yzc 1 год назад
Родитель
Сommit
2969b3fbe9

+ 23 - 25
hx-sale/src/main/java/com/fjhx/sale/flow/EhsdPurchaseFlow.java

@@ -18,7 +18,6 @@ import com.fjhx.item.enums.ProductAvailableRecordType;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.purchase.entity.purchase.enums.PurchaseDataResourceEnum;
 import com.fjhx.purchase.entity.purchase.enums.PurchaseStatusEnum;
-import com.fjhx.purchase.entity.subscribe.po.SubscribeDetail;
 import com.fjhx.purchase.service.subscribe.SubscribeDetailService;
 import com.fjhx.sale.entity.contract.po.Contract;
 import com.fjhx.sale.entity.purchase.dto.EhsdPurchaseDto;
@@ -44,7 +43,6 @@ import com.ruoyi.common.utils.SecurityUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -226,29 +224,29 @@ public class EhsdPurchaseFlow extends FlowDelegate {
                 inOutBoList.add(inOutBo);
             }
 
-            //数据来源是合同
-            if (Objects.equals(purchaseProduct.getDataResource(), PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey())) {
-                //获取采购,待采购信息
-                Long subscribeDetailId = purchaseProduct.getSubscribeDetailId();
-                BigDecimal purchaseSumCount = purchaseProductMapper.getPurchaseQuantitySumBySubscribeDetailId(subscribeDetailId);
-                SubscribeDetail subscribeDetail = subscribeDetailService.getById(subscribeDetailId);
-                Assert.notEmpty(subscribeDetail, "查询不到待采购信息!");
-
-                //已采购数量>待采购 本次超采量=已采购数量-待采购量-((已采购-本次采购)-待采购量)
-                if (purchaseSumCount.compareTo(subscribeDetail.getCount()) > 0) {
-                    //计算超采量
-                    BigDecimal oldPurchaseCount = purchaseSumCount.subtract(purchaseProduct.getQuantity());//(已采购-本次采购)
-                    BigDecimal subtract = oldPurchaseCount.subtract(subscribeDetail.getCount());//((已采购-本次采购)-待采购量)
-                    BigDecimal exceedQuantity = purchaseSumCount.subtract(subscribeDetail.getCount()).subtract(subtract);
-
-                    purchaseProduct.setExceedQuantity(exceedQuantity);
-
-                    AvailableStockBo inOutBo = new AvailableStockBo();
-                    inOutBo.setProductId(purchaseProduct.getProductId());
-                    inOutBo.setQuantity(exceedQuantity);
-                    inOutBoList.add(inOutBo);
-                }
-            }
+//            //数据来源是合同
+//            if (Objects.equals(purchaseProduct.getDataResource(), PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey())) {
+//                //获取采购,待采购信息
+//                Long subscribeDetailId = purchaseProduct.getSubscribeDetailId();
+//                BigDecimal purchaseSumCount = purchaseProductMapper.getPurchaseQuantitySumBySubscribeDetailId(subscribeDetailId);
+//                SubscribeDetail subscribeDetail = subscribeDetailService.getById(subscribeDetailId);
+//                Assert.notEmpty(subscribeDetail, "查询不到待采购信息!");
+//
+//                //已采购数量>待采购 本次超采量=已采购数量-待采购量-((已采购-本次采购)-待采购量)
+//                if (purchaseSumCount.compareTo(subscribeDetail.getCount()) > 0) {
+//                    //计算超采量
+//                    BigDecimal oldPurchaseCount = purchaseSumCount.subtract(purchaseProduct.getQuantity());//(已采购-本次采购)
+//                    BigDecimal subtract = oldPurchaseCount.subtract(subscribeDetail.getCount());//((已采购-本次采购)-待采购量)
+//                    BigDecimal exceedQuantity = purchaseSumCount.subtract(subscribeDetail.getCount()).subtract(subtract);
+//
+//                    purchaseProduct.setExceedQuantity(exceedQuantity);
+//
+//                    AvailableStockBo inOutBo = new AvailableStockBo();
+//                    inOutBo.setProductId(purchaseProduct.getProductId());
+//                    inOutBo.setQuantity(exceedQuantity);
+//                    inOutBoList.add(inOutBo);
+//                }
+//            }
         }
         productInfoService.editAvailableQuantity(inOutBoList, businessId, ProductAvailableRecordType.PURCHASE_PASS, purchase.getCompanyId());
 

+ 7 - 7
hx-sale/src/main/java/com/fjhx/sale/service/purchase/impl/EhsdPurchaseServiceImpl.java

@@ -475,13 +475,13 @@ public class EhsdPurchaseServiceImpl extends ServiceImpl<EhsdPurchaseMapper, Ehs
                 inOutBoList.add(inOutBo);
             }
 
-            //如果数据来源是合同 操作可用库存(可用库存 = 当前可用库存 - 采购超采量)
-            if (Objects.equals(purchaseProduct.getDataResource(), PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey())) {
-                AvailableStockBo inOutBo = new AvailableStockBo();
-                inOutBo.setProductId(purchaseProduct.getProductId());
-                inOutBo.setQuantity(purchaseProduct.getExceedQuantity());
-                inOutBoList.add(inOutBo);
-            }
+//            //如果数据来源是合同 操作可用库存(可用库存 = 当前可用库存 - 采购超采量)
+//            if (Objects.equals(purchaseProduct.getDataResource(), PurchaseDataResourceEnum.DATA_RESOURCE_1.getKey())) {
+//                AvailableStockBo inOutBo = new AvailableStockBo();
+//                inOutBo.setProductId(purchaseProduct.getProductId());
+//                inOutBo.setQuantity(purchaseProduct.getExceedQuantity());
+//                inOutBoList.add(inOutBo);
+//            }
         }
         productInfoService.editAvailableQuantity(inOutBoList, id, ProductAvailableRecordType.PURCHASE_CANCEL, purchase.getCompanyId());
         //检查待入库是否存在,已入库或者部分入库的数据