|
@@ -2005,6 +2005,11 @@
|
|
TAR.INSERT_TIME "arrivalTime",
|
|
TAR.INSERT_TIME "arrivalTime",
|
|
TRR.INSERT_TIME "receiptTime",
|
|
TRR.INSERT_TIME "receiptTime",
|
|
ASO.sale_remark "saleRemark",
|
|
ASO.sale_remark "saleRemark",
|
|
|
|
+ (CASE WHEN
|
|
|
|
+ ASO.sale_remark is not null and instr(ASO.sale_remark,'钢材工程组') > 0
|
|
|
|
+ then 1
|
|
|
|
+ else 0
|
|
|
|
+ end) "isGcKeHu",
|
|
(CASE WHEN
|
|
(CASE WHEN
|
|
TLFR.RESULT_OUT_GATE_TIME IS NULL
|
|
TLFR.RESULT_OUT_GATE_TIME IS NULL
|
|
then null
|
|
then null
|
|
@@ -2112,19 +2117,9 @@
|
|
ON TSR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
|
|
ON TSR.TOTAL_RESULT_ID = TTR.RESULT_TOTAL_ID
|
|
WHERE
|
|
WHERE
|
|
ASM.SALE_MATERIAL_ID IS NOT NULL
|
|
ASM.SALE_MATERIAL_ID IS NOT NULL
|
|
- and (aso.DELETED = 1 and aso.SALE_ORDER_STATUS = 4 or aso.DELETED != 1 and aso.SALE_ORDER_STATUS between 0 and 4)
|
|
|
|
-
|
|
|
|
- and ASO.SALE_TYPE = 1
|
|
|
|
- <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="carrierSsoId != null">
|
|
<if test="carrierSsoId != null">
|
|
and R_CARRIER.CARRIER_SSO_ID = #{carrierSsoId}
|
|
and R_CARRIER.CARRIER_SSO_ID = #{carrierSsoId}
|
|
</if>
|
|
</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>
|
|
|
|
<if test="remark != null" >
|
|
<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}
|
|
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>
|
|
@@ -2244,6 +2239,16 @@
|
|
<if test="consigneeLoginName != null">
|
|
<if test="consigneeLoginName != null">
|
|
and RC.CONSIGNEE_COMPANY_NAME LIKE '%${consigneeLoginName}%'
|
|
and RC.CONSIGNEE_COMPANY_NAME LIKE '%${consigneeLoginName}%'
|
|
</if>
|
|
</if>
|
|
|
|
+ and (aso.DELETED = 1 and aso.SALE_ORDER_STATUS = 4 or aso.DELETED != 1 and aso.SALE_ORDER_STATUS between 0 and 4)
|
|
|
|
+ <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>
|
|
|
|
+ and ASO.SALE_TYPE = 1
|
|
order by ASO.SALE_ORDER_ID DESC, ASOM.SALE_ORDER_MATERIAL_ID DESC,OO.ORDER_ID DESC
|
|
order by ASO.SALE_ORDER_ID DESC, ASOM.SALE_ORDER_MATERIAL_ID DESC,OO.ORDER_ID DESC
|
|
)
|
|
)
|
|
</select>
|
|
</select>
|
|
@@ -3477,5 +3482,229 @@
|
|
SELECT RSR.SALE_REMARK FROM RMS_SALER_REMAR RSR
|
|
SELECT RSR.SALE_REMARK FROM RMS_SALER_REMAR RSR
|
|
WHERE RSR.SALER_NAME = #{saler}
|
|
WHERE RSR.SALER_NAME = #{saler}
|
|
</select>
|
|
</select>
|
|
|
|
+ <select id="getSaleSteelReportForFinance" resultType="java.util.Map" parameterType="map">
|
|
|
|
+ SELECT * FROM (
|
|
|
|
+ SELECT distinct OO.ORDER_ID "orderId",
|
|
|
|
+ ASO.SALE_ORDER_ID "saleOrderId",
|
|
|
|
+ ASM.SALE_MAKE_DATE "saleMakeDate",
|
|
|
|
+ to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd') "orderTime",
|
|
|
|
+ ASO.INSERT_UPDATE_REMARK "saleOrderInertUpdateRemark",
|
|
|
|
+ ASO.SALE_NUMBER "saleOrderNo",
|
|
|
|
+ ASO.UPDATE_TIME "updateTime",
|
|
|
|
+ ASM.SALE_MATERIAL_ID "saleMaterialId",
|
|
|
|
+ ASM.MATERIAL_NUMBER "materialNum",
|
|
|
|
+ ASM.EAS_PRIMARY_ID "closeEntryId",
|
|
|
|
+ ASM.STEEL_METER "steelMeters",
|
|
|
|
+ ASM.DELETED "deletedStatus",
|
|
|
|
+ RC.CONSIGNEE_COMPANY_NAME "consigneeName",
|
|
|
|
+ ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
|
|
|
|
+ RS.SHIPPER_NAME "shipperName",
|
|
|
|
+ (CASE WHEN
|
|
|
|
+ RCA.CAPACITY_NUMBER = '空白'
|
|
|
|
+ then null
|
|
|
|
+ else RCA.CAPACITY_NUMBER
|
|
|
|
+ END) "capacityNo",
|
|
|
|
+ RCA.CAPACITY_NUMBER "newCapacityNo",
|
|
|
|
+ NVL(OO.CAPACITY_ID,0) "capacityIds",
|
|
|
|
+ OO.CAPACITY_ID "capacityId",
|
|
|
|
+ ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "truckNo",
|
|
|
|
+ ASOM.SALE_ORDER_CONSIGNEE_TEL "consigneeTel",
|
|
|
|
+ ASOM.TRUCK_REMARK "truckRemark",
|
|
|
|
+ OO.ORDER_LINE_SEQUENCE "lineSequence",
|
|
|
|
+ ASO.SALE_ORDER_ISSELF_MENTION "isSelfMention",
|
|
|
|
+ RSR.SALER_NAME "saler",
|
|
|
|
+ RM.MATERIAL_ID "materialId",
|
|
|
|
+ RM.MATERIAL_NAME "materialName",
|
|
|
|
+ RM.MATERIAL_SPECIFICATION || RM.MATERIAL_MODEL "materialSpe",
|
|
|
|
+ (CASE WHEN ASO.SALE_ORDER_ISSELF_MENTION = '是'
|
|
|
|
+ THEN '自提'
|
|
|
|
+ ELSE R_CARRIER.CARRIER_ABBREVIATION
|
|
|
|
+ END)
|
|
|
|
+ "carrierName",
|
|
|
|
+ OO.ORDER_NUMBER "orderNo",
|
|
|
|
+ ACTP.PRICE_VALUE AS "priceValue",
|
|
|
|
+ BDO.DETAILS_AMOUNT AS "detailsAmount",
|
|
|
|
+ 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_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",
|
|
|
|
+ ASOM.SALE_DATE_OF_RECEIPT "saleDateReceipt",
|
|
|
|
+ (CASE WHEN
|
|
|
|
+ ASM.IS_POUND_SALE = 0
|
|
|
|
+ THEN NULL
|
|
|
|
+ else ASM.MATERIAL_WEIGHT
|
|
|
|
+ END) "materialThoWeight",
|
|
|
|
+ R_CARRIER.CARRIER_ID "carrierId",
|
|
|
|
+ NVL(R_CARRIER.CARRIER_ID,0) "carrierIds",
|
|
|
|
+ OO.CAN_WORK "canwork",
|
|
|
|
+ OO.ORDER_STATUS "carStatus",
|
|
|
|
+ RSA.AREA_NAME "areaName",
|
|
|
|
+ OO.INSERT_UPDATE_REMARK "orderInsertUpdateRemark",
|
|
|
|
+ ASO.sale_remark "saleRemark",
|
|
|
|
+ (CASE WHEN
|
|
|
|
+ ASO.DELETED = 2 then '关闭'
|
|
|
|
+ when ASO.DELETED = 1 then '反审批'
|
|
|
|
+ when ASO.SALE_ORDER_STATUS = 4 then '审核'
|
|
|
|
+ when ASO.SALE_ORDER_STATUS = 2 then '提交'
|
|
|
|
+ when ASO.SALE_ORDER_STATUS = 1 then '保存'
|
|
|
|
+ when ASO.SALE_ORDER_STATUS = 0 then '未上报'
|
|
|
|
+ END
|
|
|
|
+ ) "saleOrderStatus",
|
|
|
|
+ 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_WEIGHT_RESULT TWR
|
|
|
|
+ ON
|
|
|
|
+ TWR.SALE_MATERIAL_ID = ASM.SALE_MATERIAL_ID
|
|
|
|
+ and twr.SALE_MATERIAL_ID is not null
|
|
|
|
+ OR ( TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID AND TWR.MATERIAL_ID = RM.MATERIAL_ID and twr.sale_material_id is null )
|
|
|
|
+ LEFT JOIN BMSTRUCK_DETAILS_ORDER BDO
|
|
|
|
+ ON BDO.WEIGHT_TASK_RESULT_ID = TWR.WEIGHT_TASK_RESULT_ID
|
|
|
|
+ LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE actp
|
|
|
|
+ ON actp.PRICE_ID = bdo.PRICE_ID
|
|
|
|
+ WHERE
|
|
|
|
+ ASM.SALE_MATERIAL_ID IS NOT NULL
|
|
|
|
+ and (aso.DELETED = 1 and aso.SALE_ORDER_STATUS = 4 or aso.DELETED != 1 and aso.SALE_ORDER_STATUS between 0 and 4)
|
|
|
|
+ and ASO.SALE_TYPE = 1
|
|
|
|
+ <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>
|
|
|
|
+ <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="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=")">
|
|
|
|
+ <if test="item == null">
|
|
|
|
+ RCA.CAPACITY_NUMBER is null
|
|
|
|
+ </if>
|
|
|
|
+ <if test="item != null">
|
|
|
|
+ RCA.CAPACITY_NUMBER like '%${item}%'
|
|
|
|
+ </if>
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleAreaRemark != null">
|
|
|
|
+ and <foreach collection="saleAreaRemark" item="item" open="(" separator="or" close=")">
|
|
|
|
+ ASO.sale_remark 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">
|
|
|
|
+ (CASE WHEN ASO.SALE_ORDER_ISSELF_MENTION = '是'
|
|
|
|
+ THEN '自提'
|
|
|
|
+ ELSE R_CARRIER.CARRIER_ABBREVIATION
|
|
|
|
+ END) 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="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>
|
|
|
|
+ <if test="saleOrderStatusList != null">
|
|
|
|
+ and <foreach collection="saleOrderStatusList" item="item" open="(" separator="or" close=")">
|
|
|
|
+ (CASE WHEN
|
|
|
|
+ ASO.DELETED = 2 then '关闭'
|
|
|
|
+ when ASO.DELETED = 1 then '反审批'
|
|
|
|
+ when ASO.SALE_ORDER_STATUS = 4 then '审核'
|
|
|
|
+ when ASO.SALE_ORDER_STATUS = 2 then '提交'
|
|
|
|
+ when ASO.SALE_ORDER_STATUS = 1 then '保存'
|
|
|
|
+ when ASO.SALE_ORDER_STATUS = 0 then '未上报'
|
|
|
|
+ END
|
|
|
|
+ ) like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="saleRemarkList != null">
|
|
|
|
+ and <foreach collection="saleRemarkList" item="item" open="(" separator="or" close=")">
|
|
|
|
+ ASO.sale_remark like '%${item}%'
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="consigneeLoginName != null">
|
|
|
|
+ and RC.CONSIGNEE_COMPANY_NAME LIKE '%${consigneeLoginName}%'
|
|
|
|
+ </if>
|
|
|
|
+ order by ASO.SALE_ORDER_ID DESC, ASOM.SALE_ORDER_MATERIAL_ID DESC,OO.ORDER_ID DESC
|
|
|
|
+ )
|
|
|
|
+ </select>
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|