|
|
|
@ -173,10 +173,19 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
|
|
|
|
|
|
//拿到 产品库存
|
|
|
|
|
IoSplitFifoInv splitFifoInv = ioSplitFifoInvService.getById(addInvDesDetaiRequest.getSplitFifoInv().getId());
|
|
|
|
|
int count = splitFifoInv.getReCount() - addInvDesDetaiRequest.getOutCount();
|
|
|
|
|
if (count < 0){
|
|
|
|
|
throw new JsonException(500,"库存不足");
|
|
|
|
|
}
|
|
|
|
|
//修改产品 库存 出库数量 可用数量 剩余数量
|
|
|
|
|
splitFifoInv.setOutCount(splitFifoInv.getOutCount() + addInvDesDetaiRequest.getOutCount());//出库数量
|
|
|
|
|
splitFifoInv.setReCount(splitFifoInv.getInCount() - splitFifoInv.getOutCount());//剩余数量
|
|
|
|
|
splitFifoInv.setAvailableCount(splitFifoInv.getInCount() - splitFifoInv.getOutCount() - splitFifoInv.getLockCount());
|
|
|
|
|
int availableCount = splitFifoInv.getInCount() - splitFifoInv.getOutCount() - splitFifoInv.getLockCount();
|
|
|
|
|
if (availableCount < 0){
|
|
|
|
|
throw new JsonException(500,"可用数量库存不足");
|
|
|
|
|
}
|
|
|
|
|
//剩余数量
|
|
|
|
|
splitFifoInv.setAvailableCount(availableCount);
|
|
|
|
|
splitFifoInv.setUpdateTime(new Date());
|
|
|
|
|
//更改 库存
|
|
|
|
|
boolean update = ioSplitFifoInvService.updateById(splitFifoInv);
|
|
|
|
@ -241,13 +250,21 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
|
IoSplitFifoInv splitFifoInv = ioSplitFifoInvService.getOne(new LambdaQueryWrapper<IoSplitFifoInv>()
|
|
|
|
|
.eq(IoSplitFifoInv::getId,splitFifoCodeEntity.getInvIdFk()));
|
|
|
|
|
if (splitFifoInv == null){
|
|
|
|
|
throw new JsonException(5000,"未找到该产品!");
|
|
|
|
|
throw new JsonException(500,"未找到该产品!");
|
|
|
|
|
}
|
|
|
|
|
//修改产品 库存 入库数量
|
|
|
|
|
int count = splitFifoInv.getReCount() - addInvDesDetaiRequest.getOutCount();
|
|
|
|
|
if (count < 0){
|
|
|
|
|
throw new JsonException(500,"库存不足");
|
|
|
|
|
}
|
|
|
|
|
//修改产品 库存 入库数
|
|
|
|
|
splitFifoInv.setInCount(splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount());
|
|
|
|
|
splitFifoInv.setOutCount(splitFifoInv.getOutCount() + addInvDesDetaiRequest.getOutCount());//出库数量
|
|
|
|
|
splitFifoInv.setReCount(splitFifoInv.getInCount() - splitFifoInv.getOutCount());//剩余数量
|
|
|
|
|
splitFifoInv.setAvailableCount(splitFifoInv.getInCount() - splitFifoInv.getOutCount()-splitFifoInv.getLockCount());//实用数量
|
|
|
|
|
int availableCount = splitFifoInv.getInCount() - splitFifoInv.getOutCount() - splitFifoInv.getLockCount();
|
|
|
|
|
if (availableCount < 0){
|
|
|
|
|
throw new JsonException(500,"可用数量库存不足");
|
|
|
|
|
}
|
|
|
|
|
splitFifoInv.setAvailableCount(availableCount);//可用数量
|
|
|
|
|
splitFifoInv.setUpdateTime(new Date());
|
|
|
|
|
//更改 库存
|
|
|
|
|
boolean update = ioSplitFifoInvService.updateById(splitFifoInv);
|
|
|
|
|