xiugai 读取

idata
wanghao 5 months ago
parent bdea369f5b
commit 586a4a2c41

@ -4,7 +4,6 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="delegatedBuild" value="true" />
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />

@ -51,20 +51,16 @@
<activity
android:name=".HomePageActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:exported="true">
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

@ -25,10 +25,12 @@ import com.google.gson.reflect.TypeToken;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
public class CheckActivity extends BaseActivity implements AdapterClickCall, InPutDialog.InPutDialogCall {
private ActivityCheckBinding binding;
private CheckAdapter adapter;
@ -37,6 +39,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
private ObservableBoolean state;
private ObservableBoolean checkState;
private InPutDialog inputDialog;
private boolean sanType;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -45,26 +48,27 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
adapter = new CheckAdapter(this, this);
state = new ObservableBoolean();
checkState = new ObservableBoolean();
binding.setAdapter(adapter);
binding.setState(state);
binding.setCheckState(checkState);
selectList = Arrays.asList(getResources().getStringArray(R.array.check_item));
binding.checkItemSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
var selectItem = selectList.get(position);
state.set(selectItem.equals("正常"));
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
// binding.checkItemSelect.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
// @Override
// public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// var selectItem = selectList.get(position);
// state.set(selectItem.equals("正常"));
// }
//
// @Override
// public void onNothingSelected(AdapterView<?> parent) {
//
// }
// });
initRequest();
inputDialog = new InPutDialog(this);
inputDialog.setInPutDialogCall(this);
tagList = new ArrayList<>();
}
// 初始化数据
@ -90,20 +94,39 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
});
}
private List<String> tagList;
private int subIndex = -1;
// 扫描一个验证
// 扫描到返回数据
@Override
protected void sanRfid(List<String> epcs) {
var text = epcs.get(0);
binding.checkEpc.setText(text);
Stock stock = new Stock();
stock.setEpcCode(text);
var index = list.indexOf(stock);
if (index == -1) {
Toast.makeText(this, "轮挡扫描错误", Toast.LENGTH_SHORT).show();
return;
}
subIndex = index;
// var text = epcs.get(0);
// binding.checkEpc.setText(text);
// Stock stock = new Stock();
// stock.setEpcCode(text);
// var index = list.indexOf(stock);
// if (index == -1) {
// Toast.makeText(this, "轮挡扫描错误", Toast.LENGTH_SHORT).show();
// return;
// }
// subIndex = index;
epcs.forEach(t -> {
if (tagList.contains(t)) {
return;
}
tagList.add(t);
var stock = new Stock();
stock.setEpcCode(t);
var index = list.indexOf(stock);
if (index != -1) {
list.get(index).setState("正常");
}
});
adapter.notifyDataSetChanged();
}
//提交数据
@ -124,15 +147,15 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
});
}
// 一条数据保存
public void check_stock(View view) {
if (subIndex == -1) return;
var stock = list.get(subIndex);
stock.setState(binding.checkItemSelect.getSelectedItem().toString());
stock.setRemark(binding.checkRemark.getText().toString());
adapter.notifyItemChanged(subIndex);
binding.checkRemark.setText(null);
binding.checkEpc.setText(null);
}
// public void check_stock(View view) {
// if (subIndex == -1) return;
// var stock = list.get(subIndex);
// stock.setState(binding.checkItemSelect.getSelectedItem().toString());
// stock.setRemark(binding.checkRemark.getText().toString());
// adapter.notifyItemChanged(subIndex);
// binding.checkRemark.setText(null);
// binding.checkEpc.setText(null);
// }
private int tag;
@ -151,6 +174,7 @@ public class CheckActivity extends BaseActivity implements AdapterClickCall, InP
inputDialog.dismiss();
adapter.notifyDataSetChanged();
}
// 持续扫描按钮
public void offCheckRead(View view) {
var b = checkState.get();

@ -45,7 +45,6 @@ public class FpInActivity extends BaseActivity {
if (body.getCode()==0){
LedgerRfid ledgerRfid=gson.fromJson(body.getData().toString(),LedgerRfid.class);
vm.setBichCode(ledgerRfid.getBatchCode());
vm.setLocation(ledgerRfid.getLocationType());
vm.setLocationCode(ledgerRfid.getLocationCode());
vm.setState(ledgerRfid.getDictLabel());

@ -71,8 +71,8 @@ public class HomePageActivity extends AppCompatActivity {
list.add(new HomeIcon(R.mipmap.home_in1, "轮挡入库", InActivity.class));
list.add(new HomeIcon(R.mipmap.home_out1, "轮挡领用出库", OutActivity.class));
list.add(new HomeIcon(R.mipmap.home_store_check, "仓库盘点", StoreCheckActivity.class));
list.add(new HomeIcon(R.mipmap.home_check, "轮挡", CheckActivity.class));
list.add(new HomeIcon(R.mipmap.home_check, "轮挡巡检", OffLineCheckActivity.class));
list.add(new HomeIcon(R.mipmap.home_check, "轮挡检", CheckActivity.class));
// list.add(new HomeIcon(R.mipmap.home_check, "轮挡巡检", OffLineCheckActivity.class));
list.add(new HomeIcon(R.mipmap.home_bf, "轮挡报废", BFActivity.class));
list.add(new HomeIcon(R.mipmap.home_in, "废品入库", FpInActivity.class));
list.add(new HomeIcon(R.mipmap.home_out, "废品出库", FpOutActivity.class));

@ -25,8 +25,8 @@ import java.util.List;
import okhttp3.MediaType;
public abstract class BaseActivity extends AppCompatActivity {
public static String url = "http://192.168.0.102:8090/api";
// public static String url = "http://175.27.215.92:8090/api";
// public static String url = "http://192.168.0.102:8090/api";
public static String url = "http://175.27.215.92:8090/api";
public ProgressDialog dialog;
public Gson gson;
public MediaType JSON = MediaType.parse("application/json; charset=utf-8");

@ -44,9 +44,10 @@
android:layout_height="450dp"
android:adapter="@{adapter}"
android:padding="10dp"
android:layout_weight="1"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
<LinearLayout
<!-- <LinearLayout
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginTop="10dp">
@ -110,14 +111,14 @@
android:layout_gravity="center"
android:minHeight="48dp" />
</LinearLayout>
<Button
style="@style/button_style"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:onClick="check_stock"
android:text="单次提交" />
android:text="单次提交" />-->
<LinearLayout

Loading…
Cancel
Save