|
@ -16,6 +16,7 @@ import org.nl.modules.wql.core.bean.WQLObject; |
|
|
import org.nl.wms.sch.SchTaskDto; |
|
|
import org.nl.wms.sch.SchTaskDto; |
|
|
import org.nl.wms.sch.manage.AbstractAcsTask; |
|
|
import org.nl.wms.sch.manage.AbstractAcsTask; |
|
|
import org.nl.wms.sch.manage.TaskStatusEnum; |
|
|
import org.nl.wms.sch.manage.TaskStatusEnum; |
|
|
|
|
|
import org.nl.wms.sch.manage.UpdateTaskStatusEnum; |
|
|
import org.nl.wms.sch.tasks.AcsTaskDto; |
|
|
import org.nl.wms.sch.tasks.AcsTaskDto; |
|
|
import org.nl.wms.util.IdUtil; |
|
|
import org.nl.wms.util.IdUtil; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -78,12 +79,13 @@ public class HnSendMaterialTask extends AbstractAcsTask { |
|
|
public void updateTaskStatus(JSONObject task, String status) { |
|
|
public void updateTaskStatus(JSONObject task, String status) { |
|
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); |
|
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); |
|
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); |
|
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); |
|
|
|
|
|
WQLObject materialTab = WQLObject.getWQLObject("MD_ME_MaterialBase"); |
|
|
|
|
|
|
|
|
String task_id = task.getString("task_id"); |
|
|
String task_id = task.getString("task_id"); |
|
|
JSONObject taskObj = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); |
|
|
JSONObject taskObj = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); |
|
|
|
|
|
|
|
|
//任务取消
|
|
|
//任务取消
|
|
|
if (StrUtil.equals(status, "0")) { |
|
|
if (StrUtil.equals(status, UpdateTaskStatusEnum.CANCEL.getCode())) { |
|
|
// 取消删除任务
|
|
|
// 取消删除任务
|
|
|
if (StrUtil.equals(taskObj.getString("task_status"), TaskStatusEnum.FINISHED.getCode())) { |
|
|
if (StrUtil.equals(taskObj.getString("task_status"), TaskStatusEnum.FINISHED.getCode())) { |
|
|
throw new BadRequestException("已完成不能取消!"); |
|
|
throw new BadRequestException("已完成不能取消!"); |
|
@ -99,7 +101,7 @@ public class HnSendMaterialTask extends AbstractAcsTask { |
|
|
taskTab.update(taskObj); |
|
|
taskTab.update(taskObj); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ("1".equals(status)) { |
|
|
if (UpdateTaskStatusEnum.EXECUTION.getCode().equals(status)) { |
|
|
// 更新任务状态为执行中
|
|
|
// 更新任务状态为执行中
|
|
|
taskObj.put("task_status", TaskStatusEnum.EXECUTING.getCode()); |
|
|
taskObj.put("task_status", TaskStatusEnum.EXECUTING.getCode()); |
|
|
taskObj.put("update_time", DateUtil.now()); |
|
|
taskObj.put("update_time", DateUtil.now()); |
|
@ -107,7 +109,7 @@ public class HnSendMaterialTask extends AbstractAcsTask { |
|
|
taskTab.update(taskObj); |
|
|
taskTab.update(taskObj); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (StrUtil.equals(status, "2")) { |
|
|
if (StrUtil.equals(status, UpdateTaskStatusEnum.FORCEFINISH.getCode())) { |
|
|
// 更改任务状态为完成
|
|
|
// 更改任务状态为完成
|
|
|
taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode()); |
|
|
taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode()); |
|
|
taskObj.put("update_optid", SecurityUtils.getCurrentUserId()); |
|
|
taskObj.put("update_optid", SecurityUtils.getCurrentUserId()); |
|
@ -147,11 +149,15 @@ public class HnSendMaterialTask extends AbstractAcsTask { |
|
|
regionIoObj.put("create_time", DateUtil.now()); |
|
|
regionIoObj.put("create_time", DateUtil.now()); |
|
|
regionIoTab.insert(regionIoObj); |
|
|
regionIoTab.insert(regionIoObj); |
|
|
|
|
|
|
|
|
|
|
|
JSONObject materialObj = materialTab.query("material_id = '" + workorderObj.getString("material_id") + "'").uniqueResult(0); |
|
|
|
|
|
if (ObjectUtil.isEmpty(materialObj)) throw new BadRequestException("物料不存在!"); |
|
|
|
|
|
|
|
|
//完成后入库
|
|
|
//完成后入库
|
|
|
point2Obj.put("instorage_time", DateUtil.now()); |
|
|
point2Obj.put("instorage_time", taskObj.getString("create_time")); // 入库时间为任务生成的时间
|
|
|
point2Obj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd")); |
|
|
point2Obj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd")); |
|
|
point2Obj.put("ivt_qty", requestObj.getString("qty")); |
|
|
point2Obj.put("ivt_qty", requestObj.getString("qty")); |
|
|
point2Obj.put("standing_time", workorderObj.getString("standing_time")); |
|
|
point2Obj.put("standing_time", materialObj.getString("standing_time")); |
|
|
|
|
|
point2Obj.put("warn_time", materialObj.getString("standing_time")); |
|
|
point2Obj.put("material_id", workorderObj.getString("material_id")); |
|
|
point2Obj.put("material_id", workorderObj.getString("material_id")); |
|
|
point2Obj.put("vehicle_type", workorderObj.getString("vehicle_type")); |
|
|
point2Obj.put("vehicle_type", workorderObj.getString("vehicle_type")); |
|
|
point2Obj.put("vehicle_code", taskObj.getString("vehicle_code")); |
|
|
point2Obj.put("vehicle_code", taskObj.getString("vehicle_code")); |
|
|