|
|
|
@ -191,6 +191,16 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
transCommonRequestDto.setSourceNo(returnDto.getWorkOrderNo()); |
|
|
|
|
|
|
|
Double seqNo = 1.0; |
|
|
|
List<Location> allLocation = productionReturnMapper.getAllLocation(returnDto.getSite()); |
|
|
|
Map<String, String> locationWarehouseMap = allLocation.stream() |
|
|
|
.filter(loc -> loc != null |
|
|
|
&& loc.getLocationId() != null |
|
|
|
&& !loc.getLocationId().trim().isEmpty()) |
|
|
|
.collect(Collectors.toMap( |
|
|
|
loc -> loc.getLocationId().trim(), |
|
|
|
Location::getWarehouseId, |
|
|
|
(oldVal, newVal) -> newVal |
|
|
|
)); |
|
|
|
// 处理每个选择的物料 |
|
|
|
for (WorkOrderMaterialDto material : returnDto.getSelectedMaterials()) { |
|
|
|
// 创建出库记录详情 |
|
|
|
@ -199,8 +209,11 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
subDto.setPartNo(returnDto.getComponentPartNo()); |
|
|
|
subDto.setSubNo(material.getLabelCode()); |
|
|
|
subDto.setBatchNo(material.getBatchNo()); |
|
|
|
subDto.setWarehouseId(material.getWarehouseId()); |
|
|
|
subDto.setLocationId(material.getLocationId()); |
|
|
|
String targetWarehouseId = locationWarehouseMap.get(material.getLocationId()); |
|
|
|
if (targetWarehouseId != null) { |
|
|
|
subDto.setWarehouseId(targetWarehouseId); |
|
|
|
} |
|
|
|
subDto.setTransQty(material.getIssueQty().toString()); |
|
|
|
subDto.setDirection("+"); |
|
|
|
subDto.setWdrNo(material.getWdrNo()); |
|
|
|
@ -230,7 +243,10 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
HandlingUnit hu = new HandlingUnit(); |
|
|
|
hu.setUnitId(material.getLabelCode()); |
|
|
|
hu.setLocationId(material.getLocationId()); |
|
|
|
|
|
|
|
String targetWarehouseId = locationWarehouseMap.get(material.getLocationId()); |
|
|
|
if (targetWarehouseId != null) { |
|
|
|
hu.setWarehouseId(targetWarehouseId); |
|
|
|
} |
|
|
|
String unitId = material.getLabelCode(); |
|
|
|
if (unitId != null && huMap.containsKey(unitId)) { |
|
|
|
//减去要出的hu上的数量 |
|
|
|
@ -348,6 +364,16 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
transCommonRequestDto.setSourceNo(returnDto.getNotifyNo()); |
|
|
|
|
|
|
|
Double seqNo = 1.0; |
|
|
|
List<Location> allLocation = productionReturnMapper.getAllLocation(returnDto.getSite()); |
|
|
|
Map<String, String> locationWarehouseMap = allLocation.stream() |
|
|
|
.filter(loc -> loc != null |
|
|
|
&& loc.getLocationId() != null |
|
|
|
&& !loc.getLocationId().trim().isEmpty()) |
|
|
|
.collect(Collectors.toMap( |
|
|
|
loc -> loc.getLocationId().trim(), |
|
|
|
Location::getWarehouseId, |
|
|
|
(oldVal, newVal) -> newVal |
|
|
|
)); |
|
|
|
// 处理每个选择的物料 |
|
|
|
for (WorkOrderMaterialDto material : returnDto.getSelectedMaterials()) { |
|
|
|
// 验证物料匹配 |
|
|
|
@ -369,8 +395,12 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
subDto.setPartNo(returnDto.getComponentPartNo()); |
|
|
|
subDto.setSubNo(material.getLabelCode()); |
|
|
|
subDto.setBatchNo(material.getBatchNo()); |
|
|
|
subDto.setWarehouseId(material.getWarehouseId()); |
|
|
|
subDto.setLocationId(material.getLocationId()); |
|
|
|
String targetWarehouseId = locationWarehouseMap.get(material.getLocationId()); |
|
|
|
if (targetWarehouseId != null) { |
|
|
|
subDto.setWarehouseId(targetWarehouseId); |
|
|
|
} |
|
|
|
|
|
|
|
subDto.setTransQty(material.getIssueQty().toString()); |
|
|
|
subDto.setDirection("+"); |
|
|
|
subDto.setWdrNo(material.getWdrNo()); |
|
|
|
@ -401,7 +431,11 @@ public class ProductionReturnServiceImpl implements ProductionReturnService { |
|
|
|
for (WorkOrderMaterialDto material : returnDto.getSelectedMaterials()) { |
|
|
|
HandlingUnit hu = new HandlingUnit(); |
|
|
|
hu.setUnitId(material.getLabelCode()); |
|
|
|
hu.setLocationId(material.getLocationId()); |
|
|
|
hu.setWarehouseId(material.getWarehouseId()); |
|
|
|
String targetWarehouseId = locationWarehouseMap.get(material.getLocationId()); |
|
|
|
if (targetWarehouseId != null) { |
|
|
|
hu.setWarehouseId(targetWarehouseId); |
|
|
|
} |
|
|
|
|
|
|
|
String unitId = material.getLabelCode(); |
|
|
|
if (unitId != null && huMap.containsKey(unitId)) { |
|
|
|
|