From 27b0ec1436ec8ba34fb947bd731044c7aa7f2669 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Thu, 20 Apr 2023 11:02:03 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E5=BC=BA=E5=88=B6=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=89=8D=E7=9A=84=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/common/utils/PointUpdateUtil.java | 19 ++++-- .../service/impl/CockpitServiceImpl.java | 4 +- .../src/views/wms/pdm/workerorder/index.vue | 59 ++++++++++++++++++- 3 files changed, 75 insertions(+), 7 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java index db2bc9a..814bb9c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java +++ b/lms/nladmin-system/src/main/java/org/nl/modules/common/utils/PointUpdateUtil.java @@ -110,15 +110,26 @@ public class PointUpdateUtil { devices.add(device); // 向ACS查询点位状态 JSONObject deviceStatus = wmsToAcsService.getPointStatus(devices); - if (ObjectUtil.isEmpty(deviceStatus.get("data"))) return DeviceStatusEnum.SHUTDOWN.getCode(); - JSONArray statusJSONArray = deviceStatus.getJSONArray("data"); - if (ObjectUtil.isEmpty(statusJSONArray)) return DeviceStatusEnum.SHUTDOWN.getCode(); + if (ObjectUtil.isEmpty(deviceStatus.get("data"))) { + return DeviceStatusEnum.SHUTDOWN.getCode(); + } + JSONArray statusJSONArray = null; + try { + statusJSONArray = deviceStatus.getJSONArray("data"); + } catch (Exception e) { + return DeviceStatusEnum.SHUTDOWN.getCode(); + } + if (ObjectUtil.isEmpty(statusJSONArray)) { + return DeviceStatusEnum.SHUTDOWN.getCode(); + } JSONObject deviceJson = statusJSONArray.getJSONObject(0); String point_code = deviceJson.getString("device_code"); String mode = deviceJson.getString("mode"); // 工作状态:0脱机,其他正常 String error = deviceJson.getString("error"); // 0是正常 log.info("device_code: " + point_code + ", mode: " + mode + ", error: " + error); - if (!error.equals("0")) return DeviceStatusEnum.FAILURE.getCode(); + if (!error.equals("0")) { + return DeviceStatusEnum.FAILURE.getCode(); + } return mode.equals("0") ? DeviceStatusEnum.STANDBY.getCode() : DeviceStatusEnum.RUNNING.getCode(); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java index e8fab23..edf236b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/cockpit/service/impl/CockpitServiceImpl.java @@ -215,8 +215,8 @@ public class CockpitServiceImpl implements CockpitService{ Duration duration = Duration.between(dateTime, now); d.setWork_time(duration.toHours() + ""); } - // 设备状态 -// d.setDevice_status(PointUpdateUtil.getDeviceStatus(d.getDevice_code())); + // 设置设备状态 + d.setDevice_status(PointUpdateUtil.getDeviceStatus(d.getDevice_code())); DeviceEnum deviceEnum = DeviceEnum.get(d.getDevice_model(), d.getDevice_code()); // 添加图片名字 d.setDevice_url(deviceEnum.getPictureName()); diff --git a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue index 385726b..85fb402 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue @@ -237,6 +237,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -328,6 +372,8 @@ export default { workprocedureList: [], order_status: ['-1'], permission: {}, + orderData: {}, + finishShow: false, rules: { plan_qty: [ { required: true, message: '计划数量不能为空', trigger: 'blur' } @@ -369,9 +415,20 @@ export default { this.$refs.child3.setForm(row) } }, + clearForm() { + this.orderData = {} + }, + cancelFinish() { + this.clearForm() + this.finishShow = false + }, // 强制完成 forceFinish(data) { - crudWorkorder.forceFinish({ row: data }).then(res => { + this.orderData = data + this.finishShow = true + }, + toForceFinish() { + crudWorkorder.forceFinish({ row: this.orderData }).then(res => { this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) this.crud.toQuery() })