Explorar el Código

解决首页左上角查询柜数区分车队

阿伏兔 hace 4 años
padre
commit
a2be0129e7

+ 11 - 5
ruoyi-fleet/src/main/resources/mapper/orderPlan/ftmsorderbillscarsMapper.xml

@@ -693,12 +693,18 @@
 
     <select id="selectHomeUpperLeftCntrs" parameterType="ftmsorderbills" resultType="Map">
         SELECT
-            IFNULL(SUM( cntr_qty ), 0) planQuantity, IFNULL(SUM( cntr_blc_qty ), 0) surplusQuantity
+            IFNULL( SUM( p.cntr_qty ), 0 ) planQuantity,
+            IFNULL( SUM( ( p.cntr_qty - p.car_qty ) ), 0 ) surplusQuantity
         FROM
-            F_TMSORDERBILLSCNTRS
-        where
-            create_time &gt;= #{currentDay[0]}
-            and create_time &lt;= #{currentDay[1]}
+            F_TMSORDERBILLSPLANS p
+            LEFT JOIN t_corps fleet ON fleet.f_id = p.carcor_pid
+        WHERE
+            p.create_time &gt;= #{currentDay[0]}
+            AND p.create_time &lt;= #{currentDay[1]}
+            AND p.bill_status = 6
+            <if test="isFleet != null and isFleet == 1">
+                AND fleet.f_id = #{fleetId}
+            </if>
     </select>
 
     <select id="selectHomeUpperLeftCars" parameterType="ftmsorderbills" resultType="int">