|
|
@ -3,24 +3,25 @@ package org.nl.wms.sch.task.send.empty; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.nl.modules.common.exception.BadRequestException; |
|
|
|
import org.nl.modules.wql.WQL; |
|
|
|
import org.nl.modules.wql.core.bean.WQLObject; |
|
|
|
import org.nl.wms.basedata.eum.TrueOrFalse; |
|
|
|
import org.nl.wms.basedata.eum.VehicleType; |
|
|
|
import org.nl.wms.sch.manage.*; |
|
|
|
import org.nl.wms.sch.task.send.material.HLSendMaterialTask; |
|
|
|
import org.nl.wms.sch.task.send.material.YZSendMaterialTask; |
|
|
|
import org.nl.wms.sch.task.util.TaskUtils; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
/** |
|
|
|
* @author zhangjiangwei |
|
|
|
* @date 2023/04/14 21:29 |
|
|
|
*/ |
|
|
|
@RequiredArgsConstructor |
|
|
|
@Component |
|
|
|
public class FJSendEmptyTask extends AbstractAcsTask { |
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void updateTaskStatus(JSONObject task, String status) { |
|
|
|
if (TaskStatus.EXECUTING.value().equals(status)) { |
|
|
@ -34,32 +35,23 @@ public class FJSendEmptyTask extends AbstractAcsTask { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public String createTask(JSONObject form) { |
|
|
|
JSONObject point = form.getJSONObject("point"); |
|
|
|
|
|
|
|
TaskUtils.isLocked(point); |
|
|
|
JSONObject work_order = TaskUtils.hasWorkOrder(point); |
|
|
|
|
|
|
|
String vehicle_code = form.getString("vehicle_code"); |
|
|
|
if ("0000".equals(vehicle_code)) { |
|
|
|
throw new BadRequestException("载具编码不能为空!"); |
|
|
|
} |
|
|
|
|
|
|
|
// todo 组盘
|
|
|
|
|
|
|
|
JSONObject task = TaskUtils.buildTask( |
|
|
|
"混料机送料入库", |
|
|
|
TaskType.SEND_MATERIAL.value(), |
|
|
|
"分拣区送空", |
|
|
|
TaskType.SEND_EMPTY.value(), |
|
|
|
TaskStatus.SURE_START.value(), |
|
|
|
point.getString("point_code"), |
|
|
|
null, |
|
|
|
work_order.getString("material_id"), |
|
|
|
VehicleType.CUP.value(), |
|
|
|
null, |
|
|
|
VehicleType.STEEL_TRAY.value(), |
|
|
|
vehicle_code, |
|
|
|
TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? "99" : "1", |
|
|
|
HLSendMaterialTask.class.getName(), |
|
|
|
"1", |
|
|
|
FJSendEmptyTask.class.getName(), |
|
|
|
form.getString("create_mode"), |
|
|
|
form.getString("request_param"), |
|
|
|
form.getString("create_id"), |
|
|
@ -67,6 +59,10 @@ public class FJSendEmptyTask extends AbstractAcsTask { |
|
|
|
); |
|
|
|
WQLObject.getWQLObject("sch_base_task").insert(task); |
|
|
|
|
|
|
|
point.put("lock_type", LockType.TASK_LOCKED.value()); |
|
|
|
point.put("task_code", task.getString("task_code")); |
|
|
|
WQLObject.getWQLObject("sch_base_point").update(point); |
|
|
|
|
|
|
|
return task.getString("task_id"); |
|
|
|
} |
|
|
|
|
|
|
@ -75,7 +71,7 @@ public class FJSendEmptyTask extends AbstractAcsTask { |
|
|
|
public void findNextPoint() { |
|
|
|
WQLObject task_table = WQLObject.getWQLObject("sch_base_task"); |
|
|
|
JSONArray tasks = task_table |
|
|
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + YZSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC") |
|
|
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + FJSendEmptyTask.class.getName() + "'", "priority DESC, create_time ASC") |
|
|
|
.getResultJSONArray(0); |
|
|
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point"); |
|
|
|
|
|
|
@ -83,7 +79,7 @@ public class FJSendEmptyTask extends AbstractAcsTask { |
|
|
|
JSONObject task = tasks.getJSONObject(i); |
|
|
|
|
|
|
|
JSONObject point = WQL |
|
|
|
.getWO("SEND_MATERIAL_TASK") |
|
|
|
.getWO("SEND_EMPTY_TASK") |
|
|
|
.addParam("flag", "1") |
|
|
|
.process() |
|
|
|
.uniqueResult(0); |
|
|
@ -186,8 +182,6 @@ public class FJSendEmptyTask extends AbstractAcsTask { |
|
|
|
JSONObject point2 = new JSONObject(); |
|
|
|
point2.put("lock_type", LockType.UNLOCKED.value()); |
|
|
|
point2.put("task_code", ""); |
|
|
|
point2.put("vehicle_type", task.getString("vehicle_type")); |
|
|
|
point2.put("vehicle_code", task.getString("vehicle_code")); |
|
|
|
point2.put("point_status", PointStatus.NOT_EMPTY.value()); |
|
|
|
if (operation_type == OperationType.AUTO) { |
|
|
|
TaskUtils.addACSUpdateColum(point2); |
|
|
|