|
|
@@ -216,4 +216,44 @@ public class FreezeService extends BaseService<Freeze> {
|
|
|
return ResponseResultUtil.success(super.updateByUuid(freeze));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @Transactional(
|
|
|
+ rollbackFor = {Exception.class}
|
|
|
+ )
|
|
|
+ public ResponseResultVO<?> updateFreeze(FreezeVO freezeVO) {
|
|
|
+
|
|
|
+ // 赋值全部解冻
|
|
|
+ String freezeStatus=Constant.FreezeStatusType.ALLUNFREEZE.getName();
|
|
|
+ // 查询冻结单明细
|
|
|
+
|
|
|
+ // 解冻
|
|
|
+ for (FreezeItemVO freezeItemVO : freezeVO.getItemList()) {
|
|
|
+
|
|
|
+ FreezeItem freezeItem = new FreezeItem();
|
|
|
+ // 赋值实体
|
|
|
+ freezeItem.setItemId(freezeItemVO.getItemId()).setUnfreezeQty(freezeItemVO.getSurplusQty())
|
|
|
+ .setSurplusQty(BigDecimal.ZERO);
|
|
|
+ // 修改冻结单明细解冻量
|
|
|
+ freezeItemService.updateByUuid(freezeItem);
|
|
|
+ // 查询库存信息
|
|
|
+ Inventory inventoryForUpdate=inventoryMapper.selectByIdForUpdate(freezeItemVO.getInvId());
|
|
|
+ // 库存冻结量=库存冻结量-实际解冻量
|
|
|
+ BigDecimal freezeqty=inventoryForUpdate.getFreezeQty().subtract(freezeItemVO.getSurplusQty());
|
|
|
+ // 库存可售量=库存可售量+实际解冻量
|
|
|
+ BigDecimal usableQt=inventoryForUpdate.getUsableQty().add(freezeItemVO.getSurplusQty());
|
|
|
+ // 更新修改内容信息
|
|
|
+ Inventory inventoryUpdate = new Inventory();
|
|
|
+ // 赋值库存可售量、冻结量和库存ID值
|
|
|
+ inventoryUpdate.setInvId(freezeItemVO.getInvId()).setFreezeQty(freezeqty).setUsableQty(usableQt);
|
|
|
+ // 修改库存冻结量、可售量
|
|
|
+ inventoryService.updateByUuid(inventoryUpdate);
|
|
|
+ }
|
|
|
+ // 赋值冻结表状态和ID
|
|
|
+ Freeze freeze=new Freeze();
|
|
|
+ freeze.setFreezeId(freezeVO.getFreezeId()).setFreezeStatus(freezeStatus);
|
|
|
+ // 更新主表冻结状态
|
|
|
+ return ResponseResultUtil.success(super.updateByUuid(freeze));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|