From aca6a33ec3dfab899fb91caa6fc06df092425a57 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Thu, 19 Oct 2023 10:51:52 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E5=88=86=E6=8B=A3=E5=8F=AB=E6=96=99?= =?UTF-8?q?=E8=A7=84=E5=88=99=E3=80=81=E6=89=8B=E6=8C=81=E8=B4=A7=E6=9E=B6?= =?UTF-8?q?=E7=9B=98=E7=82=B9=E3=80=81=E5=8E=8B=E6=9C=BA=E6=90=AC=E8=BF=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/pda/service/impl/PdaServiceImpl.java | 11 ++- .../task_manage/task/tasks/fj/FJMKTask.java | 16 ++-- .../task_manage/task/tasks/fj/FJRKTask.java | 86 +++++++++++++++++-- .../task/tasks/fj/mapper/FJMapper.java | 6 +- .../task/tasks/fj/mapper/FJMapper.xml | 37 +++++--- .../main/resources/config/application-dev.yml | 4 +- lms/nladmin-ui/.env.development | 4 +- .../src/views/wms/pdm/workerorder/index.vue | 1 + 8 files changed, 126 insertions(+), 39 deletions(-) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java index 57d40da..21befbf 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/pda/service/impl/PdaServiceImpl.java @@ -303,6 +303,7 @@ public class PdaServiceImpl implements PdaService { param.put("vehicle_code", manualResidueInDto.getVehicle_code()); param.put("vehicle_qty", "1"); param.put("user_id", "1"); + param.put("surplus_quantity", manualResidueInDto.getSurplus_quantity()); taskService.apply(param); return PdaResponseVo.pdaResultOk("包装入库请求成功"); } @@ -359,9 +360,17 @@ public class PdaServiceImpl implements PdaService { basePoint.setPoint_status(shelfSaveDto.getPoint_status()); PointUtils.setUpdateByPC(basePoint); if (shelfSaveDto.getPoint_status().equals(PointStatusEnum.EMPTY_POINT.getCode())) { + // 如果有组盘信息,就把组盘信息解绑 + if (ObjectUtil.isNotEmpty(basePoint.getVehicle_code())) { + SchBaseVehiclematerialgroup groupInfo = vehiclematerialgroupService.getGroupInfo(basePoint.getVehicle_code(), + GeneralDefinition.STEEL_TRAY, GroupBindMaterialStatusEnum.BOUND.getValue()); + TaskUtils.setGroupUpdateByPC(groupInfo); + groupInfo.setGroup_bind_material_status(GroupBindMaterialStatusEnum.UNBOUND.getValue()); + vehiclematerialgroupService.updateById(groupInfo); + } // 空位 PointUtils.clearPoint(basePoint); - return PdaResponseVo.pdaResultOk("货位情况成功"); + return PdaResponseVo.pdaResultOk("货位清空成功"); } else if (shelfSaveDto.getPoint_status().equals(PointStatusEnum.FULL_POINT.getCode())){ // 设置物料 toSaveGroupMaterial(shelfSaveDto);// 保存组盘 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java index 089b14e..5dcad63 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJMKTask.java @@ -82,6 +82,7 @@ public class FJMKTask extends AbstractTask { String requestParam = task.getRequest_param();// 任务的其他数据 JSONObject jsonObject = JSONObject.parseObject(requestParam); String workOrderCode = jsonObject.getString("workorder_code"); // 工单 + PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode); String startPoint = task.getPoint_code1(); // 获取起点 回写载具编码 SchBasePoint startPointObj = pointService.getById(startPoint); @@ -98,7 +99,6 @@ public class FJMKTask extends AbstractTask { continue; } task.setPoint_code2(packagePoint.getPoint_code()); // 包装线 - // todo: 校验是否够码满一托 List list = JSONArray.parseArray(jsonObject.getString("list"), ApplyDeviceDto.class); // 1 获取点位相应数量 int sum = 0; @@ -106,12 +106,10 @@ public class FJMKTask extends AbstractTask { sum += Integer.parseInt(applyDeviceDto.getQty()); } // 2 获取剩余量 surplusNumber - // 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 ( 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中 ) - int surplusNumber = fjMapper.getInventoryQuantity(); + int surplusNumber = fjMapper.getInventoryQuantity(workorder.getMaterial_id()); // 3 现有总数 total int total = sum + surplusNumber; // 4 获取木托盘需要多少块 needFullNumber - PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode); String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id()); int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr); // 大于两托正常,大于1托给1,小于1托给2 @@ -168,6 +166,7 @@ public class FJMKTask extends AbstractTask { String requestParam = task.getRequest_param();// 任务的其他数据 JSONObject jsonObject = JSONObject.parseObject(requestParam); String workOrderCode = jsonObject.getString("workorder_code"); // 工单 + PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode); String startPoint = task.getPoint_code1(); // 获取起点 回写载具编码 SchBasePoint startPointObj = pointService.getById(startPoint); @@ -189,17 +188,12 @@ public class FJMKTask extends AbstractTask { for (ApplyDeviceDto applyDeviceDto : list) { sum += Integer.parseInt(applyDeviceDto.getQty()); } - // 2 获取剩余量 surplusNumber - // 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 ( 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中 ) - int surplusNumber = fjMapper.getInventoryQuantity(); + // 2 获取库存量 surplusNumber + int surplusNumber = fjMapper.getInventoryQuantity(workorder.getMaterial_id()); // 3 现有总数 total int total = sum + surplusNumber; // 4 获取木托盘需要多少块 needFullNumber - PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode); String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id()); - if (ObjectUtil.isEmpty(needFullNumberStr)) { - // todo: 同步物料数据 - } int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr); // todo: 大于两托正常,大于1托给1,小于1托给2 // 5 校验是否够码满一托/两托 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java index e8f98b3..351d168 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJRKTask.java @@ -3,6 +3,7 @@ package org.nl.wms.sch.task_manage.task.tasks.fj; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.nl.common.exception.BadRequestException; @@ -22,6 +23,7 @@ import org.nl.wms.sch.task_manage.GeneralDefinition; import org.nl.wms.sch.task_manage.enums.*; import org.nl.wms.sch.task_manage.task.TaskType; import org.nl.wms.sch.task_manage.task.core.TaskStatus; +import org.nl.wms.sch.task_manage.task.tasks.fj.mapper.FJMapper; import org.nl.wms.util.PointUtils; import org.nl.wms.util.TaskUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -53,6 +55,8 @@ public class FJRKTask extends AbstractTask { private IPdmBdWorkorderService workorderService; @Autowired private ISchBaseVehiclematerialgroupService vehiclematerialgroupService; + @Autowired + private FJMapper fjMapper; @Override protected void create() throws BadRequestException { // 最后一坨不需要呼叫空盘 @@ -95,25 +99,91 @@ public class FJRKTask extends AbstractTask { // 配置信息 SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper() .eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE)); + String requestParam = task.getRequest_param();// 任务的其他数据 + JSONObject jsonObject = JSONObject.parseObject(requestParam); + String workOrderCode = jsonObject.getString("workorder_code"); // 工单 + PdmBdWorkorder workorder = workorderService.getByCode(workOrderCode); TaskUtils.setUpdateByAcs(task); List nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")).collect(Collectors.toList()); + List startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList()); // 找终点 - SchBasePoint point = findNextPoint(nextRegionStr); - if (ObjectUtil.isEmpty(point)) { + SchBasePoint packagePoint = findNextPoint(nextRegionStr); + if (ObjectUtil.isEmpty(packagePoint)) { // 消息通知 noticeService.createNotice("找不到可用的包装位!", TASK_CONFIG_CODE + task.getPoint_code1(), NoticeTypeEnum.WARN.getCode()); throw new BadRequestException("找不到可用的包装位!"); } - // 设置终点并修改创建成功状态 - task.setPoint_code2(point.getPoint_code()); + task.setPoint_code2(packagePoint.getPoint_code()); + // 1 剩余量 + Integer surplusQuantity = jsonObject.getInteger("surplus_quantity"); // 码垛上剩余数量 + // 2 获取库存量 surplusNumber + int surplusNumber = fjMapper.getInventoryQuantity(workorder.getMaterial_id()); + // 3 现有总数 total + int total = surplusNumber + surplusQuantity; + // 4 获取木托盘需要多少块 needFullNumber + String needFullNumberStr = fjMapper.getNeedFullNumber(workorder.getMaterial_id()); + int needFullNumber = TaskUtils.convertMultiply(needFullNumberStr); + // 5 校验是否够码满一托 + // 大于等于1就可以码 + if (total/needFullNumber >= 1) { + /** 覆膜机木托盘位 */ + SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject); + if (ObjectUtil.isEmpty(LaminatePoint)) { + noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getPoint_code1(), + NoticeTypeEnum.WARN.getCode()); + // 消息通知 + throw new BadRequestException("覆膜区不可用!"); + } + // 把这个设备位放到任务中 + JSONObject response = new JSONObject(); + String responseParam = task.getResponse_param(); + if (ObjectUtil.isNotEmpty(responseParam)) { + response = JSON.parseObject(responseParam); + } + response.put("fmj_device", LaminatePoint.getPoint_code()); + // 生产木托盘编码 + // 设置终点并修改创建成功状态 + task.setPoint_code3(LaminatePoint.getParent_point_code()); + task.setPoint_code4(task.getPoint_code1()); + task.setResponse_param(response.toJSONString()); + // 覆膜机对接位上锁 + SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code()); + basePoint.setIng_task_code(task.getTask_code()); + PointUtils.setUpdateByAcs(basePoint); + pointService.updateById(basePoint); + } task.setTask_status(TaskStatus.CREATED.getCode()); task.setRemark(""); taskService.save(task); - // todo 判断是否够码满一垛,够就叫空盘,否则就是两点任务 - point.setIng_task_code(task.getTask_code()); - PointUtils.setUpdateByAcs(point); - pointService.updateById(point); + // 包装线上锁 + packagePoint.setIng_task_code(task.getTask_code()); + PointUtils.setUpdateByAcs(packagePoint); + pointService.updateById(packagePoint); + } + + /** + * 从覆膜区找个空木托盘 + * @param startRegionStr + * @param extData + * @return + */ + private SchBasePoint findStartPoint(List startRegionStr, JSONObject extData) { + // 当前设备的工单 + String workorderCode = extData.getString("workorder_code"); + PdmBdWorkorder one = ObjectUtil.isNotEmpty(workorderCode) + ? workorderService.getOne(new LambdaQueryWrapper() + .eq(PdmBdWorkorder::getWorkorder_code, workorderCode)) + : null; + if (one == null) { + throw new BadRequestException("工单不能为空!"); + } + String vehicleType = one.getVehicle_type(); + // 向ACS请求所需木托盘在那个栈拆盘机?已经实时更新,故只需要自己查询即可 + SchBasePoint endPointObj = fjMapper.findPointForFJQK(startRegionStr, new JSONObject() + .fluentPut("vehicleType", vehicleType).fluentPut("pointType", GeneralDefinition.DEVICE_POINT)); + // 这个点的父点位为起点 + return ObjectUtil.isNotEmpty(endPointObj) ? endPointObj : null; } /** diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java index e1dc483..473f339 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.java @@ -17,7 +17,11 @@ public interface FJMapper { SchBasePoint findPointForFJQK(List regionCode, @Param("fluentPut") JSONObject fluentPut); - int getInventoryQuantity(); + /** + * 获取库存剩余数量 + * @return + */ + int getInventoryQuantity(String material_id); /** * 获取满托需要多少块 diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml index ea6c563..3855cce 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/mapper/FJMapper.xml @@ -46,20 +46,20 @@ #{code} - + + + + + + + + + + + + + + + diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml index fd3d8cf..883713a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml @@ -1,5 +1,5 @@ server: - port: 8010 + port: 8011 #配置数据源 spring: autoconfigure: @@ -152,4 +152,4 @@ sa-token: lucene: index: - path: D:\lucene\index + path: C:\lucene\index diff --git a/lms/nladmin-ui/.env.development b/lms/nladmin-ui/.env.development index 809e77f..e37a9a4 100644 --- a/lms/nladmin-ui/.env.development +++ b/lms/nladmin-ui/.env.development @@ -1,8 +1,8 @@ ENV = 'development' # 接口地址 -VUE_APP_BASE_API = 'http://localhost:8010' -VUE_APP_WS_API = 'ws://localhost:8010' +VUE_APP_BASE_API = 'http://localhost:8011' +VUE_APP_WS_API = 'ws://localhost:8011' # 是否启用 babel-plugin-dynamic-import-node插件 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue index 33871ef..20bec61 100644 --- a/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue +++ b/lms/nladmin-ui/src/views/wms/pdm/workerorder/index.vue @@ -304,6 +304,7 @@ {{ dict.label.vehicle_type[scope.row.vehicle_type] }} +