opt: 优化代码

This commit is contained in:
2023-04-18 11:02:07 +08:00
parent bbc946caae
commit bab0bb2520
2 changed files with 13 additions and 14 deletions

View File

@@ -211,8 +211,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonDpjStart)) {
// todo
// 判断叠盘架是否有任务 有就下一个任务 : 可以去除
// 判断叠盘架是否有任务 有就下一个任务
boolean is_point = this.isTask(jsonDpjStart.getString("point_code"));
if (!is_point) {
jsonTask.put("remark", "当前叠盘架有任务");
@@ -226,7 +225,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
taskTab.update(jsonTask);
// 起点上锁
jsonDpjStart.put("lock_type", 2);
jsonDpjStart.put("lock_type", "2");
pointTab.update(jsonDpjStart);
} else {
@@ -234,7 +233,6 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
JSONObject jsonDpjStart2 = pointTab.query("region_id = '" + RegionTypeEnum.DPJQB.getId() + "' and can_vehicle_type = '" + vehicle_type + "' and lock_type = '1' and is_used = '1' and is_delete = '0' and vehicle_qty = '0'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonDpjStart2)) continue;
// todo: 删除任务校验
// 判断叠盘架是否有任务
boolean is_point = this.isTask(jsonDpjStart2.getString("point_code"));
if (!is_point) continue;
@@ -257,7 +255,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.point_code1(jsonZcKtp.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
.vehicle_code(jsonZcKtp.getString("vehicle_code"))
.vehicle_type(jsonZcKtp.getString("vehicle_type"))
.vehicle_type(vehicle_type)
.vehicle_qty(jsonZcKtp.getIntValue("vehicle_qty"))
.task_group_id(jsonTask.getLong("task_group_id"))
.handle_class(THIS_CLASS)
@@ -289,7 +287,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("养生A区-> 叠盘架空载具")
.task_name("养生A区->叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))
@@ -314,7 +312,7 @@ public class GjxCallEmpVehicleTask extends AbstractAcsTask {
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("养生A区>叠盘架空载具")
.task_name("养生A区->叠盘架空载具")
.task_status(TaskStatusEnum.START_AND_POINT.getCode())
.point_code1(jsonStartPoint.getString("point_code"))
.point_code2(jsonDpjStart2.getString("point_code"))

View File

@@ -135,22 +135,22 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
JSONObject workOrderObj = workOrderTab.query("device_code = '" + device_code + "' and order_status = '3' and is_delete ='0'").uniqueResult(0);
if (ObjectUtil.isEmpty(workOrderObj)) throw new BadRequestException("该设备当前未生产或者已删除");
//任务表【SCH_BASE_Task】
//判断当前点是否有未完成的任务
JSONObject taskObj = taskTab.query("is_delete='0' and point_code1 = '" + point_code1 + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "' FOR UPDATE").uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code1 + "存在未完成的任务");
String vehicleType = workOrderObj.getString("vehicle_type");
if (ObjectUtil.isEmpty(vehicleType)) throw new BadRequestException("载具类型不能为空");
JSONObject jsonObject = pointTab.query("region_code = 'YQQY01' and point_type = '2' and can_vehicle_type = '" + vehicleType + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonObject)) throw new BadRequestException("找不到油漆线托盘下料起点");
String startPointCode = jsonObject.getString("point_code");
//任务表【SCH_BASE_Task】
//判断当前点是否有未完成的任务
JSONObject taskObj = taskTab.query("is_delete='0' and point_code1 = '" +
startPointCode + "' and task_status <> '" + TaskStatusEnum.FINISHED.getCode() + "' FOR UPDATE").uniqueResult(0);
if (ObjectUtil.isNotEmpty(taskObj)) throw new BadRequestException("当前点位" + point_code1 + "存在未完成的任务");
SchTaskDto dto = SchTaskDto.builder().task_id(org.nl.wms.util.IdUtil.getLongId())
.task_code(CodeUtil.getNewCode("TASK_CODE"))
.task_type("")
.acs_task_type("2")
.task_name("油漆线空盘入库")
.task_status(TaskStatusEnum.SURE_START.getCode())
.point_code1(startPointCode)
@@ -412,11 +412,12 @@ public class YqxSendEmpVehicleTask extends AbstractAcsTask {
AcsTaskDto dto = AcsTaskDto.builder()
.task_id(json.getString("task_id"))
.task_code(json.getString("task_code"))
.task_type(json.getString("task_type"))
.task_type(json.getString("acs_task_type"))
.start_device_code(json.getString("point_code1"))
.next_device_code(point_code3)
.vehicle_code(json.getString("vehicle_code"))
.vehicle_type(json.getString("vehicle_type"))
.vehicle_qty(json.getString("vehicle_qty"))
.priority(json.getString("priority"))
.remark(json.getString("remark"))
.build();