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() })