|
@@ -319,82 +319,82 @@
|
|
|
<!-- 查询销售统计报表 -->
|
|
|
<select id="getAllSaleReport" parameterType="java.util.Map" resultType="java.util.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",
|
|
|
- TLR.CASE_NUMBER "caseNumber",
|
|
|
- RC2.CARRIER_NAME "carrierName",
|
|
|
- CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
|
|
|
- from OMSTRUCK_ORDER OO
|
|
|
- left join AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
- on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_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
|
|
|
- join TMSTRUCK_TOTAL_RESULT TTR
|
|
|
- on TTR.ORDER_ID = OO.ORDER_ID
|
|
|
- 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
|
|
|
- join TMSTRUCK_WEIGHT_RESULT TWR
|
|
|
- on TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_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
|
|
|
- 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
|
|
|
- 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
|
|
|
- join RMS_CAPACITY RC
|
|
|
- on RC.CAPACITY_ID = OO.CAPACITY_ID
|
|
|
- join OMSTRUCK_ORDER_MATERIAL OOM
|
|
|
- on OOM.ORDER_ID = OO.ORDER_ID
|
|
|
- join RMS_MATERIAL RM
|
|
|
- on RM.MATERIAL_ID = OOM.MATERIAL_ID
|
|
|
- where OO.ORDER_TYPE in (1, 2)
|
|
|
- <if test="carrierSsoId != null">
|
|
|
- and RC2.CARRIER_SSO_ID = #{carrierSsoId}
|
|
|
- </if>
|
|
|
- <if test="oneDate != null">
|
|
|
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_GROSS_WEIGHT_TIME
|
|
|
- </if>
|
|
|
- <if test="startDate != null">
|
|
|
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_GROSS_WEIGHT_TIME
|
|
|
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_TIME
|
|
|
- </if>
|
|
|
- )
|
|
|
+ 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",
|
|
|
+ TLR.CASE_NUMBER "caseNumber",
|
|
|
+ RC2.CARRIER_NAME "carrierName",
|
|
|
+ CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "materialCode"
|
|
|
+ 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_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
|
|
|
+ join TMSTRUCK_LOAD_RESULT TLR
|
|
|
+ on TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ and TLR.MATERIAL_ID = TWR.MATERIAL_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
|
|
|
+ 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
|
|
|
+ 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
|
|
|
+ join RMS_CAPACITY RC
|
|
|
+ on RC.CAPACITY_ID = OO.CAPACITY_ID
|
|
|
+ join RMS_MATERIAL RM
|
|
|
+ on RM.MATERIAL_ID = TWR.MATERIAL_ID
|
|
|
+ WHERE OO.ORDER_TYPE = #{orderType}
|
|
|
+ AND ASO.SHIPPER_ID = #{shipperId}
|
|
|
+ <if test="carrierSsoId != null">
|
|
|
+ and RC2.CARRIER_SSO_ID = #{carrierSsoId}
|
|
|
+ </if>
|
|
|
+ <if test="oneDate != null">
|
|
|
+ and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_GROSS_WEIGHT_TIME
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">
|
|
|
+ and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_GROSS_WEIGHT_TIME
|
|
|
+ and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TWR.RESULT_GROSS_WEIGHT_TIME
|
|
|
+ </if>
|
|
|
+ )
|
|
|
<where>
|
|
|
<if test="orderNumber != null">
|
|
|
<foreach collection="orderNumber" item="item" open="(" separator="or" close=")">
|
|
@@ -478,7 +478,7 @@
|
|
|
<if test="resultGrossWeightTime != null">
|
|
|
and
|
|
|
<foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
|
|
|
- "resultGrossWeightTime" like '%${item}%'
|
|
|
+ "resultGrossWeightTime" like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="resultGrossWeight != null">
|
|
@@ -576,7 +576,7 @@
|
|
|
join RMS_CARRIER RCA
|
|
|
on RCA.CARRIER_ID = RC.CARRIER_ID
|
|
|
</if>
|
|
|
- where OO.ORDER_TYPE in (12,15)
|
|
|
+ where OO.ORDER_TYPE = 12
|
|
|
<if test="carrierSsoId != null">
|
|
|
and RCA.CARRIER_SSO_ID = #{carrierSsoId}
|
|
|
</if>
|
|
@@ -597,9 +597,6 @@
|
|
|
<if test="userIds!=null">
|
|
|
and ASO.UPDATE_USERNAME=#{userIds}
|
|
|
</if>
|
|
|
- <if test="orderType!=null">
|
|
|
- and OO.ORDER_TYPE=#{orderType}
|
|
|
- </if>
|
|
|
)
|
|
|
<where>
|
|
|
<if test="receiveName != null">
|
|
@@ -640,7 +637,7 @@
|
|
|
<if test="resultTareWeightTime != null">
|
|
|
and
|
|
|
<foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
|
|
|
- "resultTareWeightTime" like '%${item}%'
|
|
|
+ to_char("resultTareWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="resultTareWeight != null">
|
|
@@ -652,7 +649,7 @@
|
|
|
<if test="resultEndTime != null">
|
|
|
and
|
|
|
<foreach collection="resultEndTime" item="item" open="(" separator="or" close=")">
|
|
|
- "resultEndTime" like '%${item}%'
|
|
|
+ to_char("resultEndTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="warehouseName != null">
|
|
@@ -664,7 +661,7 @@
|
|
|
<if test="resultGrossWeightTime != null">
|
|
|
and
|
|
|
<foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
|
|
|
- "resultGrossWeightTime" like '%${item}%'
|
|
|
+ to_char("resultGrossWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="resultGrossWeight != null">
|
|
@@ -769,7 +766,7 @@
|
|
|
join RMS_CARRIER RCA
|
|
|
on RCA.CARRIER_ID = RC.CARRIER_ID
|
|
|
</if>
|
|
|
- where OO.ORDER_TYPE in (13,16)
|
|
|
+ where OO.ORDER_TYPE = 13
|
|
|
<if test="carrierSsoId != null">
|
|
|
and RCA.CARRIER_SSO_ID = #{carrierSsoId}
|
|
|
</if>
|
|
@@ -790,9 +787,6 @@
|
|
|
<if test="userIds!=null">
|
|
|
and ASO.UPDATE_USERNAME=#{userIds}
|
|
|
</if>
|
|
|
- <if test="orderType!=null">
|
|
|
- and OO.ORDER_TYPE=#{orderType}
|
|
|
- </if>
|
|
|
)
|
|
|
<where>
|
|
|
<if test="receiveName != null">
|
|
@@ -1160,7 +1154,7 @@
|
|
|
<if test="resultTareWeightTime != null">
|
|
|
and
|
|
|
<foreach collection="resultTareWeightTime" item="item" open="(" separator="or" close=")">
|
|
|
- "resultTareWeightTime" like '%${item}%'
|
|
|
+ to_char("resultTareWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
|
|
@@ -1172,7 +1166,7 @@
|
|
|
<if test="resultGrossWeightTime != null">
|
|
|
and
|
|
|
<foreach collection="resultGrossWeightTime" item="item" open="(" separator="or" close=")">
|
|
|
- "resultGrossWeightTime" like '%${item}%'
|
|
|
+ to_char("resultGrossWeightTime",'yyyy-mm-dd hh24:mi:ss') like '%${item}%'
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="resultGrossWeight != null">
|
|
@@ -1493,24 +1487,14 @@
|
|
|
|
|
|
|
|
|
<select id="getCapacityByDefend" resultType="java.util.Map" parameterType="java.util.Map">
|
|
|
- select * from(
|
|
|
+ select distinct * from(
|
|
|
select rc.CAPACITY_NUMBER "capacityNumber",
|
|
|
- oo.ORDER_NUMBER "orderNumber",
|
|
|
- twr.RESULT_GROSS_WEIGHT "resultGrossWeight",
|
|
|
- twr.RESULT_GROSS_WEIGHT_TIME "resultGrossWeightTime",
|
|
|
- rtc1.TRUCK_CALCULATE_NUMBER "truckCalculateNumber1",
|
|
|
- twr.RESULT_TARE_WEIGHT "resultTareWeight",
|
|
|
- twr.RESULT_TARE_WEIGHT_TIME "resultTareWeightTime",
|
|
|
- rtc2.TRUCK_CALCULATE_NUMBER "truckCalculateNumber2",
|
|
|
- twr.RESULT_NET_WEIGHT "resultNetWeight",
|
|
|
- ter.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
|
|
|
- rg1.GATEPOST_NAME "gatepostName1",
|
|
|
- tlfr.RESULT_OUT_GATE_TIME "resultOutGateTime",
|
|
|
- rg2.GATEPOST_NAME "gatepostName2",
|
|
|
- tlr.RESULT_LOAD_END_TIME "resultLoadEndTime",
|
|
|
- rw1.WAREHOUSE_NAME "warehouseName1",
|
|
|
- tur.RESULT_END_TIME "resultEndTime",
|
|
|
- rw2.WAREHOUSE_NAME "warehouseName2"
|
|
|
+ oo.ORDER_NUMBER "orderNumber",
|
|
|
+ ter.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
|
|
|
+ rg1.GATEPOST_NAME "gatepostName1",
|
|
|
+ tlfr.RESULT_OUT_GATE_TIME "resultOutGateTime",
|
|
|
+ rg2.GATEPOST_NAME "gatepostName2",
|
|
|
+ rm.material_name "materialName"
|
|
|
from OMSTRUCK_ORDER oo
|
|
|
left join OMSTRUCK_ORDER_MATERIAL oom
|
|
|
on oom.ORDER_ID = oo.ORDER_ID
|
|
@@ -1520,32 +1504,28 @@
|
|
|
on rc.CAPACITY_ID = oo.CAPACITY_ID
|
|
|
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
|
|
|
- left join RMS_TRUCK_CALCULATE rtc1
|
|
|
- on twr.RESULT_GROSS_PLACE_ID = rtc1.TRUCK_CALCULATE_ID
|
|
|
- left join RMS_TRUCK_CALCULATE rtc2
|
|
|
- on twr.RESULT_GROSS_PLACE_ID = rtc2.TRUCK_CALCULATE_ID
|
|
|
left join TMSTRUCK_ENFACTORY_RESULT ter
|
|
|
on ter.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
|
|
|
left join RMS_GATEPOST rg1
|
|
|
on rg1.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 rg2
|
|
|
+ left join RMS_GATEPOST rg2
|
|
|
on rg2.GATEPOST_ID = tlfr.GATEPOST_ID
|
|
|
- left join TMSTRUCK_LOAD_RESULT tlr
|
|
|
- on tlr.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
|
|
|
- left join RMS_WAREHOUSE rw1
|
|
|
- on tlr.LOADING_ID = rw1.WAREHOUSE_ID
|
|
|
- left join TMSTRUCK_UNLOAD_RESULT tur
|
|
|
- on tur.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
|
|
|
- left join RMS_WAREHOUSE rw2
|
|
|
- on tur.RESULT_UNLOAD_PLACE_ID = rw2.WAREHOUSE_ID
|
|
|
- where trunc(ter.RESULT_ENTRY_GATE_TIME) = trunc(sysdate)
|
|
|
- <if test="con!=null">
|
|
|
- and instr(rc.CAPACITY_NUMBER , #{con})>0
|
|
|
+ <where>
|
|
|
+ <if test="oneDate != null">
|
|
|
+ and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = tlfr.RESULT_OUT_GATE_TIME
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null" >
|
|
|
+ and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') < = tlfr.RESULT_OUT_GATE_TIME
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null" >
|
|
|
+ and to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss') >= tlfr.RESULT_OUT_GATE_TIME
|
|
|
</if>
|
|
|
+ <if test="con != null">
|
|
|
+ and (instr(rc.CAPACITY_NUMBER, #{con}) > 0 or instr(rg1.GATEPOST_NAME, #{con}) > 0 or instr(rg2.GATEPOST_NAME, #{con}) > 0 )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
order by ter.RESULT_ENTRY_GATE_TIME desc
|
|
|
)
|
|
|
<where>
|