Commit 8834e010a39fdd63856289fbf1aefb4679ae72c0
1 parent
83c0bdf1
增加mes接口
Showing
12 changed files
with
182 additions
and
13 deletions
.gitignore
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/controller/MesController.java
@@ -11,6 +11,7 @@ import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | @@ -11,6 +11,7 @@ import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | ||
11 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; | 11 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; |
12 | import org.jeecg.modules.wms.api.erp.service.IErpService; | 12 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
13 | import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; | 13 | import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; |
14 | +import org.jeecg.modules.wms.api.mes.entity.MesShipmentMaterial; | ||
14 | import org.jeecg.modules.wms.api.mes.servuce.IMesService; | 15 | import org.jeecg.modules.wms.api.mes.servuce.IMesService; |
15 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | 16 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; |
16 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; | 17 | import org.jeecg.modules.wms.framework.controller.HuahengBaseController; |
@@ -89,9 +90,9 @@ public class MesController extends HuahengBaseController { | @@ -89,9 +90,9 @@ public class MesController extends HuahengBaseController { | ||
89 | @PostMapping("/shipmentMaterial") | 90 | @PostMapping("/shipmentMaterial") |
90 | @ResponseBody | 91 | @ResponseBody |
91 | @ApiLogger(apiName = "物料出库", from="MES") | 92 | @ApiLogger(apiName = "物料出库", from="MES") |
92 | - public Result shipmentMaterial(@RequestBody MesReceiptMaterial mesReceiptMaterial, HttpServletRequest req) { | 93 | + public Result shipmentMaterial(@RequestBody MesShipmentMaterial mesShipmentMaterial, HttpServletRequest req) { |
93 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | 94 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
94 | - Result result = mesService.shipmentMaterial(mesReceiptMaterial, warehouseCode); | 95 | + Result result = mesService.shipmentMaterial(mesShipmentMaterial, warehouseCode); |
95 | return result; | 96 | return result; |
96 | } | 97 | } |
97 | 98 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/entity/MaterialInfo.java
1 | package org.jeecg.modules.wms.api.mes.entity; | 1 | package org.jeecg.modules.wms.api.mes.entity; |
2 | 2 | ||
3 | import lombok.Data; | 3 | import lombok.Data; |
4 | +import org.jetbrains.annotations.NotNull; | ||
4 | 5 | ||
5 | import java.math.BigDecimal; | 6 | import java.math.BigDecimal; |
6 | 7 | ||
7 | @Data | 8 | @Data |
8 | -public class MaterialInfo { | 9 | +public class MaterialInfo implements Comparable<MaterialInfo>{ |
9 | 10 | ||
10 | private String materialCode; | 11 | private String materialCode; |
11 | private BigDecimal qty; | 12 | private BigDecimal qty; |
13 | + private int sequence; | ||
12 | 14 | ||
15 | + | ||
16 | + @Override | ||
17 | + public int compareTo(@NotNull MaterialInfo o) { | ||
18 | + return getSequence() - o.getSequence(); | ||
19 | + } | ||
13 | } | 20 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesShipmentDetail.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mes.entity; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | ||
5 | + | ||
6 | +import java.math.BigDecimal; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 游杰 | ||
10 | + */ | ||
11 | +@Data | ||
12 | +public class MesShipmentDetail { | ||
13 | + | ||
14 | + /** | ||
15 | + * 出库单详情 | ||
16 | + */ | ||
17 | + private ShipmentDetail shipmentDetail; | ||
18 | + | ||
19 | + /** | ||
20 | + * 出库数量 | ||
21 | + */ | ||
22 | + private BigDecimal shipQty; | ||
23 | +} |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesShipmentMaterial.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mes.entity; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author 游杰 | ||
9 | + */ | ||
10 | +@Data | ||
11 | +public class MesShipmentMaterial { | ||
12 | + | ||
13 | + private String referCode; | ||
14 | + private String toPort; | ||
15 | + private List<MaterialInfo> materialInfoList; | ||
16 | +} |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/servuce/IMesService.java
@@ -2,6 +2,7 @@ package org.jeecg.modules.wms.api.mes.servuce; | @@ -2,6 +2,7 @@ package org.jeecg.modules.wms.api.mes.servuce; | ||
2 | 2 | ||
3 | import org.jeecg.common.api.vo.Result; | 3 | import org.jeecg.common.api.vo.Result; |
4 | import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; | 4 | import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; |
5 | +import org.jeecg.modules.wms.api.mes.entity.MesShipmentMaterial; | ||
5 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | 6 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
6 | 7 | ||
7 | /** | 8 | /** |
@@ -11,7 +12,7 @@ public interface IMesService { | @@ -11,7 +12,7 @@ public interface IMesService { | ||
11 | 12 | ||
12 | public Result receiptMaterial(MesReceiptMaterial mesReceiptMaterial, String warehouseCode); | 13 | public Result receiptMaterial(MesReceiptMaterial mesReceiptMaterial, String warehouseCode); |
13 | 14 | ||
14 | - public Result shipmentMaterial(MesReceiptMaterial mesMaterial, String warehouseCode); | 15 | + public Result shipmentMaterial(MesShipmentMaterial mesShipmentMaterial, String warehouseCode); |
15 | 16 | ||
16 | public Result backMesReceipt(TaskHeader taskHeader); | 17 | public Result backMesReceipt(TaskHeader taskHeader); |
17 | 18 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java
1 | package org.jeecg.modules.wms.api.mes.servuce.impl; | 1 | package org.jeecg.modules.wms.api.mes.servuce.impl; |
2 | 2 | ||
3 | import com.aliyun.oss.ServiceException; | 3 | import com.aliyun.oss.ServiceException; |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
4 | import org.jeecg.common.api.vo.Result; | 5 | import org.jeecg.common.api.vo.Result; |
5 | import org.jeecg.modules.wms.api.mes.entity.MaterialInfo; | 6 | import org.jeecg.modules.wms.api.mes.entity.MaterialInfo; |
6 | import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; | 7 | import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; |
8 | +import org.jeecg.modules.wms.api.mes.entity.MesShipmentDetail; | ||
9 | +import org.jeecg.modules.wms.api.mes.entity.MesShipmentMaterial; | ||
7 | import org.jeecg.modules.wms.api.mes.servuce.IMesService; | 10 | import org.jeecg.modules.wms.api.mes.servuce.IMesService; |
8 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; | 11 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.entity.ReceiptContainerHeader; |
9 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; | 12 | import org.jeecg.modules.wms.receipt.receiptContainerHeader.service.IReceiptContainerHeaderService; |
@@ -13,13 +16,26 @@ import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService | @@ -13,13 +16,26 @@ import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService | ||
13 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; | 16 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; |
14 | import org.jeecg.modules.wms.receipt.receiving.domain.Receive; | 17 | import org.jeecg.modules.wms.receipt.receiving.domain.Receive; |
15 | import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; | 18 | import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; |
19 | +import org.jeecg.modules.wms.shipment.shipmentCombination.service.IShipmentCombinationService; | ||
20 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerDetail; | ||
21 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | ||
22 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerDetailService; | ||
23 | +import org.jeecg.modules.wms.shipment.shipmentContainerHeader.service.IShipmentContainerHeaderService; | ||
24 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | ||
25 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | ||
26 | +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; | ||
27 | +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; | ||
16 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; | 28 | import org.jeecg.modules.wms.task.taskHeader.entity.TaskHeader; |
29 | +import org.jeecg.utils.StringUtils; | ||
17 | import org.springframework.stereotype.Service; | 30 | import org.springframework.stereotype.Service; |
18 | 31 | ||
19 | import javax.annotation.Resource; | 32 | import javax.annotation.Resource; |
33 | +import java.lang.ref.WeakReference; | ||
20 | import java.math.BigDecimal; | 34 | import java.math.BigDecimal; |
21 | import java.util.ArrayList; | 35 | import java.util.ArrayList; |
36 | +import java.util.Collections; | ||
22 | import java.util.List; | 37 | import java.util.List; |
38 | +import java.util.stream.Collectors; | ||
23 | 39 | ||
24 | /** | 40 | /** |
25 | * @author 游杰 | 41 | * @author 游杰 |
@@ -35,6 +51,16 @@ public class MesServiceImpl implements IMesService { | @@ -35,6 +51,16 @@ public class MesServiceImpl implements IMesService { | ||
35 | private IReceiveService receiveService; | 51 | private IReceiveService receiveService; |
36 | @Resource | 52 | @Resource |
37 | private IReceiptContainerHeaderService receiptContainerHeaderService; | 53 | private IReceiptContainerHeaderService receiptContainerHeaderService; |
54 | + @Resource | ||
55 | + private IShipmentHeaderService shipmentHeaderService; | ||
56 | + @Resource | ||
57 | + private IShipmentDetailService shipmentDetailService; | ||
58 | + @Resource | ||
59 | + private IShipmentCombinationService shipmentCombinationService; | ||
60 | + @Resource | ||
61 | + private IShipmentContainerDetailService shipmentContainerDetailService; | ||
62 | + @Resource | ||
63 | + private IShipmentContainerHeaderService shipmentContainerHeaderService; | ||
38 | 64 | ||
39 | /** | 65 | /** |
40 | * 要求入库单详情 必须是不重样的 | 66 | * 要求入库单详情 必须是不重样的 |
@@ -48,7 +74,13 @@ public class MesServiceImpl implements IMesService { | @@ -48,7 +74,13 @@ public class MesServiceImpl implements IMesService { | ||
48 | String toPort = mesReceiptMaterial.getToPort(); | 74 | String toPort = mesReceiptMaterial.getToPort(); |
49 | List<MaterialInfo> materialInfoList = mesReceiptMaterial.getMaterialInfoList(); | 75 | List<MaterialInfo> materialInfoList = mesReceiptMaterial.getMaterialInfoList(); |
50 | ReceiptHeader receiptHeader = receiptHeaderService.getReceiptHeaderByReferCode(referCode, warehouseCode); | 76 | ReceiptHeader receiptHeader = receiptHeaderService.getReceiptHeaderByReferCode(referCode, warehouseCode); |
77 | + if(receiptHeader == null) { | ||
78 | + return Result.error("MES下发入库信息,没有找到匹配的入库单, 上游单号:" + referCode); | ||
79 | + } | ||
51 | List<ReceiptDetail> receiptDetailList = receiptDetailService.selectByMainId(String.valueOf(receiptHeader.getId())); | 80 | List<ReceiptDetail> receiptDetailList = receiptDetailService.selectByMainId(String.valueOf(receiptHeader.getId())); |
81 | + if(receiptDetailList == null || receiptDetailList.size() == 0) { | ||
82 | + return Result.error("MES下发入库信息,没有找到匹配的入库单详情, 上游单号:" + referCode); | ||
83 | + } | ||
52 | for (ReceiptDetail receiptDetail : receiptDetailList) { | 84 | for (ReceiptDetail receiptDetail : receiptDetailList) { |
53 | String materialCode = receiptDetail.getMaterialCode(); | 85 | String materialCode = receiptDetail.getMaterialCode(); |
54 | BigDecimal taskQty = BigDecimal.ZERO; | 86 | BigDecimal taskQty = BigDecimal.ZERO; |
@@ -86,18 +118,90 @@ public class MesServiceImpl implements IMesService { | @@ -86,18 +118,90 @@ public class MesServiceImpl implements IMesService { | ||
86 | receiptContainerHeader.setToPort(toPort); | 118 | receiptContainerHeader.setToPort(toPort); |
87 | boolean success = receiptContainerHeaderService.updateById(receiptContainerHeader); | 119 | boolean success = receiptContainerHeaderService.updateById(receiptContainerHeader); |
88 | if(!success) { | 120 | if(!success) { |
89 | - throw new ServiceException("更新入库组盘头失败"); | 121 | + throw new ServiceException("MES下发入库信息,更新入库组盘头失败"); |
90 | } | 122 | } |
91 | return receiptContainerHeaderService.createReceiptTask(receiptContainerHeader, warehouseCode); | 123 | return receiptContainerHeaderService.createReceiptTask(receiptContainerHeader, warehouseCode); |
92 | } | 124 | } |
93 | 125 | ||
94 | @Override | 126 | @Override |
95 | - public Result shipmentMaterial(MesReceiptMaterial mesMaterial, String warehouseCode) { | ||
96 | - return null; | 127 | + public Result shipmentMaterial(MesShipmentMaterial mesShipmentMaterial, String warehouseCode) { |
128 | + String referCode = mesShipmentMaterial.getReferCode(); | ||
129 | + String toPort = mesShipmentMaterial.getToPort(); | ||
130 | + List<MaterialInfo> materialInfoList = mesShipmentMaterial.getMaterialInfoList(); | ||
131 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getShipmentHeaderByReferCode(referCode, warehouseCode); | ||
132 | + if(shipmentHeader == null) { | ||
133 | + return Result.error("MES下发出库信息,没有找到匹配的出库单, 上游单号:" + referCode); | ||
134 | + } | ||
135 | + String shipmentCode = shipmentHeader.getCode(); | ||
136 | + if(StringUtils.isEmpty(shipmentCode)) { | ||
137 | + return Result.error("MES下发出库信息,出库单号为空"); | ||
138 | + } | ||
139 | + List<ShipmentDetail> shipmentDetailList = shipmentDetailService.selectByMainId(String.valueOf(shipmentHeader.getId())); | ||
140 | + if(shipmentDetailList == null || shipmentDetailList.size() == 0) { | ||
141 | + return Result.error("MES下发出库信息,没有找到匹配的出库单详情, 上游单号:" + referCode); | ||
142 | + } | ||
143 | + List<MesShipmentDetail> mesShipmentDetailList = new ArrayList<>(); | ||
144 | + Collections.sort(materialInfoList); | ||
145 | + for (ShipmentDetail shipmentDetail : shipmentDetailList) { | ||
146 | + String materialCode = shipmentDetail.getMaterialCode(); | ||
147 | + BigDecimal shipQty = BigDecimal.ZERO; | ||
148 | + boolean hav = false; | ||
149 | + for (MaterialInfo materialInfo : materialInfoList) { | ||
150 | + if(materialInfo.getMaterialCode().equals(materialCode)) { | ||
151 | + hav = true; | ||
152 | + shipQty = materialInfo.getQty(); | ||
153 | + break; | ||
154 | + } | ||
155 | + } | ||
156 | + if(hav) { | ||
157 | + MesShipmentDetail mesShipmentDetail = new MesShipmentDetail(); | ||
158 | + mesShipmentDetail.setShipmentDetail(shipmentDetail); | ||
159 | + mesShipmentDetail.setShipQty(shipQty); | ||
160 | + mesShipmentDetailList.add(mesShipmentDetail); | ||
161 | + } | ||
162 | + } | ||
163 | + for(MesShipmentDetail mesShipmentDetail : mesShipmentDetailList) { | ||
164 | + ShipmentDetail shipmentDetail = mesShipmentDetail.getShipmentDetail(); | ||
165 | + BigDecimal shipQty = mesShipmentDetail.getShipQty(); | ||
166 | + Result result = shipmentCombinationService.autoCombination(shipmentDetail, shipQty); | ||
167 | + if(!result.isSuccess()) { | ||
168 | + throw new ServiceException("MES下发出库信息," + result.getMessage()); | ||
169 | + } | ||
170 | + } | ||
171 | + List<ShipmentContainerDetail> shipmentContainerDetailList = | ||
172 | + shipmentContainerDetailService.getShipmentContainerDetailListByShipmentCode(shipmentCode); | ||
173 | + if(shipmentContainerDetailList == null) { | ||
174 | + throw new ServiceException("MES下发出库信息, 没有找到出库配盘详情"); | ||
175 | + } | ||
176 | + List<Integer> shipmentContainerIdList = shipmentContainerDetailList.stream().map(ShipmentContainerDetail::getShipmentContainerId) | ||
177 | + .distinct().collect(Collectors.toList()); | ||
178 | + long shipmentOrder = System.currentTimeMillis(); | ||
179 | + int sequenceNumber = shipmentContainerIdList.size(); | ||
180 | + int sequence = 0; | ||
181 | + for(int shipmentContainerId : shipmentContainerIdList) { | ||
182 | + sequence++; | ||
183 | + ShipmentContainerHeader shipmentContainerHeader = shipmentContainerHeaderService.getById(shipmentContainerId); | ||
184 | + if(shipmentContainerHeader == null) { | ||
185 | + throw new ServiceException("MES下发出库信息,没有找到出库表头:" + shipmentContainerId); | ||
186 | + } | ||
187 | + shipmentContainerHeader.setToPort(toPort); | ||
188 | + boolean success = shipmentContainerHeaderService.updateById(shipmentContainerHeader); | ||
189 | + if(!success) { | ||
190 | + throw new ServiceException("MES下发出库信息,更新出库组盘头失败"); | ||
191 | + } | ||
192 | + Result result = shipmentCombinationService.createShipmentTask(shipmentContainerHeader, warehouseCode, | ||
193 | + shipmentOrder, sequence, sequenceNumber); | ||
194 | + if(!result.isSuccess()) { | ||
195 | + throw new ServiceException(result.getMessage()); | ||
196 | + } | ||
197 | + | ||
198 | + } | ||
199 | + return Result.OK("MES下发出库信息成功"); | ||
97 | } | 200 | } |
98 | 201 | ||
99 | @Override | 202 | @Override |
100 | public Result backMesReceipt(TaskHeader taskHeader) { | 203 | public Result backMesReceipt(TaskHeader taskHeader) { |
204 | + | ||
101 | return null; | 205 | return null; |
102 | } | 206 | } |
103 | 207 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/controller/ShipmentCombinationController.java
@@ -123,7 +123,7 @@ public class ShipmentCombinationController { | @@ -123,7 +123,7 @@ public class ShipmentCombinationController { | ||
123 | @ResponseBody | 123 | @ResponseBody |
124 | public Result createShipmentTask(@RequestBody ShipmentContainerHeader shipmentContainerHeader, HttpServletRequest req) { | 124 | public Result createShipmentTask(@RequestBody ShipmentContainerHeader shipmentContainerHeader, HttpServletRequest req) { |
125 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); | 125 | String warehouseCode = HuahengJwtUtil.getWarehouseCodeByToken(req); |
126 | - return shipmentCombinationService.createShipmentTask(shipmentContainerHeader, warehouseCode); | 126 | + return shipmentCombinationService.createShipmentTask(shipmentContainerHeader, warehouseCode, 0 ,0 ,0); |
127 | } | 127 | } |
128 | 128 | ||
129 | 129 |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/IShipmentCombinationService.java
@@ -8,6 +8,7 @@ import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationMode | @@ -8,6 +8,7 @@ import org.jeecg.modules.wms.shipment.shipmentCombination.entity.CombinationMode | ||
8 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; | 8 | import org.jeecg.modules.wms.shipment.shipmentContainerHeader.entity.ShipmentContainerHeader; |
9 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | 9 | import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; |
10 | 10 | ||
11 | +import java.math.BigDecimal; | ||
11 | import java.util.List; | 12 | import java.util.List; |
12 | 13 | ||
13 | /** | 14 | /** |
@@ -19,11 +20,12 @@ public interface IShipmentCombinationService { | @@ -19,11 +20,12 @@ public interface IShipmentCombinationService { | ||
19 | 20 | ||
20 | public Result autoCombination(String shipmentCode, String warehouseCode); | 21 | public Result autoCombination(String shipmentCode, String warehouseCode); |
21 | 22 | ||
22 | - public Result autoCombination(ShipmentDetail shipmentDetail); | 23 | + public Result autoCombination(ShipmentDetail shipmentDetail, BigDecimal shipQty); |
23 | 24 | ||
24 | public Result combination(CombinationModel combinationModel); | 25 | public Result combination(CombinationModel combinationModel); |
25 | 26 | ||
26 | - public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode); | 27 | + public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, |
28 | + long shipmentOrder, int sequence, int sequenceNumber); | ||
27 | 29 | ||
28 | public Result getInventoryFromShipmentDetail(Integer shipmentDetailId); | 30 | public Result getInventoryFromShipmentDetail(Integer shipmentDetailId); |
29 | } | 31 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentCombination/service/impl/ShipmentCombinationServiceImpl.java
@@ -133,7 +133,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | @@ -133,7 +133,7 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
133 | if(shipmentDetail.getTaskQty().compareTo(shipmentDetail.getQty()) < 0) { | 133 | if(shipmentDetail.getTaskQty().compareTo(shipmentDetail.getQty()) < 0) { |
134 | over = false; | 134 | over = false; |
135 | } | 135 | } |
136 | - Result result = autoCombination(shipmentDetail); | 136 | + Result result = autoCombination(shipmentDetail, null); |
137 | if(!result.isSuccess()) { | 137 | if(!result.isSuccess()) { |
138 | throw new ServiceException(result.getMessage()); | 138 | throw new ServiceException(result.getMessage()); |
139 | } | 139 | } |
@@ -146,13 +146,16 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | @@ -146,13 +146,16 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
146 | 146 | ||
147 | @Override | 147 | @Override |
148 | @Transactional(rollbackFor = ServiceException.class) | 148 | @Transactional(rollbackFor = ServiceException.class) |
149 | - public Result autoCombination(ShipmentDetail shipmentDetail) { | 149 | + public Result autoCombination(ShipmentDetail shipmentDetail, BigDecimal shipQty) { |
150 | //出库数量 | 150 | //出库数量 |
151 | BigDecimal shipmentQty = shipmentDetail.getQty().subtract(shipmentDetail.getTaskQty()); | 151 | BigDecimal shipmentQty = shipmentDetail.getQty().subtract(shipmentDetail.getTaskQty()); |
152 | //判断是否还有需要出库的物料,如果没有就跳过该物料 | 152 | //判断是否还有需要出库的物料,如果没有就跳过该物料 |
153 | if (shipmentQty.compareTo(BigDecimal.ZERO) <= 0) { | 153 | if (shipmentQty.compareTo(BigDecimal.ZERO) <= 0) { |
154 | return Result.OK("出库数量必须大于0"); | 154 | return Result.OK("出库数量必须大于0"); |
155 | } | 155 | } |
156 | + if(shipQty != null) { | ||
157 | + shipmentQty = shipQty; | ||
158 | + } | ||
156 | List<InventoryDetail> inventoryList = getInventorys(shipmentDetail); | 159 | List<InventoryDetail> inventoryList = getInventorys(shipmentDetail); |
157 | //去除已锁的库存 | 160 | //去除已锁的库存 |
158 | ArrayList<InventoryDetail> removeInventoryList = new ArrayList<>(); | 161 | ArrayList<InventoryDetail> removeInventoryList = new ArrayList<>(); |
@@ -414,7 +417,8 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | @@ -414,7 +417,8 @@ public class ShipmentCombinationServiceImpl implements IShipmentCombinationServi | ||
414 | 417 | ||
415 | @Override | 418 | @Override |
416 | @Transactional(rollbackFor = ServiceException.class) | 419 | @Transactional(rollbackFor = ServiceException.class) |
417 | - public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode) { | 420 | + public Result createShipmentTask(ShipmentContainerHeader shipmentContainerHeader, String warehouseCode, |
421 | + long shipmentOrder, int sequence, int sequenceNumber) { | ||
418 | Integer preTaskNo = 0; | 422 | Integer preTaskNo = 0; |
419 | if (shipmentContainerHeader == null) { | 423 | if (shipmentContainerHeader == null) { |
420 | return Result.error("生成出库任务时, 出库组盘头" + "未找到,操作中止"); | 424 | return Result.error("生成出库任务时, 出库组盘头" + "未找到,操作中止"); |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/IShipmentContainerDetailService.java
@@ -15,4 +15,6 @@ public interface IShipmentContainerDetailService extends IService<ShipmentContai | @@ -15,4 +15,6 @@ public interface IShipmentContainerDetailService extends IService<ShipmentContai | ||
15 | public List<ShipmentContainerDetail> selectByMainId(String mainId); | 15 | public List<ShipmentContainerDetail> selectByMainId(String mainId); |
16 | 16 | ||
17 | public List<ShipmentContainerDetail> getShipmentContainerDetailListByHeaderId(int shipmentContainerHeaderId); | 17 | public List<ShipmentContainerDetail> getShipmentContainerDetailListByHeaderId(int shipmentContainerHeaderId); |
18 | + | ||
19 | + public List<ShipmentContainerDetail> getShipmentContainerDetailListByShipmentCode(String shipmentCode); | ||
18 | } | 20 | } |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/shipment/shipmentContainerHeader/service/impl/ShipmentContainerDetailServiceImpl.java
@@ -34,4 +34,12 @@ public class ShipmentContainerDetailServiceImpl extends ServiceImpl<ShipmentCont | @@ -34,4 +34,12 @@ public class ShipmentContainerDetailServiceImpl extends ServiceImpl<ShipmentCont | ||
34 | List<ShipmentContainerDetail> shipmentContainerDetailList = list(shipmentContainerDetailLambdaQueryWrapper); | 34 | List<ShipmentContainerDetail> shipmentContainerDetailList = list(shipmentContainerDetailLambdaQueryWrapper); |
35 | return shipmentContainerDetailList; | 35 | return shipmentContainerDetailList; |
36 | } | 36 | } |
37 | + | ||
38 | + @Override | ||
39 | + public List<ShipmentContainerDetail> getShipmentContainerDetailListByShipmentCode(String shipmentCode) { | ||
40 | + LambdaQueryWrapper<ShipmentContainerDetail> shipmentContainerDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
41 | + shipmentContainerDetailLambdaQueryWrapper.eq(ShipmentContainerDetail::getShipmentCode, shipmentCode); | ||
42 | + List<ShipmentContainerDetail> shipmentContainerDetailList = list(shipmentContainerDetailLambdaQueryWrapper); | ||
43 | + return shipmentContainerDetailList; | ||
44 | + } | ||
37 | } | 45 | } |