opt:优化
This commit is contained in:
@@ -392,13 +392,17 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
//100-出50 = 50
|
||||
//如果出库是手持库出确认则不在这边变动组盘信息
|
||||
if (!changeDto.getInBound()){
|
||||
UpdateWrapper<GroupPlate> update = new UpdateWrapper<GroupPlate>()
|
||||
.set("frozen_qty", 0)
|
||||
.set("qty", subtract)
|
||||
.set("update_time", now)
|
||||
.set("status", GROUP_PLATE_STATUS.code("组盘"))
|
||||
.eq("group_id", vehicleMater.getGroup_id());
|
||||
iMdPbGroupplateService.update(update);
|
||||
if (subtract.compareTo(BigDecimal.ZERO)==0) {
|
||||
iMdPbGroupplateService.removeById(vehicleMater.getGroup_id());
|
||||
}else {
|
||||
UpdateWrapper<GroupPlate> update = new UpdateWrapper<GroupPlate>()
|
||||
.set("frozen_qty", 0)
|
||||
.set("qty", subtract)
|
||||
.set("update_time", now)
|
||||
.set("status", GROUP_PLATE_STATUS.code("组盘"))
|
||||
.eq("group_id", vehicleMater.getGroup_id());
|
||||
iMdPbGroupplateService.update(update);
|
||||
}
|
||||
}
|
||||
StIvtStructivtflow record = new StIvtStructivtflow();
|
||||
record.setId(IdUtil.getStringId());
|
||||
|
||||
@@ -203,7 +203,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
//主单
|
||||
JSONObject io_mst = new JSONObject();
|
||||
String iostorinv_id = IdUtil.getStringId();
|
||||
String bill_code = CodeUtil.getNewCode("IN_STORE_CODE");
|
||||
String bill_code = CodeUtil.getNewCode("OUT_STORE_CODE");
|
||||
io_mst.put("iostorinv_id", iostorinv_id);
|
||||
io_mst.put("bill_code", bill_code);
|
||||
io_mst.put("io_type", IOSEnum.IO_TYPE.code("出库"));
|
||||
|
||||
@@ -1134,6 +1134,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
// 完成当前分配明细
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
||||
);
|
||||
//解锁库位
|
||||
@@ -1163,6 +1164,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
// 如果分配明细全部完成则更新明细表状态
|
||||
if (countDis == 0){
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setReal_qty(ioStorInvDis.getPlan_qty());
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
//判断是否有源单据,更新源单据
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user