diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/controller/ErpController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/controller/ErpController.java index 5586041..d42dac0 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/erp/controller/ErpController.java +++ b/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 { @ApiLogger(apiName = "出库单下发", from="ERP") public Result shipment(@RequestBody ErpShipment erpShipment, HttpServletRequest req) { String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); - Result result = handleMultiProcess("shipment", new JeecgController.MultiProcessListener() { - @Override - public Result doProcess() { - return erpService.shipment(erpShipment, warehouseCode); - } - }); - return result; + return erpService.shipment(erpShipment, warehouseCode); } @@ -73,21 +67,14 @@ public class ErpController extends BaseController { public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { String referCode = param.get("referCode"); String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); - Result result = handleMultiProcess("cancelShipment", new JeecgController.MultiProcessListener() { - @Override - public Result doProcess() { - return erpService.cancelShipment(referCode, warehouseCode); - } - }); - return result; + return erpService.cancelShipment(referCode, warehouseCode); } @PostMapping("/searchInventory") @ResponseBody @ApiLogger(apiName = "查询库存", from="ERP") public Result searchInventory(@RequestBody InventoryQueryParam inventoryQueryParam, HttpServletRequest req) { - String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); - Result result = erpService.searchInventory(inventoryQueryParam); + Result result = erpService.searchInventory(inventoryQueryParam); return result; } @@ -96,12 +83,6 @@ public class ErpController extends BaseController { @ApiLogger(apiName = "增加物料", from="ERP") public Result addMaterial(@RequestBody Material material, HttpServletRequest req) { String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); - Result result = handleMultiProcess("addMaterial", new JeecgController.MultiProcessListener() { - @Override - public Result doProcess() { - return erpService.addMaterial(material, warehouseCode); - } - }); - return result; + return erpService.addMaterial(material, warehouseCode); } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/controller/MesController.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/controller/MesController.java index 3796534..47c683e 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/controller/MesController.java +++ b/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; import org.jeecg.modules.wms.api.erp.entity.ErpShipment; import org.jeecg.modules.wms.api.erp.entity.InventoryQueryParam; import org.jeecg.modules.wms.api.erp.service.IErpService; +import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; +import org.jeecg.modules.wms.api.mes.servuce.IMesService; import org.jeecg.modules.wms.framework.aspectj.lang.annotation.ApiLogger; import org.jeecg.modules.wms.framework.controller.BaseController; import org.springframework.web.bind.annotation.*; @@ -24,10 +26,12 @@ public class MesController extends BaseController { @Resource private IErpService erpService; + @Resource + private IMesService mesService; @PostMapping("/receipt") @ResponseBody - @ApiLogger(apiName = "入库单下发", from="ERP") + @ApiLogger(apiName = "入库单下发", from="MES") public Result receipt(@RequestBody ErpReceipt erpReceipt, HttpServletRequest req) { String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); return erpService.receipt(erpReceipt, warehouseCode); @@ -35,7 +39,7 @@ public class MesController extends BaseController { @PostMapping("/cancelReceipt") @ResponseBody - @ApiLogger(apiName = "取消入库单", from="ERP") + @ApiLogger(apiName = "取消入库单", from="MES") public Result cancelReceipt(@RequestBody Map<String, String> param, HttpServletRequest req) { String referCode = param.get("referCode"); String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); @@ -45,41 +49,45 @@ public class MesController extends BaseController { @PostMapping("/shipment") @ResponseBody - @ApiLogger(apiName = "出库单下发", from="ERP") + @ApiLogger(apiName = "出库单下发", from="MES") public Result shipment(@RequestBody ErpShipment erpShipment, HttpServletRequest req) { String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); - Result result = handleMultiProcess("shipment", new JeecgController.MultiProcessListener() { - @Override - public Result doProcess() { - return erpService.shipment(erpShipment, warehouseCode); - } - }); - return result; + return erpService.shipment(erpShipment, warehouseCode); } @PostMapping("/cancelShipment") @ResponseBody - @ApiLogger(apiName = "取消出库单", from="ERP") + @ApiLogger(apiName = "取消出库单", from="MES") public Result cancelShipment(@RequestBody Map<String, String> param, HttpServletRequest req) { String referCode = param.get("referCode"); String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); - Result result = handleMultiProcess("cancelShipment", new JeecgController.MultiProcessListener() { - @Override - public Result doProcess() { - return erpService.cancelShipment(referCode, warehouseCode); - } - }); - return result; + return erpService.cancelShipment(referCode, warehouseCode); } @PostMapping("/searchInventory") @ResponseBody - @ApiLogger(apiName = "查询库存", from="ERP") + @ApiLogger(apiName = "查询库存", from="MES") public Result searchInventory(@RequestBody InventoryQueryParam inventoryQueryParam, HttpServletRequest req) { - Result result = erpService.searchInventory(inventoryQueryParam); + Result result = erpService.searchInventory(inventoryQueryParam); return result; } + @PostMapping("/receiptMaterial") + @ResponseBody + @ApiLogger(apiName = "物料入库", from="MES") + public Result receiptMaterial(@RequestBody MesReceiptMaterial mesReceiptMaterial, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = mesService.receiptMaterial(mesReceiptMaterial, warehouseCode); + return result; + } + @PostMapping("/shipmentMaterial") + @ResponseBody + @ApiLogger(apiName = "物料出库", from="MES") + public Result shipmentMaterial(@RequestBody MesReceiptMaterial mesReceiptMaterial, HttpServletRequest req) { + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); + Result result = mesService.shipmentMaterial(mesReceiptMaterial, warehouseCode); + return result; + } } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesMaterial.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MaterialInfo.java index 523913b..0859f71 100644 --- a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesMaterial.java +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MaterialInfo.java @@ -1,11 +1,13 @@ package org.jeecg.modules.wms.api.mes.entity; +import lombok.Data; + import java.math.BigDecimal; -public class MesMaterial { +@Data +public class MaterialInfo { private String materialCode; private BigDecimal qty; - } diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesReceiptMaterial.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesReceiptMaterial.java new file mode 100644 index 0000000..2d2068d --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/entity/MesReceiptMaterial.java @@ -0,0 +1,15 @@ +package org.jeecg.modules.wms.api.mes.entity; + +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +@Data +public class MesReceiptMaterial { + + private String referCode; + private String containerCode; + private List<MaterialInfo> materialInfoList; + +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/servuce/IMesService.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/servuce/IMesService.java new file mode 100644 index 0000000..efe4888 --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/servuce/IMesService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.wms.api.mes.servuce; + +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; + +/** + * @author 游杰 + */ +public interface IMesService { + + public Result receiptMaterial(MesReceiptMaterial mesReceiptMaterial, String warehouseCode); + + public Result shipmentMaterial(MesReceiptMaterial mesMaterial, String warehouseCode); +} diff --git a/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java new file mode 100644 index 0000000..173adff --- /dev/null +++ b/jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/api/mes/servuce/impl/MesServiceImpl.java @@ -0,0 +1,75 @@ +package org.jeecg.modules.wms.api.mes.servuce.impl; + +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.wms.api.mes.entity.MaterialInfo; +import org.jeecg.modules.wms.api.mes.entity.MesReceiptMaterial; +import org.jeecg.modules.wms.api.mes.servuce.IMesService; +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptDetail; +import org.jeecg.modules.wms.receipt.receiptHeader.entity.ReceiptHeader; +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptDetailService; +import org.jeecg.modules.wms.receipt.receiptHeader.service.IReceiptHeaderService; +import org.jeecg.modules.wms.receipt.receiving.domain.Receive; +import org.jeecg.modules.wms.receipt.receiving.service.IReceiveService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * @author 游杰 + */ +@Service +public class MesServiceImpl implements IMesService { + + @Resource + private IReceiptHeaderService receiptHeaderService; + @Resource + private IReceiptDetailService receiptDetailService; + @Resource + private IReceiveService receiveService; + + /** + * 要求入库单详情 必须是不重样的 + * @return + */ + @Override + public Result receiptMaterial(MesReceiptMaterial mesReceiptMaterial, String warehouseCode) { + List<Receive> receiveList = new ArrayList<>(); + String referCode = mesReceiptMaterial.getReferCode(); + String containerCode = mesReceiptMaterial.getContainerCode(); + List<MaterialInfo> materialInfoList = mesReceiptMaterial.getMaterialInfoList(); + ReceiptHeader receiptHeader = receiptHeaderService.getReceiptHeaderByReferCode(referCode, warehouseCode); + List<ReceiptDetail> receiptDetailList = receiptDetailService.selectByMainId(String.valueOf(receiptHeader.getId())); + for (ReceiptDetail receiptDetail : receiptDetailList) { + String materialCode = receiptDetail.getMaterialCode(); + boolean hav = false; + for (MaterialInfo materialInfo : materialInfoList) { + if(materialInfo.getMaterialCode().equals(materialCode)) { + hav = true; + } + } + if(hav) { + Receive receive = new Receive(); + receive.setId(receiptDetail.getId()); + receive.setContainerCode(containerCode); + receive.setMaterialCode(materialCode); + receive.setMaterialName(receiptDetail.getMaterialName()); + receive.setMateiralSpec(receiptDetail.getMaterialSpec()); + receive.setMaterialUnit(receiptDetail.getMaterialUnit()); + receive.setInventoryStatus(receiptDetail.getInventoryStatus()); + receive.setQty(receiptDetail.getQty()); + receive.setTaskQty(BigDecimal.ZERO); + receiveList.add(receive); + } + } + return receiveService.receiving(receiveList, warehouseCode); + } + + @Override + public Result shipmentMaterial(MesReceiptMaterial mesMaterial, String warehouseCode) { + + return null; + } +}