|
@@ -2336,7 +2336,11 @@
|
|
|
END) "materialAcWeight",
|
|
|
ASM.EAS_PRIMARY_ID "closeEntryId",
|
|
|
ASM.DELETED "deletedStatus",
|
|
|
- RC.CONSIGNEE_COMPANY_NAME "consigneeName",
|
|
|
+ (CASE
|
|
|
+ WHEN RC2.CONSIGNEE_COMPANY_NAME IS NOT NULL
|
|
|
+ THEN RC2.CONSIGNEE_COMPANY_NAME
|
|
|
+ ELSE RC.CONSIGNEE_COMPANY_NAME
|
|
|
+ END) "consigneeName",
|
|
|
ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
|
|
|
RS.SHIPPER_NAME "shipperName",
|
|
|
RCA.CAPACITY_NUMBER "capacityNo",
|
|
@@ -2415,6 +2419,7 @@
|
|
|
BDO.PRICEIDS "priceIds",
|
|
|
BDO.REMARK "detailsRemark",
|
|
|
BDO.PHOTO "photo",
|
|
|
+ BDO.DETAILS_ID "detailsId",
|
|
|
--理重
|
|
|
ASM.MATERIAL_WEIGHT "materialWeight",
|
|
|
--收款客户
|
|
@@ -2488,20 +2493,29 @@
|
|
|
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 RMS_CONSIGNEE RC2
|
|
|
+ ON RC2.CONSIGNEE_ID = BDO.CONSIGNEE_ID
|
|
|
WHERE ASO.SALE_TYPE = 1
|
|
|
and (aso.DELETED between 1 and 2 and aso.SALE_ORDER_STATUS = 4 or aso.DELETED = 0 and aso.SALE_ORDER_STATUS between 0 and 4)
|
|
|
and ASM.SALE_MATERIAL_ID IS NOT NULL
|
|
|
and (BDO.WETHER_TO_STATEMENT IS NULL or BDO.WETHER_TO_STATEMENT != 1)
|
|
|
- <if test="oneDate != null">
|
|
|
+ <if test="oneDate != null and saleMakeDate == 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">
|
|
|
and R_CARRIER.CARRIER_SSO_ID = #{carrierSsoId}
|
|
|
</if>
|
|
|
- <if test="startDate != null">
|
|
|
+ <if test="startDate != null and saleMakeDate == 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="oneDate != null and saleMakeDate != null">
|
|
|
+ and to_date(#{oneDate}, 'yyyy-mm-dd') = to_date(to_char(ASM.SALE_MAKE_DATE,'yyyy-mm-dd'),'yyyy-mm-dd')
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and saleMakeDate != null">
|
|
|
+ and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= ASM.SALE_MAKE_DATE
|
|
|
+ and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASM.SALE_MAKE_DATE
|
|
|
+ </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
|
|
|
|| (CASE WHEN RRA_HISTORY.ADDRESS_PROVINCE is not null
|
|
@@ -2658,7 +2672,11 @@
|
|
|
END) "materialAcWeight",
|
|
|
ASM.EAS_PRIMARY_ID "closeEntryId",
|
|
|
ASM.DELETED "deletedStatus",
|
|
|
- RC.CONSIGNEE_COMPANY_NAME "consigneeName",
|
|
|
+ (CASE
|
|
|
+ WHEN RC2.CONSIGNEE_COMPANY_NAME IS NOT NULL
|
|
|
+ THEN RC2.CONSIGNEE_COMPANY_NAME
|
|
|
+ ELSE RC.CONSIGNEE_COMPANY_NAME
|
|
|
+ END) "consigneeName",
|
|
|
ASOM.SALE_ORDER_MATERIAL_ID "saleOrderMaterialId",
|
|
|
RS.SHIPPER_NAME "shipperName",
|
|
|
RCA.CAPACITY_NUMBER "capacityNo",
|
|
@@ -2810,21 +2828,30 @@
|
|
|
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 RMS_CONSIGNEE RC2
|
|
|
+ ON RC2.CONSIGNEE_ID = BDO.CONSIGNEE_ID
|
|
|
WHERE ASO.SALE_TYPE = 1
|
|
|
and (aso.DELETED between 1 and 2 and aso.SALE_ORDER_STATUS = 4 or aso.DELETED = 0 and aso.SALE_ORDER_STATUS between 0 and 4)
|
|
|
and ASM.SALE_MATERIAL_ID IS NOT NULL
|
|
|
and BDO.WETHER_TO_STATEMENT = 1
|
|
|
and BDO.STATEMENT_ID IS NULL
|
|
|
- <if test="oneDate != null">
|
|
|
+ <if test="oneDate != null and saleMakeDate == 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">
|
|
|
and R_CARRIER.CARRIER_SSO_ID = #{carrierSsoId}
|
|
|
</if>
|
|
|
- <if test="startDate != null">
|
|
|
+ <if test="startDate != null and saleMakeDate == 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="oneDate != null and saleMakeDate != null">
|
|
|
+ and to_date(#{oneDate}, 'yyyy-mm-dd') = to_date(to_char(ASM.SALE_MAKE_DATE,'yyyy-mm-dd'),'yyyy-mm-dd')
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and saleMakeDate != null">
|
|
|
+ and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') <= ASM.SALE_MAKE_DATE
|
|
|
+ and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ASM.SALE_MAKE_DATE
|
|
|
+ </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
|
|
|
|| (CASE WHEN RRA_HISTORY.ADDRESS_PROVINCE is not null
|