|
@@ -380,11 +380,18 @@
|
|
|
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}'
|
|
@@ -511,7 +518,11 @@
|
|
|
select r_capacity.CAPACITY_NUMBER "capacityNumber",
|
|
|
o_torder.ORDER_NUMBER "orderNumber",
|
|
|
a_s_order.SALE_NUMBER "saleNumber",
|
|
|
- t_abnormal.ABNORMAL_TYPE "abnormalType",
|
|
|
+ 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"
|
|
@@ -574,6 +585,218 @@
|
|
|
<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"--签收作业时间
|
|
|
+
|
|
|
+-- CEIL((TRR.INSERT_TIME-TAR.INSERT_TIME) * 24 ) "unloadingWaitingTime",
|
|
|
+--
|
|
|
+-- CEIL((TAR.INSERT_TIME - TLFR.RESULT_OUT_GATE_TIME) * 24 ) "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>
|
|
|
<sql id="orderBy">
|
|
|
<if test="orderField != null and orderField != ''">
|
|
|
order by "${orderField}"
|