Browse Source

修改内转车辆统计报表

luobang 2 years ago
parent
commit
d8b4c42611

+ 13 - 1
src/main/java/com/steerinfo/dil/controller/StatisticalReportController.java

@@ -504,9 +504,21 @@ public class StatisticalReportController extends BaseRESTfulController {
                                          Integer pageNum,
                                          Integer pageSize,
                                          String startTime,
-                                         String endTime
+                                         String endTime, BigDecimal orderType, String index, String isPage,String orgCode
     ){
+        if (index!=null&&!"null".equals(index)){
+            mapValue.put("index",index);
+        }
+        if (orgCode!=null&&!"null".equals(orgCode)){
+            mapValue.put("orgCode",orgCode);
+        }
+        if (orderType!=null&&!"null".equals(orderType)){
+            mapValue.put("orderTypee",orderType);
+        }
         DataChange.queryDataByDateTime(startTime, endTime, mapValue,sdfDateTime);//根据时间段查询数据
+        if ("yes".equals(isPage)){
+            return  success(statisticalReportService.getInwardReportForAssemble(mapValue));
+        }
         PageHelper.startPage(pageNum, pageSize);
         //分页数据
         List<Map<String, Object>> report = statisticalReportService.getInwardReportForAssemble(mapValue);

+ 73 - 119
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -1406,130 +1406,84 @@
         </where>
     </select>
     <select id="getInwardReportForAssemble" resultType="java.util.Map" parameterType="java.util.Map">
-        select * from (
-        select
-        OO.ORDER_NUMBER "orderNumber",
-        RC.CAPACITY_NUMBER  "capacityNumber",
-        RS.SHIPPER_NAME     "shipperName",
-        RW1.WAREHOUSE_NAME  "unloadName",
-        RW2.WAREHOUSE_NAME  "loadName",
-        APO.PURCHASE_ORDER_NO "purchaseOrderNo",
-        RM.MATERIAL_NAME    "materialName",
-        RTC2.TRUCK_CALCULATE_NUMBER "grossNumber",
-        RTC1.TRUCK_CALCULATE_NUMBER "tareNumber",
-        TWR.RESULT_NET_WEIGHT   "resultNetWeight",
-        TWR.RESULT_TARE_WEIGHT_TIME  "resultTareWeightTime",
-        TWR.RESULT_TARE_WEIGHT      "resultTareWeight",
-        TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
-        TWR.RESULT_GROSS_WEIGHT     "resultGrossWeight"
-        from OMSTRUCK_ORDER OO
-        left join TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
-        left join TMSTRUCK_WEIGHT_RESULT  TWR  on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
-        left join RMS_CAPACITY RC on OO.CAPACITY_ID = RC.CAPACITY_ID
-        left join RMS_TRUCK_CALCULATE RTC1 on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
-        left join RMS_TRUCK_CALCULATE RTC2 on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
-        left join AMSTRUCK_INWARD_PLAN AIP on AIP.PLAN_ID = OO.ORDER_PLAN_ID
-        left join AMSTRUCK_REQUIREMENT_PLAN ARP on AIP.PLAN_ID = ARP.PLAN_ID
-        left join AMSTRUCK_INWARD_REQUIREMENT AIR   on AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
-        left join AMS_PURCHASE_ORDER APO ON APO.PURCHASE_ORDER_ID=AIR.PURCHASE_ORDER_ID
-        left join RMS_SHIPPER   RS on AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
-        left join AMSTRUCK_REQUIREMENT_MATERIAL ARM on AIR.REQUIREMENT_ID = ARM.REQUIREMENT_ID
-        left join RMS_MATERIAL RM on ARM.MATERIAL_ID = RM.MATERIAL_ID
-        left join RMS_WAREHOUSE RW1 on ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW1.WAREHOUSE_ID
-        left join RMS_WAREHOUSE RW2 on ARM.REQUIREMENT_PLATFORM_ID = RW2.WAREHOUSE_ID
-        where OO.ORDER_TYPE in (15,16) and TWR.RESULT_NET_WEIGHT >= 0
-        <if test="oneDate != null">
-            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
-        </if>
-        <if test="startDate != null">
-            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TWR.RESULT_TARE_WEIGHT_TIME
-            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_TARE_WEIGHT_TIME
-        </if>
-        )
-        <if test=" orderNumber != null">
-            and
-            <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
-                "orderNumber" 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=" shipperName != null">
-            and
-            <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
-                "shipperName" like '%${item}%'
-            </foreach>
-        </if>
-        <if test="unloadName != null">
-            and
-            <foreach collection="unloadName" item="item" open="(" separator="or" close=")">
-                "unloadName" like '%${item}%'
-            </foreach>
-        </if>
-        <if test="loadName!= null">
-            and
-            <foreach collection="loadName" item="item" open="(" separator="or" close=")">
-                "loadName" like '%${item}%'
-            </foreach>
-        </if>
-        <if test="materialName!= null">
-            and
-            <foreach collection="materialName" item="item" open="(" separator="or" close=")">
-                "materialName" like '%${item}%'
-            </foreach>
-        </if>
-        <if test="grossNumber!= null">
-            and
-            <foreach collection="grossNumber" item="item" open="(" separator="or" close=")">
-                "grossNumber" like '%${item}%'
-            </foreach>
-        </if>
-        <if test="tareNumber!= null">
-            and
-            <foreach collection="tareNumber" item="item" open="(" separator="or" close=")">
-                "tareNumber" 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="resultTareWeightTime!= null">
-            and
-            <foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
-                "resultTareWeightTime" like '%${item}%'
-            </foreach>
+        select *
+        from (select DISTINCT oo.order_id                   "orderId",
+        rm.material_name              "materialName",
+        rc.capacity_number            "capacityNumber",
+        rs.supplier_name              "sendName",
+        oo.order_number               "orderNumber",
+        rce.consignee_company_name    "reciveName",
+        ttr.result_total_id           "totalResultId",
+        twr.result_gross_weight      "grossWeight",
+        twr.result_gross_weight_time "grossweightTime",
+        twr.result_tare_weight       "tareWeight",
+        twr.result_tare_weight_time  "tareWeightTime",
+        twr.result_net_weight        "resultNetWeight",
+        RC.CARRIER_NAME "carrierName",
+        RL.LINE_NAME "lineName"
+        from omstruck_order oo
+        left join omstruck_order_material oom
+        on oom.order_id = oo.order_id
+        LEFT JOIN RMS_LINE RL
+        ON RL.LINE_ID=OO.LINE_ID
+        left join rms_material rm
+        on rm.material_id = oom.material_id
+        left join rms_capacity rc
+        on rc.capacity_id = oo.capacity_id
+        left join amstruck_inward_plan aip
+        on aip.plan_id = oo.order_plan_id
+        left join amstruck_requirement_plan arp
+        on arp.plan_id = aip.plan_id
+        left join RMS_CARRIER  rc
+        on AIP.CARRIER_ID=rc.CARRIER_ID
+        left join amstruck_inward_requirement air
+        on air.requirement_id = arp.requirement_id
+        left join ams_purchase_order apo
+        on apo.purchase_order_id = air.purchase_order_id
+        left join rms_supplier rs
+        on rs.supplier_id = apo.supplier_unit_id
+        left join rms_consignee rce
+        on rce.consignee_id = apo.receive_unit_id
+        left join tmstruck_total_result ttr
+        on ttr.order_id = oo.order_id
+        left join tmstruck_weight_result twr
+        on twr.result_total_id = ttr.result_total_id
+        left join rms_truck_calculate rtc1
+        on rtc1.truck_calculate_id = twr.result_tare_place_id
+        left join tmstruck_load_result tlr
+        on tlr.result_total_id = ttr.result_total_id
+        left join rms_warehouse rw
+        on rw.warehouse_id = tlr.loading_id
+        left join rms_truck_calculate rtc2
+        on rtc2.truck_calculate_id = twr.result_gross_place_id
+        left join tmstruck_unload_result tur
+        on tur.result_total_id = ttr.result_total_id
+        left join rms_warehouse rw2
+        on rw2.warehouse_id = tur.result_unload_place_id
+        LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR1
+        ON TLFR1.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        where
+        twr.result_net_weight IS NOT NULL
+        AND  oo.ORDER_TYPE in (15,16)
+        <if test="orgCode!=null">
+            and oo.OPTIONER_CODE =  #{orgCode}
         </if>
-        <if test="resultTareWeight!= null">
-            and
-            <foreach collection="resultTareWeight" item="item" open="(" separator="or" close=")">
-                "resultTareWeight" like '%${item}%'
-            </foreach>
+        <if test="orderTypee !=null">
+            and oo.ORDER_TYPE = #{orderTypee}
         </if>
-        <if test="resultGrossWeightTime!= null">
-            and
-            <foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
-                "resultGrossWeightTime" like '%${item}%'
-            </foreach>
+        <if test="index!=null">
+            and ( (instr(rs.supplier_name, #{index}) > 0) or  (instr(rm.material_name , #{index}) > 0)
+            or  (instr(rc.capacity_number , #{index}) > 0)   or  (instr(rce.consignee_company_name , #{index}) > 0)
+            or  (instr( RC.CARRIER_NAME , #{index}) > 0)  or     (instr(RL.LINE_NAME , #{index}) > 0))
         </if>
-        <if test="resultGrossWeight!= null">
-            and
-            <foreach collection="resultGrossWeight" item="item" open="(" separator="or" close=")">
-                "resultGrossWeight" like '%${item}%'
-            </foreach>
+        <if test="oneDate != null">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt; = TWR.RESULT_TARE_WEIGHT_TIME
         </if>
-        <if test="purchaseOrderNo!= null">
-            and
-            <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
-                "purchaseOrderNo" like '%${item}%'
-            </foreach>
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;=  TWR.RESULT_TARE_WEIGHT_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >=  TWR.RESULT_TARE_WEIGHT_TIME
         </if>
+        )
     </select>
     <select id="getCapacityRemark" resultType="java.util.Map" parameterType="java.util.Map">
       select OO.ORDER_TYPE,

+ 1 - 1
src/main/resources/com/steerinfo/dil/mapper/TmstruckMeasureCommissionMapper.xml

@@ -1118,7 +1118,7 @@
                     RW1.WAREHOUSE_NAME "loadPlace",
                     TWR.INSERT_UPDATE_REMARK "demo",
                     RM.MATERIAL_ID "materialId",
-                    RM.MATERIAL_NAME "materiaName",
+                    CONCAT(RM.MATERIAL_NAME ,CONCAT(RM.MATERIAL_SPECIFICATION, RM.MATERIAL_MODEL)) "materiaName",
                     DB.RESULT_FOREIGN_SHIP_NAME "shipNum",
                     concat( RM.MATERIAL_SPECIFICATION, RM.MATERIAL_MODEL ) "goodsType",
                     RTC.TRUCK_CALCULATE_NUMBER "steelyardNum"