Sfoglia il codice sorgente

安品首页加接口

lazhaoqian 3 anni fa
parent
commit
ce8b1e94c9

+ 145 - 62
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -3234,86 +3234,169 @@
     </select>
     <select id="statistics" resultType="map">
         SELECT
-            temp.billType,
-            CASE
+        temp.billType,
+        CASE
 
-                WHEN temp.billType = 'CK' THEN
-                    '出库'
-                WHEN temp.billType = 'RK' THEN
-                    '入库'
-                WHEN temp.billType = 'SQ' THEN
-                    '采购'
-                WHEN temp.billType = 'XS' THEN
-                    '销售'
-                END AS billTypeName,
-            IFNULL( temp.num, 0 ) AS allNum,
-            IFNULL( temp.money, 0 ) AS allMoney,
-            IFNULL( success.num, 0 ) AS entryNum,
-            IFNULL( success.money, 0 ) AS entryMoney,
-            IFNULL( fail.num, 0 ) AS notNum,
-            IFNULL( fail.money, 0 ) AS notMoney
+        WHEN temp.billType = 'CK' THEN
+        '出库'
+        WHEN temp.billType = 'RK' THEN
+        '入库'
+        WHEN temp.billType = 'SQ' THEN
+        '采购'
+        WHEN temp.billType = 'XS' THEN
+        '销售'
+        END AS billTypeName,
+        IFNULL( temp.num, 0 ) AS allNum,
+        IFNULL( temp.money, 0 ) AS allMoney,
+        IFNULL( success.num, 0 ) AS entryNum,
+        IFNULL( success.money, 0 ) AS entryMoney,
+        IFNULL( fail.num, 0 ) AS notNum,
+        IFNULL( fail.money, 0 ) AS notMoney
         FROM
-            (
-                SELECT
-                    f_billstatus AS billStatus,
-                    f_billtype AS billType,
-                    COUNT( 1 ) AS num,
-                    IFNULL( SUM( f_money ), 0 ) AS money
-                FROM
-                    t_warehousebills
-                WHERE
-                    del_flag = 0
-                  AND f_billtype != 'DB'
+        (
+        SELECT
+        f_billstatus AS billStatus,
+        f_billtype AS billType,
+        COUNT( 1 ) AS num,
+        IFNULL( SUM( f_money ), 0 ) AS money
+        FROM
+        t_warehousebills
+        WHERE
+        del_flag = 0
+        AND f_billtype IN ('CK','RK')
         <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
             and f_bsdate &gt;= #{timeInterval[0]}
         </if>
         <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
             and f_bsdate &lt;= #{timeInterval[1]}
         </if>
-                GROUP BY
-                    f_billtype
-            ) temp
-                LEFT JOIN (
-                SELECT
-                    f_billstatus AS billStatus,
-                    f_billtype AS billType,
-                    COUNT( 1 ) AS num,
-                    IFNULL( SUM( f_money ), 0 ) AS money
-                FROM
-                    t_warehousebills
-                WHERE
-                    del_flag = 0
-                  AND f_billtype != 'DB'
-                  AND f_billstatus = 6
+        GROUP BY
+        f_billtype
+        ) temp
+        LEFT JOIN (
+        SELECT
+        f_billstatus AS billStatus,
+        f_billtype AS billType,
+        COUNT( 1 ) AS num,
+        IFNULL( SUM( f_money ), 0 ) AS money
+        FROM
+        t_warehousebills
+        WHERE
+        del_flag = 0
+        AND f_billtype IN ('CK','RK')
+        AND f_billstatus = 6
         <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
             and f_bsdate &gt;= #{timeInterval[0]}
         </if>
         <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
             and f_bsdate &lt;= #{timeInterval[1]}
         </if>
-                GROUP BY
-                    f_billtype
-            ) success ON temp.billType = success.billType
-                LEFT JOIN (
-                SELECT
-                    f_billstatus AS billStatus,
-                    f_billtype AS billType,
-                    COUNT( 1 ) AS num,
-                    IFNULL( SUM( f_money ), 0 ) AS money
-                FROM
-                    t_warehousebills
-                WHERE
-                    del_flag = 0
-                  AND f_billtype != 'DB'
-                  AND f_billstatus != 6
+        GROUP BY
+        f_billtype
+        ) success ON temp.billType = success.billType
+        LEFT JOIN (
+        SELECT
+        f_billstatus AS billStatus,
+        f_billtype AS billType,
+        COUNT( 1 ) AS num,
+        IFNULL( SUM( f_money ), 0 ) AS money
+        FROM
+        t_warehousebills
+        WHERE
+        del_flag = 0
+        AND f_billtype IN ('CK','RK')
+        AND f_billstatus != 6
         <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
             and f_bsdate &gt;= #{timeInterval[0]}
         </if>
         <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
-        and f_bsdate &lt;= #{timeInterval[1]}
+            and f_bsdate &lt;= #{timeInterval[1]}
+        </if>
+        GROUP BY
+        f_billtype
+        ) fail ON temp.billType = fail.billType
+        union
+        SELECT
+        temp.billType,
+        CASE
+
+        WHEN temp.billType = 'CK' THEN
+        '出库'
+        WHEN temp.billType = 'RK' THEN
+        '入库'
+        WHEN temp.billType = 'SQ' THEN
+        '采购'
+        WHEN temp.billType = 'XS' THEN
+        '销售'
+        END AS billTypeName,
+        IFNULL( temp.num, 0 ) AS allNum,
+        IFNULL( temp.money, 0 ) AS allMoney,
+        IFNULL( success.num, 0 ) AS entryNum,
+        IFNULL( success.money, 0 ) AS entryMoney,
+        IFNULL( fail.num, 0 ) AS notNum,
+        IFNULL( fail.money, 0 ) AS notMoney
+        FROM
+        (
+        SELECT
+        f_billstatus AS billStatus,
+        f_billtype AS billType,
+        COUNT( 1 ) AS num,
+        IFNULL( SUM( f_money ), 0 ) AS money
+        FROM
+        t_warehousebills
+        WHERE
+        del_flag = 0
+        AND f_billtype IN ('SQ','XS')
+        <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
+            and f_bsdate &gt;= #{timeInterval[0]}
+        </if>
+        <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
+            and f_bsdate &lt;= #{timeInterval[1]}
+        </if>
+        GROUP BY
+        f_billtype
+        ) temp
+        LEFT JOIN (
+        SELECT
+        f_billstatus AS billStatus,
+        f_billtype AS billType,
+        COUNT( 1 ) AS num,
+        IFNULL( SUM( f_money ), 0 ) AS money
+        FROM
+        t_warehousebills
+        WHERE
+        del_flag = 0
+        AND f_billtype IN ('SQ','XS')
+        AND f_print != 0
+        <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
+            and f_bsdate &gt;= #{timeInterval[0]}
+        </if>
+        <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
+            and f_bsdate &lt;= #{timeInterval[1]}
+        </if>
+        GROUP BY
+        f_billtype
+        ) success ON temp.billType = success.billType
+        LEFT JOIN (
+        SELECT
+        f_billstatus AS billStatus,
+        f_billtype AS billType,
+        COUNT( 1 ) AS num,
+        IFNULL( SUM( f_money ), 0 ) AS money
+        FROM
+        t_warehousebills
+        WHERE
+        del_flag = 0
+        AND f_billtype IN ('SQ','XS')
+        AND f_print = 0
+        <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
+            and f_bsdate &gt;= #{timeInterval[0]}
+        </if>
+        <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
+            and f_bsdate &lt;= #{timeInterval[1]}
         </if>
-                GROUP BY
-                    f_billtype
-            ) fail ON temp.billType = fail.billType
+        GROUP BY
+        f_billtype
+        ) fail ON temp.billType = fail.billType
     </select>
 </mapper>