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