From 9faa3c70bee0d10f7debde8d2ff6ec962210a716 Mon Sep 17 00:00:00 2001 From: wangh <123456> Date: Mon, 25 Sep 2023 11:42:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 +- app/release/output-metadata.json | 2 +- .../com/example/pulit/SolventActivity.java | 10 +++ .../java/com/example/pulit/X1Activity.java | 62 +++++++++++-------- .../com/example/pulit/entity/PlanView.java | 18 ++++++ .../java/com/example/pulit/entity/X1.java | 9 +++ .../com/example/pulit/entity/X1Submit.java | 30 +++++++-- app/src/main/res/layout/activity_solvent.xml | 21 +++++++ app/src/main/res/layout/activity_x1.xml | 28 +++++++-- app/src/main/res/values/arrays.xml | 7 +++ 10 files changed, 151 insertions(+), 38 deletions(-) create mode 100644 app/src/main/res/values/arrays.xml diff --git a/app/build.gradle b/app/build.gradle index b573dc9..3571ce5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,7 +10,7 @@ android { applicationId "com.example.pulit" minSdkVersion 26 targetSdkVersion 30 - versionCode 3 + versionCode 4 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index f74633f..7864dd8 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -10,7 +10,7 @@ { "type": "SINGLE", "filters": [], - "versionCode": 2, + "versionCode": 4, "versionName": "1.0", "outputFile": "app-release.apk" } diff --git a/app/src/main/java/com/example/pulit/SolventActivity.java b/app/src/main/java/com/example/pulit/SolventActivity.java index f9fe1fa..dece05e 100644 --- a/app/src/main/java/com/example/pulit/SolventActivity.java +++ b/app/src/main/java/com/example/pulit/SolventActivity.java @@ -3,7 +3,9 @@ package com.example.pulit; import android.os.Bundle; import android.util.Log; import android.view.View; +import android.widget.Button; import android.widget.LinearLayout; +import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; @@ -31,6 +33,9 @@ public class SolventActivity extends BaseActivity { TextView solventGoodsName; @BindView(R.id.s2gion) LinearLayout s2gion; + @BindView(R.id.solvent_db) + Spinner solventDb; + private boolean sanType; @Override @@ -72,7 +77,11 @@ public class SolventActivity extends BaseActivity { break; case R.id.solvent_submit: if (planView == null) return; + String dbaname = solventDb.getSelectedItem().toString(); + String string = solventCode.getText().toString(); dialog.show(); + planView.setWeighbridge(dbaname); + planView.setCylinderBarCode(string); RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"), JSONObject.toJSONString(planView)); OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState") @@ -87,6 +96,7 @@ public class SolventActivity extends BaseActivity { finish(); } } + @Override public void onError(Response response) { super.onError(response); diff --git a/app/src/main/java/com/example/pulit/X1Activity.java b/app/src/main/java/com/example/pulit/X1Activity.java index 8dc35ff..a435dc1 100644 --- a/app/src/main/java/com/example/pulit/X1Activity.java +++ b/app/src/main/java/com/example/pulit/X1Activity.java @@ -38,8 +38,6 @@ public class X1Activity extends BaseActivity { TextView x1Code; @BindView(R.id.x1_recycler_view) RecyclerView x1RecyclerView; - - @BindView(R.id.x1_tong) TextView x1Tong; @BindView(R.id.x1_goods_code) @@ -99,7 +97,7 @@ public class X1Activity extends BaseActivity { } - @OnClick({R.id.info_title_back, R.id.x1_scan, R.id.x1_submit}) + @OnClick({R.id.info_title_back, R.id.x1_scan, R.id.x1_submit, R.id.x1_submit2}) public void onClick(View view) { switch (view.getId()) { case R.id.info_title_back: @@ -110,36 +108,47 @@ public class X1Activity extends BaseActivity { break; case R.id.x1_submit: if (entrySubmit == null) return; - dialog.show(); - RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"), - JSONObject.toJSONString(entrySubmit)); - OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Warehouse/ExecPlcState") - .upRequestBody(requestBody) - .execute(new MyOkGoCallback() { - @Override - public void onSuccess(Response response) { - super.onSuccess(response); - dialog.dismiss(); - Toast.makeText(X1Activity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show(); - if (response.body().isSuccess()) { - finish(); - } - } - - @Override - public void onError(Response response) { - super.onError(response); - dialog.dismiss(); - } - }); - + submit(entrySubmit,1); break; + case R.id.x1_submit2: + if (entrySubmit == null) return; + submit(entrySubmit,0); + break; + } } private String kcode; private int station; + private String pianId; +//提交 + private void submit(X1Submit entrySubmit,int state){ + dialog.show(); + entrySubmit.setStates(state); + entrySubmit.setPlanId(pianId); + RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"), + JSONObject.toJSONString(entrySubmit)); + OkGo.post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Warehouse/ExecPlcState") + .upRequestBody(requestBody) + .execute(new MyOkGoCallback() { + @Override + public void onSuccess(Response response) { + super.onSuccess(response); + dialog.dismiss(); + Toast.makeText(X1Activity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show(); + if (response.body().isSuccess()) { + finish(); + } + } + @Override + public void onError(Response response) { + super.onError(response); + dialog.dismiss(); + } + }); + + } //查询 釜 private void getF(String info) { OkGo.get("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Warehouse/GetByCode") @@ -154,6 +163,7 @@ public class X1Activity extends BaseActivity { station = x1.getID();// kcode = x1.getBarCode();// items = x1.getChildren(); + pianId=x1.getPlanId(); adapter.setList(items); x1RecyclerView.setAdapter(adapter); scanStates = false;//扫描 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 964d83b..df3d782 100644 --- a/app/src/main/java/com/example/pulit/entity/PlanView.java +++ b/app/src/main/java/com/example/pulit/entity/PlanView.java @@ -37,6 +37,24 @@ public class PlanView { private String WholeMaterial; private int State; + private String Weighbridge;//9.25新增 地磅 + private String CylinderBarCode;//9.25新增 地磅 + + public String getCylinderBarCode() { + return CylinderBarCode; + } + + public void setCylinderBarCode(String cylinderBarCode) { + CylinderBarCode = cylinderBarCode; + } + + public String getWeighbridge() { + return Weighbridge; + } + + public void setWeighbridge(String weighbridge) { + Weighbridge = weighbridge; + } public int getMid() { return Mid; diff --git a/app/src/main/java/com/example/pulit/entity/X1.java b/app/src/main/java/com/example/pulit/entity/X1.java index 102fde6..049d92d 100644 --- a/app/src/main/java/com/example/pulit/entity/X1.java +++ b/app/src/main/java/com/example/pulit/entity/X1.java @@ -9,6 +9,7 @@ import java.util.List; public class X1 { private int ID; private String Name; + private String PlanId; //计划ID private String BarCode; private String CreateTime; private List Children; @@ -17,6 +18,14 @@ public class X1 { return ID; } + public String getPlanId() { + return PlanId; + } + + public void setPlanId(String planId) { + PlanId = planId; + } + public void setID(int ID) { this.ID = ID; } 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 09a5342..9e71626 100644 --- a/app/src/main/java/com/example/pulit/entity/X1Submit.java +++ b/app/src/main/java/com/example/pulit/entity/X1Submit.java @@ -11,7 +11,18 @@ public class X1Submit { private double matWeight;//物料重量 private String matType;// 物料类型:整包、散装 private int state;//状态 0:未扫描 1:匹配 2:报警 -private String wholePackage; + private String wholePackage; + private String PlanId; //计划ID + private int State; + + public String getPlanId() { + return PlanId; + } + + public void setPlanId(String planId) { + PlanId = planId; + } + public int getStation() { return station; } @@ -56,6 +67,20 @@ private String wholePackage; return state; } + public void setState(int state) { + this.state = state; + } + + public int getStateS() { + return State; + } + + public void setStates(int state) { + this.State = state; + } + + + public String getWholePackage() { return wholePackage; } @@ -64,7 +89,4 @@ private String wholePackage; this.wholePackage = wholePackage; } - public void setState(int state) { - this.state = state; - } } diff --git a/app/src/main/res/layout/activity_solvent.xml b/app/src/main/res/layout/activity_solvent.xml index a714c78..3d2430a 100644 --- a/app/src/main/res/layout/activity_solvent.xml +++ b/app/src/main/res/layout/activity_solvent.xml @@ -100,6 +100,27 @@ android:layout_height="match_parent" android:layout_marginLeft="10dp" /> + + + + + +