增加 - 返修提交

master
wangh 12 months ago
parent 2f266b78f3
commit bdebc8c98a

@ -45,32 +45,22 @@ public class BindingActivity extends BaseActivity {
@Override
protected void sanInfo(String code) {
char c = code.charAt(0);
if (title.equals("壳胆绑定")) {
if (c == 'B') {
boxCode.set(code);
selectGoodsName(code);
} else if (c == 'L') {
} else if (c == 'L' && title.equals("壳胆绑定")) {
innerCode.set(code);
} else if (title.equals("条码绑定") && code.length() >= 21) {
innerCode.set(code);
} else {
Toast.makeText(this, "条码格式不对", Toast.LENGTH_SHORT).show();
}
} else {
if (c == 'B') {
boxCode.set(code);
selectGoodsName(code);
} else {
innerCode.set(code);
}
}
}
public void click1(View view) {
if (boxCode.get() == null || innerCode.get() == null) return;
if (boxCode.get() == null || innerCode.get() == null ||materialName.get()==null ) return;
dialog.show();
String s = title.equals("壳胆绑定") ? "/api/boxBanding" : "/api/barCodeBanding";
@ -103,27 +93,12 @@ public class BindingActivity extends BaseActivity {
innerCode.set(null);
}
private String codeTag = "";
// private String codeTag = "";
private void selectGoodsName(String code) {
if (codeTag.equals(code)) return;
codeTag = code;
OkGo.<Result>post(url + "/api/selectGoodsName")
.tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.params("code", code)
.execute(new MyRecultCall(dialog,this){
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result result = response.body();
if (result.getCode()==200){
Toast.makeText(BindingActivity.this, "查询成功", Toast.LENGTH_SHORT).show();
materialName.set(result.getData().toString());
}else {
Toast.makeText(BindingActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
}
}
});
public void goodsNameCall(String code) {
super.goodsNameCall(code);
materialName.set(code);
}
}

@ -45,8 +45,6 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
private List<DefectBeen> list;
private List<DefectBeen> submitList;
private OptionsPickerView opv;
private List<String> options1;
private List<List<String>> options2;
private List<List<List<String>>> options3;
@ -64,7 +62,6 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
String stationCode = getIntent().getStringExtra("stationCode");
// 三联
opv = new OptionsPickerBuilder(this, this).build();
OkGo.<Result>get(url + "/base/qualityInspectionItem/getQualityDefects/" + stationCode).tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", "")).execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
@ -161,7 +158,7 @@ public class CheckActivity extends BaseActivity implements CheckAdapter.CheckIte
checkAdapter.notifyDataSetChanged();
}
//三联添加
@Override
public void onOptionsSelect(int options1, int options2, int options3, View v) {

@ -46,14 +46,14 @@ public class HomePageActivity extends AppCompatActivity {
}
String finalStationCode = stationCode;
// String finalStationCode = stationCode;
binding.homeButton1.setOnClickListener(v -> {
// if (!roles.contains("quality_inspection")) {
// Toast.makeText(this, "暂无权限", Toast.LENGTH_SHORT).show();
// return;
// }
intent = new Intent(this, CheckActivity.class);
intent.putExtra("stationCode", "2001");
intent.putExtra("stationCode", "20 01");
startActivity(intent);
});
binding.homeButton2.setOnClickListener(v -> {

@ -1,19 +1,18 @@
package com.example.aucma_mes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import com.example.aucma_mes.adapter.CheckAdapter;
import com.example.aucma_mes.adapter.RepairAdapter;
import com.example.aucma_mes.base.BaseActivity;
import com.example.aucma_mes.databinding.ActivityMainBinding;
import com.example.aucma_mes.databinding.ActivityRepairBinding;
import com.example.aucma_mes.entity.DefectBeen;
import com.example.aucma_mes.entity.RepairSubmitInfo;
import com.example.aucma_mes.entity.RepairMeasures;
import com.example.aucma_mes.entity.Result;
import com.example.aucma_mes.utils.MyRecultCall;
@ -26,12 +25,16 @@ import com.lzy.okgo.model.Response;
import java.util.ArrayList;
import java.util.List;
public class RepairActivity extends BaseActivity implements CheckAdapter.CheckItemClickCall {
import okhttp3.MediaType;
import okhttp3.RequestBody;
public class RepairActivity extends BaseActivity {
private ActivityRepairBinding binding;
private RepairVm repairVm;
private RepairAdapter adapter;
private List<DefectBeen> defectBeens;
private List<Integer> submitList;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -40,20 +43,21 @@ public class RepairActivity extends BaseActivity implements CheckAdapter.CheckIt
adapter = new RepairAdapter(this);
repairVm = new RepairVm();
binding.setVm(repairVm);
submitList = new ArrayList<>();
binding.recyclerView.setAdapter(adapter);
//查询返修措施
OkGo.<Result>get(url + "/report/repairMeasures/getRepairMeasures").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
Result result = response.body();
if (result.getCode()==200){
Log.e("TAG", "真实类型:" + result.getData().getClass());
List<RepairMeasures> repairList=gson.fromJson(gson.toJson(result.getData())
,new TypeToken< List<RepairMeasures>>(){}.getType());
if (result.getCode() == 200) {
List<RepairMeasures> repairList = gson.fromJson(gson.toJson(result.getData())
, new TypeToken<List<RepairMeasures>>() {
}.getType());
repairVm.setRepairList(repairList);
}else {
} else {
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
}
}
@ -65,18 +69,21 @@ public class RepairActivity extends BaseActivity implements CheckAdapter.CheckIt
repairVm.setCode(code);
OkGo.<Result>post(url + "/api/findCheckInfoByCode").tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.params("code",code)
.params("code", code)
.execute(new MyRecultCall(dialog, this) {
@SuppressLint("NotifyDataSetChanged")
@Override
public void onSuccess(Response<Result> response) {
Result result = response.body();
if (result.getCode()==200){
defectBeens = gson.fromJson(result.getData().toString()
,new TypeToken<List<DefectBeen>>(){}.getType());
if (result.getCode() == 200) {
defectBeens = gson.fromJson(result.getData().toString(), new TypeToken<List<DefectBeen>>() {
}.getType());
// Log.e("TAG", "onSuccess:" + defectBeens.toString());
defectBeens.forEach(t -> submitList.add(t.getObjId()));
adapter.setList(defectBeens);
adapter.notifyDataSetChanged();
}else {
repairVm.setMaterialName(defectBeens.get(0).getMaterialName());
} else {
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
repairSubmit(null);
}
@ -85,13 +92,31 @@ public class RepairActivity extends BaseActivity implements CheckAdapter.CheckIt
}
public void repairSubmit(View view) {
if (submitList.isEmpty()) return;
RepairSubmitInfo repairSubmitInfo =new RepairSubmitInfo(submitList,
SharedPreferencesUtils.getstring("userName", "pda01")
,repairVm.getRepairName(),repairVm.getIsFlag());
MediaType JSON = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(JSON,gson.toJson(repairSubmitInfo) );
OkGo.<Result>post(url + "/api/submitRepair")
.tag(this).headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.upRequestBody(body)
.execute(new MyRecultCall(dialog, this) {
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result result = response.body();
Toast.makeText(RepairActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
if (result.getCode()==200){
defectBeens.clear();
adapter.notifyDataSetChanged();
repairVm.setCode(null);
repairVm.setMaterialName(null);
submitList.clear();
}
}
});
}
@Override
public void onClick(int positon) {
}
}

@ -57,7 +57,7 @@ public class RepairAdapter extends RecyclerView.Adapter<RepairAdapter.CheckAdapt
}
static class CheckAdapterVH extends RecyclerView.ViewHolder {
private ItemRepairBinding inflate1;
private final ItemRepairBinding inflate1;
public ItemRepairBinding getInflate1() {
return inflate1;
@ -71,8 +71,5 @@ public class RepairAdapter extends RecyclerView.Adapter<RepairAdapter.CheckAdapt
}
public interface CheckItemClickCall {
void onClick(int positon);
}
}

@ -11,27 +11,35 @@ import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.widget.Toast;
import com.example.aucma_mes.BindingActivity;
import com.example.aucma_mes.R;
import com.example.aucma_mes.entity.Result;
import com.example.aucma_mes.utils.MyRecultCall;
import com.example.aucma_mes.utils.SharedPreferencesUtils;
import com.google.gson.Gson;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import okhttp3.MediaType;
public abstract class BaseActivity extends AppCompatActivity {
private MyBroad receiver;
// public static String url="http://192.168.137.1:8080";
public static String url="http://172.20.10.2:8080";
public static String url="http://192.168.0.101:8080";
// public static String url = "http://172.20.10.2:8080";
public ProgressDialog dialog;
public Gson gson;
public MediaType JSON = MediaType.parse("application/json; charset=utf-8");
@SuppressLint("UnspecifiedRegisterReceiverFlag")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
IntentFilter intentFilter = new IntentFilter("com.honeywell.scan.broadcast");
receiver = new MyBroad();
registerReceiver(receiver,intentFilter);
gson=new Gson();
registerReceiver(receiver, intentFilter);
gson = new Gson();
initDialog();
}
@ -44,17 +52,45 @@ public abstract class BaseActivity extends AppCompatActivity {
}
protected abstract void sanInfo(String code);
public void goodsNameCall(String code) {
}
private String codeTag = "";
public void selectGoodsName(String code) {
if (codeTag.equals(code)) return;
codeTag = code;
OkGo.<Result>post(url + "/api/selectGoodsName")
.tag(this)
.headers("Authorization", SharedPreferencesUtils.getstring("token", ""))
.params("code", code)
.execute(new MyRecultCall(dialog,this){
@Override
public void onSuccess(Response<Result> response) {
super.onSuccess(response);
Result result = response.body();
if (result.getCode()==200){
Toast.makeText(BaseActivity.this, "查询成功", Toast.LENGTH_SHORT).show();
goodsNameCall(result.getData().toString()) ;
}else {
Toast.makeText(BaseActivity.this, result.getMsg(), Toast.LENGTH_SHORT).show();
goodsNameCall(null) ;
}
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
// 注销广播接收器
unregisterReceiver(receiver);
}
private class MyBroad extends BroadcastReceiver{
private class MyBroad extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
sanInfo(intent.getStringExtra("data")) ;
sanInfo(intent.getStringExtra("data"));
}
}
}

@ -12,12 +12,13 @@ public class DefectBeen extends BaseObservable {
public int index;
public int objId;
private int index;
private int objId;
private String materialName;
private String materialCategories;
private String materialSubclass;
public String qualityDefectCode;
public String qualityDefectName;
private String qualityDefectCode;
private String qualityDefectName;
@ -85,4 +86,24 @@ public class DefectBeen extends BaseObservable {
this.qualityDefectName = qualityDefectName;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
@Override
public String toString() {
return "DefectBeen{" +
"index=" + index +
", objId=" + objId +
", materialName='" + materialName + '\'' +
", materialCategories='" + materialCategories + '\'' +
", materialSubclass='" + materialSubclass + '\'' +
", qualityDefectCode='" + qualityDefectCode + '\'' +
", qualityDefectName='" + qualityDefectName + '\'' +
'}';
}
}

@ -11,6 +11,15 @@ public class RepairMeasures {
//"repairName": "返回生产线"
private String repairCode;
private String repairName;
private int isFlag;
public int getIsFlag() {
return isFlag;
}
public void setIsFlag(int isFlag) {
this.isFlag = isFlag;
}
public String getRepairCode() {
return repairCode;

@ -0,0 +1,56 @@
package com.example.aucma_mes.entity;
import java.util.List;
/**
* @author wanghao
* @date 2023/12/4 15:05
*/
public class RepairSubmitInfo {
private List<Integer> list;
private String loginName;
private String repairName;
private int isFlag;
public RepairSubmitInfo(List<Integer> list, String loginName, String repairName, int isFlag) {
this.list = list;
this.loginName = loginName;
this.repairName = repairName;
this.isFlag = isFlag;
}
public RepairSubmitInfo() {
}
public List<Integer> getList() {
return list;
}
public void setList(List<Integer> list) {
this.list = list;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getRepairName() {
return repairName;
}
public void setRepairName(String repairName) {
this.repairName = repairName;
}
public int getIsFlag() {
return isFlag;
}
public void setIsFlag(int isFlag) {
this.isFlag = isFlag;
}
}

@ -18,14 +18,18 @@ import java.util.List;
*/
public class RepairVm extends BaseObservable {
public String code;//扫描条码
private String repairCode;//处理措施
private String materialName;//扫描条码
//处理措施
private String repairName;
private int isFlag;
public List<String> stringList;
private List<RepairMeasures> repairList;
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.e("TAG", "返修选中措施:" + position);
this.repairCode = repairList.get(position).getRepairCode();
RepairMeasures repairMeasures = repairList.get(position);
setRepairName(repairMeasures.getRepairName());
setIsFlag(repairMeasures.getIsFlag());
}
public void setRepairList(List<RepairMeasures> repairList) {
this.repairList = repairList;
@ -43,13 +47,40 @@ public class RepairVm extends BaseObservable {
notifyChange();
}
public String getRepairCode() {
return repairCode;
public String getRepairName() {
return repairName;
}
public void setRepairName(String repairName) {
this.repairName = repairName;
}
public int getIsFlag() {
return isFlag;
}
public void setIsFlag(int isFlag) {
this.isFlag = isFlag;
}
public void setRepairCode(String name) {
int i = stringList.indexOf(name);
this.repairCode = repairList.get(i).getRepairCode();
public List<String> getStringList() {
return stringList;
}
public void setStringList(List<String> stringList) {
this.stringList = stringList;
}
public List<RepairMeasures> getRepairList() {
return repairList;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
notifyChange();
}
}

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/blue" />
<corners android:radius="20dp" />
<corners android:radius="50dp" />
</shape>

@ -68,7 +68,7 @@
android:id="@+id/home_button5"
style="@style/radio_button_style"
android:drawableTop="@mipmap/icon_info"
android:text="登录信息查询"
android:text="班次确认"
app:layout_columnWeight="1" />

@ -10,21 +10,18 @@
type="com.example.aucma_mes.vm.RepairVm" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey"
tools:context=".RepairActivity">
tools:context=".RepairActivity"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_height="43dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="4dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_marginEnd="4dp">
<TextView
style="@style/text_style1"
@ -33,7 +30,6 @@
android:text="产品条码:" />
<TextView
android:id="@+id/san_text"
style="@style/san_text_style"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -41,35 +37,46 @@
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="43dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="4dp">
<TextView
style="@style/text_style1"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="产品型号:" />
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
style="@style/text_style1_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@={vm.materialName}" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="20dp"
android:text="缺陷详情"
android:textColor="@color/design_default_color_error"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout" />
android:textColor="@color/blue"
android:text="缺陷详情" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="255dp"
android:background="@color/white"
android:layout_height="215dp"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
android:background="@color/white" />
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_height="43dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="4dp"
android:background="@color/white"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recyclerView">
android:orientation="horizontal">
<TextView
style="@style/text_style1"
@ -77,7 +84,6 @@
android:layout_height="match_parent"
android:background="@color/grey"
android:text="处置措施:" />
<!-- "-->
<Spinner
android:id="@+id/check_spinner1"
android:layout_width="match_parent"
@ -91,20 +97,15 @@
<Button
android:id="@+id/button"
style="@style/button_true_style"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginStart="25dp"
android:layout_height="45dp"
android:layout_marginStart="20dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="25dp"
android:layout_weight="1"
android:layout_marginEnd="20dp"
android:onClick="repairSubmit"
android:text="提交"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2" />
</androidx.constraintlayout.widget.ConstraintLayout>
android:text="提交" />
</LinearLayout>
</layout>
Loading…
Cancel
Save