|
@@ -3126,14 +3126,33 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
}
|
|
}
|
|
|
|
|
|
//修改订单出库状态
|
|
//修改订单出库状态
|
|
- this.update(q -> q
|
|
|
|
- .eq(Contract::getId, contractId)
|
|
|
|
-// .set(Contract::getOutboundStatus, 1)
|
|
|
|
-// .set(Contract::getOutboundTime, new Date())
|
|
|
|
- .set(Contract::getStatus, 75)//已发货
|
|
|
|
- .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
|
- .set(BasePo::getUpdateTime, new Date())
|
|
|
|
- );
|
|
|
|
|
|
+ //统计出库数量
|
|
|
|
+ boolean flag = true;
|
|
|
|
+ List<ContractProduct> list = contractProductService.list(q -> q.eq(ContractProduct::getQuantity, contractId));
|
|
|
|
+ for (ContractProduct contractProduct : list) {
|
|
|
|
+ List<ContractOutboundRecordsVo> cor = contractOutboundRecordsService.getList(IWrapper.getWrapper()
|
|
|
|
+ .eq("cor", ContractOutboundRecords::getContractProductId, contractProduct.getId())
|
|
|
|
+ .in("coi.status", 10, 30, 60)
|
|
|
|
+ );
|
|
|
|
+ if (ObjectUtil.isEmpty(cor)) {
|
|
|
|
+ cor = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+ BigDecimal outCount = cor.stream()
|
|
|
|
+ .map(ContractOutboundRecords::getQuantity)
|
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ if (contractProduct.getQuantity().compareTo(outCount) > 0) {
|
|
|
|
+ flag = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (flag) {
|
|
|
|
+ this.update(q -> q
|
|
|
|
+ .eq(Contract::getId, contractId)
|
|
|
|
+ .set(Contract::getStatus, 75)//已发货
|
|
|
|
+ .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
|
+ .set(BasePo::getUpdateTime, new Date())
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
|
|
ContractVo contract = baseMapper.detail(contractId);
|
|
ContractVo contract = baseMapper.detail(contractId);
|
|
Assert.notEmpty(contract, "查询不到销售订单信息!");
|
|
Assert.notEmpty(contract, "查询不到销售订单信息!");
|