|
|
@ -174,16 +174,16 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
//拿到 产品库存
|
|
|
|
//拿到 产品库存
|
|
|
|
IoSplitFifoInv splitFifoInv = ioSplitFifoInvService.getById(addInvDesDetaiRequest.getSplitFifoInv().getId());
|
|
|
|
IoSplitFifoInv splitFifoInv = ioSplitFifoInvService.getById(addInvDesDetaiRequest.getSplitFifoInv().getId());
|
|
|
|
int count = splitFifoInv.getReCount() - addInvDesDetaiRequest.getOutCount();
|
|
|
|
int count = splitFifoInv.getReCount() - addInvDesDetaiRequest.getOutCount();
|
|
|
|
if (count < 0){
|
|
|
|
if (count < 0) {
|
|
|
|
throw new JsonException(500,"库存不足");
|
|
|
|
throw new JsonException(500, "库存不足");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//修改产品 库存 出库数量 可用数量 剩余数量
|
|
|
|
//修改产品 库存 出库数量 可用数量 剩余数量
|
|
|
|
//入库数量是否需要更改?
|
|
|
|
//入库数量是否需要更改?
|
|
|
|
splitFifoInv.setOutCount(splitFifoInv.getOutCount() + addInvDesDetaiRequest.getOutCount());//出库数量
|
|
|
|
splitFifoInv.setOutCount(splitFifoInv.getOutCount() + addInvDesDetaiRequest.getOutCount());//出库数量
|
|
|
|
splitFifoInv.setReCount(splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount());//剩余数量
|
|
|
|
splitFifoInv.setReCount(splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount());//剩余数量
|
|
|
|
int availableCount = splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount() - splitFifoInv.getLockCount();
|
|
|
|
int availableCount = splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount() - splitFifoInv.getLockCount();
|
|
|
|
if (availableCount <= -1){
|
|
|
|
if (availableCount <= -1) {
|
|
|
|
throw new JsonException(500,"可用数量库存不足");
|
|
|
|
throw new JsonException(500, "可用数量库存不足");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//可用数量
|
|
|
|
//可用数量
|
|
|
|
splitFifoInv.setAvailableCount(availableCount);
|
|
|
|
splitFifoInv.setAvailableCount(availableCount);
|
|
|
@ -196,16 +196,16 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//todo 码明细删减库存
|
|
|
|
//todo 码明细删减库存
|
|
|
|
IoSplitFifoCodeEntity splitFifoCodeEntity = splitFifoCodeService.getOne(new LambdaQueryWrapper<IoSplitFifoCodeEntity>()
|
|
|
|
IoSplitFifoCodeEntity splitFifoCodeEntity = splitFifoCodeService.getOne(new LambdaQueryWrapper<IoSplitFifoCodeEntity>()
|
|
|
|
.eq(IoSplitFifoCodeEntity::getWorkPlaceCode,splitFifoInv.getWorkPlaceCode())
|
|
|
|
.eq(IoSplitFifoCodeEntity::getWorkPlaceCode, splitFifoInv.getWorkPlaceCode())
|
|
|
|
.eq(IoSplitFifoCodeEntity::getBatchNo,splitFifoInv.getBatchNo())
|
|
|
|
.eq(IoSplitFifoCodeEntity::getBatchNo, splitFifoInv.getBatchNo())
|
|
|
|
.eq(IoSplitFifoCodeEntity::getRelId,splitFifoInv.getRelId()));
|
|
|
|
.eq(IoSplitFifoCodeEntity::getRelId, splitFifoInv.getRelId()));
|
|
|
|
if (splitFifoCodeEntity == null) {
|
|
|
|
if (splitFifoCodeEntity == null) {
|
|
|
|
throw new JsonException("该工位不存在,请检查后重试!");
|
|
|
|
throw new JsonException("该工位不存在,请检查后重试!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
splitFifoCodeEntity.setTotalCount(splitFifoCodeEntity.getTotalCount() - addInvDesDetaiRequest.getOutCount());
|
|
|
|
splitFifoCodeEntity.setTotalCount(splitFifoCodeEntity.getTotalCount() - addInvDesDetaiRequest.getOutCount());
|
|
|
|
boolean b = splitFifoCodeService.updateById(splitFifoCodeEntity);
|
|
|
|
boolean b = splitFifoCodeService.updateById(splitFifoCodeEntity);
|
|
|
|
if (!b){
|
|
|
|
if (!b) {
|
|
|
|
throw new JsonException(500,"追溯码库存删减失败");
|
|
|
|
throw new JsonException(500, "追溯码库存删减失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// IoSplitFifoInv splitFifoInv = addInvDesDetaiRequest.getSplitFifoInv();
|
|
|
|
// IoSplitFifoInv splitFifoInv = addInvDesDetaiRequest.getSplitFifoInv();
|
|
|
|
IoSplitDesOrderDetail splitDesOrderDetail = IoSplitDesOrderDetail.builder()
|
|
|
|
IoSplitDesOrderDetail splitDesOrderDetail = IoSplitDesOrderDetail.builder()
|
|
|
@ -224,7 +224,7 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
.updateTime(new Date())
|
|
|
|
.updateTime(new Date())
|
|
|
|
.remark("").build();
|
|
|
|
.remark("").build();
|
|
|
|
boolean save1 = splitDesOrderDetailService.save(splitDesOrderDetail);
|
|
|
|
boolean save1 = splitDesOrderDetailService.save(splitDesOrderDetail);
|
|
|
|
if (!save1){
|
|
|
|
if (!save1) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -252,33 +252,33 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
.updateUser(addInvDesDetaiRequest.getUpdateUser())
|
|
|
|
.updateUser(addInvDesDetaiRequest.getUpdateUser())
|
|
|
|
.build();
|
|
|
|
.build();
|
|
|
|
boolean save = save(collectOrder);
|
|
|
|
boolean save = save(collectOrder);
|
|
|
|
if(!save){
|
|
|
|
if (!save) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
splitFifoCodeEntity.setTotalCount(splitFifoCodeEntity.getTotalCount() - addInvDesDetaiRequest.getOutCount());
|
|
|
|
splitFifoCodeEntity.setTotalCount(splitFifoCodeEntity.getTotalCount() - addInvDesDetaiRequest.getOutCount());
|
|
|
|
//是否在增加一个码字段 记录可用数量
|
|
|
|
//是否在增加一个码字段 记录可用数量
|
|
|
|
splitFifoCodeEntity.setUpdateTime(new Date());
|
|
|
|
splitFifoCodeEntity.setUpdateTime(new Date());
|
|
|
|
boolean b = splitFifoCodeService.updateById(splitFifoCodeEntity);
|
|
|
|
boolean b = splitFifoCodeService.updateById(splitFifoCodeEntity);
|
|
|
|
if (!b){
|
|
|
|
if (!b) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//拿到 产品库存
|
|
|
|
//拿到 产品库存
|
|
|
|
IoSplitFifoInv splitFifoInv = ioSplitFifoInvService.getOne(new LambdaQueryWrapper<IoSplitFifoInv>()
|
|
|
|
IoSplitFifoInv splitFifoInv = ioSplitFifoInvService.getOne(new LambdaQueryWrapper<IoSplitFifoInv>()
|
|
|
|
.eq(IoSplitFifoInv::getId,splitFifoCodeEntity.getInvIdFk()));
|
|
|
|
.eq(IoSplitFifoInv::getId, splitFifoCodeEntity.getInvIdFk()));
|
|
|
|
if (splitFifoInv == null){
|
|
|
|
if (splitFifoInv == null) {
|
|
|
|
throw new JsonException(500,"未找到该产品!");
|
|
|
|
throw new JsonException(500, "未找到该产品!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int count = splitFifoInv.getReCount() - addInvDesDetaiRequest.getOutCount();
|
|
|
|
int count = splitFifoInv.getReCount() - addInvDesDetaiRequest.getOutCount();
|
|
|
|
if (count < 0){
|
|
|
|
if (count < 0) {
|
|
|
|
throw new JsonException(500,"库存不足");
|
|
|
|
throw new JsonException(500, "库存不足");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//修改产品 库存 入库数
|
|
|
|
//修改产品 库存 入库数
|
|
|
|
|
|
|
|
|
|
|
|
splitFifoInv.setOutCount(splitFifoInv.getOutCount() + addInvDesDetaiRequest.getOutCount());//出库数量
|
|
|
|
splitFifoInv.setOutCount(splitFifoInv.getOutCount() + addInvDesDetaiRequest.getOutCount());//出库数量
|
|
|
|
splitFifoInv.setReCount(splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount());//剩余数量
|
|
|
|
splitFifoInv.setReCount(splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount());//剩余数量
|
|
|
|
int availableCount = splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount() - splitFifoInv.getLockCount();
|
|
|
|
int availableCount = splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount() - splitFifoInv.getLockCount();
|
|
|
|
if (availableCount <= -1){
|
|
|
|
if (availableCount <= -1) {
|
|
|
|
throw new JsonException(500,"可用数量库存不足");
|
|
|
|
throw new JsonException(500, "可用数量库存不足");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// int newAvailableCount = splitFifoInv.getAvailableCount() - availableCount;
|
|
|
|
// int newAvailableCount = splitFifoInv.getAvailableCount() - availableCount;
|
|
|
|
splitFifoInv.setAvailableCount(availableCount);//可用数量
|
|
|
|
splitFifoInv.setAvailableCount(availableCount);//可用数量
|
|
|
@ -286,7 +286,7 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
splitFifoInv.setUpdateTime(new Date());
|
|
|
|
splitFifoInv.setUpdateTime(new Date());
|
|
|
|
//更改 库存
|
|
|
|
//更改 库存
|
|
|
|
boolean update = ioSplitFifoInvService.updateById(splitFifoInv);
|
|
|
|
boolean update = ioSplitFifoInvService.updateById(splitFifoInv);
|
|
|
|
if (!update){
|
|
|
|
if (!update) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
IoSplitDesOrderDetail splitDesOrderDetail = IoSplitDesOrderDetail.builder()
|
|
|
|
IoSplitDesOrderDetail splitDesOrderDetail = IoSplitDesOrderDetail.builder()
|
|
|
@ -332,13 +332,14 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
save(collectOrder);
|
|
|
|
save(collectOrder);
|
|
|
|
IoSplitCodeEntity splitCodeEntity = splitCodeService.findByCode(addInvDesDetaiRequest.getCode(), addInvDesDetaiRequest.getSplitFifoInv().getWorkPlaceCode(), null);
|
|
|
|
IoSplitCodeEntity splitCodeEntity = splitCodeService.findByCode(addInvDesDetaiRequest.getCode(), addInvDesDetaiRequest.getSplitFifoInv().getWorkPlaceCode(), null);
|
|
|
|
if (splitCodeEntity == null) {
|
|
|
|
if (splitCodeEntity == null) {
|
|
|
|
throw new JsonException(500,"该追溯码不存在!");
|
|
|
|
throw new JsonException(500, "该追溯码不存在!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int count = IntUtil.value(splitCodeEntity.getRemainCount()) - IntUtil.value(addInvDesDetaiRequest.getOutCount());
|
|
|
|
int count = IntUtil.value(splitCodeEntity.getRemainCount()) - IntUtil.value(addInvDesDetaiRequest.getOutCount());
|
|
|
|
if (count < 0) {
|
|
|
|
if (count < 0) {
|
|
|
|
if (splitCodeEntity == null) {
|
|
|
|
if (splitCodeEntity == null) {
|
|
|
|
throw new RuntimeException("存量不足!");
|
|
|
|
throw new RuntimeException("存量不足!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
count = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
splitCodeEntity.setRemainCount(count);
|
|
|
|
splitCodeEntity.setRemainCount(count);
|
|
|
|
splitCodeService.updateById(splitCodeEntity);
|
|
|
|
splitCodeService.updateById(splitCodeEntity);
|
|
|
|