Procházet zdrojové kódy

出货数量问题处理

yzc před 1 rokem
rodič
revize
7e3b763dc1

+ 5 - 2
hx-form/src/main/java/com/fjhx/form/service/impl/StatisticsServiceImpl.java

@@ -3,7 +3,8 @@ package com.fjhx.form.service.impl;
 import com.fjhx.account.entity.account.po.AccountRunningWater;
 import com.fjhx.account.service.account.AccountRunningWaterService;
 import com.fjhx.common.enums.FlowStatusEnum1;
-import com.fjhx.flow.entity.flow.po.FlowExample;
+import com.fjhx.flow.entity.flow.po.FlowExampleCurrent;
+import com.fjhx.flow.service.flow.FlowExampleCurrentService;
 import com.fjhx.flow.service.flow.FlowExampleService;
 import com.fjhx.form.mapper.StatisticsMapper;
 import com.fjhx.form.service.StatisticsService;
@@ -45,6 +46,8 @@ public class StatisticsServiceImpl implements StatisticsService {
     private StockWaitDetailsService stockWaitDetailsService;
     @Autowired
     private StockWaitService stockWaitService;
+    @Autowired
+    private FlowExampleCurrentService flowExampleCurrentService;
 
     /**
      * 工作统计
@@ -60,7 +63,7 @@ public class StatisticsServiceImpl implements StatisticsService {
         boolean isHeadOffice = companyIds.contains(100L);
 
         //统计待审批数据
-        long waitFlowCount = flowExampleService.count(q -> q.in(FlowExample::getStatus, 1, 0).eq(FlowExample::getHandleUserId, userId));
+        long waitFlowCount = flowExampleCurrentService.count(q -> q.eq(FlowExampleCurrent::getHandleUserId, userId));
         //待报价 总公司对内报价单 子公司 报价评估
         long waitQuotationCount = saleQuotationService.count(q -> q
                 //总公司

+ 5 - 1
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractProductVo.java

@@ -253,6 +253,10 @@ public class ContractProductVo extends ContractProduct {
      * 销售出库数量
      */
     private BigDecimal saleOutboundQuantity;
+    /**
+     * 未出货数量
+     */
+    private BigDecimal notSaleOutboundQuantity;
 
     /**
      * 实际出库数量
@@ -260,7 +264,7 @@ public class ContractProductVo extends ContractProduct {
     private BigDecimal outboundQuantity;
 
     /**
-     * 工数量
+     * 工数量
      */
     private BigDecimal finishQuantity;
 

+ 10 - 1
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractProductServiceImpl.java

@@ -190,7 +190,16 @@ public class ContractProductServiceImpl extends ServiceImpl<ContractProductMappe
 
     @Override
     public List<ContractProductVo> getList(IWrapper<ContractProduct> wrapper) {
-        return baseMapper.getList(wrapper);
+        List<ContractProductVo> list = baseMapper.getList(wrapper);
+        for (ContractProductVo contractProductVo : list) {
+            BigDecimal saleOutboundQuantity = contractProductVo.getSaleOutboundQuantity();
+            if (saleOutboundQuantity == null) {
+                saleOutboundQuantity = BigDecimal.ZERO;
+            }
+            BigDecimal notSaleOutboundQuantity = contractProductVo.getQuantity().subtract(saleOutboundQuantity);
+            contractProductVo.setNotSaleOutboundQuantity(notSaleOutboundQuantity);
+        }
+        return list;
     }
 
     /**

+ 13 - 15
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -16,8 +16,6 @@
                      (t1.sumClaimMoney - t1.invoiceAmount)     as unInvoiceAmount
               FROM (SELECT t1.*,
                            c.name                              customerName,
---                            us.nick_name                      salesmanName,
---                            us.user_id                        salesmanId,
                            (SELECT IFNULL(SUM(cc.contract_money), 0)
                             FROM claim_contract cc
                                      JOIN claim cl ON cc.claim_id = cl.id
@@ -42,7 +40,6 @@
                               AND iacd.contract_id = c.id)  AS invoiceAmount
                     FROM contract t1
                              left join customer c on t1.buy_corporation_id = c.id
---                              left join sys_user us on c.user_id = us.user_id
                              LEFT JOIN production_order po ON po.contract_id = t1.id
                              LEFT JOIN (SELECT pod.contract_id,
                                                IFNULL(sum(swd.quantity), 0)         AS quantity,
@@ -50,18 +47,19 @@
                                         FROM production_order_detail pod
                                                  JOIN stock_wait_details swd ON swd.prod_task_id = pod.id
                                         GROUP BY pod.contract_id) t3 ON t3.contract_id = t1.id
-                             LEFT JOIN (SELECT t1.contract_id,
-                                               t1.quantity,
-                                               t1.deliverQuantity,
-                                               (t1.quantity - t1.deliverQuantity) notDeliverQuantity
-                                        FROM (SELECT cp.contract_id,
-                                                     IFNULL(sum(cp.quantity), 0)  AS quantity,
-                                                     IFNULL(sum(cor.quantity), 0) AS deliverQuantity
-                                              FROM contract_product cp
-                                                       LEFT JOIN contract_outbound_records cor ON cp.id = cor.contract_product_id
-                                                       LEFT JOIN contract_outbound_info coi ON cor.record_id = coi.id
-                                              WHERE coi.`status` in (30, 60)
-                                              GROUP BY cp.contract_id) t1) t4 ON t4.contract_id = t1.id) t1
+                             LEFT JOIN (SELECT cp.contract_id,
+                                               IFNULL(sum(cp.quantity), 0)                                 AS quantity,
+                                               IFNULL(t2.deliverQuantity, 0)                               AS deliverQuantity,
+                                               IFNULL(sum(cp.quantity), 0) - IFNULL(t2.deliverQuantity, 0) AS notDeliverQuantity
+                                        FROM contract_product cp
+                                                 LEFT JOIN (SELECT cor.contract_id,
+                                                                   IFNULL(sum(cor.quantity), 0) AS deliverQuantity
+                                                            FROM contract_outbound_records cor
+                                                                     JOIN contract_outbound_info coi ON cor.record_id = coi.id
+                                                            WHERE coi.`status` IN (30, 60)
+                                                            GROUP BY cor.contract_id) t2
+                                                           ON cp.contract_id = t2.contract_id
+                                        GROUP BY cp.contract_id) t4 ON t4.contract_id = t1.id) t1
               GROUP BY t1.id) t1
     </sql>