|
|
@ -81,6 +81,8 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
itemAccountsMapper.insert(itemAccounts); |
|
|
|
id = itemAccounts.getId(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return id; |
|
|
|
} |
|
|
|
|
|
|
@ -159,13 +161,16 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
itemNewTurnInMapper.insert(itemNewTurnInDO); |
|
|
|
//更新新到货数量
|
|
|
|
BigDecimal qty = itemAccountsDO.getQty(); |
|
|
|
if(qty.compareTo(newqty) == 0){//等于删除
|
|
|
|
itemAccountsMapper.deleteById(createReqVO.getId()); |
|
|
|
}else{//更新数量
|
|
|
|
BigDecimal difference = qty.subtract(newqty); |
|
|
|
itemAccountsDO.setQty(difference); |
|
|
|
itemAccountsMapper.updateById(itemAccountsDO); |
|
|
|
} |
|
|
|
// if(qty.compareTo(newqty) == 0){//等于删除
|
|
|
|
// itemAccountsMapper.deleteById(createReqVO.getId());
|
|
|
|
// }else{//更新数量
|
|
|
|
// BigDecimal difference = qty.subtract(newqty);
|
|
|
|
// itemAccountsDO.setQty(difference);
|
|
|
|
// itemAccountsMapper.updateById(itemAccountsDO);
|
|
|
|
// }
|
|
|
|
BigDecimal difference = qty.subtract(newqty); |
|
|
|
itemAccountsDO.setQty(difference); |
|
|
|
itemAccountsMapper.updateById(itemAccountsDO); |
|
|
|
//itemAccountsMapper.deleteById(createReqVO.getId());
|
|
|
|
return id; |
|
|
|
} |
|
|
@ -214,6 +219,22 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ItemAccountsDO getByItemNumber(String itemNumber) { |
|
|
|
QueryWrapper<ItemAccountsDO> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("item_number",itemNumber); |
|
|
|
queryWrapper.eq("available","TRUE"); |
|
|
|
List<ItemAccountsDO> itemAccountsDOS = itemAccountsMapper.selectList(queryWrapper); |
|
|
|
if(itemAccountsDOS.isEmpty()){ |
|
|
|
return new ItemAccountsDO(); |
|
|
|
}else{//有数据查询所有的库存
|
|
|
|
ItemAccountsDO itemAccountsDO = itemAccountsDOS.get(0); |
|
|
|
BigDecimal allByLocation = getAllByLocation(itemAccountsDO.getLocationNumber()); |
|
|
|
itemAccountsDO.setQty(allByLocation); |
|
|
|
return itemAccountsDO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<ItemAccountsDO> getItemAccountsList(Collection<Long> ids) { |
|
|
|
return itemAccountsMapper.selectBatchIds(ids); |
|
|
|