Compare commits

...

2 Commits

Author SHA1 Message Date
李兴辉
cc51418900 Merge remote-tracking branch 'origin/main' 2025-03-24 14:40:29 +08:00
李兴辉
f5a5206620 9) 调拨入库 2025-03-24 14:40:15 +08:00
6 changed files with 177 additions and 0 deletions

View File

@ -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<Object> 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);
}
}

View File

@ -21,4 +21,7 @@ public interface ToSapDao {
//基于boxList写入过账流水表
public void saveUnDoInfo(@Param("boxList") List<MaterialPacking> boxList, @Param("unDoID") String unDoID, @Param("commitDate") String commitDate) throws Exception;
//基于出库单查询要操作的Box集合
public List<MaterialPacking> getBoxListByShipRequestName(@Param("shipRequestName") String shipRequestName) throws Exception;
}

View File

@ -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<Barcode> boxList;
public class Barcode {
private String materialPackingName;
private String locationName;
}
}

View File

@ -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;
}

View File

@ -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<MaterialPacking> boxList = toSapDao.getBoxListByShipRequestName(shipRequestName);
//保存物料凭证
toSapDao.updateStockState(boxList, "Stocked", undoId);
//记录出入库流水
toSapDao.saveUnDoInfo(boxList, undoId, "");
//更新库存状态和仓库
List<MaterialPackingKey> 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<String, Object> 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 "";
}
}

View File

@ -27,6 +27,12 @@
m.PACKINGGRADE,m.MATERIALSPECTYPE
</select>
<select id="getBoxListByShipRequestName"
resultType="com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking">
SELECT
m.MATERIALPACKINGNAME , SITENAME FROM MATERIALPACKING m
WHERE SHIPREQUESTNAME = #{shipRequestName}
</select>
<!-- 更新库存状态 -->
<update id="updateStockState" parameterType="map">