From d56daaab96407c27f1e1cc6e867be6da47d023d0 Mon Sep 17 00:00:00 2001
From: yiwenpeng <ywp303@163.com>
Date: Thu, 30 Nov 2023 20:23:59 +0800
Subject: [PATCH] feat:固定分配035仓库,改为动态分配仓库编码

---
 src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java                          |  8 ++++----
 src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java                                   |  2 +-
 src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java |  4 ++--
 src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java  |  9 +++++++--
 src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java                                       |  2 +-
 src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java   |  2 +-
 src/main/resources/application-druid.properties                                                 |  2 +-
 src/main/resources/application.yml                                                              |  2 +-
 src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html                        | 85 +++++++++++++++++++++++++++++++++++++++++++------------------------------------------
 9 files changed, 61 insertions(+), 55 deletions(-)

diff --git a/src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java b/src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java
index 5f40434..0753bf0 100644
--- a/src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java
+++ b/src/main/java/com/huaheng/api/mes/controller/MesReceiptController.java
@@ -667,7 +667,7 @@ public class MesReceiptController extends BaseController {
         Rd_In_S.put("cInvCode", receiptDetail.getMaterialCode());
         Rd_In_S.put("Iquantity", receiptDetail.getTaskQty());
         Rd_In_S.put("iFQuantity", receiptDetail.getQty());
-        Rd_In_S.put("cwhcode", "035");
+        //Rd_In_S.put("cwhcode", "");
         Rd_In_S.put("MOCode", receiptDetail.getNoticeNo());
         Rd_In_S.put("ISUrgent", receiptDetail.getIsUrgent());
         Rd_In_S.put("receiptBarcode", receiptDetail.getReceiptBarcode());
@@ -878,7 +878,7 @@ public class MesReceiptController extends BaseController {
             Rd_Out_S.put("Iquantity", shipmentDetail.getTaskQty());
             // MOM传入的入库数量
             Rd_Out_S.put("iFQuantity", shipmentDetail.getQty());
-            Rd_Out_S.put("cwhcode", "035");
+            //Rd_Out_S.put("cwhcode", "035");
             List<TaskDetail> taskDetails = taskDetailService.list(new LambdaQueryWrapper<TaskDetail>()
                     .eq(TaskDetail::getInternalTaskType, 200)
                     .eq(TaskDetail::getBillDetailId, shipmentDetail.getId()));
@@ -952,9 +952,9 @@ public class MesReceiptController extends BaseController {
         } else {
             Rd_Out_M.put("UserNo", user.getLoginName());
         }
-        Rd_Out_M.put("warehouse", "035");
+        Rd_Out_M.put("warehouse", shipmentHeader.getWarehouse());//仓库编码
         Rd_Out_M.put("cDepCode", "01030101");//部门编码
-        Rd_Out_M.put("cWhCode", shipmentHeader.getWarehouse());//仓库编码
+        //Rd_Out_M.put("cWhCode", shipmentHeader.getWarehouse());//仓库编码
         return Rd_Out_M;
     }
 
diff --git a/src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java b/src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java
index 31397ce..146f73e 100644
--- a/src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java
+++ b/src/main/java/com/huaheng/api/mes/service/MesServiceImpl.java
@@ -199,7 +199,7 @@ public class MesServiceImpl implements IMesService {
                 .eq(ShipmentHeader::getCode, header.getReferCode())
                 .eq(ShipmentHeader::getShipmentType, header.getRefeCodeType()));
         if (!list.isEmpty()) {
-            return AjaxResult.error("添加出库单: 上游单号referCode重复[ " + header.getReferCode() + " ],请勿重复添加。");
+            return AjaxResult.error("添加出库单: 上游单号重复[ " + header.getReferCode() + " ],请勿重复添加。");
         }
         AjaxResult ajaxResult = new AjaxResult();
         //校验参数
diff --git a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
index 2a733e1..37126c5 100644
--- a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
+++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
@@ -149,7 +149,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
         if (height == null) {
             return AjaxResult.error("分配库位时,高度为空");
         }
-        if (roadWays == null) {
+        if (roadWays == null || roadWays.isEmpty()) {
             return AjaxResult.error("分配库位时,没有获取到可用巷道");
         }
         Zone zone = zoneService.getOne(new LambdaQueryWrapper<Zone>().eq(Zone::getArea, area));
@@ -256,7 +256,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
         if (StringUtils.isEmpty(locationCode)) {
             return AjaxResult.error("没有库位可分配");
         } else if (locationCode.length() > 15) {
-            return AjaxResult.error(locationCode, "巷道:" + roadWays);
+            return AjaxResult.error(locationCode);
         }
 
         int updateCount = locationService.updateStatusNew(locationCode, warehouseCode, QuantityConstant.STATUS_LOCATION_LOCK, QuantityConstant.STATUS_LOCATION_EMPTY);
diff --git a/src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java
index aaa1927..9c8a299 100644
--- a/src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/inventory/inventoryHeader/service/InventoryHeaderServiceImpl.java
@@ -23,6 +23,7 @@ import com.huaheng.pc.config.location.domain.Location;
 import com.huaheng.pc.config.location.service.LocationService;
 import com.huaheng.pc.config.material.domain.Material;
 import com.huaheng.pc.config.material.service.MaterialService;
+import com.huaheng.pc.config.warehouse.domain.Warehouse;
 import com.huaheng.pc.inventory.inventoryDetail.domain.InventoryDetail;
 import com.huaheng.pc.inventory.inventoryDetail.service.InventoryDetailService;
 import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader;
@@ -590,6 +591,8 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe
     @Transactional
     public AjaxResult createShipmentHeaderAndDetail(List<InventoryDetail> inventoryDetailList) {
         ArrayList<Detail> detailList = new ArrayList<>();
+        String warehouse = "";
+        String warehouseName = "";
 
         for (InventoryDetail inventoryDetail : inventoryDetailList) {
             Detail detail = new Detail();
@@ -598,12 +601,14 @@ public class InventoryHeaderServiceImpl extends ServiceImpl<InventoryHeaderMappe
             detail.setMaterialCode(inventoryDetail.getMaterialCode());
             detail.setQty(inventoryDetail.getQty());
             //detail.setNoticeNo(inventoryDetail.getNoticeCode());
+            warehouse = inventoryDetail.getWarehouse();
+            warehouseName = inventoryDetail.getWarehouseName();
             detailList.add(detail);
         }
         Header header = new Header();
         header.setRefeCodeType("HBCK");
-        header.setWarehouse("035");
-        header.setWarehouseName("机加立库");
+        header.setWarehouse(warehouse);
+        header.setWarehouseName(warehouseName);
         String receiptCode = shipmentHeaderService.createCode(header.getRefeCodeType());
         header.setReferCode(receiptCode);
         BigDecimal totalQty = new BigDecimal(0);
diff --git a/src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java b/src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
index 6cf8bd1..5a30a03 100644
--- a/src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
+++ b/src/main/java/com/huaheng/pc/monitor/job/task/RyTask.java
@@ -212,7 +212,7 @@ public class RyTask extends BaseController {
                 //299:其他出库
                 if (("MOM".equals(shipmentHeader.getCreatedBy()) || "merge".equals(shipmentHeader.getShipmentType()) || "299".equals(shipmentHeader.getShipmentType()))) {
                     try {
-                        shipmentHeader.setWarehouse("035");
+                        //shipmentHeader.setWarehouse("035");
                         mesReceiptController.postE_Rd_Out(shipmentHeader);
                     } catch (Exception e) {
                         e.printStackTrace();
diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
index d52f0b0..bd13254 100644
--- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
+++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
@@ -567,7 +567,7 @@ public class ShipmentHeaderController extends BaseController {
         }
         if (("MOM".equals(shipmentHeader.getCreatedBy()) || "merge".equals(shipmentHeader.getShipmentType()) || "299".equals(shipmentHeader.getShipmentType()))) {
             try {
-                shipmentHeader.setWarehouse("035");
+                //shipmentHeader.setWarehouse("035");
                 if (mesReceiptController.postE_Rd_Out(shipmentHeader)) {
                     return AjaxResult.success("回传成功");
                 }
diff --git a/src/main/resources/application-druid.properties b/src/main/resources/application-druid.properties
index c465ee7..5ba58c9 100644
--- a/src/main/resources/application-druid.properties
+++ b/src/main/resources/application-druid.properties
@@ -9,7 +9,7 @@ spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
 #spring.datasource.druid.master.username=root
 #spring.datasource.druid.master.password=qq123456
 #local
-spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms_shandonghaiwang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8
+spring.datasource.druid.master.url=jdbc:mysql://localhost:3306/wms_shandonghaiwang2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2b8
 spring.datasource.druid.master.username=root
 spring.datasource.druid.master.password=123456
 # test
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 487b542..eb8fb70 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -109,7 +109,7 @@ spring:
   # redis 配置
   redis:
     # 地址
-    host: localhost
+    host: 192.168.100.134
     # 端口,默认为6379
     port: 6379
     # 密码
diff --git a/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html b/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
index 861fa0e..c474829 100644
--- a/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
+++ b/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
@@ -560,24 +560,44 @@
                     field: 'workshop',
                     title: '生产车间',
                 },
+
                 {
-                    field: 'shipmentNote',
-                    title: '备注',
+                    field: 'noticeNo',
+                    title: '通知单号',
                 },
                 {
-                    field: 'transferWarehouseName',
-                    title: '调入仓库名称',
+                    field: 'superiorName',
+                    title: '母件名称',
                 },
                 {
-                    field: 'noticeNo',
-                    title: '通知单号',
+                    field: 'superiorCode',
+                    title: '母件编码',
+                    formatter: function (value, row, index) {
+                        var actions = [];
+                        if (value == undefined || value == '')
+                            value = " "
+                        else
+                            actions.push('<pre style="max-height:50px; white-space: pre-wrap; width:500px">' + value + '</pre>')
+                        return actions.join(" ")
+                    }
                 },
-
                 {
-                    field: 'projectCode',
-                    title: '项目号',
-                    visible: false
+                    field: 'recordCode',
+                    title: '合并前单号',
+                    formatter: function (value, row, index) {
+                        var actions = [];
+                        if (value == undefined || value == '')
+                            value = " "
+                        else
+                            actions.push('<pre style="max-height:50px; white-space: pre-wrap; width:500px">' + value + '</pre>')
+                        return actions.join(" ")
+                    }
                 },
+                // {
+                //     field: 'projectCode',
+                //     title: '项目号',
+                //     visible: false
+                // },
                 {
                     field: 'customerCode',
                     title: '客户',
@@ -600,10 +620,6 @@
                     visible: false
                 },
                 {
-                    field: 'processType',
-                    title: '调整单号',
-                },
-                {
                     field: 'created',
                     title: '创建时间',
                 },
@@ -625,34 +641,7 @@
                     title: '操作人',
                     visible: true
                 },
-                {
-                    field: 'superiorName',
-                    title: '母件名称',
-                },
-                {
-                    field: 'superiorCode',
-                    title: '母件编码',
-                    formatter: function (value, row, index) {
-                        var actions = [];
-                        if (value == undefined || value == '')
-                            value = " "
-                        else
-                            actions.push('<pre style="max-height:50px; white-space: pre-wrap; width:500px">' + value + '</pre>')
-                        return actions.join(" ")
-                    }
-                },
-                {
-                    field: 'recordCode',
-                    title: '合并前单号',
-                    formatter: function (value, row, index) {
-                        var actions = [];
-                        if (value == undefined || value == '')
-                            value = " "
-                        else
-                            actions.push('<pre style="max-height:50px; white-space: pre-wrap; width:500px">' + value + '</pre>')
-                        return actions.join(" ")
-                    }
-                },
+
                 {
                     field: 'materialColor',
                     title: '颜色信息',
@@ -678,6 +667,18 @@
                     }
                 },
                 {
+                    field: 'processType',
+                    title: '调整单号',
+                },
+                {
+                    field: 'shipmentNote',
+                    title: '备注',
+                },
+                {
+                    field: 'transferWarehouseName',
+                    title: '调入仓库名称',
+                },
+                {
                     field: 'pushSuccessStatus',
                     title: '回传状态',
                     visible: true,
--
libgit2 0.22.2