From 0d004ae3eeb4fcc6fe50e48149f55f3398fe9896 Mon Sep 17 00:00:00 2001 From: wanghao Date: Mon, 18 Nov 2024 17:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E7=BB=B4=E4=BF=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/DeviceRepairInfoActivity.java | 15 +++++---- .../entity/device/DeviceRepair.java | 33 ++++++++++++++++--- .../layout/activity_device_repair_info.xml | 5 +-- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/example/jingyuan_mes/device/DeviceRepairInfoActivity.java b/app/src/main/java/com/example/jingyuan_mes/device/DeviceRepairInfoActivity.java index a8fc3f9..16251ac 100644 --- a/app/src/main/java/com/example/jingyuan_mes/device/DeviceRepairInfoActivity.java +++ b/app/src/main/java/com/example/jingyuan_mes/device/DeviceRepairInfoActivity.java @@ -67,8 +67,10 @@ public class DeviceRepairInfoActivity extends BaseActivity implements DisposalFi faultTypeLpw = new ListPopupWindow(context); faultTypeLpw.setAnchorView(binding.faultType); faultTypeLpw.setOnItemClickListener((parent, view, position, id) -> { - deviceRepair.setFaultSourceTypeName(faultList.get(position).getDictLabel()); - deviceRepair.setFaultSourceType(faultList.get(position).getDictValue()); + Dict dict = faultList.get(position); + deviceRepair.setFaultSourceTypeName(dict.getDictLabel()); + Log.e("TAG", "onCreate:" + dict.getDictValue()); + deviceRepair.setFaultSourceType(dict.getDictValue()); faultTypeLpw.dismiss(); }); opeLpw = new ListPopupWindow(context); @@ -288,14 +290,15 @@ public class DeviceRepairInfoActivity extends BaseActivity implements DisposalFi // 提交修改 维修工单 public void submitUpdateRepair(View view){ Log.e("TAG", "submitUpdateRepair:" + deviceRepair.getInstanceActivityId()); + int repairType = deviceRepair.getRepairType(); OkGo.post(url + "/dms/mobile/updateFaultInstanceActivity") .headers("Authorization", SharedPreferencesUtils.getstring("access_token", "")) - .params("instanceActivityld", deviceRepair.getInstanceActivityId()) - .params("faultType", deviceRepair.getFaultType()) + .params("instanceActivityId", deviceRepair.getInstanceActivityId()) + .params("faultType", deviceRepair.getFaultSourceType()) .params("faultDescription", deviceRepair.getFaultDescription()) .params("designOperations", deviceRepair.getDesignOperations()) - .params("repairType", deviceRepair.getRepairType()) - .params("outsrcld", deviceRepair.getOutsrcId()) + .params("repairType", repairType) + .params("outsrcld",deviceRepair.getOutsrcId()) .addFileParams("files", submitFileList) .execute(new MyRecultCall(dialog, this) { @Override diff --git a/app/src/main/java/com/example/jingyuan_mes/entity/device/DeviceRepair.java b/app/src/main/java/com/example/jingyuan_mes/entity/device/DeviceRepair.java index bcf59c5..a87070f 100644 --- a/app/src/main/java/com/example/jingyuan_mes/entity/device/DeviceRepair.java +++ b/app/src/main/java/com/example/jingyuan_mes/entity/device/DeviceRepair.java @@ -1,5 +1,6 @@ package com.example.jingyuan_mes.entity.device; +import android.util.Log; import android.view.View; import android.widget.AdapterView; @@ -87,6 +88,7 @@ public class DeviceRepair extends BaseObservable { private List outsourcingList; private List outsourcingNameList; private int outsrcId; + private int outsrcIdIndex; private String outsrcName; public List getOutsourcingNameList() { @@ -105,16 +107,30 @@ public class DeviceRepair extends BaseObservable { public void setOutsourcingList(List outsourcingList) { this.outsourcingList = outsourcingList; outsourcingNameList=new ArrayList<>(outsourcingList.size()); - outsourcingList.forEach(t->{ - outsourcingNameList.add(t.getOutsrcName()); - if (t.getOutsrcId()==outsrcId){ - this.outsrcName=t.getOutsrcName(); + for (int i = 0; i < outsourcingList.size(); i++) { + Outsourcing outsourcing = outsourcingList.get(i); + outsourcingNameList.add(outsourcing.getOutsrcName()); + if (outsourcing.getOutsrcId()==outsrcId){ + // this.outsrcName=t.getOutsrcName(); + this.outsrcIdIndex = i; + Log.e("TAG", "setOutsourcingList:" + i); } - }); + } + /* (t->{ + ; + + });*/ notifyChange(); } + + public int getOutsrcIdIndex() { + + return outsrcIdIndex; + } + public void selectOutSourcingID(AdapterView parent, View view, int position, long id) { this.outsrcId = outsourcingList.get(position).getOutsrcId(); + this.outsrcIdIndex = position; } public String getOutsrcName() { @@ -139,6 +155,11 @@ public class DeviceRepair extends BaseObservable { return repairType; } + public void setOutsrcIdIndex(int outsrcIdIndex) { + this.outsrcIdIndex = outsrcIdIndex; + notifyChange(); + } + public void setRepairType(int repairType) { this.repairType = repairType; } @@ -149,6 +170,7 @@ public class DeviceRepair extends BaseObservable { repairType = type; // radioState = (type == 2); if (type==1){ + setRadioState1(true); setRadioState2(false); }else { @@ -238,6 +260,7 @@ public class DeviceRepair extends BaseObservable { public void setFaultSourceType(String faultSourceType) { this.faultSourceType = faultSourceType; + } public Long getFaultSourceId() { diff --git a/app/src/main/res/layout/activity_device_repair_info.xml b/app/src/main/res/layout/activity_device_repair_info.xml index e7de96c..24113fc 100644 --- a/app/src/main/res/layout/activity_device_repair_info.xml +++ b/app/src/main/res/layout/activity_device_repair_info.xml @@ -242,7 +242,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:enabled="@{visState}" - android:text="@{vm.faultDescription}" /> + android:text="@={vm.faultDescription}" /> @@ -329,8 +329,9 @@ android:entries="@{vm.outsourcingNameList}" android:onItemSelected="@{vm.selectOutSourcingID}" android:spinnerMode="dropdown" + android:selection="@{vm.outsrcIdIndex}" android:textAlignment="center" /> - +