add 去包装线任务

This commit is contained in:
张江玮
2023-05-04 17:27:58 +08:00
parent abe1fb2d19
commit 6dfaa6130f
26 changed files with 1183 additions and 448 deletions

View File

@@ -0,0 +1,38 @@
package org.nl.wms.basedata.eum;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
import java.util.stream.Collectors;
/**
* 静置状态
*
* @author zhangjiangwei
* @date 2023/05/04 09:26
*/
@RequiredArgsConstructor
public enum StandStatus {
WITHOUT("无需静置", "1"),
STANDING("静置中", "2"),
COMPLETED("静置完成", "3"),
FORCE_COMPLETION("强制静置完成", "4"),
TIMEOUT("静置超时", "5");
private final String label;
private final String value;
public String label() {
return this.label;
}
public String value() {
return this.value;
}
public static StandStatus get(String value) {
return Arrays.stream(StandStatus.values()).filter(vt -> vt.value.equals(value)).collect(Collectors.toList()).get(0);
}
}

View File

@@ -15,7 +15,6 @@ 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.basedata.eum.TrueOrFalse;
import org.nl.wms.basedata.eum.VehicleStatus;
import org.nl.wms.basedata.eum.VehicleType;
import org.nl.wms.basedata.service.dto.VehicleDto;
import org.nl.wms.ext.acs.service.AcsToWmsService;
@@ -30,16 +29,15 @@ import org.nl.wms.sch.task.send.material.FJSendMaterialTask;
import org.nl.wms.sch.task.send.material.HLSendMaterialTask;
import org.nl.wms.sch.task.send.material.SZSendMaterialTask;
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
import org.nl.wms.sch.task.to.pack.BTHCToPackageTask;
import org.nl.wms.sch.task.to.pack.FJToPackageTask;
import org.nl.wms.sch.task.util.TaskUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Service
@RequiredArgsConstructor
@@ -66,6 +64,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
private final FJCallEmptyTask fjCallEmptyTask;
private final FJToPackageTask fjToPackageTask;
private final BTHCToPackageTask bthcToPackageTask;
/**
* task_id任务标识
* task_code任务编码
@@ -334,6 +336,29 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
throw new BadRequestException("[" + region.label() + "] 不能发起叫空任务!");
}
break;
case "5":
// 去包装
switch (region) {
case FJ:
method_param.put("workorder", param.getJSONObject("workorder"));
method_param.put("vd", param.getJSONObject("vd"));
task_code = yzSendMaterialTask.createTask(method_param);
break;
case BTHC:
TaskUtils.isNotEmptyPoint(point);
JSONObject vd = WQLObject
.getWQLObject("st_ivt_vehicle_detail").query("is_delete = '0' vehicle_type = '" + point.getString("vehicle_type") + "' AND vehicle_code = '" + point.getString("vehicle_code") + "'")
.uniqueResult(0);
if (ObjectUtil.isEmpty(vd)) {
throw new BadRequestException("未找到 [" + point_code + "] 上的组盘信息!");
}
method_param.put("vd", vd);
task_code = bthcToPackageTask.createTask(method_param);
break;
default:
throw new BadRequestException("[" + region.label() + "] 不能发起去包装任务!");
}
break;
default:
throw new BadRequestException("未知任务类型!");
}
@@ -464,13 +489,12 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
if (Region.FJ.value().equals(region_code)) {
vd.put("is_in_kiln", TrueOrFalse.FALSE.value());
}
if (Region.FJ.value().equals(region_code)) {
vd.put("is_package", jsonObject.getString("is_package"));
}
vd_table.insert(vd);
JSONObject vehicle_update = new JSONObject();
vehicle_update.put("vehicle_status", VehicleStatus.NOT_EMPTY.value());
WQLObject.getWQLObject("md_pb_vehicle").update(vehicle_update, "vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'");
// 入库
JSONObject param = new JSONObject();
param.put("device_code", point.getString("point_code"));
@@ -478,7 +502,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
param.put("workorder", workorder);
param.put("vd", vd);
param.put("vehicle_code", vehicle_code);
param.put("type", "1");
param.put("type", jsonObject.getString("type"));
param.put("request_param", jsonObject.toJSONString());
return this.apply(param);
}

View File

@@ -15,7 +15,8 @@ public enum TaskType {
SEND_MATERIAL("送料", "1"),
CALL_MATERIAL("叫料", "2"),
SEND_EMPTY("送空", "3"),
CALL_EMPTY("叫空", "4");
CALL_EMPTY("叫空", "4"),
TO_PACKAGE("去包装", "5");
private final String label;
private final String value;

View File

@@ -132,7 +132,7 @@ public class TaskServiceImpl implements TaskService {
wo.update(param);
}
} catch (Exception e) {
e.printStackTrace();
log.error("任务操作失败!", e);
throw new BadRequestException(e.getMessage());
}
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.call.empty;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -143,34 +144,47 @@ public class FJCallEmptyTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
@@ -180,34 +194,41 @@ public class FJCallEmptyTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.call.empty;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -120,22 +121,31 @@ public class GTKCallEmptyTask extends AbstractAcsTask {
}
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
@@ -144,16 +154,20 @@ public class GTKCallEmptyTask extends AbstractAcsTask {
}
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}

View File

@@ -12,7 +12,6 @@ import org.nl.wms.basedata.eum.VehicleType;
import org.nl.wms.sch.manage.*;
import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* 辽宁晟华混料 叫空 任务类
@@ -42,7 +41,7 @@ public class HLCallEmptyTask extends AbstractAcsTask {
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
TaskUtils.isEmpty(point);
TaskUtils.isEmptyPoint(point);
TaskUtils.isLocked(point);
JSONObject work_order = TaskUtils.hasWorkOrder(point);
@@ -162,8 +161,14 @@ public class HLCallEmptyTask extends AbstractAcsTask {
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.call.empty;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -145,34 +146,47 @@ public class YZCallEmptyTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
@@ -182,34 +196,43 @@ public class YZCallEmptyTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)) {
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
}
point_table.update(point1);
}
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
}

View File

@@ -1,5 +1,5 @@
[交易说明]
交易名: 叫空托盘
交易名: 叫空
所属模块:
功能简述:
版权所有:

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.call.material;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -19,9 +20,9 @@ import org.springframework.stereotype.Component;
*/
@RequiredArgsConstructor
@Component
public class FJCallMaterialTask extends AbstractAcsTask {
public class FJCallMaterialTask extends AbstractAcsTask {
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {
@@ -35,7 +36,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
}
}
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
@@ -68,7 +69,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
return task.getString("task_code");
}
@Override
public void findStartPoint() {
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
@@ -106,7 +107,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
}
}
@Override
public void forceFinish(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -116,7 +117,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
this.finishTask(task, OperationType.MANUAL);
}
@Override
public void cancel(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -126,7 +127,7 @@ public class FJCallMaterialTask extends AbstractAcsTask {
this.cancelTask(task, OperationType.MANUAL);
}
public void cancelTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.CANCELLED.value());
@@ -138,35 +139,48 @@ public class FJCallMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
@@ -176,34 +190,41 @@ public class FJCallMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.call.material;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -20,7 +21,7 @@ import org.springframework.stereotype.Component;
@Component
public class SZCallMaterialTask extends AbstractAcsTask {
@Override
public void autoCreate() {
JSONArray points = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "2").process().getResultJSONArray(0);
@@ -38,7 +39,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
}
}
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {
@@ -52,7 +53,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
}
}
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
@@ -84,7 +85,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
return task.getString("task_code");
}
@Override
public void findStartPoint() {
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
@@ -122,7 +123,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
}
}
@Override
public void forceFinish(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -132,7 +133,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
this.finishTask(task, OperationType.MANUAL);
}
@Override
public void cancel(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -142,7 +143,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
this.cancelTask(task, OperationType.MANUAL);
}
public void cancelTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.CANCELLED.value());
@@ -154,35 +155,48 @@ public class SZCallMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);

View File

@@ -1,5 +1,5 @@
[交易说明]
交易名: 叫空托盘
交易名: 叫
所属模块:
功能简述:
版权所有:

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.send.empty;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -18,9 +19,9 @@ import org.springframework.stereotype.Component;
*/
@RequiredArgsConstructor
@Component
public class FJSendEmptyTask extends AbstractAcsTask {
public class FJSendEmptyTask extends AbstractAcsTask {
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {
@@ -34,7 +35,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
}
}
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
@@ -66,7 +67,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
return task.getString("task_code");
}
@Override
public void findNextPoint() {
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
@@ -101,7 +102,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
}
}
@Override
public void forceFinish(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -111,7 +112,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
this.finishTask(task, OperationType.MANUAL);
}
@Override
public void cancel(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -121,7 +122,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
this.cancelTask(task, OperationType.MANUAL);
}
public void cancelTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.CANCELLED.value());
@@ -133,34 +134,47 @@ public class FJSendEmptyTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
@@ -170,32 +184,39 @@ public class FJSendEmptyTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
}

View File

@@ -1,5 +1,5 @@
[交易说明]
交易名: 叫空托盘
交易名: 送空
所属模块:
功能简述:
版权所有:

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.send.material;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -45,16 +46,13 @@ public class FJSendMaterialTask extends AbstractAcsTask {
int priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1;
JSONObject vd = form.getJSONObject("vd");
JSONObject pn = TaskUtils.buildPN(PickType.CP, vd.getLongValue("qty"), vd.getLongValue("workorder_id"));
WQLObject.getWQLObject("das_produce_number").insert(pn);
JSONObject material_task = TaskUtils.buildTask(
"分拣区送料",
TaskType.SEND_MATERIAL.value(),
TaskStatus.SURE_START.value(),
point.getString("point_code"),
null,
pn.getLongValue("data_id"),
null,
vd.getString("material_id"),
vd.getString("vehicle_type"),
vd.getString("vehicle_code"),
@@ -65,9 +63,12 @@ public class FJSendMaterialTask extends AbstractAcsTask {
form.getString("create_id"),
form.getString("create_name")
);
WQLObject.getWQLObject("sch_base_task").insert(material_task);
if (TrueOrFalse.trueOrFalse(vd.getString("is_full"))) {
JSONObject pn = TaskUtils.buildPN(PickType.CP, vd.getLongValue("qty"), vd.getLongValue("workorder_id"));
WQLObject.getWQLObject("das_produce_number").insert(pn);
material_task.put("group_id", pn.getLong("data_id"));
JSONObject empty_task = TaskUtils.buildTask(
"分拣区叫空",
TaskType.CALL_EMPTY.value(),
@@ -89,6 +90,8 @@ public class FJSendMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").insert(empty_task);
}
WQLObject.getWQLObject("sch_base_task").insert(material_task);
point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", material_task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
@@ -210,38 +213,53 @@ public class FJSendMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
if (TaskType.SEND_MATERIAL.value().equals(task.getString("task_type"))) {
WQLObject.getWQLObject("das_produce_number").delete("data_id = " + task.getLongValue("group_id"));
String data_id = task.getString("group_id");
if (TaskType.SEND_MATERIAL.value().equals(task.getString("task_type"))
&& StrUtil.isNotBlank(data_id)) {
WQLObject.getWQLObject("das_produce_number").delete("data_id = " + data_id);
}
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
@@ -251,37 +269,46 @@ public class FJSendMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (TaskType.CALL_EMPTY.value().equals(task.getString("task_type"))) {
point2.put("vehicle_type", task.getString("vehicle_type"));
point2.put("vehicle_code", task.getString("vehicle_code"));
point2.put("point_status", PointStatus.NOT_EMPTY.value());
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (TaskType.CALL_EMPTY.value().equals(task.getString("task_type"))) {
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
// todo 如果是送料任务需要发送唛头信息到包装机
}
}
}

View File

@@ -163,8 +163,14 @@ public class HLSendMaterialTask extends AbstractAcsTask {
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.send.material;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
@Component
public class SZSendMaterialTask extends AbstractAcsTask {
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {
@@ -33,7 +34,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
}
}
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
@@ -66,7 +67,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
return task.getString("task_code");
}
@Override
public void findNextPoint() {
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
@@ -101,7 +102,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
}
}
@Override
public void forceFinish(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -111,7 +112,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
this.finishTask(task, OperationType.MANUAL);
}
@Override
public void cancel(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -121,7 +122,7 @@ public class SZSendMaterialTask extends AbstractAcsTask {
this.cancelTask(task, OperationType.MANUAL);
}
public void cancelTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.CANCELLED.value());
@@ -133,34 +134,47 @@ public class SZSendMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
@@ -170,35 +184,42 @@ public class SZSendMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 +"'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
}

View File

@@ -1,6 +1,7 @@
package org.nl.wms.sch.task.send.material;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -21,7 +22,7 @@ import org.springframework.stereotype.Component;
@Component
public class YZSendMaterialTask extends AbstractAcsTask {
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {
@@ -35,7 +36,7 @@ public class YZSendMaterialTask extends AbstractAcsTask {
}
}
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
@@ -73,7 +74,7 @@ public class YZSendMaterialTask extends AbstractAcsTask {
return task.getString("task_code");
}
@Override
public void findNextPoint() {
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
@@ -109,7 +110,7 @@ public class YZSendMaterialTask extends AbstractAcsTask {
}
}
@Override
public void forceFinish(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -119,7 +120,7 @@ public class YZSendMaterialTask extends AbstractAcsTask {
this.finishTask(task, OperationType.MANUAL);
}
@Override
public void cancel(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
@@ -129,7 +130,7 @@ public class YZSendMaterialTask extends AbstractAcsTask {
this.cancelTask(task, OperationType.MANUAL);
}
public void cancelTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.CANCELLED.value());
@@ -141,36 +142,49 @@ public class YZSendMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
WQLObject.getWQLObject("das_produce_number").delete("data_id = " + task.getLongValue("group_id"));
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
@@ -180,35 +194,42 @@ public class YZSendMaterialTask extends AbstractAcsTask {
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
JSONObject point1 = point_table.query("point_code = '" + task.getString("point_code1") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
point_table.update(point1);
}
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
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);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
}
}
}

View File

@@ -1,5 +1,5 @@
[交易说明]
交易名: 送料入库
交易名: 送料
所属模块:
功能简述:
版权所有:

View File

@@ -0,0 +1,228 @@
package org.nl.wms.sch.task.to.pack;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
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.common.PickType;
import org.nl.wms.sch.manage.*;
import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component;
/**
* @author zhangjiangwei
* @date 2023/05/04 10:05
*/
@RequiredArgsConstructor
@Component
public class BTHCToPackageTask extends AbstractAcsTask {
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {
task.put("task_status", TaskStatus.EXECUTING.value());
TaskUtils.addACSUpdateColum(task);
WQLObject.getWQLObject("sch_base_task").update(task);
} else if (TaskStatus.FINISHED.value().equals(status)) {
this.finishTask(task, OperationType.AUTO);
} else if (TaskStatus.CANCELLED.value().equals(status)) {
this.cancelTask(task, OperationType.AUTO);
}
}
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
JSONObject vd = form.getJSONObject("vd");
JSONObject pn = TaskUtils.buildPN(PickType.CP, vd.getLongValue("qty"), vd.getLongValue("workorder_id"));
WQLObject.getWQLObject("das_produce_number").insert(pn);
JSONObject task = TaskUtils.buildTask(
"半托缓存区去包装",
TaskType.TO_PACKAGE.value(),
TaskStatus.SURE_START.value(),
point.getString("point_code"),
null,
pn.getLongValue("data_id"),
vd.getString("material_id"),
vd.getString("vehicle_type"),
vd.getString("vehicle_code"),
1,
BTHCToPackageTask.class.getName(),
form.getString("create_mode"),
form.getString("request_param"),
form.getString("create_id"),
form.getString("create_name")
);
WQLObject.getWQLObject("sch_base_task").insert(task);
point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_code");
}
@Override
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 = '" + BTHCToPackageTask.class.getName() + "'", "priority DESC, create_time ASC")
.getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(tasks)) {
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
for (int i = 0; i < tasks.size(); i++) {
JSONObject task = tasks.getJSONObject(i);
JSONObject point = WQL
.getWO("TO_PACKAGE_TASK")
.addParam("flag", "1")
.process()
.uniqueResult(0);
if (ObjectUtil.isNotEmpty(point)) {
task.put("task_status", TaskStatus.START_AND_END.value());
task.put("point_code2", point.getString("point_code"));
task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
task_table.update(task);
point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code"));
TaskUtils.addAutoUpdateColum(point);
point_table.update(point);
}
}
}
}
@Override
public void forceFinish(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
if (ObjectUtil.isEmpty(task)) {
throw new BadRequestException("未找到任务!");
}
this.finishTask(task, OperationType.MANUAL);
}
@Override
public void cancel(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
if (ObjectUtil.isEmpty(task)) {
throw new BadRequestException("未找到任务!");
}
this.cancelTask(task, OperationType.MANUAL);
}
public void cancelTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.CANCELLED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(task);
}
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
}
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
WQLObject.getWQLObject("das_produce_number").delete("data_id = " + task.getLongValue("group_id"));
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(task);
}
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
}
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
}
}
}

View File

@@ -0,0 +1,230 @@
package org.nl.wms.sch.task.to.pack;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
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.common.PickType;
import org.nl.wms.sch.manage.*;
import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component;
/**
* @author zhangjiangwei
* @date 2023/05/04 09:40
*/
@RequiredArgsConstructor
@Component
public class FJToPackageTask extends AbstractAcsTask {
@Override
public void updateTaskStatus(JSONObject task, String status) {
if (TaskStatus.EXECUTING.value().equals(status)) {
task.put("task_status", TaskStatus.EXECUTING.value());
TaskUtils.addACSUpdateColum(task);
WQLObject.getWQLObject("sch_base_task").update(task);
} else if (TaskStatus.FINISHED.value().equals(status)) {
this.finishTask(task, OperationType.AUTO);
} else if (TaskStatus.CANCELLED.value().equals(status)) {
this.cancelTask(task, OperationType.AUTO);
}
}
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
JSONObject work_order = form.getJSONObject("workorder");
int priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1;
JSONObject vd = form.getJSONObject("vd");
JSONObject pn = TaskUtils.buildPN(PickType.CP, vd.getLongValue("qty"), vd.getLongValue("workorder_id"));
WQLObject.getWQLObject("das_produce_number").insert(pn);
JSONObject task = TaskUtils.buildTask(
"分拣区去包装",
TaskType.TO_PACKAGE.value(),
TaskStatus.SURE_START.value(),
point.getString("point_code"),
null,
pn.getLongValue("data_id"),
vd.getString("material_id"),
vd.getString("vehicle_type"),
vd.getString("vehicle_code"),
priority,
FJToPackageTask.class.getName(),
form.getString("create_mode"),
form.getString("request_param"),
form.getString("create_id"),
form.getString("create_name")
);
WQLObject.getWQLObject("sch_base_task").insert(task);
point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code"));
TaskUtils.addFormUpdateColum(point, form);
WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_code");
}
@Override
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 = '" + FJToPackageTask.class.getName() + "'", "priority DESC, create_time ASC")
.getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(tasks)) {
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
for (int i = 0; i < tasks.size(); i++) {
JSONObject task = tasks.getJSONObject(i);
JSONObject point = WQL
.getWO("TO_PACKAGE_TASK")
.addParam("flag", "1")
.process()
.uniqueResult(0);
if (ObjectUtil.isNotEmpty(point)) {
task.put("task_status", TaskStatus.START_AND_END.value());
task.put("point_code2", point.getString("point_code"));
task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
task_table.update(task);
point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code"));
TaskUtils.addAutoUpdateColum(point);
point_table.update(point);
}
}
}
}
@Override
public void forceFinish(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
if (ObjectUtil.isEmpty(task)) {
throw new BadRequestException("未找到任务!");
}
this.finishTask(task, OperationType.MANUAL);
}
@Override
public void cancel(String task_id) {
JSONObject task = WQLObject.getWQLObject("sch_base_task").query("task_id = " + task_id).uniqueResult(0);
if (ObjectUtil.isEmpty(task)) {
throw new BadRequestException("未找到任务!");
}
this.cancelTask(task, OperationType.MANUAL);
}
public void cancelTask(JSONObject task, OperationType operation_type) {
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
task.put("task_status", TaskStatus.CANCELLED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(task);
}
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
}
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
WQLObject.getWQLObject("das_produce_number").delete("data_id = " + task.getLongValue("group_id"));
}
}
public void finishTask(JSONObject task, OperationType operation_type) {
int current_task_status = task.getIntValue("task_status");
if (current_task_status < Integer.parseInt(TaskStatus.FINISHED.value())) {
if (operation_type == OperationType.MANUAL
&& current_task_status < Integer.parseInt(TaskStatus.START_AND_END.value())) {
throw new BadRequestException("只能手动完成 [确认起点和终点] 之后的任务!");
}
task.put("task_status", TaskStatus.FINISHED.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(task);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(task);
}
WQLObject.getWQLObject("sch_base_task").update(task);
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
String point_code1 = task.getString("point_code1");
if (StrUtil.isNotBlank(point_code1)) {
JSONObject point1 = point_table.query("point_code = '" + point_code1 + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(point1)
&& LockType.TASK_LOCKED.value().equals(point1.getString("lock_type"))
&& task.getString("task_code").equals(point1.getString("task_code"))) {
point1.put("lock_type", LockType.UNLOCKED.value());
point1.put("task_code", "");
point1.put("vehicle_type", "");
point1.put("vehicle_code", "");
point1.put("point_status", PointStatus.EMPTY.value());
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point1);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point1);
}
point_table.update(point1);
}
}
String point_code2 = task.getString("point_code2");
if (StrUtil.isNotBlank(point_code2)) {
JSONObject point2 = new JSONObject();
point2.put("lock_type", LockType.UNLOCKED.value());
point2.put("task_code", "");
if (operation_type == OperationType.AUTO) {
TaskUtils.addACSUpdateColum(point2);
} else if (operation_type == OperationType.MANUAL) {
TaskUtils.addCurrentUpdateColum(point2);
}
point_table.update(point2, "point_code = '" + point_code2 + "'");
}
}
}
}

View File

@@ -0,0 +1,40 @@
[交易说明]
交易名: 去包装
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
IF 输入.flag = "1"
QUERY
SELECT
*
FROM
sch_base_point
WHERE
is_used = '1'
AND lock_type = '1'
AND point_status = '0'
AND region_code = 'FJ'
AND point_type = '5'
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -23,12 +23,18 @@ import org.nl.wms.sch.manage.PointStatus;
*/
public class TaskUtils {
public static void isEmpty(JSONObject point) {
public static void isEmptyPoint(JSONObject point) {
if (PointStatus.NOT_EMPTY.value().equals(point.getString("point_status"))) {
throw new BadRequestException("[" + point.getString("point_code") + "] 上有货!");
}
}
public static void isNotEmptyPoint(JSONObject point) {
if (PointStatus.EMPTY.value().equals(point.getString("point_status"))) {
throw new BadRequestException("[" + point.getString("point_code") + "] 上无货!");
}
}
public static void isLocked(JSONObject point) {
String lock_type = point.getString("lock_type");
if (!LockType.UNLOCKED.value().equals(lock_type)) {