出库分配数量数值更新

This commit is contained in:
zhou-hongcheng
2026-03-18 20:38:26 +08:00
parent d2f309af6b
commit b7fcd42496
3 changed files with 23 additions and 4 deletions
@@ -5,6 +5,7 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.OrderSequence;
@@ -64,6 +65,7 @@ import com.mhd.wms.domain.stockOutOrder.repository.facade.IStockOutOrderService;
import com.mhd.wms.domain.stockOutOrder.repository.po.StockOutOrderPO;
import com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO;
import com.mhd.wms.domain.waveOrder.factorys.WaveOrderServiceFactory;
import com.mhd.wms.interfaces.dto.outMaterialDetail.OutMaterialDetailDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -428,6 +430,10 @@ public class StockOutOrderDomainService {
//取消分配:stockOutOrderPO.getAllocationQuantity() 和 stockOutOrderPO.getAlreadyAllocationQuantity() 都是要取消的数量
//物料明细层面的验证已经在 batchCancelAssignUpdate 中完成,这里直接使用即可
BigDecimal cancelQuantity = stockOutOrderPO.getAllocationQuantity();
stockOutOrderService.update(null,new UpdateWrapper<StockOutOrder>().lambda()
.setSql("allocation_quantity = allocation_quantity - " + cancelQuantity)//取消分配减数量
.eq(StockOutOrder::getOutOrderId, stockOutOrderDb.getOutOrderId())
);
BigDecimal cancelAlreadyAllocationQuantity = stockOutOrderPO.getAlreadyAllocationQuantity() != null
? stockOutOrderPO.getAlreadyAllocationQuantity()
: BigDecimal.ZERO;
@@ -448,19 +454,22 @@ public class StockOutOrderDomainService {
status = judgeAllocationQuantityByManualAssign(stockOutOrderPO.getAllocationQuantity(), stockOutOrderPO.getAlreadyAllocationQuantity(),type);
}else {
allocationQuantity = allocationQuantity.add(stockOutOrderPO.getAllocationQuantity());
allocationQuantity = stockOutOrderPO.getAllocationQuantity();//直接使用返回的分配数量
alreadyAllocationQuantity = alreadyAllocationQuantity.add(stockOutOrderPO.getAlreadyAllocationQuantity() != null
? stockOutOrderPO.getAlreadyAllocationQuantity()
: BigDecimal.ZERO);
}
return stockOutOrderService.update(null, new UpdateWrapper<StockOutOrder>().lambda()
LambdaUpdateWrapper<StockOutOrder> wrapper = new UpdateWrapper<StockOutOrder>().lambda()
.set(StockOutOrder::getStatus, status)
.set(StockOutOrder::getAllocationQuantity, allocationQuantity)
.set(StockOutOrder::getAlreadyAllocationQuantity, alreadyAllocationQuantity)
.set(StockOutOrder::getUpdateBy, loginUser.getUserid())
.set(StockOutOrder::getUpdateByName, loginUser.getUsername())
.set(StockOutOrder::getUpdateTime, new Date())
.eq(StockOutOrder::getOutOrderId, stockOutOrderDb.getOutOrderId()));
.eq(StockOutOrder::getOutOrderId, stockOutOrderDb.getOutOrderId());
if (type != 2){
wrapper.set(StockOutOrder::getAllocationQuantity, allocationQuantity);
}
return stockOutOrderService.update(null, wrapper);
}
@@ -132,6 +132,7 @@ public class WaveOrderDomainService {
if (allocationQuantity.compareTo(quantity) == 0){
status = 4;
}
waveOrderService.update(null, new UpdateWrapper<WaveOrder>().lambda()
.set(WaveOrder::getStatus, status)
.set(WaveOrder::getAllocationQuantity, allocationQuantity)