From f5a52066206de5f6cc03cee1b4ebf6f43c6453b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=85=B4=E8=BE=89?= Date: Mon, 24 Mar 2025 14:40:15 +0800 Subject: [PATCH] =?UTF-8?q?9)=20=E8=B0=83=E6=8B=A8=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AllocateStockInController.java | 52 ++++++++++++++ .../main/java/com/cim/idm/dao/ToSapDao.java | 3 + .../cim/idm/model/BarcodeListByInvoice.java | 33 +++++++++ .../idm/service/AllocateStockInService.java | 15 ++++ .../Impl/AllocateStockInServiceImpl.java | 68 +++++++++++++++++++ .../resources/com/cim/idm/dao/ToSapDao.xml | 6 ++ 6 files changed, 177 insertions(+) create mode 100644 zi-wms-pda/src/main/java/com/cim/idm/controller/AllocateStockInController.java create mode 100644 zi-wms-pda/src/main/java/com/cim/idm/model/BarcodeListByInvoice.java create mode 100644 zi-wms-pda/src/main/java/com/cim/idm/service/AllocateStockInService.java create mode 100644 zi-wms-pda/src/main/java/com/cim/idm/service/Impl/AllocateStockInServiceImpl.java diff --git a/zi-wms-pda/src/main/java/com/cim/idm/controller/AllocateStockInController.java b/zi-wms-pda/src/main/java/com/cim/idm/controller/AllocateStockInController.java new file mode 100644 index 0000000..c154c57 --- /dev/null +++ b/zi-wms-pda/src/main/java/com/cim/idm/controller/AllocateStockInController.java @@ -0,0 +1,52 @@ +package com.cim.idm.controller; + +import com.alibaba.fastjson.JSONObject; +import com.cim.idm.model.BarcodeListByInvoice; +import com.cim.idm.model.HoldAndReleaseDto; +import com.cim.idm.response.BaseResponse; +import com.cim.idm.response.RespGenerator; +import com.cim.idm.service.AllocateStockInService; +import com.cim.idm.utils.AjaxResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiParam; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@RestController +@RequestMapping("/AllocateStockIn") +@Slf4j +@Api(tags = "调拨入库") +public class AllocateStockInController { + + private AllocateStockInService allocateStockInService; + + /** + * 调拨入库过账 + * @param request + * @param response + * @param barcodeListByInvoice + * @return + */ + @RequestMapping(value = "/commit", method = RequestMethod.POST) + public BaseResponse commit(HttpServletRequest request, + HttpServletResponse response, + @ApiParam(value = "调拨入库参数", required = true) @RequestBody BarcodeListByInvoice barcodeListByInvoice) { + log.info("AllocateStockInController commit {}", barcodeListByInvoice); + try { + allocateStockInService.allocateStockIn(barcodeListByInvoice.getShipRequestName(), + barcodeListByInvoice.getSiteName(), + barcodeListByInvoice.getUserId(), + barcodeListByInvoice.getErpLocation(),barcodeListByInvoice.getLocationName()) + } catch (Exception e) { + return RespGenerator.returnError(e.toString()); + } + + return RespGenerator.returnOK(null); + } +} diff --git a/zi-wms-pda/src/main/java/com/cim/idm/dao/ToSapDao.java b/zi-wms-pda/src/main/java/com/cim/idm/dao/ToSapDao.java index c23086f..1ff104c 100644 --- a/zi-wms-pda/src/main/java/com/cim/idm/dao/ToSapDao.java +++ b/zi-wms-pda/src/main/java/com/cim/idm/dao/ToSapDao.java @@ -21,4 +21,7 @@ public interface ToSapDao { //基于boxList写入过账流水表 public void saveUnDoInfo(@Param("boxList") List boxList, @Param("unDoID") String unDoID, @Param("commitDate") String commitDate) throws Exception; + + //基于出库单查询要操作的Box集合 + public List getBoxListByShipRequestName(@Param("shipRequestName") String shipRequestName) throws Exception; } diff --git a/zi-wms-pda/src/main/java/com/cim/idm/model/BarcodeListByInvoice.java b/zi-wms-pda/src/main/java/com/cim/idm/model/BarcodeListByInvoice.java new file mode 100644 index 0000000..7d3eaf5 --- /dev/null +++ b/zi-wms-pda/src/main/java/com/cim/idm/model/BarcodeListByInvoice.java @@ -0,0 +1,33 @@ +package com.cim.idm.model; + +import lombok.Data; + +import java.util.List; + +@Data +public class BarcodeListByInvoice { + + private String siteName; + + private String userId; + + private String receiveRequestName; + + private String shipRequestName; + + private String erpFactory; + + private String erpLocation; + + private String locationName; + + private List boxList; + + + public class Barcode { + + private String materialPackingName; + + private String locationName; + } +} diff --git a/zi-wms-pda/src/main/java/com/cim/idm/service/AllocateStockInService.java b/zi-wms-pda/src/main/java/com/cim/idm/service/AllocateStockInService.java new file mode 100644 index 0000000..02925d5 --- /dev/null +++ b/zi-wms-pda/src/main/java/com/cim/idm/service/AllocateStockInService.java @@ -0,0 +1,15 @@ +package com.cim.idm.service; + +public interface AllocateStockInService { + + /** + * 调拨入库提交 + * @param shipRequestName + * @param siteName + * @param user + * @param erpLocation + * @return + * @throws Exception + */ + public String allocateStockIn(String shipRequestName, String siteName, String user,String erpLocation ,String locationName) throws Exception; +} diff --git a/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/AllocateStockInServiceImpl.java b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/AllocateStockInServiceImpl.java new file mode 100644 index 0000000..2f3db08 --- /dev/null +++ b/zi-wms-pda/src/main/java/com/cim/idm/service/Impl/AllocateStockInServiceImpl.java @@ -0,0 +1,68 @@ +package com.cim.idm.service.Impl; + +import com.cim.idm.dao.ToSapDao; +import com.cim.idm.framework.data.EventInfo; +import com.cim.idm.service.AllocateStockInService; +import com.cim.idm.service.impl.ToSAPServiceImpl; +import com.cim.idm.utils.EventInfoUtil; +import com.cim.idm.wmspackage.materialpacking.MaterialPackingServiceProxy; +import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking; +import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingKey; +import com.cim.idm.wmspackage.materialpacking.management.info.SetEventInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service("AllocateStockInService") +@Slf4j +public class AllocateStockInServiceImpl implements AllocateStockInService { + + @Autowired + private ToSAPServiceImpl toSAPServiceImpl; + + @Autowired + private ToSapDao toSapDao; + /** + * 调拨入库提交 + * + * @param shipRequestName + * @param siteName + * @param user + * @param erpLocation + * @return + * @throws Exception + */ + @Override + @Transactional + public String allocateStockIn(String shipRequestName, String siteName, String user, String erpLocation,String locationName) throws Exception { + log.debug("AllocateStockInServiceImpl.allocateStockIn {} {} {} {}", shipRequestName, siteName, user, erpLocation); + //提交SAP过账 + String undoId = toSAPServiceImpl.AlloctionStockIn(shipRequestName, siteName, user, erpLocation); + //基于单据获取要操作的Box + List boxList = toSapDao.getBoxListByShipRequestName(shipRequestName); + //保存物料凭证 + toSapDao.updateStockState(boxList, "Stocked", undoId); + //记录出入库流水 + toSapDao.saveUnDoInfo(boxList, undoId, ""); + //更新库存状态和仓库 + List mpKeyList = new ArrayList<>(); + for (MaterialPacking box : boxList) { + mpKeyList.add(new MaterialPackingKey("SDK", box.getMaterialPackingName())); + } + EventInfo eventInfo = EventInfoUtil.makeEventInfo("allocateStockIn", user, "调拨入库"); + SetEventInfo setEventInfo = new SetEventInfo(); + Map hashMap = new HashMap<>(); + hashMap.put("stockState", "Stocked"); + hashMap.put("erpLocation", erpLocation); + hashMap.put("locationName", locationName); + setEventInfo.setUserColumns(hashMap); + MaterialPackingServiceProxy.getMaterialPackingService().setEvent(mpKeyList, eventInfo, setEventInfo); + return ""; + } +} diff --git a/zi-wms-pda/src/main/resources/com/cim/idm/dao/ToSapDao.xml b/zi-wms-pda/src/main/resources/com/cim/idm/dao/ToSapDao.xml index a9483fb..9283c23 100644 --- a/zi-wms-pda/src/main/resources/com/cim/idm/dao/ToSapDao.xml +++ b/zi-wms-pda/src/main/resources/com/cim/idm/dao/ToSapDao.xml @@ -27,6 +27,12 @@ m.PACKINGGRADE,m.MATERIALSPECTYPE +