|
|
@ -6,10 +6,8 @@ import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import org.nl.common.exception.BadRequestException; |
|
|
|
import org.nl.common.utils.IdUtil; |
|
|
|
import org.nl.common.utils.SecurityUtils; |
|
|
|
import org.nl.wms.basedata_manage.service.IMdPbStoragevehicleextService; |
|
|
|
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleext; |
|
|
|
import org.nl.wms.warehouse_management.enums.IOSConstant; |
|
|
|
import org.nl.wms.warehouse_management.enums.IOSEnum; |
|
|
|
import org.nl.wms.warehouse_management.service.IMdPbGroupplateService; |
|
|
@ -121,26 +119,27 @@ public class UpdateIvtUtils { |
|
|
|
* @param where 输入参数 |
|
|
|
*/ |
|
|
|
private void updateAddCanuseInsertIvt(JSONObject where) { |
|
|
|
throw new BadRequestException("当前载具已存在库存物料,请检查数据!"); |
|
|
|
// 判断当前载具是否有物料
|
|
|
|
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne( |
|
|
|
new QueryWrapper<MdPbStoragevehicleext>().lambda() |
|
|
|
.eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
); |
|
|
|
if (ObjectUtil.isNotEmpty(extDao)) { |
|
|
|
throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】已存在库存物料,请检查数据!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 插入数据
|
|
|
|
MdPbStoragevehicleext extParamDao = JSONObject.parseObject(JSONObject.toJSONString(where), MdPbStoragevehicleext.class); |
|
|
|
extParamDao.setStoragevehicleext_id(IdUtil.getStringId()); |
|
|
|
extParamDao.setCanuse_qty(where.getBigDecimal("change_qty")); |
|
|
|
extParamDao.setFrozen_qty(BigDecimal.valueOf(0)); |
|
|
|
extParamDao.setInsert_time(DateUtil.now()); |
|
|
|
extParamDao.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|
|
|
extParamDao.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|
|
|
extParamDao.setUpdate_time(DateUtil.now()); |
|
|
|
extParamDao.setRemark(where.getString("remark")); |
|
|
|
iMdPbStoragevehicleextService.save(extParamDao); |
|
|
|
// MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne(
|
|
|
|
// new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
|
|
|
// .eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
|
|
|
// );
|
|
|
|
// if (ObjectUtil.isNotEmpty(extDao)) {
|
|
|
|
// throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】已存在库存物料,请检查数据!");
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // 插入数据
|
|
|
|
// MdPbStoragevehicleext extParamDao = JSONObject.parseObject(JSONObject.toJSONString(where), MdPbStoragevehicleext.class);
|
|
|
|
// extParamDao.setStoragevehicleext_id(IdUtil.getStringId());
|
|
|
|
// extParamDao.setCanuse_qty(where.getBigDecimal("change_qty"));
|
|
|
|
// extParamDao.setFrozen_qty(BigDecimal.valueOf(0));
|
|
|
|
// extParamDao.setInsert_time(DateUtil.now());
|
|
|
|
// extParamDao.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
|
|
|
// extParamDao.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
|
|
|
// extParamDao.setUpdate_time(DateUtil.now());
|
|
|
|
// extParamDao.setRemark(where.getString("remark"));
|
|
|
|
// iMdPbStoragevehicleextService.save(extParamDao);
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -149,30 +148,30 @@ public class UpdateIvtUtils { |
|
|
|
*/ |
|
|
|
private void updateAddFrozenIvt(JSONObject where) { |
|
|
|
// 找当前托盘物料库存
|
|
|
|
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne( |
|
|
|
new QueryWrapper<MdPbStoragevehicleext>().lambda() |
|
|
|
.eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
.eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id")) |
|
|
|
.eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn")) |
|
|
|
GroupPlate extDao = iMdPbGroupPlateService.getOne( |
|
|
|
new QueryWrapper<GroupPlate>().lambda() |
|
|
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id")) |
|
|
|
.eq(GroupPlate::getPcsn, where.getString("pcsn")) |
|
|
|
); |
|
|
|
if (ObjectUtil.isEmpty(extDao)) { |
|
|
|
throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】不存在相关物料批次库存,请检查数据!"); |
|
|
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!"); |
|
|
|
} |
|
|
|
// 减可用数
|
|
|
|
double canuse_qty = NumberUtil.sub(extDao.getCanuse_qty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
double canuse_qty = NumberUtil.sub(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
if (canuse_qty < 0) { |
|
|
|
throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【"+extDao.getCanuse_qty()+"】当前变动数为【"+where.getDoubleValue("change_qty")+"】"); |
|
|
|
throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【" + extDao.getQty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】"); |
|
|
|
} |
|
|
|
// 加冻结数
|
|
|
|
double frozen_qty = NumberUtil.add(extDao.getFrozen_qty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
|
|
|
|
extDao.setCanuse_qty(BigDecimal.valueOf(canuse_qty)); |
|
|
|
extDao.setQty(BigDecimal.valueOf(canuse_qty)); |
|
|
|
extDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty)); |
|
|
|
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
|
extDao.setRemark(where.getString("remark")); |
|
|
|
iMdPbStoragevehicleextService.updateById(extDao); |
|
|
|
iMdPbGroupPlateService.updateById(extDao); |
|
|
|
; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -181,23 +180,23 @@ public class UpdateIvtUtils { |
|
|
|
*/ |
|
|
|
private void updateSubFrozenIvt(JSONObject where) { |
|
|
|
// 找当前托盘物料库存
|
|
|
|
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne( |
|
|
|
new QueryWrapper<MdPbStoragevehicleext>().lambda() |
|
|
|
.eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
.eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id")) |
|
|
|
.eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn")) |
|
|
|
GroupPlate extDao = iMdPbGroupPlateService.getOne( |
|
|
|
new QueryWrapper<GroupPlate>().lambda() |
|
|
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id")) |
|
|
|
.eq(GroupPlate::getPcsn, where.getString("pcsn")) |
|
|
|
); |
|
|
|
if (ObjectUtil.isEmpty(extDao)) { |
|
|
|
throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】不存在相关物料批次库存,请检查数据!"); |
|
|
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!"); |
|
|
|
} |
|
|
|
|
|
|
|
// 减冻结
|
|
|
|
double frozen_qty = NumberUtil.sub(extDao.getFrozen_qty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
if (frozen_qty < 0) { |
|
|
|
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【"+extDao.getFrozen_qty()+"】当前变动数为【"+where.getDoubleValue("change_qty")+"】"); |
|
|
|
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】"); |
|
|
|
} |
|
|
|
|
|
|
|
// 如果可用数和冻结数都为零则删除数据
|
|
|
|
if (frozen_qty == 0 && extDao.getCanuse_qty().doubleValue() == 0) { |
|
|
|
if (frozen_qty == 0 && extDao.getQty().doubleValue() == 0) { |
|
|
|
iMdPbStoragevehicleextService.removeById(extDao); |
|
|
|
} else { |
|
|
|
extDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty)); |
|
|
@ -205,7 +204,8 @@ public class UpdateIvtUtils { |
|
|
|
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
|
extDao.setRemark(where.getString("remark")); |
|
|
|
iMdPbStoragevehicleextService.updateById(extDao); |
|
|
|
iMdPbGroupPlateService.updateById(extDao); |
|
|
|
; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -215,12 +215,6 @@ public class UpdateIvtUtils { |
|
|
|
*/ |
|
|
|
private void updateSubFrozenAddIvt(JSONObject where) { |
|
|
|
// 找当前托盘物料库存
|
|
|
|
// MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne(
|
|
|
|
// new QueryWrapper<MdPbStoragevehicleext>().lambda()
|
|
|
|
// .eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code"))
|
|
|
|
// .eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id"))
|
|
|
|
// .eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn"))
|
|
|
|
// );
|
|
|
|
GroupPlate extDao = iMdPbGroupPlateService.getOne( |
|
|
|
new QueryWrapper<GroupPlate>().lambda() |
|
|
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
@ -236,7 +230,7 @@ public class UpdateIvtUtils { |
|
|
|
throw new BadRequestException("冻结数不能为负数,请检查变动数量!当前冻结数为【" + extDao.getFrozen_qty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】"); |
|
|
|
} |
|
|
|
// 加可用
|
|
|
|
// double canuse_qty = NumberUtil.add(extDao.getCanuse_qty(), where.getDoubleValue("change_qty")).doubleValue();
|
|
|
|
// double canuse_qty = NumberUtil.add(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();
|
|
|
|
extDao.setFrozen_qty(BigDecimal.ZERO); |
|
|
|
extDao.setQty(BigDecimal.valueOf(qty)); |
|
|
|
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|
|
@ -251,23 +245,23 @@ public class UpdateIvtUtils { |
|
|
|
* @param where 输入参数 |
|
|
|
*/ |
|
|
|
private void updateAddCanuseIvt(JSONObject where) { |
|
|
|
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne( |
|
|
|
new QueryWrapper<MdPbStoragevehicleext>().lambda() |
|
|
|
.eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
.eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id")) |
|
|
|
.eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn")) |
|
|
|
GroupPlate extDao = iMdPbGroupPlateService.getOne( |
|
|
|
new QueryWrapper<GroupPlate>().lambda() |
|
|
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id")) |
|
|
|
.eq(GroupPlate::getPcsn, where.getString("pcsn")) |
|
|
|
); |
|
|
|
if (ObjectUtil.isEmpty(extDao)) { |
|
|
|
throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】不存在相关物料批次库存,请检查数据!"); |
|
|
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!"); |
|
|
|
} |
|
|
|
|
|
|
|
double canuse_qty = NumberUtil.add(extDao.getCanuse_qty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
extDao.setCanuse_qty(BigDecimal.valueOf(canuse_qty)); |
|
|
|
double canuse_qty = NumberUtil.add(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
extDao.setQty(BigDecimal.valueOf(canuse_qty)); |
|
|
|
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
|
extDao.setRemark(where.getString("remark")); |
|
|
|
iMdPbStoragevehicleextService.updateById(extDao); |
|
|
|
iMdPbGroupPlateService.updateById(extDao); |
|
|
|
; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -275,26 +269,25 @@ public class UpdateIvtUtils { |
|
|
|
* @param where 输入参数 |
|
|
|
*/ |
|
|
|
private void updateSubCanuseIvt(JSONObject where) { |
|
|
|
MdPbStoragevehicleext extDao = iMdPbStoragevehicleextService.getOne( |
|
|
|
new QueryWrapper<MdPbStoragevehicleext>().lambda() |
|
|
|
.eq(MdPbStoragevehicleext::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
.eq(MdPbStoragevehicleext::getMaterial_id, where.getString("material_id")) |
|
|
|
.eq(MdPbStoragevehicleext::getPcsn, where.getString("pcsn")) |
|
|
|
GroupPlate extDao = iMdPbGroupPlateService.getOne( |
|
|
|
new QueryWrapper<GroupPlate>().lambda() |
|
|
|
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code")) |
|
|
|
.eq(GroupPlate::getMaterial_id, where.getString("material_id")) |
|
|
|
.eq(GroupPlate::getPcsn, where.getString("pcsn")) |
|
|
|
); |
|
|
|
if (ObjectUtil.isEmpty(extDao)) { |
|
|
|
throw new BadRequestException("当前载具【"+extDao.getStoragevehicle_code()+"】不存在相关物料批次库存,请检查数据!"); |
|
|
|
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!"); |
|
|
|
} |
|
|
|
|
|
|
|
double canuse_qty = NumberUtil.sub(extDao.getCanuse_qty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
double canuse_qty = NumberUtil.sub(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue(); |
|
|
|
if (canuse_qty < 0) { |
|
|
|
throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【"+extDao.getCanuse_qty()+"】当前变动数为【"+where.getDoubleValue("change_qty")+"】"); |
|
|
|
throw new BadRequestException("可用数不能为负数,请检查变动数量!当前可用数为【" + extDao.getQty() + "】当前变动数为【" + where.getDoubleValue("change_qty") + "】"); |
|
|
|
} |
|
|
|
extDao.setCanuse_qty(BigDecimal.valueOf(canuse_qty)); |
|
|
|
extDao.setQty(BigDecimal.valueOf(canuse_qty)); |
|
|
|
extDao.setUpdate_optid(SecurityUtils.getCurrentUserId()); |
|
|
|
extDao.setUpdate_optname(SecurityUtils.getCurrentNickName()); |
|
|
|
extDao.setUpdate_time(DateUtil.now()); |
|
|
|
extDao.setRemark(where.getString("remark")); |
|
|
|
iMdPbStoragevehicleextService.updateById(extDao); |
|
|
|
iMdPbGroupPlateService.updateById(extDao); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|