|
|
@ -154,14 +154,13 @@ public class UpdateIvtUtils { |
|
|
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!"); |
|
|
|
} |
|
|
|
// 减可用数
|
|
|
|
double canuse_qty = NumberUtil.sub(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
if (canuse_qty < 0) { |
|
|
|
BigDecimal canuse_qty = extDao.getQty().subtract(where.getBigDecimal("change_qty")); |
|
|
|
if (canuse_qty.compareTo(BigDecimal.ZERO) <0){ |
|
|
|
throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【" + extDao.getQty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】"); |
|
|
|
} |
|
|
|
// 加冻结数
|
|
|
|
double frozen_qty = NumberUtil.add(extDao.getFrozen_qty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
//extDao.setQty(BigDecimal.valueOf(canuse_qty));
|
|
|
|
extDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty)); |
|
|
|
BigDecimal frozen_qty = extDao.getFrozen_qty().add(where.getBigDecimal("change_qty")); |
|
|
|
extDao.setFrozen_qty(frozen_qty); |
|
|
|
extDao.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
@ -186,15 +185,15 @@ public class UpdateIvtUtils { |
|
|
|
} |
|
|
|
|
|
|
|
// 减冻结
|
|
|
|
double frozen_qty = NumberUtil.sub(extDao.getFrozen_qty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
if (frozen_qty < 0) { |
|
|
|
BigDecimal frozen_qty = extDao.getFrozen_qty().subtract(where.getBigDecimal("change_qty")); |
|
|
|
if (frozen_qty.compareTo(BigDecimal.ZERO) <0){ |
|
|
|
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】"); |
|
|
|
} |
|
|
|
// 如果可用数和冻结数都为零则删除数据
|
|
|
|
if (frozen_qty == 0 && extDao.getQty().doubleValue() == 0) { |
|
|
|
if (frozen_qty.compareTo(BigDecimal.ZERO)==0 && extDao.getQty().compareTo(BigDecimal.ZERO)==0) { |
|
|
|
iMdPbStoragevehicleextService.removeById(extDao); |
|
|
|
} else { |
|
|
|
extDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty)); |
|
|
|
extDao.setFrozen_qty(frozen_qty); |
|
|
|
extDao.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
@ -220,12 +219,11 @@ public class UpdateIvtUtils { |
|
|
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!"); |
|
|
|
} |
|
|
|
// 减冻结
|
|
|
|
double qty = NumberUtil.sub(extDao.getQty(), extDao.getFrozen_qty()).doubleValue(); |
|
|
|
if (qty < 0) { |
|
|
|
BigDecimal qty = extDao.getQty().subtract(extDao.getFrozen_qty()); |
|
|
|
if (qty.compareTo(BigDecimal.ZERO) <0){ |
|
|
|
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】"); |
|
|
|
} |
|
|
|
// 加可用
|
|
|
|
// double canuse_qty = NumberUtil.add(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();
|
|
|
|
extDao.setFrozen_qty(BigDecimal.ZERO); |
|
|
|
extDao.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
@ -247,8 +245,8 @@ public class UpdateIvtUtils { |
|
|
|
if (ObjectUtil.isEmpty(extDao)) { |
|
|
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!"); |
|
|
|
} |
|
|
|
double canuse_qty = NumberUtil.add(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
extDao.setQty(BigDecimal.valueOf(canuse_qty)); |
|
|
|
BigDecimal canuse_qty = extDao.getQty().add(where.getBigDecimal("change_qty")); |
|
|
|
extDao.setQty(canuse_qty); |
|
|
|
extDao.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
@ -270,16 +268,21 @@ public class UpdateIvtUtils { |
|
|
|
if (ObjectUtil.isEmpty(extDao)) { |
|
|
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!"); |
|
|
|
} |
|
|
|
double canuse_qty = NumberUtil.sub(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
if (canuse_qty < 0) { |
|
|
|
BigDecimal change_qty = where.getBigDecimal("change_qty"); |
|
|
|
BigDecimal canuse_qty = extDao.getQty().subtract(change_qty); |
|
|
|
if (canuse_qty.compareTo(BigDecimal.ZERO) <0){ |
|
|
|
throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【" + extDao.getQty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】"); |
|
|
|
} |
|
|
|
extDao.setQty(BigDecimal.valueOf(canuse_qty)); |
|
|
|
extDao.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
|
extDao.setRemark(where.getString("remark")); |
|
|
|
iMdPbGroupPlateService.updateById(extDao); |
|
|
|
if (extDao.getFrozen_qty().compareTo(BigDecimal.ZERO)==0 && canuse_qty.compareTo(BigDecimal.ZERO)==0) { |
|
|
|
iMdPbStoragevehicleextService.removeById(extDao); |
|
|
|
}else { |
|
|
|
extDao.setQty(canuse_qty); |
|
|
|
extDao.setUpdate_id(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_name(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
|
extDao.setRemark(where.getString("remark")); |
|
|
|
iMdPbGroupPlateService.updateById(extDao); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|