|
@@ -261,6 +261,12 @@ public class ProduceOrderServiceImpl extends ServiceImpl<ProduceOrderMapper, Pro
|
|
|
Long contractId = produceOrderDto.getContractId();
|
|
|
Assert.notEmpty(produceOrderDto.getContractId(), "合同id不能为空!");
|
|
|
|
|
|
+
|
|
|
+ ProductionOrder one = this.getOne(q -> q.eq(ProductionOrder::getContractId, contractId));
|
|
|
+ if (ObjectUtil.isNotEmpty(one)) {
|
|
|
+ produceOrderDto.setId(one.getId());
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
SysDept produceCompany = sysDeptService.getById(produceOrderDto.getProduceCompanyId());
|
|
|
Assert.notEmpty(produceCompany, "查询不到生产公司信息");
|
|
@@ -282,7 +288,7 @@ public class ProduceOrderServiceImpl extends ServiceImpl<ProduceOrderMapper, Pro
|
|
|
|
|
|
produceOrderDto.setCode(contract.getCode());
|
|
|
produceOrderDto.setProduceStatus(0);
|
|
|
- this.save(produceOrderDto);
|
|
|
+ this.saveOrUpdate(produceOrderDto);
|
|
|
|
|
|
|
|
|
|
|
@@ -610,7 +616,7 @@ public class ProduceOrderServiceImpl extends ServiceImpl<ProduceOrderMapper, Pro
|
|
|
|
|
|
prodTaskProgress.setBalanceQuantity(BigDecimal.ZERO);
|
|
|
if (ObjectUtil.equals(productionProcessesVo.getSourceProcessesId(), 1L)) {
|
|
|
- BigDecimal balanceQuantity = prodTaskProgress.getFinishQuantity().subtract(productionOrderDetail.getQuantity());
|
|
|
+ BigDecimal balanceQuantity = productionOrderDetail.getQuantity().subtract(prodTaskProgress.getFinishQuantity());
|
|
|
if (balanceQuantity.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
balanceQuantity = BigDecimal.ZERO;
|
|
|
}
|