|
@@ -261,6 +261,15 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
|
|
|
BigDecimal purchaseQuantity = collect.getOrDefault(materialId, BigDecimal.ZERO);
|
|
|
|
|
|
+
|
|
|
+ SubscribeDetail subscribeDetail = subscribeDetailService.getOne(q -> q.eq(SubscribeDetail::getContractId, oldContractId)
|
|
|
+ .eq(SubscribeDetail::getProductId, materialId)
|
|
|
+ );
|
|
|
+ BigDecimal demandPurchaseCount = BigDecimal.ZERO;
|
|
|
+ if (ObjectUtils.isNotEmpty(subscribeDetail)) {
|
|
|
+ demandPurchaseCount = subscribeDetail.getCount();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
AvailableStockBo availableStockBo = new AvailableStockBo();
|
|
@@ -268,37 +277,10 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
availableStockBo.setQuantity(oldContractProductBom.getQuantity());
|
|
|
availableStockBo.setNewQuantity(newQuantity);
|
|
|
availableStockBo.setInStockQuantity(purchaseQuantity);
|
|
|
+ availableStockBo.setDemandPurchaseCount(demandPurchaseCount);
|
|
|
|
|
|
availableStockBoList.add(availableStockBo);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -318,18 +300,9 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
availableStockBo.setQuantity(null);
|
|
|
availableStockBo.setNewQuantity(newPurchaseProduct.getQuantity());
|
|
|
availableStockBo.setInStockQuantity(null);
|
|
|
- availableStockBoList.add(availableStockBo);
|
|
|
-
|
|
|
+ availableStockBo.setDemandPurchaseCount(BigDecimal.ZERO);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ availableStockBoList.add(availableStockBo);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -347,15 +320,9 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
|
|
|
BigDecimal requiredQuantity = availableStockBo.getNewQuantity();
|
|
|
|
|
|
-
|
|
|
- if (requiredQuantity.compareTo(availableStockBo.getInStockQuantity()) == 0 && requiredQuantity.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
- if (ObjectUtils.isNotEmpty(subscribeDetail)) {
|
|
|
- subscribeDetailService.removeById(subscribeDetail);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
|
|
|
- else if (requiredQuantity.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ if (requiredQuantity.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
if (ObjectUtils.isEmpty(subscribeDetail)) {
|
|
|
|
|
|
subscribeDetail = new SubscribeDetail();
|
|
@@ -379,6 +346,11 @@ public class ContractUpdateFlow extends FlowDelegate {
|
|
|
subscribeDetail.setStatus(status);
|
|
|
|
|
|
subscribeDetailService.saveOrUpdate(subscribeDetail);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if (ObjectUtils.isNotEmpty(subscribeDetail)) {
|
|
|
+ subscribeDetailService.removeById(subscribeDetail);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|