|
|
@ -8,6 +8,7 @@ import com.ruoyi.common.exception.BusinessException; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
import com.ruoyi.erp.domain.*; |
|
|
|
import com.ruoyi.erp.mapper.ErpDevelopModifyorderDetailMapper; |
|
|
|
import com.ruoyi.erp.mapper.ErpDevelopModifyorderPickingDetailMapper; |
|
|
|
import com.ruoyi.erp.service.IErpBomService; |
|
|
|
import com.ruoyi.purchase.domain.PurchasePlanChild; |
|
|
@ -41,6 +42,9 @@ public class ErpDevelopModifyorderPickingServiceImpl implements IErpDevelopModif |
|
|
|
@Autowired |
|
|
|
private IErpBomService erpBomService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ErpDevelopModifyorderDetailMapper modifyorderDetailMapper; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询开发修改单领料 |
|
|
|
* |
|
|
@ -155,14 +159,14 @@ public class ErpDevelopModifyorderPickingServiceImpl implements IErpDevelopModif |
|
|
|
log.warn("开发修改单领料主表数据为空"); |
|
|
|
} |
|
|
|
|
|
|
|
int countAllMaterialNum = 0; |
|
|
|
|
|
|
|
for (ErpDevelopModifyorderDetail erpDevelopModifyorderDetail : developModifyorderDetailList) { |
|
|
|
ErpBom erpBom = new ErpBom(); |
|
|
|
erpBom.setId(Long.valueOf(erpDevelopModifyorderDetail.getBomId())); |
|
|
|
List<ErpBom> erpBoms = erpBomService.selectErpBomAllLevelList(erpBom); |
|
|
|
countAllMaterialNum += erpBoms.size(); |
|
|
|
} |
|
|
|
int countAllMaterialNum = developModifyorderDetailList.stream() |
|
|
|
.mapToInt(detail -> { |
|
|
|
ErpBom erpBom = new ErpBom(); |
|
|
|
erpBom.setId(Long.valueOf(detail.getBomId())); |
|
|
|
List<ErpBom> erpBoms = erpBomService.selectErpBomAllLevelList(erpBom); |
|
|
|
return erpBoms.size(); |
|
|
|
}) |
|
|
|
.sum(); |
|
|
|
countAllMaterialNum -= developModifyorderDetailList.size(); |
|
|
|
if (erpDevelopModifyorder.getDevelopModifyorderPickingDetails().size() < countAllMaterialNum){ |
|
|
|
throw new BusinessException("请将所有物料数据展开,并填写本次领料数!"); |
|
|
@ -228,11 +232,30 @@ public class ErpDevelopModifyorderPickingServiceImpl implements IErpDevelopModif |
|
|
|
int enterpriseSum = filterPickingDetail.stream().mapToInt(ErpDevelopModifyorderPickingDetail::getPickNum).sum(); |
|
|
|
developModifyorderPicking.setEnterpriseSum(enterpriseSum); |
|
|
|
|
|
|
|
//插入领料子表数据
|
|
|
|
bulidPickingDetail(erpDevelopModifyorder, pickingOrderCode, loginName, developModifyorderPickingDetails); |
|
|
|
|
|
|
|
|
|
|
|
return erpDevelopModifyorderPickingMapper.insertErpDevelopModifyorderPicking(developModifyorderPicking); |
|
|
|
} |
|
|
|
|
|
|
|
//插入领料子表数据
|
|
|
|
private void bulidPickingDetail(ErpDevelopModifyorder erpDevelopModifyorder, String pickingOrderCode, String loginName, List<ErpDevelopModifyorderPickingDetail> developModifyorderPickingDetails) { |
|
|
|
for (ErpDevelopModifyorderPickingDetail developModifyorderPickingDetail : developModifyorderPickingDetails) { |
|
|
|
if (developModifyorderPickingDetail.getPickNum() != null){ |
|
|
|
ErpDevelopModifyorderDetail modifyorderDetail = new ErpDevelopModifyorderDetail(); |
|
|
|
modifyorderDetail.setBomId(Math.toIntExact(developModifyorderPickingDetail.getBomId())); |
|
|
|
modifyorderDetail.setDevelopOrderCode(erpDevelopModifyorder.getDevelopOrderCode()); |
|
|
|
ErpDevelopModifyorderDetail tempModifyorderDetail = modifyorderDetailMapper.selectModifyorderDetailByCodeAndId(modifyorderDetail); |
|
|
|
|
|
|
|
Integer materialNum = tempModifyorderDetail.getMaterialNum(); |
|
|
|
Integer useNum = developModifyorderPickingDetail.getUseNum(); |
|
|
|
developModifyorderPickingDetail.setOrderUseNum(materialNum * useNum); |
|
|
|
developModifyorderPickingDetail.setUseNum(useNum); |
|
|
|
developModifyorderPickingDetail.setPickingOrderCode(pickingOrderCode); |
|
|
|
developModifyorderPickingDetail.setDevelopOderCode(erpDevelopModifyorder.getDevelopOrderCode()); |
|
|
|
developModifyorderPickingDetail.setMakeNo(erpDevelopModifyorder.getMakeNo()); |
|
|
|
|
|
|
|
developModifyorderPickingDetail.setPickNum(developModifyorderPickingDetail.getPickNum()); |
|
|
|
//已领料数
|
|
|
|
developModifyorderPickingDetail.setHasPickNum(developModifyorderPickingDetail.getPickNum()); |
|
|
@ -248,23 +271,18 @@ public class ErpDevelopModifyorderPickingServiceImpl implements IErpDevelopModif |
|
|
|
developModifyorderPickingDetail.setBomId(Long.valueOf(developModifyorderPickingDetail.getBomId())); |
|
|
|
developModifyorderPickingDetail.setWarehouseDept(developModifyorderPickingDetail.getWarehouseDept()); |
|
|
|
developModifyorderPickingDetail.setAvailableStockNum(developModifyorderPickingDetail.getAvailableStockNum()); |
|
|
|
developModifyorderPickingDetail.setMakeNo(developModifyorderPickingDetail.getMakeNo()); |
|
|
|
|
|
|
|
developModifyorderPickingDetail.setPickUser(erpDevelopModifyorder.getPickingUser()); |
|
|
|
developModifyorderPickingDetail.setBomNo(developModifyorderPickingDetail.getBomNo()); |
|
|
|
developModifyorderPickingDetail.setLevel(developModifyorderPickingDetail.getLevel()); |
|
|
|
developModifyorderPickingDetail.setCreateTime(new Date()); |
|
|
|
developModifyorderPickingDetail.setCreateBy(loginName); |
|
|
|
pickingDetailMapper.insertErpDevelopModifyorderPickingDetail(developModifyorderPickingDetail); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return erpDevelopModifyorderPickingMapper.insertErpDevelopModifyorderPicking(developModifyorderPicking); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<ErpDevelopModifyorderPickingDetail> mergePickingDetailList(List<ErpDevelopModifyorderPickingDetail> pickingDetailList) { |
|
|
|
Map<String, ErpDevelopModifyorderPickingDetail> aggregatedMap = new HashMap<>(); |
|
|
|
|
|
|
|