|
@@ -808,7 +808,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|
|
// return message;
|
|
|
}
|
|
|
|
|
|
- if (oldInventory.getQtyTotal() < vo.getChangeQty()) {
|
|
|
+ if (oldInventory.getQtyTotal() < vo.getChangeQty() && !vo.getOpType().equals(InventoryOpTypeEnum.FREEZE_QTY_CUT)) {
|
|
|
message.setMsg("库存总数量不足");
|
|
|
return message;
|
|
|
}
|
|
@@ -868,8 +868,13 @@ public class InventoryServiceImpl implements InventoryService {
|
|
|
|
|
|
// 人工冻结数量 -
|
|
|
if (vo.getOpType().equals(InventoryOpTypeEnum.FREEZE_QTY_CUT)) {
|
|
|
+ if (oldInventory.getQtyLock3() < vo.getChangeQty()) {
|
|
|
+ message.setMsg("冻结数量不足");
|
|
|
+ return message;
|
|
|
+ }
|
|
|
updateVo.setQtyLock3(oldInventory.getQtyLock3() - vo.getChangeQty());// 冻结数量减少
|
|
|
updateVo.setQtyAvail(NumberUtil.add(oldInventory.getQtyAvail(), vo.getChangeQty()));// 可用数量增加
|
|
|
+ updateVo.setQtyTotal(NumberUtil.add(oldInventory.getQtyTotal(), vo.getChangeQty()));// 总数量增加
|
|
|
}
|
|
|
|
|
|
// 人工冻结数量 +
|
|
@@ -999,6 +1004,21 @@ public class InventoryServiceImpl implements InventoryService {
|
|
|
if (vo.getOpType().equals(InventoryOpTypeEnum.INVENTORY_CHECK_GAINS_REVOKE)) {
|
|
|
updateVo.setQtyLock2(NumberUtil.add(oldInventory.getQtyLock2(), vo.getChangeQty()));// 冻结数量增加
|
|
|
}
|
|
|
+ // 人工冻结数量 -
|
|
|
+ if (vo.getOpType().equals(InventoryOpTypeEnum.FREEZE_QTY_CUT)) {
|
|
|
+ updateVo.setQtyLock3(oldInventory.getQtyLock3() - vo.getChangeQty());// 冻结数量减少
|
|
|
+ updateVo.setQtyAvail(NumberUtil.add(oldInventory.getQtyAvail(), vo.getChangeQty()));// 可用数量增加
|
|
|
+ }
|
|
|
+
|
|
|
+ // 人工冻结数量 +
|
|
|
+ if (vo.getOpType().equals(InventoryOpTypeEnum.FREEZE_QTY_ADD)) {
|
|
|
+ if (oldInventory.getQtyAvail() < vo.getChangeQty()) {
|
|
|
+ message.setMsg("库存可用数量不足");
|
|
|
+ return message;
|
|
|
+ }
|
|
|
+ updateVo.setQtyLock3(oldInventory.getQtyLock3() + vo.getChangeQty());// 冻结数量增加
|
|
|
+ updateVo.setQtyAvail(oldInventory.getQtyAvail() - vo.getChangeQty());// 可用数量减少
|
|
|
+ }
|
|
|
|
|
|
// 更新人
|
|
|
updateVo.setUpdateByUserCode(vo.getUserCode());
|
|
@@ -1428,7 +1448,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|
|
|
|
|
vo.setFreezeByUserCode(user.getCode());
|
|
|
vo.setFreezeTime(new Date());
|
|
|
- Message cutMessage = updAvail(vo);
|
|
|
+ Message cutMessage = cutQty(vo);
|
|
|
inventoryMapper.updateStatus(vo);
|
|
|
if (!cutMessage.isSuccess()) {
|
|
|
return cutMessage;
|
|
@@ -1451,7 +1471,7 @@ public class InventoryServiceImpl implements InventoryService {
|
|
|
|
|
|
vo.setFreezeByUserCode(user.getCode());
|
|
|
vo.setFreezeTime(new Date());
|
|
|
- Message cutMessage = updAvail(vo);
|
|
|
+ Message cutMessage = cutQty(vo);
|
|
|
vo.setDataVersion(vo.getDataVersion()+1);
|
|
|
inventoryMapper.updateStatus(vo);
|
|
|
if (!cutMessage.isSuccess()) {
|