|
|
|
|
@@ -9,12 +9,15 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.nl.modules.common.exception.BadRequestException;
|
|
|
|
|
import org.nl.modules.common.utils.SecurityUtils;
|
|
|
|
|
import org.nl.modules.system.util.CodeUtil;
|
|
|
|
|
import org.nl.modules.wql.WQL;
|
|
|
|
|
import org.nl.modules.wql.core.bean.WQLObject;
|
|
|
|
|
import org.nl.modules.wql.util.SpringContextHolder;
|
|
|
|
|
import org.nl.wms.sch.SchTaskDto;
|
|
|
|
|
import org.nl.wms.sch.manage.AbstractAcsTask;
|
|
|
|
|
import org.nl.wms.sch.manage.TaskStatusEnum;
|
|
|
|
|
import org.nl.wms.sch.service.PointService;
|
|
|
|
|
import org.nl.wms.sch.tasks.AcsTaskDto;
|
|
|
|
|
import org.nl.wms.util.IdUtil;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -35,6 +38,7 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void updateTaskStatus(JSONObject task, String status) {
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
|
|
|
|
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point");
|
|
|
|
|
@@ -61,7 +65,7 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
taskTab.update(taskObj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
|
|
|
|
|
if ("1".equals(status)) {
|
|
|
|
|
// 更新任务状态为执行中
|
|
|
|
|
taskObj.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
|
|
|
|
taskObj.put("update_time", DateUtil.now());
|
|
|
|
|
@@ -69,7 +73,7 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
taskTab.update(taskObj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) {
|
|
|
|
|
if (StrUtil.equals(status, "2")) {
|
|
|
|
|
// 更改任务状态为完成
|
|
|
|
|
taskObj.put("task_status", TaskStatusEnum.FINISHED.getCode());
|
|
|
|
|
taskObj.put("update_time", DateUtil.now());
|
|
|
|
|
@@ -84,14 +88,19 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
WQLObject workOrderTab = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
|
|
|
|
JSONObject workorderObj = workOrderTab.query("workorder_id", workorder_id).uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
JSONObject point3 = pointTab.query("point_code = '" + point_code3 + "'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//区域出入表【st_ivt_regionIO】
|
|
|
|
|
WQLObject regionIoTab = WQLObject.getWQLObject("st_ivt_regionIO");
|
|
|
|
|
JSONObject regionIoObj = new JSONObject();
|
|
|
|
|
regionIoObj.put("stockrecord_id", IdUtil.getLongId());
|
|
|
|
|
regionIoObj.put("iostorinv_id", IdUtil.getLongId());
|
|
|
|
|
regionIoObj.put("bill_code", CodeUtil.getNewCode("IN_STORE_CODE"));
|
|
|
|
|
regionIoObj.put("buss_date", DateUtil.today());
|
|
|
|
|
regionIoObj.put("io_type", "1");
|
|
|
|
|
regionIoObj.put("region_id", point3.getString("region_id"));
|
|
|
|
|
regionIoObj.put("region_code", point3.getString("region_code"));
|
|
|
|
|
regionIoObj.put("region_name", point3.getString("region_name"));
|
|
|
|
|
regionIoObj.put("material_id", taskObj.getString("material_id"));
|
|
|
|
|
regionIoObj.put("vehicle_code", taskObj.getString("vehicle_code"));
|
|
|
|
|
regionIoObj.put("qty", requestObj.getString("qty"));
|
|
|
|
|
@@ -100,6 +109,9 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
regionIoObj.put("end_point_code", taskObj.getString("point_code3"));
|
|
|
|
|
regionIoObj.put("create_mode", "2");
|
|
|
|
|
regionIoObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd"));
|
|
|
|
|
regionIoObj.put("create_id", SecurityUtils.getCurrentUserId());
|
|
|
|
|
regionIoObj.put("create_name", SecurityUtils.getCurrentNickName());
|
|
|
|
|
regionIoObj.put("create_time", DateUtil.now());
|
|
|
|
|
regionIoTab.insert(regionIoObj);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -117,7 +129,7 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
ivtObj.put("instorage_time", DateUtil.now());
|
|
|
|
|
ivtObj.put("pcsn", DateUtil.format(DateUtil.parse(DateUtil.today()), "yyyyMMdd"));
|
|
|
|
|
ivtObj.put("ivt_qty", requestObj.getString("qty"));
|
|
|
|
|
ivtObj.put("standing_time", DateUtil.now());
|
|
|
|
|
ivtObj.put("standing_time", workorderObj.getString("standing_time"));
|
|
|
|
|
ivtObj.put("material_id", workorderObj.getString("material_id"));
|
|
|
|
|
ivtTab.insert(ivtObj);
|
|
|
|
|
}
|
|
|
|
|
@@ -140,7 +152,7 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
param1.put("flag", "1");
|
|
|
|
|
param1.put("material_id", material_id);
|
|
|
|
|
param1.put("region_code", "YSQA01");
|
|
|
|
|
param1.put("vehicle_type", vehicle_type);
|
|
|
|
|
param1.put("vehicle_type", "%" + vehicle_type + "%");
|
|
|
|
|
//1、查找库区类是否有响应的载具类型和对应的物料
|
|
|
|
|
JSONObject json1 = WQL.getWO("QSCH_gjxSendMaterial_01").addParamMap(param1).process().uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(json1)) {
|
|
|
|
|
@@ -152,7 +164,7 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
JSONObject firstRow = pointTab.query("block_num = '" + block_num + "' and col_num = '" + col_num + "' and row_num ='1'").uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(firstRow)) throw new BadRequestException("数据错误,请校验!");
|
|
|
|
|
taskObj.put("point_code2", firstRow.getString("point_code"));
|
|
|
|
|
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT);
|
|
|
|
|
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
|
|
|
|
taskObj.put("update_time", DateUtil.now());
|
|
|
|
|
//需要设置等待点
|
|
|
|
|
if (row_num > 2) {
|
|
|
|
|
@@ -166,9 +178,9 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
taskTab.update(taskObj);
|
|
|
|
|
} else {//找空位入
|
|
|
|
|
JSONObject param2 = new JSONObject();
|
|
|
|
|
param2.put("flag", "1");
|
|
|
|
|
param2.put("flag", "2");
|
|
|
|
|
param2.put("region_code", "YSQA01");
|
|
|
|
|
param2.put("vehicle_type", vehicle_type);
|
|
|
|
|
param2.put("vehicle_type", "%" + vehicle_type + "%");
|
|
|
|
|
//1、查找整列为空的货位
|
|
|
|
|
JSONObject json2 = WQL.getWO("QSCH_gjxSendMaterial_01").addParamMap(param2).process().uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isEmpty(json2)) {
|
|
|
|
|
@@ -180,7 +192,7 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
Integer col_num = json2.getInteger("col_num");
|
|
|
|
|
JSONObject firstRow = pointTab.query("block_num = '" + block_num + "' and col_num = '" + col_num + "' and row_num ='1'").uniqueResult(0);
|
|
|
|
|
taskObj.put("point_code2", firstRow.getString("point_code"));
|
|
|
|
|
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT);
|
|
|
|
|
taskObj.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
|
|
|
|
//二楼终点追加任务
|
|
|
|
|
taskObj.put("acs_task_type", "4");
|
|
|
|
|
taskObj.put("update_time", DateUtil.now());
|
|
|
|
|
@@ -237,10 +249,11 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
.task_id(IdUtil.getLongId())
|
|
|
|
|
.task_code(CodeUtil.getNewCode("TASK_CODE"))
|
|
|
|
|
.task_type("task_type")
|
|
|
|
|
.task_status(TaskStatusEnum.SURE_END.getCode())
|
|
|
|
|
.task_status(TaskStatusEnum.SURE_START.getCode())
|
|
|
|
|
.point_code1(point_code1)
|
|
|
|
|
.vehicle_code(vehicle_code)
|
|
|
|
|
.material_info_id(workOrderObj.getLong("workorder_id"))
|
|
|
|
|
.material_id(workOrderObj.getLong("material_id"))
|
|
|
|
|
.vehicle_type(vehicle_type)
|
|
|
|
|
.handle_class(THIS_CLASS)
|
|
|
|
|
.create_time(DateUtil.now())
|
|
|
|
|
@@ -258,7 +271,10 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void forceFinish(String task_id) {
|
|
|
|
|
|
|
|
|
|
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task");
|
|
|
|
|
JSONObject taskObj = taskTab.query("task_id = '" + task_id + "' and is_delete = '0' and task_status <> " + TaskStatusEnum.FINISHED.getCode()).uniqueResult(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(taskObj))
|
|
|
|
|
this.updateTaskStatus(taskObj,"2");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -285,7 +301,7 @@ public class GjxSendMaterial extends AbstractAcsTask {
|
|
|
|
|
JSONObject jsonOnePoint = pointTab.query("region_id = '" + jsonPoint2.getString("region_id") +
|
|
|
|
|
"' and block_num = '" + jsonPoint2.getString("block_num") +
|
|
|
|
|
"' and col_num = '" + jsonPoint2.getString("col_num") +
|
|
|
|
|
"' and point_status = '1' order by row_num").uniqueResult(0);
|
|
|
|
|
"' and point_status = '1' order by row_num desc").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(jsonOnePoint)) throw new BadRequestException("该列库存状态有误,请检查!");
|
|
|
|
|
|
|
|
|
|
|