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("形态转换接口")
@RestController
@RequestMapping("/api/MoveTransform")
@RequestMapping("/MoveTransform")
@Slf4j
@EnableAutoConfiguration
public class MoveTransformController {
@Autowired
private MoveTransformService moveTransformService;

View File

@ -24,4 +24,7 @@ public interface ToSapDao {
//基于出库单查询要操作的Box集合
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
public class Barcode {
public static class Barcode {
private String materialPackingName;
private String locationName;
private String siteName;
}
}

View File

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

View File

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

View File

@ -43,6 +43,19 @@
#{box.materialPackingName}
</foreach>
</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">