|
|
@ -60,16 +60,13 @@ public class X1Activity extends BaseActivity {
|
|
|
|
Button x1Submit;
|
|
|
|
Button x1Submit;
|
|
|
|
@BindView(R.id.x1_submit2)
|
|
|
|
@BindView(R.id.x1_submit2)
|
|
|
|
Button x1Submit2;
|
|
|
|
Button x1Submit2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private boolean scanStates;
|
|
|
|
private boolean scanStates;
|
|
|
|
private List<Item> items;
|
|
|
|
private List<Item> items;
|
|
|
|
private ItemAdapter adapter;
|
|
|
|
private ItemAdapter adapter;
|
|
|
|
|
|
|
|
|
|
|
|
private ListPopupWindow lpw;
|
|
|
|
private ListPopupWindow lpw;
|
|
|
|
private List<String> planList;
|
|
|
|
private List<String> planList;
|
|
|
|
|
|
|
|
|
|
|
|
private String planId;
|
|
|
|
private String planId;
|
|
|
|
|
|
|
|
private String zbCode = null;//整包流水号
|
|
|
|
|
|
|
|
|
|
|
|
// 提交字段
|
|
|
|
// 提交字段
|
|
|
|
private X1Submit entrySubmit;
|
|
|
|
private X1Submit entrySubmit;
|
|
|
@ -89,7 +86,6 @@ public class X1Activity extends BaseActivity {
|
|
|
|
lpw.setOnItemClickListener((adapterView, view, i, l) -> {
|
|
|
|
lpw.setOnItemClickListener((adapterView, view, i, l) -> {
|
|
|
|
planId = planList.get(i);
|
|
|
|
planId = planList.get(i);
|
|
|
|
selectPlanByID(x1Code.getText().toString(), planId);
|
|
|
|
selectPlanByID(x1Code.getText().toString(), planId);
|
|
|
|
|
|
|
|
|
|
|
|
submintChildList = new ArrayList<>();
|
|
|
|
submintChildList = new ArrayList<>();
|
|
|
|
lpw.dismiss();
|
|
|
|
lpw.dismiss();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -106,17 +102,30 @@ public class X1Activity extends BaseActivity {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
x1Tong.setText(info);
|
|
|
|
x1Tong.setText(info);
|
|
|
|
if (info.contains("kg")) {
|
|
|
|
if (info.contains("kg")) {
|
|
|
|
//整包 截取 物料编码 000524-20230805-0001-CF-130|25kg
|
|
|
|
try {
|
|
|
|
String goodsCode = info.substring(0, info.indexOf("-"));
|
|
|
|
//整包 截取 物料编码 000524-20230805-0001-CF-130|25kg
|
|
|
|
//格式化重量
|
|
|
|
String goodsCode = info.substring(0, info.indexOf("-"));
|
|
|
|
String stringFormatWeight = decimalFormat.format(
|
|
|
|
//格式化重量
|
|
|
|
Double.parseDouble(info.substring(info.indexOf("|") + 1, info.indexOf("kg"))));
|
|
|
|
String stringFormatWeight = decimalFormat.format(
|
|
|
|
double goodsWeight = Double.parseDouble(stringFormatWeight);
|
|
|
|
Double.parseDouble(info.substring(info.indexOf("|") + 1, info.indexOf("kg"))));
|
|
|
|
String name1=info.substring( info.indexOf("-")+1,info.indexOf("|"));//20230805-0001-CF-130
|
|
|
|
double goodsWeight = Double.parseDouble(stringFormatWeight);
|
|
|
|
String name2=name1.substring( name1.indexOf("-")+1,name1.length());
|
|
|
|
String name1 = info.substring(info.indexOf("-") + 1, info.indexOf("|"));//20230805-0001-CF-130
|
|
|
|
String name3=name2.substring( name2.indexOf("-")+1,name2.length());
|
|
|
|
String name2 = name1.substring(name1.indexOf("-") + 1, name1.length());
|
|
|
|
Log.e("TAG", "," + name1+"," + name2+"," + name3);
|
|
|
|
String name3 = name2.substring(name2.indexOf("-") + 1, name2.length());
|
|
|
|
checkItem(goodsCode, goodsWeight, "整包", "", name3);
|
|
|
|
String lxh = name2.substring(0, name2.indexOf("-"));
|
|
|
|
|
|
|
|
Log.e("TAG", "流水号:" + lxh);
|
|
|
|
|
|
|
|
Log.e("TAG", "物料名称:" + name3);
|
|
|
|
|
|
|
|
if (zbCode == null) {
|
|
|
|
|
|
|
|
checkItem(goodsCode, goodsWeight, "整包", "", name3, lxh);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Toast.makeText(this, "物料已确认", Toast.LENGTH_SHORT).show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
Toast.makeText(this, "整包条码错误", Toast.LENGTH_SHORT).show();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//散装、查询接口
|
|
|
|
//散装、查询接口
|
|
|
|
selectGoods(info);
|
|
|
|
selectGoods(info);
|
|
|
@ -190,7 +199,6 @@ public class X1Activity extends BaseActivity {
|
|
|
|
dialog.dismiss();
|
|
|
|
dialog.dismiss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//查询 釜
|
|
|
|
//查询 釜
|
|
|
@ -274,21 +282,21 @@ public class X1Activity extends BaseActivity {
|
|
|
|
|
|
|
|
|
|
|
|
List<MaterialView> list = JSONArray.parseArray(jsonObject.get("child").toString(), MaterialView.class);
|
|
|
|
List<MaterialView> list = JSONArray.parseArray(jsonObject.get("child").toString(), MaterialView.class);
|
|
|
|
|
|
|
|
|
|
|
|
String tipTag="";
|
|
|
|
String tipTag = "";
|
|
|
|
|
|
|
|
|
|
|
|
for (MaterialView materialView : list) {
|
|
|
|
for (MaterialView materialView : list) {
|
|
|
|
if (materialView.getMatchOrNot() == 0) {
|
|
|
|
if (materialView.getMatchOrNot() == 0) {
|
|
|
|
tipTag+=materialView.getMaterialName()+"("+materialView.getMaterialBarCode()+")";
|
|
|
|
tipTag += materialView.getMaterialName() + "(" + materialView.getMaterialBarCode() + ")";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!tipTag.equals("")) {
|
|
|
|
if (!tipTag.equals("")) {
|
|
|
|
tipDialog.showMsg(false, tipTag+ " 不合格");
|
|
|
|
tipDialog.showMsg(false, tipTag + " 不合格");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (MaterialView materialView : list) {
|
|
|
|
for (MaterialView materialView : list) {
|
|
|
|
double goodsWeight = materialView.getWeight();
|
|
|
|
double goodsWeight = materialView.getWeight();
|
|
|
|
String goodsCode = materialView.getMaterialBarCode();
|
|
|
|
String goodsCode = materialView.getMaterialBarCode();
|
|
|
|
checkItem(goodsCode, goodsWeight, "散装", info, materialView.getMaterialName());
|
|
|
|
checkItem(goodsCode, goodsWeight, "散装", info, materialView.getMaterialName(), null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -306,19 +314,27 @@ public class X1Activity extends BaseActivity {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//比对
|
|
|
|
/**
|
|
|
|
private void checkItem(String goodsCode, double goodsWeight, String matType, String info, String t) {
|
|
|
|
* 比对
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param goodsCode 扫描码
|
|
|
|
|
|
|
|
* @param goodsWeight 重量
|
|
|
|
|
|
|
|
* @param matType 整包、散装
|
|
|
|
|
|
|
|
* @param info 散装码
|
|
|
|
|
|
|
|
* @param t 物料名称
|
|
|
|
|
|
|
|
* @param zbCode 整包流水号
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private void checkItem(String goodsCode, double goodsWeight, String matType, String info, String t, String zbCode) {
|
|
|
|
x1GoodsCode.setText(goodsCode);
|
|
|
|
x1GoodsCode.setText(goodsCode);
|
|
|
|
x1GoodsWeight.setText(goodsWeight + "");
|
|
|
|
x1GoodsWeight.setText(goodsWeight + "");
|
|
|
|
X1SubmintChild entrySubmitcChild = new X1SubmintChild();
|
|
|
|
X1SubmintChild entrySubmitcChild = new X1SubmintChild();
|
|
|
|
|
|
|
|
|
|
|
|
int index = -1;//目标
|
|
|
|
int index = -1;//目标
|
|
|
|
A: for (int i = 0; i < items.size(); i++) {
|
|
|
|
A:for (int i = 0; i < items.size(); i++) {
|
|
|
|
Item indexItem = items.get(i);
|
|
|
|
Item indexItem = items.get(i);
|
|
|
|
if (!indexItem.isState() && indexItem.getMaterial_Code().equals(goodsCode)) {
|
|
|
|
if (!indexItem.isState() && indexItem.getMaterial_Code().equals(goodsCode)) {
|
|
|
|
double selectWeight = indexItem.getSetWeight();
|
|
|
|
double selectWeight = indexItem.getSetWeight();//列表中的重量
|
|
|
|
double errorWeight = indexItem.getSetError();
|
|
|
|
double errorWeight = indexItem.getSetError();//误差 整包后台应该传0
|
|
|
|
Log.e("TAG", "checkItem:" + selectWeight+","+errorWeight);
|
|
|
|
Log.e("TAG", "checkItem:" + selectWeight + "," + errorWeight);
|
|
|
|
if (selectWeight - errorWeight <= goodsWeight && selectWeight + errorWeight >= goodsWeight) {
|
|
|
|
if (selectWeight - errorWeight <= goodsWeight && selectWeight + errorWeight >= goodsWeight) {
|
|
|
|
index = i;
|
|
|
|
index = i;
|
|
|
|
break A;
|
|
|
|
break A;
|
|
|
@ -339,6 +355,9 @@ public class X1Activity extends BaseActivity {
|
|
|
|
tipDialog.showState(true);
|
|
|
|
tipDialog.showState(true);
|
|
|
|
selectItem.setState(true);
|
|
|
|
selectItem.setState(true);
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
|
|
|
if (matType.equals("整包")) {
|
|
|
|
|
|
|
|
this.zbCode = zbCode;
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
tipDialog.showState(false);
|
|
|
|
tipDialog.showState(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|