|
@ -1,11 +1,18 @@ |
|
|
package com.ruoyi.system.service.impl; |
|
|
package com.ruoyi.system.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import com.ruoyi.system.domain.OutsourceMaterial; |
|
|
import com.ruoyi.system.domain.OutsourceMaterial; |
|
|
|
|
|
import com.ruoyi.system.domain.SysMakeorderPickDetail; |
|
|
import com.ruoyi.system.mapper.OutsourceMaterialMapper; |
|
|
import com.ruoyi.system.mapper.OutsourceMaterialMapper; |
|
|
|
|
|
import com.ruoyi.system.mapper.SysMakeorderPickDetailMapper; |
|
|
|
|
|
import com.ruoyi.warehouse.domain.WarehouseInventoryInquiry; |
|
|
|
|
|
import com.ruoyi.warehouse.mapper.WarehouseInventoryInquiryMapper; |
|
|
import org.apache.poi.util.StringUtil; |
|
|
import org.apache.poi.util.StringUtil; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
@ -29,6 +36,12 @@ public class SysMakeorderBomServiceImpl implements ISysMakeorderBomService |
|
|
@Autowired |
|
|
@Autowired |
|
|
private OutsourceMaterialMapper outsourceMaterialMapper; |
|
|
private OutsourceMaterialMapper outsourceMaterialMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WarehouseInventoryInquiryMapper inquiryMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private SysMakeorderPickDetailMapper pickDetailMapper; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询生产订单BOM信息 |
|
|
* 查询生产订单BOM信息 |
|
|
* |
|
|
* |
|
@ -52,6 +65,27 @@ public class SysMakeorderBomServiceImpl implements ISysMakeorderBomService |
|
|
{ |
|
|
{ |
|
|
List<SysMakeorderBom> makeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomList(sysMakeorderBom); |
|
|
List<SysMakeorderBom> makeorderBoms = sysMakeorderBomMapper.selectSysMakeorderBomList(sysMakeorderBom); |
|
|
for (SysMakeorderBom bom:makeorderBoms) { |
|
|
for (SysMakeorderBom bom:makeorderBoms) { |
|
|
|
|
|
// 获取已领料数
|
|
|
|
|
|
SysMakeorderPickDetail tempDetail = new SysMakeorderPickDetail(); |
|
|
|
|
|
tempDetail.setMakeNo(sysMakeorderBom.getMakeNo()); |
|
|
|
|
|
tempDetail.setMaterialNo(bom.getMaterialNo()); |
|
|
|
|
|
List<SysMakeorderPickDetail> pickDetails = pickDetailMapper.selectSysMakeorderPickDetailList(tempDetail); |
|
|
|
|
|
if(CollectionUtil.isEmpty(pickDetails)){ |
|
|
|
|
|
bom.setHasPickNum(0); |
|
|
|
|
|
}else{ |
|
|
|
|
|
int pickNum = pickDetails.stream() |
|
|
|
|
|
.mapToInt(detail -> Math.toIntExact(detail.getPickNum() != null ? Math.toIntExact(detail.getPickNum()) : 0)) |
|
|
|
|
|
.sum(); |
|
|
|
|
|
bom.setHasPickNum(pickNum); |
|
|
|
|
|
} |
|
|
|
|
|
// 获取可用库存数
|
|
|
|
|
|
WarehouseInventoryInquiry inquiry = inquiryMapper.selectWarehouseInventoryInquiryByMaterialNo(bom.getMaterialNo()); |
|
|
|
|
|
if(inquiry == null){ |
|
|
|
|
|
bom.setStorageNum(BigDecimal.ZERO); |
|
|
|
|
|
}else{ |
|
|
|
|
|
bom.setStorageNum(inquiry.getAvailableStockNum()); |
|
|
|
|
|
} |
|
|
|
|
|
// 处理委外加工类型物料,获取委外工序数
|
|
|
if(bom.getProcessMethod().equals("2")){ |
|
|
if(bom.getProcessMethod().equals("2")){ |
|
|
List<OutsourceMaterial> materials = outsourceMaterialMapper.selectProcessNoByNo(bom.getMaterialNo()); |
|
|
List<OutsourceMaterial> materials = outsourceMaterialMapper.selectProcessNoByNo(bom.getMaterialNo()); |
|
|
if(StringUtils.isEmpty(materials)){ |
|
|
if(StringUtils.isEmpty(materials)){ |
|
|