diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DeviceScrapServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DeviceScrapServiceImpl.java
index a40c192b..ba383079 100644
--- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DeviceScrapServiceImpl.java
+++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DeviceScrapServiceImpl.java
@@ -83,11 +83,22 @@ public class DeviceScrapServiceImpl implements DeviceScrapService {
WQLObject fileTab = WQLObject.getWQLObject("EM_BI_EquipmentFile");
WQLObject lifeTab = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle");
+ WQLObject mainTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenanceMst"); // 设备保养单
+ WQLObject reTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst"); // 设备维修单
// 更新设备档案表状态为报废
JSONObject json = fileTab.query("devicerecord_id ='" + devicerecord_id + "' and is_delete = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(json)) throw new BootstrapMethodError("档案已被删除");
+ String status = json.getString("status");
+ if (StrUtil.equals(status, "11")) {
+ // 需完成保养单或者维修单
+ JSONObject jsonMain = mainTab.query("devicerecord_id = '" + devicerecord_id + "' and is_delete = '0' and invstatus = '99'").uniqueResult(0);
+ JSONObject jsonRe = reTab.query("devicerecord_id = '" + devicerecord_id + "' and is_delete = '0' and invstatus = '99'").uniqueResult(0);
+ if (ObjectUtil.isEmpty(jsonMain) || ObjectUtil.isEmpty(jsonRe)) {
+ throw new BadRequestException("保养单或维修单未完成");
+ }
+ }
json.put("status", "90");
json.put("update_optid", currentUserId);
json.put("update_optname", nickName);
diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DevicerunrecordServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DevicerunrecordServiceImpl.java
index 71cf4b7d..4ef06435 100644
--- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DevicerunrecordServiceImpl.java
+++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DevicerunrecordServiceImpl.java
@@ -111,6 +111,10 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
String run_date = whereJson.getString("run_date");
JSONObject jsonFile = WQLObject.getWQLObject("EM_BI_EquipmentFile").query("devicerecord_id = '" + devicerecord_id + "'").uniqueResult(0);
+ String status = jsonFile.getString("status");
+ if (!"10,11,20,30,40".contains(status)) {
+ throw new BadRequestException("此设备不能填报");
+ }
double run_times = whereJson.getDoubleValue("run_times"); //生产时间
double prepare_times = whereJson.getDoubleValue("prepare_times");//准备时间
@@ -185,6 +189,9 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
json.put("oee_value", 0);
}
tab.update(json);
+ String run_date = json.getString("run_date");
+ JSONArray jsonMst = tab.query("devicerecord_id = '" + devicerecord_id + "' and run_date = '" + run_date + "'").getResultJSONArray(0);
+ if (jsonMst.size() > 1) throw new BadRequestException("填报信息已存在");
}
@Override
diff --git a/mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue b/mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue
index eaab473a..f5101b44 100644
--- a/mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue
+++ b/mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue
@@ -12,7 +12,7 @@
label-suffix=":"
>
-
+
-
+