diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java index 0b14755..4152418 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/DeviceController.java @@ -81,5 +81,12 @@ public class DeviceController { public ResponseEntity getAllRegions(){ return new ResponseEntity<>(deviceService.getAllRegions(),HttpStatus.OK); } + @PostMapping("/getYZDevice") + @Log("获取压机设备") + @ApiOperation("获取压机设备") + //@SaCheckPermission("device:list") + public ResponseEntity getYZDevice(){ + return new ResponseEntity<>(deviceService.getYZDevice(),HttpStatus.OK); + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/WorkorderController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/WorkorderController.java index 2873ed2..a715390 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/WorkorderController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/rest/WorkorderController.java @@ -134,6 +134,14 @@ public class WorkorderController { workordeService.forceFinish(param); return new ResponseEntity<>(HttpStatus.OK); } + @PostMapping("/changeDevice") + @Log("工单转移") + @ApiOperation("工单转移") + //@SaCheckPermission("produceshiftorder:list") + public ResponseEntity changeDevice(@RequestBody JSONObject param){ + workordeService.changeDevice(param); + return new ResponseEntity<>(HttpStatus.OK); + } @PostMapping("/getDtl") @Log("获取当前工单下的工单生产记录") diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java index 8492b31..00b6dd8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/DeviceService.java @@ -72,4 +72,6 @@ public interface DeviceService { * @return */ JSONArray getAllRegions(); + + JSONArray getYZDevice(); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/WorkordeService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/WorkordeService.java index 1bd390d..b5a4ec1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/WorkordeService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/WorkordeService.java @@ -126,4 +126,6 @@ public interface WorkordeService { JSONArray getMaterial(); void downloadExcel(Map params, HttpServletResponse response); + + void changeDevice(JSONObject param); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java index c3c4cdd..5f78457 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java @@ -146,4 +146,10 @@ public class DeviceServiceImpl implements DeviceService { return resultJSONArray; } + @Override + public JSONArray getYZDevice() { + WQLObject wo = WQLObject.getWQLObject("pdm_bi_device"); + JSONArray resultJSONArray = wo.query("region_code = 'YZ'").getResultJSONArray(0); + return resultJSONArray; + } } 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 804909f..6286616 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 @@ -566,4 +566,42 @@ public class WorkorderServiceImpl implements WorkordeService { throw new RuntimeException(e); } } + + @Override + public void changeDevice(JSONObject param) { + // 原先工单完成,创建新的工单。 + WQLObject workorderTab = WQLObject.getWQLObject("pdm_bd_workorder"); + WQLObject deviceTab = WQLObject.getWQLObject("pdm_bi_device"); + JSONObject deviceObj = deviceTab.query("device_code = '" + param.getString("new_device_code") + "'").uniqueResult(0); + // 计算剩余值 + Integer residual = param.getInteger("plan_qty") - param.getInteger("real_qty"); + JSONObject old = new JSONObject(); + old.put("order_status", WorkOrderEnum.ORDER_STATUS_FINISH.value()); + TaskUtils.addCurrentUpdateColum(old); + workorderTab.update(old, "workorder_id = '" + param.getString("workorder_id") + "'"); + // 创建新工单 + JSONObject work_order = new JSONObject(); + work_order.put("workorder_id", IdUtil.getSnowflake().nextId()); + work_order.put("workorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER")); + work_order.put("plan_qty", residual); + work_order.put("planproducestart_date", DateUtil.now()); + work_order.put("planproduceend_date", DateUtil.now()); + work_order.put("material_id", param.getString("material_id")); + work_order.put("vehicle_type", param.getString("vehicle_type")); + work_order.put("device_id", deviceObj.getString("device_id")); + work_order.put("device_code", deviceObj.getString("device_code")); + work_order.put("order_status", WorkOrderEnum.ORDER_STATUS_UNPRODUCED.value()); + work_order.put("is_urgent", param.getString("is_urgent")); + work_order.put("is_pri", param.getString("is_pri")); + work_order.put("ext_code", param.getString("ext_code")); + work_order.put("is_delete", TrueOrFalse.FALSE.value()); + work_order.put("plan_date", DateUtil.format(DateUtil.date(), "yyyy-MM-dd")); + Long user_id = SecurityUtils.getCurrentUserId(); + String nick_name = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + work_order.put("create_id", user_id); + work_order.put("create_name", nick_name); + work_order.put("create_time", now); + workorderTab.insert(work_order); + } }