fix 任务流程
This commit is contained in:
@@ -20,11 +20,13 @@ import org.nl.wms.basedata.eum.VehicleType;
|
|||||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||||
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
import org.nl.wms.ext.acs.service.AcsToWmsService;
|
||||||
import org.nl.wms.sch.manage.*;
|
import org.nl.wms.sch.manage.*;
|
||||||
|
import org.nl.wms.sch.task.call.empty.FJCallEmptyTask;
|
||||||
import org.nl.wms.sch.task.call.empty.GTKCallEmptyTask;
|
import org.nl.wms.sch.task.call.empty.GTKCallEmptyTask;
|
||||||
import org.nl.wms.sch.task.call.empty.HLCallEmptyTask;
|
import org.nl.wms.sch.task.call.empty.HLCallEmptyTask;
|
||||||
import org.nl.wms.sch.task.call.empty.YZCallEmptyTask;
|
import org.nl.wms.sch.task.call.empty.YZCallEmptyTask;
|
||||||
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
|
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
|
||||||
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
|
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
|
||||||
|
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.HLSendMaterialTask;
|
||||||
import org.nl.wms.sch.task.send.material.SZSendMaterialTask;
|
import org.nl.wms.sch.task.send.material.SZSendMaterialTask;
|
||||||
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
|
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
|
||||||
@@ -60,6 +62,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
|
|
||||||
private final GTKCallEmptyTask gtkCallEmptyTask;
|
private final GTKCallEmptyTask gtkCallEmptyTask;
|
||||||
|
|
||||||
|
private final FJSendMaterialTask fjSendMaterialTask;
|
||||||
|
|
||||||
|
private final FJCallEmptyTask fjCallEmptyTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* task_id:任务标识
|
* task_id:任务标识
|
||||||
* task_code:任务编码
|
* task_code:任务编码
|
||||||
@@ -249,6 +255,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
|
|
||||||
task_code = szSendMaterialTask.createTask(method_param);
|
task_code = szSendMaterialTask.createTask(method_param);
|
||||||
break;
|
break;
|
||||||
|
case FJ:
|
||||||
|
method_param.put("workorder", param.getJSONObject("workorder"));
|
||||||
|
method_param.put("vd", param.getJSONObject("vd"));
|
||||||
|
task_code = fjSendMaterialTask.createTask(method_param);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new BadRequestException("[" + region.label() + "] 不能发起送料任务!");
|
throw new BadRequestException("[" + region.label() + "] 不能发起送料任务!");
|
||||||
}
|
}
|
||||||
@@ -295,25 +306,30 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
switch (region) {
|
switch (region) {
|
||||||
case HL:
|
case HL:
|
||||||
String device_code = point.getString("device_code");
|
String device_code = point.getString("device_code");
|
||||||
JSONObject work_order = WQLObject
|
workorder = WQLObject
|
||||||
.getWQLObject("pdm_bd_workorder")
|
.getWQLObject("pdm_bd_workorder")
|
||||||
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'")
|
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'")
|
||||||
.uniqueResult(0);
|
.uniqueResult(0);
|
||||||
method_param.put("workorder", work_order);
|
method_param.put("workorder", workorder);
|
||||||
task_code = hlCallEmptyTask.createTask(method_param);
|
task_code = hlCallEmptyTask.createTask(method_param);
|
||||||
break;
|
break;
|
||||||
case YZ:
|
case YZ:
|
||||||
device_code = point.getString("device_code");
|
device_code = point.getString("device_code");
|
||||||
work_order = WQLObject
|
workorder = WQLObject
|
||||||
.getWQLObject("pdm_bd_workorder")
|
.getWQLObject("pdm_bd_workorder")
|
||||||
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'")
|
.query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'")
|
||||||
.uniqueResult(0);
|
.uniqueResult(0);
|
||||||
method_param.put("workorder", work_order);
|
method_param.put("workorder", workorder);
|
||||||
task_code = yzCallEmptyTask.createTask(method_param);
|
task_code = yzCallEmptyTask.createTask(method_param);
|
||||||
break;
|
break;
|
||||||
case GTK:
|
case GTK:
|
||||||
task_code = gtkCallEmptyTask.createTask(method_param);
|
task_code = gtkCallEmptyTask.createTask(method_param);
|
||||||
break;
|
break;
|
||||||
|
case FJ:
|
||||||
|
workorder = TaskUtils.hasWorkOrder(point);
|
||||||
|
method_param.put("workorder", workorder);
|
||||||
|
task_code = fjCallEmptyTask.createTask(method_param);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new BadRequestException("[" + region.label() + "] 不能发起叫空任务!");
|
throw new BadRequestException("[" + region.label() + "] 不能发起叫空任务!");
|
||||||
}
|
}
|
||||||
@@ -368,8 +384,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
}
|
}
|
||||||
TaskUtils.isLocked(point);
|
TaskUtils.isLocked(point);
|
||||||
|
|
||||||
JSONObject work_order = TaskUtils.hasWorkOrder(point);
|
JSONObject workorder = TaskUtils.hasWorkOrder(point);
|
||||||
String vehicle_type = work_order.getString("vehicle_type");
|
String vehicle_type = workorder.getString("vehicle_type");
|
||||||
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||||
JSONObject vd_update = new JSONObject();
|
JSONObject vd_update = new JSONObject();
|
||||||
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
|
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
|
||||||
@@ -380,11 +396,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
vd.put("vd_id", IdUtil.getSnowflake(1, 1).nextId());
|
vd.put("vd_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||||
vd.put("vehicle_type", vehicle_type);
|
vd.put("vehicle_type", vehicle_type);
|
||||||
vd.put("vehicle_code", vehicle_code);
|
vd.put("vehicle_code", vehicle_code);
|
||||||
vd.put("material_id", work_order.getString("material_id"));
|
vd.put("material_id", workorder.getString("material_id"));
|
||||||
vd.put("qty", qty);
|
vd.put("qty", qty);
|
||||||
vd.put("weight", weight);
|
vd.put("weight", weight);
|
||||||
vd.put("is_full", is_full);
|
vd.put("is_full", is_full);
|
||||||
vd.put("workorder_id", work_order.getString("workorder_id"));
|
vd.put("workorder_id", workorder.getString("workorder_id"));
|
||||||
vd.put("point_code", point_code);
|
vd.put("point_code", point_code);
|
||||||
vd.put("tray_high", jsonObject.get("tray_high"));
|
vd.put("tray_high", jsonObject.get("tray_high"));
|
||||||
vd.put("crib_category", jsonObject.get("crib_category"));
|
vd.put("crib_category", jsonObject.get("crib_category"));
|
||||||
@@ -459,7 +475,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("device_code", point.getString("point_code"));
|
param.put("device_code", point.getString("point_code"));
|
||||||
param.put("point", point);
|
param.put("point", point);
|
||||||
param.put("workorder", work_order);
|
param.put("workorder", workorder);
|
||||||
param.put("vd", vd);
|
param.put("vd", vd);
|
||||||
param.put("vehicle_code", vehicle_code);
|
param.put("vehicle_code", vehicle_code);
|
||||||
param.put("type", "1");
|
param.put("type", "1");
|
||||||
@@ -718,11 +734,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
JSONObject update = new JSONObject();
|
JSONObject update = new JSONObject();
|
||||||
update.put("vehicle_type", String.valueOf(Integer.parseInt(vehicle_type) + 2));
|
if ("0".equals(vehicle_type)) {
|
||||||
|
update.put("vehicle_type", "");
|
||||||
|
} else {
|
||||||
|
update.put("vehicle_type", String.valueOf(Integer.parseInt(vehicle_type) + 2));
|
||||||
|
}
|
||||||
WQLObject
|
WQLObject
|
||||||
.getWQLObject("sch_base_point")
|
.getWQLObject("sch_base_point")
|
||||||
.update(update, "point_code = '" + point_code + "'");
|
.update(update, "point_code = '" + point_code + "'");
|
||||||
|
|
||||||
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("status", HttpStatus.OK.value());
|
result.put("status", HttpStatus.OK.value());
|
||||||
result.put("message", "反馈成功!");
|
result.put("message", "反馈成功!");
|
||||||
|
|||||||
@@ -0,0 +1,213 @@
|
|||||||
|
package org.nl.wms.sch.task.call.empty;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.wql.WQL;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wms.basedata.eum.TrueOrFalse;
|
||||||
|
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||||
|
import org.nl.wms.sch.manage.*;
|
||||||
|
import org.nl.wms.sch.task.util.TaskUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangjiangwei
|
||||||
|
* @date 2023/04/28 15:27
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Component
|
||||||
|
public class FJCallEmptyTask extends AbstractAcsTask {
|
||||||
|
|
||||||
|
private final WmsToAcsService wmsToAcsService;
|
||||||
|
|
||||||
|
@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");
|
||||||
|
|
||||||
|
JSONObject task = TaskUtils.buildTask(
|
||||||
|
"分拣区叫空",
|
||||||
|
TaskType.CALL_EMPTY.value(),
|
||||||
|
TaskStatus.SURE_END.value(),
|
||||||
|
null,
|
||||||
|
point.getString("point_code"),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
work_order.getString("vehicle_type"),
|
||||||
|
null,
|
||||||
|
TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1,
|
||||||
|
FJCallEmptyTask.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 findStartPoint() {
|
||||||
|
WQLObject task_table = WQLObject.getWQLObject("sch_base_task");
|
||||||
|
JSONArray tasks = task_table
|
||||||
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + FJCallEmptyTask.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("CALL_EMPTY_TASK")
|
||||||
|
.addParam("flag", "4")
|
||||||
|
.addParam("vehicle_type", task.getString("vehicle_type"))
|
||||||
|
.process()
|
||||||
|
.uniqueResult(0);
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(point)) {
|
||||||
|
JSONArray request_param = new JSONArray();
|
||||||
|
request_param.add(point.getString("point_code"));
|
||||||
|
JSONObject result = wmsToAcsService.getTray(request_param);
|
||||||
|
if (!"200".equals(result.getString("status"))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
|
task.put("point_code1", point.getString("device_code"));
|
||||||
|
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
|
||||||
|
task.put("remark", "");
|
||||||
|
TaskUtils.addAutoUpdateColum(task);
|
||||||
|
task_table.update(task);
|
||||||
|
|
||||||
|
JSONObject update_point = new JSONObject();
|
||||||
|
update_point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
|
update_point.put("task_code", task.getString("task_code"));
|
||||||
|
TaskUtils.addAutoUpdateColum(update_point);
|
||||||
|
point_table.update(update_point, "point_code = '" + point.getString("device_code") + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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())) {
|
||||||
|
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");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
point_table.update(point2, "point_code = '" + task.getString("point_code2") + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -78,36 +78,39 @@ public class YZCallEmptyTask extends AbstractAcsTask {
|
|||||||
JSONArray tasks = task_table
|
JSONArray tasks = task_table
|
||||||
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + YZCallEmptyTask.class.getName() + "'", "priority DESC, create_time ASC")
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + YZCallEmptyTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||||
.getResultJSONArray(0);
|
.getResultJSONArray(0);
|
||||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) {
|
if (ObjectUtil.isNotEmpty(tasks)) {
|
||||||
JSONObject task = tasks.getJSONObject(i);
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
JSONObject point = WQL
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
.getWO("CALL_EMPTY_TASK")
|
JSONObject task = tasks.getJSONObject(i);
|
||||||
.addParam("flag", "1")
|
|
||||||
.addParam("point_code", task.getString("point_code2"))
|
JSONObject point = WQL
|
||||||
.process()
|
|
||||||
.uniqueResult(0);
|
|
||||||
if (ObjectUtil.isEmpty(point)) {
|
|
||||||
point = WQL
|
|
||||||
.getWO("CALL_EMPTY_TASK")
|
.getWO("CALL_EMPTY_TASK")
|
||||||
.addParam("flag", "2")
|
.addParam("flag", "1")
|
||||||
|
.addParam("point_code", task.getString("point_code2"))
|
||||||
.process()
|
.process()
|
||||||
.uniqueResult(0);
|
.uniqueResult(0);
|
||||||
}
|
if (ObjectUtil.isEmpty(point)) {
|
||||||
if (ObjectUtil.isNotEmpty(point)) {
|
point = WQL
|
||||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
.getWO("CALL_EMPTY_TASK")
|
||||||
task.put("point_code1", point.getString("point_code"));
|
.addParam("flag", "2")
|
||||||
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
|
.process()
|
||||||
task.put("remark", "");
|
.uniqueResult(0);
|
||||||
TaskUtils.addAutoUpdateColum(task);
|
}
|
||||||
task_table.update(task);
|
if (ObjectUtil.isNotEmpty(point)) {
|
||||||
|
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
|
task.put("point_code1", point.getString("point_code"));
|
||||||
|
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
|
||||||
|
task.put("remark", "");
|
||||||
|
TaskUtils.addAutoUpdateColum(task);
|
||||||
|
task_table.update(task);
|
||||||
|
|
||||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
point.put("task_code", task.getString("task_code"));
|
point.put("task_code", task.getString("task_code"));
|
||||||
TaskUtils.addAutoUpdateColum(point);
|
TaskUtils.addAutoUpdateColum(point);
|
||||||
point_table.update(point);
|
point_table.update(point);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#################################################
|
#################################################
|
||||||
输入.flag TYPEAS s_string
|
输入.flag TYPEAS s_string
|
||||||
输入.point_code TYPEAS s_string
|
输入.point_code TYPEAS s_string
|
||||||
|
输入.vehicle_type TYPEAS s_string
|
||||||
|
|
||||||
[临时表]
|
[临时表]
|
||||||
--这边列出来的临时表就会在运行期动态创建
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
@@ -92,3 +93,23 @@
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "4"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
tpw.*
|
||||||
|
FROM
|
||||||
|
sch_base_point tpw
|
||||||
|
LEFT JOIN sch_base_point djw ON tpw.device_code = djw.point_code
|
||||||
|
WHERE
|
||||||
|
tpw.is_used = '1'
|
||||||
|
AND djw.is_used = '1'
|
||||||
|
AND tpw.region_code = 'FJ'
|
||||||
|
AND djw.region_code = 'FJ'
|
||||||
|
AND tpw.point_type = '4'
|
||||||
|
AND djw.point_type = '3'
|
||||||
|
AND djw.lock_type = '1'
|
||||||
|
AND tpw.vehicle_type = 输入.vehicle_type
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|||||||
@@ -75,31 +75,33 @@ public class FJCallMaterialTask extends AbstractAcsTask {
|
|||||||
JSONArray tasks = task_table
|
JSONArray tasks = task_table
|
||||||
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + FJCallMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + FJCallMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||||
.getResultJSONArray(0);
|
.getResultJSONArray(0);
|
||||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
if (ObjectUtil.isNotEmpty(tasks)) {
|
||||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) {
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
JSONObject task = tasks.getJSONObject(i);
|
JSONObject task = tasks.getJSONObject(i);
|
||||||
|
|
||||||
JSONObject point = WQL
|
JSONObject point = WQL
|
||||||
.getWO("CALL_MATERIAL_TASK")
|
.getWO("CALL_MATERIAL_TASK")
|
||||||
.addParam("flag", "3")
|
.addParam("flag", "3")
|
||||||
.addParam("material_id", task.getString("material_id"))
|
.addParam("material_id", task.getString("material_id"))
|
||||||
.process()
|
.process()
|
||||||
.uniqueResult(0);
|
.uniqueResult(0);
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(point)) {
|
if (ObjectUtil.isNotEmpty(point)) {
|
||||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
task.put("point_code1", point.getString("point_code"));
|
task.put("point_code1", point.getString("point_code"));
|
||||||
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
|
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
|
||||||
task.put("remark", "");
|
task.put("remark", "");
|
||||||
TaskUtils.addAutoUpdateColum(task);
|
TaskUtils.addAutoUpdateColum(task);
|
||||||
task_table.update(task);
|
task_table.update(task);
|
||||||
|
|
||||||
JSONObject point_update = new JSONObject();
|
JSONObject point_update = new JSONObject();
|
||||||
point_update.put("lock_type", LockType.TASK_LOCKED.value());
|
point_update.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
point_update.put("task_code", task.getString("task_code"));
|
point_update.put("task_code", task.getString("task_code"));
|
||||||
TaskUtils.addAutoUpdateColum(point_update);
|
TaskUtils.addAutoUpdateColum(point_update);
|
||||||
point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
|
point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,31 +91,33 @@ public class SZCallMaterialTask extends AbstractAcsTask {
|
|||||||
JSONArray tasks = task_table
|
JSONArray tasks = task_table
|
||||||
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + SZCallMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + SZCallMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||||
.getResultJSONArray(0);
|
.getResultJSONArray(0);
|
||||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
if (ObjectUtil.isNotEmpty(tasks)) {
|
||||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) {
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
JSONObject task = tasks.getJSONObject(i);
|
JSONObject task = tasks.getJSONObject(i);
|
||||||
|
|
||||||
JSONObject point = WQL
|
JSONObject point = WQL
|
||||||
.getWO("CALL_MATERIAL_TASK")
|
.getWO("CALL_MATERIAL_TASK")
|
||||||
.addParam("flag", "1")
|
.addParam("flag", "1")
|
||||||
.process()
|
.process()
|
||||||
.uniqueResult(0);
|
.uniqueResult(0);
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(point)) {
|
if (ObjectUtil.isNotEmpty(point)) {
|
||||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
task.put("point_code1", point.getString("point_code"));
|
task.put("point_code1", point.getString("point_code"));
|
||||||
task.put("material_id", point.getString("material_id"));
|
task.put("material_id", point.getString("material_id"));
|
||||||
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
|
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
|
||||||
task.put("remark", "");
|
task.put("remark", "");
|
||||||
TaskUtils.addAutoUpdateColum(task);
|
TaskUtils.addAutoUpdateColum(task);
|
||||||
task_table.update(task);
|
task_table.update(task);
|
||||||
|
|
||||||
JSONObject point_update = new JSONObject();
|
JSONObject point_update = new JSONObject();
|
||||||
point_update.put("lock_type", LockType.TASK_LOCKED.value());
|
point_update.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
point_update.put("task_code", task.getString("task_code"));
|
point_update.put("task_code", task.getString("task_code"));
|
||||||
TaskUtils.addAutoUpdateColum(point_update);
|
TaskUtils.addAutoUpdateColum(point_update);
|
||||||
point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
|
point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,28 +73,30 @@ public class FJSendEmptyTask extends AbstractAcsTask {
|
|||||||
JSONArray tasks = task_table
|
JSONArray tasks = task_table
|
||||||
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + FJSendEmptyTask.class.getName() + "'", "priority DESC, create_time ASC")
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + FJSendEmptyTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||||
.getResultJSONArray(0);
|
.getResultJSONArray(0);
|
||||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
if (ObjectUtil.isNotEmpty(tasks)) {
|
||||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) {
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
JSONObject task = tasks.getJSONObject(i);
|
JSONObject task = tasks.getJSONObject(i);
|
||||||
|
|
||||||
JSONObject point = WQL
|
JSONObject point = WQL
|
||||||
.getWO("SEND_EMPTY_TASK")
|
.getWO("SEND_EMPTY_TASK")
|
||||||
.addParam("flag", "1")
|
.addParam("flag", "1")
|
||||||
.process()
|
.process()
|
||||||
.uniqueResult(0);
|
.uniqueResult(0);
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(point)) {
|
if (ObjectUtil.isNotEmpty(point)) {
|
||||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
task.put("point_code2", point.getString("point_code"));
|
task.put("point_code2", point.getString("point_code"));
|
||||||
task.put("remark", "");
|
task.put("remark", "");
|
||||||
TaskUtils.addAutoUpdateColum(task);
|
TaskUtils.addAutoUpdateColum(task);
|
||||||
task_table.update(task);
|
task_table.update(task);
|
||||||
|
|
||||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
point.put("task_code", task.getString("task_code"));
|
point.put("task_code", task.getString("task_code"));
|
||||||
TaskUtils.addAutoUpdateColum(point);
|
TaskUtils.addAutoUpdateColum(point);
|
||||||
point_table.update(point);
|
point_table.update(point);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,287 @@
|
|||||||
|
package org.nl.wms.sch.task.send.material;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.wql.WQL;
|
||||||
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
|
import org.nl.wms.basedata.eum.TrueOrFalse;
|
||||||
|
import org.nl.wms.common.PickType;
|
||||||
|
import org.nl.wms.ext.acs.service.WmsToAcsService;
|
||||||
|
import org.nl.wms.sch.manage.*;
|
||||||
|
import org.nl.wms.sch.task.util.TaskUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangjiangwei
|
||||||
|
* @date 2023/04/28 12:33
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Component
|
||||||
|
public class FJSendMaterialTask extends AbstractAcsTask {
|
||||||
|
|
||||||
|
private final WmsToAcsService wmsToAcsService;
|
||||||
|
|
||||||
|
@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 material_task = TaskUtils.buildTask(
|
||||||
|
"分拣区送料",
|
||||||
|
TaskType.SEND_MATERIAL.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,
|
||||||
|
FJSendMaterialTask.class.getName(),
|
||||||
|
form.getString("create_mode"),
|
||||||
|
form.getString("request_param"),
|
||||||
|
form.getString("create_id"),
|
||||||
|
form.getString("create_name")
|
||||||
|
);
|
||||||
|
WQLObject.getWQLObject("sch_base_task").insert(material_task);
|
||||||
|
|
||||||
|
if (TrueOrFalse.trueOrFalse(vd.getString("is_full"))) {
|
||||||
|
JSONObject empty_task = TaskUtils.buildTask(
|
||||||
|
"分拣区叫空",
|
||||||
|
TaskType.CALL_EMPTY.value(),
|
||||||
|
TaskStatus.SURE_END.value(),
|
||||||
|
null,
|
||||||
|
point.getString("point_code"),
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
work_order.getString("vehicle_type"),
|
||||||
|
null,
|
||||||
|
priority,
|
||||||
|
FJSendMaterialTask.class.getName(),
|
||||||
|
form.getString("create_mode"),
|
||||||
|
form.getString("request_param"),
|
||||||
|
form.getString("create_id"),
|
||||||
|
form.getString("create_name")
|
||||||
|
);
|
||||||
|
empty_task.put("task_group_id", material_task.getLongValue("task_id"));
|
||||||
|
WQLObject.getWQLObject("sch_base_task").insert(empty_task);
|
||||||
|
}
|
||||||
|
|
||||||
|
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
|
point.put("task_code", material_task.getString("task_code"));
|
||||||
|
TaskUtils.addFormUpdateColum(point, form);
|
||||||
|
WQLObject.getWQLObject("sch_base_point").update(point);
|
||||||
|
|
||||||
|
return material_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 = '" + FJSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||||
|
.getResultJSONArray(0);
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(tasks)) {
|
||||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
|
||||||
|
|
||||||
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
|
JSONObject material_task = tasks.getJSONObject(i);
|
||||||
|
|
||||||
|
JSONObject vd = vd_table
|
||||||
|
.query("is_delete = '0' AND vehicle_type = '" + material_task.getString("vehicle_type") + "' AND vehicle_code = '" + material_task.getString("vehicle_code") + "'")
|
||||||
|
.uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(vd)) {
|
||||||
|
JSONObject send_point = WQL
|
||||||
|
.getWO("SEND_MATERIAL_TASK")
|
||||||
|
.addParam("flag", "2")
|
||||||
|
.addParam("is_full", vd.getString("is_full"))
|
||||||
|
.process()
|
||||||
|
.uniqueResult(0);
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(send_point)) {
|
||||||
|
material_task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
|
material_task.put("point_code2", send_point.getString("point_code"));
|
||||||
|
material_task.put("remark", "");
|
||||||
|
TaskUtils.addAutoUpdateColum(material_task);
|
||||||
|
|
||||||
|
send_point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
|
send_point.put("task_code", material_task.getString("task_code"));
|
||||||
|
TaskUtils.addAutoUpdateColum(send_point);
|
||||||
|
|
||||||
|
JSONObject empty_task = task_table
|
||||||
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_END.value() + "' AND handle_class = '" + FJSendMaterialTask.class.getName() + "' AND task_group_id = " + material_task.getLongValue("task_id"))
|
||||||
|
.uniqueResult(0);
|
||||||
|
if (ObjectUtil.isNotEmpty(empty_task)) {
|
||||||
|
JSONObject fmj_point = WQL
|
||||||
|
.getWO("SEND_MATERIAL_TASK")
|
||||||
|
.addParam("flag", "3")
|
||||||
|
.addParam("vehicle_type", empty_task.getString("vehicle_type"))
|
||||||
|
.process()
|
||||||
|
.uniqueResult(0);
|
||||||
|
|
||||||
|
if (ObjectUtil.isNotEmpty(fmj_point)) {
|
||||||
|
JSONArray request_param = new JSONArray();
|
||||||
|
request_param.add(fmj_point.getString("point_code"));
|
||||||
|
JSONObject result = wmsToAcsService.getTray(request_param);
|
||||||
|
if (!"200".equals(result.getString("status"))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
empty_task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
|
empty_task.put("point_code1", fmj_point.getString("device_code"));
|
||||||
|
empty_task.put("vehicle_code", TaskUtils.formatVehicleCode(fmj_point.getString("vehicle_code")));
|
||||||
|
empty_task.put("remark", "");
|
||||||
|
TaskUtils.addAutoUpdateColum(empty_task);
|
||||||
|
|
||||||
|
JSONObject update_point = new JSONObject();
|
||||||
|
update_point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
|
update_point.put("task_code", material_task.getString("task_code"));
|
||||||
|
TaskUtils.addAutoUpdateColum(update_point);
|
||||||
|
|
||||||
|
task_table.update(material_task);
|
||||||
|
point_table.update(send_point);
|
||||||
|
task_table.update(empty_task);
|
||||||
|
point_table.update(update_point, "point_code = '" + fmj_point.getString("device_code") + "'");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
task_table.update(material_task);
|
||||||
|
point_table.update(send_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");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void finishTask(JSONObject task, OperationType operation_type) {
|
||||||
|
if (task.getIntValue("task_status") < Integer.parseInt(TaskStatus.FINISHED.value())) {
|
||||||
|
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");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
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") + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -73,28 +73,30 @@ public class SZSendMaterialTask extends AbstractAcsTask {
|
|||||||
JSONArray tasks = task_table
|
JSONArray tasks = task_table
|
||||||
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + SZSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
|
.query("is_delete = '0' AND task_status = '" + TaskStatus.SURE_START.value() + "' AND handle_class = '" + SZSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
|
||||||
.getResultJSONArray(0);
|
.getResultJSONArray(0);
|
||||||
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
if (ObjectUtil.isNotEmpty(tasks)) {
|
||||||
|
WQLObject point_table = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
|
||||||
for (int i = 0; i < tasks.size(); i++) {
|
for (int i = 0; i < tasks.size(); i++) {
|
||||||
JSONObject task = tasks.getJSONObject(i);
|
JSONObject task = tasks.getJSONObject(i);
|
||||||
|
|
||||||
JSONObject point = WQL
|
JSONObject point = WQL
|
||||||
.getWO("SEND_MATERIAL_TASK")
|
.getWO("SEND_MATERIAL_TASK")
|
||||||
.addParam("flag", "1")
|
.addParam("flag", "1")
|
||||||
.process()
|
.process()
|
||||||
.uniqueResult(0);
|
.uniqueResult(0);
|
||||||
|
|
||||||
if (ObjectUtil.isNotEmpty(point)) {
|
if (ObjectUtil.isNotEmpty(point)) {
|
||||||
task.put("task_status", TaskStatus.START_AND_END.value());
|
task.put("task_status", TaskStatus.START_AND_END.value());
|
||||||
task.put("point_code2", point.getString("point_code"));
|
task.put("point_code2", point.getString("point_code"));
|
||||||
task.put("remark", "");
|
task.put("remark", "");
|
||||||
TaskUtils.addAutoUpdateColum(task);
|
TaskUtils.addAutoUpdateColum(task);
|
||||||
task_table.update(task);
|
task_table.update(task);
|
||||||
|
|
||||||
point.put("lock_type", LockType.TASK_LOCKED.value());
|
point.put("lock_type", LockType.TASK_LOCKED.value());
|
||||||
point.put("task_code", task.getString("task_code"));
|
point.put("task_code", task.getString("task_code"));
|
||||||
TaskUtils.addAutoUpdateColum(point);
|
TaskUtils.addAutoUpdateColum(point);
|
||||||
point_table.update(point);
|
point_table.update(point);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package org.nl.wms.sch.task.send.material;
|
package org.nl.wms.sch.task.send.material;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|||||||
@@ -14,8 +14,8 @@
|
|||||||
## 表字段对应输入参数
|
## 表字段对应输入参数
|
||||||
#################################################
|
#################################################
|
||||||
输入.flag TYPEAS s_string
|
输入.flag TYPEAS s_string
|
||||||
输入.point_type TYPEAS s_string
|
输入.is_full TYPEAS s_string
|
||||||
输入.device_code TYPEAS s_string
|
输入.vehicle_type TYPEAS s_string
|
||||||
|
|
||||||
[临时表]
|
[临时表]
|
||||||
--这边列出来的临时表就会在运行期动态创建
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
@@ -54,3 +54,47 @@
|
|||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "2"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
sch_base_point
|
||||||
|
WHERE
|
||||||
|
is_used = '1'
|
||||||
|
AND lock_type = '1'
|
||||||
|
AND point_status = '0'
|
||||||
|
OPTION 输入.is_full = "1"
|
||||||
|
region_code = 'FJ'
|
||||||
|
AND point_type = '5'
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.is_full = "0"
|
||||||
|
region_code = 'BTHC'
|
||||||
|
AND point_type = '1'
|
||||||
|
AND point_status = '0'
|
||||||
|
ENDOPTION
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
IF 输入.flag = "3"
|
||||||
|
QUERY
|
||||||
|
SELECT
|
||||||
|
tpw.*
|
||||||
|
FROM
|
||||||
|
sch_base_point tpw
|
||||||
|
LEFT JOIN sch_base_point djw ON tpw.device_code = djw.point_code
|
||||||
|
WHERE
|
||||||
|
tpw.is_used = '1'
|
||||||
|
AND djw.is_used = '1'
|
||||||
|
AND tpw.region_code = 'FJ'
|
||||||
|
AND djw.region_code = 'FJ'
|
||||||
|
AND tpw.point_type = '4'
|
||||||
|
AND djw.point_type = '3'
|
||||||
|
AND djw.lock_type = '1'
|
||||||
|
AND tpw.vehicle_type = 输入.vehicle_type
|
||||||
|
ENDSELECT
|
||||||
|
ENDQUERY
|
||||||
|
ENDIF
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,11 @@ public class TempTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test01() {
|
public void test01() {
|
||||||
JSONObject data = WQL
|
JSONObject data = WQL
|
||||||
.getWO("ACS_TO_WMS")
|
.getWO("SEND_MATERIAL_TASK")
|
||||||
.addParam("flag", "1")
|
.addParam("flag", "4")
|
||||||
.addParam("vehicle_type", "2")
|
.addParam("is_full", "0")
|
||||||
.addParam("vehicle_code", "5555")
|
|
||||||
.process()
|
.process()
|
||||||
.uniqueResult(0);
|
.uniqueResult(0);
|
||||||
System.out.println(data);
|
System.out.println(data.getString("region_name"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -241,21 +241,6 @@
|
|||||||
<el-form-item v-show="crud.status.edit" label="载具编码" prop="vehicle_code">
|
<el-form-item v-show="crud.status.edit" label="载具编码" prop="vehicle_code">
|
||||||
<el-input v-model="form.vehicle_code" placeholder="载具编码" clearable style="width: 300px" />
|
<el-input v-model="form.vehicle_code" placeholder="载具编码" clearable style="width: 300px" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="关联设备" prop="device_code">
|
|
||||||
<el-select
|
|
||||||
v-model="form.device_code"
|
|
||||||
placeholder="关联设备"
|
|
||||||
style="width: 300px"
|
|
||||||
clearable
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in deviceList"
|
|
||||||
:key="item.device_id"
|
|
||||||
:label="item.device_name"
|
|
||||||
:value="item.device_code"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="备注">
|
<el-form-item label="备注">
|
||||||
<el-input v-model="form.remark" style="width: 300px" rows="2" type="textarea" />
|
<el-input v-model="form.remark" style="width: 300px" rows="2" type="textarea" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
Reference in New Issue
Block a user