diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java index 1af737bf0..7fbd7dd9b 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java @@ -151,4 +151,12 @@ public interface WmsServiceFeign { @ApiOperation("OMS批量签名-同步WMS入/出库单签名字段") @PostMapping("/stockSignatureApi/batchSign") public AjaxResult batchSignWms(@RequestBody SignatureBatchFeignDTO dto); + + /** + * OMS查询WMS线路管理列表(按线路编码模糊查,OMS侧自行精确匹配), + * 出库导入时校验送貨線號/車次并回填线路名称 + */ + @ApiOperation("OMS查询WMS线路管理列表") + @GetMapping("/lineManagementApi/listByApp") + public AjaxResult listLineManagement(@RequestParam("routeCode") String routeCode); } \ No newline at end of file diff --git a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWmsFallbackFactory.java b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWmsFallbackFactory.java index 1cab68d00..1bf77e956 100644 --- a/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWmsFallbackFactory.java +++ b/mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/factory/RemoteWmsFallbackFactory.java @@ -125,6 +125,12 @@ public class RemoteWmsFallbackFactory implements FallbackFactory> lineList = (List>) lineResult.get(AjaxResult.DATA_TAG); + for (Map line : lineList) { + //listByApp按routeCode模糊查,此处做精确匹配 + if (lineCode.equals(String.valueOf(line.get("routeCode")))) { + lineFound = true; + Object routeName = line.get("routeName"); + lineName = routeName == null ? null : String.valueOf(routeName); + Object shuttleObj = line.get("shuttleJson"); + shuttleJson = shuttleObj == null ? null : String.valueOf(shuttleObj); + break; + } + } + if (!lineFound) { + throw new Exception("线路【" + lineCode + "】在WMS线路管理中不存在,请先在基础数据-线路管理中维护"); + } + boolean shuttleMatched = false; + if (StringUtils.isNotBlank(shuttleJson)) { + try { + JSONArray shuttleArray = JSONUtil.parseArray(shuttleJson); + for (Object shuttle : shuttleArray) { + if (String.valueOf(trainNumber).equals(String.valueOf(shuttle))) { + shuttleMatched = true; + break; + } + } + } catch (Exception e) { + shuttleMatched = false; + } + } + if (!shuttleMatched) { + throw new Exception("线路【" + lineCode + "】维护的车次清单(" + shuttleJson + ")中不存在车次【" + trainNumber + "】,请先在WMS线路管理中维护该车次"); + } + return StringUtils.isNotBlank(lineName) ? lineName : lineCode; + } + @Override public DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName) throws Exception { LoginUser loginUser = SecurityUtils.getLoginUser(); @@ -223,6 +285,11 @@ public class ExecutionStockInOrderImpl extends ServiceImpl reservationOutMaterialDetailDOList = new ArrayList<>(); for (ProductDetail productDetail : productDetailList) { diff --git a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java index 8e4f2013e..ba2e86657 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java +++ b/mhd_oms/src/main/java/com/mhd/oms/domain/reservationStockInOrder/repository/persistence/ReservationStockInOrderImpl.java @@ -1,6 +1,7 @@ package com.mhd.oms.domain.reservationStockInOrder.repository.persistence; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONArray; import cn.hutool.json.JSONUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.fastjson.JSON; @@ -42,6 +43,7 @@ import com.mhd.oms.domain.reservationStockOutOrder.service.ReservationStockOutOr import com.mhd.oms.domain.reserveStockInOrder.repository.mapper.ReserveStockInOrderMapper; import com.mhd.system.api.SystemServiceFeign; import com.mhd.system.api.UserServiceFeign; +import com.mhd.system.api.WmsServiceFeign; import com.mhd.system.api.domain.SysDictData; import com.mhd.system.api.domain.WarehouseFeignPO; import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO; @@ -73,6 +75,8 @@ public class ReservationStockInOrderImpl extends ServiceImpl> lineList = (List>) lineResult.get(AjaxResult.DATA_TAG); + for (Map line : lineList) { + //listByApp按routeCode模糊查,此处做精确匹配 + if (lineCode.equals(String.valueOf(line.get("routeCode")))) { + lineFound = true; + Object routeName = line.get("routeName"); + lineName = routeName == null ? null : String.valueOf(routeName); + Object shuttleObj = line.get("shuttleJson"); + shuttleJson = shuttleObj == null ? null : String.valueOf(shuttleObj); + break; + } + } + if (!lineFound) { + throw new Exception("线路【" + lineCode + "】在WMS线路管理中不存在,请先在基础数据-线路管理中维护"); + } + boolean shuttleMatched = false; + if (StringUtils.isNotBlank(shuttleJson)) { + try { + JSONArray shuttleArray = JSONUtil.parseArray(shuttleJson); + for (Object shuttle : shuttleArray) { + if (String.valueOf(trainNumber).equals(String.valueOf(shuttle))) { + shuttleMatched = true; + break; + } + } + } catch (Exception e) { + shuttleMatched = false; + } + } + if (!shuttleMatched) { + throw new Exception("线路【" + lineCode + "】维护的车次清单(" + shuttleJson + ")中不存在车次【" + trainNumber + "】,请先在WMS线路管理中维护该车次"); + } + return StringUtils.isNotBlank(lineName) ? lineName : lineCode; + } + @Override public DeliveryDataDTO parseExcelFile(MultipartFile file, String sheetName) throws Exception { LoginUser loginUser = SecurityUtils.getLoginUser(); @@ -258,6 +320,11 @@ public class ReservationStockInOrderImpl extends ServiceImpl reservationOutMaterialDetailDOList = new ArrayList<>(); for (ProductDetail productDetail : productDetailList) {