|
|
|
@ -161,7 +161,7 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
|
.createTime(new Date())
|
|
|
|
|
.billTime(new Date())
|
|
|
|
|
.remark(addInvDesDetaiRequest.getRemark())
|
|
|
|
|
.status(1)
|
|
|
|
|
.status(2)
|
|
|
|
|
.createUser(addInvDesDetaiRequest.getCreateUser())
|
|
|
|
|
.updateTime(new Date())
|
|
|
|
|
.updateUser(addInvDesDetaiRequest.getUpdateUser())
|
|
|
|
@ -194,8 +194,78 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I
|
|
|
|
|
.produceDate(splitFifoInv.getProduceDate())
|
|
|
|
|
.expireDate(splitFifoInv.getExpireDate())
|
|
|
|
|
.supId(splitFifoInv.getSupId())
|
|
|
|
|
.count(splitFifoInv.getReCount())
|
|
|
|
|
.reCount(splitFifoInv.getReCount())
|
|
|
|
|
.count(addInvDesDetaiRequest.getOutCount())
|
|
|
|
|
.reCount(addInvDesDetaiRequest.getOutCount())
|
|
|
|
|
.createTime(new Date())
|
|
|
|
|
.updateTime(new Date())
|
|
|
|
|
.remark("").build();
|
|
|
|
|
boolean save1 = splitDesOrderDetailService.save(splitDesOrderDetail);
|
|
|
|
|
if (!save1){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Boolean destroyOutByCode(AddInvDesDetaiRequest addInvDesDetaiRequest) {
|
|
|
|
|
IoSplitFifoCodeEntity splitFifoCodeEntity = splitFifoCodeService.findByCode(addInvDesDetaiRequest.getCode(), addInvDesDetaiRequest.getSplitFifoInv().getWorkPlaceCode());
|
|
|
|
|
if (splitFifoCodeEntity == null) {
|
|
|
|
|
throw new JsonException("该工位不存在,请检查后重试!");
|
|
|
|
|
}
|
|
|
|
|
IoSplitDesOrder collectOrder;
|
|
|
|
|
collectOrder = IoSplitDesOrder.builder()
|
|
|
|
|
.id(IdUtil.getSnowflakeNextId())
|
|
|
|
|
.billNo(gennerOrderUtils.createWdOrderNo(new OrderNoTypeBean(Constant.SPLIT_DES_ORDER, "yyyyMMdd")))
|
|
|
|
|
.busType("1")
|
|
|
|
|
.orderType(1)
|
|
|
|
|
.workPlaceCode(addInvDesDetaiRequest.getSplitFifoInv().getWorkPlaceCode())
|
|
|
|
|
.createTime(new Date())
|
|
|
|
|
.billTime(new Date())
|
|
|
|
|
.remark(addInvDesDetaiRequest.getRemark())
|
|
|
|
|
.status(2)
|
|
|
|
|
.createUser(addInvDesDetaiRequest.getCreateUser())
|
|
|
|
|
.updateTime(new Date())
|
|
|
|
|
.updateUser(addInvDesDetaiRequest.getUpdateUser())
|
|
|
|
|
.build();
|
|
|
|
|
boolean save = save(collectOrder);
|
|
|
|
|
if(!save){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
splitFifoCodeEntity.setTotalCount(splitFifoCodeEntity.getTotalCount() - addInvDesDetaiRequest.getOutCount());
|
|
|
|
|
//是否在增加一个码字段 记录可用数量
|
|
|
|
|
splitFifoCodeEntity.setUpdateTime(new Date());
|
|
|
|
|
boolean b = splitFifoCodeService.updateById(splitFifoCodeEntity);
|
|
|
|
|
if (!b){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//拿到 产品库存
|
|
|
|
|
IoSplitFifoInv splitFifoInv = ioSplitFifoInvService.getOne(new LambdaQueryWrapper<IoSplitFifoInv>()
|
|
|
|
|
.eq(IoSplitFifoInv::getId,splitFifoCodeEntity.getInvIdFk()));
|
|
|
|
|
if (splitFifoInv == null){
|
|
|
|
|
throw new JsonException(5000,"未找到该产品!");
|
|
|
|
|
}
|
|
|
|
|
//修改产品 库存 入库数量
|
|
|
|
|
splitFifoInv.setInCount(splitFifoInv.getInCount() - addInvDesDetaiRequest.getOutCount());
|
|
|
|
|
splitFifoInv.setOutCount(splitFifoInv.getOutCount() + addInvDesDetaiRequest.getOutCount());//出库数量
|
|
|
|
|
splitFifoInv.setReCount(splitFifoInv.getInCount() - splitFifoInv.getOutCount());//剩余数量
|
|
|
|
|
splitFifoInv.setAvailableCount(splitFifoInv.getInCount() - splitFifoInv.getOutCount()-splitFifoInv.getLockCount());//实用数量
|
|
|
|
|
splitFifoInv.setUpdateTime(new Date());
|
|
|
|
|
//更改 库存
|
|
|
|
|
boolean update = ioSplitFifoInvService.updateById(splitFifoInv);
|
|
|
|
|
if (!update){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
IoSplitDesOrderDetail splitDesOrderDetail = IoSplitDesOrderDetail.builder()
|
|
|
|
|
.id(IdUtil.getSnowflakeNextId())
|
|
|
|
|
.workPlaceCode(collectOrder.getWorkPlaceCode())
|
|
|
|
|
.orderIdFk(collectOrder.getBillNo())
|
|
|
|
|
.invId(splitFifoInv.getId())
|
|
|
|
|
.relId(splitFifoInv.getRelId())
|
|
|
|
|
.batchNo(splitFifoInv.getBatchNo())
|
|
|
|
|
.produceDate(splitFifoInv.getProduceDate())
|
|
|
|
|
.expireDate(splitFifoInv.getExpireDate())
|
|
|
|
|
.supId(splitFifoInv.getSupId())
|
|
|
|
|
.count(addInvDesDetaiRequest.getOutCount())
|
|
|
|
|
.reCount(addInvDesDetaiRequest.getOutCount())
|
|
|
|
|
.createTime(new Date())
|
|
|
|
|
.updateTime(new Date())
|
|
|
|
|
.remark("").build();
|
|
|
|
|