diff --git a/app/build.gradle b/app/build.gradle
index 3009a04..1117d69 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,7 +10,7 @@ android {
applicationId "com.example.pulit"
minSdkVersion 26
targetSdkVersion 30
- versionCode 11
+ versionCode 13
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
index 0e772c4..e208b83 100644
--- a/app/release/output-metadata.json
+++ b/app/release/output-metadata.json
@@ -10,7 +10,7 @@
{
"type": "SINGLE",
"filters": [],
- "versionCode": 11,
+ "versionCode": 13,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a0ca3bd..3bcd4f4 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -15,8 +15,9 @@
android:supportsRtl="true"
android:theme="@style/Theme.PuLiT"
android:usesCleartextTraffic="true">
-
-
+
+
+
diff --git a/app/src/main/java/com/example/pulit/LtActivity.java b/app/src/main/java/com/example/pulit/LtActivity.java
new file mode 100644
index 0000000..b58f301
--- /dev/null
+++ b/app/src/main/java/com/example/pulit/LtActivity.java
@@ -0,0 +1,71 @@
+package com.example.pulit;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.appcompat.app.AppCompatActivity;
+
+import com.alibaba.fastjson2.JSONObject;
+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.model.Response;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+
+public class LtActivity extends BaseActivity {
+
+ @BindView(R.id.lt_code)
+ TextView ltCode;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_lt);
+ ButterKnife.bind(this);
+ }
+
+ @Override
+ public void scanInfo(String info) {
+ ltCode.setText(info);
+ dialog.show();
+ OkGo.get("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/xl_material/MaterialVerification")
+ .params("barCode", info)
+ .execute(new MyOkGoCallback() {
+ @Override
+ public void onSuccess(Response response) {
+ super.onSuccess(response);
+ dialog.dismiss();
+
+ Resust body = response.body();
+ tipDialog.showMsg(body.isSuccess(), body.getMsg());
+
+ }
+
+ @Override
+ public void onError(Response response) {
+ super.onError(response);
+ dialog.dismiss();
+ Toast.makeText(LtActivity.this, "网络请求失败", Toast.LENGTH_SHORT).show();
+ }
+ });
+ }
+
+ @OnClick({R.id.lt_title_back, R.id.lt_scan})
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.lt_title_back:
+ this.finish();
+ break;
+ case R.id.lt_scan:
+ super.sanCode();
+ break;
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/pulit/MainActivity.java b/app/src/main/java/com/example/pulit/MainActivity.java
index 38bcf3f..76802a0 100644
--- a/app/src/main/java/com/example/pulit/MainActivity.java
+++ b/app/src/main/java/com/example/pulit/MainActivity.java
@@ -33,7 +33,7 @@ public class MainActivity extends AppCompatActivity {
@OnClick({R.id.home_xl_b, R.id.home_xl_t, R.id.home_xl_z, R.id.home_rj_c, R.id.home_rj_t,
- R.id.home_setting, R.id.home_back, R.id.home_plan})
+ R.id.home_setting,R.id.home_lt, R.id.home_back, R.id.home_plan})
public void onClick(View view) {
Intent intent = null;
switch (view.getId()) {
@@ -59,7 +59,11 @@ public class MainActivity extends AppCompatActivity {
textDialog.setIpAddress(SharedPreferencesUtils.getstring("ip", null));
textDialog.show();
break;
- case R.id.home_back:
+ case R.id.home_lt:
+ intent = new Intent(this, LtActivity.class);
+ break;
+
+ case R.id.home_back:
finish();
break;
}
diff --git a/app/src/main/java/com/example/pulit/SolventActivity.java b/app/src/main/java/com/example/pulit/SolventActivity.java
index 77b7932..0f72f0e 100644
--- a/app/src/main/java/com/example/pulit/SolventActivity.java
+++ b/app/src/main/java/com/example/pulit/SolventActivity.java
@@ -17,6 +17,9 @@ import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
+import java.util.ArrayList;
+import java.util.List;
+
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
@@ -78,7 +81,6 @@ public class SolventActivity extends BaseActivity {
}
-
}
@OnClick({R.id.info_title_back, R.id.solvent_scan, R.id.solvent_submit})
@@ -103,7 +105,10 @@ public class SolventActivity extends BaseActivity {
dialog.show();
planView.setWeighbridge(dbaname);
planView.setCylinderBarCode(string);
- planView.setRate(string1.isEmpty()?"0":string1);
+ planView.setRate(string1.isEmpty() ? "0" : string1);
+ List list = new ArrayList<>(1);
+ list.add(solventGoodsCode.getText().toString().trim());
+ planView.setBarCodeList(list);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"),
JSONObject.toJSONString(planView));
OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState")
@@ -115,10 +120,10 @@ public class SolventActivity extends BaseActivity {
dialog.dismiss();
Toast.makeText(SolventActivity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show();
if (response.body().isSuccess()) {
- sanType=0;
+ sanType = 0;
solventCode.setText(null);
solventGoodsCode.setText(null);
- planView=null;
+ planView = null;
solventGoodsName.setText(null);
solventGoodslv.setText(null);
solventGoodslvState.setVisibility(View.GONE);
@@ -195,7 +200,7 @@ public class SolventActivity extends BaseActivity {
if (planView.getMaterial_code().equals(goodsCode)) {
planView.setState(1);
tipDialog.showState(true);
- sanType= exist?2:1;
+ sanType = exist ? 2 : 1;
} else {
planView.setState(0);
diff --git a/app/src/main/java/com/example/pulit/X2Activity.java b/app/src/main/java/com/example/pulit/X2Activity.java
index d80fc2c..8c13871 100644
--- a/app/src/main/java/com/example/pulit/X2Activity.java
+++ b/app/src/main/java/com/example/pulit/X2Activity.java
@@ -113,6 +113,7 @@ public class X2Activity extends BaseActivity {
.params("state", state)
.params("materialCode", goodsCode)
.params("weight", weight)
+ .params("barCode", x2Goods.getText().toString().trim())
.execute(new MyOkGoCallback() {
@Override
public void onSuccess(Response response) {
diff --git a/app/src/main/java/com/example/pulit/ZBActivity.java b/app/src/main/java/com/example/pulit/ZBActivity.java
index d763256..eeae72f 100644
--- a/app/src/main/java/com/example/pulit/ZBActivity.java
+++ b/app/src/main/java/com/example/pulit/ZBActivity.java
@@ -33,6 +33,8 @@ public class ZBActivity extends BaseActivity {
TextView zbGoodsName;
private int sanType;
private boolean exist;
+ private String dbCode = null;
+ private String findGoodesCode = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -49,7 +51,50 @@ public class ZBActivity extends BaseActivity {
public void scanInfo(String info) {
try {
- checkGoods(info);
+ String dbaname = zbDb.getSelectedItem().toString();
+ if (findGoodesCode == null || dbCode == null || !dbCode.equals(dbaname)) {
+ dialog.show();
+ OkGo.get("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/GetByZbCode")
+ .params("code", info)
+ .params("weighbridge", dbaname)
+ .execute(new MyOkGoCallback() {
+ @Override
+ public void onSuccess(Response response) {
+ super.onSuccess(response);
+ dialog.dismiss();
+ Resust body = response.body();
+ if (body.getStatus() == 200) {
+ JSONObject dateObj = body.getDateObj();
+ findGoodesCode = dateObj.get("Material_code").toString();
+ dbCode = dbaname;
+ Log.e("TAG", "查询出的物料:" + findGoodesCode);
+
+ checkGoods(info);
+
+ } else {
+ tipDialog.showMsg(false, body.getMsg());
+ findGoodesCode = null;
+ dbCode = null;
+ }
+
+ }
+
+ @Override
+ public void onError(Response response) {
+ super.onError(response);
+ dialog.dismiss();
+ Toast.makeText(ZBActivity.this, "网络连接错误", Toast.LENGTH_SHORT).show();
+ findGoodesCode = null;
+ dbCode = null;
+ }
+ });
+ } else {
+
+ checkGoods(info);
+
+ }
+
+
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, "条码格式错误", Toast.LENGTH_SHORT).show();
@@ -71,7 +116,7 @@ public class ZBActivity extends BaseActivity {
dialog.show();
planView.setWeighbridge(dbaname);
planView.setCylinderBarCode("00000000");
- planView.setRate( "0" );
+ planView.setRate("0");
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"),
JSONObject.toJSONString(planView));
OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState")
@@ -91,6 +136,9 @@ public class ZBActivity extends BaseActivity {
}
}
+
+
+
@Override
public void onError(Response response) {
super.onError(response);
@@ -104,12 +152,18 @@ public class ZBActivity extends BaseActivity {
private void checkGoods(String scanInfo) {
- planView=new PlanView();
+ planView = new PlanView();
zbGoodsCode.setText(scanInfo);
//物料编码
String goodsCode = scanInfo.substring(0, scanInfo.indexOf("-"));
Log.e("TAG", "scanInfo:" + goodsCode);
planView.setCode(goodsCode);
+ if (goodsCode.equals(findGoodesCode)) {
+ Toast.makeText(this, "验证成功", Toast.LENGTH_SHORT).show();
+ } else {
+ tipDialog.showMsg(false, "物料不匹配");
+ return;
+ }
//品名
int index = scanInfo.indexOf("-", scanInfo.indexOf("-", scanInfo.indexOf("-") + 1) + 1) + 1;
int endIndex = scanInfo.indexOf("|");
diff --git a/app/src/main/java/com/example/pulit/entity/PlanView.java b/app/src/main/java/com/example/pulit/entity/PlanView.java
index b95256c..1e553a9 100644
--- a/app/src/main/java/com/example/pulit/entity/PlanView.java
+++ b/app/src/main/java/com/example/pulit/entity/PlanView.java
@@ -1,5 +1,7 @@
package com.example.pulit.entity;
+import java.util.List;
+
/**
* @author wanghao
* @date 2023/8/8 13:54
@@ -42,6 +44,15 @@ public class PlanView {
private boolean Exist;
private String Rate;
+ private List barCodeList;
+
+ public List getBarCodeList() {
+ return barCodeList;
+ }
+
+ public void setBarCodeList(List barCodeList) {
+ this.barCodeList = barCodeList;
+ }
public String getCylinderBarCode() {
return CylinderBarCode;
diff --git a/app/src/main/res/layout/activity_lt.xml b/app/src/main/res/layout/activity_lt.xml
new file mode 100644
index 0000000..f9ff258
--- /dev/null
+++ b/app/src/main/res/layout/activity_lt.xml
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 7d75bde..520729b 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -51,10 +51,11 @@
+
+
+
+
+
+
+
+
+