Browse Source

rev 压机叫料/送空盅

master
张江玮 2 years ago
parent
commit
eadb626003
  1. 2
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java
  2. 52
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java
  3. 6
      lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java
  4. 11
      lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java
  5. 89
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoUpdateStandStatus.java
  6. 87
      lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/wql/MANAGE_QUERY.wql
  7. 231
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/YZCallMaterialTask.java
  8. 29
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/material/wql/CALL_MATERIAL_TASK.wql
  9. 8
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/FJSendEmptyTask.java
  10. 231
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/YZSendEmptyTask.java
  11. 16
      lms/nladmin-system/src/main/java/org/nl/wms/sch/task/send/empty/wql/SEND_EMPTY_TASK.wql
  12. 67
      lms/nladmin-system/src/test/java/org/nl/test/TempTest.java
  13. 2
      lms/nladmin-ui/src/utils/nladmin.js
  14. 6
      lms/nladmin-ui/src/views/wms/pdm/workerorder/hl/index.vue
  15. 8
      lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue
  16. 2
      lms/nladmin-ui/src/views/wms/sch/point/index.vue

2
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java

@ -69,6 +69,8 @@ public interface WmsToAcsService {
*/
JSONObject getTray(JSONArray whereJson);
JSONObject light(JSONArray whereJson);
/**
* 获取点位
*/

52
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java

@ -14,6 +14,7 @@ import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.basedata.eum.StandStatus;
import org.nl.wms.basedata.eum.TrueOrFalse;
import org.nl.wms.basedata.eum.VehicleType;
import org.nl.wms.basedata.service.dto.VehicleDto;
@ -24,7 +25,9 @@ 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.YZCallEmptyTask;
import org.nl.wms.sch.task.call.material.FJCallMaterialTask;
import org.nl.wms.sch.task.call.material.YZCallMaterialTask;
import org.nl.wms.sch.task.send.empty.FJSendEmptyTask;
import org.nl.wms.sch.task.send.empty.YZSendEmptyTask;
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;
@ -68,6 +71,10 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
private final BTHCToPackageTask bthcToPackageTask;
private final YZCallMaterialTask yzCallMaterialTask;
private final YZSendEmptyTask yzSendEmptyTask;
/**
* task_id任务标识
* task_code任务编码
@ -264,7 +271,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
vd.put("create_name", ACSSystem.nick_name);
vd.put("create_time", now);
vd.put("is_in_kiln", "0");
vd.put("stand_status", "2");
vd.put("stand_status", StandStatus.STANDING.value());
vd_table.insert(vd);
method_param.put("vd", vd);
@ -310,6 +317,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
method_param.put("workorder", workorder);
switch (region) {
case YZ:
task_code = yzCallMaterialTask.createTask(method_param);
break;
case FJ:
task_code = fjCallMaterialTask.createTask(method_param);
break;
@ -319,19 +329,41 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
break;
case "3":
// 送空
String vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
if ("0000".equals(vehicle_code)) {
vehicle_code = point.getString("vehicle_code");
if (StrUtil.isBlank(vehicle_code) || "0000".equals(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
}
method_param.put("vehicle_code", vehicle_code);
workorder = WQLObject
.getWQLObject("pdm_bd_workorder")
.query("is_delete = '0' AND device_code = '" + point.getString("device_code") + "' AND order_status = '3'")
.uniqueResult(0);
method_param.put("workorder", workorder);
switch (region) {
case FJ:
case YZ:
String vehicle_type = point.getString("vehicle_type");
if (StrUtil.isBlank(vehicle_type)) {
throw new BadRequestException("点位 [" + point_code + "] 无载具类型!");
}
String vehicle_code = TaskUtils.formatVehicleCode(point.getString("vehicle_code"));
if ("0000".equals(vehicle_code)) {
throw new BadRequestException("点位 [" + point_code + "] 无载具编码!");
}
JSONObject vd_update = new JSONObject();
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
WQLObject
.getWQLObject("st_ivt_vehicle_detail")
.update(vd_update, "vehicle_type = " + vehicle_type + " AND vehicle_code = '" + vehicle_code + "'");
task_code = yzSendEmptyTask.createTask(method_param);
break;
case FJ:
vehicle_code = TaskUtils.formatVehicleCode(param.getString("vehicle_code"));
if ("0000".equals(vehicle_code)) {
vehicle_code = point.getString("vehicle_code");
if (StrUtil.isBlank(vehicle_code) || "0000".equals(vehicle_code)) {
throw new BadRequestException("载具编码不能为空!");
}
}
method_param.put("vehicle_code", vehicle_code);
vd_update = new JSONObject();
vd_update.put("is_delete", TrueOrFalse.TRUE.value());
WQLObject
.getWQLObject("st_ivt_vehicle_detail")
.update(vd_update, "vehicle_type = '2' AND vehicle_code = '" + vehicle_code + "'");

6
lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java

@ -66,4 +66,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
return AcsUtil.notifyAcs(api, whereJson);
}
@Override
public JSONObject light(JSONArray whereJson) {
String api = "api/wms/light";
return AcsUtil.notifyAcs(api, whereJson);
}
}

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

@ -169,6 +169,13 @@ public class WorkorderServiceImpl implements WorkordeService {
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
JSONObject workorder = wo.query("is_delete = '0' AND workorder_id = " + ids[0]).uniqueResult(0);
if (ObjectUtil.isEmpty(workorder)) {
throw new BadRequestException("工单不存在或已删除!");
}
if (workorder.getIntValue("order_status") > 1) {
throw new BadRequestException("工单已进入流程,无法删除!");
}
for (Long workorder_id : ids) {
JSONObject param = new JSONObject();
param.put("workorder_id", String.valueOf(workorder_id));
@ -190,13 +197,13 @@ public class WorkorderServiceImpl implements WorkordeService {
.addParam("workorder_id", workorder_id)
.process()
.uniqueResult(0);
if (submit_obj.getIntValue("order_status") > 1) {
if (submit_obj.getIntValue("order_status") > 2) {
throw new BadRequestException("工单已开工!");
}
JSONObject workorder = WQLObject
.getWQLObject("pdm_bd_workorder")
.query("is_delete = '0' AND device_id = '" + submit_obj.getString("device_id") + "' AND order_status IN ('2', '3')")
.query("is_delete = '0' AND device_id = '" + submit_obj.getString("device_id") + "' AND order_status = '3' AND workorder_id <> " + workorder_id)
.uniqueResult(0);
if (ObjectUtil.isNotEmpty(workorder)) {
throw new BadRequestException("该设备正在执行其它工单!");

89
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoUpdateStandStatus.java

@ -0,0 +1,89 @@
package org.nl.wms.sch.manage;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.utils.CommonUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.wms.basedata.eum.StandStatus;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
/**
* @author zhangjiangwei
* @date 2023/05/10 10:48
*/
@Slf4j
@RequiredArgsConstructor
@Component("autoUpdateStandStatus")
public class AutoUpdateStandStatus {
private final WmsToAcsService wmsToAcsService;
@SneakyThrows
public void run() {
JSONArray vds = WQL.getWO("MANAGE_QUERY").addParam("flag", "1").process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(vds)) {
ArrayList<Long> ids = new ArrayList<>();
for (int i = 0; i < vds.size(); i++) {
JSONObject vd = vds.getJSONObject(i);
DateTime create_time = DateUtil.parse(vd.getString("create_time"));
DateTime time = DateUtil.offsetMinute(create_time, vd.getIntValue("standing_time"));
int compare = DateUtil.compare(DateUtil.date(), time);
if (compare >= 0) {
ids.add(vd.getLong("vd_id"));
}
}
if (!ids.isEmpty()) {
JSONObject update = new JSONObject();
update.put("stand_status", StandStatus.COMPLETED.value());
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(update, "vd_id IN " + CommonUtils.idsArrayToInStr(ids.toArray(new Long[0])));
}
}
vds = WQL.getWO("MANAGE_QUERY").addParam("flag", "2").process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(vds)) {
ArrayList<Long> ids = new ArrayList<>();
for (int i = 0; i < vds.size(); i++) {
JSONObject vd = vds.getJSONObject(i);
DateTime create_time = DateUtil.parse(vd.getString("create_time"));
int threshold_time = vd.getIntValue("threshold_time");
int standing_time = vd.getIntValue("standing_time");
if (threshold_time != 0 && threshold_time < standing_time) {
DateTime time = DateUtil.offsetMinute(create_time, threshold_time);
int compare = DateUtil.compare(DateUtil.date(), time);
if (compare >= 0) {
ids.add(vd.getLong("vd_id"));
}
}
}
if (!ids.isEmpty()) {
JSONObject update = new JSONObject();
update.put("stand_status", StandStatus.TIMEOUT.value());
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(update, "vd_id IN " + CommonUtils.idsArrayToInStr(ids.toArray(new Long[0])));
}
}
JSONArray points = WQL.getWO("MANAGE_QUERY").addParam("flag", "3").process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(vds)) {
JSONArray point_codes = new JSONArray();
for (int i = 0; i < points.size(); i++) {
JSONObject point = points.getJSONObject(i);
point_codes.add(point.getString("point_code"));
}
wmsToAcsService.light(point_codes);
}
}
}

87
lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/wql/MANAGE_QUERY.wql

@ -0,0 +1,87 @@
[交易说明]
交易名: manage
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
vd.*,
mb.standing_time
FROM
st_ivt_vehicle_detail vd
LEFT JOIN md_me_materialbase mb ON vd.material_id = mb.material_id
WHERE
vd.is_delete = '0'
AND vd.vehicle_type = '1'
AND vd.stand_status = '2'
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
vd.*,
mb.standing_time,
mb.threshold_time
FROM
st_ivt_vehicle_detail vd
LEFT JOIN md_me_materialbase mb ON vd.material_id = mb.material_id
WHERE
vd.is_delete = '0'
AND vd.vehicle_type = '1'
AND vd.stand_status IN ('3', '4')
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
*
FROM
sch_base_point point
LEFT 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'
WHERE
point.region_code = 'KLHJ'
AND point.point_type = '2'
AND vd.stand_status > '2'
ENDSELECT
ENDQUERY
ENDIF

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

@ -0,0 +1,231 @@
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;
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.util.TaskUtils;
import org.springframework.stereotype.Component;
/**
* @author zhangjiangwei
* @date 2023/05/10 10:04
*/
@RequiredArgsConstructor
@Component
public class YZCallMaterialTask 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 workorder = form.getJSONObject("workorder");
JSONObject task = TaskUtils.buildTask(
"压制区叫料",
TaskType.CALL_MATERIAL.value(),
TaskStatus.SURE_END.value(),
null,
point.getString("point_code"),
null,
workorder.getString("material_id"),
VehicleType.CUP.value(),
null,
TrueOrFalse.trueOrFalse(workorder.getString("is_urgent")) ? 50 : 1,
YZCallMaterialTask.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 = '" + YZCallMaterialTask.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_MATERIAL_TASK")
.addParam("flag", "4")
.addParam("material_id", task.getString("material_id"))
.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("vehicle_code", TaskUtils.formatVehicleCode(point.getString("vehicle_code")));
task.put("material_id", point.getString("material_id"));
task.put("remark", "");
TaskUtils.addAutoUpdateColum(task);
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"));
TaskUtils.addAutoUpdateColum(point_update);
point_table.update(point_update, "point_id = " + point.getLongValue("point_id"));
}
}
}
}
@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 (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);
}
}
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 + "'");
}
}
}
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 (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", "");
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 + "'");
}
}
}
}

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

@ -104,3 +104,32 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
point.*,
mb1.material_id
FROM
sch_base_point point
LEFT 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 md_me_materialbase mb1 ON vd.material_id = mb1.material_id
LEFT JOIN md_me_material_detail md ON mb1.material_code = md.bom_code
LEFT JOIN md_me_materialbase mb2 ON md.material_id = mb2.material_id
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 = 'KLHJ'
AND point.point_type = '1'
AND point.point_status = '1'
AND point.vehicle_type = '1'
AND mb2.material_id = 输入.material_id
AND vd.stand_status IN ('3', '4')
ORDER BY
workorder.is_urgent DESC, vd.create_time ASC
ENDSELECT
ENDQUERY
ENDIF

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

@ -8,6 +8,7 @@ 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.basedata.eum.VehicleType;
import org.nl.wms.sch.manage.*;
import org.nl.wms.sch.task.util.TaskUtils;
@ -39,6 +40,11 @@ public class FJSendEmptyTask extends AbstractAcsTask {
@Override
public String createTask(JSONObject form) {
JSONObject point = form.getJSONObject("point");
JSONObject work_order = form.getJSONObject("workorder");
int priority = 1;
if (ObjectUtil.isNotEmpty(work_order)) {
priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1;
}
JSONObject task = TaskUtils.buildTask(
"分拣区送空",
@ -50,7 +56,7 @@ public class FJSendEmptyTask extends AbstractAcsTask {
null,
VehicleType.STEEL_TRAY.value(),
form.getString("vehicle_code"),
1,
priority,
FJSendEmptyTask.class.getName(),
form.getString("create_mode"),
form.getString("request_param"),

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

@ -0,0 +1,231 @@
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;
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.util.TaskUtils;
import org.springframework.stereotype.Component;
/**
* @author zhangjiangwei
* @date 2023/05/10 10:25
*/
@RequiredArgsConstructor
@Component
public class YZSendEmptyTask 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 = 1;
if (ObjectUtil.isNotEmpty(work_order)) {
priority = TrueOrFalse.trueOrFalse(work_order.getString("is_urgent")) ? 50 : 1;
}
JSONObject task = TaskUtils.buildTask(
"压制区送空",
TaskType.SEND_EMPTY.value(),
TaskStatus.SURE_START.value(),
point.getString("point_code"),
null,
null,
null,
point.getString("vehicle_type"),
point.getString("vehicle_code"),
priority,
YZSendEmptyTask.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 = '" + YZSendEmptyTask.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("SEND_EMPTY_TASK")
.addParam("flag", "2")
.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 + "'");
}
}
}
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", "");
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 + "'");
}
}
}
}

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

@ -55,3 +55,19 @@
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
*
FROM
sch_base_point
WHERE
is_used = '1'
AND lock_type = '1'
AND point_status = '0'
AND region_code = 'KLHJ'
AND point_type = '1'
ENDSELECT
ENDQUERY
ENDIF

67
lms/nladmin-system/src/test/java/org/nl/test/TempTest.java

@ -1,17 +1,24 @@
package org.nl.test;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.nl.modules.common.utils.CommonUtils;
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.StandStatus;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.sch.manage.LockType;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.Set;
/**
@ -24,12 +31,58 @@ public class TempTest {
@Test
public void test01() {
JSONObject data = WQL
.getWO("SEND_MATERIAL_TASK")
.addParam("flag", "4")
.addParam("is_full", "0")
.process()
.uniqueResult(0);
System.out.println(data.getString("region_name"));
JSONArray vds = WQL.getWO("MANAGE_QUERY").addParam("flag", "1").process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(vds)) {
ArrayList<Long> ids = new ArrayList<>();
for (int i = 0; i < vds.size(); i++) {
JSONObject vd = vds.getJSONObject(i);
DateTime create_time = DateUtil.parse(vd.getString("create_time"));
DateTime time = DateUtil.offsetMinute(create_time, vd.getIntValue("standing_time"));
int compare = DateUtil.compare(DateUtil.date(), time);
if (compare >= 0) {
ids.add(vd.getLong("vd_id"));
}
}
JSONObject update = new JSONObject();
update.put("stand_status", StandStatus.COMPLETED.value());
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(update, "vd_id IN " + CommonUtils.idsArrayToInStr(ids.toArray(new Long[0])));
}
vds = WQL.getWO("MANAGE_QUERY").addParam("flag", "2").process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(vds)) {
ArrayList<Long> ids = new ArrayList<>();
for (int i = 0; i < vds.size(); i++) {
JSONObject vd = vds.getJSONObject(i);
DateTime create_time = DateUtil.parse(vd.getString("create_time"));
int threshold_time = vd.getIntValue("threshold_time");
int standing_time = vd.getIntValue("standing_time");
if (threshold_time != 0 && threshold_time < standing_time) {
DateTime time = DateUtil.offsetMinute(create_time, threshold_time);
int compare = DateUtil.compare(DateUtil.date(), time);
if (compare >= 0) {
ids.add(vd.getLong("vd_id"));
}
}
}
if (!ids.isEmpty()) {
JSONObject update = new JSONObject();
update.put("stand_status", StandStatus.TIMEOUT.value());
WQLObject.getWQLObject("st_ivt_vehicle_detail").update(update, "vd_id IN " + CommonUtils.idsArrayToInStr(ids.toArray(new Long[0])));
}
}
JSONArray points = WQL.getWO("MANAGE_QUERY").addParam("flag", "3").process().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(vds)) {
JSONArray point_codes = new JSONArray();
for (int i = 0; i < points.size(); i++) {
JSONObject point = points.getJSONObject(i);
point_codes.add(point.getString("point_code"));
}
SpringContextHolder.getBean(WmsToAcsService.class).light(point_codes);
}
}
}

2
lms/nladmin-ui/src/utils/nladmin.js

@ -257,7 +257,7 @@ export function flexWidth(prop, tableData, title, num = 0) {
const column_w = context.measureText(columnContent).width
const title_w = context.measureText(title).width
if (column_w < title_w) {
columnContent = title || '留四个字'
columnContent = title
}
// 计算最宽内容的列宽
const width = context.measureText(columnContent)

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

@ -136,8 +136,8 @@
<el-row>
<el-col :span="12">
<el-form-item label="是否加急" prop="is_urgent">
<el-radio v-model="form.is_urgent" :disabled="crud.status.edit" label="1"></el-radio>
<el-radio v-model="form.is_urgent" :disabled="crud.status.edit" label="0"></el-radio>
<el-radio v-model="form.is_urgent" label="1"></el-radio>
<el-radio v-model="form.is_urgent" label="0"></el-radio>
</el-form-item>
</el-col>
</el-row>
@ -177,7 +177,7 @@
</template>
</el-table-column>
<el-table-column prop="device_name" label="设备" :min-width="flexWidth('device_name',crud.data,'设备')" />
<el-table-column prop="material_code" label="BOM编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_code" label="BOM编码" :min-width="flexWidth('material_code',crud.data,'BOM编码')" />
<el-table-column prop="plan_qty" label="计划重量" :min-width="flexWidth('plan_qty',crud.data,'计划数量/重量')" />
<el-table-column prop="is_urgent" label="是否加急" :min-width="flexWidth('is_urgent',crud.data,'是否加急')">
<template slot-scope="scope">

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

@ -150,16 +150,16 @@
<el-row>
<el-col :span="12">
<el-form-item label="是否加急" prop="is_urgent">
<el-radio v-model="form.is_urgent" :disabled="crud.status.edit" label="1"></el-radio>
<el-radio v-model="form.is_urgent" :disabled="crud.status.edit" label="0"></el-radio>
<el-radio v-model="form.is_urgent" label="1"></el-radio>
<el-radio v-model="form.is_urgent" label="0"></el-radio>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否优先包装" prop="is_pri">
<el-radio v-model="form.is_pri" :disabled="crud.status.edit" label="1"></el-radio>
<el-radio v-model="form.is_pri" :disabled="crud.status.edit" label="0"></el-radio>
<el-radio v-model="form.is_pri" label="1"></el-radio>
<el-radio v-model="form.is_pri" label="0"></el-radio>
</el-form-item>
</el-col>
</el-row>

2
lms/nladmin-ui/src/views/wms/sch/point/index.vue

@ -265,7 +265,7 @@
</template>
</el-table-column>
<el-table-column prop="vehicle_code" label="载具编码" :min-width="flexWidth('vehicle_code',crud.data,'载具编码')" />
<el-table-column prop="material_code" label="物料编码/BOM编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_code" label="物料编码/BOM编码" :min-width="flexWidth('material_code',crud.data,'物料编码/BOM编码')" />
<el-table-column prop="remark" label="备注" :min-width="flexWidth('remark',crud.data,'备注')" show-overflow-tooltip />
<el-table-column prop="create_name" label="创建人" :min-width="flexWidth('create_name',crud.data,'创建人')" />
<el-table-column prop="create_time" label="创建时间" :min-width="flexWidth('create_time',crud.data,'创建时间')" />

Loading…
Cancel
Save