瀏覽代碼

合同分页装箱

yzc 1 年之前
父節點
當前提交
267b2538c2

+ 2 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractVo.java

@@ -233,5 +233,7 @@ public class ContractVo extends Contract {
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     private Date shipmentTime;
 
+    private Integer notPack;
+
 }
 

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

@@ -20,10 +20,23 @@
                             FROM claim_contract cc
                                      left join claim c on cc.claim_id = c.id
                                      LEFT JOIN bytesailing_account.account_running_water arw on c.business_id = arw.id
-                            WHERE cc.contract_id = t1.id) AS sumClaimMoney
+                            WHERE cc.contract_id = t1.id) AS sumClaimMoney,
+                           pa.notPack
                     FROM contract t1
                              left join bytesailing_customer.customer c on t1.buy_corporation_id = c.id
-                             left join bytesailing_base.sys_user us on c.user_id = us.user_id) t1
+                             left join bytesailing_base.sys_user us on c.user_id = us.user_id
+                             left join (SELECT pack.*,
+                                               (sumPackQuantity < cpQuantity) notPack
+                                        FROM (SELECT t1.id                                   AS contractId,
+                                                     t2.quantity                             AS cpQuantity,
+                                                     (SELECT IFNULL(SUM(pd.pack_quantity * pdd.quantity), 0)
+                                                      FROM pack_detail_product pdd
+                                                               LEFT JOIN pack_detail pd ON pdd.pack_detail_id = pd.id
+                                                      WHERE pdd.contract_product_id = t2.id) AS sumPackQuantity
+                                              FROM contract t1
+                                                       LEFT JOIN contract_product t2 ON t1.id = t2.contract_id
+                                              WHERE t1.`status` = 30
+                                              GROUP BY t1.id) pack) pa on pa.contractId = t1.id) t1
               GROUP BY t1.id) t1
             ${ew.customSqlSegment}
     </select>