Commit 47abfd7511a6764670107c747bf41f0715dff777
1 parent
724c73e4
增加ERP 单据下发、取消 接口
Showing
13 changed files
with
425 additions
and
16 deletions
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/controller/ErpController.java
... | ... | @@ -3,6 +3,7 @@ package org.jeecg.modules.wms.api.erp.controller; |
3 | 3 | |
4 | 4 | import com.google.gson.Gson; |
5 | 5 | import io.swagger.annotations.ApiOperation; |
6 | +import io.swagger.annotations.ApiParam; | |
6 | 7 | import net.sf.json.JSON; |
7 | 8 | import org.jeecg.common.api.vo.Result; |
8 | 9 | import org.jeecg.common.aspect.annotation.AutoLog; |
... | ... | @@ -11,6 +12,7 @@ import org.jeecg.common.system.util.JwtUtil; |
11 | 12 | import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; |
12 | 13 | import org.jeecg.modules.wms.api.erp.entity.ErpReceiptDetail; |
13 | 14 | import org.jeecg.modules.wms.api.erp.entity.ErpReceiptHeader; |
15 | +import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | |
14 | 16 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
15 | 17 | import org.jeecg.modules.wms.api.wcs.entity.WarecellDomain; |
16 | 18 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; |
... | ... | @@ -22,6 +24,7 @@ import javax.annotation.Resource; |
22 | 24 | import javax.servlet.http.HttpServletRequest; |
23 | 25 | import java.util.ArrayList; |
24 | 26 | import java.util.List; |
27 | +import java.util.Map; | |
25 | 28 | |
26 | 29 | /** |
27 | 30 | * @author 游杰 |
... | ... | @@ -35,7 +38,7 @@ public class ErpController extends BaseController { |
35 | 38 | |
36 | 39 | @PostMapping("/receipt") |
37 | 40 | @ResponseBody |
38 | - @ApiLogger(apiName = "入库单下发", from="WCS") | |
41 | + @ApiLogger(apiName = "入库单下发", from="ERP") | |
39 | 42 | public Result receipt(@RequestBody ErpReceipt erpReceipt, HttpServletRequest req) { |
40 | 43 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
41 | 44 | Result result = handleMultiProcess("receipt", new JeecgController.MultiProcessListener() { |
... | ... | @@ -46,4 +49,50 @@ public class ErpController extends BaseController { |
46 | 49 | }); |
47 | 50 | return result; |
48 | 51 | } |
52 | + | |
53 | + @PostMapping("/cancelReceipt") | |
54 | + @ResponseBody | |
55 | + @ApiLogger(apiName = "取消入库单", from="ERP") | |
56 | + public Result cancelReceipt(@RequestBody Map<String, String> param, HttpServletRequest req) { | |
57 | + String referCode = param.get("referCode"); | |
58 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
59 | + Result result = handleMultiProcess("cancelReceipt", new JeecgController.MultiProcessListener() { | |
60 | + @Override | |
61 | + public Result doProcess() { | |
62 | + return erpService.cancelReceipt(referCode, warehouseCode); | |
63 | + } | |
64 | + }); | |
65 | + return result; | |
66 | + } | |
67 | + | |
68 | + | |
69 | + @PostMapping("/shipment") | |
70 | + @ResponseBody | |
71 | + @ApiLogger(apiName = "出库单下发", from="ERP") | |
72 | + public Result shipment(@RequestBody ErpShipment erpShipment, HttpServletRequest req) { | |
73 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
74 | + Result result = handleMultiProcess("shipment", new JeecgController.MultiProcessListener() { | |
75 | + @Override | |
76 | + public Result doProcess() { | |
77 | + return erpService.shipment(erpShipment, warehouseCode); | |
78 | + } | |
79 | + }); | |
80 | + return result; | |
81 | + } | |
82 | + | |
83 | + | |
84 | + @PostMapping("/cancelShipment") | |
85 | + @ResponseBody | |
86 | + @ApiLogger(apiName = "取消出库单", from="ERP") | |
87 | + public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { | |
88 | + String referCode = param.get("referCode"); | |
89 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
90 | + Result result = handleMultiProcess("cancelShipment", new JeecgController.MultiProcessListener() { | |
91 | + @Override | |
92 | + public Result doProcess() { | |
93 | + return erpService.cancelShipment(referCode, warehouseCode); | |
94 | + } | |
95 | + }); | |
96 | + return result; | |
97 | + } | |
49 | 98 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpShipment.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.erp.entity; | |
2 | + | |
3 | +import lombok.Data; | |
4 | + | |
5 | +import java.util.List; | |
6 | + | |
7 | +/** | |
8 | + * @author 游杰 | |
9 | + */ | |
10 | +@Data | |
11 | +public class ErpShipment { | |
12 | + | |
13 | + private ErpShipmentHeader shipmentHeader; | |
14 | + private List<ErpShipmentDetail> shipmentDetailList; | |
15 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpShipmentDetail.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.erp.entity; | |
2 | + | |
3 | +import lombok.Data; | |
4 | + | |
5 | +import java.math.BigDecimal; | |
6 | + | |
7 | +@Data | |
8 | +public class ErpShipmentDetail { | |
9 | + | |
10 | + /** | |
11 | + * 物料编码 | |
12 | + */ | |
13 | + private String materialCode; | |
14 | + | |
15 | + /** | |
16 | + * 单据数量 | |
17 | + */ | |
18 | + private BigDecimal qty; | |
19 | + | |
20 | + /** | |
21 | + * 库存状况 | |
22 | + */ | |
23 | + private String inventoryStatus; | |
24 | + | |
25 | + /** | |
26 | + * 批次 | |
27 | + */ | |
28 | + private String batch; | |
29 | + | |
30 | + /** | |
31 | + * 批号 | |
32 | + */ | |
33 | + private String lot; | |
34 | + | |
35 | + /** | |
36 | + * 项目号 | |
37 | + */ | |
38 | + private String project; | |
39 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/entity/ErpShipmentHeader.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.erp.entity; | |
2 | + | |
3 | +import lombok.Data; | |
4 | + | |
5 | +@Data | |
6 | +public class ErpShipmentHeader { | |
7 | + | |
8 | + /** | |
9 | + * 货主 | |
10 | + */ | |
11 | + private String companyCode; | |
12 | + /** | |
13 | + * 出库单类型 | |
14 | + */ | |
15 | + private String shipmentType; | |
16 | + /** | |
17 | + * 上游单号 | |
18 | + */ | |
19 | + private String referCode; | |
20 | + /** | |
21 | + * 客户编码 | |
22 | + */ | |
23 | + private String customerCode; | |
24 | + /** | |
25 | + * 备注 | |
26 | + */ | |
27 | + private String remark; | |
28 | + | |
29 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/entity/InventoryQueryParam.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.erp.entity; | |
2 | + | |
3 | +import lombok.Data; | |
4 | + | |
5 | +/** | |
6 | + * @author 游杰 | |
7 | + */ | |
8 | +@Data | |
9 | +public class InventoryQueryParam { | |
10 | + | |
11 | + private String warehouseCode; | |
12 | + private String companyCode; | |
13 | + private String materialCode; | |
14 | + private String containerCode; | |
15 | + private String locationCode; | |
16 | + private String zoneCode; | |
17 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/service/IErpService.java
... | ... | @@ -2,8 +2,18 @@ package org.jeecg.modules.wms.api.erp.service; |
2 | 2 | |
3 | 3 | import org.jeecg.common.api.vo.Result; |
4 | 4 | import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; |
5 | +import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | |
6 | +import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; | |
5 | 7 | |
6 | 8 | public interface IErpService { |
7 | 9 | |
8 | 10 | public Result receipt(ErpReceipt erpReceipt, String warehouseCode); |
11 | + | |
12 | + public Result cancelReceipt(String referCode, String warehouseCode); | |
13 | + | |
14 | + public Result shipment(ErpShipment erpShipment, String warehouseCode); | |
15 | + | |
16 | + public Result cancelShipment(String referCode, String warehouseCode); | |
17 | + | |
18 | + public Result searchInventory(InventoryQueryParam inventoryQueryParam); | |
9 | 19 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/service/impl/ErpServiceImpl.java
1 | 1 | package org.jeecg.modules.wms.api.erp.service.impl; |
2 | 2 | |
3 | 3 | import com.aliyun.oss.ServiceException; |
4 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
5 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
4 | 6 | import org.jeecg.common.api.vo.Result; |
5 | -import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | |
6 | -import org.jeecg.modules.wms.api.erp.entity.ErpReceiptDetail; | |
7 | -import org.jeecg.modules.wms.api.erp.entity.ErpReceiptHeader; | |
7 | +import org.jeecg.modules.wms.api.erp.entity.*; | |
8 | 8 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
9 | 9 | import org.jeecg.modules.wms.config.company.entity.Company; |
10 | 10 | import org.jeecg.modules.wms.config.company.service.ICompanyService; |
... | ... | @@ -12,10 +12,16 @@ import org.jeecg.modules.wms.config.material.entity.Material; |
12 | 12 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
13 | 13 | import org.jeecg.modules.wms.config.warehouse.entity.Warehouse; |
14 | 14 | import org.jeecg.modules.wms.config.warehouse.service.IWarehouseService; |
15 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
16 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
15 | 17 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; |
16 | 18 | import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; |
17 | 19 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; |
18 | 20 | import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; |
21 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentDetail; | |
22 | +import org.jeecg.modules.wms.shipment.shipmentHeader.entity.ShipmentHeader; | |
23 | +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentDetailService; | |
24 | +import org.jeecg.modules.wms.shipment.shipmentHeader.service.IShipmentHeaderService; | |
19 | 25 | import org.jeecg.utils.StringUtils; |
20 | 26 | import org.jeecg.utils.constant.QuantityConstant; |
21 | 27 | import org.springframework.stereotype.Service; |
... | ... | @@ -38,9 +44,15 @@ public class ErpServiceImpl implements IErpService { |
38 | 44 | @Resource |
39 | 45 | private IReceiptHeaderService receiptHeaderService; |
40 | 46 | @Resource |
47 | + private IShipmentHeaderService shipmentHeaderService; | |
48 | + @Resource | |
41 | 49 | private IMaterialService materialService; |
42 | 50 | @Resource |
43 | 51 | private IReceiptDetailService receiptDetailService; |
52 | + @Resource | |
53 | + private IShipmentDetailService shipmentDetailService; | |
54 | + @Resource | |
55 | + private IInventoryDetailService inventoryDetailService; | |
44 | 56 | |
45 | 57 | @Override |
46 | 58 | @Transactional(rollbackFor = Exception.class) |
... | ... | @@ -80,8 +92,14 @@ public class ErpServiceImpl implements IErpService { |
80 | 92 | return Result.error("入库单下发, company为空"); |
81 | 93 | } |
82 | 94 | companyCode = company.getCode(); |
95 | + } else { | |
96 | + Company company = companyService.getCompanyByCode(companyCode, warehouseCode); | |
97 | + if(company == null) { | |
98 | + return Result.error("入库单下发, 没有找到货主"); | |
99 | + } | |
83 | 100 | } |
84 | 101 | ReceiptHeader receiptHeader = new ReceiptHeader(); |
102 | + receiptHeader.setWarehouseCode(warehouseCode); | |
85 | 103 | receiptHeader.setCompanyCode(companyCode); |
86 | 104 | receiptHeader.setType(receiptType); |
87 | 105 | receiptHeader.setReferCode(referCode); |
... | ... | @@ -89,7 +107,7 @@ public class ErpServiceImpl implements IErpService { |
89 | 107 | receiptHeader.setRemark(remark); |
90 | 108 | Result result = receiptHeaderService.saveReceiptHeader(receiptHeader); |
91 | 109 | if(!result.isSuccess()) { |
92 | - throw new ServiceException("创建入库单头失败"); | |
110 | + throw new ServiceException("创建入库单头失败" + result.getMessage()); | |
93 | 111 | } |
94 | 112 | for(ErpReceiptDetail erpReceiptDetail : erpReceiptDetailList) { |
95 | 113 | BigDecimal qty = erpReceiptDetail.getQty(); |
... | ... | @@ -104,10 +122,11 @@ public class ErpServiceImpl implements IErpService { |
104 | 122 | if(StringUtils.isEmpty(inventoryStatus)) { |
105 | 123 | inventoryStatus = QuantityConstant.QUALITY_GOOD; |
106 | 124 | } |
107 | - if(qty.compareTo(BigDecimal.ZERO) > 0) { | |
108 | - throw new ServiceException("入库单下发, 单据数量大于0"); | |
125 | + if(qty.compareTo(BigDecimal.ZERO) <= 0) { | |
126 | + throw new ServiceException("入库单下发, 单据数量必须大于0"); | |
109 | 127 | } |
110 | 128 | ReceiptDetail receiptDetail = new ReceiptDetail(); |
129 | + receiptDetail.setWarehouseCode(warehouseCode); | |
111 | 130 | receiptDetail.setCompanyCode(companyCode); |
112 | 131 | receiptDetail.setReceiptCode(receiptHeader.getCode()); |
113 | 132 | receiptDetail.setReceiptId(receiptHeader.getId()); |
... | ... | @@ -130,8 +149,176 @@ public class ErpServiceImpl implements IErpService { |
130 | 149 | throw new ServiceException("入库单下发, 保存入库单详情失败"); |
131 | 150 | } |
132 | 151 | } |
152 | + boolean success = receiptHeaderService.updateReceiptHeader(receiptHeader.getId()); | |
153 | + if(!success) { | |
154 | + throw new ServiceException("入库单下发, 更新入库单失败"); | |
155 | + } | |
133 | 156 | return Result.OK("入库单下发成功"); |
134 | 157 | } |
135 | 158 | |
159 | + @Override | |
160 | + public Result cancelReceipt(String referCode, String warehouseCode) { | |
161 | + if(StringUtils.isEmpty(warehouseCode)) { | |
162 | + return Result.error("入库单取消,仓库编码为空"); | |
163 | + } | |
164 | + Warehouse warehouse = warehouseService.getWarehouseByCode(warehouseCode); | |
165 | + if(warehouse == null) { | |
166 | + return Result.error("入库单取消, 没有找到仓库"); | |
167 | + } | |
168 | + ReceiptHeader receiptHeader = receiptHeaderService.getReceiptHeaderByReferCode(referCode, warehouseCode); | |
169 | + if(receiptHeader == null) { | |
170 | + return Result.error("入库单取消, 没有找到入库单"); | |
171 | + } | |
172 | + boolean success = receiptHeaderService.delMain(String.valueOf(receiptHeader.getId())); | |
173 | + if(!success) { | |
174 | + return Result.error("入库单取消失败"); | |
175 | + } | |
176 | + return Result.OK("取消入库单成功"); | |
177 | + } | |
178 | + | |
179 | + @Override | |
180 | + public Result shipment(ErpShipment erpShipment, String warehouseCode) { | |
181 | + if(StringUtils.isEmpty(warehouseCode)) { | |
182 | + return Result.error("出库单下发,仓库编码为空"); | |
183 | + } | |
184 | + Warehouse warehouse = warehouseService.getWarehouseByCode(warehouseCode); | |
185 | + if(warehouse == null) { | |
186 | + return Result.error("出库单下发, 没有找到仓库"); | |
187 | + } | |
188 | + if(erpShipment == null) { | |
189 | + return Result.error("出库单下发,没有传shipment"); | |
190 | + } | |
191 | + ErpShipmentHeader erpShipmentHeader = erpShipment.getShipmentHeader(); | |
192 | + List<ErpShipmentDetail> erpShipmentDetailList = erpShipment.getShipmentDetailList(); | |
193 | + if(erpShipmentHeader == null) { | |
194 | + return Result.error("出库单下发,没有传shipmentHeader"); | |
195 | + } | |
196 | + if(erpShipmentDetailList == null) { | |
197 | + return Result.error("出库单下发,没有传shipmentDetailList"); | |
198 | + } | |
199 | + String shipmentType = erpShipmentHeader.getShipmentType(); | |
200 | + String referCode = erpShipmentHeader.getReferCode(); | |
201 | + String companyCode = erpShipmentHeader.getCompanyCode(); | |
202 | + String remark = erpShipmentHeader.getRemark(); | |
203 | + String customerCode = erpShipmentHeader.getCustomerCode(); | |
204 | + if(StringUtils.isEmpty(shipmentType)) { | |
205 | + return Result.error("出库单下发, shipmentType为空"); | |
206 | + } | |
207 | + if(StringUtils.isEmpty(referCode)) { | |
208 | + return Result.error("出库单下发, referCode为空"); | |
209 | + } | |
210 | + if(StringUtils.isEmpty(companyCode)) { | |
211 | + Company company = companyService.getDefaultCompany(); | |
212 | + if(company == null) { | |
213 | + return Result.error("出库单下发, company为空"); | |
214 | + } | |
215 | + companyCode = company.getCode(); | |
216 | + } else { | |
217 | + Company company = companyService.getCompanyByCode(companyCode, warehouseCode); | |
218 | + if(company == null) { | |
219 | + return Result.error("出库单下发, 没有找到货主"); | |
220 | + } | |
221 | + } | |
222 | + ShipmentHeader shipmentHeader = new ShipmentHeader(); | |
223 | + shipmentHeader.setWarehouseCode(warehouseCode); | |
224 | + shipmentHeader.setCompanyCode(companyCode); | |
225 | + shipmentHeader.setType(shipmentType); | |
226 | + shipmentHeader.setReferCode(referCode); | |
227 | + shipmentHeader.setCustomerCode(customerCode); | |
228 | + shipmentHeader.setRemark(remark); | |
229 | + Result result = shipmentHeaderService.saveShipmentHeader(shipmentHeader); | |
230 | + if(!result.isSuccess()) { | |
231 | + throw new ServiceException("创建出库单头失败" + result.getMessage()); | |
232 | + } | |
233 | + | |
234 | + for(ErpShipmentDetail erpShipmentDetail : erpShipmentDetailList) { | |
235 | + BigDecimal qty = erpShipmentDetail.getQty(); | |
236 | + String materialCode = erpShipmentDetail.getMaterialCode(); | |
237 | + String inventoryStatus = erpShipmentDetail.getInventoryStatus(); | |
238 | + String batch = erpShipmentDetail.getBatch(); | |
239 | + String lot = erpShipmentDetail.getLot(); | |
240 | + String project = erpShipmentDetail.getProject(); | |
241 | + if(StringUtils.isEmpty(materialCode)) { | |
242 | + throw new ServiceException("出库单下发, 物料编码为空"); | |
243 | + } | |
244 | + if(StringUtils.isEmpty(inventoryStatus)) { | |
245 | + inventoryStatus = QuantityConstant.QUALITY_GOOD; | |
246 | + } | |
247 | + if(qty.compareTo(BigDecimal.ZERO) <= 0) { | |
248 | + throw new ServiceException("出库单下发, 单据数量必须大于0"); | |
249 | + } | |
250 | + ShipmentDetail shipmentDetail = new ShipmentDetail(); | |
251 | + shipmentDetail.setWarehouseCode(warehouseCode); | |
252 | + shipmentDetail.setCompanyCode(companyCode); | |
253 | + shipmentDetail.setShipmentCode(shipmentHeader.getCode()); | |
254 | + shipmentDetail.setShipmentId(shipmentHeader.getId()); | |
255 | + shipmentDetail.setStatus(QuantityConstant.SHIPMENT_HEADER_BUILD); | |
256 | + shipmentDetail.setQty(qty); | |
257 | + Material material = materialService.getMaterialByCode(materialCode); | |
258 | + if(material == null) { | |
259 | + throw new ServiceException("出库单下发, 没有找到物料信息" + materialCode); | |
260 | + } | |
261 | + shipmentDetail.setInventoryStatus(inventoryStatus); | |
262 | + shipmentDetail.setMaterialCode(materialCode); | |
263 | + shipmentDetail.setMaterialName(material.getName()); | |
264 | + shipmentDetail.setMaterialSpec(material.getSpec()); | |
265 | + shipmentDetail.setMaterialUnit(material.getUnit()); | |
266 | + shipmentDetail.setBatch(batch); | |
267 | + shipmentDetail.setLot(lot); | |
268 | + shipmentDetail.setProject(project); | |
269 | + boolean success = shipmentDetailService.save(shipmentDetail); | |
270 | + if(!success) { | |
271 | + throw new ServiceException("出库单下发, 保存入库单详情失败"); | |
272 | + } | |
273 | + } | |
274 | + boolean success = shipmentHeaderService.updateShipmentHeader(shipmentHeader.getId()); | |
275 | + if(!success) { | |
276 | + throw new ServiceException("出库单下发, 更新入库单失败"); | |
277 | + } | |
278 | + return Result.OK("出库单下发成功"); | |
279 | + } | |
280 | + | |
281 | + @Override | |
282 | + public Result cancelShipment(String referCode, String warehouseCode) { | |
283 | + if(StringUtils.isEmpty(warehouseCode)) { | |
284 | + return Result.error("出库单取消,仓库编码为空"); | |
285 | + } | |
286 | + Warehouse warehouse = warehouseService.getWarehouseByCode(warehouseCode); | |
287 | + if(warehouse == null) { | |
288 | + return Result.error("出库单取消, 没有找到仓库"); | |
289 | + } | |
290 | + ShipmentHeader shipmentHeader = shipmentHeaderService.getShipmentHeaderByReferCode(referCode, warehouseCode); | |
291 | + if(shipmentHeader == null) { | |
292 | + return Result.error("出库单取消, 没有找到出库单"); | |
293 | + } | |
294 | + boolean success = shipmentHeaderService.delMain(String.valueOf(shipmentHeader.getId())); | |
295 | + if(!success) { | |
296 | + return Result.error("出库单取消失败"); | |
297 | + } | |
298 | + return Result.OK("取消出库单成功"); | |
299 | + } | |
300 | + | |
301 | + @Override | |
302 | + public Result searchInventory(InventoryQueryParam inventoryQueryParam) { | |
303 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
304 | + inventoryDetailLambdaQueryWrapper.eq(StringUtils.isNotEmpty(inventoryQueryParam.getWarehouseCode()), | |
305 | + InventoryDetail::getWarehouseCode, inventoryQueryParam.getWarehouseCode()) | |
306 | + .eq(StringUtils.isNotEmpty(inventoryQueryParam.getMaterialCode()), | |
307 | + InventoryDetail::getMaterialCode, inventoryQueryParam.getMaterialCode()) | |
308 | + .eq(StringUtils.isNotEmpty(inventoryQueryParam.getCompanyCode()), | |
309 | + InventoryDetail::getCompanyCode, inventoryQueryParam.getCompanyCode()) | |
310 | + .eq(StringUtils.isNotEmpty(inventoryQueryParam.getZoneCode()), | |
311 | + InventoryDetail::getZoneCode, inventoryQueryParam.getZoneCode()) | |
312 | + .eq(StringUtils.isNotEmpty(inventoryQueryParam.getContainerCode()), | |
313 | + InventoryDetail::getContainerCode, inventoryQueryParam.getContainerCode()) | |
314 | + .eq(StringUtils.isNotEmpty(inventoryQueryParam.getLocationCode()), | |
315 | + InventoryDetail::getLocationCode, inventoryQueryParam.getLocationCode()); | |
316 | + List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); | |
317 | + if(inventoryDetailList.size() == 0) { | |
318 | + return Result.error("没有找到对应库存"); | |
319 | + } | |
320 | + return Result.ok(inventoryDetailList); | |
321 | + } | |
322 | + | |
136 | 323 | |
137 | 324 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/company/service/ICompanyService.java
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/company/service/impl/CompanyServiceImpl.java
... | ... | @@ -25,4 +25,13 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl |
25 | 25 | Company company = getOne(companyLambdaQueryWrapper); |
26 | 26 | return company; |
27 | 27 | } |
28 | + | |
29 | + @Override | |
30 | + public Company getCompanyByCode(String code, String warehouseCode) { | |
31 | + LambdaQueryWrapper<Company> companyLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
32 | + companyLambdaQueryWrapper.eq(Company::getCode, code) | |
33 | + .eq(Company::getWarehouseCode, warehouseCode); | |
34 | + Company company = getOne(companyLambdaQueryWrapper); | |
35 | + return company; | |
36 | + } | |
28 | 37 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/IReceiptHeaderService.java
... | ... | @@ -19,13 +19,16 @@ public interface IReceiptHeaderService extends IService<ReceiptHeader> { |
19 | 19 | /** |
20 | 20 | * 删除一对多 |
21 | 21 | */ |
22 | - public void delMain (String id); | |
22 | + public boolean delMain (String id); | |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * 批量删除一对多 |
26 | 26 | */ |
27 | 27 | public void delBatchMain (Collection<? extends Serializable> idList); |
28 | 28 | |
29 | + /** | |
30 | + * | |
31 | + */ | |
29 | 32 | public Result saveReceiptHeader(ReceiptHeader receiptHeader); |
30 | 33 | |
31 | 34 | public String createCode(String receiptType); |
... | ... | @@ -34,5 +37,7 @@ public interface IReceiptHeaderService extends IService<ReceiptHeader> { |
34 | 37 | |
35 | 38 | public boolean updateReceiptHeader(Integer id); |
36 | 39 | |
40 | + public ReceiptHeader getReceiptHeaderByCode(String code, String warehouseCode); | |
37 | 41 | |
42 | + public ReceiptHeader getReceiptHeaderByReferCode(String referCode, String warehouseCode); | |
38 | 43 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/receipt/receiptHeader/service/impl/ReceiptHeaderServiceImpl.java
... | ... | @@ -54,14 +54,18 @@ public class ReceiptHeaderServiceImpl extends ServiceImpl<ReceiptHeaderMapper, R |
54 | 54 | |
55 | 55 | @Override |
56 | 56 | @Transactional |
57 | - public void delMain(String id) { | |
57 | + public boolean delMain(String id) { | |
58 | 58 | ReceiptHeader receiptHeader = getById(id); |
59 | 59 | if(receiptHeader.getFirstStatus().intValue() > QuantityConstant.RECEIPT_HEADER_BUILD) { |
60 | 60 | throw new ServiceException("不能删除非新建状态单据"); |
61 | 61 | } |
62 | 62 | receiptHeaderHistoryService.saveById(id); |
63 | - receiptDetailMapper.deleteByMainId(id); | |
64 | - receiptHeaderMapper.deleteById(id); | |
63 | + boolean success = receiptDetailMapper.deleteByMainId(id); | |
64 | + if(!success) { | |
65 | + return success; | |
66 | + } | |
67 | + success = removeById(id); | |
68 | + return success; | |
65 | 69 | } |
66 | 70 | |
67 | 71 | @Override |
... | ... | @@ -195,4 +199,22 @@ public class ReceiptHeaderServiceImpl extends ServiceImpl<ReceiptHeaderMapper, R |
195 | 199 | return true; |
196 | 200 | } |
197 | 201 | |
202 | + @Override | |
203 | + public ReceiptHeader getReceiptHeaderByCode(String code, String warehouseCode) { | |
204 | + LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
205 | + receiptHeaderLambdaQueryWrapper.eq(ReceiptHeader::getCode, code) | |
206 | + .eq(ReceiptHeader::getWarehouseCode, warehouseCode); | |
207 | + ReceiptHeader receiptHeader = getOne(receiptHeaderLambdaQueryWrapper); | |
208 | + return receiptHeader; | |
209 | + } | |
210 | + | |
211 | + @Override | |
212 | + public ReceiptHeader getReceiptHeaderByReferCode(String referCode, String warehouseCode) { | |
213 | + LambdaQueryWrapper<ReceiptHeader> receiptHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
214 | + receiptHeaderLambdaQueryWrapper.eq(ReceiptHeader::getReferCode, referCode) | |
215 | + .eq(ReceiptHeader::getWarehouseCode, warehouseCode); | |
216 | + ReceiptHeader receiptHeader = getOne(receiptHeaderLambdaQueryWrapper); | |
217 | + return receiptHeader; | |
218 | + } | |
219 | + | |
198 | 220 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/IShipmentHeaderService.java
... | ... | @@ -22,7 +22,7 @@ public interface IShipmentHeaderService extends IService<ShipmentHeader> { |
22 | 22 | /** |
23 | 23 | * 删除一对多 |
24 | 24 | */ |
25 | - public void delMain (String id); | |
25 | + public boolean delMain (String id); | |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * 批量删除一对多 |
... | ... | @@ -36,4 +36,8 @@ public interface IShipmentHeaderService extends IService<ShipmentHeader> { |
36 | 36 | public boolean updateShipmentHeaderStatus(Integer id); |
37 | 37 | |
38 | 38 | public boolean updateShipmentHeader(Integer id); |
39 | + | |
40 | + public ShipmentHeader getShipmentHeaderByCode(String code, String warehouseCode); | |
41 | + | |
42 | + public ShipmentHeader getShipmentHeaderByReferCode(String referCode, String warehouseCode); | |
39 | 43 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/shipment/shipmentHeader/service/impl/ShipmentHeaderServiceImpl.java
... | ... | @@ -79,14 +79,17 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, |
79 | 79 | |
80 | 80 | @Override |
81 | 81 | @Transactional |
82 | - public void delMain(String id) { | |
82 | + public boolean delMain(String id) { | |
83 | 83 | ShipmentHeader shipmentHeader = getById(id); |
84 | 84 | if(shipmentHeader.getFirstStatus().intValue() > QuantityConstant.RECEIPT_HEADER_BUILD) { |
85 | 85 | throw new ServiceException("不能删除非新建状态单据"); |
86 | 86 | } |
87 | - shipmentHeaderHistoryService.saveById(id); | |
88 | - shipmentDetailMapper.deleteByMainId(id); | |
89 | - shipmentHeaderMapper.deleteById(id); | |
87 | + boolean success = shipmentDetailMapper.deleteByMainId(id); | |
88 | + if(!success) { | |
89 | + return success; | |
90 | + } | |
91 | + success = removeById(id); | |
92 | + return success; | |
90 | 93 | } |
91 | 94 | |
92 | 95 | @Override |
... | ... | @@ -208,4 +211,22 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper, |
208 | 211 | return true; |
209 | 212 | } |
210 | 213 | |
214 | + @Override | |
215 | + public ShipmentHeader getShipmentHeaderByCode(String code, String warehouseCode) { | |
216 | + LambdaQueryWrapper<ShipmentHeader> shipmentHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
217 | + shipmentHeaderLambdaQueryWrapper.eq(ShipmentHeader::getCode, code) | |
218 | + .eq(ShipmentHeader::getWarehouseCode, warehouseCode); | |
219 | + ShipmentHeader shipmentHeader = getOne(shipmentHeaderLambdaQueryWrapper); | |
220 | + return shipmentHeader; | |
221 | + } | |
222 | + | |
223 | + @Override | |
224 | + public ShipmentHeader getShipmentHeaderByReferCode(String referCode, String warehouseCode) { | |
225 | + LambdaQueryWrapper<ShipmentHeader> shipmentHeaderLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
226 | + shipmentHeaderLambdaQueryWrapper.eq(ShipmentHeader::getReferCode, referCode) | |
227 | + .eq(ShipmentHeader::getWarehouseCode, warehouseCode); | |
228 | + ShipmentHeader shipmentHeader = getOne(shipmentHeaderLambdaQueryWrapper); | |
229 | + return shipmentHeader; | |
230 | + } | |
231 | + | |
211 | 232 | } |
... | ... |