Browse Source

更新

master
张江玮 2 years ago
parent
commit
79937af8d5
  1. 2
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java
  2. 4
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java
  3. 4
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql
  4. 1
      lms/nladmin-system/src/main/java/org/nl/wms/sch/rest/TaskController.java
  5. 2
      lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/TaskServiceImpl.java
  6. 107
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/HLCallEmptyTask.java
  7. 195
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/FJCallMaterialTask.java
  8. 2
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java
  9. 2
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/wql/CALL_MATERIAL_TASK.wql
  10. 200
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/FJSendEmptyTask.java
  11. 79
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/wql/SEND_EMPTY_TASK.wql
  12. 137
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/HLSendMaterialTask.java
  13. BIN
      lms/nladmin-system/src/main/java/org/nl/wms/wms.xls
  14. 2
      lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

2
lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/DeviceServiceImpl.java

@ -44,7 +44,7 @@ public class DeviceServiceImpl implements DeviceService {
if (!StrUtil.isEmpty(search)) { if (!StrUtil.isEmpty(search)) {
map.put("search", "%" + search + "%"); map.put("search", "%" + search + "%");
} }
JSONObject json = WQL.getWO("PDM_BI_DEVICE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "device.device_model, device.device_code"); JSONObject json = WQL.getWO("PDM_BI_DEVICE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "device.device_code");
return json; return json;
} }

4
lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java

@ -183,7 +183,7 @@ public class WorkorderServiceImpl implements WorkordeService {
String workorder_id = param.getString("workorder_id"); String workorder_id = param.getString("workorder_id");
JSONObject submit_obj = WQL JSONObject submit_obj = WQL
.getWO("MPS_PRODUCEDURE001") .getWO("MPS_PRODUCEDURE001")
.addParam("flag", "5") .addParam("flag", "6")
.addParam("workorder_id", workorder_id) .addParam("workorder_id", workorder_id)
.process() .process()
.uniqueResult(0); .uniqueResult(0);
@ -193,7 +193,7 @@ public class WorkorderServiceImpl implements WorkordeService {
JSONObject workorder = WQLObject JSONObject workorder = WQLObject
.getWQLObject("pdm_bd_workorder") .getWQLObject("pdm_bd_workorder")
.query("is_delete = '0' AND device_code = '" + submit_obj.getString("workorder_code") + "' AND order_status IN ('2', '3')") .query("is_delete = '0' AND device_id = '" + submit_obj.getString("device_id") + "' AND order_status IN ('2', '3')")
.uniqueResult(0); .uniqueResult(0);
if (ObjectUtil.isNotEmpty(workorder)) { if (ObjectUtil.isNotEmpty(workorder)) {
throw new BadRequestException("该设备正在执行其它工单!"); throw new BadRequestException("该设备正在执行其它工单!");

4
lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/MPS_PRODUCEDURE001.wql

@ -161,8 +161,9 @@
SELECT SELECT
workorder.workorder_code, workorder.workorder_code,
workorder.plan_qty, workorder.plan_qty,
workorder.device_code,
workorder.order_status, workorder.order_status,
workorder.device_id,
device.device_code,
material.material_code, material.material_code,
material.product_code, material.product_code,
material.a, material.a,
@ -172,6 +173,7 @@
FROM FROM
pdm_bd_workorder workorder pdm_bd_workorder workorder
LEFT JOIN md_me_materialbase material ON workorder.material_id = material.material_id LEFT JOIN md_me_materialbase material ON workorder.material_id = material.material_id
LEFT JOIN pdm_bi_device device ON workorder.device_id = device.device_id
WHERE WHERE
workorder.is_delete = '0' workorder.is_delete = '0'
AND workorder.workorder_id = 输入.workorder_id AND workorder.workorder_id = 输入.workorder_id

1
lms/nladmin-system/src/main/java/org/nl/wms/sch/rest/TaskController.java

@ -1,4 +1,3 @@
package org.nl.wms.sch.rest; package org.nl.wms.sch.rest;

2
lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/TaskServiceImpl.java

@ -124,7 +124,7 @@ public class TaskServiceImpl implements TaskService {
public void operation(Map<String, Object> map) { public void operation(Map<String, Object> map) {
String task_id = MapUtil.getStr(map, "task_id"); String task_id = MapUtil.getStr(map, "task_id");
String method_name = MapUtil.getStr(map, "method_name"); String method_name = MapUtil.getStr(map, "method_name");
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0); JSONObject taskObj = WQLObject.getWQLObject("sch_base_task").query("task_id = '" + task_id + "'").uniqueResult(0);
if (taskObj.getString("task_status").equals(TaskStatus.FINISHED.value())) throw new BadRequestException("任务已完成!"); if (taskObj.getString("task_status").equals(TaskStatus.FINISHED.value())) throw new BadRequestException("任务已完成!");
// 任务处理类 // 任务处理类
String processing_class = taskObj.getString("handle_class"); String processing_class = taskObj.getString("handle_class");

107
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/HLCallEmptyTask.java

@ -4,14 +4,12 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.basedata.eum.TrueOrFalse; import org.nl.wms.basedata.eum.TrueOrFalse;
import org.nl.wms.basedata.eum.VehicleType; import org.nl.wms.basedata.eum.VehicleType;
import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.*;
import org.nl.wms.sch.manage.LockType;
import org.nl.wms.sch.manage.TaskStatus;
import org.nl.wms.sch.manage.TaskType;
import org.nl.wms.sch.task.util.TaskUtils; import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -27,8 +25,16 @@ import org.springframework.transaction.annotation.Transactional;
public class HLCallEmptyTask extends AbstractAcsTask { public class HLCallEmptyTask extends AbstractAcsTask {
@Override @Override
public void updateTaskStatus(JSONObject taskObj, String status) { 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);
}
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -96,13 +102,100 @@ public class HLCallEmptyTask extends AbstractAcsTask {
} }
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void forceFinish(String task_id) { 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);
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void cancel(String task_id) { 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);
}
@Transactional(rollbackFor = Exception.class)
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") + "'");
}
}
@Transactional(rollbackFor = Exception.class)
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());
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") + "'");
}
} }
} }

195
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/FJCallMaterialTask.java

@ -0,0 +1,195 @@
package org.nl.wms.sch.task.call.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.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;
/**
* @author zhangjiangwei
* @date 2023/04/14 21:28
*/
@RequiredArgsConstructor
@Component
public class FJCallMaterialTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
@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);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
JSONObject task = TaskUtils.buildTask(
"烧制区叫料",
TaskType.CALL_MATERIAL.value(),
TaskStatus.SURE_END.value(),
null,
point.getString("point_code"),
null,
VehicleType.STEEL_TRAY.value(),
null,
"1",
SZCallMaterialTask.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"));
WQLObject.getWQLObject("sch_base_point").update(point);
return task.getString("task_id");
}
@Transactional(rollbackFor = Exception.class)
@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 = '" + SZCallMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
.getResultJSONArray(0);
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_MATERIAL_TASK")
.addParam("flag", "1")
.process()
.uniqueResult(0);
if (ObjectUtil.isNotEmpty(point)) {
task.put("task_status", TaskStatus.START_AND_END.value());
task.put("point_code1", point.getString("point_code"));
task.put("material_id", point.getString("material_id"));
task.put("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
task.put("remark", "");
task_table.update(task);
JSONObject point_update = new JSONObject();
point_update.put("lock_type", LockType.TASK_LOCKED.value());
point_update.put("task_code", task.getString("task_code"));
point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
}
}
}
@Transactional(rollbackFor = Exception.class)
@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);
}
@Transactional(rollbackFor = Exception.class)
@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);
}
@Transactional(rollbackFor = Exception.class)
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") + "'");
}
}
@Transactional(rollbackFor = Exception.class)
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());
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") + "'");
}
}
}

2
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/SZCallMaterialTask.java

@ -24,7 +24,7 @@ public class SZCallMaterialTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public void autoCreate() { public void autoCreate() {
JSONArray points = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "1").process().getResultJSONArray(0); JSONArray points = WQL.getWO("CALL_MATERIAL_TASK").addParam("flag", "2").process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(points) && !points.isEmpty()) { if (ObjectUtil.isNotEmpty(points) && !points.isEmpty()) {
JSONObject form = new JSONObject(); JSONObject form = new JSONObject();
form.put("create_mode", CreateMode.ZDSC.value()); form.put("create_mode", CreateMode.ZDSC.value());

2
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/wql/CALL_MATERIAL_TASK.wql

@ -56,7 +56,7 @@
AND point.point_status = '1' AND point.point_status = '1'
AND point.vehicle_type = '2' AND point.vehicle_type = '2'
AND vd.is_fire = '0' AND vd.is_fire = '0'
AND vd.if_in_kiln = '1' AND vd.is_in_kiln = '1'
ORDER BY ORDER BY
workorder.is_urgent DESC, vd.create_time ASC workorder.is_urgent DESC, vd.create_time ASC
ENDSELECT ENDSELECT

200
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/FJSendEmptyTask.java

@ -0,0 +1,200 @@
package org.nl.wms.sch.task.send.empty;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.basedata.eum.VehicleType;
import org.nl.wms.sch.manage.*;
import org.nl.wms.sch.task.send.material.HLSendMaterialTask;
import org.nl.wms.sch.task.send.material.YZSendMaterialTask;
import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.transaction.annotation.Transactional;
/**
* @author zhangjiangwei
* @date 2023/04/14 21:29
*/
public class FJSendEmptyTask 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
@Transactional
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
TaskUtils.isLocked(point);
JSONObject work_order = TaskUtils.hasWorkOrder(point);
String vehicle_code = form.getString("vehicle_code");
if ("0000".equals(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
// todo 组盘
JSONObject task = TaskUtils.buildTask(
"混料机送料入库",
TaskType.SEND_MATERIAL.value(),
TaskStatus.SURE_START.value(),
point.getString("point_code"),
null,
work_order.getString("material_id"),
VehicleType.CUP.value(),
vehicle_code,
TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? "99" : "1",
HLSendMaterialTask.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);
return task.getString("task_id");
}
@Transactional(rollbackFor = Exception.class)
@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 = '" + YZSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
.getResultJSONArray(0);
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("SEND_MATERIAL_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", "");
task_table.update(task);
point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code"));
point_table.update(point);
}
}
}
@Transactional(rollbackFor = Exception.class)
@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);
}
@Transactional(rollbackFor = Exception.class)
@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);
}
@Transactional(rollbackFor = Exception.class)
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") + "'");
}
}
@Transactional(rollbackFor = Exception.class)
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());
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") + "'");
}
}
}

79
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/wql/SEND_EMPTY_TASK.wql

@ -0,0 +1,79 @@
[交易说明]
交易名: 叫空托盘
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF flag = "1"
QUERY
SELECT
point.*,
vd.material_id,
workorder.is_urgent
FROM
sch_base_point point
JOIN st_ivt_vehicle_detail vd ON point.vehicle_type = vd.vehicle_type
AND point.vehicle_code = vd.vehicle_code
AND vd.is_delete = '0'
LEFT JOIN pdm_bd_workorder workorder ON vd.workorder_id = workorder.workorder_id
WHERE
point.is_used = '1'
AND point.lock_type = '1'
AND point.region_code = 'CPHJ'
AND point.point_status = '1'
AND point.vehicle_type = '2'
AND vd.is_fire = '0'
AND vd.is_in_kiln = '1'
ORDER BY
workorder.is_urgent DESC, vd.create_time ASC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
*
FROM
sch_base_point
WHERE
is_used = '1'
AND lock_type = '1'
AND region_code = 'SZ'
AND point_type = '1'
ENDSELECT
ENDQUERY
ENDIF

137
lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/material/HLSendMaterialTask.java

@ -1,14 +1,15 @@
package org.nl.wms.sch.task.send.material; 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 com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.basedata.eum.TrueOrFalse; import org.nl.wms.basedata.eum.TrueOrFalse;
import org.nl.wms.basedata.eum.VehicleType; import org.nl.wms.basedata.eum.VehicleType;
import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.*;
import org.nl.wms.sch.manage.TaskStatus;
import org.nl.wms.sch.manage.TaskType;
import org.nl.wms.sch.task.util.TaskUtils; import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -25,8 +26,16 @@ public class HLSendMaterialTask extends AbstractAcsTask {
@Override @Override
public void updateTaskStatus(JSONObject taskObj, String status) { 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 @Override
@ -65,19 +74,131 @@ public class HLSendMaterialTask extends AbstractAcsTask {
return task.getString("task_id"); return task.getString("task_id");
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
@Transactional
public void findNextPoint() { 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 = '" + YZSendMaterialTask.class.getName() + "'", "priority DESC, create_time ASC")
.getResultJSONArray(0);
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("SEND_MATERIAL_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", "");
task_table.update(task);
point.put("lock_type", LockType.TASK_LOCKED.value());
point.put("task_code", task.getString("task_code"));
point_table.update(point);
}
}
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void forceFinish(String task_id) { 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);
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void cancel(String task_id) { 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);
}
@Transactional(rollbackFor = Exception.class)
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") + "'");
}
}
@Transactional(rollbackFor = Exception.class)
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());
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") + "'");
}
} }
} }

BIN
lms/nladmin-system/src/main/java/org/nl/wms/wms.xls

Binary file not shown.

2
lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue

@ -205,7 +205,6 @@
{{ dict.label.vehicle_type[scope.row.vehicle_type] }} {{ dict.label.vehicle_type[scope.row.vehicle_type] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="plan_qty" label="计划数量" /> <el-table-column prop="plan_qty" label="计划数量" />
<el-table-column prop="is_urgent" label="是否加急"> <el-table-column prop="is_urgent" label="是否加急">
<template slot-scope="scope"> <template slot-scope="scope">
@ -222,6 +221,7 @@
<el-table-column prop="real_qty" label="实际数量" /> <el-table-column prop="real_qty" label="实际数量" />
<el-table-column prop="qualified_qty" label="合格数量" /> <el-table-column prop="qualified_qty" label="合格数量" />
<el-table-column prop="unqualified_qty" label="不合格数量" width="100" /> <el-table-column prop="unqualified_qty" label="不合格数量" width="100" />
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="create_time" label="创建时间" width="150" /> <el-table-column prop="create_time" label="创建时间" width="150" />
<el-table-column prop="update_optname" label="修改人" /> <el-table-column prop="update_optname" label="修改人" />
<el-table-column prop="update_time" label="修改时间" width="150" /> <el-table-column prop="update_time" label="修改时间" width="150" />

Loading…
Cancel
Save