增加 1 修改 2

master
wangh 10 months ago
parent f8b61fef03
commit ee6ada7129

@ -10,7 +10,7 @@ android {
applicationId "com.example.pulit" applicationId "com.example.pulit"
minSdkVersion 26 minSdkVersion 26
targetSdkVersion 30 targetSdkVersion 30
versionCode 11 versionCode 13
versionName "1.0" versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

@ -10,7 +10,7 @@
{ {
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"versionCode": 11, "versionCode": 13,
"versionName": "1.0", "versionName": "1.0",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }

@ -15,8 +15,9 @@
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.PuLiT" android:theme="@style/Theme.PuLiT"
android:usesCleartextTraffic="true"> android:usesCleartextTraffic="true">
<activity android:name=".PlanActivity"></activity> <activity android:name=".LtActivity"></activity>
<activity android:name=".ZBActivity"/> <activity android:name=".PlanActivity" />
<activity android:name=".ZBActivity" />
<activity android:name=".So2Activity" /> <activity android:name=".So2Activity" />
<activity android:name=".X3Activity" /> <activity android:name=".X3Activity" />
<activity android:name=".SolventActivity" /> <activity android:name=".SolventActivity" />

@ -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.<Resust>get("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/xl_material/MaterialVerification")
.params("barCode", info)
.execute(new MyOkGoCallback() {
@Override
public void onSuccess(Response<Resust> response) {
super.onSuccess(response);
dialog.dismiss();
Resust body = response.body();
tipDialog.showMsg(body.isSuccess(), body.getMsg());
}
@Override
public void onError(Response<Resust> 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;
}
}
}

@ -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, @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) { public void onClick(View view) {
Intent intent = null; Intent intent = null;
switch (view.getId()) { switch (view.getId()) {
@ -59,6 +59,10 @@ public class MainActivity extends AppCompatActivity {
textDialog.setIpAddress(SharedPreferencesUtils.getstring("ip", null)); textDialog.setIpAddress(SharedPreferencesUtils.getstring("ip", null));
textDialog.show(); textDialog.show();
break; break;
case R.id.home_lt:
intent = new Intent(this, LtActivity.class);
break;
case R.id.home_back: case R.id.home_back:
finish(); finish();
break; break;

@ -17,6 +17,9 @@ import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback; import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response; import com.lzy.okgo.model.Response;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick; 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}) @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(); dialog.show();
planView.setWeighbridge(dbaname); planView.setWeighbridge(dbaname);
planView.setCylinderBarCode(string); planView.setCylinderBarCode(string);
planView.setRate(string1.isEmpty()?"0":string1); planView.setRate(string1.isEmpty() ? "0" : string1);
List<String> list = new ArrayList<>(1);
list.add(solventGoodsCode.getText().toString().trim());
planView.setBarCodeList(list);
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"), RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"),
JSONObject.toJSONString(planView)); JSONObject.toJSONString(planView));
OkGo.<Resust>post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState") OkGo.<Resust>post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState")
@ -115,10 +120,10 @@ public class SolventActivity extends BaseActivity {
dialog.dismiss(); dialog.dismiss();
Toast.makeText(SolventActivity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show(); Toast.makeText(SolventActivity.this, response.body().getMsg(), Toast.LENGTH_SHORT).show();
if (response.body().isSuccess()) { if (response.body().isSuccess()) {
sanType=0; sanType = 0;
solventCode.setText(null); solventCode.setText(null);
solventGoodsCode.setText(null); solventGoodsCode.setText(null);
planView=null; planView = null;
solventGoodsName.setText(null); solventGoodsName.setText(null);
solventGoodslv.setText(null); solventGoodslv.setText(null);
solventGoodslvState.setVisibility(View.GONE); solventGoodslvState.setVisibility(View.GONE);
@ -195,7 +200,7 @@ public class SolventActivity extends BaseActivity {
if (planView.getMaterial_code().equals(goodsCode)) { if (planView.getMaterial_code().equals(goodsCode)) {
planView.setState(1); planView.setState(1);
tipDialog.showState(true); tipDialog.showState(true);
sanType= exist?2:1; sanType = exist ? 2 : 1;
} else { } else {
planView.setState(0); planView.setState(0);

@ -113,6 +113,7 @@ public class X2Activity extends BaseActivity {
.params("state", state) .params("state", state)
.params("materialCode", goodsCode) .params("materialCode", goodsCode)
.params("weight", weight) .params("weight", weight)
.params("barCode", x2Goods.getText().toString().trim())
.execute(new MyOkGoCallback() { .execute(new MyOkGoCallback() {
@Override @Override
public void onSuccess(Response<Resust> response) { public void onSuccess(Response<Resust> response) {

@ -33,6 +33,8 @@ public class ZBActivity extends BaseActivity {
TextView zbGoodsName; TextView zbGoodsName;
private int sanType; private int sanType;
private boolean exist; private boolean exist;
private String dbCode = null;
private String findGoodesCode = null;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -49,7 +51,50 @@ public class ZBActivity extends BaseActivity {
public void scanInfo(String info) { public void scanInfo(String info) {
try { try {
String dbaname = zbDb.getSelectedItem().toString();
if (findGoodesCode == null || dbCode == null || !dbCode.equals(dbaname)) {
dialog.show();
OkGo.<Resust>get("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/GetByZbCode")
.params("code", info)
.params("weighbridge", dbaname)
.execute(new MyOkGoCallback() {
@Override
public void onSuccess(Response<Resust> 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); checkGoods(info);
} else {
tipDialog.showMsg(false, body.getMsg());
findGoodesCode = null;
dbCode = null;
}
}
@Override
public void onError(Response<Resust> response) {
super.onError(response);
dialog.dismiss();
Toast.makeText(ZBActivity.this, "网络连接错误", Toast.LENGTH_SHORT).show();
findGoodesCode = null;
dbCode = null;
}
});
} else {
checkGoods(info);
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Toast.makeText(this, "条码格式错误", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "条码格式错误", Toast.LENGTH_SHORT).show();
@ -71,7 +116,7 @@ public class ZBActivity extends BaseActivity {
dialog.show(); dialog.show();
planView.setWeighbridge(dbaname); planView.setWeighbridge(dbaname);
planView.setCylinderBarCode("00000000"); planView.setCylinderBarCode("00000000");
planView.setRate( "0" ); planView.setRate("0");
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"), RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;"),
JSONObject.toJSONString(planView)); JSONObject.toJSONString(planView));
OkGo.<Resust>post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState") OkGo.<Resust>post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState")
@ -91,6 +136,9 @@ public class ZBActivity extends BaseActivity {
} }
} }
@Override @Override
public void onError(Response<Resust> response) { public void onError(Response<Resust> response) {
super.onError(response); super.onError(response);
@ -104,12 +152,18 @@ public class ZBActivity extends BaseActivity {
private void checkGoods(String scanInfo) { private void checkGoods(String scanInfo) {
planView=new PlanView(); planView = new PlanView();
zbGoodsCode.setText(scanInfo); zbGoodsCode.setText(scanInfo);
//物料编码 //物料编码
String goodsCode = scanInfo.substring(0, scanInfo.indexOf("-")); String goodsCode = scanInfo.substring(0, scanInfo.indexOf("-"));
Log.e("TAG", "scanInfo:" + goodsCode); Log.e("TAG", "scanInfo:" + goodsCode);
planView.setCode(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 index = scanInfo.indexOf("-", scanInfo.indexOf("-", scanInfo.indexOf("-") + 1) + 1) + 1;
int endIndex = scanInfo.indexOf("|"); int endIndex = scanInfo.indexOf("|");

@ -1,5 +1,7 @@
package com.example.pulit.entity; package com.example.pulit.entity;
import java.util.List;
/** /**
* @author wanghao * @author wanghao
* @date 2023/8/8 13:54 * @date 2023/8/8 13:54
@ -42,6 +44,15 @@ public class PlanView {
private boolean Exist; private boolean Exist;
private String Rate; private String Rate;
private List<String> barCodeList;
public List<String> getBarCodeList() {
return barCodeList;
}
public void setBarCodeList(List<String> barCodeList) {
this.barCodeList = barCodeList;
}
public String getCylinderBarCode() { public String getCylinderBarCode() {
return CylinderBarCode; return CylinderBarCode;

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LtActivity"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@color/blue"
app:layout_constraintTop_toTopOf="parent">
<TextView
style="@style/title_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="料筒验证" />
<ImageView
android:id="@+id/lt_title_back"
android:layout_width="55dp"
android:layout_height="match_parent"
android:padding="15dp"
android:src="@mipmap/icon_back" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginStart="10dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="10dp"
android:orientation="horizontal">
<TextView
style="@style/text_view"
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="扫描料桶" />
<TextView
android:id="@+id/lt_code"
style="@style/text_view2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"/>
</LinearLayout>
<Button
android:id="@+id/lt_scan"
style="@style/button_style1"
android:layout_width="match_parent"
android:layout_height="54dp"
android:layout_marginStart="20dp"
android:layout_marginTop="202dp"
android:layout_marginEnd="20dp"
android:text="触发扫描" />
</LinearLayout>

@ -51,10 +51,11 @@
</RadioGroup> </RadioGroup>
<RadioGroup <RadioGroup
android:id="@+id/radioGroup2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="140dp" android:layout_height="140dp"
android:layout_marginStart="30dp" android:layout_marginStart="30dp"
android:layout_marginTop="66dp" android:layout_marginTop="6dp"
android:layout_marginEnd="30dp" android:layout_marginEnd="30dp"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -80,6 +81,29 @@
android:text="整包称量" /> android:text="整包称量" />
</RadioGroup> </RadioGroup>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_marginStart="30dp"
android:layout_marginEnd="30dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/radioGroup2">
<RadioButton
android:id="@+id/home_lt"
style="@style/TabRadioButton"
android:drawableTop="@mipmap/home_lt"
android:text="料筒验证" />
<RadioButton
style="@style/TabRadioButton" />
<RadioButton
style="@style/TabRadioButton"/>
</RadioGroup>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="55dp" android:layout_height="55dp"

Loading…
Cancel
Save