diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java index 1501907..9a0ca9c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java @@ -61,12 +61,11 @@ public class AcsToWmsController { @ApiOperation("申请任务") @SaIgnore public ResponseEntity apply(@RequestBody JSONObject whereJson) { - String point_code = whereJson.getString("device_code"); - if (StrUtil.isBlank(point_code)) { - throw new BadRequestException("点位不能为空!"); + String type = whereJson.getString("type"); + if (StrUtil.isBlank(type)) { + throw new BadRequestException("任务类型不能为空!"); } - - RLock lock = SpringContextHolder.getBean(RedissonClient.class).getFairLock(point_code); + RLock lock = SpringContextHolder.getBean(RedissonClient.class).getFairLock(type); boolean try_lock = false; try { try_lock = lock.tryLock(5, TimeUnit.SECONDS); @@ -92,12 +91,12 @@ public class AcsToWmsController { @ApiOperation("ACS机械手给WMS发送任务") @SaIgnore public ResponseEntity manipulatorApply(@RequestBody JSONObject whereJson) { - String point_code = whereJson.getString("device_code"); - if (StrUtil.isBlank(point_code)) { - throw new BadRequestException("点位不能为空!"); + String type = whereJson.getString("type"); + if (StrUtil.isBlank(type)) { + throw new BadRequestException("任务类型不能为空!"); } - RLock lock = SpringContextHolder.getBean(RedissonClient.class).getFairLock(point_code); + RLock lock = SpringContextHolder.getBean(RedissonClient.class).getFairLock(type); boolean try_lock = false; try { try_lock = lock.tryLock(5, TimeUnit.SECONDS); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 0a62afe..7b9bc3f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; -import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.util.CodeUtil; @@ -19,6 +18,7 @@ import org.nl.wms.basedata.eum.StandStatus; import org.nl.wms.basedata.eum.TrueOrFalse; import org.nl.wms.basedata.eum.VehicleType; import org.nl.wms.basedata.service.dto.VehicleDto; +import org.nl.wms.common.PickType; import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.sch.manage.*; import org.nl.wms.sch.task.call.empty.FJCallEmptyTask; @@ -37,16 +37,12 @@ import org.nl.wms.sch.task.send.material.YZSendMaterialTask; import org.nl.wms.sch.task.to.pack.BTHCToPackageTask; import org.nl.wms.sch.task.to.pack.FJToPackageTask; import org.nl.wms.sch.task.util.TaskUtils; -import org.redisson.api.RLock; -import org.redisson.api.RedissonClient; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.lang.reflect.Method; import java.util.Map; -import java.util.concurrent.TimeUnit; @Service @RequiredArgsConstructor @@ -83,11 +79,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { private final SZCallMaterialTask szCallMaterialTask; - @Autowired - private RedissonClient redissonClient; - @Autowired - private AcsToWmsService acsToWmsService; - /** * task_id:任务标识 * task_code:任务编码 @@ -209,34 +200,14 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } - @Override - @SneakyThrows - public JSONObject apply(JSONObject jsonObject) { - String type = (String) jsonObject.get("type"); - RLock lock = redissonClient.getLock("acs_to_wms:" + type); - boolean tryLock = lock.tryLock(5, TimeUnit.SECONDS); - try { - if (tryLock) { - return acsToWmsService.transApply(jsonObject); - } - } finally { - if (tryLock) { - lock.unlock(); - } - } - - return null; - } - - @Override @Transactional(rollbackFor = Exception.class) - public JSONObject transApply(JSONObject param) { + public JSONObject apply(JSONObject param) { String point_code = param.getString("device_code"); - String type = param.getString("type"); - if (StrUtil.isBlank(type)) { - throw new BadRequestException("任务类型不能为空!"); + if (StrUtil.isBlank(point_code)) { + throw new BadRequestException("点位不能为空!"); } + String type = param.getString("type"); String task_code; JSONObject point = param.getJSONObject("point"); if (ObjectUtil.isEmpty(point)) { @@ -262,7 +233,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { method_param.put("request_param", request_param); method_param.put("create_id", ACSSystem.id); method_param.put("create_name", ACSSystem.nick_name); - switch (type) { case "1": // 送料 @@ -279,10 +249,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (StrUtil.isBlank(weight)) { throw new BadRequestException("重量不能为空!"); } - String is_full = param.getString("is_full"); - if (StrUtil.isBlank(is_full)) { - throw new BadRequestException("是否满垛不能为空!"); - } + workorder.put("real_qty", workorder.getIntValue("real_qty") + Integer.parseInt(weight)); + TaskUtils.addACSUpdateColum(workorder); + WQLObject.getWQLObject("pdm_bd_workorder").update(workorder); + WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); JSONObject vd_update = new JSONObject(); vd_update.put("is_delete", "1"); @@ -298,7 +268,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { vd.put("vehicle_code", vehicle_code); vd.put("material_id", workorder.getString("material_id")); vd.put("weight", weight); - vd.put("is_full", is_full); vd.put("workorder_id", workorder.getString("workorder_id")); vd.put("point_code", point_code); vd.put("create_id", ACSSystem.id); @@ -450,7 +419,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { case FJ: method_param.put("workorder", param.getJSONObject("workorder")); method_param.put("vd", param.getJSONObject("vd")); - task_code = yzSendMaterialTask.createTask(method_param); + task_code = fjToPackageTask.createTask(method_param); break; case BTHC: TaskUtils.isNotEmptyPoint(point); @@ -729,7 +698,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (workorder.getIntValue("order_status") < 5) { workorder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value()); - workorder.put("real_qty", qty); + if (!"0".equals(qty)) { + workorder.put("real_qty", qty); + } String unqualified_qty = jsonObject.getString("unqualified_qty"); if (StrUtil.isNotBlank(unqualified_qty) && !"0".equals(unqualified_qty)) { workorder.put("unqualified_qty", unqualified_qty); @@ -738,7 +709,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (StrUtil.isNotBlank(qualified_qty) && !"0".equals(qualified_qty)) { workorder.put("qualified_qty", qualified_qty); } else { - workorder.put("qualified_qty", Integer.parseInt(qty) - workorder.getIntValue("unqualified_qty")); + workorder.put("qualified_qty", workorder.getIntValue("real_qty") - workorder.getIntValue("unqualified_qty")); } workorder.put("realproduceend_date", DateUtil.now()); @@ -832,7 +803,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { JSONObject data = null; if (!"0000".equals(vehicle_code)) { - data = WQLObject.getWQLObject("st_ivt_vehicle_detail") + data = WQLObject + .getWQLObject("st_ivt_vehicle_detail") .query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'") .uniqueResult(0); } @@ -870,7 +842,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } else { update.put("vehicle_type", String.valueOf(Integer.parseInt(vehicle_type) + 2)); } - WQLObject.getWQLObject("sch_base_point").update(update, "point_code = '" + point_code + "'"); + WQLObject + .getWQLObject("sch_base_point") + .update(update, "point_code = '" + point_code + "'"); + JSONObject result = new JSONObject(); result.put("status", HttpStatus.OK.value()); @@ -917,7 +892,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { String vehicle_code = point.getString("vehicle_code"); JSONObject data = null; if (StrUtil.isNotBlank(vehicle_code) && !"0000".equals(vehicle_code)) { - data = WQL.getWO("ACS_TO_WMS") + data = WQL + .getWO("ACS_TO_WMS") .addParam("flag", "1") .addParam("vehicle_type", vehicle_type) .addParam("vehicle_code", vehicle_code) @@ -940,13 +916,21 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } boolean to_package = false; - JSONObject workorder = WQL.getWO("ACS_TO_WMS") - .addParam("flag", "2") - .addParam("vehicle_code", vehicle_code) - .process() + + WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); + JSONObject vd = vd_table + .query("is_delete = '0' AND vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'") .uniqueResult(0); - if (ObjectUtil.isNotEmpty(workorder)) { - to_package = TrueOrFalse.trueOrFalse("is_pri"); + if (ObjectUtil.isNotEmpty(vd)) { + vd.put("is_fire", "1"); + vd.put("is_in_kiln", "0"); + vd_table.update(vd); + + JSONObject pn = TaskUtils.buildPN(PickType.GZ, vd.getLongValue("qty"), null); + WQLObject.getWQLObject("das_produce_number").insert(pn); + + JSONObject workorder = WQLObject.getWQLObject("pdm_bd_workorder").query("workorder_id = " + vd.getString("workorder_id")).uniqueResult(0); + to_package = TrueOrFalse.trueOrFalse(workorder.getString("is_pri")); } JSONObject result = new JSONObject(); @@ -955,4 +939,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { result.put("data", to_package); return result; } + + @Override + public JSONObject transApply(JSONObject param) { + return null; + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java index 6da4a8d..05efc93 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/rest/PdaController.java @@ -150,8 +150,8 @@ public class PdaController { if (StrUtil.isBlank(point_code)) { throw new BadRequestException("点位编码不能为空!"); } - String vehicle_code = param.getString("vehicle_code"); - if (StrUtil.isBlank(vehicle_code)) { + String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code")); + if ("0000".equals(vehicle_code)) { throw new BadRequestException("载具编码不能为空!"); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java index 44efceb..5af0603 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java @@ -194,12 +194,17 @@ public class PdaServiceImpl implements PdaService { @Transactional(rollbackFor = Exception.class) @Override public void report(String device_code, String unqualified_qty) { + JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("is_used = '1' AND is_delete = '0' AND device_code = '" + device_code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(device)) { + throw new BadRequestException("设备不存在或未启用!"); + } + WQLObject workorder_table = WQLObject.getWQLObject("pdm_bd_workorder"); JSONObject work_order = workorder_table .query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'") .uniqueResult(0); if (ObjectUtil.isEmpty(work_order)) { - throw new BadRequestException("设备 [" + device_code + "] 未开始生产!"); + throw new BadRequestException("设备 [" + device.getString("device_name") + "] 未开始生产!"); } int current_qty = work_order.getIntValue("unqualified_qty"); @@ -217,8 +222,8 @@ public class PdaServiceImpl implements PdaService { if (ObjectUtil.isEmpty(point)) { throw new BadRequestException("[" + point_code + "] 已删除或未启用!"); } - TaskUtils.isLocked(point); - JSONObject workorder = TaskUtils.hasWorkOrder(point); + TaskUtils.pointNameIsLocked(point); + JSONObject workorder = TaskUtils.pointNameHasWorkOrder(point); String vehicle_type = workorder.getString("vehicle_type"); WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); JSONObject vd_update = new JSONObject(); @@ -291,8 +296,9 @@ public class PdaServiceImpl implements PdaService { if (ObjectUtil.isEmpty(point)) { throw new BadRequestException("[" + point_code + "] 已删除或未启用!"); } + TaskUtils.pointNameIsLocked(point); - JSONObject workorder = TaskUtils.hasWorkOrder(point); + JSONObject workorder = TaskUtils.pointNameHasWorkOrder(point); Region region = Region.get(point.getString("region_code")); JSONObject method_param = new JSONObject(); @@ -325,6 +331,7 @@ public class PdaServiceImpl implements PdaService { if (ObjectUtil.isEmpty(point)) { throw new BadRequestException("[" + point_code + "] 已删除或未启用!"); } + TaskUtils.pointNameIsLocked(point); JSONObject workorder = WQLObject .getWQLObject("pdm_bd_workorder") @@ -342,6 +349,13 @@ public class PdaServiceImpl implements PdaService { switch (region) { case KLHJ: + JSONObject vd_update = new JSONObject(); + vd_update.put("is_delete", TrueOrFalse.TRUE.value()); + TaskUtils.addACSUpdateColum(vd_update); + WQLObject + .getWQLObject("st_ivt_vehicle_detail") + .update(vd_update, "vehicle_type = '1' AND vehicle_code = '" + vehicle_code + "'"); + WQLObject point_table = WQLObject.getWQLObject("sch_base_point"); point.put("vehicle_type", VehicleType.CUP.value()); point.put("vehicle_code", vehicle_code); @@ -358,6 +372,12 @@ public class PdaServiceImpl implements PdaService { yzSendEmptyTask.createTask(method_param); break; case FJ: + vd_update = new JSONObject(); + vd_update.put("is_delete", TrueOrFalse.TRUE.value()); + TaskUtils.addACSUpdateColum(vd_update); + WQLObject + .getWQLObject("st_ivt_vehicle_detail") + .update(vd_update, "vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'"); method_param.put("vehicle_code", vehicle_code); fjSendEmptyTask.createTask(method_param); break; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql index 0d42136..b4eafe8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/wql/PDA.wql @@ -79,6 +79,8 @@ device_name FROM pdm_bi_device + WHERE + is_workorder = '1' ORDER BY device_code ASC ENDSELECT diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java index 32b3c8b..d133acd 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java @@ -203,10 +203,10 @@ public class WorkorderServiceImpl implements WorkordeService { JSONObject workorder = WQLObject .getWQLObject("pdm_bd_workorder") - .query("is_delete = '0' AND device_id = '" + submit_obj.getString("device_id") + "' AND order_status = '3' AND workorder_id <> " + workorder_id) + .query("is_delete = '0' AND device_id = '" + submit_obj.getString("device_id") + "' AND order_status IN ('2', '3') AND workorder_id <> " + workorder_id) .uniqueResult(0); if (ObjectUtil.isNotEmpty(workorder)) { - throw new BadRequestException("该设备正在执行其它工单!"); + throw new BadRequestException("该设备已下发其它工单!"); } JSONArray request = new JSONArray(); @@ -425,14 +425,9 @@ public class WorkorderServiceImpl implements WorkordeService { if (workorder.getIntValue("order_status") < 5) { workorder.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value()); String qty = row.getString("qty"); - if (StrUtil.isBlank(qty)) { - JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("device_id = " + workorder.getString("device_id")).uniqueResult(0); - if (Region.HL.value().equals(device.getString("region_code"))) { - throw new BadRequestException("重量不能为空!"); - } - throw new BadRequestException("数量不能为空!"); + if (!StrUtil.isBlank(qty)) { + workorder.put("real_qty", qty); } - workorder.put("real_qty", qty); String unqualified_qty = row.getString("unqualified_qty"); if (StrUtil.isNotBlank(unqualified_qty) && !"0".equals(unqualified_qty)) { workorder.put("unqualified_qty", unqualified_qty); @@ -441,7 +436,7 @@ public class WorkorderServiceImpl implements WorkordeService { if (StrUtil.isNotBlank(qualified_qty) && !"0".equals(qualified_qty)) { workorder.put("qualified_qty", qualified_qty); } else { - workorder.put("qualified_qty", Integer.parseInt(qty) - workorder.getIntValue("unqualified_qty")); + workorder.put("qualified_qty", workorder.getIntValue("real_qty") - workorder.getIntValue("unqualified_qty")); } workorder.put("realproduceend_date", DateUtil.now()); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/YZSendEmptyTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/YZSendEmptyTask.java index d3fafce..470be15 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/YZSendEmptyTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/YZSendEmptyTask.java @@ -45,6 +45,9 @@ public class YZSendEmptyTask extends AbstractAcsTask { if (ObjectUtil.isNotEmpty(work_order)) { priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1; } + if (Region.KLHJ.value().equals(point.getString("region_code"))) { + priority++; + } JSONObject task = TaskUtils.buildTask( "压制区送空", diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/HLSendMaterialTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/HLSendMaterialTask.java index 373136b..9e1e89a 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/HLSendMaterialTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/HLSendMaterialTask.java @@ -46,7 +46,7 @@ public class HLSendMaterialTask extends AbstractAcsTask { int priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1; JSONObject vd = form.getJSONObject("vd"); - JSONObject pn = TaskUtils.buildPN(PickType.YL, vd.getLongValue("qty"), vd.getLongValue("workorder_id")); + JSONObject pn = TaskUtils.buildPN(PickType.YL, vd.getLongValue("weight"), vd.getLongValue("workorder_id")); WQLObject.getWQLObject("das_produce_number").insert(pn); JSONObject task = TaskUtils.buildTask( @@ -189,6 +189,15 @@ public class HLSendMaterialTask extends AbstractAcsTask { } WQLObject.getWQLObject("das_produce_number").delete("data_id = " + task.getLongValue("table_fk_id")); + + JSONObject workorder = WQL.getWO("SEND_MATERIAL_TASK").addParam("flag", "6").addParam("vd_id", task.getString("vd_id")).process().uniqueResult(0); + workorder.put("real_qty", workorder.getIntValue("real_qty") - workorder.getIntValue("weight")); + if (operation_type == OperationType.AUTO) { + TaskUtils.addACSUpdateColum(workorder); + } else if (operation_type == OperationType.MANUAL) { + TaskUtils.addCurrentUpdateColum(workorder); + } + WQLObject.getWQLObject("pdm_bd_workorder").update(workorder); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/wql/SEND_MATERIAL_TASK.wql b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/wql/SEND_MATERIAL_TASK.wql index bd4d063..902bf2c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/wql/SEND_MATERIAL_TASK.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/wql/SEND_MATERIAL_TASK.wql @@ -17,6 +17,7 @@ 输入.is_full TYPEAS s_string 输入.vehicle_type TYPEAS s_string 输入.material_id TYPEAS s_string + 输入.vd_id TYPEAS s_string [临时表] --这边列出来的临时表就会在运行期动态创建 @@ -136,3 +137,17 @@ ENDSELECT ENDQUERY ENDIF + + IF 输入.flag = "6" + QUERY + SELECT + workorder.*, + vd.weight + FROM + pdm_bd_workorder workorder + LEFT JOIN st_ivt_vehicle_detail vd ON workorder.workorder_id = vd.workorder_id + WHERE + vd.vd_id = 输入.vd_id + ENDSELECT + ENDQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java index a055458..c76a63f 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/util/TaskUtils.java @@ -42,8 +42,19 @@ public class TaskUtils { } } + public static void pointNameIsLocked(JSONObject point) { + String lock_type = point.getString("lock_type"); + if (!LockType.UNLOCKED.value().equals(lock_type)) { + throw new BadRequestException("[" + point.getString("point_name") + "] 已被" + LockType.get(lock_type).label() + "!"); + } + } + public static JSONObject hasWorkOrder(JSONObject point) { String device_code = point.getString("device_code"); + JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("is_used = '1' AND is_delete = '0' AND device_code = '" + device_code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(device)) { + throw new BadRequestException("[" + device_code + "] 不存在或未启用!"); + } JSONObject work_order = WQLObject .getWQLObject("pdm_bd_workorder") .query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'") @@ -54,6 +65,22 @@ public class TaskUtils { return work_order; } + public static JSONObject pointNameHasWorkOrder(JSONObject point) { + String device_code = point.getString("device_code"); + JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("is_used = '1' AND is_delete = '0' AND device_code = '" + device_code + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(device)) { + throw new BadRequestException("[" + device_code + "] 不存在或未启用!"); + } + JSONObject work_order = WQLObject + .getWQLObject("pdm_bd_workorder") + .query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'") + .uniqueResult(0); + if (ObjectUtil.isEmpty(work_order)) { + throw new BadRequestException("[" + point.getString("point_name") + "] 所属设备 [" + device.getString("device_name") + "] 未开始生产!"); + } + return work_order; + } + public static JSONObject buildTask( String task_name, String task_type, @@ -92,10 +119,10 @@ public class TaskUtils { task.put("create_time", DateUtil.now()); return task; } - + public static String formatVehicleCode(String vehicle_code) { if (StrUtil.isBlank(vehicle_code)) { - vehicle_code = "0000"; + vehicle_code = "0000"; } else { if (vehicle_code.length() > 4 || !vehicle_code.matches("^\\d+$")) { throw new BadRequestException("载具编码错误!"); @@ -134,7 +161,7 @@ public class TaskUtils { row.put("update_time", DateUtil.now()); } - public static JSONObject buildPN(PickType pickType, long real_qty, long workorder_id) { + public static JSONObject buildPN(PickType pickType, long real_qty, Long workorder_id) { JSONObject pn = new JSONObject(); pn.put("data_id", IdUtil.getSnowflake(1L, 1L).nextId()); pn.put("pick_type", pickType.value()); diff --git a/lms/nladmin-ui/src/views/wms/basedata/bom/index.vue b/lms/nladmin-ui/src/views/wms/basedata/bom/index.vue index abbfe1d..35b51b4 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/bom/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/bom/index.vue @@ -41,15 +41,15 @@ - - + + 分钟 - - + + 分钟 diff --git a/lms/nladmin-ui/src/views/wms/basedata/material/index.vue b/lms/nladmin-ui/src/views/wms/basedata/material/index.vue index 8a09d17..b86c221 100644 --- a/lms/nladmin-ui/src/views/wms/basedata/material/index.vue +++ b/lms/nladmin-ui/src/views/wms/basedata/material/index.vue @@ -42,7 +42,7 @@ - + 千克 @@ -56,28 +56,28 @@ - + 毫米 - + 毫米 - + 毫米 - + 毫米 diff --git a/lms/nladmin-ui/src/views/wms/pdm/workerorder/hl/index.vue b/lms/nladmin-ui/src/views/wms/pdm/workerorder/hl/index.vue index 3877ffe..382455c 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/workerorder/hl/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/workerorder/hl/index.vue @@ -129,7 +129,7 @@ - + 千克 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 03e7629..38779a5 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue @@ -129,7 +129,7 @@ - + @@ -197,7 +197,7 @@ {{ dict.label.vehicle_type[scope.row.vehicle_type] }} - +