zhouzh vor 3 Jahren
Ursprung
Commit
bbd1f69f8b

+ 79 - 5
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -1103,10 +1103,14 @@
         SELECT * FROM(
         SELECT MATERIAL_NAME "materialName",
         COUNT(RC.CAPACITY_NUMBER) "capacityNumber",
+        SUM(TWR.RESULT_NET_WEIGHT)  "resultNetWeight",
+        count(TWR.RESULT_NET_WEIGHT) "number",
         WAREHOUSE_NAME "warehouseName"
         FROM TMSTRUCK_LOAD_RESULT TLR
         LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
         ON TTR.RESULT_TOTAL_ID = TLR.RESULT_TOTAL_ID
+        LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
+        ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
         LEFT JOIN OMSTRUCK_ORDER OO
         ON OO.ORDER_ID = TTR.ORDER_ID
         LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
@@ -1119,12 +1123,12 @@
         ON RW.WAREHOUSE_ID = TLR.LOADING_ID
         WHERE OO.ORDER_TYPE = 11
         AND TLR.RESULT_LOAD_START_TIME IS NOT NULL
-        <if test="oneDate != null and (con ==null || con == '') ">
-            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.INSERT_TIME
+        <if test="oneDate != null">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TLR.RESULT_LOAD_END_TIME
         </if>
         <if test="startDate != null">
-            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.INSERT_TIME
-            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.INSERT_TIME
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TLR.RESULT_LOAD_END_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TLR.RESULT_LOAD_END_TIME
         </if>
         GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
         )
@@ -1147,10 +1151,80 @@
                     "warehouseName" like '%${item}%'
                 </foreach>
             </if>
+            <if test="number != null">
+                and
+                <foreach collection="number" item="item" open="(" separator="or" close=")">
+                    "number" like '%${item}%'
+                </foreach>
+            </if>
         </where>
     </select>
 
     <select id="getUnLoading" parameterType="map" resultType="java.util.Map">
-
+        SELECT * FROM (
+        SELECT
+        COUNT(RC.CAPACITY_NUMBER) "capacityNumber",
+	    SUM(TWR.RESULT_NET_WEIGHT)  "resultNetWeight",
+        count(TWR.RESULT_NET_WEIGHT) "number",
+        MATERIAL_NAME          "materialName",
+        WAREHOUSE_NAME         "warehouseName"
+        FROM TMSTRUCK_UNLOAD_RESULT TUR
+        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
+        ON TTR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
+		LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
+		ON TWR.RESULT_TOTAL_ID = TUR.RESULT_TOTAL_ID
+        LEFT JOIN OMSTRUCK_ORDER OO
+        ON OO.ORDER_ID = TTR.ORDER_ID
+        LEFT JOIN RMS_CAPACITY RC
+        ON RC.CAPACITY_ID = OO.CAPACITY_ID
+        LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
+        ON OOM.ORDER_ID = OO.ORDER_ID
+        LEFT JOIN RMS_MATERIAL RM
+        ON RM.MATERIAL_ID = OOM.MATERIAL_ID
+        LEFT JOIN RMS_WAREHOUSE RW
+        ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
+        WHERE TUR.RESULT_END_TIME IS NOT NULL
+        AND OO.ORDER_TYPE = 11
+        <if test="oneDate != null">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TUR.RESULT_END_TIME
+        </if>
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TUR.RESULT_END_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TUR.RESULT_END_TIME
+        </if>
+		GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
+		)
+        <where>
+            <if test="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="capacityNumber != null">
+                and
+                <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
+                    "capacityNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="warehouseName != null">
+                and
+                <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
+                    "warehouseName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultNetWeight != null">
+                and
+                <foreach collection="resultNetWeight" item="item" open="(" separator="or" close=")">
+                    "resultNetWeight" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="number != null">
+                and
+                <foreach collection="number" item="item" open="(" separator="or" close=")">
+                    "number" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
     </select>
 </mapper>