|
@@ -15,105 +15,119 @@
|
|
select
|
|
select
|
|
*
|
|
*
|
|
from (
|
|
from (
|
|
- select distinct 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" , --承运商名称
|
|
|
|
- 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 REA
|
|
|
|
- on RRP.ADDRESS_ID=REA.ADDRESS_ID
|
|
|
|
-
|
|
|
|
- left join AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
|
- on ASOM.SALE_ORDER_MATERIAL_ID=ASTM.SALE_ORDER_MATERIAL_ID
|
|
|
|
- left join TMSTRUCK_WEIGHT_RESULT TWR --运输实绩计重
|
|
|
|
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID and ASTM.MATERIAL_ID =TWR.MATERIAL_ID
|
|
|
|
- left join AMS_SALE_MATERIAL ASM1
|
|
|
|
- on ASTM.MATERIAL_ID =ASM1.SALE_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
|
|
|
|
|
|
+ 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>
|
|
<where>
|
|
- <if test="orderNumbers !=null">
|
|
|
|
- and "orderNumber" like '${orderNumbers}'
|
|
|
|
|
|
+ <if test="orderStatus !=null">
|
|
|
|
+ and "orderStatus" ='${orderStatus}'
|
|
|
|
+ </if>
|
|
|
|
+ <if test="orderNumbers !=null and orderNumbers !=''">
|
|
|
|
+ and "orderNumber" like '%${orderNumbers}%'
|
|
</if>
|
|
</if>
|
|
- <if test="capacityNumbers !=null">
|
|
|
|
- and "capacityNumber" like '${capacityNumbers}'
|
|
|
|
|
|
+ <if test="capacityNumbers !=null and capacityNumbers !=''">
|
|
|
|
+ and "capacityNumber" like '%${capacityNumbers}%'
|
|
|
|
+ </if>
|
|
|
|
+ <if test="resultGrossWeightTimes !=null and resultGrossWeightTimes !=''">
|
|
|
|
+ and "resultGrossWeightTime" like '%${resultGrossWeightTimes}%'
|
|
</if>
|
|
</if>
|
|
- <if test="resultGrossWeightTimes !=null">
|
|
|
|
- and "resultGrossWeightTime" like '${resultGrossWeightTimes}'
|
|
|
|
|
|
+ <if test="resultGrossWeightTimes !=null and resultGrossWeightTimes !=''">
|
|
|
|
+ and "resultGrossWeightTime" like '%${resultGrossWeightTimes}%'
|
|
</if>
|
|
</if>
|
|
- <if test="resultGrossWeightTimes !=null">
|
|
|
|
- and "resultGrossWeightTime" like '${resultGrossWeightTimes}'
|
|
|
|
|
|
+ <if test="resultOutGateTimes !=null and resultOutGateTimes !=''">
|
|
|
|
+ and "resultOutGateTime" like '%${resultOutGateTimes}%'
|
|
</if>
|
|
</if>
|
|
- <if test="resultOutGateTimes !=null">
|
|
|
|
- and "resultOutGateTime" like '${resultOutGateTimes}'
|
|
|
|
|
|
+ <if test="resultNetWeights !=null and resultNetWeights !=''">
|
|
|
|
+ and "resultNetWeight" like '%${resultNetWeights}%'
|
|
</if>
|
|
</if>
|
|
- <if test="resultNetWeights !=null">
|
|
|
|
- and "resultNetWeight" like '${resultNetWeights}'
|
|
|
|
|
|
+ <if test="resultOutGateTimes !=null and resultOutGateTimes !=''">
|
|
|
|
+ and "resultOutGateTime" like '%${resultOutGateTimes}%'
|
|
</if>
|
|
</if>
|
|
- <if test="resultOutGateTimes !=null">
|
|
|
|
- and "resultOutGateTime" like '${resultOutGateTimes}'
|
|
|
|
|
|
+ <if test="outGatepostNames !=null and outGatepostNames !=''">
|
|
|
|
+ and "outGatepostName" like '%${outGatepostNames}%'
|
|
</if>
|
|
</if>
|
|
- <if test="outGatepostNames !=null">
|
|
|
|
- and "outGatepostName" like '${outGatepostNames}'
|
|
|
|
|
|
+ <if test="carrierNames !=null and carrierNames !=''">
|
|
|
|
+ and "carrierName" like '%${carrierNames}%'
|
|
</if>
|
|
</if>
|
|
- <if test="carrierNames !=null">
|
|
|
|
- and "carrierName" like '${carrierNames}'
|
|
|
|
|
|
+ <if test="deliveryAddresss !=null and deliveryAddresss !=''">
|
|
|
|
+ and "deliveryAddress" like '%${deliveryAddresss}%'
|
|
</if>
|
|
</if>
|
|
- <if test="deliveryAddresss !=null">
|
|
|
|
- and "deliveryAddress" like '${deliveryAddresss}'
|
|
|
|
|
|
+ <if test="materialNames !=null and materialNames !=''">
|
|
|
|
+ and "materialName" like '%${materialNames}%'
|
|
</if>
|
|
</if>
|
|
- <if test="materialNames !=null">
|
|
|
|
- and "materialName" like '${materialNames}'
|
|
|
|
|
|
+ <if test="materialSpecifications !=null and materialSpecifications !=''">
|
|
|
|
+ and "materialSpecification" like '%${materialSpecifications}%'
|
|
</if>
|
|
</if>
|
|
- <if test="materialSpecifications !=null">
|
|
|
|
- and "materialSpecification" like '${materialSpecifications}'
|
|
|
|
|
|
+ <if test="materialModels !=null and materialModels !=''">
|
|
|
|
+ and "materialModel" like '%${materialModels}%'
|
|
</if>
|
|
</if>
|
|
- <if test="materialModels !=null">
|
|
|
|
- and "materialModel" like '${materialModels}'
|
|
|
|
|
|
+ <if test="receiveNames !=null and receiveNames!=''">
|
|
|
|
+ and "receiveName" like '%${receiveNames}%'
|
|
</if>
|
|
</if>
|
|
- <if test="receiveNames !=null">
|
|
|
|
- and "receiveName" like '${receiveNames}'
|
|
|
|
|
|
+ <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>
|
|
<if test="orderNumber !=null">
|
|
<if test="orderNumber !=null">
|
|
and "orderNumber" in
|
|
and "orderNumber" in
|
|
@@ -251,27 +265,36 @@
|
|
where o_order.ORDER_NUMBER = #{orderNumber}
|
|
where o_order.ORDER_NUMBER = #{orderNumber}
|
|
</select>
|
|
</select>
|
|
<select id="getStartAndEndCapacityNumber" resultType="java.util.Map">
|
|
<select id="getStartAndEndCapacityNumber" resultType="java.util.Map">
|
|
- select distinct
|
|
|
|
- r_shipper.SHIPPER_NAME "shipperName",
|
|
|
|
- receive_address.ADDRESS_DELIVERY_ADDRESS "addressDeliveryAddress",
|
|
|
|
- r_capacity.CAPACITY_NUMBER "capacityNumber",
|
|
|
|
- t_leave.RESULT_OUT_GATE_TIME "resultOutGateTime"
|
|
|
|
- from OMSTRUCK_ORDER o_torder
|
|
|
|
- left join TMSTRUCK_TOTAL_RESULT t_total
|
|
|
|
- on o_torder.ORDER_ID=t_total.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 RMS_RECEIVE_ADDRESS receive_address
|
|
|
|
- on sale_material.SALE_SHIPPING_ADDRESS_ID=receive_address.ADDRESS_ID
|
|
|
|
- left join AMS_SALE_ORDER a_s_order
|
|
|
|
- on sale_material.SALE_ORDER_ID=a_s_order.SALE_ORDER_ID
|
|
|
|
- left join RMS_SHIPPER r_shipper
|
|
|
|
- on a_s_order.SHIPPER_ID=r_shipper.SHIPPER_ID
|
|
|
|
- left join TMSTRUCK_LEAVE_FACTORY_RESULT t_leave
|
|
|
|
- on t_total.RESULT_TOTAL_ID=t_leave.RESULT_TOTAL_ID
|
|
|
|
- where o_torder.ORDER_NUMBER=#{orderNumber}
|
|
|
|
|
|
+ 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>
|
|
<select id="getReceiptData" resultType="java.util.Map">
|
|
<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 result_id resultId,result_total_id resultTotalId,insert_username inserUserName,insert_time insertTime,status status from TMSTRUCK_RECEIPT_RESULT
|