luobang 2 lat temu
rodzic
commit
2252a443b1

+ 8 - 8
pom.xml

@@ -141,12 +141,12 @@
             <!-- 表示开发的时候引入,发布的时候不会加载此包 -->
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.junit.jupiter</groupId>
-            <artifactId>junit-jupiter</artifactId>
-            <version>RELEASE</version>
-            <scope>compile</scope>
-        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.junit.jupiter</groupId>-->
+<!--            <artifactId>junit-jupiter</artifactId>-->
+<!--            <version>RELEASE</version>-->
+<!--            <scope>compile</scope>-->
+<!--        </dependency>-->
     </dependencies>
     <build>
         <plugins>
@@ -162,9 +162,9 @@
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-<!--                        <param>MEASURE_JSON_DATA</param>-->
+                        <!--                        <param>MEASURE_JSON_DATA</param>-->
                         <param>DIL_ROLE_ORGCODE_TABLE</param>
-<!--                        <param>DIL_CAPACITY_TIMES</param>-->
+                        <!--                        <param>DIL_CAPACITY_TIMES</param>-->
                     </tables>
                 </configuration>
                 <executions>

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

@@ -1314,10 +1314,12 @@ public class StatisticalReportController extends BaseRESTfulController {
 
     @ApiOperation("欠运力统计表")
     @PostMapping("yawnReport")
-    public RESTfulResult yawnReport(@RequestBody(required = false) Map<String,Object> map) {
+    public synchronized RESTfulResult yawnReport(@RequestBody(required = false) Map<String,Object> map) {
         String startTime = map.get("startTime").toString();
         String endTime = map.get("startTime").toString();
         DataChange.queryDataByDateTimeYestDay(startTime, endTime, map, sdfDateTime);//根据时间段查询数据
+
+        System.out.println(map.get("startDate"));
         return success(statisticalReportService.yawnReport(map));
     }
 }

+ 2 - 0
src/main/java/com/steerinfo/dil/mapper/StatisticalReportMapper.java

@@ -127,4 +127,6 @@ public interface StatisticalReportMapper {
 
     BigDecimal getSpellNum(BigDecimal saleOrderMaterialId);
 
+    List<Map<String, Object>> yawnReportMonth(Map<String, Object> map);
+
 }

+ 14 - 3
src/main/java/com/steerinfo/dil/service/impl/StatisticalReportImpl.java

@@ -258,6 +258,7 @@ public class StatisticalReportImpl implements IStatisticalReportService {
     public List<Map<String, Object>> getSaleSteelReport(Map<String, Object> mapValue) {
         List<Map<String, Object>> saleSteelReport = statisticalReportMapper.getSaleSteelReport(mapValue);
         HashSet set = new HashSet<>();
+        HashSet quxiaoSet = new HashSet();
         HashSet<Map<String,Object>> filterConsigneeList = new HashSet<>();
         HashSet<Map<String,Object>> filterCarrierList = new HashSet<>();
         HashSet<Map<String,Object>> filterCapacityList = new LinkedHashSet<>();
@@ -298,7 +299,11 @@ public class StatisticalReportImpl implements IStatisticalReportService {
                     //stringObjectMap.put("spellNum",spellNum);
                 }
             }
-            set.add(stringObjectMap.get("saleOrderMaterialId"));
+            if(!"取消".equals(stringObjectMap.get("newCapacityNo"))) {
+                set.add(stringObjectMap.get("saleOrderMaterialId"));
+            }else{
+                quxiaoSet.add(stringObjectMap.get("saleOrderMaterialId"));
+            }
             Map<String,Object> filterCapacityMap = new HashMap<>();
             if(stringObjectMap.get("newCapacityNo") == null) {
                 filterCapacityMap.put("text","空白");
@@ -359,7 +364,9 @@ public class StatisticalReportImpl implements IStatisticalReportService {
             filterAreaNameMap.put("text",stringObjectMap.get("areaName"));
             filterAreaNameMap.put("value",stringObjectMap.get("areaName"));
             filterAreaName.add(filterAreaNameMap);
-            totalNumber += Integer.parseInt(stringObjectMap.get("materialNum").toString());
+            if(!"取消".equals(stringObjectMap.get("newCapacityNo"))) {
+                totalNumber += Integer.parseInt(stringObjectMap.get("materialNum").toString());
+            }
             String capacityNumbers= (String) stringObjectMap.get("capacityNumbers");
             //确认是否有多个收货单位
             //if (shippingAddressIds !=null && !("".equals(shippingAddressIds))){
@@ -396,6 +403,7 @@ public class StatisticalReportImpl implements IStatisticalReportService {
             }
         }
         if(saleSteelReport.size() > 0 && saleSteelReport.get(0) != null){
+            saleSteelReport.get(0).put("quxiaoCapacityNum",quxiaoSet.size());
             saleSteelReport.get(0).put("totalCapacity",set.size());
             saleSteelReport.get(0).put("totalNumber",totalNumber);
             saleSteelReport.get(0).put("filterConsigneeList",filterConsigneeList);
@@ -744,6 +752,9 @@ public class StatisticalReportImpl implements IStatisticalReportService {
 
     public List<Map<String, Object>> yawnReport(Map<String, Object> map){
 
-        return statisticalReportMapper.yawnReport(map);
+        List<Map<String,Object>> dayList =  statisticalReportMapper.yawnReport(map);
+        List<Map<String,Object>> monthList =  statisticalReportMapper.yawnReportMonth(map);
+        dayList.addAll(monthList);
+        return dayList;
     }
 }

+ 1 - 1
src/main/java/com/steerinfo/dil/service/impl/TmstruckEnfactoryResultServiceImpl.java

@@ -481,7 +481,7 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
         //添加进厂时间
         tmstruckEnfactoryResult.setResultEntryGateTime(new Date((long) map.get("resultEntryGateTime")));
         //添加门岗
-        String gatepostName = (String) map.get("gatepostName");
+        String gatepostName = (String) map.get("gatepostName") ;
         Integer gatepostNameId = tmstruckEnfactoryResultMapper.selectGatepostIdByGatepostName(gatepostName);
         tmstruckEnfactoryResult.setGatepostId(new BigDecimal(gatepostNameId));
 

+ 1 - 1
src/main/java/com/steerinfo/dil/service/impl/TmstruckLeaveFactoryResultServiceImpl.java

@@ -545,7 +545,7 @@ public class TmstruckLeaveFactoryResultServiceImpl implements ITmstruckLeaveFact
         tmstruckLeaveFactoryResult.setResultId(DataChange.dataToBigDecimal(mapValue.get("resultId")));
         //通过门岗名称获取门岗ID
         if(mapValue.get("gatepostId") == null){
-            Integer gatepostId = tmstruckEnfactoryResultMapper.selectGatepostIdByGatepostName((String) mapValue.get("gatepostName"));
+            Integer gatepostId = tmstruckEnfactoryResultMapper.selectGatepostIdByGatepostName( mapValue.get("gatepostName") + "");
             if(gatepostId != null){
                 tmstruckLeaveFactoryResult.setGatepostId(new BigDecimal(gatepostId));
             }

+ 8 - 4
src/main/java/com/steerinfo/dil/service/impl/TmstruckTotalResultServiceImpl.java

@@ -156,10 +156,14 @@ public class TmstruckTotalResultServiceImpl implements ITmstruckTotalResultServi
             orderMap.put("orderStatus",4);
             tmstruckWeightResultMapper.updateOrderStatus(orderMap);
         }
-        TmstruckTotalResult tmstruckTotalResult1= new TmstruckTotalResult();
-        tmstruckTotalResult1.setResultTotalId(maxId);
-        tmstruckTotalResult1.setOrderStatus(oldOrderStatus + "");
-        tmstruckTotalResultMapper.updateByPrimaryKeySelective(tmstruckTotalResult1);
+        try {
+            TmstruckTotalResult tmstruckTotalResult1= new TmstruckTotalResult();
+            tmstruckTotalResult1.setResultTotalId(maxId);
+            tmstruckTotalResult1.setOrderStatus(oldOrderStatus + "");
+            tmstruckTotalResultMapper.updateByPrimaryKeySelective(tmstruckTotalResult1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         return maxId.intValue();
     }
     /**

+ 1 - 1
src/main/java/com/steerinfo/dil/service/impl/UtilsServiceImpl.java

@@ -6,7 +6,7 @@ import com.steerinfo.dil.feign.IMFeign;
 import com.steerinfo.dil.mapper.UtilsMapper;
 import com.steerinfo.dil.service.IUtilsService;
 import com.steerinfo.dil.util.DataChange;
-import org.junit.jupiter.api.Test;
+//import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 

+ 33 - 0
src/main/java/com/steerinfo/dil/util/DataChange.java

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
 import java.text.DecimalFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -284,10 +285,42 @@ public class DataChange {
      * @return
      **/
     public static void queryDataByDateTimeYestDay(String startTime, String endTime, Map<String, Object> map,SimpleDateFormat sdf){
+        //再加一个结算月
         SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat sdfDateMonth = new SimpleDateFormat("yyyy-MM");
         if (startTime != null && !"null".equals(startTime) && endTime != null && !"null".equals(endTime)) {
             map.put("startDate", sdfDate.format(new Date(Long.parseLong(startTime))));
             map.put("endDate", sdfDate.format(new Date(Long.parseLong(endTime))));
+            int dateValue = new Date(Long.parseLong(startTime)).getDate();
+            Calendar calendar=Calendar.getInstance();
+            calendar.setTime(new Date(Long.parseLong(startTime)));
+            if(dateValue < 26) {
+                calendar.add(Calendar.MONTH,-1);
+                String startMonthTime = sdfDateMonth.format(calendar.getTime()) + "-26";
+                calendar.add(Calendar.MONTH,+1);
+                String endMonthTime =  sdfDateMonth.format(calendar.getTime()) + "-25";
+                map.put("startMonthTime", startMonthTime);
+                map.put("endMonthTime", endMonthTime);
+            }else{
+                String startMonthTime = sdfDateMonth.format(calendar.getTime()) + "-26";
+                calendar.add(Calendar.MONTH,+1);
+                String endMonthTime =  sdfDateMonth.format(calendar.getTime()) + "-25";
+                map.put("startMonthTime", startMonthTime);
+                map.put("endMonthTime", endMonthTime);
+            }
+            ////获取月份
+            //System.out.println(new Date(Long.parseLong(startTime)).getMonth() + 1);
+            //System.out.println(new Date(Long.parseLong(startTime)).getDate());
+
+            //String startMonthTime = null;
+            //String endMonthTime = null;
+            //if(monthValue == 1 && dateValue < 26) {
+            //    startMonthTime = (yearValue - 1) + "-" + 12 + "-" + 26;
+            //    endMonthTime = yearValue + "-" + "01" + "-" + 25;
+            //}
+            //if(monthValue != 1 && dateValue > 26) {
+            //
+            //}
         }
         //如果开始时间和结束时间有且只有一个为空 则只查那天的数据
         else if((startTime != null && !"null".equals(startTime)) || (endTime != null && !"null".equals(endTime))){

+ 348 - 10
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -1981,7 +1981,7 @@
                     ELSE
                         RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT ||
                         RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS
-                    END) "addressPlace",
+                    END) || ASOM.SALE_ORDER_CONSIGNEE_TEL  "addressPlace",
                     RRP.PLACE_ID "placeId",
                     RRP.ADDRESS_DELIVERY_ADDRESS "place",
                     RRA.ADDRESS_ID "shipperAddressId",
@@ -2395,6 +2395,7 @@
         AND ASO.SALE_ORDER_STATUS = 4
         and ASM.SALE_MATERIAL_ID IS NOT NULL
         and asm.DELETED is null
+        and asm.SALE_ORDER_ID != -1
         <if test="startTime != null">
             and (to_date(#{startDate}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
             and to_date(#{endDate}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
@@ -2402,7 +2403,13 @@
             or
             to_date(#{startDate}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-2,'yyyy-mm-dd'),'yyyy-mm-dd')
             and to_date(#{endDate}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-2,'yyyy-mm-dd'),'yyyy-mm-dd')
-            AND NVL(ASOM.WARRANTY_NUMBER,0) = 1)
+            AND NVL(ASOM.WARRANTY_NUMBER,0) = 1
+            AND ASOM.PREVIOUS_ORDER_NUMBER IS NOT NULL
+            OR
+            to_date(#{startDate}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+            and to_date(#{endDate}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+            AND NVL(ASOM.WARRANTY_NUMBER,0) = 1
+            AND ASOM.PREVIOUS_ORDER_NUMBER IS  NULL)
         </if>
         GROUP BY  ASO.SALE_ORDER_ISSELF_MENTION,ASM.TRANSFER_OUT_OF_WAREHOUSE,OO .ORDER_ID
         )
@@ -4162,7 +4169,7 @@
         SELECT
         "target",
         "carrierName",
-        "planNum" - "quxiaoNum" "planNum",
+        "planNum",
         "quxiaoNum",
         "orderNum" - "quxiaoNum" "orderNum",
         "notSendNum",
@@ -4180,8 +4187,8 @@
         END) AS "percent",
         NVL("numGong",0) "numGong",
         NVL("numCang",0) "numCang",
-        NVL("totalNet",0) "totalNet",
-        NVL("materialThoWeight",0) "materialThoWeight",
+        NVL("truckNetWeight",0) "totalNet",
+        NVL("truckThoWeight",0) "materialThoWeight",
         NVL("trainWeight",0)   "trainWeight",
         decode("target",'钢材达州组',1,'钢材万州组',2,'钢材南充组',3,'钢材巴中组',4,'钢材广安组',5,'钢材武汉组',6,'钢材西安组',7,'钢材重庆组',8,'钢材成都组',9,'钢材工程组',10,11) "no"
         FROM
@@ -4196,8 +4203,8 @@
         T1."receivedNum",
         T1."unReceiveNum",
         T2 ."num" "numGong" ,T3 ."num" "numCang",
-        T1."totalNet",
-        T1."materialThoWeight",
+        T5."truckNetWeight",
+        T5."truckThoWeight",
         T4."trainWeight"
         FROM
         (
@@ -4396,7 +4403,7 @@
         (
         --查询车皮
         SELECT
-        ASM .TRANSFER_OUT_OF_WAREHOUSE "target",--方向
+        '钢材工程组' "target",--方向
         '达运' "carrierName",--承运商
         SUM( TWR.RESULT_NET_WEIGHT) "trainWeight"
         FROM AMS_SALE_ORDER ASO
@@ -4426,6 +4433,44 @@
         </if>
         GROUP BY ASM.TRANSFER_OUT_OF_WAREHOUSE
         ) T4 ON T1 ."target" = T4."target" AND T1."carrierName" = 	T4."carrierName"
+        LEFT JOIN
+        (
+        --查询净重、理重
+        SELECT
+        ASM .TRANSFER_OUT_OF_WAREHOUSE "target",--方向
+        RC.CARRIER_ABBREVIATION "carrierName",--承运商
+        SUM( TWR.RESULT_NET_WEIGHT) "truckNetWeight",
+        SUM(ASM.MATERIAL_WEIGHT) "truckThoWeight"
+        FROM AMS_SALE_ORDER ASO
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+        ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
+        ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
+        ON ADSO .SALE_ORDER_MATERIAL_ID = ASOM .SALE_ORDER_MATERIAL_ID
+        LEFT JOIN RMS_CARRIER RC
+        ON RC .CARRIER_ID = ADSO .CARRIER_ID
+        LEFT JOIN AMS_SALE_MATERIAL ASM
+        ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
+        LEFT JOIN OMSTRUCK_ORDER OO
+        ON OO.ORDER_PLAN_ID=ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
+        ON TWR.SALE_MATERIAL_ID = ASM.SALE_MATERIAL_iD
+        WHERE
+        aso.DELETED = 0
+        AND aso.SALE_ORDER_STATUS = 4
+        AND NVL(OO.ORDER_STATUS,0) IN (0,2,4,5,7)
+        AND ASO.SALE_TYPE = 1
+        AND NVL(OO.ORDER_TYPE,0) IN(0,1)
+        AND ASM.SALE_MATERIAL_ID IS NOT NULL
+        AND ASM.SALE_ORDER_ID != -1
+        AND ASO.SALE_ORDER_ISSELF_MENTION='否'
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+            and to_date(#{endDate}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+        </if>
+        GROUP BY ASM.TRANSFER_OUT_OF_WAREHOUSE,RC.CARRIER_ABBREVIATION
+        ) T5 ON T1 ."target" = T5."target" AND T1."carrierName" = 	T5."carrierName"
         UNION
         SELECT T1."target",T1."carrierName",
         T1."planNum",T1."orderNum",T1."quxiaoNum",
@@ -4438,8 +4483,8 @@
         NVL("unReceiveNum",0) "unReceiveNum",
         T2 ."num" "numGong" ,
         T3 ."num" "numCang",
-        T1."totalNet",
-        T1."materialThoWeight",
+        T5."truckNetWeight",
+        T5."truckThoWeight",
         0 "trainWeight"
         FROM
         (
@@ -4633,6 +4678,44 @@
         </if>
         GROUP BY ASM.TRANSFER_OUT_OF_WAREHOUSE
         ) T3 ON T1 ."target" = T3."target" AND T1."carrierName" = 	T3."carrierName"
+        LEFT JOIN
+        (
+        --查询净重、理重
+        SELECT
+        ASM .TRANSFER_OUT_OF_WAREHOUSE "target",--方向
+        '本地自提' "carrierName",--承运商
+        SUM( TWR.RESULT_NET_WEIGHT) "truckNetWeight",
+        SUM(ASM.MATERIAL_WEIGHT) "truckThoWeight"
+        FROM AMS_SALE_ORDER ASO
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+        ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
+        ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
+        ON ADSO .SALE_ORDER_MATERIAL_ID = ASOM .SALE_ORDER_MATERIAL_ID
+        LEFT JOIN RMS_CARRIER RC
+        ON RC .CARRIER_ID = ADSO .CARRIER_ID
+        LEFT JOIN AMS_SALE_MATERIAL ASM
+        ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
+        LEFT JOIN OMSTRUCK_ORDER OO
+        ON OO.ORDER_PLAN_ID=ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
+        ON TWR.SALE_MATERIAL_ID = ASM.SALE_MATERIAL_iD
+        WHERE
+        aso.DELETED = 0
+        AND aso.SALE_ORDER_STATUS = 4
+        AND NVL(OO.ORDER_STATUS,0) IN (0,2,4,5,7)
+        AND ASO.SALE_TYPE = 1
+        AND NVL(OO.ORDER_TYPE,0) IN(0,1)
+        AND ASM.SALE_MATERIAL_ID IS NOT NULL
+        AND ASM.SALE_ORDER_ID != -1
+        AND ASO.SALE_ORDER_ISSELF_MENTION='是'
+        <if test="startDate != null">
+            and to_date(#{startDate}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+            and to_date(#{endDate}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+        </if>
+        GROUP BY ASM.TRANSFER_OUT_OF_WAREHOUSE
+        ) T5 ON T1 ."target" = T5."target" AND T1."carrierName" = 	T5."carrierName"
         )
         ORDER BY "no","carrierName"
     </select>
@@ -4644,4 +4727,259 @@
         AND   ASM.DELETED IS NULL
         AND   ASTM.SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
     </select>
+    <select id="yawnReportMonth" resultType="java.util.Map">
+        SELECT
+        T1."target",
+        T1."carrierName",
+        T1."planNum",
+        "orderNum" - "quxiaoNum" "orderNum",
+        T1."quxiaoNum",
+        T1."planNum"-"orderNum" "notSendNum",
+        T1."notEnNum",
+        nvl(T1."enFactoryNum",0) "enFactoryNum",
+        nvl(T1."queueNum",0) "queueNum",
+        nvl(T1."receivedNum",0) "receivedNum",
+        nvl(T1."unReceiveNum",0) "unReceiveNum",
+        nvl(T2 ."num",0) "numGong" ,nvl(T3 ."num",0) "numCang",
+        nvl(T5."truckNetWeight",0) "totalNet",
+        nvl(T5."truckThoWeight",0) "materialThoWeight",
+        nvl(T4."trainWeight",0) "trainWeight"
+        FROM
+        (
+        SELECT
+        '月合计' "target",--方向
+        '月合计' "carrierName",--承运商
+        COUNT(DISTINCT ASOM.SALE_ORDER_MATERIAL_ID) "planNum",--计划总数
+        COUNT(DISTINCT OO .ORDER_ID) "orderNum",--运单总数
+        COUNT(DISTINCT OO_QUXIAO .ORDER_ID) "quxiaoNum",--取消运单数
+        COUNT(DISTINCT OO_NOT_EN .ORDER_ID) "notEnNum",--未进场数量
+        COUNT(DISTINCT OO_ENFACTORY.ORDER_ID) "enFactoryNum",--已进厂数量
+        COUNT(DISTINCT OO_QUEUE.ORDER_ID) "queueNum",--排队中数量
+        COUNT(DISTINCT OO_RECEIVED.ORDER_ID) "receivedNum",--已接单数量
+        COUNT(DISTINCT OO_UN_RECEIVE.ORDER_ID) "unReceiveNum",--未接收数量
+        SUM(TWR.RESULT_NET_WEIGHT) "totalNet",--总净重
+        SUM(ASM.MATERIAL_WEIGHT) "materialThoWeight"
+        FROM AMS_SALE_ORDER ASO
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+        ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
+        ON ADSO .SALE_ORDER_MATERIAL_ID = ASOM .SALE_ORDER_MATERIAL_ID
+        LEFT JOIN RMS_CARRIER RC
+        ON RC .CARRIER_ID = ADSO .CARRIER_ID
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
+        ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_SALE_MATERIAL ASM
+        ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
+        LEFT JOIN OMSTRUCK_ORDER OO
+        ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN OMSTRUCK_ORDER OO_QUXIAO
+        ON OO_QUXIAO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID AND OO_QUXIAO.CAPACITY_ID=35128
+        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 AND TWR .SALE_MATERIAL_ID=ASM .SALE_MATERIAL_ID
+        LEFT JOIN
+        (
+        --未接收
+        SELECT OO.ORDER_ID
+        FROM OMSTRUCK_ORDER OO
+        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
+        WHERE TTR.ORDER_STATUS = '已派单'
+        AND OO.CAPACITY_ID!=35128
+        AND OO . ORDER_TYPE= 1
+        ) OO_UN_RECEIVE ON OO_UN_RECEIVE.ORDER_ID = OO.ORDER_ID
+        LEFT JOIN
+        (
+        --已接单
+        SELECT OO.ORDER_ID
+        FROM OMSTRUCK_ORDER OO
+        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
+        WHERE TTR.ORDER_STATUS = '已接单'
+        AND OO.CAPACITY_ID!=35128
+        AND OO . ORDER_TYPE= 1
+        ) OO_RECEIVED ON OO_RECEIVED.ORDER_ID = OO.ORDER_ID
+        LEFT JOIN
+        (
+        --排队中
+        SELECT OO.ORDER_ID
+        FROM OMSTRUCK_ORDER OO
+        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
+        WHERE TTR.ORDER_STATUS = '排队中'
+        AND OO.CAPACITY_ID!=35128
+        AND OO . ORDER_TYPE= 1
+        ) OO_QUEUE ON OO_QUEUE.ORDER_ID = OO.ORDER_ID
+        LEFT JOIN
+        (
+        --已进厂
+        SELECT OO.ORDER_ID
+        FROM OMSTRUCK_ORDER OO
+        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
+        WHERE TTR.ORDER_STATUS = '已进厂'
+        AND OO.CAPACITY_ID!=35128
+        AND OO . ORDER_TYPE= 1
+        ) OO_ENFACTORY ON OO_ENFACTORY.ORDER_ID = OO.ORDER_ID
+        LEFT JOIN
+        (
+        --未进场
+        SELECT OO.ORDER_ID
+        FROM OMSTRUCK_ORDER OO
+        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TTR .ORDER_ID = OO .ORDER_ID
+        LEFT JOIN QMS_QUEUE_RESULT QQR ON QQR .RESULT_TOTAL_ID = TTR .RESULT_TOTAL_ID
+        WHERE QQR .RESULT_ID IS NULL AND OO.CAPACITY_ID!=35128 AND OO . ORDER_TYPE= 1
+        ) OO_NOT_EN ON OO_NOT_EN .ORDER_ID = OO .ORDER_ID
+        WHERE
+        aso.DELETED = 0
+        AND aso.SALE_ORDER_STATUS = 4
+        AND RC.CARRIER_ABBREVIATION IS NOT NULL
+        AND NVL(OO.ORDER_STATUS,0) IN (0,2,4,5,7)
+        AND ASO.SALE_TYPE = 1
+        AND ASM.SALE_MATERIAL_ID IS NOT NULL
+        and ASM.SALE_ORDER_ID != -1
+        <if test="startMonthTime != null">
+            and to_date(#{startMonthTime}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+            and to_date(#{endMonthTime}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+        </if>
+        ) T1
+        LEFT JOIN
+        (
+        --查询工地数量
+        SELECT
+        '月合计' "target",--方向
+        '月合计' "carrierName",--承运商
+        COUNT(DISTINCT OO .ORDER_ID) "num"
+        FROM AMS_SALE_ORDER ASO
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+        ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
+        ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
+        ON ADSO .SALE_ORDER_MATERIAL_ID = ASOM .SALE_ORDER_MATERIAL_ID
+        LEFT JOIN RMS_CARRIER RC
+        ON RC .CARRIER_ID = ADSO .CARRIER_ID
+        LEFT JOIN AMS_SALE_MATERIAL ASM
+        ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
+        LEFT JOIN RMS_RECEIVE_PLACE RRP
+        ON RRP.PLACE_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
+        LEFT JOIN OMSTRUCK_ORDER OO
+        ON OO.ORDER_PLAN_ID=ASOM.SALE_ORDER_MATERIAL_ID
+        WHERE
+        aso.DELETED = 0
+        and
+        aso.SALE_ORDER_STATUS = 4
+        AND RC.CARRIER_ABBREVIATION IS NOT NULL
+        AND NVL(OO.ORDER_STATUS,0) IN (0,2,4,5,7)
+        AND ASO.SALE_TYPE = 1
+        AND NVL(OO.ORDER_TYPE,0) IN(0,1)
+        AND RRP.UNLOAD_TYPE = '工地'
+        AND ASM.SALE_MATERIAL_ID IS NOT NULL
+        AND ASM.SALE_ORDER_ID != -1
+        <if test="startMonthTime != null">
+            and to_date(#{startMonthTime}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+            and to_date(#{endMonthTime}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+        </if>
+        ) T2 ON T1 ."target" = T2."target" AND T1."carrierName" = 	T2."carrierName"
+        LEFT JOIN
+        (
+        --查询仓库数量
+        SELECT
+        '月合计' "target",--方向
+        '月合计' "carrierName",--承运商
+        COUNT(DISTINCT OO .ORDER_ID) "num"
+        FROM AMS_SALE_ORDER ASO
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+        ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
+        ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
+        ON ADSO .SALE_ORDER_MATERIAL_ID = ASOM .SALE_ORDER_MATERIAL_ID
+        LEFT JOIN RMS_CARRIER RC
+        ON RC .CARRIER_ID = ADSO .CARRIER_ID
+        LEFT JOIN AMS_SALE_MATERIAL ASM
+        ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
+        LEFT JOIN RMS_RECEIVE_PLACE RRP
+        ON RRP.PLACE_ID=ASOM.SALE_SHIPPING_ADDRESS_ID
+        LEFT JOIN OMSTRUCK_ORDER OO
+        ON OO.ORDER_PLAN_ID=ASOM.SALE_ORDER_MATERIAL_ID
+        WHERE
+        aso.DELETED = 0
+        AND aso.SALE_ORDER_STATUS = 4
+        AND NVL(OO.ORDER_STATUS,0) IN (0,2,4,5,7)
+        AND ASO.SALE_TYPE = 1
+        AND NVL(OO.ORDER_TYPE,0) IN(0,1)
+        AND RRP.UNLOAD_TYPE = '库房'
+        AND ASM.SALE_MATERIAL_ID IS NOT NULL
+        AND ASM.SALE_ORDER_ID != -1
+        <if test="startMonthTime != null">
+            and to_date(#{startMonthTime}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+            and to_date(#{endMonthTime}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+        </if>
+        ) T3 ON T1 ."target" = T3."target" AND T1."carrierName" = 	T3."carrierName"
+        LEFT JOIN
+        (
+        --查询车皮
+        SELECT
+        '月合计' "target",--方向
+        '月合计' "carrierName",--承运商
+        SUM( TWR.RESULT_NET_WEIGHT) "trainWeight"
+        FROM AMS_SALE_ORDER ASO
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+        ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
+        ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_SALE_MATERIAL ASM
+        ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
+        LEFT JOIN OMSTRUCK_ORDER OO
+        ON OO.ORDER_PLAN_ID=ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
+        ON TWR.SALE_MATERIAL_ID = ASM.SALE_MATERIAL_iD
+        WHERE
+        aso.DELETED = 0
+        AND aso.SALE_ORDER_STATUS = 4
+        AND NVL(OO.ORDER_STATUS,0) IN (0,2,4,5,7)
+        AND ASO.SALE_TYPE = 4
+        AND NVL(OO.ORDER_TYPE,0) IN(0,4)
+        AND ASM.SALE_MATERIAL_ID IS NOT NULL
+        AND ASM.SALE_ORDER_ID != -1
+        <if test="startMonthTime != null">
+            and to_date(#{startMonthTime}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASO.insert_time,'yyyy-mm-dd'),'yyyy-mm-dd')
+            and to_date(#{endMonthTime}, 'yyyy-mm-dd') >=  to_date(to_char(ASO.insert_time,'yyyy-mm-dd'),'yyyy-mm-dd')
+        </if>
+        ) T4 ON T1 ."target" = T4."target" AND T1."carrierName" = 	T4."carrierName"
+        LEFT JOIN
+        (
+        --查询净重、理重
+        SELECT
+        '月合计' "target",--方向
+        '月合计' "carrierName",--承运商
+        SUM( TWR.RESULT_NET_WEIGHT) "truckNetWeight",
+        SUM(ASM.MATERIAL_WEIGHT) "truckThoWeight"
+        FROM AMS_SALE_ORDER ASO
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+        ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
+        ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
+        ON ADSO .SALE_ORDER_MATERIAL_ID = ASOM .SALE_ORDER_MATERIAL_ID
+        LEFT JOIN RMS_CARRIER RC
+        ON RC .CARRIER_ID = ADSO .CARRIER_ID
+        LEFT JOIN AMS_SALE_MATERIAL ASM
+        ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
+        LEFT JOIN OMSTRUCK_ORDER OO
+        ON OO.ORDER_PLAN_ID=ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
+        ON TWR.SALE_MATERIAL_ID = ASM.SALE_MATERIAL_iD
+        WHERE
+        aso.DELETED = 0
+        AND aso.SALE_ORDER_STATUS = 4
+        AND NVL(OO.ORDER_STATUS,0) IN (0,2,4,5,7)
+        AND ASO.SALE_TYPE = 1
+        AND NVL(OO.ORDER_TYPE,0) IN(0,1)
+        AND ASM.SALE_MATERIAL_ID IS NOT NULL
+        AND ASM.SALE_ORDER_ID != -1
+        <if test="startMonthTime != null">
+            and to_date(#{startMonthTime}, 'yyyy-mm-dd') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+            and to_date(#{endMonthTime}, 'yyyy-mm-dd') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
+        </if>
+        ) T5 ON T1 ."target" = T5."target" AND T1."carrierName" = 	T5."carrierName"
+    </select>
 </mapper>

+ 1 - 1
src/main/resources/log4j.properties

@@ -1,5 +1,5 @@
 ## LOG4J配置
-log4j.rootCategory=INFO,file, RUNNING,errorfile
+log4j.rootCategory=INFO,file, RUNNING,errorfile,stdout
 ## 控制台输出
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout