From 47b2e621c2a5ea58cee946c36a3307f6fe8e6982 Mon Sep 17 00:00:00 2001
From: 李金换 <lijinhuan@prec-tech.com>
Date: 星期三, 23 三月 2022 18:22:58 +0800
Subject: [PATCH] 【委托】金华众智-ET耗材无法入库问题解决

---
 force-app/main/default/classes/ArriveGoodsController.cls |  193 ++++++++++++++++++++++++++++++++---------------
 1 files changed, 131 insertions(+), 62 deletions(-)

diff --git a/force-app/main/default/classes/ArriveGoodsController.cls b/force-app/main/default/classes/ArriveGoodsController.cls
index 6289fe7..8c90505 100644
--- a/force-app/main/default/classes/ArriveGoodsController.cls
+++ b/force-app/main/default/classes/ArriveGoodsController.cls
@@ -15,7 +15,7 @@
     public List<Consumable_order_details2__c> consumableorderdetails2Insert= new List<Consumable_order_details2__c>();
     public List<Consumable_order_details2__c> consumableorderdetails2Nobox= new List<Consumable_order_details2__c>();
     public List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
-    public List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
+    public transient List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
     public List<ConsumableorderdetailsInfo> ShowGoodsofReturnList{get;set;}
     public List<ConsumableorderdetailsInfo> ShowGoodsofRemoveBoxReturnList{get;set;}
     //add by rentx 20210602 CHAN-C3K4ZQ
@@ -34,15 +34,16 @@
         return ConsumableorderdetailsRecordserror.size();
     }
     Set<String> noboxBarcodeList = new Set<String>();
-    Map<String, String> ExistIdMap = new Map<String, String>();
-    Map<String, String> ErrorIdMap = new Map<String, String>();
-    Map<String, String> AllMap = new Map<String, String>();
+    public transient Map<String, String> ExistIdMap = new Map<String, String>();
+    public transient Map<String, String> ErrorIdMap = new Map<String, String>();
+    public transient Map<String, String> AllMap = new Map<String, String>();
     Map<String, String> otherAgencyMap = new Map<String, String>();
-    Map<String, String> barMcodeMap = new Map<String, String>();
+    public transient Map<String, String> barMcodeMap = new Map<String, String>();
     Map<String, Integer> BarcodeCntMap = new Map<String, Integer>();
-    public List<String> BarCodeListP = new List<String>();
+    //qi
+    public transient List<String> BarCodeListP = new List<String>();
 
-    Map<String, String> OrderAllMap = new Map<String, String>();
+    // public transient Map<String, String> OrderAllMap = new Map<String, String>();
     Map<String, Decimal> orderProductCunMap = new Map<String, Decimal>();
     Map<String, Decimal> orderProductArrivedCunMap = new Map<String, Decimal>();
     Map<String, Decimal> orderWantArriveCunMap = new Map<String, Decimal>();
@@ -65,7 +66,7 @@
     list<String> exitBarCodeList = new list<String>();
 
 
-    Map<String, Consumable_order_details2__c> reallMap = new Map<String, Consumable_order_details2__c>();
+    // Map<String, Consumable_order_details2__c> reallMap = new Map<String, Consumable_order_details2__c>();
     Map<String,String> HosErrorMap = new Map<String,String>();
     List<String> HosErrorList = new List<String>();
     public String baseUrl {get;private set;}
@@ -108,36 +109,65 @@
         //add by rentx 20210602 CHAN-C3K4ZQ start 
         consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
         //add by rentx 20210602 CHAN-C3K4ZQ end 
+        // OrderAllMap = new Map<String, String>();
     }
 
-    //add by rentx 20210602 CHAN-C3K4ZQ start 鍑洪敊鐨勫師鍥犳槸椤甸潰鏈�澶氬睍绀�1000鏉℃暟鎹�,浣嗘槸闇�瑕佸睍绀虹殑鏁版嵁瓒呰繃浜�1000鏉�,鐜板湪鎶婂睍绀轰笂绾挎敼涓�2000
+    //add by rentx 20210602 CHAN-C3K4ZQ start 鍑洪敊鐨勫師鍥犳槸椤甸潰鏈�澶氬睍绀�1000鏉℃暟鎹�,浣嗘槸闇�瑕佸睍绀虹殑鏁版嵁瓒呰繃浜�1000鏉�,鐜板湪鎶婂睍绀轰笂绾挎敼涓�1000 * 1000
     public void makeRecordsView(List<ConsumableorderdetailsInfo> recordsdummy){
-        //鎷嗗垎鏆傜敤list
-        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
-        List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
-        ConsumableorderdetailsInfo c = null;
-        ConsumableorderdetailsRecordsbreak.clear();
-        ConsumableorderdetailsRecordsbreakover.clear();
-        consumableorderdetailsRecordsview.clear();
+        consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
 
         if(recordsdummy.size() > 1000){
-            for(Integer i = 0; i < recordsdummy.size(); i++){
-                if(i < 1000){
-                    c = recordsdummy.get(i);
-                    ConsumableorderdetailsRecordsbreak.add(c);
-                }else{
-                    c = recordsdummy.get(i);
-                    ConsumableorderdetailsRecordsbreakover.add(c);
+            List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
+            List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
+            ConsumableorderdetailsInfo c = null;
+            ConsumableorderdetailsRecordsbreak.clear();
+            ConsumableorderdetailsRecordsbreakover.clear();
+            consumableorderdetailsRecordsview.clear();
+            //閫夋嫨浜у搧view
+            ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
+            ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
+            if(recordsdummy.size() > 1000){
+                for(Integer i = 0; i < recordsdummy.size(); i++){
+                    if(i < 1000){
+                        c = recordsdummy.get(i);
+                        ConsumableorderdetailsRecordsbreak.add(c);
+                    }else{
+                        c = recordsdummy.get(i);
+                        ConsumableorderdetailsRecordsbreakover.add(c);
+                    }
                 }
+                consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak);
+                consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover);
+            }else{
+                consumableorderdetailsRecordsview.add(recordsdummy);
             }
-            consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak);
-            consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover);
+
+            // Integer count = recordsdummy.size() / 1000;
+            // Integer last = recordsdummy.size() - (1000*count);
+
+            // for(Integer i = 0; i < count ; i++){
+            //     List<ConsumableorderdetailsInfo> tempList = new List<ConsumableorderdetailsInfo>();
+            //     for(Integer j=0; j < 1000; j++){
+            //         tempList.add(recordsdummy.get(i * count + j ));
+            //         // itemList.add(resList.get(i*count+j));
+            //     }
+            //     consumableorderdetailsRecordsview.add(tempList);
+            // }
+            // if (last > 0) {
+            //     List<ConsumableorderdetailsInfo> tempList = new List<ConsumableorderdetailsInfo>();
+            //     for(Integer j=0; j < last; j++){
+            //         tempList.add(recordsdummy.get(count * 1000 + j ));
+            //         // itemList.add(resList.get(i*count+j));
+            //     }
+            //     consumableorderdetailsRecordsview.add(tempList);
+            // }
         }else{
             consumableorderdetailsRecordsview.add(recordsdummy);
         }
     }
     //add by rentx 20210602 CHAN-C3K4ZQ end
     public void init() {
+        // String userId = '00510000007cthP';
         String userId = UserInfo.getUserId();
         List<user> Useracc = New List<user>();
         Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId];
@@ -235,14 +265,16 @@
                         AND Dealer_Arrive__c = true
                         AND Box_Piece__c != '涓�' ];
             for (Integer i = 0; i < reSet1.size(); i++) {
-                OrderAllMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
-                ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet1[i]));
+                // OrderAllMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                //init鐨勬椂鍊欎笉灞曠ず宸茬粡鍏ュ簱鐨勬槑缁� by rentx 20210617 CHAN-C3K4ZQ
+                // ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet1[i]));
+                //update by rentx 20210617 end CHAN-C3K4ZQ
                 if(orderProductArrivedCunMap.containsKey(reSet1[i].Asset_Model_No__c)){
                    orderProductArrivedCunMap.put(reSet1[i].Asset_Model_No__c,orderProductArrivedCunMap.get(reSet1[i].Asset_Model_No__c)+1);
                 }
             }
             //add by rentx 20210602 start CHAN-C3K4ZQ
-            makeRecordsView(ConsumableorderdetailsRecordsdummy);
+            // makeRecordsView(ConsumableorderdetailsRecordsdummy);
             //add by rentx 20210602 end CHAN-C3K4ZQ
         }
     }
@@ -264,7 +296,7 @@
                barMcodeMap.put(B,tracingCode);
             }
             outPut.add(B);
-        }
+        }system.debug('barMcodeMap绛変簬'+barMcodeMap);
         return outPut;
     }
 
@@ -287,12 +319,15 @@
         noboxBarcodeList.clear();
         //鍐嶆绱㈤」鐩竻绌�
         ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+        ErrorIdMap = new Map<String, String>();
         ErrorIdMap.clear();
+        AllMap = new Map<String, String>();
         AllMap.clear();
+        ExistIdMap = new Map<String, String>();
         ExistIdMap.clear();
         consumableorderdetails2Insert = new List<Consumable_order_details2__c>();
         ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
-        if(EsetId != null && EsetId != ''){
+        /*if(EsetId != null && EsetId != ''){
             List<Consumable_order_details2__c> reSet1 = [SELECT Id,
                             Name,
                             Intra_Trade_List_RMB__c,
@@ -316,10 +351,7 @@
                             Report_Product_Approbation__c,
                             Report_Product_Expiration__c
                             //add by rentx 2020-10-14 start
-                           ,ContractNo_text__c/*,ContractNo__c1*/
-                           // tcm start
-                           ,Consumable_order_minor__r.ContractNo__c
-                           // tcm end
+                            ,ContractNo_text__c,/*ContractNo__c1*
                             //add by rentx 2020-10-14 end
                             ,hospitalSpecialOffer__c
                         FROM Consumable_order_details2__c
@@ -328,19 +360,22 @@
                         AND Arrive_Owner_Work_Location__c =: userWorkLocation
                         AND Dealer_Arrive__c = true ];
             for (Integer i = 0; i < reSet1.size(); i++) {
-                OrderAllMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                // OrderAllMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
                 //add by rentx 2021-01-27
-                reallMap.put(reSet1[i].Bar_Code__C, reSet1[i]);
+                // reallMap.put(reSet1[i].Bar_Code__C, reSet1[i]);
                 //add by rentx 2021-01-27
 
-                ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet1[i]));
+                //涓嶉渶瑕佸睍绀哄凡鍒拌揣鐨勬槑缁� update by rentx 20210617 start CHAN-C3K4ZQ
+                // ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet1[i]));
+                //涓嶉渶瑕佸睍绀哄凡鍒拌揣鐨勬槑缁� update by rentx 20210617 end CHAN-C3K4ZQ
+
                 //if(orderProductArrivedCunMap.containsKey(reSet1[i].Asset_Model_No__c)){
                 //   orderProductArrivedCunMap.put(reSet1[i].Asset_Model_No__c,orderProductArrivedCunMap.get(reSet1[i].Asset_Model_No__c)+1);
                 //}
             }
-        }
+        }*/
         ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
-
+        BarCodeListP = new List<String>();
         BarCodeListP = ParseBarCode(barcode);
         Consumable_order_details2__c p = new Consumable_order_details2__c();
         List<Consumable_order_details2__c> Ins = New List<Consumable_order_details2__c>();
@@ -351,7 +386,7 @@
             return;
         }
         //瀵规瘮鍏ㄩ儴搴撳瓨涓槸鍚﹀瓨鍦ㄧ鐞嗙紪鐮佷竴鏍凤紝barcode鍙蜂笉涓�鏍风殑浜у搧
-        reSet1 = [SELECT Id,  Name,TracingCode__c,Bar_Code__c
+        reSet1 = [SELECT Id,  Name,TracingCode__c,Bar_Code__c,Report_Product_Expiration__c 
                     FROM Consumable_order_details2__c
                     WHERE Dealer_Arrive__c = true
                     AND Dealer_Shipment__c = false
@@ -385,7 +420,7 @@
                         Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                         Deliver_date__c,Bar_Code__c,Box_Piece__c,
                         Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                        TracingCode__c
+                        TracingCode__c,Report_Product_Expiration__c 
                     FROM Consumable_order_details2__c
                     WHERE Bar_Code__c in :BarCodeListP
                     AND Dealer_Info_text__c = :accountName
@@ -451,7 +486,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,OwnerId
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,OwnerId,Report_Product_Expiration__c 
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Saled__c = true
                             AND  Dealer_Returned__c = false
@@ -483,7 +518,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Shipment__c = true
                             AND  Dealer_Returned__c = false
@@ -508,7 +543,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Lose_Flag__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c 
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Arrive__c = true
                             AND  Dealer_Returned__c = false
@@ -537,7 +572,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c 
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Arrive__c = true
                             AND  Bar_Code__c in :BarCodeListP
@@ -583,6 +618,7 @@
                                 //add by rentx 2021-03-22 start
                                 ,hospitalSpecialOffer__c
                                 ,exchangeOutPattern__c 
+                                ,Report_Product_Expiration__c
                                 //add by rentx 2021-03-22 end
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Arrive__c = TRUE
@@ -661,8 +697,9 @@
                                 //add by rentx 2020-10-13 end
 
                                 //add by rentx 2021-03-22 start
-                                if (reSet1[i].Lose_Flag__c == true){
-                                    codsIns.exchangeOutPattern__c = reSet1[i].hospitalSpecialOffer__c;
+                                // if (reSet1[i].Lose_Flag__c == true){
+                                if (reSet1[i].hospitalSpecialOffer__c == true && reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣'){
+                                    codsIns.exchangeOutPattern__c = true;
                                 }
                                 //add by rentx 2021-03-22 end
 
@@ -698,7 +735,7 @@
                                 //add by rentx 2020-10-13 end   浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
                                 ,hospitalSpecialOffer__c
                                 ,exchangeOutPattern__c
-                                ,Lose_Flag__c
+                                ,Lose_Flag__c,Report_Product_Expiration__c 
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Arrive__c = FALSE
                             AND  Dealer_Shipment__c= FALSE
@@ -778,8 +815,9 @@
                                 //add by rentx 2020-10-13 end   浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
 
                                 //add by rentx 2021-03-22 start
-                                if (reSet1[i].Lose_Flag__c == true){
-                                    codsIns.exchangeOutPattern__c = reSet1[i].hospitalSpecialOffer__c;
+                                // if (reSet1[i].Lose_Flag__c == true){
+                                if (reSet1[i].hospitalSpecialOffer__c == true && reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣'){
+                                    codsIns.exchangeOutPattern__c = true;
                                 }
                                 //add by rentx 2021-03-22 end
 
@@ -839,6 +877,7 @@
                             // tcm start
                             ,Consumable_order_minor__r.ContractNo__c
                             // tcm end
+                            ,Report_Product_Expiration__c 
                             //add by rentx 2020-10-14 end
                         FROM Consumable_order_details2__c
                         WHERE Dealer_Arrive__c = FALSE 
@@ -870,6 +909,7 @@
                                 // tcm start
                                 ,Consumable_order_minor__r.ContractNo__c
                                 // tcm end
+                                , Report_Product_Expiration__c
                                 //add by rentx 2020-10-14 end
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Arrive__c = true
@@ -1075,8 +1115,14 @@
                         }
                         ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
                         for(String str : barMcodeMap.keySet()){
+                            // BarCode涓嶄竴鑷存椂鐨勮鍛婁俊鎭�
+                            if(reSet[i].Bar_Code__c != str){
+                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'姝ょ鐞嗙紪鐮佸凡鍏ュ簱涓擝arCode涓嶄竴鑷达紝璇锋牳瀵圭鐞嗙紪鐮�('+ str +')鐨勫叆搴撳強搴撳瓨鏁版嵁銆�'));
+                            }
                             if(barMcodeMap.get(str) == reSet[i].TracingCode__c){
                                 reSet[i].Bar_Code__c = str;
+                                //=====================================
+                                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'鍏ュ簱BarCode('+ str +')鍜屽簱瀛樻潯鐮佷笉涓�鑷淬��'));
                                 ExistIdMap.put(str,str);
                             }
                         }
@@ -1088,7 +1134,7 @@
 
 
             // CHAN-BD43NK 鍏抽棴鐩存帴杩斿搧鍔熻兘  杩藉姞 barcode涓嶄竴鑷村垽鏂�
-            reSet1 = [SELECT Id,Name,TracingCode__c,Bar_Code__c,Sale_orderName__c
+            reSet1 = [SELECT Id,Name,TracingCode__c,Bar_Code__c,Sale_orderName__c,Report_Product_Expiration__c 
                         FROM Consumable_order_details2__c
                         WHERE Dealer_Arrive__c = true
                         AND (Dealer_Shipment__c = true
@@ -1170,7 +1216,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c 
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Arrive__c = FALSE 
                             AND  Dealer_Shipment__c= FALSE
@@ -1197,7 +1243,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c 
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Saled__c = true
                             AND  Dealer_Returned__c =false
@@ -1222,7 +1268,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c 
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Shipment__c = true
                             AND   Dealer_Returned__c =false
@@ -1247,7 +1293,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Lose_Flag__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c
                             FROM Consumable_order_details2__c
                             WHERE Dealer_Arrive__c = true
                             AND   Dealer_Returned__c =false
@@ -1275,7 +1321,7 @@
                                 Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
                                 Deliver_date__c,Bar_Code__c,Box_Piece__c,
                                 Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c
+                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,Report_Product_Expiration__c 
                             FROM Consumable_order_details2__c
                             WHERE Consumable_order_minor__c != :ESetId
                             AND  Bar_Code__c in :BarCodeListP
@@ -2669,11 +2715,15 @@
 
     //鍒拌揣纭
     public PageReference ArriveGoodsConfim() {
+        //add by rentx 20210618 start CHAN-C3K4ZQ 璺宠繃涓嶅繀瑕佺殑鏌ヨ
+        StaticParameter.ConsumableOrderTrigger = true;
+        //add by rentx 20210618 end CHAN-C3K4ZQ 璺宠繃涓嶅繀瑕佺殑鏌ヨ
         cancellationProList = new List<String>();
         List<Consumable_order_details2__c> ins = New List<Consumable_order_details2__c>();
         String resultcheck = '';
         List<String> resultcheckWithoutOrder = new List<String>();
         Savepoint sp = Database.setSavepoint();
+
         if(ConsumableorderdetailsRecords.size()<1 && consumableInventory.size()<1){
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄥ埌璐ф槑缁�'));
             return null;
@@ -2784,7 +2834,7 @@
                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
                 arriveAmount += insAfterDel.Intra_Trade_List_RMB__c;
                 //add by rentx 2020-10-14 strat
-                // insAfterDel.ContractNo_text__c      = /*ass.esd.ContractNo__c*/;
+                //insAfterDel.ContractNo_text__c      = /*ass.esd.ContractNo__c*/;
                 // tcm start
                 if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
                     insAfterDel.ContractNo_text__c= ass.esd.ContractNo_text__c;
@@ -3016,6 +3066,7 @@
                             ,Consumable_order_minor__r.ContractNo__c
                             // tcm end
                             //add by rentx 2020-10-14 end
+                            ,Report_Product_Expiration__c 
                     FROM    Consumable_order_details2__c
                     WHERE   ((Dealer_Arrive__c = true
                             AND(  Dealer_Shipment__c = true
@@ -3124,6 +3175,7 @@
                              // tcm start
                              ,Consumable_order_minor__r.ContractNo__c
                              // tcm end
+                            ,Report_Product_Expiration__c
                             //add by rentx 2020-10-13 end
                     FROM    Consumable_order_details2__c
                     WHERE
@@ -3520,11 +3572,11 @@
                     //add by rentx 2020-10-14 start
                     // retorddetail.ContractNo_text__c         = /*ass.esd.ContractNo__c*/;
                     // tcm start
-                    // if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
-                    //     retorddetail.ContractNo_text__c= ass.esd.ContractNo_text__c;
-                    // }else {
+                     if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
+                        retorddetail.ContractNo_text__c= ass.esd.ContractNo_text__c;
+                     }else {
                         retorddetail.ContractNo_text__c= ass.esd.Consumable_order_minor__r.ContractNo__c;
-                    // }
+                     }
                     // tcm end
                     //add by rentx 2020-10-14 end
 
@@ -3618,7 +3670,10 @@
             }
         }catch(Exception e){
             //Database.rollback(sp);
-            ApexPages.addMessages(e);
+            throw new ControllerUtil.myException('e::'+e + '  linenumber::'+e.getLineNumber());
+            // ApexPages.addMessages(e);
+            // ApexPages.addMessages(e.getLineNumber() + '  11111111111111111');
+
             //return null;
         }
     }
@@ -3661,12 +3716,18 @@
         public Integer intMark { get; set; }
         public Decimal arriveAmount { get; set; }
         public Decimal arrivedCount { get; set; }
+
+        public String ReportProductExpirationDate {get;set;}
         public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
             esd                = e;
             Prod               = e.Consumable_Product__r;
             oldConsumableCount = e.name;
             ErrorReason        = str;
             intMark = 1;
+            if (e.Report_Product_Expiration__c != null) {
+                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();  
+            }
+
         }
         public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
             canEdit = false;
@@ -3678,6 +3739,10 @@
             esd                = e;
             Prod               = e.Consumable_Product__r;
             oldConsumableCount = e.name;
+            if (e.Report_Product_Expiration__c != null) {
+                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();  
+            }
+
         }
 
         public ConsumableorderdetailsInfo(Product2__c e,List<String> barinfoL) {
@@ -3702,6 +3767,10 @@
             }
             serialNoorLotNo = barinfoL[2];
             tracingCodeNo = barinfoL[3];
+            if (e.Report_Product_Expiration__c != null) {
+                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();  
+            }
+
         }
         public ConsumableorderdetailsInfo(Product2__c e) {
             Prod = e;

--
Gitblit v1.9.1