luobang 1 rok pred
rodič
commit
db9ae35edf

+ 36 - 7
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -2437,12 +2437,17 @@
         ASO.SALE_ORDER_STATUS "saleOrderStatus",
         ASM.SALE_MATERIAL_ID "saleMaterialId",
         CASE
+            WHEN bdo.CONSIGNEE_ID is null and bdo.PRICE_VALUE is null and bdo.REMARK is not null
+            then null
             WHEN nvl(TWR.RESULT_GROSS_WEIGHT,0) =0
             then null
             when nvl(TWR.RESULT_GROSS_WEIGHT,0) !=0
             then ASM.MATERIAL_NUMBER
             end "materialNum",
-        (CASE WHEN
+        (CASE
+            WHEN bdo.CONSIGNEE_ID is null and bdo.PRICE_VALUE is null and bdo.REMARK is not null
+            then null
+            WHEN
             ASM.SALE_MAKE_DATE IS NULL
             THEN null
             WHEN  ASM.IS_POUND_SALE = 0
@@ -2513,7 +2518,13 @@
         TWR.RESULT_GROSS_WEIGHT_TIME "grossWeightTime",
         TWR.RESULT_TARE_WEIGHT       "tareWeight",
         TWR.RESULT_TARE_WEIGHT_TIME  "tareWeightTime",
-        TWR.RESULT_NET_WEIGHT        "netWeight",
+        (CASE WHEN
+        bdo.CONSIGNEE_ID is null and bdo.PRICE_VALUE is null and bdo.REMARK is not null
+        then null
+        ELSE
+        TWR.RESULT_NET_WEIGHT
+        END)
+               "netWeight",
         TLFR.RESULT_OUT_GATE_TIME    "outGateTime",
         TER.RESULT_ENTRY_GATE_TIME   "entryGateTime",
         TAR.RESULT_ARRIVAL_ADDRESS "arrivalAddress",
@@ -2614,7 +2625,7 @@
         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)
+        and NVL(BDO.WETHER_TO_STATEMENT,0) = 0
         <if test="oneDate != null and saleMakeDate == null">
             and to_date(#{oneDate}, 'yyyy-mm-dd') &lt; = to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
         </if>
@@ -2771,14 +2782,20 @@
         to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd') "orderTime",
         ASO.SALE_NUMBER "saleOrderNo",
         ASO.SALE_ORDER_STATUS "saleOrderStatus",
+        BDO.DETAILS_ID  "detailsId",
         ASM.SALE_MATERIAL_ID "saleMaterialId",
         CASE
+        WHEN bdo.CONSIGNEE_ID is null and bdo.PRICE_VALUE is null and bdo.REMARK is not null
+        then null
         WHEN nvl(TWR.RESULT_GROSS_WEIGHT,0) =0
         then null
         when nvl(TWR.RESULT_GROSS_WEIGHT,0) !=0
         then ASM.MATERIAL_NUMBER
         end "materialNum",
-        (CASE WHEN
+        (CASE
+        WHEN bdo.CONSIGNEE_ID is null and bdo.PRICE_VALUE is null and bdo.REMARK is not null
+        then null
+        WHEN
         ASM.SALE_MAKE_DATE IS NULL
         THEN null
         WHEN  ASM.IS_POUND_SALE = 0
@@ -2849,7 +2866,13 @@
         TWR.RESULT_GROSS_WEIGHT_TIME "grossWeightTime",
         TWR.RESULT_TARE_WEIGHT       "tareWeight",
         TWR.RESULT_TARE_WEIGHT_TIME  "tareWeightTime",
-        TWR.RESULT_NET_WEIGHT        "netWeight",
+        (CASE WHEN
+         bdo.CONSIGNEE_ID is null and bdo.PRICE_VALUE is null and bdo.REMARK is not null
+        then null
+            ELSE
+        TWR.RESULT_NET_WEIGHT
+            END)
+                "netWeight",
         TLFR.RESULT_OUT_GATE_TIME    "outGateTime",
         TER.RESULT_ENTRY_GATE_TIME   "entryGateTime",
         TAR.RESULT_ARRIVAL_ADDRESS "arrivalAddress",
@@ -2886,7 +2909,12 @@
         --制单时间
         to_char(ASM.SALE_MAKE_DATE,'yyyy-fmmm-dd HH24:mi') "saleMakeDate",
         --操作人
-        OO.RECORD_USERNAME "recordUserName"
+        OO.RECORD_USERNAME "recordUserName",
+        (CASE WHEN
+            BDO.STATEMENT_ID IS NULL
+            THEN '未生成账单'
+            ELSE '已生成账单,账单编号' || BS.STATEMENT_NUMBER
+            END) "statementRemark"
         FROM AMS_SALE_ORDER ASO
         LEFT JOIN RMS_CONSIGNEE RC
         ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
@@ -2946,11 +2974,12 @@
         ON TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
         LEFT JOIN RMS_CONSIGNEE RC2
         ON RC2.CONSIGNEE_ID = BDO.CONSIGNEE_ID
+        left join BMSTRUCK_STATEMENT BS
+        ON BS.STATEMENT_ID = BDO.STATEMENT_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  and saleMakeDate == null">
             and to_date(#{oneDate}, 'yyyy-mm-dd') &lt; = to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd'),'yyyy-mm-dd')
         </if>