From f530e9bfe5d02597aba3d7733f9c82e5a954fc83 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Tue, 10 Oct 2023 15:06:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=89=8B=E6=8C=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/ext/acs/service/WmsToAcsService.java | 2 +- .../acs/service/dto/to/acs/DeviceInfoDto.java | 6 ++++ .../acs/service/dto/to/wms/AcsResponse.java | 1 + .../acs/service/impl/AcsToWmsServiceImpl.java | 4 +-- .../acs/service/impl/WmsToAcsServiceImpl.java | 8 ++--- .../mes/service/impl/WmsToMesServiceImpl.java | 5 ++- .../wms/pda/service/impl/PdaServiceImpl.java | 35 ++++++++++++------- .../task_manage/task/tasks/fj/FJMKTask.java | 2 +- .../task_manage/task/tasks/fj/FJQLTask.java | 4 +-- .../task/tasks/fj/mapper/FJMapper.xml | 2 +- .../task_manage/task/tasks/hn/HNMLTask.java | 1 - .../src/main/resources/config/application.yml | 2 +- 12 files changed, 45 insertions(+), 27 deletions(-) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java index 8741db8..ab3ab82 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/WmsToAcsService.java @@ -42,5 +42,5 @@ public interface WmsToAcsService { * @param list * @return */ - ResultForAcs getDeviceStatusByCode(List list); + AcsResponse getDeviceStatusByCode(List list); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/DeviceInfoDto.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/DeviceInfoDto.java index 02af60d..e560b7f 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/DeviceInfoDto.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/acs/DeviceInfoDto.java @@ -10,4 +10,10 @@ import lombok.Data; @Data public class DeviceInfoDto { private String device_code; + + public static DeviceInfoDto buildDevice(String device_code) { + DeviceInfoDto infoDto = new DeviceInfoDto(); + infoDto.setDevice_code(device_code); + return infoDto; + } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/AcsResponse.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/AcsResponse.java index 25fa3c0..68cb703 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/AcsResponse.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/dto/to/wms/AcsResponse.java @@ -14,6 +14,7 @@ import org.nl.wms.ext.acs.service.dto.to.BaseResponse; @Data public class AcsResponse extends BaseResponse { private JSONArray errArr = new JSONArray(); + private JSONArray data = new JSONArray(); public static AcsResponse requestRefuse(String message) { AcsResponse result = new AcsResponse(); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 7776d83..5a1effe 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -423,7 +423,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } /** - * 申请贴标 + * 申请贴标 - 打印唛头 */ @Override public ApplyTaskResponse applyLabelling(JSONObject param) { @@ -595,7 +595,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { mesMudConsumptionDto.setOUT_FINNUM(one.getMaterial_weight()); mesMudConsumptionDto.setPRESSUNIT(devicePoint.getExt_point_code()); mesMudConsumptionDto.setFBAGCODE(one.getExt_data()); - mesMudConsumptionDto.setLOGT("仓库未知"); + mesMudConsumptionDto.setLOGT("配料仓"); mesMudConsumptionDto.setSENDTIM(DateUtil.now()); mesMudConsumptionDto.setCREATE_TM(DateUtil.now()); mesMudConsumptionDto.setOP_FLAG(GeneralDefinition.NO); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java index 1b107ba..d2f529b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/WmsToAcsServiceImpl.java @@ -57,11 +57,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { } @Override - public ResultForAcs getDeviceStatusByCode(List list) { - String api = ""; // todo: 地址未确认 - ResultForAcs resultForAcs = AcsUtil.notifyAcs(api, list); + public AcsResponse getDeviceStatusByCode(List list) { + String api = "/api/wms/querydevice"; // todo: 地址未确认 + AcsResponse resultForAcs = AcsUtil.notifyAcs2(api, list); // 记录日志 - interactRecordService.saveRecord("获取设备状态", list, resultForAcs, GeneralDefinition.LMS_ACS); + interactRecordService.saveRecord("获取设备信息", list, resultForAcs, GeneralDefinition.LMS_ACS); return resultForAcs; } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java index d1a775f..0de4948 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/mes/service/impl/WmsToMesServiceImpl.java @@ -206,7 +206,10 @@ public class WmsToMesServiceImpl implements WmsToMesService { // 获取工单 PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode); String extData = workorder.getExt_data(); - MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class); + MesWorkOrderDto mesWorkOrderDto = new MesWorkOrderDto(); + if (ObjectUtil.isNotEmpty(extData)) { + mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class); + } log.info("获取MES给的工单数据:{}", mesWorkOrderDto); MesSemiProductionInfoOutDto semiProductionInfoOutDto = new MesSemiProductionInfoOutDto(); semiProductionInfoOutDto.setMSGID(IdUtil.getSnowflake(1, 1).nextIdStr()); 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 4c2de2a..e631ef0 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 @@ -3,12 +3,16 @@ package org.nl.wms.pda.service.impl; 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 lombok.extern.slf4j.Slf4j; import org.nl.common.exception.BadRequestException; import org.nl.common.utils.SecurityUtils; import org.nl.wms.database.material.service.IMdBaseMaterialService; import org.nl.wms.database.material.service.dao.MdBaseMaterial; +import org.nl.wms.ext.acs.service.WmsToAcsService; +import org.nl.wms.ext.acs.service.dto.to.acs.DeviceInfoDto; +import org.nl.wms.ext.acs.service.dto.to.wms.AcsResponse; import org.nl.wms.pda.service.PdaService; import org.nl.wms.pda.service.dao.dto.*; import org.nl.wms.pda.service.dao.mapper.PdaMapper; @@ -30,6 +34,7 @@ import org.nl.wms.util.TaskUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -54,6 +59,8 @@ public class PdaServiceImpl implements PdaService { private ISchBaseTaskService taskService; @Autowired private IPdmBdVehicleBindingService vehicleBindingService; + @Autowired + private WmsToAcsService wmsToAcsService; @Override public List getDeviceInfo() { // 暂定压机区域 @@ -120,20 +127,18 @@ public class PdaServiceImpl implements PdaService { if (ObjectUtil.isEmpty(blendingMoveDto.getStart_point_code())) { throw new BadRequestException("混碾位不能为空"); } -// if (ObjectUtil.isEmpty(blendingMoveDto.getEnd_point_code())) { -// throw new BadRequestException("目标压机位不能为空"); -// } - // 获取压机对应的困料线、空位、无任务 -// SchBasePoint point = pdaMapper.findKLXPoint(blendingMoveDto.getEnd_point_code()); -// if (ObjectUtil.isEmpty(point)) { -// throw new BadRequestException("创建失败,已有搬运到【" + blendingMoveDto.getEnd_point_code() + "】的任务, 请稍后在试!"); -// } - // todo: 1、向acs获取吨袋号、重量 + // 向acs获取吨袋号、重量 + SchBasePoint basePoint = pointService.getById(blendingMoveDto.getStart_point_code()); + List list = new ArrayList<>(); + list.add(DeviceInfoDto.buildDevice(basePoint.getParent_point_code())); + AcsResponse statusByCode = wmsToAcsService.getDeviceStatusByCode(list); + JSONArray data = statusByCode.getData(); + JSONObject object = data.getJSONObject(0); // 准备参数:设备编码、载具号、载具类型、重量、吨袋号(material_code) JSONObject param = new JSONObject(); param.put("device_code", blendingMoveDto.getStart_point_code()); - param.put("material_code", "吨袋号"); - param.put("weight", "0"); + param.put("material_code", object.getString("material_code")); + param.put("weight", object.getString("weight")); param.put("vehicle_code", blendingMoveDto.getVehicle_code()); param.put("vehicle_type", GeneralDefinition.MATERIAL_CUP); param.put("requestNo", IdUtil.simpleUUID()); @@ -216,6 +221,10 @@ public class PdaServiceImpl implements PdaService { JSONObject param = new JSONObject(); param.put("device_code", "RGCDW01"); param.put("config_code", "FJSKTask"); + // 获取载具类型和载具编码 + SchBasePoint rgcdw01 = pointService.getById("RGCDW01"); + param.put("vehicle_code", rgcdw01.getVehicle_code()); + param.put("vehicle_type", GeneralDefinition.STEEL_TRAY); taskService.apply(param); return PdaResponseVo.pdaResultOk("空盘入库请求成功"); } @@ -282,7 +291,7 @@ public class PdaServiceImpl implements PdaService { // 准备参数:设备编码 JSONObject param = new JSONObject(); param.put("device_code", "RGMDW01"); - param.put("config_code", "FJMLTask"); + param.put("config_code", "RGFJRKTask"); param.put("qty", manualResidueInDto.getQty()); param.put("vehicle_code", manualResidueInDto.getVehicle_code()); param.put("vehicle_qty", "1"); @@ -292,7 +301,7 @@ public class PdaServiceImpl implements PdaService { @Override public List packingTaskShow() { - return pdaMapper.getRunningTaskByStart("RGMDW01", "FJMLTask"); + return pdaMapper.getRunningTaskByStart("RGMDW01", "RGFJRKTask"); } @Override 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 c0ca643..13bcf79 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 @@ -287,7 +287,7 @@ public class FJMKTask extends AbstractTask { groupEntity.setGroup_bind_material_status(GroupBindMaterialStatusEnum.BOUND.getValue()); // 绑定 groupEntity.setGroup_status(GroupStatusEnum.IN_STORAGE.getType()); // 暂时不维护。 groupEntity.setIs_delete(false); - groupEntity.setIs_full(isFull.equals(GeneralDefinition.YES) ? true : false); + groupEntity.setIs_full(isFull.equals(GeneralDefinition.YES)); vehiclematerialgroupService.saveOrUpdate(groupEntity); // 返回组盘id记录任务中 return groupEntity.getGroup_id(); diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQLTask.java index 34d45b6..a146724 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/fj/FJQLTask.java @@ -232,8 +232,8 @@ public class FJQLTask extends AbstractTask { processTracking.setRecord_time(DateUtil.now()); processTrackingService.create(processTracking); // 终点设置对应的参数 - endPointObj.setVehicle_code(startPointObj.getVehicle_code()); - endPointObj.setVehicle_type(startPointObj.getVehicle_type()); + endPointObj.setVehicle_code(vehicleMaterialGroupObj.getVehicle_code()); + endPointObj.setVehicle_type(vehicleMaterialGroupObj.getVehicle_type()); endPointObj.setPoint_status(PointStatusEnum.EMPTY_VEHICLE.getCode()); PointUtils.setUpdateByType(endPointObj, taskFinishedType); pointService.updateById(endPointObj); 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 af041fa..ea6c563 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 @@ -14,7 +14,7 @@ AND p.point_status = '3' AND vg.is_firing = true AND vg.material_id = #{materialId} - AND TIMESTAMPDIFF(MINUTE, vg.instorage_time, NOW()) > ma.cooling_time + AND TIMESTAMPDIFF(MINUTE, vg.instorage_time, NOW()) >= ma.cooling_time AND p.region_code IN #{code} diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java index 92ccd3e..cec966d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/sch/task_manage/task/tasks/hn/HNMLTask.java @@ -193,7 +193,6 @@ public class HNMLTask extends AbstractTask { private SchBasePoint findNextPoint(List nextRegionStr, JSONObject requestParam) { // *: 混碾无工单 String materialCode = requestParam.getString("material_code"); // 混碾编码 - materialCode = "GBMAC3"; Assert.notNull(materialCode, "物料编码不能为空!"); // 根据工单物料标识寻找点位 List points = hnMapper.findPointForHNMLAndWorkOrder(nextRegionStr, materialCode); diff --git a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml index a37104c..7e2aa7b 100644 --- a/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml +++ b/lms/nladmin-system/nlsso-server/src/main/resources/config/application.yml @@ -42,7 +42,7 @@ spring: freemarker: check-template-location: false profiles: - active: prod + active: dev jackson: time-zone: GMT+8 data: