|
@ -566,4 +566,42 @@ public class WorkorderServiceImpl implements WorkordeService { |
|
|
throw new RuntimeException(e); |
|
|
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); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|