|
@@ -120,6 +120,23 @@ public class PurchaseFlow extends FlowDelegate {
|
|
|
|
|
|
@Override
|
|
|
public void reject(Long flowId, Long businessId, FlowStatusEnum flowStatus) {
|
|
|
+
|
|
|
+ Map<Long, PurchaseBom> purchaseBomMap = purchaseBomService.mapKEntity(
|
|
|
+ PurchaseBom::getApplyBuyBomId,
|
|
|
+ q -> q.eq(PurchaseBom::getPurchaseId, businessId));
|
|
|
+
|
|
|
+ List<ApplyBuyBom> applyBuyBomList = applyBuyBomService.list(
|
|
|
+ q -> q.eq(ApplyBuyBom::getApplyBuyId, businessId));
|
|
|
+
|
|
|
+ applyBuyBomList.forEach(item -> {
|
|
|
+ PurchaseBom purchaseBom = purchaseBomMap.get(item.getId());
|
|
|
+ if (purchaseBom == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ item.setFrozenQuantity(item.getFrozenQuantity().subtract(purchaseBom.getPurchaseQuantity()));
|
|
|
+ });
|
|
|
+ applyBuyBomService.updateBatchById(applyBuyBomList);
|
|
|
+
|
|
|
purchaseService.update(q -> q
|
|
|
.eq(BaseIdPo::getId, businessId)
|
|
|
.set(Purchase::getFlowStatus, flowStatus.getKey())
|