|
|
@ -315,5 +315,50 @@ public class ItemServiceImpl implements ItemService { |
|
|
|
return itemMapper.selectOne(queryWrapper); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageResult<ItemDO> getWarningPage(ItemPageReqVO pageReqVO) { |
|
|
|
PageResult<ItemDO> pageResult = itemMapper.selectPage(pageReqVO); |
|
|
|
List<ItemDO> itemNewList=new ArrayList(); |
|
|
|
for (ItemDO itemDO : pageResult.getList()) { |
|
|
|
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_number",itemDO.getNumber()); |
|
|
|
queryWrapper.eq("available","TRUE"); |
|
|
|
List<ItemAccountsDO> itemAccountsDOList = itemAccountsMapper.selectList(queryWrapper); |
|
|
|
BigDecimal allCount = BigDecimal.ZERO; |
|
|
|
for (ItemAccountsDO itemAccountsDO : itemAccountsDOList) { |
|
|
|
allCount=allCount.add(itemAccountsDO.getQty()); |
|
|
|
} |
|
|
|
//如果各种类型的备件库存数量总数低于最低库存数量
|
|
|
|
if(allCount.compareTo(itemDO.getMinInventory())==-1){ |
|
|
|
itemDO.setAllCount(allCount); |
|
|
|
itemNewList.add(itemDO); |
|
|
|
} |
|
|
|
} |
|
|
|
pageResult.setList(itemNewList); |
|
|
|
pageResult.setTotal(Long.valueOf(itemNewList.size()).longValue()); |
|
|
|
return pageResult; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageResult<ItemDO> getItemWarningSenior(CustomConditions conditions) { |
|
|
|
PageResult<ItemDO> pageResult = itemMapper.getItemSenior(conditions); |
|
|
|
for (ItemDO itemDO : pageResult.getList()) { |
|
|
|
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_number",itemDO.getNumber()); |
|
|
|
queryWrapper.eq("available","TRUE"); |
|
|
|
List<ItemAccountsDO> itemAccountsDOList = itemAccountsMapper.selectList(queryWrapper); |
|
|
|
BigDecimal allCount = BigDecimal.ZERO; |
|
|
|
for (ItemAccountsDO itemAccountsDO : itemAccountsDOList) { |
|
|
|
allCount=allCount.add(itemAccountsDO.getQty()); |
|
|
|
} |
|
|
|
//如果各种类型的备件库存数量总数低于最低库存数量
|
|
|
|
if(allCount.compareTo(itemDO.getMinInventory())>=0){ |
|
|
|
pageResult.getList().remove(itemDO); |
|
|
|
}else { |
|
|
|
itemDO.setAllCount(allCount); |
|
|
|
} |
|
|
|
} |
|
|
|
return pageResult; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|