Redeem 1 년 전
부모
커밋
b0cdc9bd55

+ 1 - 1
pom.xml

@@ -6,7 +6,7 @@
 
     <groupId>org.example</groupId>
     <artifactId>dil-api</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <version>dil-tms-truck-api-1.1</version>
 
     <parent>
         <groupId>org.springframework.boot</groupId>

+ 55 - 0
src/main/java/com/steerinfo/dil/controller/StatisticalReportController.java

@@ -1342,4 +1342,59 @@ public class StatisticalReportController extends BaseRESTfulController {
         System.out.println(map.get("startDate"));
         return success(statisticalReportService.yawnReport(map));
     }
+
+    @ApiOperation(value="查询销售统计报表修改")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
+            @ApiImplicitParam(name = "apiId(423)", value = "动态表头", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/getAllSaleReportByLb")
+    public RESTfulResult getAllSaleReportByLb(@RequestBody(required=false) Map<String,Object> mapValue,
+                                          Integer apiId,
+                                          Integer pageNum,
+                                          Integer pageSize,
+                                          String startTime,
+                                          String endTime,
+                                          String carrierSsoId,
+                                          Integer orderType,
+                                          Integer shipperId,
+                                          String receiveName,
+                                          String materialName,
+                                          String wareHouse
+    ){
+        DataChange.queryDataByDateTime(startTime, endTime, mapValue, sdfDateTime);//根据时间段查询数据
+        if(carrierSsoId != null){
+            if(!"null".equals(carrierSsoId)){
+                mapValue.put("carrierSsoId", carrierSsoId);
+            }
+        }
+        if (receiveName != null && !"null".equals(receiveName)) {
+            mapValue.put("receivName", receiveName);
+        }
+        if (materialName != null && !"".equals(materialName) && !"null".equals(materialName)) {
+            mapValue.put("remark",materialName);
+        }
+        if (wareHouse != null && !"".equals(wareHouse) && !"null".equals(wareHouse)) {
+            mapValue.put("wareHouse",wareHouse);
+        }
+        mapValue.put("orderTypee",orderType);
+        mapValue.put("shipperId",shipperId);
+        if(orderType==1 && mapValue.get("orderField")==null){
+            //如果没有使用排序且查询的表格类型为销售钢材内部专用表格,默认规格排序
+            mapValue.put("orderField","materialCode");
+            mapValue.put("orderType","desc");
+        }
+        Map<String,Object> preMap = statisticalReportService.getPreMap(mapValue);
+        if(mapValue.get("isExcel")==null){
+            PageHelper.startPage(pageNum, pageSize);
+        }
+        //分页数据
+        List<Map<String, Object>> report = statisticalReportService.getAllSaleReportByLb(mapValue);
+        report.get(0).putAll(preMap);
+        PageListAdd pageList = columnDataUtil.tableColumnData5(apiId, null, report);
+        return success(pageList);
+    }
 }

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

@@ -129,4 +129,8 @@ public interface StatisticalReportMapper {
 
     List<Map<String, Object>> yawnReportMonth(Map<String, Object> map);
 
+    List<Map<String, Object>> getAllSaleReportByLb(Map<String, Object> mapValue);
+
+    Map<String, Object> getPreMap(Map<String, Object> mapValue);
+
 }

+ 12 - 0
src/main/java/com/steerinfo/dil/service/impl/StatisticalReportImpl.java

@@ -767,4 +767,16 @@ public class StatisticalReportImpl implements IStatisticalReportService {
         dayList.addAll(monthList);
         return dayList;
     }
+
+    public List<Map<String, Object>> getAllSaleReportByLb(Map<String, Object> mapValue) {
+        List<Map<String,Object>> mapList = statisticalReportMapper.getAllSaleReportByLb(mapValue);
+        for (Map<String, Object> mesMap : mapList) {
+            calculateDifferenceTime(mesMap);
+        }
+        return mapList;
+    }
+
+    public Map<String, Object> getPreMap(Map<String, Object> mapValue) {
+        return statisticalReportMapper.getPreMap(mapValue);
+    }
 }

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

@@ -238,6 +238,12 @@ public class DataChange {
      **/
     public static void queryDataByDateTime(String startTime, String endTime, Map<String, Object> map,SimpleDateFormat sdf){
         SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
+        if((startTime == null || "null".equals(startTime)) && map.get("startTime") != null) {
+            startTime = map.get("startTime").toString();
+        }
+        if((endTime == null || "null".equals(endTime)) && map.get("endTime") != null) {
+            endTime = map.get("endTime").toString();
+        }
         if (startTime != null && !"null".equals(startTime) && endTime != null && !"null".equals(endTime)) {
             map.put("startDate", sdf.format(new Date(Long.parseLong(startTime))));
             map.put("endDate", sdf.format(new Date(Long.parseLong(endTime))));

+ 373 - 0
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -5523,4 +5523,377 @@
         </if>
         ) T6 ON T1 ."target" = T6."target" AND T1."carrierName" = 	T6."carrierName"
     </select>
+    <select id="getAllSaleReportByLb" resultType="java.util.Map" parameterType="map">
+        select
+        *
+        from (
+        select DISTINCT OO.ORDER_NUMBER "orderNumber",
+        RC.CAPACITY_NUMBER "capacityNumber",
+        TER.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
+        TWR.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
+        TWR.RESULT_TARE_WEIGHT "resultTareWeight",
+        TLR.RESULT_LOAD_END_TIME "resultLoadEndTime",
+        RW.WAREHOUSE_NAME "warehouseName",
+        TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
+        TWR.RESULT_GROSS_WEIGHT "resultGrossWeight",
+        TWR.RESULT_NET_WEIGHT "resultNetWeight",
+        TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",
+        RTCMAO.TRUCK_CALCULATE_NUMBER "maoCalculate",
+        RTCPI.TRUCK_CALCULATE_NUMBER "piCalculate",
+        RGEN.GATEPOST_NAME "enGatepostName",
+        RGOUT.GATEPOST_NAME "outGatepostName",
+        RCON.CONSIGNEE_COMPANY_NAME "receiveName",
+        RS.SUPPLIER_NAME "sendName",
+        RM.MATERIAL_NAME "materialName",
+        TLR.INSERT_UPDATE_REMARK "materialRemark",
+        ASO.SALE_NUMBER "saleNumber",
+        ASO.SALE_REMARK "saleRemark",
+        ASM.SALE_WAREHOUSE "saleWarehouse",
+        ASM.MATERIAL_NUMBER "materialNum",
+        ASM.MATERIAL_WEIGHT "materialWeight",
+        TLR.CASE_NUMBER "caseNumber",
+        TLR.CAPACITY_REMARK "capacityRemark",
+        RC2.CARRIER_NAME "carrierName",
+        TAR.RESULT_ARRIVAL_ADDRESS "arrivalAddress",
+        TRR.RESULT_ARRIVAL_ADDRESS "receiptAddress",
+        TAR.INSERT_TIME "arrivalTime",
+        TRR.INSERT_TIME "receiptTime",
+        TAR.RESULT_FULL_CONTAINER_PHOTO "arrivalPhoto",
+        TRR.RESULT_EMPTY_CONTAINER_PHOTO "receiptPhoto",
+        RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "materialCode",
+        RM.MATERIAL_NAME  || TLR.INSERT_UPDATE_REMARK "likeRemark",
+        ASM.SALE_WAREHOUSE || RW.WAREHOUSE_NAME "wareHouse",
+        TLR.RESULT_ID "resultId",
+        TLR.MATERIAL_ID "materialId",
+        OO.ORDER_ID "orderId",
+        CASE
+        WHEN TER.RESULT_ENTRY_GATE_TIME IS NULL
+        THEN '未进厂'
+        when TLFR.RESULT_OUT_GATE_TIME IS NULL
+        THEN '已进厂'
+        when TAR.RESULT_ARRIVAL_ADDRESS IS NULL
+        THEN '已出厂'
+        WHEN TRR.RESULT_ARRIVAL_ADDRESS IS NULL
+        THEN '已抵达'
+        ELSE '已签收' END "transportStatus"
+        from TMSTRUCK_WEIGHT_RESULT TWR
+        left join TMSTRUCK_TOTAL_RESULT TTR
+        on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join OMSTRUCK_ORDER OO
+        on TTR.ORDER_ID = OO.ORDER_ID
+        left join AMS_SALE_ORDER_MATERIAL ASOM
+        on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
+        left join AMS_SALE_TRUCKNO_MATERIAL ASTM
+        on ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        left join RMS_MATERIAL RM
+        on RM.MATERIAL_ID = TWR.MATERIAL_ID
+        left join AMS_SALE_MATERIAL ASM
+        on ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID AND ASM.MATERIAL_ID=RM.MATERIAL_ID
+        --         left join RMS_MATERIAL RM
+        --         on ASM.MATERIAL_ID = RM.MATERIAL_ID
+        left join AMS_DISPATCH_SALE_ORDER ADSO
+        on ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        left join RMS_CARRIER RC2
+        on RC2.CARRIER_ID = ADSO.CARRIER_ID
+        left join AMS_SALE_ORDER ASO
+        on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
+        left join RMS_CONSIGNEE RCON
+        on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
+        left join RMS_SUPPLIER RS
+        on RS.SUPPLIER_ID = ASO.SHIPPER_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 RTCMAO
+        on TWR.RESULT_GROSS_PLACE_ID = RTCMAO.TRUCK_CALCULATE_ID
+        left join RMS_TRUCK_CALCULATE RTCPI
+        on TWR.RESULT_TARE_PLACE_ID = RTCPI.TRUCK_CALCULATE_ID
+        left join TMSTRUCK_ENFACTORY_RESULT TER
+        on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_GATEPOST RGEN
+        on RGEN.GATEPOST_ID = TER.GATEPOST_ID
+        left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
+        on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_GATEPOST RGOUT
+        on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
+        left join RMS_CAPACITY RC
+        on RC.CAPACITY_ID = OO.CAPACITY_ID
+        left join TMSTRUCK_ARRIVAL_RESULT TAR
+        on TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join TMStRUCK_RECEIPT_RESULT TRR
+        on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+        WHERE OO.ORDER_TYPE = #{orderTypee}
+        AND ASO.SHIPPER_ID = #{shipperId}
+        AND OO.ORDER_STATUS IN (2,4,5)
+        <if test="orderTypee!=null and orderTypee==1">
+            AND ASM.MATERIAL_NUMBER IS NOT NULL
+        </if>
+        <if test="carrierSsoId != null">
+            and RC2.CARRIER_SSO_ID = #{carrierSsoId}
+        </if>
+        <if test="receivName != null and receivName != ''">
+            and RCON.CONSIGNEE_COMPANY_NAME like Concat('%',Concat(#{receivName},'%'))
+        </if>
+        <if test="remarkOne != null and remarkOne != '' and remarkOne !='null' ">
+            and RCON.CONSIGNEE_COMPANY_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL || RC2.CARRIER_NAME
+            || RC.CAPACITY_NUMBER like Concat('%',Concat(#{remarkOne},'%'))
+        </if>
+        <if test="remarkTwo != null and remarkTwo != '' and remarkTwo !='null'">
+            and RCON.CONSIGNEE_COMPANY_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL || RC2.CARRIER_NAME
+            || RC.CAPACITY_NUMBER like Concat('%',Concat(#{remarkTwo},'%'))
+        </if>
+        <if test="remarkThree != null and remarkThree != '' and remarkThree !='null'">
+            and RCON.CONSIGNEE_COMPANY_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL || RC2.CARRIER_NAME
+            || RC.CAPACITY_NUMBER like Concat('%',Concat(#{remarkThree},'%'))
+        </if>
+        <if test="oneDate != null and orderTypee == 1 and isEnFactoryFlag == 0">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.ORDER_ISSUE_TIME
+        </if>
+        <if test="startDate != null and orderTypee == 1 and isEnFactoryFlag == 0">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.ORDER_ISSUE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= OO.ORDER_ISSUE_TIME
+        </if>
+        <if test="oneDate != null and orderTypee == 1 and isEnFactoryFlag == 1">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        <if test="startDate != null and orderTypee == 1 and isEnFactoryFlag == 1">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        <if test="oneDate != null and orderTypee != 1 and isEnFactoryFlag == 0">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.ORDER_ISSUE_TIME
+        </if>
+        <if test="startDate != null and orderTypee != 1 and isEnFactoryFlag == 0">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.ORDER_ISSUE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= OO.ORDER_ISSUE_TIME
+        </if>
+        <if test="oneDate != null and orderTypee != 1 and isEnFactoryFlag == 1">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        <if test="startDate != null and orderTypee != 1 and isEnFactoryFlag == 1">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        )
+        <where>
+            <if test="capacityNumber != null and capacityNumber != ''">
+                and "capacityNumber" like Concat('%',Concat(#{capacityNumber},'%'))
+            </if>
+            <if test="remark != null and remark != ''">
+                and "likeRemark" like Concat('%',Concat(#{remark},'%'))
+            </if>
+            <if test="wareHouse != null and wareHouse != ''">
+                and "wareHouse" like Concat('%',Concat(#{wareHouse},'%'))
+            </if>
+            <if test="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="receiveName != null">
+                and
+                <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
+                    "receiveName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="sendName != null">
+                and
+                <foreach collection="sendName" item="item" open="(" separator="or" close=")">
+                    "sendName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="saleWarehouse != null">
+                and
+                <foreach collection="saleWarehouse" item="item" open="(" separator="or" close=")">
+                    "saleWarehouse" 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="saleRemark != null">
+                and
+                <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
+                    "saleRemark" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
+        <if test="orderField == null">
+            order by "resultOutGateTime" desc, "resultEntryGateTime" desc
+        </if>
+    </select>
+    <select id="getPreMap" resultType="java.util.Map" parameterType="map">
+        select
+        *
+        from (
+        SELECT
+        sum(
+            CASE WHEN
+            TER.RESULT_ENTRY_GATE_TIME IS NOT NULL
+            THEN 1
+            ELSE 0
+            END
+        ) "enFactoryNumber",
+        sum(
+            CASE WHEN
+            TWR.RESULT_GROSS_WEIGHT_TIME IS NOT NULL
+            THEN 1
+            ELSE 0
+            END
+        ) "grossNumber",
+        SUM(TWR.RESULT_NET_WEIGHT) "totalNumber"
+        from TMSTRUCK_WEIGHT_RESULT TWR
+        left join TMSTRUCK_TOTAL_RESULT TTR
+        on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join OMSTRUCK_ORDER OO
+        on TTR.ORDER_ID = OO.ORDER_ID
+        left join AMS_SALE_ORDER_MATERIAL ASOM
+        on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
+        left join AMS_SALE_TRUCKNO_MATERIAL ASTM
+        on ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        left join RMS_MATERIAL RM
+        on RM.MATERIAL_ID = TWR.MATERIAL_ID
+        left join AMS_SALE_MATERIAL ASM
+        on ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID AND ASM.MATERIAL_ID=RM.MATERIAL_ID
+        --         left join RMS_MATERIAL RM
+        --         on ASM.MATERIAL_ID = RM.MATERIAL_ID
+        left join AMS_DISPATCH_SALE_ORDER ADSO
+        on ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        left join RMS_CARRIER RC2
+        on RC2.CARRIER_ID = ADSO.CARRIER_ID
+        left join AMS_SALE_ORDER ASO
+        on ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
+        left join RMS_CONSIGNEE RCON
+        on RCON.CONSIGNEE_ID = ASO.RECEIVE_ID
+        left join RMS_SUPPLIER RS
+        on RS.SUPPLIER_ID = ASO.SHIPPER_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 RTCMAO
+        on TWR.RESULT_GROSS_PLACE_ID = RTCMAO.TRUCK_CALCULATE_ID
+        left join RMS_TRUCK_CALCULATE RTCPI
+        on TWR.RESULT_TARE_PLACE_ID = RTCPI.TRUCK_CALCULATE_ID
+        left join TMSTRUCK_ENFACTORY_RESULT TER
+        on TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_GATEPOST RGEN
+        on RGEN.GATEPOST_ID = TER.GATEPOST_ID
+        left join TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
+        on TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join RMS_GATEPOST RGOUT
+        on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
+        left join RMS_CAPACITY RC
+        on RC.CAPACITY_ID = OO.CAPACITY_ID
+        left join TMSTRUCK_ARRIVAL_RESULT TAR
+        on TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        left join TMStRUCK_RECEIPT_RESULT TRR
+        on TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+        WHERE OO.ORDER_TYPE = #{orderTypee}
+        AND ASO.SHIPPER_ID = #{shipperId}
+        AND OO.ORDER_STATUS IN (2,4,5)
+        <if test="orderTypee!=null and orderTypee==1">
+            AND ASM.MATERIAL_NUMBER IS NOT NULL
+        </if>
+        <if test="carrierSsoId != null">
+            and RC2.CARRIER_SSO_ID = #{carrierSsoId}
+        </if>
+        <if test="receivName != null and receivName != ''">
+            and RCON.CONSIGNEE_COMPANY_NAME like Concat('%',Concat(#{receivName},'%'))
+        </if>
+        <if test="remarkOne != null and remarkOne != '' and remarkOne !='null' ">
+            and RCON.CONSIGNEE_COMPANY_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL || RC2.CARRIER_NAME
+            || RC.CAPACITY_NUMBER like Concat('%',Concat(#{remarkOne},'%'))
+        </if>
+        <if test="remarkTwo != null and remarkTwo != '' and remarkTwo !='null'">
+            and RCON.CONSIGNEE_COMPANY_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL || RC2.CARRIER_NAME
+            || RC.CAPACITY_NUMBER like Concat('%',Concat(#{remarkTwo},'%'))
+        </if>
+        <if test="remarkThree != null and remarkThree != '' and remarkThree !='null'">
+            and RCON.CONSIGNEE_COMPANY_NAME || RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL || RC2.CARRIER_NAME
+            || RC.CAPACITY_NUMBER like Concat('%',Concat(#{remarkThree},'%'))
+        </if>
+        <if test="oneDate != null and orderTypee == 1 and isEnFactoryFlag == 0">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.ORDER_ISSUE_TIME
+        </if>
+        <if test="startDate != null and orderTypee == 1 and isEnFactoryFlag == 0">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.ORDER_ISSUE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= OO.ORDER_ISSUE_TIME
+        </if>
+        <if test="oneDate != null and orderTypee == 1 and isEnFactoryFlag == 1">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        <if test="startDate != null and orderTypee == 1 and isEnFactoryFlag == 1">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        <if test="oneDate != null and orderTypee != 1 and isEnFactoryFlag == 0">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.ORDER_ISSUE_TIME
+        </if>
+        <if test="startDate != null and orderTypee != 1 and isEnFactoryFlag == 0">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= OO.ORDER_ISSUE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= OO.ORDER_ISSUE_TIME
+        </if>
+        <if test="oneDate != null and orderTypee != 1 and isEnFactoryFlag == 1">
+            and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        <if test="startDate != null and orderTypee != 1 and isEnFactoryFlag == 1">
+            and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= TER.RESULT_ENTRY_GATE_TIME
+            and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TER.RESULT_ENTRY_GATE_TIME
+        </if>
+        )
+        <where>
+            <if test="capacityNumber != null and capacityNumber != ''">
+                and "capacityNumber" like Concat('%',Concat(#{capacityNumber},'%'))
+            </if>
+            <if test="remark != null and remark != ''">
+                and "likeRemark" like Concat('%',Concat(#{remark},'%'))
+            </if>
+            <if test="wareHouse != null and wareHouse != ''">
+                and "wareHouse" like Concat('%',Concat(#{wareHouse},'%'))
+            </if>
+            <if test="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="receiveName != null">
+                and
+                <foreach collection="receiveName" item="item" open="(" separator="or" close=")">
+                    "receiveName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="sendName != null">
+                and
+                <foreach collection="sendName" item="item" open="(" separator="or" close=")">
+                    "sendName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="saleWarehouse != null">
+                and
+                <foreach collection="saleWarehouse" item="item" open="(" separator="or" close=")">
+                    "saleWarehouse" 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="saleRemark != null">
+                and
+                <foreach collection="saleRemark" item="item" open="(" separator="or" close=")">
+                    "saleRemark" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+    </select>
 </mapper>