123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.steerinfo.dil.mapper.OffSiteTransportationMapper">
- <insert id="insertOrderMileage" >
- update TMSTRUCK_RECEIPT_RESULT set ORDER_MILEAGE = #{orderMileage} where RESULT_TOTAL_ID = #{truckTotalId}
- </insert>
- <insert id="insertReceive">
- insert into TMSTRUCK_RECEIVE_RESULT(RESULT_RECEIVE_ID ,result_total_id ,insert_username ,insert_time ,status) values('${RESULTID}','${RESULTTOTALID}','${INSERUSERNAME}', #{INSERTTIME,jdbcType=TIMESTAMP},'${STATUS}')
- </insert>
- <insert id="addTransportationAlarm">
-
- </insert>
- <update id="insertOrderTripId" parameterType="java.util.Map">
- update OMSTRUCK_ORDER set TRIP_ID = #{rid} where ORDER_NUMBER = #{orderNumber}
- </update>
- <update id="orderClose">
- update OMSTRUCK_ORDER set ORDER_STATUS = '2' where ORDER_NUMBER = #{orderNumber}
- </update>
-
- <select id="getInTransitTransportation" resultType="java.util.Map">
- select
- *
- from (
- select distinct
- OO.ORDER_STATUS "orderStatus",
- OO.ORDER_NUMBER "orderNumber", --运单订单号
- RC.CAPACITY_NUMBER "capacityNumber",--车牌号
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",--计毛时间
- TWR.RESULT_NET_WEIGHT "resultNetWeight",--净重
- TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",--出厂时间
- RGOUT.GATEPOST_NAME "outGatepostName",--出厂门禁
- RCR.CARRIER_NAME "carrierName" , --承运商名称
- CONCAT( CONCAT( CONCAT(RRA.ADDRESS_PROVINCE,RRA.ADDRESS_DISTRICT),RRA.Address_Town),RRP.ADDRESS_DELIVERY_ADDRESS) "deliveryAddress", --详细收货地址
- RM.MATERIAL_NAME "materialName" , --"物质名称"
- RM.MATERIAL_SPECIFICATION "materialSpecification", -- "物质规格"
- RM.MATERIAL_MODEL "materialModel", --"物质型号"
- RCON.CONSIGNEE_COMPANY_NAME "receiveName"--客户名称
-
-
- from OMSTRUCK_ORDER OO --运输订单
- left join AMS_SALE_ORDER_MATERIAL ASOM --销售订单物质表
- on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_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 TMSTRUCK_TOTAL_RESULT TTR --运输总实绩
- on TTR.ORDER_ID = OO.ORDER_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 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 AMS_DISPATCH_SALE_ORDER ADSO
- on ASOM.SALE_ORDER_MATERIAL_ID=ADSO.SALE_ORDER_MATERIAL_ID
- left join RMS_CARRIER RCR --承运单位
- on ADSO.CARRIER_ID=RCR.CARRIER_ID
-
-
- left join RMS_RECEIVE_PLACE RRP --收货地址
- on ASOM.SALE_SHIPPING_ADDRESS_ID=RRP.PLACE_ID
- left join RMS_RECEIVE_ADDRESS RRA
- on RRP.ADDRESS_ID=RRA.ADDRESS_ID
-
- left join AMS_SALE_TRUCKNO_MATERIAL ASTM
- on ASOM.SALE_ORDER_MATERIAL_ID=ASTM.SALE_ORDER_MATERIAL_ID
-
- left join AMS_SALE_MATERIAL ASM1
- on ASTM.MATERIAL_ID =ASM1.SALE_MATERIAL_ID
-
- left join TMSTRUCK_WEIGHT_RESULT TWR --运输实绩计重
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID and ASM1.MATERIAL_ID =TWR.MATERIAL_ID
-
- left join RMS_MATERIAL RM
- on ASM1.MATERIAL_ID=RM.MATERIAL_ID
- where OO.ORDER_TYPE in (1) and TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
- )
- <where>
- <if test="orderStatus !=null">
- and "orderStatus" ='${orderStatus}'
- </if>
- <if test="orderNumbers !=null and orderNumbers !=''">
- and "orderNumber" like '%${orderNumbers}%'
- </if>
- <if test="capacityNumbers !=null and capacityNumbers !=''">
- and "capacityNumber" like '%${capacityNumbers}%'
- </if>
- <if test="resultGrossWeightTimes !=null and resultGrossWeightTimes !=''">
- and "resultGrossWeightTime" like '%${resultGrossWeightTimes}%'
- </if>
- <if test="resultGrossWeightTimes !=null and resultGrossWeightTimes !=''">
- and "resultGrossWeightTime" like '%${resultGrossWeightTimes}%'
- </if>
- <if test="resultOutGateTimes !=null and resultOutGateTimes !=''">
- and "resultOutGateTime" like '%${resultOutGateTimes}%'
- </if>
- <if test="resultNetWeights !=null and resultNetWeights !=''">
- and "resultNetWeight" like '%${resultNetWeights}%'
- </if>
- <if test="resultOutGateTimes !=null and resultOutGateTimes !=''">
- and "resultOutGateTime" like '%${resultOutGateTimes}%'
- </if>
- <if test="outGatepostNames !=null and outGatepostNames !=''">
- and "outGatepostName" like '%${outGatepostNames}%'
- </if>
- <if test="carrierNames !=null and carrierNames !=''">
- and "carrierName" like '%${carrierNames}%'
- </if>
- <if test="deliveryAddresss !=null and deliveryAddresss !=''">
- and "deliveryAddress" like '%${deliveryAddresss}%'
- </if>
- <if test="materialNames !=null and materialNames !=''">
- and "materialName" like '%${materialNames}%'
- </if>
- <if test="materialSpecifications !=null and materialSpecifications !=''">
- and "materialSpecification" like '%${materialSpecifications}%'
- </if>
- <if test="materialModels !=null and materialModels !=''">
- and "materialModel" like '%${materialModels}%'
- </if>
- <if test="receiveNames !=null and receiveNames!=''">
- and "receiveName" like '%${receiveNames}%'
- </if>
- <if test="startTime != null">
- and "resultOutGateTime" >= to_date('${startTime}','yyyy-mm-dd')
- </if>
- <if test="endTime != null">
- and "resultOutGateTime" <= to_date('${endTime}','yyyy-mm-dd')
- </if>
- <if test="orderNumber !=null">
- and "orderNumber" in
- <foreach collection="orderNumber" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="capacityNumber !=null">
- and "capacityNumber" in
- <foreach collection="capacityNumber" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultGrossWeightTime !=null">
- and "resultGrossWeightTime" in
- <foreach collection="resultGrossWeightTime" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultNetWeight !=null">
- and "resultNetWeight" in
- <foreach collection="resultNetWeight" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultOutGateTime !=null">
- and "resultOutGateTime" in
- <foreach collection="resultOutGateTime" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="outGatepostName !=null">
- and "outGatepostName" in
- <foreach collection="outGatepostName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="carrierName !=null">
- and "carrierName" in
- <foreach collection="carrierName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="deliveryAddress !=null">
- and "deliveryAddress" in
- <foreach collection="deliveryAddress" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="materialSpecification !=null">
- and "materialSpecification" in
- <foreach collection="materialSpecification" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="materialModel !=null">
- and "materialModel" in
- <foreach collection="materialModel" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="receiveName !=null">
- and "receiveName" in
- <foreach collection="receiveName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getTruckFactoryResult" resultType="java.util.Map">
- SELECT * from(
-
- SELECT
- -- 出厂时间
- to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-mm-dd hh24:mi:ss') "resultOutGateTime",
- --出厂抓拍图片
- TLFR.RESULT_TRUCK_SNAPSHOT_PICTURE "resultTruckSnapshotPicture",
- --出厂方式
- TLFR.RESULT_OUT_MODE "resultOutMode",
- --门岗名称
- RG.GATEPOST_NAME "gatepostName",
- -- 运输订单号
- OO.ORDER_NUMBER "orderNumber",
- -- 车牌号
- RC.CAPACITY_NUMBER "capacityNumber",
- -- 运输订单id
- OO.ORDER_ID "orderId",
- -- 订单类型
- OO.ORDER_TYPE "orderType",
- -- 销售订单号
- ASO.SALE_NUMBER "saleNum",
- -- 收货地址
- RRA.ADDRESS_DELIVERY_ADDRESS "receiveAddress",
- -- 收货单位
- RS.SUPPLIER_NAME "supplierName" ,
- -- 发货单位
- RS2.SHIPPER_NAME "shipperName"
-
-
-
-
- FROM
- -- 出厂实绩
- TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
- -- 总实绩
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- -- 运输订单
- LEFT JOIN OMSTRUCK_ORDER OO ON TTR.ORDER_ID = OO.ORDER_ID
- -- 销售订单信息
- LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
- -- 托运人
- LEFT JOIN RMS_SUPPLIER RS ON ASO.SHIPPER_ID = RS.SUPPLIER_ID
- -- 门岗
- LEFT JOIN RMS_GATEPOST RG ON TLFR.GATEPOST_ID = RG.GATEPOST_ID
- -- 运力信息
- LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
- -- 销售订单中间表
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_MATERIAL_ID =OO.ORDER_PLAN_ID
- -- 收货地址
- LEFT JOIN RMS_RECEIVE_ADDRESS RRA ON ASOM.SALE_SHIPPING_ADDRESS_ID =RRA.ADDRESS_ID
- -- 收货单位
- LEFT JOIN RMS_SHIPPER RS2 ON ASO.SHIPPER_ID = RS2.SHIPPER_ID
-
- WHERE
- -- 判断出厂实绩的出厂时间不为空
- TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
- -- 并且订单类型等于1(销售订单),2(焦炭发运计划),3(水渣发运计划)
- AND OO.ORDER_TYPE =1 AND OO.ORDER_NUMBER=#{orderNumber}
-
- )
- </select>
- <select id="getOrderStatu" resultType="java.lang.Integer">
- select o_order.ORDER_STATUS from OMSTRUCK_ORDER o_order
- where o_order.ORDER_NUMBER = #{orderNumber}
- </select>
- <select id="getStartAndEndCapacityNumber" resultType="java.util.Map">
- SELECT
- -- 出厂时间
- to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-mm-dd hh24:mi:ss') "resultOutGateTime",
- -- 车牌号
- RC.CAPACITY_NUMBER "capacityNumber",
- -- 收货地址
- CONCAT( CONCAT(RRA.ADDRESS_PROVINCE,RRA.ADDRESS_DISTRICT),RRA.Address_Town) "addressDeliveryAddress"
-
- FROM
- -- 出厂实绩
- TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
- -- 总实绩
- LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
- -- 运输订单
- LEFT JOIN OMSTRUCK_ORDER OO ON TTR.ORDER_ID = OO.ORDER_ID
- -- 运力信息
- LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
- -- 销售订单中间表
- LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_MATERIAL_ID =OO.ORDER_PLAN_ID
- --收货地址
- left join RMS_RECEIVE_PLACE RRP on ASOM.SALE_SHIPPING_ADDRESS_ID=RRP.PLACE_ID
-
- left join RMS_RECEIVE_ADDRESS RRA on RRP.ADDRESS_ID=RRA.ADDRESS_ID
-
-
- WHERE
- -- 判断出厂实绩的出厂时间不为空
- TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
- -- 并且订单类型等于1(销售订单),2(焦炭发运计划),3(水渣发运计划)
- AND OO.ORDER_TYPE =1 AND OO.ORDER_NUMBER=#{orderNumber}
- </select>
- <select id="getReceiptData" resultType="java.util.Map">
- select result_id resultId,result_total_id resultTotalId,insert_username inserUserName,insert_time insertTime,status status from TMSTRUCK_RECEIPT_RESULT
- </select>
- <select id="selectWarnSwitch" resultType="Map">
- select WARN_SWITCH "switch",WARN_TYPE "type" from TMSTRUCK_IN_TRANSIT_WARN where WARN_ID = 1
- </select>
- <select id="selectIsReceiving" resultType="java.math.BigDecimal">
- select RESULT_TOTAL_ID "totalId"
- from TMSTRUCK_TOTAL_RESULT t_total
- left join OMSTRUCK_ORDER o_order
- on t_total.ORDER_ID=o_order.ORDER_ID
- where o_order.TRIP_ID = #{tripId} and o_order.ORDER_STATUS = 1
- </select>
- <select id="getHaveAbnormalTruckOrderInfo" resultType="java.util.Map">
- select
- *
- from (
- select distinct
- OO.ORDER_STATUS "orderStatus",
- OO.ORDER_NUMBER "orderNumber", --运单订单号
- RC.CAPACITY_NUMBER "capacityNumber",--车牌号
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",--计毛时间
- TWR.RESULT_NET_WEIGHT "resultNetWeight",--净重
- TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",--出厂时间
- RGOUT.GATEPOST_NAME "outGatepostName",--出厂门禁
- RCR.CARRIER_NAME "carrierName" , --承运商名称
- CONCAT( CONCAT( CONCAT(RRA.ADDRESS_PROVINCE,RRA.ADDRESS_DISTRICT),RRA.Address_Town),RRP.ADDRESS_DELIVERY_ADDRESS) "deliveryAddress", --详细收货地址
- RM.MATERIAL_NAME "materialName" , --"物质名称"
- RM.MATERIAL_SPECIFICATION "materialSpecification", -- "物质规格"
- RM.MATERIAL_MODEL "materialModel", --"物质型号"
- RCON.CONSIGNEE_COMPANY_NAME "receiveName"--客户名称
-
- from OMSTRUCK_ORDER OO --运输订单
- left join AMS_SALE_ORDER_MATERIAL ASOM --销售订单物质表
- on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_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 TMSTRUCK_TOTAL_RESULT TTR --运输总实绩
- on TTR.ORDER_ID = OO.ORDER_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 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 AMS_DISPATCH_SALE_ORDER ADSO
- on ASOM.SALE_ORDER_MATERIAL_ID=ADSO.SALE_ORDER_MATERIAL_ID
- left join RMS_CARRIER RCR --承运单位
- on ADSO.CARRIER_ID=RCR.CARRIER_ID
-
-
- left join RMS_RECEIVE_PLACE RRP --收货地址
- on ASOM.SALE_SHIPPING_ADDRESS_ID=RRP.PLACE_ID
- left join RMS_RECEIVE_ADDRESS RRA
- on RRP.ADDRESS_ID=RRA.ADDRESS_ID
-
- left join AMS_SALE_TRUCKNO_MATERIAL ASTM
- on ASOM.SALE_ORDER_MATERIAL_ID=ASTM.SALE_ORDER_MATERIAL_ID
-
- left join AMS_SALE_MATERIAL ASM1
- on ASTM.MATERIAL_ID =ASM1.SALE_MATERIAL_ID
-
- left join TMSTRUCK_WEIGHT_RESULT TWR --运输实绩计重
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID and ASM1.MATERIAL_ID =TWR.MATERIAL_ID
-
- left join RMS_MATERIAL RM
- on ASM1.MATERIAL_ID=RM.MATERIAL_ID
- left join(
- select max(RESULT_TOTAL_ID) coun,RESULT_TOTAL_ID RESULT_TOTAL_ID from TMSTRUCK_ABNORMAL_RESULT
-
- <if test="abnormalType!=null">
- where
- ABNORMAL_TYPE=#{abnormalType}
- </if>
- group by RESULT_TOTAL_ID
- ) TAR
- on TTR.RESULT_TOTAL_ID=TAR.RESULT_TOTAL_ID
- where TAR.coun is not null and OO.ORDER_TYPE in (1) and TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
-
- )
-
- <where>
- <if test="orderStatus !=null">
- and "orderStatus" ='${orderStatus}'
- </if>
- <if test="orderNumbers !=null and orderNumbers !=''">
- and "orderNumber" like '%${orderNumbers}%'
- </if>
- <if test="capacityNumbers !=null and capacityNumbers !=''">
- and "capacityNumber" like '%${capacityNumbers}%'
- </if>
- <if test="resultGrossWeightTimes !=null and resultGrossWeightTimes !=''">
- and "resultGrossWeightTime" like '%${resultGrossWeightTimes}%'
- </if>
- <if test="resultGrossWeightTimes !=null and resultGrossWeightTimes !=''">
- and "resultGrossWeightTime" like '%${resultGrossWeightTimes}%'
- </if>
- <if test="resultOutGateTimes !=null and resultOutGateTimes !=''">
- and "resultOutGateTime" like '%${resultOutGateTimes}%'
- </if>
- <if test="resultNetWeights !=null and resultNetWeights !=''">
- and "resultNetWeight" like '%${resultNetWeights}%'
- </if>
- <if test="resultOutGateTimes !=null and resultOutGateTimes !=''">
- and "resultOutGateTime" like '%${resultOutGateTimes}%'
- </if>
- <if test="outGatepostNames !=null and outGatepostNames !=''">
- and "outGatepostName" like '%${outGatepostNames}%'
- </if>
- <if test="carrierNames !=null and carrierNames !=''">
- and "carrierName" like '%${carrierNames}%'
- </if>
- <if test="deliveryAddresss !=null and deliveryAddresss !=''">
- and "deliveryAddress" like '%${deliveryAddresss}%'
- </if>
- <if test="materialNames !=null and materialNames !=''">
- and "materialName" like '%${materialNames}%'
- </if>
- <if test="materialSpecifications !=null and materialSpecifications !=''">
- and "materialSpecification" like '%${materialSpecifications}%'
- </if>
- <if test="materialModels !=null and materialModels !=''">
- and "materialModel" like '%${materialModels}%'
- </if>
- <if test="receiveNames !=null and receiveNames!=''">
- and "receiveName" like '%${receiveNames}%'
- </if>
- <if test="startTime != null">
- and "resultOutGateTime" >= to_date('${startTime}','yyyy-mm-dd')
- </if>
- <if test="endTime != null">
- and "resultOutGateTime" <= to_date('${endTime}','yyyy-mm-dd')
- </if>
- <if test="orderNumber !=null">
- and "orderNumber" in
- <foreach collection="orderNumber" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="capacityNumber !=null">
- and "capacityNumber" in
- <foreach collection="capacityNumber" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultGrossWeightTime !=null">
- and "resultGrossWeightTime" in
- <foreach collection="resultGrossWeightTime" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultNetWeight !=null">
- and "resultNetWeight" in
- <foreach collection="resultNetWeight" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultOutGateTime !=null">
- and "resultOutGateTime" in
- <foreach collection="resultOutGateTime" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="outGatepostName !=null">
- and "outGatepostName" in
- <foreach collection="outGatepostName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="carrierName !=null">
- and "carrierName" in
- <foreach collection="carrierName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="deliveryAddress !=null">
- and "deliveryAddress" in
- <foreach collection="deliveryAddress" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="materialSpecification !=null">
- and "materialSpecification" in
- <foreach collection="materialSpecification" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="materialModel !=null">
- and "materialModel" in
- <foreach collection="materialModel" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="receiveName !=null">
- and "receiveName" in
- <foreach collection="receiveName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="getTransportAbnormalInfo" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
- select * from(
- select r_capacity.CAPACITY_NUMBER "capacityNumber",
- o_torder.ORDER_NUMBER "orderNumber",
- a_s_order.SALE_NUMBER "saleNumber",
- case t_abnormal.ABNORMAL_TYPE
- when '1' then '偏离'
- when '2' then '停车'
- when '3' then '离线'
- else '其他' end "abnormalType",
- t_abnormal.ABNORMAL_TIME "abnormalTime",
- t_abnormal.ABNORMAL_ADDRESS "abnormalAddress",
- t_abnormal.ABNORMAL_DURATION "abnormalDuration"
- from TMSTRUCK_ABNORMAL_RESULT t_abnormal
- left join TMSTRUCK_TOTAL_RESULT t_total
- on t_abnormal.RESULT_TOTAL_ID=t_total.RESULT_TOTAL_ID
- left join OMSTRUCK_ORDER o_torder
- on t_total.ORDER_ID=o_torder.ORDER_ID
- left join RMS_CAPACITY r_capacity
- on o_torder.CAPACITY_ID=r_capacity.CAPACITY_ID
- left join AMS_SALE_ORDER_MATERIAL sale_material
- on o_torder.ORDER_PLAN_ID=sale_material.SALE_ORDER_MATERIAL_ID
- left join AMS_SALE_ORDER a_s_order
- on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
- where o_torder.ORDER_NUMBER=#{orderNumbers}
- order by t_abnormal.ABNORMAL_TIME desc)
- <where>
- <if test="capacityNumber != null">
- and
- <foreach collection="capacityNumber" item="item" open="(" separator="or" close=")">
- "capacityNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="orderNumber != null">
- and
- <foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
- "orderNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="saleNumber != null">
- and
- <foreach collection="saleNumber" item="item" open="(" separator="or" close=")">
- "saleNumber" like '%${item}%'
- </foreach>
- </if>
- <if test="abnormalCondition != null">
- and
- <foreach collection="abnormalCondition" item="item" open="(" separator="or" close=")">
- "abnormalCondition" like '%${item}%'
- </foreach>
- </if>
- <if test="abnormalTime != null">
- and
- <foreach collection="abnormalTime" item="item" open="(" separator="or" close=")">
- "abnormalTime" like '%${item}%'
- </foreach>
- </if>
- <if test="abnormalAddress != null">
- and
- <foreach collection="abnormalAddress" item="item" open="(" separator="or" close=")">
- "abnormalAddress" like '%${item}%'
- </foreach>
- </if>
- <if test="abnormalDuration != null">
- and
- <foreach collection="abnormalDuration" item="item" open="(" separator="or" close=")">
- "abnormalDuration" like '%${item}%'
- </foreach>
- </if>
- <include refid="orderBy"></include>
- </where>
- </select>
- <select id="transportationPerformance" resultType="java.util.Map">
- select
- *
- from (
- select distinct
- OO.ORDER_STATUS "orderStatus",
- OO.ORDER_NUMBER "orderNumber", --运单订单号
- RC.CAPACITY_NUMBER "capacityNumber",--车牌号
- TWR.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",--计毛时间
- TWR.RESULT_NET_WEIGHT "resultNetWeight",--净重
-
- RGOUT.GATEPOST_NAME "outGatepostName",--出厂门禁
- RCR.CARRIER_NAME "carrierName" , --承运商名称
- CONCAT( CONCAT( CONCAT(RRA.ADDRESS_PROVINCE,RRA.ADDRESS_DISTRICT),RRA.Address_Town),RRP.ADDRESS_DELIVERY_ADDRESS) "deliveryAddress", --详细收货地址
- RM.MATERIAL_NAME "materialName" , --"物质名称"
- RM.MATERIAL_SPECIFICATION "materialSpecification", -- "物质规格"
- RM.MATERIAL_MODEL "materialModel", --"物质型号"
- RCON.CONSIGNEE_COMPANY_NAME "receiveName" ,--客户名称
-
- TAR.RESULT_ARRIVAL_ADDRESS "resultReceiveAddress",--签收收货点的地址
-
- TRR.ORDER_MILEAGE "orderMileage", --运输距离
-
- TAR.RESULT_ARRIVAL_ADDRESS "resultArrivalAddress",--抵达收货点的地址
- TLFR.RESULT_OUT_GATE_TIME "resultOutGateTime",--出厂时间
- TAR.INSERT_TIME "arrivalTime",--抵达作业时间
- TRR.INSERT_TIME "recepitTime",--签收作业时间
-
- to_char(to_timestamp(to_char(TRR.INSERT_TIME,'yyyy-MM-dd HH24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')-to_timestamp(to_char(TAR.INSERT_TIME,'yyyy-MM-dd HH24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')) "unloadingWaitingTime",
-
- to_char(to_timestamp(to_char(TAR.INSERT_TIME,'yyyy-MM-dd HH24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')-to_timestamp(to_char(TLFR.RESULT_OUT_GATE_TIME,'yyyy-MM-dd HH24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')) "transportationTime"
-
- from OMSTRUCK_ORDER OO --运输订单
- left join AMS_SALE_ORDER_MATERIAL ASOM --销售订单物质表
- on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_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 TMSTRUCK_TOTAL_RESULT TTR --运输总实绩
- on TTR.ORDER_ID = OO.ORDER_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 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 AMS_DISPATCH_SALE_ORDER ADSO
- on ASOM.SALE_ORDER_MATERIAL_ID=ADSO.SALE_ORDER_MATERIAL_ID
- left join RMS_CARRIER RCR --承运单位
- on ADSO.CARRIER_ID=RCR.CARRIER_ID
-
-
- left join RMS_RECEIVE_PLACE RRP --收货地址
- on ASOM.SALE_SHIPPING_ADDRESS_ID=RRP.PLACE_ID
- left join RMS_RECEIVE_ADDRESS RRA
- on RRP.ADDRESS_ID=RRA.ADDRESS_ID
-
- left join AMS_SALE_TRUCKNO_MATERIAL ASTM
- on ASOM.SALE_ORDER_MATERIAL_ID=ASTM.SALE_ORDER_MATERIAL_ID
-
- left join AMS_SALE_MATERIAL ASM1
- on ASTM.MATERIAL_ID =ASM1.SALE_MATERIAL_ID
-
- left join TMSTRUCK_WEIGHT_RESULT TWR --运输实绩计重
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID and ASM1.MATERIAL_ID =TWR.MATERIAL_ID
-
- left join RMS_MATERIAL RM
- on ASM1.MATERIAL_ID=RM.MATERIAL_ID
-
- left join TMSTRUCK_RECEIPT_RESULT TRR
- on TRR.RESULT_TOTAL_ID=TTR.RESULT_TOTAL_ID
-
- left join TMSTRUCK_ARRIVAL_RESULT TAR
- on TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
-
- where OO.ORDER_TYPE in (1) and TLFR.RESULT_OUT_GATE_TIME IS NOT NULL
- )
- <where>
- <if test="orderStatus !=null">
- and "orderStatus" ='${orderStatus}'
- </if>
- <if test="orderNumbers !=null and orderNumbers !=''">
- and "orderNumber" like '%${orderNumbers}%'
- </if>
- <if test="capacityNumbers !=null and capacityNumbers !=''">
- and "capacityNumber" like '%${capacityNumbers}%'
- </if>
- <if test="resultGrossWeightTimes !=null and resultGrossWeightTimes !=''">
- and "resultGrossWeightTime" like '%${resultGrossWeightTimes}%'
- </if>
- <if test="resultGrossWeightTimes !=null and resultGrossWeightTimes !=''">
- and "resultGrossWeightTime" like '%${resultGrossWeightTimes}%'
- </if>
- <if test="resultOutGateTimes !=null and resultOutGateTimes !=''">
- and "resultOutGateTime" like '%${resultOutGateTimes}%'
- </if>
- <if test="resultNetWeights !=null and resultNetWeights !=''">
- and "resultNetWeight" like '%${resultNetWeights}%'
- </if>
- <if test="resultOutGateTimes !=null and resultOutGateTimes !=''">
- and "resultOutGateTime" like '%${resultOutGateTimes}%'
- </if>
- <if test="outGatepostNames !=null and outGatepostNames !=''">
- and "outGatepostName" like '%${outGatepostNames}%'
- </if>
- <if test="carrierNames !=null and carrierNames !=''">
- and "carrierName" like '%${carrierNames}%'
- </if>
- <if test="deliveryAddresss !=null and deliveryAddresss !=''">
- and "deliveryAddress" like '%${deliveryAddresss}%'
- </if>
- <if test="materialNames !=null and materialNames !=''">
- and "materialName" like '%${materialNames}%'
- </if>
- <if test="materialSpecifications !=null and materialSpecifications !=''">
- and "materialSpecification" like '%${materialSpecifications}%'
- </if>
- <if test="materialModels !=null and materialModels !=''">
- and "materialModel" like '%${materialModels}%'
- </if>
- <if test="receiveNames !=null and receiveNames!=''">
- and "receiveName" like '%${receiveNames}%'
- </if>
- <if test="startTime != null">
- and "resultOutGateTime" >= to_date('${startTime}','yyyy-mm-dd')
- </if>
- <if test="endTime != null">
- and "resultOutGateTime" <= to_date('${endTime}','yyyy-mm-dd')
- </if>
- <if test="orderNumber !=null">
- and "orderNumber" in
- <foreach collection="orderNumber" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="capacityNumber !=null">
- and "capacityNumber" in
- <foreach collection="capacityNumber" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultGrossWeightTime !=null">
- and "resultGrossWeightTime" in
- <foreach collection="resultGrossWeightTime" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultNetWeight !=null">
- and "resultNetWeight" in
- <foreach collection="resultNetWeight" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="resultOutGateTime !=null">
- and "resultOutGateTime" in
- <foreach collection="resultOutGateTime" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="outGatepostName !=null">
- and "outGatepostName" in
- <foreach collection="outGatepostName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="carrierName !=null">
- and "carrierName" in
- <foreach collection="carrierName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="deliveryAddress !=null">
- and "deliveryAddress" in
- <foreach collection="deliveryAddress" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="materialSpecification !=null">
- and "materialSpecification" in
- <foreach collection="materialSpecification" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="materialModel !=null">
- and "materialModel" in
- <foreach collection="materialModel" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="receiveName !=null">
- and "receiveName" in
- <foreach collection="receiveName" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- <if test="orderMileage !=null">
- and "orderMileage" in
- <foreach collection="orderMileage" separator="," open="(" close=")" item="item" >
- #{item}
- </foreach>
- </if>
- </where>
- <include refid="orderBy"></include>
- </select>
- <select id="selectIsSelfMention" resultType="java.lang.Integer">
- select count(*) from RMS_CAPACITY RC
- left join OMSTRUCK_ORDER OO
- on RC.CAPACITY_ID=OO.CAPACITY_ID
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
- left join AMS_SALE_ORDER ASO
- on ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- where OO.ORDER_TYPE in (1) and ASO.Sale_Order_Isself_Mention='是' and RC.CAPACITY_NUMBER = #{capcityNumber}
- </select>
- <select id="isSelfMentionByOrderNumber" resultType="java.lang.Integer">
- select count(*) from OMSTRUCK_ORDER OO
- left join AMS_SALE_ORDER_MATERIAL ASOM
- on OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
- left join AMS_SALE_ORDER ASO
- on ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
- where OO.ORDER_TYPE in (1) and ASO.Sale_Order_Isself_Mention='是' and OO.ORDER_NUMBER =#{orderNumber}
- </select>
- <sql id="orderBy">
- <if test="orderField != null and orderField != ''">
- order by "${orderField}"
- <if test="orderType != null and orderType != ''">
- ${orderType}
- </if>
- </if>
- </sql>
- </mapper>
|