补正入库方法,跑通流程
This commit is contained in:
parent
8f548f45be
commit
32015dd9db
@ -46,6 +46,7 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_so(采购单领料单)】的数据库操作Service实现
|
||||
@ -109,6 +110,14 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
@Override
|
||||
public void createRepairSo(DlRepairSoRespVO repairSoRespVO) {
|
||||
repairSoRespVO.setSoTime(new Date());
|
||||
// 加个判断,可能出现没有设置价格的情况
|
||||
if (repairSoRespVO.getGoodsList() != null){
|
||||
repairSoRespVO.getGoodsList().forEach(item -> {
|
||||
if (item.getGoodsPrice() == null){
|
||||
throw exception0(500, "有配件未设置进价");
|
||||
}
|
||||
});
|
||||
}
|
||||
//保存供应商
|
||||
if (StringUtils.isEmpty(repairSoRespVO.getSupplierId())){
|
||||
//采购单中录入供应商或无供应商情况
|
||||
@ -500,8 +509,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
List<DlRepairSoi> pmsWaresList = repairSoiService.listByIds(filterWare.stream().map(DlRepairSoi::getId).collect(Collectors.toList()));
|
||||
//初始化本次入库采购品
|
||||
List<DlRepairSoi> inWaresList = new ArrayList<>();
|
||||
//原始配件库相关配件
|
||||
List<RepairWares> waresList = waresService.listByIds(pmsWaresList.stream().map(DlRepairSoi::getWareId).collect(Collectors.toList()));
|
||||
//原始配件库相关配件---不是用wareId,是用GoodsId,wareId是仓库
|
||||
List<RepairWares> waresList = waresService.listByIds(pmsWaresList.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
|
||||
|
||||
/*2、采购单转入库单*/
|
||||
//入库单关联采购单
|
||||
@ -542,10 +551,10 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
repairSoiService.saveBatch(inWaresList);
|
||||
|
||||
/*4、原始配件库处理*/
|
||||
//入库配件按照原始配件库id分组,目的取出数量
|
||||
Map<String, DlRepairSoi> wareMap = filterWare.stream().collect(Collectors.toMap(DlRepairSoi::getWareId, soi -> soi));
|
||||
//采购配件按照按照原始配件库id分组,目的取出价格
|
||||
Map<String, DlRepairSoi> itemsMap = pmsWaresList.stream().collect(Collectors.toMap(DlRepairSoi::getWareId,soi -> soi));
|
||||
//入库配件按照原始配件库id分组,目的取出数量---不是用wareId,是用GoodsId,wareId是仓库
|
||||
Map<String, DlRepairSoi> wareMap = filterWare.stream().collect(Collectors.toMap(DlRepairSoi::getGoodsId, soi -> soi));
|
||||
//采购配件按照按照原始配件库id分组,目的取出价格---不是用wareId,是用GoodsId,wareId是仓库
|
||||
Map<String, DlRepairSoi> itemsMap = pmsWaresList.stream().collect(Collectors.toMap(DlRepairSoi::getGoodsId,soi -> soi));
|
||||
waresList.forEach(item -> {
|
||||
DlRepairSoi filterSoi = wareMap.get(item.getId());
|
||||
DlRepairSoi itemSoi = itemsMap.get(item.getId());
|
||||
|
Loading…
Reference in New Issue
Block a user