10) 形态转换

This commit is contained in:
李兴辉 2025-03-24 17:59:34 +08:00
parent b7667b55db
commit b54bd29f29
7 changed files with 44 additions and 19 deletions

View File

@ -31,11 +31,12 @@ import java.util.Map;
@Api("形态转换接口") @Api("形态转换接口")
@RestController @RestController
@RequestMapping("/api/MoveTransform") @RequestMapping("/MoveTransform")
@Slf4j @Slf4j
@EnableAutoConfiguration @EnableAutoConfiguration
public class MoveTransformController { public class MoveTransformController {
@Autowired
private MoveTransformService moveTransformService; private MoveTransformService moveTransformService;

View File

@ -24,4 +24,7 @@ public interface ToSapDao {
//基于出库单查询要操作的Box集合 //基于出库单查询要操作的Box集合
public List<MaterialPacking> getBoxListByShipRequestName(@Param("shipRequestName") String shipRequestName) throws Exception; public List<MaterialPacking> getBoxListByShipRequestName(@Param("shipRequestName") String shipRequestName) throws Exception;
//基于形态转换单更新物料编码
public void updateMaterialCode(@Param("boxList") List<MaterialPacking> boxList, @Param("unDoID") String unDoID) throws Exception;
} }

View File

@ -31,10 +31,12 @@ public class BarcodeListByInvoice {
@Data @Data
public class Barcode { public static class Barcode {
private String materialPackingName; private String materialPackingName;
private String locationName; private String locationName;
private String siteName;
} }
} }

View File

@ -61,6 +61,8 @@ public class AllocateStockInServiceImpl implements AllocateStockInService {
hashMap.put("stockState", "Stocked"); hashMap.put("stockState", "Stocked");
hashMap.put("erpLocation", erpLocation); hashMap.put("erpLocation", erpLocation);
hashMap.put("locationName", locationName); hashMap.put("locationName", locationName);
hashMap.put("shipRequestName", "");
hashMap.put("shipRequestDetailName", "");
setEventInfo.setUserColumns(hashMap); setEventInfo.setUserColumns(hashMap);
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(mpKeyList, eventInfo, setEventInfo); MaterialPackingServiceProxy.getMaterialPackingService().setEvent(mpKeyList, eventInfo, setEventInfo);
return ""; return "";

View File

@ -12,6 +12,7 @@ import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingKey
import com.cim.idm.wmspackage.materialpacking.management.info.MaterialPackingAssignShipRequestInfo; import com.cim.idm.wmspackage.materialpacking.management.info.MaterialPackingAssignShipRequestInfo;
import com.cim.idm.wmspackage.materialpacking.management.info.SetEventInfo; import com.cim.idm.wmspackage.materialpacking.management.info.SetEventInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -24,8 +25,9 @@ import java.util.Map;
@Slf4j @Slf4j
public class MoveTransformServiceImpl implements MoveTransformService { public class MoveTransformServiceImpl implements MoveTransformService {
@Autowired
private ToSAPServiceImpl toSAPServiceImpl; private ToSAPServiceImpl toSAPServiceImpl;
@Autowired
private ToSapDao toSapDao; private ToSapDao toSapDao;
@ -36,8 +38,8 @@ public class MoveTransformServiceImpl implements MoveTransformService {
* @throws Exception * @throws Exception
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public void AssignOrDessign(BarcodeListByInvoice barcodeListByInvoice) throws Exception { public String AssignOrDessign(BarcodeListByInvoice barcodeListByInvoice) throws Exception {
log.info("MoveTransformService AssignOrDessign {}", barcodeListByInvoice); log.info("MoveTransformService AssignOrDessign {}", barcodeListByInvoice);
List<BarcodeListByInvoice.Barcode> boxList = barcodeListByInvoice.getBoxList(); List<BarcodeListByInvoice.Barcode> boxList = barcodeListByInvoice.getBoxList();
String userId = barcodeListByInvoice.getUserId(); String userId = barcodeListByInvoice.getUserId();
@ -48,6 +50,7 @@ public class MoveTransformServiceImpl implements MoveTransformService {
List<MaterialPackingKey> mpkList = new ArrayList<>(); List<MaterialPackingKey> mpkList = new ArrayList<>();
for (BarcodeListByInvoice.Barcode barcode : boxList) { for (BarcodeListByInvoice.Barcode barcode : boxList) {
String materialPackingName = barcode.getMaterialPackingName(); String materialPackingName = barcode.getMaterialPackingName();
siteName = barcode.getSiteName();
MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName, materialPackingName); MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName, materialPackingName);
mpkList.add(materialPackingKey); mpkList.add(materialPackingKey);
com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking materialPacking1 = com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking materialPacking1 =
@ -82,9 +85,9 @@ public class MoveTransformServiceImpl implements MoveTransformService {
break; break;
case "Dessign": case "Dessign":
EventInfo eventInfo1 = EventInfoUtil.makeEventInfo("Dessign", userId, "解绑单据"); EventInfo eventInfo1 = EventInfoUtil.makeEventInfo("Dessign", userId, "解绑单据");
assignShipRequestInfo.setShipRequestName(shipRequestName); assignShipRequestInfo.setShipRequestName("");
assignShipRequestInfo assignShipRequestInfo
.setShipRequestDetailName(shipRequestDetailName); .setShipRequestDetailName("");
MaterialPackingServiceProxy.getMaterialPackingService() MaterialPackingServiceProxy.getMaterialPackingService()
.assignShipRequest(mpkList, eventInfo1, .assignShipRequest(mpkList, eventInfo1,
assignShipRequestInfo); assignShipRequestInfo);
@ -92,6 +95,7 @@ public class MoveTransformServiceImpl implements MoveTransformService {
default: default:
break; break;
} }
return "";
} }
@ -102,37 +106,37 @@ public class MoveTransformServiceImpl implements MoveTransformService {
* @throws Exception * @throws Exception
*/ */
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public void MoveTransform(BarcodeListByInvoice barcodeListByInvoice) throws Exception { public String MoveTransform(BarcodeListByInvoice barcodeListByInvoice) throws Exception {
log.info("MoveTransformService MoveTransform {}", barcodeListByInvoice); log.info("MoveTransformService MoveTransform {}", barcodeListByInvoice);
String siteName = barcodeListByInvoice.getSiteName(); String siteName = barcodeListByInvoice.getSiteName();
String user = barcodeListByInvoice.getUserId(); String user = barcodeListByInvoice.getUserId();
String erpLocation = barcodeListByInvoice.getErpLocation(); // String erpLocation = barcodeListByInvoice.getErpLocation();
String locationName = barcodeListByInvoice.getLocationName(); // String locationName = barcodeListByInvoice.getLocationName();
String shipRequestName = barcodeListByInvoice.getShipRequestName(); String shipRequestName = barcodeListByInvoice.getShipRequestName();
//提交SAP过账 //提交SAP过账
String undoId = toSAPServiceImpl.ChangeStateStockOut(shipRequestName, siteName, String undoId = toSAPServiceImpl.ChangeStateStockOut(shipRequestName, siteName,
barcodeListByInvoice.getUserId()); barcodeListByInvoice.getUserId());
//更新库存状态和仓库 //更新库存状态和仓库
List<MaterialPacking> boxListByShipRequestName = toSapDao.getBoxListByShipRequestName(shipRequestName); List<MaterialPacking> boxListByShipRequestName = toSapDao.getBoxListByShipRequestName(shipRequestName);
toSapDao.updateStockState(boxListByShipRequestName, "Stocked", undoId); toSapDao.updateMaterialCode(boxListByShipRequestName, undoId);
//更新库存状态和仓库 //更新库存状态和仓库
List<MaterialPackingKey> mpKeyList = new ArrayList<>(); List<MaterialPackingKey> mpKeyList = new ArrayList<>();
for (MaterialPacking box : boxListByShipRequestName) { for (MaterialPacking box : boxListByShipRequestName) {
mpKeyList.add(new MaterialPackingKey("SDK", box.getMaterialPackingName())); mpKeyList.add(new MaterialPackingKey("SDK", box.getMaterialPackingName()));
} }
EventInfo eventInfo = EventInfoUtil.makeEventInfo("allocateStockIn", user, "调拨入库"); EventInfo eventInfo = EventInfoUtil.makeEventInfo("moveTransform", user, "形态转换");
SetEventInfo setEventInfo = new SetEventInfo(); SetEventInfo setEventInfo = new SetEventInfo();
Map<String, Object> hashMap = new HashMap<>(); Map<String, Object> hashMap = new HashMap<>();
hashMap.put("stockState", "Stocked"); hashMap.put("stockState", "Stocked");
hashMap.put("erpLocation", erpLocation); hashMap.put("shipRequestName", "");
hashMap.put("locationName", locationName); hashMap.put("shipRequestDetailName", "");
setEventInfo.setUserColumns(hashMap); setEventInfo.setUserColumns(hashMap);
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(mpKeyList, eventInfo, setEventInfo); MaterialPackingServiceProxy.getMaterialPackingService().setEvent(mpKeyList, eventInfo, setEventInfo);
//保存物料凭证 //保存物料凭证
toSapDao.saveUnDoInfo(boxListByShipRequestName, undoId, ""); toSapDao.saveUnDoInfo(boxListByShipRequestName, undoId, "");
//记录出入库流水 //记录出入库流水
return "";
} }
} }

View File

@ -9,12 +9,12 @@ public interface MoveTransformService {
* @param barcodeListByInvoice * @param barcodeListByInvoice
* @throws Exception * @throws Exception
*/ */
public void AssignOrDessign(BarcodeListByInvoice barcodeListByInvoice) throws Exception; public String AssignOrDessign(BarcodeListByInvoice barcodeListByInvoice) throws Exception;
/** /**
* 形态转换提交 * 形态转换提交
* @param barcodeListByInvoice * @param barcodeListByInvoice
* @throws Exception * @throws Exception
*/ */
void MoveTransform(BarcodeListByInvoice barcodeListByInvoice) throws Exception; String MoveTransform(BarcodeListByInvoice barcodeListByInvoice) throws Exception;
} }

View File

@ -43,6 +43,19 @@
#{box.materialPackingName} #{box.materialPackingName}
</foreach> </foreach>
</update> </update>
<!-- 基于形态转换更新物料编码-->
<update id="updateMaterialCode" parameterType="map">
UPDATE MATERIALPACKING m
JOIN MATERIALSHIPREQUESTDETAIL mpsrd
ON m.SHIPREQUESTNAME = mpsrd.SHIPREQUESTNAME
AND m.MATERIALPACKINGNAME = mpsrd.SHIPREQUESTDETAILNAME
SET m.MATERIALSPECNAME = mpsrd.GOALMATERIALSPEC,m.UNDOID = #{undoId}
WHERE m.MATERIALPACKINGNAME IN
<foreach item="box" index="index" collection="boxList" open="(" separator="," close=")">
#{box.materialPackingName}
</foreach>
</update>
<!-- 保存未完成信息 --> <!-- 保存未完成信息 -->
<insert id="saveUnDoInfo" parameterType="map"> <insert id="saveUnDoInfo" parameterType="map">