From c4ca99ad3c477f8b195280d935896e93dd92ee3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Sun, 23 Apr 2023 10:25:43 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=B7=A5=E5=8D=95=E4=B8=8B=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/ext/acs/rest/AcsToWmsController.java | 12 +- .../wms/ext/acs/service/AcsToWmsService.java | 2 - .../acs/service/impl/AcsToWmsServiceImpl.java | 72 +++----- .../org/nl/wms/ext/acs/wql/ACS_TO_WMS.wql | 60 +++++++ .../nl/wms/pdm/service/dto/WorkorderDto.java | 2 + .../service/impl/WorkorderServiceImpl.java | 22 +-- .../nl/wms/sch/manage/AbstractAcsTask.java | 3 +- .../org/nl/wms/sch/manage/TaskStatus.java | 2 +- .../wms/sch/service/impl/TaskServiceImpl.java | 13 +- .../sch/task/call/empty/GTKCallEmptyTask.java | 162 ++++++++++++++++++ .../task/call/empty/wql/CALL_EMPTY_TASK.wql | 19 ++ .../java/org/nl/wms/sch/wql/QSCH_TASK_01.wql | 4 +- .../src/test/java/org/nl/test/TempTest.java | 14 +- lms/nladmin-ui/src/views/login.vue | 18 +- .../src/views/wms/sch/point/index.vue | 3 + .../src/views/wms/sch/task/index.vue | 32 ++-- 16 files changed, 330 insertions(+), 110 deletions(-) create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/wql/ACS_TO_WMS.wql create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/GTKCallEmptyTask.java diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java index 5b596a8..d515fbd 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java @@ -136,18 +136,10 @@ public class AcsToWmsController { } @PostMapping("/getVehicleInfo") - @Log("根据载具编码获取托盘信息") - @ApiOperation("根据载具编码获取托盘信息") + @Log("根据载具编码获组盘信息") + @ApiOperation("根据载具编码获组盘信息") @SaIgnore public ResponseEntity getVehicleInfo(@RequestBody JSONObject whereJson) { return new ResponseEntity<>(acsToWmsService.getVehicleInfo(whereJson), HttpStatus.OK); } - - @PostMapping("/updateFoldPoint") - @Log("更新叠盘位点位状态") - @ApiOperation("更新叠盘位点位状态") - @SaIgnore - public ResponseEntity updateFoldPoint(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(acsToWmsService.updateFoldPoint(whereJson), HttpStatus.OK); - } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java index 21aee0d..529a6b0 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java @@ -106,6 +106,4 @@ public interface AcsToWmsService { JSONObject feedbackVehicleType(JSONObject param); JSONObject getVehicleInfo(JSONObject whereJson); - - JSONObject updateFoldPoint(JSONObject param); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index ff637f4..645c836 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -11,6 +11,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.modules.common.exception.BadRequestException; 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.TrueOrFalse; @@ -19,6 +20,7 @@ import org.nl.wms.basedata.eum.VehicleType; import org.nl.wms.basedata.service.dto.VehicleDto; import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.sch.manage.*; +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; @@ -58,6 +60,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { private final FJSendEmptyTask fjSendEmptyTask; + private final GTKCallEmptyTask gtkCallEmptyTask; + /** * task_id:任务标识 * task_code:任务编码 @@ -284,21 +288,27 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { break; case "4": // 叫空 - String device_code = point.getString("device_code"); - JSONObject work_order = WQLObject - .getWQLObject("pdm_bd_workorder") - .query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'") - .uniqueResult(0); - method_param.put("workorder", work_order); - switch (region) { case HL: + String device_code = point.getString("device_code"); + JSONObject work_order = WQLObject + .getWQLObject("pdm_bd_workorder") + .query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'") + .uniqueResult(0); + method_param.put("workorder", work_order); task_code = hlCallEmptyTask.createTask(method_param); break; case YZ: + device_code = point.getString("device_code"); + work_order = WQLObject + .getWQLObject("pdm_bd_workorder") + .query("is_delete = '0' AND device_code = '" + device_code + "' AND order_status = '3'") + .uniqueResult(0); + method_param.put("workorder", work_order); task_code = yzCallEmptyTask.createTask(method_param); break; case GTK: + task_code = gtkCallEmptyTask.createTask(method_param); break; default: throw new BadRequestException("[" + region.label() + "] 不能发起叫空任务!"); @@ -368,7 +378,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail"); JSONObject vd_update = new JSONObject(); vd_update.put("is_delete", TrueOrFalse.TRUE.value()); - vd_table.update(vd_update, "vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'"); + TaskUtils.addACSUpdateColum(vd_update); + vd_table.update(vd_update, "is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'"); JSONObject vd = new JSONObject(); vd.put("vd_id", IdUtil.getSnowflake(1, 1).nextId()); @@ -729,11 +740,6 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { if (StrUtil.isBlank(point_code)) { throw new BadRequestException("点位不能为空!"); } - String vehicle_code = whereJson.getString("vehicle_code"); - vehicle_code = TaskUtils.formatVehicleCode(vehicle_code); - if ("0000".equals(vehicle_code)) { - throw new BadRequestException("载具编码不能为空!"); - } JSONObject point = WQLObject .getWQLObject("sch_base_point") .query("is_used = '1' AND point_code = '" + point_code + "'") @@ -764,22 +770,17 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { throw new BadRequestException("未知载具类型!"); } + String vehicle_code = point.getString("vehicle_code"); JSONObject data = null; if (!"0000".equals(vehicle_code)) { - data = WQLObject - .getWQLObject("st_ivt_vehicle_detail") - .query("is_delete = '0' AND vehicle_type = '" + vehicle_type + "' AND vehicle_code = '" + vehicle_code + "'") + data = WQL + .getWO("ACS_TO_WMS") + .addParam("flag", "1") + .addParam("vehicle_type", vehicle_type) + .addParam("vehicle_code", vehicle_code) + .process() .uniqueResult(0); } - if (ObjectUtil.isNotEmpty(data)) { - assert data != null; - JSONObject material = WQLObject.getWQLObject("md_me_materialbase").query("material_id = " + data.getString("material_id")).uniqueResult(0); - data.put("product_code", material.getString("product_code")); - data.put("AlongSide", material.getString("a")); - data.put("BshortSide", material.getString("b")); - data.put("Htrapezoidal", material.getString("h")); - data.put("Wthickness", material.getString("w")); - } JSONObject result = new JSONObject(); result.put("status", HttpStatus.OK.value()); @@ -787,25 +788,4 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { result.put("data", data); return result; } - - @Override - public JSONObject updateFoldPoint(JSONObject param) { - String point_code = param.getString("device_code"); - if (StrUtil.isBlank(point_code)) { - throw new BadRequestException("点位不能为空!"); - } - String point_status = param.getString("point_status"); - if (StrUtil.isBlank(point_status)) { - throw new BadRequestException("点位状态不能为空!"); - } - - JSONObject point_update = new JSONObject(); - point_update.put("point_status", point_status); - WQLObject.getWQLObject("sch_base_point").update(point_update, "point_code = '" + point_code + "'"); - - JSONObject result = new JSONObject(); - result.put("status", HttpStatus.OK.value()); - result.put("message", "更新点位状态成功!"); - return result; - } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/wql/ACS_TO_WMS.wql b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/wql/ACS_TO_WMS.wql new file mode 100644 index 0000000..c041723 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/wql/ACS_TO_WMS.wql @@ -0,0 +1,60 @@ +[交易说明] + 交易名: 工单分页查询 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.vehicle_type TYPEAS s_string + 输入.vehicle_code TYPEAS s_string + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + + IF 输入.flag = "1" + QUERY + SELECT + vd.*, + material.product_code, + material.a AS AlongSide, + material.b AS BshortSide, + material.h AS Htrapezoidal, + material.w AS Wthickness + FROM + st_ivt_vehicle_detail vd + JOIN md_me_materialbase material ON vd.material_id = material.material_id + WHERE + vd.is_delete = '0' + AND vd.vehicle_type = 输入.vehicle_type + AND vd.vehicle_code = 输入.vehicle_code + ENDSELECT + ENDQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/WorkorderDto.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/WorkorderDto.java index 9ccfb31..ee0eaa1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/WorkorderDto.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/dto/WorkorderDto.java @@ -108,4 +108,6 @@ public class WorkorderDto implements Serializable { private String is_pri; private String ext_code; + + private String region_code; } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java index bfbc454..5ffa76b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/service/impl/WorkorderServiceImpl.java @@ -73,7 +73,7 @@ public class WorkorderServiceImpl implements WorkordeService { if (StrUtil.isNotEmpty(material)) { map.put("material", "%" + material + "%"); } - JSONObject jsonObject = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ShiftOrder.update_time desc"); + JSONObject jsonObject = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "ShiftOrder.order_status ASC, ShiftOrder.create_time DESC"); return jsonObject; } @@ -115,14 +115,12 @@ public class WorkorderServiceImpl implements WorkordeService { work_order.put("planproducestart_date", dto.getPlanproducestart_date()); work_order.put("planproduceend_date", dto.getPlanproduceend_date()); work_order.put("material_id", dto.getMaterial_id()); - Long device_id = dto.getDevice_id(); - JSONObject device = WQLObject.getWQLObject("pdm_bi_device").query("device = " + device_id).uniqueResult(0); - String device_region_code = device.getString("region_code"); + String region_code = dto.getRegion_code(); String vehicle_type = dto.getVehicle_type(); - if (!Region.FJ.value().equals(device_region_code)) { - if (Region.YZ.value().equals(device_region_code)) { + if (!Region.FJ.value().equals(region_code)) { + if (Region.YZ.value().equals(region_code)) { vehicle_type = VehicleType.STEEL_TRAY.value(); - } else if (Region.HL.value().equals(device_region_code)) { + } else if (Region.HL.value().equals(region_code)) { vehicle_type = VehicleType.CUP.value(); } } @@ -140,9 +138,6 @@ public class WorkorderServiceImpl implements WorkordeService { work_order.put("create_id", user_id); work_order.put("create_name", nick_name); work_order.put("create_time", now); - work_order.put("update_optid", user_id); - work_order.put("update_optname", nick_name); - work_order.put("update_time", now); WQLObject.getWQLObject("pdm_bd_workorder").insert(work_order); } @@ -219,11 +214,12 @@ public class WorkorderServiceImpl implements WorkordeService { throw new BadRequestException(String.valueOf(result.get("message"))); } - JSONObject order_status = new JSONObject(); - order_status.put("order_status", WorkOrderEnum.ORDER_STATUS_DELIVERED.value()); + JSONObject order_update = new JSONObject(); + order_update.put("order_status", WorkOrderEnum.ORDER_STATUS_DELIVERED.value()); + TaskUtils.addCurrentUpdateColum(order_update); WQLObject .getWQLObject("pdm_bd_workorder") - .update(order_status, "workorder_id = " + workorder_id); + .update(order_update, "workorder_id = " + workorder_id); } @Override diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AbstractAcsTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AbstractAcsTask.java index 43ca0ff..3863e34 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AbstractAcsTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AbstractAcsTask.java @@ -173,7 +173,7 @@ public abstract class AbstractAcsTask { .build(); JSONArray tasks = new JSONArray() {{ - add(acs_task); + add(JSONObject.parseObject(JSON.toJSONString(acs_task))); }}; JSONObject result = AcsUtil.notifyAcs("api/wms/task", tasks); @@ -258,6 +258,7 @@ public abstract class AbstractAcsTask { point1.put("vehicle_type", ""); point1.put("vehicle_code", ""); point1.put("point_status", PointStatus.EMPTY.value()); + TaskUtils.addACSUpdateColum(point1); point_table.update(point1); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/TaskStatus.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/TaskStatus.java index 06a9ae5..951f60b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/TaskStatus.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/TaskStatus.java @@ -7,7 +7,7 @@ public enum TaskStatus { CREATED("生成", "1"), SURE_START("确定起点", "2"), SURE_END("确定终点", "3"), - START_AND_END("起点终点确认", "4"), + START_AND_END("确认起点和终点", "4"), ISSUE("下发", "5"), EXECUTING("执行中", "6"), FINISHED("完成", "7"), diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/TaskServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/TaskServiceImpl.java index 205cf99..3897074 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/TaskServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/service/impl/TaskServiceImpl.java @@ -19,14 +19,11 @@ import org.nl.wms.basedata.service.ClassstandardService; import org.nl.wms.basedata.service.dto.ClassstandardDto; import org.nl.wms.sch.manage.AbstractAcsTask; import org.nl.wms.sch.manage.TaskStatus; -import org.nl.wms.sch.service.PointService; -import org.nl.wms.sch.service.RegionService; import org.nl.wms.sch.service.TaskService; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; @@ -41,8 +38,6 @@ import java.util.Map; public class TaskServiceImpl implements TaskService { private final ClassstandardService classstandardService; - private final RegionService regionService; - private final PointService pointService; @Override public Map queryAll(Map form, Pageable page) { @@ -90,15 +85,17 @@ public class TaskServiceImpl implements TaskService { if (StrUtil.isNotEmpty(whereJson.getString("point_code"))) { map.put("point_code", "%" + whereJson.getString("point_code") + "%"); } - return WQL.getWO("QSCH_TASK_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "task.update_time desc"); + return WQL.getWO("QSCH_TASK_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "task.create_time desc"); } + @Transactional(rollbackFor = Exception.class) @Override public void operation(Map map) { String task_id = MapUtil.getStr(map, "task_id"); String method_name = MapUtil.getStr(map, "method_name"); 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 message = ""; diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/GTKCallEmptyTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/GTKCallEmptyTask.java new file mode 100644 index 0000000..f2247b7 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/GTKCallEmptyTask.java @@ -0,0 +1,162 @@ +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.VehicleType; +import org.nl.wms.sch.manage.*; +import org.nl.wms.sch.task.util.TaskUtils; +import org.springframework.stereotype.Component; + +/** + * @author zhangjiangwei + * @date 2023/04/21 09:15 + */ +@RequiredArgsConstructor +@Component +public class GTKCallEmptyTask 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 task = TaskUtils.buildTask( + "钢托库叫空", + TaskType.CALL_EMPTY.value(), + TaskStatus.SURE_END.value(), + null, + point.getString("point_code"), + null, + VehicleType.STEEL_TRAY.value(), + null, + "1", + GTKCallEmptyTask.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 = '" + GTKCallEmptyTask.class.getName() + "'", "priority DESC, create_time ASC") + .getResultJSONArray(0); + + for (int i = 0; i < tasks.size(); i++) { + JSONObject task = tasks.getJSONObject(i); + + JSONObject point = WQL + .getWO("CALL_EMPTY_TASK") + .addParam("flag", "3") + .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("remark", ""); + TaskUtils.addAutoUpdateColum(task); + task_table.update(task); + } + } + } + + @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 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 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") + "'"); + } + } + + @Override + public void pickUpComplete(JSONObject task) { + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/wql/CALL_EMPTY_TASK.wql b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/wql/CALL_EMPTY_TASK.wql index f14b4bf..45a1f34 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/wql/CALL_EMPTY_TASK.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/task/call/empty/wql/CALL_EMPTY_TASK.wql @@ -73,3 +73,22 @@ ENDSELECT ENDQUERY ENDIF + + IF 输入.flag = "3" + QUERY + SELECT + * + FROM + sch_base_point point + LEFT JOIN sch_base_task task ON point.point_code = task.point_code1 + AND task.task_status <> '7' + AND task_status <> '8' + WHERE + point.is_used = '1' + AND point.lock_type = '1' + AND point.region_code = 'GTK' + AND point.point_type = '1' + AND task.task_id IS NULL + ENDSELECT + ENDQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/wql/QSCH_TASK_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/sch/wql/QSCH_TASK_01.wql index db15174..aa46e8b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/wql/QSCH_TASK_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/wql/QSCH_TASK_01.wql @@ -56,12 +56,14 @@ point1.region_name AS point1_region_name, point2.point_name AS point2_name, point2.region_name AS point2_region_name, - material.material_code + material.material_code, + dd.label AS task_status_name FROM sch_base_task task LEFT JOIN sch_base_point point1 ON task.point_code1 = point1.point_code LEFT JOIN sch_base_point point2 ON task.point_code2 = point2.point_code LEFT JOIN md_me_materialbase material ON task.material_id = material.material_id + LEFT JOIN sys_dict_detail dd ON dd.name = 'task_status' AND task.task_status = dd.value WHERE task.is_delete = '0' OPTION 输入.unFinish <> "" diff --git a/lms/nladmin-system/src/test/java/org/nl/test/TempTest.java b/lms/nladmin-system/src/test/java/org/nl/test/TempTest.java index 09a6287..801d06c 100644 --- a/lms/nladmin-system/src/test/java/org/nl/test/TempTest.java +++ b/lms/nladmin-system/src/test/java/org/nl/test/TempTest.java @@ -2,9 +2,11 @@ package org.nl.test; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSONObject; import org.junit.Test; import org.junit.runner.RunWith; +import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.wms.sch.manage.LockType; import org.springframework.boot.test.context.SpringBootTest; @@ -22,9 +24,13 @@ public class TempTest { @Test public void test01() { - Set materialbase = WQLObject.getWQLObject("md_me_materialbase").query().uniqueResult(0).keySet(); - for (String s : materialbase) { - System.out.println(s); - } + JSONObject data = WQL + .getWO("ACS_TO_WMS") + .addParam("flag", "1") + .addParam("vehicle_type", "2") + .addParam("vehicle_code", "5555") + .process() + .uniqueResult(0); + System.out.println(data); } } diff --git a/lms/nladmin-ui/src/views/login.vue b/lms/nladmin-ui/src/views/login.vue index b246c98..c37f610 100644 --- a/lms/nladmin-ui/src/views/login.vue +++ b/lms/nladmin-ui/src/views/login.vue @@ -98,9 +98,9 @@ export default { }) }, getCookie() { - const username = Cookies.get('username') - let password = Cookies.get('password') - const rememberMe = Cookies.get('rememberMe') + const username = Cookies.get('lms-username') + let password = Cookies.get('lms-password') + const rememberMe = Cookies.get('lms-rememberMe') // 保存cookie里面的加密后的密码 this.cookiePass = password === undefined ? '' : password password = password === undefined ? this.loginForm.password : password @@ -124,13 +124,13 @@ export default { if (valid) { this.loading = true if (user.rememberMe) { - Cookies.set('username', user.username, { expires: Config.passCookieExpires }) - Cookies.set('password', this.loginForm.password, { expires: Config.passCookieExpires }) - Cookies.set('rememberMe', user.rememberMe, { expires: Config.passCookieExpires }) + Cookies.set('lms-username', user.username, { expires: Config.passCookieExpires }) + Cookies.set('lms-password', this.loginForm.password, { expires: Config.passCookieExpires }) + Cookies.set('lms-rememberMe', user.rememberMe, { expires: Config.passCookieExpires }) } else { - Cookies.remove('username') - Cookies.remove('password') - Cookies.remove('rememberMe') + Cookies.remove('lms-username') + Cookies.remove('lms-password') + Cookies.remove('lms-rememberMe') } this.$store.dispatch('Login', user).then(() => { this.loading = false diff --git a/lms/nladmin-ui/src/views/wms/sch/point/index.vue b/lms/nladmin-ui/src/views/wms/sch/point/index.vue index 920ab4c..d5a89c0 100644 --- a/lms/nladmin-ui/src/views/wms/sch/point/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/point/index.vue @@ -370,6 +370,9 @@ export default { title: '点位', url: 'api/point', idField: 'point_id', + query: { + is_used: '1' + }, optShow: { add: true, edit: false, diff --git a/lms/nladmin-ui/src/views/wms/sch/task/index.vue b/lms/nladmin-ui/src/views/wms/sch/task/index.vue index bd816e8..7e0dfd4 100644 --- a/lms/nladmin-ui/src/views/wms/sch/task/index.vue +++ b/lms/nladmin-ui/src/views/wms/sch/task/index.vue @@ -28,12 +28,12 @@ @keyup.enter.native="crud.toQuery" /> - + @@ -84,35 +84,37 @@ - + - + - - - - - - + + + + + + - - + + - - - + + + + +