增加 1 修改 2

master
wangh 10 months ago
parent f8b61fef03
commit ee6ada7129

@ -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"

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

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

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

@ -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})
@ -104,6 +106,9 @@ public class SolventActivity extends BaseActivity {
planView.setWeighbridge(dbaname);
planView.setCylinderBarCode(string);
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;"),
JSONObject.toJSONString(planView));
OkGo.<Resust>post("http://" + SharedPreferencesUtils.getstring("ip", null) + "/api/Solvent/ExecPlcState")

@ -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<Resust> response) {

@ -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 {
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);
} 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) {
e.printStackTrace();
Toast.makeText(this, "条码格式错误", Toast.LENGTH_SHORT).show();
@ -91,6 +136,9 @@ public class ZBActivity extends BaseActivity {
}
}
@Override
public void onError(Response<Resust> response) {
super.onError(response);
@ -110,6 +158,12 @@ public class ZBActivity extends BaseActivity {
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("|");

@ -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<String> barCodeList;
public List<String> getBarCodeList() {
return barCodeList;
}
public void setBarCodeList(List<String> barCodeList) {
this.barCodeList = barCodeList;
}
public String getCylinderBarCode() {
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
android:id="@+id/radioGroup2"
android:layout_width="match_parent"
android:layout_height="140dp"
android:layout_marginStart="30dp"
android:layout_marginTop="66dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="30dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
@ -80,6 +81,29 @@
android:text="整包称量" />
</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
android:layout_width="match_parent"
android:layout_height="55dp"

Loading…
Cancel
Save