feat:工单转移后端代码
This commit is contained in:
@@ -81,5 +81,12 @@ public class DeviceController {
|
||||
public ResponseEntity<Object> getAllRegions(){
|
||||
return new ResponseEntity<>(deviceService.getAllRegions(),HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/getYZDevice")
|
||||
@Log("获取压机设备")
|
||||
@ApiOperation("获取压机设备")
|
||||
//@SaCheckPermission("device:list")
|
||||
public ResponseEntity<Object> getYZDevice(){
|
||||
return new ResponseEntity<>(deviceService.getYZDevice(),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -134,6 +134,14 @@ public class WorkorderController {
|
||||
workordeService.forceFinish(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/changeDevice")
|
||||
@Log("工单转移")
|
||||
@ApiOperation("工单转移")
|
||||
//@SaCheckPermission("produceshiftorder:list")
|
||||
public ResponseEntity<Object> changeDevice(@RequestBody JSONObject param){
|
||||
workordeService.changeDevice(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getDtl")
|
||||
@Log("获取当前工单下的工单生产记录")
|
||||
|
||||
@@ -72,4 +72,6 @@ public interface DeviceService {
|
||||
* @return
|
||||
*/
|
||||
JSONArray getAllRegions();
|
||||
|
||||
JSONArray getYZDevice();
|
||||
}
|
||||
|
||||
@@ -126,4 +126,6 @@ public interface WorkordeService {
|
||||
JSONArray getMaterial();
|
||||
|
||||
void downloadExcel(Map<String, Object> params, HttpServletResponse response);
|
||||
|
||||
void changeDevice(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user