|
@@ -86,7 +86,7 @@
|
|
|
on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
|
|
|
left join RMS_CONSIGNEE RCON
|
|
|
on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
|
|
|
- where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
|
|
|
+ where OO.ORDER_STATUS in (5,2)
|
|
|
and OO.ORDER_TYPE = #{orderTypee}
|
|
|
<if test="oneDate != null">
|
|
|
and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
|
|
@@ -239,8 +239,7 @@
|
|
|
on RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
|
|
|
left join RMS_CONSIGNEE RCON
|
|
|
on RCON.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
|
|
|
-
|
|
|
- where OO.ORDER_STATUS in (5, 8, 9, 1, 2)
|
|
|
+ where OO.ORDER_STATUS in (5, 2)
|
|
|
and OO.ORDER_TYPE = #{orderTypee}
|
|
|
<if test="oneDate != null">
|
|
|
and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') <= TWR.RESULT_TARE_WEIGHT_TIME
|
|
@@ -550,6 +549,7 @@
|
|
|
on RCA.CARRIER_ID = RC.CARRIER_ID
|
|
|
</if>
|
|
|
where OO.ORDER_TYPE = 12
|
|
|
+ and OO.ORDER_STATUS IN (2,5)
|
|
|
<if test="carrierSsoId != null">
|
|
|
and RCA.CARRIER_SSO_ID = #{carrierSsoId}
|
|
|
</if>
|
|
@@ -644,6 +644,7 @@
|
|
|
on RCA.CARRIER_ID = RC.CARRIER_ID
|
|
|
</if>
|
|
|
where OO.ORDER_TYPE = 13
|
|
|
+ and oo.ORDER_STATUS in (2,5)
|
|
|
<if test="carrierSsoId != null">
|
|
|
and RCA.CARRIER_SSO_ID = #{carrierSsoId}
|
|
|
</if>
|
|
@@ -718,11 +719,13 @@
|
|
|
twr4.result_tare_weight "tareWeightSecond",
|
|
|
twr4.result_tare_weight_time "tareWeightTimeSecond",
|
|
|
twr4.result_net_weight "netWeightSecond",
|
|
|
+ twr4.RESULT_POUND_NO "poundNo",
|
|
|
rtc4.truck_calculate_number "tareTruckCalculateSecond",
|
|
|
tlfr2.result_out_gate_time "outGatepostTimeSecond",
|
|
|
tlfr2.result_out_gate_time "resultOutGateTime",
|
|
|
tlfr2.result_out_mode "outModeSecond",
|
|
|
- rg4.gatepost_name "gatepostNameSecond"
|
|
|
+ rg4.gatepost_name "gatepostNameSecond",
|
|
|
+ apo.EAS_ENTRY_ID "easPrimaryId"
|
|
|
from omstruck_order oo
|
|
|
left join omstruck_order_material oom
|
|
|
on oom.order_id = oo.order_id
|
|
@@ -1050,14 +1053,15 @@
|
|
|
ON RM.MATERIAL_ID = OOM.MATERIAL_ID
|
|
|
LEFT JOIN RMS_WAREHOUSE RW
|
|
|
ON RW.WAREHOUSE_ID = TUR.RESULT_UNLOAD_PLACE_ID
|
|
|
- WHERE TUR.RESULT_END_TIME IS NOT NULL
|
|
|
+ WHERE TWR.RESULT_NET_WEIGHT IS NOT NULL
|
|
|
AND OO.ORDER_TYPE = 11
|
|
|
+ AND OO.ORDER_STATUS = 2
|
|
|
<if test="oneDate != null">
|
|
|
- and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TUR.RESULT_END_TIME
|
|
|
+ and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = GREATEST(TWR.RESULT_GROSS_WEIGHT_TIME,TWR.RESULT_TARE_WEIGHT_TIME)
|
|
|
</if>
|
|
|
<if test="startDate != null">
|
|
|
- and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= TUR.RESULT_END_TIME
|
|
|
- and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= TUR.RESULT_END_TIME
|
|
|
+ and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= GREATEST(TWR.RESULT_GROSS_WEIGHT_TIME,TWR.RESULT_TARE_WEIGHT_TIME)
|
|
|
+ and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= GREATEST(TWR.RESULT_GROSS_WEIGHT_TIME,TWR.RESULT_TARE_WEIGHT_TIME)
|
|
|
</if>
|
|
|
GROUP BY MATERIAL_NAME, WAREHOUSE_NAME
|
|
|
)
|
|
@@ -1279,6 +1283,7 @@
|
|
|
<select id="getCapacityByDefend" resultType="java.util.Map" parameterType="java.util.Map">
|
|
|
select distinct * from(
|
|
|
select rc.CAPACITY_NUMBER "capacityNumber",
|
|
|
+ rc.CAPACITY_TEL "capacityTel",
|
|
|
oo.ORDER_NUMBER "orderNumber",
|
|
|
ter.RESULT_ENTRY_GATE_TIME "resultEntryGateTime",
|
|
|
rg1.GATEPOST_NAME "gatepostName1",
|
|
@@ -1402,7 +1407,7 @@
|
|
|
<if test="index!=null">
|
|
|
and ( (instr(rs.supplier_name, #{index}) > 0) or (instr(rm.material_name , #{index}) > 0)
|
|
|
or (instr(rc.capacity_number , #{index}) > 0) or (instr(rce.consignee_company_name , #{index}) > 0)
|
|
|
- or (instr( RC.CARRIER_NAME , #{index}) > 0) or (instr(RL.LINE_NAME , #{index}) > 0))
|
|
|
+ or (instr( RC.CARRIER_NAME , #{index}) > 0) )
|
|
|
</if>
|
|
|
<if test="oneDate != null">
|
|
|
and to_date(#{oneDate}, 'yyyy-mm-dd hh24:mi:ss') < = TWR.RESULT_TARE_WEIGHT_TIME
|
|
@@ -1763,6 +1768,8 @@
|
|
|
from OMSTRUCK_ORDER OO
|
|
|
left join TMSTRUCK_TOTAL_RESULT TTR on OO.ORDER_ID = TTR.ORDER_ID
|
|
|
left join TMSTRUCK_WEIGHT_RESULT TWR on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
|
|
|
+ left join TMSTRUCK_UNLOAD_RESULT tur on tur.RESULT_TOTAL_ID = ttr.RESULT_TOTAL_ID
|
|
|
+ LEFT JOIN TMSTRUCK_LOAD_RESULT TLR ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
left join RMS_CAPACITY RC on OO.CAPACITY_ID = RC.CAPACITY_ID
|
|
|
left join RMS_TRUCK_CALCULATE RTC1 on RTC1.TRUCK_CALCULATE_ID = TWR.RESULT_TARE_PLACE_ID
|
|
|
left join RMS_TRUCK_CALCULATE RTC2 on RTC2.TRUCK_CALCULATE_ID = TWR.RESULT_GROSS_PLACE_ID
|
|
@@ -1773,14 +1780,15 @@
|
|
|
left join RMS_SHIPPER RS on AIR.REQUIREMENT_SHIPPER_ID = RS.SHIPPER_ID
|
|
|
left join AMSTRUCK_REQUIREMENT_MATERIAL ARM on AIR.REQUIREMENT_ID = ARM.REQUIREMENT_ID
|
|
|
left join RMS_MATERIAL RM on ARM.MATERIAL_ID = RM.MATERIAL_ID
|
|
|
- left join RMS_WAREHOUSE RW1 on ARM.REQUIREMENT_UNLOAD_UNIT_ID = RW1.WAREHOUSE_ID
|
|
|
- left join RMS_WAREHOUSE RW2 on ARM.REQUIREMENT_PLATFORM_ID = RW2.WAREHOUSE_ID
|
|
|
+ left join RMS_WAREHOUSE RW1 on TUR.RESULT_UNLOAD_PLACE_ID = RW1.WAREHOUSE_ID
|
|
|
+ left join RMS_WAREHOUSE RW2 on TLR.LOADING_ID = RW2.WAREHOUSE_ID
|
|
|
left join RMS_MATERIAL_TYPE RMT ON RMT.MATERIAL_TYPE_ID = RM.MATERIAL_TYPE_ID
|
|
|
LEFT JOIN RMS_TRANS_RANGE RTR ON RTR.TRANS_RANGE_ID = AIR.LINE_ID
|
|
|
<where>
|
|
|
TWR.RESULT_NET_WEIGHT IS NOT NULL
|
|
|
AND OO.ORDER_STATUS = 2
|
|
|
AND OO.ORDER_TYPE = 11
|
|
|
+ AND AIR.INSERT_UPDATE_REMARK not like '%计时且过计量%'
|
|
|
<if test="orgCode!=null">
|
|
|
AND OO.OPTIONER_CODE=#{orgCode}
|
|
|
</if>
|
|
@@ -1794,7 +1802,7 @@
|
|
|
<if test="index!=null">
|
|
|
and ((instr(RC.CAPACITY_NUMBER, #{index}) > 0) or (instr(RW1.WAREHOUSE_NAME, #{index}) > 0)
|
|
|
or (instr(RW2.WAREHOUSE_NAME, #{index}) > 0) or (instr(RM.MATERIAL_NAME , #{index}) > 0)
|
|
|
- or (instr( RC2.CARRIER_NAME, #{index}) > 0) or (instr(RL.LINE_NAME, #{index}) > 0))
|
|
|
+ or (instr( RC2.CARRIER_NAME, #{index}) > 0) )
|
|
|
</if>
|
|
|
)
|
|
|
</where>
|
|
@@ -1907,7 +1915,11 @@
|
|
|
RM.MATERIAL_ID "materialId",
|
|
|
RM.MATERIAL_NAME "materialName",
|
|
|
RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "materialSpe",
|
|
|
- R_CARRIER.CARRIER_ABBREVIATION "carrierName",
|
|
|
+ (CASE WHEN ASO.SALE_ORDER_ISSELF_MENTION = '是'
|
|
|
+ THEN '自提'
|
|
|
+ ELSE R_CARRIER.CARRIER_ABBREVIATION
|
|
|
+ END)
|
|
|
+ "carrierName",
|
|
|
OO.ORDER_NUMBER "orderNo",
|
|
|
RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT ||
|
|
|
RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
|
|
@@ -1935,7 +1947,11 @@
|
|
|
NVL(R_CARRIER.CARRIER_ID,0) "carrierIds",
|
|
|
OO.CAN_WORK "canwork",
|
|
|
OO.ORDER_STATUS "carStatus",
|
|
|
+ RSA.AREA_NAME "areaName",
|
|
|
+ TAR.INSERT_TIME "arrivalTime",
|
|
|
+ TRR.INSERT_TIME "receiptTime",
|
|
|
DECODE(OO.PRINTNUMBER,1,'已打印','未打印') "isPrintDelivery",
|
|
|
+ decode(TSR.RESULT_ID,null,'未发送','已发送') "smsResultId",
|
|
|
DECODE(ASO.SALE_ORDER_STATUS,1,'销售订单已上报',
|
|
|
2,'销售已提交',
|
|
|
4,'财务已审批',
|
|
@@ -1947,6 +1963,8 @@
|
|
|
ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
|
|
|
LEFT JOIN RMS_SHIPPER RS
|
|
|
ON RS.SHIPPER_ID = ASO.SHIPPER_ID
|
|
|
+ LEFT JOIN RMS_SALE_AREA RSA
|
|
|
+ ON RSA.AREA_ID=RC.AREA_ID
|
|
|
LEFT JOIN RMS_SALER RSR
|
|
|
ON RSR.SALER_ID = ASO.SALER_ID
|
|
|
LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
|
|
@@ -1986,6 +2004,8 @@
|
|
|
ON TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
LEFT JOIN TMStRUCK_RECEIPT_RESULT TRR
|
|
|
ON TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
|
|
|
+ LEFT JOIN TMSTRUCK_SMS_RUSULT TSR
|
|
|
+ ON TSR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
|
|
|
WHERE ASO.SALE_TYPE = 1
|
|
|
AND ASO.DELETED = 0
|
|
|
and ASM.SALE_MATERIAL_ID IS NOT NULL
|
|
@@ -2005,15 +2025,64 @@
|
|
|
<if test="salers != null">
|
|
|
and RSR.SALER_NAME = #{salers}
|
|
|
</if>
|
|
|
+ <if test="easPrimaryId != null">
|
|
|
+ and ASM.EAS_PRIMARY_ID = #{easPrimaryId}
|
|
|
+ </if>
|
|
|
<if test="capacityNum != null">
|
|
|
and RCA.CAPACITY_NUMBER like #{capacityNum}
|
|
|
</if>
|
|
|
+ <if test="capacityList != null">
|
|
|
+ and <foreach collection="capacityList" item="item" open="(" separator="or" close=")">
|
|
|
+ RCA.CAPACITY_NUMBER like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="consigneeNames != null">
|
|
|
and RC.CONSIGNEE_COMPANY_NAME like #{consigneeNames}
|
|
|
</if>
|
|
|
+ <if test="consigneeNameList != null">
|
|
|
+ and <foreach collection="consigneeNameList" item="item" open="(" separator="or" close=")">
|
|
|
+ RC.CONSIGNEE_COMPANY_NAME like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="carrierNames != null">
|
|
|
and R_CARRIER.CARRIER_ABBREVIATION like #{carrierNames}
|
|
|
</if>
|
|
|
+ <if test="carrierList != null ">
|
|
|
+ and <foreach collection="carrierList" item="item" open="(" separator="or" close=")">
|
|
|
+ <if test="item == null">
|
|
|
+ R_CARRIER.CARRIER_ABBREVIATION is null
|
|
|
+ </if>
|
|
|
+ <if test="item != null">
|
|
|
+ R_CARRIER.CARRIER_ABBREVIATION like '%${item}%'
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="materialNameList != null">
|
|
|
+ and <foreach collection="materialNameList" item="item" open="(" separator="or" close=")">
|
|
|
+ RM.MATERIAL_NAME like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="saleAreaList != null">
|
|
|
+ and <foreach collection="saleAreaList" item="item" open="(" separator="or" close=")">
|
|
|
+ RSA.AREA_NAME like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="orderStatusList != null">
|
|
|
+ and <foreach collection="orderStatusList" item="item" open="(" separator="or" close=")">
|
|
|
+ DECODE(OO.ORDER_STATUS ,2,'作业已完成',4,'物流公司已派单',5,'司机已接单',0,'未派发',7,'已关闭',8,'已关闭') like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="addressPlaceList != null">
|
|
|
+ and <foreach collection="addressPlaceList" item="item" open="(" separator="or" close=")">
|
|
|
+ RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT ||
|
|
|
+ RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="materialSpeList != null">
|
|
|
+ and <foreach collection="materialSpeList" item="item" open="(" separator="or" close=")">
|
|
|
+ RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
order by ASO.SALE_ORDER_ID DESC, OO.ORDER_ID DESC
|
|
|
)
|
|
|
</select>
|
|
@@ -2421,4 +2490,208 @@
|
|
|
select CAPACITY_NUMBER from RMS_CAPACITY
|
|
|
where CAPACITY_ID=#{capacitynumber}
|
|
|
</select>
|
|
|
+ <select id="getCarrierFilterList" resultType="java.util.Map" parameterType="map">
|
|
|
+ SELECT * FROM (
|
|
|
+ SELECT distinct
|
|
|
+ R_CARRIER.CARRIER_ABBREVIATION "value",
|
|
|
+ R_CARRIER.CARRIER_ABBREVIATION "text",
|
|
|
+ FROM AMS_SALE_ORDER ASO
|
|
|
+ LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
+ ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
|
|
|
+ LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
|
|
|
+ ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
+ LEFT JOIN RMS_CARRIER R_CARRIER
|
|
|
+ ON R_CARRIER.CARRIER_ID = ADSO.CARRIER_ID
|
|
|
+ WHERE ASO.SALE_TYPE = 1
|
|
|
+ AND ASO.DELETED = 0
|
|
|
+ <if test="oneDate != null">
|
|
|
+ and to_date(#{oneDate}, 'yyyy-mm-dd') < = to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">
|
|
|
+ and to_date(#{startDate}, 'yyyy-mm-dd') <= to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
|
|
|
+ and to_date(#{endDate}, 'yyyy-mm-dd') >= to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
|
|
|
+ </if>
|
|
|
+ order by ASO.SALE_ORDER_ID DESC
|
|
|
+ )
|
|
|
+ </select>
|
|
|
+ <select id="loadingSaleSteelReport" resultType="java.util.Map" parameterType="map">
|
|
|
+ SELECT * FROM (
|
|
|
+ SELECT distinct OO.ORDER_ID "orderId",
|
|
|
+ ASO.SALE_ORDER_ID "saleOrderId",
|
|
|
+ to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd') "orderTime",
|
|
|
+ ASO.SALE_NUMBER "saleOrderNo",
|
|
|
+ ASM.SALE_MATERIAL_ID "saleMaterialId",
|
|
|
+ ASM.MATERIAL_NUMBER "materialNum",
|
|
|
+ ASM.MATERIAL_NUMBER "materialNumber",
|
|
|
+ ASO.SALE_REMARK "saleRemark",
|
|
|
+ ASM.EAS_PRIMARY_ID "closeEntryId",
|
|
|
+ ASM.DELETED "deletedStatus",
|
|
|
+ decode(ASM.DELETED,0,'关闭','审核') "entryStatus",
|
|
|
+ RC.CONSIGNEE_COMPANY_NAME "consigneeName",
|
|
|
+ RC.CONSIGNEE_COMPANY_NAME "receiveName",
|
|
|
+ ASO.SALE_ORDER_RECEIVE_CUSTOMER "saleOrderReceiveCustomer",
|
|
|
+ ASM.IS_POUND_SALE "isPoundSale",
|
|
|
+ ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
|
|
|
+ RS.SHIPPER_NAME "shipperName",
|
|
|
+ RCA.CAPACITY_NUMBER "capacityNo",
|
|
|
+ NVL(OO.CAPACITY_ID,0) "capacityIds",
|
|
|
+ OO.CAPACITY_ID "capacityId",
|
|
|
+ ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "truckNo",
|
|
|
+ ASOM.SALE_ORDER_CONSIGNEE_TEL "consigneeTel",
|
|
|
+ ASOM.SALE_ORDER_CONSIGNEE_TEL "saleOrderConsigneeTel",
|
|
|
+ OO.ORDER_LINE_SEQUENCE "lineSequence",
|
|
|
+ ASO.SALE_ORDER_ISSELF_MENTION "isSelfMention",
|
|
|
+ RSR.SALER_NAME "saler",
|
|
|
+ RSR.SALER_NAME "salerName",
|
|
|
+ RM.MATERIAL_ID "materialId",
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
+ RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "materialSpe",
|
|
|
+ ASM.STEEL_METER "steelMeters",
|
|
|
+ RM.MATERIAL_SPECIFICATION "materialSpecification",
|
|
|
+ RM.MATERIAL_MODEL "materialModel",
|
|
|
+ R_CARRIER.CARRIER_ABBREVIATION "carrierName",
|
|
|
+ OO.ORDER_NUMBER "orderNo",
|
|
|
+ RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT ||
|
|
|
+ RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS AS "addressPlace",
|
|
|
+ RRP.PLACE_ID "placeId",
|
|
|
+ RRP.ADDRESS_DELIVERY_ADDRESS "place",
|
|
|
+ RRA.ADDRESS_ID "shipperAddressId",
|
|
|
+ RRA.ADDRESS_PROVINCE "addressProvince",
|
|
|
+ RRA.ADDRESS_PROVINCE "province",
|
|
|
+ RRA.ADDRESS_DISTRICT "district",
|
|
|
+ RRA.ADDRESS_TOWN "town",
|
|
|
+ RRA.ADDRESS_DISTRICT "addressDistrict",
|
|
|
+ RRA.ADDRESS_TOWN "addressTown",
|
|
|
+ OO.ORDER_LINE_SEQUENCE "lineSqe",
|
|
|
+ OO.DRIVER_TEL "capacityTel",
|
|
|
+ TWR.RESULT_GROSS_WEIGHT "grossWeight",
|
|
|
+ TWR.RESULT_GROSS_WEIGHT_TIME "grossWeightTime",
|
|
|
+ TWR.RESULT_TARE_WEIGHT "tareWeight",
|
|
|
+ TWR.RESULT_TARE_WEIGHT_TIME "tareWeightTime",
|
|
|
+ TWR.RESULT_NET_WEIGHT "netWeight",
|
|
|
+ TLR.RESULT_LOAD_END_TIME "loadTime",
|
|
|
+ TLFR.RESULT_OUT_GATE_TIME "outGateTime",
|
|
|
+ TER.RESULT_ENTRY_GATE_TIME "entryGateTime",
|
|
|
+ ASOM.SALE_DATE_OF_RECEIPT "saleDateReceipt",
|
|
|
+ R_CARRIER.CARRIER_ID "carrierId",
|
|
|
+ OO.CAPACITYIDS "capacityNumbers",
|
|
|
+ NVL(R_CARRIER.CARRIER_ID,0) "carrierIds",
|
|
|
+ OO.CAN_WORK "canwork",
|
|
|
+ OO.ORDER_STATUS "carStatus",
|
|
|
+ RSA.AREA_NAME "areaName",
|
|
|
+ RSA.AREA_NAME "saleArea",
|
|
|
+ DECODE(ASO.SALE_ORDER_STATUS,1,'销售订单已上报',
|
|
|
+ 2,'销售已提交',
|
|
|
+ 4,'财务已审批',
|
|
|
+ 0,'销售订单未上报') "saleOrderStatus",
|
|
|
+ DECODE(OO.ORDER_STATUS ,2,'作业已完成',4,'物流公司已派单',5,'司机已接单',0,'未派发',7,'已关闭',8,'已关闭')
|
|
|
+ "orderStatus"
|
|
|
+ FROM AMS_SALE_ORDER ASO
|
|
|
+ LEFT JOIN RMS_CONSIGNEE RC
|
|
|
+ ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
|
|
|
+ LEFT JOIN RMS_SHIPPER RS
|
|
|
+ ON RS.SHIPPER_ID = ASO.SHIPPER_ID
|
|
|
+ LEFT JOIN RMS_SALE_AREA RSA
|
|
|
+ ON RSA.AREA_ID=RC.AREA_ID
|
|
|
+ LEFT JOIN RMS_SALER RSR
|
|
|
+ ON RSR.SALER_ID = ASO.SALER_ID
|
|
|
+ LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
+ ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
|
|
|
+ LEFT JOIN RMS_RECEIVE_PLACE RRP
|
|
|
+ ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
|
|
|
+ LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
|
+ ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
|
|
|
+ LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
|
|
|
+ ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
+ LEFT JOIN RMS_CARRIER R_CARRIER
|
|
|
+ ON R_CARRIER.CARRIER_ID = ADSO.CARRIER_ID
|
|
|
+ LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL ASTM
|
|
|
+ ON ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
+ LEFT JOIN AMS_SALE_MATERIAL ASM
|
|
|
+ ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
|
|
|
+ LEFT JOIN RMS_MATERIAL RM
|
|
|
+ ON RM.MATERIAL_ID = ASM.MATERIAL_ID
|
|
|
+ LEFT JOIN OMSTRUCK_ORDER OO
|
|
|
+ ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
+ AND NVL(OO.ORDER_TYPE,0) in (0,1)
|
|
|
+ LEFT JOIN RMS_CAPACITY RCA
|
|
|
+ ON RCA.CAPACITY_ID = OO.CAPACITY_ID
|
|
|
+ LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
|
|
|
+ ON TTR.ORDER_ID = OO.ORDER_ID
|
|
|
+ LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
|
|
|
+ ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
|
|
|
+ ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ AND TWR.MATERIAL_ID = RM.MATERIAL_ID
|
|
|
+ LEFT JOIN TMSTRUCK_LOAD_RESULT TLR
|
|
|
+ ON TLR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ AND TLR.MATERIAL_ID = RM.MATERIAL_ID
|
|
|
+ LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
|
|
|
+ ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
|
|
|
+ WHERE ASO.SALE_TYPE = 1
|
|
|
+ <if test="entryIdList == null">
|
|
|
+ AND ASO.DELETED = 0
|
|
|
+ and ASM.SALE_MATERIAL_ID IS NOT NULL
|
|
|
+ AND TWR.RESULT_NET_WEIGHT IS NULL
|
|
|
+ AND ASOM.SALE_DATE_OF_RECEIPT < sysdate
|
|
|
+ AND ASOM.SALE_DATE_OF_RECEIPT > sysdate -1
|
|
|
+ AND ASO.INSERT_UPDATE_REMARK != '物流上传金蝶成功'
|
|
|
+ </if>
|
|
|
+ <if test="remark != null" >
|
|
|
+ and RSR.SALER_NAME || RCA.CAPACITY_NUMBER || RC.CONSIGNEE_COMPANY_NAME || R_CARRIER.CARRIER_ABBREVIATION || RM.MATERIAL_NAME || RM.MATERIAL_MODEL || RM.MATERIAL_SPECIFICATION LIKE #{remark}
|
|
|
+ </if>
|
|
|
+ <if test="salers != null">
|
|
|
+ and RSR.SALER_NAME = #{salers}
|
|
|
+ </if>
|
|
|
+ <if test="easPrimaryId != null">
|
|
|
+ and ASM.EAS_PRIMARY_ID = #{easPrimaryId}
|
|
|
+ </if>
|
|
|
+ <if test="capacityNum != null">
|
|
|
+ and RCA.CAPACITY_NUMBER like #{capacityNum}
|
|
|
+ </if>
|
|
|
+ <if test="capacityList != null">
|
|
|
+ and <foreach collection="capacityList" item="item" open="(" separator="or" close=")">
|
|
|
+ RCA.CAPACITY_NUMBER like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="consigneeNames != null">
|
|
|
+ and RC.CONSIGNEE_COMPANY_NAME like #{consigneeNames}
|
|
|
+ </if>
|
|
|
+ <if test="consigneeNameList != null">
|
|
|
+ and <foreach collection="consigneeNameList" item="item" open="(" separator="or" close=")">
|
|
|
+ RC.CONSIGNEE_COMPANY_NAME like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="carrierNames != null">
|
|
|
+ and R_CARRIER.CARRIER_ABBREVIATION like #{carrierNames}
|
|
|
+ </if>
|
|
|
+ <if test="carrierList != null ">
|
|
|
+ and <foreach collection="carrierList" item="item" open="(" separator="or" close=")">
|
|
|
+ <if test="item == null">
|
|
|
+ R_CARRIER.CARRIER_ABBREVIATION is null
|
|
|
+ </if>
|
|
|
+ <if test="item != null">
|
|
|
+ R_CARRIER.CARRIER_ABBREVIATION like '%${item}%'
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="materialNameList != null">
|
|
|
+ and <foreach collection="materialNameList" item="item" open="(" separator="or" close=")">
|
|
|
+ RM.MATERIAL_NAME like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="saleAreaList != null">
|
|
|
+ and <foreach collection="saleAreaList" item="item" open="(" separator="or" close=")">
|
|
|
+ RSA.AREA_NAME like '%${item}%'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="entryIdList != null">
|
|
|
+ and <foreach collection="entryIdList" item="item" open="(" separator="or" close=")">
|
|
|
+ ASM.EAS_PRIMARY_ID like '%${item}'
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by ASO.SALE_ORDER_ID DESC, OO.ORDER_ID DESC
|
|
|
+ )
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|