Commit 7d4c1709e8f3b4813f67ace4134357355a604a1c
1 parent
a134d96e
1. erp和mes接口开发
Showing
6 changed files
with
140 additions
and
45 deletions
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/controller/ErpController.java
@@ -57,13 +57,7 @@ public class ErpController extends BaseController { | @@ -57,13 +57,7 @@ public class ErpController extends BaseController { | ||
57 | @ApiLogger(apiName = "出库单下发", from="ERP") | 57 | @ApiLogger(apiName = "出库单下发", from="ERP") |
58 | public Result shipment(@RequestBody ErpShipment erpShipment, HttpServletRequest req) { | 58 | public Result shipment(@RequestBody ErpShipment erpShipment, HttpServletRequest req) { |
59 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 59 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
60 | - Result result = handleMultiProcess("shipment", new JeecgController.MultiProcessListener() { | ||
61 | - @Override | ||
62 | - public Result doProcess() { | ||
63 | - return erpService.shipment(erpShipment, warehouseCode); | ||
64 | - } | ||
65 | - }); | ||
66 | - return result; | 60 | + return erpService.shipment(erpShipment, warehouseCode); |
67 | } | 61 | } |
68 | 62 | ||
69 | 63 | ||
@@ -73,21 +67,14 @@ public class ErpController extends BaseController { | @@ -73,21 +67,14 @@ public class ErpController extends BaseController { | ||
73 | public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { | 67 | public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { |
74 | String referCode = param.get("referCode"); | 68 | String referCode = param.get("referCode"); |
75 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 69 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
76 | - Result result = handleMultiProcess("cancelShipment", new JeecgController.MultiProcessListener() { | ||
77 | - @Override | ||
78 | - public Result doProcess() { | ||
79 | - return erpService.cancelShipment(referCode, warehouseCode); | ||
80 | - } | ||
81 | - }); | ||
82 | - return result; | 70 | + return erpService.cancelShipment(referCode, warehouseCode); |
83 | } | 71 | } |
84 | 72 | ||
85 | @PostMapping("/searchInventory") | 73 | @PostMapping("/searchInventory") |
86 | @ResponseBody | 74 | @ResponseBody |
87 | @ApiLogger(apiName = "查询库存", from="ERP") | 75 | @ApiLogger(apiName = "查询库存", from="ERP") |
88 | public Result searchInventory(@RequestBody InventoryQueryParam inventoryQueryParam, HttpServletRequest req) { | 76 | public Result searchInventory(@RequestBody InventoryQueryParam inventoryQueryParam, HttpServletRequest req) { |
89 | - String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
90 | - Result result = erpService.searchInventory(inventoryQueryParam); | 77 | + Result result = erpService.searchInventory(inventoryQueryParam); |
91 | return result; | 78 | return result; |
92 | } | 79 | } |
93 | 80 | ||
@@ -96,12 +83,6 @@ public class ErpController extends BaseController { | @@ -96,12 +83,6 @@ public class ErpController extends BaseController { | ||
96 | @ApiLogger(apiName = "增加物料", from="ERP") | 83 | @ApiLogger(apiName = "增加物料", from="ERP") |
97 | public Result addMaterial(@RequestBody Material material, HttpServletRequest req) { | 84 | public Result addMaterial(@RequestBody Material material, HttpServletRequest req) { |
98 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 85 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
99 | - Result result = handleMultiProcess("addMaterial", new JeecgController.MultiProcessListener() { | ||
100 | - @Override | ||
101 | - public Result doProcess() { | ||
102 | - return erpService.addMaterial(material, warehouseCode); | ||
103 | - } | ||
104 | - }); | ||
105 | - return result; | 86 | + return erpService.addMaterial(material, warehouseCode); |
106 | } | 87 | } |
107 | } | 88 | } |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/controller/MesController.java
@@ -7,6 +7,8 @@ import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | @@ -7,6 +7,8 @@ import org.jeecg.modules.wms.api.erp.entity.ErpReceipt; | ||
7 | import org.jeecg.modules.wms.api.erp.entity.ErpShipment; | 7 | import org.jeecg.modules.wms.api.erp.entity.ErpShipment; |
8 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; | 8 | import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; |
9 | import org.jeecg.modules.wms.api.erp.service.IErpService; | 9 | import org.jeecg.modules.wms.api.erp.service.IErpService; |
10 | +import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; | ||
11 | +import org.jeecg.modules.wms.api.mes.servuce.IMesService; | ||
10 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; | 12 | import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; |
11 | import org.jeecg.modules.wms.framework.controller.BaseController; | 13 | import org.jeecg.modules.wms.framework.controller.BaseController; |
12 | import org.springframework.web.bind.annotation.*; | 14 | import org.springframework.web.bind.annotation.*; |
@@ -24,10 +26,12 @@ public class MesController extends BaseController { | @@ -24,10 +26,12 @@ public class MesController extends BaseController { | ||
24 | 26 | ||
25 | @Resource | 27 | @Resource |
26 | private IErpService erpService; | 28 | private IErpService erpService; |
29 | + @Resource | ||
30 | + private IMesService mesService; | ||
27 | 31 | ||
28 | @PostMapping("/receipt") | 32 | @PostMapping("/receipt") |
29 | @ResponseBody | 33 | @ResponseBody |
30 | - @ApiLogger(apiName = "入库单下发", from="ERP") | 34 | + @ApiLogger(apiName = "入库单下发", from="MES") |
31 | public Result receipt(@RequestBody ErpReceipt erpReceipt, HttpServletRequest req) { | 35 | public Result receipt(@RequestBody ErpReceipt erpReceipt, HttpServletRequest req) { |
32 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 36 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
33 | return erpService.receipt(erpReceipt, warehouseCode); | 37 | return erpService.receipt(erpReceipt, warehouseCode); |
@@ -35,7 +39,7 @@ public class MesController extends BaseController { | @@ -35,7 +39,7 @@ public class MesController extends BaseController { | ||
35 | 39 | ||
36 | @PostMapping("/cancelReceipt") | 40 | @PostMapping("/cancelReceipt") |
37 | @ResponseBody | 41 | @ResponseBody |
38 | - @ApiLogger(apiName = "取消入库单", from="ERP") | 42 | + @ApiLogger(apiName = "取消入库单", from="MES") |
39 | public Result cancelReceipt(@RequestBody Map<String, String> param, HttpServletRequest req) { | 43 | public Result cancelReceipt(@RequestBody Map<String, String> param, HttpServletRequest req) { |
40 | String referCode = param.get("referCode"); | 44 | String referCode = param.get("referCode"); |
41 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 45 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
@@ -45,41 +49,45 @@ public class MesController extends BaseController { | @@ -45,41 +49,45 @@ public class MesController extends BaseController { | ||
45 | 49 | ||
46 | @PostMapping("/shipment") | 50 | @PostMapping("/shipment") |
47 | @ResponseBody | 51 | @ResponseBody |
48 | - @ApiLogger(apiName = "出库单下发", from="ERP") | 52 | + @ApiLogger(apiName = "出库单下发", from="MES") |
49 | public Result shipment(@RequestBody ErpShipment erpShipment, HttpServletRequest req) { | 53 | public Result shipment(@RequestBody ErpShipment erpShipment, HttpServletRequest req) { |
50 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 54 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
51 | - Result result = handleMultiProcess("shipment", new JeecgController.MultiProcessListener() { | ||
52 | - @Override | ||
53 | - public Result doProcess() { | ||
54 | - return erpService.shipment(erpShipment, warehouseCode); | ||
55 | - } | ||
56 | - }); | ||
57 | - return result; | 55 | + return erpService.shipment(erpShipment, warehouseCode); |
58 | } | 56 | } |
59 | 57 | ||
60 | 58 | ||
61 | @PostMapping("/cancelShipment") | 59 | @PostMapping("/cancelShipment") |
62 | @ResponseBody | 60 | @ResponseBody |
63 | - @ApiLogger(apiName = "取消出库单", from="ERP") | 61 | + @ApiLogger(apiName = "取消出库单", from="MES") |
64 | public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { | 62 | public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { |
65 | String referCode = param.get("referCode"); | 63 | String referCode = param.get("referCode"); |
66 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | 64 | String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); |
67 | - Result result = handleMultiProcess("cancelShipment", new JeecgController.MultiProcessListener() { | ||
68 | - @Override | ||
69 | - public Result doProcess() { | ||
70 | - return erpService.cancelShipment(referCode, warehouseCode); | ||
71 | - } | ||
72 | - }); | ||
73 | - return result; | 65 | + return erpService.cancelShipment(referCode, warehouseCode); |
74 | } | 66 | } |
75 | 67 | ||
76 | @PostMapping("/searchInventory") | 68 | @PostMapping("/searchInventory") |
77 | @ResponseBody | 69 | @ResponseBody |
78 | - @ApiLogger(apiName = "查询库存", from="ERP") | 70 | + @ApiLogger(apiName = "查询库存", from="MES") |
79 | public Result searchInventory(@RequestBody InventoryQueryParam inventoryQueryParam, HttpServletRequest req) { | 71 | public Result searchInventory(@RequestBody InventoryQueryParam inventoryQueryParam, HttpServletRequest req) { |
80 | - Result result = erpService.searchInventory(inventoryQueryParam); | 72 | + Result result = erpService.searchInventory(inventoryQueryParam); |
81 | return result; | 73 | return result; |
82 | } | 74 | } |
83 | 75 | ||
76 | + @PostMapping("/receiptMaterial") | ||
77 | + @ResponseBody | ||
78 | + @ApiLogger(apiName = "物料入库", from="MES") | ||
79 | + public Result receiptMaterial(@RequestBody MesReceiptMaterial mesReceiptMaterial, HttpServletRequest req) { | ||
80 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
81 | + Result result = mesService.receiptMaterial(mesReceiptMaterial, warehouseCode); | ||
82 | + return result; | ||
83 | + } | ||
84 | 84 | ||
85 | + @PostMapping("/shipmentMaterial") | ||
86 | + @ResponseBody | ||
87 | + @ApiLogger(apiName = "物料出库", from="MES") | ||
88 | + public Result shipmentMaterial(@RequestBody MesReceiptMaterial mesReceiptMaterial, HttpServletRequest req) { | ||
89 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | ||
90 | + Result result = mesService.shipmentMaterial(mesReceiptMaterial, warehouseCode); | ||
91 | + return result; | ||
92 | + } | ||
85 | } | 93 | } |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesMaterial.java renamed to jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/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; | ||
4 | + | ||
3 | import java.math.BigDecimal; | 5 | import java.math.BigDecimal; |
4 | 6 | ||
5 | -public class MesMaterial { | 7 | +@Data |
8 | +public class MaterialInfo { | ||
6 | 9 | ||
7 | private String materialCode; | 10 | private String materialCode; |
8 | private BigDecimal qty; | 11 | private BigDecimal qty; |
9 | - | ||
10 | 12 | ||
11 | } | 13 | } |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesReceiptMaterial.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mes.entity; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +import java.math.BigDecimal; | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +@Data | ||
9 | +public class MesReceiptMaterial { | ||
10 | + | ||
11 | + private String referCode; | ||
12 | + private String containerCode; | ||
13 | + private List<MaterialInfo> materialInfoList; | ||
14 | + | ||
15 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/servuce/IMesService.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mes.servuce; | ||
2 | + | ||
3 | +import org.jeecg.common.api.vo.Result; | ||
4 | +import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; | ||
5 | + | ||
6 | +/** | ||
7 | + * @author 游杰 | ||
8 | + */ | ||
9 | +public interface IMesService { | ||
10 | + | ||
11 | + public Result receiptMaterial(MesReceiptMaterial mesReceiptMaterial, String warehouseCode); | ||
12 | + | ||
13 | + public Result shipmentMaterial(MesReceiptMaterial mesMaterial, String warehouseCode); | ||
14 | +} |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java
0 → 100644
1 | +package org.jeecg.modules.wms.api.mes.servuce.impl; | ||
2 | + | ||
3 | +import org.jeecg.common.api.vo.Result; | ||
4 | +import org.jeecg.modules.wms.api.mes.entity.MaterialInfo; | ||
5 | +import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; | ||
6 | +import org.jeecg.modules.wms.api.mes.servuce.IMesService; | ||
7 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; | ||
8 | +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; | ||
9 | +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; | ||
10 | +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; | ||
11 | +import org.jeecg.modules.wms.receipt.receiving.domain.Receive; | ||
12 | +import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; | ||
13 | +import org.springframework.stereotype.Service; | ||
14 | + | ||
15 | +import javax.annotation.Resource; | ||
16 | +import java.math.BigDecimal; | ||
17 | +import java.util.ArrayList; | ||
18 | +import java.util.List; | ||
19 | + | ||
20 | +/** | ||
21 | + * @author 游杰 | ||
22 | + */ | ||
23 | +@Service | ||
24 | +public class MesServiceImpl implements IMesService { | ||
25 | + | ||
26 | + @Resource | ||
27 | + private IReceiptHeaderService receiptHeaderService; | ||
28 | + @Resource | ||
29 | + private IReceiptDetailService receiptDetailService; | ||
30 | + @Resource | ||
31 | + private IReceiveService receiveService; | ||
32 | + | ||
33 | + /** | ||
34 | + * 要求入库单详情 必须是不重样的 | ||
35 | + * @return | ||
36 | + */ | ||
37 | + @Override | ||
38 | + public Result receiptMaterial(MesReceiptMaterial mesReceiptMaterial, String warehouseCode) { | ||
39 | + List<Receive> receiveList = new ArrayList<>(); | ||
40 | + String referCode = mesReceiptMaterial.getReferCode(); | ||
41 | + String containerCode = mesReceiptMaterial.getContainerCode(); | ||
42 | + List<MaterialInfo> materialInfoList = mesReceiptMaterial.getMaterialInfoList(); | ||
43 | + ReceiptHeader receiptHeader = receiptHeaderService.getReceiptHeaderByReferCode(referCode, warehouseCode); | ||
44 | + List<ReceiptDetail> receiptDetailList = receiptDetailService.selectByMainId(String.valueOf(receiptHeader.getId())); | ||
45 | + for (ReceiptDetail receiptDetail : receiptDetailList) { | ||
46 | + String materialCode = receiptDetail.getMaterialCode(); | ||
47 | + boolean hav = false; | ||
48 | + for (MaterialInfo materialInfo : materialInfoList) { | ||
49 | + if(materialInfo.getMaterialCode().equals(materialCode)) { | ||
50 | + hav = true; | ||
51 | + } | ||
52 | + } | ||
53 | + if(hav) { | ||
54 | + Receive receive = new Receive(); | ||
55 | + receive.setId(receiptDetail.getId()); | ||
56 | + receive.setContainerCode(containerCode); | ||
57 | + receive.setMaterialCode(materialCode); | ||
58 | + receive.setMaterialName(receiptDetail.getMaterialName()); | ||
59 | + receive.setMateiralSpec(receiptDetail.getMaterialSpec()); | ||
60 | + receive.setMaterialUnit(receiptDetail.getMaterialUnit()); | ||
61 | + receive.setInventoryStatus(receiptDetail.getInventoryStatus()); | ||
62 | + receive.setQty(receiptDetail.getQty()); | ||
63 | + receive.setTaskQty(BigDecimal.ZERO); | ||
64 | + receiveList.add(receive); | ||
65 | + } | ||
66 | + } | ||
67 | + return receiveService.receiving(receiveList, warehouseCode); | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public Result shipmentMaterial(MesReceiptMaterial mesMaterial, String warehouseCode) { | ||
72 | + | ||
73 | + return null; | ||
74 | + } | ||
75 | +} |