From f8b61fef0390585199fd2b10b7e266985f6a5847 Mon Sep 17 00:00:00 2001
From: wangh <123456>
Date: Mon, 20 Nov 2023 10:41:31 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=B6=B2=E4=BD=93?=
=?UTF-8?q?=E7=A7=B0=E9=87=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/build.gradle | 4 +-
app/release/output-metadata.json | 2 +-
app/src/main/AndroidManifest.xml | 1 +
.../java/com/example/pulit/MainActivity.java | 6 +-
.../com/example/pulit/SolventActivity.java | 48 ++++--
.../java/com/example/pulit/X1Activity.java | 148 ++++++++++++------
.../java/com/example/pulit/ZBActivity.java | 129 +++++++++++++++
.../java/com/example/pulit/entity/Item.java | 2 +-
.../example/pulit/entity/MaterialView.java | 63 ++++++++
.../example/pulit/entity/X1SubmintChild.java | 69 ++++++++
.../com/example/pulit/entity/X1Submit.java | 45 ++----
app/src/main/res/layout/activity_main.xml | 6 +-
app/src/main/res/layout/activity_solvent.xml | 1 +
app/src/main/res/layout/activity_x1.xml | 29 +++-
app/src/main/res/layout/activity_x2.xml | 2 +-
app/src/main/res/layout/activity_zb.xml | 118 ++++++++++++++
16 files changed, 559 insertions(+), 114 deletions(-)
create mode 100644 app/src/main/java/com/example/pulit/ZBActivity.java
create mode 100644 app/src/main/java/com/example/pulit/entity/MaterialView.java
create mode 100644 app/src/main/java/com/example/pulit/entity/X1SubmintChild.java
create mode 100644 app/src/main/res/layout/activity_zb.xml
diff --git a/app/build.gradle b/app/build.gradle
index 8a3e2f3..3009a04 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,7 +10,7 @@ android {
applicationId "com.example.pulit"
minSdkVersion 26
targetSdkVersion 30
- versionCode 7
+ versionCode 11
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -42,6 +42,8 @@ dependencies {
implementation 'com.alibaba.fastjson2:fastjson2:2.0.38'
// https://mvnrepository.com/artifact/com.android.volley/volley
implementation 'com.android.volley:volley:1.2.1'
+// https://mvnrepository.com/artifact/com.google.code.gson/gson
+ implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.lzy.net:okgo:3.0.4'
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
index cd3405a..0e772c4 100644
--- a/app/release/output-metadata.json
+++ b/app/release/output-metadata.json
@@ -10,7 +10,7 @@
{
"type": "SINGLE",
"filters": [],
- "versionCode": 6,
+ "versionCode": 11,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 541095f..a0ca3bd 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -16,6 +16,7 @@
android:theme="@style/Theme.PuLiT"
android:usesCleartextTraffic="true">
+
diff --git a/app/src/main/java/com/example/pulit/MainActivity.java b/app/src/main/java/com/example/pulit/MainActivity.java
index 0c849a7..38bcf3f 100644
--- a/app/src/main/java/com/example/pulit/MainActivity.java
+++ b/app/src/main/java/com/example/pulit/MainActivity.java
@@ -52,9 +52,9 @@ public class MainActivity extends AppCompatActivity {
case R.id.home_rj_t:
intent = new Intent(this, So2Activity.class);
break;
-// case R.id.home_plan:
-// intent = new Intent(this, PlanActivity.class);
-// break;
+ case R.id.home_plan:
+ intent = new Intent(this, ZBActivity.class);
+ break;
case R.id.home_setting:
textDialog.setIpAddress(SharedPreferencesUtils.getstring("ip", null));
textDialog.show();
diff --git a/app/src/main/java/com/example/pulit/SolventActivity.java b/app/src/main/java/com/example/pulit/SolventActivity.java
index 1b1005f..77b7932 100644
--- a/app/src/main/java/com/example/pulit/SolventActivity.java
+++ b/app/src/main/java/com/example/pulit/SolventActivity.java
@@ -39,41 +39,46 @@ public class SolventActivity extends BaseActivity {
TextView solventGoodslv;
@BindView(R.id.solvent_goodslv_state)
LinearLayout solventGoodslvState;
-
- private boolean sanType;
- private boolean sanLvType;
+ private int sanType;
+ private boolean exist;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_solvent);
ButterKnife.bind(this);
- sanType = true;
- sanLvType = false;
+ sanType = 0;
+
}
private PlanView planView;
@Override
public void scanInfo(String info) {
- if (sanLvType) {
- solventGoodslv.setText(info.replace("%", "").trim());
- } else {
- if (sanType) {
+
+ switch (sanType) {
+ case 0:
dialog.show();
solventCode.setText(info);
String dbName = solventDb.getSelectedItem().toString();
selectSup(info, dbName);
- } else {
+ break;
+ case 1:
try {
checkGoods(info);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, "条码格式错误", Toast.LENGTH_SHORT).show();
}
- }
+ break;
+ case 2:
+ solventGoodslv.setText(info.replace("%", "").trim());
+ break;
+
}
+
+
}
@OnClick({R.id.info_title_back, R.id.solvent_scan, R.id.solvent_submit})
@@ -88,7 +93,7 @@ public class SolventActivity extends BaseActivity {
case R.id.solvent_submit:
if (planView == null) return;
String string1 = solventGoodslv.getText().toString();
- if (sanLvType && string1.isEmpty()) {
+ if (exist && string1.isEmpty()) {
Toast.makeText(this, "必须扫描固含率", Toast.LENGTH_SHORT).show();
return;
}
@@ -98,7 +103,7 @@ public class SolventActivity extends BaseActivity {
dialog.show();
planView.setWeighbridge(dbaname);
planView.setCylinderBarCode(string);
- planView.setRate(string1);
+ planView.setRate(string1.isEmpty()?"0":string1);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"),
JSONObject.toJSONString(planView));
OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState")
@@ -110,7 +115,14 @@ public class SolventActivity extends BaseActivity {
dialog.dismiss();
Toast.makeText(SolventActivity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show();
if (response.body().isSuccess()) {
- finish();
+ sanType=0;
+ solventCode.setText(null);
+ solventGoodsCode.setText(null);
+ planView=null;
+ solventGoodsName.setText(null);
+ solventGoodslv.setText(null);
+ solventGoodslvState.setVisibility(View.GONE);
+
}
}
@@ -139,12 +151,13 @@ public class SolventActivity extends BaseActivity {
String substring = body.substring(body.indexOf(":{") + 1, body.length() - 1);
planView = JSONObject.parseObject(substring, PlanView.class);
Log.e("TAG", "onSuccess:" + planView.toString());
- if (planView.isExist()) {
+ exist = planView.isExist();
+ if (exist) {
solventGoodslvState.setVisibility(View.VISIBLE);
}
Toast.makeText(SolventActivity.this, "查询成功", Toast.LENGTH_SHORT).show();
- sanType = false;
+ sanType = 1;//扫描物料
} else {
Toast.makeText(SolventActivity.this, resust.getMsg(), Toast.LENGTH_SHORT).show();
}
@@ -182,7 +195,8 @@ public class SolventActivity extends BaseActivity {
if (planView.getMaterial_code().equals(goodsCode)) {
planView.setState(1);
tipDialog.showState(true);
- sanLvType = true;
+ sanType= exist?2:1;
+
} else {
planView.setState(0);
tipDialog.showState(false);
diff --git a/app/src/main/java/com/example/pulit/X1Activity.java b/app/src/main/java/com/example/pulit/X1Activity.java
index d0c567d..00f12b6 100644
--- a/app/src/main/java/com/example/pulit/X1Activity.java
+++ b/app/src/main/java/com/example/pulit/X1Activity.java
@@ -4,6 +4,7 @@ import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListPopupWindow;
import android.widget.TextView;
@@ -13,18 +14,22 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.example.pulit.adapter.ItemAdapter;
import com.example.pulit.entity.Item;
+import com.example.pulit.entity.MaterialView;
import com.example.pulit.entity.X1;
+import com.example.pulit.entity.X1SubmintChild;
import com.example.pulit.entity.X1Submit;
import com.example.pulit.util.MyOkGoCallback;
import com.example.pulit.util.Resust;
import com.example.pulit.util.SharedPreferencesUtils;
+import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
@@ -47,30 +52,45 @@ public class X1Activity extends BaseActivity {
TextView x1GoodsWeight;
@BindView(R.id.x1_code1)
LinearLayout x1Code1;
+ @BindView(R.id.x1_plan_code)
+ TextView x1PlanCode;
+ @BindView(R.id.x1_scan)
+ Button x1Scan;
+ @BindView(R.id.x1_submit)
+ Button x1Submit;
+ @BindView(R.id.x1_submit2)
+ Button x1Submit2;
private boolean scanStates;
private List- items;
private ItemAdapter adapter;
- private X1Submit entrySubmit;
+
private ListPopupWindow lpw;
private List planList;
- private String kcode;
- private int station;
- private String pianId;
+
+ private String planId;
+
+ // 提交字段
+ private X1Submit entrySubmit;
+ private List submintChildList;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_x1);
ButterKnife.bind(this);
+ entrySubmit = new X1Submit();
scanStates = true;
x1RecyclerView.setLayoutManager(new LinearLayoutManager(this));
adapter = new ItemAdapter(this);
lpw = new ListPopupWindow(this);
- lpw.setAnchorView(x1Code1);
+ lpw.setAnchorView(x1PlanCode);
lpw.setOnItemClickListener((adapterView, view, i, l) -> {
- String planId = planList.get(i);
+ planId = planList.get(i);
selectPlanByID(x1Code.getText().toString(), planId);
+
+ submintChildList = new ArrayList<>();
lpw.dismiss();
});
}
@@ -86,13 +106,17 @@ public class X1Activity extends BaseActivity {
} else {
x1Tong.setText(info);
if (info.contains("kg")) {
- //整包 截取 物料编码
+ //整包 截取 物料编码 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"))));
double goodsWeight = Double.parseDouble(stringFormatWeight);
- checkItem(goodsCode, goodsWeight, "整包", info);
+ String name1=info.substring( info.indexOf("-")+1,info.indexOf("|"));//20230805-0001-CF-130
+ String name2=name1.substring( name1.indexOf("-")+1,name1.length());
+ String name3=name2.substring( name2.indexOf("-")+1,name2.length());
+ Log.e("TAG", "," + name1+"," + name2+"," + name3);
+ checkItem(goodsCode, goodsWeight, "整包", "", name3);
} else {
//散装、查询接口
selectGoods(info);
@@ -104,7 +128,7 @@ public class X1Activity extends BaseActivity {
}
- @OnClick({R.id.info_title_back, R.id.x1_scan, R.id.x1_submit, R.id.x1_submit2})
+ @OnClick({R.id.info_title_back, R.id.x1_scan, R.id.x1_submit, R.id.x1_submit2, R.id.x1_plan_code})
public void onClick(View view) {
switch (view.getId()) {
case R.id.info_title_back:
@@ -115,8 +139,8 @@ public class X1Activity extends BaseActivity {
break;
case R.id.x1_submit:
if (entrySubmit == null) return;
- for(Item item:items){
- if (!item.isState()){
+ for (Item item : items) {
+ if (!item.isState()) {
Toast.makeText(this, "还有物料未验证", Toast.LENGTH_SHORT).show();
return;
}
@@ -127,7 +151,9 @@ public class X1Activity extends BaseActivity {
if (entrySubmit == null) return;
submit(entrySubmit, 0);
break;
-
+ case R.id.x1_plan_code:
+ lpw.show();
+ break;
}
}
@@ -135,8 +161,10 @@ public class X1Activity extends BaseActivity {
//提交
private void submit(X1Submit entrySubmit, int state) {
dialog.show();
+ entrySubmit.setkCode(x1Code.getText().toString());
entrySubmit.setState(state);
- entrySubmit.setPlanId(pianId);
+ entrySubmit.setPlanId(planId);
+ entrySubmit.setChild(submintChildList);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"),
JSONObject.toJSONString(entrySubmit));
OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Warehouse/ExecPlcState")
@@ -179,9 +207,9 @@ public class X1Activity extends BaseActivity {
lpw.setAdapter(new ArrayAdapter(X1Activity.this,
R.layout.support_simple_spinner_dropdown_item,
planList));
- lpw.show();
+ tipDialog.showMsg(true, "查询成功,请选择计划");
} else {
- Toast.makeText(X1Activity.this, "请求失败,条码不正确", Toast.LENGTH_SHORT).show();
+ Toast.makeText(X1Activity.this, "请求失败,反应釜条码不正确", Toast.LENGTH_SHORT).show();
}
}
@@ -197,6 +225,7 @@ public class X1Activity extends BaseActivity {
//查询计划中的物料
private void selectPlanByID(String code, String planID) {
+ x1PlanCode.setText(planID);
OkGo.get("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Warehouse/GetByCode")
.params("code", code)
.params("planId", planID)
@@ -207,15 +236,16 @@ public class X1Activity extends BaseActivity {
dialog.dismiss();
if (response.body().isSuccess()) {
X1 x1 = JSONObject.parseObject(response.body().getData(), X1.class);
- station = x1.getID();//
- kcode = x1.getBarCode();//
+ entrySubmit.setStation(x1.getID());//提交的字段
items = x1.getChildren();
- pianId = x1.getPlanId();
adapter.setList(items);
x1RecyclerView.setAdapter(adapter);
scanStates = false;//扫描
+ x1Tong.setText(null);
+ x1GoodsCode.setText(null);
+ x1GoodsWeight.setText(null);
} else {
- Toast.makeText(X1Activity.this, "请求失败,条码不正确", Toast.LENGTH_SHORT).show();
+ Toast.makeText(X1Activity.this, "请求失败,计划条码不正确", Toast.LENGTH_SHORT).show();
}
}
@@ -232,16 +262,35 @@ public class X1Activity extends BaseActivity {
//查询散装
private void selectGoods(String info) {
OkGo.get("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Warehouse/GetByBarrelInfo")
+ .params("kettleBarCode", x1Code.getText().toString())
+ .params("planId", planId)
.params("code", info)
.execute(new MyOkGoCallback() {
@Override
public void onSuccess(Response response) {
super.onSuccess(response);
if (response.body().isSuccess()) {
- JSONObject obj = response.body().getDateObj();
- double goodsWeight = obj.getDoubleValue("Weight");
- String goodsCode = obj.getString("MaterialID");
- checkItem(goodsCode, goodsWeight, "散装", info);
+ JSONObject jsonObject = JSONObject.parseObject(response.body().getData());
+
+ List list = JSONArray.parseArray(jsonObject.get("child").toString(), MaterialView.class);
+
+ String tipTag="";
+
+ for (MaterialView materialView : list) {
+ if (materialView.getMatchOrNot() == 0) {
+ tipTag+=materialView.getMaterialName()+"("+materialView.getMaterialBarCode()+")";
+ }
+ }
+ if (!tipTag.equals("")) {
+ tipDialog.showMsg(false, tipTag+ " 不合格");
+ return;
+ }
+ for (MaterialView materialView : list) {
+ double goodsWeight = materialView.getWeight();
+ String goodsCode = materialView.getMaterialBarCode();
+ checkItem(goodsCode, goodsWeight, "散装", info, materialView.getMaterialName());
+ }
+
} else {
Toast.makeText(X1Activity.this, "查询失败,条码不正确", Toast.LENGTH_SHORT).show();
x1GoodsCode.setText(null);
@@ -258,37 +307,42 @@ public class X1Activity extends BaseActivity {
}
//比对
- private void checkItem(String goodsCode, double goodsWeight, String matType, String info) {
+ private void checkItem(String goodsCode, double goodsWeight, String matType, String info, String t) {
x1GoodsCode.setText(goodsCode);
x1GoodsWeight.setText(goodsWeight + "");
- entrySubmit = new X1Submit();
- Item item = new Item();
- item.setMaterial_Code(goodsCode);
- int index = items.indexOf(item);
+ X1SubmintChild entrySubmitcChild = new X1SubmintChild();
+
+ int index = -1;//目标
+ A: for (int i = 0; i < items.size(); i++) {
+ Item indexItem = items.get(i);
+ if (!indexItem.isState() && indexItem.getMaterial_Code().equals(goodsCode)) {
+ double selectWeight = indexItem.getSetWeight();
+ double errorWeight = indexItem.getSetError();
+ Log.e("TAG", "checkItem:" + selectWeight+","+errorWeight);
+ if (selectWeight - errorWeight <= goodsWeight && selectWeight + errorWeight >= goodsWeight) {
+ index = i;
+ break A;
+ }
+ }
+ }
+
//验证
if (index != -1) {
Item selectItem = items.get(index);
- double selectWeight = selectItem.getSetWeight();
- double errorWeight = selectItem.getSetError();
- if (selectWeight - errorWeight <= goodsWeight && selectWeight + errorWeight >= goodsWeight) {
- entrySubmit.setState(1);
- tipDialog.showState(true);
- selectItem.setState(true);
- adapter.notifyDataSetChanged();
- } else {
- tipDialog.showState(false);
- entrySubmit.setState(2);
- }
+ entrySubmitcChild.setMatType(matType);
+ entrySubmitcChild.setMatCode(goodsCode);
+ entrySubmitcChild.setMatName(t);
+ entrySubmitcChild.setMatWeight(goodsWeight);
+ entrySubmitcChild.setWholePackage("string");
+ entrySubmitcChild.setBarrelCode(info);
+ submintChildList.add(entrySubmitcChild);
+ tipDialog.showState(true);
+ selectItem.setState(true);
+ adapter.notifyDataSetChanged();
} else {
tipDialog.showState(false);
- entrySubmit.setState(2);
}
- entrySubmit.setkCode(kcode);
- entrySubmit.setStation(station);
- entrySubmit.setMatWeight(goodsWeight);
- entrySubmit.setMatCode(goodsCode);
- entrySubmit.setMatType(matType);
- entrySubmit.setWholePackage(info);
+
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/pulit/ZBActivity.java b/app/src/main/java/com/example/pulit/ZBActivity.java
new file mode 100644
index 0000000..d763256
--- /dev/null
+++ b/app/src/main/java/com/example/pulit/ZBActivity.java
@@ -0,0 +1,129 @@
+package com.example.pulit;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.example.pulit.entity.PlanView;
+import com.example.pulit.util.MyOkGoCallback;
+import com.example.pulit.util.Resust;
+import com.example.pulit.util.SharedPreferencesUtils;
+import com.lzy.okgo.OkGo;
+import com.lzy.okgo.callback.StringCallback;
+import com.lzy.okgo.model.Response;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+import okhttp3.MediaType;
+import okhttp3.RequestBody;
+
+public class ZBActivity extends BaseActivity {
+
+
+ @BindView(R.id.zb_db)
+ Spinner zbDb;
+ @BindView(R.id.zb_goods_code)
+ TextView zbGoodsCode;
+ @BindView(R.id.zb_goodsName)
+ TextView zbGoodsName;
+ private int sanType;
+ private boolean exist;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_zb);
+ ButterKnife.bind(this);
+ sanType = 0;
+
+ }
+
+ private PlanView planView;
+
+ @Override
+ public void scanInfo(String info) {
+
+ try {
+ checkGoods(info);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Toast.makeText(this, "条码格式错误", Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ @OnClick({R.id.info_title_back, R.id.zb_scan, R.id.zb_submit})
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.info_title_back:
+ finish();
+ break;
+ case R.id.zb_scan:
+ super.sanCode();
+ break;
+ case R.id.zb_submit:
+ if (planView == null) return;
+ String dbaname = zbDb.getSelectedItem().toString();
+ dialog.show();
+ planView.setWeighbridge(dbaname);
+ planView.setCylinderBarCode("00000000");
+ planView.setRate( "0" );
+ RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"),
+ JSONObject.toJSONString(planView));
+ OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState")
+ .upRequestBody(requestBody)
+ .execute(new MyOkGoCallback() {
+ @Override
+ public void onSuccess(Response response) {
+ super.onSuccess(response);
+ dialog.dismiss();
+ Toast.makeText(ZBActivity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show();
+ if (response.body().isSuccess()) {
+ sanType = 0;
+ zbGoodsCode.setText(null);
+ planView = null;
+ zbGoodsName.setText(null);
+
+ }
+ }
+
+ @Override
+ public void onError(Response response) {
+ super.onError(response);
+ dialog.dismiss();
+ Toast.makeText(ZBActivity.this, "网络请求失败", Toast.LENGTH_SHORT).show();
+ }
+ });
+ break;
+ }
+ }
+
+
+ private void checkGoods(String scanInfo) {
+ planView=new PlanView();
+ zbGoodsCode.setText(scanInfo);
+ //物料编码
+ String goodsCode = scanInfo.substring(0, scanInfo.indexOf("-"));
+ Log.e("TAG", "scanInfo:" + goodsCode);
+ planView.setCode(goodsCode);
+ //品名
+ int index = scanInfo.indexOf("-", scanInfo.indexOf("-", scanInfo.indexOf("-") + 1) + 1) + 1;
+ int endIndex = scanInfo.indexOf("|");
+ String goodsName = scanInfo.substring(index, endIndex);
+ Log.e("TAG", "scanInfo:" + goodsName);
+ planView.setMaterialName(goodsName);
+ zbGoodsName.setText(goodsName);
+ //重量
+ String format = decimalFormat.format(
+ Double.parseDouble(scanInfo.substring(scanInfo.indexOf("|") + 1, scanInfo.indexOf("kg"))));
+ double weight = Double.parseDouble(format);
+ planView.setMaterialWeight(weight);
+ planView.setWholeMaterial(scanInfo);
+ planView.setState(1);
+
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/pulit/entity/Item.java b/app/src/main/java/com/example/pulit/entity/Item.java
index 94419da..af384e3 100644
--- a/app/src/main/java/com/example/pulit/entity/Item.java
+++ b/app/src/main/java/com/example/pulit/entity/Item.java
@@ -13,7 +13,7 @@ public class Item {
private double SetWeight;
private double SetError;
private boolean state=false;
-
+ private boolean Fixed;
public double getSetError() {
return SetError;
}
diff --git a/app/src/main/java/com/example/pulit/entity/MaterialView.java b/app/src/main/java/com/example/pulit/entity/MaterialView.java
new file mode 100644
index 0000000..2959686
--- /dev/null
+++ b/app/src/main/java/com/example/pulit/entity/MaterialView.java
@@ -0,0 +1,63 @@
+package com.example.pulit.entity;
+
+/**
+ * @author wanghao
+ * @date 2023/11/15 16:24
+ */
+public class MaterialView {
+ private String MaterialID;
+ private String MaterialBarCode;
+ private String MaterialName;
+ private double Weight;
+ private double Error;
+ private int MatchOrNot;
+
+ public String getMaterialID() {
+ return MaterialID;
+ }
+
+ public void setMaterialID(String materialID) {
+ MaterialID = materialID;
+ }
+
+ public String getMaterialBarCode() {
+ return MaterialBarCode;
+ }
+
+ public void setMaterialBarCode(String materialBarCode) {
+ MaterialBarCode = materialBarCode;
+ }
+
+ public String getMaterialName() {
+ return MaterialName;
+ }
+
+ public void setMaterialName(String materialName) {
+ MaterialName = materialName;
+ }
+
+ public double getWeight() {
+ return Weight;
+ }
+
+ public void setWeight(double weight) {
+ Weight = weight;
+ }
+
+ public double getError() {
+ return Error;
+ }
+
+ public void setError(double error) {
+ Error = error;
+ }
+
+ public int getMatchOrNot() {
+ return MatchOrNot;
+ }
+
+ public void setMatchOrNot(int matchOrNot) {
+ MatchOrNot = matchOrNot;
+ }
+
+}
diff --git a/app/src/main/java/com/example/pulit/entity/X1SubmintChild.java b/app/src/main/java/com/example/pulit/entity/X1SubmintChild.java
new file mode 100644
index 0000000..c0b8d8a
--- /dev/null
+++ b/app/src/main/java/com/example/pulit/entity/X1SubmintChild.java
@@ -0,0 +1,69 @@
+package com.example.pulit.entity;
+
+/**
+ * @author wanghao
+ * @date 2023/11/15 16:48
+ */
+public class X1SubmintChild {
+// "matType": "散装",
+// "barrelCode": "CZLC0009",
+// "matCode": "84012",
+// "matName": "84012",
+// "matWeight": 2.000,//实际重量,从料桶获取
+// "wholePackage": "string"
+
+ private String matType;// 物料类型:整包、散装
+ private String barrelCode;
+ private String matCode;// 物料条码
+ private String matName;
+ private double matWeight;//物料重量
+ private String wholePackage;
+
+ public String getMatType() {
+ return matType;
+ }
+
+ public void setMatType(String matType) {
+ this.matType = matType;
+ }
+
+ public String getBarrelCode() {
+ return barrelCode;
+ }
+
+ public void setBarrelCode(String barrelCode) {
+ this.barrelCode = barrelCode;
+ }
+
+ public String getMatCode() {
+ return matCode;
+ }
+
+ public void setMatCode(String matCode) {
+ this.matCode = matCode;
+ }
+
+ public String getMatName() {
+ return matName;
+ }
+
+ public void setMatName(String matName) {
+ this.matName = matName;
+ }
+
+ public double getMatWeight() {
+ return matWeight;
+ }
+
+ public void setMatWeight(double matWeight) {
+ this.matWeight = matWeight;
+ }
+
+ public String getWholePackage() {
+ return wholePackage;
+ }
+
+ public void setWholePackage(String wholePackage) {
+ this.wholePackage = wholePackage;
+ }
+}
diff --git a/app/src/main/java/com/example/pulit/entity/X1Submit.java b/app/src/main/java/com/example/pulit/entity/X1Submit.java
index 1958800..86f93ef 100644
--- a/app/src/main/java/com/example/pulit/entity/X1Submit.java
+++ b/app/src/main/java/com/example/pulit/entity/X1Submit.java
@@ -1,18 +1,17 @@
package com.example.pulit.entity;
+import java.util.List;
+
/**
* @author wanghao
* @date 2023/8/8 11:20
*/
public class X1Submit {
private int station;// 釜工位——主键
+ private String PlanId; //计划ID
private String kCode;// 投料釜条码
- private String matCode;// 物料条码
- private double matWeight;//物料重量
- private String matType;// 物料类型:整包、散装
private int state;//状态 0:未扫描 1:匹配 2:报警
- private String wholePackage;
- private String PlanId; //计划ID
+ private List child;
public String getPlanId() {
@@ -39,29 +38,6 @@ public class X1Submit {
this.kCode = kCode;
}
- public String getMatCode() {
- return matCode;
- }
-
- public void setMatCode(String matCode) {
- this.matCode = matCode;
- }
-
- public double getMatWeight() {
- return matWeight;
- }
-
- public void setMatWeight(double matWeight) {
- this.matWeight = matWeight;
- }
-
- public String getMatType() {
- return matType;
- }
-
- public void setMatType(String matType) {
- this.matType = matType;
- }
public int getState() {
return state;
@@ -71,16 +47,13 @@ public class X1Submit {
this.state = state;
}
-
-
-
-
- public String getWholePackage() {
- return wholePackage;
+ public List getChild() {
+ return child;
}
- public void setWholePackage(String wholePackage) {
- this.wholePackage = wholePackage;
+ public void setChild(List child) {
+ this.child = child;
}
+
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 8af27ce..7d75bde 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -72,12 +72,12 @@
style="@style/TabRadioButton"
android:drawableTop="@mipmap/home_rj"
android:text="液体核对" />
+
-
+ android:drawableTop="@mipmap/home_zb"
+ android:text="整包称量" />
diff --git a/app/src/main/res/layout/activity_x1.xml b/app/src/main/res/layout/activity_x1.xml
index 54430c7..90e5799 100644
--- a/app/src/main/res/layout/activity_x1.xml
+++ b/app/src/main/res/layout/activity_x1.xml
@@ -34,7 +34,7 @@
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_marginStart="10dp"
- android:layout_marginTop="20dp"
+ android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:orientation="horizontal">
@@ -51,7 +51,28 @@
android:layout_height="match_parent"
android:layout_marginLeft="10dp"/>
+
+
+
+
+
@@ -111,7 +132,7 @@
android:layout_width="match_parent"
android:layout_height="46dp"
android:layout_marginStart="10dp"
- android:layout_marginTop="20dp"
+ android:layout_marginTop="10dp"
android:layout_marginEnd="10dp"
android:orientation="horizontal">
@@ -134,7 +155,7 @@
style="@style/button_style1"
android:layout_width="match_parent"
android:layout_height="54dp"
- android:layout_marginStart="20dp"
+ android:layout_marginStart="10dp"
android:layout_marginTop="22dp"
android:layout_marginEnd="20dp"
android:text="触发扫描" />
diff --git a/app/src/main/res/layout/activity_x2.xml b/app/src/main/res/layout/activity_x2.xml
index be85791..990299a 100644
--- a/app/src/main/res/layout/activity_x2.xml
+++ b/app/src/main/res/layout/activity_x2.xml
@@ -180,5 +180,5 @@
android:layout_marginTop="22dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="22dp"
- android:text="补料完毕" />
+ android:text="开启仓门" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_zb.xml b/app/src/main/res/layout/activity_zb.xml
new file mode 100644
index 0000000..1f718ee
--- /dev/null
+++ b/app/src/main/res/layout/activity_zb.xml
@@ -0,0 +1,118 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file