From d4a4ce824f3b2f3a335a3ad8e8c9efb3b37d630f Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期四, 04 五月 2023 08:59:14 +0800
Subject: [PATCH] backup

---
 force-app/main/default/classes/LexSummonsCreatController.cls                          | 1408 ++-
 force-app/main/default/classes/LogAutoSendBatch.cls                                   |  322 
 force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js                         | 2550 ++++---
 force-app/main/default/lwc/paginatedList/paginatedList.html                           |   12 
 force-app/main/default/classes/OCSMHandler.cls                                        |   28 
 force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html     |    7 
 force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js |   40 
 force-app/main/default/classes/DNUpsertBatchTest.cls                                  |    8 
 force-app/main/default/classes/DNUpsertBatch.cls                                      | 1080 +-
 force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html                       | 1248 ++
 force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html         |    7 
 force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html      |    8 
 force-app/main/default/classes/ArriveGoodsController.cls                              | 4927 ++++++++------
 force-app/main/default/lwc/paginatedList/paginatedList.js                             |   52 
 force-app/main/default/classes/LexArriveGoodsController.cls                           |  389 +
 force-app/main/default/classes/updateESignBatchTest.cls                               | 3192 +++++----
 force-app/main/default/classes/InventoryViewController.cls                            |  769 +-
 force-app/main/default/classes/LexArriveGoodsController.cls-meta.xml                  |    5 
 manifest/packageForSign.xml                                                           |    3 
 force-app/main/default/classes/updateESignBatch.cls                                   | 1285 +--
 force-app/main/default/classes/CPL003Rest.cls                                         |   95 
 force-app/main/default/pages/summonsCreat.page                                        | 2468 ++++--
 22 files changed, 11,757 insertions(+), 8,146 deletions(-)

diff --git a/force-app/main/default/classes/ArriveGoodsController.cls b/force-app/main/default/classes/ArriveGoodsController.cls
index d9c445a..6ed3c54 100644
--- a/force-app/main/default/classes/ArriveGoodsController.cls
+++ b/force-app/main/default/classes/ArriveGoodsController.cls
@@ -10,14 +10,14 @@
     //鏇存柊鏄庣粏鍙栨秷鏃堕棿
     public List<Consumable_order_details2__c> consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
     // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-    Map<String,Consumable_order_details2__c> orderdetails2trMap = new Map<String,Consumable_order_details2__c>();
+    Map<String, Consumable_order_details2__c> orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
     // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-    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<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 transient List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
-    public List<ConsumableorderdetailsInfo> ShowGoodsofReturnList{get;set;}
-    public List<ConsumableorderdetailsInfo> ShowGoodsofRemoveBoxReturnList{get;set;}
+    public List<ConsumableorderdetailsInfo> ShowGoodsofReturnList { get; set; }
+    public List<ConsumableorderdetailsInfo> ShowGoodsofRemoveBoxReturnList { get; set; }
     //add by rentx 20210602 CHAN-C3K4ZQ
     public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }
     //add by rentx 20210602 CHAN-C3K4ZQ
@@ -26,11 +26,11 @@
     //瓒呭嚭瀹氳揣鏁伴噺鐨勪骇鍝�
     public List<String> cancellationProList = new List<String>();
     //閿欒淇℃伅
-    public String alertMessage {set;get;}
-    public integer getinventorysize(){
+    public String alertMessage { get; set; }
+    public integer getinventorysize() {
         return consumableInventory.size();
     }
-    public integer geterrorsize(){
+    public integer geterrorsize() {
         return ConsumableorderdetailsRecordserror.size();
     }
     Set<String> noboxBarcodeList = new Set<String>();
@@ -51,25 +51,24 @@
     Map<String, Decimal> overOrderCunMap = new Map<String, Decimal>();
     //瓒呭嚭BARCODE鍜屽瀷鍙�
     Map<String, List<String>> overOrderBARcodeCunMap = new Map<String, List<String>>();
-    list<String> overOrderBARcodeTTTTTT = new list<String>();
+    list<String> overOrderBARcodeTTTTTT = new List<String>();
 
     //涓嶇鍚堢殑barcode鍜屽瀷鍙�
     Map<String, List<String>> notEqualBARcodeCunMap = new Map<String, List<String>>();
-    list<String> overOrderBARcodeSSSSSS = new list<String>();
-    list<String> productList = new list<String>();
-    list<String> notInlist = new list<String>();
+    list<String> overOrderBARcodeSSSSSS = new List<String>();
+    list<String> productList = new List<String>();
+    list<String> notInlist = new List<String>();
     //涓嶉�夋嫨璁㈠崟鏃朵繚瀛樿鍗旾D銆佷骇鍝佸瀷鍙风敤
     //List<String> orderId = new List<String>();
     //List<String> prodName = new List<String>();
     //搴撳瓨鐧诲綍浣跨敤
-    list<String> notInStorelist = new list<String>();
-    list<String> exitBarCodeList = new list<String>();
-
+    list<String> notInStorelist = new List<String>();
+    list<String> exitBarCodeList = new List<String>();
 
     // Map<String, Consumable_order_details2__c> reallMap = new Map<String, Consumable_order_details2__c>();
-    Map<String,String> HosErrorMap = new Map<String,String>();
+    Map<String, String> HosErrorMap = new Map<String, String>();
     List<String> HosErrorList = new List<String>();
-    public String baseUrl {get;private set;}
+    public String baseUrl { get; private set; }
     public String ESetId { get; set; }
     public String arriveId = '';
     private String accountid = null;
@@ -79,9 +78,9 @@
     public Decimal orderCountNotarrive = 0;
     private id return_Order_id = null;
     private id inventory_Order_id = null;
-    public boolean ReturnFLGbln {get;set;}
-    public boolean saveFLGbln {get;set;}
-    public String ArrType{get;set;}
+    public boolean ReturnFLGbln { get; set; }
+    public boolean saveFLGbln { get; set; }
+    public String ArrType { get; set; }
     // 鐧诲綍鑰呭伐浣滃湴
     private String userWorkLocation;
 
@@ -91,7 +90,7 @@
     public String product_Type = null;
     public Boolean EngFlag = false;
     public Boolean ETFlag = false;
-    public ArriveGoodsController(){
+    public ArriveGoodsController() {
         baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
         ESetId = ApexPages.currentPage().getParameters().get('esetId');
         ArrType = ApexPages.currentPage().getParameters().get('ArrType');
@@ -102,21 +101,21 @@
         consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
         consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
         consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
-        orderdetails2trMap = new Map<String,Consumable_order_details2__c>();
+        orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
         detailsSummary = new List<ConsumableorderdetailsInfo>();
-        saveFLGbln = FALSE;
+        saveFLGbln = false;
         //overOrderBARcodeTTTTTT.add('');
-        //add by rentx 20210602 CHAN-C3K4ZQ start 
+        //add by rentx 20210602 CHAN-C3K4ZQ start
         consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
-        //add by rentx 20210602 CHAN-C3K4ZQ end 
+        //add by rentx 20210602 CHAN-C3K4ZQ end
         // OrderAllMap = new Map<String, String>();
     }
 
     //add by rentx 20210602 CHAN-C3K4ZQ start 鍑洪敊鐨勫師鍥犳槸椤甸潰鏈�澶氬睍绀�1000鏉℃暟鎹�,浣嗘槸闇�瑕佸睍绀虹殑鏁版嵁瓒呰繃浜�1000鏉�,鐜板湪鎶婂睍绀轰笂绾挎敼涓�1000 * 1000
-    public void makeRecordsView(List<ConsumableorderdetailsInfo> recordsdummy){
+    public void makeRecordsView(List<ConsumableorderdetailsInfo> recordsdummy) {
         consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
 
-        if(recordsdummy.size() > 1000){
+        if (recordsdummy.size() > 1000) {
             List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
             List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
             ConsumableorderdetailsInfo c = null;
@@ -126,19 +125,19 @@
             //閫夋嫨浜у搧view
             ConsumableorderdetailsRecordsbreak = new List<ConsumableorderdetailsInfo>();
             ConsumableorderdetailsRecordsbreakover = new List<ConsumableorderdetailsInfo>();
-            if(recordsdummy.size() > 1000){
-                for(Integer i = 0; i < recordsdummy.size(); i++){
-                    if(i < 1000){
+            if (recordsdummy.size() > 1000) {
+                for (Integer i = 0; i < recordsdummy.size(); i++) {
+                    if (i < 1000) {
                         c = recordsdummy.get(i);
                         ConsumableorderdetailsRecordsbreak.add(c);
-                    }else{
+                    } else {
                         c = recordsdummy.get(i);
                         ConsumableorderdetailsRecordsbreakover.add(c);
                     }
                 }
                 consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreak);
                 consumableorderdetailsRecordsview.add(ConsumableorderdetailsRecordsbreakover);
-            }else{
+            } else {
                 consumableorderdetailsRecordsview.add(recordsdummy);
             }
 
@@ -161,7 +160,7 @@
             //     }
             //     consumableorderdetailsRecordsview.add(tempList);
             // }
-        }else{
+        } else {
             consumableorderdetailsRecordsview.add(recordsdummy);
         }
     }
@@ -169,108 +168,128 @@
     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];
+        List<user> Useracc = new List<user>();
+        Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
         accountid = Useracc[0].accountid;
         //--------AddStart-----XHL--------------20181008-------------
         userPro_Type = Useracc[0].UserPro_Type__c;
-        if(String.isBlank(userPro_Type)){
+        if (String.isBlank(userPro_Type)) {
             userPro_Type = 'ET';
         }
 
-        if(userPro_Type == 'ENG'){
+        if (userPro_Type == 'ENG') {
             product_Type = 'ET';
             EngFlag = true;
-        }else{
+        } else {
             product_Type = 'ENG';
             ETFlag = true;
         }
         userPro_Typestr = '%' + userPro_Type + '%';
         //--------AddEnd-----XHL--------------20181008-------------
         userWorkLocation = Useracc[0].Work_Location__c;
-        system.debug('userWorkLocation'+ userWorkLocation);
-        List<account> accountInfo = [SELECT Name FROM account WHERE id =:accountid];
+        system.debug('userWorkLocation' + userWorkLocation);
+        List<account> accountInfo = [SELECT Name FROM account WHERE id = :accountid];
         accountName = accountInfo[0].Name;
-        system.debug('accountName'+ accountName);
+        system.debug('accountName' + accountName);
         coc = new Consumable_order__c();
-        if(ArrType=='ReG'){
+        if (ArrType == 'ReG') {
             ReturnFLGbln = true;
-        }else{
+        } else {
             ReturnFLGbln = false;
         }
-        if(ESetId != '' && ESetId !=null){
-            List<Consumable_order__c> qs = New List<Consumable_order__c>();
-            List<Consumable_order_details2__c> reSet1 = New List<Consumable_order_details2__c>();
-            List<Consumable_Orderdetails__c> reSet = New List<Consumable_Orderdetails__c>();
-            qs = [SELECT Id,Name,Order_status__c,Dealer_Info__c,Deliver_date__c,ReturnGs_Upload_Date__c,
-                        Order_Reason__c,Order_date__c,
-                        Contract_application_decision__c,Order_type__c,Total_num__c,
-                        OrderNumber_arrived__c,Delivery_detail_count__c,OrderNumber_notarrive__c,orderPattern__c 
-                    FROM Consumable_order__c
-                    WHERE Id =:ESetId AND Order_Owner_WorkLocal__c =: userWorkLocation
-                    AND Dealer_Info__c = :accountid];
-            if (qs.size()>0){
+        if (ESetId != '' && ESetId != null) {
+            List<Consumable_order__c> qs = new List<Consumable_order__c>();
+            List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
+            List<Consumable_Orderdetails__c> reSet = new List<Consumable_Orderdetails__c>();
+            qs = [
+                SELECT
+                    Id,
+                    Name,
+                    Order_status__c,
+                    Dealer_Info__c,
+                    Deliver_date__c,
+                    ReturnGs_Upload_Date__c,
+                    Order_Reason__c,
+                    Order_date__c,
+                    Contract_application_decision__c,
+                    Order_type__c,
+                    Total_num__c,
+                    OrderNumber_arrived__c,
+                    Delivery_detail_count__c,
+                    OrderNumber_notarrive__c,
+                    orderPattern__c
+                FROM Consumable_order__c
+                WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Dealer_Info__c = :accountid
+            ];
+            if (qs.size() > 0) {
                 coc = qs[0];
                 orderCountAll = coc.Total_num__c;
                 orderCountNotarrive = coc.OrderNumber_notarrive__c;
             }
             //浜у搧瀹氳揣鏁伴噺
-            reSet = [SELECT Asset_Model_No__c,
-                            Consumable_order__c,
-                            Consumable_count__c
-                        FROM Consumable_Orderdetails__c
-                        WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c =: userWorkLocation];
+            reSet = [
+                SELECT Asset_Model_No__c, Consumable_order__c, Consumable_count__c
+                FROM Consumable_Orderdetails__c
+                WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation
+            ];
             for (Integer i = 0; i < reSet.size(); i++) {
                 productList.add(reSet[i].Asset_Model_No__c);
-                orderProductCunMap.put(reSet[i].Asset_Model_No__c,reSet[i].Consumable_count__c);
-                orderProductArrivedCunMap.put(reSet[i].Asset_Model_No__c,0);
-                orderWantArriveCunMap.put(reSet[i].Asset_Model_No__c,0);
-                overOrderCunMap.put(reSet[i].Asset_Model_No__c,0);
-                overOrderBARcodeCunMap.put(reSet[i].Asset_Model_No__c,overOrderBARcodeTTTTTT);
+                orderProductCunMap.put(reSet[i].Asset_Model_No__c, reSet[i].Consumable_count__c);
+                orderProductArrivedCunMap.put(reSet[i].Asset_Model_No__c, 0);
+                orderWantArriveCunMap.put(reSet[i].Asset_Model_No__c, 0);
+                overOrderCunMap.put(reSet[i].Asset_Model_No__c, 0);
+                overOrderBARcodeCunMap.put(reSet[i].Asset_Model_No__c, overOrderBARcodeTTTTTT);
                 //overOrderCunMap.put(reSet[i].Asset_Model_No__c,0);
             }
             //
-            reSet1 = [SELECT Id,
-                            Name,
-                            Intra_Trade_List_RMB__c,
-                            Asset_Model_No__c,
-                            Consumable_Product__c,
-                            Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,
-                            Sterilization_limit__c,
-                            Deliver_date__c,
-                            Bar_Code__c,
-                            Arrive_date__c,
-                            Send_Date__c,
-                            Consumable_order_minor__r.Name,
-                            Consumable_order_minor__c,
-                            Dealer_Arrive__c,
-                            Guarantee_period_for_products__c,
-                            CFDA_Status__c,
-                            Box_Piece__c,
-                            Rrturn_count__c,
-                            ProductPacking_list_manual__c,
-                            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
-                            //add by rentx 2020-10-14 end
-                        FROM Consumable_order_details2__c
-                        WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
-                        AND Arrive_Owner_Work_Location__c = : userWorkLocation
-                        AND Consumable_order_minor__c = :ESetId
-                        AND Dealer_Arrive__c = true
-                        AND Box_Piece__c != '涓�' ];
+            reSet1 = [
+                SELECT
+                    Id,
+                    Name,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    Consumable_Product__c,
+                    Consumable_Product__r.Name,
+                    Consumable_Product__r.Name__c,
+                    Sterilization_limit__c,
+                    Deliver_date__c,
+                    Bar_Code__c,
+                    Arrive_date__c,
+                    Send_Date__c,
+                    Consumable_order_minor__r.Name,
+                    Consumable_order_minor__c,
+                    Dealer_Arrive__c,
+                    Guarantee_period_for_products__c,
+                    CFDA_Status__c,
+                    Box_Piece__c,
+                    Rrturn_count__c,
+                    ProductPacking_list_manual__c,
+                    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
+                //add by rentx 2020-10-14 end
+                FROM Consumable_order_details2__c
+                WHERE
+                    recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                    AND Consumable_order_minor__c = :ESetId
+                    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);
                 //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);
+                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
@@ -281,39 +300,39 @@
     //========20160311======ADD_Start================================
     // 灏嗛〉闈㈡垨鍙栧緱BarCode鍘绘帀閲嶅鐨勶紝杞崲鎴怢ist
     //========20160311======ADD_Start================================
-    public List<String> ParseBarCode(String Code){
-        String[] Cache = new String[]{};
+    public List<String> ParseBarCode(String Code) {
+        String[] Cache = new List<String>{};
         Cache = Code.split('\n');
-        Set <String> Buff = new Set<String>();
-        for(String A : Cache){
+        Set<String> Buff = new Set<String>();
+        for (String A : Cache) {
             Buff.add(A.toUpperCase());
         }
         List<String> outPut = new List<String>();
-        for(String B :Buff){
+        for (String B : Buff) {
             B = B.trim();
-            if(B.length() > 8){
-               String tracingCode = B.substring(B.length() - 5,B.length());
-               barMcodeMap.put(B,tracingCode);
+            if (B.length() > 8) {
+                String tracingCode = B.substring(B.length() - 5, B.length());
+                barMcodeMap.put(B, tracingCode);
             }
             outPut.add(B);
-        }system.debug('barMcodeMap绛変簬'+barMcodeMap);
+        }
+        system.debug('barMcodeMap绛変簬' + barMcodeMap);
         return outPut;
     }
-
 
     //========20160311======ADD_End==================================
     //鑾峰彇鏄庣粏
     public void SearchPro() {
-        notInlist = new list<String>();
+        notInlist = new List<String>();
         otherAgencyMap = new Map<String, String>();
         barMcodeMap = new Map<String, String>();
         consumableInventory = new List<ConsumableorderdetailsInfo>();
         consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
         consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
-        orderdetails2trMap = new Map<String,Consumable_order_details2__c>();
+        orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
         //add by rentx 2021-01-27 start
         HosErrorList = new List<String>();
-        HosErrorMap = new Map<String,String>();
+        HosErrorMap = new Map<String, String>();
         //add by rentx 2021-01-27 end
 
         noboxBarcodeList.clear();
@@ -378,334 +397,466 @@
         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>();
+        List<Consumable_order_details2__c> Ins = new List<Consumable_order_details2__c>();
         List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
         List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
-        if(barcode == null || barcode.trim() ==''){
-            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��'));
+        if (barcode == null || barcode.trim() == '') {
+            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '璇疯緭鍏arCode鍙枫��'));
             return;
         }
         //瀵规瘮鍏ㄩ儴搴撳瓨涓槸鍚﹀瓨鍦ㄧ鐞嗙紪鐮佷竴鏍凤紝barcode鍙蜂笉涓�鏍风殑浜у搧
-        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
-                    AND Dealer_Saled__c = false
-                    AND Lose_Flag__c = false
-                    AND Dealer_Returned__c = false
-                    AND Cancellation_Flag__c = false
-                    AND TracingCode__c in :barMcodeMap.values()
-                    AND Bar_Code__c not in :barMcodeMap.keySet()
-                    AND Dealer_Info_text__c = :accountName
-                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                    ORDER BY Name ];
-        if(reSet1.size()>0){
+        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
+                AND Dealer_Saled__c = FALSE
+                AND Lose_Flag__c = FALSE
+                AND Dealer_Returned__c = FALSE
+                AND Cancellation_Flag__c = FALSE
+                AND TracingCode__c IN :barMcodeMap.values()
+                AND Bar_Code__c NOT IN :barMcodeMap.keySet()
+                AND Dealer_Info_text__c = :accountName
+                AND Arrive_Owner_Work_Location__c = :userWorkLocation
+            ORDER BY Name
+        ];
+        if (reSet1.size() > 0) {
             for (Integer i = 0; i < reSet1.size(); i++) {
-                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                     // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                     continue;
-                }else{
-                    for(String str : barMcodeMap.keySet()){
-                        if(barMcodeMap.get(str) == reSet1[i].TracingCode__c){
-                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, str + ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�'));
-                            ErrorIdMap.put(str,str);
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                } else {
+                    for (String str : barMcodeMap.keySet()) {
+                        if (barMcodeMap.get(str) == reSet1[i].TracingCode__c) {
+                            ApexPages.addmessage(
+                                new ApexPages.message(
+                                    ApexPages.severity.ERROR,
+                                    str + ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�'
+                                )
+                            );
+                            ErrorIdMap.put(str, str);
+                            ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                         }
                     }
                 }
             }
         }
         //绠$悊缂栫爜涓虹┖鐨勪骇鍝�
-        reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                        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,Report_Product_Expiration__c 
-                    FROM Consumable_order_details2__c
-                    WHERE Bar_Code__c in :BarCodeListP
-                    AND Dealer_Info_text__c = :accountName
-                    //AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                    AND (TracingCode__c = null
-                         OR TracingCode__c = '')
-                    ORDER BY Name ];
+        reSet1 = [
+            SELECT
+                Id,
+                Name,
+                Consumable_Product__r.Name__c,
+                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,
+                Report_Product_Expiration__c
+            FROM Consumable_order_details2__c
+            WHERE
+                Bar_Code__c IN :BarCodeListP
+                AND Dealer_Info_text__c = :accountName
+                //AND Arrive_Owner_Work_Location__c =: userWorkLocation
+                AND (TracingCode__c = NULL
+                OR TracingCode__c = '')
+            ORDER BY Name
+        ];
 
-        if(reSet1.size()>0){
+        if (reSet1.size() > 0) {
             for (Integer i = 0; i < reSet1.size(); i++) {
-                if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                     // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                     continue;
-                }else{
+                } else {
                     String str = '璇ヤ骇鍝佹病鏈夌鐞嗙紪鐮侊紝鏃犳硶鍏ュ簱';
-                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                    ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                    ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                 }
             }
         }
         //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '绠$悊缂栫爜涓虹┖鐨勪骇鍝� ' + ErrorIdMap));
         //鏁翠綋鍒拌揣
-        if(EsetId == null || EsetId == ''){
-            if(ArrType!='ReG'){
-                //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�            
-                reSet1 = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
-                                Consumable_Product__c,Consumable_Product__r.Name,
-                                Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__c,
-                                Sterilization_limit__c,Deliver_date__c,Bar_Code__c,
-                                Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,
-                                Consumable_order_minor__c,Dealer_Arrive__c,
-                                Guarantee_period_for_products__c,CFDA_Status__c,
-                                ProductPacking_list_manual__c,Report_Product_Approbation__c,
-                                Report_Product_Expiration__c,Box_Piece__c, Rrturn_count__c,
-                                Product_Type__c
-                                ,ContractNo_text__c/*,ContractNo__c1*/
-                                // tcm start
-                                ,Consumable_order_minor__r.ContractNo__c
-                                // tcm end
-                        FROM Consumable_order_details2__c
-                        WHERE Bar_Code__c in :BarCodeListP
-                        AND ( not Product_Type__c  like :userPro_Typestr)
+        if (EsetId == null || EsetId == '') {
+            if (ArrType != 'ReG') {
+                //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Intra_Trade_List_RMB__c,
+                        Asset_Model_No__c,
+                        Consumable_Product__c,
+                        Consumable_Product__r.Name,
+                        Consumable_Product__r.Name__c,
+                        Consumable_Product__r.Asset_Model_No__c,
+                        Sterilization_limit__c,
+                        Deliver_date__c,
+                        Bar_Code__c,
+                        Arrive_date__c,
+                        Send_Date__c,
+                        Consumable_order_minor__r.Name,
+                        Consumable_order_minor__c,
+                        Dealer_Arrive__c,
+                        Guarantee_period_for_products__c,
+                        CFDA_Status__c,
+                        ProductPacking_list_manual__c,
+                        Report_Product_Approbation__c,
+                        Report_Product_Expiration__c,
+                        Box_Piece__c,
+                        Rrturn_count__c,
+                        Product_Type__c,
+                        ContractNo_text__c /*,ContractNo__c1*/,
+                        // tcm start
+                        Consumable_order_minor__r.ContractNo__c
+                    // tcm end
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        Bar_Code__c IN :BarCodeListP
+                        AND (NOT Product_Type__c LIKE :userPro_Typestr)
                         AND Dealer_Info_text__c = :accountName
-                        AND ((Consumable_order_minor__c != null 
-                                AND  Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation) 
-                            OR Consumable_order_minor__c = null)
-                        ORDER BY Name ];
+                        AND ((Consumable_order_minor__c != NULL
+                        AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+                        OR Consumable_order_minor__c = NULL)
+                    ORDER BY Name
+                ];
 
-                if(reSet1.size()>0){
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
-                            String str = '浜у搧绫诲瀷['+reSet1[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                        } else {
+                            String str = '浜у搧绫诲瀷[' + reSet1[i].Product_Type__c + ']涓庣敤鎴风殑绫诲瀷[' + userPro_Type + ']涓嶇';
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                            ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                         }
                     }
                 }
                 //閿�鍞骇鍝�
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c 
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Saled__c = true
-                            AND  Dealer_Returned__c = false
-                            AND  Bar_Code__c in :BarCodeListP
-                            AND Dealer_Info_text__c = :accountName
-                            AND (Arrive_Owner_Work_Location__c =: userWorkLocation
-                                OR OwnerId = :System.Label.User_OlympusSystem)
-                            ORDER BY Name ];
-                if(reSet1.size()>0){
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        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,
+                        Report_Product_Expiration__c
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        Dealer_Saled__c = TRUE
+                        AND Dealer_Returned__c = FALSE
+                        AND Bar_Code__c IN :BarCodeListP
+                        AND Dealer_Info_text__c = :accountName
+                        AND (Arrive_Owner_Work_Location__c = :userWorkLocation
+                        OR OwnerId = :System.Label.User_OlympusSystem)
+                    ORDER BY Name
+                ];
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
+                        } else {
                             String str = '';
                             if (reSet1[i].OwnerId == System.Label.User_OlympusSystem) {
                                 str = '璇ュ晢鍝佹槸鐩撮攢浜у搧璇峰厛杩斿搧';
-                            }else{
+                            } else {
                                 str = '璇ュ晢鍝佸凡缁忛攢鍞�';
                             }
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
-                            
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                            ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                         }
                     }
                 }
                 //鍑哄簱浜у搧
-               reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Shipment__c = true
-                            AND  Dealer_Returned__c = false
-                            AND  Bar_Code__c in :BarCodeListP
-                            AND Dealer_Info_text__c = :accountName
-                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                            ORDER BY Name ];
-                if(reSet1.size()>0){
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        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,
+                        Report_Product_Expiration__c
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        Dealer_Shipment__c = TRUE
+                        AND Dealer_Returned__c = FALSE
+                        AND Bar_Code__c IN :BarCodeListP
+                        AND Dealer_Info_text__c = :accountName
+                        AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                    ORDER BY Name
+                ];
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
+                        } else {
                             String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                            ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                         }
                     }
                 }
                 //宸插埌璐т骇鍝�
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c 
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Arrive__c = true
-                            AND  Dealer_Returned__c = false
-                            AND  Bar_Code__c in :BarCodeListP
-                            AND Dealer_Info_text__c = :accountName
-                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                            ORDER BY Name ];
-                if(reSet1.size()>0){
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        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,
+                        Report_Product_Expiration__c
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        Dealer_Arrive__c = TRUE
+                        AND Dealer_Returned__c = FALSE
+                        AND Bar_Code__c IN :BarCodeListP
+                        AND Dealer_Info_text__c = :accountName
+                        AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                    ORDER BY Name
+                ];
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
+                        } else {
                             String str = '璇ュ晢鍝佸凡缁忓埌璐�';
-                            if (reSet1[i].Lose_Flag__c == TRUE) {
+                            if (reSet1[i].Lose_Flag__c == true) {
                                 str = '璇ュ晢鍝佸凡缁忎涪澶�';
                             }
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                            ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                         }
                     }
                 }
 
                 //宸叉媶鐩掍骇鍝�
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c 
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Arrive__c = true
-                            AND  Bar_Code__c in :BarCodeListP
-                            AND (Dealer_Info_text__c != :accountName
-                                OR (Dealer_Info_text__c = :accountName
-                                    AND Arrive_Owner_Work_Location__c !=: userWorkLocation))
-                            AND Box_Piece__c = '涓�'
-                            ORDER BY Name ];
-                if(reSet1.size()>0){
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        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,
+                        Report_Product_Expiration__c
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        Dealer_Arrive__c = TRUE
+                        AND Bar_Code__c IN :BarCodeListP
+                        AND (Dealer_Info_text__c != :accountName
+                        OR (Dealer_Info_text__c = :accountName
+                        AND Arrive_Owner_Work_Location__c != :userWorkLocation))
+                        AND Box_Piece__c = '涓�'
+                    ORDER BY Name
+                ];
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
+                        } else {
                             String str = '宸叉媶鐩掔殑浜у搧涓嶈兘鍏ュ簱';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                            ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                         }
                     }
                 }
 
                 // 缁忛攢鍟嗕箣闂存垨鑰呭悓涓�缁忛攢鍟嗕笉鍚屽伐浣滃湴璋冭揣
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,Asset_Model_No__c, Arrive_Owner_Work_Location__c,
-                                Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,Box_Piece__c,
-                                Deliver_date__c,Bar_Code__c,TracingCode__c, Dealer_Info_text__c, OwnerId, Lose_Flag__c,
-                                Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,Consumable_order_minor__c,
-                                recordtypeid,Consumable_order_minor__r.Arrive_Order__c,SerialLotNo__c, Dealer_Arrive__c,
-                                Consumable_Arrived_order__r.Dealer_Info__c, Consumable_Arrived_order__r.Dealer_Info__r.Name,
-                                Intra_Trade_List_RMB__c, Dealer_Shipment__c, Dealer_Saled__c,Consumable_Product__r.Asset_Model_No__c
-                                // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                                ,SummonsForDirction_det__c,Transfer_Time__c,Frist_Transfer_Agency__c,Agency_Transfer__c
-                                // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                                // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 start
-                                ,Agencyinfo_fromSAP__c,Frist_Storage_Agency__c 
-                                // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 end
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        Asset_Model_No__c,
+                        Arrive_Owner_Work_Location__c,
+                        Consumable_Product__c,
+                        Consumable_Product__r.Name,
+                        Sterilization_limit__c,
+                        Box_Piece__c,
+                        Deliver_date__c,
+                        Bar_Code__c,
+                        TracingCode__c,
+                        Dealer_Info_text__c,
+                        OwnerId,
+                        Lose_Flag__c,
+                        Arrive_date__c,
+                        Send_Date__c,
+                        Consumable_order_minor__r.Name,
+                        Consumable_order_minor__c,
+                        recordtypeid,
+                        Consumable_order_minor__r.Arrive_Order__c,
+                        SerialLotNo__c,
+                        Dealer_Arrive__c,
+                        Consumable_Arrived_order__r.Dealer_Info__c,
+                        Consumable_Arrived_order__r.Dealer_Info__r.Name,
+                        Intra_Trade_List_RMB__c,
+                        Dealer_Shipment__c,
+                        Dealer_Saled__c,
+                        Consumable_Product__r.Asset_Model_No__c,
+                        // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+                        SummonsForDirction_det__c,
+                        Transfer_Time__c,
+                        Frist_Transfer_Agency__c,
+                        Agency_Transfer__c,
+                        // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+                        // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 start
+                        Agencyinfo_fromSAP__c,
+                        Frist_Storage_Agency__c,
+                        // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 end
 
-                                //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
-                                ,ContractNo_text__c/*,ContractNo__c */
-                                // tcm start
-                                ,Consumable_order_minor__r.ContractNo__c
-                                // tcm end
-                                //add by rentx 2020-10-13 end
-                                //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
-                            //AND  Dealer_Shipment__c= false
-                            //AND  Dealer_Saled__c = FALSE
-                            AND  Dealer_Returned__c = FALSE
-                            AND  Cancellation_Flag__c = FALSE
-                            AND  Bar_Code__c in :BarCodeListP
-                            //AND (Dealer_Shipment__c = FALSE 
-                            //        OR (Dealer_Shipment__c = TRUE 
-                            //            AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣'))
-                            AND (Dealer_Info_text__c != :accountName 
-                                OR (Dealer_Info_text__c = :accountName 
-                                    AND Arrive_Owner_Work_Location__c != :userWorkLocation)
-                            )
-                            // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                            order by Bar_Code__c, Transfer_Time__c desc
-                            // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                            ];
-                if(reSet1.size()>0){
+                        //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
+                        ContractNo_text__c /*,ContractNo__c */,
+                        // tcm start
+                        Consumable_order_minor__r.ContractNo__c,
+                        // tcm end
+                        //add by rentx 2020-10-13 end
+                        //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
+                        //AND  Dealer_Shipment__c= false
+                        //AND  Dealer_Saled__c = FALSE
+                        AND Dealer_Returned__c = FALSE
+                        AND Cancellation_Flag__c = FALSE
+                        AND Bar_Code__c IN :BarCodeListP
+                        //AND (Dealer_Shipment__c = FALSE
+                        //        OR (Dealer_Shipment__c = TRUE
+                        //            AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣'))
+                        AND (Dealer_Info_text__c != :accountName
+                        OR (Dealer_Info_text__c = :accountName
+                        AND Arrive_Owner_Work_Location__c != :userWorkLocation))
+                    // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+                    ORDER BY Bar_Code__c, Transfer_Time__c DESC
+                    // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+                ];
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
-                            if(otherAgencyMap.containsKey(reSet1[i].Bar_Code__c)){
+                        } else {
+                            if (otherAgencyMap.containsKey(reSet1[i].Bar_Code__c)) {
                                 continue;
-                            }else{
+                            } else {
                                 //鍏朵粬缁忛攢鍟嗗嚭搴撲骇鍝佸彲浠ュ叆搴�
                                 List<String> barcodedetList = new List<String>();
                                 barcodedetList.add(reSet1[i].Bar_Code__c);
                                 barcodedetList.add(String.valueOf(reSet1[i].Sterilization_limit__c));
                                 barcodedetList.add(reSet1[i].SerialLotNo__c);
                                 barcodedetList.add(reSet1[i].TracingCode__c);
-                                if (reSet1[i].Lose_Flag__c == false 
+                                if (reSet1[i].Lose_Flag__c == false) {
                                     //&& reSet1[i].Dealer_Info_text__c == accountName
-                                     ) {
                                     consumableorderdetails2Cancle.add(reSet1[i]);
                                 }
                                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                                if (reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣' && !orderdetails2trMap.containsKey(reSet1[i].Bar_Code__c)) {
+                                if (
+                                    reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣' &&
+                                    !orderdetails2trMap.containsKey(reSet1[i].Bar_Code__c)
+                                ) {
                                     orderdetails2trMap.put(reSet1[i].Bar_Code__c, reSet1[i]);
                                 }
                                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                                consumableInventory.add(new ConsumableorderdetailsInfo(reSet1[i],barcodedetList));
+                                consumableInventory.add(new ConsumableorderdetailsInfo(reSet1[i], barcodedetList));
                                 Consumable_order_details2__c codsIns = new Consumable_order_details2__c();
 
-                                codsIns.RecordTypeId                = System.Label.RT_ConOrderDetail2_Delivery;
-                                codsIns.Intra_Trade_List_RMB__c     = reSet1[i].Intra_Trade_List_RMB__c;
-                                //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                                codsIns.Asset_Model_No__c           = reSet1[i].Asset_Model_No__c;
-                                codsIns.Direct_Arrive_Product__c    = true;
-                                codsIns.Sterilization_limit__c      = reSet1[i].Sterilization_limit__c;
-                                codsIns.Consumable_Product__c       = reSet1[i].Consumable_Product__c;
-                                codsIns.Bar_Code__c                 = reSet1[i].Bar_Code__c;
-                                codsIns.SerialLotNo__c              = reSet1[i].SerialLotNo__c;
-                                codsIns.TracingCode__c              = reSet1[i].TracingCode__c;
+                                codsIns.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+                                codsIns.Intra_Trade_List_RMB__c = null;
+                                codsIns.Asset_Model_No__c = reSet1[i].Asset_Model_No__c;
+                                codsIns.Direct_Arrive_Product__c = true;
+                                codsIns.Sterilization_limit__c = reSet1[i].Sterilization_limit__c;
+                                codsIns.Consumable_Product__c = reSet1[i].Consumable_Product__c;
+                                codsIns.Bar_Code__c = reSet1[i].Bar_Code__c;
+                                codsIns.SerialLotNo__c = reSet1[i].SerialLotNo__c;
+                                codsIns.TracingCode__c = reSet1[i].TracingCode__c;
                                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                                codsIns.Transfer_Time__c            = reSet1[i].Transfer_Time__c == null? 1 : reSet1[i].Transfer_Time__c;
-                                codsIns.Frist_Transfer_Agency__c    = reSet1[i].Frist_Transfer_Agency__c == null ? reSet1[i].Dealer_Info_text__c : reSet1[i].Frist_Transfer_Agency__c;
-                                codsIns.Agency_Transfer__c          = true;
+                                codsIns.Transfer_Time__c = reSet1[i].Transfer_Time__c == null ? 1 : reSet1[i].Transfer_Time__c;
+                                codsIns.Frist_Transfer_Agency__c = reSet1[i].Frist_Transfer_Agency__c == null
+                                    ? reSet1[i].Dealer_Info_text__c
+                                    : reSet1[i].Frist_Transfer_Agency__c;
+                                codsIns.Agency_Transfer__c = true;
                                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                                 
+
                                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
-                                codsIns.Agencyinfo_fromSAP__c       = reSet1[i].Agencyinfo_fromSAP__c;
-                                codsIns.Frist_Storage_Agency__c     = reSet1[i].Frist_Storage_Agency__c;
+                                codsIns.Agencyinfo_fromSAP__c = reSet1[i].Agencyinfo_fromSAP__c;
+                                codsIns.Frist_Storage_Agency__c = reSet1[i].Frist_Storage_Agency__c;
                                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
 
                                 //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,璁板綍SAP鍚堝悓鍙�
                                 // update tcm start
                                 if (String.isBlank(reSet1[i].Consumable_order_minor__r.ContractNo__c)) {
-                                    codsIns.ContractNo_text__c= reSet1[i].ContractNo_text__c;
-                                }else {
-                                    codsIns.ContractNo_text__c= reSet1[i].Consumable_order_minor__r.ContractNo__c;
+                                    codsIns.ContractNo_text__c = reSet1[i].ContractNo_text__c;
+                                } else {
+                                    codsIns.ContractNo_text__c = reSet1[i].Consumable_order_minor__r.ContractNo__c;
                                 }
                                 // update tcm end
                                 //add by rentx 2020-10-13 end
 
                                 //add by rentx 2021-03-22 start
                                 // if (reSet1[i].Lose_Flag__c == true){
-                                if (reSet1[i].hospitalSpecialOffer__c == true && reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣'){
+                                if (reSet1[i].hospitalSpecialOffer__c == true && reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣') {
                                     codsIns.exchangeOutPattern__c = true;
                                 }
                                 //add by rentx 2021-03-22 end
 
                                 consumableorderdetails2Insert.add(codsIns);
-                                otherAgencyMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                                otherAgencyMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                                 //String str = '璇ュ晢鍝佸湪鍏朵粬缁忛攢鍟嗗簱瀛�';
                                 //ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                                 //ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
@@ -714,56 +865,80 @@
                     }
                 }
 
-                 //鍙戦敊搴� 鏈埌璐�
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,Asset_Model_No__c,
-                                Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c,
-                                Deliver_date__c,Bar_Code__c,TracingCode__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,SerialLotNo__c,Dealer_Arrive__c,
-                                Dealer_Shipment__c, Dealer_Saled__c,Consumable_Product__r.Asset_Model_No__c
-                                // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                                ,SummonsForDirction_det__c,Transfer_Time__c,Frist_Transfer_Agency__c,Agency_Transfer__c,
-                                Dealer_Info_text__c,Intra_Trade_List_RMB__c
-                                // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                                // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 start
-                                ,Agencyinfo_fromSAP__c,Frist_Storage_Agency__c 
-                                // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 end
-                                //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
-                                ,ContractNo_text__c/*,ContractNo__c*/ 
-                                // tcm start
-                                ,Consumable_order_minor__r.ContractNo__c
-                                // tcm end
-                                //add by rentx 2020-10-13 end   浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
-                                ,hospitalSpecialOffer__c
-                                ,exchangeOutPattern__c
-                                ,Lose_Flag__c,Report_Product_Expiration__c 
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Arrive__c = FALSE
-                            AND  Dealer_Shipment__c= FALSE
-                            AND  Dealer_Saled__c = FALSE
-                            //AND  Cancellation_Flag__c = FALSE
-                            AND  Bar_Code__c in :BarCodeListP
-                            AND  (Dealer_Info_text__c != :accountName
-                                OR (Dealer_Info_text__c = :accountName 
-                                    AND ((Consumable_order_minor__c != null
-                                            AND (Consumable_order_minor__r.Order_Owner_WorkLocal__c != :userWorkLocation
-                                                OR (Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
-                                                    AND Cancellation_Flag__c = TRUE)))
-                                        OR (Consumable_order_minor__c = null AND Cancellation_Flag__c = TRUE)))
-                            )
-                            // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                            order by Bar_Code__c, Transfer_Time__c desc
-                            // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                            ];
-                if(reSet1.size()>0){
+                //鍙戦敊搴� 鏈埌璐�
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        Asset_Model_No__c,
+                        Consumable_Product__c,
+                        Consumable_Product__r.Name,
+                        Sterilization_limit__c,
+                        Deliver_date__c,
+                        Bar_Code__c,
+                        TracingCode__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,
+                        SerialLotNo__c,
+                        Dealer_Arrive__c,
+                        Dealer_Shipment__c,
+                        Dealer_Saled__c,
+                        Consumable_Product__r.Asset_Model_No__c,
+                        // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+                        SummonsForDirction_det__c,
+                        Transfer_Time__c,
+                        Frist_Transfer_Agency__c,
+                        Agency_Transfer__c,
+                        Dealer_Info_text__c,
+                        // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+                        // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 start
+                        Agencyinfo_fromSAP__c,
+                        Frist_Storage_Agency__c,
+                        // 棣栨鍏ュ簱缁忛攢鍟嗕俊鎭� add by gzw 2020-04-27 end
+                        //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
+                        ContractNo_text__c /*,ContractNo__c*/,
+                        // tcm start
+                        Consumable_order_minor__r.ContractNo__c,
+                        // tcm end
+                        //add by rentx 2020-10-13 end   浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
+                        hospitalSpecialOffer__c,
+                        exchangeOutPattern__c,
+                        Lose_Flag__c,
+                        Report_Product_Expiration__c
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        Dealer_Arrive__c = FALSE
+                        AND Dealer_Shipment__c = FALSE
+                        AND Dealer_Saled__c = FALSE
+                        //AND  Cancellation_Flag__c = FALSE
+                        AND Bar_Code__c IN :BarCodeListP
+                        AND (Dealer_Info_text__c != :accountName
+                        OR (Dealer_Info_text__c = :accountName
+                        AND ((Consumable_order_minor__c != NULL
+                        AND (Consumable_order_minor__r.Order_Owner_WorkLocal__c != :userWorkLocation
+                        OR (Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
+                        AND Cancellation_Flag__c = TRUE)))
+                        OR (Consumable_order_minor__c = NULL
+                        AND Cancellation_Flag__c = TRUE))))
+                    // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+                    ORDER BY Bar_Code__c, Transfer_Time__c DESC
+                    // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+                ];
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
-                            if(otherAgencyMap.containsKey(reSet1[i].Bar_Code__c)){
+                        } else {
+                            if (otherAgencyMap.containsKey(reSet1[i].Bar_Code__c)) {
                                 continue;
-                            }else{
+                            } else {
                                 //鍙栨秷鏄庣粏
                                 List<String> barcodedetList = new List<String>();
                                 barcodedetList.add(reSet1[i].Bar_Code__c);
@@ -772,189 +947,242 @@
                                 barcodedetList.add(reSet1[i].TracingCode__c);
                                 // 鍙戦敊搴撳瓨鏃讹紝鑷姩鍙栨秷 update by gzw 2020-04-15 start
                                 //if (reSet1[i].Consumable_order_minor__c == null) {
-                                    consumableorderdetails2Cancle.add(reSet1[i]);
+                                consumableorderdetails2Cancle.add(reSet1[i]);
                                 //}
                                 // 鍙戦敊搴撳瓨鏃讹紝鑷姩鍙栨秷 update by gzw 2020-04-15 start
                                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
-                                if (reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣' && !orderdetails2trMap.containsKey(reSet1[i].Bar_Code__c)) {
-
+                                if (
+                                    reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣' &&
+                                    !orderdetails2trMap.containsKey(reSet1[i].Bar_Code__c)
+                                ) {
                                     orderdetails2trMap.put(reSet1[i].Bar_Code__c, reSet1[i]);
                                 }
                                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                                consumableInventory.add(new ConsumableorderdetailsInfo(reSet1[i],barcodedetList));
+                                consumableInventory.add(new ConsumableorderdetailsInfo(reSet1[i], barcodedetList));
                                 Consumable_order_details2__c codsIns = new Consumable_order_details2__c();
 
-                                codsIns.RecordTypeId                = System.Label.RT_ConOrderDetail2_Delivery;
-                                codsIns.Intra_Trade_List_RMB__c     = reSet1[i].Intra_Trade_List_RMB__c;
-                                //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                                codsIns.Asset_Model_No__c           = reSet1[i].Asset_Model_No__c;
-                                codsIns.Direct_Arrive_Product__c    = true;
-                                codsIns.Sterilization_limit__c      = reSet1[i].Sterilization_limit__c;
-                                codsIns.Consumable_Product__c       = reSet1[i].Consumable_Product__c;
-                                codsIns.Bar_Code__c                 = reSet1[i].Bar_Code__c;
-                                codsIns.SerialLotNo__c              = reSet1[i].SerialLotNo__c;
-                                codsIns.TracingCode__c              = reSet1[i].TracingCode__c;
+                                codsIns.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+                                codsIns.Intra_Trade_List_RMB__c = null;
+                                codsIns.Asset_Model_No__c = reSet1[i].Asset_Model_No__c;
+                                codsIns.Direct_Arrive_Product__c = true;
+                                codsIns.Sterilization_limit__c = reSet1[i].Sterilization_limit__c;
+                                codsIns.Consumable_Product__c = reSet1[i].Consumable_Product__c;
+                                codsIns.Bar_Code__c = reSet1[i].Bar_Code__c;
+                                codsIns.SerialLotNo__c = reSet1[i].SerialLotNo__c;
+                                codsIns.TracingCode__c = reSet1[i].TracingCode__c;
                                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
                                 // 娌℃湁鍏ュ簱鏃讹紝娌℃湁鍊熻皟淇℃伅
-                                codsIns.Transfer_Time__c            = reSet1[i].Transfer_Time__c;
-                                codsIns.Frist_Transfer_Agency__c    = reSet1[i].Frist_Transfer_Agency__c;
-                                codsIns.Agency_Transfer__c          = reSet1[i].Agency_Transfer__c;
+                                codsIns.Transfer_Time__c = reSet1[i].Transfer_Time__c;
+                                codsIns.Frist_Transfer_Agency__c = reSet1[i].Frist_Transfer_Agency__c;
+                                codsIns.Agency_Transfer__c = reSet1[i].Agency_Transfer__c;
                                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                                
+
                                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
-                                codsIns.Agencyinfo_fromSAP__c       = reSet1[i].Agencyinfo_fromSAP__c;
-                                codsIns.Frist_Storage_Agency__c     = reSet1[i].Frist_Storage_Agency__c;
+                                codsIns.Agencyinfo_fromSAP__c = reSet1[i].Agencyinfo_fromSAP__c;
+                                codsIns.Frist_Storage_Agency__c = reSet1[i].Frist_Storage_Agency__c;
                                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
 
                                 //add by rentx 2020-10-13 start 浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
                                 // update tcm start
                                 if (String.isBlank(reSet1[i].Consumable_order_minor__r.ContractNo__c)) {
-                                    codsIns.ContractNo_text__c= reSet1[i].ContractNo_text__c;
-                                }else {
-                                    codsIns.ContractNo_text__c= reSet1[i].Consumable_order_minor__r.ContractNo__c;
+                                    codsIns.ContractNo_text__c = reSet1[i].ContractNo_text__c;
+                                } else {
+                                    codsIns.ContractNo_text__c = reSet1[i].Consumable_order_minor__r.ContractNo__c;
                                 }
                                 // update tcm end
                                 //add by rentx 2020-10-13 end   浜掔浉璋冭揣鏃�,鍊熷叆鏂硅褰昐AP鍚堝悓鍙�
 
                                 //add by rentx 2021-03-22 start
                                 // if (reSet1[i].Lose_Flag__c == true){
-                                if (reSet1[i].hospitalSpecialOffer__c == true && reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣'){
+                                if (reSet1[i].hospitalSpecialOffer__c == true && reSet1[i].SummonsForDirction_det__c == '浜掔浉璋冭揣') {
                                     codsIns.exchangeOutPattern__c = true;
                                 }
                                 //add by rentx 2021-03-22 end
 
                                 consumableorderdetails2Insert.add(codsIns);
-                                otherAgencyMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                                otherAgencyMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                             }
                         }
                     }
                 }
-            }else{
+            } else {
                 //杩斿搧妫�鏌�
-                //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�            
-                reSet1 = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
-                                Consumable_Product__c,Consumable_Product__r.Name,
-                                Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__c,
-                                Sterilization_limit__c,Deliver_date__c,Bar_Code__c,
-                                Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,
-                                Consumable_order_minor__c,Dealer_Arrive__c,
-                                Guarantee_period_for_products__c,CFDA_Status__c,
-                                ProductPacking_list_manual__c,Report_Product_Approbation__c,
-                                Report_Product_Expiration__c,Box_Piece__c, Rrturn_count__c,
-                                Product_Type__c
-                                //add by rentx 2020-10-14 start
-                                ,ContractNo_text__c/*,ContractNo__c*/
-                                // tcm start
-                            ,Consumable_order_minor__r.ContractNo__c
-                            // tcm end
-                                //add by rentx 2020-10-14 end
-                        FROM Consumable_order_details2__c
-                        WHERE Bar_Code__c in :BarCodeListP
-                        AND ( not Product_Type__c  like :userPro_Typestr)
+                //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Intra_Trade_List_RMB__c,
+                        Asset_Model_No__c,
+                        Consumable_Product__c,
+                        Consumable_Product__r.Name,
+                        Consumable_Product__r.Name__c,
+                        Consumable_Product__r.Asset_Model_No__c,
+                        Sterilization_limit__c,
+                        Deliver_date__c,
+                        Bar_Code__c,
+                        Arrive_date__c,
+                        Send_Date__c,
+                        Consumable_order_minor__r.Name,
+                        Consumable_order_minor__c,
+                        Dealer_Arrive__c,
+                        Guarantee_period_for_products__c,
+                        CFDA_Status__c,
+                        ProductPacking_list_manual__c,
+                        Report_Product_Approbation__c,
+                        Report_Product_Expiration__c,
+                        Box_Piece__c,
+                        Rrturn_count__c,
+                        Product_Type__c,
+                        //add by rentx 2020-10-14 start
+                        ContractNo_text__c /*,ContractNo__c*/,
+                        // tcm start
+                        Consumable_order_minor__r.ContractNo__c
+                    // tcm end
+                    //add by rentx 2020-10-14 end
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        Bar_Code__c IN :BarCodeListP
+                        AND (NOT Product_Type__c LIKE :userPro_Typestr)
                         AND Dealer_Info_text__c = :accountName
-                        AND ((Consumable_order_minor__c != null 
-                                AND  Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation) 
-                            OR Consumable_order_minor__c = null)
-                        ORDER BY Name ];
+                        AND ((Consumable_order_minor__c != NULL
+                        AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+                        OR Consumable_order_minor__c = NULL)
+                    ORDER BY Name
+                ];
 
-                if(reSet1.size()>0){
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
-                            String str = '浜у搧绫诲瀷['+reSet1[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                        } else {
+                            String str = '浜у搧绫诲瀷[' + reSet1[i].Product_Type__c + ']涓庣敤鎴风殑绫诲瀷[' + userPro_Type + ']涓嶇';
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                            ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                         }
                     }
                 }
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                            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
-                            //add by rentx 2020-10-14 start
-                            ,ContractNo_text__c/*,ContractNo__c*/
-                            // 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 
-                        AND  Dealer_Shipment__c= FALSE
-                        AND  Dealer_Saled__c = FALSE
-                        AND  Dealer_Returned__c = false
-                        AND  Bar_Code__c in :BarCodeListP
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        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,
+                        //add by rentx 2020-10-14 start
+                        ContractNo_text__c /*,ContractNo__c*/,
+                        // 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
+                        AND Dealer_Shipment__c = FALSE
+                        AND Dealer_Saled__c = FALSE
+                        AND Dealer_Returned__c = FALSE
+                        AND Bar_Code__c IN :BarCodeListP
                         AND Dealer_Info_text__c = :accountName
-                        ORDER BY Name ];//娌″埌璐�
-                if(reSet1.size()>0){
+                    ORDER BY Name
+                ]; //娌″埌璐�
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
+                        } else {
                             String str = '璇ュ晢鍝佸皻鏈叆搴�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                            ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                         }
                     }
                 }
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,ToDueDateDays__c,
-                                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
-                                //add by rentx 2020-10-14 start
-                                ,ContractNo_text__c/*,ContractNo__c*/
-                                // 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
-                            AND  Dealer_Shipment__c= FALSE
-                            AND  Dealer_Saled__c = FALSE
-                            AND  Bar_Code__c in :BarCodeListP
-                            AND  Dealer_Returned__c = false
-                            // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                            //AND  Lose_Flag__c = FALSE
-                            // AND  Lose_Flag__c = FALSE
-                            // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                            AND Dealer_Info_text__c = :accountName
-                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                            // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                            // Gzw 20201215淇锛屾媶鐩掍骇鍝佷笉鍒ゆ柇
-                            AND Box_Piece__c = '鐩�'
-                            // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-                            ORDER BY Name ];//娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
-                if(reSet1.size()>0){
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Consumable_Product__r.Name__c,
+                        ToDueDateDays__c,
+                        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,
+                        //add by rentx 2020-10-14 start
+                        ContractNo_text__c /*,ContractNo__c*/,
+                        // 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
+                        AND Dealer_Shipment__c = FALSE
+                        AND Dealer_Saled__c = FALSE
+                        AND Bar_Code__c IN :BarCodeListP
+                        AND Dealer_Returned__c = FALSE
+                        // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+                        //AND  Lose_Flag__c = FALSE
+                        // AND  Lose_Flag__c = FALSE
+                        // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+                        AND Dealer_Info_text__c = :accountName
+                        AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                        // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+                        // Gzw 20201215淇锛屾媶鐩掍骇鍝佷笉鍒ゆ柇
+                        AND Box_Piece__c = '鐩�'
+                    // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+                    ORDER BY Name
+                ]; //娌″嚭搴擄紝娌¢攢鍞紝灏辨槸鍦ㄥ簱
+                if (reSet1.size() > 0) {
                     for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                        if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                             // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                             continue;
-                        }else{
-                            
+                        } else {
                             // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
                             // String str = '璇ュ晢鍝佸湪搴�';
                             // if (reSet1[i].Lose_Flag__c) {
                             //     str = '璇ュ晢鍝佷涪澶�';
                             // }
                             String str = '';
-                            if(reSet1[i].Lose_Flag__c == false){
-                                str = '璇ュ晢鍝佸湪搴�';//娌″嚭搴� 锛屾病閿�鍞紝娌′涪澶卞氨鏄湪搴撱��
+                            if (reSet1[i].Lose_Flag__c == false) {
+                                str = '璇ュ晢鍝佸湪搴�'; //娌″嚭搴� 锛屾病閿�鍞紝娌′涪澶卞氨鏄湪搴撱��
                             }
-                            if(reSet1[i].Lose_Flag__c == true && reSet1[i].ToDueDateDays__c >= 0){
-                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '浜у搧'+reSet1[i].Consumable_Product__r.Name+'瀛樺湪涓㈠け璁板綍'));//濡傛灉涓㈠け浜у搧灏辩粰鎻愮ず銆�
+                            if (reSet1[i].Lose_Flag__c == true && reSet1[i].ToDueDateDays__c >= 0) {
+                                ApexPages.addmessage(
+                                    new ApexPages.message(
+                                        ApexPages.severity.WARNING,
+                                        '浜у搧' + reSet1[i].Consumable_Product__r.Name + '瀛樺湪涓㈠け璁板綍'
+                                    )
+                                ); //濡傛灉涓㈠け浜у搧灏辩粰鎻愮ず銆�
                             }
                             if (reSet1[i].Lose_Flag__c == true && reSet1[i].ToDueDateDays__c < 0) {
                                 str = '杩囨湡宸查攢瀛樹骇鍝侊紝涓嶅厑璁歌繑鍝�';
                             }
-                            if(str != ''){
-                                ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                                ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                            if (str != '') {
+                                ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                                ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                             }
                             // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
                             // ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
@@ -964,82 +1192,82 @@
                 }
             }
 
-            
-            
-            
             //鍒拌揣姝g‘淇℃伅
-            reSet = [SELECT Id,
-                            Name,
-                            Intra_Trade_List_RMB__c,
-                            Asset_Model_No__c,
-                            Consumable_Product__c,
-                            Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,
-                            Consumable_Product__r.Asset_Model_No__c,
-                            Sterilization_limit__c,
-                            Deliver_date__c,
-                            Bar_Code__c,
-                            Arrive_date__c,
-                            Send_Date__c,
-                            Box_Piece__c,
-                            Rrturn_count__c,
-                            Consumable_order_minor__r.Name,
-                            Consumable_order_minor__c,
-                            Dealer_Arrive__c,
-                            Guarantee_period_for_products__c,
-                            CFDA_Status__c,
-                            ProductPacking_list_manual__c,
-                            Report_Product_Approbation__c,
-                            Report_Product_Expiration__c,
-                            Consumable_Product__r.Pro2_Dealer_ENG__c,
-                            Consumable_Product__r.Pro2_Dealer_Object__c,
-                            TracingCode__c,
-                            Agencyinfo_fromSAP__c,
-                            Frist_Storage_Agency__c,
-                            Dealer_Info_text__c
-                            //add by rentx 2020-10-14 start
-                            ,ContractNo_text__c/*,ContractNo__c*/
-                            // tcm start
-                            ,Consumable_order_minor__r.ContractNo__c
-                            // tcm end
-                            //add by rentx 2020-10-14 end
-                        FROM Consumable_order_details2__c
-                        WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
-                        AND Cancellation_Date__c = null
-                        AND Dealer_Arrive__c = false
-                        AND Product_Type__c like :userPro_Typestr
-                        AND Bar_Code__c in :BarCodeListP
-                        AND Dealer_Info_text__c = :accountName
-                        AND ((Consumable_order_minor__c != null 
-                                AND  Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation) 
-                            OR Consumable_order_minor__c = null)
-                        ORDER BY Name ];
+            reSet = [
+                SELECT
+                    Id,
+                    Name,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    Consumable_Product__c,
+                    Consumable_Product__r.Name,
+                    Consumable_Product__r.Name__c,
+                    Consumable_Product__r.Asset_Model_No__c,
+                    Sterilization_limit__c,
+                    Deliver_date__c,
+                    Bar_Code__c,
+                    Arrive_date__c,
+                    Send_Date__c,
+                    Box_Piece__c,
+                    Rrturn_count__c,
+                    Consumable_order_minor__r.Name,
+                    Consumable_order_minor__c,
+                    Dealer_Arrive__c,
+                    Guarantee_period_for_products__c,
+                    CFDA_Status__c,
+                    ProductPacking_list_manual__c,
+                    Report_Product_Approbation__c,
+                    Report_Product_Expiration__c,
+                    Consumable_Product__r.Pro2_Dealer_ENG__c,
+                    Consumable_Product__r.Pro2_Dealer_Object__c,
+                    TracingCode__c,
+                    Agencyinfo_fromSAP__c,
+                    Frist_Storage_Agency__c,
+                    Dealer_Info_text__c,
+                    //add by rentx 2020-10-14 start
+                    ContractNo_text__c /*,ContractNo__c*/,
+                    // tcm start
+                    Consumable_order_minor__r.ContractNo__c
+                // tcm end
+                //add by rentx 2020-10-14 end
+                FROM Consumable_order_details2__c
+                WHERE
+                    recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+                    AND Cancellation_Date__c = NULL
+                    AND Dealer_Arrive__c = FALSE
+                    AND Product_Type__c LIKE :userPro_Typestr
+                    AND Bar_Code__c IN :BarCodeListP
+                    AND Dealer_Info_text__c = :accountName
+                    AND ((Consumable_order_minor__c != NULL
+                    AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+                    OR Consumable_order_minor__c = NULL)
+                ORDER BY Name
+            ];
 
-            if(reSet.size()>0){
+            if (reSet.size() > 0) {
                 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'ErrorIdMap+++ '+ ErrorIdMap.keyset()));
-                Map<String,String> errorMap = new Map<String,String>();
+                Map<String, String> errorMap = new Map<String, String>();
                 for (Integer i = 0; i < reSet.size(); i++) {
-
-                    if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
+                    if (ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)) {
                         // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                         continue;
-                    }else{
+                    } else {
                         Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c);
-                        if(n.find()){
+                        if (n.find()) {
                             String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
-                            ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i], str));
+                            ErrorIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
                             continue;
                         }
-                        if(otherAgencyMap.containsKey(reSet[i].Bar_Code__c)){
-                            for (Integer j=0; j<consumableInventory.size(); j++) {
+                        if (otherAgencyMap.containsKey(reSet[i].Bar_Code__c)) {
+                            for (Integer j = 0; j < consumableInventory.size(); j++) {
                                 ConsumableorderdetailsInfo codInfo = consumableInventory.get(j);
                                 if (codInfo.barCodeNo == reSet[i].Bar_Code__c) {
                                     consumableInventory.remove(j);
                                     break;
                                 }
                             }
-                            for (Integer m=0; m<consumableorderdetails2Insert.size(); m++) {
+                            for (Integer m = 0; m < consumableorderdetails2Insert.size(); m++) {
                                 Consumable_order_details2__c cod2 = consumableorderdetails2Insert.get(m);
                                 if (cod2.Bar_Code__c == reSet[i].Bar_Code__c) {
                                     consumableorderdetails2Insert.remove(m);
@@ -1051,84 +1279,92 @@
                         //prodName.add(reSet[i].Consumable_Product__r.Name);
                         ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
                         ConsumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(reSet[i]));
-                        ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+                        ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
                     }
                 }
             }
             //barcode涓嶄竴鑷达紝绠$悊缂栫爜涓�鑷�
-            reSet = [SELECT Id,
-                            Name,
-                            Intra_Trade_List_RMB__c,
-                            Asset_Model_No__c,
-                            Consumable_Product__c,
-                            Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,
-                            Consumable_Product__r.Asset_Model_No__c,
-                            Sterilization_limit__c,
-                            Deliver_date__c,
-                            Bar_Code__c,
-                            Arrive_date__c,
-                            Send_Date__c,
-                            Consumable_order_minor__r.Name,
-                            Consumable_order_minor__c,
-                            Dealer_Arrive__c,
-                            Guarantee_period_for_products__c,
-                            CFDA_Status__c,
-                            ProductPacking_list_manual__c,
-                            Report_Product_Approbation__c,
-                            Report_Product_Expiration__c,
-                            Box_Piece__c,
-                            Rrturn_count__c,
-                            TracingCode__c
-                            ,Agencyinfo_fromSAP__c
-                            ,Frist_Storage_Agency__c
-                            //add by rentx 2020-10-14 start
-                            ,ContractNo_text__c/*,ContractNo__c */
-                            // tcm start
-                            ,Consumable_order_minor__r.ContractNo__c
-                            // tcm end
-                            //add by rentx 2020-10-14 end
-                        FROM Consumable_order_details2__c
-                       WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
-                        AND Dealer_Info_text__c = :accountName
-                        //update by rentx 2021-01-04 start CHAN-BWX3XW
-                        // AND Consumable_order_minor__c != null
-                        // AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
-                        AND ((Consumable_order_minor__c != null AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation) OR Consumable_order_minor__c = null)
-                        //update by rentx 2021-01-04 end CHAN-BWX3XW
-                        AND Dealer_Arrive__c = false
-                        AND Cancellation_Date__c = null
-                        AND TracingCode__c in :barMcodeMap.values()
-                        AND Bar_Code__c not in :barMcodeMap.keySet()
-                        ORDER BY Name ];
+            reSet = [
+                SELECT
+                    Id,
+                    Name,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    Consumable_Product__c,
+                    Consumable_Product__r.Name,
+                    Consumable_Product__r.Name__c,
+                    Consumable_Product__r.Asset_Model_No__c,
+                    Sterilization_limit__c,
+                    Deliver_date__c,
+                    Bar_Code__c,
+                    Arrive_date__c,
+                    Send_Date__c,
+                    Consumable_order_minor__r.Name,
+                    Consumable_order_minor__c,
+                    Dealer_Arrive__c,
+                    Guarantee_period_for_products__c,
+                    CFDA_Status__c,
+                    ProductPacking_list_manual__c,
+                    Report_Product_Approbation__c,
+                    Report_Product_Expiration__c,
+                    Box_Piece__c,
+                    Rrturn_count__c,
+                    TracingCode__c,
+                    Agencyinfo_fromSAP__c,
+                    Frist_Storage_Agency__c,
+                    //add by rentx 2020-10-14 start
+                    ContractNo_text__c /*,ContractNo__c */,
+                    // tcm start
+                    Consumable_order_minor__r.ContractNo__c
+                // tcm end
+                //add by rentx 2020-10-14 end
+                FROM Consumable_order_details2__c
+                WHERE
+                    recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+                    AND Dealer_Info_text__c = :accountName
+                    //update by rentx 2021-01-04 start CHAN-BWX3XW
+                    // AND Consumable_order_minor__c != null
+                    // AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
+                    AND ((Consumable_order_minor__c != NULL
+                    AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+                    OR Consumable_order_minor__c = NULL)
+                    //update by rentx 2021-01-04 end CHAN-BWX3XW
+                    AND Dealer_Arrive__c = FALSE
+                    AND Cancellation_Date__c = NULL
+                    AND TracingCode__c IN :barMcodeMap.values()
+                    AND Bar_Code__c NOT IN :barMcodeMap.keySet()
+                ORDER BY Name
+            ];
 
-            if(reSet.size()>0){
+            if (reSet.size() > 0) {
                 for (Integer i = 0; i < reSet.size(); i++) {
-                    if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
+                    if (ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)) {
                         // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                         continue;
-                    }else{
+                    } else {
                         Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c);
-                        if(n.find()){
+                        if (n.find()) {
                             String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
-                            ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i], str));
+                            ErrorIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
                             continue;
                         }
-                        ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
-                        for(String str : barMcodeMap.keySet()){
+                        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 && reSet[i].TracingCode__c == barMcodeMap.get(str)){
+                            if (reSet[i].Bar_Code__c != str && reSet[i].TracingCode__c == barMcodeMap.get(str)) {
                                 // 20220815 ljh SWAG-CH65B7 start
                                 // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'姝ょ鐞嗙紪鐮佷笌瀹為檯鍙戣揣BarCode涓嶄竴鑷达紝璇锋牳瀵圭鐞嗙紪鐮�('+ str +')鐨勫叆搴撳強搴撳瓨鏁版嵁銆�'));
-                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'鏉″舰鐮佷负('+ str +')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�'));
+                                ApexPages.addmessage(
+                                    new ApexPages.message(ApexPages.severity.WARNING, '鏉″舰鐮佷负(' + str + ')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�')
+                                );
                                 // 20220815 ljh SWAG-CH65B7 end
                             }
-                            if(barMcodeMap.get(str) == reSet[i].TracingCode__c){
+                            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);
+                                ExistIdMap.put(str, str);
                             }
                         }
                         ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
@@ -1137,360 +1373,488 @@
                 }
             }
 
-
             // CHAN-BD43NK 鍏抽棴鐩存帴杩斿搧鍔熻兘  杩藉姞 barcode涓嶄竴鑷村垽鏂�
-            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
-                            OR Dealer_Saled__c = true)
-                        AND TracingCode__c in :barMcodeMap.values()
-                        AND Bar_Code__c not in :barMcodeMap.keySet()
-                        AND Dealer_Info_text__c = :accountName
-                        AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                        ORDER BY Name ];
-            if(reSet1.size()>0){
+            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
+                    OR Dealer_Saled__c = TRUE)
+                    AND TracingCode__c IN :barMcodeMap.values()
+                    AND Bar_Code__c NOT IN :barMcodeMap.keySet()
+                    AND Dealer_Info_text__c = :accountName
+                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                ORDER BY Name
+            ];
+            if (reSet1.size() > 0) {
                 for (Integer i = 0; i < reSet1.size(); i++) {
-                    if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
+                    if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                         // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                         continue;
-                    }else{
-                        for(String str : barMcodeMap.keySet()){
-                            if(barMcodeMap.get(str) == reSet1[i].TracingCode__c){
-                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'barcode' +str + '涓庡嚭搴撳崟' + reSet1[i].Sale_orderName__c + ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�'));
-                                ErrorIdMap.put(str,str);
-                                ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
+                    } else {
+                        for (String str : barMcodeMap.keySet()) {
+                            if (barMcodeMap.get(str) == reSet1[i].TracingCode__c) {
+                                ApexPages.addmessage(
+                                    new ApexPages.message(
+                                        ApexPages.severity.ERROR,
+                                        'barcode' +
+                                            str +
+                                            '涓庡嚭搴撳崟' +
+                                            reSet1[i].Sale_orderName__c +
+                                            ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�'
+                                    )
+                                );
+                                ErrorIdMap.put(str, str);
+                                ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
                             }
                         }
                     }
                 }
             }
-            integer RGcnt =  GoodsReturnCheck();
+            integer RGcnt = GoodsReturnCheck();
             AllMap.putAll(ErrorIdMap);
             AllMap.putAll(ExistIdMap);
-            if(RGcnt>0){
-                for(String str:GrList){
-                    AllMap.put(str,str);
+            if (RGcnt > 0) {
+                for (String str : GrList) {
+                    AllMap.put(str, str);
                 }
             }
             //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
             //return;
-            for(Integer i = 0; i < BarCodeListP.size(); i++){
-                if(AllMap.containsKey(BarCodeListP[i])){
+            for (Integer i = 0; i < BarCodeListP.size(); i++) {
+                if (AllMap.containsKey(BarCodeListP[i])) {
                     continue;
-                }else if(otherAgencyMap.containsKey(BarCodeListP[i])){
+                } else if (otherAgencyMap.containsKey(BarCodeListP[i])) {
                     continue;
                 }
                 //add by rentx 2021-01-27 start
-                else if (coc!= null && coc.orderPattern__c == 'hospitalorder') {
+                else if (coc != null && coc.orderPattern__c == 'hospitalorder') {
                     HosErrorList.add(BarCodeListP[i]);
                     continue;
                 }
                 //add by rentx 2021-01-27 end
-                else{
+                else {
                     notInlist.add(BarCodeListP[i]);
-                    otherAgencyMap.put(BarCodeListP[i],BarCodeListP[i]);
+                    otherAgencyMap.put(BarCodeListP[i], BarCodeListP[i]);
                 }
             }
             //  CHAN-BD43NK 鍏抽棴鐩存帴杩斿搧鍔熻兘
-            if(notInlist.size()>0){
-                if(ArrType!='ReG'){
+            if (notInlist.size() > 0) {
+                if (ArrType != 'ReG') {
                     inventoryEntryNoESetId(notInlist);
-                    if(notInStorelist.size() > 0){
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦ㄣ��'));
+                    if (notInStorelist.size() > 0) {
+                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'BarCode鍙�' + notInStorelist + '涓嶅瓨鍦ㄣ��'));
                         return;
                     }
-                }else{
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInlist + '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱銆�'));
+                } else {
+                    ApexPages.addmessage(
+                        new ApexPages.message(
+                            ApexPages.severity.ERROR,
+                            'BarCode鍙�' + notInlist + '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱銆�'
+                        )
+                    );
                     return;
                 }
             }
 
-        //add by rentx 2021-01-27 start
-        if (HosErrorList.size() > 0) {
-            for (String str : HosErrorList) {
-                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�:' + str + HosErrorMap.get(str)+''));
-                
+            //add by rentx 2021-01-27 start
+            if (HosErrorList.size() > 0) {
+                for (String str : HosErrorList) {
+                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'BarCode鍙�:' + str + HosErrorMap.get(str) + ''));
+                }
             }
-        }
-        //add by rentx 2021-01-27 end
-
-        }else{
-                //宸插彇娑堜骇鍝�
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c 
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Arrive__c = FALSE 
-                            AND  Dealer_Shipment__c= FALSE
-                            AND  Dealer_Saled__c = FALSE
-                            AND  Dealer_Returned__c = false
-                            AND Cancellation_Date__c != null
-                            AND  Bar_Code__c in :BarCodeListP
-                            AND Dealer_Info_text__c = :accountName
-                            ORDER BY Name ];//娌″埌璐�
-                if(reSet1.size()>0){
-                    for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
-                            // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
-                            continue;
-                        }else{
-                            String str = '璇ュ晢鍝佸彇娑�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
-                        }
-                    }
-                }
-                //宸茬粡閿�鍞�
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c 
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Saled__c = true
-                            AND  Dealer_Returned__c =false
-                            AND  Dealer_Info_text__c = :accountName
-                            AND  Bar_Code__c in :BarCodeListP 
-                            AND  Arrive_Owner_Work_Location__c =: userWorkLocation 
-                            ORDER BY Name ];
-                if(reSet1.size()>0){
-                    for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
-                            // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
-                            continue;
-                        }else{
-                            String str = '璇ュ晢鍝佸凡缁忛攢鍞�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
-                        }
-                    }
-                }
-                //宸茬粡鍑哄簱浜у搧
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c 
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Shipment__c = true
-                            AND   Dealer_Returned__c =false
-                            AND  Dealer_Info_text__c = :accountName
-                            AND  Arrive_Owner_Work_Location__c =: userWorkLocation 
-                            AND  Bar_Code__c in :BarCodeListP  
-                            ORDER BY Name ];
-                if(reSet1.size()>0){
-                    for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
-                            // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
-                            continue;
-                        }else{
-                            String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
-                        }
-                    }
-                }
-                //宸茬粡鍒拌揣浜у搧
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c
-                            FROM Consumable_order_details2__c
-                            WHERE Dealer_Arrive__c = true
-                            AND   Dealer_Returned__c =false
-                            AND  Bar_Code__c in :BarCodeListP
-                            AND Dealer_Info_text__c = :accountName
-                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                            ORDER BY Name ];
-                if(reSet1.size()>0){
-                    for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
-                            // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
-                            continue;
-                        }else{
-                            String str = '璇ュ晢鍝佸凡缁忓埌璐�';
-                            if (reSet1[i].Lose_Flag__c == TRUE) {
-                                str = '璇ュ晢鍝佸凡缁忎涪澶�';
-                            }
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
-                        }
-                    }
-                }
-                //涓嶅睘浜庢湰璁㈠崟
-                reSet1 = [SELECT Id,  Name,Consumable_Product__r.Name__c,
-                                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,Report_Product_Expiration__c 
-                            FROM Consumable_order_details2__c
-                            WHERE Consumable_order_minor__c != :ESetId
-                            AND  Bar_Code__c in :BarCodeListP
-                            //AND Dealer_Info_text__c = :accountName
-                            ORDER BY Name ];
-                if(reSet1.size()>0){
-                    for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
-                            // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
-                            continue;
-                        }else{
-                            String str = '璇ユ秷鑰楀搧涓嶅睘浜庢湰璁㈠崟';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
-                        }
-                    }
-                }
-            //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
-                reSet1 = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
-                            Consumable_Product__c,Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__c,
-                            Sterilization_limit__c,Deliver_date__c,Bar_Code__c,
-                            Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,
-                            Consumable_order_minor__c,Dealer_Arrive__c,
-                            Guarantee_period_for_products__c,CFDA_Status__c,
-                            ProductPacking_list_manual__c,Report_Product_Approbation__c,
-                            Report_Product_Expiration__c,Box_Piece__c, Rrturn_count__c,
-                            Product_Type__c
-                            ,ContractNo_text__c/*,ContractNo__c*/
-                            // tcm start
-                            ,Consumable_order_minor__r.ContractNo__c
-                            // tcm end
-                        FROM Consumable_order_details2__c
-                        WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
-                        AND Dealer_Info_text__c = :accountName
-                        AND ( not Product_Type__c  like :userPro_Typestr)
-                        AND Consumable_order_minor__c = :ESetId
-                        AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
-                        AND Dealer_Arrive__c = false
-                        AND Cancellation_Date__c = null
-                        AND Bar_Code__c in :BarCodeListP
-                        ORDER BY Name ];
-                if(reSet1.size()>0){
-                    for (Integer i = 0; i < reSet1.size(); i++) {
-                        if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){
-                            // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
-                            continue;
-                        }else{
-                            String str = '浜у搧绫诲瀷['+reSet1[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str));
-                            ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c);
-                        }
-                    }
-                }
-
-            //鍒拌揣姝g‘淇℃伅
-            reSet = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
-                            Consumable_Product__c,Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__c,
-                            Sterilization_limit__c,Deliver_date__c,Bar_Code__c,
-                            Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,
-                            Consumable_order_minor__c,Dealer_Arrive__c,
-                            Guarantee_period_for_products__c,CFDA_Status__c,
-                            ProductPacking_list_manual__c,Report_Product_Approbation__c,
-                            Report_Product_Expiration__c,Box_Piece__c, Rrturn_count__c,
-                            TracingCode__c,
-                            Agencyinfo_fromSAP__c,
-                            Frist_Storage_Agency__c,
-                            Dealer_Info_text__c
-                            ,ContractNo_text__c/*,ContractNo__c*/
-                            // tcm start
-                            ,Consumable_order_minor__r.ContractNo__c
-                            // tcm end
-                        FROM Consumable_order_details2__c
-                        WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
-                        AND Dealer_Info_text__c = :accountName
-                        AND Product_Type__c like :userPro_Typestr
-                        AND Consumable_order_minor__c = :ESetId
-                        AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
-                        AND Dealer_Arrive__c = false
-                        AND Cancellation_Date__c = null
-                        AND Bar_Code__c in :BarCodeListP
-                        ORDER BY Name ];
-            if(reSet.size()>0){
-                Map<String,String> errorMap = new Map<String,String>();
-                for (Integer i = 0; i < reSet.size(); i++) {
-                    if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
+            //add by rentx 2021-01-27 end
+        } else {
+            //宸插彇娑堜骇鍝�
+            reSet1 = [
+                SELECT
+                    Id,
+                    Name,
+                    Consumable_Product__r.Name__c,
+                    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,
+                    Report_Product_Expiration__c
+                FROM Consumable_order_details2__c
+                WHERE
+                    Dealer_Arrive__c = FALSE
+                    AND Dealer_Shipment__c = FALSE
+                    AND Dealer_Saled__c = FALSE
+                    AND Dealer_Returned__c = FALSE
+                    AND Cancellation_Date__c != NULL
+                    AND Bar_Code__c IN :BarCodeListP
+                    AND Dealer_Info_text__c = :accountName
+                ORDER BY Name
+            ]; //娌″埌璐�
+            if (reSet1.size() > 0) {
+                for (Integer i = 0; i < reSet1.size(); i++) {
+                    if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
                         // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                         continue;
-                    }else{
+                    } else {
+                        String str = '璇ュ晢鍝佸彇娑�';
+                        ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                        ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+                    }
+                }
+            }
+            //宸茬粡閿�鍞�
+            reSet1 = [
+                SELECT
+                    Id,
+                    Name,
+                    Consumable_Product__r.Name__c,
+                    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,
+                    Report_Product_Expiration__c
+                FROM Consumable_order_details2__c
+                WHERE
+                    Dealer_Saled__c = TRUE
+                    AND Dealer_Returned__c = FALSE
+                    AND Dealer_Info_text__c = :accountName
+                    AND Bar_Code__c IN :BarCodeListP
+                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                ORDER BY Name
+            ];
+            if (reSet1.size() > 0) {
+                for (Integer i = 0; i < reSet1.size(); i++) {
+                    if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+                        // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+                        continue;
+                    } else {
+                        String str = '璇ュ晢鍝佸凡缁忛攢鍞�';
+                        ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                        ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+                    }
+                }
+            }
+            //宸茬粡鍑哄簱浜у搧
+            reSet1 = [
+                SELECT
+                    Id,
+                    Name,
+                    Consumable_Product__r.Name__c,
+                    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,
+                    Report_Product_Expiration__c
+                FROM Consumable_order_details2__c
+                WHERE
+                    Dealer_Shipment__c = TRUE
+                    AND Dealer_Returned__c = FALSE
+                    AND Dealer_Info_text__c = :accountName
+                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                    AND Bar_Code__c IN :BarCodeListP
+                ORDER BY Name
+            ];
+            if (reSet1.size() > 0) {
+                for (Integer i = 0; i < reSet1.size(); i++) {
+                    if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+                        // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+                        continue;
+                    } else {
+                        String str = '璇ュ晢鍝佸凡缁忓嚭搴�';
+                        ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                        ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+                    }
+                }
+            }
+            //宸茬粡鍒拌揣浜у搧
+            reSet1 = [
+                SELECT
+                    Id,
+                    Name,
+                    Consumable_Product__r.Name__c,
+                    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,
+                    Report_Product_Expiration__c
+                FROM Consumable_order_details2__c
+                WHERE
+                    Dealer_Arrive__c = TRUE
+                    AND Dealer_Returned__c = FALSE
+                    AND Bar_Code__c IN :BarCodeListP
+                    AND Dealer_Info_text__c = :accountName
+                    AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                ORDER BY Name
+            ];
+            if (reSet1.size() > 0) {
+                for (Integer i = 0; i < reSet1.size(); i++) {
+                    if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+                        // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+                        continue;
+                    } else {
+                        String str = '璇ュ晢鍝佸凡缁忓埌璐�';
+                        if (reSet1[i].Lose_Flag__c == true) {
+                            str = '璇ュ晢鍝佸凡缁忎涪澶�';
+                        }
+                        ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                        ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+                    }
+                }
+            }
+            //涓嶅睘浜庢湰璁㈠崟
+            reSet1 = [
+                SELECT
+                    Id,
+                    Name,
+                    Consumable_Product__r.Name__c,
+                    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,
+                    Report_Product_Expiration__c
+                FROM Consumable_order_details2__c
+                WHERE Consumable_order_minor__c != :ESetId AND Bar_Code__c IN :BarCodeListP
+                //AND Dealer_Info_text__c = :accountName
+                ORDER BY Name
+            ];
+            if (reSet1.size() > 0) {
+                for (Integer i = 0; i < reSet1.size(); i++) {
+                    if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+                        // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+                        continue;
+                    } else {
+                        String str = '璇ユ秷鑰楀搧涓嶅睘浜庢湰璁㈠崟';
+                        ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                        ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+                    }
+                }
+            }
+            //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗�
+            reSet1 = [
+                SELECT
+                    Id,
+                    Name,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    Consumable_Product__c,
+                    Consumable_Product__r.Name,
+                    Consumable_Product__r.Name__c,
+                    Consumable_Product__r.Asset_Model_No__c,
+                    Sterilization_limit__c,
+                    Deliver_date__c,
+                    Bar_Code__c,
+                    Arrive_date__c,
+                    Send_Date__c,
+                    Consumable_order_minor__r.Name,
+                    Consumable_order_minor__c,
+                    Dealer_Arrive__c,
+                    Guarantee_period_for_products__c,
+                    CFDA_Status__c,
+                    ProductPacking_list_manual__c,
+                    Report_Product_Approbation__c,
+                    Report_Product_Expiration__c,
+                    Box_Piece__c,
+                    Rrturn_count__c,
+                    Product_Type__c,
+                    ContractNo_text__c /*,ContractNo__c*/,
+                    // tcm start
+                    Consumable_order_minor__r.ContractNo__c
+                // tcm end
+                FROM Consumable_order_details2__c
+                WHERE
+                    recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+                    AND Dealer_Info_text__c = :accountName
+                    AND (NOT Product_Type__c LIKE :userPro_Typestr)
+                    AND Consumable_order_minor__c = :ESetId
+                    AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
+                    AND Dealer_Arrive__c = FALSE
+                    AND Cancellation_Date__c = NULL
+                    AND Bar_Code__c IN :BarCodeListP
+                ORDER BY Name
+            ];
+            if (reSet1.size() > 0) {
+                for (Integer i = 0; i < reSet1.size(); i++) {
+                    if (ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)) {
+                        // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+                        continue;
+                    } else {
+                        String str = '浜у搧绫诲瀷[' + reSet1[i].Product_Type__c + ']涓庣敤鎴风殑绫诲瀷[' + userPro_Type + ']涓嶇';
+                        ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i], str));
+                        ErrorIdMap.put(reSet1[i].Bar_Code__c, reSet1[i].Bar_Code__c);
+                    }
+                }
+            }
+
+            //鍒拌揣姝g‘淇℃伅
+            reSet = [
+                SELECT
+                    Id,
+                    Name,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    Consumable_Product__c,
+                    Consumable_Product__r.Name,
+                    Consumable_Product__r.Name__c,
+                    Consumable_Product__r.Asset_Model_No__c,
+                    Sterilization_limit__c,
+                    Deliver_date__c,
+                    Bar_Code__c,
+                    Arrive_date__c,
+                    Send_Date__c,
+                    Consumable_order_minor__r.Name,
+                    Consumable_order_minor__c,
+                    Dealer_Arrive__c,
+                    Guarantee_period_for_products__c,
+                    CFDA_Status__c,
+                    ProductPacking_list_manual__c,
+                    Report_Product_Approbation__c,
+                    Report_Product_Expiration__c,
+                    Box_Piece__c,
+                    Rrturn_count__c,
+                    TracingCode__c,
+                    Agencyinfo_fromSAP__c,
+                    Frist_Storage_Agency__c,
+                    Dealer_Info_text__c,
+                    ContractNo_text__c /*,ContractNo__c*/,
+                    // tcm start
+                    Consumable_order_minor__r.ContractNo__c
+                // tcm end
+                FROM Consumable_order_details2__c
+                WHERE
+                    recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+                    AND Dealer_Info_text__c = :accountName
+                    AND Product_Type__c LIKE :userPro_Typestr
+                    AND Consumable_order_minor__c = :ESetId
+                    AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation
+                    AND Dealer_Arrive__c = FALSE
+                    AND Cancellation_Date__c = NULL
+                    AND Bar_Code__c IN :BarCodeListP
+                ORDER BY Name
+            ];
+            if (reSet.size() > 0) {
+                Map<String, String> errorMap = new Map<String, String>();
+                for (Integer i = 0; i < reSet.size(); i++) {
+                    if (ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)) {
+                        // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
+                        continue;
+                    } else {
                         Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c);
-                        if(n.find()){
+                        if (n.find()) {
                             String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
-                            ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i], str));
+                            ErrorIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
                             continue;
                         }
                         ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
                         ConsumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(reSet[i]));
-                        ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+                        ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
                     }
                 }
             }
 
             //barcode涓嶄竴鑷达紝绠$悊缂栫爜涓�鑷�
-            reSet = [SELECT Id,
-                            Name,
-                            Intra_Trade_List_RMB__c,
-                            Asset_Model_No__c,
-                            Consumable_Product__c,
-                            Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,
-                            Consumable_Product__r.Asset_Model_No__c,
-                            Sterilization_limit__c,
-                            Deliver_date__c,
-                            Bar_Code__c,
-                            Arrive_date__c,
-                            Send_Date__c,
-                            Box_Piece__c,
-                            Rrturn_count__c,
-                            Consumable_order_minor__r.Name,
-                            Consumable_order_minor__c,
-                            Dealer_Arrive__c,
-                            Guarantee_period_for_products__c,
-                            CFDA_Status__c,
-                            ProductPacking_list_manual__c,
-                            Report_Product_Approbation__c,
-                            Report_Product_Expiration__c,
-                            TracingCode__c
-                            ,Agencyinfo_fromSAP__c
-                            ,Frist_Storage_Agency__c
-                            ,ContractNo_text__c/*,ContractNo__c*/
-                            // tcm start
-                            ,Consumable_order_minor__r.ContractNo__c
-                            // tcm end
-                        FROM Consumable_order_details2__c
-                        WHERE recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
-                        AND Cancellation_Date__c = null
-                        AND Dealer_Arrive__c = false
-                        AND TracingCode__c in :barMcodeMap.values()
-                        AND Bar_Code__c not in :barMcodeMap.keySet()
-                        AND Dealer_Info_text__c = :accountName
-                        AND ((Consumable_order_minor__c != null
-                                AND  Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
-                            OR Consumable_order_minor__c = null)
-                        ORDER BY Name ];
-            if(reSet.size()>0){
+            reSet = [
+                SELECT
+                    Id,
+                    Name,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    Consumable_Product__c,
+                    Consumable_Product__r.Name,
+                    Consumable_Product__r.Name__c,
+                    Consumable_Product__r.Asset_Model_No__c,
+                    Sterilization_limit__c,
+                    Deliver_date__c,
+                    Bar_Code__c,
+                    Arrive_date__c,
+                    Send_Date__c,
+                    Box_Piece__c,
+                    Rrturn_count__c,
+                    Consumable_order_minor__r.Name,
+                    Consumable_order_minor__c,
+                    Dealer_Arrive__c,
+                    Guarantee_period_for_products__c,
+                    CFDA_Status__c,
+                    ProductPacking_list_manual__c,
+                    Report_Product_Approbation__c,
+                    Report_Product_Expiration__c,
+                    TracingCode__c,
+                    Agencyinfo_fromSAP__c,
+                    Frist_Storage_Agency__c,
+                    ContractNo_text__c /*,ContractNo__c*/,
+                    // tcm start
+                    Consumable_order_minor__r.ContractNo__c
+                // tcm end
+                FROM Consumable_order_details2__c
+                WHERE
+                    recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+                    AND Cancellation_Date__c = NULL
+                    AND Dealer_Arrive__c = FALSE
+                    AND TracingCode__c IN :barMcodeMap.values()
+                    AND Bar_Code__c NOT IN :barMcodeMap.keySet()
+                    AND Dealer_Info_text__c = :accountName
+                    AND ((Consumable_order_minor__c != NULL
+                    AND Consumable_order_minor__r.Order_Owner_WorkLocal__c = :userWorkLocation)
+                    OR Consumable_order_minor__c = NULL)
+                ORDER BY Name
+            ];
+            if (reSet.size() > 0) {
                 for (Integer i = 0; i < reSet.size(); i++) {
-                    if(ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)){
+                    if (ExistIdMap.containsKey(reSet[i].Bar_Code__c) || ErrorIdMap.containsKey(reSet[i].Bar_Code__c)) {
                         // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                         continue;
-                    }else{
+                    } else {
                         Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c);
-                        if(n.find()){
+                        if (n.find()) {
                             String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
-                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str));
-                            ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
+                            ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i], str));
+                            ErrorIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
                             continue;
                         }
-                        ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c);
-                        for(String str : barMcodeMap.keySet()){
-                            if(barMcodeMap.get(str) == reSet[i].TracingCode__c){
+                        ExistIdMap.put(reSet[i].Bar_Code__c, reSet[i].Bar_Code__c);
+                        for (String str : barMcodeMap.keySet()) {
+                            if (barMcodeMap.get(str) == reSet[i].TracingCode__c) {
                                 reSet[i].Bar_Code__c = str;
-                                ExistIdMap.put(str,str);
+                                ExistIdMap.put(str, str);
                             }
                         }
                         ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i]));
@@ -1501,28 +1865,27 @@
             AllMap.putAll(ErrorIdMap);
             AllMap.putAll(ExistIdMap);
             //寰楀埌涓嶅瓨鍦ㄧ殑BarCode
-            for(Integer i = 0; i < BarCodeListP.size(); i++){
-                if(AllMap.containsKey(BarCodeListP[i])){
+            for (Integer i = 0; i < BarCodeListP.size(); i++) {
+                if (AllMap.containsKey(BarCodeListP[i])) {
                     continue;
-                }else if(otherAgencyMap.containsKey(BarCodeListP[i])){
+                } else if (otherAgencyMap.containsKey(BarCodeListP[i])) {
                     continue;
                 }
                 //add by rentx 2021-01-27 start
-                else if (coc!= null && coc.orderPattern__c == 'hospitalorder') {
+                else if (coc != null && coc.orderPattern__c == 'hospitalorder') {
                     HosErrorList.add(BarCodeListP[i]);
                     continue;
-                    
                 }
                 //add by rentx 2021-01-27 end
-                else{
+                else {
                     notInlist.add(BarCodeListP[i]);
-                    otherAgencyMap.put(BarCodeListP[i],BarCodeListP[i]);
+                    otherAgencyMap.put(BarCodeListP[i], BarCodeListP[i]);
                 }
             }
-            if(notInlist.size()>0){
+            if (notInlist.size() > 0) {
                 inventoryEntry(notInlist);
-                if(notInStorelist.size() > 0){
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦ㄣ��'));
+                if (notInStorelist.size() > 0) {
+                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'BarCode鍙�' + notInStorelist + '涓嶅瓨鍦ㄣ��'));
                     return;
                 }
             }
@@ -1531,135 +1894,188 @@
         //add by rentx 2021-01-27 start 褰撹鍗曚负鍖婚櫌鐗逛环绫诲瀷鐨勮鍗曟椂,濡傛灉鎵句笉鍒癰arcode,涓嶈В鏋�,骞朵笖榛樿璇arcode瀵瑰簲鐨勬槑缁�2涓洪潪鍖婚櫌鐗逛环浜у搧,鐩存帴鎶ラ敊
         if (HosErrorList.size() > 0) {
             for (String str : HosErrorList) {
-                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�:' + str +'鏄潪鍖婚櫌鐗逛环浜у搧'));
-                
+                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'BarCode鍙�:' + str + '鏄潪鍖婚櫌鐗逛环浜у搧'));
             }
         }
         //add by rentx 2021-01-27 end
 
         makeArrivedSummary();
 
-
         //add by rentx 20210602 start CHAN-C3K4ZQ
         makeRecordsView(ConsumableorderdetailsRecordsdummy);
         //add by rentx 20210602 end CHAN-C3K4ZQ
     }
 
-
-    public void inventoryEntryNoESetId (List<String> barCodeList){
+    public void inventoryEntryNoESetId(List<String> barCodeList) {
         //鎵�鏈塨arcode瑙f瀽鍒扮殑Jancode
         List<String> alljanCodeList = new List<String>();
         List<String> allotCodeList = new List<String>();
         List<String> barCode01List = new List<String>();
         List<String> barCode241List = new List<String>();
-        Map<String,Map<String,String>> barJancodeMap = new  Map<String,Map<String,String>>();
-        Map<String,Map<String,String>> barOtcodeMap = new  Map<String,Map<String,String>>();
-        Map<String,List<String>> barcodeinfoMap = new  Map<String,List<String>>();
-        Map<String,String> barcoderightMap = new  Map<String,String>();
+        Map<String, Map<String, String>> barJancodeMap = new Map<String, Map<String, String>>();
+        Map<String, Map<String, String>> barOtcodeMap = new Map<String, Map<String, String>>();
+        Map<String, List<String>> barcodeinfoMap = new Map<String, List<String>>();
+        Map<String, String> barcoderightMap = new Map<String, String>();
         notInStorelist.clear();
-        for(Integer i = 0; i < barCodeList.size(); i++){
-            Date expirationDate = null ;
+        for (Integer i = 0; i < barCodeList.size(); i++) {
+            Date expirationDate = null;
             String serialNoorLotNo = '';
             String tracingCode = '';
             String productDateStr = '';
-            Date productionDate = null ;
+            Date productionDate = null;
             String expirationDateStr = '';
-            if(barCodeList[i].length() >= 3){
-                if(barCodeList[i].substring(0,2) =='01'){
+            if (barCodeList[i].length() >= 3) {
+                if (barCodeList[i].substring(0, 2) == '01') {
                     String janCodeMark = '';
                     //鐢熶骇鏃ユ湡
                     List<String> janCode = new List<String>();
-                    if(barCodeList[i].length() < 16){
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'));
+                    if (barCodeList[i].length() < 16) {
+                        ApexPages.addmessage(
+                            new ApexPages.message(
+                                ApexPages.severity.ERROR,
+                                '浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
+                            )
+                        );
                         continue;
-                    }else {
+                    } else {
                         //if(barCodeList[i].substring(0,2) !='01'){
                         //    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode锛屼笉绗﹀悎瑕佹眰锛�'));
                         //    return;
                         //}
-                        janCodeMark = barCodeList[i].substring(2,16);
-                        try{
-                            Decimal test  = Decimal.valueOf(janCodeMark);
-                        }catch(Exception e){
-                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'));
+                        janCodeMark = barCodeList[i].substring(2, 16);
+                        try {
+                            Decimal test = Decimal.valueOf(janCodeMark);
+                        } catch (Exception e) {
+                            ApexPages.addmessage(
+                                new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�')
+                            );
                             continue;
                         }
                     }
-                    if(barCodeList[i].length() >= 22){
-                        if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){
-                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'));
+                    if (barCodeList[i].length() >= 22) {
+                        if (barCodeList[i].substring(barCodeList[i].length() - 8, barCodeList[i].length() - 5) != '250') {
+                            ApexPages.addmessage(
+                                new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')
+                            );
                             continue;
                         }
-                        if( barCodeList[i].substring(16,18) =='11'){
-                            try{
-                                productDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01' ;
+                        if (barCodeList[i].substring(16, 18) == '11') {
+                            try {
+                                productDateStr = '20' + barCodeList[i].substring(18, 20) + '-' + barCodeList[i].substring(20, 22) + '-01';
                                 productionDate = Date.valueOf(productDateStr);
-                            }catch(Exception e){
-                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'));
+                            } catch (Exception e) {
+                                ApexPages.addmessage(
+                                    new ApexPages.message(
+                                        ApexPages.severity.ERROR,
+                                        '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'
+                                    )
+                                );
                                 continue;
                             }
-                            if(barCodeList[i].length() >=32){
-                                if( barCodeList[i].substring(24,26) =='17'){
-                                    try{
-                                        if(barCodeList[i].substring(30,32)=='00'){
-                                            expirationDateStr = '20' + barCodeList[i].substring(26,28) + '-' + barCodeList[i].substring(28,30) + '-' + '01' ;
+                            if (barCodeList[i].length() >= 32) {
+                                if (barCodeList[i].substring(24, 26) == '17') {
+                                    try {
+                                        if (barCodeList[i].substring(30, 32) == '00') {
+                                            expirationDateStr =
+                                                '20' +
+                                                barCodeList[i].substring(26, 28) +
+                                                '-' +
+                                                barCodeList[i].substring(28, 30) +
+                                                '-' +
+                                                '01';
                                             expirationDate = Date.valueOf(expirationDateStr);
                                             expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
-                                        }else{
-                                            expirationDateStr = '20' + barCodeList[i].substring(26,28) + '-' + barCodeList[i].substring(28,30) + '-' +barCodeList[i].substring(30,32) ;
-                                        expirationDate = Date.valueOf(expirationDateStr);
+                                        } else {
+                                            expirationDateStr =
+                                                '20' +
+                                                barCodeList[i].substring(26, 28) +
+                                                '-' +
+                                                barCodeList[i].substring(28, 30) +
+                                                '-' +
+                                                barCodeList[i].substring(30, 32);
+                                            expirationDate = Date.valueOf(expirationDateStr);
                                         }
-                                    }catch(Exception e){
-                                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+                                    } catch (Exception e) {
+                                        ApexPages.addmessage(
+                                            new ApexPages.message(
+                                                ApexPages.severity.ERROR,
+                                                '浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'
+                                            )
+                                        );
                                         continue;
                                     }
-                                    if(barCodeList[i].length() >= 42){
-                                        if(barCodeList[i].substring(32,34) =='10' || barCodeList[i].substring(32,34) =='21'){
-                                            serialNoorLotNo = barCodeList[i].substring(34,barCodeList[i].length() - 8) ;
+                                    if (barCodeList[i].length() >= 42) {
+                                        if (barCodeList[i].substring(32, 34) == '10' || barCodeList[i].substring(32, 34) == '21') {
+                                            serialNoorLotNo = barCodeList[i].substring(34, barCodeList[i].length() - 8);
                                         }
                                     }
-                                }else if(barCodeList[i].substring(24,26) =='10' || barCodeList[i].substring(24,26) =='21'){
-                                    serialNoorLotNo = barCodeList[i].substring(26,barCodeList[i].length() - 8) ;
+                                } else if (barCodeList[i].substring(24, 26) == '10' || barCodeList[i].substring(24, 26) == '21') {
+                                    serialNoorLotNo = barCodeList[i].substring(26, barCodeList[i].length() - 8);
                                 }
                             }
-                        }else if(barCodeList[i].substring(16,18) =='17'){
-                            try{
-                                if(barCodeList[i].substring(22,24)=='00'){
-                                    expirationDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01';
+                        } else if (barCodeList[i].substring(16, 18) == '17') {
+                            try {
+                                if (barCodeList[i].substring(22, 24) == '00') {
+                                    expirationDateStr =
+                                        '20' +
+                                        barCodeList[i].substring(18, 20) +
+                                        '-' +
+                                        barCodeList[i].substring(20, 22) +
+                                        '-01';
                                     //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧expirationDateStr' + expirationDateStr));
                                     expirationDate = Date.valueOf(expirationDateStr);
                                     expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
-                                }else{
-                                    expirationDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-' +barCodeList[i].substring(22,24);
+                                } else {
+                                    expirationDateStr =
+                                        '20' +
+                                        barCodeList[i].substring(18, 20) +
+                                        '-' +
+                                        barCodeList[i].substring(20, 22) +
+                                        '-' +
+                                        barCodeList[i].substring(22, 24);
                                     expirationDate = Date.valueOf(expirationDateStr);
                                 }
-                            }catch(Exception e){
-                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+                            } catch (Exception e) {
+                                ApexPages.addmessage(
+                                    new ApexPages.message(
+                                        ApexPages.severity.ERROR,
+                                        '浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'
+                                    )
+                                );
                                 continue;
                             }
-                            if(barCodeList[i].length() >= 34){
-                                if(barCodeList[i].substring(24,26) =='10' || barCodeList[i].substring(24,26) =='21'){
-                                    serialNoorLotNo = barCodeList[i].substring(26,barCodeList[i].length() - 8) ;
+                            if (barCodeList[i].length() >= 34) {
+                                if (barCodeList[i].substring(24, 26) == '10' || barCodeList[i].substring(24, 26) == '21') {
+                                    serialNoorLotNo = barCodeList[i].substring(26, barCodeList[i].length() - 8);
                                 }
                             }
-
-                        }else if(barCodeList[i].length() >= 26){
-                            if(barCodeList[i].substring(16,18) =='10' || barCodeList[i].substring(16,18) =='21'){
-                                serialNoorLotNo = barCodeList[i].substring(18,barCodeList[i].length() - 8) ;
+                        } else if (barCodeList[i].length() >= 26) {
+                            if (barCodeList[i].substring(16, 18) == '10' || barCodeList[i].substring(16, 18) == '21') {
+                                serialNoorLotNo = barCodeList[i].substring(18, barCodeList[i].length() - 8);
                             }
                         }
                     }
-                    if(barCodeList[i].length() >= 24 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)=='250'){
-                        if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)=='250'){
-                            tracingCode = barCodeList[i].substring(barCodeList[i].length() - 5,barCodeList[i].length());
+                    if (
+                        barCodeList[i].length() >= 24 &&
+                        barCodeList[i].substring(barCodeList[i].length() - 8, barCodeList[i].length() - 5) == '250'
+                    ) {
+                        if (barCodeList[i].substring(barCodeList[i].length() - 8, barCodeList[i].length() - 5) == '250') {
+                            tracingCode = barCodeList[i].substring(barCodeList[i].length() - 5, barCodeList[i].length());
                             Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
-                            if(n.find()){
+                            if (n.find()) {
                                 String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
-                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
+                                ApexPages.addmessage(
+                                    new ApexPages.message(
+                                        ApexPages.severity.ERROR,
+                                        '浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'
+                                    )
+                                );
                                 continue;
                             }
-                        }else{
-                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'));
+                        } else {
+                            ApexPages.addmessage(
+                                new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�')
+                            );
                             continue;
                         }
                     }
@@ -1668,404 +2084,590 @@
                     barcodedetList.add(String.valueOf(expirationDate));
                     barcodedetList.add(serialNoorLotNo);
                     barcodedetList.add(tracingCode);
-                    Integer jan1  = Integer.valueOf(janCodeMark.substring(0, 1));
-                    Integer jan2  = Integer.valueOf(janCodeMark.substring(1, 2));
-                    Integer jan3  = Integer.valueOf(janCodeMark.substring(2, 3));
-                    Integer jan4  = Integer.valueOf(janCodeMark.substring(3, 4));
-                    Integer jan5  = Integer.valueOf(janCodeMark.substring(4, 5));
-                    Integer jan6  = Integer.valueOf(janCodeMark.substring(5, 6));
-                    Integer jan7  = Integer.valueOf(janCodeMark.substring(6, 7));
-                    Integer jan8  = Integer.valueOf(janCodeMark.substring(7, 8));
-                    Integer jan9  = Integer.valueOf(janCodeMark.substring(8, 9));
+                    Integer jan1 = Integer.valueOf(janCodeMark.substring(0, 1));
+                    Integer jan2 = Integer.valueOf(janCodeMark.substring(1, 2));
+                    Integer jan3 = Integer.valueOf(janCodeMark.substring(2, 3));
+                    Integer jan4 = Integer.valueOf(janCodeMark.substring(3, 4));
+                    Integer jan5 = Integer.valueOf(janCodeMark.substring(4, 5));
+                    Integer jan6 = Integer.valueOf(janCodeMark.substring(5, 6));
+                    Integer jan7 = Integer.valueOf(janCodeMark.substring(6, 7));
+                    Integer jan8 = Integer.valueOf(janCodeMark.substring(7, 8));
+                    Integer jan9 = Integer.valueOf(janCodeMark.substring(8, 9));
                     Integer jan10 = Integer.valueOf(janCodeMark.substring(9, 10));
                     Integer jan11 = Integer.valueOf(janCodeMark.substring(10, 11));
                     Integer jan12 = Integer.valueOf(janCodeMark.substring(11, 12));
                     Integer jan13 = Integer.valueOf(janCodeMark.substring(12, 13));
 
-                    Integer count12 = jan2 + jan3*3 + jan4 + jan5*3 + jan6 + jan7*3 + jan8 + jan9*3 + jan10 + jan11*3 +jan12 + jan13*3;
-                    Integer count13 = jan1*3 + jan2 + jan3*3 + jan4 + jan5*3 + jan6 + jan7*3 + jan8 + jan9*3 + jan10 + jan11*3 +jan12 + jan13*3;
-                    String frost12  = (String.valueOf(count12)).substring((String.valueOf(count12)).length()-1);
-                    String frost13  = (String.valueOf(count13)).substring((String.valueOf(count13)).length()-1);
+                    Integer count12 =
+                        jan2 +
+                        jan3 * 3 +
+                        jan4 +
+                        jan5 * 3 +
+                        jan6 +
+                        jan7 * 3 +
+                        jan8 +
+                        jan9 * 3 +
+                        jan10 +
+                        jan11 * 3 +
+                        jan12 +
+                        jan13 * 3;
+                    Integer count13 =
+                        jan1 * 3 +
+                        jan2 +
+                        jan3 * 3 +
+                        jan4 +
+                        jan5 * 3 +
+                        jan6 +
+                        jan7 * 3 +
+                        jan8 +
+                        jan9 * 3 +
+                        jan10 +
+                        jan11 * 3 +
+                        jan12 +
+                        jan13 * 3;
+                    String frost12 = (String.valueOf(count12)).substring((String.valueOf(count12)).length() - 1);
+                    String frost13 = (String.valueOf(count13)).substring((String.valueOf(count13)).length() - 1);
                     //鍑忓幓12浣嶄釜浣�
-                    frost12 = (String.valueOf(10 - Integer.valueOf(frost12))).substring((String.valueOf(10 - Integer.valueOf(frost12))).length()-1);
-                    frost13 = (String.valueOf(10 - Integer.valueOf(frost13))).substring((String.valueOf(10 - Integer.valueOf(frost13))).length()-1);
+                    frost12 = (String.valueOf(10 - Integer.valueOf(frost12)))
+                        .substring((String.valueOf(10 - Integer.valueOf(frost12))).length() - 1);
+                    frost13 = (String.valueOf(10 - Integer.valueOf(frost13)))
+                        .substring((String.valueOf(10 - Integer.valueOf(frost13))).length() - 1);
                     janCode.add(janCodeMark.substring(1, 13) + frost12);
                     janCode.add(janCodeMark.substring(0, 13) + frost12);
                     janCode.add(janCodeMark.substring(1, 13) + frost13);
                     janCode.add(janCodeMark.substring(0, 13) + frost13);
                     alljanCodeList.addAll(janCode);
-                    Map<String,String> janCodeMap = new Map<String,String>();
-                    janCodeMap.put(janCodeMark.substring(1, 13) + frost12,barCodeList[i]);
-                    janCodeMap.put(janCodeMark.substring(0, 13) + frost12,barCodeList[i]);
-                    janCodeMap.put(janCodeMark.substring(1, 13) + frost13,barCodeList[i]);
-                    janCodeMap.put(janCodeMark.substring(0, 13) + frost13,barCodeList[i]);
+                    Map<String, String> janCodeMap = new Map<String, String>();
+                    janCodeMap.put(janCodeMark.substring(1, 13) + frost12, barCodeList[i]);
+                    janCodeMap.put(janCodeMark.substring(0, 13) + frost12, barCodeList[i]);
+                    janCodeMap.put(janCodeMark.substring(1, 13) + frost13, barCodeList[i]);
+                    janCodeMap.put(janCodeMark.substring(0, 13) + frost13, barCodeList[i]);
                     barJancodeMap.put(barCodeList[i], janCodeMap);
                     barcodeinfoMap.put(barCodeList[i], barcodedetList);
                     barCode01List.add(barCodeList[i]);
-                }else if(barCodeList[i].substring(0,3) =='241'){
-                    if(barCodeList[i].length() > 8 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'));
+                } else if (barCodeList[i].substring(0, 3) == '241') {
+                    if (
+                        barCodeList[i].length() > 8 &&
+                        barCodeList[i].substring(barCodeList[i].length() - 8, barCodeList[i].length() - 5) != '250'
+                    ) {
+                        ApexPages.addmessage(
+                            new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')
+                        );
                         continue;
                     }
                     List<String> otCodeList = new List<String>();
-                    Map<String,String> otCodeMap = new Map<String,String>();
-                    if(barCodeList[i].length() < 7){
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'));
+                    Map<String, String> otCodeMap = new Map<String, String>();
+                    if (barCodeList[i].length() < 7) {
+                        ApexPages.addmessage(
+                            new ApexPages.message(
+                                ApexPages.severity.ERROR,
+                                '浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'
+                            )
+                        );
                         continue;
-                    }else if(barCodeList[i].length() == 11){
-                        String otCode4 = barCodeList[i].substring(3,7);
-                        String otCode5 = barCodeList[i].substring(3,8);
-                        String otCode6 = barCodeList[i].substring(3,9);
-                        String otCode7 = barCodeList[i].substring(3,10);
-                        String otCode8 = barCodeList[i].substring(3,11);
+                    } else if (barCodeList[i].length() == 11) {
+                        String otCode4 = barCodeList[i].substring(3, 7);
+                        String otCode5 = barCodeList[i].substring(3, 8);
+                        String otCode6 = barCodeList[i].substring(3, 9);
+                        String otCode7 = barCodeList[i].substring(3, 10);
+                        String otCode8 = barCodeList[i].substring(3, 11);
                         otCodeList.add(otCode4);
                         otCodeList.add(otCode5);
                         otCodeList.add(otCode6);
                         otCodeList.add(otCode7);
                         otCodeList.add(otCode8);
-                        otCodeMap.put(otCode4,barCodeList[i]);
-                        otCodeMap.put(otCode5,barCodeList[i]);
-                        otCodeMap.put(otCode6,barCodeList[i]);
-                        otCodeMap.put(otCode7,barCodeList[i]);
-                        otCodeMap.put(otCode8,barCodeList[i]);
-                    }else if(barCodeList[i].length() >= 12){
-                        String otCode4 = barCodeList[i].substring(3,7);
-                        String otCode5 = barCodeList[i].substring(3,8);
-                        String otCode6 = barCodeList[i].substring(3,9);
-                        String otCode7 = barCodeList[i].substring(3,10);
-                        String otCode8 = barCodeList[i].substring(3,11);
-                        String otCode9 = barCodeList[i].substring(3,12);
+                        otCodeMap.put(otCode4, barCodeList[i]);
+                        otCodeMap.put(otCode5, barCodeList[i]);
+                        otCodeMap.put(otCode6, barCodeList[i]);
+                        otCodeMap.put(otCode7, barCodeList[i]);
+                        otCodeMap.put(otCode8, barCodeList[i]);
+                    } else if (barCodeList[i].length() >= 12) {
+                        String otCode4 = barCodeList[i].substring(3, 7);
+                        String otCode5 = barCodeList[i].substring(3, 8);
+                        String otCode6 = barCodeList[i].substring(3, 9);
+                        String otCode7 = barCodeList[i].substring(3, 10);
+                        String otCode8 = barCodeList[i].substring(3, 11);
+                        String otCode9 = barCodeList[i].substring(3, 12);
                         otCodeList.add(otCode4);
                         otCodeList.add(otCode5);
                         otCodeList.add(otCode6);
                         otCodeList.add(otCode7);
                         otCodeList.add(otCode8);
                         otCodeList.add(otCode9);
-                        otCodeMap.put(otCode4,barCodeList[i]);
-                        otCodeMap.put(otCode5,barCodeList[i]);
-                        otCodeMap.put(otCode6,barCodeList[i]);
-                        otCodeMap.put(otCode7,barCodeList[i]);
-                        otCodeMap.put(otCode8,barCodeList[i]);
-                        otCodeMap.put(otCode9,barCodeList[i]);
+                        otCodeMap.put(otCode4, barCodeList[i]);
+                        otCodeMap.put(otCode5, barCodeList[i]);
+                        otCodeMap.put(otCode6, barCodeList[i]);
+                        otCodeMap.put(otCode7, barCodeList[i]);
+                        otCodeMap.put(otCode8, barCodeList[i]);
+                        otCodeMap.put(otCode9, barCodeList[i]);
                     }
                     allotCodeList.addAll(otCodeList);
                     barOtcodeMap.put(barCodeList[i], otCodeMap);
                     barCode241List.add(barCodeList[i]);
-                }else{
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'));
+                } else {
+                    ApexPages.addmessage(
+                        new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒')
+                    );
                     continue;
                 }
-            }else{
-                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'));
+            } else {
+                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'));
                 continue;
             }
         }
         //01閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
         //-----------XHL--------------UpdateSTART----------------20181010------
-        if(alljanCodeList.size() > 0){
-            List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
-                                        Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c
+        if (alljanCodeList.size() > 0) {
+            List<Product2__c> product2InStore = [
+                SELECT
+                    Id,
+                    Name,
+                    Name__c,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    OT_CODE__c,
+                    Product2_Jancode__c,
+                    Pro2_Dealer_ENG__c,
+                    Pro2_Dealer_Object__c
                 FROM Product2__c
-                WHERE Product2_Jancode__c in :alljanCodeList
-                order by SFDA_Expiration_Date__c  desc ] ;
-            if(product2InStore.size() > 0){
+                WHERE Product2_Jancode__c IN :alljanCodeList
+                ORDER BY SFDA_Expiration_Date__c DESC
+            ];
+            if (product2InStore.size() > 0) {
                 // CHAN-AVSAST
-                Map<String,String> rightBar = new Map<String,String>();
-                Map<String,String> errorMap = new Map<String,String>();
-                for(String bar: barJancodeMap.keySet() ){
+                Map<String, String> rightBar = new Map<String, String>();
+                Map<String, String> errorMap = new Map<String, String>();
+                for (String bar : barJancodeMap.keySet()) {
                     Integer cou = 0;
-                    for(Product2__c produ: product2InStore){
-                        if(barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)){
-                            cou ++;
-                            if(EngFlag == TRUE && produ.Pro2_Dealer_ENG__c == TRUE){
-                                consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
-                                consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+                    for (Product2__c produ : product2InStore) {
+                        if (barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)) {
+                            cou++;
+                            if (EngFlag == true && produ.Pro2_Dealer_ENG__c == true) {
+                                consumableInventory.add(new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar)));
+                                consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar)));
                                 rightBar.put(bar, bar);
-                            }else if(ETFlag == TRUE && produ.Pro2_Dealer_Object__c == TRUE){   
-                                consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
-                                consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+                            } else if (ETFlag == true && produ.Pro2_Dealer_Object__c == true) {
+                                consumableInventory.add(new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar)));
+                                consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar)));
                                 rightBar.put(bar, bar);
-                            }else{
+                            } else {
                                 errorMap.put(bar, bar);
                             }
                         }
-                        
                     }
-                    if(cou <= 0 ){
+                    if (cou <= 0) {
                         notInStorelist.add(bar);
                     }
                 }
-                if(errorMap.size() > 0){
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风被鍨媅'+userPro_Type+']涓嶇'));
+                if (errorMap.size() > 0) {
+                    ApexPages.addmessage(
+                        new ApexPages.message(
+                            ApexPages.severity.ERROR,
+                            'BarCode鍙穂' + errorMap.values() + ']浜у搧绫诲瀷[' + product_Type + ']涓庣敤鎴风被鍨媅' + userPro_Type + ']涓嶇'
+                        )
+                    );
                 }
             }
         }
-        
+
         //241閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
-        if(allotCodeList.size() > 0){
-            Map<String,String> errorMap = new Map<String,String>();
-            Map<String,String> exitBarCodeMap = new Map<String,String>();
-            List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
-                                Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c
+        if (allotCodeList.size() > 0) {
+            Map<String, String> errorMap = new Map<String, String>();
+            Map<String, String> exitBarCodeMap = new Map<String, String>();
+            List<Product2__c> product2InStore = [
+                SELECT
+                    Id,
+                    Name,
+                    Name__c,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    OT_CODE__c,
+                    Product2_Jancode__c,
+                    Pro2_Dealer_ENG__c,
+                    Pro2_Dealer_Object__c
                 FROM Product2__c
-                WHERE OT_CODE__c in :allotCodeList 
-                AND (not Product_Type__c like :userPro_Typestr)] ;
-            if(product2InStore.size() > 0){
-                
-                for(Product2__c produ: product2InStore){
-                    for(String bar: barOtcodeMap.keySet() ){
-                        if(barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)){
-                            exitBarCodeMap.put(bar,bar);
+                WHERE OT_CODE__c IN :allotCodeList AND (NOT Product_Type__c LIKE :userPro_Typestr)
+            ];
+            if (product2InStore.size() > 0) {
+                for (Product2__c produ : product2InStore) {
+                    for (String bar : barOtcodeMap.keySet()) {
+                        if (barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)) {
+                            exitBarCodeMap.put(bar, bar);
                             errorMap.put(bar, bar);
                         }
                     }
                 }
             }
-            if(errorMap.size() > 0){
-                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇'));
+            if (errorMap.size() > 0) {
+                ApexPages.addmessage(
+                    new ApexPages.message(
+                        ApexPages.severity.ERROR,
+                        'BarCode鍙穂' + errorMap.values() + ']浜у搧绫诲瀷[' + product_Type + ']涓庣敤鎴穂' + userPro_Type + ']绫诲瀷涓嶇'
+                    )
+                );
             }
-            product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
-                                Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c
+            product2InStore = [
+                SELECT
+                    Id,
+                    Name,
+                    Name__c,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    OT_CODE__c,
+                    Product2_Jancode__c,
+                    Pro2_Dealer_ENG__c,
+                    Pro2_Dealer_Object__c
                 FROM Product2__c
-                WHERE OT_CODE__c in :allotCodeList 
-                AND Product_Type__c like :userPro_Typestr] ;
-            
-            if(product2InStore.size() > 0){
-                
-                for(Product2__c produ: product2InStore){
-                    for(String bar: barOtcodeMap.keySet() ){
-                        Date expirationDate = null ;
+                WHERE OT_CODE__c IN :allotCodeList AND Product_Type__c LIKE :userPro_Typestr
+            ];
+
+            if (product2InStore.size() > 0) {
+                for (Product2__c produ : product2InStore) {
+                    for (String bar : barOtcodeMap.keySet()) {
+                        Date expirationDate = null;
                         String serialNoorLotNo = '';
                         String tracingCode = '';
                         String productDateStr = '';
-                        Date productionDate = null ;
+                        Date productionDate = null;
                         String expirationDateStr = '';
-                        if(barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)){
+                        if (barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)) {
                             Integer oTcodeLength = produ.OT_CODE__c.length();
-                                if(bar.length() >= oTcodeLength + 11){
-                                    if( bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='11'){
-                                        try{
-                                            productDateStr = '20' + bar.substring(oTcodeLength + 5,oTcodeLength + 7) + '-' + bar.substring(oTcodeLength + 7,oTcodeLength + 9) + '-01' ;
-                                            productionDate = Date.valueOf(productDateStr);
-                                        }catch(Exception e){
-                                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'));
-                                            continue;
-                                        }
-                                        if(bar.length() >=oTcodeLength + 3 + 16){
-                                            if( bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='17'){
-                                                try{
-                                                    if(bar.substring(oTcodeLength + 3 + 14,oTcodeLength + 3 + 16)=='00'){
-                                                        expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 10,oTcodeLength + 3 + 12) + '-' + bar.substring(oTcodeLength + 3 + 12,oTcodeLength + 3 + 14) + '-' + '01' ;
-                                                        expirationDate = Date.valueOf(expirationDateStr);
-                                                        expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
-                                                    }else{
-                                                        expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 10,oTcodeLength + 3 + 12) + '-' + bar.substring(oTcodeLength + 3 + 12,oTcodeLength + 3 + 14) + '-' +bar.substring(oTcodeLength + 3 + 14,oTcodeLength + 3 + 16) ;
-                                                    expirationDate = Date.valueOf(expirationDateStr);
-                                                    }
-                                                }catch(Exception e){
-                                                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
-                                                    continue;
-                                                }
-                                                if(bar.length() >= oTcodeLength + 3 + 25){
-                                                    if(bar.substring(oTcodeLength + 3 + 16,oTcodeLength + 3 + 18) =='10' || bar.substring(oTcodeLength + 3 + 16,oTcodeLength + 3 + 18) =='21'){
-                                                        serialNoorLotNo = bar.substring(oTcodeLength + 3 + 18,bar.length() - 8) ;
-                                                        //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  'serialNoorLotNo' + serialNoorLotNo));
-                                                    }
-                                                }
-                                            }else if(bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='10' || bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='21'){
-                                                serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10,bar.length() - 8) ;
-                                                //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  'serialNoorLotNo' + serialNoorLotNo));
-                                            }
-                                        }
-                                    }else if(bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='17'){
-                                        try{
-                                            if(bar.substring(oTcodeLength + 3 + 6,oTcodeLength + 3 + 8)=='00'){
-                                                expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 2,oTcodeLength + 3 + 4) + '-' + bar.substring(oTcodeLength + 3 + 4,oTcodeLength + 3 + 6) + '-01';
-                                                expirationDate = Date.valueOf(expirationDateStr);
-                                                expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
-                                            }else{
-                                                expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 2,oTcodeLength + 3 + 4) + '-' + bar.substring(oTcodeLength + 3 + 4,oTcodeLength + 3 + 6) + '-' +bar.substring(oTcodeLength + 3 + 6,oTcodeLength + 3 + 8);
-                                                expirationDate = Date.valueOf(expirationDateStr);
-                                            }
-                                        }catch(Exception e){
-                                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
-                                            continue;
-                                        }
-                                        if(bar.length() >=oTcodeLength + 20){
-                                            if(bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='10' || bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='21'){
-                                                serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10,bar.length() - 8) ;
-                                            }
-                                        }
-
-                                    }else if(bar.length() >= oTcodeLength + 12){
-                                        if(bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='10' || bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='21'){
-                                            serialNoorLotNo = bar.substring(oTcodeLength + 3 + 2,bar.length() - 8) ;
-                                        }
-                                    }
-                                }
-                                if(bar.length() >= oTcodeLength + 3 + 8 && bar.substring(bar.length() - 8,bar.length()-5)=='250'){
-                                    if(bar.substring(bar.length() - 8,bar.length()-5)=='250'){
-                                        tracingCode = bar.substring(bar.length() - 5,bar.length());
-                                        Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
-                                        if(n.find()){
-                                            String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
-                                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
-                                            continue;
-                                        }
-                                    }else{
-                                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'));
+                            if (bar.length() >= oTcodeLength + 11) {
+                                if (bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '11') {
+                                    try {
+                                        productDateStr =
+                                            '20' +
+                                            bar.substring(oTcodeLength + 5, oTcodeLength + 7) +
+                                            '-' +
+                                            bar.substring(oTcodeLength + 7, oTcodeLength + 9) +
+                                            '-01';
+                                        productionDate = Date.valueOf(productDateStr);
+                                    } catch (Exception e) {
+                                        ApexPages.addmessage(
+                                            new ApexPages.message(
+                                                ApexPages.severity.ERROR,
+                                                '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'
+                                            )
+                                        );
                                         continue;
                                     }
+                                    if (bar.length() >= oTcodeLength + 3 + 16) {
+                                        if (bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '17') {
+                                            try {
+                                                if (bar.substring(oTcodeLength + 3 + 14, oTcodeLength + 3 + 16) == '00') {
+                                                    expirationDateStr =
+                                                        '20' +
+                                                        bar.substring(oTcodeLength + 3 + 10, oTcodeLength + 3 + 12) +
+                                                        '-' +
+                                                        bar.substring(oTcodeLength + 3 + 12, oTcodeLength + 3 + 14) +
+                                                        '-' +
+                                                        '01';
+                                                    expirationDate = Date.valueOf(expirationDateStr);
+                                                    expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+                                                } else {
+                                                    expirationDateStr =
+                                                        '20' +
+                                                        bar.substring(oTcodeLength + 3 + 10, oTcodeLength + 3 + 12) +
+                                                        '-' +
+                                                        bar.substring(oTcodeLength + 3 + 12, oTcodeLength + 3 + 14) +
+                                                        '-' +
+                                                        bar.substring(oTcodeLength + 3 + 14, oTcodeLength + 3 + 16);
+                                                    expirationDate = Date.valueOf(expirationDateStr);
+                                                }
+                                            } catch (Exception e) {
+                                                ApexPages.addmessage(
+                                                    new ApexPages.message(
+                                                        ApexPages.severity.ERROR,
+                                                        '浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'
+                                                    )
+                                                );
+                                                continue;
+                                            }
+                                            if (bar.length() >= oTcodeLength + 3 + 25) {
+                                                if (
+                                                    bar.substring(oTcodeLength + 3 + 16, oTcodeLength + 3 + 18) == '10' ||
+                                                    bar.substring(oTcodeLength + 3 + 16, oTcodeLength + 3 + 18) == '21'
+                                                ) {
+                                                    serialNoorLotNo = bar.substring(oTcodeLength + 3 + 18, bar.length() - 8);
+                                                    //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  'serialNoorLotNo' + serialNoorLotNo));
+                                                }
+                                            }
+                                        } else if (
+                                            bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '10' ||
+                                            bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '21'
+                                        ) {
+                                            serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10, bar.length() - 8);
+                                            //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  'serialNoorLotNo' + serialNoorLotNo));
+                                        }
+                                    }
+                                } else if (bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '17') {
+                                    try {
+                                        if (bar.substring(oTcodeLength + 3 + 6, oTcodeLength + 3 + 8) == '00') {
+                                            expirationDateStr =
+                                                '20' +
+                                                bar.substring(oTcodeLength + 3 + 2, oTcodeLength + 3 + 4) +
+                                                '-' +
+                                                bar.substring(oTcodeLength + 3 + 4, oTcodeLength + 3 + 6) +
+                                                '-01';
+                                            expirationDate = Date.valueOf(expirationDateStr);
+                                            expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
+                                        } else {
+                                            expirationDateStr =
+                                                '20' +
+                                                bar.substring(oTcodeLength + 3 + 2, oTcodeLength + 3 + 4) +
+                                                '-' +
+                                                bar.substring(oTcodeLength + 3 + 4, oTcodeLength + 3 + 6) +
+                                                '-' +
+                                                bar.substring(oTcodeLength + 3 + 6, oTcodeLength + 3 + 8);
+                                            expirationDate = Date.valueOf(expirationDateStr);
+                                        }
+                                    } catch (Exception e) {
+                                        ApexPages.addmessage(
+                                            new ApexPages.message(
+                                                ApexPages.severity.ERROR,
+                                                '浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'
+                                            )
+                                        );
+                                        continue;
+                                    }
+                                    if (bar.length() >= oTcodeLength + 20) {
+                                        if (
+                                            bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '10' ||
+                                            bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '21'
+                                        ) {
+                                            serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10, bar.length() - 8);
+                                        }
+                                    }
+                                } else if (bar.length() >= oTcodeLength + 12) {
+                                    if (
+                                        bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '10' ||
+                                        bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '21'
+                                    ) {
+                                        serialNoorLotNo = bar.substring(oTcodeLength + 3 + 2, bar.length() - 8);
+                                    }
                                 }
-                                exitBarCodeMap.put(bar,bar);
-                                List<String> barcodedetList = new List<String>();
-                                barcodedetList.add(bar);
-                                barcodedetList.add(String.valueOf(expirationDate));
-                                barcodedetList.add(serialNoorLotNo);
-                                barcodedetList.add(tracingCode);
-                                consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodedetList));
-                                consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ,barcodedetList));
-                            
+                            }
+                            if (bar.length() >= oTcodeLength + 3 + 8 && bar.substring(bar.length() - 8, bar.length() - 5) == '250') {
+                                if (bar.substring(bar.length() - 8, bar.length() - 5) == '250') {
+                                    tracingCode = bar.substring(bar.length() - 5, bar.length());
+                                    Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
+                                    if (n.find()) {
+                                        String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
+                                        ApexPages.addmessage(
+                                            new ApexPages.message(
+                                                ApexPages.severity.ERROR,
+                                                '浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'
+                                            )
+                                        );
+                                        continue;
+                                    }
+                                } else {
+                                    ApexPages.addmessage(
+                                        new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�')
+                                    );
+                                    continue;
+                                }
+                            }
+                            exitBarCodeMap.put(bar, bar);
+                            List<String> barcodedetList = new List<String>();
+                            barcodedetList.add(bar);
+                            barcodedetList.add(String.valueOf(expirationDate));
+                            barcodedetList.add(serialNoorLotNo);
+                            barcodedetList.add(tracingCode);
+                            consumableInventory.add(new ConsumableorderdetailsInfo(produ, barcodedetList));
+                            consumableInventoryUse.add(new ConsumableorderdetailsInfo(produ, barcodedetList));
                         }
                     }
-
                 }
             }
-            for(String bartxt :barCode241List){
-               if(!exitBarCodeMap.containsKey(bartxt)){
-                 if(!errorMap.containsKey(bartxt)){
-                    notInStorelist.add(bartxt);
-                 } 
-               }
+            for (String bartxt : barCode241List) {
+                if (!exitBarCodeMap.containsKey(bartxt)) {
+                    if (!errorMap.containsKey(bartxt)) {
+                        notInStorelist.add(bartxt);
+                    }
+                }
             }
         }
-
     }
 
-
-    public void inventoryEntry (List<String> barCodeList){
+    public void inventoryEntry(List<String> barCodeList) {
         //鎵�鏈塨arcode瑙f瀽鍒扮殑Jancode
         List<String> alljanCodeList = new List<String>();
         List<String> allotCodeList = new List<String>();
         List<String> barCode01List = new List<String>();
         List<String> barCode241List = new List<String>();
-        Map<String,Map<String,String>> barJancodeMap = new  Map<String,Map<String,String>>();
-        Map<String,Map<String,String>> barOtcodeMap = new  Map<String,Map<String,String>>();
-        Map<String,List<String>> barcodeinfoMap = new  Map<String,List<String>>();
+        Map<String, Map<String, String>> barJancodeMap = new Map<String, Map<String, String>>();
+        Map<String, Map<String, String>> barOtcodeMap = new Map<String, Map<String, String>>();
+        Map<String, List<String>> barcodeinfoMap = new Map<String, List<String>>();
         notInStorelist.clear();
         notEqualBARcodeCunMap.clear();
-        Map<String,String> orderdetailMap = new Map<String,String>();
-        List<Consumable_Orderdetails__c> orderdetail = [SELECT Id,  Name, Consumable_order__c,
-                            Consumable_Product__c,Asset_Model_No__c
-                        FROM Consumable_Orderdetails__c
-                        WHERE Consumable_order__r.Dealer_Info__c = :accountid
-                        AND Consumable_order__c != null
-                        AND Consumable_order__c = :ESetId
-                        AND Order_Owner_WorkLocal__c = :userWorkLocation
-                        ORDER BY Name ];
-        for(Integer i = 0; i < orderdetail.size(); i++){
+        Map<String, String> orderdetailMap = new Map<String, String>();
+        List<Consumable_Orderdetails__c> orderdetail = [
+            SELECT Id, Name, Consumable_order__c, Consumable_Product__c, Asset_Model_No__c
+            FROM Consumable_Orderdetails__c
+            WHERE
+                Consumable_order__r.Dealer_Info__c = :accountid
+                AND Consumable_order__c != NULL
+                AND Consumable_order__c = :ESetId
+                AND Order_Owner_WorkLocal__c = :userWorkLocation
+            ORDER BY Name
+        ];
+        for (Integer i = 0; i < orderdetail.size(); i++) {
             orderdetailMap.put(orderdetail[i].Consumable_Product__c, orderdetail[i].Consumable_Product__c);
         }
 
-        for(Integer i = 0; i < barCodeList.size(); i++){
-            Date expirationDate = null ;
+        for (Integer i = 0; i < barCodeList.size(); i++) {
+            Date expirationDate = null;
             String serialNoorLotNo = '';
             String tracingCode = '';
             String productDateStr = '';
-            Date productionDate = null ;
+            Date productionDate = null;
             String expirationDateStr = '';
 
-            if(barCodeList[i].substring(0,2) =='01'){
+            if (barCodeList[i].substring(0, 2) == '01') {
                 String janCodeMark = '';
                 //鐢熶骇鏃ユ湡
                 List<String> janCode = new List<String>();
-                if(barCodeList[i].length() < 16){
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'));
+                if (barCodeList[i].length() < 16) {
+                    ApexPages.addmessage(
+                        new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')
+                    );
                     continue;
-                }else {
-                    janCodeMark = barCodeList[i].substring(2,16);
-                    try{
-                        Decimal test  = Decimal.valueOf(janCodeMark);
-                    }catch(Exception e){
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'));
+                } else {
+                    janCodeMark = barCodeList[i].substring(2, 16);
+                    try {
+                        Decimal test = Decimal.valueOf(janCodeMark);
+                    } catch (Exception e) {
+                        ApexPages.addmessage(
+                            new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�')
+                        );
                         continue;
                     }
                 }
-                if(barCodeList[i].length() >= 22){
-                    if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'));
+                if (barCodeList[i].length() >= 22) {
+                    if (barCodeList[i].substring(barCodeList[i].length() - 8, barCodeList[i].length() - 5) != '250') {
+                        ApexPages.addmessage(
+                            new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')
+                        );
                         continue;
                     }
-                    if( barCodeList[i].substring(16,18) =='11'){
-                        try{
-                            productDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01' ;
+                    if (barCodeList[i].substring(16, 18) == '11') {
+                        try {
+                            productDateStr = '20' + barCodeList[i].substring(18, 20) + '-' + barCodeList[i].substring(20, 22) + '-01';
                             productionDate = Date.valueOf(productDateStr);
-                        }catch(Exception e){
-                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'));
+                        } catch (Exception e) {
+                            ApexPages.addmessage(
+                                new ApexPages.message(
+                                    ApexPages.severity.ERROR,
+                                    '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'
+                                )
+                            );
                             continue;
                         }
-                        if(barCodeList[i].length() >=32){
-                            if( barCodeList[i].substring(24,26) =='17'){
-                                try{
-                                    if(barCodeList[i].substring(30,32)=='00'){
-                                        expirationDateStr = '20' + barCodeList[i].substring(26,28) + '-' + barCodeList[i].substring(28,30) + '-' + '01' ;
+                        if (barCodeList[i].length() >= 32) {
+                            if (barCodeList[i].substring(24, 26) == '17') {
+                                try {
+                                    if (barCodeList[i].substring(30, 32) == '00') {
+                                        expirationDateStr =
+                                            '20' +
+                                            barCodeList[i].substring(26, 28) +
+                                            '-' +
+                                            barCodeList[i].substring(28, 30) +
+                                            '-' +
+                                            '01';
                                         expirationDate = Date.valueOf(expirationDateStr);
                                         expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
-                                    }else{
-                                        expirationDateStr = '20' + barCodeList[i].substring(26,28) + '-' + barCodeList[i].substring(28,30) + '-' +barCodeList[i].substring(30,32) ;
-                                    expirationDate = Date.valueOf(expirationDateStr);
+                                    } else {
+                                        expirationDateStr =
+                                            '20' +
+                                            barCodeList[i].substring(26, 28) +
+                                            '-' +
+                                            barCodeList[i].substring(28, 30) +
+                                            '-' +
+                                            barCodeList[i].substring(30, 32);
+                                        expirationDate = Date.valueOf(expirationDateStr);
                                     }
-                                }catch(Exception e){
-                                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+                                } catch (Exception e) {
+                                    ApexPages.addmessage(
+                                        new ApexPages.message(
+                                            ApexPages.severity.ERROR,
+                                            '浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'
+                                        )
+                                    );
                                     continue;
                                 }
-                                if(barCodeList[i].length() >= 42){
-                                    if(barCodeList[i].substring(32,34) =='10' || barCodeList[i].substring(32,34) =='21'){
-                                        serialNoorLotNo = barCodeList[i].substring(34,barCodeList[i].length() - 8) ;
+                                if (barCodeList[i].length() >= 42) {
+                                    if (barCodeList[i].substring(32, 34) == '10' || barCodeList[i].substring(32, 34) == '21') {
+                                        serialNoorLotNo = barCodeList[i].substring(34, barCodeList[i].length() - 8);
                                     }
                                 }
-                            }else if(barCodeList[i].substring(24,26) =='10' || barCodeList[i].substring(24,26) =='21'){
-                                serialNoorLotNo = barCodeList[i].substring(26,barCodeList[i].length() - 8) ;
+                            } else if (barCodeList[i].substring(24, 26) == '10' || barCodeList[i].substring(24, 26) == '21') {
+                                serialNoorLotNo = barCodeList[i].substring(26, barCodeList[i].length() - 8);
                             }
                         }
-                    }else if(barCodeList[i].substring(16,18) =='17'){
-                        try{
-                            if(barCodeList[i].substring(22,24)=='00'){
-                                expirationDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01';
+                    } else if (barCodeList[i].substring(16, 18) == '17') {
+                        try {
+                            if (barCodeList[i].substring(22, 24) == '00') {
+                                expirationDateStr =
+                                    '20' +
+                                    barCodeList[i].substring(18, 20) +
+                                    '-' +
+                                    barCodeList[i].substring(20, 22) +
+                                    '-01';
                                 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧expirationDateStr' + expirationDateStr));
                                 expirationDate = Date.valueOf(expirationDateStr);
                                 expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
-                            }else{
-                                expirationDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-' +barCodeList[i].substring(22,24);
+                            } else {
+                                expirationDateStr =
+                                    '20' +
+                                    barCodeList[i].substring(18, 20) +
+                                    '-' +
+                                    barCodeList[i].substring(20, 22) +
+                                    '-' +
+                                    barCodeList[i].substring(22, 24);
                                 expirationDate = Date.valueOf(expirationDateStr);
                             }
-                        }catch(Exception e){
-                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+                        } catch (Exception e) {
+                            ApexPages.addmessage(
+                                new ApexPages.message(
+                                    ApexPages.severity.ERROR,
+                                    '浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'
+                                )
+                            );
                             continue;
                         }
-                        if(barCodeList[i].length() >= 34){
-                            if(barCodeList[i].substring(24,26) =='10' || barCodeList[i].substring(24,26) =='21'){
-                                serialNoorLotNo = barCodeList[i].substring(26,barCodeList[i].length() - 8) ;
+                        if (barCodeList[i].length() >= 34) {
+                            if (barCodeList[i].substring(24, 26) == '10' || barCodeList[i].substring(24, 26) == '21') {
+                                serialNoorLotNo = barCodeList[i].substring(26, barCodeList[i].length() - 8);
                             }
                         }
-
-                    }else if(barCodeList[i].length() >= 26){
-                        if(barCodeList[i].substring(16,18) =='10' || barCodeList[i].substring(16,18) =='21'){
-                            serialNoorLotNo = barCodeList[i].substring(18,barCodeList[i].length() - 8) ;
+                    } else if (barCodeList[i].length() >= 26) {
+                        if (barCodeList[i].substring(16, 18) == '10' || barCodeList[i].substring(16, 18) == '21') {
+                            serialNoorLotNo = barCodeList[i].substring(18, barCodeList[i].length() - 8);
                         }
                     }
                 }
-                if(barCodeList[i].length() >= 24 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)=='250'){
-                    if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)=='250'){
-                        tracingCode = barCodeList[i].substring(barCodeList[i].length() - 5,barCodeList[i].length());
+                if (
+                    barCodeList[i].length() >= 24 &&
+                    barCodeList[i].substring(barCodeList[i].length() - 8, barCodeList[i].length() - 5) == '250'
+                ) {
+                    if (barCodeList[i].substring(barCodeList[i].length() - 8, barCodeList[i].length() - 5) == '250') {
+                        tracingCode = barCodeList[i].substring(barCodeList[i].length() - 5, barCodeList[i].length());
                         Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
-                        if(n.find()){
+                        if (n.find()) {
                             String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
-                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
+                            ApexPages.addmessage(
+                                new ApexPages.message(
+                                    ApexPages.severity.ERROR,
+                                    '浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'
+                                )
+                            );
                             continue;
                         }
-                    }else{
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'));
+                    } else {
+                        ApexPages.addmessage(
+                            new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�')
+                        );
                         continue;
                     }
                 }
@@ -2074,275 +2676,397 @@
                 barcodedetList.add(String.valueOf(expirationDate));
                 barcodedetList.add(serialNoorLotNo);
                 barcodedetList.add(tracingCode);
-                Integer jan1  = Integer.valueOf(janCodeMark.substring(0, 1));
-                Integer jan2  = Integer.valueOf(janCodeMark.substring(1, 2));
-                Integer jan3  = Integer.valueOf(janCodeMark.substring(2, 3));
-                Integer jan4  = Integer.valueOf(janCodeMark.substring(3, 4));
-                Integer jan5  = Integer.valueOf(janCodeMark.substring(4, 5));
-                Integer jan6  = Integer.valueOf(janCodeMark.substring(5, 6));
-                Integer jan7  = Integer.valueOf(janCodeMark.substring(6, 7));
-                Integer jan8  = Integer.valueOf(janCodeMark.substring(7, 8));
-                Integer jan9  = Integer.valueOf(janCodeMark.substring(8, 9));
+                Integer jan1 = Integer.valueOf(janCodeMark.substring(0, 1));
+                Integer jan2 = Integer.valueOf(janCodeMark.substring(1, 2));
+                Integer jan3 = Integer.valueOf(janCodeMark.substring(2, 3));
+                Integer jan4 = Integer.valueOf(janCodeMark.substring(3, 4));
+                Integer jan5 = Integer.valueOf(janCodeMark.substring(4, 5));
+                Integer jan6 = Integer.valueOf(janCodeMark.substring(5, 6));
+                Integer jan7 = Integer.valueOf(janCodeMark.substring(6, 7));
+                Integer jan8 = Integer.valueOf(janCodeMark.substring(7, 8));
+                Integer jan9 = Integer.valueOf(janCodeMark.substring(8, 9));
                 Integer jan10 = Integer.valueOf(janCodeMark.substring(9, 10));
                 Integer jan11 = Integer.valueOf(janCodeMark.substring(10, 11));
                 Integer jan12 = Integer.valueOf(janCodeMark.substring(11, 12));
                 Integer jan13 = Integer.valueOf(janCodeMark.substring(12, 13));
-                Integer count12 = jan2 + jan3*3 + jan4 + jan5*3 + jan6 + jan7*3 + jan8 + jan9*3 + jan10 + jan11*3 +jan12 + jan13*3;
-                
-                Integer count13 = jan1*3 + jan2 + jan3*3 + jan4 + jan5*3 + jan6 + jan7*3 + jan8 + jan9*3 + jan10 + jan11*3 +jan12 + jan13*3;
-                String frost12  = (String.valueOf(count12)).substring((String.valueOf(count12)).length()-1);
-                String frost13  = (String.valueOf(count13)).substring((String.valueOf(count13)).length()-1);
+                Integer count12 =
+                    jan2 +
+                    jan3 * 3 +
+                    jan4 +
+                    jan5 * 3 +
+                    jan6 +
+                    jan7 * 3 +
+                    jan8 +
+                    jan9 * 3 +
+                    jan10 +
+                    jan11 * 3 +
+                    jan12 +
+                    jan13 * 3;
+
+                Integer count13 =
+                    jan1 * 3 +
+                    jan2 +
+                    jan3 * 3 +
+                    jan4 +
+                    jan5 * 3 +
+                    jan6 +
+                    jan7 * 3 +
+                    jan8 +
+                    jan9 * 3 +
+                    jan10 +
+                    jan11 * 3 +
+                    jan12 +
+                    jan13 * 3;
+                String frost12 = (String.valueOf(count12)).substring((String.valueOf(count12)).length() - 1);
+                String frost13 = (String.valueOf(count13)).substring((String.valueOf(count13)).length() - 1);
                 //鍑忓幓12浣嶄釜浣�4
-                frost12 = (String.valueOf(10 - Integer.valueOf(frost12))).substring((String.valueOf(10 - Integer.valueOf(frost12))).length()-1);
-                frost13 = (String.valueOf(10 - Integer.valueOf(frost13))).substring((String.valueOf(10 - Integer.valueOf(frost13))).length()-1);
-                
+                frost12 = (String.valueOf(10 - Integer.valueOf(frost12)))
+                    .substring((String.valueOf(10 - Integer.valueOf(frost12))).length() - 1);
+                frost13 = (String.valueOf(10 - Integer.valueOf(frost13)))
+                    .substring((String.valueOf(10 - Integer.valueOf(frost13))).length() - 1);
+
                 janCode.add(janCodeMark.substring(1, 13) + frost12);
                 janCode.add(janCodeMark.substring(0, 13) + frost12);
                 janCode.add(janCodeMark.substring(1, 13) + frost13);
                 janCode.add(janCodeMark.substring(0, 13) + frost13);
                 alljanCodeList.addAll(janCode);
-                Map<String,String> janCodeMap = new Map<String,String>();
-                janCodeMap.put(janCodeMark.substring(1, 13) + frost12,barCodeList[i]);
-                janCodeMap.put(janCodeMark.substring(0, 13) + frost12,barCodeList[i]);
-                janCodeMap.put(janCodeMark.substring(1, 13) + frost13,barCodeList[i]);
-                janCodeMap.put(janCodeMark.substring(0, 13) + frost13,barCodeList[i]);
+                Map<String, String> janCodeMap = new Map<String, String>();
+                janCodeMap.put(janCodeMark.substring(1, 13) + frost12, barCodeList[i]);
+                janCodeMap.put(janCodeMark.substring(0, 13) + frost12, barCodeList[i]);
+                janCodeMap.put(janCodeMark.substring(1, 13) + frost13, barCodeList[i]);
+                janCodeMap.put(janCodeMark.substring(0, 13) + frost13, barCodeList[i]);
                 barJancodeMap.put(barCodeList[i], janCodeMap);
                 barcodeinfoMap.put(barCodeList[i], barcodedetList);
                 barCode01List.add(barCodeList[i]);
-            }else if(barCodeList[i].substring(0,3) =='241'){
-                if(barCodeList[i].length() > 8 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'));
+            } else if (barCodeList[i].substring(0, 3) == '241') {
+                if (
+                    barCodeList[i].length() > 8 &&
+                    barCodeList[i].substring(barCodeList[i].length() - 8, barCodeList[i].length() - 5) != '250'
+                ) {
+                    ApexPages.addmessage(
+                        new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')
+                    );
                     continue;
                 }
                 List<String> otCodeList = new List<String>();
-                Map<String,String> otCodeMap = new Map<String,String>();
-                if(barCodeList[i].length() < 7){
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'));
+                Map<String, String> otCodeMap = new Map<String, String>();
+                if (barCodeList[i].length() < 7) {
+                    ApexPages.addmessage(
+                        new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')
+                    );
                     continue;
-                }else if(barCodeList[i].length() == 11){
-                    String otCode4 = barCodeList[i].substring(3,7);
-                    String otCode5 = barCodeList[i].substring(3,8);
-                    String otCode6 = barCodeList[i].substring(3,9);
-                    String otCode7 = barCodeList[i].substring(3,10);
-                    String otCode8 = barCodeList[i].substring(3,11);
+                } else if (barCodeList[i].length() == 11) {
+                    String otCode4 = barCodeList[i].substring(3, 7);
+                    String otCode5 = barCodeList[i].substring(3, 8);
+                    String otCode6 = barCodeList[i].substring(3, 9);
+                    String otCode7 = barCodeList[i].substring(3, 10);
+                    String otCode8 = barCodeList[i].substring(3, 11);
                     otCodeList.add(otCode4);
                     otCodeList.add(otCode5);
                     otCodeList.add(otCode6);
                     otCodeList.add(otCode7);
                     otCodeList.add(otCode8);
-                    otCodeMap.put(otCode4,barCodeList[i]);
-                    otCodeMap.put(otCode5,barCodeList[i]);
-                    otCodeMap.put(otCode6,barCodeList[i]);
-                    otCodeMap.put(otCode7,barCodeList[i]);
-                    otCodeMap.put(otCode8,barCodeList[i]);
-                }else if(barCodeList[i].length() >= 12){
-                    String otCode4 = barCodeList[i].substring(3,7);
-                    String otCode5 = barCodeList[i].substring(3,8);
-                    String otCode6 = barCodeList[i].substring(3,9);
-                    String otCode7 = barCodeList[i].substring(3,10);
-                    String otCode8 = barCodeList[i].substring(3,11);
-                    String otCode9 = barCodeList[i].substring(3,12);
+                    otCodeMap.put(otCode4, barCodeList[i]);
+                    otCodeMap.put(otCode5, barCodeList[i]);
+                    otCodeMap.put(otCode6, barCodeList[i]);
+                    otCodeMap.put(otCode7, barCodeList[i]);
+                    otCodeMap.put(otCode8, barCodeList[i]);
+                } else if (barCodeList[i].length() >= 12) {
+                    String otCode4 = barCodeList[i].substring(3, 7);
+                    String otCode5 = barCodeList[i].substring(3, 8);
+                    String otCode6 = barCodeList[i].substring(3, 9);
+                    String otCode7 = barCodeList[i].substring(3, 10);
+                    String otCode8 = barCodeList[i].substring(3, 11);
+                    String otCode9 = barCodeList[i].substring(3, 12);
                     otCodeList.add(otCode4);
                     otCodeList.add(otCode5);
                     otCodeList.add(otCode6);
                     otCodeList.add(otCode7);
                     otCodeList.add(otCode8);
                     otCodeList.add(otCode9);
-                    otCodeMap.put(otCode4,barCodeList[i]);
-                    otCodeMap.put(otCode5,barCodeList[i]);
-                    otCodeMap.put(otCode6,barCodeList[i]);
-                    otCodeMap.put(otCode7,barCodeList[i]);
-                    otCodeMap.put(otCode8,barCodeList[i]);
-                    otCodeMap.put(otCode9,barCodeList[i]);
+                    otCodeMap.put(otCode4, barCodeList[i]);
+                    otCodeMap.put(otCode5, barCodeList[i]);
+                    otCodeMap.put(otCode6, barCodeList[i]);
+                    otCodeMap.put(otCode7, barCodeList[i]);
+                    otCodeMap.put(otCode8, barCodeList[i]);
+                    otCodeMap.put(otCode9, barCodeList[i]);
                 }
                 allotCodeList.addAll(otCodeList);
                 barOtcodeMap.put(barCodeList[i], otCodeMap);
                 barCode241List.add(barCodeList[i]);
-            }else{
-                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�'));
+            } else {
+                ApexPages.addmessage(
+                    new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�')
+                );
                 continue;
             }
         }
         //01閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
-        Map<String,String> rightBar = new Map<String,String>();
-        if(alljanCodeList.size() > 0){
-            Map<String,String> exitBarCodeMap = new Map<String,String>();
-            List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
-                                            Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c,
-                                            Product_Type__c                                      
-                                                 FROM Product2__c
-                                                 WHERE Product2_Jancode__c in :alljanCodeList
-                                                 AND (not Product_Type__c like :userPro_Typestr)
-                                                 order by SFDA_Expiration_Date__c  desc ] ;
-            if(product2InStore.size() > 0){
-                Map<String,String> errorMap = new Map<String,String>();
-                for(Product2__c produ: product2InStore){
-                    for(String bar: barJancodeMap.keySet() ){
-                        if(barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)){
-                            exitBarCodeMap.put(bar,bar);
+        Map<String, String> rightBar = new Map<String, String>();
+        if (alljanCodeList.size() > 0) {
+            Map<String, String> exitBarCodeMap = new Map<String, String>();
+            List<Product2__c> product2InStore = [
+                SELECT
+                    Id,
+                    Name,
+                    Name__c,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    OT_CODE__c,
+                    Product2_Jancode__c,
+                    Pro2_Dealer_ENG__c,
+                    Pro2_Dealer_Object__c,
+                    Product_Type__c
+                FROM Product2__c
+                WHERE Product2_Jancode__c IN :alljanCodeList AND (NOT Product_Type__c LIKE :userPro_Typestr)
+                ORDER BY SFDA_Expiration_Date__c DESC
+            ];
+            if (product2InStore.size() > 0) {
+                Map<String, String> errorMap = new Map<String, String>();
+                for (Product2__c produ : product2InStore) {
+                    for (String bar : barJancodeMap.keySet()) {
+                        if (barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)) {
+                            exitBarCodeMap.put(bar, bar);
                             errorMap.put(bar, bar);
                         }
-
                     }
                 }
-                if(errorMap.size() > 0){
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇'));
+                if (errorMap.size() > 0) {
+                    ApexPages.addmessage(
+                        new ApexPages.message(
+                            ApexPages.severity.ERROR,
+                            'BarCode鍙穂' + errorMap.values() + ']浜у搧绫诲瀷[' + product_Type + ']涓庣敤鎴风殑绫诲瀷[' + userPro_Type + ']涓嶇'
+                        )
+                    );
                 }
-            }                                   
-            product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c,
-                                            Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c,
-                                            Product_Type__c                                      
-                                                 FROM Product2__c
-                                                 WHERE Product2_Jancode__c in :alljanCodeList
-                                                 AND Product_Type__c like :userPro_Typestr
-                                                 order by SFDA_Expiration_Date__c  desc ] ;
-            if(product2InStore.size() > 0){
-                Map<String,String> errorMap = new Map<String,String>();
-                for(Product2__c produ: product2InStore){
-                    for(String bar: barJancodeMap.keySet() ){
-                        if(barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)){
-                            exitBarCodeMap.put(bar,bar); 
-                            if(orderdetailMap.containsKey(produ.Id)){
-                                consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+            }
+            product2InStore = [
+                SELECT
+                    Id,
+                    Name,
+                    Name__c,
+                    Intra_Trade_List_RMB__c,
+                    Asset_Model_No__c,
+                    OT_CODE__c,
+                    Product2_Jancode__c,
+                    Pro2_Dealer_ENG__c,
+                    Pro2_Dealer_Object__c,
+                    Product_Type__c
+                FROM Product2__c
+                WHERE Product2_Jancode__c IN :alljanCodeList AND Product_Type__c LIKE :userPro_Typestr
+                ORDER BY SFDA_Expiration_Date__c DESC
+            ];
+            if (product2InStore.size() > 0) {
+                Map<String, String> errorMap = new Map<String, String>();
+                for (Product2__c produ : product2InStore) {
+                    for (String bar : barJancodeMap.keySet()) {
+                        if (barJancodeMap.get(bar).containsKey(produ.Product2_Jancode__c) && !rightBar.containsKey(bar)) {
+                            exitBarCodeMap.put(bar, bar);
+                            if (orderdetailMap.containsKey(produ.Id)) {
+                                consumableInventory.add(new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar)));
                                 rightBar.put(bar, bar);
-                            }else{
-                                consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodeinfoMap.get(bar)));
+                            } else {
+                                consumableInventory.add(new ConsumableorderdetailsInfo(produ, barcodeinfoMap.get(bar)));
                                 rightBar.put(bar, bar);
-                                list<String> overOrderBARcodeCunList = new list<String>();
-                                if(notEqualBARcodeCunMap.containsKey(produ.Id)){
+                                list<String> overOrderBARcodeCunList = new List<String>();
+                                if (notEqualBARcodeCunMap.containsKey(produ.Id)) {
                                     overOrderBARcodeCunList = notEqualBARcodeCunMap.get(produ.Id).clone();
                                     overOrderBARcodeCunList.add(bar);
-                                    notEqualBARcodeCunMap.put(produ.Id,overOrderBARcodeCunList);
-                                }else{
+                                    notEqualBARcodeCunMap.put(produ.Id, overOrderBARcodeCunList);
+                                } else {
                                     overOrderBARcodeCunList.add(bar);
-                                    notEqualBARcodeCunMap.put(produ.Id,overOrderBARcodeCunList);
+                                    notEqualBARcodeCunMap.put(produ.Id, overOrderBARcodeCunList);
                                 }
                             }
-                            
                         }
                     }
                 }
             }
-            for(String bartxt :barCode01List){
-               if(!exitBarCodeMap.containsKey(bartxt)){
-                  notInStorelist.add(bartxt);
-               }
+            for (String bartxt : barCode01List) {
+                if (!exitBarCodeMap.containsKey(bartxt)) {
+                    notInStorelist.add(bartxt);
+                }
             }
-            
         }
 
         //241閫氳繃妫�绱骇鍝佹槸鍚﹀瓨鍦�
-        if(allotCodeList.size() > 0){
-            Map<String,String> exitBarCodeMap = new Map<String,String>();
-            Map<String,String> errorMap = new Map<String,String>();
-            List<Product2__c> product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,
-                                            Pro2_Dealer_Object__c,Pro2_Dealer_ENG__c
-                                                     FROM Product2__c
-                                                     WHERE OT_CODE__c in :allotCodeList 
-                                                     AND (not Product_Type__c like :userPro_Typestr)] ;
-            if(product2InStore.size() > 0){
-                for(Product2__c produ: product2InStore){
-                    for(String bar: barOtcodeMap.keySet() ){
-                        if(barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)){
-                            exitBarCodeMap.put(bar,bar);
+        if (allotCodeList.size() > 0) {
+            Map<String, String> exitBarCodeMap = new Map<String, String>();
+            Map<String, String> errorMap = new Map<String, String>();
+            List<Product2__c> product2InStore = [
+                SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c, OT_CODE__c, Pro2_Dealer_Object__c, Pro2_Dealer_ENG__c
+                FROM Product2__c
+                WHERE OT_CODE__c IN :allotCodeList AND (NOT Product_Type__c LIKE :userPro_Typestr)
+            ];
+            if (product2InStore.size() > 0) {
+                for (Product2__c produ : product2InStore) {
+                    for (String bar : barOtcodeMap.keySet()) {
+                        if (barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)) {
+                            exitBarCodeMap.put(bar, bar);
                             errorMap.put(bar, bar);
                         }
                     }
                 }
             }
-            if(errorMap.size() > 0){
-                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇'));
+            if (errorMap.size() > 0) {
+                ApexPages.addmessage(
+                    new ApexPages.message(
+                        ApexPages.severity.ERROR,
+                        'BarCode鍙穂' + errorMap.values() + ']浜у搧绫诲瀷[' + product_Type + ']涓庣敤鎴穂' + userPro_Type + ']绫诲瀷涓嶇'
+                    )
+                );
             }
-            product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,
-                                            Pro2_Dealer_Object__c,Pro2_Dealer_ENG__c
-                                                     FROM Product2__c
-                                                     WHERE OT_CODE__c in :allotCodeList 
-                                                     AND Product_Type__c like :userPro_Typestr] ;
-            
-            if(product2InStore.size() > 0){
-                for(Product2__c produ: product2InStore){
-                    for(String bar: barOtcodeMap.keySet() ){
-                        Date expirationDate = null ;
+            product2InStore = [
+                SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c, OT_CODE__c, Pro2_Dealer_Object__c, Pro2_Dealer_ENG__c
+                FROM Product2__c
+                WHERE OT_CODE__c IN :allotCodeList AND Product_Type__c LIKE :userPro_Typestr
+            ];
+
+            if (product2InStore.size() > 0) {
+                for (Product2__c produ : product2InStore) {
+                    for (String bar : barOtcodeMap.keySet()) {
+                        Date expirationDate = null;
                         String serialNoorLotNo = '';
                         String tracingCode = '';
                         String productDateStr = '';
-                        Date productionDate = null ;
+                        Date productionDate = null;
                         String expirationDateStr = '';
                         Integer oTcodeLength = produ.OT_CODE__c.length();
 
-                        if(bar.length() >= oTcodeLength + 11){
-                            if( bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='11'){
-                                try{
-                                    productDateStr = '20' + bar.substring(oTcodeLength + 5,oTcodeLength + 7) + '-' + bar.substring(oTcodeLength + 7,oTcodeLength + 9) + '-01' ;
+                        if (bar.length() >= oTcodeLength + 11) {
+                            if (bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '11') {
+                                try {
+                                    productDateStr =
+                                        '20' +
+                                        bar.substring(oTcodeLength + 5, oTcodeLength + 7) +
+                                        '-' +
+                                        bar.substring(oTcodeLength + 7, oTcodeLength + 9) +
+                                        '-01';
                                     productionDate = Date.valueOf(productDateStr);
-                                }catch(Exception e){
-                                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'));
+                                } catch (Exception e) {
+                                    ApexPages.addmessage(
+                                        new ApexPages.message(
+                                            ApexPages.severity.ERROR,
+                                            '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'
+                                        )
+                                    );
                                     continue;
                                 }
-                                if(bar.length() >=oTcodeLength + 3 + 16){
+                                if (bar.length() >= oTcodeLength + 3 + 16) {
                                     //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode17' + bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10)));
-                                    if( bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='17'){
-                                        try{
-                                            if(bar.substring(oTcodeLength + 3 + 14,oTcodeLength + 3 + 16)=='00'){
-                                                expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 10,oTcodeLength + 3 + 12) + '-' + bar.substring(oTcodeLength + 3 + 12,oTcodeLength + 3 + 14) + '-' + '01' ;
+                                    if (bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '17') {
+                                        try {
+                                            if (bar.substring(oTcodeLength + 3 + 14, oTcodeLength + 3 + 16) == '00') {
+                                                expirationDateStr =
+                                                    '20' +
+                                                    bar.substring(oTcodeLength + 3 + 10, oTcodeLength + 3 + 12) +
+                                                    '-' +
+                                                    bar.substring(oTcodeLength + 3 + 12, oTcodeLength + 3 + 14) +
+                                                    '-' +
+                                                    '01';
                                                 expirationDate = Date.valueOf(expirationDateStr);
                                                 expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
-                                            }else{
-                                                expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 10,oTcodeLength + 3 + 12) + '-' + bar.substring(oTcodeLength + 3 + 12,oTcodeLength + 3 + 14) + '-' +bar.substring(oTcodeLength + 3 + 14,oTcodeLength + 3 + 16) ;
-                                            expirationDate = Date.valueOf(expirationDateStr);
+                                            } else {
+                                                expirationDateStr =
+                                                    '20' +
+                                                    bar.substring(oTcodeLength + 3 + 10, oTcodeLength + 3 + 12) +
+                                                    '-' +
+                                                    bar.substring(oTcodeLength + 3 + 12, oTcodeLength + 3 + 14) +
+                                                    '-' +
+                                                    bar.substring(oTcodeLength + 3 + 14, oTcodeLength + 3 + 16);
+                                                expirationDate = Date.valueOf(expirationDateStr);
                                             }
-                                        }catch(Exception e){
-                                            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+                                        } catch (Exception e) {
+                                            ApexPages.addmessage(
+                                                new ApexPages.message(
+                                                    ApexPages.severity.ERROR,
+                                                    '浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'
+                                                )
+                                            );
                                             continue;
                                         }
-                                        if(bar.length() >= oTcodeLength + 3 + 25){
-                                            if(bar.substring(oTcodeLength + 3 + 16,oTcodeLength + 3 + 18) =='10' || bar.substring(oTcodeLength + 3 + 16,oTcodeLength + 3 + 18) =='21'){
-                                                serialNoorLotNo = bar.substring(oTcodeLength + 3 + 18,bar.length() - 8) ;
+                                        if (bar.length() >= oTcodeLength + 3 + 25) {
+                                            if (
+                                                bar.substring(oTcodeLength + 3 + 16, oTcodeLength + 3 + 18) == '10' ||
+                                                bar.substring(oTcodeLength + 3 + 16, oTcodeLength + 3 + 18) == '21'
+                                            ) {
+                                                serialNoorLotNo = bar.substring(oTcodeLength + 3 + 18, bar.length() - 8);
                                                 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  'serialNoorLotNo' + serialNoorLotNo));
                                             }
                                         }
-                                    }else if(bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='10' || bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='21'){
-                                        serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10,bar.length() - 8) ;
+                                    } else if (
+                                        bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '10' ||
+                                        bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '21'
+                                    ) {
+                                        serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10, bar.length() - 8);
                                         //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,  'serialNoorLotNo' + serialNoorLotNo));
                                     }
                                 }
-                            }else if(bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='17'){
-                                try{
-                                    if(bar.substring(oTcodeLength + 3 + 6,oTcodeLength + 3 + 8)=='00'){
-                                        expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 2,oTcodeLength + 3 + 4) + '-' + bar.substring(oTcodeLength + 3 + 4,oTcodeLength + 3 + 6) + '-01';
+                            } else if (bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '17') {
+                                try {
+                                    if (bar.substring(oTcodeLength + 3 + 6, oTcodeLength + 3 + 8) == '00') {
+                                        expirationDateStr =
+                                            '20' +
+                                            bar.substring(oTcodeLength + 3 + 2, oTcodeLength + 3 + 4) +
+                                            '-' +
+                                            bar.substring(oTcodeLength + 3 + 4, oTcodeLength + 3 + 6) +
+                                            '-01';
                                         expirationDate = Date.valueOf(expirationDateStr);
                                         expirationDate = expirationDate.addMonths(1).toStartofMonth().addDays(-1);
-                                    }else{
-                                        expirationDateStr = '20' + bar.substring(oTcodeLength + 3 + 2,oTcodeLength + 3 + 4) + '-' + bar.substring(oTcodeLength + 3 + 4,oTcodeLength + 3 + 6) + '-' +bar.substring(oTcodeLength + 3 + 6,oTcodeLength + 3 + 8);
+                                    } else {
+                                        expirationDateStr =
+                                            '20' +
+                                            bar.substring(oTcodeLength + 3 + 2, oTcodeLength + 3 + 4) +
+                                            '-' +
+                                            bar.substring(oTcodeLength + 3 + 4, oTcodeLength + 3 + 6) +
+                                            '-' +
+                                            bar.substring(oTcodeLength + 3 + 6, oTcodeLength + 3 + 8);
                                         expirationDate = Date.valueOf(expirationDateStr);
                                     }
-                                }catch(Exception e){
-                                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'));
+                                } catch (Exception e) {
+                                    ApexPages.addmessage(
+                                        new ApexPages.message(
+                                            ApexPages.severity.ERROR,
+                                            '浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'
+                                        )
+                                    );
                                     continue;
                                 }
-                                if(bar.length() >=oTcodeLength + 20){
-                                    if(bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='10' || bar.substring(oTcodeLength + 3 + 8,oTcodeLength + 3 + 10) =='21'){
-                                        serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10,bar.length() - 8) ;
+                                if (bar.length() >= oTcodeLength + 20) {
+                                    if (
+                                        bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '10' ||
+                                        bar.substring(oTcodeLength + 3 + 8, oTcodeLength + 3 + 10) == '21'
+                                    ) {
+                                        serialNoorLotNo = bar.substring(oTcodeLength + 3 + 10, bar.length() - 8);
                                     }
                                 }
-
-                            }else if(bar.length() >= oTcodeLength + 12){
-                                if(bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='10' || bar.substring(oTcodeLength + 3,oTcodeLength + 5) =='21'){
-                                    serialNoorLotNo = bar.substring(oTcodeLength + 3 + 2,bar.length() - 8) ;
+                            } else if (bar.length() >= oTcodeLength + 12) {
+                                if (
+                                    bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '10' ||
+                                    bar.substring(oTcodeLength + 3, oTcodeLength + 5) == '21'
+                                ) {
+                                    serialNoorLotNo = bar.substring(oTcodeLength + 3 + 2, bar.length() - 8);
                                 }
                             }
                         }
-                        if(bar.length() >= oTcodeLength + 3 + 8 && bar.substring(bar.length() - 8,bar.length()-5)=='250'){
-                            if(bar.substring(bar.length() - 8,bar.length()-5)=='250'){
-                                tracingCode = bar.substring(bar.length() - 5,bar.length());
+                        if (bar.length() >= oTcodeLength + 3 + 8 && bar.substring(bar.length() - 8, bar.length() - 5) == '250') {
+                            if (bar.substring(bar.length() - 8, bar.length() - 5) == '250') {
+                                tracingCode = bar.substring(bar.length() - 5, bar.length());
                                 Matcher n = Pattern.compile('[0-9]').matcher(tracingCode);
-                                if(n.find()){
+                                if (n.find()) {
                                     String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��';
-                                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'));
+                                    ApexPages.addmessage(
+                                        new ApexPages.message(
+                                            ApexPages.severity.ERROR,
+                                            '浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�'
+                                        )
+                                    );
                                     continue;
                                 }
-                            }else{
-                                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'));
+                            } else {
+                                ApexPages.addmessage(
+                                    new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�')
+                                );
                                 continue;
                             }
                         }
@@ -2351,43 +3075,42 @@
                         barcodedetList.add(String.valueOf(expirationDate));
                         barcodedetList.add(serialNoorLotNo);
                         barcodedetList.add(tracingCode);
-                        if(barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)){
-                            exitBarCodeMap.put(bar,bar);
-                            
-                            if(orderdetailMap.containsKey(produ.Id)){
-                                consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodedetList));
-                            }else{
-                                consumableInventory.add(new ConsumableorderdetailsInfo(produ,barcodedetList));
-                                list<String> overOrderBARcodeCunList = new list<String>();
-                                if(notEqualBARcodeCunMap.containsKey(produ.Id)){
+                        if (barOtcodeMap.get(bar).containsKey(produ.OT_CODE__c)) {
+                            exitBarCodeMap.put(bar, bar);
+
+                            if (orderdetailMap.containsKey(produ.Id)) {
+                                consumableInventory.add(new ConsumableorderdetailsInfo(produ, barcodedetList));
+                            } else {
+                                consumableInventory.add(new ConsumableorderdetailsInfo(produ, barcodedetList));
+                                list<String> overOrderBARcodeCunList = new List<String>();
+                                if (notEqualBARcodeCunMap.containsKey(produ.Id)) {
                                     overOrderBARcodeCunList = notEqualBARcodeCunMap.get(produ.Id).clone();
                                     overOrderBARcodeCunList.add(bar);
-                                    notEqualBARcodeCunMap.put(produ.Id,overOrderBARcodeCunList);
-                                }else{
+                                    notEqualBARcodeCunMap.put(produ.Id, overOrderBARcodeCunList);
+                                } else {
                                     overOrderBARcodeCunList.add(bar);
-                                    notEqualBARcodeCunMap.put(produ.Id,overOrderBARcodeCunList);
+                                    notEqualBARcodeCunMap.put(produ.Id, overOrderBARcodeCunList);
                                 }
-                            } 
- 
+                            }
                         }
                     }
                 }
             }
 
-            for(String bartxt :barCode241List){
-               if(!exitBarCodeMap.containsKey(bartxt)){
-                    if(!errorMap.containsKey(bartxt)){
+            for (String bartxt : barCode241List) {
+                if (!exitBarCodeMap.containsKey(bartxt)) {
+                    if (!errorMap.containsKey(bartxt)) {
                         notInStorelist.add(bartxt);
                     }
-               }
+                }
             }
         }
         //鍒ゆ柇浜у搧鏄惁涓�鑷�
-        if(notEqualBARcodeCunMap.size() > 0){
-            for(String widget : notEqualBARcodeCunMap.keySet()) {
-                if(notEqualBARcodeCunMap.get(widget).size() >0){
+        if (notEqualBARcodeCunMap.size() > 0) {
+            for (String widget : notEqualBARcodeCunMap.keySet()) {
+                if (notEqualBARcodeCunMap.get(widget).size() > 0) {
                     ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '浠ヤ笅barcode浜у搧涓庤璐т骇鍝佷笉涓�鑷淬��'));
-                    for(String barcodeListTTT : (List<String>)notEqualBARcodeCunMap.get(widget)) {
+                    for (String barcodeListTTT : (List<String>) notEqualBARcodeCunMap.get(widget)) {
                         ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT));
                     }
                 }
@@ -2396,64 +3119,73 @@
     }
 
     public String ConfimResult() {
-        list<String> overOrderproList = new list<String>();
-        list<String> overOrderBARcodeCunList = new list<String>();
-        list<String> overOrderBARcodeCunListTest = new list<String>();
+        list<String> overOrderproList = new List<String>();
+        list<String> overOrderBARcodeCunList = new List<String>();
+        list<String> overOrderBARcodeCunListTest = new List<String>();
         //overOrderBARcodeCunMap.clear();
-        for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords)  {
-            if(orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Asset_Model_No__c) > orderProductCunMap.get(ass.esd.Asset_Model_No__c)-1){
+        for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords) {
+            if (
+                orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Asset_Model_No__c) >
+                orderProductCunMap.get(ass.esd.Asset_Model_No__c) - 1
+            ) {
                 // 鑾峰彇瓒呰繃瀹氳揣鏁伴噺鐨勬秷鑰楀搧淇℃伅
-                overOrderBARcodeCunList = new list<String>();
+                overOrderBARcodeCunList = new List<String>();
                 overOrderBARcodeCunList = overOrderBARcodeCunMap.get(ass.esd.Asset_Model_No__c).clone();
                 overOrderBARcodeCunList.add(ass.esd.Bar_Code__c);
-                overOrderBARcodeCunMap.put(ass.esd.Asset_Model_No__c,overOrderBARcodeCunList);
-                overOrderCunMap.put(ass.esd.Asset_Model_No__c,overOrderCunMap.get(ass.esd.Asset_Model_No__c)+1);
+                overOrderBARcodeCunMap.put(ass.esd.Asset_Model_No__c, overOrderBARcodeCunList);
+                overOrderCunMap.put(ass.esd.Asset_Model_No__c, overOrderCunMap.get(ass.esd.Asset_Model_No__c) + 1);
                 cancellationProList.add(ass.esd.Asset_Model_No__c);
-            }else if(orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Asset_Model_No__c) == orderProductCunMap.get(ass.esd.Asset_Model_No__c)-1){
+            } else if (
+                orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Asset_Model_No__c) ==
+                orderProductCunMap.get(ass.esd.Asset_Model_No__c) - 1
+            ) {
                 consumableorderdetailsRecordsUse.add(ass);
                 cancellationProList.add(ass.esd.Asset_Model_No__c);
-            }else{
+            } else {
                 consumableorderdetailsRecordsUse.add(ass);
             }
-            orderWantArriveCunMap.put(ass.esd.Asset_Model_No__c,orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c)+1);
+            orderWantArriveCunMap.put(ass.esd.Asset_Model_No__c, orderWantArriveCunMap.get(ass.esd.Asset_Model_No__c) + 1);
         }
-        for(ConsumableorderdetailsInfo ass : consumableInventory){
+        for (ConsumableorderdetailsInfo ass : consumableInventory) {
             if (!orderWantArriveCunMap.containsKey(ass.Prod.Asset_Model_No__c)) {
                 consumableInventoryUse.add(ass);
                 continue;
             }
-            if(orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.Prod.Asset_Model_No__c) > orderProductCunMap.get(ass.Prod.Asset_Model_No__c)-1){
-                
+            if (
+                orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.Prod.Asset_Model_No__c) >
+                orderProductCunMap.get(ass.Prod.Asset_Model_No__c) - 1
+            ) {
                 //鍙栧緱鍘熸湁list
-                overOrderBARcodeCunList = new list<String>();
+                overOrderBARcodeCunList = new List<String>();
                 overOrderBARcodeCunList = overOrderBARcodeCunMap.get(ass.Prod.Asset_Model_No__c).clone();
                 //鏇存柊list
                 overOrderBARcodeCunList.add(ass.barCodeNo);
                 //鏇存柊map
-                overOrderBARcodeCunMap.put(ass.Prod.Asset_Model_No__c,overOrderBARcodeCunList);
-                overOrderCunMap.put(ass.Prod.Asset_Model_No__c,overOrderCunMap.get(ass.Prod.Asset_Model_No__c)+1);
+                overOrderBARcodeCunMap.put(ass.Prod.Asset_Model_No__c, overOrderBARcodeCunList);
+                overOrderCunMap.put(ass.Prod.Asset_Model_No__c, overOrderCunMap.get(ass.Prod.Asset_Model_No__c) + 1);
                 cancellationProList.add(ass.Prod.Asset_Model_No__c);
-            }else if(orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.Prod.Asset_Model_No__c) == orderProductCunMap.get(ass.Prod.Asset_Model_No__c)-1){
-                
+            } else if (
+                orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.Prod.Asset_Model_No__c) ==
+                orderProductCunMap.get(ass.Prod.Asset_Model_No__c) - 1
+            ) {
                 consumableInventoryUse.add(ass);
                 cancellationProList.add(ass.Prod.Asset_Model_No__c);
-            }else{
+            } else {
                 consumableInventoryUse.add(ass);
             }
-            orderWantArriveCunMap.put(ass.Prod.Asset_Model_No__c,orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c)+1);
+            orderWantArriveCunMap.put(ass.Prod.Asset_Model_No__c, orderWantArriveCunMap.get(ass.Prod.Asset_Model_No__c) + 1);
         }
         for (Integer i = 0; i < productList.size(); i++) {
-            if(overOrderBARcodeCunMap.get(productList[i]).size() > 0){
+            if (overOrderBARcodeCunMap.get(productList[i]).size() > 0) {
                 // 鑾峰彇瓒呰繃瀹氳揣鏁伴噺鐨勬秷鑰楀搧淇℃伅
                 overOrderproList.add(productList[i]);
             }
         }
-        if(overOrderproList.size() > 0){
+        if (overOrderproList.size() > 0) {
             return '浜у搧' + overOrderproList + '鏈鍒拌揣鏁伴噺鍜屽凡鍒拌揣鏁伴噺宸茬粡瓒呰繃璁㈣揣鏁伴噺!';
-        }else{
+        } else {
             return '';
         }
-
     }
 
     public void confimResultWithoutOrder() {
@@ -2494,7 +3226,7 @@
         }*/
 
         //瑕佸埌璐т骇鍝佹暟閲�
-        for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords)  {
+        for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords) {
             /*if(orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c) + orderProductArrivedCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c) > orderProductCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)-1){
                 // 鑾峰彇瓒呰繃瀹氳揣鏁伴噺鐨勬秷鑰楀搧淇℃伅
                 overOrderproList.add('浜у搧' + ass.esd.Asset_Model_No__c + '鍦ㄨ鍗�' + ass.esd.Consumable_order_minor__r.Name + '涓秴杩囪璐ф暟閲�!\n');
@@ -2506,23 +3238,23 @@
                 consumableorderdetailsRecordsUse.add(ass);
                 orderWantArriveCunMap.put(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c,orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)+1);
             }else{*/
-                consumableorderdetailsRecordsUse.add(ass);
-            }
-            /*orderWantArriveCunMap.put(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c,orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)+1);
+            consumableorderdetailsRecordsUse.add(ass);
+        }
+        /*orderWantArriveCunMap.put(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c,orderWantArriveCunMap.get(ass.esd.Consumable_order_minor__c + ass.esd.Asset_Model_No__c)+1);
         }
         return overOrderproList;*/
     }
 
     // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
     // 铏氭嫙鐩樼偣鍗曟秷鑰楀搧鏄庣粏1鍒涘缓宸″洖
-    public void addInventoryDetails1(List<Consumable_order_details2__c> addList){
+    public void addInventoryDetails1(List<Consumable_order_details2__c> addList) {
         Map<String, List<Consumable_order_details2__c>> accountGroupMap = new Map<String, List<Consumable_order_details2__c>>();
-        Map<String, Map<Id, Integer>> productMap = new Map<String, Map<Id, Integer>> ();
-        List<Id> orderIdList = new List<Id> ();
+        Map<String, Map<Id, Integer>> productMap = new Map<String, Map<Id, Integer>>();
+        List<Id> orderIdList = new List<Id>();
         // 浠ョ粡閿�鍟嗗悕灏嗚鐢熸垚鍑哄簱鍗曠殑鏁版嵁鍒嗙粍
         for (Consumable_order_details2__c cod : addList) {
-            List<Consumable_order_details2__c> accGroupList = new List<Consumable_order_details2__c> ();
-            Map<Id, Integer> pNumMap = new Map<Id, Integer> ();
+            List<Consumable_order_details2__c> accGroupList = new List<Consumable_order_details2__c>();
+            Map<Id, Integer> pNumMap = new Map<Id, Integer>();
             Integer num = 1;
             if (accountGroupMap.containsKey(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c)) {
                 accGroupList = accountGroupMap.get(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c);
@@ -2531,16 +3263,20 @@
                     num = pNumMap.get(cod.Consumable_Product__c) + 1;
                 }
             }
-            orderIdList.add(cod.Consumable_Inventory_order__c); 
+            orderIdList.add(cod.Consumable_Inventory_order__c);
             pNumMap.put(cod.Consumable_Product__c, num);
             accGroupList.add(cod);
             productMap.put(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c, pNumMap);
             accountGroupMap.put(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c, accGroupList);
-            System.debug('======accGroupList'+accGroupList);
+            System.debug('======accGroupList' + accGroupList);
         }
-        
-        System.debug('======accountGroupMap'+accountGroupMap);
-        List<Consumable_order__c> orderList = [select Id, Name, Dealer_Info__r.Name, Order_Owner_WorkLocal__c from Consumable_order__c where id in : orderIdList];
+
+        System.debug('======accountGroupMap' + accountGroupMap);
+        List<Consumable_order__c> orderList = [
+            SELECT Id, Name, Dealer_Info__r.Name, Order_Owner_WorkLocal__c
+            FROM Consumable_order__c
+            WHERE id IN :orderIdList
+        ];
 
         // 鐢熸垚鍚勭粡閿�鍟嗗嚭搴撹鍗昄ist
         // List<Consumable_order__c> orderList = new List<Consumable_order__c> ();
@@ -2548,19 +3284,19 @@
         for (String acc : accountGroupMap.keySet()) {
             Consumable_order_details2__c arriveAccount = accountGroupMap.get(acc)[0];
             List<Consumable_order_details2__c> prodPriceList = accountGroupMap.get(acc);
-            Map<Id, Integer> pNumMap = new Map<Id, Integer> ();
+            Map<Id, Integer> pNumMap = new Map<Id, Integer>();
             pNumMap = productMap.get(acc);
-            List<Consumable_orderdetails__c> insDetail1 = New List<Consumable_orderdetails__c>();
+            List<Consumable_orderdetails__c> insDetail1 = new List<Consumable_orderdetails__c>();
             for (Id id : pNumMap.keySet()) {
                 Consumable_orderdetails__c ins = new Consumable_orderdetails__c();
-                
+
                 //InsAfterDel.Consumable_order__c = p.id;
                 ins.Product_Refind__c = pNumMap.get(id);
                 ins.inventory_sum__c = pNumMap.get(id);
                 ins.Consumable_Product__c = id;
                 for (Consumable_order_details2__c pri : prodPriceList) {
                     if (pri.Consumable_Product__c == id) {
-                        ins.Intra_Trade_List_RMB__c =pri.Intra_Trade_List_RMB__c;
+                        ins.Intra_Trade_List_RMB__c = pri.Intra_Trade_List_RMB__c;
                         break;
                     }
                 }
@@ -2575,11 +3311,11 @@
 
                 insDetail1.add(ins);
             }
-            System.debug('======insDetail1'+insDetail1);
+            System.debug('======insDetail1' + insDetail1);
             insDetail1Map.put(acc, insDetail1);
-            System.debug('======insDetail1Map'+insDetail1Map);
+            System.debug('======insDetail1Map' + insDetail1Map);
         }
-        List<Consumable_orderdetails__c> insDetail1List = new List<Consumable_orderdetails__c> ();
+        List<Consumable_orderdetails__c> insDetail1List = new List<Consumable_orderdetails__c>();
         for (Consumable_order__c setId : orderList) {
             // 鏄庣粏1
             List<Consumable_orderdetails__c> d1list = insDetail1Map.get(setId.Dealer_Info__r.Name + setId.Order_Owner_WorkLocal__c);
@@ -2587,24 +3323,23 @@
             for (Consumable_orderdetails__c dtl1 : d1list) {
                 String str = ('000' + i).right(4);
                 dtl1.Consumable_order__c = setId.Id;
-                dtl1.Name = setId.Name + '-'+ str;
+                dtl1.Name = setId.Name + '-' + str;
                 insDetail1List.add(dtl1);
             }
-        } 
-        System.debug('======insDetail1List'+insDetail1List);
+        }
+        System.debug('======insDetail1List' + insDetail1List);
         insert insDetail1List;
     }
     // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
 
-
     // 缁忛攢鍟嗙殑涓嶅悓宸ヤ綔鍦拌皟璐ц嚜鍔ㄧ敓鎴愬嚭搴撳崟
-    public void addSaleOrderAuto (List<Consumable_order_details2__c> addList) {
+    public void addSaleOrderAuto(List<Consumable_order_details2__c> addList) {
         Map<String, List<Consumable_order_details2__c>> accountGroupMap = new Map<String, List<Consumable_order_details2__c>>();
-        Map<String, Map<Id, Integer>> productMap = new Map<String, Map<Id, Integer>> ();
+        Map<String, Map<Id, Integer>> productMap = new Map<String, Map<Id, Integer>>();
         // 浠ョ粡閿�鍟嗗悕灏嗚鐢熸垚鍑哄簱鍗曠殑鏁版嵁鍒嗙粍
         for (Consumable_order_details2__c cod : addList) {
-            List<Consumable_order_details2__c> accGroupList = new List<Consumable_order_details2__c> ();
-            Map<Id, Integer> pNumMap = new Map<Id, Integer> ();
+            List<Consumable_order_details2__c> accGroupList = new List<Consumable_order_details2__c>();
+            Map<Id, Integer> pNumMap = new Map<Id, Integer>();
             Integer num = 1;
             if (accountGroupMap.containsKey(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c)) {
                 accGroupList = accountGroupMap.get(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c);
@@ -2612,7 +3347,7 @@
                 if (pNumMap.containsKey(cod.Consumable_Product__c)) {
                     num = pNumMap.get(cod.Consumable_Product__c) + 1;
                 }
-            } 
+            }
             pNumMap.put(cod.Consumable_Product__c, num);
             accGroupList.add(cod);
             productMap.put(cod.Dealer_Info_text__c + cod.Arrive_Owner_Work_Location__c, pNumMap);
@@ -2620,7 +3355,7 @@
         }
 
         // 鐢熸垚鍚勭粡閿�鍟嗗嚭搴撹鍗昄ist
-        List<Consumable_order__c> orderList = new List<Consumable_order__c> ();
+        List<Consumable_order__c> orderList = new List<Consumable_order__c>();
         Map<String, List<Consumable_orderdetails__c>> insDetail1Map = new Map<String, List<Consumable_orderdetails__c>>();
         for (String acc : accountGroupMap.keySet()) {
             Consumable_order_details2__c arriveAccount = accountGroupMap.get(acc)[0];
@@ -2635,22 +3370,22 @@
             autoOrder.RecordTypeid = System.Label.RT_ConOrder_Shipment;
             autoOrder.Outbound_Date__c = Date.today();
             autoOrder.Order_date__c = Date.today();
-            autoOrder.AutoShipment__c = TRUE;
+            autoOrder.AutoShipment__c = true;
             orderList.add(autoOrder);
 
             List<Consumable_order_details2__c> prodPriceList = accountGroupMap.get(acc);
-            Map<Id, Integer> pNumMap = new Map<Id, Integer> ();
+            Map<Id, Integer> pNumMap = new Map<Id, Integer>();
             pNumMap = productMap.get(acc);
-            List<Consumable_orderdetails__c> insDetail1 = New List<Consumable_orderdetails__c>();
+            List<Consumable_orderdetails__c> insDetail1 = new List<Consumable_orderdetails__c>();
             for (Id id : pNumMap.keySet()) {
                 Consumable_orderdetails__c ins = new Consumable_orderdetails__c();
-                
+
                 //InsAfterDel.Consumable_order__c = p.id;
                 ins.Shipment_Count__c = pNumMap.get(id);
                 ins.Consumable_Product__c = id;
                 for (Consumable_order_details2__c pri : prodPriceList) {
                     if (pri.Consumable_Product__c == id) {
-                        ins.Intra_Trade_List_RMB__c =pri.Intra_Trade_List_RMB__c;
+                        ins.Intra_Trade_List_RMB__c = pri.Intra_Trade_List_RMB__c;
                         break;
                     }
                 }
@@ -2669,17 +3404,17 @@
         }
         insert orderList;
 
-        List<Id> orderIdList = new List<Id> ();
+        List<Id> orderIdList = new List<Id>();
         for (Consumable_order__c co : orderList) {
             orderIdList.add(co.Id);
         }
 
-        orderList = new List<Consumable_order__c> ();
-        orderList = [select Id, Name, Dealer_Info__r.Name, Order_Owner_WorkLocal__c from Consumable_order__c where id in : orderIdList];
+        orderList = new List<Consumable_order__c>();
+        orderList = [SELECT Id, Name, Dealer_Info__r.Name, Order_Owner_WorkLocal__c FROM Consumable_order__c WHERE id IN :orderIdList];
 
         // 璁剧疆鏄庣粏1 鍜� 鏄庣粏2 鐨� 璁㈠崟ID
-        List<Consumable_orderdetails__c> insDetail1List = new List<Consumable_orderdetails__c> ();
-        List<Consumable_order_details2__c> updDetail2List = new List<Consumable_order_details2__c> ();
+        List<Consumable_orderdetails__c> insDetail1List = new List<Consumable_orderdetails__c>();
+        List<Consumable_order_details2__c> updDetail2List = new List<Consumable_order_details2__c>();
         for (Consumable_order__c setId : orderList) {
             // 鏄庣粏1
             List<Consumable_orderdetails__c> d1list = insDetail1Map.get(setId.Dealer_Info__r.Name + setId.Order_Owner_WorkLocal__c);
@@ -2690,7 +3425,7 @@
                 //     str = '0' + str;
                 // }
                 dtl1.Consumable_order__c = setId.Id;
-                dtl1.Name = setId.Name + '-'+ str;
+                dtl1.Name = setId.Name + '-' + str;
                 insDetail1List.add(dtl1);
             }
 
@@ -2724,146 +3459,156 @@
         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>();
+        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,'涓嶅瓨鍦ㄥ埌璐ф槑缁�'));
+        if (ConsumableorderdetailsRecords.size() < 1 && consumableInventory.size() < 1) {
+            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '涓嶅瓨鍦ㄥ埌璐ф槑缁�'));
             return null;
         }
-        if(EsetId != null && EsetId != ''){
+        if (EsetId != null && EsetId != '') {
             resultcheck = ConfimResult();
-            if(resultcheck.length() > 0){
-                for(String widget : overOrderBARcodeCunMap.keySet()) {
-                    if(overOrderBARcodeCunMap.get(widget).size() >0){
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '浜у搧' + widget + '鏈鍒拌揣鏁伴噺瓒呰繃' + overOrderBARcodeCunMap.get(widget).size() +'涓璐х殑鏁伴噺銆�'));
-                        for(String barcodeListTTT : (List<String>)overOrderBARcodeCunMap.get(widget)) {
+            if (resultcheck.length() > 0) {
+                for (String widget : overOrderBARcodeCunMap.keySet()) {
+                    if (overOrderBARcodeCunMap.get(widget).size() > 0) {
+                        ApexPages.addmessage(
+                            new ApexPages.message(
+                                ApexPages.severity.INFO,
+                                '浜у搧' + widget + '鏈鍒拌揣鏁伴噺瓒呰繃' + overOrderBARcodeCunMap.get(widget).size() + '涓璐х殑鏁伴噺銆�'
+                            )
+                        );
+                        for (String barcodeListTTT : (List<String>) overOrderBARcodeCunMap.get(widget)) {
                             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT));
                         }
                     }
                 }
             }
-        }else{
+        } else {
             confimResultWithoutOrder();
         }
-        try{
+        try {
             Consumable_order__c orderMain = new Consumable_order__c();
-            List<Consumable_order_details2__c> orderdetails = New List<Consumable_order_details2__c>();
+            List<Consumable_order_details2__c> orderdetails = new List<Consumable_order_details2__c>();
             //鍒拌揣姝g‘淇℃伅
-            orderMain.Name            = '*';
+            orderMain.Name = '*';
             orderMain.Order_status__c = '鎵瑰噯';
-            orderMain.Dealer_Info__c  = accountid;
+            orderMain.Dealer_Info__c = accountid;
             orderMain.Deliver_date__c = Date.today();
-            orderMain.Order_date__c   = Date.today();
-            orderMain.Order_type__c   = '鍒拌揣';
+            orderMain.Order_date__c = Date.today();
+            orderMain.Order_type__c = '鍒拌揣';
             orderMain.Order_ProType__c = userPro_Type;
-            if(EsetId != null && EsetId != ''){
+            if (EsetId != null && EsetId != '') {
                 orderMain.Arrive_Order__c = coc.Id;
             }
             orderMain.RecordTypeid = System.Label.RT_ConOrder_Arrive;
             insert orderMain;
 
-            List<Consumable_order__c> consumable_order = [SELECT Name FROM Consumable_order__c WHERE id =:orderMain.id];
+            List<Consumable_order__c> consumable_order = [SELECT Name FROM Consumable_order__c WHERE id = :orderMain.id];
             arriveId = orderMain.id;
-            Decimal arriveAmount =0;
-            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsUse)  {
+            Decimal arriveAmount = 0;
+            for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsUse) {
+                //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------1------'));
                 Consumable_order_details2__c insDetails = new Consumable_order_details2__c();
-                insDetails.Id                           = ass.esd.Id;
-                insDetails.Consumable_Arrived_order__c  = orderMain.id;
-                insDetails.Arrive_date__c               = Date.today();
-                insDetails.Bar_Code__c                  = ass.esd.Bar_Code__c;
-                insDetails.OwnerId                      = UserInfo.getUserId();
+                insDetails.Id = ass.esd.Id;
+                insDetails.Consumable_Arrived_order__c = orderMain.id;
+                insDetails.Arrive_date__c = Date.today();
+                insDetails.Bar_Code__c = ass.esd.Bar_Code__c;
+                insDetails.OwnerId = UserInfo.getUserId();
                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
                 if (orderdetails2trMap.containsKey(ass.esd.Bar_Code__c)) {
                     insDetails.Transfer_Time__c = ass.esd.Transfer_Time__c == null ? 1 : ass.esd.Transfer_Time__c;
                     insDetails.Agency_Transfer__c = true;
-                    insDetails.Frist_Transfer_Agency__c = ass.esd.Frist_Transfer_Agency__c == null ? ass.esd.Dealer_Info_text__c : ass.esd.Frist_Transfer_Agency__c;
+                    insDetails.Frist_Transfer_Agency__c = ass.esd.Frist_Transfer_Agency__c == null
+                        ? ass.esd.Dealer_Info_text__c
+                        : ass.esd.Frist_Transfer_Agency__c;
                 }
                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                 
+
                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
                 insDetails.Agencyinfo_fromSAP__c = ass.esd.Agencyinfo_fromSAP__c;
-                insDetails.Frist_Storage_Agency__c  = ass.esd.Frist_Storage_Agency__c == null ? ass.esd.Dealer_Info_text__c : ass.esd.Frist_Storage_Agency__c;
+                insDetails.Frist_Storage_Agency__c = ass.esd.Frist_Storage_Agency__c == null
+                    ? ass.esd.Dealer_Info_text__c
+                    : ass.esd.Frist_Storage_Agency__c;
                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
-                arriveAmount                            += ass.esd.Intra_Trade_List_RMB__c;
+                arriveAmount += ass.esd.Intra_Trade_List_RMB__c;
                 orderdetails.add(insDetails);
             }
             Integer i = 1;
-            for(ConsumableorderdetailsInfo ass : consumableInventoryUse){
+            for (ConsumableorderdetailsInfo ass : consumableInventoryUse) {
                 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------2------'));
                 Consumable_order_details2__c insAfterDel = new Consumable_order_details2__c();
                 String str = ('000' + i).right(4);
                 // if(str.length() == 1){
                 //     str = '0' + str;
                 // }
-                insAfterDel.Name                        = consumable_order[0].Name + '-'+ str;
-                insAfterDel.RecordTypeId                = System.Label.RT_ConOrderDetail2_Delivery;
-                // gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                // if(EsetId != null && EsetId != ''){
-                //     insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
-                // }else{
-                //     insAfterDel.Intra_Trade_List_RMB__c = 0;
-                // }
-                insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
-                //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                insAfterDel.Asset_Model_No__c           = ass.Prod.Asset_Model_No__c;
-                if(EsetId != null && EsetId != ''){
-                    insAfterDel.Consumable_order_minor__c   = ESetId;
+                insAfterDel.Name = consumable_order[0].Name + '-' + str;
+                insAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+                if (EsetId != null && EsetId != '') {
+                    insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+                } else {
+                    insAfterDel.Intra_Trade_List_RMB__c = 0;
                 }
-                insAfterDel.Deliver_date__c             = Date.today();
-                insAfterDel.Direct_Arrive_Product__c    = true;
+                insAfterDel.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
+                if (EsetId != null && EsetId != '') {
+                    insAfterDel.Consumable_order_minor__c = ESetId;
+                }
+                insAfterDel.Deliver_date__c = Date.today();
+                insAfterDel.Direct_Arrive_Product__c = true;
                 //TODO寰呯‘璁�
-                insAfterDel.Sterilization_limit__c      = ass.sterilizationlimitDate;
-                insAfterDel.Consumable_Product__c       = ass.Prod.id;
-                insAfterDel.Bar_Code__c                 = ass.barCodeNo;
-                insAfterDel.Used_account__c             = accountid;
+                insAfterDel.Sterilization_limit__c = ass.sterilizationlimitDate;
+                insAfterDel.Consumable_Product__c = ass.Prod.id;
+                insAfterDel.Bar_Code__c = ass.barCodeNo;
+                insAfterDel.Used_account__c = accountid;
                 //TODO寰呯‘璁�
-                insAfterDel.SerialLotNo__c              = ass.serialNoorLotNo;
-                insAfterDel.TracingCode__c              = ass.tracingCodeNo;
+                insAfterDel.SerialLotNo__c = ass.serialNoorLotNo;
+                insAfterDel.TracingCode__c = ass.tracingCodeNo;
 
                 //insAfterDel.Dealer_Arrive__c                = true;
                 insAfterDel.Consumable_Arrived_order__c = orderMain.id;
-                insAfterDel.Arrive_date__c              = Date.today();
-                insAfterDel.OwnerId                      = UserInfo.getUserId();
+                insAfterDel.Arrive_date__c = Date.today();
+                insAfterDel.OwnerId = UserInfo.getUserId();
                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
                 if (orderdetails2trMap.containsKey(ass.esd.Bar_Code__c)) {
                     insAfterDel.Transfer_Time__c = ass.esd.Transfer_Time__c == null ? 1 : ass.esd.Transfer_Time__c;
                     insAfterDel.Agency_Transfer__c = true;
-                    insAfterDel.Frist_Transfer_Agency__c = ass.esd.Frist_Transfer_Agency__c == null ? accountName : ass.esd.Frist_Transfer_Agency__c;
+                    insAfterDel.Frist_Transfer_Agency__c = ass.esd.Frist_Transfer_Agency__c == null
+                        ? accountName
+                        : ass.esd.Frist_Transfer_Agency__c;
                 }
                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                 
+
                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
                 insAfterDel.Agencyinfo_fromSAP__c = ass.esd.Agencyinfo_fromSAP__c;
-                insAfterDel.Frist_Storage_Agency__c  = ass.esd.Frist_Storage_Agency__c == null ? accountName : ass.esd.Frist_Storage_Agency__c;
+                insAfterDel.Frist_Storage_Agency__c = ass.esd.Frist_Storage_Agency__c == null
+                    ? accountName
+                    : ass.esd.Frist_Storage_Agency__c;
                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� 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*/;
                 // tcm start
                 if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
-                    insAfterDel.ContractNo_text__c= ass.esd.ContractNo_text__c;
-                }else {
-                    insAfterDel.ContractNo_text__c= ass.esd.Consumable_order_minor__r.ContractNo__c;
+                    insAfterDel.ContractNo_text__c = ass.esd.ContractNo_text__c;
+                } else {
+                    insAfterDel.ContractNo_text__c = ass.esd.Consumable_order_minor__r.ContractNo__c;
                 }
                 // tcm end
                 //add by rentx 2020-10-14 end
                 i++;
 
                 ins.add(insAfterDel);
-
             }
             orderMain.Arrive_total_amount__c = arriveAmount;
             update orderMain;
             List<Consumable_order_details2__c> updateconsumableorderdetails2 = new List<Consumable_order_details2__c>();
             //鏇存柊鏄庣粏鍙栨秷鏃堕棿 => 鏈埌璐у彇娑堬紝鍒拌揣鑷姩鐢熸垚鍑哄簱娴佺▼
-            List<Consumable_order_details2__c> addSaleOrderList = new List<Consumable_order_details2__c> ();
-            for(Consumable_order_details2__c Cod : consumableorderdetails2Cancle){
+            List<Consumable_order_details2__c> addSaleOrderList = new List<Consumable_order_details2__c>();
+            for (Consumable_order_details2__c Cod : consumableorderdetails2Cancle) {
                 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------3------'));
                 if (Cod.Dealer_Arrive__c) {
-                    if (Cod.Dealer_Shipment__c == FALSE && Cod.Dealer_Saled__c == FALSE) {
+                    if (Cod.Dealer_Shipment__c == false && Cod.Dealer_Saled__c == false) {
                         addSaleOrderList.add(Cod);
                     }
                 } else {
@@ -2877,22 +3622,23 @@
                 addSaleOrderAuto(addSaleOrderList);
             }
 
-            if(updateconsumableorderdetails2.size() > 0){
+            if (updateconsumableorderdetails2.size() > 0) {
                 update updateconsumableorderdetails2;
             }
+
             List<Consumable_order_details2__c> insertconsumableorderdetails2 = new List<Consumable_order_details2__c>();
-            for(Consumable_order_details2__c Cod2 : consumableorderdetails2Insert){
+            for (Consumable_order_details2__c Cod2 : consumableorderdetails2Insert) {
                 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4------'));
                 String str = ('000' + i).right(4);
                 // if(str.length() == 1){
                 //     str = '0' + str;
                 // }
-                Cod2.Name                        = consumable_order[0].Name + '-'+ str;
-                Cod2.Consumable_order_minor__c   = null;
-                Cod2.Deliver_date__c             = Date.today();
-                Cod2.Used_account__c             = accountid;
+                Cod2.Name = consumable_order[0].Name + '-' + str;
+                Cod2.Consumable_order_minor__c = null;
+                Cod2.Deliver_date__c = Date.today();
+                Cod2.Used_account__c = accountid;
                 Cod2.Consumable_Arrived_order__c = orderMain.id;
-                Cod2.Arrive_date__c              = Date.today();
+                Cod2.Arrive_date__c = Date.today();
                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
                 if (orderdetails2trMap.containsKey(Cod2.Bar_Code__c)) {
                     //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4++++++' + Cod2.Frist_Storage_Agency__c));
@@ -2901,236 +3647,268 @@
                     Cod2.Frist_Transfer_Agency__c = Cod2.Frist_Transfer_Agency__c == null ? accountName : Cod2.Frist_Transfer_Agency__c;
                 }
                 // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
-                 
+
                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
-                Cod2.Agencyinfo_fromSAP__c        = Cod2.Agencyinfo_fromSAP__c;
+                Cod2.Agencyinfo_fromSAP__c = Cod2.Agencyinfo_fromSAP__c;
                 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4------' + Cod2.Frist_Storage_Agency__c));
-                Cod2.Frist_Storage_Agency__c      = Cod2.Frist_Storage_Agency__c == null ? accountName : Cod2.Frist_Storage_Agency__c;
+                Cod2.Frist_Storage_Agency__c = Cod2.Frist_Storage_Agency__c == null ? accountName : Cod2.Frist_Storage_Agency__c;
                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
                 insertconsumableorderdetails2.add(Cod2);
                 i++;
             }
 
-            // return null;
+            //return null;
 
-            if(insertconsumableorderdetails2.size() >0){
+            if (insertconsumableorderdetails2.size() > 0) {
                 insert insertconsumableorderdetails2;
             }
 
-            if(ins.size()>0){
+            if (ins.size() > 0) {
                 insert ins;
             }
-            if(orderdetails.size()>0){
+            if (orderdetails.size() > 0) {
                 ControllerUtil.updateOrderDetailsSatus(orderdetails);
             }
             //瓒呭嚭鍒拌揣鏁伴噺浜у搧鍙栨秷鏃ユ湡鏇存柊
             List<Consumable_order_details2__c> needcanceldet = new List<Consumable_order_details2__c>();
-            if(cancellationProList.size() > 0){
-                needcanceldet = [SELECT Id,
-                                    Cancellation_Date__c
-                                FROM Consumable_order_details2__c
-                                WHERE Asset_Model_No__c in :cancellationProList
-                                AND Consumable_order_minor__c = :ESetId
-                                AND Dealer_Arrive__c = FALSE
-                                AND Cancellation_Date__c = null ];
-                if(needcanceldet.size() >0){
-                    for(Integer a = 0; a < needcanceldet.size(); a++){
+            if (cancellationProList.size() > 0) {
+                needcanceldet = [
+                    SELECT Id, Cancellation_Date__c
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        Asset_Model_No__c IN :cancellationProList
+                        AND Consumable_order_minor__c = :ESetId
+                        AND Dealer_Arrive__c = FALSE
+                        AND Cancellation_Date__c = NULL
+                ];
+                if (needcanceldet.size() > 0) {
+                    for (Integer a = 0; a < needcanceldet.size(); a++) {
                         needcanceldet[a].Cancellation_Date__c = Date.today();
                         needcanceldet[a].Cancellation_Flag__c = true;
                     }
                     ControllerUtil.updateOrderDetailsSatus(needcanceldet);
                 }
             }
-            List<Consumable_order__c> qs = New List<Consumable_order__c>();
-            qs = [SELECT Id,Name,Order_status__c,Dealer_Info__c,Deliver_date__c,ReturnGs_Upload_Date__c,
-                        Order_Reason__c,Order_date__c,
-                        Contract_application_decision__c,Order_type__c,Total_num__c,
-                        OrderNumber_arrived__c,Delivery_detail_count__c,OrderNumber_notarrive__c
-                    FROM Consumable_order__c
-                    WHERE Id =:ESetId
-                    AND Dealer_Info__c = :accountid];
-            if (qs.size()>0){
+            List<Consumable_order__c> qs = new List<Consumable_order__c>();
+            qs = [
+                SELECT
+                    Id,
+                    Name,
+                    Order_status__c,
+                    Dealer_Info__c,
+                    Deliver_date__c,
+                    ReturnGs_Upload_Date__c,
+                    Order_Reason__c,
+                    Order_date__c,
+                    Contract_application_decision__c,
+                    Order_type__c,
+                    Total_num__c,
+                    OrderNumber_arrived__c,
+                    Delivery_detail_count__c,
+                    OrderNumber_notarrive__c
+                FROM Consumable_order__c
+                WHERE Id = :ESetId AND Dealer_Info__c = :accountid
+            ];
+            if (qs.size() > 0) {
                 coc = qs[0];
             }
             saveFLGbln = true;
             alertMessage = '鍒拌揣瀹屾垚銆�';
             // Integer a = 1/0;
-        }catch(Exception e){
+        } catch (Exception e) {
             Database.rollback(sp);
             ApexPages.addMessages(e);
             return null;
         }
-        if(resultcheck.length() > 0){
+        if (resultcheck.length() > 0) {
             return null;
-        }else if(resultcheckWithoutOrder.size() >0){
+        } else if (resultcheckWithoutOrder.size() > 0) {
             return null;
-        } else{
+        } else {
             return UnabletoEdit();
             // return null;
         }
     }
-    
+
     // 杩斿搧妫�鏌ワ紝鍚庡洖搴�
-    public integer GoodsReturnCheck(){
-        List<String> GrListIn  =   ParseBarCode(   barcode );
+    public integer GoodsReturnCheck() {
+        List<String> GrListIn = ParseBarCode(barcode);
         GrList = new List<String>();
-        Map<String,String>  CheckBarcodeResult  =   new Map<String,String>();
-        for(    String  Str :   GrListIn  ){
-            CheckBarcodeResult.put( str , 'UnFind');
+        Map<String, String> CheckBarcodeResult = new Map<String, String>();
+        for (String Str : GrListIn) {
+            CheckBarcodeResult.put(str, 'UnFind');
         }
-        List<Consumable_order_details2__c>   BarcodeRetrunResult =
-                 [  SELECT  Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c,
-                            Consumable_Product__c,Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__c,
-                            Sterilization_limit__c,Deliver_date__c,Bar_Code__c,
-                            Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name,
-                            Consumable_order_minor__c,Dealer_Arrive__c,
-                            Guarantee_period_for_products__c,CFDA_Status__c,
-                            ProductPacking_list_manual__c,Report_Product_Approbation__c,
-                            Report_Product_Expiration__c,Box_Piece__c, Rrturn_count__c,
-                            Product_Type__c
-                            //add by rentx 2020-10-14 start
-                            ,ContractNo_text__c/*,ContractNo__c*/
-                            // tcm start
-                            ,Consumable_order_minor__r.ContractNo__c
-                            // tcm end
-                            //add by rentx 2020-10-14 end
-                    FROM    Consumable_order_details2__c
-                    WHERE   ((Dealer_Arrive__c = true
-                            AND(  Dealer_Shipment__c = true
-                                    //AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣')
-                                  or  Dealer_Saled__c = true
-                                )
-                            ))
-                    AND     Dealer_Info_text__c = :accountName
-                    AND     Bar_Code__c in :GrListIn
-                    AND     ( not Product_Type__c  like :userPro_Typestr)
-                    AND     Dealer_Returned__c = false
-                    AND     Arrive_Owner_Work_Location__c =: userWorkLocation
-                    ORDER BY Box_Piece__c desc,Name ];
-        if(BarcodeRetrunResult.size()>0){
+        List<Consumable_order_details2__c> BarcodeRetrunResult = [
+            SELECT
+                Id,
+                Name,
+                Intra_Trade_List_RMB__c,
+                Asset_Model_No__c,
+                Consumable_Product__c,
+                Consumable_Product__r.Name,
+                Consumable_Product__r.Name__c,
+                Consumable_Product__r.Asset_Model_No__c,
+                Sterilization_limit__c,
+                Deliver_date__c,
+                Bar_Code__c,
+                Arrive_date__c,
+                Send_Date__c,
+                Consumable_order_minor__r.Name,
+                Consumable_order_minor__c,
+                Dealer_Arrive__c,
+                Guarantee_period_for_products__c,
+                CFDA_Status__c,
+                ProductPacking_list_manual__c,
+                Report_Product_Approbation__c,
+                Report_Product_Expiration__c,
+                Box_Piece__c,
+                Rrturn_count__c,
+                Product_Type__c,
+                //add by rentx 2020-10-14 start
+                ContractNo_text__c /*,ContractNo__c*/,
+                // tcm start
+                Consumable_order_minor__r.ContractNo__c
+            // tcm end
+            //add by rentx 2020-10-14 end
+            FROM Consumable_order_details2__c
+            WHERE
+                Dealer_Arrive__c = TRUE
+                AND (Dealer_Shipment__c = TRUE
+                //AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣')
+                OR Dealer_Saled__c = TRUE)
+                AND Dealer_Info_text__c = :accountName
+                AND Bar_Code__c IN :GrListIn
+                AND (NOT Product_Type__c LIKE :userPro_Typestr)
+                AND Dealer_Returned__c = FALSE
+                AND Arrive_Owner_Work_Location__c = :userWorkLocation
+            ORDER BY Box_Piece__c DESC, Name
+        ];
+        if (BarcodeRetrunResult.size() > 0) {
             for (Integer i = 0; i < BarcodeRetrunResult.size(); i++) {
-                if(ErrorIdMap.containsKey(BarcodeRetrunResult[i].Bar_Code__c) || ExistIdMap.containsKey(BarcodeRetrunResult[i].Bar_Code__c)){
+                if (
+                    ErrorIdMap.containsKey(BarcodeRetrunResult[i].Bar_Code__c) || ExistIdMap.containsKey(BarcodeRetrunResult[i].Bar_Code__c)
+                ) {
                     // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                     continue;
-                }else{
-                    String str = '浜у搧绫诲瀷['+BarcodeRetrunResult[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇';
-                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(BarcodeRetrunResult[i],str));
-                    ErrorIdMap.put(BarcodeRetrunResult[i].Bar_Code__c,BarcodeRetrunResult[i].Bar_Code__c);
+                } else {
+                    String str = '浜у搧绫诲瀷[' + BarcodeRetrunResult[i].Product_Type__c + ']涓庣敤鎴风殑绫诲瀷[' + userPro_Type + ']涓嶇';
+                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(BarcodeRetrunResult[i], str));
+                    ErrorIdMap.put(BarcodeRetrunResult[i].Bar_Code__c, BarcodeRetrunResult[i].Bar_Code__c);
                 }
             }
         }
         AllMap.putAll(ErrorIdMap);
-        BarcodeRetrunResult =
-                 [  SELECT  Id,
-                            Consumable_order_minor__c,
-                            Deliver_date__c,
-                            Asset_Model_No__c,
-                            Consumable_Product__c,
-                            Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,
-                            Name,
-                            Bar_Code__c,
-                            Arrive_date__c,
-                            Dealer_Shipment__c,
-                            Lose_Flag__c,
-                            Dealer_Saled__c,
-                            Return_reason__c,
-                            Consumable_Shipment_order__c,
-                            Consumable_Shipment_order__r.Name,
-                            Send_date__c,
-                            Consumable_Sale_order__c,
-                            Consumable_Sale_order__r.Name,
-                            Used_date__c,
-                            SerialLotNo__c,
-                            TracingCode__c,
-                            Sterilization_limit__c,
-                            Consumable_ZS_order__c,
-                            Consumable_ZS_order__r.Name,
-                            Product_OutDate__c,
-                            Invoice_Date__c,
-                            recordtypeid,
-                            Consumable_Arrived_order__c,
-                            Box_Piece__c,
-                            Rrturn_count__c,
-                            Intra_Trade_List_RMB__c,
-                            OwnerId,
-                            SummonsForDirction_det__c,
-                            Order_Dealer_Info__c,
-                            HospItal_Name__c,
-                            Agencyinfo_fromSAP__c,
-                            Frist_Storage_Agency__c,
-                            Dealer_Info_text__c,
-                            Used_account__c,
-                            Transfer_Time__c,
-                            Frist_Transfer_Agency__c,
-                            Arrive_Owner_Work_Location__c,
-                            Agency_Transfer__c
-                            //add by rentx 2020-10-14 start
-                            ,ContractNo_text__c/*,ContractNo__c*/
-                            // tcm start
-                            ,Consumable_order_minor__r.ContractNo__c
-                            // tcm end
-                            //add by rentx 2020-10-14 end
-                            ,Report_Product_Expiration__c 
-                            ,Intra_Trade_List__c
-                    FROM    Consumable_order_details2__c
-                    WHERE   ((Dealer_Arrive__c = true
-                            AND(  Dealer_Shipment__c = true
-                                    //AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣')
-                                  or  Dealer_Saled__c = true
-                                  // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                                  or (Dealer_Shipment__c = false and Dealer_Saled__c = false and Lose_Flag__c = true)
-                                  // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-                                )
-                            ))
-                    AND     Dealer_Info_text__c = :accountName
-                    AND     Bar_Code__c in :GrListIn
-                    AND     Product_Type__c  like :userPro_Typestr 
-                    AND     Dealer_Returned__c = false
-                    AND     (Arrive_Owner_Work_Location__c =: userWorkLocation
-                        OR OwnerId = :System.Label.User_OlympusSystem)
-                    ORDER BY Box_Piece__c desc,Name ];
-        ShowGoodsofReturnList   =   new List<ConsumableorderdetailsInfo>();
+        BarcodeRetrunResult = [
+            SELECT
+                Id,
+                Consumable_order_minor__c,
+                Deliver_date__c,
+                Asset_Model_No__c,
+                Consumable_Product__c,
+                Consumable_Product__r.Name,
+                Consumable_Product__r.Name__c,
+                Name,
+                Bar_Code__c,
+                Arrive_date__c,
+                Dealer_Shipment__c,
+                Lose_Flag__c,
+                Dealer_Saled__c,
+                Return_reason__c,
+                Consumable_Shipment_order__c,
+                Consumable_Shipment_order__r.Name,
+                Send_date__c,
+                Consumable_Sale_order__c,
+                Consumable_Sale_order__r.Name,
+                Used_date__c,
+                SerialLotNo__c,
+                TracingCode__c,
+                Sterilization_limit__c,
+                Consumable_ZS_order__c,
+                Consumable_ZS_order__r.Name,
+                Product_OutDate__c,
+                Invoice_Date__c,
+                recordtypeid,
+                Consumable_Arrived_order__c,
+                Box_Piece__c,
+                Rrturn_count__c,
+                Intra_Trade_List_RMB__c,
+                OwnerId,
+                SummonsForDirction_det__c,
+                Order_Dealer_Info__c,
+                HospItal_Name__c,
+                Agencyinfo_fromSAP__c,
+                Frist_Storage_Agency__c,
+                Dealer_Info_text__c,
+                Used_account__c,
+                Transfer_Time__c,
+                Frist_Transfer_Agency__c,
+                Arrive_Owner_Work_Location__c,
+                Agency_Transfer__c,
+                //add by rentx 2020-10-14 start
+                ContractNo_text__c /*,ContractNo__c*/,
+                // tcm start
+                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
+                //AND Consumable_Shipment_order__r.SummonsForDirction__c != '浜掔浉璋冭揣')
+                OR Dealer_Saled__c = TRUE
+                // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+                OR (Dealer_Shipment__c = FALSE
+                AND Dealer_Saled__c = FALSE
+                AND Lose_Flag__c = TRUE))
+                // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+                AND Dealer_Info_text__c = :accountName
+                AND Bar_Code__c IN :GrListIn
+                AND Product_Type__c LIKE :userPro_Typestr
+                AND Dealer_Returned__c = FALSE
+                AND (Arrive_Owner_Work_Location__c = :userWorkLocation
+                OR OwnerId = :System.Label.User_OlympusSystem)
+            ORDER BY Box_Piece__c DESC, Name
+        ];
+        ShowGoodsofReturnList = new List<ConsumableorderdetailsInfo>();
 
         //杩斿搧鏃秈stinct澶勭悊
-        if(ArrType=='ReG'){
+        if (ArrType == 'ReG') {
             BarcodeRetrunResult = getDistinctZSOrder(BarcodeRetrunResult);
         }
 
-        for(    Consumable_order_details2__c codc    :   BarcodeRetrunResult ){
-            if(ErrorIdMap.containsKey(codc.Bar_Code__c) || ExistIdMap.containsKey(codc.Bar_Code__c)){
+        for (Consumable_order_details2__c codc : BarcodeRetrunResult) {
+            if (ErrorIdMap.containsKey(codc.Bar_Code__c) || ExistIdMap.containsKey(codc.Bar_Code__c)) {
                 // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏
                 continue;
-            }else{
-
+            } else {
                 Matcher n = Pattern.compile('[0-9]').matcher(codc.TracingCode__c);
-                if(n.find()){
+                if (n.find()) {
                     String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
-                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(codc,str));
-                    ErrorIdMap.put(codc.Bar_Code__c,codc.Bar_Code__c);
+                    ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(codc, str));
+                    ErrorIdMap.put(codc.Bar_Code__c, codc.Bar_Code__c);
                     continue;
                 }
-                if( CheckBarcodeResult.containsKey( codc.Bar_Code__c    )){
+                if (CheckBarcodeResult.containsKey(codc.Bar_Code__c)) {
                     GrList.add(codc.Bar_Code__c);
-                    if( codc.Dealer_Shipment__c ==  true){
-                        CheckBarcodeResult.put( codc.Bar_Code__c,   '宸插嚭搴�'   );
-                        ShowGoodsofReturnList.add(  new ConsumableorderdetailsInfo( codc    )   );
+                    if (codc.Dealer_Shipment__c == true) {
+                        CheckBarcodeResult.put(codc.Bar_Code__c, '宸插嚭搴�');
+                        ShowGoodsofReturnList.add(new ConsumableorderdetailsInfo(codc));
                     }
                     // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
                     // else{
                     //     CheckBarcodeResult.put( codc.Bar_Code__c, '宸查攢鍞�');
                     //     ShowGoodsofReturnList.add(  new ConsumableorderdetailsInfo( codc    )   );
                     // }
-                    else if( codc.Dealer_Saled__c == true ){
-                        CheckBarcodeResult.put( codc.Bar_Code__c, '宸查攢鍞�');
-                        ShowGoodsofReturnList.add(  new ConsumableorderdetailsInfo( codc    )   );
-                    }else{
-                        CheckBarcodeResult.put( codc.Bar_Code__c, '宸蹭涪澶�');
-                        ShowGoodsofReturnList.add(  new ConsumableorderdetailsInfo( codc    )   );
+                    else if (codc.Dealer_Saled__c == true) {
+                        CheckBarcodeResult.put(codc.Bar_Code__c, '宸查攢鍞�');
+                        ShowGoodsofReturnList.add(new ConsumableorderdetailsInfo(codc));
+                    } else {
+                        CheckBarcodeResult.put(codc.Bar_Code__c, '宸蹭涪澶�');
+                        ShowGoodsofReturnList.add(new ConsumableorderdetailsInfo(codc));
                     }
                     // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-                }else{
+                } else {
                     continue;
                 }
             }
@@ -3140,113 +3918,124 @@
     }
 
     // 鍗曚綅涓轰釜鐨凚arcode瀵瑰簲鐨勫嚭搴撳崟
-    public integer Getconsumableorderdetails2Nobox(){
+    public integer Getconsumableorderdetails2Nobox() {
         consumableorderdetails2Nobox = new List<Consumable_order_details2__c>();
         BarcodeCntMap.clear();
-        consumableorderdetails2Nobox =
-                 [  SELECT  Id,
-                            Consumable_order_minor__c,
-                            Deliver_date__c,
-                            Asset_Model_No__c,
-                            Consumable_Product__c,
-                            Consumable_Product__r.Name,
-                            Consumable_Product__r.Name__c,
-                            Name,
-                            Bar_Code__c,
-                            Arrive_date__c,
-                            Dealer_Shipment__c,
-                            Dealer_Saled__c,
-                            Return_reason__c,
-                            Consumable_Shipment_order__c,
-                            Send_date__c,
-                            Consumable_Sale_order__c,
-                            Used_date__c,
-                            SerialLotNo__c,
-                            TracingCode__c,
-                            Sterilization_limit__c,
-                            Consumable_ZS_order__c,
-                            Consumable_ZS_order__r.Name,
-                            Product_OutDate__c,
-                            Invoice_Date__c,
-                            recordtypeid,
-                            Consumable_Arrived_order__c,
-                            Box_Piece__c,
-                            RemoveBox_No__c,
-                            RemoveBox_date__c,
-                            Rrturn_count__c,
-                            Dealer_Info_text__c,
-                            Arrive_Owner_Work_Location__c,
-                            Intra_Trade_List_RMB__c
-                            //add by rentx 2020-10-13 start 杩斿搧鏃� 鏂版暟鎹褰昐AP鍚堝悓鍙�
-                            ,ContractNo_text__c/*,ContractNo__c*/
-                             // tcm start
-                             ,Consumable_order_minor__r.ContractNo__c
-                             // tcm end
-                            ,Report_Product_Expiration__c
-                            //add by rentx 2020-10-13 end
-                            ,Intra_Trade_List__c
-                            //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                    FROM    Consumable_order_details2__c
-                    WHERE
-                            // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                            // (Dealer_Shipment__c = true or Dealer_Saled__c =  true)
-                            (Dealer_Shipment__c = true or Dealer_Saled__c =  true or (Dealer_Shipment__c = false and Dealer_Saled__c = false and Lose_Flag__c = true))
-                            // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-                    AND     Dealer_Info_text__c = :accountName
-                    AND     Bar_Code__c in :noboxBarcodeList
-                    AND     Arrive_Owner_Work_Location__c =: userWorkLocation
-                    AND     Dealer_Returned__c = false
-                    AND     Box_Piece__c = '涓�'
-                    ORDER BY Consumable_ZS_order__c,RemoveBox_No__c];
+        consumableorderdetails2Nobox = [
+            SELECT
+                Id,
+                Consumable_order_minor__c,
+                Deliver_date__c,
+                Asset_Model_No__c,
+                Consumable_Product__c,
+                Consumable_Product__r.Name,
+                Consumable_Product__r.Name__c,
+                Name,
+                Bar_Code__c,
+                Arrive_date__c,
+                Dealer_Shipment__c,
+                Dealer_Saled__c,
+                Return_reason__c,
+                Consumable_Shipment_order__c,
+                Send_date__c,
+                Consumable_Sale_order__c,
+                Used_date__c,
+                SerialLotNo__c,
+                TracingCode__c,
+                Sterilization_limit__c,
+                Consumable_ZS_order__c,
+                Consumable_ZS_order__r.Name,
+                Product_OutDate__c,
+                Invoice_Date__c,
+                recordtypeid,
+                Consumable_Arrived_order__c,
+                Box_Piece__c,
+                RemoveBox_No__c,
+                RemoveBox_date__c,
+                Rrturn_count__c,
+                Dealer_Info_text__c,
+                Arrive_Owner_Work_Location__c,
+                Intra_Trade_List_RMB__c,
+                //add by rentx 2020-10-13 start 杩斿搧鏃� 鏂版暟鎹褰昐AP鍚堝悓鍙�
+                ContractNo_text__c /*,ContractNo__c*/,
+                // 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
+                // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+                // (Dealer_Shipment__c = true or Dealer_Saled__c =  true)
+                (Dealer_Shipment__c = TRUE
+                OR Dealer_Saled__c = TRUE
+                OR (Dealer_Shipment__c = FALSE
+                AND Dealer_Saled__c = FALSE
+                AND Lose_Flag__c = TRUE))
+                // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+                AND Dealer_Info_text__c = :accountName
+                AND Bar_Code__c IN :noboxBarcodeList
+                AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                AND Dealer_Returned__c = FALSE
+                AND Box_Piece__c = '涓�'
+            ORDER BY Consumable_ZS_order__c, RemoveBox_No__c
+        ];
 
-         AggregateResult[] results = [SELECT  Consumable_ZS_order__c,Bar_Code__c,count(Id) recordCount 
-                                      FROM Consumable_order_details2__c 
-                                      WHERE Dealer_Arrive__c = true
-                                      // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                                      // AND  (Dealer_Shipment__c= true OR  Dealer_Saled__c = true)
-                                      AND  (Dealer_Shipment__c= true OR  Dealer_Saled__c = true or(Dealer_Shipment__c = false and Dealer_Saled__c = false and Lose_Flag__c = true))
-                                      // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-                                      AND  Dealer_Returned__c = false
-                                      AND  Bar_Code__c in :noboxBarcodeList
-                                      AND  Arrive_Owner_Work_Location__c =: userWorkLocation
-                                      AND  Box_Piece__c = '涓�'
-                                      AND Dealer_Info_text__c = :accountName
-                                      GROUP BY Consumable_ZS_order__c,Bar_Code__c];
+        AggregateResult[] results = [
+            SELECT Consumable_ZS_order__c, Bar_Code__c, count(Id) recordCount
+            FROM Consumable_order_details2__c
+            WHERE
+                Dealer_Arrive__c = TRUE
+                // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
+                // AND  (Dealer_Shipment__c= true OR  Dealer_Saled__c = true)
+                AND (Dealer_Shipment__c = TRUE
+                OR Dealer_Saled__c = TRUE
+                OR (Dealer_Shipment__c = FALSE
+                AND Dealer_Saled__c = FALSE
+                AND Lose_Flag__c = TRUE))
+                // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
+                AND Dealer_Returned__c = FALSE
+                AND Bar_Code__c IN :noboxBarcodeList
+                AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                AND Box_Piece__c = '涓�'
+                AND Dealer_Info_text__c = :accountName
+            GROUP BY Consumable_ZS_order__c, Bar_Code__c
+        ];
 
-        for(AggregateResult ar: results){               
+        for (AggregateResult ar : results) {
             String key = '' + ar.get('Consumable_ZS_order__c') + ar.get('Bar_Code__c');
             BarcodeCntMap.put(key, Integer.valueOf(ar.get('recordCount')));
         }
-                                         
+
         return consumableorderdetails2Nobox.size();
     }
 
     //distinct
-    public List<Consumable_order_details2__c>  getDistinctZSOrder(List<Consumable_order_details2__c>  duplicates){
-        List<Consumable_order_details2__c>  distinctOrder = new List<Consumable_order_details2__c>();
-        
-        for(Consumable_order_details2__c details2 : duplicates){
+    public List<Consumable_order_details2__c> getDistinctZSOrder(List<Consumable_order_details2__c> duplicates) {
+        List<Consumable_order_details2__c> distinctOrder = new List<Consumable_order_details2__c>();
+
+        for (Consumable_order_details2__c details2 : duplicates) {
             Boolean found = false;
-            for(Consumable_order_details2__c result : distinctOrder){
-                if(details2.Consumable_ZS_order__c == result.Consumable_ZS_order__c
-                   && details2.Bar_Code__c == result.Bar_Code__c){
+            for (Consumable_order_details2__c result : distinctOrder) {
+                if (details2.Consumable_ZS_order__c == result.Consumable_ZS_order__c && details2.Bar_Code__c == result.Bar_Code__c) {
                     found = true;
                     break;
                 }
             }
 
-            if(!found){
+            if (!found) {
                 distinctOrder.add(details2);
 
-                if(details2.Box_Piece__c == '涓�') noboxBarcodeList.add(details2.Bar_Code__c);
-            } 
+                if (details2.Box_Piece__c == '涓�')
+                    noboxBarcodeList.add(details2.Bar_Code__c);
+            }
         }
         return distinctOrder;
     }
 
-        // Update杩斿搧鏄庣粏淇℃伅
-    public Pagereference UpdateGoodsOfReturn(){
-        if( ShowGoodsofReturnList==null){
+    // Update杩斿搧鏄庣粏淇℃伅
+    public Pagereference UpdateGoodsOfReturn() {
+        if (ShowGoodsofReturnList == null) {
             GoodsReturnCheck();
         }
         Getconsumableorderdetails2Nobox();
@@ -3254,260 +4043,270 @@
         Savepoint sp = Database.setSavepoint();
         boolean hasReturnGoods = false;
         boolean hasLoseGoods = false;
-        try{
-            if( ShowGoodsofReturnList.size() >0 || consumableInventory.size()>0 ){
-
-                Consumable_order__c Return_Order_Sheet     = new Consumable_order__c();
-                Return_Order_Sheet.Name                    ='*';
-                Return_Order_Sheet.Order_status__c         = '鎵瑰噯';
+        try {
+            if (ShowGoodsofReturnList.size() > 0 || consumableInventory.size() > 0) {
+                Consumable_order__c Return_Order_Sheet = new Consumable_order__c();
+                Return_Order_Sheet.Name = '*';
+                Return_Order_Sheet.Order_status__c = '鎵瑰噯';
                 Return_Order_Sheet.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
                 Return_Order_Sheet.ReturnGs_Upload_Date__c = Date.today();
-                Return_Order_Sheet.Order_type__c           = '杩斿搧';
-                Return_Order_Sheet.RecordTypeid            =System.Label.Dealer_Returned_Label;
-                Return_Order_Sheet.Order_ProType__c        = userPro_Type;
+                Return_Order_Sheet.Order_type__c = '杩斿搧';
+                Return_Order_Sheet.RecordTypeid = System.Label.Dealer_Returned_Label;
+                Return_Order_Sheet.Order_ProType__c = userPro_Type;
                 insert Return_Order_Sheet;
                 return_Order_id = Return_Order_Sheet.id;
-                List<Consumable_order__c> consumable_order_ret = [SELECT Name FROM Consumable_order__c WHERE id =:Return_Order_Sheet.id];
-                
+                List<Consumable_order__c> consumable_order_ret = [SELECT Name FROM Consumable_order__c WHERE id = :Return_Order_Sheet.id];
+
                 //2017-07-03 鍒拌揣璁㈠崟
-                Consumable_order__c Arrived_Order_Sheet     = new Consumable_order__c();
-                Arrived_Order_Sheet.Name                    ='*';
-                Arrived_Order_Sheet.Order_status__c         = '鎵瑰噯';
-                Arrived_Order_Sheet.Order_type__c           = '鍒拌揣';
-                Arrived_Order_Sheet.Dealer_Info__c          =accountid;
-                Arrived_Order_Sheet.RecordTypeid            =System.Label.RT_ConOrder_Arrive;
-                Arrived_Order_Sheet.Order_ProType__c        = userPro_Type;
+                Consumable_order__c Arrived_Order_Sheet = new Consumable_order__c();
+                Arrived_Order_Sheet.Name = '*';
+                Arrived_Order_Sheet.Order_status__c = '鎵瑰噯';
+                Arrived_Order_Sheet.Order_type__c = '鍒拌揣';
+                Arrived_Order_Sheet.Dealer_Info__c = accountid;
+                Arrived_Order_Sheet.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+                Arrived_Order_Sheet.Order_ProType__c = userPro_Type;
                 insert Arrived_Order_Sheet;
-                List<Consumable_order__c> consumable_order_arr = [SELECT Name FROM Consumable_order__c WHERE id =:Arrived_Order_Sheet.id];
+                List<Consumable_order__c> consumable_order_arr = [SELECT Name FROM Consumable_order__c WHERE id = :Arrived_Order_Sheet.id];
 
                 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
                 // 铏氭嫙鐩樼偣鍗�
-                Consumable_order__c Inventory_Order_Sheet     = new Consumable_order__c();
-                Inventory_Order_Sheet.Name                    ='*';
-                Inventory_Order_Sheet.Order_status__c         = '鎵瑰噯';
+                Consumable_order__c Inventory_Order_Sheet = new Consumable_order__c();
+                Inventory_Order_Sheet.Name = '*';
+                Inventory_Order_Sheet.Order_status__c = '鎵瑰噯';
                 Inventory_Order_Sheet.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
-                Inventory_Order_Sheet.Inventory_date__c       = Date.today();
-                Inventory_Order_Sheet.Dealer_Info__c          =accountid;
+                Inventory_Order_Sheet.Inventory_date__c = Date.today();
+                Inventory_Order_Sheet.Dealer_Info__c = accountid;
                 Inventory_Order_Sheet.ReturnGs_Upload_Date__c = Date.today();
-                Inventory_Order_Sheet.Order_type__c           = '鐩樼偣';
-                Inventory_Order_Sheet.RecordTypeid            = System.Label.RT_ConOrder_Inventory;
-                Inventory_Order_Sheet.Order_ProType__c        = userPro_Type;
+                Inventory_Order_Sheet.Order_type__c = '鐩樼偣';
+                Inventory_Order_Sheet.RecordTypeid = System.Label.RT_ConOrder_Inventory;
+                Inventory_Order_Sheet.Order_ProType__c = userPro_Type;
                 insert Inventory_Order_Sheet;
                 inventory_Order_id = Inventory_Order_Sheet.id;
-                List<Consumable_order__c> consumable_order_Inv = [SELECT Name FROM Consumable_order__c WHERE id =:Inventory_Order_Sheet.id];
+                List<Consumable_order__c> consumable_order_Inv = [
+                    SELECT Name
+                    FROM Consumable_order__c
+                    WHERE id = :Inventory_Order_Sheet.id
+                ];
                 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
 
-                List<Consumable_order_details2__c>   codcList    =   new List<Consumable_order_details2__c>();
+                List<Consumable_order_details2__c> codcList = new List<Consumable_order_details2__c>();
                 //鏂拌杩斿搧瀵瑰簲鐨勪骇鍝佹槑缁�
-                List<Consumable_order_details2__c>   codcorderdetList    =   new List<Consumable_order_details2__c>();
+                List<Consumable_order_details2__c> codcorderdetList = new List<Consumable_order_details2__c>();
                 //杩斿搧鍘熷洜,杩斿搧鏁伴噺妫�鏌�
-                for( ConsumableorderdetailsInfo  codi    :   ShowGoodsofReturnList ){
-                    if (codi.esd.Box_Piece__c =='涓�' && (
-                        codi.esd.Rrturn_count__c == null || 
-                        String.valueof(codi.esd.Rrturn_count__c) =='' || 
-                        codi.esd.Rrturn_count__c <= 0)){
+                for (ConsumableorderdetailsInfo codi : ShowGoodsofReturnList) {
+                    if (
+                        codi.esd.Box_Piece__c == '涓�' &&
+                        (codi.esd.Rrturn_count__c == null ||
+                        String.valueof(codi.esd.Rrturn_count__c) == '' ||
+                        codi.esd.Rrturn_count__c <= 0)
+                    ) {
                         continue;
                     }
 
-                    if(codi.esd.Return_reason__c==null||codi.esd.Return_reason__c==''){
+                    if (codi.esd.Return_reason__c == null || codi.esd.Return_reason__c == '') {
                         codi.esd.Return_reason__c.addError('璇疯ˉ鍏呰繑鍝佸師鍥�');
                         return null;
                     }
 
-
-                    if(codi.esd.Box_Piece__c=='涓�' && codi.esd.Rrturn_count__c > 0){
+                    if (codi.esd.Box_Piece__c == '涓�' && codi.esd.Rrturn_count__c > 0) {
                         String key = '' + codi.esd.Consumable_ZS_order__c + codi.esd.Bar_Code__c;
                         Integer deliverycnt = BarcodeCntMap.get(key);
-                        if(codi.esd.Rrturn_count__c > deliverycnt){
+                        if (codi.esd.Rrturn_count__c > deliverycnt) {
                             codi.esd.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺');
                             return null;
-                        }  
+                        }
                     }
                 }
 
-                Integer tempNo=0;
+                Integer tempNo = 0;
                 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
                 List<Consumable_order_details2__c> conOrderDetail2InList = new List<Consumable_order_details2__c>();
                 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                for( ConsumableorderdetailsInfo  codi    :   ShowGoodsofReturnList ){
+                for (ConsumableorderdetailsInfo codi : ShowGoodsofReturnList) {
                     Consumable_order_details2__c codcorderdet = new Consumable_order_details2__c();
-                    
+
                     //鍗曚綅=涓�
-                    if (codi.esd.Box_Piece__c =='涓�' && (
-                        codi.esd.Rrturn_count__c == null || 
-                        String.valueof(codi.esd.Rrturn_count__c) =='' || 
-                        codi.esd.Rrturn_count__c <= 0)){
+                    if (
+                        codi.esd.Box_Piece__c == '涓�' &&
+                        (codi.esd.Rrturn_count__c == null ||
+                        String.valueof(codi.esd.Rrturn_count__c) == '' ||
+                        codi.esd.Rrturn_count__c <= 0)
+                    ) {
                         continue;
                     }
 
-                    if(codi.esd.Box_Piece__c=='涓�' && codi.esd.Rrturn_count__c > 0){
+                    if (codi.esd.Box_Piece__c == '涓�' && codi.esd.Rrturn_count__c > 0) {
                         hasReturnGoods = true;
 
                         Integer cnt = 1;
-                        for(Consumable_order_details2__c codctmp    :   consumableorderdetails2Nobox ){
-                            if(codctmp.Consumable_ZS_order__c == codi.esd.Consumable_ZS_order__c && codctmp.Bar_Code__c == codi.esd.Bar_Code__c){
+                        for (Consumable_order_details2__c codctmp : consumableorderdetails2Nobox) {
+                            if (
+                                codctmp.Consumable_ZS_order__c == codi.esd.Consumable_ZS_order__c &&
+                                codctmp.Bar_Code__c == codi.esd.Bar_Code__c
+                            ) {
                                 Consumable_order_details2__c esd = codctmp;
                                 // esd.Consumable_Return_order__c      = Return_Order_Sheet.id;
-                                esd.Return_reason__c                = codi.esd.Return_reason__c;
-                                esd.Return_date__c                  = Date.today();
+                                esd.Return_reason__c = codi.esd.Return_reason__c;
+                                esd.Return_date__c = Date.today();
                                 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
                                 // esd.Return_reason__c                = codi.esd.Return_reason__c;
                                 // esd.Return_date__c                  = Date.today();
                                 // esd.Consumable_Return_order__c      = Return_Order_Sheet.id;
-                                if(codi.esd.Dealer_Saled__c == false && codi.esd.Dealer_Shipment__c == false && codi.esd.Lose_Flag__c == true){
+                                if (
+                                    codi.esd.Dealer_Saled__c == false &&
+                                    codi.esd.Dealer_Shipment__c == false &&
+                                    codi.esd.Lose_Flag__c == true
+                                ) {
                                     // esd.Lose_Flag__c = false;
                                     esd.Consumable_Inventory_order__c = Inventory_Order_Sheet.id;
                                     conOrderDetail2InList.add(esd);
                                     hasLoseGoods = true;
-                                }
-                                else{
+                                } else {
                                     // esd.Return_date__c                  = Date.today();
-                                    esd.Consumable_Return_order__c      = Return_Order_Sheet.id;
-                                    
+                                    esd.Consumable_Return_order__c = Return_Order_Sheet.id;
                                 }
                                 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-                                esd.ReturnGs_Uploader_ID__c         = UserInfo.getUserId();
-                                
+                                esd.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
+
                                 //淇敼杩斿搧鎵�鏈変汉
-                                esd.OwnerId                         = UserInfo.getUserId();
-                                esd.RecordTypeId                    = System.Label.RT_ConOrderDetail2_Return;
-                               
+                                esd.OwnerId = UserInfo.getUserId();
+                                esd.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
+
                                 //Consumable_order__c coc = [select name from Consumable_order__c where Id =:Arrived_Order_Sheet.id];
                                 codcorderdet = new Consumable_order_details2__c();
-                                codcorderdet.Name                        = consumable_order_arr[0].name + '-' + String.valueOf(++tempNo).leftPad(4,'0');
-                                codcorderdet.Consumable_order_minor__c   = codi.esd.Consumable_order_minor__c;
+                                codcorderdet.Name = consumable_order_arr[0].name + '-' + String.valueOf(++tempNo).leftPad(4, '0');
+                                codcorderdet.Consumable_order_minor__c = codi.esd.Consumable_order_minor__c;
                                 codcorderdet.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
                                 //淇敼鍒拌揣鎵�鏈変汉
-                                codcorderdet.OwnerId                     = UserInfo.getUserId();
-                                codcorderdet.Arrive_date__c              = Date.today();
-                                codcorderdet.Consumable_Product__c       = codi.esd.Consumable_Product__c;
-                                codcorderdet.Asset_Model_No__c           = codi.esd.Asset_Model_No__c;
-                                codcorderdet.Bar_Code__c                 = codi.esd.Bar_Code__c;
-                                codcorderdet.Deliver_date__c             = codi.esd.Deliver_date__c;
-                                codcorderdet.SerialLotNo__c              = codi.esd.SerialLotNo__c;
-                                codcorderdet.TracingCode__c              = codi.esd.TracingCode__c;
-                                codcorderdet.Sterilization_limit__c      = codi.esd.Sterilization_limit__c;
-                                //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                                codcorderdet.Intra_Trade_List_RMB__c     =  (codi.esd.Intra_Trade_List_RMB__c == null || codi.esd.Intra_Trade_List_RMB__c == 0) ? codi.esd.Intra_Trade_List__c : codi.esd.Intra_Trade_List_RMB__c;
-                                codcorderdet.RemoveBox_No__c             = codctmp.RemoveBox_No__c;
-                                codcorderdet.RemoveBox_date__c           = codctmp.RemoveBox_date__c;
-                                codcorderdet.Box_Piece__c                = codctmp.Box_Piece__c;
+                                codcorderdet.OwnerId = UserInfo.getUserId();
+                                codcorderdet.Arrive_date__c = Date.today();
+                                codcorderdet.Consumable_Product__c = codi.esd.Consumable_Product__c;
+                                codcorderdet.Asset_Model_No__c = codi.esd.Asset_Model_No__c;
+                                codcorderdet.Bar_Code__c = codi.esd.Bar_Code__c;
+                                codcorderdet.Deliver_date__c = codi.esd.Deliver_date__c;
+                                codcorderdet.SerialLotNo__c = codi.esd.SerialLotNo__c;
+                                codcorderdet.TracingCode__c = codi.esd.TracingCode__c;
+                                codcorderdet.Sterilization_limit__c = codi.esd.Sterilization_limit__c;
+                                codcorderdet.Intra_Trade_List_RMB__c = codi.esd.Intra_Trade_List_RMB__c;
+                                codcorderdet.RemoveBox_No__c = codctmp.RemoveBox_No__c;
+                                codcorderdet.RemoveBox_date__c = codctmp.RemoveBox_date__c;
+                                codcorderdet.Box_Piece__c = codctmp.Box_Piece__c;
 
                                 //add by rentx 2020-10-13 start 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
                                 // codcorderdet.ContractNo_text__c= codctmp.ContractNo__c;
                                 // tcm start
                                 if (String.isBlank(codctmp.Consumable_order_minor__r.ContractNo__c)) {
-                                    codcorderdet.ContractNo_text__c= codctmp.ContractNo_text__c;
-                                }else {
-                                    codcorderdet.ContractNo_text__c= codctmp.Consumable_order_minor__r.ContractNo__c;
+                                    codcorderdet.ContractNo_text__c = codctmp.ContractNo_text__c;
+                                } else {
+                                    codcorderdet.ContractNo_text__c = codctmp.Consumable_order_minor__r.ContractNo__c;
                                 }
                                 // tcm end
                                 //add by rentx 2020-10-13 end   杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
 
-
                                 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                                if(hasLoseGoods){
+                                if (hasLoseGoods) {
                                     codcorderdet.loseInventory__c = true;
                                 }
                                 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-                                 
+
                                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
                                 // 杩斿搧鏃讹紝鈶犺拷鍔犲�熻皟鍊熷嚭鏂逛俊鎭� 鈶′繚鐣欏�熻皟淇℃伅 鈶繚瀛楽AP鍜岀粡閿�鍟嗛娆″彂璐х粡閿�鍟�
-                                codcorderdet.Used_account__c             = codi.esd.Used_account__c;
-                                codcorderdet.Transfer_Time__c            = codi.esd.Transfer_Time__c;
-                                codcorderdet.Frist_Transfer_Agency__c    = codi.esd.Frist_Transfer_Agency__c;
-                                codcorderdet.Agency_Transfer__c          = codi.esd.Agency_Transfer__c;
+                                codcorderdet.Used_account__c = codi.esd.Used_account__c;
+                                codcorderdet.Transfer_Time__c = codi.esd.Transfer_Time__c;
+                                codcorderdet.Frist_Transfer_Agency__c = codi.esd.Frist_Transfer_Agency__c;
+                                codcorderdet.Agency_Transfer__c = codi.esd.Agency_Transfer__c;
 
-                                codcorderdet.Agencyinfo_fromSAP__c       = codi.esd.Agencyinfo_fromSAP__c;
+                                codcorderdet.Agencyinfo_fromSAP__c = codi.esd.Agencyinfo_fromSAP__c;
                                 //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------1------' + codi.esd.Frist_Storage_Agency__c));
-                                codcorderdet.Frist_Storage_Agency__c     = codi.esd.Frist_Storage_Agency__c == null ? codi.esd.Dealer_Info_text__c : codi.esd.Frist_Storage_Agency__c;
+                                codcorderdet.Frist_Storage_Agency__c = codi.esd.Frist_Storage_Agency__c == null
+                                    ? codi.esd.Dealer_Info_text__c
+                                    : codi.esd.Frist_Storage_Agency__c;
                                 // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
                                 codcorderdetList.add(codcorderdet);
-                                codcList.add(   esd    );
+                                codcList.add(esd);
 
                                 cnt++;
-                                if(cnt > codi.esd.Rrturn_count__c) break;
+                                if (cnt > codi.esd.Rrturn_count__c)
+                                    break;
                             }
-
                         }
-                    }
-                    else{
+                    } else {
                         hasReturnGoods = true;
                         //鍗曚綅=鐩�
                         //changeinvoiceInfo(codi.esd);
                         //Consumable_order__c coc = [select name from Consumable_order__c where Id =:Arrived_Order_Sheet.id];
                         // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                        codi.esd.Return_date__c                  = Date.today();
+                        codi.esd.Return_date__c = Date.today();
                         // codi.esd.Consumable_Return_order__c      = Return_Order_Sheet.id;
-                        if(codi.esd.Dealer_Saled__c == false && codi.esd.Dealer_Shipment__c == false && codi.esd.Lose_Flag__c == true){
+                        if (codi.esd.Dealer_Saled__c == false && codi.esd.Dealer_Shipment__c == false && codi.esd.Lose_Flag__c == true) {
                             codi.esd.Lose_Flag__c = false;
                             codi.esd.Return_reason__c = '';
-                            codi.esd.Consumable_Inventory_order__c      = Inventory_Order_Sheet.id;
+                            codi.esd.Consumable_Inventory_order__c = Inventory_Order_Sheet.id;
                             conOrderDetail2InList.add(codi.esd);
                             hasLoseGoods = true;
-                        }
-                        else{
+                        } else {
                             // codi.esd.Return_date__c                  = Date.today();
-                            codi.esd.Consumable_Return_order__c      = Return_Order_Sheet.id;
-                            
+                            codi.esd.Consumable_Return_order__c = Return_Order_Sheet.id;
                         }
                         // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
-                        codi.esd.ReturnGs_Uploader_ID__c         = UserInfo.getUserId();
+                        codi.esd.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
                         // codi.esd.Consumable_Return_order__c      = Return_Order_Sheet.id;
                         //淇敼杩斿搧鎵�鏈変汉
-                        codi.esd.OwnerId                             = UserInfo.getUserId();
-                        codi.esd.RecordTypeId                    = System.Label.RT_ConOrderDetail2_Return;
-                        codcorderdet.Name                        = consumable_order_arr[0].name + '-' + String.valueOf(++tempNo).leftPad(4,'0');
-                        codcorderdet.Consumable_order_minor__c   = codi.esd.Consumable_order_minor__c;
+                        codi.esd.OwnerId = UserInfo.getUserId();
+                        codi.esd.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
+                        codcorderdet.Name = consumable_order_arr[0].name + '-' + String.valueOf(++tempNo).leftPad(4, '0');
+                        codcorderdet.Consumable_order_minor__c = codi.esd.Consumable_order_minor__c;
                         codcorderdet.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
                         //淇敼鍒拌揣鎵�鏈変汉
-                        codcorderdet.OwnerId                     = UserInfo.getUserId();
-                        codcorderdet.Arrive_date__c              = Date.today();
-                        codcorderdet.Consumable_Product__c       = codi.esd.Consumable_Product__c;
-                        codcorderdet.Asset_Model_No__c           = codi.esd.Asset_Model_No__c;
-                        codcorderdet.Bar_Code__c                 = codi.esd.Bar_Code__c;
-                        codcorderdet.Deliver_date__c             = codi.esd.Deliver_date__c;
-                        codcorderdet.SerialLotNo__c              = codi.esd.SerialLotNo__c;
-                        codcorderdet.TracingCode__c              = codi.esd.TracingCode__c;
-                        codcorderdet.Sterilization_limit__c      = codi.esd.Sterilization_limit__c;
-                        //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                        codcorderdet.Intra_Trade_List_RMB__c     =  (codi.esd.Intra_Trade_List_RMB__c == null || codi.esd.Intra_Trade_List_RMB__c == 0) ? codi.esd.Intra_Trade_List__c : codi.esd.Intra_Trade_List_RMB__c;
+                        codcorderdet.OwnerId = UserInfo.getUserId();
+                        codcorderdet.Arrive_date__c = Date.today();
+                        codcorderdet.Consumable_Product__c = codi.esd.Consumable_Product__c;
+                        codcorderdet.Asset_Model_No__c = codi.esd.Asset_Model_No__c;
+                        codcorderdet.Bar_Code__c = codi.esd.Bar_Code__c;
+                        codcorderdet.Deliver_date__c = codi.esd.Deliver_date__c;
+                        codcorderdet.SerialLotNo__c = codi.esd.SerialLotNo__c;
+                        codcorderdet.TracingCode__c = codi.esd.TracingCode__c;
+                        codcorderdet.Sterilization_limit__c = codi.esd.Sterilization_limit__c;
+                        codcorderdet.Intra_Trade_List_RMB__c = codi.esd.Intra_Trade_List_RMB__c;
                         // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
-                        if(hasLoseGoods){
+                        if (hasLoseGoods) {
                             codcorderdet.loseInventory__c = true;
                         }
                         // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
                         // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
                         // 杩斿搧鏃讹紝鈶犺拷鍔犲�熻皟鍊熷嚭鏂逛俊鎭� 鈶′繚鐣欏�熻皟淇℃伅 鈶繚瀛楽AP鍜岀粡閿�鍟嗛娆″彂璐х粡閿�鍟�
-                        codcorderdet.Used_account__c             = codi.esd.Used_account__c;
-                        codcorderdet.Transfer_Time__c            = codi.esd.Transfer_Time__c;
-                        codcorderdet.Frist_Transfer_Agency__c    = codi.esd.Frist_Transfer_Agency__c;
-                        codcorderdet.Agency_Transfer__c          = codi.esd.Agency_Transfer__c;
+                        codcorderdet.Used_account__c = codi.esd.Used_account__c;
+                        codcorderdet.Transfer_Time__c = codi.esd.Transfer_Time__c;
+                        codcorderdet.Frist_Transfer_Agency__c = codi.esd.Frist_Transfer_Agency__c;
+                        codcorderdet.Agency_Transfer__c = codi.esd.Agency_Transfer__c;
 
-                        codcorderdet.Agencyinfo_fromSAP__c        = codi.esd.Agencyinfo_fromSAP__c;
+                        codcorderdet.Agencyinfo_fromSAP__c = codi.esd.Agencyinfo_fromSAP__c;
                         //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------2------' + codi.esd.Frist_Storage_Agency__c));
-                        codcorderdet.Frist_Storage_Agency__c      = codi.esd.Frist_Storage_Agency__c == null ? codi.esd.Dealer_Info_text__c : codi.esd.Frist_Storage_Agency__c;
+                        codcorderdet.Frist_Storage_Agency__c = codi.esd.Frist_Storage_Agency__c == null
+                            ? codi.esd.Dealer_Info_text__c
+                            : codi.esd.Frist_Storage_Agency__c;
                         // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
 
                         //add by rentx 2020-10-13 start 杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
                         // codcorderdet.ContractNo_text__c          = /*codi.esd.ContractNo__c*/;
                         // tcm start
                         if (String.isBlank(codi.esd.Consumable_order_minor__r.ContractNo__c)) {
-                            codcorderdet.ContractNo_text__c= codi.esd.ContractNo_text__c;
-                        }else {
-                            codcorderdet.ContractNo_text__c= codi.esd.Consumable_order_minor__r.ContractNo__c;
+                            codcorderdet.ContractNo_text__c = codi.esd.ContractNo_text__c;
+                        } else {
+                            codcorderdet.ContractNo_text__c = codi.esd.Consumable_order_minor__r.ContractNo__c;
                         }
                         // tcm end
                         //add by rentx 2020-10-13 end   杩斿搧鏃舵柊鏁版嵁璁板綍SAP鍚堝悓鍙�
 
                         codcorderdetList.add(codcorderdet);
-                        codcList.add(   codi.esd    );
+                        codcList.add(codi.esd);
                     }
                 }
+
                 //鏄庣粏2涓嶅瓨鍦ㄧ殑瀵瑰簲鐨勫埌璐ц鍗曟槑缁� 2017-07-05
                 Integer i = 1;
                 //for(ConsumableorderdetailsInfo ass : consumableInventoryUse){
-                for(ConsumableorderdetailsInfo ass : consumableInventory){
+                for (ConsumableorderdetailsInfo ass : consumableInventory) {
                     hasReturnGoods = true;
                     Consumable_order_details2__c codcorderdetail = new Consumable_order_details2__c();
                     Consumable_order_details2__c retorddetail = new Consumable_order_details2__c();
@@ -3516,33 +4315,32 @@
                     //     str = '0' + str;
                     // }
 
-                    if(ass.ReturnReason==null || ass.ReturnReason==''){
-                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇疯ˉ鍏呰繑鍝佸師鍥�'));
+                    if (ass.ReturnReason == null || ass.ReturnReason == '') {
+                        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璇疯ˉ鍏呰繑鍝佸師鍥�'));
                         return null;
                     }
 
                     //鍒拌揣鏄庣粏
-                    codcorderdetail.Name                        = consumable_order_arr[0].Name + '-'+ str;
-                    codcorderdetail.RecordTypeId                = System.Label.RT_ConOrderDetail2_Delivery;
-                    codcorderdetail.Intra_Trade_List_RMB__c     = ass.Prod.Intra_Trade_List_RMB__c;
-                    //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                    codcorderdetail.Asset_Model_No__c           = ass.Prod.Asset_Model_No__c;
-                    codcorderdetail.Direct_Arrive_Product__c    = true;
-                    codcorderdetail.Sterilization_limit__c      = ass.sterilizationlimitDate;
-                    codcorderdetail.Consumable_Product__c       = ass.Prod.id;
-                    codcorderdetail.Bar_Code__c                 = ass.barCodeNo;
-                    codcorderdetail.SerialLotNo__c              = ass.serialNoorLotNo;
-                    codcorderdetail.TracingCode__c              = ass.tracingCodeNo;
+                    codcorderdetail.Name = consumable_order_arr[0].Name + '-' + str;
+                    codcorderdetail.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+                    codcorderdetail.Intra_Trade_List_RMB__c = null;
+                    codcorderdetail.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
+                    codcorderdetail.Direct_Arrive_Product__c = true;
+                    codcorderdetail.Sterilization_limit__c = ass.sterilizationlimitDate;
+                    codcorderdetail.Consumable_Product__c = ass.Prod.id;
+                    codcorderdetail.Bar_Code__c = ass.barCodeNo;
+                    codcorderdetail.SerialLotNo__c = ass.serialNoorLotNo;
+                    codcorderdetail.TracingCode__c = ass.tracingCodeNo;
                     codcorderdetail.Consumable_Arrived_order__c = Arrived_Order_Sheet.id;
-                    codcorderdetail.Arrive_date__c              = Date.today();
+                    codcorderdetail.Arrive_date__c = Date.today();
 
                     //add by rentx 2020-10-14 start
                     // codcorderdetail.ContractNo_text__c          = /*ass.esd.ContractNo__c*/;
                     // tcm start
                     if (String.isBlank(ass.esd.Consumable_order_minor__r.ContractNo__c)) {
-                        codcorderdetail.ContractNo_text__c= ass.esd.ContractNo_text__c;
-                    }else {
-                        codcorderdetail.ContractNo_text__c= ass.esd.Consumable_order_minor__r.ContractNo__c;
+                        codcorderdetail.ContractNo_text__c = ass.esd.ContractNo_text__c;
+                    } else {
+                        codcorderdetail.ContractNo_text__c = ass.esd.Consumable_order_minor__r.ContractNo__c;
                     }
                     // tcm end
                     //add by rentx 2020-10-14 end
@@ -3550,45 +4348,43 @@
                     codcorderdetList.add(codcorderdetail);
 
                     //杩斿搧鏄庣粏
-                    retorddetail.Return_reason__c            = ass.ReturnReason;
-                    retorddetail.Return_date__c              = Date.today();
-                    retorddetail.ReturnGs_Uploader_ID__c     = UserInfo.getUserId();
+                    retorddetail.Return_reason__c = ass.ReturnReason;
+                    retorddetail.Return_date__c = Date.today();
+                    retorddetail.ReturnGs_Uploader_ID__c = UserInfo.getUserId();
 
                     // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 start
                     // if(ass.esd.Dealer_Saled__c == false && ass.esd.Dealer_Shipment__c == false && ass.esd.Lose_Flag__c == true){
                     //     retorddetail.Consumable_Inventory_order__c  = Inventory_Order_Sheet.id;
                     //     retorddetail.loseInventory__c = true;
                     // }
-                    retorddetail.Consumable_Return_order__c  = Return_Order_Sheet.id;
+                    retorddetail.Consumable_Return_order__c = Return_Order_Sheet.id;
                     // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end
 
-                    
-                    retorddetail.Name                        = consumable_order_ret[0].Name + '-'+ str;
-                    retorddetail.RecordTypeId                = System.Label.RT_ConOrderDetail2_Return;
-                    retorddetail.Intra_Trade_List_RMB__c     = ass.Prod.Intra_Trade_List_RMB__c;
-                    //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307
-                    retorddetail.Dealer_Info_IF__c           = accountid;
-                    retorddetail.Asset_Model_No__c           = ass.Prod.Asset_Model_No__c;
-                    retorddetail.Direct_Arrive_Product__c    = true;
-                    retorddetail.Sterilization_limit__c      = ass.sterilizationlimitDate;
-                    retorddetail.Consumable_Product__c       = ass.Prod.id;
-                    retorddetail.Bar_Code__c                 = ass.barCodeNo;
-                    retorddetail.SerialLotNo__c              = ass.serialNoorLotNo;
-                    retorddetail.TracingCode__c              = ass.tracingCodeNo;
-                    retorddetail.Arrive_date__c              = Date.today();
-                    retorddetail.Deliver_date__c             = Date.today();
+                    retorddetail.Name = consumable_order_ret[0].Name + '-' + str;
+                    retorddetail.RecordTypeId = System.Label.RT_ConOrderDetail2_Return;
+                    retorddetail.Intra_Trade_List_RMB__c = null;
+                    retorddetail.Dealer_Info_IF__c = accountid;
+                    retorddetail.Asset_Model_No__c = ass.Prod.Asset_Model_No__c;
+                    retorddetail.Direct_Arrive_Product__c = true;
+                    retorddetail.Sterilization_limit__c = ass.sterilizationlimitDate;
+                    retorddetail.Consumable_Product__c = ass.Prod.id;
+                    retorddetail.Bar_Code__c = ass.barCodeNo;
+                    retorddetail.SerialLotNo__c = ass.serialNoorLotNo;
+                    retorddetail.TracingCode__c = ass.tracingCodeNo;
+                    retorddetail.Arrive_date__c = Date.today();
+                    retorddetail.Deliver_date__c = Date.today();
                     // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 start
-                    retorddetail.Frist_Storage_Agency__c      = accountName;
+                    retorddetail.Frist_Storage_Agency__c = accountName;
                     // 杩藉姞棣栨鍏ュ簱缁忛攢鍟� add by gzw 2020-04-27 end
 
                     //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 {
-                        retorddetail.ContractNo_text__c= ass.esd.Consumable_order_minor__r.ContractNo__c;
-                     }
+                    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
 
@@ -3599,90 +4395,88 @@
                 // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------end------'));
                 // return null;
 
-                if(codcList.size()>0){
-                    ControllerUtil.updateOrderDetailsSatus(   codcList    );
+                if (codcList.size() > 0) {
+                    ControllerUtil.updateOrderDetailsSatus(codcList);
                     //insert codcorderdetList;
                 }
-                if (codcorderdetList.size()>0){
-                    System.debug('codcorderdetList +++++ '+ codcorderdetList);
+                if (codcorderdetList.size() > 0) {
+                    System.debug('codcorderdetList +++++ ' + codcorderdetList);
                     insert codcorderdetList;
                 }
                 // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
-                if(conOrderDetail2InList.size() > 0){
+                if (conOrderDetail2InList.size() > 0) {
                     addInventoryDetails1(conOrderDetail2InList);
                 }
                 // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
 
-                if(hasReturnGoods){
+                if (hasReturnGoods) {
                     // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
                     // return ToReturnGoodsPage();
-                    if(hasLoseGoods){
+                    if (hasLoseGoods) {
                         return ToInventoryGoodsPage();
                         // return null;
-                    }else{
+                    } else {
                         return ToReturnGoodsPage();
                         // return null;
                     }
                     // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
-                }
-                else{
-                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'));
+                } else {
+                    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'));
                     return null;
                 }
-
-            }else{
-                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'));
+            } else {
+                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'));
                 return null;
             }
-        }catch(Exception e){
+        } catch (Exception e) {
             Database.rollback(sp);
             ApexPages.addMessages(e);
             return null;
         }
     }
 
-    public void makeArrivedSummary(){
+    public void makeArrivedSummary() {
         detailsSummary = new List<ConsumableorderdetailsInfo>();
         //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'consumableInventory   ' + consumableInventory));
-        try{
+        try {
             ConsumableorderdetailsInfo arriveDdetailsSummary = null;
-            Map<String,ConsumableorderdetailsInfo> detailsSummaryMap = new Map<String,ConsumableorderdetailsInfo>();
-            for(ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords){
-                if(detailsSummaryMap.containsKey(ass.Prod.Id)){
-                    detailsSummaryMap.get(ass.Prod.Id).arrivedCount ++;
+            Map<String, ConsumableorderdetailsInfo> detailsSummaryMap = new Map<String, ConsumableorderdetailsInfo>();
+            for (ConsumableorderdetailsInfo ass : ConsumableorderdetailsRecords) {
+                if (detailsSummaryMap.containsKey(ass.Prod.Id)) {
+                    detailsSummaryMap.get(ass.Prod.Id).arrivedCount++;
                     detailsSummaryMap.get(ass.Prod.Id).arriveAmount += ass.esd.Intra_Trade_List_RMB__c;
-                }else{
+                } else {
                     arriveDdetailsSummary = new ConsumableorderdetailsInfo(ass.Prod);
                     arriveDdetailsSummary.arrivedCount = 1;
                     arriveDdetailsSummary.arriveAmount = ass.esd.Intra_Trade_List_RMB__c;
                     detailsSummaryMap.put(ass.Prod.Id, arriveDdetailsSummary);
                 }
             }
-            for(ConsumableorderdetailsInfo ass : consumableInventory){
-                if(detailsSummaryMap.containsKey(ass.Prod.Id)){
-                    detailsSummaryMap.get(ass.Prod.Id).arrivedCount ++;
-                    if(EsetId != null && EsetId != ''){
+            for (ConsumableorderdetailsInfo ass : consumableInventory) {
+                if (detailsSummaryMap.containsKey(ass.Prod.Id)) {
+                    detailsSummaryMap.get(ass.Prod.Id).arrivedCount++;
+                    if (EsetId != null && EsetId != '') {
                         detailsSummaryMap.get(ass.Prod.Id).arriveAmount += ass.Prod.Intra_Trade_List_RMB__c;
-                    }else{
+                    } else {
                         detailsSummaryMap.get(ass.Prod.Id).arriveAmount += 0;
                     }
-                }else{
+                } else {
                     arriveDdetailsSummary = new ConsumableorderdetailsInfo(ass.Prod);
                     arriveDdetailsSummary.arrivedCount = 1;
-                    if(EsetId != null && EsetId != ''){
+                    if (EsetId != null && EsetId != '') {
                         arriveDdetailsSummary.arriveAmount = ass.Prod.Intra_Trade_List_RMB__c;
-                    }else{
+                    } else {
                         arriveDdetailsSummary.arriveAmount = 0;
                     }
                     detailsSummaryMap.put(ass.Prod.Id, arriveDdetailsSummary);
                 }
             }
-            for(String key : detailsSummaryMap.keySet()){
+            for (String key : detailsSummaryMap.keySet()) {
                 detailsSummary.add(detailsSummaryMap.get(key));
             }
-        }catch(Exception e){
+        } catch (Exception e) {
             //Database.rollback(sp);
-            throw new ControllerUtil.myException('e::'+e + '  linenumber::'+e.getLineNumber());
+            throw new ControllerUtil.myException('e::' + e + '  linenumber::' + e.getLineNumber());
             // ApexPages.addMessages(e);
             // ApexPages.addMessages(e.getLineNumber() + '  11111111111111111');
 
@@ -3691,23 +4485,23 @@
     }
 
     //璺宠浆鍒拌繑鍝侀〉闈�
-    public Pagereference ToReturnGoodsPage(){
-        PageReference ref = new Pagereference('/'+return_Order_id);
-            ref.setRedirect(true);
-            return ref;
+    public Pagereference ToReturnGoodsPage() {
+        PageReference ref = new Pagereference('/' + return_Order_id);
+        ref.setRedirect(true);
+        return ref;
     }
-    
+
     // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start
-    public Pagereference ToInventoryGoodsPage(){
-        PageReference ref = new Pagereference('/'+inventory_Order_id);
-            ref.setRedirect(true);
-            return ref;
+    public Pagereference ToInventoryGoodsPage() {
+        PageReference ref = new Pagereference('/' + inventory_Order_id);
+        ref.setRedirect(true);
+        return ref;
     }
     // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 end
 
-        // 璺宠浆鍒板埌璐ц鍗曟槑缁�
-    public PageReference UnabletoEdit(){
-        PageReference ref = new Pagereference('/ArriveGsDetails?EsetId='+arriveId);
+    // 璺宠浆鍒板埌璐ц鍗曟槑缁�
+    public PageReference UnabletoEdit() {
+        PageReference ref = new Pagereference('/ArriveGsDetails?EsetId=' + arriveId);
         ref.setRedirect(true);
         return ref;
     }
@@ -3729,40 +4523,38 @@
         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;
+        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;
+            ErrorReason = str;
             intMark = 1;
             if (e.Report_Product_Expiration__c != null) {
-                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();  
+                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
             }
-
         }
         public ConsumableorderdetailsInfo(Consumable_order_details2__c e) {
             canEdit = false;
-            if(e.Box_Piece__c=='鐩�'){
+            if (e.Box_Piece__c == '鐩�') {
                 e.Rrturn_count__c = 1;
                 canEdit = true;
             }
 
-            esd                = e;
-            Prod               = e.Consumable_Product__r;
+            esd = e;
+            Prod = e.Consumable_Product__r;
             oldConsumableCount = e.name;
             if (e.Report_Product_Expiration__c != null) {
-                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();  
+                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
             }
-
         }
 
-        public ConsumableorderdetailsInfo(Product2__c e,List<String> barinfoL) {
+        public ConsumableorderdetailsInfo(Product2__c e, List<String> barinfoL) {
             esd = new Consumable_order_details2__c();
             ProductName = e.Name__c;
             Prod = e;
             barCodeNo = barinfoL[0];
-            if(String.isNotBlank(barinfoL[1])){
+            if (String.isNotBlank(barinfoL[1])) {
                 sterilizationlimitDate = Date.valueOf(barinfoL[1]);
             }
             serialNoorLotNo = barinfoL[2];
@@ -3770,19 +4562,18 @@
             ReturnReason = '';
         }
 
-        public ConsumableorderdetailsInfo(Consumable_order_details2__c e,List<String> barinfoL) {
+        public ConsumableorderdetailsInfo(Consumable_order_details2__c e, List<String> barinfoL) {
             esd = e;
-            Prod               = e.Consumable_Product__r;
+            Prod = e.Consumable_Product__r;
             barCodeNo = barinfoL[0];
-            if(String.isNotBlank(barinfoL[1])){
+            if (String.isNotBlank(barinfoL[1])) {
                 sterilizationlimitDate = Date.valueOf(barinfoL[1]);
             }
             serialNoorLotNo = barinfoL[2];
             tracingCodeNo = barinfoL[3];
             if (e.Report_Product_Expiration__c != null) {
-                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();  
+                ReportProductExpirationDate = e.Report_Product_Expiration__c.format();
             }
-
         }
         public ConsumableorderdetailsInfo(Product2__c e) {
             Prod = e;
@@ -3792,4 +4583,4 @@
             return null;
         }
     }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/classes/CPL003Rest.cls b/force-app/main/default/classes/CPL003Rest.cls
index 6355680..22dc62f 100644
--- a/force-app/main/default/classes/CPL003Rest.cls
+++ b/force-app/main/default/classes/CPL003Rest.cls
@@ -1,28 +1,27 @@
 @RestResource(urlMapping='/CPL003/*')
 global with sharing class CPL003Rest {
-	
     global class GeDatas {
-        webservice NFMUtil.Monitoring Monitoring;
-        webservice CPL003Rest.GeData[] Inventory;
+        webService NFMUtil.Monitoring Monitoring;
+        webService CPL003Rest.GeData[] Inventory;
     }
 
     global class GeData {
-        webservice String MaterialNumber; //浜у搧缂栫爜(浜у搧浠g爜)
-        webservice String ItemQuantity;   //OpenPO鍜屽簱瀛樼殑鎬绘暟閲�
+        webService String MaterialNumber; //浜у搧缂栫爜(浜у搧浠g爜)
+        webService String ItemQuantity; //OpenPO鍜屽簱瀛樼殑鎬绘暟閲�
 
-        webservice String Area;    //鍖哄煙(寰呭畾)
+        webService String Area; //鍖哄煙(寰呭畾)
         //webservice String other1;
         //webservice String other2;
         //webservice String other3;
     }
 
-	@HttpPost
+    @HttpPost
     global static void execute() {
-    	// 鍙栧緱鎺ュ彛浼犺緭鍐呭
+        // 鍙栧緱鎺ュ彛浼犺緭鍐呭
         String strData = RestContext.request.requestBody.toString();
         GeDatas ges = (GeDatas) JSON.deserializeStrict(strData, GeDatas.class);
 
-        if (ges == null ) {
+        if (ges == null) {
             return;
         }
 
@@ -46,7 +45,6 @@
         return;
     }
 
-
     @future
     global static void executefuture(String rowData_Id) {
         main(rowData_Id);
@@ -54,8 +52,29 @@
 
     global static void main(String rowData_Id) {
         Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
-        BatchIF_Log__c rowData = [Select Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,retry_cnt__c from BatchIF_Log__c where RowDataFlg__c = true and Id = :rowData_Id];
-        MDMITMWebService.isRunning = true;
+        BatchIF_Log__c rowData = [
+            SELECT
+                Id,
+                Name,
+                Log__c,
+                ErrorLog__c,
+                Log2__c,
+                Log3__c,
+                Log4__c,
+                Log5__c,
+                Log6__c,
+                Log7__c,
+                Log8__c,
+                Log9__c,
+                Log10__c,
+                Log11__c,
+                Log12__c,
+                MessageGroupNumber__c,
+                retry_cnt__c
+            FROM BatchIF_Log__c
+            WHERE RowDataFlg__c = TRUE AND Id = :rowData_Id
+        ];
+        //MDMITMWebService.isRunning = true; //Commented By Li Jun 20230428
         String logstr = rowData.MessageGroupNumber__c + ' start\n';
         BatchIF_Log__c iflog = new BatchIF_Log__c();
         iflog.Type__c = 'CPL003';
@@ -67,36 +86,39 @@
         String rowDataStr = NFMUtil.getRowDataStr(rowData);
         //rowDataStr = XMLTools.xml2json(rowDataStr);
         List<GeData> itemMasterList = (List<GeData>) JSON.deserialize(rowDataStr, List<GeData>.class);
-        
+
         if (itemMasterList == null || itemMasterList.size() == 0) {
             return;
-        }   
+        }
 
         Savepoint sp = Database.setSavepoint();
 
-        try{
+        try {
             List<String> materialNumberList = new List<String>();
 
             for (GeData GeData : itemMasterList) {
-                if (String.isBlank(GeData.MaterialNumber))  continue;
-                if (String.isBlank(GeData.ItemQuantity))  continue;
+                if (String.isBlank(GeData.MaterialNumber))
+                    continue;
+                if (String.isBlank(GeData.ItemQuantity))
+                    continue;
                 materialNumberList.add(GeData.MaterialNumber);
             }
 
-            List<Product2> product2List = [select Id, ProductCode, StorageStatusNo__c 
-                                             from Product2
-                                            where ProductCode in :materialNumberList ];
-            
-            Map<String,Product2> product2Map = new Map<String,Product2>();
+            List<Product2> product2List = [
+                SELECT Id, ProductCode, StorageStatusNo__c
+                FROM Product2
+                WHERE ProductCode IN :materialNumberList
+            ];
+
+            Map<String, Product2> product2Map = new Map<String, Product2>();
             for (Product2 product2 : product2List) {
                 product2Map.put(product2.ProductCode, product2);
             }
 
             List<Product2> upsertProList = new List<Product2>();
-            Map<String,Product2> prdUpdateMap = new Map<String, Product2>();
+            Map<String, Product2> prdUpdateMap = new Map<String, Product2>();
 
             for (GeData GeData : itemMasterList) {
-                
                 if (String.isBlank(GeData.MaterialNumber)) {
                     iflog.ErrorLog__c += 'MaterialNumber is required.\n';
                     continue;
@@ -106,29 +128,36 @@
                     Product2 product = product2Map.get(GeData.MaterialNumber);
                     product.StorageStatusNo__c = Double.valueOf(GeData.ItemQuantity);
                     upsertProList.add(product);
-
                 } else {
                     iflog.ErrorLog__c += 'This MaterialNumber [ ' + GeData.MaterialNumber + ' ] is not Exist.\n';
                     continue;
                 }
             }
 
-            if(upsertProList.size() > 0)    upsert upsertProList;
+            if (upsertProList.size() > 0)
+                upsert upsertProList;
 
             logstr += '\nend';
-            rowData.retry_cnt__c=0;
-        } catch(Exception ex) {
+            rowData.retry_cnt__c = 0;
+        } catch (Exception ex) {
             // 銈ㄣ儵銉笺亴鐧虹敓銇椼仧鍫村悎
             Database.rollback(sp);
             logstr += '\n' + ex.getMessage();
             iflog.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + iflog.ErrorLog__c;
-            if (rowData.retry_cnt__c == null) rowData.retry_cnt__c = 0;
-            if (rowData.retry_cnt__c < batch_retry_max_cnt){
+            if (rowData.retry_cnt__c == null)
+                rowData.retry_cnt__c = 0;
+            if (rowData.retry_cnt__c < batch_retry_max_cnt) {
                 rowData.retry_cnt__c++;
                 LogAutoSendSchedule.assignOneMinute();
             }
-            if (rowData.retry_cnt__c >= batch_retry_max_cnt){
-                rowData.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + rowData.ErrorLog__c+'閿欒娆℃暟宸茬粡瓒呰繃鑷姩鏀朵俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄦ敹淇�';
+            if (rowData.retry_cnt__c >= batch_retry_max_cnt) {
+                rowData.ErrorLog__c =
+                    ex.getMessage() +
+                    '\n' +
+                    ex.getStackTraceString() +
+                    '\n' +
+                    rowData.ErrorLog__c +
+                    '閿欒娆℃暟宸茬粡瓒呰繃鑷姩鏀朵俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄦ敹淇�';
             }
         }
 
@@ -142,4 +171,4 @@
         }
         update iflog;
     }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/classes/DNUpsertBatch.cls b/force-app/main/default/classes/DNUpsertBatch.cls
index b23a318..da38630 100644
--- a/force-app/main/default/classes/DNUpsertBatch.cls
+++ b/force-app/main/default/classes/DNUpsertBatch.cls
@@ -1,5 +1,5 @@
 global class DNUpsertBatch implements Database.Batchable<sObject>, Database.Stateful {
-    public string  rowData_Id;
+    public string rowData_Id;
     public transient static List<Id> orderReturnIdList;
     private class DNdetail {
         private string DeliveryNote;
@@ -8,29 +8,69 @@
 
     global DNUpsertBatch() {
     }
-    global DNUpsertBatch( string rowData_Id ) {
+    global DNUpsertBatch(string rowData_Id) {
         this.rowData_Id = rowData_Id;
     }
     global Database.QueryLocator start(Database.BatchableContext bc) {
-        if( string.isBlank( rowData_Id )){
+        if (string.isBlank(rowData_Id)) {
             return Database.getQueryLocator(
-                [Select Id, Name, Log__c, ErrorLog__c, Log2__c,
-                 Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c,
-                 Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,
-                 retry_cnt__c,DN_retry_cnt__c, CreatedDate 
-                 from BatchIF_Log__c
-                 where RowDataFlg__c = true
-                 and IsUpsertDN__c = true
-                 and (DN_retry_cnt__c = null
-                     or (DN_retry_cnt__c != 0 and DN_retry_cnt__c < 3))]);
-        }else{
-            return Database.getQueryLocator([Select Id, Name, Log__c, ErrorLog__c, Log2__c,
-                                             Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c,
-                                             Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c,
-                                             retry_cnt__c ,DN_retry_cnt__c,CreatedDate 
-                                             from BatchIF_Log__c
-                                             where RowDataFlg__c = true
-                                             and Id = :rowData_Id ]);
+                [
+                    SELECT
+                        Id,
+                        Name,
+                        Log__c,
+                        ErrorLog__c,
+                        Log2__c,
+                        Log3__c,
+                        Log4__c,
+                        Log5__c,
+                        Log6__c,
+                        Log7__c,
+                        Log8__c,
+                        Log9__c,
+                        Log10__c,
+                        Log11__c,
+                        Log12__c,
+                        MessageGroupNumber__c,
+                        retry_cnt__c,
+                        DN_retry_cnt__c,
+                        CreatedDate
+                    FROM BatchIF_Log__c
+                    WHERE
+                        RowDataFlg__c = TRUE
+                        AND IsUpsertDN__c = TRUE
+                        AND (DN_retry_cnt__c = NULL
+                        OR (DN_retry_cnt__c != 0
+                        AND DN_retry_cnt__c < 3))
+                ]
+            );
+        } else {
+            return Database.getQueryLocator(
+                [
+                    SELECT
+                        Id,
+                        Name,
+                        Log__c,
+                        ErrorLog__c,
+                        Log2__c,
+                        Log3__c,
+                        Log4__c,
+                        Log5__c,
+                        Log6__c,
+                        Log7__c,
+                        Log8__c,
+                        Log9__c,
+                        Log10__c,
+                        Log11__c,
+                        Log12__c,
+                        MessageGroupNumber__c,
+                        retry_cnt__c,
+                        DN_retry_cnt__c,
+                        CreatedDate
+                    FROM BatchIF_Log__c
+                    WHERE RowDataFlg__c = TRUE AND Id = :rowData_Id
+                ]
+            );
         }
     }
     global void execute(Database.BatchableContext BC, List<BatchIF_Log__c> rowDataList) {
@@ -41,19 +81,19 @@
         // String day = String.valueOf(strdate.day()) ;
         // String datestr = String.valueOf(year+month+day);
         //add by rentx 20210727 end
-        
+
         BatchIF_Log__c rowData = rowDataList[0];
         rowData.IsUpsertDN__c = false;
         update rowData;
-        //update by rentx  20210823 
+        //update by rentx  20210823
         //鏈淇敼鍙拡瀵逛簬淇濇湁璁惧 涔嬪墠浣跨敤骞存湀鏃ュ幓鎻掑叆鏃� 浼氬嚭鐜� 鍚屼竴澶╁鎵规棩蹇楅噷鏈夊悓涓�涓澶� 瀵艰嚧鏇存柊澶辫触  鐜拌В鍐虫柟妗堜负绮剧‘鍒板垎
         Datetime nowTime = rowData.CreatedDate;
-        String oyear = String.valueOf(nowTime.year()) ;
-        String omonth = String.valueOf(nowTime.month()) ;
-        String oday = String.valueOf(nowTime.day()) ;
-        String ohour = String.valueOf(nowTime.hour()) ;
-        String ominute = String.valueOf(nowTime.minute()) ;
-        String datestr = String.valueOf(oyear+omonth+oday+ohour+ominute);
+        String oyear = String.valueOf(nowTime.year());
+        String omonth = String.valueOf(nowTime.month());
+        String oday = String.valueOf(nowTime.day());
+        String ohour = String.valueOf(nowTime.hour());
+        String ominute = String.valueOf(nowTime.minute());
+        String datestr = String.valueOf(oyear + omonth + oday + ohour + ominute);
         //update by rentx  20210823
         //涔嬪墠浣跨敤骞存湀鏃ュ幓鎻掑叆鏃� 浼氬嚭鐜� 鍚屼竴澶╁鎵规棩蹇楅噷鏈夊悓涓�涓澶� 瀵艰嚧鏇存柊澶辫触  鐜拌В鍐虫柟妗堜负绮剧‘鍒板垎
 
@@ -69,30 +109,30 @@
         iflog.ErrorLog__c = '';
         insert iflog;
         String rowDataStr = NFMUtil.getRowDataStr(rowData);
-        List<NFM110Rest.GeneralData> generalDataList =
-            (List<NFM110Rest.GeneralData>) JSON.deserialize(rowDataStr, List<NFM110Rest.GeneralData>.class);
+        List<NFM110Rest.GeneralData> generalDataList = (List<NFM110Rest.GeneralData>) JSON.deserialize(
+            rowDataStr,
+            List<NFM110Rest.GeneralData>.class
+        );
         if (generalDataList == null || generalDataList.size() == 0) {
             return;
         }
         // 鐢靛瓙绛炬敹鍗� start 浼樺寲鍘熸湁select
-        list<account> olympusAcclist =
-            [select Id , ParentId ,AgentCode_Ext__c
-             from Account
-             where AgentCode_Ext__c = '9999900' or
-             AgentCode_Ext__c = '9999999' or
-             AgentCode_Ext__c = '9999901'
+        list<account> olympusAcclist = [
+            SELECT Id, ParentId, AgentCode_Ext__c
+            FROM Account
+            WHERE AgentCode_Ext__c = '9999900' OR AgentCode_Ext__c = '9999999' OR AgentCode_Ext__c = '9999901'
         ];
-        Account ocm ,olympus,olympus_return;
-        for(Account tempAcc : olympusAcclist){
-            if(tempAcc.AgentCode_Ext__c.equals('9999900')){
+        Account ocm, olympus, olympus_return;
+        for (Account tempAcc : olympusAcclist) {
+            if (tempAcc.AgentCode_Ext__c.equals('9999900')) {
                 ocm = tempAcc;
-            }else if(tempAcc.AgentCode_Ext__c.equals('9999999')){
+            } else if (tempAcc.AgentCode_Ext__c.equals('9999999')) {
                 olympus = tempAcc;
-            }else if(tempAcc.AgentCode_Ext__c.equals('9999901')){
+            } else if (tempAcc.AgentCode_Ext__c.equals('9999901')) {
                 olympus_return = tempAcc;
             }
         }
-    // 鐢靛瓙绛炬敹鍗� end
+        // 鐢靛瓙绛炬敹鍗� end
         NFM110Rest.isRunning = true;
         //orderoutIdList = new List<Id>();
         orderReturnIdList = new List<Id>();
@@ -121,7 +161,7 @@
                 // 鐥呴櫌銇ㄨê鐧傜銇鐞嗐偝銉笺儔銆乀ODO 璨╁2搴�
                 infoH.EndUserNo = NFMUtil.trimLeft(infoH.EndUserNo, '0');
                 infoH.DepartmentNo = NFMUtil.trimLeft(infoH.DepartmentNo, '0');
-                if (infoH.EndUserNo == null || infoH.EndUserNo  == '') {
+                if (infoH.EndUserNo == null || infoH.EndUserNo == '') {
                     // 鐥呴櫌銇ㄨê鐧傜銇鐞嗐偝銉笺儔銇屻仾銇勫牬鍚堛�佸嚘鐞嗐仺椋涖伆銇�
                     continue;
                 }
@@ -145,106 +185,121 @@
                         //鏍规嵁鏁版嵁浼犵殑鏍峰紡鍐冲畾
                     }
                 }
-                if (!(infoH.ReturnMark == null || infoH.ReturnMark  == ''
-                      || infoH.ReturnMark == '1' || infoH.ReturnMark == '3'
-                     )) {
-                         // ReturnMark = 涓婅浠ュ銇牬鍚� Error銉°儍銈汇兗銈稿嚭鍔�
-                         continue;
-                     }
+                if (!(infoH.ReturnMark == null || infoH.ReturnMark == '' || infoH.ReturnMark == '1' || infoH.ReturnMark == '3')) {
+                    // ReturnMark = 涓婅浠ュ銇牬鍚� Error銉°儍銈汇兗銈稿嚭鍔�
+                    continue;
+                }
                 for (nfm110rest.DnInformation dnInfo : infoH.DnInformation) {
                     dnInfo.SerialNoorLotNo = checkSerialNoorLotNo(dnInfo.SerialNoorLotNo);
                     productCodeList.add(dnInfo.OTCode);
                     // CHAN-BBLAAP start
                     string Product_Serial_No = '';
                     if (dnInfo.SorLMark == 'S') {
-                        Product_Serial_No =
-                            dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo;
+                        Product_Serial_No = dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo;
                     } else {
-                        Product_Serial_No  =
-                            dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo
-                            + '(' + dnInfo.TracingCode + ')';
+                        Product_Serial_No = dnInfo.OTCode + ':' + dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')';
                     }
                     // CHAN-BBLAAP end
-                    if (dnInfo.OTCode == null || dnInfo.OTCode == ''
-                        || dnInfo.SerialNoorLotNo == null || dnInfo.SerialNoorLotNo == ''
-                       ) {
-                           // 鍟嗗搧銈炽兗銉夈亴銇亜鍫村悎銆佸嚘鐞嗐仺椋涖伆銇�
-                           continue;
-                       }
+                    if (dnInfo.OTCode == null || dnInfo.OTCode == '' || dnInfo.SerialNoorLotNo == null || dnInfo.SerialNoorLotNo == '') {
+                        // 鍟嗗搧銈炽兗銉夈亴銇亜鍫村悎銆佸嚘鐞嗐仺椋涖伆銇�
+                        continue;
+                    }
                     // HHOA-AGN2EH start
-                    //add by rentx 20210726 start 
-                    dnInfo.SerialNoorLotNo = dnInfo.SerialNoorLotNo == '.'? datestr +dnInfo.OTCode : dnInfo.SerialNoorLotNo;
+                    //add by rentx 20210726 start
+                    dnInfo.SerialNoorLotNo = dnInfo.SerialNoorLotNo == '.' ? datestr + dnInfo.OTCode : dnInfo.SerialNoorLotNo;
                     //update by rentx 20210726 end
                     productSerialNoList.add(dnInfo.SerialNoorLotNo);
                     productSerialNoList.add(dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')');
                 }
-
             }
             // 鐢靛瓙绛炬敹鍗� start 棰濆妫�绱nd user
-             List<Account> accList = [select Id, Name, Management_Code__c, Department_Class__c, Hospital__c, ParentId,
-                                     RecordType.DeveloperName, Department_Name__c, OCM_man_province_txt__c
-                                     from Account
-                                     where Management_Code__c in :managementCodeList];
+            List<Account> accList = [
+                SELECT
+                    Id,
+                    Name,
+                    Management_Code__c,
+                    Department_Class__c,
+                    Hospital__c,
+                    ParentId,
+                    RecordType.DeveloperName,
+                    Department_Name__c,
+                    OCM_man_province_txt__c
+                FROM Account
+                WHERE Management_Code__c IN :managementCodeList
+            ];
             // HHOA-BLC8S6 update by vivek 2020-02-13 end
             Map<String, Account> accsMap = new Map<String, Account>();
             for (Account acc : accList) {
                 accsMap.put(acc.Management_Code__c, acc);
             }
             Map<String, Opportunity> oppMap = new Map<String, Opportunity>();
-            List<Opportunity> oppList = [Select Id, Purchase_Type__c, Opportunity_No__c,Strategic_department_Class_Name__c,
-                                         Sales_Root__c, SAP_Province__c, Trade__c, Agency1__c,Agency1__r.Name,
-                                         Agency1__r.OCM_man_province_txt__c, Opportunity_Category__c, 
-                                         OCM_man_province_cus__c, Sales_assistant_name_text__c
-                                        // 鐢靛瓙绛炬敹鍗� start
-                                        // 涓存椂浣跨敤 鐢ㄤ綔璇曠偣缁忛攢鍟�
-                                        ,Agency1__r.EsignTestAccount__c,Agency1__r.EsignTestAccountType__c 
-                                        // 鐢靛瓙绛炬敹鍗� end
-                                        //闆嗕腑閲囪喘璇环 绮剧悽鎶�鏈� wql  start
-                                        ,Group_purchase_PCL__c
-                                        //闆嗕腑閲囪喘璇环 绮剧悽鎶�鏈� wql  end
-                                        ,Is_Corrosion__c
-
-                                         From Opportunity Where Opportunity_No__c IN :inquiryNoList];
+            List<Opportunity> oppList = [
+                SELECT
+                    Id,
+                    Purchase_Type__c,
+                    Opportunity_No__c,
+                    Strategic_department_Class_Name__c,
+                    Sales_Root__c,
+                    SAP_Province__c,
+                    Trade__c,
+                    Agency1__c,
+                    Agency1__r.Name,
+                    Agency1__r.OCM_man_province_txt__c,
+                    Opportunity_Category__c,
+                    OCM_man_province_cus__c,
+                    Sales_assistant_name_text__c,
+                    // 鐢靛瓙绛炬敹鍗� start
+                    // 涓存椂浣跨敤 鐢ㄤ綔璇曠偣缁忛攢鍟�
+                    Agency1__r.EsignTestAccount__c,
+                    Agency1__r.EsignTestAccountType__c,
+                    // 鐢靛瓙绛炬敹鍗� end
+                    //闆嗕腑閲囪喘璇环 绮剧悽鎶�鏈� wql  start
+                    Group_purchase_PCL__c,
+                    //闆嗕腑閲囪喘璇环 绮剧悽鎶�鏈� wql  end
+                    Is_Corrosion__c
+                FROM Opportunity
+                WHERE Opportunity_No__c IN :inquiryNoList
+            ];
 
             for (Opportunity opp : oppList) {
                 oppMap.put(opp.Opportunity_No__c, opp);
             }
 
             // 妫�绱㈠嚭DN 骞剁敓鎴怐N Map
-            Boolean flg=true;
-            map <string, Statu_Achievements_DN__c> DNMap = new  map <string, Statu_Achievements_DN__c>();
+            Boolean flg = true;
+            map<string, Statu_Achievements_DN__c> DNMap = new Map<string, Statu_Achievements_DN__c>();
             List<Statu_Achievements_DN__c> DNList = GetDNList(DNNoSet);
-                // [select id, Name,
-                //  DeliveryDate_Raw__c,
-                //  DeliveryNote_Raw__c,
-                //  DepartmentNo_Raw__c,
-                //  EndUserNo_Raw__c,
-                //  InquiryNo_Raw__c,
-                //  ReturnMark_Raw__c,
-                //  SoNo_Raw__c,
-                //  Opportunity__c,
-                //  Statu_Achievements__c,
-                //  endUser__c
-                //  //鐢靛瓙绛炬敹鍗曡瘯鐐圭敤鎴疯祴鍊�
-                //  ,endUser__r.RecordType.Name
-                //  // 鐢靛瓙绛炬敹鍗� start 
-                //  , Sales_assistant_name_text__c,
-                //  RC_Manager__c,ReturnMark__c
-                //  // 璇曠偣鐢ㄦ埛锛屽眾鏃堕渶瑕佸垹鎺�
-                //  , EsignTestAccount__c
-                //  // 鐢靛瓙绛炬敹鍗�  end
-                //  //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� start
-                // , ETRecalledProducts__c
-                //  //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� end
-                //  //acc鏍囪瘑 start
-                //  ,ACC_Text__c,
-                //  Is_Corrosion__c,
-                //  //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 start
-                //  Statu_Achievements__r.orderType__c 
-                //  //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 end
-                //  //acc鏍囪瘑 end
-                //  from Statu_Achievements_DN__c where
-                //  Name in: DNNoSet];
+            // [select id, Name,
+            //  DeliveryDate_Raw__c,
+            //  DeliveryNote_Raw__c,
+            //  DepartmentNo_Raw__c,
+            //  EndUserNo_Raw__c,
+            //  InquiryNo_Raw__c,
+            //  ReturnMark_Raw__c,
+            //  SoNo_Raw__c,
+            //  Opportunity__c,
+            //  Statu_Achievements__c,
+            //  endUser__c
+            //  //鐢靛瓙绛炬敹鍗曡瘯鐐圭敤鎴疯祴鍊�
+            //  ,endUser__r.RecordType.Name
+            //  // 鐢靛瓙绛炬敹鍗� start
+            //  , Sales_assistant_name_text__c,
+            //  RC_Manager__c,ReturnMark__c
+            //  // 璇曠偣鐢ㄦ埛锛屽眾鏃堕渶瑕佸垹鎺�
+            //  , EsignTestAccount__c
+            //  // 鐢靛瓙绛炬敹鍗�  end
+            //  //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� start
+            // , ETRecalledProducts__c
+            //  //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� end
+            //  //acc鏍囪瘑 start
+            //  ,ACC_Text__c,
+            //  Is_Corrosion__c,
+            //  //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 start
+            //  Statu_Achievements__r.orderType__c
+            //  //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 end
+            //  //acc鏍囪瘑 end
+            //  from Statu_Achievements_DN__c where
+            //  Name in: DNNoSet];
             for (Statu_Achievements_DN__c dn : DNList) {
                 DNMap.put(dn.Name, dn);
             }
@@ -254,49 +309,73 @@
             List<DNdetail> insertDNdetailList = new List<DNdetail>();
 
             // CHAN-BBLAAP  end
-            List<Statu_Achievements__c> boList = [select Id, Name
-                                                  from Statu_Achievements__c
-                                                  where Name in :soNoList and OverviewStatus__c <> '鏃犳晥鍚堝悓'];
+            List<Statu_Achievements__c> boList = [
+                SELECT Id, Name
+                FROM Statu_Achievements__c
+                WHERE Name IN :soNoList AND OverviewStatus__c != '鏃犳晥鍚堝悓'
+            ];
             Map<String, String> boMap = new Map<String, String>();
             for (Statu_Achievements__c bo : boList) {
                 boMap.put(bo.Name, bo.Id);
             }
-            
-            List<Product2> prdList = [select Id, Name, ProductCode, ProductCode_Ext__c, MDM_Model_No__c
-                                      from Product2
-                                      where ProductCode_Ext__c in :productCodeList];
+
+            List<Product2> prdList = [
+                SELECT Id, Name, ProductCode, ProductCode_Ext__c, MDM_Model_No__c
+                FROM Product2
+                WHERE ProductCode_Ext__c IN :productCodeList
+            ];
             Map<String, Product2> prdsMap = new Map<String, Product2>();
             for (Product2 prd : prdList) {
                 prdsMap.put(prd.ProductCode_Ext__c, prd);
             }
-            List<Asset> astList = [select Id, Name, Product2.ProductCode, Product2.Dealer_special_Object__c , Product2.Dealer_Object__c,
-                                   SerialNumber, Product_Serial_No__c, Repair_Count__c, TracingCode__c,
-                                   Product2Id, AccountId, Account.Management_Code__c, Department_Class__c, Hospital__c,
-                                   Posting_Date__c, InstallDate, SLMark__c, MDM_Model_No__c, OT_CODE__c,
-                                   Guarantee_period_for_products__c, Installation_Site__c, Delete_Flag__c, Return_Flag__c,
-                                   Extend_Gurantee_DateTo__c, guarantee_period__c, Proviston_period__c
-                                   from Asset
-                                   where SerialNumber in :productSerialNoList
-                                   and IsCompetitorProduct = false
-                                   and Information_From__c <> '澶卞崟'];
+            List<Asset> astList = [
+                SELECT
+                    Id,
+                    Name,
+                    Product2.ProductCode,
+                    Product2.Dealer_special_Object__c,
+                    Product2.Dealer_Object__c,
+                    SerialNumber,
+                    Product_Serial_No__c,
+                    Repair_Count__c,
+                    TracingCode__c,
+                    Product2Id,
+                    AccountId,
+                    Account.Management_Code__c,
+                    Department_Class__c,
+                    Hospital__c,
+                    Posting_Date__c,
+                    InstallDate,
+                    SLMark__c,
+                    MDM_Model_No__c,
+                    OT_CODE__c,
+                    Guarantee_period_for_products__c,
+                    Installation_Site__c,
+                    Delete_Flag__c,
+                    Return_Flag__c,
+                    Extend_Gurantee_DateTo__c,
+                    guarantee_period__c,
+                    Proviston_period__c
+                FROM Asset
+                WHERE SerialNumber IN :productSerialNoList AND IsCompetitorProduct = FALSE AND Information_From__c != '澶卞崟'
+            ];
             Map<String, Asset> astsMap = new Map<String, Asset>();
             for (Asset ast : astList) {
                 astsMap.put(ast.MDM_Model_No__c + ast.SerialNumber, ast);
             }
-            
+
             // 鐢靛瓙绛炬敹鍗� start
             // key 鏄渷浠藉悕瀛楋紝 value 鏄搴旂殑钀ヤ笟绠$悊閮ㄦ媴褰� 1 ,2 ,3
-            Map < String, String > provinceOwnerMap = new Map< String, String > ();
+            Map<String, String> provinceOwnerMap = new Map<String, String>();
             //闆嗕腑閲囪喘璇环 鏋勫缓鍔╃悊map key鏄渷浠藉悕绉� value鏄姪鐞�
-            Map < String, String > provinceGIMap = new Map< String, String > ();
+            Map<String, String> provinceGIMap = new Map<String, String>();
             //妫�绱CSM绠$悊鐪佸璞�
-            //闆嗕腑閲囪喘璇环 澧炲姞妫�绱㈠姪鐞� 
-            List < OCM_Management_Province__c > ompList = [select id, Name, SalesManage__c,GI_assistant__c,Window1__c   from OCM_Management_Province__c ];
+            //闆嗕腑閲囪喘璇环 澧炲姞妫�绱㈠姪鐞�
+            List<OCM_Management_Province__c> ompList = [SELECT id, Name, SalesManage__c, GI_assistant__c FROM OCM_Management_Province__c];
             //瀛樻斁map<鐪侊紝鎷呭綋>
-            for (OCM_Management_Province__c omp: ompList) {
+            for (OCM_Management_Province__c omp : ompList) {
                 provinceOwnerMap.put(omp.Name, omp.SalesManage__c);
-                //provinceGIMap.put(omp.Name,omp.GI_assistant__c); //Commented by Li Jun 20230420
-                provinceGIMap.put(omp.Name, omp.Window1__c);// Add By Li Jun 鏇存柊 绛炬敹鍗曠殑銆愯惀涓氬姪鐞嗐�戝�硷紝浠嶰CSM绠$悊鐪佸搴旂殑銆愯惀涓氱獥鍙c�戝瓧娈佃幏鍙�
+                provinceGIMap.put(omp.Name, omp.GI_assistant__c);
             }
             // 鐢靛瓙绛炬敹鍗� end
 
@@ -320,48 +399,72 @@
                     continue;
                 }
                 if (infoH.DnInformation == null || infoH.DnInformation.size() == 0) {
-                    iflog.ErrorLog__c += 'Error! SoNo[' + infoH.SoNo + '] DeliveryNote[' + infoH.DeliveryNote + '] DnInformation is required. This DN is skipped.\n';
+                    iflog.ErrorLog__c +=
+                        'Error! SoNo[' +
+                        infoH.SoNo +
+                        '] DeliveryNote[' +
+                        infoH.DeliveryNote +
+                        '] DnInformation is required. This DN is skipped.\n';
                     continue;
                 }
-                if (infoH.EndUserNo == null || infoH.EndUserNo  == '') {
-                    iflog.ErrorLog__c += 'Error! SoNo[' + infoH.SoNo + '] DeliveryNote[' + infoH.DeliveryNote + '] EndUserNo is required. This DN is skipped.\n';
+                if (infoH.EndUserNo == null || infoH.EndUserNo == '') {
+                    iflog.ErrorLog__c +=
+                        'Error! SoNo[' +
+                        infoH.SoNo +
+                        '] DeliveryNote[' +
+                        infoH.DeliveryNote +
+                        '] EndUserNo is required. This DN is skipped.\n';
                     continue;
                 }
                 if (accsMap.get(infoH.EndUserNo) == null) {
-                    iflog.ErrorLog__c += 'Error! SoNo[' + infoH.SoNo + '] DeliveryNote[' + infoH.DeliveryNote + '] EndUserNo[' + infoH.EndUserNo + ']NotExist. This DN is skipped.\n';
+                    iflog.ErrorLog__c +=
+                        'Error! SoNo[' +
+                        infoH.SoNo +
+                        '] DeliveryNote[' +
+                        infoH.DeliveryNote +
+                        '] EndUserNo[' +
+                        infoH.EndUserNo +
+                        ']NotExist. This DN is skipped.\n';
                     continue;
-                } else if (accsMap.get(infoH.EndUserNo).RecordType.DeveloperName != 'HP'
-                           && accsMap.get(infoH.EndUserNo).RecordType.DeveloperName != 'Agency'
-                           && accsMap.get(infoH.EndUserNo).RecordType.DeveloperName != 'AgencyContract') {
-                    iflog.ErrorLog__c += 'Error! SoNo[' + infoH.SoNo + '] DeliveryNote[' + infoH.DeliveryNote + '] EndUserNo[' + infoH.EndUserNo + ']Is Not HP or Agency(Contract). This DN is skipped.\n';
+                } else if (
+                    accsMap.get(infoH.EndUserNo).RecordType.DeveloperName != 'HP' &&
+                    accsMap.get(infoH.EndUserNo).RecordType.DeveloperName != 'Agency' &&
+                    accsMap.get(infoH.EndUserNo).RecordType.DeveloperName != 'AgencyContract'
+                ) {
+                    iflog.ErrorLog__c +=
+                        'Error! SoNo[' +
+                        infoH.SoNo +
+                        '] DeliveryNote[' +
+                        infoH.DeliveryNote +
+                        '] EndUserNo[' +
+                        infoH.EndUserNo +
+                        ']Is Not HP or Agency(Contract). This DN is skipped.\n';
                     continue;
                 }
-                Statu_Achievements_DN__c tempSADN =
-                    DNMap.get(infoH.DeliveryNote);
+                Statu_Achievements_DN__c tempSADN = DNMap.get(infoH.DeliveryNote);
                 if (infoH.DeliveryNote != null) {
                     if (tempSADN == null) {
                         tempSADN = new Statu_Achievements_DN__c();
                         tempSADN.Statu_Achievements__c = null;
-                        tempSADN = SetSADN(tempSADN, infoH, boMap, oppMap, accsMap , provinceOwnerMap,provinceGIMap);
-                        checkSA( tempSADN, UpsertDNList, iflog, infoH );
-
+                        tempSADN = SetSADN(tempSADN, infoH, boMap, oppMap, accsMap, provinceOwnerMap, provinceGIMap);
+                        checkSA(tempSADN, UpsertDNList, iflog, infoH);
                     } else {
-                        if (infoH.SoNo != tempSADN.SoNo_Raw__c ||
+                        if (
+                            infoH.SoNo != tempSADN.SoNo_Raw__c ||
                             infoH.InquiryNo != tempSADN.InquiryNo_Raw__c ||
                             infoH.ReturnMark != tempSADN.ReturnMark_Raw__c ||
                             infoH.DeliveryDate != tempSADN.DeliveryDate_Raw__c ||
                             infoH.EndUserNo != tempSADN.EndUserNo_Raw__c ||
                             infoH.DepartmentNo != tempSADN.DepartmentNo_Raw__c ||
                             infoH.DeliveryNote != tempSADN.DeliveryNote_Raw__c
-                           ) {
-                               string SADNID = tempSADN.id;
-                               // 鐢靛瓙绛炬敹鍗�  棰濆澧炲姞钀ヤ笟绠$悊閮ㄦ媴褰撹祴鍊� start
-                               tempSADN = SetSADN(tempSADN, infoH, boMap, 
-                               oppMap,accsMap, provinceOwnerMap,provinceGIMap);
-                               // 鐢靛瓙绛炬敹鍗�  棰濆澧炲姞钀ヤ笟绠$悊閮ㄦ媴褰撹祴鍊� end
-                               tempSADN.id = SADNID;
-                               checkSA( tempSADN, UpsertDNList, iflog, infoH );
-                           }
+                        ) {
+                            string SADNID = tempSADN.id;
+                            // 鐢靛瓙绛炬敹鍗�  棰濆澧炲姞钀ヤ笟绠$悊閮ㄦ媴褰撹祴鍊� start
+                            tempSADN = SetSADN(tempSADN, infoH, boMap, oppMap, accsMap, provinceOwnerMap, provinceGIMap);
+                            // 鐢靛瓙绛炬敹鍗�  棰濆澧炲姞钀ヤ笟绠$悊閮ㄦ媴褰撹祴鍊� end
+                            tempSADN.id = SADNID;
+                            checkSA(tempSADN, UpsertDNList, iflog, infoH);
+                        }
                     }
                 }
                 integer tempDNdetailNumber = 0;
@@ -377,10 +480,13 @@
                     }
                     //  CHAN-BBLAAP 鎻掑叆淇濇湁璁惧鏄庣粏鏃舵彃鍏ュ搴擠N start
                     boolean tempReturnFlg = infoH.ReturnMark == '1' ? true : false;
-                    DNdetail tempDNdetail
-                        = SetSADNDetails(infoH.DeliveryNote, tempReturnFlg, dnInfo, ast,
-                                         dnInfo.SerialNoorLotNo != null && dnInfo.SerialNoorLotNo.equals('.') ?
-                                         tempDNdetailNumber++ : tempDNdetailNumber);
+                    DNdetail tempDNdetail = SetSADNDetails(
+                        infoH.DeliveryNote,
+                        tempReturnFlg,
+                        dnInfo,
+                        ast,
+                        dnInfo.SerialNoorLotNo != null && dnInfo.SerialNoorLotNo.equals('.') ? tempDNdetailNumber++ : tempDNdetailNumber
+                    );
                     insertDNdetailList.add(tempDNdetail);
                 }
             }
@@ -391,43 +497,42 @@
                 DNMap.put(tempSADN.Name, tempSADN);
             }
             DNList = GetDNList(DNMap.keySet());
-                // [select id, Name,
-                //  DeliveryDate_Raw__c,
-                //  DeliveryNote_Raw__c,
-                //  DepartmentNo_Raw__c,
-                //  EndUserNo_Raw__c,
-                //  InquiryNo_Raw__c,
-                //  ReturnMark_Raw__c,
-                //  SoNo_Raw__c,
-                //  Opportunity__c,
-                //  Statu_Achievements__c,
-                //  endUser__c
-                //  //鐢靛瓙绛炬敹鍗曡瘯鐐圭敤鎴疯祴鍊�
-                //  ,endUser__r.RecordType.Name
-                //  // 鐢靛瓙绛炬敹鍗� start 
-                //  , Sales_assistant_name_text__c,
-                //  RC_Manager__c,ReturnMark__c
-                //  // 璇曠偣鐢ㄦ埛锛屽眾鏃堕渶瑕佸垹鎺�
-                //  , EsignTestAccount__c
-                //  // 鐢靛瓙绛炬敹鍗�  end
-                //  //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� start
-                // , ETRecalledProducts__c
-                //  //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� end
-                //  //acc鏍囪瘑 start
-                //  ,ACC_Text__c,
-                //  Is_Corrosion__c,
-                //  Statu_Achievements__r.orderType__c 
-                //  //acc鏍囪瘑 end
-                //  from Statu_Achievements_DN__c where
-                //  Name in: DNMap.keySet()];
+            // [select id, Name,
+            //  DeliveryDate_Raw__c,
+            //  DeliveryNote_Raw__c,
+            //  DepartmentNo_Raw__c,
+            //  EndUserNo_Raw__c,
+            //  InquiryNo_Raw__c,
+            //  ReturnMark_Raw__c,
+            //  SoNo_Raw__c,
+            //  Opportunity__c,
+            //  Statu_Achievements__c,
+            //  endUser__c
+            //  //鐢靛瓙绛炬敹鍗曡瘯鐐圭敤鎴疯祴鍊�
+            //  ,endUser__r.RecordType.Name
+            //  // 鐢靛瓙绛炬敹鍗� start
+            //  , Sales_assistant_name_text__c,
+            //  RC_Manager__c,ReturnMark__c
+            //  // 璇曠偣鐢ㄦ埛锛屽眾鏃堕渶瑕佸垹鎺�
+            //  , EsignTestAccount__c
+            //  // 鐢靛瓙绛炬敹鍗�  end
+            //  //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� start
+            // , ETRecalledProducts__c
+            //  //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� end
+            //  //acc鏍囪瘑 start
+            //  ,ACC_Text__c,
+            //  Is_Corrosion__c,
+            //  Statu_Achievements__r.orderType__c
+            //  //acc鏍囪瘑 end
+            //  from Statu_Achievements_DN__c where
+            //  Name in: DNMap.keySet()];
             for (Statu_Achievements_DN__c dn : DNList) {
                 DNMap.put(dn.Name, dn);
             }
 
-            list<Statu_Achievements_DN_details__c> insertSADNdetailList
-                = new  list<Statu_Achievements_DN_details__c>();
+            list<Statu_Achievements_DN_details__c> insertSADNdetailList = new List<Statu_Achievements_DN_details__c>();
             //鐢靛瓙绛炬敹鍗� 铏氳繘铏氬嚭 tracingcode涓虹┖涓嶇敓鎴愮鏀跺崟 绮剧悽鎶�鏈� 2020/12/08 start
-             map <string, Statu_Achievements_DN__c> DNRestructureMap = new  map <string, Statu_Achievements_DN__c>();   
+            map<string, Statu_Achievements_DN__c> DNRestructureMap = new Map<string, Statu_Achievements_DN__c>();
             //鐢靛瓙绛炬敹鍗� 铏氳繘铏氬嚭 tracingcode涓虹┖涓嶇敓鎴愮鏀跺崟 绮剧悽鎶�鏈� 2020/12/08 end
             for (DNdetail tempDNd : insertDNdetailList) {
                 if (DNMap.containskey(tempDNd.DeliveryNote)) {
@@ -438,25 +543,22 @@
                     insertSADNdetailList.add(tempDNd.DNd);
 
                     //鐢靛瓙绛炬敹鍗� 铏氳繘铏氬嚭 tracingcode涓虹┖涓嶇敓鎴愮鏀跺崟 绮剧悽鎶�鏈� 2020/12/08 start
-                    
-                    if(tempSADN.ACC_Text__c != 'Y'){
-                        if(String.isBlank(tempDNd.DNd.TracingCode_Raw__c)){
-                            tempSADN.ACC_Text__c = 'Y';
 
+                    if (tempSADN.ACC_Text__c != 'Y') {
+                        if (String.isBlank(tempDNd.DNd.TracingCode_Raw__c)) {
+                            tempSADN.ACC_Text__c = 'Y';
                         }
                     }
                     DNRestructureMap.put(tempSADN.Name, tempSADN);
 
                     //鐢靛瓙绛炬敹鍗� 铏氳繘铏氬嚭 tracingcode涓虹┖涓嶇敓鎴愮鏀跺崟 绮剧悽鎶�鏈� 2020/12/08 end
-
-
                 }
             }
-            List<Statu_Achievements_DN_details__c> DNdetailList =
-                [SELECT Id
-                 FROM Statu_Achievements_DN_details__c
-                 where Statu_Achievements_DN__r.Name in: DNMap.keySet()];
-
+            List<Statu_Achievements_DN_details__c> DNdetailList = [
+                SELECT Id
+                FROM Statu_Achievements_DN_details__c
+                WHERE Statu_Achievements_DN__r.Name IN :DNMap.keySet()
+            ];
 
             if (DNdetailList.size() > 0 && !System.Test.isRunningTest()) {
                 delete DNdetailList;
@@ -466,68 +568,69 @@
             }
             // 鐢靛瓙绛炬敹鍗�  2020/07/17 start
             // 妫�绱㈠嚭绛炬敹鍗曪紝骞剁敓鎴愮鏀跺崟map key 涓篋N鍙�
-            map <string, eSignForm__c> eSFMap = new  map <string, eSignForm__c>();
-            List<eSignForm__c> eSFList =
-                [select id, DNName__c,
-                Hazardous_Chemicals__c,
-                 Statu_Achievements__c,Statu_Achievements_DN__c
-                 from eSignForm__c where
-                 DNName__c in: DNNoSet];
+            map<string, eSignForm__c> eSFMap = new Map<string, eSignForm__c>();
+            List<eSignForm__c> eSFList = [
+                SELECT id, DNName__c, Hazardous_Chemicals__c, Statu_Achievements__c, Statu_Achievements_DN__c
+                FROM eSignForm__c
+                WHERE DNName__c IN :DNNoSet
+            ];
             for (eSignForm__c eSF : eSFList) {
                 eSFMap.put(eSF.DNName__c, eSF);
             }
             //鐢靛瓙绛炬敹鍗� 铏氳繘铏氬嚭 鏄庣粏涓簉acing code 涓虹┖鐨� 涓嶇敓鎴愮鏀跺崟 20201207 绮剧悽鎶�鏈� start
-            list<eSignForm__c> UpsertESFList = SetupeSignForm( eSFMap , DNRestructureMap.values() );
-            
+            list<eSignForm__c> UpsertESFList = SetupeSignForm(eSFMap, DNRestructureMap.values());
+
             //鐢靛瓙绛炬敹鍗� 铏氳繘铏氬嚭 鏄庣粏涓簉acing code 涓虹┖鐨� 涓嶇敓鎴愮鏀跺崟 20201207 绮剧悽鎶�鏈� end
-            if(UpsertESFList.size()> 0) {
+            if (UpsertESFList.size() > 0) {
                 upsert UpsertESFList;
             }
             // key 涓� 瀵瑰簲DN鐨処D
-            map <string, eSignForm__c> eSFAllMap = new map <string, eSignForm__c> ();
-            for( eSignForm__c tempeSignForm : UpsertESFList){
-                eSFAllMap.put(tempeSignForm.DNName__c,tempeSignForm);
+            map<string, eSignForm__c> eSFAllMap = new Map<string, eSignForm__c>();
+            for (eSignForm__c tempeSignForm : UpsertESFList) {
+                eSFAllMap.put(tempeSignForm.DNName__c, tempeSignForm);
             }
 
-
             // 妫�绱㈢幇鏈夌鏀跺崟鏄庣粏锛屽苟鐢熸垚绛炬敹鍗曟槑缁唌ap key 涓篋N鍙� + 浜у搧OTCode
-            map <string, eSignFormLineItem__c> eSFLMap = new  map <string, eSignFormLineItem__c>();
-            List<eSignFormLineItem__c> eSFLList =
-                [select id,DNProductNo__c,
-                 Count__c,Product2__c,eSignForm__c 
-                 , CaseNumber__c 
-                 from eSignFormLineItem__c
-                 where eSignForm__r.DNName__c in: DNNoSet
-                ];
+            map<string, eSignFormLineItem__c> eSFLMap = new Map<string, eSignFormLineItem__c>();
+            List<eSignFormLineItem__c> eSFLList = [
+                SELECT id, DNProductNo__c, Count__c, Product2__c, eSignForm__c, CaseNumber__c
+                FROM eSignFormLineItem__c
+                WHERE eSignForm__r.DNName__c IN :DNNoSet
+            ];
             for (eSignFormLineItem__c eSFL : eSFLList) {
                 eSFL.Count__c = 0;
                 eSFLMap.put(eSFL.DNProductNo__c, eSFL);
             }
             // 鏋勯�犵鏀跺崟鏄庣粏
-            list<eSignFormLineItem__c> UpsertESFLList =
-                SetupeSignFormLineItems( insertSADNdetailList, eSFLMap , eSFAllMap, prdsMap);
-            if(UpsertESFLList.size() > 0){
+            list<eSignFormLineItem__c> UpsertESFLList = SetupeSignFormLineItems(insertSADNdetailList, eSFLMap, eSFAllMap, prdsMap);
+            if (UpsertESFLList.size() > 0) {
                 upsert UpsertESFLList;
             }
             rowData.IsUpsertDN__c = false;
             rowData.DN_retry_cnt__c = 0;
-            if(System.Test.isRunningTest()){
+            if (System.Test.isRunningTest()) {
                 throw new ControllerUtil.myException('娴嬭瘯閿欒锛�');
             }
             // 鐢靛瓙绛炬敹鍗�  2020/07/17 end
-            
         } catch (Exception ex) {
             Database.rollback(sp);
             logstr += '\n' + ex.getMessage();
-             rowData.IsUpsertDN__c = true;
+            rowData.IsUpsertDN__c = true;
             iflog.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + iflog.ErrorLog__c;
-            if (rowData.DN_retry_cnt__c == null) rowData.DN_retry_cnt__c = 0;
+            if (rowData.DN_retry_cnt__c == null)
+                rowData.DN_retry_cnt__c = 0;
             if (rowData.DN_retry_cnt__c < batch_retry_max_cnt) {
                 rowData.DN_retry_cnt__c++;
                 DNUpsertSchedule.assignOneMinute();
             }
             if (rowData.DN_retry_cnt__c >= batch_retry_max_cnt) {
-                rowData.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + rowData.ErrorLog__c + '閿欒娆℃暟宸茬粡瓒呰繃鑷姩鏀朵俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄦ敹淇�';
+                rowData.ErrorLog__c =
+                    ex.getMessage() +
+                    '\n' +
+                    ex.getStackTraceString() +
+                    '\n' +
+                    rowData.ErrorLog__c +
+                    '閿欒娆℃暟宸茬粡瓒呰繃鑷姩鏀朵俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄦ敹淇�';
             }
         }
 
@@ -540,107 +643,92 @@
             iflog.ErrorLog__c = iflog.ErrorLog__c.subString(0, 32760) + ' ...';
         }
         update iflog;
-
     }
     //浼樺寲涓ゆsql鏌ヨ thh 2021-11-02 start
-    private static list<Statu_Achievements_DN__c> GetDNList(Set<String> DNNoSet){
-        List<Statu_Achievements_DN__c> DNList =
-                [select id, Name,
-                 DeliveryDate_Raw__c,
-                 DeliveryNote_Raw__c,
-                 DepartmentNo_Raw__c,
-                 EndUserNo_Raw__c,
-                 InquiryNo_Raw__c,
-                 ReturnMark_Raw__c,
-                 SoNo_Raw__c,
-                 Opportunity__c,
-                 Statu_Achievements__c,
-                 endUser__c
-                 //鐢靛瓙绛炬敹鍗曡瘯鐐圭敤鎴疯祴鍊�
-                 ,endUser__r.RecordType.Name
-                 // 鐢靛瓙绛炬敹鍗� start 
-                 , Sales_assistant_name_text__c,
-                 RC_Manager__c,ReturnMark__c
-                 // 璇曠偣鐢ㄦ埛锛屽眾鏃堕渶瑕佸垹鎺�
-                 , EsignTestAccount__c
-                 // 鐢靛瓙绛炬敹鍗�  end
-                 //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� start
-                , ETRecalledProducts__c
-                 //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� end
-                 //acc鏍囪瘑 start
-                 ,ACC_Text__c,
-                 Is_Corrosion__c,
-                 //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 start
-                 Statu_Achievements__r.orderType__c 
-                 //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 end
-                 //acc鏍囪瘑 end
-                 //Add by Li Jun 20230420 start 
-                 ,Opportunity__r.OCM_man_province_cus__c
-                 //Add By Li Jun 20230420 end
-                 from Statu_Achievements_DN__c where
-                 Name in: DNNoSet];
+    private static list<Statu_Achievements_DN__c> GetDNList(Set<String> DNNoSet) {
+        List<Statu_Achievements_DN__c> DNList = [
+            SELECT
+                id,
+                Name,
+                DeliveryDate_Raw__c,
+                DeliveryNote_Raw__c,
+                DepartmentNo_Raw__c,
+                EndUserNo_Raw__c,
+                InquiryNo_Raw__c,
+                ReturnMark_Raw__c,
+                SoNo_Raw__c,
+                Opportunity__c,
+                Statu_Achievements__c,
+                endUser__c,
+                //鐢靛瓙绛炬敹鍗曡瘯鐐圭敤鎴疯祴鍊�
+                endUser__r.RecordType.Name,
+                // 鐢靛瓙绛炬敹鍗� start
+                Sales_assistant_name_text__c,
+                RC_Manager__c,
+                ReturnMark__c,
+                // 璇曠偣鐢ㄦ埛锛屽眾鏃堕渶瑕佸垹鎺�
+                EsignTestAccount__c,
+                // 鐢靛瓙绛炬敹鍗�  end
+                //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� start
+                ETRecalledProducts__c,
+                //ET鍙洖鍝佷笉鐢熸垚绛炬敹鍗� end
+                //acc鏍囪瘑 start
+                ACC_Text__c,
+                Is_Corrosion__c,
+                //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 start
+                Statu_Achievements__r.orderType__c
+            //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 end
+            //acc鏍囪瘑 end
+            FROM Statu_Achievements_DN__c
+            WHERE Name IN :DNNoSet
+        ];
         return DNList;
     }
     global void finish(Database.BatchableContext BC) {
     }
-
-    //Add By Li Jun 0420 Start query management province
-    private static Map<String,OCM_Management_Province__c> provinceManagementMap{set;get;}
-    public static Map<String,OCM_Management_Province__c> getManagementProvince(){ 
-        if(provinceManagementMap !=null && provinceManagementMap.keySet().size()>0 ){
-            return provinceManagementMap;
-        }
-        provinceManagementMap = new Map<String,OCM_Management_Province__c>();
-        List <OCM_Management_Province__c > ompList = [select id, Name, SalesManage__c,GI_assistant__c,Window1__c   from OCM_Management_Province__c];
-        for (OCM_Management_Province__c omp: ompList) {
-            provinceManagementMap.put(omp.Name,omp);
-        }
-        return provinceManagementMap;
-    }
-      //Add By Li Jun 0420 End
     /* 鏋勫缓绛炬敹鍗曪細
      * eSFMap 鏄郴缁熼噷闈㈢幇鏈夌殑绛炬敹鍗�
      * key 涓� DN鍙凤紱
      * 閫�璐N涓嶇敓鎴愮鏀跺崟
      */
     @TestVisible
-    private static list<eSignForm__c> SetupeSignForm(map <string, eSignForm__c> eSFMap , list<Statu_Achievements_DN__c> DNList){
-        list<eSignForm__c> UpsertESFList = new list<eSignForm__c> ();
-        for(Statu_Achievements_DN__c tempDN:DNList ){
+    private static list<eSignForm__c> SetupeSignForm(map<string, eSignForm__c> eSFMap, list<Statu_Achievements_DN__c> DNList) {
+        list<eSignForm__c> UpsertESFList = new List<eSignForm__c>();
+        for (Statu_Achievements_DN__c tempDN : DNList) {
             // 鑾峰彇鐜版湁绛炬敹鍗�
             eSignForm__c tempeSF = eSFMap.get(tempDN.Name);
-            if( tempeSF == null ){
+            if (tempeSF == null) {
                 tempeSF = new eSignForm__c();
             }
 
             // 绛炬敹鍗曞悕瀛� 涓猴細 DN鍙�-鍙戣揣鏃ュ勾鏈堟棩
-            string datestr = tempDN.DeliveryDate_Raw__c == null?
-            Date.today().format().ReplaceAll('/', ''):
-            tempDN.DeliveryDate_Raw__c ;
-            tempeSF.Name = string.valueof(integer.valueOf(tempDN.Name)) + '-' +datestr;
-            
+            string datestr = tempDN.DeliveryDate_Raw__c == null ? Date.today().format().ReplaceAll('/', '') : tempDN.DeliveryDate_Raw__c;
+            tempeSF.Name = string.valueof(integer.valueOf(tempDN.Name)) + '-' + datestr;
+
             tempeSF.DNName__c = tempDN.Name;
             tempeSF.Statu_Achievements__c = tempDN.Statu_Achievements__c;
             tempeSF.Statu_Achievements_DN__c = tempDN.ID;
-            //Updated By Li Jun 20230420 start 
-            //tempeSF.Sales_assistant_name_text__c = tempDN.Sales_assistant_name_text__c;
-            tempeSF.Sales_assistant_name_text__c = tempDN.Opportunity__c != null && tempDN.Opportunity__r.OCM_man_province_cus__c != '' && getManagementProvince().containsKey(tempDN.Opportunity__r.OCM_man_province_cus__c)? 
-                                                    getManagementProvince().get(tempDN.Opportunity__r.OCM_man_province_cus__c).Window1__c: null;
-            
+            tempeSF.Sales_assistant_name_text__c = tempDN.Sales_assistant_name_text__c;
             tempeSF.RC_Manager__c = tempDN.RC_Manager__c;
-            //Updated By Li Jun 20230420 end
             //鐢熸垚绛炬敹鍗曟椂锛岀粰鏄惁鏃犲伩鍑哄簱璧嬪��  绮剧悽鎶�鏈� thh 2021-10-15 start
-            if(tempDN.Statu_Achievements__r.orderType__c == 'ZM16'){
+            if (tempDN.Statu_Achievements__r.orderType__c == 'ZM16') {
                 tempeSF.isFreeDelivery__c = true;
             }
             //鐢熸垚绛炬敹鍗曟椂锛岀粰鏄惁鏃犲伩鍑哄簱璧嬪��  绮剧悽鎶�鏈� thh 2021-10-15 end
 
             // 缁忛攢鍟嗚瘯鐐圭敤鎴�
             //鐢靛瓙绛炬敹鍗� 铏氳繘铏氬嚭 鏄庣粏涓簉acing code 涓虹┖鐨� 涓嶇敓鎴愮鏀跺崟 20201207 绮剧悽鎶�鏈� start
-            if(tempDN.EsignTestAccount__c && !tempDN.ETRecalledProducts__c&&!tempDN.ReturnMark__c&&(tempDN.ACC_Text__c!='Y'||(tempDN.ACC_Text__c=='Y'&&tempDN.Is_Corrosion__c))){//&&tempDN.Is_Corrosion__c
+            if (
+                tempDN.EsignTestAccount__c &&
+                !tempDN.ETRecalledProducts__c &&
+                !tempDN.ReturnMark__c &&
+                (tempDN.ACC_Text__c != 'Y' || (tempDN.ACC_Text__c == 'Y' && tempDN.Is_Corrosion__c))
+            ) {
+                //&&tempDN.Is_Corrosion__c
                 //娣诲姞鍗卞寲鍝佹爣璇�
-                if(tempDN.ACC_Text__c=='Y'&&tempDN.Is_Corrosion__c){//&&tempDN.Is_Corrosion__c
-                    tempeSF.Hazardous_Chemicals__c=true;
+                if (tempDN.ACC_Text__c == 'Y' && tempDN.Is_Corrosion__c) {
+                    //&&tempDN.Is_Corrosion__c
+                    tempeSF.Hazardous_Chemicals__c = true;
                 }
                 UpsertESFList.add(tempeSF);
             }
@@ -663,202 +751,208 @@
     @TestVisible
     private static list<eSignFormLineItem__c> SetupeSignFormLineItems(
         list<Statu_Achievements_DN_details__c> insertSADNdetailList,
-        map <string, eSignFormLineItem__c> eSFLMap ,map <string, eSignForm__c> eSFAllMap,
-        Map<String, Product2> prdsMap){
-            // key 鏄� DN鍙� + 绠卞彿 + 浜у搧OTCode
-            for(Statu_Achievements_DN_details__c tempDNDetail : insertSADNdetailList){
-                string key = tempDNDetail.DNName__c + '-' + 
-                tempDNDetail.CaseNumber__c + '-' + tempDNDetail.OTCode_Raw__c;
-                //鑾峰彇鐜版湁绛炬敹鍗曟槑缁�
-                eSignFormLineItem__c tempeSignFormLineItem = eSFLMap.get(key);
-                if( tempeSignFormLineItem == null){
-                    tempeSignFormLineItem = new eSignFormLineItem__c();
-                    tempeSignFormLineItem.Count__c = 0;
-                }
-                tempeSignFormLineItem.Count__c++;
-                // Double CaseNumber;
-                if(string.isBlank(tempDNDetail.CaseNumber__c)){
-                    tempeSignFormLineItem.CaseNumber__c = null;
-                }else{
-                    tempeSignFormLineItem.CaseNumber__c = Double.valueOf(tempDNDetail.CaseNumber__c);
-                }
-                // Double CaseNumber = tempDNDetail.CaseNumber__c == null ? tempDNDetail.CaseNumber__c : Double.valueOf(tempDNDetail.CaseNumber__c);
-                tempeSignFormLineItem.DNProductNo__c = key ;
-                tempeSignFormLineItem.Name  = tempDNDetail.CaseNumber__c == null ? String.valueOf(integer.valueOf(tempDNDetail.DNName__c)) + '-' +  tempDNDetail.OTCode_Raw__c:String.valueOf(integer.valueOf(tempDNDetail.DNName__c)) + '-' + 
-                tempDNDetail.CaseNumber__c + '-' + tempDNDetail.OTCode_Raw__c;
-                tempeSignFormLineItem.Product2__c = prdsMap.get(tempDNDetail.OTCode_Raw__c).ID;
-                if(eSFAllMap.containskey(tempDNDetail.DNName__c)){
-                    tempeSignFormLineItem.eSignForm__c = eSFAllMap.get(tempDNDetail.DNName__c).ID;
-                    eSFLMap.put(key,tempeSignFormLineItem);
-                }
+        map<string, eSignFormLineItem__c> eSFLMap,
+        map<string, eSignForm__c> eSFAllMap,
+        Map<String, Product2> prdsMap
+    ) {
+        // key 鏄� DN鍙� + 绠卞彿 + 浜у搧OTCode
+        for (Statu_Achievements_DN_details__c tempDNDetail : insertSADNdetailList) {
+            string key = tempDNDetail.DNName__c + '-' + tempDNDetail.CaseNumber__c + '-' + tempDNDetail.OTCode_Raw__c;
+            //鑾峰彇鐜版湁绛炬敹鍗曟槑缁�
+            eSignFormLineItem__c tempeSignFormLineItem = eSFLMap.get(key);
+            if (tempeSignFormLineItem == null) {
+                tempeSignFormLineItem = new eSignFormLineItem__c();
+                tempeSignFormLineItem.Count__c = 0;
             }
-            return eSFLMap.values();
+            tempeSignFormLineItem.Count__c++;
+            // Double CaseNumber;
+            if (string.isBlank(tempDNDetail.CaseNumber__c)) {
+                tempeSignFormLineItem.CaseNumber__c = null;
+            } else {
+                tempeSignFormLineItem.CaseNumber__c = Double.valueOf(tempDNDetail.CaseNumber__c);
+            }
+            // Double CaseNumber = tempDNDetail.CaseNumber__c == null ? tempDNDetail.CaseNumber__c : Double.valueOf(tempDNDetail.CaseNumber__c);
+            tempeSignFormLineItem.DNProductNo__c = key;
+            tempeSignFormLineItem.Name = tempDNDetail.CaseNumber__c == null
+                ? String.valueOf(integer.valueOf(tempDNDetail.DNName__c)) + '-' + tempDNDetail.OTCode_Raw__c
+                : String.valueOf(integer.valueOf(tempDNDetail.DNName__c)) +
+                  '-' +
+                  tempDNDetail.CaseNumber__c +
+                  '-' +
+                  tempDNDetail.OTCode_Raw__c;
+            tempeSignFormLineItem.Product2__c = prdsMap.get(tempDNDetail.OTCode_Raw__c).ID;
+            if (eSFAllMap.containskey(tempDNDetail.DNName__c)) {
+                tempeSignFormLineItem.eSignForm__c = eSFAllMap.get(tempDNDetail.DNName__c).ID;
+                eSFLMap.put(key, tempeSignFormLineItem);
+            }
         }
+        return eSFLMap.values();
+    }
     // 璁剧疆鍙戣揣DN
     private static Statu_Achievements_DN__c SetSADN(
         Statu_Achievements_DN__c tempSADN,
         NFM110Rest.GeneralData infoH,
         Map<String, String> boMap,
         Map<String, Opportunity> oppMap,
-      Map<String, Account> accsMap, 
-        Map < String, String > provinceOwnerMap,
-        Map < String, String > provinceGIMap) {
-            tempSADN.SoNo_Raw__c = infoH.SoNo;
-            tempSADN.InquiryNo_Raw__c = infoH.InquiryNo ;
-            tempSADN.ReturnMark_Raw__c = infoH.ReturnMark ;
-            tempSADN.DeliveryDate_Raw__c = infoH.DeliveryDate ;
-            tempSADN.EndUserNo_Raw__c = infoH.EndUserNo ;
-            tempSADN.DepartmentNo_Raw__c = infoH.DepartmentNo ;
-            tempSADN.DeliveryNote_Raw__c = infoH.DeliveryNote ;
-            // 鐢靛瓙绛炬敹鍗� 2020/07/17 start
-            tempSADN.supplier__c = infoH.supplier ;
-            tempSADN.supplierNo__c = infoH.supplierNo ;
-            tempSADN.shippingUnit__c = infoH.shippingUnit ;
-            tempSADN.shippingAddress__c = infoH.shippingAddress ;
-            tempSADN.contactName__c = infoH.contactName ;
-            tempSADN.contactNumber__c = infoH.contactNumber ;
-            tempSADN.totalNumber__c = infoH.totalNumber ;
-            tempSADN.transportMode__c = infoH.transportMode ;
-            tempSADN.totalWeight__c = infoH.totalWeight ;
-            //tempSADN.GoodDetails__c = infoH.GoodDetails ;
-            //tempSADN.weight__c = infoH.weight ;
-            tempSADN.endUser__c = accsMap.get(infoH.EndUserNo) == null ?null : accsMap.get(infoH.EndUserNo).id  ;
+        Map<String, Account> accsMap,
+        Map<String, String> provinceOwnerMap,
+        Map<String, String> provinceGIMap
+    ) {
+        tempSADN.SoNo_Raw__c = infoH.SoNo;
+        tempSADN.InquiryNo_Raw__c = infoH.InquiryNo;
+        tempSADN.ReturnMark_Raw__c = infoH.ReturnMark;
+        tempSADN.DeliveryDate_Raw__c = infoH.DeliveryDate;
+        tempSADN.EndUserNo_Raw__c = infoH.EndUserNo;
+        tempSADN.DepartmentNo_Raw__c = infoH.DepartmentNo;
+        tempSADN.DeliveryNote_Raw__c = infoH.DeliveryNote;
+        // 鐢靛瓙绛炬敹鍗� 2020/07/17 start
+        tempSADN.supplier__c = infoH.supplier;
+        tempSADN.supplierNo__c = infoH.supplierNo;
+        tempSADN.shippingUnit__c = infoH.shippingUnit;
+        tempSADN.shippingAddress__c = infoH.shippingAddress;
+        tempSADN.contactName__c = infoH.contactName;
+        tempSADN.contactNumber__c = infoH.contactNumber;
+        tempSADN.totalNumber__c = infoH.totalNumber;
+        tempSADN.transportMode__c = infoH.transportMode;
+        tempSADN.totalWeight__c = infoH.totalWeight;
+        //tempSADN.GoodDetails__c = infoH.GoodDetails ;
+        //tempSADN.weight__c = infoH.weight ;
+        tempSADN.endUser__c = accsMap.get(infoH.EndUserNo) == null ? null : accsMap.get(infoH.EndUserNo).id;
 
-            // 鐢靛瓙绛炬敹鍗� 2020/07/17 end
-            //澧炲姞鍙戣揣DNacc鏍囪瘑 2020/11/23 start
-            if(infoH.ACCMark !=null){
-                if(infoH.ACCMark.trim() == 'Y'){
-                    tempSADN.ACC_Mark__c = 'Y';
-                }else{
-                    tempSADN.ACC_Mark__c = 'N';
-                }
+        // 鐢靛瓙绛炬敹鍗� 2020/07/17 end
+        //澧炲姞鍙戣揣DNacc鏍囪瘑 2020/11/23 start
+        if (infoH.ACCMark != null) {
+            if (infoH.ACCMark.trim() == 'Y') {
+                tempSADN.ACC_Mark__c = 'Y';
+            } else {
+                tempSADN.ACC_Mark__c = 'N';
             }
-            tempSADN.name = infoH.DeliveryNote;
-            tempSADN.ReturnMark__c = infoH.ReturnMark == '1' ? true : false;
-            if (tempSADN.Statu_Achievements__c == null) {
-                tempSADN.Statu_Achievements__c = boMap.get(infoH.SoNo);
-            }
-            tempSADN.DeliveryDate__c = NFMUtil.parseStr2Date(infoH.DeliveryDate);
-            //鍙戣揣鏃ュ湪2020/12/01浠ュ悗鐨勶紝鎵嶇敓鎴愮鏀跺崟 start
-            Date afterDate = NFMUtil.parseStr2Date('20201201');
-            String todate = NFMUtil.formatDate2Str(afterDate);
-            String DeliveryDate = NFMUtil.formatDate2Str(tempSADN.DeliveryDate__c);
-            //鍙戣揣鏃ュ湪2020/12/01浠ュ悗鐨勶紝鎵嶇敓鎴愮鏀跺崟 end
-           
-            String[] Inquiry;
-            if (infoH.InquiryNo != null && infoH.InquiryNo.contains(',')) {
-                Inquiry = infoH.InquiryNo.split(',');
-                if (oppMap.get(Inquiry[0]) != null) {
-                    opportunity opp =  oppMap.get(Inquiry[0]);
-                    tempSADN.Opportunity__c = opp.id;
-                    tempSADN.Is_Corrosion__c=opp.Is_Corrosion__c;
-                    // 鐢靛瓙绛炬敹鍗�  璧嬪�艰惀涓氬姪鐞嗗拰钀ヤ笟绠$悊閮ㄦ媴褰� start
-                    //闆嗕腑閲囪喘鐨勮浠� 绮剧悽鎶�鏈� wql 2020/01/11 start 
-                    //Add By Li Jun 20230420 Start 
-                    tempSADN.Sales_assistant_name_text__c =opp.OCM_man_province_cus__c!='' && provinceGIMap.containskey(opp.OCM_man_province_cus__c)?provinceGIMap.get(opp.OCM_man_province_cus__c):null;
-                    //Add By Li Jun 20230420 End
-                    if(opp.Group_purchase_PCL__c){
-                        //tempSADN.Sales_assistant_name_text__c = provinceGIMap.get('闆嗛噰璇�'); //Commented By Li Jun 20230420
-                        tempSADN.RC_Manager__c =  provinceOwnerMap.get('闆嗛噰璇�');
-                    }else{
-                        //tempSADN.Sales_assistant_name_text__c = opp.Sales_assistant_name_text__c; //Commented By Li Jun 20230420
-                        tempSADN.RC_Manager__c =  provinceOwnerMap.get(opp.OCM_man_province_cus__c);
-                    }
-                    //闆嗕腑閲囪喘鐨勮浠� 绮剧悽鎶�鏈� wql 2020/01/11 end
-                    
-                    
-                    //濡傛灉 鍙戣揣鏃ユ湡 澶т簬 2020/12/01 鎵嶇敓鎴愮鏀跺崟
-                    if(DeliveryDate >= todate){
-                    
-                        tempSADN.EsignTestAccount__c =true;
-                    }else{
-                        tempSADN.EsignTestAccount__c =false;
-                    }
-
-                    //SAP閲屽彫鍥炲搧鎹㈠嚭璁㈠崟鐨勯�佽揪鏂瑰湴鍧�濡傛灉涓哄ゥ鏋楀反鏂姙浜嬪鐨勫湴鍧�锛孌N涓嶇敓鎴愬緟绛炬敹淇℃伅銆�
-                    String ContactName = tempSADN.ContactName__c.toUpperCase();
-                    if(ContactName.indexOf('OCSM')>=0){
-                        tempSADN.ETRecalledProducts__c =true;
-                    }else{
-                        tempSADN.ETRecalledProducts__c =false;
-                    }
-                    
-                }
-                if (Inquiry.size() > 1) {
-                    tempSADN.Order_No__c = Inquiry[1];
-                }
-            }
-            return tempSADN;
         }
-    private static void checkSA(Statu_Achievements_DN__c tempSADN,
-                                List<Statu_Achievements_DN__c> UpsertDNList,
-                                BatchIF_Log__c iflog,
-                                NFM110rest.GeneralData infoH ) {
-                                    if (tempSADN.Statu_Achievements__c != null)
-                                        UpsertDNList.add(tempSADN);
-                                    else {
-                                        iflog.ErrorLog__c += 'warning! SoNo[' + infoH.SoNo +
-                                            '] Statu_Achievements__c  NotExist. The insert of this DN is skipped.\n';
-                                    }                                    
-                                }
-    private static DNdetail SetSADNDetails(string DNnumber, boolean returnFlg,
-                                           NFM110Rest.DnInformation dnInfo, asset ast, integer tempDNdetailNumber) {
-                                               DNdetail tempDNdetail = new DNdetail();
-                                               Statu_Achievements_DN_details__c DNd = new Statu_Achievements_DN_details__c();
-                                               DNd.Qty_Raw__c = dnInfo.QTY;
-                                               DNd.QTY__c = String.isBlank(dnInfo.QTY) || Decimal.valueOf(dnInfo.QTY.trim()) == 0 ?
-                                                   1 : Decimal.valueOf(dnInfo.QTY.trim());
-                                               DNd.ShippedAmount_without_tax__c = String.isBlank(dnInfo.NetWorth) ?
-                                                   0 : returnFlg == false ?
-                                                       Decimal.valueOf(dnInfo.NetWorth.trim()) : - Decimal.valueOf(dnInfo.NetWorth.trim());
+        tempSADN.name = infoH.DeliveryNote;
+        tempSADN.ReturnMark__c = infoH.ReturnMark == '1' ? true : false;
+        if (tempSADN.Statu_Achievements__c == null) {
+            tempSADN.Statu_Achievements__c = boMap.get(infoH.SoNo);
+        }
+        tempSADN.DeliveryDate__c = NFMUtil.parseStr2Date(infoH.DeliveryDate);
+        //鍙戣揣鏃ュ湪2020/12/01浠ュ悗鐨勶紝鎵嶇敓鎴愮鏀跺崟 start
+        Date afterDate = NFMUtil.parseStr2Date('20201201');
+        String todate = NFMUtil.formatDate2Str(afterDate);
+        String DeliveryDate = NFMUtil.formatDate2Str(tempSADN.DeliveryDate__c);
+        //鍙戣揣鏃ュ湪2020/12/01浠ュ悗鐨勶紝鎵嶇敓鎴愮鏀跺崟 end
 
-                                               DNd.ShippedAmount__c = String.isBlank(dnInfo.VALUE) ?
-                                                   0 : returnFlg == false ?
-                                                       Decimal.valueOf(dnInfo.VALUE.trim()) : - Decimal.valueOf(dnInfo.VALUE.trim());
+        String[] Inquiry;
+        if (infoH.InquiryNo != null && infoH.InquiryNo.contains(',')) {
+            Inquiry = infoH.InquiryNo.split(',');
+            if (oppMap.get(Inquiry[0]) != null) {
+                opportunity opp = oppMap.get(Inquiry[0]);
+                tempSADN.Opportunity__c = opp.id;
+                tempSADN.Is_Corrosion__c = opp.Is_Corrosion__c;
+                // 鐢靛瓙绛炬敹鍗�  璧嬪�艰惀涓氬姪鐞嗗拰钀ヤ笟绠$悊閮ㄦ媴褰� start
+                //闆嗕腑閲囪喘鐨勮浠� 绮剧悽鎶�鏈� wql 2020/01/11 start
+                if (opp.Group_purchase_PCL__c) {
+                    tempSADN.Sales_assistant_name_text__c = provinceGIMap.get('闆嗛噰璇�');
+                    tempSADN.RC_Manager__c = provinceOwnerMap.get('闆嗛噰璇�');
+                } else {
+                    tempSADN.Sales_assistant_name_text__c = opp.Sales_assistant_name_text__c;
+                    tempSADN.RC_Manager__c = provinceOwnerMap.get(opp.OCM_man_province_cus__c);
+                }
+                //闆嗕腑閲囪喘鐨勮浠� 绮剧悽鎶�鏈� wql 2020/01/11 end
 
-                                               DNd.NetWorthNoProviston__c = String.isBlank(dnInfo.NetWorthNoProviston) ?
-                                                   0 : returnFlg == false ?
-                                                       Decimal.valueOf(dnInfo.NetWorthNoProviston.trim()) : - Decimal.valueOf(dnInfo.NetWorthNoProviston.trim());
-                                               if (dnInfo.SorLMark == 'S') {
-                                                   DNd.SerialNumber__c = dnInfo.SerialNoorLotNo;
-                                               } else {
-                                                   DNd.SerialNumber__c  = dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')';
-                                               }
-                                               DNd.Product_Serial_No__c = dnInfo.OTCode + ':' + DNd.SerialNumber__c;
-                                               DNd.DNProduct_Serial_No__c = DNnumber + ':' + DNd.Product_Serial_No__c;
-                                               if (dnInfo.SerialNoorLotNo != null && dnInfo.SerialNoorLotNo.equals('.')) {
-                                                   DNd.DNProduct_Serial_No__c += tempDNdetailNumber;
-                                               }
-                                               // 鐢靛瓙绛炬敹鍗� start
-                                               DNd.CaseNumber__c = NFMUtil.trimLeft(dnInfo.CaseNumber, '0');
-                                               // 鐢靛瓙绛炬敹鍗� end
+                //濡傛灉 鍙戣揣鏃ユ湡 澶т簬 2020/12/01 鎵嶇敓鎴愮鏀跺崟
+                if (DeliveryDate >= todate) {
+                    tempSADN.EsignTestAccount__c = true;
+                } else {
+                    tempSADN.EsignTestAccount__c = false;
+                }
 
-                                               DNd.Barcode_Raw__c = dnInfo.Barcode;
-                                               DNd.OTCode_Raw__c = dnInfo.OTCode;
-                                               DNd.SerialNoorLotNo_Raw__c = dnInfo.SerialNoorLotNo;
-                                               DNd.SorLMark_Raw__c = dnInfo.SorLMark;
-                                               DNd.GuaranteePeriod_Raw__c = dnInfo.GuaranteePeriod;
-                                               DNd.TracingCode_Raw__c = dnInfo.TracingCode;
-                                               DNd.ValidTo_Raw__c = dnInfo.ValidTo;
-                                               DNd.NetWorth_Raw__c = dnInfo.NetWorth;
-                                               DNd.GuaranteePrice_Raw__c    = dnInfo.GuaranteePrice;
-                                               DNd.GuaranteeType_Raw__c     = dnInfo.GuaranteeType;
-                                               DNd.MaintenancePrice_Raw__c = dnInfo.MaintenancePrice;
-                                               DNd.NetWorthNoProviston_Raw__c = dnInfo.NetWorthNoProviston;
-                                               DNd.ProduceDate_Raw__c = dnInfo.ProduceDate;
-                                               DNd.ProvistonPeriod_Raw__c = dnInfo.ProvistonPeriod;
-                                               DNd.ServicePrice_Raw__c = dnInfo.ServicePrice;
-                                               DNd.VALUE_Raw__c = dnInfo.VALUE;
-                                               DNd.NetWorth_Raw__c = dnInfo.NetWorth;
-                                               DNd.NMPA_Approbation_No__c = dnInfo.NMPA_NO;
-                                               DNd.ProduceCompany__c = dninfo.Provider;
-                                               tempDNdetail.DeliveryNote = DNnumber;
-                                               tempDNdetail.DNd = DNd;
-                                               if (ast != null && ast.id != null) {
-                                                   tempDNdetail.DNd.asset__c = ast.id;
-                                               }
-                                               return tempDNdetail;
-                                           }
+                //SAP閲屽彫鍥炲搧鎹㈠嚭璁㈠崟鐨勯�佽揪鏂瑰湴鍧�濡傛灉涓哄ゥ鏋楀反鏂姙浜嬪鐨勫湴鍧�锛孌N涓嶇敓鎴愬緟绛炬敹淇℃伅銆�
+                String ContactName = tempSADN.ContactName__c.toUpperCase();
+                if (ContactName.indexOf('OCSM') >= 0) {
+                    tempSADN.ETRecalledProducts__c = true;
+                } else {
+                    tempSADN.ETRecalledProducts__c = false;
+                }
+            }
+            if (Inquiry.size() > 1) {
+                tempSADN.Order_No__c = Inquiry[1];
+            }
+        }
+        return tempSADN;
+    }
+    private static void checkSA(
+        Statu_Achievements_DN__c tempSADN,
+        List<Statu_Achievements_DN__c> UpsertDNList,
+        BatchIF_Log__c iflog,
+        NFM110rest.GeneralData infoH
+    ) {
+        if (tempSADN.Statu_Achievements__c != null)
+            UpsertDNList.add(tempSADN);
+        else {
+            iflog.ErrorLog__c += 'warning! SoNo[' + infoH.SoNo + '] Statu_Achievements__c  NotExist. The insert of this DN is skipped.\n';
+        }
+    }
+    private static DNdetail SetSADNDetails(
+        string DNnumber,
+        boolean returnFlg,
+        NFM110Rest.DnInformation dnInfo,
+        asset ast,
+        integer tempDNdetailNumber
+    ) {
+        DNdetail tempDNdetail = new DNdetail();
+        Statu_Achievements_DN_details__c DNd = new Statu_Achievements_DN_details__c();
+        DNd.Qty_Raw__c = dnInfo.QTY;
+        DNd.QTY__c = String.isBlank(dnInfo.QTY) || Decimal.valueOf(dnInfo.QTY.trim()) == 0 ? 1 : Decimal.valueOf(dnInfo.QTY.trim());
+        DNd.ShippedAmount_without_tax__c = String.isBlank(dnInfo.NetWorth)
+            ? 0
+            : returnFlg == false ? Decimal.valueOf(dnInfo.NetWorth.trim()) : -Decimal.valueOf(dnInfo.NetWorth.trim());
+
+        DNd.ShippedAmount__c = String.isBlank(dnInfo.VALUE)
+            ? 0
+            : returnFlg == false ? Decimal.valueOf(dnInfo.VALUE.trim()) : -Decimal.valueOf(dnInfo.VALUE.trim());
+
+        DNd.NetWorthNoProviston__c = String.isBlank(dnInfo.NetWorthNoProviston)
+            ? 0
+            : returnFlg == false ? Decimal.valueOf(dnInfo.NetWorthNoProviston.trim()) : -Decimal.valueOf(dnInfo.NetWorthNoProviston.trim());
+        if (dnInfo.SorLMark == 'S') {
+            DNd.SerialNumber__c = dnInfo.SerialNoorLotNo;
+        } else {
+            DNd.SerialNumber__c = dnInfo.SerialNoorLotNo + '(' + dnInfo.TracingCode + ')';
+        }
+        DNd.Product_Serial_No__c = dnInfo.OTCode + ':' + DNd.SerialNumber__c;
+        DNd.DNProduct_Serial_No__c = DNnumber + ':' + DNd.Product_Serial_No__c;
+        if (dnInfo.SerialNoorLotNo != null && dnInfo.SerialNoorLotNo.equals('.')) {
+            DNd.DNProduct_Serial_No__c += tempDNdetailNumber;
+        }
+        // 鐢靛瓙绛炬敹鍗� start
+        DNd.CaseNumber__c = NFMUtil.trimLeft(dnInfo.CaseNumber, '0');
+        // 鐢靛瓙绛炬敹鍗� end
+
+        DNd.Barcode_Raw__c = dnInfo.Barcode;
+        DNd.OTCode_Raw__c = dnInfo.OTCode;
+        DNd.SerialNoorLotNo_Raw__c = dnInfo.SerialNoorLotNo;
+        DNd.SorLMark_Raw__c = dnInfo.SorLMark;
+        DNd.GuaranteePeriod_Raw__c = dnInfo.GuaranteePeriod;
+        DNd.TracingCode_Raw__c = dnInfo.TracingCode;
+        DNd.ValidTo_Raw__c = dnInfo.ValidTo;
+        DNd.NetWorth_Raw__c = dnInfo.NetWorth;
+        DNd.GuaranteePrice_Raw__c = dnInfo.GuaranteePrice;
+        DNd.GuaranteeType_Raw__c = dnInfo.GuaranteeType;
+        DNd.MaintenancePrice_Raw__c = dnInfo.MaintenancePrice;
+        DNd.NetWorthNoProviston_Raw__c = dnInfo.NetWorthNoProviston;
+        DNd.ProduceDate_Raw__c = dnInfo.ProduceDate;
+        DNd.ProvistonPeriod_Raw__c = dnInfo.ProvistonPeriod;
+        DNd.ServicePrice_Raw__c = dnInfo.ServicePrice;
+        DNd.VALUE_Raw__c = dnInfo.VALUE;
+        DNd.NetWorth_Raw__c = dnInfo.NetWorth;
+        DNd.NMPA_Approbation_No__c = dnInfo.NMPA_NO;
+        DNd.ProduceCompany__c = dninfo.Provider;
+        tempDNdetail.DeliveryNote = DNnumber;
+        tempDNdetail.DNd = DNd;
+        if (ast != null && ast.id != null) {
+            tempDNdetail.DNd.asset__c = ast.id;
+        }
+        return tempDNdetail;
+    }
     @TestVisible
     private static String checkSerialNoorLotNo(String sn) {
         if (sn == null || sn == '' || sn.length() < 8) {
@@ -900,4 +994,4 @@
         }
         return sn;
     }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/classes/DNUpsertBatchTest.cls b/force-app/main/default/classes/DNUpsertBatchTest.cls
index 047dd34..227fd7a 100644
--- a/force-app/main/default/classes/DNUpsertBatchTest.cls
+++ b/force-app/main/default/classes/DNUpsertBatchTest.cls
@@ -221,13 +221,5 @@
         prdsMap.put(prd.ProductCode_Ext__c, prd);
 
         DNUpsertBatch.SetupeSignFormLineItems(insertSADNdetailList, eSFLMap, eSFMap, prdsMap);
-        //Add By DTT - Li Jun Start 20230425
-        OCM_Management_Province__c ocsmTest = new OCM_Management_Province__c();
-        ocsmTest.Name = '鍏朵粬';
-        ocsmTest.Province__c = '鍖椾含甯�';
-        ocsmTest.Window1__c = UserInfo.getUserId();
-        insert ocsmTest;
-        Map<String, OCM_Management_Province__c> provinceMap = DNUpsertBatch.getManagementProvince();
-        //Add by DTT - Li Jun End 20230425
     }
 }
diff --git a/force-app/main/default/classes/InventoryViewController.cls b/force-app/main/default/classes/InventoryViewController.cls
index 40effd0..9c56e24 100644
--- a/force-app/main/default/classes/InventoryViewController.cls
+++ b/force-app/main/default/classes/InventoryViewController.cls
@@ -1,40 +1,48 @@
 public without sharing class InventoryViewController {
     /*****************鐢婚潰琛ㄧずBean******************/
-    public List<ConsumableorderdetailsInfo> consumableorderdetailsRecords =new List<ConsumableorderdetailsInfo>();
+    public List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
     public List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
 
     //page
-    Public Integer pagesize{get; set;} 
-    Public Integer totalcount{get; set;} 
-    Public Integer pagecount{get; set;} 
-    Public Integer currentpage{get; set;} 
-    public Boolean hasPrevious{get; set;}
-    public Boolean hasNext{get; set;}
+    public Integer pagesize { get; set; }
+    public Integer totalcount { get; set; }
+    public Integer pagecount { get; set; }
+    public Integer currentpage { get; set; }
+    public Boolean hasPrevious { get; set; }
+    public Boolean hasNext { get; set; }
     public List<ConsumableorderdetailsInfo> pageRecords { get; set; }
-    public String soql {get;set;}
+    public String soql { get; set; }
 
     public String sortKey { get; set; }
     public String preSortKey { get; private set; }
     public Boolean sortOrderAsc { get; private set; }
     public String[] sortOrder { get; private set; }
-    private String[] columus = new String[]{ 'Product2__c.Name__c','Asset_Model_No__c','','Category3__c','Category4__c','Category5__c',''};
-    
-    String[] proLimitAndDate =new String[]{};
-    private Map<String,Date> productkucun = new Map<String,Date>();
-    public List<SelectOption> categoryOptionList{get;set;}
-    public List<SelectOption> category4OptionList{get;set;}
-    public List<SelectOption> category5OptionList{get;set;}
+    private String[] columus = new List<String>{
+        'Product2__c.Name__c',
+        'Asset_Model_No__c',
+        '',
+        'Category3__c',
+        'Category4__c',
+        'Category5__c',
+        ''
+    };
+
+    String[] proLimitAndDate = new List<String>{};
+    private Map<String, Date> productkucun = new Map<String, Date>();
+    public List<SelectOption> categoryOptionList { get; set; }
+    public List<SelectOption> category4OptionList { get; set; }
+    public List<SelectOption> category5OptionList { get; set; }
     public String category5 { get; set; }
     public String category4 { get; set; }
     public String category3 { get; set; }
-    public String category_Goods {get ; set;}
+    public String category_Goods { get; set; }
     public String category1 { get; set; }
-    public Boolean editAble {get;set;}
+    public Boolean editAble { get; set; }
     // 缁忛攢鍟嗗湪搴撲骇鍝両D
     List<String> orderDetZaikuList = new List<String>();
     // 浜у搧 ID
-    public String ESetId  { get; set; }
-    public String idCheck {get;set;}
+    public String ESetId { get; set; }
+    public String idCheck { get; set; }
     /*****************銈姐兗銉堟檪鍐嶆绱㈡潯浠讹紙鐢婚潰銇嬨倝銇叆鍔涙潯浠躲倰鐒¤銇欍倠銇熴倎锛�******************/
     private String accountid = null;
     public String accountName { get; set; }
@@ -43,11 +51,11 @@
     // 鐧诲綍鑰呭伐浣滃湴
     private String userWorkLocation;
     //缁忛攢鍟嗙敤鎴蜂骇鍝佸垎绫伙紙ET銆丒NG锛�
-    public String agencyProType {get;set;}
+    public String agencyProType { get; set; }
     String sqlagencyProType;
 
     //add by rentx 2021-3-10
-    public Boolean hasHos {get;set;}
+    public Boolean hasHos { get; set; }
     //add by rentx 2021-3-10
 
     public InventoryViewController() {
@@ -64,162 +72,176 @@
     }
     // 鐢婚潰鍒濆鍖�
     public void init() {
-
         this.sortKey = '2';
         this.preSortKey = '2';
         this.sortOrderAsc = false;
         this.sortOrder = new String[8];
-        this.sortOrder = new String[]{' ','',' ',' ','','','','鈫�'};
+        this.sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '鈫�' };
 
-         
         //鍙栫敤鎴稩D
         String userId = UserInfo.getUserId();
-        User useracc = [select Accountid, Work_Location__c,UserPro_Type__c FROM user WHERE id =:userId];
+        User useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
         accountid = useracc.accountid;
         userWorkLocation = useracc.Work_Location__c;
         agencyProType = Useracc.UserPro_Type__c;
-        if(String.isBlank(Useracc.UserPro_Type__c)){
+        if (String.isBlank(Useracc.UserPro_Type__c)) {
             agencyProType = 'ET';
         }
-        Account accountInfo = [SELECT Name,Dealer_discount__c,Product_Limit_Date__c FROM account WHERE id =:accountid];
+        Account accountInfo = [SELECT Name, Dealer_discount__c, Product_Limit_Date__c FROM account WHERE id = :accountid];
         accountName = accountInfo.Name;
         //缁忛攢鍟嗘煡鐪嬩骇鍝�
         String product_Limit = accountInfo.Product_Limit_Date__c;
 
-        if(product_Limit != null && product_Limit !=''){
+        if (product_Limit != null && product_Limit != '') {
             proLimitAndDate = product_Limit.split(',');
         }
 
         List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
-        Map<String,Product2__c> MidMap = new Map<String,Product2__c>();
-        Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
-        Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
+        Map<String, Product2__c> MidMap = new Map<String, Product2__c>();
+        Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
         //搴撳瓨鏄庣粏鍙栧緱
         sqlagencyProType = '%' + agencyProType + '%';
         orderDetZaikuList = new List<String>();
-        List<AggregateResult>  orderDetZaiku = [SELECT count(Id),
-                                                      Consumable_Product__c
-                                                FROM Consumable_order_details2__c
-                                                WHERE Dealer_Arrive__c = true
-                                                AND Dealer_Shipment__c = false
-                                                AND Dealer_Saled__c = false
-                                                AND Lose_Flag__c = false
-                                                AND Dealer_Returned__c = false
-                                                AND Bar_Code__c !=null
-                                                AND Product_Type__c like : sqlagencyProType
-                                                AND Dealer_Info_text__c = :accountName
-                                                AND Cancellation_Flag__c = false
-                                                AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                                                group by Consumable_Product__c];
-        for(AggregateResult zaikuId : orderDetZaiku){
+        List<AggregateResult> orderDetZaiku = [
+            SELECT count(Id), Consumable_Product__c
+            FROM Consumable_order_details2__c
+            WHERE
+                Dealer_Arrive__c = TRUE
+                AND Dealer_Shipment__c = FALSE
+                AND Dealer_Saled__c = FALSE
+                AND Lose_Flag__c = FALSE
+                AND Dealer_Returned__c = FALSE
+                AND Bar_Code__c != NULL
+                AND Product_Type__c LIKE :sqlagencyProType
+                AND Dealer_Info_text__c = :accountName
+                AND Cancellation_Flag__c = FALSE
+                AND Arrive_Owner_Work_Location__c = :userWorkLocation
+            GROUP BY Consumable_Product__c
+        ];
+        for (AggregateResult zaikuId : orderDetZaiku) {
             orderDetZaikuList.add(String.valueOf(zaikuId.get('Consumable_Product__c')));
         }
-        List<Consumable_order_details2__c> CountDel = [SELECT Id,
-                            Bar_Code__c,
-                            Name,
-                            Inventory_date__c,
-                            Consumable_Product__c,
-                            Recordtypeid,
-                            Guarantee_period_for_products__c,
-                            Isoverdue__c,
-                            Box_Piece__c,
-                            hospitalSpecialOffer__c
-                        FROM Consumable_order_details2__c
-                        WHERE Dealer_Arrive__c = true
-                        AND Dealer_Shipment__c = false
-                        AND Dealer_Saled__c = false
-                        AND Dealer_Returned__c = false
-                        AND Lose_Flag__c = false
-                        AND Cancellation_Flag__c = false
-                        AND Bar_Code__c !=null
-                        AND Product_Type__c like : sqlagencyProType
-                        AND Dealer_Info_text__c = :accountName
-                        AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                        ];
-        List<Product2__c> product2Selected = [select Id, Name,Name__c,Intra_Trade_List_RMB__c,
-                                Asset_Model_No__c,
-                                Category3__c,Category4__c,Category5__c,
-                                SFDA_Status__c,
-                                Product2__r.SFDA_Approbation_No__c,
-                                Product2__r.SFDA_Expiration_Date__c,
-                                Product2__r.Packing_list_manual__c
-                            FROM Product2__c
-                            WHERE Id in : orderDetZaikuList ];
+        List<Consumable_order_details2__c> CountDel = [
+            SELECT
+                Id,
+                Bar_Code__c,
+                Name,
+                Inventory_date__c,
+                Consumable_Product__c,
+                Recordtypeid,
+                Guarantee_period_for_products__c,
+                Isoverdue__c,
+                Box_Piece__c,
+                hospitalSpecialOffer__c
+            FROM Consumable_order_details2__c
+            WHERE
+                Dealer_Arrive__c = TRUE
+                AND Dealer_Shipment__c = FALSE
+                AND Dealer_Saled__c = FALSE
+                AND Dealer_Returned__c = FALSE
+                AND Lose_Flag__c = FALSE
+                AND Cancellation_Flag__c = FALSE
+                AND Bar_Code__c != NULL
+                AND Product_Type__c LIKE :sqlagencyProType
+                AND Dealer_Info_text__c = :accountName
+                AND Arrive_Owner_Work_Location__c = :userWorkLocation
+        ];
+        List<Product2__c> product2Selected = [
+            SELECT
+                Id,
+                Name,
+                Name__c,
+                Intra_Trade_List_RMB__c,
+                Asset_Model_No__c,
+                Category3__c,
+                Category4__c,
+                Category5__c,
+                SFDA_Status__c,
+                Product2__r.SFDA_Approbation_No__c,
+                Product2__r.SFDA_Expiration_Date__c,
+                Product2__r.Packing_list_manual__c
+            FROM Product2__c
+            WHERE Id IN :orderDetZaikuList
+        ];
         for (Integer i = 0; i < product2Selected.size(); i++) {
             MidMap.put(product2Selected[i].Id, product2Selected[i]);
         }
         /////////////////////====================================update by rentx
-        Map<String,ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
-        Map<String,ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
         //update by rentx 2021-01-27 start
-        for(Integer i = 0 ; i< CountDel.size();i++){
+        for (Integer i = 0; i < CountDel.size(); i++) {
             //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
-            if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '鐩�'){
+            if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '鐩�') {
                 String tex = 'A';
                 if (CountDel[i].hospitalSpecialOffer__c) {
                     tex = 'B';
                 }
-                if(newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex)){
-                    ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex).clone();
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Isoverdue__c == 1){
+                if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
+                    ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)
+                        .clone();
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Isoverdue__c == 1) {
                         Jstage.limitCount = Jstage.limitCount + 1;
                     }
                     Jstage.BoxPiece = CountDel[i].Box_Piece__c;
-                    newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
-                }else{
+                    newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+                } else {
                     ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Isoverdue__c == 1){
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Isoverdue__c == 1) {
                         Jstage.limitCount = Jstage.limitCount + 1;
                     }
                     Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                     if (CountDel[i].hospitalSpecialOffer__c) {
                         Jstage.hospitalSpecialOffer = true;
-                    }else {
+                    } else {
                         Jstage.hospitalSpecialOffer = false;
                     }
-                    newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
+                    newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                 }
-            }else if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '涓�'){
+            } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '涓�') {
                 String tex = 'A';
                 if (CountDel[i].hospitalSpecialOffer__c) {
                     tex = 'B';
                 }
-                if(newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c  + tex)){
-                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex).clone();
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Isoverdue__c == 1){
+                if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
+                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
+                            CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
+                        )
+                        .clone();
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Isoverdue__c == 1) {
                         Jstage.limitCount = Jstage.limitCount + 1;
                     }
                     Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                     if (CountDel[i].hospitalSpecialOffer__c) {
                         Jstage.hospitalSpecialOffer = true;
-                    }else {
+                    } else {
                         Jstage.hospitalSpecialOffer = false;
                     }
-                    newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
-                }else{
+                    newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+                } else {
                     ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Isoverdue__c == 1){
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Isoverdue__c == 1) {
                         Jstage.limitCount = Jstage.limitCount + 1;
                     }
                     Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                     if (CountDel[i].hospitalSpecialOffer__c) {
                         Jstage.hospitalSpecialOffer = true;
-                    }else {
+                    } else {
                         Jstage.hospitalSpecialOffer = false;
-                        
                     }
-                    newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
+                    newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                 }
             }
         }
         consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
         //鎶夿oxmap閲岀殑鍊间粠鏂拌祴缁檅oxRecords
-        for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
-            if(bss.allnumber>0){
+        for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
+            if (bss.allnumber > 0) {
                 bss.sortBy = false;
                 bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
                 bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
@@ -230,43 +252,42 @@
         }
 
         boxRecords.sort();
-        for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
-            if(bss.allnumber>0){
+        for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+            if (bss.allnumber > 0) {
                 bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
                 bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                 bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                 bss.overlimitCount = bss.allnumber - bss.limitCount;
             }
         }
-        for(ConsumableorderdetailsInfo bss : boxRecords){
+        for (ConsumableorderdetailsInfo bss : boxRecords) {
             consumableorderdetailsRecords.add(bss);
             //璇ヤ骇鍝佹槸鍖婚櫌鐗逛环浜у搧
-            if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'涓狟')) {
-                if (newMidPieceMap.get(bss.Prod.Id+'涓狟').hospitalSpecialOffer) {
-                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'涓狟'));
-                    newMidPieceMap.remove(bss.Prod.Id+'涓狟');
+            if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '涓狟')) {
+                if (newMidPieceMap.get(bss.Prod.Id + '涓狟').hospitalSpecialOffer) {
+                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
+                    newMidPieceMap.remove(bss.Prod.Id + '涓狟');
                 }
             }
 
-            if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'涓狝')) {
+            if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '涓狝')) {
                 // if (newMidPieceMap.get(bss.Prod.Id+'涓狝')) {
-                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'涓狝'));
-                    newMidPieceMap.remove(bss.Prod.Id+'涓狝');
+                consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
+                newMidPieceMap.remove(bss.Prod.Id + '涓狝');
                 // }
             }
         }
-        for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
-            if (newMidPieceMap.containsKey(bss.Prod.Id+'涓狟')) {
+        for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+            if (newMidPieceMap.containsKey(bss.Prod.Id + '涓狟')) {
                 consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
             }
         }
-        for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
-            if (newMidPieceMap.containsKey(bss.Prod.Id+'涓狝')) {
+        for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+            if (newMidPieceMap.containsKey(bss.Prod.Id + '涓狝')) {
                 consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
             }
         }
 
-        
         /////////////////////====================================update by rentx
 
         /*for(Integer i = 0 ; i< CountDel.size();i++){
@@ -346,132 +367,176 @@
 
         //update by rentx 2021-01-27 end
         productLimtAndDate();
-          datelimitSearch();
+        datelimitSearch();
 
         //add by rentx 2021-3-10 start
         Integer hosnum = 0;
         //add by rentx 2021-3-10 end
-        for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){
-            if(productkucun.get(bss.Prod.Id) != null){
+        for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
+            if (productkucun.get(bss.Prod.Id) != null) {
                 bss.guaranteeperiod = productkucun.get(bss.Prod.Id);
             }
 
             //add by rentx 2021-3-10 start
             if (bss.hospitalSpecialOffer) {
-                hosnum = hosnum +1;
+                hosnum = hosnum + 1;
             }
         }
         if (hosnum > 0) {
             hasHos = true;
-        }else{
+        } else {
             hasHos = false;
         }
         //add by rentx 2021-3-10 end
         //listCut();
 
-        AggregateResult[] categoryList = [select Count(id), Category3_text__c c3c from Product2__c WHERE Estimation_Entry_Possibility__c = '鈼�' AND Product_Type__c like :agencyProType AND Category3_text__c != null group by Category3_text__c];
-        
-         categoryOptionList = new List<SelectOption>();
-         categoryOptionList.add(new SelectOption('', '-鏃�-'));
-         for(AggregateResult category3Search : categoryList) {
+        AggregateResult[] categoryList = [
+            SELECT Count(id), Category3_text__c c3c
+            FROM Product2__c
+            WHERE Estimation_Entry_Possibility__c = '鈼�' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL
+            GROUP BY Category3_text__c
+        ];
+
+        categoryOptionList = new List<SelectOption>();
+        categoryOptionList.add(new SelectOption('', '-鏃�-'));
+        for (AggregateResult category3Search : categoryList) {
             String deliverycnt = String.valueOf(category3Search.get('c3c'));
-            categoryOptionList.add(new SelectOption(deliverycnt,deliverycnt));
-         }
+            categoryOptionList.add(new SelectOption(deliverycnt, deliverycnt));
+        }
 
-
-         category4OptionList = new List<SelectOption>();
-         category4OptionList.add(new SelectOption('', '-鏃�-'));
-         category5OptionList = new List<SelectOption>();
-         category5OptionList.add(new SelectOption('', '-鏃�-'));
+        category4OptionList = new List<SelectOption>();
+        category4OptionList.add(new SelectOption('', '-鏃�-'));
+        category5OptionList = new List<SelectOption>();
+        category5OptionList.add(new SelectOption('', '-鏃�-'));
 
         //鎬讳欢鏁�
         totalcount = consumableorderdetailsRecords.size();
         //椤垫暟
-        pagecount=(totalcount  +  pagesize  - 1) / pagesize; 
+        pagecount = (totalcount + pagesize - 1) / pagesize;
 
         //鏄剧ず绗竴椤�
         moveToFirst();
         makeCurrentPageRecords();
-
     }
-  public void categoryAllload() {
-         AggregateResult[] category4List = [select Count(id), Category4_text__c c4c from Product2__c WHERE Estimation_Entry_Possibility__c = '鈼�' AND Category3_text__c=:category3 AND Product_Type__c like :agencyProType AND Category4_text__c != null AND Category5_text__c != null group by Category4_text__c];
-         category4OptionList = new List<SelectOption>();
-         category4OptionList.add(new SelectOption('', '-鏃�-'));
-         for(AggregateResult category4Search : category4List) {
+    public void categoryAllload() {
+        AggregateResult[] category4List = [
+            SELECT Count(id), Category4_text__c c4c
+            FROM Product2__c
+            WHERE
+                Estimation_Entry_Possibility__c = '鈼�'
+                AND Category3_text__c = :category3
+                AND Product_Type__c LIKE :agencyProType
+                AND Category4_text__c != NULL
+                AND Category5_text__c != NULL
+            GROUP BY Category4_text__c
+        ];
+        category4OptionList = new List<SelectOption>();
+        category4OptionList.add(new SelectOption('', '-鏃�-'));
+        for (AggregateResult category4Search : category4List) {
             String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
-            category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4));
-         }
+            category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+        }
 
-           AggregateResult[] category5List = [select Count(id), Category5_text__c c5c from Product2__c WHERE Estimation_Entry_Possibility__c = '鈼�' AND Category3_text__c=:category3 AND Product_Type__c like :agencyProType AND Category4_text__c != null AND Category5_text__c != null group by Category5_text__c];
-        
-         category5OptionList = new List<SelectOption>();
-         category5OptionList.add(new SelectOption('', '-鏃�-'));
-         for(AggregateResult category5Search : category5List) {
+        AggregateResult[] category5List = [
+            SELECT Count(id), Category5_text__c c5c
+            FROM Product2__c
+            WHERE
+                Estimation_Entry_Possibility__c = '鈼�'
+                AND Category3_text__c = :category3
+                AND Product_Type__c LIKE :agencyProType
+                AND Category4_text__c != NULL
+                AND Category5_text__c != NULL
+            GROUP BY Category5_text__c
+        ];
+
+        category5OptionList = new List<SelectOption>();
+        category5OptionList.add(new SelectOption('', '-鏃�-'));
+        for (AggregateResult category5Search : category5List) {
             String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
-            category5OptionList.add(new SelectOption(deliverycnt5,deliverycnt5));
-         }
-
+            category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+        }
     }
-    
+
     public void categoryload() {
-         AggregateResult[] category4List = [select Count(id), Category4_text__c c4c from Product2__c WHERE Estimation_Entry_Possibility__c = '鈼�' AND Category3_text__c=:category3 AND Product_Type__c like :agencyProType AND Category4_text__c != null AND Category5_text__c != null group by Category4_text__c];
-         category4OptionList = new List<SelectOption>();
-         category4OptionList.add(new SelectOption('', '-鏃�-'));
-         for(AggregateResult category4Search : category4List) {
+        AggregateResult[] category4List = [
+            SELECT Count(id), Category4_text__c c4c
+            FROM Product2__c
+            WHERE
+                Estimation_Entry_Possibility__c = '鈼�'
+                AND Category3_text__c = :category3
+                AND Product_Type__c LIKE :agencyProType
+                AND Category4_text__c != NULL
+                AND Category5_text__c != NULL
+            GROUP BY Category4_text__c
+        ];
+        category4OptionList = new List<SelectOption>();
+        category4OptionList.add(new SelectOption('', '-鏃�-'));
+        for (AggregateResult category4Search : category4List) {
             String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
-            category4OptionList.add(new SelectOption(deliverycnt4,deliverycnt4));
-         }
+            category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+        }
 
-           AggregateResult[] category5List = [select Count(id), Category5_text__c c5c from Product2__c WHERE Estimation_Entry_Possibility__c = '鈼�' AND Category3_text__c=:category3 AND Product_Type__c like :agencyProType AND Category4_text__c=:category4 AND Category5_text__c != null group by Category5_text__c];
-        
-         category5OptionList = new List<SelectOption>();
-         category5OptionList.add(new SelectOption('', '-鏃�-'));
-         for(AggregateResult category5Search : category5List) {
+        AggregateResult[] category5List = [
+            SELECT Count(id), Category5_text__c c5c
+            FROM Product2__c
+            WHERE
+                Estimation_Entry_Possibility__c = '鈼�'
+                AND Category3_text__c = :category3
+                AND Product_Type__c LIKE :agencyProType
+                AND Category4_text__c = :category4
+                AND Category5_text__c != NULL
+            GROUP BY Category5_text__c
+        ];
+
+        category5OptionList = new List<SelectOption>();
+        category5OptionList.add(new SelectOption('', '-鏃�-'));
+        for (AggregateResult category5Search : category5List) {
             String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
-            category5OptionList.add(new SelectOption(deliverycnt5,deliverycnt5));
-         }
-
+            category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+        }
     }
-        // 妫�绱�
+    // 妫�绱�
     public void searchConsumableorderdetails() {
         this.sortKey = '2';
         this.preSortKey = '2';
         this.sortOrderAsc = false;
         this.sortOrder = new String[8];
-        this.sortOrder = new String[]{' ','',' ',' ','','','','鈫�'};
+        this.sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '鈫�' };
 
         List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
-        List<Consumable_order_details2__c> CountDel = [SELECT Id,
-                            Bar_Code__c,
-                            Name,
-                            Inventory_date__c,
-                            Consumable_Product__c,
-                            Recordtypeid,
-                            Guarantee_period_for_products__c,
-                            Isoverdue__c,
-                            Box_Piece__c,
-                            hospitalSpecialOffer__c 
-                        FROM Consumable_order_details2__c
-                        WHERE Dealer_Arrive__c = true
-                        AND Dealer_Shipment__c = false
-                        AND Dealer_Saled__c = false
-                        AND Dealer_Returned__c = false
-                        AND Lose_Flag__c = false
-                        AND Bar_Code__c !=null
-                        AND Product_Type__c like : sqlagencyProType
-                        AND Dealer_Info_text__c = :accountName 
-                        AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                        ];
+        List<Consumable_order_details2__c> CountDel = [
+            SELECT
+                Id,
+                Bar_Code__c,
+                Name,
+                Inventory_date__c,
+                Consumable_Product__c,
+                Recordtypeid,
+                Guarantee_period_for_products__c,
+                Isoverdue__c,
+                Box_Piece__c,
+                hospitalSpecialOffer__c
+            FROM Consumable_order_details2__c
+            WHERE
+                Dealer_Arrive__c = TRUE
+                AND Dealer_Shipment__c = FALSE
+                AND Dealer_Saled__c = FALSE
+                AND Dealer_Returned__c = FALSE
+                AND Lose_Flag__c = FALSE
+                AND Bar_Code__c != NULL
+                AND Product_Type__c LIKE :sqlagencyProType
+                AND Dealer_Info_text__c = :accountName
+                AND Arrive_Owner_Work_Location__c = :userWorkLocation
+        ];
 
         List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
-        Map<String,Product2__c> MidMap = new Map<String,Product2__c>();
-        Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
-        Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
-      
-        
+        Map<String, Product2__c> MidMap = new Map<String, Product2__c>();
+        Map<String, ConsumableorderdetailsInfo> newMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> newMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
+
         // 鎵�鏈変骇鍝佸彇寰�
-        String soql = this.makeSoql(category1,category_Goods,category3,category4,category5);
+        String soql = this.makeSoql(category1, category_Goods, category3, category4, category5);
+        System.debug('====>soql11' + soql);
         //soql += ' ORDER BY ' + this.columus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
         List<Product2__c> queryList = Database.query(soql);
         for (Integer i = 0; i < queryList.size(); i++) {
@@ -519,8 +584,8 @@
                 }
             }
         } 娉ㄩ噴by rentx */
-        Map<String,ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
-        Map<String,ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> newHosMidBoxMap = new Map<String, ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> newHosMidPieceMap = new Map<String, ConsumableorderdetailsInfo>();
 
         /*for(Integer i = 0 ; i< CountDel.size();i++){
             //濡傛灉鏄� 鍖婚櫌鐗逛环鍒涘缓鐨勬槑缁�2  鍒�   update and add by rentx 2020-11-26 start
@@ -620,75 +685,78 @@
                 
             }
         }*/
-        for(Integer i = 0 ; i< CountDel.size();i++){
+        for (Integer i = 0; i < CountDel.size(); i++) {
             //鐒跺悗寰幆CountDel鍋欱ox鍜宲iece2涓猰ap
-            if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '鐩�'){
+            if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '鐩�') {
                 String tex = 'A';
                 if (CountDel[i].hospitalSpecialOffer__c) {
                     tex = 'B';
                 }
-                if(newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex)){
-                    ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex).clone();
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Isoverdue__c == 1){
+                if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
+                    ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)
+                        .clone();
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Isoverdue__c == 1) {
                         Jstage.limitCount = Jstage.limitCount + 1;
                     }
                     Jstage.BoxPiece = CountDel[i].Box_Piece__c;
-                    newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
-                }else{
+                    newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+                } else {
                     ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Isoverdue__c == 1){
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Isoverdue__c == 1) {
                         Jstage.limitCount = Jstage.limitCount + 1;
                     }
                     Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                     if (CountDel[i].hospitalSpecialOffer__c) {
                         Jstage.hospitalSpecialOffer = true;
-                    }else {
+                    } else {
                         Jstage.hospitalSpecialOffer = false;
                     }
-                    newMidBoxMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
+                    newMidBoxMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                 }
-            }else if(MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '涓�'){
+            } else if (MidMap.containsKey(CountDel[i].Consumable_Product__c) && CountDel[i].Box_Piece__c == '涓�') {
                 String tex = 'A';
                 if (CountDel[i].hospitalSpecialOffer__c) {
                     tex = 'B';
                 }
-                if(newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c  + tex)){
-                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex).clone();
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Isoverdue__c == 1){
+                if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
+                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
+                            CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
+                        )
+                        .clone();
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Isoverdue__c == 1) {
                         Jstage.limitCount = Jstage.limitCount + 1;
                     }
                     Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                     if (CountDel[i].hospitalSpecialOffer__c) {
                         Jstage.hospitalSpecialOffer = true;
-                    }else {
+                    } else {
                         Jstage.hospitalSpecialOffer = false;
                     }
-                    newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
-                }else{
+                    newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
+                } else {
                     ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(CountDel[i].Consumable_Product__c));
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Isoverdue__c == 1){
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Isoverdue__c == 1) {
                         Jstage.limitCount = Jstage.limitCount + 1;
                     }
                     Jstage.BoxPiece = CountDel[i].Box_Piece__c;
                     if (CountDel[i].hospitalSpecialOffer__c) {
                         Jstage.hospitalSpecialOffer = true;
-                    }else {
+                    } else {
                         Jstage.hospitalSpecialOffer = false;
-                        
                     }
-                    newMidPieceMap.put(CountDel[i].Consumable_Product__c+CountDel[i].Box_Piece__c + tex, Jstage);
+                    newMidPieceMap.put(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex, Jstage);
                 }
             }
         }
 
         consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
         //鎶夿oxmap閲岀殑鍊间粠鏂拌祴缁檅oxRecords
-        for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
-            if(bss.allnumber>0){
+        for (ConsumableorderdetailsInfo bss : newMidBoxMap.values()) {
+            if (bss.allnumber > 0) {
                 bss.sortBy = false;
                 bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
                 bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
@@ -699,43 +767,42 @@
         }
 
         boxRecords.sort();
-        for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
-            if(bss.allnumber>0){
+        for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+            if (bss.allnumber > 0) {
                 bss.packing_list = Integer.valueof(bss.Prod.Product2__r.Packing_list_manual__c);
                 bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
                 bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c;
                 bss.overlimitCount = bss.allnumber - bss.limitCount;
             }
         }
-        for(ConsumableorderdetailsInfo bss : boxRecords){
+        for (ConsumableorderdetailsInfo bss : boxRecords) {
             consumableorderdetailsRecords.add(bss);
             //璇ヤ骇鍝佹槸鍖婚櫌鐗逛环浜у搧
-            if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'涓狟')) {
-                if (newMidPieceMap.get(bss.Prod.Id+'涓狟').hospitalSpecialOffer) {
-                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'涓狟'));
-                    newMidPieceMap.remove(bss.Prod.Id+'涓狟');
+            if (bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '涓狟')) {
+                if (newMidPieceMap.get(bss.Prod.Id + '涓狟').hospitalSpecialOffer) {
+                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
+                    newMidPieceMap.remove(bss.Prod.Id + '涓狟');
                 }
             }
 
-            if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id+'涓狝')) {
+            if (!bss.hospitalSpecialOffer && newMidPieceMap.containsKey(bss.Prod.Id + '涓狝')) {
                 // if (newMidPieceMap.get(bss.Prod.Id+'涓狝')) {
-                    consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id+'涓狝'));
-                    newMidPieceMap.remove(bss.Prod.Id+'涓狝');
+                consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
+                newMidPieceMap.remove(bss.Prod.Id + '涓狝');
                 // }
             }
         }
-        for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
-            if (newMidPieceMap.containsKey(bss.Prod.Id+'涓狟')) {
+        for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+            if (newMidPieceMap.containsKey(bss.Prod.Id + '涓狟')) {
                 consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狟'));
             }
         }
-        for(ConsumableorderdetailsInfo bss : newMidPieceMap.values()){
-            if (newMidPieceMap.containsKey(bss.Prod.Id+'涓狝')) {
+        for (ConsumableorderdetailsInfo bss : newMidPieceMap.values()) {
+            if (newMidPieceMap.containsKey(bss.Prod.Id + '涓狝')) {
                 consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓狝'));
             }
         }
 
-        
         /////////////////////====================================update by rentx
         /*//鎶夿oxmap閲岀殑鍊间粠鏂拌祴缁檅oxRecords
         for(ConsumableorderdetailsInfo bss : newMidBoxMap.values()){
@@ -770,9 +837,9 @@
             consumableorderdetailsRecords.add(newMidPieceMap.get(bss.Prod.Id + '涓�'));
         }娉ㄩ噴 by rentx 2020-12-09*/
         productLimtAndDate();
-          datelimitSearch();
-        for(ConsumableorderdetailsInfo bss : consumableorderdetailsRecords){
-            if(productkucun.get(bss.Prod.Id) != null){
+        datelimitSearch();
+        for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) {
+            if (productkucun.get(bss.Prod.Id) != null) {
                 bss.guaranteeperiod = productkucun.get(bss.Prod.Id);
             }
         }
@@ -782,12 +849,12 @@
         this.preSortKey = '2';
         this.sortOrderAsc = false;
         this.sortOrder = new String[8];
-        this.sortOrder = new String[]{' ','',' ',' ','','','','鈫�'};
+        this.sortOrder = new List<String>{ ' ', '', ' ', ' ', '', '', '', '鈫�' };
 
         //鎬讳欢鏁�
         totalcount = consumableorderdetailsRecords.size();
         //椤垫暟
-        pagecount=(totalcount  +  pagesize  - 1) / pagesize; 
+        pagecount = (totalcount + pagesize - 1) / pagesize;
 
         //鏄剧ず绗竴椤�
         currentpage = 0;
@@ -795,54 +862,60 @@
         makeCurrentPageRecords();
     }
 
-        //搴撳瓨涓婁笅闄�
-    public void productLimtAndDate (){
+    //搴撳瓨涓婁笅闄�
+    public void productLimtAndDate() {
         String nowName = null, nowRightAsstModelNo = null;
-        Map<String,String> productLimt = new Map<String,String>();
-        for(Integer i = 0; i < proLimitAndDate.size(); i++){
+        Map<String, String> productLimt = new Map<String, String>();
+        for (Integer i = 0; i < proLimitAndDate.size(); i++) {
             nowName = proLimitAndDate[i];
-            if( nowName.indexOf( '|') >= 0) {
-                nowRightAsstModelNo = nowName.subString( 0, nowName.indexOf( '|'));
-                nowName = nowName.subString( nowName.indexOf( '|')+1);
+            if (nowName.indexOf('|') >= 0) {
+                nowRightAsstModelNo = nowName.subString(0, nowName.indexOf('|'));
+                nowName = nowName.subString(nowName.indexOf('|') + 1);
             }
             productLimt.put(nowRightAsstModelNo, nowName);
         }
-        for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
-            if(productLimt.containsKey(ass.Prod.Asset_Model_No__c)){
-              ass.lowerlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|')));
-              ass.upperlimit = decimal.valueOf(productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf( '|')+1));
-           }
+        for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
+            if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) {
+                ass.lowerlimit = decimal.valueOf(
+                    productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|'))
+                );
+                ass.upperlimit = decimal.valueOf(
+                    productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1)
+                );
+            }
         }
     }
 
-    public void datelimitSearch(){
+    public void datelimitSearch() {
         List<String> barcodekucun = new List<String>();
-        List<Consumable_order_details2__c> orderkucun = [SELECT Id,Bar_Code__c, Name,Consumable_Product__c,Recordtypeid,
-                                                            Guarantee_period_for_products__c,Sterilization_limit__c
-                                                        FROM Consumable_order_details2__c
-                                                        WHERE Dealer_Arrive__c = true
-                                                        AND Dealer_Shipment__c = false
-                                                        AND Dealer_Saled__c = false
-                                                        AND Dealer_Returned__c = false
-                                                        AND Lose_Flag__c = false
-                                                        AND Bar_Code__c !=null
-                                                        AND Product_Type__c like : sqlagencyProType
-                                                        AND Dealer_Info_text__c = :accountName
-                                                        AND Arrive_Owner_Work_Location__c =: userWorkLocation
-                                                        ORDER BY Consumable_Product__c, Sterilization_limit__c asc];
-        for(Integer i = 0 ; i< orderkucun.size();i++){
-            if(productkucun.containsKey(orderkucun[i].Consumable_Product__c)){
+        List<Consumable_order_details2__c> orderkucun = [
+            SELECT Id, Bar_Code__c, Name, Consumable_Product__c, Recordtypeid, Guarantee_period_for_products__c, Sterilization_limit__c
+            FROM Consumable_order_details2__c
+            WHERE
+                Dealer_Arrive__c = TRUE
+                AND Dealer_Shipment__c = FALSE
+                AND Dealer_Saled__c = FALSE
+                AND Dealer_Returned__c = FALSE
+                AND Lose_Flag__c = FALSE
+                AND Bar_Code__c != NULL
+                AND Product_Type__c LIKE :sqlagencyProType
+                AND Dealer_Info_text__c = :accountName
+                AND Arrive_Owner_Work_Location__c = :userWorkLocation
+            ORDER BY Consumable_Product__c, Sterilization_limit__c ASC
+        ];
+        for (Integer i = 0; i < orderkucun.size(); i++) {
+            if (productkucun.containsKey(orderkucun[i].Consumable_Product__c)) {
                 continue;
-            }else{
+            } else {
                 productkucun.put(orderkucun[i].Consumable_Product__c, orderkucun[i].Sterilization_limit__c);
             }
         }
     }
 
     //鍚嶇О鎺掑簭
-    public void SortLimited(){
-        Map<String,ConsumableorderdetailsInfo> MidMap = new Map<String,ConsumableorderdetailsInfo>();
-        Map<String,ConsumableorderdetailsInfo> newMap = new Map<String,ConsumableorderdetailsInfo>();
+    public void SortLimited() {
+        Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> newMap = new Map<String, ConsumableorderdetailsInfo>();
         if (this.sortKey == this.preSortKey) {
             // 鏂瑰悜銇屽銈忋倠銇伩
             this.sortOrderAsc = !this.sortOrderAsc;
@@ -855,27 +928,30 @@
 
         this.preSortKey = this.sortKey;
         // 鎵�鏈変骇鍝佸彇寰�
-        String soql = this.makeSoql(null,null,null,null,null);
-        soql += ' ORDER BY ' + this.columus[Integer.valueOf(this.sortKey)] + ' ' + (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
+        String soql = this.makeSoql(null, null, null, null, null);
+        soql +=
+            ' ORDER BY ' +
+            this.columus[Integer.valueOf(this.sortKey)] +
+            ' ' +
+            (this.sortOrderAsc == true ? 'asc nulls first' : 'desc nulls last');
         List<Product2__c> queryList = Database.query(soql);
         for (Integer i = 0; i < queryList.size(); i++) {
             MidMap.put(queryList[i].Id + '鐩�', null);
             MidMap.put(queryList[i].Id + '涓�', null);
-
         }
 
         //update by rentx 2020-12-29
-        for(Integer i = 0 ; i< pageRecords.size();i++){
-            if(MidMap.containsKey(pageRecords[i].prod.Id+pageRecords[i].BoxPiece)){
+        for (Integer i = 0; i < pageRecords.size(); i++) {
+            if (MidMap.containsKey(pageRecords[i].prod.Id + pageRecords[i].BoxPiece)) {
                 ConsumableorderdetailsInfo Jstage = pageRecords[i].clone();
                 if (Jstage.hospitalSpecialOffer == true) {
-                    newMap.put(pageRecords[i].prod.id+pageRecords[i].BoxPiece, Jstage);
-                }else{
-                    MidMap.put(pageRecords[i].prod.id+pageRecords[i].BoxPiece, Jstage);
+                    newMap.put(pageRecords[i].prod.id + pageRecords[i].BoxPiece, Jstage);
+                } else {
+                    MidMap.put(pageRecords[i].prod.id + pageRecords[i].BoxPiece, Jstage);
                 }
             }
         }
-        //update by rentx 2020-12-29 
+        //update by rentx 2020-12-29
 
         // for(Integer i = 0 ; i< pageRecords.size();i++){
         //     if(MidMap.containsKey(pageRecords[i].prod.Id+pageRecords[i].BoxPiece)){
@@ -887,17 +963,16 @@
 
         //update byr entx 2020-12-29
         //鍐嶆妸map閲岀殑鍊间粠鏂拌祴缁機pageRecords
-        for(ConsumableorderdetailsInfo bss : MidMap.values()){
-
-            if(bss != null){
+        for (ConsumableorderdetailsInfo bss : MidMap.values()) {
+            if (bss != null) {
                 pageRecords.add(bss);
-                if (newMap.get(bss.Prod.Id+bss.BoxPiece) != null) {
-                    pageRecords.add(newMap.get(bss.Prod.Id+bss.BoxPiece));
-                    newMap.remove(bss.Prod.Id+bss.BoxPiece);
+                if (newMap.get(bss.Prod.Id + bss.BoxPiece) != null) {
+                    pageRecords.add(newMap.get(bss.Prod.Id + bss.BoxPiece));
+                    newMap.remove(bss.Prod.Id + bss.BoxPiece);
                 }
             }
         }
-        for(ConsumableorderdetailsInfo bss : newMap.values()){
+        for (ConsumableorderdetailsInfo bss : newMap.values()) {
             if (bss != null) {
                 pageRecords.add(bss);
             }
@@ -912,8 +987,8 @@
         //update by rentx 2020-12-29
     }
 
-        //搴撳瓨鎺掑簭
-    public void SortStore(){
+    //搴撳瓨鎺掑簭
+    public void SortStore() {
         if (this.sortKey == this.preSortKey) {
             // 鏂瑰悜銇屽銈忋倠銇伩
             this.sortOrderAsc = !this.sortOrderAsc;
@@ -925,74 +1000,87 @@
         }
         this.preSortKey = this.sortKey;
 
-        for(ConsumableorderdetailsInfo ass :pageRecords){
+        for (ConsumableorderdetailsInfo ass : pageRecords) {
             ass.sortBy = this.sortOrderAsc;
         }
         pageRecords.sort();
     }
     //妫�绱ql鏂囧仛鎴�
-    private String makeSoql(String CateName,String CateCode,String Category3,String Category4,String Category5){
+    private String makeSoql(String CateName, String CateCode, String Category3, String Category4, String Category5) {
         String sqlTail = '(\'';
-        for(Integer i = 0 ; i< orderDetZaikuList.size();i++){
-            if(i<orderDetZaikuList.size()-1){
-                sqlTail += orderDetZaikuList[i]+'\',\'';
-            }else{
-                sqlTail += orderDetZaikuList[i]+'\')';
+        for (Integer i = 0; i < orderDetZaikuList.size(); i++) {
+            if (i < orderDetZaikuList.size() - 1) {
+                sqlTail += orderDetZaikuList[i] + '\',\'';
+            } else {
+                sqlTail += orderDetZaikuList[i] + '\')';
             }
         }
         String soql = 'select Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Category3__c,Category4__c,Category5__c,';
         soql += ' SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Product2__r.Packing_list_manual__c FROM Product2__c ';
         soql += ' WHERE Id in' + sqlTail;
-        if(!String.isBlank(CateName)){
-            soql += ' AND (Name__c like \'%' + String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + '%\' or Asset_Model_No__c like \'%' + String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + '%\')';
-        }if(!String.isBlank(Category3)){
-            soql += ' AND Category3__c = \'' +  Category3 + '\'';
-        }if(!String.isBlank(Category4)){
-            soql += ' AND Category4__c = \'' +  Category4 + '\'';
-        }if(!String.isBlank(Category5)){
-            soql += ' AND Category5__c = \'' +  Category5 + '\'';
+        if (!String.isBlank(CateName)) {
+            soql +=
+                ' AND (Name__c like \'%' +
+                String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+                '%\' or Asset_Model_No__c like \'%' +
+                String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+                '%\')';
         }
+        if (!String.isBlank(Category3)) {
+            soql += ' AND Category3__c = \'' + Category3 + '\'';
+        }
+        if (!String.isBlank(Category4)) {
+            soql += ' AND Category4__c = \'' + Category4 + '\'';
+        }
+        if (!String.isBlank(Category5)) {
+            soql += ' AND Category5__c = \'' + Category5 + '\'';
+        }
+        System.debug('====>soql' + soql);
         return soql;
-
     }
 
     //棣栭〉
-    public void moveToFirst(){
-        if(currentpage == 1) return;
+    public void moveToFirst() {
+        if (currentpage == 1)
+            return;
         currentpage = 1;
         canMove();
     }
 
     //灏鹃〉
-    public void moveToLast(){
-        if(currentpage >= pagecount) return;
+    public void moveToLast() {
+        if (currentpage >= pagecount)
+            return;
         currentpage = pagecount;
         canMove();
     }
 
-   //涓婁竴椤�
-   public void moveToPrevious(){
-        if(currentpage == 1) return;
-        currentpage = currentpage -1;
+    //涓婁竴椤�
+    public void moveToPrevious() {
+        if (currentpage == 1)
+            return;
+        currentpage = currentpage - 1;
         canMove();
     }
 
     //涓嬩竴椤�
-    public void moveToNext(){
-        if(currentpage >= pagecount) return;
+    public void moveToNext() {
+        if (currentpage >= pagecount)
+            return;
 
         currentpage = currentpage + 1;
         canMove();
     }
 
     //鍒ゆ柇鏄惁鍙炕椤�
-    public void canMove(){
+    public void canMove() {
         hasPrevious = false;
         hasNext = false;
-        if(pagecount > 1 && currentpage > 1) hasPrevious = true;
-        if(pagecount > 1 && currentpage < pagecount)  hasNext = true;
+        if (pagecount > 1 && currentpage > 1)
+            hasPrevious = true;
+        if (pagecount > 1 && currentpage < pagecount)
+            hasNext = true;
     }
-
 
     //鍒锋柊褰撳墠椤�
     public PageReference refreshPageSize() {
@@ -1000,22 +1088,22 @@
         return null;
     }
 
-   //缂栬緫褰撳墠椤靛唴瀹�
-   public void makeCurrentPageRecords(){
+    //缂栬緫褰撳墠椤靛唴瀹�
+    public void makeCurrentPageRecords() {
         Integer startIdx;
         Integer endIdx;
 
         pageRecords = new List<ConsumableorderdetailsInfo>();
-        startIdx = (currentpage-1) * pagesize;
-        endIdx = (currentpage-1) * pagesize+ pagesize;
-        if (endIdx > consumableorderdetailsRecords.size()){
+        startIdx = (currentpage - 1) * pagesize;
+        endIdx = (currentpage - 1) * pagesize + pagesize;
+        if (endIdx > consumableorderdetailsRecords.size()) {
             endIdx = consumableorderdetailsRecords.size();
-        } 
+        }
 
-        for(Integer i=startIdx; i < endIdx ; i++){
+        for (Integer i = startIdx; i < endIdx; i++) {
             pageRecords.add(consumableorderdetailsRecords.get(i));
         }
-   }
+    }
 
     // Data Bean
     class ConsumableorderdetailsInfo implements Comparable {
@@ -1044,16 +1132,16 @@
         }
         // 鎺掑簭
         public Integer compareTo(Object compareTo) {
-            ConsumableorderdetailsInfo compareToesd =(ConsumableorderdetailsInfo)compareTo;
+            ConsumableorderdetailsInfo compareToesd = (ConsumableorderdetailsInfo) compareTo;
             Integer returnValue = 0;
-            if(sortBy == false){
+            if (sortBy == false) {
                 if (allnumber > compareToesd.allnumber) {
                     returnValue = -1;
                 } else if (allnumber < compareToesd.allnumber) {
                     returnValue = 1;
                 }
                 return returnValue;
-            }else{
+            } else {
                 if (allnumber > compareToesd.allnumber) {
                     returnValue = 1;
                 } else if (allnumber < compareToesd.allnumber) {
@@ -1061,7 +1149,6 @@
                 }
                 return returnValue;
             }
-
         }
     }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/classes/LexArriveGoodsController.cls b/force-app/main/default/classes/LexArriveGoodsController.cls
new file mode 100644
index 0000000..0d5ff9d
--- /dev/null
+++ b/force-app/main/default/classes/LexArriveGoodsController.cls
@@ -0,0 +1,389 @@
+public without sharing class LexArriveGoodsController {
+    public static String barcode { get; set; }
+    public static Consumable_order__c coc { get; set; }
+    /*****************鐢婚潰琛ㄧずBean******************/
+    public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
+    public static List<ConsumableorderdetailsInfo> consumableInventory { get; set; }
+    public static List<ConsumableorderdetailsInfo> detailsSummary { get; set; }
+    public static List<ConsumableorderdetailsInfo> consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
+    //鏇存柊鏄庣粏鍙栨秷鏃堕棿
+    public static List<Consumable_order_details2__c> consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
+    // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 start
+    public static Map<String, Consumable_order_details2__c> orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
+    // 鏇存柊鍊熻皟淇℃伅 add by gzw 2020-0-415 end
+    public static List<Consumable_order_details2__c> consumableorderdetails2Insert = new List<Consumable_order_details2__c>();
+    public static List<Consumable_order_details2__c> consumableorderdetails2Nobox = new List<Consumable_order_details2__c>();
+    public static List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordserror { get; set; }
+    public static transient List<ConsumableorderdetailsInfo> ConsumableorderdetailsRecordsdummy { get; set; }
+    public static List<ConsumableorderdetailsInfo> ShowGoodsofReturnList { get; set; }
+    public static List<ConsumableorderdetailsInfo> ShowGoodsofRemoveBoxReturnList { get; set; }
+    //add by rentx 20210602 CHAN-C3K4ZQ
+    public static List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }
+    //add by rentx 20210602 CHAN-C3K4ZQ
+    public static List<String> GrList = new List<String>();
+    //瓒呭嚭瀹氳揣鏁伴噺鐨勪骇鍝�
+    public static List<String> cancellationProList = new List<String>();
+    //閿欒淇℃伅
+    public static String alertMessage { get; set; }
+    public static integer getinventorysize() {
+        return consumableInventory.size();
+    }
+    public static integer geterrorsize() {
+        return ConsumableorderdetailsRecordserror.size();
+    }
+    public static Set<String> noboxBarcodeList = new Set<String>();
+    public static transient Map<String, String> ExistIdMap = new Map<String, String>();
+    public static transient Map<String, String> ErrorIdMap = new Map<String, String>();
+    public static transient Map<String, String> AllMap = new Map<String, String>();
+    public static Map<String, String> otherAgencyMap = new Map<String, String>();
+    public static transient Map<String, String> barMcodeMap = new Map<String, String>();
+    public static Map<String, Integer> BarcodeCntMap = new Map<String, Integer>();
+    public static transient List<String> BarCodeListP = new List<String>();
+    public static Map<String, Decimal> orderProductCunMap = new Map<String, Decimal>();
+    public static Map<String, Decimal> orderProductArrivedCunMap = new Map<String, Decimal>();
+    public static Map<String, Decimal> orderWantArriveCunMap = new Map<String, Decimal>();
+    //瓒呭嚭鍨嬪彿鍜屾暟閲�
+    public static Map<String, Decimal> overOrderCunMap = new Map<String, Decimal>();
+    //瓒呭嚭BARCODE鍜屽瀷鍙�
+    public static Map<String, List<String>> overOrderBARcodeCunMap = new Map<String, List<String>>();
+    public static List<String> overOrderBARcodeTTTTTT = new List<String>();
+    //涓嶇鍚堢殑barcode鍜屽瀷鍙�
+    public static Map<String, List<String>> notEqualBARcodeCunMap = new Map<String, List<String>>();
+    public static List<String> overOrderBARcodeSSSSSS = new List<String>();
+    public static List<String> productList = new List<String>();
+    public static List<String> notInlist = new List<String>();
+    //涓嶉�夋嫨璁㈠崟鏃朵繚瀛樿鍗旾D銆佷骇鍝佸瀷鍙风敤
+    //搴撳瓨鐧诲綍浣跨敤
+    public static List<String> notInStorelist = new List<String>();
+    public static List<String> exitBarCodeList = new List<String>();
+
+    public static Map<String, String> HosErrorMap = new Map<String, String>();
+    public static List<String> HosErrorList = new List<String>();
+    public static String baseUrl { get; private set; }
+    public static String ESetId { get; set; }
+    public static String arriveId = '';
+    private static String accountid = null;
+    private static String accountName = null;
+    public static Decimal orderCountAll = 0;
+    public static Decimal orderCountNotarrive = 0;
+    private static id return_Order_id = null;
+    private static id inventory_Order_id = null;
+    public static boolean ReturnFLGbln { get; set; }
+    public static boolean saveFLGbln { get; set; }
+    public static String ArrType { get; set; }
+    // 鐧诲綍鑰呭伐浣滃湴
+    private static String userWorkLocation;
+
+    //鐢ㄦ埛浜у搧鍖哄垎
+    public static String userPro_Typestr = null;
+    public static String userPro_Type = null;
+    public static String product_Type = null;
+    public static Boolean EngFlag = false;
+    public static Boolean ETFlag = false;
+
+    @AuraEnabled
+    public static Results init(String arrTypeStr, String eSetIdStr) {
+        Results results = new Results();
+        ESetId = eSetIdStr;
+        ArrType = arrTypeStr;
+        ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
+        ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>();
+        ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>();
+        consumableInventory = new List<ConsumableorderdetailsInfo>();
+        consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>();
+        consumableInventoryUse = new List<ConsumableorderdetailsInfo>();
+        consumableorderdetails2Cancle = new List<Consumable_order_details2__c>();
+        orderdetails2trMap = new Map<String, Consumable_order_details2__c>();
+        detailsSummary = new List<ConsumableorderdetailsInfo>();
+        saveFLGbln = false;
+        consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
+        try {
+            String userId = UserInfo.getUserId();
+            List<user> Useracc = new List<user>();
+            Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
+            accountid = Useracc[0].accountid;
+            userPro_Type = Useracc[0].UserPro_Type__c;
+            if (String.isBlank(userPro_Type)) {
+                userPro_Type = 'ET';
+            }
+
+            if (userPro_Type == 'ENG') {
+                product_Type = 'ET';
+                EngFlag = true;
+            } else {
+                product_Type = 'ENG';
+                ETFlag = true;
+            }
+            userPro_Typestr = '%' + userPro_Type + '%';
+            userWorkLocation = Useracc[0].Work_Location__c;
+            system.debug('userWorkLocation' + userWorkLocation);
+            List<account> accountInfo = [SELECT Name FROM account WHERE id = :accountid];
+            accountName = accountInfo[0].Name;
+            system.debug('accountName' + accountName);
+            coc = new Consumable_order__c();
+            if (ArrType == 'ReG') {
+                ReturnFLGbln = true;
+            } else {
+                ReturnFLGbln = false;
+            }
+            if (ESetId != '' && ESetId != null) {
+                List<Consumable_order__c> qs = new List<Consumable_order__c>();
+                List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>();
+                List<Consumable_Orderdetails__c> reSet = new List<Consumable_Orderdetails__c>();
+                qs = [
+                    SELECT
+                        Id,
+                        Name,
+                        Order_status__c,
+                        Dealer_Info__c,
+                        Deliver_date__c,
+                        ReturnGs_Upload_Date__c,
+                        Order_Reason__c,
+                        Order_date__c,
+                        Contract_application_decision__c,
+                        Order_type__c,
+                        Total_num__c,
+                        OrderNumber_arrived__c,
+                        Delivery_detail_count__c,
+                        OrderNumber_notarrive__c,
+                        orderPattern__c
+                    FROM Consumable_order__c
+                    WHERE Id = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation AND Dealer_Info__c = :accountid
+                ];
+                if (qs.size() > 0) {
+                    coc = qs[0];
+                    orderCountAll = coc.Total_num__c;
+                    orderCountNotarrive = coc.OrderNumber_notarrive__c;
+                }
+                //浜у搧瀹氳揣鏁伴噺
+                reSet = [
+                    SELECT Asset_Model_No__c, Consumable_order__c, Consumable_count__c
+                    FROM Consumable_Orderdetails__c
+                    WHERE Consumable_order__c = :ESetId AND Order_Owner_WorkLocal__c = :userWorkLocation
+                ];
+                for (Integer i = 0; i < reSet.size(); i++) {
+                    productList.add(reSet[i].Asset_Model_No__c);
+                    orderProductCunMap.put(reSet[i].Asset_Model_No__c, reSet[i].Consumable_count__c);
+                    orderProductArrivedCunMap.put(reSet[i].Asset_Model_No__c, 0);
+                    orderWantArriveCunMap.put(reSet[i].Asset_Model_No__c, 0);
+                    overOrderCunMap.put(reSet[i].Asset_Model_No__c, 0);
+                    overOrderBARcodeCunMap.put(reSet[i].Asset_Model_No__c, overOrderBARcodeTTTTTT);
+                }
+                reSet1 = [
+                    SELECT
+                        Id,
+                        Name,
+                        Intra_Trade_List_RMB__c,
+                        Asset_Model_No__c,
+                        Consumable_Product__c,
+                        Consumable_Product__r.Name,
+                        Consumable_Product__r.Name__c,
+                        Sterilization_limit__c,
+                        Deliver_date__c,
+                        Bar_Code__c,
+                        Arrive_date__c,
+                        Send_Date__c,
+                        Consumable_order_minor__r.Name,
+                        Consumable_order_minor__c,
+                        Dealer_Arrive__c,
+                        Guarantee_period_for_products__c,
+                        CFDA_Status__c,
+                        Box_Piece__c,
+                        Rrturn_count__c,
+                        ProductPacking_list_manual__c,
+                        Report_Product_Approbation__c,
+                        Report_Product_Expiration__c,
+                        ContractNo_text__c,
+                        Consumable_order_minor__r.ContractNo__c
+                    FROM Consumable_order_details2__c
+                    WHERE
+                        recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
+                        AND Arrive_Owner_Work_Location__c = :userWorkLocation
+                        AND Consumable_order_minor__c = :ESetId
+                        AND Dealer_Arrive__c = TRUE
+                        AND Box_Piece__c != '涓�'
+                ];
+                for (Integer i = 0; i < reSet1.size(); i++) {
+                    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
+                        );
+                    }
+                }
+            }
+            results.accountId = accountid;
+            results.accountName = accountName;
+            results.userProType = userPro_Type;
+            results.userProTypestr = userPro_Typestr;
+            results.productType = product_Type;
+            results.saveFLGbln = saveFLGbln;
+            results.returnFLGbln = ReturnFLGbln;
+            results.engFlag = EngFlag;
+            results.etFlag = ETFlag;
+            results.userWorkLocation = userWorkLocation;
+            results.productList = productList;
+            results.orderProductCunMap = orderProductCunMap;
+            results.orderProductArrivedCunMap = orderProductArrivedCunMap;
+            results.orderWantArriveCunMap = orderWantArriveCunMap;
+            results.overOrderCunMap = overOrderCunMap;
+            results.overOrderBARcodeCunMap = overOrderBARcodeCunMap;
+            results.result = 'Success';
+        } catch (Exception e) {
+            results.result = 'Fail';
+            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+        }
+        return results;
+    }
+
+    @AuraEnabled
+    public static Results methodName() {
+        Results results = new Results();
+        try {
+            results.result = 'Success';
+        } catch (Exception e) {
+            results.result = 'Fail';
+            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+        }
+        return results;
+    }
+
+    public class Results {
+        @AuraEnabled
+        public String result;
+        @AuraEnabled
+        public String errorMsg;
+        @AuraEnabled
+        public String accountId;
+        @AuraEnabled
+        public String accountName;
+        @AuraEnabled
+        public String userProType;
+        @AuraEnabled
+        public String userProTypestr;
+        @AuraEnabled
+        public String productType;
+        @AuraEnabled
+        public String userWorkLocation;
+        @AuraEnabled
+        public String inventoryOrderId;
+        @AuraEnabled
+        public String returnOrderId;
+        @AuraEnabled
+        public String arriveId;
+        @AuraEnabled
+        public Boolean returnFLGbln;
+        @AuraEnabled
+        public Boolean saveFLGbln;
+        @AuraEnabled
+        public Boolean engFlag;
+        @AuraEnabled
+        public Boolean etFlag;
+        @AuraEnabled
+        public Consumable_order__c coc;
+        @AuraEnabled
+        public List<String> productList;
+        @AuraEnabled
+        public Map<String, Decimal> orderProductCunMap;
+        @AuraEnabled
+        public Map<String, Decimal> orderProductArrivedCunMap;
+        @AuraEnabled
+        public Map<String, Decimal> orderWantArriveCunMap;
+        @AuraEnabled
+        public Map<String, Decimal> overOrderCunMap;
+        @AuraEnabled
+        public Map<String, List<String>> overOrderBARcodeCunMap;
+    }
+
+    public class ConsumableorderdetailsInfo implements Comparable {
+        @AuraEnabled
+        public Consumable_order_details2__c esd { get; set; }
+        @AuraEnabled
+        public Product2__c Prod { get; set; }
+        @AuraEnabled
+        public String ProductName { get; set; }
+        @AuraEnabled
+        public String barCodeNo { get; set; }
+        @AuraEnabled
+        public Date sterilizationlimitDate { get; set; }
+        @AuraEnabled
+        public String serialNoorLotNo { get; set; }
+        @AuraEnabled
+        public String tracingCodeNo { get; set; }
+        @AuraEnabled
+        public String ReturnReason { get; set; }
+        @AuraEnabled
+        public String oldConsumableCount { get; set; }
+        @AuraEnabled
+        public String ErrorReason { get; set; }
+        @AuraEnabled
+        public boolean canEdit { get; set; }
+        @AuraEnabled
+        public Integer intMark { get; set; }
+        @AuraEnabled
+        public Decimal arriveAmount { get; set; }
+        @AuraEnabled
+        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;
+            if (e.Box_Piece__c == '鐩�') {
+                e.Rrturn_count__c = 1;
+                canEdit = true;
+            }
+
+            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) {
+            esd = new Consumable_order_details2__c();
+            ProductName = e.Name__c;
+            Prod = e;
+            barCodeNo = barinfoL[0];
+            if (String.isNotBlank(barinfoL[1])) {
+                sterilizationlimitDate = Date.valueOf(barinfoL[1]);
+            }
+            serialNoorLotNo = barinfoL[2];
+            tracingCodeNo = barinfoL[3];
+            ReturnReason = '';
+        }
+
+        public ConsumableorderdetailsInfo(Consumable_order_details2__c e, List<String> barinfoL) {
+            esd = e;
+            Prod = e.Consumable_Product__r;
+            barCodeNo = barinfoL[0];
+            if (String.isNotBlank(barinfoL[1])) {
+                sterilizationlimitDate = Date.valueOf(barinfoL[1]);
+            }
+            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;
+        }
+        // 鎺掑簭
+        public Integer compareTo(Object compareTo) {
+            return null;
+        }
+    }
+}
diff --git a/force-app/main/default/classes/LexArriveGoodsController.cls-meta.xml b/force-app/main/default/classes/LexArriveGoodsController.cls-meta.xml
new file mode 100644
index 0000000..1248daa
--- /dev/null
+++ b/force-app/main/default/classes/LexArriveGoodsController.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>56.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexSummonsCreatController.cls b/force-app/main/default/classes/LexSummonsCreatController.cls
index dd50ba6..9f94ea4 100644
--- a/force-app/main/default/classes/LexSummonsCreatController.cls
+++ b/force-app/main/default/classes/LexSummonsCreatController.cls
@@ -1,5 +1,4 @@
 public without sharing class LexSummonsCreatController {
-
     public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
 
     /*****************妞滅储鐢�******************/
@@ -42,13 +41,19 @@
     public static List<SelectOption> category4OptionList { get; set; }
     public static List<SelectOption> category5OptionList { get; set; }
     @AuraEnabled
-    public static Map<String,String> categoryOptionMap { get; set; }
+    public static Map<String, String> categoryOptionMap { get; set; }
     @AuraEnabled
-    public static Map<String,String> category4OptionMap { get; set; }
+    public static Map<String, String> category4OptionMap { get; set; }
     @AuraEnabled
-    public static Map<String,String> category5OptionMap { get; set; }
+    public static Map<String, String> category5OptionMap { get; set; }
     /*****************鐢婚潰琛ㄧずBean******************/
     private static List<ConsumableorderdetailsInfo> consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
+    //鏄庣粏2
+    @AuraEnabled
+    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords { get; set; }
+    //閿欒鏄庣粏
+    @AuraEnabled
+    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserror { get; set; }
     @AuraEnabled
     public static List<ConsumableorderdetailsInfo> pageRecords { get; set; }
     public static List<ConsumableorderdetailsInfoLwc> pageRecordsLwc { get; set; }
@@ -58,6 +63,18 @@
     private static List<ConsumableorderdetailsInfo> consumableproductdetailsRecords = new List<ConsumableorderdetailsInfo>();
     private static List<Attachment> attachmentinfo = new List<Attachment>();
     public static List<Product2__c> product2Selected = new List<Product2__c>();
+    @AuraEnabled
+    public static Map<String, String> orderpieceorboxMap { get; set; }
+    @AuraEnabled
+    public static List<Consumable_orderdetails__c> orderdetails { get; set; }
+    @AuraEnabled
+    public static Map<String, Decimal> orderagencypriceMap { get; set; }
+    @AuraEnabled
+    public static Map<String, Decimal> orderpriceMap { get; set; }
+    @AuraEnabled
+    public static Map<String, Decimal> orderdetCountMap { get; set; }
+    @AuraEnabled
+    public static Boolean hasSpecialHos { get; set; }
     //閫夋嫨浜у搧size
     public static Integer consumableorderdetailsCount {
         get {
@@ -88,31 +105,42 @@
     public static Boolean EditDelCommitBtnDisabled { get; private set; }
     public static Boolean saveBtnDisabled { get; private set; }
     public static Boolean SorderBtnDisabled { get; private set; }
+
+    // page
+    public static Integer pagesize { get; set; }
+    public static Integer pageToken { get; set; }
+    //public static String sortField { get; set; }
+    //public static String sortOrder { get; set; }
+    public static Integer totalcount { get; set; }
+    public static Integer addSize { get; set; }
+    //List<ConsumableorderdetailsInfoLwc> reSetLwc
+    public static List<ConsumableorderdetailsInfo> addData { get; set; }
+    public static Map<String, String> skipData { get; set; }
     // 淇濆瓨鍚庡姩浣滐細 1.妫�绱� 2.鎺掑簭
-    public static String sortKey { get; set; }
-    public static String preSortKey { get; private set; }
-    public static Boolean sortOrderAsc { get; private set; }
-    public static String[] sortOrder { get; private set; }
-    private static String[] columus = new List<String>{
-        'Consumable_Product__r.Name',
-        'Consumable_Product__r.Asset_Model_No__c',
-        'Consumable_Product__r.Intra_Trade_List_RMB__c',
-        '',
-        '',
-        'Consumable_Product__r.Category3__c',
-        'Consumable_Product__r.Category4__c',
-        'Consumable_Product__r.Category5__c'
-    };
-    private static String[] columus_no = new List<String>{
-        'Product2__c.Name',
-        'Product2__c.Asset_Model_No__c',
-        'Product2__c.Intra_Trade_List_RMB__c',
-        '',
-        '',
-        'Category3__c',
-        'Category4__c',
-        'Category5__c'
-    };
+    // public static String sortKey { get; set; }
+    // public static String preSortKey { get; private set; }
+    // public static Boolean sortOrderAsc { get; private set; }
+    // public static String[] sortOrder { get; private set; }
+    // private static String[] columus = new List<String>{
+    //     'Consumable_Product__r.Name',
+    //     'Consumable_Product__r.Asset_Model_No__c',
+    //     'Consumable_Product__r.Intra_Trade_List_RMB__c',
+    //     '',
+    //     '',
+    //     'Consumable_Product__r.Category3__c',
+    //     'Consumable_Product__r.Category4__c',
+    //     'Consumable_Product__r.Category5__c'
+    // };
+    // private static String[] columus_no = new List<String>{
+    //     'Product2__c.Name',
+    //     'Product2__c.Asset_Model_No__c',
+    //     'Product2__c.Intra_Trade_List_RMB__c',
+    //     '',
+    //     '',
+    //     'Category3__c',
+    //     'Category4__c',
+    //     'Category5__c'
+    // };
 
     //鍒拌揣鍗曟槑缁�1
     private static List<Consumable_Orderdetails__c> consumableorderdetailsSelected = new List<Consumable_Orderdetails__c>();
@@ -168,9 +196,9 @@
         category4OptionList = new List<SelectOption>();
         category5OptionList = new List<SelectOption>();
 
-        categoryOptionMap = new Map<String,String>();
-        category4OptionMap = new Map<String,String>();
-        category5OptionMap = new Map<String,String>();
+        categoryOptionMap = new Map<String, String>();
+        category4OptionMap = new Map<String, String>();
+        category5OptionMap = new Map<String, String>();
 
         outOutPatternOptionMap = new Map<String, String>();
         outOutPatternOptionMap.put('', '-鏃�-');
@@ -183,7 +211,7 @@
         HospitalName = '';
     }
 
-    public static void firstInit(String ESetidJs){
+    public static void firstInit(String ESetidJs) {
         System.debug('enter firstInit');
         ESetid = ESetidJs;
         System.debug('ESetid = ' + ESetid);
@@ -200,9 +228,9 @@
         category4OptionList = new List<SelectOption>();
         category5OptionList = new List<SelectOption>();
 
-        categoryOptionMap = new Map<String,String>();
-        category4OptionMap = new Map<String,String>();
-        category5OptionMap = new Map<String,String>();
+        categoryOptionMap = new Map<String, String>();
+        category4OptionMap = new Map<String, String>();
+        category5OptionMap = new Map<String, String>();
 
         outOutPatternOptionMap = new Map<String, String>();
         outOutPatternOptionMap.put('', '-鏃�-');
@@ -217,9 +245,10 @@
 
     // 鐢婚潰鍒濆鍖�
     @AuraEnabled
-    public static ResponseBodyLWC init(String ESetidJs) {
+    public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC) {
         // try {
         firstInit(ESetidJs);
+        statusEdit = statusEdit;
         arriveorder = '';
         HospitalName = '';
         provinceOpts = new List<SelectOption>();
@@ -227,12 +256,18 @@
         ResponseBodyLWC res = new ResponseBodyLWC();
         Map<String, object> data = new Map<String, object>();
         res.entity = data;
+        // public static Integer pagesize { get; set; }
+        // public static Integer pageToken { get; set; }
+        // public static String sortField { get; set; }
+        // public static String sortOrder { get; set; }
+        pagesize = pageSizeLWC;
+        pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
 
-        sortKey = '1';
-        preSortKey = '1';
-        sortOrderAsc = false;
-        sortOrder = new String[8];
-        sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
+        // sortKey = '1';
+        // preSortKey = '1';
+        // sortOrderAsc = false;
+        // sortOrder = new List<String>(8);
+        // sortOrder = new List<String>{ ' ', ' ', ' ', ' ', '鈫�', '', '', '' };
         //cate1ForSort = '';
         sumPrice = 0;
         IdCheck = EsetId;
@@ -308,6 +343,9 @@
         for (AggregateResult orderdetail : orderdetailCount) {
             zaikuId.add(String.valueOf(orderdetail.get('cpc')));
         }
+        System.debug('sqlagencyProType = ' + sqlagencyProType);
+        System.debug('userWorkLocation = ' + userWorkLocation);
+        System.debug('accountName = ' + accountName);
         List<Consumable_order_details2__c> CountDel = [
             SELECT
                 Id,
@@ -341,8 +379,8 @@
             SummonsFlag = 'hidden';
             String msoql = makeSoqlinventory();
             initStandardController(msoql);
+            System.debug('msoql = ' + msoql);
             product2Selected = Database.query(msoql);
-            //product2Selected = product2s();
             if (String.isBlank(arriveorder)) {
                 EditDelCommitBtnDisabled = true;
                 for (Integer i = 0; i < product2Selected.size(); i++) {
@@ -396,6 +434,7 @@
                             MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                         }
                     }
+                    System.debug('MidMap2.size() = ' + MidMap2.size());
                     /*//鐒跺悗寰幆CountDel鍘讳慨鏀筸ap閲岀殑allnumber
                         if(MidMap.containsKey(CountDel[i].Consumable_Product__c)){
                             ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c);
@@ -432,7 +471,7 @@
 
                 Integer ishosnum = 0;
                 for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
-                    ass.sortBy = sortOrderAsc;
+                    //ass.sortBy = sortOrderAsc;
                     //add by rentx 2021-3-10
                     if (ass.hospitalSpecialOffer) {
                         ishosnum = ishosnum + 1;
@@ -623,7 +662,7 @@
 
                 Integer ishosnum = 0;
                 for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
-                    ass.sortBy = sortOrderAsc;
+                    //ass.sortBy = sortOrderAsc;
                     for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                         cdc1.Shipment_Count__c = cdc1.Consumable_count__c;
                         if (ass.prod.Id == cdc1.Consumable_Product__c) {
@@ -690,9 +729,8 @@
                     consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                 }
             }
-        }
-        // 鏇存柊銆�
-        else {
+        } else {
+            // 鏇存柊銆�
             SummonsFlag = 'visible';
             // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select
             consumableInvoiceRecords = [
@@ -703,6 +741,8 @@
                     AND Invoice_status__c != '鑽夋涓�'
             ];
 
+            System.debug('coc ESetId = ' + ESetId);
+            System.debug('coc userWorkLocation = ' + userWorkLocation);
             coc = [
                 SELECT
                     Id,
@@ -998,9 +1038,8 @@
                 for (Integer i = 0; i < consumablearriveproductdetailsSelected.size(); i++) {
                     consumableproductdetailsRecords.add(new ConsumableorderdetailsInfo(consumablearriveproductdetailsSelected[i]));
                 }
-            }
-            // 涓嶆槸鍒拌揣璁㈠崟鏉ョ殑鏃跺��
-            else {
+            } else {
+                // 涓嶆槸鍒拌揣璁㈠崟鏉ョ殑鏃跺��
                 if (coc.SummonsStatus_c__c == '宸叉彁浜�' || coc.SummonsStatus_c__c == '鎵瑰噯') {
                     system.debug('coc.SummonsStatus_c__c : ' + coc.SummonsStatus_c__c);
                     saveBtnDisabled = true;
@@ -1082,7 +1121,7 @@
                 for (Integer i = 0; i < product2Selected.size(); i++) {
                     MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                 }
-                
+
                 for (Integer i = 0; i < CountDel.size(); i++) {
                     String str = '';
                     if (CountDel[i].hospitalSpecialOffer__c) {
@@ -1157,7 +1196,7 @@
                 // return null;
                 Integer ishosnum = 0;
                 for (ConsumableorderdetailsInfo ass : consumableorderdetailsSelectRecords) {
-                    ass.sortBy = sortOrderAsc;
+                    //ass.sortBy = sortOrderAsc;
                     for (Consumable_Orderdetails__c cdc1 : consumableorderdetailsSelected) {
                         //update by rentx 2012-3-1 start
                         // if(ass.prod.Id == cdc1.Consumable_Product__c){
@@ -1273,7 +1312,7 @@
 
         categoryOptionList = new List<SelectOption>();
         categoryOptionList.add(new SelectOption('', '-鏃�-'));
-        categoryOptionMap = new Map<String,String>();
+        categoryOptionMap = new Map<String, String>();
         categoryOptionMap.put('', '-鏃�-');
         for (AggregateResult category3Search : categoryList) {
             String deliverycnt = String.valueOf(category3Search.get('c3c'));
@@ -1283,7 +1322,7 @@
 
         category4OptionList = new List<SelectOption>();
         category4OptionList.add(new SelectOption('', '-鏃�-'));
-        category4OptionMap = new Map<String,String>();
+        category4OptionMap = new Map<String, String>();
         category4OptionMap.put('', '-鏃�-');
         /*for(AggregateResult category4Search : category4List) {
                 String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
@@ -1292,34 +1331,64 @@
 
         category5OptionList = new List<SelectOption>();
         category5OptionList.add(new SelectOption('', '-鏃�-'));
-        category5OptionMap = new Map<String,String>();
+        category5OptionMap = new Map<String, String>();
         category5OptionMap.put('', '-鏃�-');
 
+        //鍒嗛〉
+        PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+        totalCount = pageRecords.size();
+        System.debug('pageToken = ' + pageToken);
+        System.debug('pageSize = ' + pageSize);
+        System.debug('totalCount = ' + totalCount);
+        paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+        System.debug('paginatedAccounts.nextPageToken = ' + paginatedAccounts.nextPageToken);
+        paginatedAccounts.recordStart = pageToken + 1;
+        paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+        Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+        paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+        paginatedAccounts.totalRecords = totalCount;
+
+        Integer startIdx;
+        Integer endIdx;
+        startIdx = pageToken;
+        endIdx = pageToken + pageSize;
+        List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
+        if (endIdx > pageRecords.size()) {
+            endIdx = pageRecords.size();
+        }
+        for (Integer i = startIdx; i < endIdx; i++) {
+            pageRecordsTemp.add(pageRecords.get(i));
+        }
 
         Boolean Existarrive = (coc.Arrive_Order__c != null);
         String ConsumableOut_report = System.Label.ConsumableOut_report;
         System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
-        data.put('ConsumableOut_report','ConsumableOut_report');
-        data.put('accountid',accountid);
-        data.put('consumableproductdetailsRecords',consumableproductdetailsRecords);
-        data.put('agencyProType',agencyProType);
-        data.put('accountName',accountName);
-        data.put('userWorkLocation',userWorkLocation);
-        data.put('categoryOptionMap',categoryOptionMap);
-        data.put('category4OptionMap',category4OptionMap);
-        data.put('category5OptionMap',category5OptionMap);
-        data.put('outOutPatternOptionMap',outOutPatternOptionMap);
-        data.put('hasHosPro',hasHosPro);
-        data.put('Existarrive',Existarrive);
-        data.put('sumPrice',sumPrice);
+
+        data.put('paginatedAccounts', paginatedAccounts);
+        data.put('ConsumableOut_report', ConsumableOut_report);
+        data.put('accountid', accountid);
+        data.put('consumableproductdetailsRecords', consumableproductdetailsRecords);
+        data.put('agencyProType', agencyProType);
+        data.put('accountName', accountName);
+        data.put('userWorkLocation', userWorkLocation);
+        data.put('categoryOptionMap', categoryOptionMap);
+        data.put('category4OptionMap', category4OptionMap);
+        data.put('category5OptionMap', category5OptionMap);
+        data.put('outOutPatternOptionMap', outOutPatternOptionMap);
+        data.put('hasHosPro', hasHosPro);
+        data.put('Existarrive', Existarrive);
+        data.put('sumPrice', sumPrice);
         data.put('HospitalName', HospitalName);
         data.put('provinceOptsMap', provinceOptsMap);
         data.put('SummonsFlag', SummonsFlag);
         data.put('EditDelCommitBtnDisabled', EditDelCommitBtnDisabled);
         data.put('EditAble', EditAble);
         data.put('coc', coc);
-        data.put('pageRecords', pageRecords);
-        data.put('arriveorder',arriveorder);
+        data.put('pageRecords', pageRecordsTemp);
+        data.put('arriveorder', arriveorder);
+        data.put('consumableorderdetails2Count', consumableorderdetails2Count);
+        data.put('consumableorderdetails2Records', consumableorderdetails2Records);
+        data.put('HospitalInfo', HospitalInfo);
         res.status = 'Success';
         res.code = 200;
         System.debug('res = ' + res);
@@ -1329,9 +1398,119 @@
         // }
     }
 
+    @AuraEnabled
+    public static ResponseBodyLWC categoryAllload(String category3Lwc) {
+        ResponseBodyLWC res = new ResponseBodyLWC();
+        Map<String, object> data = new Map<String, object>();
+        res.entity = data;
+
+        category3 = category3Lwc;
+        AggregateResult[] category4List = [
+            SELECT Count(id), Category4_text__c c4c
+            FROM Product2__c
+            WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+            GROUP BY Category4_text__c
+        ];
+        category4OptionList = new List<SelectOption>();
+        category4OptionList.add(new SelectOption('', '-鏃�-'));
+        category4OptionMap = new Map<String, String>();
+        category4OptionMap.put('', '-鏃�-');
+        for (AggregateResult category4Search : category4List) {
+            String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+            category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+            category4OptionMap.put(deliverycnt4, deliverycnt4);
+        }
+
+        AggregateResult[] category5List = [
+            SELECT Count(id), Category5_text__c c5c
+            FROM Product2__c
+            WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+            GROUP BY Category5_text__c
+        ];
+
+        category5OptionList = new List<SelectOption>();
+        category5OptionList.add(new SelectOption('', '-鏃�-'));
+        category5OptionMap = new Map<String, String>();
+        category5OptionMap.put('', '-鏃�-');
+        for (AggregateResult category5Search : category5List) {
+            String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+            category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+            category5OptionMap.put(deliverycnt5, deliverycnt5);
+        }
+        data.put('category4OptionMap', category4OptionMap);
+        data.put('category5OptionMap', category5OptionMap);
+        res.status = 'Success';
+        res.code = 200;
+        System.debug('res = ' + res);
+        return res;
+    }
+
+    @AuraEnabled
+    public static ResponseBodyLWC categoryload(String category3Lwc, String category4Lwc) {
+        ResponseBodyLWC res = new ResponseBodyLWC();
+        Map<String, object> data = new Map<String, object>();
+        res.entity = data;
+
+        category3 = category3Lwc;
+        category4 = category4Lwc;
+        AggregateResult[] category4List = [
+            SELECT Count(id), Category4_text__c c4c
+            FROM Product2__c
+            WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
+            GROUP BY Category4_text__c
+        ];
+        category4OptionList = new List<SelectOption>();
+        category4OptionList.add(new SelectOption('', '-鏃�-'));
+        category4OptionMap = new Map<String, String>();
+        category4OptionMap.put('', '-鏃�-');
+        for (AggregateResult category4Search : category4List) {
+            String deliverycnt4 = String.valueOf(category4Search.get('c4c'));
+            category4OptionList.add(new SelectOption(deliverycnt4, deliverycnt4));
+            category4OptionMap.put(deliverycnt4, deliverycnt4);
+        }
+
+        AggregateResult[] category5List = [
+            SELECT Count(id), Category5_text__c c5c
+            FROM Product2__c
+            WHERE Category3_text__c = :category3 AND Category4_text__c = :category4 AND Category5_text__c != NULL
+            GROUP BY Category5_text__c
+        ];
+
+        category5OptionList = new List<SelectOption>();
+        category5OptionList.add(new SelectOption('', '-鏃�-'));
+        category5OptionMap = new Map<String, String>();
+        category5OptionMap.put('', '-鏃�-');
+        for (AggregateResult category5Search : category5List) {
+            String deliverycnt5 = String.valueOf(category5Search.get('c5c'));
+            category5OptionList.add(new SelectOption(deliverycnt5, deliverycnt5));
+            category5OptionMap.put(deliverycnt5, deliverycnt5);
+        }
+        data.put('category4OptionMap', category4OptionMap);
+        data.put('category5OptionMap', category5OptionMap);
+        res.status = 'Success';
+        res.code = 200;
+        System.debug('res = ' + res);
+        return res;
+    }
+
     // 妫�绱�
     @AuraEnabled
-    public static ResponseBodyLWC searchConsumableorderdetails(String agencyProTypeLwc,String accountNameLwc,String userWorkLocationLwc,String outOutPattern,String category1,String category3,String category4,String category5,Boolean editAbleLwc,List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc,List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,String arriveorderLwc) {
+    public static ResponseBodyLWC searchConsumableorderdetails(
+        String agencyProTypeLwc,
+        String accountNameLwc,
+        String userWorkLocationLwc,
+        String outOutPattern,
+        String category1,
+        String category3,
+        String category4,
+        String category5,
+        Boolean editAbleLwc,
+        List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc,
+        List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,
+        String arriveorderLwc,
+        Integer pageSizeLWC,
+        Integer pageTokenLWC
+    ) {
         consumableproductdetailsRecords = consumableproductdetailsRecordsLwc;
         pageRecordsLwc = pageRecordsLwcLwc;
         System.debug('pageRecordsLwc = ' + pageRecordsLwc);
@@ -1339,6 +1518,14 @@
         accountName = accountNameLwc;
         userWorkLocation = userWorkLocationLwc;
         agencyProType = agencyProTypeLwc;
+        product2Selected = new List<Product2__c>();
+        pagesize = pageSizeLWC;
+        pageToken = pageTokenLWC > 2000 ? 2000 : pageTokenLWC;
+        addSize = 0;
+        addData = new List<ConsumableorderdetailsInfo>();
+        System.debug('start addData = ' + addData);
+        System.debug('accountName = ' + accountName);
+        System.debug('userWorkLocation = ' + userWorkLocation);
         String sqlagencyProType = '%' + agencyProTypeLwc + '%';
         List<AggregateResult> orderdetailCount = [
             SELECT count(id), Consumable_Product__c cpc, Box_Piece__c
@@ -1366,13 +1553,13 @@
         SearchDone = 'SearchDone';
         Map<String, String> selectedIdMap = new Map<String, String>();
         List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
-        Map<String,ConsumableorderdetailsInfo> MidMap = new Map<String,ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> MidMap = new Map<String, ConsumableorderdetailsInfo>();
         //update by rentx 2021-01-29
-        Map<String,ConsumableorderdetailsInfo> MidMap2 = new Map<String,ConsumableorderdetailsInfo>();
+        Map<String, ConsumableorderdetailsInfo> MidMap2 = new Map<String, ConsumableorderdetailsInfo>();
         String countdelSoql = 'SELECT Id,Bar_Code__c,Name,Inventory_date__c,Consumable_Product__c,Consumable_Product__r.Asset_Model_No__c,Recordtypeid,Box_Piece__c,ProductPacking_list_manual__c,hospitalSpecialOffer__c FROM Consumable_order_details2__c WHERE  Dealer_Arrive__c = true AND Dealer_Shipment__c = false AND Dealer_Saled__c = false AND Dealer_Returned__c = false AND Lose_Flag__c = false AND Bar_Code__c != null AND Isoverdue__c = 1 AND Arrive_Owner_Work_Location__c =  :userWorkLocation AND Dealer_Info_text__c = :accountName ';
         if (String.isNotBlank(outOutPattern) && outOutPattern.equals('ishos')) {
             countdelSoql += ' AND hospitalSpecialOffer__c = true';
-        }else if (String.isNotBlank(outOutPattern) && outOutPattern.equals('nothos')) {
+        } else if (String.isNotBlank(outOutPattern) && outOutPattern.equals('nothos')) {
             countdelSoql += ' AND hospitalSpecialOffer__c = false';
         }
         System.debug('countdelSoql = ' + countdelSoql);
@@ -1382,20 +1569,20 @@
 
         consumableorderdetailsSelectRecords = new List<ConsumableorderdetailsInfo>();
         //consumableorderdetailsSelectRecords = reSet;
-        String soql = makeSoql(category1,category3,category4,category5);
-        System.debug('soql = ' + soql);
+        String soql = makeSoql(category1, category3, category4, category5);
         size = Integer.valueOf(System.Label.orderdetLimitsize);
         initStandardController(soql);
+        System.debug('soql = ' + soql);
         product2Selected = Database.query(soql);
         for (Integer i = 0; i < product2Selected.size(); i++) {
             MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
         }
 
-        for (Integer i = 0; i < CountDel.size() ;i++ ) {
+        for (Integer i = 0; i < CountDel.size(); i++) {
             String str = '';
             if (CountDel[i].hospitalSpecialOffer__c) {
                 str = 'isHos';
-            }else{
+            } else {
                 str = 'notHos';
             }
             System.debug('MidMap = ' + MidMap);
@@ -1403,50 +1590,50 @@
             if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                 //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
                 if (MidMap2.containsKey(CountDel[i].Consumable_Product__c + str)) {
-                    ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c+str);
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Box_Piece__c == '鐩�'){
+                    ConsumableorderdetailsInfo Jstage = MidMap2.get(CountDel[i].Consumable_Product__c + str);
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Box_Piece__c == '鐩�') {
                         Jstage.Boxnumber = Jstage.Boxnumber + 1;
-                    }else if(CountDel[i].Box_Piece__c == '涓�'){
+                    } else if (CountDel[i].Box_Piece__c == '涓�') {
                         Jstage.Piecenumber = Jstage.Piecenumber + 1;
                     }
                     if (CountDel[i].hospitalSpecialOffer__c) {
                         Jstage.hospitalSpecialOffer = true;
-                    }else{
+                    } else {
                         Jstage.hospitalSpecialOffer = false;
                     }
                     if (HosProMap.containsKey(Jstage.Prod.Id)) {
                         Jstage.hosPro = true;
                     }
-                    MidMap2.put(CountDel[i].Consumable_Product__c+str, Jstage);
-                }else{
+                    MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
+                } else {
                     //midmap2涓病鏈夊搴旂殑浜у搧
                     ConsumableorderdetailsInfo Jstage = MidMap.get(CountDel[i].Consumable_Product__c).clone();
-                    Jstage.allnumber = Jstage.allnumber+1 ;
-                    if(CountDel[i].Box_Piece__c == '鐩�'){
+                    Jstage.allnumber = Jstage.allnumber + 1;
+                    if (CountDel[i].Box_Piece__c == '鐩�') {
                         Jstage.Boxnumber = Jstage.Boxnumber + 1;
-                    }else if(CountDel[i].Box_Piece__c == '涓�'){
+                    } else if (CountDel[i].Box_Piece__c == '涓�') {
                         Jstage.Piecenumber = Jstage.Piecenumber + 1;
                     }
                     if (CountDel[i].hospitalSpecialOffer__c) {
                         Jstage.hospitalSpecialOffer = true;
-                    }else{
+                    } else {
                         Jstage.hospitalSpecialOffer = false;
                     }
                     if (HosProMap.containsKey(Jstage.Prod.Id)) {
                         Jstage.hosPro = true;
                     }
                     //Jstage.BoxPiece = CountDel[i].Box_Piece__c;
-                    MidMap2.put(CountDel[i].Consumable_Product__c+str, Jstage);
+                    MidMap2.put(CountDel[i].Consumable_Product__c + str, Jstage);
                 }
             }
         }
         Integer ishosnum = 0;
         System.debug('MidMap2 = ' + MidMap2);
-        for(ConsumableorderdetailsInfo bss : MidMap2.values()){
-            if(selectedIdMap.containsKey(bss.Prod.id)){
+        for (ConsumableorderdetailsInfo bss : MidMap2.values()) {
+            if (selectedIdMap.containsKey(bss.Prod.id)) {
                 continue;
-            }else{
+            } else {
                 bss.sortBy = false;
                 bss.packinglist = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c);
                 bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c;
@@ -1458,52 +1645,95 @@
                 }
             }
         }
-         if (ishosnum > 0) {
+        if (ishosnum > 0) {
             hasHosPro = true;
-        }else{
+        } else {
             hasHosPro = false;
         }
 
-
         consumableorderdetailsSelectRecords.sort();
-        //add by rentx
-        //noOfRecords = consumableorderdetailsSelectRecords.size();
-        //add by rentx
-        //makepagerecords();
         makepagerecordsLwc();
-        // this.sortKey = '1';
-        // this.preSortKey = '1';
-        // this.sortOrderAsc = false;
-        // this.sortOrder = new String[8];
-        // this.sortOrder = new String[]{' ',' ',' ',' ','鈫�','','',''};
-        data.put('pageRecords', pageRecords);
-        data.put('test','test');
+        //鍒嗛〉
+        PaginatedAccounts paginatedAccounts = new PaginatedAccounts();
+        totalCount = pageRecords.size();
+        paginatedAccounts.nextPageToken = (pageToken + pageSize < totalCount) ? pageToken + pageSize : null;
+        paginatedAccounts.recordStart = pageToken + 1;
+        paginatedAccounts.pageNumber = pageToken / pageSize + 1;
+        Integer recordEnd = pageSize * paginatedAccounts.pageNumber;
+        paginatedAccounts.recordEnd = totalCount >= recordEnd ? recordEnd : totalCount;
+        paginatedAccounts.totalRecords = totalCount;
+
+        System.debug('addSize = ' + addSize);
+        Integer startIdx;
+        Integer endIdx;
+        startIdx = pageToken;
+        endIdx = pageToken + pageSize;
+        List<ConsumableorderdetailsInfo> pageRecordsTemp = new List<ConsumableorderdetailsInfo>();
+        if (endIdx > pageRecords.size()) {
+            endIdx = pageRecords.size();
+        }
+
+        System.debug('addData.size() = ' + addData.size());
+        for (ConsumableorderdetailsInfo ci : addData) {
+            pageRecordsTemp.add(ci);
+        }
+        System.debug('startIdx = ' + startIdx);
+        System.debug('endIdx = ' + endIdx);
+        System.debug('skipData = ' + skipData);
+        System.debug('pageRecords = ' + pageRecords.size());
+        String hos = '';
+        for (Integer i = startIdx; i < endIdx; i++) {
+            System.debug('skipData.get(pageRecords.get(i).Prod.Id) = ' + skipData.get(pageRecords.get(i).Prod.Id));
+            if (pageRecords.get(i).hospitalSpecialOffer == true) {
+                hos = 'ishos';
+            } else {
+                hos = 'nothos';
+            }
+            if (skipData.get(pageRecords.get(i).Prod.Id + hos) == null) {
+                pageRecordsTemp.add(pageRecords.get(i));
+            }
+        }
+
+        System.debug('pageRecordsTemp = ' + pageRecordsTemp.size());
+        data.put('paginatedAccounts', paginatedAccounts);
+        data.put('pageRecords', pageRecordsTemp);
+        data.put('SearchDone', SearchDone);
         res.status = 'Success';
         res.code = 200;
         System.debug('res = ' + res);
         return res;
     }
 
-    private static String makeSoql(String CateName,String Category3,String Category4,String Category5){
+    private static String makeSoql(String CateName, String Category3, String Category4, String Category5) {
         String sqlTail1 = '(\'';
-        for(Integer i = 0 ; i< zaikuId.size();i++){
-            if(i<zaikuId.size()-1){
-                sqlTail1 += zaikuId[i]+'\',\'';
-            }else{
-                sqlTail1 += zaikuId[i];
+        for (Integer i = 0; i < zaikuId.size(); i++) {
+            if (zaikuId[i] != null) {
+                if (i < zaikuId.size() - 1) {
+                    sqlTail1 += zaikuId[i] + '\',\'';
+                } else {
+                    sqlTail1 += zaikuId[i];
+                }
             }
         }
         sqlTail1 += '\')';
         String soql = 'SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,Product2__r.Packing_list_manual__c,SFDA_Status__c,Product2__r.SFDA_Approbation_No__c,Product2__r.SFDA_Expiration_Date__c,Category3__c,Category4__c,Category5__c  FROM Product2__c ';
         soql += ' WHERE Id in' + sqlTail1;
-        if(!String.isBlank(CateName)){
-            soql += ' AND (Name__c like \'%' + String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + '%\' or Asset_Model_No__c like \'%' + String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) + '%\')';
-        }if(!String.isBlank(Category3)){
-            soql += ' AND Category3__c = \'' +  Category3 + '\'';
-        }if(!String.isBlank(Category4)){
-            soql += ' AND Category4__c = \'' +  Category4 + '\'';
-        }if(!String.isBlank(Category5)){
-            soql += ' AND Category5__c = \'' +  Category5 + '\'';
+        if (!String.isBlank(CateName)) {
+            soql +=
+                ' AND (Name__c like \'%' +
+                String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+                '%\' or Asset_Model_No__c like \'%' +
+                String.escapeSingleQuotes(CateName.replaceAll('%', '\\%')) +
+                '%\')';
+        }
+        if (!String.isBlank(Category3)) {
+            soql += ' AND Category3__c = \'' + Category3 + '\'';
+        }
+        if (!String.isBlank(Category4)) {
+            soql += ' AND Category4__c = \'' + Category4 + '\'';
+        }
+        if (!String.isBlank(Category5)) {
+            soql += ' AND Category5__c = \'' + Category5 + '\'';
         }
         return soql;
     }
@@ -1526,10 +1756,12 @@
     public static String makeSoqlinventory() {
         String sqlTail = '(\'';
         for (Integer i = 0; i < zaikuId.size(); i++) {
-            if (i < zaikuId.size() - 1) {
-                sqlTail += zaikuId[i] + '\',\'';
-            } else {
-                sqlTail += zaikuId[i];
+            if (zaikuId[i] != null) {
+                if (i < zaikuId.size() - 1) {
+                    sqlTail += zaikuId[i] + '\',\'';
+                } else {
+                    sqlTail += zaikuId[i];
+                }
             }
         }
         sqlTail += '\')';
@@ -1568,6 +1800,7 @@
         }
         System.debug('zhj3');
         pageRecords = new List<ConsumableorderdetailsInfo>();
+        System.debug('reSet.size() = ' + reSet.size());
         if (editAble && String.isBlank(arriveorder)) {
             pageRecords = reSet;
         }
@@ -1575,7 +1808,7 @@
         //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1);
         Integer addNo = 0;
         //update by rentx 2021-2-26 start
-        System.debug('consumableorderdetailsSelectRecords = ' + consumableorderdetailsSelectRecords);
+        System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size());
         for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) {
             Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
             if (
@@ -1600,6 +1833,7 @@
     public static List<ConsumableorderdetailsInfo> makepagerecordsLwc() {
         List<ConsumableorderdetailsInfoLwc> reSetLwc = new List<ConsumableorderdetailsInfoLwc>();
         Map<String, String> selectedIdMap = new Map<String, String>();
+        skipData = new Map<String, String>();
         System.debug('makepagerecordsLwc pageRecordsLwc = ' + pageRecordsLwc);
         //鍙栧嚭閫夋嫨鐨勪骇鍝�
         if (pageRecordsLwc != null) {
@@ -1608,19 +1842,21 @@
                 if (ass.check == true) {
                     if (ass.hospitalSpecialOffer == true) {
                         selectedIdMap.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
+                        skipData.put(ass.Prod.Id + 'ishos', ass.Prod.Id);
                     } else {
                         selectedIdMap.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
+                        skipData.put(ass.Prod.Id + 'nothos', ass.Prod.Id);
                     }
                     reSetLwc.add(ass);
                 }
             }
         }
-        System.debug('reSetLwc = ' + reSetLwc);
         System.debug('selectedIdMap = ' + selectedIdMap);
         pageRecords = new List<ConsumableorderdetailsInfo>();
         if (editAble && String.isBlank(arriveorder)) {
             List<ConsumableorderdetailsInfo> reSet = new List<ConsumableorderdetailsInfo>();
-            for(ConsumableorderdetailsInfoLwc assLwc : reSetLwc){
+            System.debug('reSetLwc = ' + reSetLwc);
+            for (ConsumableorderdetailsInfoLwc assLwc : reSetLwc) {
                 ConsumableorderdetailsInfo ci = new ConsumableorderdetailsInfo();
                 ci.check = assLwc.check;
                 ci.oldCheck = assLwc.oldCheck;
@@ -1646,19 +1882,24 @@
                 reSet.add(ci);
             }
             pageRecords = reSet;
+            System.debug('reSet = ' + reSet);
+            addData = reSet.clone();
+            System.debug('addData = reSet = ' + addData);
         }
         //Integer pagestartNo = (setCon.getPageNumber() * size)-size;
         //Integer pageendNo = (setCon.getPageNumber() * size)>noOfRecords ? noOfRecords :(setCon.getPageNumber() * size-1);
         Integer addNo = 0;
         //update by rentx 2021-2-26 start
-        System.debug('consumableorderdetailsSelectRecords = ' + consumableorderdetailsSelectRecords);
+        System.debug('consumableorderdetailsSelectRecords.size() = ' + consumableorderdetailsSelectRecords.size());
         for (ConsumableorderdetailsInfo info : consumableorderdetailsSelectRecords) {
             Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c();
             if (
                 (info.hospitalSpecialOffer && selectedIdMap.containsKey(info.Prod.Id + 'ishos')) ||
                 (info.hospitalSpecialOffer == false && selectedIdMap.containsKey(info.Prod.Id + 'nothos'))
             ) {
+                System.debug('鍘绘帀鐨刬d : ' + info.Prod.Id);
                 addNo++;
+                addSize++;
             } else {
                 if (info.check == false) {
                     info.orderdetails1 = orderdetails1;
@@ -1667,93 +1908,109 @@
                 addNo++;
             }
         }
-        System.debug('pageRecords = ' + pageRecords);
+        System.debug('pageRecords.size() = ' + pageRecords.size());
+        System.debug('end  addData = ' + addData);
         return pageRecords;
     }
 
-
-
-
-
     // 淇濆瓨鎸夐挳
     @AuraEnabled
-    public static ResponseBodyLWC save(Consumable_order__c cocLwc,String hospitalInfoLwc,String hospitalNameLwc,String secondaryDistributor,List<ConsumableorderdetailsInfoLwc> pageRecordsLwc,String accountid,String ESetId,List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc) {
-        System.debug('cocLwc = ' + cocLwc);
+    public static ResponseBodyLWC save(
+        Consumable_order__c cocLwc,
+        String hospitalInfoLwc,
+        String hospitalNameLwc,
+        String secondaryDistributorLwc,
+        List<ConsumableorderdetailsInfoLwc> pageRecordsLwc,
+        String accountidLwc,
+        String ESetIdLwc,
+        List<ConsumableorderdetailsInfo> consumableproductdetailsRecordsLwc,
+        String agencyProTypeLwc,
+        String userWorkLocationLwc
+    ) {
         coc = cocLwc;
         HospitalInfo = hospitalInfoLwc;
         HospitalName = hospitalNameLwc;
-        SecondDealer = secondaryDistributor;
+        SecondDealer = secondaryDistributorLwc;
         pageRecordsLwc = pageRecordsLwc;
+        accountid = accountidLwc;
         consumableproductdetailsRecords = consumableproductdetailsRecordsLwc;
+        ESetId = ESetIdLwc;
+        agencyProType = agencyProTypeLwc;
+        userWorkLocation = userWorkLocationLwc;
+
+        System.debug('coc = ' + coc);
+        System.debug('HospitalInfo = ' + HospitalInfo);
+        System.debug('HospitalName = ' + HospitalName);
+        System.debug('SecondDealer = ' + SecondDealer);
+        System.debug('pageRecordsLwc = ' + pageRecordsLwc);
+        System.debug('accountid = ' + accountid);
+        System.debug('consumableproductdetailsRecords = ' + consumableproductdetailsRecords);
+        System.debug('ESetId = ' + ESetId);
         ResponseBodyLWC res = new ResponseBodyLWC();
         Map<String, object> data = new Map<String, object>();
         res.entity = data;
         //璁㈠崟淇℃伅纭
-        if(coc.SummonsForDirction__c  ==''||coc.SummonsForDirction__c  == null){
+        if (coc.SummonsForDirction__c == '' || coc.SummonsForDirction__c == null) {
             // coc.SummonsForDirction__c.addError('璇疯緭鍏ユ寚绀哄崟鐩殑銆�');
             // return null;
-            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ユ寚绀哄崟鐩殑銆�', '');
-        }
-        else if(coc.SummonsForDirction__c =='鐩存帴閿�鍞粰鍖婚櫌'){
-            if(String.isBlank(HospitalInfo) || String.isBlank(HospitalName)){
+            return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ寚绀哄崟鐩殑銆�', '');
+        } else if (coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌') {
+            if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
                 // coc.addError('璇疯緭鍏ュ尰闄€��');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ尰闄€��', '');
+                return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄€��', '');
             }
-            if(String.isBlank(coc.Order_ForCustomerText__c)){
+            if (String.isBlank(coc.Order_ForCustomerText__c)) {
                 // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹ゃ��');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '璇疯緭鍏ョ瀹ゃ��', '');
-            }
-            else if(String.isNotBlank(SecondDealer) || String.isNotBlank(coc.Order_ForDealerText__c)){
+                return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹ゃ��', '');
+            } else if (String.isNotBlank(SecondDealer) || String.isNotBlank(coc.Order_ForDealerText__c)) {
                 // coc.addError('涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅銆�' );
                 // return null;
-                return new ResponseBodyLWC('Error',500, '涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅銆�', '');
+                return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佷簩绾х粡閿�鍟嗗拰缁忛攢鍟�(褰曞叆)淇℃伅銆�', '');
             }
-        }else if(coc.SummonsForDirction__c =='鍖婚櫌璇曠敤'){
-            if(String.isBlank(HospitalInfo) || String.isBlank(HospitalName)){
+        } else if (coc.SummonsForDirction__c == '鍖婚櫌璇曠敤') {
+            if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
                 // coc.addError('璇疯緭鍏ュ尰闄€��');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ尰闄€��', '');
+                return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄€��', '');
             }
-            if(String.isBlank(coc.Order_ForCustomerText__c)){
+            if (String.isBlank(coc.Order_ForCustomerText__c)) {
                 // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹ゃ��');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '璇疯緭鍏ョ瀹ゃ��', '');
+                return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹ゃ��', '');
             }
-        }
-        else if(coc.SummonsForDirction__c =='閿�鍞粰浜岀骇缁忛攢鍟�'){
-            if(String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)){
+        } else if (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�') {
+            if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) {
                 // coc.addError('蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)銆�');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)銆�', '');
+                return new ResponseBodyLWC('Error', 500, '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)銆�', '');
             }
-            if(String.isBlank(HospitalInfo) || String.isBlank(HospitalName)){
+            if (String.isBlank(HospitalInfo) || String.isBlank(HospitalName)) {
                 // coc.addError('璇疯緭鍏ュ尰闄€��');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ尰闄€��', '');
+                return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ尰闄€��', '');
             }
-            if(String.isBlank(coc.Order_ForCustomerText__c)){
+            if (String.isBlank(coc.Order_ForCustomerText__c)) {
                 // coc.Order_ForCustomerText__c.addError('璇疯緭鍏ョ瀹ゃ��');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '璇疯緭鍏ョ瀹ゃ��', '');
+                return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ョ瀹ゃ��', '');
             }
-        }
-        else if(coc.SummonsForDirction__c =='浜掔浉璋冭揣'){
-            if(String.isNotBlank(HospitalInfo) || String.isNotBlank(HospitalName)){
+        } else if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+            if (String.isNotBlank(HospitalInfo) || String.isNotBlank(HospitalName)) {
                 // coc.addError('涓嶉渶瑕佽緭鍏ュ尰闄€��');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '涓嶉渶瑕佽緭鍏ュ尰闄€��', '');
+                return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ュ尰闄€��', '');
             }
-            if(String.isNotBlank(coc.Order_ForCustomerText__c)){
+            if (String.isNotBlank(coc.Order_ForCustomerText__c)) {
                 // coc.Order_ForCustomerText__c.addError('涓嶉渶瑕佽緭鍏ョ瀹ゃ��');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '涓嶉渶瑕佽緭鍏ョ瀹ゃ��', '');
+                return new ResponseBodyLWC('Error', 500, '涓嶉渶瑕佽緭鍏ョ瀹ゃ��', '');
             }
-            if(String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)){
+            if (String.isBlank(SecondDealer) && String.isBlank(coc.Order_ForDealerText__c)) {
                 // coc.addError('蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)銆�');
                 // return null;
-                return new ResponseBodyLWC('Error',500, '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)銆�', '');
+                return new ResponseBodyLWC('Error', 500, '蹇呴』杈撳叆浜岀骇缁忛攢鍟嗘垨缁忛攢鍟�(褰曞叆)銆�', '');
             }
         }
 
@@ -1761,47 +2018,47 @@
 
         Integer FLG = 0;
         Integer Count = 0;
-        for(ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
+        for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
             FLG = FLG + 1;
-            if(CheckCount.check == false){ 
+            if (CheckCount.check == false) {
                 Count = Count + 1;
-            }else{
+            } else {
                 //add by rentx
                 if (CheckCount.hospitalSpecialOffer) {
-                    isHos = isHos+1;
+                    isHos = isHos + 1;
                 }
                 //add by rentx
             }
         }
-        if(Count == FLG){
+        if (Count == FLG) {
             // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇烽�夋嫨鎵�闇�娑堣�楀搧'));
             // return null;
-            return new ResponseBodyLWC('Error',500, '璇烽�夋嫨鎵�闇�娑堣�楀搧', '');
+            return new ResponseBodyLWC('Error', 500, '璇烽�夋嫨鎵�闇�娑堣�楀搧', '');
         }
         // gzw 娉ㄩ噴 鍒ゆ柇鎻愬墠 20210308
         //checkOutPattern();
         //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
         Integer isHosCheckOutPattern = 0;
-        for(ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
+        for (ConsumableorderdetailsInfoLwc CheckCount : pageRecordsLwc) {
             if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) {
-                isHosCheckOutPattern = isHosCheckOutPattern +1;
+                isHosCheckOutPattern = isHosCheckOutPattern + 1;
             }
         }
         if (isHosCheckOutPattern > 0) {
             coc.OutPattern__c = true;
-        }else{
+        } else {
             coc.OutPattern__c = false;
         }
 
         // add by rentx 2021-3-10 start
         //鐗逛环鍖婚櫌鍑哄簱闈炴湰鍖婚櫌缁存姢鐨勭壒浠峰晢鍝佹椂,鎶ラ敊 闈炵壒浠峰尰闄㈠嚭搴撶淮鎶ゅ湪鍖婚櫌鐗逛环鍏崇郴琛ㄧ殑浜у搧鏃� 鎶ラ敊
-        if(coc.SummonsForDirction__c !='浜掔浉璋冭揣'){
+        if (coc.SummonsForDirction__c != '浜掔浉璋冭揣') {
             //闈炵壒浠峰尰闄㈠嚭搴撶壒浠蜂骇鍝佹椂 鎶ラ敊(褰撳墠缁忛攢鍟嗕笅娌℃湁鐗逛环鍖婚櫌闄ゅ)
-            List<hospitalprice__c> hopList = [select id,hospital__c,product__c from hospitalprice__c where account__c = :accountid];
+            List<hospitalprice__c> hopList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid];
             //缁忛攢鍟嗗搴斿尰闄笅鐨勬墍鏈夌壒浠蜂骇鍝�
-            Map<String,String> proMap = new Map<String,String>();
+            Map<String, String> proMap = new Map<String, String>();
             //缁忛攢鍟嗕笅鐨勬墍鏈夌壒浠蜂骇鍝�
-            Map<String,String> allProMap = new Map<String,String>();
+            Map<String, String> allProMap = new Map<String, String>();
 
             if (hopList != null && hopList.size() > 0) {
                 Boolean flag = false;
@@ -1810,47 +2067,50 @@
                         allProMap.put(hp.product__c, '');
                         //濡傛灉褰撳墠 鍖婚櫌鐗逛环鍏崇郴涓殑鍖婚櫌瀵瑰簲鍑哄簱鍗曚笂鍑哄簱鐨勫尰闄�,鍒欐斁浜у搧id鍒癿ap
                         if (hp.hospital__c == HospitalInfo) {
-                            flag = true; 
+                            flag = true;
                             proMap.put(hp.product__c, '');
                         }
-
                     }
                 }
-                for(ConsumableorderdetailsInfoLwc ass : pageRecordsLwc){
+                for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                     if (ass.check == true) {
                         //鍒ゆ柇閫変腑鐨勫尰闄㈢壒浠蜂骇鍝�
                         if (ass.hospitalSpecialOffer == true) {
                             //鐢ㄦ埛閫変腑浜嗗綋鍓嶅尰闄笅鐨勭壒浠蜂骇鍝�
                             if (proMap.containsKey(ass.Prod.Id)) {
                                 continue;
-                            //鐢ㄦ埛閫変腑浜嗘病鏈夌淮鎶ょ壒浠峰尰闄㈢殑鐗逛环浜у搧
-                            }else if (!allProMap.containsKey(ass.Prod.Id)) {
+                                //鐢ㄦ埛閫変腑浜嗘病鏈夌淮鎶ょ壒浠峰尰闄㈢殑鐗逛环浜у搧
+                            } else if (!allProMap.containsKey(ass.Prod.Id)) {
                                 continue;
-                            }else{
+                            } else {
                                 //鐢ㄦ埛閫変腑闈炲綋鍓嶅尰闄㈢淮鎶ょ殑鐗逛环浜у搧
                                 // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:'+ ass.Prod.Name__c +' 鐨勭壒浠�'));
                                 // return null;
-                                return new ResponseBodyLWC('Error',500, '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:' + ass.Prod.Name__c + '鐨勭壒浠�', '');
+                                return new ResponseBodyLWC('Error', 500, '褰撳墠鍖婚櫌娌℃湁缁存姢 娑堣�楀搧:' + ass.Prod.Name__c + '鐨勭壒浠�', '');
                             }
-                        }//闈炲尰闄㈢壒浠蜂骇鍝佸彲浠ュ嚭搴撶粰浠绘剰鍖婚櫌,鎵�浠ヤ笉闇�瑕佸垽鏂�
+                        } //闈炲尰闄㈢壒浠蜂骇鍝佸彲浠ュ嚭搴撶粰浠绘剰鍖婚櫌,鎵�浠ヤ笉闇�瑕佸垽鏂�
                     }
                 }
             }
-        }else{
-            //濡傛灉鏄簰鐩歌皟璐�,鍒ゆ柇 缁忛攢鍟�(褰曞叆) 鏄惁缁存姢浜� 褰撳墠閫変腑鐨勭壒浠蜂骇鍝� 
-            List<hospitalprice__c> hopList = [select id,hospital__c,product__c from hospitalprice__c where account__c = :coc.Order_ForDealerTextID__c];
-            Map<Id,String> proMap = new Map<Id,String>();
+        } else {
+            //濡傛灉鏄簰鐩歌皟璐�,鍒ゆ柇 缁忛攢鍟�(褰曞叆) 鏄惁缁存姢浜� 褰撳墠閫変腑鐨勭壒浠蜂骇鍝�
+            List<hospitalprice__c> hopList = [
+                SELECT id, hospital__c, product__c
+                FROM hospitalprice__c
+                WHERE account__c = :coc.Order_ForDealerTextID__c
+            ];
+            Map<Id, String> proMap = new Map<Id, String>();
             if (hopList != null && hopList.size() > 0) {
                 for (hospitalprice__c hpc : hopList) {
                     proMap.put(hpc.product__c, '');
                 }
 
                 String proStr = '';
-                for(ConsumableorderdetailsInfoLwc ass : pageRecordsLwc){
+                for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                     if (ass.check == true) {
                         if (ass.hospitalSpecialOffer == true) {
                             if (!proMap.containsKey(ass.Prod.Id)) {
-                                proStr += ass.Prod.Name__c+',';
+                                proStr += ass.Prod.Name__c + ',';
                             }
                         }
                     }
@@ -1858,124 +2118,291 @@
                 if (proStr != '') {
                     // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '缁忛攢鍟�:'+coc.Order_ForDealerText__c +' 娌℃湁娑堣�楀搧:'+proStr.substring(0,proStr.length()-1) + ' 鐨勭壒浠�'));
                     // return null;
-                    return new ResponseBodyLWC('Error',500, '缁忛攢鍟�:' + coc.Order_ForDealerText__c + ' 娌℃湁娑堣�楀搧:' + proStr.substring(0,proStr.length()-1) + ' 鐨勭壒浠�', '');
+                    return new ResponseBodyLWC(
+                        'Error',
+                        500,
+                        '缁忛攢鍟�:' + coc.Order_ForDealerText__c + ' 娌℃湁娑堣�楀搧:' + proStr.substring(0, proStr.length() - 1) + ' 鐨勭壒浠�',
+                        ''
+                    );
                 }
             }
         }
-        
+
         // checkOutPattern();
         Consumable_order__c p = new Consumable_order__c();
-        List<Consumable_orderdetails__c> Ins = New List<Consumable_orderdetails__c>();
-        List<Consumable_order_details2__c> InsProduct = New List<Consumable_order_details2__c>();
+        List<Consumable_orderdetails__c> Ins = new List<Consumable_orderdetails__c>();
+        List<Consumable_order_details2__c> InsProduct = new List<Consumable_order_details2__c>();
         Savepoint sp = Database.setSavepoint();
         // try {
-            //鏂板缓璁㈠崟鏃�
-            if(String.isEmpty(ESetId)){
-                p.Name = '*';
-                p.Order_type__c = '浼犵エ';
-                p.Order_ProType__c = agencyProType;
-                if(coc.SummonsStatus_c__c ==null||String.isBlank(coc.SummonsStatus_c__c))coc.SummonsStatus_c__c ='鑽夋涓�'; 
-                // update strat by vivek 2019-7-12
-                p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
-                // update end by vivek 2019-7-12
-                p.SummonsStatus_c__c = coc.SummonsStatus_c__c;
-                if(coc.Arrive_Order__c != null){
-                    p.Arrive_Order__c = coc.Arrive_Order__c;
-                }
-                p.Offers_Price__c = coc.Offers_Price__c;
-                p.Dealer_Info__c = accountid;
-                if(String.isBlank(SecondDealer)){
-                    p.Order_ForHospital__c =String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
-                    p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
-                }else {
-                    p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
-                    p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
-                    p.Order_ForDealer__c = SecondDealer;
-                }
-                P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
-                P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
-                p.Order_date__c = coc.Order_date__c;
-                p.SummonsForDirction__c = coc.SummonsForDirction__c;
-                p.RecordTypeid = System.Label.RT_ConOrder_Outboundorder;
-                // update start by vivek 2019-7-15
-                p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
-                // update end by vivek 2019-7-15
-                //add by rentx 
-                p.OutPattern__c = coc.OutPattern__c;
-                //add by rentx
-                //Map<String,String> ProductNewMap = new Map<String, String>();
-                for(ConsumableorderdetailsInfoLwc ass : pageRecordsLwc){
-                    if(ass.check == true){
-                        if(ass.orderdetails1.Delivery_List_RMB__c < 0){
-                            // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�', '');
-                        }
-                        if(ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c !='鍖婚櫌璇曠敤'){
-                            // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�', '');
-                        }
-                        if(ass.orderdetails1.Delivery_List_RMB__c == 0 && (coc.SummonsForDirction__c =='閿�鍞粰浜岀骇缁忛攢鍟�' || coc.SummonsForDirction__c =='鐩存帴閿�鍞粰鍖婚櫌')){
-                            // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�', '');
-                        }
-                        if(ass.orderdetails1.Shipment_Count__c == null ||ass.orderdetails1.Shipment_Count__c ==0){
-                            // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲忋��');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ嚭璐ф暟閲忋��', '');
-                        }
+        //鏂板缓璁㈠崟鏃�
+        if (String.isEmpty(ESetId)) {
+            p.Name = '*';
+            p.Order_type__c = '浼犵エ';
+            p.Order_ProType__c = agencyProType;
+            if (coc.SummonsStatus_c__c == null || String.isBlank(coc.SummonsStatus_c__c))
+                coc.SummonsStatus_c__c = '鑽夋涓�';
+            // update strat by vivek 2019-7-12
+            p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
+            // update end by vivek 2019-7-12
+            p.SummonsStatus_c__c = coc.SummonsStatus_c__c;
+            if (coc.Arrive_Order__c != null) {
+                p.Arrive_Order__c = coc.Arrive_Order__c;
+            }
+            p.Offers_Price__c = coc.Offers_Price__c;
+            p.Dealer_Info__c = accountid;
+            if (String.isBlank(SecondDealer)) {
+                p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+                p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+            } else {
+                p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+                p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+                p.Order_ForDealer__c = SecondDealer;
+            }
+            P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+            P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
+            p.Order_date__c = coc.Order_date__c;
+            p.SummonsForDirction__c = coc.SummonsForDirction__c;
+            p.RecordTypeid = System.Label.RT_ConOrder_Outboundorder;
+            // update start by vivek 2019-7-15
+            p.NoConfirmedPrice__c = coc.NoConfirmedPrice__c;
+            // update end by vivek 2019-7-15
+            //add by rentx
+            p.OutPattern__c = coc.OutPattern__c;
+            //add by rentx
+            //Map<String,String> ProductNewMap = new Map<String, String>();
+            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+                if (ass.check == true) {
+                    if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
+                        // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�', '');
+                    }
+                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '鍖婚櫌璇曠敤') {
+                        // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�', '');
+                    }
+                    if (
+                        ass.orderdetails1.Delivery_List_RMB__c == 0 &&
+                        (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
+                        coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌')
+                    ) {
+                        // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�', '');
+                    }
+                    if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
+                        // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲忋��');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐ф暟閲忋��', '');
+                    }
 
-                        if(ass.orderdetails1.Box_Piece__c == null ||ass.orderdetails1.Box_Piece__c ==''){
-                            // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣嶃��');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ崟浣嶃��', '');
-                        }
-                        if(ass.orderdetails1.Box_Piece__c == '鐩�'){
-                            if(ass.orderdetails1.Shipment_Count__c > ass.Boxnumber){
-                                //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
-                                if(ass.oldCheck == false){
-                                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
-                                    return new ResponseBodyLWC('Error',500, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
-                                }else{
-                                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
-                                    return new ResponseBodyLWC('Error',500, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻', '');
-                                }
+                    if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
+                        // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣嶃��');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ崟浣嶃��', '');
+                    }
+                    if (ass.orderdetails1.Box_Piece__c == '鐩�') {
+                        if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) {
+                            //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+                            if (ass.oldCheck == false) {
+                                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+                                return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+                            } else {
+                                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+                                return new ResponseBodyLWC(
+                                    'Error',
+                                    500,
+                                    '娑堣�楀搧' + ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻',
+                                    ''
+                                );
                             }
-                        }else if(ass.orderdetails1.Box_Piece__c == '涓�'){
-                            if(ass.orderdetails1.Shipment_Count__c > ass.Piecenumber){
-                                //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻'); 
-                                if(ass.oldCheck == false){
-                                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
-                                    return new ResponseBodyLWC('Error',500, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
-                                }else{
-                                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
-                                    return new ResponseBodyLWC('Error',500, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻', '');
-                                }
+                        }
+                    } else if (ass.orderdetails1.Box_Piece__c == '涓�') {
+                        if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) {
+                            //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+                            if (ass.oldCheck == false) {
+                                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+                                return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+                            } else {
+                                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+                                return new ResponseBodyLWC(
+                                    'Error',
+                                    500,
+                                    '娑堣�楀搧' + ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻',
+                                    ''
+                                );
                             }
                         }
                     }
                 }
-                insert p;
-                ESetId = p.id;
-                List<Consumable_order__c> detailName = new List<Consumable_order__c>();
-                detailName = [SELECT id,Name FROM Consumable_order__c WHERE id =:ESetId];
-                Integer i = 1;
-                for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc)  {
-                    if(ass.check == true){
-                        Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
+            }
+            insert p;
+            ESetId = p.id;
+            List<Consumable_order__c> detailName = new List<Consumable_order__c>();
+            detailName = [SELECT id, Name FROM Consumable_order__c WHERE id = :ESetId];
+            Integer i = 1;
+            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+                if (ass.check == true) {
+                    Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
+                    String str = string.valueOf(i);
+                    if (str.length() == 1) {
+                        str = '0' + str;
+                    }
+                    InsAfterDel.Name = detailName[0].name + '-' + str;
+                    InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
+                    InsAfterDel.Consumable_order__c = p.id;
+                    InsAfterDel.Consumable_Product__c = ass.Prod.id;
+                    InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
+                    InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
+                    // TODO 榛樿 鐩� 锛岄渶瑕佷慨姝�
+                    InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
+                    InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
+                    //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
+                    InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
+                    InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+                    //add by rentx 2021-2-26 start
+                    InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer;
+                    //add by rentx 2021-2-26 end
+                    i++;
+                    Ins.add(InsAfterDel);
+                }
+            }
+            // 濡傛灉 鍑哄簱鍗� 鍜� OCM鍙戣揣Header杩� 鐨勮瘽锛屽彂璐х殑Detail2 Copy鍒� 鍑哄簱鍗曠殑Detail2閲�
+            if (getExistarrive()) {
+                for (ConsumableorderdetailsInfo ass : consumableproductdetailsRecords) {
+                    //BlockForP;
+                    Consumable_order_details2__c InsProductDet = new Consumable_order_details2__c();
+                    InsProductDet.Id = ass.orderdetails2.Id;
+                    InsProductDet.Consumable_ZS_order__c = p.id;
+                    i++;
+                    InsProduct.add(InsProductDet);
+                }
+            }
+            if (Ins.size() > 0) {
+                insert Ins;
+            }
+            if (InsProduct.size() > 0) {
+                //ControllerUtil.updateOrderDetailsSatus(InsProduct);
+                update InsProduct;
+            }
+        } else if (ESetId != null || ESetId.length() > 0) {
+            //淇敼涔嬪悗 淇濆瓨璁㈠崟
+            List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+            // update start by vivek 2019-7-15 add "NoConfirmedPrice__c" in select
+            cocinfo = [
+                SELECT Id, Name, SummonsStatus_c__c, NoConfirmedPrice__c, Dealer_Info__c, Order_ForHospital__c, SummonsForDirction__c
+                FROM Consumable_order__c
+                WHERE Id = :ESetId
+            ];
+            // update end by vivek 2019-7-15
+            if (cocinfo.size() > 0) {
+                p = cocinfo[0];
+            }
+            p.Name = coc.Name;
+            p.Dealer_Info__c = accountid;
+            p.Order_ProType__c = agencyProType;
+            if (String.isEmpty(SecondDealer)) {
+                p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+                p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+                System.debug('SecondDealer = ' + SecondDealer);
+                p.Order_ForDealer__c = null;
+            } else {
+                p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
+                p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
+                p.Order_ForDealer__c = SecondDealer;
+            }
+            P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
+            P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
+            p.Order_date__c = coc.Order_date__c;
+            p.SummonsForDirction__c = coc.SummonsForDirction__c;
+            //add by rentx
+            p.OutPattern__c = coc.OutPattern__c;
+            // update start by vivek 2019-7-15
+            if (p.SummonsStatus_c__c == '浠锋牸鏈畾') {
+                p.NoConfirmedPrice__c = false;
+                p.SummonsStatus_c__c = '宸插畬鎴�';
+            } else {
+                p.SummonsStatus_c__c = '鑽夋涓�';
+            }
+            // p.SummonsStatus_c__c = '鑽夋涓�';
+            // update end by vivek 2019-7-15
+            Integer i = 1;
+            //Map<String,String> ProductOldMap = new Map<String, String>();
+            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+                if (ass.check == true) {
+                    if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
+                        // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�', '');
+                    }
+                    Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
+                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '鍖婚櫌璇曠敤') {
+                        // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�', '');
+                    }
+                    if (
+                        ass.orderdetails1.Delivery_List_RMB__c == 0 &&
+                        (coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�' ||
+                        coc.SummonsForDirction__c == '鐩存帴閿�鍞粰鍖婚櫌')
+                    ) {
+                        // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�', '');
+                    }
+                    if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
+                        // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣嶃��');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ崟浣嶃��', '');
+                    }
+                    if (ass.orderdetails1.Box_Piece__c == '鐩�') {
+                        if (ass.orderdetails1.Shipment_Count__c > ass.Boxnumber) {
+                            //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
+                            if (ass.oldCheck == false) {
+                                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+                                return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+                            } else {
+                                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+                                return new ResponseBodyLWC(
+                                    'Error',
+                                    500,
+                                    '娑堣�楀搧' + ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻',
+                                    ''
+                                );
+                            }
+                        }
+                    } else if (ass.orderdetails1.Box_Piece__c == '涓�') {
+                        if (ass.orderdetails1.Shipment_Count__c > ass.Piecenumber) {
+                            if (ass.oldCheck == false) {
+                                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
+                                return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
+                            } else {
+                                //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+                                return new ResponseBodyLWC(
+                                    'Error',
+                                    500,
+                                    '娑堣�楀搧' + ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻',
+                                    ''
+                                );
+                            }
+                        }
+                    }
+                    if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
+                        // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲忋��');
+                        // return null;
+                        return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ュ嚭璐ф暟閲忋��', '');
+                    } else {
                         String str = string.valueOf(i);
-                        if(str.length() == 1){
+                        if (str.length() == 1) {
                             str = '0' + str;
                         }
-                        InsAfterDel.Name = detailName[0].name + '-'+ str;
+                        InsAfterDel.Name = p.name + '-' + str;
                         InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
-                        InsAfterDel.Consumable_order__c = p.id;
+                        InsAfterDel.Consumable_order__c = ESetId;
                         InsAfterDel.Consumable_Product__c = ass.Prod.id;
-                        InsAfterDel.Intra_Trade_List_RMB__c =ass.Prod.Intra_Trade_List_RMB__c;
+                        InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
                         InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
-                        // TODO 榛樿 鐩� 锛岄渶瑕佷慨姝�
                         InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
                         InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
                         //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
@@ -1988,155 +2415,17 @@
                         Ins.add(InsAfterDel);
                     }
                 }
-                // 濡傛灉 鍑哄簱鍗� 鍜� OCM鍙戣揣Header杩� 鐨勮瘽锛屽彂璐х殑Detail2 Copy鍒� 鍑哄簱鍗曠殑Detail2閲�
-                if (getExistarrive()) {
-                    for (ConsumableorderdetailsInfo ass : consumableproductdetailsRecords)  {
-                        //BlockForP;
-                        Consumable_order_details2__c InsProductDet = new Consumable_order_details2__c();
-                        InsProductDet.Id = ass.orderdetails2.Id;
-                        InsProductDet.Consumable_ZS_order__c = p.id;
-                        i++;
-                        InsProduct.add(InsProductDet);
-                    }
-                }
-                if(Ins.size()>0){
-                    insert Ins;
-                }
-                if(InsProduct.size() >0){
-                    ControllerUtil.updateOrderDetailsSatus(InsProduct);
-                }
             }
-            //淇敼涔嬪悗 淇濆瓨璁㈠崟
-            else if(ESetId != null || ESetId.length() >0 ){
-                List<Consumable_order__c> cocinfo = New List<Consumable_order__c>();
-                // update start by vivek 2019-7-15 add "NoConfirmedPrice__c" in select
-                cocinfo = [SELECT Id,
-                                Name,
-                                SummonsStatus_c__c,
-                                NoConfirmedPrice__c,
-                                Dealer_Info__c,
-                                Order_ForHospital__c,
-                                SummonsForDirction__c
-                            FROM Consumable_order__c
-                            WHERE Id =:ESetId];
-                // update end by vivek 2019-7-15
-                if (cocinfo.size()>0){
-                    p = cocinfo[0];
-                }
-                p.Name = coc.Name;
-                p.Dealer_Info__c = accountid;
-                p.Order_ProType__c = agencyProType;
-                if(SecondDealer == null){
-                    p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
-                    p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
-                    p.Order_ForDealer__c = SecondDealer;
-                }else {
-                    p.Order_ForHospital__c = String.isNotBlank(HospitalInfo) ? HospitalInfo : null;
-                    p.Order_ForCustomerText__c = coc.Order_ForCustomerText__c;
-                    p.Order_ForDealer__c = SecondDealer;
-                }
-                P.Order_ForDealerText__c = coc.Order_ForDealerText__c;
-                P.Order_ForDealerTextID__c = coc.Order_ForDealerTextID__c;
-                p.Order_date__c = coc.Order_date__c;
-                p.SummonsForDirction__c = coc.SummonsForDirction__c;
-                //add by rentx
-                p.OutPattern__c = coc.OutPattern__c;
-                // update start by vivek 2019-7-15
-                if(p.SummonsStatus_c__c== '浠锋牸鏈畾'){
-                    p.NoConfirmedPrice__c = false;
-                    p.SummonsStatus_c__c= '宸插畬鎴�';
-                }else{
-                    p.SummonsStatus_c__c = '鑽夋涓�';
-                }
-                // p.SummonsStatus_c__c = '鑽夋涓�';
-                // update end by vivek 2019-7-15
-                Integer i = 1;
-                //Map<String,String> ProductOldMap = new Map<String, String>();
-                for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc)  {
-                    if(ass.check == true){
-                        if(ass.orderdetails1.Delivery_List_RMB__c < 0){
-                            // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ユ纭殑鍑鸿揣鍗曚环 (鍏�)銆�', '');
-                        }
-                        Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
-                        if(ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c !='鍖婚櫌璇曠敤'){
-                            // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�', '');
-                        }
-                        if(ass.orderdetails1.Delivery_List_RMB__c == 0 && (coc.SummonsForDirction__c =='閿�鍞粰浜岀骇缁忛攢鍟�' || coc.SummonsForDirction__c =='鐩存帴閿�鍞粰鍖婚櫌')){
-                            // ass.orderdetails1.Delivery_List_RMB__c.addError('璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ嚭璐у崟浠� (鍏�)銆�', '');
-                        }
-                        if(ass.orderdetails1.Box_Piece__c == null ||ass.orderdetails1.Box_Piece__c ==''){
-                            // ass.orderdetails1.Box_Piece__c.addError('璇疯緭鍏ュ崟浣嶃��');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ崟浣嶃��', '');
-                        }
-                        if(ass.orderdetails1.Box_Piece__c == '鐩�'){
-                            if(ass.orderdetails1.Shipment_Count__c > ass.Boxnumber){
-                                //ass.orderdetails1.Shipment_Count__c.addError('搴撳瓨涓嶈冻');
-                                if(ass.oldCheck == false){
-                                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
-                                    return new ResponseBodyLWC('Error',500, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
-                                }else{
-                                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
-                                    return new ResponseBodyLWC('Error',500, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻', '');
-                                }
-                            }
-                        }else if(ass.orderdetails1.Box_Piece__c == '涓�'){
-                            if(ass.orderdetails1.Shipment_Count__c > ass.Piecenumber){
-                                if(ass.oldCheck == false){
-                                    // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻'));
-                                    return new ResponseBodyLWC('Error',500, '娑堣�楀搧'+ ass.Prod.Name__c + '搴撳瓨涓嶈冻', '');
-                                }else{
-                                    //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
-                                    return new ResponseBodyLWC('Error',500, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻', '');
-                                }
-                            }
-                        }
-                        if(ass.orderdetails1.Shipment_Count__c == null||ass.orderdetails1.Shipment_Count__c==0){
-                            // ass.orderdetails1.Shipment_Count__c.addError('璇疯緭鍏ュ嚭璐ф暟閲忋��');
-                            // return null;
-                            return new ResponseBodyLWC('Error',500, '璇疯緭鍏ュ嚭璐ф暟閲忋��', '');
-                        }else{
-
-                            String str = string.valueOf(i);
-                            if(str.length() == 1){
-                                str = '0' + str;
-                            }
-                            InsAfterDel.Name = p.name + '-'+ str;
-                            InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
-                            InsAfterDel.Consumable_order__c = ESetId;
-                            InsAfterDel.Consumable_Product__c = ass.Prod.id;
-                            InsAfterDel.Intra_Trade_List_RMB__c =ass.Prod.Intra_Trade_List_RMB__c;
-                            InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
-                            InsAfterDel.Box_Piece__c = ass.orderdetails1.Box_Piece__c;
-                            InsAfterDel.Out_unit__c = ass.orderdetails1.Box_Piece__c;
-                            //InsAfterDel.Unitprice_To_agency__c = ass.orderdetails1.Unitprice_To_agency__c;
-                            InsAfterDel.Dealer_Custom_Price__c = ass.orderdetails1.Dealer_Custom_Price__c;
-                            InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
-                            //add by rentx 2021-2-26 start
-                            InsAfterDel.isOutPattern__c = ass.hospitalSpecialOffer;
-                            //add by rentx 2021-2-26 end
-                            i++;
-                            Ins.add(InsAfterDel);
-                        }
-                    }
-                }
-                update p;
-                List<Consumable_orderdetails__c> qs = New List<Consumable_orderdetails__c>();
-                qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c =:ESetId];
-                if (qs.size()>0){
-                    delete qs;
-                }
-                if(Ins.size()>0){
-                    insert Ins;
-                }
-
+            update p;
+            List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>();
+            qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
+            if (qs.size() > 0) {
+                delete qs;
             }
+            if (Ins.size() > 0) {
+                insert Ins;
+            }
+        }
         // }catch (Exception ex) {
         //     Database.rollback(sp);
         //     // ApexPages.addMessages(ex);
@@ -2144,31 +2433,31 @@
         //     //return new ResponseBodyLWC('Error',500, ex.getMessage(), '');
         //     return new ResponseBodyLWC('Error',500, JSON.serialize(ex), '');
         // }
-        data.put('ESetId',ESetId);
+        data.put('ESetId', ESetId);
         res.status = 'Success';
         res.code = 200;
         System.debug('res = ' + res);
         return res;
     }
 
-    public static void checkOutPattern(){
+    public static void checkOutPattern() {
         //鏍规嵁鐢ㄦ埛閫変腑鐨勪骇鍝佺粰 鍑哄簱鍗曚笂鐨勬槸鍚﹀尰闄㈢壒浠峰嚭搴撳瓧娈佃祴鍊�
         Integer isHos = 0;
-        for(ConsumableorderdetailsInfo CheckCount : pageRecords) {
+        for (ConsumableorderdetailsInfo CheckCount : pageRecords) {
             if (CheckCount.check == true && CheckCount.hospitalSpecialOffer == true) {
-                ishos = ishos +1;
+                ishos = ishos + 1;
             }
         }
         if (isHos > 0) {
             coc.OutPattern__c = true;
-        }else{
+        } else {
             coc.OutPattern__c = false;
         }
     }
 
     //鎵撳嵃PDF
     @AuraEnabled
-    public static ResponseBodyLWC PraseToPDF(Consumable_order__c cocLwc,String ESetId){
+    public static ResponseBodyLWC PraseToPDF(Consumable_order__c cocLwc, String ESetId) {
         System.debug('cocLwc = ' + cocLwc);
         System.debug('ESetId = ' + ESetId);
         coc = cocLwc;
@@ -2176,19 +2465,184 @@
         Map<String, object> data = new Map<String, object>();
         res.entity = data;
 
-        if(coc.SummonsStatus_c__c =='鎵瑰噯'){
+        if (coc.SummonsStatus_c__c == '鎵瑰噯') {
             Consumable_order__c P = new Consumable_order__c();
-            List<Consumable_order__c> cocinfo = New List<Consumable_order__c>();
-            // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select 
-            cocinfo = [SELECT Id,Name,SummonsStatus_c__c,NoConfirmedPrice__c,Dealer_Info__c,Order_ForHospital__c,SummonsForDirction__c,Billed_Status__c FROM Consumable_order__c WHERE Id =:ESetId];
+            List<Consumable_order__c> cocinfo = new List<Consumable_order__c>();
+            // update start by vivek 2019-7-15 add 鈥淣oConfirmedPrice__c鈥� in select
+            cocinfo = [
+                SELECT
+                    Id,
+                    Name,
+                    SummonsStatus_c__c,
+                    NoConfirmedPrice__c,
+                    Dealer_Info__c,
+                    Order_ForHospital__c,
+                    SummonsForDirction__c,
+                    Billed_Status__c
+                FROM Consumable_order__c
+                WHERE Id = :ESetId
+            ];
             // update end by vivek 2019-7-15
-                if (cocinfo.size()>0){
-                    p = cocinfo[0];
-                }
+            if (cocinfo.size() > 0) {
+                p = cocinfo[0];
+            }
             p.SummonsStatus_c__c = '鍑哄簱鍗曞凡鎵撳嵃';
             update p;
         }
-        data.put('ESetId',ESetId);
+        data.put('ESetId', ESetId);
+        res.status = 'Success';
+        res.code = 200;
+        System.debug('res = ' + res);
+        return res;
+    }
+
+    //鏌ユ壘缁忛攢鍟�
+    @AuraEnabled(cacheable=true scope='global')
+    public static List<LookupSearchResult> search(String searchTerm) {
+        System.debug('searchTerm = ' + searchTerm);
+        String nameCondition = '';
+        nameCondition += '%' + String.escapeSingleQuotes(''.replaceAll('%', '\\%')) + '%';
+        List<Account> accs;
+        System.debug('nameCondition = ' + nameCondition);
+        accs = [
+            SELECT id, Parentid
+            FROM Account
+            WHERE
+                Parent.Name LIKE :nameCondition
+                AND Contract_Decide_Start_Date__c <= :Date.Today()
+                AND Contract_Decide_End_Date__c >= :Date.Today()
+        ];
+
+        // 鐢ㄤ簬淇濆瓨鐗圭害缁忛攢鍟嗗尮閰嶅埌鐨勫叾鐖剁被鐨刬d
+        Set<String> pids = new Set<String>();
+        for (Account acc : accs) {
+            pids.add(acc.Parentid);
+        }
+        accs = [
+            SELECT Id, Name, Department_Class__c, Department_Class__r.Name, Hospital__c, Hospital__r.Name, BillingCity
+            FROM Account
+            WHERE
+                (Id IN :pids
+                OR (Name = '濂ユ灄宸存柉锛堝寳浜級閿�鍞湇鍔℃湁闄愬叕鍙�'
+                AND Name LIKE :nameCondition))
+                AND RecordType.DeveloperName = 'Agency'
+                AND Is_Active__c != '鐒″姽'
+            ORDER BY Name
+            LIMIT 5
+        ];
+
+        List<LookupSearchResult> results = new List<LookupSearchResult>();
+        String accountIcon = 'standard:account';
+        for (Account account : accs) {
+            String subtitle = account.BillingCity == null ? 'Account' : 'Account 鈥� ' + account.BillingCity;
+            results.add(new LookupSearchResult(account.Id, 'Account', accountIcon, account.Name, subtitle));
+        }
+        results.sort();
+        System.debug('results = ' + results);
+        return results;
+    }
+
+    //淇濆瓨闄勪欢
+    @AuraEnabled
+    public static String saveFile(Id recordId, String fileName, String base64Data) {
+        base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8');
+        ContentVersion cv = new ContentVersion();
+        cv.Title = fileName;
+        cv.PathOnClient = '/' + fileName;
+        cv.FirstPublishLocationId = recordId;
+        cv.VersionData = EncodingUtil.base64Decode(base64Data);
+        cv.IsMajorVersion = true;
+        insert cv;
+        return cv.Id;
+    }
+
+    //鑾峰彇闄勪欢
+    @AuraEnabled
+    public static ResponseBodyLWC getFiles(Id recordId) {
+        System.debug('getFiles recordId = ' + recordId);
+        ResponseBodyLWC res = new ResponseBodyLWC();
+        Map<String, object> data = new Map<String, object>();
+        res.entity = data;
+        List<ContentVersion> cvList = [
+            SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate
+            FROM ContentVersion
+            WHERE FirstPublishLocationId = :recordId
+        ];
+        data.put('cvList', cvList);
+        res.status = 'Success';
+        res.code = 200;
+        System.debug('res = ' + res);
+        return res;
+    }
+
+    //璺宠浆鍑鸿揣/閿�鍞�
+    @AuraEnabled
+    public static ResponseBodyLWC GoodsDelivery(
+        Consumable_order__c cocLwc,
+        String ESetId,
+        List<ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc
+    ) {
+        ResponseBodyLWC res = new ResponseBodyLWC();
+        Map<String, object> data = new Map<String, object>();
+        res.entity = data;
+        coc = cocLwc;
+        ESetId = ESetId;
+        pageRecordsLwc = pageRecordsLwcLwc;
+        if (coc.SummonsForDirction__c == '浜掔浉璋冭揣') {
+            List<Account> accList = [
+                SELECT Id
+                FROM Account
+                WHERE Name = :coc.Order_ForDealerText__c AND RecordType.DeveloperName = 'Agency'
+            ];
+            if (accList.size() < 1) {
+                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇疯緭鍏ヤ簩绾х粡閿�鍟嗗叏绉帮紒'));
+                // return null;
+                return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ簩绾х粡閿�鍟嗗叏绉帮紒', '');
+            }
+        }
+        if (coc.SummonsStatus_c__c == '鎵瑰噯') {
+            // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '璇峰厛鎵撳嵃鎸囩ず鍗曪紒'));
+            // return null;
+            return new ResponseBodyLWC('Error', 500, '璇峰厛鎵撳嵃鎸囩ず鍗曪紒', '');
+        }
+        for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
+            if (ass.orderdetails1.Shipment_Count__c > ass.allnumber) {
+                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, '娑堣�楀搧'+ ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻'));
+                // return null;
+                return new ResponseBodyLWC('Error', 500, '娑堣�楀搧' + ass.orderdetails1.Consumable_Product__r.Name__c + '搴撳瓨涓嶈冻', '');
+            }
+        }
+        data.put('ESetid', ESetid);
+        res.status = 'Success';
+        res.code = 200;
+        System.debug('res = ' + res);
+        return res;
+    }
+
+    //鍒犻櫎鎸夐挳
+    @AuraEnabled
+    public static ResponseBodyLWC DelConsumable(String ESetId) {
+        ResponseBodyLWC res = new ResponseBodyLWC();
+        Map<String, object> data = new Map<String, object>();
+        res.entity = data;
+
+        ESetId = ESetId;
+
+        Savepoint sp = Database.setSavepoint();
+        try {
+            List<Consumable_order__c> qs = new List<Consumable_order__c>();
+            List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>();
+            Dqs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
+            qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId];
+            if (Dqs.size() > 0 || qs.size() > 0) {
+                delete Dqs;
+                delete qs;
+            }
+        } catch (Exception e) {
+            Database.rollback(sp);
+            System.debug(e.getMessage() + e.getLineNumber());
+            return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
+        }
         res.status = 'Success';
         res.code = 200;
         System.debug('res = ' + res);
@@ -2240,7 +2694,8 @@
         @AuraEnabled
         public Boolean hosPro { get; set; }
 
-        public ConsumableorderdetailsInfo(){}
+        public ConsumableorderdetailsInfo() {
+        }
 
         public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) {
             check = true;
@@ -2289,6 +2744,7 @@
             hospitalSpecialOffer = false;
             hosPro = false;
         }
+
         public ConsumableorderdetailsInfo(Product2__c e) {
             check = false;
             oldCheck = false;
@@ -2334,7 +2790,7 @@
         }
     }
 
-    class ConsumableorderdetailsInfoLwc{
+    class ConsumableorderdetailsInfoLwc {
         @AuraEnabled
         public Boolean check { get; set; }
         @AuraEnabled
@@ -2377,24 +2833,38 @@
         @AuraEnabled
         public Boolean hosPro { get; set; }
         @AuraEnabled
-        public List<Map<String,String>> unitOptions{ get; set; }
+        public List<Map<String, String>> unitOptions { get; set; }
         @AuraEnabled
-        public String unitValue{ get; set; }
+        public String unitValue { get; set; }
         @AuraEnabled
-        public Integer shipmentNumber{ get; set; }
+        public Integer shipmentNumber { get; set; }
         @AuraEnabled
-        public Decimal shippingUnitPrice{ get; set; }
+        public Decimal shippingUnitPrice { get; set; }
         @AuraEnabled
-        public String recordId{ get; set; }
+        public String recordId { get; set; }
         @AuraEnabled
-        public String Id{ get; set; }
+        public String Id { get; set; }
         @AuraEnabled
-        public String Name{ get; set; }
+        public String Name { get; set; }
         @AuraEnabled
-        public String Category3{ get; set; }
+        public String Category3 { get; set; }
         @AuraEnabled
-        public String Category4{ get; set; }
+        public String Category4 { get; set; }
         @AuraEnabled
-        public String Category5{ get; set; }
+        public String Category5 { get; set; }
     }
-}
\ No newline at end of file
+
+    //鍒嗛〉Bean
+    public class PaginatedAccounts {
+        @AuraEnabled
+        public Integer nextPageToken;
+        @AuraEnabled
+        public Integer pageNumber { get; set; }
+        @AuraEnabled
+        public Integer totalRecords { get; set; }
+        @AuraEnabled
+        public Integer recordStart { get; set; }
+        @AuraEnabled
+        public Integer recordEnd { get; set; }
+    }
+}
diff --git a/force-app/main/default/classes/LogAutoSendBatch.cls b/force-app/main/default/classes/LogAutoSendBatch.cls
index 2b270b0..89a2fac 100644
--- a/force-app/main/default/classes/LogAutoSendBatch.cls
+++ b/force-app/main/default/classes/LogAutoSendBatch.cls
@@ -1,15 +1,9 @@
 global class LogAutoSendBatch implements Database.Batchable<sObject>, Database.AllowsCallouts, Database.Stateful {
-
     private String typeNFM;
     private String messageGroupNumber;
     private Datetime times;
-    private Boolean isForecast;// 20220318 ljh SWAG-CC54R2 add  
+    private Boolean isForecast; // 20220318 ljh SWAG-CC54R2 add
     private String loginId;
-
-     //20230203 lt 璁″垝鐨勪綔涓氫紭鍖�  涓�灏忔椂涓ゆ start
-     private BatchEmailUtil.ScBean scB1;
-     //20230203 lt 璁″垝鐨勪綔涓氫紭鍖�  涓�灏忔椂涓ゆ end
-
     /**
      * 銈炽兂銈广偪銉炽儓
      */
@@ -19,14 +13,14 @@
         this.loginId = loginId;
     }
     // 2023-1-19 zyh DB202301301244 add start
-    global LogAutoSendBatch(String type,String message) {
+    global LogAutoSendBatch(String type, String message) {
         this.typeNFM = type;
         this.messageGroupNumber = message;
-        System.debug('type++++++'+type + 'message+++++' + message);
+        System.debug('type++++++' + type + 'message+++++' + message);
     }
     // 2023-1-19 zyh DB202301301244 add end
     // 20220318 ljh SWAG-CC54R2 add start
-    global LogAutoSendBatch(String type,Boolean isForecast) {
+    global LogAutoSendBatch(String type, Boolean isForecast) {
         this.typeNFM = type;
         this.isForecast = isForecast;
     }
@@ -43,103 +37,224 @@
      */
     public Integer max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
     global Database.QueryLocator start(Database.BatchableContext BC) {
-
-        //20230203 lt 璁″垝鐨勪綔涓氫紭鍖�  涓�灏忔椂涓ゆ start
-        scB1 = BatchEmailUtil.setSc1('LogAutoSendSchedule', 0, 23, 0, '0 30 *', null);
-        if (System.Test.isRunningTest() == false) {
-            for(CronTrigger ct : [SELECT Id FROM CronTrigger WHERE CronJobDetail.Name =: scB1.scName]) {
-                System.abortJob(ct.Id);
-            }
-            system.schedule(scB1.scName, scB1.scTime, new LogAutoSendSchedule());
-        }
-        //20230203 lt 璁″垝鐨勪綔涓氫紭鍖�  涓�灏忔椂涓ゆ end
-
         String profileId = UserInfo.getProfileId();
         // 20220318 ljh SWAG-CC54R2 add start
-        if(String.isNotBlank(typeNFM) && typeNFM == 'NFM010' && String.isBlank(messageGroupNumber)){
+        if (String.isNotBlank(typeNFM) && typeNFM == 'NFM010' && String.isBlank(messageGroupNumber)) {
             return Database.getQueryLocator(
-                [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
-                 Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, Type__c,
-                 retry_cnt__c, NFM501Future_Count__c, NFM501_Web_Annex_Count__c
-                 FROM BatchIF_Log__c
-                 WHERE RowDataFlg__c = true
-                 AND (retry_cnt__c = null OR (retry_cnt__c != null AND retry_cnt__c > 0 AND retry_cnt__c < : max_cnt))
-                 AND Type__c = : typeNFM ]
-                );
+                [
+                    SELECT
+                        Id,
+                        Name,
+                        Log__c,
+                        ErrorLog__c,
+                        Log2__c,
+                        Log3__c,
+                        Log4__c,
+                        Log5__c,
+                        Log6__c,
+                        Log7__c,
+                        Log8__c,
+                        Log9__c,
+                        Log10__c,
+                        Log11__c,
+                        Log12__c,
+                        MessageGroupNumber__c,
+                        Type__c,
+                        retry_cnt__c,
+                        NFM501Future_Count__c,
+                        NFM501_Web_Annex_Count__c
+                    FROM BatchIF_Log__c
+                    WHERE
+                        RowDataFlg__c = TRUE
+                        AND (retry_cnt__c = NULL
+                        OR (retry_cnt__c != NULL
+                        AND retry_cnt__c > 0
+                        AND retry_cnt__c < :max_cnt))
+                        AND Type__c = :typeNFM
+                ]
+            );
         }
         // gzw 603 閲嶅彂鍒ゆ柇 鏆傛椂鐢�
         // ljh鍙墽琛岃嚜宸辫繖鏉℃棩蹇楋紝鑰屼笖杩欎釜鏃ュ織retry_cnt__c涓嶆槸0
         else if (String.isNotBlank(loginId)) {
             return Database.getQueryLocator(
-                [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
-                    Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, Type__c,
-                    retry_cnt__c, NFM501Future_Count__c, NFM501_Web_Annex_Count__c
+                [
+                    SELECT
+                        Id,
+                        Name,
+                        Log__c,
+                        ErrorLog__c,
+                        Log2__c,
+                        Log3__c,
+                        Log4__c,
+                        Log5__c,
+                        Log6__c,
+                        Log7__c,
+                        Log8__c,
+                        Log9__c,
+                        Log10__c,
+                        Log11__c,
+                        Log12__c,
+                        MessageGroupNumber__c,
+                        Type__c,
+                        retry_cnt__c,
+                        NFM501Future_Count__c,
+                        NFM501_Web_Annex_Count__c
                     FROM BatchIF_Log__c
-                    WHERE RowDataFlg__c = true
-                    AND retry_cnt__c != 0
-                    AND id = : loginId ]
-                );
+                    WHERE RowDataFlg__c = TRUE AND retry_cnt__c != 0 AND id = :loginId
+                ]
+            );
         }
         // gzw 603 閲嶅彂鍒ゆ柇 鏆傛椂鐢�
         // 2023-01-19   zyh   add start
         else if (String.isNotBlank(typeNFM) && String.isNotBlank(messageGroupNumber) && times == null) {
             return Database.getQueryLocator(
-                [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
-                 Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, Type__c,
-                 retry_cnt__c, NFM501Future_Count__c, NFM501_Web_Annex_Count__c
-                 FROM BatchIF_Log__c
-                 WHERE RowDataFlg__c = true
-                                       AND Type__c = : typeNFM AND MessageGroupNumber__c = : messageGroupNumber
-                                                    ]
-                );
+                [
+                    SELECT
+                        Id,
+                        Name,
+                        Log__c,
+                        ErrorLog__c,
+                        Log2__c,
+                        Log3__c,
+                        Log4__c,
+                        Log5__c,
+                        Log6__c,
+                        Log7__c,
+                        Log8__c,
+                        Log9__c,
+                        Log10__c,
+                        Log11__c,
+                        Log12__c,
+                        MessageGroupNumber__c,
+                        Type__c,
+                        retry_cnt__c,
+                        NFM501Future_Count__c,
+                        NFM501_Web_Annex_Count__c
+                    FROM BatchIF_Log__c
+                    WHERE RowDataFlg__c = TRUE AND Type__c = :typeNFM AND MessageGroupNumber__c = :messageGroupNumber
+                ]
+            );
         }
         // 2023-01-19   zyh   add end
         else if (String.isNotBlank(typeNFM) && String.isNotBlank(messageGroupNumber) && times != null) {
-        // 20220318 ljh SWAG-CC54R2 add end
-        //20191224 HWAG-BK65E8 add start
-        // if (String.isNotBlank(typeNFM) && String.isNotBlank(messageGroupNumber) && times != null) {
+            // 20220318 ljh SWAG-CC54R2 add end
+            //20191224 HWAG-BK65E8 add start
+            // if (String.isNotBlank(typeNFM) && String.isNotBlank(messageGroupNumber) && times != null) {
             return Database.getQueryLocator(
-                [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
-                 Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, Type__c,
-                 retry_cnt__c, NFM501Future_Count__c, NFM501_Web_Annex_Count__c
-                 FROM BatchIF_Log__c
-                 WHERE RowDataFlg__c = true
-                                         AND Type__c != 'NFM007'  // 2023-01-18   ZYH   ADD
-                                        AND Type__c = : typeNFM AND CreatedDate >= : times AND MessageGroupNumber__c >= : messageGroupNumber
-                                                     order by MessageGroupNumber__c asc ]
-                );
+                [
+                    SELECT
+                        Id,
+                        Name,
+                        Log__c,
+                        ErrorLog__c,
+                        Log2__c,
+                        Log3__c,
+                        Log4__c,
+                        Log5__c,
+                        Log6__c,
+                        Log7__c,
+                        Log8__c,
+                        Log9__c,
+                        Log10__c,
+                        Log11__c,
+                        Log12__c,
+                        MessageGroupNumber__c,
+                        Type__c,
+                        retry_cnt__c,
+                        NFM501Future_Count__c,
+                        NFM501_Web_Annex_Count__c
+                    FROM BatchIF_Log__c
+                    WHERE
+                        RowDataFlg__c = TRUE
+                        AND Type__c != 'NFM007' // 2023-01-18   ZYH   ADD
+                        AND Type__c = :typeNFM
+                        AND CreatedDate >= :times
+                        AND MessageGroupNumber__c >= :messageGroupNumber
+                    ORDER BY MessageGroupNumber__c ASC
+                ]
+            );
             //20191224 HWAG-BK65E8 add end
         } else if (profileId.left(15).equals('00e10000000dzzG') || profileId.left(15).equals('00e10000000Y3o5')) {
             return Database.getQueryLocator(
-                [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
-                 Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, Type__c,
-                 retry_cnt__c, NFM501Future_Count__c, NFM501_Web_Annex_Count__c
-                 FROM BatchIF_Log__c
-                 WHERE RowDataFlg__c = true
-                                         AND Type__c != 'NFM007'  // 2023-01-18   ZYH   ADD
-                                        AND ((retry_cnt__c != null AND retry_cnt__c > 0 AND retry_cnt__c < : max_cnt)
-                                            OR (NFM501Future_Count__c != null
-                                                AND NFM501Future_Count__c > 0 AND NFM501Future_Count__c < : max_cnt)
-                                            OR(NFM501_Web_Annex_Count__c != null
-                                               AND NFM501_Web_Annex_Count__c > 0 AND NFM501_Web_Annex_Count__c < : max_cnt))]
-                );
-        }else {
+                [
+                    SELECT
+                        Id,
+                        Name,
+                        Log__c,
+                        ErrorLog__c,
+                        Log2__c,
+                        Log3__c,
+                        Log4__c,
+                        Log5__c,
+                        Log6__c,
+                        Log7__c,
+                        Log8__c,
+                        Log9__c,
+                        Log10__c,
+                        Log11__c,
+                        Log12__c,
+                        MessageGroupNumber__c,
+                        Type__c,
+                        retry_cnt__c,
+                        NFM501Future_Count__c,
+                        NFM501_Web_Annex_Count__c
+                    FROM BatchIF_Log__c
+                    WHERE
+                        RowDataFlg__c = TRUE
+                        AND Type__c != 'NFM007' // 2023-01-18   ZYH   ADD
+                        AND ((retry_cnt__c != NULL
+                        AND retry_cnt__c > 0
+                        AND retry_cnt__c < :max_cnt)
+                        OR (NFM501Future_Count__c != NULL
+                        AND NFM501Future_Count__c > 0
+                        AND NFM501Future_Count__c < :max_cnt)
+                        OR (NFM501_Web_Annex_Count__c != NULL
+                        AND NFM501_Web_Annex_Count__c > 0
+                        AND NFM501_Web_Annex_Count__c < :max_cnt))
+                ]
+            );
+        } else {
             return Database.getQueryLocator(
-                [SELECT Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c,
-                 Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, Type__c,
-                 retry_cnt__c, NFM501Future_Count__c, NFM501_Web_Annex_Count__c
-                 FROM BatchIF_Log__c
-                 WHERE RowDataFlg__c = true
-                                         AND Type__c != 'NFM007'  // 2023-01-18   ZYH   ADD
-                                        AND ((retry_cnt__c != null AND retry_cnt__c > 0 AND retry_cnt__c < : max_cnt)
-                                            OR (NFM501Future_Count__c != null
-                                                AND NFM501Future_Count__c > 0 AND NFM501Future_Count__c < : max_cnt)
-                                            OR(NFM501_Web_Annex_Count__c != null
-                                               AND NFM501_Web_Annex_Count__c > 0 AND NFM501_Web_Annex_Count__c < : max_cnt))
-                                       AND ownerId = : UserInfo.getUserId()
-                                       ORDER BY CreatedDate // 2023-02-04   ZYH   ADD
-                                       ]
-                );
+                [
+                    SELECT
+                        Id,
+                        Name,
+                        Log__c,
+                        ErrorLog__c,
+                        Log2__c,
+                        Log3__c,
+                        Log4__c,
+                        Log5__c,
+                        Log6__c,
+                        Log7__c,
+                        Log8__c,
+                        Log9__c,
+                        Log10__c,
+                        Log11__c,
+                        Log12__c,
+                        MessageGroupNumber__c,
+                        Type__c,
+                        retry_cnt__c,
+                        NFM501Future_Count__c,
+                        NFM501_Web_Annex_Count__c
+                    FROM BatchIF_Log__c
+                    WHERE
+                        RowDataFlg__c = TRUE
+                        AND Type__c != 'NFM007' // 2023-01-18   ZYH   ADD
+                        AND ((retry_cnt__c != NULL
+                        AND retry_cnt__c > 0
+                        AND retry_cnt__c < :max_cnt)
+                        OR (NFM501Future_Count__c != NULL
+                        AND NFM501Future_Count__c > 0
+                        AND NFM501Future_Count__c < :max_cnt)
+                        OR (NFM501_Web_Annex_Count__c != NULL
+                        AND NFM501_Web_Annex_Count__c > 0
+                        AND NFM501_Web_Annex_Count__c < :max_cnt))
+                        AND ownerId = :UserInfo.getUserId()
+                    ORDER BY CreatedDate // 2023-02-04   ZYH   ADD
+                ]
+            );
         }
     }
 
@@ -163,12 +278,14 @@
             if (strType_c == 'NFM001') {
                 NFM001Controller.execute(rowData, null);
             }
-            if (strType_c == 'NFM002') {
-                NFM002WebService.execute(rowData.Id);
-            }
-            if (strType_c == 'NFM006') {
-                NFM006WebService.execute(rowData.Id);
-            }
+            // 娓呯悊Apex 20230428 LHJ Start
+            //if (strType_c == 'NFM002') {
+            //    NFM002WebService.execute(rowData.Id);
+            //}
+            //if (strType_c == 'NFM006') {
+            //    NFM006WebService.execute(rowData.Id);
+            //}
+            // 娓呯悊Apex 20230428 LHJ End
             if (strType_c == 'NFM007') {
                 NFM007Controller.execute(rowData, null);
             }
@@ -225,17 +342,17 @@
             }
             // 2021/12/1 fxk add Star
             if (strType_c == 'NFM115') {
-                NFM115Controller.execute(rowData,null);
+                NFM115Controller.execute(rowData, null);
             }
             if (strType_c == 'NFM114') {
                 NFM114Rest.main(rowData.Id);
             }
             // 2021/12/1 fxk add End
-            // // 鐢靛瓙绛炬敹鍗曞彂閫丼AP鎺ュ彛 thh 20220427 start 
+            // // 鐢靛瓙绛炬敹鍗曞彂閫丼AP鎺ュ彛 thh 20220427 start
             if (strType_c == 'NFM116') {
-                NFM116Controller.execute(rowData,null);
+                NFM116Controller.execute(rowData, null);
             }
-            // // 鐢靛瓙绛炬敹鍗曞彂閫丼AP鎺ュ彛 thh 20220427 end 
+            // // 鐢靛瓙绛炬敹鍗曞彂閫丼AP鎺ュ彛 thh 20220427 end
             // XLIU-CEW9PD 闆朵欢棰勮榻愬鏃ユ湡 -SFDC澧炲姞 LY 20220610 start
             if (strType_c == 'NFM117') {
                 NFM117Rest.main(rowData.Id);
@@ -330,17 +447,20 @@
             // if (strType_c == 'NFM624') {//鏅烘収鍖荤枟pk
             //     NFM624Rest.main(rowData.Id);
             // }
-            if (strType_c == 'NFM624Rest2') {//鏅烘収鍖荤枟pk
+            if (strType_c == 'NFM624Rest2') {
+                //鏅烘収鍖荤枟pk
                 NFMUtil.againSendToAWS624(rowData.Id);
             }
             //zhj 鏂版柟妗堟敼閫� 2023-01-06 end
             if (strType_c == 'NFM622') {
                 NFM622Controller.execute(rowData, null);
             }
-            if (strType_c == 'NFM112') {//鍏堟鍚庝慨pk
+            if (strType_c == 'NFM112') {
+                //鍏堟鍚庝慨pk
                 NFM112Controller.ManualExecute(rowData.id);
             }
-            if (strType_c == 'NFM113') {//鍏堟鍚庝慨pk
+            if (strType_c == 'NFM113') {
+                //鍏堟鍚庝慨pk
                 NFM113Rest.main(rowData.id);
             }
             if (strType_c == 'NFM701') {
@@ -534,13 +654,11 @@
     }
 
     global void finish(Database.BatchableContext BC) {
-        BatchEmailUtil.removeOtherSc('LogAutoSendSchedule', scB1.scName);  //20230203 lt 璁″垝鐨勪綔涓氫紭鍖�
-
         // 浠婂洖銇倓銈嬨亾銇ㄣ仾銇勩仹銇�
         // 20220318 ljh SWAG-CC54R2 add start
-        if(String.isNotBlank(typeNFM) && typeNFM == 'NFM010' && isForecast){
+        if (String.isNotBlank(typeNFM) && typeNFM == 'NFM010' && isForecast) {
             Id execBTId = Database.executeBatch(new BeforeSSOpportunityBatch(), 100);
         }
         // 20220318 ljh SWAG-CC54R2 add end
     }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/classes/OCSMHandler.cls b/force-app/main/default/classes/OCSMHandler.cls
index a8aa3db..10f8cd2 100644
--- a/force-app/main/default/classes/OCSMHandler.cls
+++ b/force-app/main/default/classes/OCSMHandler.cls
@@ -1,15 +1,15 @@
 public with sharing class OCSMHandler extends Oly_TriggerHandler {
     //LY          2021/11/12                  start
     //骞冲彴绐楀彛1銆�2銆�3浠讳綍涓�涓湁鍙樻洿閮戒細瑙﹀彂瀹㈡埛浜哄憳鎺ュ彛锛屽悜鍏遍�氬钩鍙板彂閫�
-	public static void OCSMToUser(List<OCM_Management_Province__c> newList, Map<Id, OCM_Management_Province__c> newMap, List<OCM_Management_Province__c> oldList, Map<Id, OCM_Management_Province__c> oldMap){
-    
+    public static void OCSMToUser(
+        List<OCM_Management_Province__c> newList,
+        Map<Id, OCM_Management_Province__c> newMap,
+        List<OCM_Management_Province__c> oldList,
+        Map<Id, OCM_Management_Province__c> oldMap
+    ) {
         OCM_Management_Province__c old = null;
         List<String> noList = new List<String>();
-        //Add By Li Jun 20230420 Start OCSM鐪佺殑銆愯惀涓氱獥鍙c�戜汉鍛樺彂鐢熷彉鍔ㄦ椂锛岄渶瑕佹洿鏂扮幇鏈夌殑鏈畬鎴愮殑绛炬敹鍗曠殑銆愯惀涓氬姪鐞嗐�戝�� 
-        Set<String> changedWindowProvince = new set<String>();
-        //Add By Li Jun 20230420 End 
         for (OCM_Management_Province__c local : newList) {
-
             if (Trigger.isInsert) {
                 if (String.isNotBlank(local.OnlinePlatformWindow1__c)) {
                     noList.add(local.OnlinePlatformWindow1__c);
@@ -48,23 +48,11 @@
                         noList.add(old.OnlinePlatformWindow3__c);
                     }
                 }
-                //Add By Li Jun 20230420 Start 
-                if (local.Window1__c != null &&  local.Window1__c != old.Window1__c) {
-                    changedWindowProvince.add(local.Name);   
-                }                
-                //Add By Li Jun 20230420 End
-            
             }
-
         }
         if (noList.size() > 0) {
-            NFM621Controller.callout('',  noList);
+            NFM621Controller.callout('', noList);
         }
-        //Add By Li Jun 20230420 Start 
-        if(changedWindowProvince.size() > 0){
-            SyncProvinceWIndowToSignForm.syncProvinceWIndow(changedWindowProvince);
-        }
-        //Add By Li Jun 20230420 End
     }
 }
-//LY          2021/11/12                  end
\ No newline at end of file
+//LY          2021/11/12                  end
diff --git a/force-app/main/default/classes/updateESignBatch.cls b/force-app/main/default/classes/updateESignBatch.cls
index 05488e2..8862e8d 100644
--- a/force-app/main/default/classes/updateESignBatch.cls
+++ b/force-app/main/default/classes/updateESignBatch.cls
@@ -1,4 +1,4 @@
-global class updateESignBatch implements Database.Batchable < sObject > , Database.Stateful {
+global class updateESignBatch implements Database.Batchable<sObject>, Database.Stateful {
     //鐢靛瓙绛炬敹鍗�-绛炬敹鍗曞綍鍏ヨ〃鏇存柊绛炬敹鍗�  绮剧悽鎶�鏈� wql 2020-09-25 start
     /*
     鈶犳甯告墽琛� Database.executeBatch(new updateESignBatch(), 20);
@@ -29,18 +29,17 @@
     //瀛樻斁闇�瑕佹洿鏂扮殑绛炬敹鍗昳d
     private String id;
     //瀛樻斁闇�瑕佹洿鏂扮殑涓�浜涚鏀跺崟
-    private List < String > ids;
+    private List<String> ids;
     //瀛樻斁宸茬粡鏈�缁堢姸鎬佺殑flag
     private Boolean flag;
     //鐢ㄤ簬鎵цbatch鍚屾椂璁板綍鏃ュ織淇℃伅
     private BatchIF_Log__c iflog;
-    global List < String > emailMessages = new List < String > ();
+    global List<String> emailMessages = new List<String>();
     global Integer totalCount = 0; // 鎬讳欢鏁�
     global Integer failedCount = 0; //澶辫触浠舵暟
     global Boolean ManualExecution_Identification = false;
     //榛樿璺戞墍鏈夌鏀跺崟
     global updateESignBatch() {
-
         iflog = new BatchIF_Log__c();
         iflog.Type__c = 'ESignBatch';
         iflog.Is_Error__c = 0;
@@ -75,7 +74,7 @@
         // insert iflog;
     }
     //鎵归噺鏇存柊绛炬敹鍗�
-    global updateESignBatch(List < String > ids) {
+    global updateESignBatch(List<String> ids) {
         //鎵嬪姩鏍囪瘑缃垚true
         this.ManualExecution_Identification = true;
         this.ids = ids;
@@ -88,7 +87,6 @@
     }
     //鏇存柊鏌愪竴鏉$殑绛炬敹鍗�
     global updateESignBatch(String id) {
-
         //鎵嬪姩鏍囪瘑缃垚true
         this.ManualExecution_Identification = true;
         system.debug('鎵嬪姩浼犲弬1锛�' + ManualExecution_Identification);
@@ -114,7 +112,7 @@
         // insert iflog;
     }
     //鎵归噺鏇存柊宸插鐞嗙殑绛炬敹鍗�
-    global updateESignBatch(List < String > ids, boolean flag) {
+    global updateESignBatch(List<String> ids, boolean flag) {
         //鎵嬪姩鏍囪瘑缃垚true
         this.ManualExecution_Identification = true;
         this.ids = ids;
@@ -138,9 +136,11 @@
             // 濡傛灉鍝熷悓鍚嶇殑Batch璁″垝鍒犻櫎宸插瓨鍦ㄧ殑璁″垝閲嶆柊璁剧疆
             if (haveError) {
                 haveError = false;
-                for (CronTrigger ct : [SELECT Id, CronJobDetailId, CronExpression, CronJobDetail.Name
-                                       FROM CronTrigger
-                                       WHERE CronJobDetail.Name = :scB.scName]) {
+                for (CronTrigger ct : [
+                    SELECT Id, CronJobDetailId, CronExpression, CronJobDetail.Name
+                    FROM CronTrigger
+                    WHERE CronJobDetail.Name = :scB.scName
+                ]) {
                     System.abortJob(ct.Id);
                 }
                 try {
@@ -202,7 +202,7 @@
             if (spafter != null && String.isNotBlank(spafter)) {
                 b.scName = baseName + '005';
                 b.scTime = spafter + ' ' + day + ' ' + month + ' ? ' + year;
-                
+
                 // system.schedule(sJobame,spafter + ' ' + day + ' ' + month + ' ? ' + year, new AgencyShareUpdateBatchSchedule());
                 return b;
             } else {
@@ -242,164 +242,139 @@
             b.scName = baseName + '001';
             b.scTime = '0 ' + minMin + ' ' + (hour + 1) + ' ' + day + ' ' + month + ' ? ' + year;
             // system.schedule(sJobame,'0 ' + minMin + ' ' + (hour + 1) +' ' + day + ' ' + month + ' ? ' + year, new AgencyShareUpdateBatchSchedule());
-
         }
         return b;
     }
 
     public static void removeOtherSc(String likeName, String needName) {
         String likeStr = likeName + '00%';
-        for (CronTrigger ct : [SELECT Id, CronJobDetailId, CronExpression, CronJobDetail.Name
-                               FROM CronTrigger
-                               WHERE CronJobDetail.Name Like :likeStr
-                               AND CronJobDetail.Name != :needName]) {
+        for (CronTrigger ct : [
+            SELECT Id, CronJobDetailId, CronExpression, CronJobDetail.Name
+            FROM CronTrigger
+            WHERE CronJobDetail.Name LIKE :likeStr AND CronJobDetail.Name != :needName
+        ]) {
             System.abortJob(ct.Id);
         }
     }
 
-    global void execute(Database.BatchableContext BC, list < eSignForm__c > eSignList) {
+    global void execute(Database.BatchableContext BC, list<eSignForm__c> eSignList) {
         //鐢ㄤ綔褰曞叆琛ㄧ殑妫�绱㈡潯浠�
-        List < String > esFormidList = new List < String > ();
+        List<String> esFormidList = new List<String>();
         //瀛樻斁绛炬敹鍗曞綍鍏ヨ〃鏄庣粏
-        List < eSignFormLineItemEntry__c > eSignFormLineItemEntryList = new List < eSignFormLineItemEntry__c > ();
+        List<eSignFormLineItemEntry__c> eSignFormLineItemEntryList = new List<eSignFormLineItemEntry__c>();
         //鐢ㄤ綔绛炬敹鍗曟槑缁嗙殑妫�绱㈡潯浠�
-        List < String > eSignFormLineIdList = new List < String > ();
+        List<String> eSignFormLineIdList = new List<String>();
         //鏇存柊鐨勭鏀跺崟鏄庣粏
-        List < eSignFormLineItem__c > eSignFormLuRUList = new List < eSignFormLineItem__c > ();
+        List<eSignFormLineItem__c> eSignFormLuRUList = new List<eSignFormLineItem__c>();
         //瀛樻斁鏈�鍚庢洿鏂扮殑 褰曞叆琛╥d
-        List < Id > fileIdList = new List < Id > ();
+        List<Id> fileIdList = new List<Id>();
         //瀛樻斁鏈�鏂扮殑 绛炬敹鍗昳d锛岀鏀跺崟褰曞叆id
-        Map < Id, Id > eSignIdMap = new Map < Id, Id > ();
+        Map<Id, Id> eSignIdMap = new Map<Id, Id>();
 
         //瀛樻斁鏈�鏂扮殑 绛炬敹鍗昳d锛岀鏀跺崟褰曞叆id 鐢ㄤ簬鏈�鍚庝竴鏉$鏀跺崟褰曞叆琛ㄤ笉鍒犻櫎
-        Map < Id, Id > eSignFormLastIdMap = new Map < Id, Id > ();
+        Map<Id, Id> eSignFormLastIdMap = new Map<Id, Id>();
 
         //瀛樻斁鏈�鏂扮殑 绛炬敹鍗昳d锛岀鏀跺崟褰曞叆id 鐢ㄤ簬鏂囦欢鏇存柊
-        Map < Id, Id > eSignFlieIdMap = new Map < Id, Id > ();
+        Map<Id, Id> eSignFlieIdMap = new Map<Id, Id>();
 
         //瀛樻斁褰曞叆琛╥d锛屽綍鍏ヨ〃
-        Map < String, eSignFormEntry__c > lasteSignFormEntryMap = new Map < String, eSignFormEntry__c > ();
+        Map<String, eSignFormEntry__c> lasteSignFormEntryMap = new Map<String, eSignFormEntry__c>();
         //瀛樻斁鏈�鏂扮殑 绛炬敹鍗曟槑缁唅d锛岀鏀跺崟鏄庣粏褰曞叆id
-        Map < Id, Id > eSignFormLineItemEntryIdMap = new Map < Id, Id > ();
+        Map<Id, Id> eSignFormLineItemEntryIdMap = new Map<Id, Id>();
         //绛炬敹鍗曞綍鍏ヨ〃鏄庣粏id锛岀鏀跺崟褰曞叆琛ㄦ槑缁�
-        Map < String, eSignFormLineItemEntry__c > lasteSignFormLineItemEntryMap = new Map < String, eSignFormLineItemEntry__c > ();
+        Map<String, eSignFormLineItemEntry__c> lasteSignFormLineItemEntryMap = new Map<String, eSignFormLineItemEntry__c>();
         //瀛樻斁 绛炬敹鍗昳d,鏂囦欢鏁伴噺
-        Map < String, Integer > fileMap = new Map < String, Integer > ();
+        Map<String, Integer> fileMap = new Map<String, Integer>();
         //椹冲洖鍚庡垹闄ゆ枃浠� 鍚�  鎺掑簭闂  绮剧悽鎶�鏈� wql  2020/12/24 start
-        // List<Attachment> esignAttachAgencyList = new List<Attachment>();
-        // List<Attachment> esignAttachHPList = new List<Attachment>();
-        List<FileAddress__c> esignAttachAgencyList = new List<FileAddress__c>();        //zhj Attachment To AWS 2023-02-06
-        List<FileAddress__c> esignAttachHPList = new List<FileAddress__c>();            //zhj Attachment To AWS 2023-02-06
+        List<Attachment> esignAttachAgencyList = new List<Attachment>();
+        List<Attachment> esignAttachHPList = new List<Attachment>();
         Map<String, Integer> fileAgencyMap = new Map<String, Integer>();
         Map<String, Integer> fileHPMap = new Map<String, Integer>();
         //椹冲洖鍚庡垹闄ゆ枃浠� 鍚�  鎺掑簭闂  绮剧悽鎶�鏈� wql  2020/12/24 end
         //瀛樻斁ocsm绠$悊鐪�
-        List < String > provinceList = new List < String > ();
+        List<String> provinceList = new List<String>();
         //瀛樻斁15浣嶇鏀跺崟id,ocsm绠$悊鐪�
-        Map < Id, String > provinceMap = new Map < Id, String > ();
+        Map<Id, String> provinceMap = new Map<Id, String>();
         //瀛樻斁鐢ㄤ簬鏇存柊鐨勭鏀跺崟鏁扮粍
-        List < eSignForm__c > eSignFormList = new List < eSignForm__c > ();
+        List<eSignForm__c> eSignFormList = new List<eSignForm__c>();
         //瀛樻斁绛炬敹鍗曞綍鍏ヨ〃id锛宯ame
-        Map < Id, String > eSignNameMap = new Map < Id, String > ();
+        Map<Id, String> eSignNameMap = new Map<Id, String>();
         //瀛樻斁绛炬敹鍗曞綍鍏ヨ〃id锛宼ype
-        Map < Id, String > eSignTypeMap = new Map < Id, String > ();
+        Map<Id, String> eSignTypeMap = new Map<Id, String>();
 
         //鍒犻櫎涓棿琛ㄦ暟鎹敤
-        Map < String, eSignFormEntry__c > eSignStringMap = new Map < String, eSignFormEntry__c > ();
+        Map<String, eSignFormEntry__c> eSignStringMap = new Map<String, eSignFormEntry__c>();
         //瀛樻斁鎵�鏈夌鏀跺崟褰曞叆琛╥d
-        List < String > luruIsSubmitList = new List < String > ();
+        List<String> luruIsSubmitList = new List<String>();
 
         //瀛樻斁鎵�鏈夌鏀跺崟褰曞叆琛╥d
-        List < String > luruIsLastSubmitList = new List < String > ();
-
-        // 2023-03-16 ssm 浼樺寲閫昏緫锛岄伩鍏嶅悓鏃跺璁惧鍋氱郴缁熸洿鏂颁互鍙婂尰闄㈠拰缁忛攢鍟嗗湪鍚屼竴鎵规锛�15鍒嗛挓鍐咃級涓婁紶鏁版嵁 start
+        List<String> luruIsLastSubmitList = new List<String>();
         //鍒ゆ柇鏄惁鏈夋湭澶勭悊鐨勫綍鍏ヨ〃
-        // Map < Id, eSignFormEntry__c > unprocessedESignEneryMap = new Map < Id, eSignFormEntry__c > ();
-        Map < Id, List<eSignFormEntry__c> > unprocessedESignEneryMap = new Map < Id, List<eSignFormEntry__c> > ();
-        List<eSignFormEntry__c> unprocessedEntries = new List<eSignFormEntry__c>();
-        // Map <Id, eSignFormEntry__c> unprocessedEntries = new Map<Id, eSignFormEntry__c>();
-        // 2023-03-16 ssm 浼樺寲閫昏緫锛岄伩鍏嶅悓鏃跺璁惧鍋氱郴缁熸洿鏂颁互鍙婂尰闄㈠拰缁忛攢鍟嗗湪鍚屼竴鎵规锛�15鍒嗛挓鍐咃級涓婁紶鏁版嵁 start
+        Map<Id, eSignFormEntry__c> unprocessedESignEneryMap = new Map<Id, eSignFormEntry__c>();
 
         //鐢ㄤ簬鍒ゆ柇鍒犻櫎椹冲洖鐨勯檮浠剁殑绛涢�夋潯浠�
-        Map < Id, eSignForm__c > rejectESignEneryMap = new Map < Id, eSignForm__c > ();
+        Map<Id, eSignForm__c> rejectESignEneryMap = new Map<Id, eSignForm__c>();
         //椹冲洖鍚� 鍒犻櫎涔嬪墠涓婁紶鐨勬枃浠秈d
-        //List<Attachment> deleteLastFileList = new List<Attachment>();
-        List<FileAddress__c> deleteLastFileList = new List<FileAddress__c>();       //zhj Attachment To AWS 2023-02-06
+        List<Attachment> deleteLastFileList = new List<Attachment>();
         //瀛樻斁鏈洿鏂板墠鐨勭粡閿�鍟嗗鎵圭姸鎬�
-        Map < String, String > oldESignAgencyStatusMap = new Map < String, String > ();
+        Map<String, String> oldESignAgencyStatusMap = new Map<String, String>();
         //瀛樻斁鏈洿鏂板墠鐨勫尰闄㈠鎵圭姸鎬�
-        Map < String, String > oldESignHPStatusMap = new Map < String, String > ();
+        Map<String, String> oldESignHPStatusMap = new Map<String, String>();
         try {
             //寰幆瀛樻斁绛炬敹鍗昳d 鐢ㄤ綔妫�绱㈢鏀跺崟褰曞叆琛ㄧ殑鏉′欢
             system.debug('eSignList:' + eSignList);
             if (eSignList.size() > 0) {
                 for (eSignForm__c esForm : eSignList) {
                     //瀛樻斁绛炬敹鍗昳d,ocsm绠$悊鐪� 濡傛灉璇环鏄泦閲� 鍒欏彇ocsm绠$悊鐪佷负闆嗛噰璇剧殑鎷呭綋
-                    if(esForm.Statu_Achievements__r.Opportunity__r.Group_purchase_PCL__c){
+                    if (esForm.Statu_Achievements__r.Opportunity__r.Group_purchase_PCL__c) {
                         provinceMap.put(esForm.Id, '闆嗛噰璇�');
                         //妫�绱㈡潯浠�
                         provinceList.add('闆嗛噰璇�');
-                    }else{
+                    } else {
                         provinceMap.put(esForm.Id, esForm.OCM_man_province_cus__c);
                         //妫�绱㈡潯浠�
                         provinceList.add(esForm.OCM_man_province_cus__c);
                     }
-                    
+
                     esFormidList.add(esForm.Id);
 
                     //鏈夌粡閿�鍟嗛┏鍥炴垨鑰呭尰闄㈤┏鍥炴椂鍒犻櫎涔嬪墠闄勪欢
                     if (esForm.agencyRejectDate__c != null || esForm.HPRejectDate__c != null) {
                         rejectESignEneryMap.put(esForm.Id, esForm);
                     }
-
-
                 }
             }
             system.debug('rejectESignEneryMap:' + rejectESignEneryMap);
             //濡傛灉map涓嶄负绌� 鍒欎綔涓虹瓫閫夋潯浠�
-            if (rejectESignEneryMap.size()>0) {
-                // List<Attachment> deleteFileList = [SELECT parentId, createdDate, Name,Description   
-                //                                    FROM Attachment
-                //                                    WHERE parentId IN: rejectESignEneryMap.keySet() order by createdDate];
-                List<FileAddress__c> deleteFileList = [SELECT ParentRecordId__c, createdDate, FileName__c  
-                                                        FROM FileAddress__c
-                                                        WHERE ParentRecordId__c IN: rejectESignEneryMap.keySet() order by createdDate];  //zhj Attachment To AWS 2023-02-06
+            if (rejectESignEneryMap.size() > 0) {
+                List<Attachment> deleteFileList = [
+                    SELECT parentId, createdDate, Name, Description
+                    FROM Attachment
+                    WHERE parentId IN :rejectESignEneryMap.keySet()
+                    ORDER BY createdDate
+                ];
                 system.debug('deleteFileList:' + deleteFileList);
                 if (deleteFileList.size() > 0) {
                     for (eSignForm__c esFile : rejectESignEneryMap.values()) {
-                        //for (Attachment att : deleteFileList) {
-                        for (FileAddress__c att : deleteFileList) {             //zhj Attachment To AWS 2023-02-06
+                        for (Attachment att : deleteFileList) {
                             if (esFile.agencyRejectDate__c != null || esFile.HPRejectDate__c != null) {
-                                if (att.ParentRecordId__c == esFile.Id ) {
+                                if (att.parentId == esFile.Id) {
                                     //鈶犵粡閿�鍟嗛┏鍥炲悗闇�瑕佸垹闄ょ殑闄勪欢
                                     if (esFile.agencyRejectDate__c != null) {
-                                        //zhj Attachment To AWS 2023-02-06
-                                        // if (att.Name.substring(0, 1) == 'A' && att.createdDate < esFile.agencyRejectDate__c) {
-                                        //     deleteLastFileList.add(att);
-                                        // }
-                                        if (att.FileName__c.substring(0, 1) == 'A' && att.createdDate < esFile.agencyRejectDate__c) {
+                                        if (att.Name.substring(0, 1) == 'A' && att.createdDate < esFile.agencyRejectDate__c) {
                                             deleteLastFileList.add(att);
                                         }
                                     }
                                     //鈶″尰闄㈤┏鍥炲悗闇�瑕佸垹闄ょ殑闄勪欢
                                     if (esFile.HPRejectDate__c != null) {
-                                        //zhj Attachment To AWS 2023-02-06
-                                        // if (att.Name.substring(0, 1) == 'H' && att.createdDate < esFile.HPRejectDate__c) {
-                                        //     deleteLastFileList.add(att);
-                                        // }
-                                        if (att.FileName__c.substring(0, 1) == 'H' && att.createdDate < esFile.HPRejectDate__c) {
+                                        if (att.Name.substring(0, 1) == 'H' && att.createdDate < esFile.HPRejectDate__c) {
                                             deleteLastFileList.add(att);
                                         }
                                     }
                                 }
-
-
                             }
                         }
-
                     }
-
-
                 }
             }
             system.debug('椹冲洖鍚庡垹闄ょ殑鏂囦欢锛�' + deleteLastFileList);
@@ -409,12 +384,47 @@
             }
 
             //妫�绱㈡墍鏈夊綍鍏ヨ〃
-            List < eSignFormEntry__c > eSignFormEntryList = [select id, Name, entryType__c, eSignForm__c, eSignForm__r.OCM_man_province_cus__c, salesManageConfirmDate__c, salesHPManageConfirmDate__c, agencyScanDayBack__c, agencySignUpDateBack__c, agencyConfirmDateBack__c, HPScanDayBack__c, HPSignUpDateBack__c, HPConfirmDateBack__c,
-                                       eSignForm__r.Name, IsSubmit__c, IsHPSubmit__c, IsAgencyConfirmSubmit__c, agencyAutoSignUpStatus__c, HPSignUpStatus__c, Sales_Root_Formula__c, Sales_assistant_ID__c, IsHandled__c, IsHPHandled__c, createdDate, AgencyWorkflowEmailBack__c, HPWorkflowEmailBack__c, AgencyWorkflowEmail__c, HPWorkflowEmail__c, eSignForm__r.Id, agencyDNSignUpStatus__c, HPDNSignUpStatus__c, agencyReject__c, HPReject__c, IsAgencyScan__c, IsHPScan__c
-                                       from eSignFormEntry__c
-                                       where eSignForm__c IN: esFormidList
-                                       order by eSignForm__c, createdDate asc
-                                                            ];
+            List<eSignFormEntry__c> eSignFormEntryList = [
+                SELECT
+                    id,
+                    Name,
+                    entryType__c,
+                    eSignForm__c,
+                    eSignForm__r.OCM_man_province_cus__c,
+                    salesManageConfirmDate__c,
+                    salesHPManageConfirmDate__c,
+                    agencyScanDayBack__c,
+                    agencySignUpDateBack__c,
+                    agencyConfirmDateBack__c,
+                    HPScanDayBack__c,
+                    HPSignUpDateBack__c,
+                    HPConfirmDateBack__c,
+                    eSignForm__r.Name,
+                    IsSubmit__c,
+                    IsHPSubmit__c,
+                    IsAgencyConfirmSubmit__c,
+                    agencyAutoSignUpStatus__c,
+                    HPSignUpStatus__c,
+                    Sales_Root_Formula__c,
+                    Sales_assistant_ID__c,
+                    IsHandled__c,
+                    IsHPHandled__c,
+                    createdDate,
+                    AgencyWorkflowEmailBack__c,
+                    HPWorkflowEmailBack__c,
+                    AgencyWorkflowEmail__c,
+                    HPWorkflowEmail__c,
+                    eSignForm__r.Id,
+                    agencyDNSignUpStatus__c,
+                    HPDNSignUpStatus__c,
+                    agencyReject__c,
+                    HPReject__c,
+                    IsAgencyScan__c,
+                    IsHPScan__c
+                FROM eSignFormEntry__c
+                WHERE eSignForm__c IN :esFormidList
+                ORDER BY eSignForm__c, createdDate ASC
+            ];
 
             if (eSignFormEntryList.size() > 0) {
                 for (Id eid : esFormidList) {
@@ -424,24 +434,16 @@
                         eSignStringMap.put(eSignFormEntryWhole.Id, eSignFormEntryWhole);
                         //鈶℃墍鏈夌殑 鐢ㄤ簬鏇存柊鏂囦欢(鍖呭惈宸插鐞嗘湭澶勭悊鐨勬暟鎹� )
                         fileIdList.add(eSignFormEntryWhole.Id);
-                        // 杩欓噷鏄粈涔堥锛熼兘涓嶅垽鏂竴涓嬬鏀跺崟id鐨勶紵
-                        // if (eSignFormEntryWhole.IsHandled__c == false) {
-                        if (eSignFormEntryWhole.IsHandled__c == false && eSignFormEntryWhole.eSignForm__r.Id  == eid) {
+                        if (eSignFormEntryWhole.IsHandled__c == false) {
                             //鏈鐞嗙殑
-                            // 2023-03-16 ssm 浼樺寲閫昏緫锛岄伩鍏嶅悓鏃跺璁惧鍋氱郴缁熸洿鏂颁互鍙婂尰闄㈠拰缁忛攢鍟嗗湪鍚屼竴鎵规锛�15鍒嗛挓鍐咃級涓婁紶鏁版嵁 start
-                            // unprocessedESignEneryMap.put(eid, eSignFormEntryWhole);
-                            List<eSignFormEntry__c> entries = unprocessedESignEneryMap.size() > 0 && unprocessedESignEneryMap.keySet().contains(eid) ? unprocessedESignEneryMap.get(eid) : new List<eSignFormEntry__c>();
-                            entries.add(eSignFormEntryWhole);
-                            unprocessedESignEneryMap.put(eid, entries);
-                            // 2023-03-16 ssm 浼樺寲閫昏緫锛岄伩鍏嶅悓鏃跺璁惧鍋氱郴缁熸洿鏂颁互鍙婂尰闄㈠拰缁忛攢鍟嗗湪鍚屼竴鎵规锛�15鍒嗛挓鍐咃級涓婁紶鏁版嵁 end
+                            unprocessedESignEneryMap.put(eid, eSignFormEntryWhole);
                         }
-                        if (eSignFormEntryWhole.eSignForm__r.Id  == eid) {
+                        if (eSignFormEntryWhole.eSignForm__r.Id == eid) {
                             //瀛樻斁 绛炬敹鍗昳d锛屽綍鍏ヨ〃id 鏂囦欢鐢�
                             eSignFlieIdMap.put(eSignFormEntryWhole.Id, eid);
                             //瀛樻斁绛炬敹鍗曞綍鍏ヨ〃锛宨d锛宯ame 鏂囦欢鐢�
                             eSignNameMap.put(eid, eSignFormEntryWhole.eSignForm__r.Name);
                         }
-
 
                         //瀛樻斁褰曞叆琛╥d锛岃褰曠被鍨� id锛宼ype 鏂囦欢鐢�
                         eSignTypeMap.put(eSignFormEntryWhole.Id, eSignFormEntryWhole.entryType__c);
@@ -453,10 +455,8 @@
                 for (Id esFormid : esFormidList) {
                     //鍐呭眰鏄鏀跺崟褰曞叆琛�
                     for (eSignFormEntry__c eSignFormEntry : eSignFormEntryList) {
-
                         //鈶犲彇鏈�鏂扮殑 褰曞叆琛� + 鏈鐞嗙殑
                         if (esFormid.equals(eSignFormEntry.eSignForm__c)) {
-
                             if (!eSignFormEntry.IsHandled__c) {
                                 //瀛樻斁 绛炬敹鍗昳d锛屽綍鍏ヨ〃id
                                 eSignIdMap.put(esFormid, eSignFormEntry.Id);
@@ -465,9 +465,7 @@
                                 // break;
                             }
                             eSignFormLastIdMap.put(esFormid, eSignFormEntry.Id);
-
                         }
-
                     }
                 }
                 //鏈�鍚庢洿鏂扮殑褰曞叆琛╥d
@@ -482,42 +480,26 @@
                 //閲嶆柊瀵归檮浠舵帓搴�  瑙勫垯鍙樹负鏍规嵁绛炬敹鍗曠幇鏈夐檮浠跺簭鍙疯繘琛屾帓搴� 绮剧悽鎶�鏈� wql start
                 //鏆傛椂瀛樻斁涓�涓嬬鏀跺崟鍚嶇О
                 Map<string, string> tempMap = new Map<string, string>();
-                //zhj Attachment To AWS 2023-02-06
-                // List<Attachment> tempAttList = [SELECT parentId, createdDate, Name,Description  
-                //                                 FROM Attachment
-                //                                 WHERE parentId IN: esFormidList order by createdDate];
-                List<FileAddress__c> tempAttList = [SELECT ParentRecordId__c, createdDate, FileName__c 
-                                                FROM FileAddress__c
-                                                WHERE ParentRecordId__c IN: esFormidList order by createdDate];
+                List<Attachment> tempAttList = [
+                    SELECT parentId, createdDate, Name, Description
+                    FROM Attachment
+                    WHERE parentId IN :esFormidList
+                    ORDER BY createdDate
+                ];
                 if (tempAttList.size() > 0) {
                     //澶栧眰寰幆绛炬敹鍗�
                     for (String es : esFormidList) {
-                        //zhj Attachment To AWS 2023-02-06
                         //鍐呭眰寰幆闄勪欢
-                        // for (Attachment att : tempAttList) {
-                        //     //濡傛灉id鐩哥瓑
-                        //     if (es.equals(att.parentId)) {
-                        //         //鏍规嵁鍚嶇О鎷嗗垎 瀛樺叆涓嶅悓list
-                        //         String name = att.Name;
-                        //         if (name.substring(0, 1).equals('A')) {
-                        //             esignAttachAgencyList.add(att);
-                        //         } else if (name.substring(0, 1).equals('H')) {
-                        //             esignAttachHPList.add(att);
-                        //         }
-
-                        //     }
-                        // }
-                        for (FileAddress__c att : tempAttList) {
+                        for (Attachment att : tempAttList) {
                             //濡傛灉id鐩哥瓑
-                            if (es.equals(att.ParentRecordId__c)) {
+                            if (es.equals(att.parentId)) {
                                 //鏍规嵁鍚嶇О鎷嗗垎 瀛樺叆涓嶅悓list
-                                String name = att.FileName__c;
+                                String name = att.Name;
                                 if (name.substring(0, 1).equals('A')) {
                                     esignAttachAgencyList.add(att);
                                 } else if (name.substring(0, 1).equals('H')) {
                                     esignAttachHPList.add(att);
                                 }
-
                             }
                         }
                         //鍒嗗埆瀛樺叆鍒扮粡閿�鍟唎r鍖婚櫌鐨勯檮浠秏ap 鐢ㄤ簬鍚庢湡鍛藉悕
@@ -530,7 +512,6 @@
                         //娓呯┖list 渚涗笅涓�涓鏀跺崟浣跨敤
                         esignAttachAgencyList.clear();
                         esignAttachHPList.clear();
-
                     }
                 }
                 system.debug('fileAgencyMap:' + fileAgencyMap);
@@ -538,10 +519,21 @@
                 //閲嶆柊瀵归檮浠舵帓搴�  瑙勫垯鍙樹负鏍规嵁绛炬敹鍗曠幇鏈夐檮浠跺簭鍙疯繘琛屾帓搴� 绮剧悽鎶�鏈� wql end
 
                 //鏍规嵁鎵�鏈夌殑绛炬敹鍗曞綍鍏ヨ〃id妫�绱㈡墍鏈夌殑绛炬敹鍗曟槑缁嗗綍鍏�
-                List < eSignFormLineItemEntry__c > eSignFormLineItemEntryLists = [select id, eSignFormEntry__r.entryType__c, eSignFormEntry__r.IsHandled__c, eSignFormLineItem__c, eSignFormEntry__c,
-                                                   agencyConfirmResult__c, HPConfirmResult__c, HPGoodStatus__c, agencyGoodStatus__c
-                                                   from eSignFormLineItemEntry__c where eSignFormEntry__c in : luruIsSubmitList  and eSignFormEntry__r.IsHandled__c = false order by createdDate asc
-                                                                                 ];
+                List<eSignFormLineItemEntry__c> eSignFormLineItemEntryLists = [
+                    SELECT
+                        id,
+                        eSignFormEntry__r.entryType__c,
+                        eSignFormEntry__r.IsHandled__c,
+                        eSignFormLineItem__c,
+                        eSignFormEntry__c,
+                        agencyConfirmResult__c,
+                        HPConfirmResult__c,
+                        HPGoodStatus__c,
+                        agencyGoodStatus__c
+                    FROM eSignFormLineItemEntry__c
+                    WHERE eSignFormEntry__c IN :luruIsSubmitList AND eSignFormEntry__r.IsHandled__c = FALSE
+                    ORDER BY createdDate ASC
+                ];
                 if (eSignFormLineItemEntryLists.size() > 0) {
                     for (eSignFormLineItemEntry__c eSignFormLineItemEntry : eSignFormLineItemEntryLists) {
                         eSignFormLineIdList.add(eSignFormLineItemEntry.eSignFormLineItem__c);
@@ -550,7 +542,11 @@
                 system.debug('eSignFormLineIdList:' + eSignFormLineIdList);
                 if (eSignFormLineIdList.size() > 0) {
                     //鏍规嵁绛炬敹鍗曟槑缁嗗綍鍏ヨ〃 鍘绘绱㈢鏀跺崟鏄庣粏
-                    List < eSignFormLineItem__c > eSignFormLineItemList = [select id, agencyGoodStatus__c, HPGoodStatus__c from eSignFormLineItem__c where id IN: eSignFormLineIdList];
+                    List<eSignFormLineItem__c> eSignFormLineItemList = [
+                        SELECT id, agencyGoodStatus__c, HPGoodStatus__c
+                        FROM eSignFormLineItem__c
+                        WHERE id IN :eSignFormLineIdList
+                    ];
                     if (eSignFormLineItemList.size() > 0) {
                         //澶栧眰绛炬敹鍗曟槑缁�
                         for (eSignFormLineItem__c eSignFormLineItem : eSignFormLineItemList) {
@@ -570,7 +566,6 @@
                 if (eSignFormLineIdList.size() > 0) {
                     //寰幆 鏇存柊绛炬敹鍗�
                     for (Id esefId : eSignFormLineIdList) {
-
                         if (lasteSignFormLineItemEntryMap.containsKey(esefId)) {
                             eSignFormLineItemEntry__c luru = lasteSignFormLineItemEntryMap.get(esefId);
                             //new 涓�涓鏀跺崟鏄庣粏瀵硅薄
@@ -591,8 +586,6 @@
                                 eSignFormLuRuList.add(eSignLuRu);
                             }
                         }
-
-
                     }
                 }
                 System.debug('鏇存柊鐨勭鏀跺崟鏄庣粏list:' + eSignFormLuRUList);
@@ -608,195 +601,167 @@
                         boolean IsHPSubmit = false;
                         //閿�鍞笭閬�
                         String Sales_Root_Formula;
-                        //褰曞叆绫诲瀷 
-                        String type; // 杩欎笢瑗挎病鏈夌敤
+                        //褰曞叆绫诲瀷
+                        String type;
                         System.debug('lasteSignFormEntryMap:' + lasteSignFormEntryMap);
                         if (lasteSignFormEntryMap.containsKey(eSignFormid)) {
                             eSignForm.id = eSignFormid;
-                            // 2023-03-16 ssm 浼樺寲閫昏緫锛岄伩鍏嶅悓鏃跺璁惧鍋氱郴缁熸洿鏂颁互鍙婂尰闄㈠拰缁忛攢鍟嗗湪鍚屼竴鎵规锛�15鍒嗛挓鍐咃級涓婁紶鏁版嵁 start
                             //绛炬敹鍗昳d
-                            // eSignFormEntry__c eSignFormEntry = lasteSignFormEntryMap.get(eSignFormid);
-                            for (eSignFormEntry__c eSignFormEntry : unprocessedESignEneryMap.get(eSignFormid)) {
-                                // 鏍规嵁褰曞叆绫诲瀷鍘绘洿鏂板搴旂殑閮ㄥ垎鏁版嵁
-                                // entryType__c鍖呭惈缁忛攢鍟�
-                                if (String.isNotBlank(eSignFormEntry.entryType__c) && eSignFormEntry.entryType__c.contains('缁忛攢鍟�')) {
-                                    //濡傛灉缁忛攢鍟嗙‘璁ゆ棩涓虹┖鐨勮瘽 杩涘幓鍒ゆ柇鏇存柊缁忛攢鍟嗗鎵圭姸鎬�
-                                    if (eSignFormEntry.agencyDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
-                                        if (eSignFormEntry.agencyConfirmDateBack__c == null) {
-                                            if (eSignFormEntry.IsSubmit__c == true) {
-                                                eSignForm.agencyAutoSignUpStatus__c = '鐢宠涓�';
-                                                eSignForm.agencyReject__c = false;
-                                            } else {
-                                                if (eSignFormEntry.agencyScanDayBack__c != null && eSignFormEntry.IsAgencyScan__c) {
-                                                    // 璋冩暣鑽夋涓殑璧嬪�奸�昏緫锛屽绔搷浣滅殑鎯呭喌涓嬫湁鍙兘鍏堢敵璇峰悗鑽夋
-                                                    // eSignForm.agencyAutoSignUpStatus__c = '鑽夋涓�';
-                                                    eSignForm.agencyAutoSignUpStatus__c = String.isBlank(eSignForm.agencyAutoSignUpStatus__c) ? '鑽夋涓�' : eSignForm.agencyAutoSignUpStatus__c;
-                                                    eSignForm.agencyReject__c = false;
-                                                }
-                                            }
-                                        }
-                                        //鏈洿鏂板墠鐨勭粡閿�鍟嗗鎵圭姸鎬� 鐢ㄤ簬鏂囦欢绱姹囨��
-                                        if(eSignFormEntry.agencyAutoSignUpStatus__c!=null &&eSignFormEntry.agencyAutoSignUpStatus__c!=''){
-                                            oldESignAgencyStatusMap.put('A' + eSignForm.id, eSignFormEntry.agencyAutoSignUpStatus__c);
-                                        }else{
-                                            oldESignAgencyStatusMap.put('A' + eSignForm.id, '鏃�');
-                                        }
-                                    }
-                                    //濡傛灉娌″彉鍖栧垯涓嶆洿鏂�
-                                    if (eSignFormEntry.AgencyWorkflowEmailBack__c != eSignFormEntry.AgencyWorkflowEmail__c) {
-                                        //缁忛攢鍟嗛偖浠�
-                                        eSignForm.AgencyWorkflowEmail__c = eSignFormEntry.AgencyWorkflowEmailBack__c;
-                                    }
-                                    // 鏃ユ湡鏇存柊
-                                    if (eSignFormEntry.agencyDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
-                                        //缁忛攢鍟嗘壂鎻忔棩
-                                        if (eSignFormEntry.agencyScanDayBack__c != null) {
-                                            eSignForm.agencyScanDay__c = eSignFormEntry.agencyScanDayBack__c;
-                                        }
-                                        //缁忛攢鍟嗙鏀舵棩
-                                        if (eSignFormEntry.agencySignUpDateBack__c != null) {
-                                            eSignForm.agencySignUpDate__c = eSignFormEntry.agencySignUpDateBack__c;
-                                        }
-                                        //缁忛攢鍟嗙‘璁ゆ棩
-                                        if (eSignFormEntry.agencyConfirmDateBack__c != null) {
-                                            eSignForm.agencyConfirmDate__c = eSignFormEntry.agencyConfirmDateBack__c;
+                            eSignFormEntry__c eSignFormEntry = lasteSignFormEntryMap.get(eSignFormid);
+                            //濡傛灉缁忛攢鍟嗙‘璁ゆ棩涓虹┖鐨勮瘽 杩涘幓鍒ゆ柇鏇存柊缁忛攢鍟嗗鎵圭姸鎬�
+                            if (eSignFormEntry.agencyDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
+                                if (eSignFormEntry.agencyConfirmDateBack__c == null) {
+                                    if (eSignFormEntry.IsSubmit__c == true) {
+                                        eSignForm.agencyAutoSignUpStatus__c = '鐢宠涓�';
+                                        eSignForm.agencyReject__c = false;
+                                    } else {
+                                        if (eSignFormEntry.agencyScanDayBack__c != null && eSignFormEntry.IsAgencyScan__c) {
+                                            eSignForm.agencyAutoSignUpStatus__c = '鑽夋涓�';
+                                            eSignForm.agencyReject__c = false;
                                         }
                                     }
                                 }
-                                // entryType__c鍖呭惈鍖婚櫌
-                                if (String.isNotBlank(eSignFormEntry.entryType__c) && eSignFormEntry.entryType__c.contains('鍖婚櫌')) {
-                                    if (eSignFormEntry.HPDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
-                                        //濡傛灉鍖婚櫌纭鏃ヤ负绌虹殑璇� 杩涘幓鍒ゆ柇鏇存柊鍖婚櫌瀹℃壒鐘舵��
-                                        if (eSignFormEntry.salesHPManageConfirmDate__c == null) {
-                                            if (eSignFormEntry.IsHPSubmit__c == true) {
-                                                eSignForm.HPSignUpStatus__c = '鐢宠涓�';
-                                                eSignForm.HPReject__c = false;
-                                            } else {
-                                                if (eSignFormEntry.HPScanDayBack__c != null && eSignFormEntry.IsHPScan__c) {
-                                                    // 璋冩暣鑽夋涓殑璧嬪�奸�昏緫锛屽绔搷浣滅殑鎯呭喌涓嬫湁鍙兘鍏堢敵璇峰悗鑽夋
-                                                    // eSignForm.HPSignUpStatus__c = '鑽夋涓�';
-                                                    eSignForm.HPSignUpStatus__c = String.isBlank(eSignForm.HPSignUpStatus__c) ? '鑽夋涓�' : eSignForm.HPSignUpStatus__c;
-                                                    eSignForm.HPReject__c = false;
-                                                }
-                                            }
-                                        }
-                                        //鏈洿鏂板墠鐨勫尰闄㈠鎵圭姸鎬� 鐢ㄤ簬鏂囦欢绱姹囨��
-                                        if(eSignFormEntry.HPSignUpStatus__c!=null &&eSignFormEntry.HPSignUpStatus__c!=''){
-                                            oldESignHPStatusMap.put('H' + eSignForm.id, eSignFormEntry.HPSignUpStatus__c);
-                                        }else{
-                                            oldESignHPStatusMap.put('H' + eSignForm.id, '鏃�');
-                                        }
-                                    }
-                                    //濡傛灉娌″彉鍖栧垯涓嶆洿鏂�
-                                    if (eSignFormEntry.HPWorkflowEmailBack__c != eSignFormEntry.HPWorkflowEmail__c) {
-                                        //鍖婚櫌閭欢
-                                        eSignForm.HPWorkflowEmail__c = eSignFormEntry.HPWorkflowEmailBack__c;
-                                    }
-                                    // 鏃ユ湡鏇存柊
-                                    if (eSignFormEntry.HPDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
-                                        //鍖婚櫌鎵弿鏃�
-                                        if (eSignFormEntry.HPScanDayBack__c != null) {
-                                            eSignForm.HPScanDay__c = eSignFormEntry.HPScanDayBack__c;
-                                        }
-                                        //鍖婚櫌绛炬敹鏃�
-                                        if (eSignFormEntry.HPSignUpDateBack__c != null) {
-                                            eSignForm.HPSignUpDate__c = eSignFormEntry.HPSignUpDateBack__c;
-                                        }
-                                        //鍖婚櫌纭鏃�
-                                        if (eSignFormEntry.HPConfirmDateBack__c != null) {
-                                            eSignForm.HPConfirmDate__c = eSignFormEntry.HPConfirmDateBack__c;
-                                        }
-                                    }
+                                //鏈洿鏂板墠鐨勭粡閿�鍟嗗鎵圭姸鎬� 鐢ㄤ簬鏂囦欢绱姹囨��
+                                if (eSignFormEntry.agencyAutoSignUpStatus__c != null && eSignFormEntry.agencyAutoSignUpStatus__c != '') {
+                                    oldESignAgencyStatusMap.put('A' + eSignForm.id, eSignFormEntry.agencyAutoSignUpStatus__c);
+                                } else {
+                                    oldESignAgencyStatusMap.put('A' + eSignForm.id, '鏃�');
                                 }
-                                //缁欒惀涓氬姪鐞嗚祴鍊�
-                                //eSignForm.Sales_assistant_name_text__c = eSignFormEntry.Sales_assistant_ID__c;// Commented By Li Jun 20230420
-                                //瀛樹竴涓猧d
-                                idlast = eSignFormEntry.Id;
-                                //绛炬敹鍗昻ame鐢ㄤ綔鏂囦欢鍛藉悕
-                                name = eSignFormEntry.eSignForm__r.Name;
-                                //鏄惁缁忛攢鍟嗘彁浜�
-                                IsSubmit = eSignFormEntry.IsSubmit__c;
-                                //鏄惁鍖婚櫌鎻愪氦
-                                IsHPSubmit = eSignFormEntry.IsHPSubmit__c;
-                                //鏈�鍚庡綍鍏ヨ〃
-                                eSignForm.finalUpadteFrom__c = eSignFormEntry.Id;
-                                //閿�鍞笭閬� 鍖哄垎鐩撮攢杩樻槸鍒嗛攢
-                                Sales_Root_Formula = eSignFormEntry.Sales_Root_Formula__c;
-                                //褰曞叆绫诲瀷
-                                type = eSignFormEntry.entryType__c; // 娌℃湁鐢�
-
-                                // 鎵�鏈夋病鏈夋病鏈夊鐞嗙殑entry閮借鏍囪涓哄鐞�
-                                eSignFormEntry.IsHandled__c = true;
-                                unprocessedEntries.add(eSignFormEntry);
-                                // unprocessedEntries.put(eSignFormEntry.Id, eSignFormEntry);
                             }
-                            // 2023-03-16 ssm 浼樺寲閫昏緫锛岄伩鍏嶅悓鏃跺璁惧鍋氱郴缁熸洿鏂颁互鍙婂尰闄㈠拰缁忛攢鍟嗗湪鍚屼竴鎵规锛�15鍒嗛挓鍐咃級涓婁紶鏁版嵁 end
+                            if (eSignFormEntry.HPDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
+                                //濡傛灉鍖婚櫌纭鏃ヤ负绌虹殑璇� 杩涘幓鍒ゆ柇鏇存柊鍖婚櫌瀹℃壒鐘舵��
+                                if (eSignFormEntry.salesHPManageConfirmDate__c == null) {
+                                    if (eSignFormEntry.IsHPSubmit__c == true) {
+                                        eSignForm.HPSignUpStatus__c = '鐢宠涓�';
+                                        eSignForm.HPReject__c = false;
+                                    } else {
+                                        if (eSignFormEntry.HPScanDayBack__c != null && eSignFormEntry.IsHPScan__c) {
+                                            eSignForm.HPSignUpStatus__c = '鑽夋涓�';
+                                            eSignForm.HPReject__c = false;
+                                        }
+                                    }
+                                }
+                                //鏈洿鏂板墠鐨勫尰闄㈠鎵圭姸鎬� 鐢ㄤ簬鏂囦欢绱姹囨��
+                                if (eSignFormEntry.HPSignUpStatus__c != null && eSignFormEntry.HPSignUpStatus__c != '') {
+                                    oldESignHPStatusMap.put('H' + eSignForm.id, eSignFormEntry.HPSignUpStatus__c);
+                                } else {
+                                    oldESignHPStatusMap.put('H' + eSignForm.id, '鏃�');
+                                }
+                            }
 
+                            //濡傛灉娌″彉鍖栧垯涓嶆洿鏂�
+                            if (eSignFormEntry.AgencyWorkflowEmailBack__c != eSignFormEntry.AgencyWorkflowEmail__c) {
+                                //缁忛攢鍟嗛偖浠�
+                                eSignForm.AgencyWorkflowEmail__c = eSignFormEntry.AgencyWorkflowEmailBack__c;
+                            }
+                            //濡傛灉娌″彉鍖栧垯涓嶆洿鏂�
+                            if (eSignFormEntry.HPWorkflowEmailBack__c != eSignFormEntry.HPWorkflowEmail__c) {
+                                //鍖婚櫌閭欢
+                                eSignForm.HPWorkflowEmail__c = eSignFormEntry.HPWorkflowEmailBack__c;
+                            }
+                            if (eSignFormEntry.agencyDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
+                                //缁忛攢鍟嗘壂鎻忔棩
+                                if (eSignFormEntry.agencyScanDayBack__c != null) {
+                                    eSignForm.agencyScanDay__c = eSignFormEntry.agencyScanDayBack__c;
+                                }
+                                //缁忛攢鍟嗙鏀舵棩
+                                if (eSignFormEntry.agencySignUpDateBack__c != null) {
+                                    eSignForm.agencySignUpDate__c = eSignFormEntry.agencySignUpDateBack__c;
+                                }
+                                //缁忛攢鍟嗙‘璁ゆ棩
+                                if (eSignFormEntry.agencyConfirmDateBack__c != null) {
+                                    eSignForm.agencyConfirmDate__c = eSignFormEntry.agencyConfirmDateBack__c;
+                                }
+                            }
+
+                            if (eSignFormEntry.HPDNSignUpStatus__c != '绛炬敹宸插畬鎴�') {
+                                //鍖婚櫌鎵弿鏃�
+                                if (eSignFormEntry.HPScanDayBack__c != null) {
+                                    eSignForm.HPScanDay__c = eSignFormEntry.HPScanDayBack__c;
+                                }
+                                //鍖婚櫌绛炬敹鏃�
+                                if (eSignFormEntry.HPSignUpDateBack__c != null) {
+                                    eSignForm.HPSignUpDate__c = eSignFormEntry.HPSignUpDateBack__c;
+                                }
+                                //鍖婚櫌纭鏃�
+                                if (eSignFormEntry.HPConfirmDateBack__c != null) {
+                                    eSignForm.HPConfirmDate__c = eSignFormEntry.HPConfirmDateBack__c;
+                                }
+                            }
+
+                            //缁欒惀涓氬姪鐞嗚祴鍊�
+                            eSignForm.Sales_assistant_name_text__c = eSignFormEntry.Sales_assistant_ID__c;
+                            //瀛樹竴涓猧d
+                            idlast = eSignFormEntry.Id;
+                            //绛炬敹鍗昻ame鐢ㄤ綔鏂囦欢鍛藉悕
+                            name = eSignFormEntry.eSignForm__r.Name;
+                            //鏄惁缁忛攢鍟嗘彁浜�
+                            IsSubmit = eSignFormEntry.IsSubmit__c;
+                            //鏄惁鍖婚櫌鎻愪氦
+                            IsHPSubmit = eSignFormEntry.IsHPSubmit__c;
+                            //鏈�鍚庡綍鍏ヨ〃
+                            eSignForm.finalUpadteFrom__c = eSignFormEntry.Id;
+                            //閿�鍞笭閬� 鍖哄垎鐩撮攢杩樻槸鍒嗛攢
+                            Sales_Root_Formula = eSignFormEntry.Sales_Root_Formula__c;
+                            //褰曞叆绫诲瀷
+                            type = eSignFormEntry.entryType__c;
                         }
                         system.debug('绛炬敹鍗曞璞�-----锛�' + eSignForm);
                         if (eSignForm != null) {
                             system.debug('eSignFormid:' + eSignFormid);
                             if (eSignForm.id != null) {
-
                                 eSignFormList.add(eSignForm);
                             }
-
                         }
                         system.debug('eSignFormList111:' + eSignFormList);
                         if (eSignFormList.size() > 0) {
                             //鏇存柊OCSM绠$悊鐪� 鎷呭綋
                             eSignFormList = updateOwner(provinceList, provinceMap, eSignFormList, false);
                         }
-
-
                     }
                 }
-
-
             }
 
             if (eSignFormList.size() <= 0) {
                 system.debug('鎴戣蛋鍒拌繖閲屼簡锛�');
-                eSignFormList  = updateOwner(provinceList, provinceMap, eSignList, true);
+                eSignFormList = updateOwner(provinceList, provinceMap, eSignList, true);
             }
 
-
-            List<Id> fileList = new List<Id> ();
+            List<Id> fileList = new List<Id>();
             if (fileIdList.size() > 0) {
                 for (Id fileId : fileIdList) {
                     if (!fileList.contains(fileId)) {
                         fileList.add(fileId);
                     }
-
                 }
             }
 
             System.debug('fileIdList锛�' + fileIdList);
             System.debug('fileList锛�' + fileList);
             //鐢ㄤ簬鏈�鍚巌nsert 闄勪欢
-            //zhj Attachment To AWS 2023-02-06
-            //List<Attachment> insertAttactment = new List<Attachment>();
-            List<FileAddress__c> insertAttactment = new List<FileAddress__c>();
+            List<Attachment> insertAttactment = new List<Attachment>();
             //闄勪欢  start
-            //List<Attachment> attachMentList = [SELECT id, parentId, Body, Name, ContentType,Description  from Attachment where parentId IN :fileList and Description!='鐢靛瓙绛炬敹鍗曪細宸插鐞�'];
-            List<FileAddress__c> attachMentList = [SELECT id, ParentRecordId__c, FileName__c,subInfoType__c,AWS_File_Key__c,DownloadLink__c,ViewLink__c  from FileAddress__c where ParentRecordId__c IN :fileList and subInfoType__c  !='鐢靛瓙绛炬敹鍗曪細宸插鐞�'];
-            //淇宸插鐞嗘暟鎹� 闄勪欢娌℃洿鏂�  鍗虫病鏈夐檮浠惰兘鎻愪氦鐨刡ug 绮剧悽鎶�鏈� wql 2021/01/19 start 
-            //List<Attachment> eSignEntryAttachMentList = new List<Attachment>();
-            List<FileAddress__c> eSignEntryAttachMentList = new List<FileAddress__c>();
+            List<Attachment> attachMentList = [
+                SELECT id, parentId, Body, Name, ContentType, Description
+                FROM Attachment
+                WHERE parentId IN :fileList AND Description != '鐢靛瓙绛炬敹鍗曪細宸插鐞�'
+            ];
+            //淇宸插鐞嗘暟鎹� 闄勪欢娌℃洿鏂�  鍗虫病鏈夐檮浠惰兘鎻愪氦鐨刡ug 绮剧悽鎶�鏈� wql 2021/01/19 start
+            List<Attachment> eSignEntryAttachMentList = new List<Attachment>();
             //鏂囦欢鏁伴噺 鐢ㄤ簬鏂囦欢鍛藉悕
             Integer agencyCount = 0;
             Integer hpCount = 0;
 
             String name;
-            String type ;
+            String type;
             Integer agencyFileCountNum = 0;
             Integer hpFileCountNum = 0;
             Integer i = 0;
             Integer j = 0;
             //璁板綍璇ョ鏀跺崟鐨勬渶鏂扮粡閿�鍟嗛檮浠舵暟閲�
-            Map<id,Integer> eSignAgencyAttSum = new Map<id,Integer> ();
+            Map<id, Integer> eSignAgencyAttSum = new Map<id, Integer>();
             //璁板綍璇ョ鏀跺崟鐨勬渶鏂板尰闄㈤檮浠舵暟閲�
-            Map<id,Integer> eSignHpAttSum = new Map<id,Integer> ();
+            Map<id, Integer> eSignHpAttSum = new Map<id, Integer>();
 
             //鍚屼竴鏉″綍鍏ヨ〃澶氫釜闄勪欢鏍囪瘑
             Boolean agencyNumFlag = false;
@@ -811,28 +776,25 @@
                 system.debug('eSignFlieIdMap:' + eSignFlieIdMap);
                 system.debug('eSignNameMap:' + eSignNameMap);
                 for (Id eSignFormEntryId : fileList) {
-
-                    for (FileAddress__c attach : attachMentList) {          //zhj Attachment To AWS 2023-02-06
-
-                        if (attach.ParentRecordId__c == eSignFormEntryId) {
-                            Id eid = eSignFlieIdMap.get(attach.ParentRecordId__c);
+                    for (Attachment attach : attachMentList) {
+                        if (attach.parentId == eSignFormEntryId) {
+                            Id eid = eSignFlieIdMap.get(attach.parentId);
                             system.debug('eid:' + eid);
 
                             name = eSignNameMap.get(eid);
                             system.debug('name:' + name);
-                            type = eSignTypeMap.get(attach.ParentRecordId__c);
+                            type = eSignTypeMap.get(attach.parentId);
 
                             //鍥犱负澶栧眰寰幆鏄腑闂磋〃 濡傛灉2鏉′互涓婂綍鍏ヨ〃閮芥湁缁忛攢鍟嗛檮浠� 鍒欎娇鐢ㄦ渶鏂版瀯寤虹殑缁忛攢鍟嗛檮浠舵暟閲忔潵鍛藉悕
                             //鍚﹀垯鍙栨湭鏇存柊涔嬪墠鏈夌殑缁忛攢鍟嗛檮浠舵暟閲� 骞朵笖 涓嶆槸1涓綍鍏ヨ〃澶氫釜闄勪欢 涔熷氨鏄痜alse鐨勬椂鍊� 鍙栨ā鎷熺殑鏈�鏂版暟閲�
-                            if(eSignAgencyAttSum.size()>0&&!agencyNumFlag){
+                            if (eSignAgencyAttSum.size() > 0 && !agencyNumFlag) {
                                 agencyCount = eSignAgencyAttSum.get(eid);
                                 //璁板綍涓�涓渶鏂扮殑闄勪欢鏁�
-                                agencySumCount =agencyCount;
-                            }else if(agencySumCount>0){
+                                agencySumCount = agencyCount;
+                            } else if (agencySumCount > 0) {
                                 //鏈寰幆鍐� 绗竴娆″彇闄勪欢鏁版渶鏂板�� 鍚庣画閮藉湪姝ゅ熀纭�涓奿++
-                                agencyCount =agencySumCount;
-                            }
-                            else if(fileAgencyMap.size() > 0){
+                                agencyCount = agencySumCount;
+                            } else if (fileAgencyMap.size() > 0) {
                                 //鍙湁涓�鏉℃暟鎹椂锛屼娇鐢ㄦ闄勪欢鏁板嵆鍙� 鍚庣画鍦ㄦ鍩虹涓奿++
                                 agencyCount = fileAgencyMap.get(eid);
                             }
@@ -854,20 +816,19 @@
                             //缁忛攢鍟嗛檮浠跺懡鍚� end
                             //鍥犱负澶栧眰寰幆鏄腑闂磋〃 濡傛灉2鏉′互涓婂綍鍏ヨ〃閮芥湁鍖婚櫌闄勪欢 鍒欎娇鐢ㄦ渶鏂版瀯寤虹殑鍖婚櫌闄勪欢鏁伴噺鏉ュ懡鍚�
                             //鍚﹀垯鍙栨湭鏇存柊涔嬪墠鏈夌殑鍖婚櫌闄勪欢鏁伴噺 骞朵笖 涓嶆槸1涓綍鍏ヨ〃澶氫釜闄勪欢 涔熷氨鏄痜alse鐨勬椂鍊� 鍙栨ā鎷熺殑鏈�鏂版暟閲�
-                            if(eSignHpAttSum.size()>0&&!hpNumFlag){
+                            if (eSignHpAttSum.size() > 0 && !hpNumFlag) {
                                 hpCount = eSignHpAttSum.get(eid);
                                 //璁板綍涓�涓渶鏂扮殑闄勪欢鏁�
                                 hpSumCount = hpCount;
-                            }else if(hpSumCount >0 ){
+                            } else if (hpSumCount > 0) {
                                 //鏈寰幆鍐� 绗竴娆″彇闄勪欢鏁版渶鏂板�� 鍚庣画閮藉湪姝ゅ熀纭�涓妀++
-                                hpCount =hpSumCount;                        
-                            }
-                            else if(fileHPMap.size() > 0){
+                                hpCount = hpSumCount;
+                            } else if (fileHPMap.size() > 0) {
                                 //鍙湁涓�鏉℃暟鎹椂锛屼娇鐢ㄦ闄勪欢鏁板嵆鍙� 鍚庣画鍦ㄦ鍩虹涓妀++
                                 hpCount = fileHPMap.get(eid);
                             }
                             //鍚屼竴涓唴閮ㄥ惊鐜噷缃垚true
-                            hpNumFlag =true;
+                            hpNumFlag = true;
                             //鍖婚櫌闄勪欢鍛藉悕 start
                             // if (fileHPMap.size() > 0) {
                             //     hpCount = fileHPMap.get(eid);
@@ -880,12 +841,12 @@
                                 hpFileCountNum = hpCount + 1 + j;
                             }
                             //鏋勫缓鏈�鏂扮殑绛炬敹鍗曠粡閿�鍟嗛檮浠舵暟閲�
-                            if(agencyFileCountNum>0){
-                                eSignAgencyAttSum.put(eid,agencyFileCountNum);
+                            if (agencyFileCountNum > 0) {
+                                eSignAgencyAttSum.put(eid, agencyFileCountNum);
                             }
                             //鏋勫缓鏈�鏂扮殑绛炬敹鍗曞尰闄㈤檮浠舵暟閲�
-                            if(hpFileCountNum>0){
-                                eSignHpAttSum.put(eid,hpFileCountNum);
+                            if (hpFileCountNum > 0) {
+                                eSignHpAttSum.put(eid, hpFileCountNum);
                             }
                             //鍖婚櫌闄勪欢鍛藉悕 end
                             //鐢ㄤ簬鎷嗗垎缁忛攢鍟�/鍖婚櫌 鍖哄埆鏂囦欢鍚�
@@ -915,40 +876,31 @@
                             //     title = title +'.jpg';
                             // }
                             //鍒ゆ柇涓�涓嬫牸寮忥紝涓嶇劧涓嬭浇涓嬫潵鏄被鍨嬫槸鎵�鏈夋枃浠� 鏃犳硶鎵撳紑
-                            //zhj Attachment To AWS 2023-02-06 start
-                            if (attach.FileName__c.lastIndexOf('.') > -1) {
-                                title = title + attach.FileName__c.substring(attach.FileName__c.lastIndexOf('.'));
+                            if (attach.Name.lastIndexOf('.') > -1) {
+                                title = title + attach.Name.substring(attach.Name.lastIndexOf('.'));
                             }
 
-                            //Attachment newAttachment = attach.clone();
-                            FileAddress__c newAttachment = attach.clone();
-                            newAttachment.ParentRecordId__c = eid;
-                            newAttachment.FileName__c = title;
+                            Attachment newAttachment = attach.clone();
+                            newAttachment.parentId = eid;
+                            newAttachment.name = title;
                             // newAttachment.ContentType =attach.ContentType;
                             //瑕佹洿鏂扮殑绛炬敹鍗曢檮浠�
                             insertAttactment.add(newAttachment);
                             //鍙嶆洿鏂板綍鍏ヨ〃鐨勯檮浠� 鐢ㄦ潵鍒ゆ柇闄勪欢鏄惁琚洿鏂�
-                            //Attachment oldAttachment = new  Attachment();
-                            FileAddress__c oldAttachment = new  FileAddress__c();
+                            Attachment oldAttachment = new Attachment();
                             oldAttachment.Id = attach.Id;
-                            //oldAttachment.Description = '鐢靛瓙绛炬敹鍗曪細宸插鐞�';
-                            oldAttachment.subInfoType__c = '鐢靛瓙绛炬敹鍗曪細宸插鐞�';
-                            //zhj Attachment To AWS 2023-02-06 end
+                            oldAttachment.Description = '鐢靛瓙绛炬敹鍗曪細宸插鐞�';
                             eSignEntryAttachMentList.add(oldAttachment);
-
                         }
-
-
                     }
                     //鏁村崟寰幆鍚� 娓呯┖鍊�
                     i = 0;
                     j = 0;
-                    agencyNumFlag= false;
-                    hpNumFlag =false;
-                    agencySumCount =0;
-                    hpSumCount=0;
+                    agencyNumFlag = false;
+                    hpNumFlag = false;
+                    agencySumCount = 0;
+                    hpSumCount = 0;
                 }
-
             }
 
             //鐢靛瓙绛炬敹鍗� 澧炲姞鏈鏇存柊闄勪欢鏁伴噺  2020/01/07 绮剧悽鎶�鏈� wql start
@@ -956,7 +908,7 @@
             if (insertAttactment.size() > 0) {
                 insert insertAttactment;
                 //鍙嶅悜鏇存柊褰曞叆琛ㄩ檮浠�
-                if(eSignEntryAttachMentList.size()>0){
+                if (eSignEntryAttachMentList.size() > 0) {
                     update eSignEntryAttachMentList;
                 }
 
@@ -964,84 +916,59 @@
                 if (eSignFormList.size() > 0) {
                     //澶栧眰鎵�鏈夌鏀跺崟
                     for (eSignForm__c es : eSignFormList) {
-
                         //a涓虹粡閿�鍟嗛檮浠剁殑鏁伴噺 h涓哄尰闄㈤檮浠剁殑鏁伴噺
                         Integer a = 0;
                         Integer h = 0;
 
                         //鍐呭眰鎵�鏈夐渶瑕佹洿鏂扮殑闄勪欢
-                        //for (Attachment att : insertAttactment) {
-                        for (FileAddress__c att : insertAttactment) {   //zhj Attachment To AWS 2023-02-06
+                        for (Attachment att : insertAttactment) {
                             if (es.Id != null) {
-                                if (es.Id.equals(att.ParentRecordId__c)) {
+                                if (es.Id.equals(att.parentId)) {
                                     if (es.agencyAutoSignUpStatus__c != null) {
-                                        if (es.agencyAutoSignUpStatus__c.equals('鐢宠涓�') && oldESignAgencyStatusMap.size()>0) {
-                                                if(!oldESignAgencyStatusMap.get('A' + es.Id).equals('鐢宠涓�')){
-                                                    if (att.FileName__c.substring(0, 1).equals('A')) {      //zhj Attachment To AWS 2023-02-06
-                                                        a ++;
-                                                    }
+                                        if (es.agencyAutoSignUpStatus__c.equals('鐢宠涓�') && oldESignAgencyStatusMap.size() > 0) {
+                                            if (!oldESignAgencyStatusMap.get('A' + es.Id).equals('鐢宠涓�')) {
+                                                if (att.Name.substring(0, 1).equals('A')) {
+                                                    a++;
                                                 }
-                                            
+                                            }
                                         }
                                     }
                                     if (es.HPSignUpStatus__c != null) {
-                                        if (es.HPSignUpStatus__c.equals('鐢宠涓�') && oldESignHPStatusMap.size()>0) {
-                                            if(!oldESignHPStatusMap.get('H' + es.Id).equals('鐢宠涓�')){
-                                                if (att.FileName__c.substring(0, 1).equals('H')) {          //zhj Attachment To AWS 2023-02-06
-                                                    h ++;
+                                        if (es.HPSignUpStatus__c.equals('鐢宠涓�') && oldESignHPStatusMap.size() > 0) {
+                                            if (!oldESignHPStatusMap.get('H' + es.Id).equals('鐢宠涓�')) {
+                                                if (att.Name.substring(0, 1).equals('H')) {
+                                                    h++;
                                                 }
                                             }
-                                            
                                         }
                                     }
-
                                 }
                             }
-
                         }
 
                         //鍙湁鐪熸鎵爜鎻愪氦鐨� 骞朵笖娌℃湁闄勪欢鎵嶄細琚洿鏂�
                         if (es.agencyAutoSignUpStatus__c != null) {
-                            if (es.agencyAutoSignUpStatus__c.equals('鐢宠涓�') && oldESignAgencyStatusMap.size()>0) {
-                                if(!oldESignAgencyStatusMap.get('A' + es.Id).equals('鐢宠涓�')){
+                            if (es.agencyAutoSignUpStatus__c.equals('鐢宠涓�') && oldESignAgencyStatusMap.size() > 0) {
+                                if (!oldESignAgencyStatusMap.get('A' + es.Id).equals('鐢宠涓�')) {
                                     es.agencyAttachNum__c = a;
                                 }
-                                
                             }
                         }
                         //鍙湁鐪熸鎵爜鎻愪氦鐨� 骞朵笖娌℃湁闄勪欢鎵嶄細琚洿鏂�
                         if (es.HPSignUpStatus__c != null) {
-                            if (es.HPSignUpStatus__c.equals('鐢宠涓�') &&oldESignHPStatusMap.size()>0 ) {
-                                if(!oldESignHPStatusMap.get('H' + es.Id).equals('鐢宠涓�')){
-                                     es.HPAttachNum__c = h;
+                            if (es.HPSignUpStatus__c.equals('鐢宠涓�') && oldESignHPStatusMap.size() > 0) {
+                                if (!oldESignHPStatusMap.get('H' + es.Id).equals('鐢宠涓�')) {
+                                    es.HPAttachNum__c = h;
                                 }
-                               
-
                             }
                         }
 
                         a = 0;
                         h = 0;
-
                     }
                 }
                 //鐢靛瓙绛炬敹鍗� 澧炲姞鏈鏇存柊闄勪欢鏁伴噺  2020/01/07 绮剧悽鎶�鏈� wql end
                 //鏂囦欢 end
-            }
-            // 鏇存柊绛炬敹鍗曞綍鍏ヨ〃
-            if(unprocessedEntries.size() > 0) {
-                Database.SaveResult[] lsr = Database.update(unprocessedEntries, false);
-                // Database.SaveResult[] lsr = Database.update(unprocessedEntries.values(), false);
-                eb.setError(lsr, MAXERRORCNT, eSignFormEntry__c.sObjectType);
-                for (Integer tIdx = 0; tIdx < lsr.size(); tIdx++) {
-                    Database.SaveResult sr = lsr[tIdx];
-                    System.debug('sr.isSuccess:' + sr.isSuccess());
-                    if (!sr.isSuccess()) {
-                        Database.Error emsg = sr.getErrors()[0];
-                        iflog.ErrorLog__c += 'ERROR ' + unprocessedEntries[tIdx].Id + ' eSignFormEntry__c:' + emsg + '\n';
-                        // iflog.ErrorLog__c += 'ERROR ' + unprocessedEntries.values()[tIdx].Id + ' eSignFormEntry__c:' + emsg + '\n';
-                    }
-                }
             }
             system.debug('鏇存柊鐨勭鏀跺崟锛�' + eSignFormList);
             //鏇存柊绛炬敹鍗曟槑缁嗗苟娣诲姞鏃ュ織
@@ -1070,35 +997,30 @@
                     }
                 }
             }
-
-
-        }catch(NullPointerException npe){
-            
-                iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:绌烘寚閽堥敊璇�-琛屽彿:'+ npe.getLineNumber()+ '\n';
-        } 
-        catch (Exception e) {
+        } catch (NullPointerException npe) {
+            iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:绌烘寚閽堥敊璇�-琛屽彿:' + npe.getLineNumber() + '\n';
+        } catch (Exception e) {
             // Database.rollback(sp);
-                
-            iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:'+ e.getMessage() + '\n';
 
+            iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:' + e.getMessage() + '\n';
         }
-        try{
-            System.debug('luruIsLastSubmitList:'+luruIsLastSubmitList);
+        try {
+            System.debug('luruIsLastSubmitList:' + luruIsLastSubmitList);
             if (luruIsLastSubmitList.size() > 0) {
                 //鍒犻櫎涓棿琛ㄦ暟鎹紙鍥犱负浣忎富璇﹀叧绯伙紝鍒犻櫎褰曞叆琛ㄥ嵆鍙級
                 deleteMiddleData(eSignStringMap, luruIsLastSubmitList);
             }
-        }catch(Exception e){
-            iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:'+ e.getMessage() + '\n';
+        } catch (Exception e) {
+            iflog.ErrorLog__c += 'ERROR 锛� eSignForm__c:' + e.getMessage() + '\n';
         }
         //鏂囦欢 end
     }
 
     //鍒犻櫎涓棿琛ㄦ暟鎹紙鍥犱负浣忎富璇﹀叧绯伙紝鍒犻櫎褰曞叆琛ㄥ嵆鍙級
-    private static void deleteMiddleData(Map < String, eSignFormEntry__c > eSignStringMap, List < String > luruIsSubmitList) {
+    private static void deleteMiddleData(Map<String, eSignFormEntry__c> eSignStringMap, List<String> luruIsSubmitList) {
         system.debug('妫�绱㈢殑鎵�鏈夊綍鍏ヨ〃锛�' + eSignStringMap);
         system.debug('鏈�鍚庡綍鍏ョ殑id 锛�' + luruIsSubmitList + '----鏁伴噺锛�' + luruIsSubmitList.size());
-        list < eSignFormEntry__c > eSignFormDeleteList = new list < eSignFormEntry__c > ();
+        list<eSignFormEntry__c> eSignFormDeleteList = new List<eSignFormEntry__c>();
         for (String essm : eSignStringMap.keySet()) {
             for (String lisl : luruIsSubmitList) {
                 if (essm.equals(lisl)) {
@@ -1111,73 +1033,68 @@
         }
         system.debug('鍒犻櫎鐨勬暟鎹甶d锛�' + eSignFormDeleteList + '----鏁伴噺锛�' + eSignFormDeleteList.size());
 
-
-
         //鍒犻櫎绛炬敹鍗曞綍鍏ヨ〃鍏朵粬鏁版嵁
         if (eSignFormDeleteList.size() > 0) {
             //寰幆閬嶅巻id 鍒犻櫎鏂囦欢
-            List<String> fileDeleteIdList = new List<String> ();
-            //List<Attachment> deleteAttachmentList = new List<Attachment>();
-            List<FileAddress__c> deleteAttachmentList = new List<FileAddress__c>();     //zhj Attachment To AWS 2023-02-06
+            List<String> fileDeleteIdList = new List<String>();
+            List<Attachment> deleteAttachmentList = new List<Attachment>();
 
             for (eSignFormEntry__c eSigf : eSignFormDeleteList) {
                 fileDeleteIdList.add(eSigf.Id);
             }
             //寰幆鎵惧埌鏂囦欢id
             if (fileDeleteIdList.size() > 0) {
-
                 // 2022-02-28 shashiming Apex heap size too large
                 // 鍘绘帀Body瀛楁
-                //List<Attachment> attachMentList = [SELECT id, parentId, Name, ContentType,Description  from Attachment where parentId = :fileDeleteIdList];
-                List<FileAddress__c> attachMentList = [SELECT id, ParentRecordId__c, FileName__c,AWS_File_Key__c  from FileAddress__c where ParentRecordId__c = :fileDeleteIdList];       //zhj Attachment To AWS 2023-02-06
-                List<Transaction_Log__c> tranList = new List<Transaction_Log__c>();
+                List<Attachment> attachMentList = [
+                    SELECT id, parentId, Name, ContentType, Description
+                    FROM Attachment
+                    WHERE parentId = :fileDeleteIdList
+                ];
+
                 if (attachMentList.size() > 0) {
-                    for (FileAddress__c att : attachMentList) {
-                        FileAddress__c am = new FileAddress__c();           //zhj Attachment To AWS 2023-02-06
+                    for (Attachment att : attachMentList) {
+                        Attachment am = new Attachment();
                         am.Id = att.Id;
                         deleteAttachmentList.add(am);
-                        //zhj 鏂板鏃ュ織锛屽垹闄WS鐨勯檮浠� 2023-02-17
-                        Transaction_Log__c tran = new Transaction_Log__c();
-                        tran.AWS_Data_Id__c = att.AWS_File_Key__c;
-                        tran.Status__c = 'In Process';
-                        tran.Module__c = '绛炬敹鍗曢檮浠跺垹闄�';
-                        tranList.add(tran);
-                    }
-                    //鏂板鏃ュ織锛屽垹闄WS鐨勯檮浠� zhj 2023-02-17
-                    if(tranList.size() > 0){
-                        insert tranList;
                     }
                     //鍒犻櫎鏂囦欢
                     if (deleteAttachmentList.size() > 0) {
                         delete deleteAttachmentList;
                     }
                 }
-
-
             }
             //鍒犻櫎褰曞叆琛�
-            System.debug('鍒犻櫎褰曞叆琛� : ' + eSignFormDeleteList);
-            // delete eSignFormDeleteList;  // 2023-03-14 ssm 鏆傛椂涓嶈嚜鍔ㄥ垹闄や腑闂磋〃鏁版嵁锛屾柟渚跨煭鏈熷唴鍋歝heck
+            delete eSignFormDeleteList;
         }
     }
     @TestVisible
     //鏇存柊钀ヤ笟閮ㄦ媴褰�
-    private static List < eSignForm__c > updateOwner(List < String > provinceList, Map < Id, String > provinceMap, List < eSignForm__c > eSignFormList, boolean ocsmFlag) {
+    private static List<eSignForm__c> updateOwner(
+        List<String> provinceList,
+        Map<Id, String> provinceMap,
+        List<eSignForm__c> eSignFormList,
+        boolean ocsmFlag
+    ) {
         //钀ヤ笟鎷呭綋 map
-        Map < String, String > provinceOwnerMap = new Map < String, String > ();
+        Map<String, String> provinceOwnerMap = new Map<String, String>();
         //钀ヤ笟鍔╃悊 map
-        Map < String, String > provinceGIMap = new Map < String, String > ();
+        Map<String, String> provinceGIMap = new Map<String, String>();
 
-        List < eSignForm__c > eSignFormLastList = new List < eSignForm__c >();
+        List<eSignForm__c> eSignFormLastList = new List<eSignForm__c>();
         //妫�绱CSM绠$悊鐪佸璞�
-        List < OCM_Management_Province__c > ompList = [select id, Name, SalesManage__c,GI_assistant__c,Window1__c    from OCM_Management_Province__c where Name IN: provinceList];
+        List<OCM_Management_Province__c> ompList = [
+            SELECT id, Name, SalesManage__c, GI_assistant__c
+            FROM OCM_Management_Province__c
+            WHERE Name IN :provinceList
+        ];
         //瀛樻斁map<鐪侊紝鎷呭綋>
         for (OCM_Management_Province__c omp : ompList) {
             //涓嶇敤map<String,list>鐨� 鍘熷洜鏄� 鎯� ocsm绠$悊鐪� 鍜岀鏀跺崟 钀ヤ笟鎷呭綋鐨勯『搴忎繚鎸佷竴鑷�
             //String salesManage = omp.SalesManage__c+','+omp.SalesManage2__c+','+omp.SalesManage3__c;
             //provinceOwnerMap.put(omp.Name, salesManage);
             provinceOwnerMap.put(omp.Name, omp.SalesManage__c);
-            provinceGIMap.put(omp.Name, omp.Window1__c);//Update By Li Jun 20230420 for  绛炬敹鍗曡惀涓氬姪鐞嗕粠GI/SP鍔╃悊鏀逛负绛炬敹鍗昈CSM鐪佺殑钀ヤ笟绐楀彛
+            provinceGIMap.put(omp.Name, omp.GI_assistant__c);
         }
         //鈶犱负true鐨勬椂鍊� 鏄叾浠栨病鍙戠敓鍙樺寲鍙湁ocsm鐪佷笂钀ヤ笟鎷呭綋鏀瑰彉
         //鈶′负false鐨勬椂鍊欙紝鏈変腑闂磋〃姝e父鏇存柊鐨勬儏鍐�
@@ -1223,7 +1140,6 @@
         //             }
         //         }
 
-
         //     }
         //     return eSignFormLastList;
 
@@ -1257,43 +1173,39 @@
         if (ocsmFlag) {
             //缁欐渶鍚庤鏇存柊鐨勭鏀跺崟鐨勫鎵硅�咃紙钀ヤ笟閮ㄦ媴褰擄級璧嬪��
             for (Integer cnt = 0; cnt < eSignFormList.size(); cnt++) {
-                if (provinceOwnerMap.get(provinceMap.get(eSignFormList[cnt].Id)) != eSignFormList[cnt].RC_Manager__c ||provinceMap.get(eSignFormList[cnt].Id).equals('闆嗛噰璇�')) {
-
+                if (
+                    provinceOwnerMap.get(provinceMap.get(eSignFormList[cnt].Id)) != eSignFormList[cnt].RC_Manager__c ||
+                    provinceMap.get(eSignFormList[cnt].Id).equals('闆嗛噰璇�')
+                ) {
                     eSignForm__c eSignForm = new eSignForm__c();
                     eSignForm.Id = eSignFormList[cnt].Id;
                     eSignForm.RC_Manager__c = provinceOwnerMap.get(provinceMap.get(eSignFormList[cnt].Id));
-                    //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 start 
-                    if(provinceMap.get(eSignFormList[cnt].Id).equals('闆嗛噰璇�')){
+                    //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 start
+                    if (provinceMap.get(eSignFormList[cnt].Id).equals('闆嗛噰璇�')) {
                         eSignForm.Sales_assistant_name_text__c = provinceGIMap.get(provinceMap.get(eSignFormList[cnt].Id));
                     }
                     //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 end
                     eSignFormLastList.add(eSignForm);
                 }
-
             }
             return eSignFormLastList;
-
         } else {
             //缁欐渶鍚庤鏇存柊鐨勭鏀跺崟鐨勫鎵硅�咃紙钀ヤ笟閮ㄦ媴褰擄級璧嬪��
             for (eSignForm__c esf : eSignFormList) {
                 if (provinceOwnerMap.get(provinceMap.get(esf.Id)) != null) {
                     esf.RC_Manager__c = provinceOwnerMap.get(provinceMap.get(esf.Id));
-                    //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 start 
-                    if(provinceMap.get(esf.Id).equals('闆嗛噰璇�')){
+                    //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 start
+                    if (provinceMap.get(esf.Id).equals('闆嗛噰璇�')) {
                         esf.Sales_assistant_name_text__c = provinceGIMap.get(provinceMap.get(esf.Id));
                     }
                     //闆嗛噰璇环 钀ヤ笟鍔╃悊闇�瑕佺淮鎶ゆ垚 闆嗛噰璇剧殑SP銆丟I鍔╃悊 绮剧悽鎶�鏈� wql 2021/01/08 end
                 }
-
             }
             return eSignFormList;
         }
-
     }
 
-
     global void finish(Database.BatchableContext BC) {
-
         //鏇存柊璇ユ棩蹇楃殑鏁版嵁淇℃伅
         iflog.Log__c += '\nupdateESignBatch end';
         String tmp = iflog.ErrorLog__c;
@@ -1331,7 +1243,7 @@
                 //鍐欐绮剧悽鐢ㄦ埛 涓婄嚎鍚庡簲璇ヤ細淇敼鎴愯嚜瀹氫箟鏍囩
                 // String batchUserId = '00510000005sEEM';
                 String batchUserId = System.Label.Batch_User_Id;
-                List<User> us = [Select Id, NAme, Email From User Where Id = : batchUserId];
+                List<User> us = [SELECT Id, NAme, Email FROM User WHERE Id = :batchUserId];
                 if (!us.isEmpty()) {
                     User use = us[0];
                     if (String.isNotBlank(use.Email)) {
@@ -1339,11 +1251,7 @@
                         if (System.Label.ESign_Error_Send_To_CC != 'null') {
                             MailCc = System.Label.ESign_Error_Send_To_CC.split(',');
                         }
-                        FixtureUtil.sendMessage(batchUserId,
-                                                MailCc,
-                                                'updateESignBatch Error',
-                                                body
-                                               );
+                        FixtureUtil.sendMessage(batchUserId, MailCc, 'updateESignBatch Error', body);
                     }
                 }
             }
@@ -1364,7 +1272,7 @@
             messageMap = new Map<Id, String>();
             overMax = false;
         }
-        public void setError (Database.SaveResult[] saveRes, Integer maxCut, Schema.sObjectType obj) {
+        public void setError(Database.SaveResult[] saveRes, Integer maxCut, Schema.sObjectType obj) {
             if (messageMap.keySet().size() <= maxCut && overMax == false) {
                 String objectName = obj.getDescribe().getName();
                 String objectLabel = obj.getDescribe().getLabel();
@@ -1376,12 +1284,16 @@
                                 break;
                             }
                             for (Database.Error err : saveRe.getErrors()) {
-
-                                String message = objectName + ':'
-                                                 + objectLabel + ':'
-                                                 + err.getStatusCode() + ':'
-                                                 + err.getFields() + ':'
-                                                 + err.getMessage();
+                                String message =
+                                    objectName +
+                                    ':' +
+                                    objectLabel +
+                                    ':' +
+                                    err.getStatusCode() +
+                                    ':' +
+                                    err.getFields() +
+                                    ':' +
+                                    err.getMessage();
                                 // 鏁版嵁閲岄潰鏈夊鏁伴敊璇俊鎭殑璇濆彧鑾峰彇绗竴鏉�
                                 messageMap.put(saveRe.getId(), message);
                                 break;
@@ -1394,519 +1306,8 @@
     }
 
     //瀹氭椂璺戜换鍔�
-    public Class ScBean {
+    public class ScBean {
         public String scName;
         public String scTime;
     }
-
-    public static void improveTestRate(){
-        Integer i = 0;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-        i++;
-    }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/classes/updateESignBatchTest.cls b/force-app/main/default/classes/updateESignBatchTest.cls
index c574454..92a4473 100644
--- a/force-app/main/default/classes/updateESignBatchTest.cls
+++ b/force-app/main/default/classes/updateESignBatchTest.cls
@@ -2,93 +2,110 @@
 private class updateESignBatchTest {
     //娴嬭瘯缁忛攢鍟嗘敹璐�
     static testMethod void testMethod1() {
-    	 List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
 
@@ -103,34 +120,32 @@
         insert Sac;
 
         //鏂板缓鐢靛瓙绛炬敹鍗�
-    	eSignForm__c eSignForm = new eSignForm__c();
-    	eSignForm.Statu_Achievements__c = Sac.Id;
-    	eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
+        eSignForm__c eSignForm = new eSignForm__c();
+        eSignForm.Statu_Achievements__c = Sac.Id;
+        eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
 
-
-    	insert eSignForm;
+        insert eSignForm;
 
         eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
         eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃1';
         eSignFormEntry1.eSignForm__c = eSignForm.Id;
         eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
-        
+
         insert eSignFormEntry1;
 
-    	eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
-    	eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃2';
-    	eSignFormEntry2.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
+        eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
+        eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃2';
+        eSignFormEntry2.eSignForm__c = eSignForm.Id;
+        eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
         eSignFormEntry2.IsSubmit__c = true;
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
-    	// eSignFormEntry2.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry2;
-
+        // eSignFormEntry2.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry2;
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
@@ -143,42 +158,41 @@
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
         attach.ContentType = 'application/pdf';
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
         attach1.ContentType = 'application/pdf';
-        
+
         attachmentList.add(attach1);
 
         insert attachmentList;
 
         Test.startTest();
-
 
         Database.executeBatch(new updateESignBatch(), 20);
         Test.stopTest();
@@ -186,92 +200,109 @@
 
     //娴嬭瘯缁忛攢鍟嗙‘璁�
     static testMethod void testMethod2() {
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp
         );
         insert opp;
 
@@ -296,7 +327,7 @@
         eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃1';
         eSignFormEntry1.eSignForm__c = eSignForm.Id;
         eSignFormEntry1.entryType__c = '缁忛攢鍟嗙‘璁�';
-        
+
         insert eSignFormEntry1;
 
         eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
@@ -305,14 +336,13 @@
         eSignFormEntry2.entryType__c = '缁忛攢鍟嗙‘璁�';
         eSignFormEntry2.IsSubmit__c = true;
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;
-
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
@@ -325,36 +355,36 @@
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
-        attach.ContentType='image/jpeg';
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
+        attach.ContentType = 'image/jpeg';
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        attach1.ContentType='image/jpeg';
-        
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+        attach1.ContentType = 'image/jpeg';
+
         attachmentList.add(attach1);
 
         insert attachmentList;
@@ -367,93 +397,110 @@
 
     //娴嬭瘯鍖婚櫌鏀惰揣
     static testMethod void testMethod3() {
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
 
@@ -478,7 +525,7 @@
         eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃1';
         eSignFormEntry1.eSignForm__c = eSignForm.Id;
         eSignFormEntry1.entryType__c = '鍖婚櫌鏀惰揣';
-        
+
         insert eSignFormEntry1;
 
         eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
@@ -487,14 +534,13 @@
         eSignFormEntry2.entryType__c = '鍖婚櫌鏀惰揣';
         eSignFormEntry2.IsSubmit__c = true;
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;
-
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
@@ -507,34 +553,34 @@
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
         attachmentList.add(attach1);
 
         insert attachmentList;
@@ -546,93 +592,110 @@
 
     //娴嬭瘯鍖婚櫌纭
     static testMethod void testMethod4() {
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
 
@@ -657,7 +720,7 @@
         eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃1';
         eSignFormEntry1.eSignForm__c = eSignForm.Id;
         eSignFormEntry1.entryType__c = '鍖婚櫌纭';
-        
+
         insert eSignFormEntry1;
 
         eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
@@ -666,14 +729,13 @@
         eSignFormEntry2.entryType__c = '鍖婚櫌纭';
         eSignFormEntry2.IsSubmit__c = true;
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;
-
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
@@ -686,34 +748,34 @@
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
         attachmentList.add(attach1);
 
         insert attachmentList;
@@ -724,546 +786,111 @@
         Test.stopTest();
     }
 
-
     static testMethod void testMethod5() {
-    	 List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
+
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
         String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = 'OCM鐩存帴璨╁2',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
-        );
-        insert opp;
-        //娉ㄦ畫
-        Statu_Achievements__c Sac = new Statu_Achievements__c(
-            name = 'zhucan_one',
-            Opportunity__c = opp.id,
-            DeliveryDate__c = Date.today(),
-            ContractNO__c = 'ContractNO1',
-            ContractAmount__c = 1000
-        );
-        insert Sac;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗�
-    	eSignForm__c eSignForm = new eSignForm__c();
-    	eSignForm.Statu_Achievements__c = Sac.Id;
-    	eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
-
-    	insert eSignForm;
-
-    	//鏂板缓鐢靛瓙绛炬敹鍗�7
-    	eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c();
-    	eSignFormEntry.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry.entryType__c = '缁忛攢鍟嗘敹璐�';
-    	// eSignFormEntry.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry;
-
-    	eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
-    	eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry1.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
-    	// eSignFormEntry1.createdDate = Date.today().addDays(-3);
-    	insert eSignFormEntry1;
-
-    	eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
-    	eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry2.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
-        eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
-    	// eSignFormEntry2.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry2;
-
-    	eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c();
-    	eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry3.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry3.entryType__c = '缁忛攢鍟嗙‘璁�';
-    	// eSignFormEntry3.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry3;
-
-    	eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
-    	eSignFormEntry4.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry4.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry4.entryType__c = '缁忛攢鍟嗙‘璁�';
-    	// eSignFormEntry4.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry4;
-
-    	eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c();
-    	eSignFormEntry5.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry5.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry5.entryType__c = '鍖婚櫌鏀惰揣';
-    	// eSignFormEntry5.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry5;
-
-    	eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c();
-    	eSignFormEntry6.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry6.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry6.entryType__c = '鍖婚櫌鏀惰揣';
-    	// eSignFormEntry6.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry6;
-
-        eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c();
-        eSignFormEntry8.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-        eSignFormEntry8.eSignForm__c = eSignForm.Id;
-        eSignFormEntry8.entryType__c = '鍖婚櫌纭';
-
-        insert eSignFormEntry8;
-
-        eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c();
-        eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-        eSignFormEntry7.eSignForm__c = eSignForm.Id;
-        eSignFormEntry7.entryType__c = '鍖婚櫌纭';
-        
-        insert eSignFormEntry7;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
-        eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
-        eSignFormLineItem.Name = '::鐢靛瓙绛炬敹鍗曟槑缁�';
-        eSignFormLineItem.eSignForm__c = eSignForm.Id;
-
-        insert eSignFormLineItem;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
-        eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
-        eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id;
-        eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
-
-        insert eSignFormLineItemEntry1;
-
-        eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
-        eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
-        eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
-
-        insert eSignFormLineItemEntry2;
-
-    	list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
-
-        attachmentList.add(attach);
-
-        // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
-        attachmentList.add(attach1);
-
-        insert attachmentList;
-
-        Test.startTest();
-
-        Date d = Date.today();
-        Database.executeBatch(new updateESignBatch(d), 20);
-        Test.stopTest();
-    }
-
-    static testMethod void testMethod6() {
-    	 List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
-        if (rectCo.size() == 0) {
-            return;
-        }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
-        if (rectSct.size() == 0) {
-            return;
-        }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
-        if (rectDpt.size() == 0) {
-            return;
-        }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
-        if (rectAs.size() == 0) {
-            return;
-        }
-
-     
-        // insert hospital
-        Account company1 = new Account();
-        company1.RecordTypeId = rectCo[0].Id;
-        company1.Name = '鐥呴櫌銉嗐偣銉�1';
-        company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
-        insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
-        Account depart1 = new Account();
-        depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
-        depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
-        depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
-
-        List<Product2> prdList = new List<Product2>();
-        Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
-        prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
-        prd1.Extend_new_product_gurantee__c = true;
-        prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
-        prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
-        prdList.add(prd1);
-        insert prdList;
-    
-        Asset ast = new Asset();
-
-        ast.RecordTypeId = rectAs[0].Id;
-        ast.SerialNumber = 'abcdefg';
-        ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
-        ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
-        ast.Manage_type__c = '涓綋绠$悊';
-        ast.FirstApproveDate_old__c = Date.today().addDays(-30);
-
-        Oly_TriggerHandler.bypass('AssetHandler');
-
-        insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
-
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
-        Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = 'OCM鐩存帴璨╁2',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
-        );
-        insert opp;
-        //娉ㄦ畫
-        Statu_Achievements__c Sac = new Statu_Achievements__c(
-            name = 'zhucan_one',
-            Opportunity__c = opp.id,
-            DeliveryDate__c = Date.today(),
-            ContractNO__c = 'ContractNO1',
-            ContractAmount__c = 1000
-        );
-        insert Sac;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗�
-    	eSignForm__c eSignForm = new eSignForm__c();
-    	eSignForm.Statu_Achievements__c = Sac.Id;
-    	eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
-
-    	insert eSignForm;
-
-    	//鏂板缓鐢靛瓙绛炬敹鍗�7
-    	eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c();
-    	eSignFormEntry.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry.entryType__c = '缁忛攢鍟嗘敹璐�';
-    	// eSignFormEntry.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry;
-
-    	eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
-    	eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry1.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
-    	// eSignFormEntry1.createdDate = Date.today().addDays(-3);
-    	insert eSignFormEntry1;
-
-    	eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
-    	eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry2.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
-        eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
-    	// eSignFormEntry2.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry2;
-
-    	eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c();
-    	eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry3.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry3.entryType__c = '缁忛攢鍟嗙‘璁�';
-    	// eSignFormEntry3.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry3;
-
-    	eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
-    	eSignFormEntry4.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry4.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry4.entryType__c = '缁忛攢鍟嗙‘璁�';
-    	// eSignFormEntry4.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry4;
-
-    	eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c();
-    	eSignFormEntry5.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry5.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry5.entryType__c = '鍖婚櫌鏀惰揣';
-    	// eSignFormEntry5.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry5;
-
-    	eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c();
-    	eSignFormEntry6.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry6.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry6.entryType__c = '鍖婚櫌鏀惰揣';
-    	// eSignFormEntry6.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry6;
-
-        eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c();
-        eSignFormEntry8.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-        eSignFormEntry8.eSignForm__c = eSignForm.Id;
-        eSignFormEntry8.entryType__c = '鍖婚櫌纭';
-
-        insert eSignFormEntry8;
-
-        eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c();
-        eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-        eSignFormEntry7.eSignForm__c = eSignForm.Id;
-        eSignFormEntry7.entryType__c = '鍖婚櫌纭';
-        
-        insert eSignFormEntry7;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
-        eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
-        eSignFormLineItem.Name = '::鐢靛瓙绛炬敹鍗曟槑缁�';
-        eSignFormLineItem.eSignForm__c = eSignForm.Id;
-
-        insert eSignFormLineItem;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
-        eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
-        eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id;
-        eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
-
-        insert eSignFormLineItemEntry1;
-
-        eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
-        eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
-        eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
-
-        insert eSignFormLineItemEntry2;
-
-    	list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
-
-        attachmentList.add(attach);
-
-        // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
-        attachmentList.add(attach1);
-
-        insert attachmentList;
-        Test.startTest();
-        Date startDate = Date.today();
-        Date enDdate = Date.today().addDays(-1);
-        Database.executeBatch(new updateESignBatch(startDate,enDdate), 20);
-        Test.stopTest();
-    }
-
-    static testMethod void testMethod7() {
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
-        if (rectCo.size() == 0) {
-            return;
-        }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
-        if (rectSct.size() == 0) {
-            return;
-        }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
-        if (rectDpt.size() == 0) {
-            return;
-        }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
-        if (rectAs.size() == 0) {
-            return;
-        }
-
-     
-        // insert hospital
-        Account company1 = new Account();
-        company1.RecordTypeId = rectCo[0].Id;
-        company1.Name = '鐥呴櫌銉嗐偣銉�1';
-        company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
-        insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
-        Account depart1 = new Account();
-        depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
-        depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
-        depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
-
-        List<Product2> prdList = new List<Product2>();
-        Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
-        prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
-        prd1.Extend_new_product_gurantee__c = true;
-        prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
-        prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
-        prdList.add(prd1);
-        insert prdList;
-    
-        Asset ast = new Asset();
-
-        ast.RecordTypeId = rectAs[0].Id;
-        ast.SerialNumber = 'abcdefg';
-        ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
-        ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
-        ast.Manage_type__c = '涓綋绠$悊';
-        ast.FirstApproveDate_old__c = Date.today().addDays(-30);
-
-        Oly_TriggerHandler.bypass('AssetHandler');
-
-        insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
-
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
-        Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = 'OCM鐩存帴璨╁2',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = 'OCM鐩存帴璨╁2',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
         //娉ㄦ畫
@@ -1303,10 +930,10 @@
         eSignFormEntry2.eSignForm__c = eSignForm.Id;
         eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;
@@ -1350,7 +977,7 @@
         eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
         eSignFormEntry7.eSignForm__c = eSignForm.Id;
         eSignFormEntry7.entryType__c = '鍖婚櫌纭';
-        
+
         insert eSignFormEntry7;
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
@@ -1363,34 +990,519 @@
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
+        attachmentList.add(attach1);
+
+        insert attachmentList;
+
+        Test.startTest();
+
+        Date d = Date.today();
+        Database.executeBatch(new updateESignBatch(d), 20);
+        Test.stopTest();
+    }
+
+    static testMethod void testMethod6() {
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
+        if (rectSct.size() == 0) {
+            return;
+        }
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
+        if (rectDpt.size() == 0) {
+            return;
+        }
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
+        if (rectAs.size() == 0) {
+            return;
+        }
+
+        // insert hospital
+        Account company1 = new Account();
+        company1.RecordTypeId = rectCo[0].Id;
+        company1.Name = '鐥呴櫌銉嗐偣銉�1';
+        company1.OCM_man_province_txt__c = '姹熻タ';
+        List<Account> hps = new List<Account>{ company1 };
+        insert hps;
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
+        Account depart1 = new Account();
+        depart1.RecordTypeId = rectDpt[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
+        depart1.Department_Class__c = dc1s[0].Id;
+        depart1.Hospital__c = company1.Id;
+        depart1.OCM_man_province_txt__c = '姹熻タ';
+
+        insert new List<Account>{ depart1 };
+
+        List<Product2> prdList = new List<Product2>();
+        Product2 prd1 = new Product2();
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
+        prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
+        prd1.Extend_new_product_gurantee__c = true;
+        prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
+        prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
+        prdList.add(prd1);
+        insert prdList;
+
+        Asset ast = new Asset();
+
+        ast.RecordTypeId = rectAs[0].Id;
+        ast.SerialNumber = 'abcdefg';
+        ast.Name = '娴嬭瘯璧勪骇1';
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
+        ast.Guarantee_period_for_products__c = Date.today();
+        ast.InstallDate = Date.today();
+        ast.Manage_type__c = '涓綋绠$悊';
+        ast.FirstApproveDate_old__c = Date.today().addDays(-30);
+
+        Oly_TriggerHandler.bypass('AssetHandler');
+
+        insert ast;
+
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
+        Opportunity opp = new Opportunity(
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = 'OCM鐩存帴璨╁2',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
+        );
+        insert opp;
+        //娉ㄦ畫
+        Statu_Achievements__c Sac = new Statu_Achievements__c(
+            name = 'zhucan_one',
+            Opportunity__c = opp.id,
+            DeliveryDate__c = Date.today(),
+            ContractNO__c = 'ContractNO1',
+            ContractAmount__c = 1000
+        );
+        insert Sac;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗�
+        eSignForm__c eSignForm = new eSignForm__c();
+        eSignForm.Statu_Achievements__c = Sac.Id;
+        eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
+
+        insert eSignForm;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗�7
+        eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c();
+        eSignFormEntry.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry.eSignForm__c = eSignForm.Id;
+        eSignFormEntry.entryType__c = '缁忛攢鍟嗘敹璐�';
+        // eSignFormEntry.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry;
+
+        eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
+        eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry1.eSignForm__c = eSignForm.Id;
+        eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
+        // eSignFormEntry1.createdDate = Date.today().addDays(-3);
+        insert eSignFormEntry1;
+
+        eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
+        eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry2.eSignForm__c = eSignForm.Id;
+        eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
+        eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
+        // eSignFormEntry2.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry2;
+
+        eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c();
+        eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry3.eSignForm__c = eSignForm.Id;
+        eSignFormEntry3.entryType__c = '缁忛攢鍟嗙‘璁�';
+        // eSignFormEntry3.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry3;
+
+        eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
+        eSignFormEntry4.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry4.eSignForm__c = eSignForm.Id;
+        eSignFormEntry4.entryType__c = '缁忛攢鍟嗙‘璁�';
+        // eSignFormEntry4.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry4;
+
+        eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c();
+        eSignFormEntry5.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry5.eSignForm__c = eSignForm.Id;
+        eSignFormEntry5.entryType__c = '鍖婚櫌鏀惰揣';
+        // eSignFormEntry5.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry5;
+
+        eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c();
+        eSignFormEntry6.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry6.eSignForm__c = eSignForm.Id;
+        eSignFormEntry6.entryType__c = '鍖婚櫌鏀惰揣';
+        // eSignFormEntry6.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry6;
+
+        eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c();
+        eSignFormEntry8.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry8.eSignForm__c = eSignForm.Id;
+        eSignFormEntry8.entryType__c = '鍖婚櫌纭';
+
+        insert eSignFormEntry8;
+
+        eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c();
+        eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry7.eSignForm__c = eSignForm.Id;
+        eSignFormEntry7.entryType__c = '鍖婚櫌纭';
+
+        insert eSignFormEntry7;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
+        eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
+        eSignFormLineItem.Name = '::鐢靛瓙绛炬敹鍗曟槑缁�';
+        eSignFormLineItem.eSignForm__c = eSignForm.Id;
+
+        insert eSignFormLineItem;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
+        eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
+        eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id;
+        eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
+
+        insert eSignFormLineItemEntry1;
+
+        eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
+        eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
+
+        insert eSignFormLineItemEntry2;
+
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
+
+        attachmentList.add(attach);
+
+        // insert attach;
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
+        attachmentList.add(attach1);
+
+        insert attachmentList;
+        Test.startTest();
+        Date startDate = Date.today();
+        Date enDdate = Date.today().addDays(-1);
+        Database.executeBatch(new updateESignBatch(startDate, enDdate), 20);
+        Test.stopTest();
+    }
+
+    static testMethod void testMethod7() {
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
+        if (rectSct.size() == 0) {
+            return;
+        }
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
+        if (rectDpt.size() == 0) {
+            return;
+        }
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
+        if (rectAs.size() == 0) {
+            return;
+        }
+
+        // insert hospital
+        Account company1 = new Account();
+        company1.RecordTypeId = rectCo[0].Id;
+        company1.Name = '鐥呴櫌銉嗐偣銉�1';
+        company1.OCM_man_province_txt__c = '姹熻タ';
+        List<Account> hps = new List<Account>{ company1 };
+        insert hps;
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
+        Account depart1 = new Account();
+        depart1.RecordTypeId = rectDpt[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
+        depart1.Department_Class__c = dc1s[0].Id;
+        depart1.Hospital__c = company1.Id;
+        depart1.OCM_man_province_txt__c = '姹熻タ';
+
+        insert new List<Account>{ depart1 };
+
+        List<Product2> prdList = new List<Product2>();
+        Product2 prd1 = new Product2();
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
+        prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
+        prd1.Extend_new_product_gurantee__c = true;
+        prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
+        prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
+        prdList.add(prd1);
+        insert prdList;
+
+        Asset ast = new Asset();
+
+        ast.RecordTypeId = rectAs[0].Id;
+        ast.SerialNumber = 'abcdefg';
+        ast.Name = '娴嬭瘯璧勪骇1';
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
+        ast.Guarantee_period_for_products__c = Date.today();
+        ast.InstallDate = Date.today();
+        ast.Manage_type__c = '涓綋绠$悊';
+        ast.FirstApproveDate_old__c = Date.today().addDays(-30);
+
+        Oly_TriggerHandler.bypass('AssetHandler');
+
+        insert ast;
+
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
+        Opportunity opp = new Opportunity(
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = 'OCM鐩存帴璨╁2',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
+        );
+        insert opp;
+        //娉ㄦ畫
+        Statu_Achievements__c Sac = new Statu_Achievements__c(
+            name = 'zhucan_one',
+            Opportunity__c = opp.id,
+            DeliveryDate__c = Date.today(),
+            ContractNO__c = 'ContractNO1',
+            ContractAmount__c = 1000
+        );
+        insert Sac;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗�
+        eSignForm__c eSignForm = new eSignForm__c();
+        eSignForm.Statu_Achievements__c = Sac.Id;
+        eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
+
+        insert eSignForm;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗�7
+        eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c();
+        eSignFormEntry.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry.eSignForm__c = eSignForm.Id;
+        eSignFormEntry.entryType__c = '缁忛攢鍟嗘敹璐�';
+        // eSignFormEntry.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry;
+
+        eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
+        eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry1.eSignForm__c = eSignForm.Id;
+        eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
+        // eSignFormEntry1.createdDate = Date.today().addDays(-3);
+        insert eSignFormEntry1;
+
+        eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
+        eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry2.eSignForm__c = eSignForm.Id;
+        eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
+        eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
+        // eSignFormEntry2.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry2;
+
+        eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c();
+        eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry3.eSignForm__c = eSignForm.Id;
+        eSignFormEntry3.entryType__c = '缁忛攢鍟嗙‘璁�';
+        // eSignFormEntry3.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry3;
+
+        eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
+        eSignFormEntry4.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry4.eSignForm__c = eSignForm.Id;
+        eSignFormEntry4.entryType__c = '缁忛攢鍟嗙‘璁�';
+        // eSignFormEntry4.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry4;
+
+        eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c();
+        eSignFormEntry5.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry5.eSignForm__c = eSignForm.Id;
+        eSignFormEntry5.entryType__c = '鍖婚櫌鏀惰揣';
+        // eSignFormEntry5.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry5;
+
+        eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c();
+        eSignFormEntry6.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry6.eSignForm__c = eSignForm.Id;
+        eSignFormEntry6.entryType__c = '鍖婚櫌鏀惰揣';
+        // eSignFormEntry6.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry6;
+
+        eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c();
+        eSignFormEntry8.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry8.eSignForm__c = eSignForm.Id;
+        eSignFormEntry8.entryType__c = '鍖婚櫌纭';
+
+        insert eSignFormEntry8;
+
+        eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c();
+        eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry7.eSignForm__c = eSignForm.Id;
+        eSignFormEntry7.entryType__c = '鍖婚櫌纭';
+
+        insert eSignFormEntry7;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
+        eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
+        eSignFormLineItem.Name = '::鐢靛瓙绛炬敹鍗曟槑缁�';
+        eSignFormLineItem.eSignForm__c = eSignForm.Id;
+
+        insert eSignFormLineItem;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
+        eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
+        eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id;
+        eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
+
+        insert eSignFormLineItemEntry1;
+
+        eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
+        eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
+
+        insert eSignFormLineItemEntry2;
+
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
+
+        attachmentList.add(attach);
+
+        // insert attach;
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
         attachmentList.add(attach1);
 
         insert attachmentList;
@@ -1404,319 +1516,110 @@
     }
 
     static testMethod void testMethod8() {
-    	 List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
+
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
         String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = 'OCM鐩存帴璨╁2',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
-        );
-        insert opp;
-        //娉ㄦ畫
-        Statu_Achievements__c Sac = new Statu_Achievements__c(
-            name = 'zhucan_one',
-            Opportunity__c = opp.id,
-            DeliveryDate__c = Date.today(),
-            ContractNO__c = 'ContractNO1',
-            ContractAmount__c = 1000
-        );
-        insert Sac;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗�
-    	eSignForm__c eSignForm = new eSignForm__c();
-    	eSignForm.Statu_Achievements__c = Sac.Id;
-    	eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
-
-    	insert eSignForm;
-
-    	//鏂板缓鐢靛瓙绛炬敹鍗�7
-    	eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c();
-    	eSignFormEntry.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry.entryType__c = '缁忛攢鍟嗘敹璐�';
-    	// eSignFormEntry.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry;
-
-    	eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
-    	eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry1.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
-    	// eSignFormEntry1.createdDate = Date.today().addDays(-3);
-    	insert eSignFormEntry1;
-
-    	eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
-    	eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry2.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
-        eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
-    	// eSignFormEntry2.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry2;
-
-    	eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c();
-    	eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry3.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry3.entryType__c = '缁忛攢鍟嗙‘璁�';
-    	// eSignFormEntry3.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry3;
-
-    	eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
-    	eSignFormEntry4.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry4.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry4.entryType__c = '缁忛攢鍟嗙‘璁�';
-    	// eSignFormEntry4.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry4;
-
-    	eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c();
-    	eSignFormEntry5.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry5.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry5.entryType__c = '鍖婚櫌鏀惰揣';
-    	// eSignFormEntry5.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry5;
-
-    	eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c();
-    	eSignFormEntry6.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry6.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry6.entryType__c = '鍖婚櫌鏀惰揣';
-    	// eSignFormEntry6.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry6;
-
-        eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c();
-        eSignFormEntry8.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-        eSignFormEntry8.eSignForm__c = eSignForm.Id;
-        eSignFormEntry8.entryType__c = '鍖婚櫌纭';
-
-        insert eSignFormEntry8;
-
-        eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c();
-        eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-        eSignFormEntry7.eSignForm__c = eSignForm.Id;
-        eSignFormEntry7.entryType__c = '鍖婚櫌纭';
-        
-        insert eSignFormEntry7;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
-        eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
-        eSignFormLineItem.Name = '::鐢靛瓙绛炬敹鍗曟槑缁�';
-        eSignFormLineItem.eSignForm__c = eSignForm.Id;
-
-        insert eSignFormLineItem;
-
-        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
-        eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
-        eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id;
-        eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
-
-        insert eSignFormLineItemEntry1;
-
-        eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
-        eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
-        eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
-
-        insert eSignFormLineItemEntry2;
-
-    	list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
-
-        attachmentList.add(attach);
-
-        // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
-        attachmentList.add(attach1);
-
-        insert attachmentList;
-
-        Test.startTest();
-
-        String type = '缁忛攢鍟嗘敹璐�';
-        Database.executeBatch(new updateESignBatch(type), 20);
-        Test.stopTest();
-    }
-
-    static testMethod void testMethod9() {
-    	 List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
-        if (rectCo.size() == 0) {
-            return;
-        }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
-        if (rectSct.size() == 0) {
-            return;
-        }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
-        if (rectDpt.size() == 0) {
-            return;
-        }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
-        if (rectAs.size() == 0) {
-            return;
-        }
-
-     
-        // insert hospital
-        Account company1 = new Account();
-        company1.RecordTypeId = rectCo[0].Id;
-        company1.Name = '鐥呴櫌銉嗐偣銉�1';
-        company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
-        insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
-        Account depart1 = new Account();
-        depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
-        depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
-        depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
-
-        List<Product2> prdList = new List<Product2>();
-        Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
-        prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
-        prd1.Extend_new_product_gurantee__c = true;
-        prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
-        prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
-        prdList.add(prd1);
-        insert prdList;
-    
-        Asset ast = new Asset();
-
-        ast.RecordTypeId = rectAs[0].Id;
-        ast.SerialNumber = 'abcdefg';
-        ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
-        ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
-        ast.Manage_type__c = '涓綋绠$悊';
-        ast.FirstApproveDate_old__c = Date.today().addDays(-30);
-
-        Oly_TriggerHandler.bypass('AssetHandler');
-
-        insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
-
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
-        Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = 'OCM鐩存帴璨╁2',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = 'OCM鐩存帴璨╁2',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
         //娉ㄦ畫
@@ -1756,10 +1659,10 @@
         eSignFormEntry2.eSignForm__c = eSignForm.Id;
         eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;
@@ -1803,7 +1706,7 @@
         eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
         eSignFormEntry7.eSignForm__c = eSignForm.Id;
         eSignFormEntry7.entryType__c = '鍖婚櫌纭';
-        
+
         insert eSignFormEntry7;
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
@@ -1816,134 +1719,150 @@
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
         attachmentList.add(attach1);
 
         insert attachmentList;
 
         Test.startTest();
 
-        List<String> ids = new List<String>();
-        ids.add(eSignForm.Id);
-        Database.executeBatch(new updateESignBatch(ids,true), 20);
+        String type = '缁忛攢鍟嗘敹璐�';
+        Database.executeBatch(new updateESignBatch(type), 20);
         Test.stopTest();
     }
 
-    static testMethod void testMethod10() {
-    	 List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+    static testMethod void testMethod9() {
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = 'OCM鐩存帴璨╁2',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = 'OCM鐩存帴璨╁2',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
         //娉ㄦ畫
@@ -1957,67 +1876,67 @@
         insert Sac;
 
         //鏂板缓鐢靛瓙绛炬敹鍗�
-    	eSignForm__c eSignForm = new eSignForm__c();
-    	eSignForm.Statu_Achievements__c = Sac.Id;
-    	eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
+        eSignForm__c eSignForm = new eSignForm__c();
+        eSignForm.Statu_Achievements__c = Sac.Id;
+        eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
 
-    	insert eSignForm;
+        insert eSignForm;
 
-    	//鏂板缓鐢靛瓙绛炬敹鍗�7
-    	eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c();
-    	eSignFormEntry.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry.entryType__c = '缁忛攢鍟嗘敹璐�';
-    	// eSignFormEntry.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry;
+        //鏂板缓鐢靛瓙绛炬敹鍗�7
+        eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c();
+        eSignFormEntry.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry.eSignForm__c = eSignForm.Id;
+        eSignFormEntry.entryType__c = '缁忛攢鍟嗘敹璐�';
+        // eSignFormEntry.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry;
 
-    	eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
-    	eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry1.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
-    	// eSignFormEntry1.createdDate = Date.today().addDays(-3);
-    	insert eSignFormEntry1;
+        eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
+        eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry1.eSignForm__c = eSignForm.Id;
+        eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
+        // eSignFormEntry1.createdDate = Date.today().addDays(-3);
+        insert eSignFormEntry1;
 
-    	eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
-    	eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry2.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
+        eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
+        eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry2.eSignForm__c = eSignForm.Id;
+        eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
-    	// eSignFormEntry2.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry2;
+        // eSignFormEntry2.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry2;
 
-    	eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c();
-    	eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry3.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry3.entryType__c = '缁忛攢鍟嗙‘璁�';
-    	// eSignFormEntry3.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry3;
+        eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c();
+        eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry3.eSignForm__c = eSignForm.Id;
+        eSignFormEntry3.entryType__c = '缁忛攢鍟嗙‘璁�';
+        // eSignFormEntry3.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry3;
 
-    	eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
-    	eSignFormEntry4.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry4.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry4.entryType__c = '缁忛攢鍟嗙‘璁�';
-    	// eSignFormEntry4.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry4;
+        eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
+        eSignFormEntry4.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry4.eSignForm__c = eSignForm.Id;
+        eSignFormEntry4.entryType__c = '缁忛攢鍟嗙‘璁�';
+        // eSignFormEntry4.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry4;
 
-    	eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c();
-    	eSignFormEntry5.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry5.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry5.entryType__c = '鍖婚櫌鏀惰揣';
-    	// eSignFormEntry5.createdDate = Date.today().addDays(-7);
-    	insert eSignFormEntry5;
+        eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c();
+        eSignFormEntry5.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry5.eSignForm__c = eSignForm.Id;
+        eSignFormEntry5.entryType__c = '鍖婚櫌鏀惰揣';
+        // eSignFormEntry5.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry5;
 
-    	eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c();
-    	eSignFormEntry6.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
-    	eSignFormEntry6.eSignForm__c = eSignForm.Id;
-    	eSignFormEntry6.entryType__c = '鍖婚櫌鏀惰揣';
-    	// eSignFormEntry6.createdDate = Date.today().addDays(-2);
-    	insert eSignFormEntry6;
+        eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c();
+        eSignFormEntry6.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry6.eSignForm__c = eSignForm.Id;
+        eSignFormEntry6.entryType__c = '鍖婚櫌鏀惰揣';
+        // eSignFormEntry6.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry6;
 
         eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c();
         eSignFormEntry8.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
@@ -2030,7 +1949,7 @@
         eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
         eSignFormEntry7.eSignForm__c = eSignForm.Id;
         eSignFormEntry7.entryType__c = '鍖婚櫌纭';
-        
+
         insert eSignFormEntry7;
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
@@ -2043,34 +1962,278 @@
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-    	list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
+        attachmentList.add(attach1);
+
+        insert attachmentList;
+
+        Test.startTest();
+
+        List<String> ids = new List<String>();
+        ids.add(eSignForm.Id);
+        Database.executeBatch(new updateESignBatch(ids, true), 20);
+        Test.stopTest();
+    }
+
+    static testMethod void testMethod10() {
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
+        if (rectCo.size() == 0) {
+            return;
+        }
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
+        if (rectSct.size() == 0) {
+            return;
+        }
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
+        if (rectDpt.size() == 0) {
+            return;
+        }
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
+        if (rectAs.size() == 0) {
+            return;
+        }
+
+        // insert hospital
+        Account company1 = new Account();
+        company1.RecordTypeId = rectCo[0].Id;
+        company1.Name = '鐥呴櫌銉嗐偣銉�1';
+        company1.OCM_man_province_txt__c = '姹熻タ';
+        List<Account> hps = new List<Account>{ company1 };
+        insert hps;
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
+        Account depart1 = new Account();
+        depart1.RecordTypeId = rectDpt[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
+        depart1.Department_Class__c = dc1s[0].Id;
+        depart1.Hospital__c = company1.Id;
+        depart1.OCM_man_province_txt__c = '姹熻タ';
+
+        insert new List<Account>{ depart1 };
+
+        List<Product2> prdList = new List<Product2>();
+        Product2 prd1 = new Product2();
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
+        prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
+        prd1.Extend_new_product_gurantee__c = true;
+        prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
+        prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
+        prdList.add(prd1);
+        insert prdList;
+
+        Asset ast = new Asset();
+
+        ast.RecordTypeId = rectAs[0].Id;
+        ast.SerialNumber = 'abcdefg';
+        ast.Name = '娴嬭瘯璧勪骇1';
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
+        ast.Guarantee_period_for_products__c = Date.today();
+        ast.InstallDate = Date.today();
+        ast.Manage_type__c = '涓綋绠$悊';
+        ast.FirstApproveDate_old__c = Date.today().addDays(-30);
+
+        Oly_TriggerHandler.bypass('AssetHandler');
+
+        insert ast;
+
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
+        Opportunity opp = new Opportunity(
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = 'OCM鐩存帴璨╁2',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
+        );
+        insert opp;
+        //娉ㄦ畫
+        Statu_Achievements__c Sac = new Statu_Achievements__c(
+            name = 'zhucan_one',
+            Opportunity__c = opp.id,
+            DeliveryDate__c = Date.today(),
+            ContractNO__c = 'ContractNO1',
+            ContractAmount__c = 1000
+        );
+        insert Sac;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗�
+        eSignForm__c eSignForm = new eSignForm__c();
+        eSignForm.Statu_Achievements__c = Sac.Id;
+        eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
+
+        insert eSignForm;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗�7
+        eSignFormEntry__c eSignFormEntry = new eSignFormEntry__c();
+        eSignFormEntry.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry.eSignForm__c = eSignForm.Id;
+        eSignFormEntry.entryType__c = '缁忛攢鍟嗘敹璐�';
+        // eSignFormEntry.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry;
+
+        eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
+        eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry1.eSignForm__c = eSignForm.Id;
+        eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
+        // eSignFormEntry1.createdDate = Date.today().addDays(-3);
+        insert eSignFormEntry1;
+
+        eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
+        eSignFormEntry2.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry2.eSignForm__c = eSignForm.Id;
+        eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
+        eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
+        // eSignFormEntry2.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry2;
+
+        eSignFormEntry__c eSignFormEntry3 = new eSignFormEntry__c();
+        eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry3.eSignForm__c = eSignForm.Id;
+        eSignFormEntry3.entryType__c = '缁忛攢鍟嗙‘璁�';
+        // eSignFormEntry3.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry3;
+
+        eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
+        eSignFormEntry4.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry4.eSignForm__c = eSignForm.Id;
+        eSignFormEntry4.entryType__c = '缁忛攢鍟嗙‘璁�';
+        // eSignFormEntry4.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry4;
+
+        eSignFormEntry__c eSignFormEntry5 = new eSignFormEntry__c();
+        eSignFormEntry5.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry5.eSignForm__c = eSignForm.Id;
+        eSignFormEntry5.entryType__c = '鍖婚櫌鏀惰揣';
+        // eSignFormEntry5.createdDate = Date.today().addDays(-7);
+        insert eSignFormEntry5;
+
+        eSignFormEntry__c eSignFormEntry6 = new eSignFormEntry__c();
+        eSignFormEntry6.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry6.eSignForm__c = eSignForm.Id;
+        eSignFormEntry6.entryType__c = '鍖婚櫌鏀惰揣';
+        // eSignFormEntry6.createdDate = Date.today().addDays(-2);
+        insert eSignFormEntry6;
+
+        eSignFormEntry__c eSignFormEntry8 = new eSignFormEntry__c();
+        eSignFormEntry8.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry8.eSignForm__c = eSignForm.Id;
+        eSignFormEntry8.entryType__c = '鍖婚櫌纭';
+
+        insert eSignFormEntry8;
+
+        eSignFormEntry__c eSignFormEntry7 = new eSignFormEntry__c();
+        eSignFormEntry7.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃';
+        eSignFormEntry7.eSignForm__c = eSignForm.Id;
+        eSignFormEntry7.entryType__c = '鍖婚櫌纭';
+
+        insert eSignFormEntry7;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
+        eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
+        eSignFormLineItem.Name = '::鐢靛瓙绛炬敹鍗曟槑缁�';
+        eSignFormLineItem.eSignForm__c = eSignForm.Id;
+
+        insert eSignFormLineItem;
+
+        //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏ヨ〃
+        eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
+        eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry2.Id;
+        eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
+
+        insert eSignFormLineItemEntry1;
+
+        eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
+        eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
+
+        insert eSignFormLineItemEntry2;
+
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
+
+        attachmentList.add(attach);
+
+        // insert attach;
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
         attachmentList.add(attach1);
 
         insert attachmentList;
@@ -2080,99 +2243,116 @@
         String type = '缁忛攢鍟嗘敹璐�';
         Date startDate = Date.today();
         Date enDdate = Date.today().addDays(-1);
-        Database.executeBatch(new updateESignBatch(type,true), 20);
+        Database.executeBatch(new updateESignBatch(type, true), 20);
         Test.stopTest();
     }
 
     //娴嬭瘯缁忛攢鍟嗘敹璐�
     static testMethod void testMethod11() {
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
 
@@ -2197,7 +2377,7 @@
         eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃1';
         eSignFormEntry1.eSignForm__c = eSignForm.Id;
         eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
-        
+
         insert eSignFormEntry1;
 
         eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
@@ -2206,10 +2386,10 @@
         eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
         eSignFormEntry2.IsSubmit__c = true;
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;
@@ -2218,7 +2398,7 @@
         eSignFormEntry3.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃1';
         eSignFormEntry3.eSignForm__c = eSignForm.Id;
         eSignFormEntry3.entryType__c = '鍖婚櫌鏀惰揣';
-        
+
         insert eSignFormEntry3;
 
         eSignFormEntry__c eSignFormEntry4 = new eSignFormEntry__c();
@@ -2228,7 +2408,6 @@
         eSignFormEntry4.IsSubmit__c = true;
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry4;
-
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
@@ -2241,48 +2420,48 @@
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry3 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry3.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�3';
-        eSignFormLineItemEntry3.eSignFormEntry__c =eSignFormEntry3.Id;
+        eSignFormLineItemEntry3.eSignFormEntry__c = eSignFormEntry3.Id;
         eSignFormLineItemEntry3.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry3;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry4 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry4.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�4';
-        eSignFormLineItemEntry4.eSignFormEntry__c =eSignFormEntry4.Id;
+        eSignFormLineItemEntry4.eSignFormEntry__c = eSignFormEntry4.Id;
         eSignFormLineItemEntry4.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry4;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
         attachmentList.add(attach1);
 
         insert attachmentList;
@@ -2294,93 +2473,110 @@
     }
     //娴嬭瘯鍖婚櫌纭
     static testMethod void testMethod12() {
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
 
@@ -2405,7 +2601,7 @@
         eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃1';
         eSignFormEntry1.eSignForm__c = eSignForm.Id;
         eSignFormEntry1.entryType__c = '鍖婚櫌纭';
-        
+
         insert eSignFormEntry1;
 
         eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
@@ -2422,7 +2618,6 @@
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;
 
-
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
         eSignFormLineItem.Name = '::鐢靛瓙绛炬敹鍗曟槑缁�';
@@ -2434,34 +2629,34 @@
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
-        
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
+
         attachmentList.add(attach1);
 
         insert attachmentList;
@@ -2472,95 +2667,112 @@
         Test.stopTest();
     }
 
-        //娴嬭瘯缁忛攢鍟嗘敹璐�
+    //娴嬭瘯缁忛攢鍟嗘敹璐�
     static testMethod void testMethod13() {
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
 
@@ -2581,14 +2793,12 @@
         eSignForm.RC_Manager__c = UserInfo.getUserId();
         // eSignForm.RC_Manager2__c = UserInfo.getUserId();
         // eSignForm.RC_Manager3__c = UserInfo.getUserId();
-        eSignForm.agencyRejectDate__c   = Date.today().addDays(2);
-        eSignForm.HPRejectDate__c   = Date.today().addDays(2);
-
-
+        eSignForm.agencyRejectDate__c = Date.today().addDays(2);
+        eSignForm.HPRejectDate__c = Date.today().addDays(2);
 
         insert eSignForm;
 
-/*        eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
+        /*        eSignFormEntry__c eSignFormEntry1 = new eSignFormEntry__c();
         eSignFormEntry1.Name = '::鐢靛瓙绛炬敹鍗曞綍鍏ヨ〃1';
         eSignFormEntry1.eSignForm__c = eSignForm.Id;
         eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
@@ -2609,12 +2819,10 @@
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;*/
 
-
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
         eSignFormLineItem.Name = '::鐢靛瓙绛炬敹鍗曟槑缁�';
         eSignFormLineItem.eSignForm__c = eSignForm.Id;
-
 
         insert eSignFormLineItem;
 
@@ -2634,126 +2842,140 @@
 
         insert eSignFormLineItemEntry2;*/
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignForm.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignForm.id;
         attach.ContentType = 'application/pdf';
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='Unit Test Attachment';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'Unit Test Attachment';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
         attach1.ContentType = 'application/pdf';
-        
+
         attachmentList.add(attach1);
 
         insert attachmentList;
 
         Test.startTest();
 
-
         Database.executeBatch(new updateESignBatch(), 20);
         Test.stopTest();
-    
     }
-     //璺戝崟鐙柟娉�
+    //璺戝崟鐙柟娉�
     @isTest
     private static void test_upsertESignLineItems() {
-
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
 
@@ -2767,16 +2989,12 @@
         );
         insert Sac;
 
-
         //鏂板缓鐢靛瓙绛炬敹鍗�
         eSignForm__c eSignForm = new eSignForm__c();
         eSignForm.Statu_Achievements__c = Sac.Id;
         eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
-        
 
         insert eSignForm;
-
-        
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
@@ -2784,8 +3002,6 @@
         eSignFormLineItem.eSignForm__c = eSignForm.Id;
 
         insert eSignFormLineItem;
-
-        
 
         /*list<Attachment> attachmentList = new list<Attachment>();
         Attachment attach=new Attachment();     
@@ -2893,120 +3109,134 @@
 
         // }
 
-
         OCM_Management_Province__c mp1 = new OCM_Management_Province__c();
         mp1.Name = '姹熻タ';
         mp1.GI_assistant__c = UserInfo.getUserId();
         mp1.SP_assistant__c = UserInfo.getUserId();
         mp1.Energy_assistant__c = UserInfo.getUserId();
         mp1.SalesManage__c = UserInfo.getUserId();
-        mp1.Window1__c = UserInfo.getUserId();
 
         insert mp1;
 
-        List <String> provinceList = new List<String>{'姹熻タ'};
-        Map < Id, String > provinceMap = new Map < Id, String >();
+        List<String> provinceList = new List<String>{ '姹熻タ' };
+        Map<Id, String> provinceMap = new Map<Id, String>();
         Id i = eSignForm.id;
         // provinceMap.put(i,'鍖椾含甯�');
         // provinceMap.put(i,'灞辫タ鐪�');
-        provinceMap.put(i,'姹熻タ');
+        provinceMap.put(i, '姹熻タ');
 
-        List < eSignForm__c > eSignFormList = new List < eSignForm__c >();
+        List<eSignForm__c> eSignFormList = new List<eSignForm__c>();
         eSignFormList.add(eSignForm);
 
-        updateESignBatch.updateOwner(provinceList,provinceMap,eSignFormList,true);
-        
+        updateESignBatch.updateOwner(provinceList, provinceMap, eSignFormList, true);
     }
 
-        //娴嬭瘯缁忛攢鍟嗘敹璐�
+    //娴嬭瘯缁忛攢鍟嗘敹璐�
     static testMethod void testMethod14() {
-         List<RecordType> rectCo = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鐥呴櫌'];
+        List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'];
         if (rectCo.size() == 0) {
             return;
         }
-        List<RecordType> rectSct = [select Id from RecordType where IsActive = true and SobjectType = 'Account' and Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'];
+        List<RecordType> rectSct = [
+            SELECT Id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鎴︾暐绉戝鍒嗛 鍛煎惛绉�'
+        ];
         if (rectSct.size() == 0) {
             return;
         }
-        List<RecordType> rectDpt = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account' and Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�') order by Name desc];
+        List<RecordType> rectDpt = [
+            SELECT Id, Name
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name IN ('瑷虹檪绉� 娑堝寲绉�', '瑷虹檪绉� 鍛煎惛绉�')
+            ORDER BY Name DESC
+        ];
         if (rectDpt.size() == 0) {
             return;
         }
-         List<RecordType> rectAs = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Asset' and Name = '澶囧搧'];
+        List<RecordType> rectAs = [SELECT Id, Name FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Asset' AND Name = '澶囧搧'];
         if (rectAs.size() == 0) {
             return;
         }
 
-     
         // insert hospital
         Account company1 = new Account();
         company1.RecordTypeId = rectCo[0].Id;
         company1.Name = '鐥呴櫌銉嗐偣銉�1';
         company1.OCM_man_province_txt__c = '姹熻タ';
-        List<Account> hps = new Account[]{company1};
+        List<Account> hps = new List<Account>{ company1 };
         insert hps;
-          
-        List<Account> dc1s = [Select Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c from Account where Parent.Id = :company1.Id order by Department_Class_Label__c];
-        
+
+        List<Account> dc1s = [
+            SELECT Id, Name, Department_Class_Label__c, Sys_Dept_Name_Change_Chk__c
+            FROM Account
+            WHERE Parent.Id = :company1.Id
+            ORDER BY Department_Class_Label__c
+        ];
+
         Account depart1 = new Account();
         depart1.RecordTypeId = rectDpt[0].Id;
-        depart1.Name         = '*';
-        depart1.Department_Name__c  = '瑷虹檪绉�1';
-        depart1.ParentId            = dc1s[0].Id;
+        depart1.Name = '*';
+        depart1.Department_Name__c = '瑷虹檪绉�1';
+        depart1.ParentId = dc1s[0].Id;
         depart1.Department_Class__c = dc1s[0].Id;
-        depart1.Hospital__c         = company1.Id;
+        depart1.Hospital__c = company1.Id;
         depart1.OCM_man_province_txt__c = '姹熻タ';
-        
-        insert new Account[] {depart1};
+
+        insert new List<Account>{ depart1 };
 
         List<Product2> prdList = new List<Product2>();
         Product2 prd1 = new Product2();
-        prd1.ProductCode_Ext__c     = 'HistoryPrd1';
-        prd1.ProductCode            = 'HistoryPrd1';
+        prd1.ProductCode_Ext__c = 'HistoryPrd1';
+        prd1.ProductCode = 'HistoryPrd1';
         prd1.Repair_Product_Code__c = 'HistoryPrd1_RP';
-        prd1.Name                   = 'HistoryPrd1';
-        prd1.Manual_Entry__c        = false;
+        prd1.Name = 'HistoryPrd1';
+        prd1.Manual_Entry__c = false;
         prd1.Extend_new_product_gurantee__c = true;
         prd1.Extend_Gurantee_Start__c = Date.today().addDays(-60);
         prd1.Extend_Gurantee_End__c = Date.today().addDays(60);
         prdList.add(prd1);
         insert prdList;
-    
+
         Asset ast = new Asset();
 
         ast.RecordTypeId = rectAs[0].Id;
         ast.SerialNumber = 'abcdefg';
         ast.Name = '娴嬭瘯璧勪骇1';
-        ast.AccountId              = depart1.Id;
-        ast.Department_Class__c    = dc1s[0].Id;
-        ast.Hospital__c            = company1.Id;
-        ast.Product2Id             = prd1.Id;
+        ast.AccountId = depart1.Id;
+        ast.Department_Class__c = dc1s[0].Id;
+        ast.Hospital__c = company1.Id;
+        ast.Product2Id = prd1.Id;
         ast.Guarantee_period_for_products__c = Date.today();
-        ast.InstallDate                      = Date.today();
+        ast.InstallDate = Date.today();
         ast.Manage_type__c = '涓綋绠$悊';
         ast.FirstApproveDate_old__c = Date.today().addDays(-30);
 
         Oly_TriggerHandler.bypass('AssetHandler');
 
         insert ast;
-        
-        Asset ast1 = [select RecordTypeID__c from Asset where Id =: ast.Id];
-        
-        String RecordTypeID = ast1.RecordTypeID__c;
-           
-        System.assertEquals(RecordTypeID , ast.RecordTypeId);
 
-        RecordType rectOpp = [select id from RecordType where IsActive = true and SobjectType = 'Opportunity' and DeveloperName = 'Opportunity' ];
+        Asset ast1 = [SELECT RecordTypeID__c FROM Asset WHERE Id = :ast.Id];
+
+        String RecordTypeID = ast1.RecordTypeID__c;
+
+        System.assertEquals(RecordTypeID, ast.RecordTypeId);
+
+        RecordType rectOpp = [
+            SELECT id
+            FROM RecordType
+            WHERE IsActive = TRUE AND SobjectType = 'Opportunity' AND DeveloperName = 'Opportunity'
+        ];
         Opportunity opp = new Opportunity(
-               Name='testOpp1',
-               StageName='寮曞悎',
-               CloseDate=Date.today(),
-               AccountId=depart1.Id,
-               Sales_Root__c = '璨╁2搴�',
-               Competitor__c ='A',
-               Click_Close_Date__c = null,
-               RecordType = rectOpp,
-               Trade__c = '鍐呰部'
+            Name = 'testOpp1',
+            StageName = '寮曞悎',
+            CloseDate = Date.today(),
+            AccountId = depart1.Id,
+            Sales_Root__c = '璨╁2搴�',
+            Competitor__c = 'A',
+            Click_Close_Date__c = null,
+            RecordType = rectOpp,
+            Trade__c = '鍐呰部'
         );
         insert opp;
 
@@ -3024,9 +3254,8 @@
         eSignForm__c eSignForm = new eSignForm__c();
         eSignForm.Statu_Achievements__c = Sac.Id;
         eSignForm.Name = '::娴嬭瘯鐢靛瓙绛炬敹鍗�';
-        eSignForm.agencyRejectDate__c   = Date.today().addDays(2);
-        eSignForm.HPRejectDate__c   = Date.today().addDays(2);
-
+        eSignForm.agencyRejectDate__c = Date.today().addDays(2);
+        eSignForm.HPRejectDate__c = Date.today().addDays(2);
 
         insert eSignForm;
 
@@ -3035,7 +3264,6 @@
         eSignFormEntry1.eSignForm__c = eSignForm.Id;
         eSignFormEntry1.entryType__c = '缁忛攢鍟嗘敹璐�';
 
-        
         insert eSignFormEntry1;
 
         eSignFormEntry__c eSignFormEntry2 = new eSignFormEntry__c();
@@ -3044,14 +3272,13 @@
         eSignFormEntry2.entryType__c = '缁忛攢鍟嗘敹璐�';
         eSignFormEntry2.IsSubmit__c = true;
         eSignFormEntry2.agencyScanDayBack__c = Date.today().addDays(-2);
-        eSignFormEntry2.agencySignUpDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.agencyConfirmDateBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPScanDayBack__c =Date.today().addDays(-2);
-        eSignFormEntry2.HPSignUpDateBack__c =Date.today().addDays(-2);
+        eSignFormEntry2.agencySignUpDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.agencyConfirmDateBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPScanDayBack__c = Date.today().addDays(-2);
+        eSignFormEntry2.HPSignUpDateBack__c = Date.today().addDays(-2);
         eSignFormEntry2.HPConfirmDateBack__c = Date.today().addDays(-2);
         // eSignFormEntry2.createdDate = Date.today().addDays(-2);
         insert eSignFormEntry2;
-
 
         //鏂板缓鐢靛瓙绛炬敹鍗曟槑缁�
         eSignFormLineItem__c eSignFormLineItem = new eSignFormLineItem__c();
@@ -3064,61 +3291,52 @@
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry1 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry1.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�1';
-        eSignFormLineItemEntry1.eSignFormEntry__c =eSignFormEntry1.Id;
+        eSignFormLineItemEntry1.eSignFormEntry__c = eSignFormEntry1.Id;
         eSignFormLineItemEntry1.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry1;
 
         eSignFormLineItemEntry__c eSignFormLineItemEntry2 = new eSignFormLineItemEntry__c();
         eSignFormLineItemEntry2.Name = '::鐢靛瓙绛炬敹鍗曟槑缁嗗綍鍏�2';
-        eSignFormLineItemEntry2.eSignFormEntry__c =eSignFormEntry2.Id;
+        eSignFormLineItemEntry2.eSignFormEntry__c = eSignFormEntry2.Id;
         eSignFormLineItemEntry2.eSignFormLineItem__c = eSignFormLineItem.Id;
 
         insert eSignFormLineItemEntry2;
 
-        list<Attachment> attachmentList = new list<Attachment>();
-        Attachment attach=new Attachment();     
-        attach.Name='Unit Test Attachment';
-        Blob bodyBlob=Blob.valueOf('Unit Test Attachment Body');
-        attach.body=bodyBlob;
-        attach.parentId=eSignFormEntry2.id;
+        list<Attachment> attachmentList = new List<Attachment>();
+        Attachment attach = new Attachment();
+        attach.Name = 'Unit Test Attachment';
+        Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+        attach.body = bodyBlob;
+        attach.parentId = eSignFormEntry2.id;
         attach.ContentType = 'application/pdf';
 
         attachmentList.add(attach);
 
         // insert attach;
-        Attachment attach1=new Attachment();     
-        attach1.Name='H-65224941-20200923--10.jpg';
-        Blob bodyBlob1=Blob.valueOf('Unit Test Attachment Body');
-        attach1.body=bodyBlob1;
-        attach1.parentId=eSignForm.id;
+        Attachment attach1 = new Attachment();
+        attach1.Name = 'H-65224941-20200923--10.jpg';
+        Blob bodyBlob1 = Blob.valueOf('Unit Test Attachment Body');
+        attach1.body = bodyBlob1;
+        attach1.parentId = eSignForm.id;
         attach1.ContentType = 'application/pdf';
-        
-        
+
         attachmentList.add(attach1);
 
-        Attachment attach2=new Attachment();     
-        attach2.Name='A-65224945-20200928--8.jpg';
-        Blob bodyBlob2=Blob.valueOf('Unit Test Attachment Body');
-        attach2.body=bodyBlob2;
-        attach2.parentId=eSignForm.id;
+        Attachment attach2 = new Attachment();
+        attach2.Name = 'A-65224945-20200928--8.jpg';
+        Blob bodyBlob2 = Blob.valueOf('Unit Test Attachment Body');
+        attach2.body = bodyBlob2;
+        attach2.parentId = eSignForm.id;
         attach2.ContentType = 'application/pdf';
-        
-        
+
         attachmentList.add(attach2);
 
         insert attachmentList;
 
         Test.startTest();
 
-
         Database.executeBatch(new updateESignBatch(), 20);
         Test.stopTest();
     }
-
-    static testMethod void testMethod15(){
-        Test.startTest();
-        updateESignBatch.improveTestRate();
-        Test.stopTest();
-    }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html
new file mode 100644
index 0000000..a84a33d
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customOutputGoods.html
@@ -0,0 +1,7 @@
+<template>
+    <c-custom-output-good
+        output-value={typeAttributes.outputValue}
+        output-type={typeAttributes.type}
+        record-id={typeAttributes.recordId}
+    ></c-custom-output-good>
+</template>
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html
new file mode 100644
index 0000000..976070e
--- /dev/null
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customReturnGoodInput.html
@@ -0,0 +1,7 @@
+<template>
+    <c-lex-return-good-cus-input
+        intput-value={typeAttributes.inputValue}
+        box-price={typeAttributes.boxPrice}
+        record-id={typeAttributes.recordId}
+    ></c-lex-return-good-cus-input>
+</template>
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html b/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html
index f7bd7cd..2db4584 100644
--- a/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/customShipmentNumber.html
@@ -1,8 +1,8 @@
 <template>
     <c-custom-shipment-number-comp
-    record-id={typeAttributes.recordId}
-    shipment-number={typeAttributes.shipmentNumber}
+        style="border-color: red"
+        record-id={typeAttributes.recordId}
+        shipment-number={typeAttributes.shipmentNumber}
     >
-
     </c-custom-shipment-number-comp>
-</template>
\ No newline at end of file
+</template>
diff --git a/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js
index 2266f29..5c5a702 100644
--- a/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js
+++ b/force-app/main/default/lwc/lexCustomLightningDatatable/lexCustomLightningDatatable.js
@@ -5,44 +5,58 @@
 import customShipmentAmountTemplate from './customShipmentAmount.html';
 import customDiffReasonTemplate from './lexCustomDiffReason.html';
 import attachmentTypeTemplate from './customAttachmentType.html';
-import { loadStyle} from 'lightning/platformResourceLoader';
+import customTableInputTemplate from './customTableInput.html';
+import customOutputGoodsTemplate from './customOutputGoods.html';
+import customReturnGoodInputTemplate from './customReturnGoodInput.html';
+import { loadStyle } from 'lightning/platformResourceLoader';
 import LexCustomDataTable from '@salesforce/resourceUrl/LexCustomDataTable';
 
 export default class LexCustomLightningDatatable extends LightningDatatable {
     static customTypes = {
         customUnit: {
             template: customUnitTemplate,
-            typeAttributes: ['unitValue','unitOptions','recordId'],
+            typeAttributes: ['unitValue', 'unitOptions', 'recordId']
         },
         customShipment: {
             template: customShipmentNumberTemplate,
-            typeAttributes: ['shipmentNumber','recordId'],
+            typeAttributes: ['shipmentNumber', 'recordId']
         },
         customShipmentUnitPrice: {
             template: customShippingUnitPriceTemplate,
-            typeAttributes: ['shippingUnitPrice','recordId'],
+            typeAttributes: ['shippingUnitPrice', 'recordId']
         },
         customShipmentAmount: {
             template: customShipmentAmountTemplate,
-            typeAttributes: ['shipmentAmount','recordId'],
+            typeAttributes: ['shipmentAmount', 'recordId']
         },
-        customDiffReason : {
+        customDiffReason: {
             template: customDiffReasonTemplate,
-            typeAttributes: ['ProdId'],
+            typeAttributes: ['ProdId']
         },
         customAttachmentType: {
             template: attachmentTypeTemplate,
-            typeAttributes: ['typeValue','typeOptions','recordId','isDisabledAttachment'],
+            typeAttributes: [
+                'typeValue',
+                'typeOptions',
+                'recordId',
+                'isDisabledAttachment'
+            ]
         },
         customTableInput: {
             template: customTableInputTemplate,
-            typeAttributes:['inputValue','recordId'],
+            typeAttributes: ['inputValue', 'recordId']
+        },
+        customOutputGood: {
+            template: customOutputGoodsTemplate,
+            typeAttributes: ['outputValue', 'type', 'recordId']
+        },
+        customReturnGoodInput: {
+            template: customReturnGoodInputTemplate,
+            typeAttributes: ['inputValue', 'boxPrice', 'recordId']
         }
     };
     constructor() {
         super();
-        Promise.all([
-            loadStyle(this, LexCustomDataTable),
-        ]).then(() => {})
+        Promise.all([loadStyle(this, LexCustomDataTable)]).then(() => {});
     }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
index d08f03b..9a12e11 100644
--- a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.html
@@ -2,51 +2,96 @@
 <!-- sldsValidatorIgnore -->
 <template>
     <template if:true={isShowSpinner}>
-        <lightning-spinner alternative-text="Loading" size="large"></lightning-spinner>
+        <lightning-spinner
+            alternative-text="Loading"
+            size="large"
+        ></lightning-spinner>
     </template>
     <!-- 鎼滅储瀹㈡埛鍚� -->
     <template if:true={isModalOpen}>
         <!-- Modal/Popup Box LWC starts here -->
-        <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true"
-            aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open">
+        <section
+            role="dialog"
+            tabindex="-1"
+            aria-labelledby="modal-heading-01"
+            aria-modal="true"
+            aria-describedby="modal-content-id-1"
+            class="slds-modal slds-fade-in-open"
+        >
             <div class="slds-modal__container">
                 <!-- Modal/Popup Box LWC header here -->
                 <header class="slds-modal__header">
-                    <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
-                        title="Close" onclick={closeModal}>
-                        <lightning-icon icon-name="utility:close" alternative-text="close" variant="inverse"
-                            size="small"></lightning-icon>
+                    <button
+                        class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+                        title="Close"
+                        onclick={closeModal}
+                    >
+                        <lightning-icon
+                            icon-name="utility:close"
+                            alternative-text="close"
+                            variant="inverse"
+                            size="small"
+                        ></lightning-icon>
                         <span class="slds-assistive-text">Close</span>
                     </button>
-                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">
+                    <h2
+                        id="modal-heading-01"
+                        class="slds-text-heading_medium slds-hyphenate"
+                    >
                         缁忛攢鍟嗗尰闄㈡绱�
                     </h2>
                 </header>
                 <!-- Modal/Popup Box LWC body starts here -->
-                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
+                <div
+                    class="slds-modal__content slds-p-around_medium"
+                    id="modal-content-id-1"
+                >
                     <lightning-layout>
-                        <lightning-layout-item flexibility="auto" padding="around-small">
-                            <lightning-input type="text" label="鍖婚櫌鍚嶇О" onchange={dataChange}
-                                data-field="searchHospitalName" value={searchHospitalName}
-                                variant="label-inline"></lightning-input>
+                        <lightning-layout-item
+                            flexibility="auto"
+                            padding="around-small"
+                        >
+                            <lightning-input
+                                type="text"
+                                label="鍖婚櫌鍚嶇О"
+                                onchange={dataChange}
+                                data-field="searchHospitalName"
+                                value={searchHospitalName}
+                                variant="label-inline"
+                            ></lightning-input>
                         </lightning-layout-item>
-                        <lightning-layout-item flexibility="auto" padding="around-small">
-                            <lightning-button label="妫�绱�" onclick={searchHospital}></lightning-button>
+                        <lightning-layout-item
+                            flexibility="auto"
+                            padding="around-small"
+                        >
+                            <lightning-button
+                                label="妫�绱�"
+                                onclick={searchHospital}
+                            ></lightning-button>
                         </lightning-layout-item>
                     </lightning-layout>
 
                     <div class="tableColumn">
                         <lightning-layout class="datatable">
-                            <lightning-datatable class="datatabel slds-border_top" key-field="id" data={hospitalList}
-                                columns={hospitalColumns} hide-checkbox-column="true"
-                                onrowaction={searchHandleRowAction}>
+                            <lightning-datatable
+                                class="datatabel slds-border_top"
+                                key-field="id"
+                                data={hospitalList}
+                                columns={hospitalColumns}
+                                hide-checkbox-column="true"
+                                onrowaction={searchHandleRowAction}
+                            >
                             </lightning-datatable>
                         </lightning-layout>
                     </div>
                 </div>
                 <!-- Modal/Popup Box LWC footer starts here -->
                 <footer class="slds-modal__footer">
-                    <button class="slds-button slds-button_neutral" onclick={closeModal} title="Cancel">
+                    <button
+                        class="slds-button slds-button_neutral"
+                        onclick={closeModal}
+                        title="Cancel"
+                    >
                         鍏抽棴
                     </button>
                 </footer>
@@ -57,27 +102,64 @@
 
     <!-- 涓婁紶闄勪欢寮圭獥 -->
     <template if:true={showAttPop}>
-        <section role="dialog" tabindex="-1" aria-labelledby="modal-heading-01" aria-modal="true" aria-describedby="modal-content-id-1" class="slds-modal slds-fade-in-open slds-modal_small" style="border: 1px solid #D4D4D4;">
+        <section
+            role="dialog"
+            tabindex="-1"
+            aria-labelledby="modal-heading-01"
+            aria-modal="true"
+            aria-describedby="modal-content-id-1"
+            class="slds-modal slds-fade-in-open slds-modal_small"
+            style="border: 1px solid #d4d4d4"
+        >
             <template if:true={showPopSpinner}>
-                <lightning-spinner size="medium" variant="brand"></lightning-spinner>
+                <lightning-spinner
+                    size="medium"
+                    variant="brand"
+                ></lightning-spinner>
             </template>
             <div class="slds-modal__container">
-                <header class="slds-modal__header" style="background-color: #F3F3F3;">
-                    <button style="" class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closePop}>
-                        <lightning-icon icon-name="utility:close"
+                <header
+                    class="slds-modal__header"
+                    style="background-color: #f3f3f3"
+                >
+                    <button
+                        style=""
+                        class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse"
+                        title="Close"
+                        onclick={closePop}
+                    >
+                        <lightning-icon
+                            icon-name="utility:close"
                             alternative-text="close"
                             variant="inverse"
-                            size="small" ></lightning-icon>
+                            size="small"
+                        ></lightning-icon>
                         <span class="slds-assistive-text">Close</span>
                     </button>
-                    <h2 id="modal-heading-02" class="slds-text-heading_medium slds-hyphenate">涓婁紶闄勪欢</h2>
+                    <h2
+                        id="modal-heading-02"
+                        class="slds-text-heading_medium slds-hyphenate"
+                    >
+                        涓婁紶闄勪欢
+                    </h2>
                 </header>
-                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-2" style="border: 1px solid #F3F3F3;">
+                <div
+                    class="slds-modal__content slds-p-around_medium"
+                    id="modal-content-id-2"
+                    style="border: 1px solid #f3f3f3"
+                >
                     <div class="slds-m-top_medium slds-m-bottom_x-large">
                         <div class="slds-p-around_medium lgc-bg">
-                            <lightning-input type="file" label="闄勪欢涓婁紶" accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf" onchange={attChange}></lightning-input>
+                            <lightning-input
+                                type="file"
+                                label="闄勪欢涓婁紶"
+                                accept=".xlsx, .xls, .csv, .png, .doc, .docx, .pdf"
+                                onchange={attChange}
+                            ></lightning-input>
                         </div>
-                        <p>宸查�夋嫨鏂囦欢锛歿fileName} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                        <p>
+                            宸查�夋嫨鏂囦欢锛歿fileName}
+                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                             <template if:true={attDelBtn}>
                                 <a onclick={removeAtt}>绉婚櫎</a>
                             </template>
@@ -85,8 +167,18 @@
                     </div>
                 </div>
                 <footer class="slds-modal__footer">
-                    <lightning-button style="margin-left: 10px;" variant="neutral" label="鍙栨秷" onclick={closePop}></lightning-button>
-                    <lightning-button style="margin-left: 10px;" variant="neutral" label="涓婁紶" onclick={handleSave}></lightning-button>
+                    <lightning-button
+                        style="margin-left: 10px"
+                        variant="neutral"
+                        label="鍙栨秷"
+                        onclick={closePop}
+                    ></lightning-button>
+                    <lightning-button
+                        style="margin-left: 10px"
+                        variant="neutral"
+                        label="涓婁紶"
+                        onclick={handleSave}
+                    ></lightning-button>
                 </footer>
             </div>
         </section>
@@ -121,8 +213,11 @@
                                 <tr>
                                     <td>
                                         <template if:true={isSaveShow}>
-                                            <lightning-button label="淇濆瓨" onclick={saveConfirmJs}
-                                                style="width: 150px"></lightning-button>
+                                            <lightning-button
+                                                label="淇濆瓨"
+                                                onclick={saveConfirmJs}
+                                                style="width: 150px"
+                                            ></lightning-button>
                                         </template>
                                     </td>
                                     <td colspan="4">
@@ -135,25 +230,35 @@
                                 <tr>
                                     <td></td>
                                     <td>
-
                                         <template if:true={isEditShow}>
-                                            <lightning-button label="缂栬緫鍑哄簱鍗�" onclick={EditConsumable}
-                                                style="width: 150px" disabled={isEditDisabled}></lightning-button>
+                                            <lightning-button
+                                                label="缂栬緫鍑哄簱鍗�"
+                                                onclick={EditConsumable}
+                                                style="width: 150px"
+                                                disabled={isEditDisabled}
+                                            ></lightning-button>
                                         </template>
                                     </td>
 
                                     <td>
                                         <template if:true={isDeliveryShow}>
-                                            <lightning-button label="鍑鸿揣/閿�鍞�" onclick={GoodsDeliveryJs}
-                                                style="width: 150px;" disabled={isDeliveryDisabled}></lightning-button>
+                                            <lightning-button
+                                                label="鍑鸿揣/閿�鍞�"
+                                                onclick={GoodsDeliveryJs}
+                                                style="width: 150px"
+                                                disabled={isDeliveryDisabled}
+                                            ></lightning-button>
                                         </template>
                                     </td>
 
                                     <td>
-
                                         <template if:true={isOpenToInvoiceShow}>
-                                            <lightning-button label="寮�绁�" onclick={openToInvoiceJs} style="width: 150px"
-                                                disabled={isOpenToInvoiceDisabled}></lightning-button>
+                                            <lightning-button
+                                                label="寮�绁�"
+                                                onclick={openToInvoiceJs}
+                                                style="width: 150px"
+                                                disabled={isOpenToInvoiceDisabled}
+                                            ></lightning-button>
                                         </template>
                                     </td>
                                 </tr>
@@ -161,26 +266,34 @@
                                     <td></td>
 
                                     <td>
-
                                         <template if:true={isPraseToPDFShow}>
-                                            <lightning-button label="鎵撳嵃鎸囩ず鍗�" onclick={PraseToPDFJs} style="width: 150px"
-                                                disabled={isPraseToPDFDisabled}></lightning-button>
+                                            <lightning-button
+                                                label="鎵撳嵃鎸囩ず鍗�"
+                                                onclick={PraseToPDFJs}
+                                                style="width: 150px"
+                                                disabled={isPraseToPDFDisabled}
+                                            ></lightning-button>
                                         </template>
                                     </td>
 
                                     <td>
-
                                         <template if:true={isOpenReportShow}>
-                                            <lightning-button label="鏄剧ず鏄庣粏" onclick={openReportJs} style="width: 150px"
-                                                disabled={isOpenReportDisabled}></lightning-button>
+                                            <lightning-button
+                                                label="鏄剧ず鏄庣粏"
+                                                onclick={openReportJs}
+                                                style="width: 150px"
+                                                disabled={isOpenReportDisabled}
+                                            ></lightning-button>
                                         </template>
                                     </td>
                                     <td>
-
                                         <template if:true={isDeleteShow}>
-                                            <lightning-button label="鍒犻櫎" onclick={DeleteConsumable} style="width: 150px"
-                                                disabled={isDeleteDisabled}></lightning-button>
-
+                                            <lightning-button
+                                                label="鍒犻櫎"
+                                                onclick={DeleteConsumable}
+                                                style="width: 150px"
+                                                disabled={isDeleteDisabled}
+                                            ></lightning-button>
                                         </template>
                                     </td>
                                     <td></td>
@@ -202,182 +315,323 @@
                             <div lwc:dom="manual" class="resultDiv"></div>
                             <div draggable="false">
                                 <!-- SummonsStatus_c__c == '浠锋牸鏈畾' -->
-                                <template if:true={summonsStatusPriceNotDetermined}>
-                                    <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
-                                        onload={handleLoad}>
+                                <template
+                                    if:true={summonsStatusPriceNotDetermined}
+                                >
+                                    <lightning-record-edit-form
+                                        object-api-name="Consumable_order__c"
+                                        record-id={cocId}
+                                        onload={handleLoad}
+                                    >
                                         <!-- 鍑哄簱鍗曞彿 鍑哄簱鍗曠姸鎬� -->
                                         <lightning-layout multiple-rows="true">
                                             <template if:true={isSummonsFlag}>
-                                                <lightning-layout-item size="1"></lightning-layout-item>
+                                                <lightning-layout-item
+                                                    size="1"
+                                                ></lightning-layout-item>
 
                                                 <lightning-layout-item size="4">
-                                                    <lightning-output-field field-name="Name"
-                                                        class="hehe-layoutItem"></lightning-output-field>
+                                                    <lightning-output-field
+                                                        field-name="Name"
+                                                        class="hehe-layoutItem"
+                                                    ></lightning-output-field>
                                                 </lightning-layout-item>
 
-                                                <lightning-layout-item size="1"></lightning-layout-item>
+                                                <lightning-layout-item
+                                                    size="1"
+                                                ></lightning-layout-item>
 
-                                                <lightning-layout-item class="hehe-layoutItem" size="4">
+                                                <lightning-layout-item
+                                                    class="hehe-layoutItem"
+                                                    size="4"
+                                                >
                                                     <lightning-output-field
-                                                        field-name="SummonsStatus_c__c"></lightning-output-field>
+                                                        field-name="SummonsStatus_c__c"
+                                                    ></lightning-output-field>
                                                 </lightning-layout-item>
                                             </template>
                                         </lightning-layout>
 
                                         <!-- 鐩殑   寮�绁ㄧ姸鎬� -->
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
                                                 <lightning-output-field
-                                                    field-name="SummonsForDirction__c"></lightning-output-field>
+                                                    field-name="SummonsForDirction__c"
+                                                ></lightning-output-field>
                                             </lightning-layout-item>
 
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
                                                 <lightning-output-field
-                                                    field-name="Billed_Status__c"></lightning-output-field>
+                                                    field-name="Billed_Status__c"
+                                                ></lightning-output-field>
                                             </lightning-layout-item>
                                         </lightning-layout>
 
                                         <!-- 浜岀骇缁忛攢鍟� -->
-                                        <template if:true={isSummonsForDirctionTwoShow}>
-                                            <lightning-layout multiple-rows="true">
-                                                <lightning-layout-item size="1"></lightning-layout-item>
+                                        <template
+                                            if:true={isSummonsForDirctionTwoShow}
+                                        >
+                                            <lightning-layout
+                                                multiple-rows="true"
+                                            >
+                                                <lightning-layout-item
+                                                    size="1"
+                                                ></lightning-layout-item>
 
-                                                <lightning-layout-item class="hehe-layoutItem" size="4">
+                                                <lightning-layout-item
+                                                    class="hehe-layoutItem"
+                                                    size="4"
+                                                >
                                                     <lightning-output-field
-                                                        field-name="Order_Dealer_Info__c"></lightning-output-field>
+                                                        field-name="Order_Dealer_Info__c"
+                                                    ></lightning-output-field>
                                                 </lightning-layout-item>
                                             </lightning-layout>
                                         </template>
 
                                         <!-- 瀹㈡埛鍚� 鍙戠エ-->
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
-                                            
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                <lightning-output-field class="hideHelpText"
-                                                    field-name="ShipmentAccount__c"></lightning-output-field>
-                                            </lightning-layout-item>
-                                            
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                <lightning-input-field data-field={ConInvoice_Code__c}
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
+                                                <lightning-output-field
+                                                    class="hideHelpText"
+                                                    field-name="ShipmentAccount__c"
+                                                ></lightning-output-field>
+                                            </lightning-layout-item>
+
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
+
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
+                                                <lightning-input-field
+                                                    data-field={ConInvoice_Code__c}
                                                     onchange={invoiceChange}
-                                                    field-name="ConInvoice_Code__c"></lightning-input-field>
+                                                    field-name="ConInvoice_Code__c"
+                                                ></lightning-input-field>
                                             </lightning-layout-item>
                                         </lightning-layout>
 
                                         <!-- 绉戝 鍑哄簱閲戦 -->
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
                                                 <lightning-output-field
-                                                    field-name="Order_ForCustomerText__c"></lightning-output-field>
+                                                    field-name="Order_ForCustomerText__c"
+                                                ></lightning-output-field>
                                             </lightning-layout-item>
 
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
                                                 <lightning-output-field
-                                                    field-name="Shipment_total_amount__c"></lightning-output-field>
+                                                    field-name="Shipment_total_amount__c"
+                                                ></lightning-output-field>
                                             </lightning-layout-item>
                                         </lightning-layout>
 
                                         <!-- 娌℃湁纭畾浠锋牸 -->
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
                                                 <lightning-output-field
-                                                    field-name="NoConfirmedPrice__c"></lightning-output-field>
+                                                    field-name="NoConfirmedPrice__c"
+                                                ></lightning-output-field>
                                             </lightning-layout-item>
                                         </lightning-layout>
                                     </lightning-record-edit-form>
                                 </template>
 
                                 <!-- SummonsStatus_c__c != '浠锋牸鏈畾' -->
-                                <template if:false={summonsStatusPriceNotDetermined}>
-                                    <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
-                                        onsubmit={handleSubmit} onload={handleLoad}>
+                                <template
+                                    if:false={summonsStatusPriceNotDetermined}
+                                >
+                                    <lightning-record-edit-form
+                                        object-api-name="Consumable_order__c"
+                                        record-id={cocId}
+                                        onsubmit={handleSubmit}
+                                        onload={handleLoad}
+                                    >
                                         <!-- 鍑哄簱鍗曞彿 鍑哄簱鍗曠姸鎬� -->
                                         <lightning-layout multiple-rows="true">
                                             <template if:true={isSummonsFlag}>
-                                                <lightning-layout-item size="1"></lightning-layout-item>
+                                                <lightning-layout-item
+                                                    size="1"
+                                                ></lightning-layout-item>
 
-                                                <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                    <lightning-output-field field-name="Name"></lightning-output-field>
+                                                <lightning-layout-item
+                                                    class="hehe-layoutItem"
+                                                    size="4"
+                                                >
+                                                    <lightning-output-field
+                                                        field-name="Name"
+                                                    ></lightning-output-field>
                                                 </lightning-layout-item>
 
-                                                <lightning-layout-item size="1"></lightning-layout-item>
+                                                <lightning-layout-item
+                                                    size="1"
+                                                ></lightning-layout-item>
 
-                                                <lightning-layout-item class="hehe-layoutItem" size="4">
+                                                <lightning-layout-item
+                                                    class="hehe-layoutItem"
+                                                    size="4"
+                                                >
                                                     <lightning-output-field
-                                                        field-name="SummonsStatus_c__c"></lightning-output-field>
+                                                        field-name="SummonsStatus_c__c"
+                                                    ></lightning-output-field>
                                                 </lightning-layout-item>
                                             </template>
                                         </lightning-layout>
 
                                         <!-- 鐩殑   浜岀骇缁忛攢鍟� -->
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                <lightning-input-field data-field="summonsForDirction"
-                                                    value={summonsForDirction} field-name="SummonsForDirction__c"
-                                                    required="true" onchange={ChangeDirction}></lightning-input-field>
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
+                                                <lightning-input-field
+                                                    data-field="summonsForDirction"
+                                                    value={summonsForDirction}
+                                                    field-name="SummonsForDirction__c"
+                                                    required="true"
+                                                    onchange={ChangeDirction}
+                                                ></lightning-input-field>
                                             </lightning-layout-item>
 
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                <lightning-combobox data-field="secondaryDistributor"
-                                                    name="secondaryDistributor" label="浜岀骇缁忛攢鍟�"
-                                                    value={secondaryDistributor} placeholder="璇烽�夋嫨..."
-                                                    options={secondaryDistributorOptions} variant="label-inline"
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
+                                                <lightning-combobox
+                                                    data-field="secondaryDistributor"
+                                                    name="secondaryDistributor"
+                                                    label="浜岀骇缁忛攢鍟�"
+                                                    value={secondaryDistributor}
+                                                    placeholder="璇烽�夋嫨..."
+                                                    options={secondaryDistributorOptions}
+                                                    variant="label-inline"
                                                     onchange={dataChange}
-                                                    disabled={isDisabledSecondaryDistributor}></lightning-combobox>
+                                                    disabled={isDisabledSecondaryDistributor}
+                                                ></lightning-combobox>
                                             </lightning-layout-item>
                                         </lightning-layout>
 
                                         <!-- 瀹㈡埛鍚�   缁忛攢鍟嗗綍鍏� -->
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
                                                 <div
-                                                    class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right">
-                                                    <lightning-icon size="x-small"
+                                                    class="slds-form-element__control slds-input-has-icon slds-input-has-icon_right"
+                                                >
+                                                    <lightning-icon
+                                                        size="x-small"
                                                         class="iconMargin slds-icon slds-input__icon slds-input__icon_right slds-icon-text-default"
-                                                        icon-name="utility:search"></lightning-icon>
-                                                    <lightning-input type="text" name="HospitalName" label="瀹㈡埛鍚�"
-                                                        value={HospitalName} variant="label-inline"
-                                                        onclick={searchHospitalNameModal} data-field="HospitalName"
+                                                        icon-name="utility:search"
+                                                    ></lightning-icon>
+                                                    <lightning-input
+                                                        type="text"
+                                                        name="HospitalName"
+                                                        label="瀹㈡埛鍚�"
+                                                        value={HospitalName}
+                                                        variant="label-inline"
+                                                        onclick={searchHospitalNameModal}
+                                                        data-field="HospitalName"
                                                         disabled={isDisabledHospitalName}
-                                                        onchange={clearAgencyI}></lightning-input>
+                                                        onchange={clearAgencyI}
+                                                    ></lightning-input>
                                                 </div>
                                             </lightning-layout-item>
 
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                <template if:true={isMutualTransferGoods}>
-                                                    <c-lex-lookup onsearch={handleSearch}
-                                                        onselectionchange={handleSelectionChange} label="缁忛攢鍟�(褰曞叆)"
-                                                        variant="label-inline" placeholder="鎼滅储缁忛攢鍟�"
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
+                                                <template
+                                                    if:true={isMutualTransferGoods}
+                                                >
+                                                    <c-lex-lookup
+                                                        onsearch={handleSearch}
+                                                        onselectionchange={handleSelectionChange}
+                                                        label="缁忛攢鍟�(褰曞叆)"
+                                                        variant="label-inline"
+                                                        placeholder="鎼滅储缁忛攢鍟�"
                                                         onisdisabledfordealertext={isDisabledForDealerText}
-                                                        onblur={vpClear2Delay} disabled={isDisabledForDealerText}>
+                                                        onblur={vpClear2Delay}
+                                                        disabled={isDisabledForDealerText}
+                                                    >
                                                     </c-lex-lookup>
                                                 </template>
-                                                <template if:false={isMutualTransferGoods}>
-                                                    <lightning-input type="text" name="Order_ForDealerText__c"
-                                                        label="缁忛攢鍟�(褰曞叆)" value={ForDealerText} onchange={dataChange}
+                                                <template
+                                                    if:false={isMutualTransferGoods}
+                                                >
+                                                    <lightning-input
+                                                        type="text"
+                                                        name="Order_ForDealerText__c"
+                                                        label="缁忛攢鍟�(褰曞叆)"
+                                                        value={ForDealerText}
+                                                        onchange={dataChange}
                                                         data-field="Order_ForDealerText__c"
-                                                        disabled={isDisabledForDealerText} variant="label-inline">
+                                                        disabled={isDisabledForDealerText}
+                                                        variant="label-inline"
+                                                    >
                                                     </lightning-input>
                                                 </template>
                                             </lightning-layout-item>
@@ -385,32 +639,60 @@
 
                                         <!-- 绉戝   鎬婚噾棰� -->
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                <lightning-input-field onchange={dataChange}
-                                                    data-field="ForCustomerText" value={ForCustomerText}
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
+                                                <lightning-input-field
+                                                    onchange={dataChange}
+                                                    data-field="ForCustomerText"
+                                                    value={ForCustomerText}
                                                     field-name="Order_ForCustomerText__c"
-                                                    disabled={isDisabledForCustomerText}></lightning-input-field>
+                                                    disabled={isDisabledForCustomerText}
+                                                ></lightning-input-field>
                                             </lightning-layout-item>
 
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                <lightning-input type="text" name="sumPrice" label="鎬婚噾棰�"
-                                                    value={sumPrice} variant="label-inline" onchange={dataChange}
-                                                    data-field="sumPrice" readonly></lightning-input>
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
+                                                <lightning-input
+                                                    type="text"
+                                                    name="sumPrice"
+                                                    label="鎬婚噾棰�"
+                                                    value={sumPrice}
+                                                    variant="label-inline"
+                                                    onchange={dataChange}
+                                                    data-field="sumPrice"
+                                                    readonly
+                                                ></lightning-input>
                                             </lightning-layout-item>
                                         </lightning-layout>
 
                                         <!-- 娌℃湁纭畾浠锋牸 -->
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
-                                            <lightning-layout-item class="hehe-layoutItem" size="4">
-                                                <lightning-input-field value={NoConfirmedPrice}
-                                                    field-name="NoConfirmedPrice__c" data-field="NoConfirmedPrice"
-                                                    onchange={dataChange}></lightning-input-field>
+                                            <lightning-layout-item
+                                                class="hehe-layoutItem"
+                                                size="4"
+                                            >
+                                                <lightning-input-field
+                                                    value={NoConfirmedPrice}
+                                                    field-name="NoConfirmedPrice__c"
+                                                    data-field="NoConfirmedPrice"
+                                                    onchange={dataChange}
+                                                ></lightning-input-field>
                                             </lightning-layout-item>
                                         </lightning-layout>
                                     </lightning-record-edit-form>
@@ -431,100 +713,146 @@
                         <div style="padding: 10px">
                             <div lwc:dom="manual" class="resultDiv"></div>
                             <div draggable="false">
-                                <lightning-record-edit-form object-api-name="Consumable_order__c" record-id={cocId}
-                                    onload={handleLoad2}>
+                                <lightning-record-edit-form
+                                    object-api-name="Consumable_order__c"
+                                    record-id={cocId}
+                                    onload={handleLoad2}
+                                >
                                     <!-- 鍑哄簱鍗曞彿 鍑哄簱鍗曠姸鎬� -->
                                     <lightning-layout multiple-rows="true">
                                         <template if:true={isSummonsFlag}>
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
                                             <lightning-layout-item size="4">
-                                                <lightning-output-field field-name="Name"
-                                                    class="hehe-layoutItem"></lightning-output-field>
+                                                <lightning-output-field
+                                                    field-name="Name"
+                                                    class="hehe-layoutItem"
+                                                ></lightning-output-field>
                                             </lightning-layout-item>
 
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
                                             <lightning-layout-item size="4">
-                                                <lightning-output-field field-name="SummonsStatus_c__c"
-                                                    class="hehe-layoutItem"></lightning-output-field>
+                                                <lightning-output-field
+                                                    field-name="SummonsStatus_c__c"
+                                                    class="hehe-layoutItem"
+                                                ></lightning-output-field>
                                             </lightning-layout-item>
                                         </template>
                                     </lightning-layout>
 
                                     <!-- 鐩殑   寮�绁ㄧ姸鎬� -->
                                     <lightning-layout multiple-rows="true">
-                                        <lightning-layout-item size="1"></lightning-layout-item>
+                                        <lightning-layout-item
+                                            size="1"
+                                        ></lightning-layout-item>
 
                                         <lightning-layout-item size="4">
-                                            <lightning-output-field field-name="SummonsForDirction__c"
-                                                class="hehe-layoutItem"></lightning-output-field>
+                                            <lightning-output-field
+                                                field-name="SummonsForDirction__c"
+                                                class="hehe-layoutItem"
+                                            ></lightning-output-field>
                                         </lightning-layout-item>
 
-                                        <lightning-layout-item size="1"></lightning-layout-item>
+                                        <lightning-layout-item
+                                            size="1"
+                                        ></lightning-layout-item>
 
                                         <lightning-layout-item size="4">
-                                            <lightning-output-field field-name="Billed_Status__c"
-                                                class="hehe-layoutItem"></lightning-output-field>
+                                            <lightning-output-field
+                                                field-name="Billed_Status__c"
+                                                class="hehe-layoutItem"
+                                            ></lightning-output-field>
                                         </lightning-layout-item>
                                     </lightning-layout>
 
                                     <!-- 浜岀骇缁忛攢鍟� -->
-                                    <template if:true={isSummonsForDirctionTwoShow}>
+                                    <template
+                                        if:true={isSummonsForDirctionTwoShow}
+                                    >
                                         <lightning-layout multiple-rows="true">
-                                            <lightning-layout-item size="1"></lightning-layout-item>
+                                            <lightning-layout-item
+                                                size="1"
+                                            ></lightning-layout-item>
 
                                             <lightning-layout-item size="4">
-                                                <lightning-output-field field-name="Order_Dealer_Info__c"
-                                                    class="hehe-layoutItem"></lightning-output-field>
+                                                <lightning-output-field
+                                                    field-name="Order_Dealer_Info__c"
+                                                    class="hehe-layoutItem"
+                                                ></lightning-output-field>
                                             </lightning-layout-item>
                                         </lightning-layout>
                                     </template>
 
                                     <!-- 瀹㈡埛鍚� 鍙戠エ-->
                                     <lightning-layout multiple-rows="true">
-                                        <lightning-layout-item size="1"></lightning-layout-item>
+                                        <lightning-layout-item
+                                            size="1"
+                                        ></lightning-layout-item>
 
                                         <lightning-layout-item size="4">
-                                            <lightning-output-field class="hideHelpText"
-                                                field-name="ShipmentAccount__c"></lightning-output-field>
+                                            <lightning-output-field
+                                                class="hideHelpText"
+                                                field-name="ShipmentAccount__c"
+                                            ></lightning-output-field>
                                         </lightning-layout-item>
 
-                                        <lightning-layout-item size="1"></lightning-layout-item>
+                                        <lightning-layout-item
+                                            size="1"
+                                        ></lightning-layout-item>
 
                                         <template if:true={isConInvoiceShow}>
                                             <lightning-layout-item size="4">
-                                                <lightning-input-field data-field={ConInvoice_Code__c}
-                                                    onchange={invoiceChange} field-name="ConInvoice_Code__c"
-                                                    class="hehe-layoutItem"></lightning-input-field>
+                                                <lightning-input-field
+                                                    data-field={ConInvoice_Code__c}
+                                                    onchange={invoiceChange}
+                                                    field-name="ConInvoice_Code__c"
+                                                    class="hehe-layoutItem"
+                                                ></lightning-input-field>
                                             </lightning-layout-item>
                                         </template>
                                     </lightning-layout>
 
                                     <!-- 绉戝 鍑哄簱閲戦 -->
                                     <lightning-layout multiple-rows="true">
-                                        <lightning-layout-item size="1"></lightning-layout-item>
+                                        <lightning-layout-item
+                                            size="1"
+                                        ></lightning-layout-item>
 
                                         <lightning-layout-item size="4">
-                                            <lightning-output-field field-name="Order_ForCustomerText__c"
-                                                class="hehe-layoutItem"></lightning-output-field>
+                                            <lightning-output-field
+                                                field-name="Order_ForCustomerText__c"
+                                                class="hehe-layoutItem"
+                                            ></lightning-output-field>
                                         </lightning-layout-item>
 
-                                        <lightning-layout-item size="1"></lightning-layout-item>
+                                        <lightning-layout-item
+                                            size="1"
+                                        ></lightning-layout-item>
 
                                         <lightning-layout-item size="4">
-                                            <lightning-output-field field-name="Shipment_total_amount__c"
-                                                class="hehe-layoutItem"></lightning-output-field>
+                                            <lightning-output-field
+                                                field-name="Shipment_total_amount__c"
+                                                class="hehe-layoutItem"
+                                            ></lightning-output-field>
                                         </lightning-layout-item>
                                     </lightning-layout>
 
                                     <!-- 娌℃湁纭畾浠锋牸 -->
                                     <lightning-layout multiple-rows="true">
-                                        <lightning-layout-item size="1"></lightning-layout-item>
+                                        <lightning-layout-item
+                                            size="1"
+                                        ></lightning-layout-item>
 
                                         <lightning-layout-item size="4">
-                                            <lightning-output-field field-name="NoConfirmedPrice__c"
-                                                class="hehe-layoutItem"></lightning-output-field>
+                                            <lightning-output-field
+                                                field-name="NoConfirmedPrice__c"
+                                                class="hehe-layoutItem"
+                                            ></lightning-output-field>
                                         </lightning-layout-item>
                                     </lightning-layout>
                                 </lightning-record-edit-form>
@@ -540,61 +868,153 @@
                             <div lwc:dom="manual" class="resultDiv"></div>
                             <div draggable="false">
                                 <lightning-layout multiple-rows>
-                                    <lightning-layout-item padding="around-small">
-                                        <div class="slds-grid slds-grid_vertical-align-center">
-                                            <div class="slds-form-element__label">娑堣�楀搧鍚嶇О</div>
-                                            <lightning-input type="text" name="consumableName" label="娑堣�楀搧鍚嶇О"
-                                                value={consumableName} variant="label-hidden" onchange={dataChange}
-                                                data-field="consumableName"></lightning-input>
-                                        </div>
-
-                                    </lightning-layout-item>
-                                    <lightning-layout-item padding="around-small">
-                                        <div class="slds-grid slds-grid_vertical-align-center">
-                                            <div class="slds-form-element__label" style="width:70px">绗�3鍒嗙被</div>
-                                            <lightning-combobox name="progress" label="绗�3鍒嗙被" value={Category3}
-                                                variant="label-hidden" options={category3Options} onchange={dataChange}
-                                                data-field="Category3" style="min-width: 185px;"></lightning-combobox>
+                                    <lightning-layout-item
+                                        padding="around-small"
+                                        flexibility="auto"
+                                    >
+                                        <div
+                                            class="slds-grid slds-grid_vertical-align-center"
+                                        >
+                                            <div
+                                                class="slds-form-element__label"
+                                            >
+                                                娑堣�楀搧鍚嶇О
+                                            </div>
+                                            <lightning-input
+                                                type="text"
+                                                name="consumableName"
+                                                label="娑堣�楀搧鍚嶇О"
+                                                value={consumableName}
+                                                variant="label-hidden"
+                                                onchange={dataChange}
+                                                data-field="consumableName"
+                                            ></lightning-input>
                                         </div>
                                     </lightning-layout-item>
-                                    <lightning-layout-item padding="around-small">
-                                        <div class="slds-grid slds-grid_vertical-align-center">
-                                            <div class="slds-form-element__label" style="width:70px">绗�4鍒嗙被</div>
-                                            <lightning-combobox name="progress" label="绗�4鍒嗙被" value={Category4}
-                                                variant="label-hidden" options={category4Options} onchange={dataChange}
-                                                data-field="Category4" style="min-width: 185px;"></lightning-combobox>
+                                    <lightning-layout-item
+                                        padding="around-small"
+                                        flexibility="auto"
+                                    >
+                                        <div
+                                            class="slds-grid slds-grid_vertical-align-center"
+                                        >
+                                            <div
+                                                class="slds-form-element__label"
+                                                style="width: 70px"
+                                            >
+                                                绗�3鍒嗙被
+                                            </div>
+                                            <lightning-combobox
+                                                name="progress"
+                                                label="绗�3鍒嗙被"
+                                                value={Category3}
+                                                variant="label-hidden"
+                                                options={category3Options}
+                                                onchange={dataChange}
+                                                data-field="Category3"
+                                                style="min-width: 160px"
+                                            ></lightning-combobox>
                                         </div>
-
                                     </lightning-layout-item>
-                                    <lightning-layout-item padding="around-small">
-                                        <div class="slds-grid slds-grid_vertical-align-center">
-                                            <div class="slds-form-element__label" style="width:70px">绗�5鍒嗙被</div>
-                                            <lightning-combobox name="progress" label="绗�5鍒嗙被" value={Category5}
-                                                variant="label-hidden" onchange={dataChange} data-field="Category5"
+                                    <lightning-layout-item
+                                        padding="around-small"
+                                        flexibility="auto"
+                                    >
+                                        <div
+                                            class="slds-grid slds-grid_vertical-align-center"
+                                        >
+                                            <div
+                                                class="slds-form-element__label"
+                                                style="width: 70px"
+                                            >
+                                                绗�4鍒嗙被
+                                            </div>
+                                            <lightning-combobox
+                                                name="progress"
+                                                label="绗�4鍒嗙被"
+                                                value={Category4}
+                                                variant="label-hidden"
+                                                options={category4Options}
+                                                onchange={dataChange}
+                                                data-field="Category4"
+                                                style="min-width: 160px"
+                                            ></lightning-combobox>
+                                        </div>
+                                    </lightning-layout-item>
+                                    <lightning-layout-item
+                                        padding="around-small"
+                                        flexibility="auto"
+                                    >
+                                        <div
+                                            class="slds-grid slds-grid_vertical-align-center"
+                                        >
+                                            <div
+                                                class="slds-form-element__label"
+                                                style="width: 70px"
+                                            >
+                                                绗�5鍒嗙被
+                                            </div>
+                                            <lightning-combobox
+                                                name="progress"
+                                                label="绗�5鍒嗙被"
+                                                value={Category5}
+                                                variant="label-hidden"
+                                                onchange={dataChange}
+                                                data-field="Category5"
                                                 options={category5Options}
-                                                style="min-width: 185px;"></lightning-combobox>
+                                                style="min-width: 160px"
+                                            ></lightning-combobox>
                                         </div>
-
                                     </lightning-layout-item>
                                     <template if:true={hasHosPro}>
-                                        <lightning-layout-item padding="around-small">
-                                            <div class="slds-grid slds-grid_vertical-align-center">
-                                                <div class="slds-form-element__label">鍖婚櫌鐗逛环</div>
-                                                <lightning-combobox name="progress" label="鍖婚櫌鐗逛环" value={outOutPattern}
-                                                    variant="label-hidden" options={outOutPatternOptionList}
-                                                    onchange={handleChange}></lightning-combobox>
+                                        <lightning-layout-item
+                                            padding="around-small"
+                                            flexibility="auto"
+                                        >
+                                            <div
+                                                class="slds-grid slds-grid_vertical-align-center"
+                                            >
+                                                <div
+                                                    class="slds-form-element__label"
+                                                >
+                                                    鍖婚櫌鐗逛环
+                                                </div>
+                                                <lightning-combobox
+                                                    name="progress"
+                                                    label="鍖婚櫌鐗逛环"
+                                                    value={outOutPattern}
+                                                    variant="label-hidden"
+                                                    options={outOutPatternOptionList}
+                                                    onchange={handleChange}
+                                                ></lightning-combobox>
                                             </div>
                                         </lightning-layout-item>
                                     </template>
 
-                                    <lightning-layout-item padding="around-small">
-                                        <div class="slds-grid slds-grid_vertical-align-center">
-                                            <lightning-button label="妫�绱�" onclick={searchProductJs}></lightning-button>
+                                    <lightning-layout-item
+                                        padding="around-small"
+                                        flexibility="auto"
+                                    >
+                                        <div
+                                            class="slds-grid slds-grid_vertical-align-center"
+                                        >
+                                            <lightning-button
+                                                label="妫�绱�"
+                                                onclick={searchProductJs}
+                                            ></lightning-button>
                                         </div>
                                     </lightning-layout-item>
-                                    <lightning-layout-item padding="around-small">
-                                        <div class="slds-grid slds-grid_vertical-align-center">
-                                            <lightning-button label="娓呯┖" onclick={ClearJs}></lightning-button>
+                                    <lightning-layout-item
+                                        padding="around-small"
+                                        flexibility="auto"
+                                    >
+                                        <div
+                                            class="slds-grid slds-grid_vertical-align-center"
+                                        >
+                                            <lightning-button
+                                                label="娓呯┖"
+                                                onclick={ClearJs}
+                                            ></lightning-button>
                                         </div>
                                     </lightning-layout-item>
                                 </lightning-layout>
@@ -613,23 +1033,83 @@
                     <div style="padding: 10px">
                         <template if:true={EditAble}>
                             <template if:true={showTable}>
-                                <c-lex-custom-lightning-datatable key-field="Id" data={data} columns={columns}
-                                    onunitchange={handleUnitChange} onshipmentnumber={handleShipmentNumber}
-                                    onshipmentunitprice={handleShipmentUnitPrice} onrowselection={getSelectedRows}
-                                    selected-rows={selectedRows} style="word-wrap:break-word; word-break:break-all; ">
+                                <c-lex-custom-lightning-datatable
+                                    key-field="Id"
+                                    data={data}
+                                    columns={columns}
+                                    onunitchange={handleUnitChange}
+                                    onshipmentnumber={handleShipmentNumber}
+                                    onshipmentunitprice={handleShipmentUnitPrice}
+                                    onrowselection={getSelectedRows}
+                                    selected-rows={selectedRows}
+                                    default-sort-direction={defaultSortDirection}
+                                    sorted-direction={sortDirection}
+                                    sorted-by={sortedBy}
+                                    onsort={onHandleSort}
+                                    style="
+                                        word-wrap: break-word;
+                                        word-break: break-all;
+                                    "
+                                >
                                 </c-lex-custom-lightning-datatable>
                             </template>
+                            <c-paginator
+                                onprevious={handlePrevious}
+                                onnext={handleNext}
+                                onpageschange={handlePageschange}
+                                onfirst={handleFirst}
+                                onlast={handleLast}
+                                page-size-options={pageSizeOptions}
+                                previous-button-disabled={previousButtonDisabled}
+                                next-button-disabled={nextButtonDisabled}
+                                record-start={recordStart}
+                                record-end={recordEnd}
+                                total-records={totalRecords}
+                            ></c-paginator>
                         </template>
 
                         <template if:false={EditAble}>
                             <template if:true={showTable}>
-                                <c-lex-custom-lightning-datatable hide-checkbox-column key-field="Id" data={data}
-                                    columns={editColumns} onunitchange={handleUnitChange}
+                                <c-lex-custom-lightning-datatable
+                                    hide-checkbox-column
+                                    key-field="Id"
+                                    data={editData}
+                                    columns={editColumns}
+                                    onunitchange={handleUnitChange}
                                     onshipmentnumber={handleShipmentNumber}
-                                    onshipmentunitprice={handleShipmentUnitPrice} onrowselection={getSelectedRows}
-                                    selected-rows={selectedRows} style="word-wrap:break-word; word-break:break-all; ">
+                                    onshipmentunitprice={handleShipmentUnitPrice}
+                                    onrowselection={getSelectedRows}
+                                    selected-rows={selectedRows}
+                                    default-sort-direction={defaultSortDirection}
+                                    sorted-direction={sortDirection}
+                                    sorted-by={sortedBy}
+                                    onsort={onHandleSort}
+                                    style="
+                                        word-wrap: break-word;
+                                        word-break: break-all;
+                                    "
+                                >
                                 </c-lex-custom-lightning-datatable>
+                                <c-paginator
+                                    onprevious={editHandlePrevious}
+                                    onnext={editHandleNext}
+                                    onpageschange={editHandlePageschange}
+                                    onfirst={editHandleFirst}
+                                    onlast={editHandleLast}
+                                    page-size-options={pageSizeOptions}
+                                    previous-button-disabled={previousButtonDisabled}
+                                    next-button-disabled={nextButtonDisabled}
+                                    record-start={recordStart}
+                                    record-end={recordEnd}
+                                    total-records={totalRecords}
+                                ></c-paginator>
                             </template>
+                        </template>
+
+                        <template if:true={isEditShowSpinner}>
+                            <lightning-spinner
+                                alternative-text="Uploading now"
+                            ></lightning-spinner>
                         </template>
                     </div>
                 </div>
@@ -643,8 +1123,12 @@
                             </p>
                         </div>
                         <div style="padding: 10px">
-                            <lightning-datatable key-field="id" data={consumableorderdetails2Records}
-                                columns={consumableorderdetails2RecordsColumns} hide-checkbox-column>
+                            <lightning-datatable
+                                key-field="id"
+                                data={consumableorderdetails2Records}
+                                columns={consumableorderdetails2RecordsColumns}
+                                hide-checkbox-column
+                            >
                             </lightning-datatable>
                         </div>
                     </div>
@@ -662,7 +1146,10 @@
                             <div lwc:dom="manual" class="resultDiv"></div>
                             <div draggable="false">
                                 <lightning-card title="">
-                                    <lightning-layout multiple-rows="true" style="margin-top: -20px">
+                                    <lightning-layout
+                                        multiple-rows="true"
+                                        style="margin-top: -20px"
+                                    >
                                         <!-- <lightning-layout-item size="12">
                                             <lightning-input label="" name="file uploader" onchange={handleFilesChange}
                                                 type="file" accept={acceptedType}></lightning-input><br />
@@ -676,16 +1163,27 @@
                                         </lightning-layout-item> -->
                                         <lightning-layout-item size="5">
                                         </lightning-layout-item>
-                                        <lightning-layout-item padding="around-small">
-                                            <lightning-button label='涓婁紶闄勪欢' onclick={uploadOrder}></lightning-button>
+                                        <lightning-layout-item
+                                            padding="around-small"
+                                        >
+                                            <lightning-button
+                                                label="涓婁紶闄勪欢"
+                                                onclick={uploadOrder}
+                                            ></lightning-button>
                                         </lightning-layout-item>
                                     </lightning-layout>
                                     <template if:true={showLoadingSpinner}>
-                                        <lightning-spinner alternative-text="Uploading now"></lightning-spinner>
+                                        <lightning-spinner
+                                            alternative-text="Uploading now"
+                                        ></lightning-spinner>
                                     </template>
                                     <footer style="margin-top: 20px">
-                                        <lightning-datatable key-field="id" data={fileData} columns={fileColumns}
-                                            hide-checkbox-column>
+                                        <lightning-datatable
+                                            key-field="id"
+                                            data={fileData}
+                                            columns={fileColumns}
+                                            hide-checkbox-column
+                                        >
                                         </lightning-datatable>
                                     </footer>
                                 </lightning-card>
@@ -707,66 +1205,152 @@
                         <div lwc:dom="manual" class="resultDiv"></div>
                         <div draggable="false">
                             <lightning-layout multiple-rows="true">
-                                <lightning-layout-item class="hehe-layoutItem" size="4">
+                                <lightning-layout-item
+                                    class="hehe-layoutItem"
+                                    size="4"
+                                >
                                 </lightning-layout-item>
                                 <template if:true={isSales}>
-                                    <lightning-layout-item class="hehe-layoutItem" size="4">
-                                        <lightning-button label="閿�鍞�" onclick={SaveP}
-                                            style="margin-top:-10px"></lightning-button>
+                                    <lightning-layout-item
+                                        class="hehe-layoutItem"
+                                        size="4"
+                                    >
+                                        <lightning-button
+                                            label="閿�鍞�"
+                                            onclick={SaveP}
+                                            style="margin-top: -10px"
+                                        ></lightning-button>
                                     </lightning-layout-item>
                                 </template>
                                 <template if:false={isSales}>
-                                    <lightning-layout-item class="hehe-layoutItem" size="4">
-                                        <lightning-button label="鍑鸿揣" onclick={SaveE}></lightning-button>
+                                    <lightning-layout-item
+                                        class="hehe-layoutItem"
+                                        size="4"
+                                    >
+                                        <lightning-button
+                                            label="鍑鸿揣"
+                                            onclick={SaveE}
+                                        ></lightning-button>
                                     </lightning-layout-item>
                                 </template>
-                                <lightning-layout-item class="hehe-layoutItem" size="4">
+                                <lightning-layout-item
+                                    class="hehe-layoutItem"
+                                    size="4"
+                                >
                                 </lightning-layout-item>
                             </lightning-layout>
 
                             <template if:true={isShowInformation}>
-                                <div class="borderCss" style="margin-top: 5px;">
+                                <div class="borderCss" style="margin-top: 5px">
                                     <div class="headerDorderCss">
                                         <p style="font-size: 16px">
                                             <strong>鍑哄簱鍗曚俊鎭�</strong>
                                         </p>
                                     </div>
                                     <div style="padding: 10px">
-                                        <div lwc:dom="manual" class="resultDiv"></div>
+                                        <div
+                                            lwc:dom="manual"
+                                            class="resultDiv"
+                                        ></div>
                                         <div draggable="false">
-                                            <lightning-record-edit-form object-api-name="Consumable_order__c"
-                                                record-id={cocId} onload={handleLoad2}>
-                                                <lightning-layout multiple-rows="true">
-                                                    <lightning-layout-item size="3" padding="around-small">
+                                            <lightning-record-edit-form
+                                                object-api-name="Consumable_order__c"
+                                                record-id={cocId}
+                                                onload={handleLoad2}
+                                            >
+                                                <lightning-layout
+                                                    multiple-rows="true"
+                                                >
+                                                    <lightning-layout-item
+                                                        size="3"
+                                                        padding="around-small"
+                                                    >
                                                         <!-- <lightning-output-field field-name="Name"></lightning-output-field> -->
-                                                        <div class="slds-grid slds-grid_vertical-align-center">
-                                                            <div class="slds-form-element__label" style="padding: 0px;">鍑哄簱鍗曞彿锛�</div>
-                                                            <lightning-output-field field-name="Name" variant="label-hidden"></lightning-output-field>
+                                                        <div
+                                                            class="slds-grid slds-grid_vertical-align-center"
+                                                        >
+                                                            <div
+                                                                class="slds-form-element__label"
+                                                                style="
+                                                                    padding: 0px;
+                                                                "
+                                                            >
+                                                                鍑哄簱鍗曞彿锛�
+                                                            </div>
+                                                            <lightning-output-field
+                                                                field-name="Name"
+                                                                variant="label-hidden"
+                                                            ></lightning-output-field>
                                                         </div>
                                                     </lightning-layout-item>
-                                                    <lightning-layout-item size="4" padding="around-small">
+                                                    <lightning-layout-item
+                                                        size="4"
+                                                        padding="around-small"
+                                                    >
                                                         <!-- <lightning-output-field
                                                             field-name="ShipmentAccount__c" class="hideHelpText"></lightning-output-field> -->
-                                                            <div class="slds-grid slds-grid_vertical-align-center">
-                                                                <div class="slds-form-element__label" style="padding: 0px;">瀹㈡埛鍚嶏細</div>
-                                                                <lightning-output-field field-name="ShipmentAccount__c" variant="label-hidden"></lightning-output-field>
+                                                        <div
+                                                            class="slds-grid slds-grid_vertical-align-center"
+                                                        >
+                                                            <div
+                                                                class="slds-form-element__label"
+                                                                style="
+                                                                    padding: 0px;
+                                                                "
+                                                            >
+                                                                瀹㈡埛鍚嶏細
                                                             </div>
+                                                            <lightning-output-field
+                                                                field-name="ShipmentAccount__c"
+                                                                variant="label-hidden"
+                                                            ></lightning-output-field>
+                                                        </div>
                                                     </lightning-layout-item>
-                                                    <lightning-layout-item size="2" padding="around-small">
+                                                    <lightning-layout-item
+                                                        size="2"
+                                                        padding="around-small"
+                                                    >
                                                         <!-- <lightning-output-field
                                                             field-name="Order_ForCustomerText__c"></lightning-output-field> -->
-                                                            <div class="slds-grid slds-grid_vertical-align-center">
-                                                                <div class="slds-form-element__label" style="padding: 0px;">绉戝锛�</div>
-                                                                <lightning-output-field field-name="Order_ForCustomerText__c" variant="label-hidden"></lightning-output-field>
+                                                        <div
+                                                            class="slds-grid slds-grid_vertical-align-center"
+                                                        >
+                                                            <div
+                                                                class="slds-form-element__label"
+                                                                style="
+                                                                    padding: 0px;
+                                                                "
+                                                            >
+                                                                绉戝锛�
                                                             </div>
+                                                            <lightning-output-field
+                                                                field-name="Order_ForCustomerText__c"
+                                                                variant="label-hidden"
+                                                            ></lightning-output-field>
+                                                        </div>
                                                     </lightning-layout-item>
-                                                    <lightning-layout-item size="2" padding="around-small">
+                                                    <lightning-layout-item
+                                                        size="2"
+                                                        padding="around-small"
+                                                    >
                                                         <!-- <lightning-output-field
                                                             field-name="SummonsForDirction__c"></lightning-output-field> -->
-                                                            <div class="slds-grid slds-grid_vertical-align-center">
-                                                                <div class="slds-form-element__label" style="padding: 0px;">鐩殑锛�</div>
-                                                                <lightning-output-field field-name="SummonsForDirction__c" variant="label-hidden"></lightning-output-field>
+                                                        <div
+                                                            class="slds-grid slds-grid_vertical-align-center"
+                                                        >
+                                                            <div
+                                                                class="slds-form-element__label"
+                                                                style="
+                                                                    padding: 0px;
+                                                                "
+                                                            >
+                                                                鐩殑锛�
                                                             </div>
+                                                            <lightning-output-field
+                                                                field-name="SummonsForDirction__c"
+                                                                variant="label-hidden"
+                                                            ></lightning-output-field>
+                                                        </div>
                                                     </lightning-layout-item>
                                                 </lightning-layout>
                                             </lightning-record-edit-form>
@@ -782,31 +1366,63 @@
                                             </p>
                                         </div>
                                         <div style="padding: 10px">
-                                            <div lwc:dom="manual" class="resultDiv"></div>
+                                            <div
+                                                lwc:dom="manual"
+                                                class="resultDiv"
+                                            ></div>
                                             <div draggable="false">
-                                                <lightning-record-edit-form object-api-name="Consumable_order__c"
-                                                    record-id={cocId}>
-                                                    <lightning-layout multiple-rows="true">
-                                                        <lightning-layout-item size="1"></lightning-layout-item>
-                                                        <lightning-layout-item padding="around-small">
+                                                <lightning-record-edit-form
+                                                    object-api-name="Consumable_order__c"
+                                                    record-id={cocId}
+                                                >
+                                                    <lightning-layout
+                                                        multiple-rows="true"
+                                                    >
+                                                        <lightning-layout-item
+                                                            size="1"
+                                                        ></lightning-layout-item>
+                                                        <lightning-layout-item
+                                                            padding="around-small"
+                                                        >
                                                             <!-- <lightning-textarea name="Barcode" label="BarCode鍙�"
                                                                 onchange={dataChange} variant="label-inline"
                                                                 data-field="Barcode"
                                                                 value={Barcode}></lightning-textarea> -->
 
-                                                            <div class="slds-grid">
-                                                                <div class="slds-form-element__label">BarCode鍙�</div>
-                                                                <lightning-textarea name="Barcode" label="BarCode鍙�"
-                                                                    onchange={dataChange} variant="label-hidden"
-                                                                    data-field="Barcode" value={Barcode}
-                                                                    style="min-width: 400px;"></lightning-textarea>
+                                                            <div
+                                                                class="slds-grid"
+                                                            >
+                                                                <div
+                                                                    class="slds-form-element__label"
+                                                                >
+                                                                    BarCode鍙�
+                                                                </div>
+                                                                <lightning-textarea
+                                                                    name="Barcode"
+                                                                    label="BarCode鍙�"
+                                                                    onchange={dataChange}
+                                                                    variant="label-hidden"
+                                                                    data-field="Barcode"
+                                                                    value={Barcode}
+                                                                    style="
+                                                                        min-width: 400px;
+                                                                    "
+                                                                ></lightning-textarea>
                                                             </div>
                                                         </lightning-layout-item>
-                                                        <lightning-layout-item padding="around-small">
-                                                            <div class="slds-grid slds-grid_vertical-align-center">
-                                                                <div class="slds-form-element__label">
-                                                                    <lightning-button label="纭"
-                                                                        onclick={SalesearchProductJs}></lightning-button>
+                                                        <lightning-layout-item
+                                                            padding="around-small"
+                                                        >
+                                                            <div
+                                                                class="slds-grid slds-grid_vertical-align-center"
+                                                            >
+                                                                <div
+                                                                    class="slds-form-element__label"
+                                                                >
+                                                                    <lightning-button
+                                                                        label="纭"
+                                                                        onclick={SalesearchProductJs}
+                                                                    ></lightning-button>
                                                                 </div>
                                                             </div>
                                                         </lightning-layout-item>
@@ -824,11 +1440,21 @@
                                         </p>
                                     </div>
                                     <div style="padding: 10px">
-                                        <div lwc:dom="manual" class="resultDiv"></div>
+                                        <div
+                                            lwc:dom="manual"
+                                            class="resultDiv"
+                                        ></div>
                                         <div draggable="false">
-                                            <lightning-datatable key-field="id" data={salesData} columns={salesColumns}
+                                            <lightning-datatable
+                                                key-field="id"
+                                                data={salesData}
+                                                columns={salesColumns}
                                                 hide-checkbox-column
-                                                style="word-wrap:break-word; word-break:break-all; ">
+                                                style="
+                                                    word-wrap: break-word;
+                                                    word-break: break-all;
+                                                "
+                                            >
                                             </lightning-datatable>
                                         </div>
                                     </div>
@@ -841,30 +1467,58 @@
                                         </p>
                                     </div>
                                     <div style="padding: 10px">
-                                        <div lwc:dom="manual" class="resultDiv"></div>
+                                        <div
+                                            lwc:dom="manual"
+                                            class="resultDiv"
+                                        ></div>
                                         <div draggable="false">
-                                            <lightning-datatable key-field="id" data={salesErrorData}
-                                                columns={salesErrorColumns} hide-checkbox-column
-                                                style="word-wrap:break-word; word-break:break-all; ">
+                                            <lightning-datatable
+                                                key-field="id"
+                                                data={salesErrorData}
+                                                columns={salesErrorColumns}
+                                                hide-checkbox-column
+                                                style="
+                                                    word-wrap: break-word;
+                                                    word-break: break-all;
+                                                "
+                                            >
                                             </lightning-datatable>
                                         </div>
                                     </div>
                                 </div>
 
                                 <lightning-layout multiple-rows="true">
-                                    <lightning-layout-item class="hehe-layoutItem" size="4">
+                                    <lightning-layout-item
+                                        class="hehe-layoutItem"
+                                        size="4"
+                                    >
                                     </lightning-layout-item>
                                     <template if:true={isSales}>
-                                        <lightning-layout-item class="hehe-layoutItem" size="4">
-                                            <lightning-button label="閿�鍞�" onclick={SaveP}></lightning-button>
+                                        <lightning-layout-item
+                                            class="hehe-layoutItem"
+                                            size="4"
+                                        >
+                                            <lightning-button
+                                                label="閿�鍞�"
+                                                onclick={SaveP}
+                                            ></lightning-button>
                                         </lightning-layout-item>
                                     </template>
                                     <template if:false={isSales}>
-                                        <lightning-layout-item class="hehe-layoutItem" size="4">
-                                            <lightning-button label="鍑鸿揣" onclick={SaveE}></lightning-button>
+                                        <lightning-layout-item
+                                            class="hehe-layoutItem"
+                                            size="4"
+                                        >
+                                            <lightning-button
+                                                label="鍑鸿揣"
+                                                onclick={SaveE}
+                                            ></lightning-button>
                                         </lightning-layout-item>
                                     </template>
-                                    <lightning-layout-item class="hehe-layoutItem" size="4">
+                                    <lightning-layout-item
+                                        class="hehe-layoutItem"
+                                        size="4"
+                                    >
                                     </lightning-layout-item>
                                 </lightning-layout>
                             </template>
@@ -874,4 +1528,4 @@
             </template>
         </div>
     </div>
-</template>
\ No newline at end of file
+</template>
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
index faa4f1e..36f78d9 100644
--- a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
@@ -1,414 +1,418 @@
-import { LightningElement, wire, api, track } from "lwc";
-import init from "@salesforce/apex/LexSummonsCreatController.init";
-import { ShowToastEvent } from "lightning/platformShowToastEvent";
-import searchConsumableorderdetails from "@salesforce/apex/LexSummonsCreatController.searchConsumableorderdetails";
-import PraseToPDF from "@salesforce/apex/LexSummonsCreatController.PraseToPDF";
-import apexSearch from "@salesforce/apex/LexSummonsCreatController.search";
-import saveFile from "@salesforce/apex/LexSummonsCreatController.saveFile";
-import getFiles from "@salesforce/apex/LexSummonsCreatController.getFiles";
-import GoodsDelivery from "@salesforce/apex/LexSummonsCreatController.GoodsDelivery";
-import DelConsumable from "@salesforce/apex/LexSummonsCreatController.DelConsumable";
-import categoryAllload from "@salesforce/apex/LexSummonsCreatController.categoryAllload";
-import categoryload from "@salesforce/apex/LexSummonsCreatController.categoryload";
-import GoodsDeliveryInit from "@salesforce/apex/LexSaleOrderController.GoodsDeliveryInit";
-import SearchPro from "@salesforce/apex/LexSaleOrderController.SearchPro";
-import ProdElivery from "@salesforce/apex/LexSaleOrderController.ProdElivery";
-import ProSale from "@salesforce/apex/LexSaleOrderController.ProSale";
-import save from "@salesforce/apex/LexSummonsCreatController.save";
-import OPPORTUNITY_OBJECT from "@salesforce/schema/Consumable_Orderdetails__c";
-import { getObjectInfo } from "lightning/uiObjectInfoApi";
-import hospitalInit from "@salesforce/apex/lexSearchAgencyHospitalController.init";
-import serContact from "@salesforce/apex/lexSearchAgencyHospitalController.serContact";
-import { NavigationMixin } from "lightning/navigation";
+import { LightningElement, wire, api, track } from 'lwc';
+import init from '@salesforce/apex/LexSummonsCreatController.init';
+import { ShowToastEvent } from 'lightning/platformShowToastEvent';
+import searchConsumableorderdetails from '@salesforce/apex/LexSummonsCreatController.searchConsumableorderdetails';
+import PraseToPDF from '@salesforce/apex/LexSummonsCreatController.PraseToPDF';
+import apexSearch from '@salesforce/apex/LexSummonsCreatController.search';
+import saveFile from '@salesforce/apex/LexSummonsCreatController.saveFile';
+import getFiles from '@salesforce/apex/LexSummonsCreatController.getFiles';
+import GoodsDelivery from '@salesforce/apex/LexSummonsCreatController.GoodsDelivery';
+import DelConsumable from '@salesforce/apex/LexSummonsCreatController.DelConsumable';
+import categoryAllload from '@salesforce/apex/LexSummonsCreatController.categoryAllload';
+import categoryload from '@salesforce/apex/LexSummonsCreatController.categoryload';
+import GoodsDeliveryInit from '@salesforce/apex/LexSaleOrderController.GoodsDeliveryInit';
+import SearchPro from '@salesforce/apex/LexSaleOrderController.SearchPro';
+import ProdElivery from '@salesforce/apex/LexSaleOrderController.ProdElivery';
+import ProSale from '@salesforce/apex/LexSaleOrderController.ProSale';
+import save from '@salesforce/apex/LexSummonsCreatController.save';
+import OPPORTUNITY_OBJECT from '@salesforce/schema/Consumable_Orderdetails__c';
+import { getObjectInfo } from 'lightning/uiObjectInfoApi';
+import hospitalInit from '@salesforce/apex/lexSearchAgencyHospitalController.init';
+import serContact from '@salesforce/apex/lexSearchAgencyHospitalController.serContact';
+import { NavigationMixin } from 'lightning/navigation';
 
 export default class LexSummonsCreat extends NavigationMixin(LightningElement) {
     @track isShowSpinner = true;
+    @track isEditShowSpinner = false;
     @track showResults = true;
     @track results = [
         {
-            Id: "1",
-            Name: "z",
+            Id: '1',
+            Name: 'z'
         },
         {
-            Id: "2",
-            Name: "h",
+            Id: '2',
+            Name: 'h'
         },
         {
-            Id: "3",
-            Name: "j",
-        },
+            Id: '3',
+            Name: 'j'
+        }
     ];
 
     @track COLS = [
         {
-            label: "Account Name",
-            type: "customName",
+            label: 'Account Name',
+            type: 'customName',
             typeAttributes: {
-                accountName: { fieldName: "Name" },
-            },
-        },
+                accountName: { fieldName: 'Name' }
+            }
+        }
     ];
     @track columns = [
         {
-            label: "娑堣�楀搧鍚嶇О",
-            fieldName: "Name__c",
-            //hideDefaultActions: true,
+            label: '娑堣�楀搧鍚嶇О',
+            fieldName: 'Name__c',
+            hideDefaultActions: true,
             wrapText: true,
-            //initialWidth : 100,
+            initialWidth: 150,
+            sortable: true
         },
         {
-            label: "瑙勬牸",
-            fieldName: "packinglist",
+            label: '瑙勬牸',
+            fieldName: 'packinglist',
             //initialWidth : 50,
             wrapText: true,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "CFDA鐘舵��",
-            fieldName: "SFDA_Status__c",
+            label: 'CFDA鐘舵��',
+            fieldName: 'SFDA_Status__c',
             //initialWidth : 100,
             wrapText: true,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "娉ㄥ唽璇佺紪鐮佸彿",
-            fieldName: "approbation_No",
+            label: '娉ㄥ唽璇佺紪鐮佸彿',
+            fieldName: 'approbation_No',
             //initialWidth : 150,
             wrapText: true,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "娉ㄥ唽璇佹晥鏈�",
+            label: '娉ㄥ唽璇佹晥鏈�',
             //initialWidth : 100,
             wrapText: true,
-            fieldName: "expiration_Date",
-            hideDefaultActions: true,
+            fieldName: 'expiration_Date',
+            hideDefaultActions: true
         },
         {
-            label: "绗�3鍒嗙被",
-            fieldName: "Category3__c",
+            label: '绗�3鍒嗙被',
+            fieldName: 'Category3__c',
             //initialWidth : 100,
             wrapText: true,
             hideDefaultActions: true,
-            sortable: true,
+            sortable: true
         },
         {
-            label: "绗�4鍒嗙被",
-            fieldName: "Category4__c",
+            label: '绗�4鍒嗙被',
+            fieldName: 'Category4__c',
             //initialWidth : 100,
             wrapText: true,
             hideDefaultActions: true,
-            sortable: true,
+            sortable: true
         },
         {
-            label: "绗�5鍒嗙被",
-            fieldName: "Category5__c",
+            label: '绗�5鍒嗙被',
+            fieldName: 'Category5__c',
             //initialWidth : 100,
             wrapText: true,
             hideDefaultActions: true,
-            sortable: true,
+            sortable: true
         },
         {
-            label: "鍗曚綅",
-            type: "customUnit",
+            label: '鍗曚綅',
+            type: 'customUnit',
             //initialWidth : 100,
             hideDefaultActions: true,
             typeAttributes: {
-                unitValue: { fieldName: "unitValue" },
-                unitOptions: { fieldName: "unitOptions" },
-                recordId: { fieldName: "recordId" },
-            },
+                unitValue: { fieldName: 'unitValue' },
+                unitOptions: { fieldName: 'unitOptions' },
+                recordId: { fieldName: 'recordId' }
+            }
         },
         {
-            label: "鍑鸿揣鏁伴噺",
-            type: "customShipment",
+            label: '鍑鸿揣鏁伴噺',
+            type: 'customShipment',
             //initialWidth : 150,
             hideDefaultActions: true,
             typeAttributes: {
-                recordId: { fieldName: "recordId" },
-                shipmentNumber: { fieldName: "shipmentNumber" },
-            },
+                recordId: { fieldName: 'recordId' },
+                shipmentNumber: { fieldName: 'shipmentNumber' }
+            }
         },
         {
-            label: "鍑鸿揣鍗曚环(鍏�)",
-            type: "customShipmentUnitPrice",
+            label: '鍑鸿揣鍗曚环(鍏�)',
+            type: 'customShipmentUnitPrice',
             //initialWidth : 150,
             hideDefaultActions: true,
             typeAttributes: {
-                recordId: { fieldName: "recordId" },
-                shippingUnitPrice: { fieldName: "shippingUnitPrice" },
-            },
+                recordId: { fieldName: 'recordId' },
+                shippingUnitPrice: { fieldName: 'shippingUnitPrice' }
+            }
         },
         {
-            label: "鍑鸿揣閲戦(鍏�)",
-            type: "customShipmentAmount",
+            label: '鍑鸿揣閲戦(鍏�)',
+            type: 'customShipmentAmount',
             //initialWidth : 120,
             hideDefaultActions: true,
             typeAttributes: {
-                shipmentAmount: { fieldName: "shipmentAmount" },
-            },
+                shipmentAmount: { fieldName: 'shipmentAmount' }
+            }
         },
         {
-            label: "鏈夋晥鏈熷唴搴撳瓨(鐩�)",
-            fieldName: "Boxnumber",
+            label: '鏈夋晥鏈熷唴搴撳瓨(鐩�)',
+            fieldName: 'Boxnumber',
             //initialWidth : 120,
             wrapText: true,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "鏈夋晥鏈熷唴搴撳瓨(涓�)",
-            fieldName: "Piecenumber",
+            label: '鏈夋晥鏈熷唴搴撳瓨(涓�)',
+            fieldName: 'Piecenumber',
             //initialWidth : 120,
             wrapText: true,
-            hideDefaultActions: true,
-        },
+            hideDefaultActions: true
+        }
     ];
     @track editColumns = [
         {
-            label: "娑堣�楀搧鍚嶇О",
-            fieldName: "Name__c",
+            label: '娑堣�楀搧鍚嶇О',
+            fieldName: 'Name__c',
             hideDefaultActions: true,
             initialWidth: 250,
             wrapText: true,
+            sortable: true
         },
         {
-            label: "瑙勬牸",
-            fieldName: "packinglist",
+            label: '瑙勬牸',
+            fieldName: 'packinglist',
             initialWidth: 50,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "CFDA鐘舵��",
-            fieldName: "SFDA_Status__c",
+            label: 'CFDA鐘舵��',
+            fieldName: 'SFDA_Status__c',
             initialWidth: 100,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "娉ㄥ唽璇佺紪鐮佸彿",
-            fieldName: "approbation_No",
+            label: '娉ㄥ唽璇佺紪鐮佸彿',
+            fieldName: 'approbation_No',
             initialWidth: 150,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "娉ㄥ唽璇佹晥鏈�",
+            label: '娉ㄥ唽璇佹晥鏈�',
             initialWidth: 100,
-            fieldName: "expiration_Date",
-            hideDefaultActions: true,
+            fieldName: 'expiration_Date',
+            hideDefaultActions: true
         },
         {
-            label: "绗�3鍒嗙被",
-            fieldName: "Category3__c",
+            label: '绗�3鍒嗙被',
+            fieldName: 'Category3__c',
             initialWidth: 100,
             hideDefaultActions: true,
-            sortable: true,
+            sortable: true
         },
         {
-            label: "绗�4鍒嗙被",
-            fieldName: "Category4__c",
+            label: '绗�4鍒嗙被',
+            fieldName: 'Category4__c',
             initialWidth: 100,
             hideDefaultActions: true,
-            sortable: true,
+            sortable: true
         },
         {
-            label: "绗�5鍒嗙被",
-            fieldName: "Category5__c",
+            label: '绗�5鍒嗙被',
+            fieldName: 'Category5__c',
             initialWidth: 100,
             hideDefaultActions: true,
-            sortable: true,
+            sortable: true
         },
         {
-            label: "鍗曚綅",
-            fieldName: "Box_Piece__c",
+            label: '鍗曚綅',
+            fieldName: 'Box_Piece__c',
             initialWidth: 100,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "鍑鸿揣鏁伴噺",
-            fieldName: "Shipment_Count__c",
+            label: '鍑鸿揣鏁伴噺',
+            fieldName: 'Shipment_Count__c',
             initialWidth: 150,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "鍑鸿揣鍗曚环(鍏�)",
-            fieldName: "Shipment_amount__c",
-            type: "number",
+            label: '鍑鸿揣鍗曚环(鍏�)',
+            fieldName: 'Shipment_amount__c',
+            type: 'number',
             typeAttributes: {
-                minimumFractionDigits: 2,
+                minimumFractionDigits: 2
             },
             initialWidth: 150,
-            hideDefaultActions: true,
-        },
+            hideDefaultActions: true
+        }
     ];
+    @track editData = [];
 
     @track hospitalList = [];
     @track hospitalColumns = [
         {
-            label: "鍖婚櫌鍚嶇О",
-            fieldName: "Name",
+            label: '鍖婚櫌鍚嶇О',
+            fieldName: 'Name',
             initialWidth: 400,
-            hideDefaultActions: true,
+            hideDefaultActions: true
         },
         {
-            label: "鐪佷唤",
-            fieldName: "stateMasterName",
-            hideDefaultActions: true,
+            label: '鐪佷唤',
+            fieldName: 'stateMasterName',
+            hideDefaultActions: true
         },
         {
-            label: "閫夋嫨",
-            fieldName: "Id1",
-            type: "button",
+            label: '閫夋嫨',
+            fieldName: 'Id1',
+            type: 'button',
             hideDefaultActions: true,
             typeAttributes: {
-                label: "閫夋嫨",
-                name: "Id2",
-                size: 1,
-            },
-        },
+                label: '閫夋嫨',
+                name: 'Id2',
+                size: 1
+            }
+        }
     ];
 
-    @track accountid = "";
+    @track accountid = '';
     @track consumableproductdetailsRecords = [];
-    @track SummonsStatus = "";
-    @track ESetid = "";
-    @track statusEdit = "";
+    @track SummonsStatus = '';
+    @track ESetid = '';
+    @track statusEdit = '';
     @track cocLwc = {};
     @track selectedRows = [];
-    @track ConsumableOut_report = "";
+    @track ConsumableOut_report = '';
     @track isMutualTransferGoods = false;
-    @track Barcode = "";
+    @track Barcode = '';
     @track summonsForDirction = '';
 
     @track consumableorderdetails2RecordsColumns = [
         {
-            label: "娑堣�楀搧鍚嶇О",
-            fieldName: "ProdName",
-            hideDefaultActions: true,
+            label: '娑堣�楀搧鍚嶇О',
+            fieldName: 'ProdName',
+            hideDefaultActions: true
         },
         {
-            label: "鎵规鍙�",
-            fieldName: "orderdetails2SerialLotNo__c",
-            hideDefaultActions: true,
+            label: '鎵规鍙�',
+            fieldName: 'orderdetails2SerialLotNo__c',
+            hideDefaultActions: true
         },
         {
-            label: "绠$悊缂栫爜",
-            fieldName: "orderdetails2TracingCode__c",
-            hideDefaultActions: true,
+            label: '绠$悊缂栫爜',
+            fieldName: 'orderdetails2TracingCode__c',
+            hideDefaultActions: true
         },
         {
-            label: "浣跨敤鏈熼檺",
-            fieldName: "orderdetails2Sterilization_limit__c",
-            hideDefaultActions: true,
-        },
+            label: '浣跨敤鏈熼檺',
+            fieldName: 'orderdetails2Sterilization_limit__c',
+            hideDefaultActions: true
+        }
     ];
     @track consumableorderdetails2Records = [];
 
     //鍑鸿揣/閿�鍞�
     @track salesColumns = [
         {
-            label: "娑堣�楀搧璁㈠崟",
-            fieldName: "Consumable_order_minor__c",
+            label: '娑堣�楀搧璁㈠崟',
+            fieldName: 'Consumable_order_minor__c',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "娑堣�楀搧鏄庣粏2鍚嶇О",
-            fieldName: "orderdetails2NameUrl",
-            type: "url",
+            label: '娑堣�楀搧鏄庣粏2鍚嶇О',
+            fieldName: 'orderdetails2NameUrl',
+            type: 'url',
             typeAttributes: {
-                label: { fieldName: "orderdetails2Name" },
-                target: "_blank",
+                label: { fieldName: 'orderdetails2Name' },
+                target: '_blank'
             },
             hideDefaultActions: true,
             wrapText: true,
             initialWidth: 240
         },
         {
-            label: "鍗曚綅",
-            fieldName: "Box_Piece__c",
+            label: '鍗曚綅',
+            fieldName: 'Box_Piece__c',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "娑堣�楀搧鍚嶇О",
-            fieldName: "ProdName",
+            label: '娑堣�楀搧鍚嶇О',
+            fieldName: 'ProdName',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "鍙戣揣鏃ユ湡",
-            fieldName: "Deliver_date__c",
+            label: '鍙戣揣鏃ユ湡',
+            fieldName: 'Deliver_date__c',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "BarCode",
-            fieldName: "Bar_Code__c",
+            label: 'BarCode',
+            fieldName: 'Bar_Code__c',
             hideDefaultActions: true,
             wrapText: true,
             initialWidth: 500
         },
         {
-            label: "浣跨敤鏈熼檺",
-            fieldName: "Sterilization_limit__c",
+            label: '浣跨敤鏈熼檺',
+            fieldName: 'Sterilization_limit__c',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "鍑鸿揣鏁伴噺",
-            fieldName: "outboundCount",
+            label: '鍑鸿揣鏁伴噺',
+            fieldName: 'outboundCount',
             hideDefaultActions: true,
-            wrapText: true,
-        },
+            wrapText: true
+        }
     ];
     @track salesData = [];
 
     @track salesErrorColumns = [
         {
-            label: "娑堣�楀搧璁㈠崟",
-            fieldName: "Consumable_order_minor__c",
+            label: '娑堣�楀搧璁㈠崟',
+            fieldName: 'Consumable_order_minor__c',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "娑堣�楀搧鏄庣粏2鍚嶇О",
-            fieldName: "orderdetails2Name",
+            label: '娑堣�楀搧鏄庣粏2鍚嶇О',
+            fieldName: 'orderdetails2Name',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "娑堣�楀搧鍚嶇О",
-            fieldName: "ProdName",
+            label: '娑堣�楀搧鍚嶇О',
+            fieldName: 'ProdName',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "鍗曚綅",
-            fieldName: "Box_Piece__c",
+            label: '鍗曚綅',
+            fieldName: 'Box_Piece__c',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "BarCode",
-            fieldName: "Bar_Code__c",
-            hideDefaultActions: true,
+            label: 'BarCode',
+            fieldName: 'Bar_Code__c',
+            hideDefaultActions: true
         },
         {
-            label: "浣跨敤鏈熼檺",
-            fieldName: "Sterilization_limit__c",
+            label: '浣跨敤鏈熼檺',
+            fieldName: 'Sterilization_limit__c',
             hideDefaultActions: true,
-            wrapText: true,
+            wrapText: true
         },
         {
-            label: "閿欒鍘熷洜",
-            fieldName: "ErrorReason",
+            label: '閿欒鍘熷洜',
+            fieldName: 'ErrorReason',
             hideDefaultActions: true,
-            wrapText: true,
-        },
+            wrapText: true
+        }
     ];
     @track salesErrorData = [];
-    @track salesAccountName = "";
-    @track salesUserWorkLocation = "";
-    @track salesAccountid = "";
+    @track salesAccountName = '';
+    @track salesUserWorkLocation = '';
+    @track salesAccountid = '';
     @track salesOrderdetails = [];
     @track salesCoc = {};
     @track salesOrderpieceorboxMap;
@@ -441,55 +445,55 @@
     @track isDeleteDisabled = false;
 
     //鍑哄簱鍗曚俊鎭�
-    @track cocId = "";
+    @track cocId = '';
     @track EditAble = false;
     @track summonsStatusPriceNotDetermined = false;
     @track isSummonsForDirctionTwoShow = false;
     @track isSummonsFlag = false;
     @track isConInvoiceShow = false;
-    @track sumPrice = "";
+    @track sumPrice = '';
     @track isSearchShow = false;
     @track Existarrive = false;
-    @track Category3 = "";
+    @track Category3 = '';
     @track category3Options = [];
-    @track Category4 = "";
+    @track Category4 = '';
     @track category4Options = [];
-    @track Category5 = "";
+    @track Category5 = '';
     @track category5Options = [];
     //鍙戠エid
     @track invoiceId = '';
 
     //浜岀骇缁忛攢鍟�
-    @track secondaryDistributor = "";
+    @track secondaryDistributor = '';
     @track secondaryDistributorOptions = [];
     @track isDisabledSecondaryDistributor = false;
 
     //缁忛攢鍟嗗綍鍏�
-    @track ForDealerText = "";
+    @track ForDealerText = '';
     @track isDisabledForDealerText = false;
 
     //瀹㈡埛鍚�
     @track isModalOpen = false;
-    @track HospitalName = "";
-    @track searchHospitalName = "";
-    @track OECId = "";
+    @track HospitalName = '';
+    @track searchHospitalName = '';
+    @track OECId = '';
     @track isDisabledHospitalName = false;
 
     //绉戝
-    @track ForCustomerText = "";
+    @track ForCustomerText = '';
     @track isDisabledForCustomerText = false;
 
     //娌℃湁纭畾浠锋牸
     @track NoConfirmedPrice = false;
 
     //娑堣�楀搧鍚嶇О
-    @track consumableName = "";
+    @track consumableName = '';
 
-    @track agencyProType = "";
-    @track accountName = "";
-    @track userWorkLocation = "";
+    @track agencyProType = '';
+    @track accountName = '';
+    @track userWorkLocation = '';
     @track OutPattern__c = false;
-    @track outOutPattern = "";
+    @track outOutPattern = '';
 
     //鍑哄簱鍗曟槑缁�
     @track showTable = false;
@@ -497,37 +501,59 @@
     @track isSelectShow = false;
     @track hidecheckboxcolumn = false;
     @track is345Show = false;
-    @track arriveorder = "";
+    @track arriveorder = '';
     @track hasHosPro = false;
-    @track InvoiceProNotLabel = "";
-    @track RrturnProLabel = "";
-    @track InvoicedLabel = "";
+    @track InvoiceProNotLabel = '';
+    @track RrturnProLabel = '';
+    @track InvoicedLabel = '';
     @track outOutPatternOptionList = [];
 
     //鏂囦欢涓婁紶
     @track showLoadingSpinner = false;
-    @track UploadFile = "Upload File";
-    @track fileName = "";
+    @track UploadFile = 'Upload File';
+    @track fileName = '';
     @track fileData = [];
     @track fileColumns = [
         {
-            label: "鏍囬",
-            fieldName: "url",
-            type: "url",
-            typeAttributes: { label: { fieldName: "Title" }, target: "_blank" },
-            hideDefaultActions: true,
+            label: '鏍囬',
+            fieldName: 'url',
+            type: 'url',
+            typeAttributes: { label: { fieldName: 'Title' }, target: '_blank' },
+            hideDefaultActions: true
         },
         {
-            label: "鍒涘缓浜�",
-            fieldName: "CreatedByName",
-            hideDefaultActions: true,
-        },
+            label: '鍒涘缓浜�',
+            fieldName: 'CreatedByName',
+            hideDefaultActions: true
+        }
     ];
     filesUploaded = [];
     fileContents;
     fileReader;
     content;
     MAX_FILE_SIZE = 1500000;
+
+    //鍒嗛〉start
+    //@track sortBy = "";
+    //@track sortDirection = "asc";
+    defaultSortDirection = 'asc';
+    sortDirection = 'asc';
+    sortedBy;
+    @track pageSize = 5;
+    error;
+    records;
+    currentPageToken = 0;
+    nextPageToken = this.pageSize;
+    @track totalRecords = 0;
+    @track loader = false;
+    @track pageNumber = 1;
+    @track paginationVisibility = false;
+    @track totalPages = 1;
+    pageSizeOptions = [5, 10, 25, 50, 75, 100];
+    @track recordStart = 0;
+    @track recordEnd = 0;
+    //end
+    @track SearchDone = '';
 
     //InvoiceProNotLabel    RrturnProLabel  InvoicedLabel
     @wire(getObjectInfo, { objectApiName: OPPORTUNITY_OBJECT })
@@ -536,16 +562,16 @@
             this.InvoiceProNotLabel = data.fields.InvoiceProNot_count__c.label;
             this.RrturnProLabel = data.fields.RrturnPro_count__c.label;
             this.InvoicedLabel = data.fields.Invoiced_Procount__c.label;
-            console.log("this.InvoiceProNotLabel = " + this.InvoiceProNotLabel);
-            console.log("this.RrturnProLabel = " + this.RrturnProLabel);
-            console.log("this.InvoicedLabel = " + this.InvoicedLabel);
+            console.log('this.InvoiceProNotLabel = ' + this.InvoiceProNotLabel);
+            console.log('this.RrturnProLabel = ' + this.RrturnProLabel);
+            console.log('this.InvoicedLabel = ' + this.InvoicedLabel);
         }
     }
 
     //鑾峰彇閾炬帴鍙傛暟
     getQueryString(name) {
-        console.log("getQueryString name " + name);
-        let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+        console.log('getQueryString name ' + name);
+        let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
         let r = window.location.search.substr(1).match(reg);
         if (r != null) {
             return decodeURIComponent(r[2]);
@@ -553,414 +579,577 @@
         return null;
     }
     connectedCallback() {
-        console.log("connectedCallback LexSummonsCreat");
-        this.ESetid = this.getQueryString("ESetid");
-        this.ESetid = this.ESetid == null ? "" : this.ESetid;
+        console.log('connectedCallback LexSummonsCreat');
+        this.ESetid = this.getQueryString('ESetid');
+        this.ESetid = this.ESetid == null ? '' : this.ESetid;
         //statusEdit
-        this.statusEdit = this.getQueryString("KeyWords");
-        this.statusEdit = this.statusEdit == null ? "" : this.statusEdit;
-        console.log("this.ESetid = " + this.ESetid);
-        console.log("this.statusEdit = " + this.statusEdit);
-        if (this.ESetid == "") {
+        this.statusEdit = this.getQueryString('KeyWords');
+        this.statusEdit = this.statusEdit == null ? '' : this.statusEdit;
+        console.log('this.ESetid = ' + this.ESetid);
+        console.log('this.statusEdit = ' + this.statusEdit);
+        if (this.ESetid == '') {
             this.isShowInformation = false;
         }
-        console.log("init LexSummonsCreat");
+        console.log('init LexSummonsCreat');
         init({
             ESetidJs: this.ESetid,
-            statusEdit: this.statusEdit
-        }).then((r) => {
-            r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
+            statusEdit: this.statusEdit,
+            pageSizeLWC: this.pageSize,
+            pageTokenLWC: this.currentPageToken
+        })
+            .then((r) => {
+                r = JSON.parse(JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
 
-            if (r.status == "Success") {
+                if (r.status == 'Success') {
+                    //鍒嗛〉
+                    console.log(
+                        'r.entity.paginatedAccounts = ' +
+                            JSON.stringify(r.entity.paginatedAccounts)
+                    );
+                    this.nextPageToken =
+                        r.entity.paginatedAccounts.nextPageToken;
+                    this.totalRecords = r.entity.paginatedAccounts.totalRecords;
+                    this.recordStart = r.entity.paginatedAccounts.recordStart;
+                    this.recordEnd = r.entity.paginatedAccounts.recordEnd;
+                    this.totalPages = Math.ceil(
+                        r.entity.paginatedAccounts.totalRecords / this.pageSize
+                    );
+                    console.log('this.totalPages = ' + this.totalPages);
 
-                this.OECId = r.entity.HospitalInfo == null ? '' : r.entity.HospitalInfo;
-                console.log("this.OECId = " + this.OECId);
-                this.ConsumableOut_report = r.entity.ConsumableOut_report;
-                console.log("this.ConsumableOut_report = " + this.ConsumableOut_report);
-                this.accountid = r.entity.accountid;
-                this.consumableproductdetailsRecords =
-                    r.entity.consumableproductdetailsRecords;
-                this.accountName = r.entity.accountName;
-                this.agencyProType = r.entity.agencyProType;
-                this.accountName = r.entity.accountName;
-                this.userWorkLocation = r.entity.userWorkLocation;
-                this.EditAble = r.entity.EditAble;
-                this.consumableorderdetails2Records =
-                    r.entity.consumableorderdetails2Records;
-                for (var i in this.consumableorderdetails2Records) {
-                    this.consumableorderdetails2Records[i]["ProdName"] =
-                        this.consumableorderdetails2Records[i].Prod.Name;
-                    this.consumableorderdetails2Records[i][
-                        "orderdetails2SerialLotNo__c"
-                    ] =
-                        this.consumableorderdetails2Records[i].orderdetails2.SerialLotNo__c;
-                    this.consumableorderdetails2Records[i][
-                        "orderdetails2TracingCode__c"
-                    ] =
-                        this.consumableorderdetails2Records[i].orderdetails2.TracingCode__c;
-                    this.consumableorderdetails2Records[i][
-                        "orderdetails2Sterilization_limit__c"
-                    ] =
-                        this.consumableorderdetails2Records[
-                            i
-                        ].orderdetails2.Sterilization_limit__c;
-                }
-                this.isShowOutboundProductDetails =
-                    r.entity.consumableorderdetails2Count > 0 ? true : false;
-                console.log("this.agencyProType = " + this.agencyProType);
-                console.log("this.EditAble = " + this.EditAble);
-                //鏌ヨ闄勪欢
-                if (!this.EditAble) this.getFiles();
-                //绗�3鍒嗙被
-                for (var key in r.entity.categoryOptionMap) {
-                    let object = {};
-                    object["label"] = r.entity.categoryOptionMap[key];
-                    object["value"] = key;
-                    this.category3Options.push(object);
-                }
-                console.log("this.category3Options = " + JSON.stringify(this.category3Options));
-                //绗�4鍒嗙被
-                for (var key in r.entity.category4OptionMap) {
-                    let object = {};
-                    object["label"] = r.entity.category4OptionMap[key];
-                    object["value"] = key;
-                    this.category4Options.push(object);
-                }
-                console.log("this.category4Options = " + this.category4Options);
-                //绗�5鍒嗙被
-                for (var key in r.entity.category5OptionMap) {
-                    let object = {};
-                    object["label"] = r.entity.category5OptionMap[key];
-                    object["value"] = key;
-                    this.category5Options.push(object);
-                }
-                console.log("this.category5Options = " + this.category5Options);
-
-                this.data = r.entity.pageRecords;
-                console.log("this.data start = " + JSON.stringify(this.data));
-                for (var i in this.data) {
-                    let unitOptions = [];
-                    for (var key in this.data[i].boxorpieceMap) {
-                        let unitOption = {};
-                        unitOption["label"] = this.data[i].boxorpieceMap[key];
-                        unitOption["value"] = key;
-                        unitOptions.push(unitOption);
+                    this.OECId =
+                        r.entity.HospitalInfo == null
+                            ? ''
+                            : r.entity.HospitalInfo;
+                    console.log('this.OECId = ' + this.OECId);
+                    this.ConsumableOut_report = r.entity.ConsumableOut_report;
+                    console.log(
+                        'this.ConsumableOut_report = ' +
+                            this.ConsumableOut_report
+                    );
+                    this.accountid = r.entity.accountid;
+                    this.consumableproductdetailsRecords =
+                        r.entity.consumableproductdetailsRecords;
+                    this.accountName = r.entity.accountName;
+                    this.agencyProType = r.entity.agencyProType;
+                    this.accountName = r.entity.accountName;
+                    this.userWorkLocation = r.entity.userWorkLocation;
+                    this.EditAble = r.entity.EditAble;
+                    this.consumableorderdetails2Records =
+                        r.entity.consumableorderdetails2Records;
+                    for (var i in this.consumableorderdetails2Records) {
+                        this.consumableorderdetails2Records[i]['ProdName'] =
+                            this.consumableorderdetails2Records[i].Prod.Name;
+                        this.consumableorderdetails2Records[i][
+                            'orderdetails2SerialLotNo__c'
+                        ] =
+                            this.consumableorderdetails2Records[
+                                i
+                            ].orderdetails2.SerialLotNo__c;
+                        this.consumableorderdetails2Records[i][
+                            'orderdetails2TracingCode__c'
+                        ] =
+                            this.consumableorderdetails2Records[
+                                i
+                            ].orderdetails2.TracingCode__c;
+                        this.consumableorderdetails2Records[i][
+                            'orderdetails2Sterilization_limit__c'
+                        ] =
+                            this.consumableorderdetails2Records[
+                                i
+                            ].orderdetails2.Sterilization_limit__c;
                     }
-                    this.data[i]["unitOptions"] = unitOptions;
-                    this.data[i]["unitValue"] = this.data[i]["unitValue"] == null ? unitOptions[0].value : this.data[i]["unitValue"];
-                    if (this.EditAble) {
-                        this.data[i].orderdetails1["Box_Piece__c"] = this.data[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : this.data[i].orderdetails1["Box_Piece__c"];
-                        this.data[i].orderdetails1["Shipment_Count__c"] = this.data[i].orderdetails1["Shipment_Count__c"] == null ? 0 : this.data[i].orderdetails1["Shipment_Count__c"];
-                        this.data[i].orderdetails1["Delivery_List_RMB__c"] = this.data[i].orderdetails1["Delivery_List_RMB__c"] == null ? 0.0 : this.data[i].orderdetails1["Delivery_List_RMB__c"];
-                    } else {
-                        this.data[i]["InvoiceProNot_count__c"] =
-                            this.data[i].orderdetails1.InvoiceProNot_count__c;
-                        this.data[i]["RrturnPro_count__c"] =
-                            this.data[i].orderdetails1.RrturnPro_count__c;
-                        this.data[i]["Invoiced_Procount__c"] =
-                            this.data[i].orderdetails1.Invoiced_Procount__c;
-                    }
-                    // this.data[i]["shipmentNumber"] = 0;
-                    // this.data[i]["shippingUnitPrice"] = 0.0;
-                    //this.data[i]["shipmentNumber"] = this.data[i].orderdetails1["Shipment_Count__c"] == 0 ? '' : this.data[i].orderdetails1["Shipment_Count__c"];
-                    //this.data[i]["shippingUnitPrice"] = this.data[i].orderdetails1["Delivery_List_RMB__c"] == 0 ? '' : this.data[i].orderdetails1["Delivery_List_RMB__c"];
-                    this.data[i]["shipmentNumber"] = this.data[i].orderdetails1["Shipment_Count__c"];
-                    this.data[i]["shippingUnitPrice"] = this.data[i].orderdetails1["Delivery_List_RMB__c"];
-
-                    this.data[i]["recordId"] = this.data[i].Prod.Id;
-                    this.data[i]["Id"] = this.data[i].Prod.Id;
-                    this.data[i]["Name__c"] = this.data[i].Prod.Name__c;
-                    this.data[i]["SFDA_Status__c"] = this.data[i].Prod.SFDA_Status__c;
-                    this.data[i]["Category3__c"] = this.data[i].Prod.Category3__c;
-                    this.data[i]["Category4__c"] = this.data[i].Prod.Category4__c;
-                    this.data[i]["Category5__c"] = this.data[i].Prod.Category5__c;
-                    this.data[i]["Box_Piece__c"] = this.data[i].orderdetails1.Box_Piece__c;
-                    this.data[i]["shipmentAmount"] = this.data[i].orderdetails1.Shipment_amount__c;
-                    this.data[i]["Shipment_amount__c"] = this.data[i].orderdetails1.Shipment_amount__c;
-                    this.data[i]["Shipment_Count__c"] = this.data[i].orderdetails1.Shipment_Count__c;
-
-                    if (this.data[i]['check']) {
-                        this.selectedRows.push(this.data[i].Id);
-                    }
-
-                }
-                console.log("this.data = " + JSON.stringify(this.data));
-                //show
-                if (r.entity.EditDelCommitBtnDisabled || r.entity.EditAble) {
-                    this.isSaveShow = true;
-                } else {
-                    this.isEditShow = true;
-                    this.isDeliveryShow = true;
-                    this.isOpenToInvoiceShow = true;
-                    this.isPraseToPDFShow = true;
-                    this.isOpenReportShow = true;
-                    this.isDeleteShow = true;
-                }
-
-                this.Existarrive = r.entity.Existarrive;
-
-                console.log("this.EditAble = " + this.EditAble);
-                this.hasHosPro = r.entity.hasHosPro;
-                //disable
-
-                if (Object.values(r.entity.coc).length > 0) {
-                    this.cocLwc = r.entity.coc;
-                    console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
-                    var coc = r.entity.coc;
-                    this.cocId = coc.Id;
-                    console.log('cocId = ' + this.cocId);
-                    coc.SummonsStatus = coc.SummonsStatus_c__c;
-                    if (coc.SummonsStatus_c__c == "宸插畬鎴�") {
-                        this.isEditDisabled = true;
-                    }
-                    if (
-                        coc.SummonsStatus_c__c == "鎵瑰噯" ||
-                        coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" ||
-                        coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" ||
-                        coc.SummonsStatus_c__c == "宸插畬鎴�"
-                    ) {
-                        this.isDeliveryDisabled = true;
-                    }
-                    if (
-                        ((coc.Billed_Status__c != "鍏ㄩ儴寮�绁�" &&
-                            coc.SummonsStatus_c__c == "宸插畬鎴�") ||
-                            coc.Onchange_order__c == true) &&
-                        coc.SummonsForDirction__c != "浜掔浉璋冭揣"
-                    ) {
-                        this.isOpenToInvoiceDisabled = false;
-                    }
-                    if (
-                        coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" ||
-                        coc.SummonsStatus_c__c == "鎵瑰噯" ||
-                        coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" ||
-                        coc.SummonsStatus_c__c == "鑽夋涓�"
-                    ) {
-                        this.isPraseToPDFDisabled = false;
-                    }
-                    if (
-                        coc.Billed_Status__c != "杩樻病寮�绁�" ||
-                        coc.SummonsStatus_c__c == "宸插畬鎴�"
-                    ) {
-                        this.isOpenReportDisabled = false;
-                    }
-                    if (
-                        coc.SummonsStatus_c__c == "宸查攢鍞緟涓婁紶绾冲搧涔�" ||
-                        coc.SummonsStatus_c__c == "浠锋牸鏈畾" ||
-                        coc.SummonsStatus_c__c == "鎵瑰噯" ||
-                        coc.SummonsStatus_c__c == "鍑哄簱鍗曞凡鎵撳嵃" ||
-                        coc.SummonsStatus_c__c == "宸插畬鎴�"
-                    ) {
-                        this.isDeleteDisabled = true;
-                    }
-                    this.isConInvoiceShow =
-                        coc.SummonsStatus_c__c == "宸插畬鎴�" &&
-                            coc.SummonsForDirction__c != "浜掔浉璋冭揣"
+                    this.isShowOutboundProductDetails =
+                        r.entity.consumableorderdetails2Count > 0
                             ? true
                             : false;
-                    this.summonsStatusPriceNotDetermined =
-                        coc.SummonsStatus_c__c == "浠锋牸鏈畾" ? true : false;
-                    this.isSummonsForDirctionTwoShow =
-                        coc.SummonsForDirction__c == "閿�鍞粰浜岀骇缁忛攢鍟�" ? true : false;
-                }
-                this.isSearchShow =
-                    !this.Existarrive &&
-                        r.entity.coc.SummonsStatus_c__c != "浠锋牸鏈畾" &&
-                        r.entity.EditAble
-                        ? true
-                        : false;
-                this.hidecheckboxcolumn = !this.isSearchShow;
-                this.arriveorder = r.entity.arriveorder;
-                this.is345Show =
-                    this.arriveorder == "" && this.Existarrive == false && this.EditAble
-                        ? true
-                        : false;
-                //濡傛灉涓嶆樉绀�345鍒嗙被锛宑olumns閲岄潰鍒犻櫎3锛�4锛�5鍒嗙被
-                if (!this.is345Show) {
-                    for (var i = 0; i < this.columns.length; i++) {
-                        if (this.columns[i].label == "绗�3鍒嗙被") {
-                            this.columns.splice(i, 1);
-                        }
+                    console.log('this.agencyProType = ' + this.agencyProType);
+                    console.log('this.EditAble = ' + this.EditAble);
+                    //鏌ヨ闄勪欢
+                    if (!this.EditAble) this.getFiles();
+                    //绗�3鍒嗙被
+                    for (var key in r.entity.categoryOptionMap) {
+                        let object = {};
+                        object['label'] = r.entity.categoryOptionMap[key];
+                        object['value'] = key;
+                        this.category3Options.push(object);
                     }
-                    for (var i = 0; i < this.columns.length; i++) {
-                        if (this.columns[i].label == "绗�4鍒嗙被") {
-                            this.columns.splice(i, 1);
-                        }
+                    console.log(
+                        'this.category3Options = ' +
+                            JSON.stringify(this.category3Options)
+                    );
+                    //绗�4鍒嗙被
+                    for (var key in r.entity.category4OptionMap) {
+                        let object = {};
+                        object['label'] = r.entity.category4OptionMap[key];
+                        object['value'] = key;
+                        this.category4Options.push(object);
                     }
-                    for (var i = 0; i < this.columns.length; i++) {
-                        if (this.columns[i].label == "绗�5鍒嗙被") {
-                            this.columns.splice(i, 1);
-                        }
+                    console.log(
+                        'this.category4Options = ' + this.category4Options
+                    );
+                    //绗�5鍒嗙被
+                    for (var key in r.entity.category5OptionMap) {
+                        let object = {};
+                        object['label'] = r.entity.category5OptionMap[key];
+                        object['value'] = key;
+                        this.category5Options.push(object);
                     }
-                    for (var i = 0; i < this.editColumns.length; i++) {
-                        if (this.editColumns[i].label == "绗�3鍒嗙被") {
-                            this.editColumns.splice(i, 1);
-                        }
-                    }
-                    for (var i = 0; i < this.editColumns.length; i++) {
-                        if (this.editColumns[i].label == "绗�4鍒嗙被") {
-                            this.editColumns.splice(i, 1);
-                        }
-                    }
-                    for (var i = 0; i < this.editColumns.length; i++) {
-                        if (this.editColumns[i].label == "绗�5鍒嗙被") {
-                            this.editColumns.splice(i, 1);
-                        }
-                    }
-                }
-                //濡傛灉EditAble==false锛屽垹闄� 鍑鸿揣閲戦(鍏�) 鏈夋晥鏈熷唴搴撳瓨(鐩�) 鏈夋晥鏈熷唴搴撳瓨(涓�) 3鍒� 灞曠ず 杩樻病鍙戠エ鏁伴噺 杩斿搧鏁伴噺 宸插彂绁ㄦ暟閲�
-                //type : "number",
-                // typeAttributes:{
-                //     minimumFractionDigits:2,
-                // },
-                if (!this.EditAble) {
-                    let object1 = {
-                        label: this.InvoiceProNotLabel,
-                        fieldName: "InvoiceProNot_count__c",
-                        type: "number",
-                        typeAttributes: {
-                            minimumFractionDigits: 2,
-                        },
-                        hideDefaultActions: true,
-                    };
-                    let object2 = {
-                        label: this.RrturnProLabel,
-                        fieldName: "RrturnPro_count__c",
-                        hideDefaultActions: true,
-                    };
-                    let object3 = {
-                        label: this.InvoicedLabel,
-                        fieldName: "Invoiced_Procount__c",
-                        type: "number",
-                        typeAttributes: {
-                            minimumFractionDigits: 2,
-                        },
-                        hideDefaultActions: true,
-                    };
-                    this.editColumns.push(object1);
-                    this.editColumns.push(object2);
-                    this.editColumns.push(object3);
-                } else {
-                    this.ForCustomerText = this.cocLwc.Order_ForCustomerText__c;
-                    console.log('EditAble = true this.ForCustomerText = ' + this.ForCustomerText);
-                    this.summonsForDirction = this.cocLwc.SummonsForDirction__c;
-                    console.log('EditAble = true this.summonsForDirction = ' + this.summonsForDirction);
-                    let value = this.summonsForDirction;
-                    switch (value) {
-                        case "鐩存帴閿�鍞粰鍖婚櫌":
-                            this.isDisabledHospitalName = false;
-                            this.isDisabledForCustomerText = false;
-                            this.secondaryDistributor = "";
-                            this.ForDealerText = "";
-                            this.isDisabledForDealerText = true;
-                            this.isDisabledSecondaryDistributor = true;
-                            break;
-                        case "鍖婚櫌璇曠敤":
-                            this.isDisabledHospitalName = false;
-                            this.isDisabledForCustomerText = false;
-                            this.isDisabledForDealerText = false;
-                            this.isDisabledSecondaryDistributor = false;
-                            break;
-                        case "閿�鍞粰浜岀骇缁忛攢鍟�":
-                            this.isDisabledHospitalName = false;
-                            this.isDisabledForCustomerText = false;
-                            this.isDisabledForDealerText = false;
-                            this.isDisabledSecondaryDistributor = false;
-                            break;
-                        case "浜掔浉璋冭揣":
-                            this.isDisabledHospitalName = true;
-                            this.HospitalName = "";
-                            this.OECId = "";
-                            this.isDisabledForCustomerText = true;
-                            this.ForCustomerText = "";
-                            this.isDisabledForDealerText = false;
-                            this.isDisabledSecondaryDistributor = false;
-                            this.isMutualTransferGoods = true;
-                            break;
-                        default:
-                            this.isDisabledHospitalName = false;
-                            this.isDisabledForCustomerText = false;
-                            this.isDisabledForDealerText = false;
-                            this.isDisabledSecondaryDistributor = false;
-                    }
-                }
+                    console.log(
+                        'this.category5Options = ' + this.category5Options
+                    );
 
-                //濡傛灉hasHosPro = true 鍖婚櫌鐗逛环
-                if (this.hasHosPro) {
-                    let object1 = {
-                        label: "鍖婚櫌鐗逛环",
-                        fieldName: "InvoiceProNot_count__c",
-                        hideDefaultActions: true,
-                    };
-                    this.columns.push(object1);
-                    this.editColumns.push(object1);
+                    this.data = r.entity.pageRecords;
+                    this.editData = r.entity.pageRecords;
+                    console.log(
+                        'this.data start = ' + JSON.stringify(this.data)
+                    );
+                    if (this.EditAble) {
+                        for (var i in this.data) {
+                            let unitOptions = [];
+                            for (var key in this.data[i].boxorpieceMap) {
+                                let unitOption = {};
+                                unitOption['label'] =
+                                    this.data[i].boxorpieceMap[key];
+                                unitOption['value'] = key;
+                                unitOptions.push(unitOption);
+                            }
+                            this.data[i]['unitOptions'] = unitOptions;
+                            this.data[i]['unitValue'] =
+                                this.data[i]['unitValue'] == null
+                                    ? unitOptions[0].value
+                                    : this.data[i]['unitValue'];
+                            if (this.EditAble) {
+                                this.data[i].orderdetails1['Box_Piece__c'] =
+                                    this.data[i].orderdetails1[
+                                        'Box_Piece__c'
+                                    ] == null
+                                        ? unitOptions[0].value
+                                        : this.data[i].orderdetails1[
+                                              'Box_Piece__c'
+                                          ];
+                                this.data[i].orderdetails1[
+                                    'Shipment_Count__c'
+                                ] =
+                                    this.data[i].orderdetails1[
+                                        'Shipment_Count__c'
+                                    ] == null
+                                        ? 0
+                                        : this.data[i].orderdetails1[
+                                              'Shipment_Count__c'
+                                          ];
+                                this.data[i].orderdetails1[
+                                    'Delivery_List_RMB__c'
+                                ] =
+                                    this.data[i].orderdetails1[
+                                        'Delivery_List_RMB__c'
+                                    ] == null
+                                        ? 0.0
+                                        : this.data[i].orderdetails1[
+                                              'Delivery_List_RMB__c'
+                                          ];
+                            } else {
+                                this.data[i]['InvoiceProNot_count__c'] =
+                                    this.data[
+                                        i
+                                    ].orderdetails1.InvoiceProNot_count__c;
+                                this.data[i]['RrturnPro_count__c'] =
+                                    this.data[
+                                        i
+                                    ].orderdetails1.RrturnPro_count__c;
+                                this.data[i]['Invoiced_Procount__c'] =
+                                    this.data[
+                                        i
+                                    ].orderdetails1.Invoiced_Procount__c;
+                            }
+                            // this.data[i]["shipmentNumber"] = 0;
+                            // this.data[i]["shippingUnitPrice"] = 0.0;
+                            //this.data[i]["shipmentNumber"] = this.data[i].orderdetails1["Shipment_Count__c"] == 0 ? '' : this.data[i].orderdetails1["Shipment_Count__c"];
+                            //this.data[i]["shippingUnitPrice"] = this.data[i].orderdetails1["Delivery_List_RMB__c"] == 0 ? '' : this.data[i].orderdetails1["Delivery_List_RMB__c"];
+                            this.data[i]['shipmentNumber'] =
+                                this.data[i].orderdetails1['Shipment_Count__c'];
+                            this.data[i]['shippingUnitPrice'] =
+                                this.data[i].orderdetails1[
+                                    'Delivery_List_RMB__c'
+                                ];
+
+                            this.data[i]['recordId'] = this.data[i].Prod.Id;
+                            this.data[i]['Id'] = this.data[i].Prod.Id;
+                            this.data[i]['Name__c'] = this.data[i].Prod.Name__c;
+                            this.data[i]['SFDA_Status__c'] =
+                                this.data[i].Prod.SFDA_Status__c;
+                            this.data[i]['Category3__c'] =
+                                this.data[i].Prod.Category3__c;
+                            this.data[i]['Category4__c'] =
+                                this.data[i].Prod.Category4__c;
+                            this.data[i]['Category5__c'] =
+                                this.data[i].Prod.Category5__c;
+                            this.data[i]['Box_Piece__c'] =
+                                this.data[i].orderdetails1.Box_Piece__c;
+                            this.data[i]['shipmentAmount'] =
+                                this.data[i].orderdetails1.Shipment_amount__c;
+                            this.data[i]['Shipment_amount__c'] =
+                                this.data[i].orderdetails1.Shipment_amount__c;
+                            this.data[i]['Shipment_Count__c'] =
+                                this.data[i].orderdetails1.Shipment_Count__c;
+
+                            if (this.data[i]['check']) {
+                                this.selectedRows.push(this.data[i].Id);
+                            }
+                        }
+                    } else {
+                        for (var i in this.editData) {
+                            this.editData[i]['unitValue'] =
+                                this.editData[i]['unitValue'];
+                            this.editData[i]['InvoiceProNot_count__c'] =
+                                this.editData[
+                                    i
+                                ].orderdetails1.InvoiceProNot_count__c;
+                            this.editData[i]['RrturnPro_count__c'] =
+                                this.editData[
+                                    i
+                                ].orderdetails1.RrturnPro_count__c;
+                            this.editData[i]['Invoiced_Procount__c'] =
+                                this.editData[
+                                    i
+                                ].orderdetails1.Invoiced_Procount__c;
+                            this.editData[i]['shipmentNumber'] =
+                                this.editData[i].orderdetails1[
+                                    'Shipment_Count__c'
+                                ];
+                            this.editData[i]['shippingUnitPrice'] =
+                                this.editData[i].orderdetails1[
+                                    'Delivery_List_RMB__c'
+                                ];
+
+                            this.editData[i]['recordId'] =
+                                this.editData[i].Prod.Id;
+                            this.editData[i]['Id'] = this.editData[i].Prod.Id;
+                            this.editData[i]['Name__c'] =
+                                this.editData[i].Prod.Name__c;
+                            this.editData[i]['SFDA_Status__c'] =
+                                this.editData[i].Prod.SFDA_Status__c;
+                            this.editData[i]['Category3__c'] =
+                                this.editData[i].Prod.Category3__c;
+                            this.editData[i]['Category4__c'] =
+                                this.editData[i].Prod.Category4__c;
+                            this.editData[i]['Category5__c'] =
+                                this.editData[i].Prod.Category5__c;
+                            this.editData[i]['Box_Piece__c'] =
+                                this.editData[i].orderdetails1.Box_Piece__c;
+                            this.editData[i]['shipmentAmount'] =
+                                this.editData[
+                                    i
+                                ].orderdetails1.Shipment_amount__c;
+                            this.editData[i]['Shipment_amount__c'] =
+                                this.editData[
+                                    i
+                                ].orderdetails1.Shipment_amount__c;
+                            this.editData[i]['Shipment_Count__c'] =
+                                this.editData[
+                                    i
+                                ].orderdetails1.Shipment_Count__c;
+                        }
+                    }
+
+                    console.log('this.data = ' + JSON.stringify(this.data));
+                    //show
+                    if (
+                        r.entity.EditDelCommitBtnDisabled ||
+                        r.entity.EditAble
+                    ) {
+                        this.isSaveShow = true;
+                    } else {
+                        this.isEditShow = true;
+                        this.isDeliveryShow = true;
+                        this.isOpenToInvoiceShow = true;
+                        this.isPraseToPDFShow = true;
+                        this.isOpenReportShow = true;
+                        this.isDeleteShow = true;
+                    }
+
+                    this.Existarrive = r.entity.Existarrive;
+
+                    console.log('this.EditAble = ' + this.EditAble);
+                    this.hasHosPro = r.entity.hasHosPro;
+                    //disable
+
+                    if (Object.values(r.entity.coc).length > 0) {
+                        this.cocLwc = r.entity.coc;
+                        console.log(
+                            'this.cocLwc = ' + JSON.stringify(this.cocLwc)
+                        );
+                        var coc = r.entity.coc;
+                        this.cocId = coc.Id;
+                        console.log('cocId = ' + this.cocId);
+                        coc.SummonsStatus = coc.SummonsStatus_c__c;
+                        if (coc.SummonsStatus_c__c == '宸插畬鎴�') {
+                            this.isEditDisabled = true;
+                        }
+                        if (
+                            coc.SummonsStatus_c__c == '鎵瑰噯' ||
+                            coc.SummonsStatus_c__c == '宸查攢鍞緟涓婁紶绾冲搧涔�' ||
+                            coc.SummonsStatus_c__c == '鍑哄簱鍗曞凡鎵撳嵃' ||
+                            coc.SummonsStatus_c__c == '宸插畬鎴�'
+                        ) {
+                            this.isDeliveryDisabled = true;
+                        }
+                        if (
+                            ((coc.Billed_Status__c != '鍏ㄩ儴寮�绁�' &&
+                                coc.SummonsStatus_c__c == '宸插畬鎴�') ||
+                                coc.Onchange_order__c == true) &&
+                            coc.SummonsForDirction__c != '浜掔浉璋冭揣'
+                        ) {
+                            this.isOpenToInvoiceDisabled = false;
+                        }
+                        if (
+                            coc.SummonsStatus_c__c == '宸查攢鍞緟涓婁紶绾冲搧涔�' ||
+                            coc.SummonsStatus_c__c == '鎵瑰噯' ||
+                            coc.SummonsStatus_c__c == '鍑哄簱鍗曞凡鎵撳嵃' ||
+                            coc.SummonsStatus_c__c == '鑽夋涓�'
+                        ) {
+                            this.isPraseToPDFDisabled = false;
+                        }
+                        if (
+                            coc.Billed_Status__c != '杩樻病寮�绁�' ||
+                            coc.SummonsStatus_c__c == '宸插畬鎴�'
+                        ) {
+                            this.isOpenReportDisabled = false;
+                        }
+                        if (
+                            coc.SummonsStatus_c__c == '宸查攢鍞緟涓婁紶绾冲搧涔�' ||
+                            coc.SummonsStatus_c__c == '浠锋牸鏈畾' ||
+                            coc.SummonsStatus_c__c == '鎵瑰噯' ||
+                            coc.SummonsStatus_c__c == '鍑哄簱鍗曞凡鎵撳嵃' ||
+                            coc.SummonsStatus_c__c == '宸插畬鎴�'
+                        ) {
+                            this.isDeleteDisabled = true;
+                        }
+                        this.isConInvoiceShow =
+                            coc.SummonsStatus_c__c == '宸插畬鎴�' &&
+                            coc.SummonsForDirction__c != '浜掔浉璋冭揣'
+                                ? true
+                                : false;
+                        this.summonsStatusPriceNotDetermined =
+                            coc.SummonsStatus_c__c == '浠锋牸鏈畾' ? true : false;
+                        this.isSummonsForDirctionTwoShow =
+                            coc.SummonsForDirction__c == '閿�鍞粰浜岀骇缁忛攢鍟�'
+                                ? true
+                                : false;
+                    }
+                    this.isSearchShow =
+                        !this.Existarrive &&
+                        r.entity.coc.SummonsStatus_c__c != '浠锋牸鏈畾' &&
+                        r.entity.EditAble
+                            ? true
+                            : false;
+                    this.hidecheckboxcolumn = !this.isSearchShow;
+                    this.arriveorder = r.entity.arriveorder;
+                    this.is345Show =
+                        this.arriveorder == '' &&
+                        this.Existarrive == false &&
+                        this.EditAble
+                            ? true
+                            : false;
+                    //濡傛灉涓嶆樉绀�345鍒嗙被锛宑olumns閲岄潰鍒犻櫎3锛�4锛�5鍒嗙被
+                    if (!this.is345Show) {
+                        for (var i = 0; i < this.columns.length; i++) {
+                            if (this.columns[i].label == '绗�3鍒嗙被') {
+                                this.columns.splice(i, 1);
+                            }
+                        }
+                        for (var i = 0; i < this.columns.length; i++) {
+                            if (this.columns[i].label == '绗�4鍒嗙被') {
+                                this.columns.splice(i, 1);
+                            }
+                        }
+                        for (var i = 0; i < this.columns.length; i++) {
+                            if (this.columns[i].label == '绗�5鍒嗙被') {
+                                this.columns.splice(i, 1);
+                            }
+                        }
+                        for (var i = 0; i < this.editColumns.length; i++) {
+                            if (this.editColumns[i].label == '绗�3鍒嗙被') {
+                                this.editColumns.splice(i, 1);
+                            }
+                        }
+                        for (var i = 0; i < this.editColumns.length; i++) {
+                            if (this.editColumns[i].label == '绗�4鍒嗙被') {
+                                this.editColumns.splice(i, 1);
+                            }
+                        }
+                        for (var i = 0; i < this.editColumns.length; i++) {
+                            if (this.editColumns[i].label == '绗�5鍒嗙被') {
+                                this.editColumns.splice(i, 1);
+                            }
+                        }
+                    }
+                    //濡傛灉EditAble==false锛屽垹闄� 鍑鸿揣閲戦(鍏�) 鏈夋晥鏈熷唴搴撳瓨(鐩�) 鏈夋晥鏈熷唴搴撳瓨(涓�) 3鍒� 灞曠ず 杩樻病鍙戠エ鏁伴噺 杩斿搧鏁伴噺 宸插彂绁ㄦ暟閲�
+                    //type : "number",
+                    // typeAttributes:{
+                    //     minimumFractionDigits:2,
+                    // },
+                    if (!this.EditAble) {
+                        let object1 = {
+                            label: this.InvoiceProNotLabel,
+                            fieldName: 'InvoiceProNot_count__c',
+                            type: 'number',
+                            typeAttributes: {
+                                minimumFractionDigits: 2
+                            },
+                            hideDefaultActions: true
+                        };
+                        let object2 = {
+                            label: this.RrturnProLabel,
+                            fieldName: 'RrturnPro_count__c',
+                            hideDefaultActions: true
+                        };
+                        let object3 = {
+                            label: this.InvoicedLabel,
+                            fieldName: 'Invoiced_Procount__c',
+                            type: 'number',
+                            typeAttributes: {
+                                minimumFractionDigits: 2
+                            },
+                            hideDefaultActions: true
+                        };
+                        this.editColumns.push(object1);
+                        this.editColumns.push(object2);
+                        this.editColumns.push(object3);
+                    } else {
+                        this.ForCustomerText =
+                            this.cocLwc.Order_ForCustomerText__c;
+                        console.log(
+                            'EditAble = true this.ForCustomerText = ' +
+                                this.ForCustomerText
+                        );
+                        this.summonsForDirction =
+                            this.cocLwc.SummonsForDirction__c;
+                        console.log(
+                            'EditAble = true this.summonsForDirction = ' +
+                                this.summonsForDirction
+                        );
+                        let value = this.summonsForDirction;
+                        switch (value) {
+                            case '鐩存帴閿�鍞粰鍖婚櫌':
+                                this.isDisabledHospitalName = false;
+                                this.isDisabledForCustomerText = false;
+                                this.secondaryDistributor = '';
+                                this.ForDealerText = '';
+                                this.isDisabledForDealerText = true;
+                                this.isDisabledSecondaryDistributor = true;
+                                break;
+                            case '鍖婚櫌璇曠敤':
+                                this.isDisabledHospitalName = false;
+                                this.isDisabledForCustomerText = false;
+                                this.isDisabledForDealerText = false;
+                                this.isDisabledSecondaryDistributor = false;
+                                break;
+                            case '閿�鍞粰浜岀骇缁忛攢鍟�':
+                                this.isDisabledHospitalName = false;
+                                this.isDisabledForCustomerText = false;
+                                this.isDisabledForDealerText = false;
+                                this.isDisabledSecondaryDistributor = false;
+                                break;
+                            case '浜掔浉璋冭揣':
+                                this.isDisabledHospitalName = true;
+                                this.HospitalName = '';
+                                this.OECId = '';
+                                this.isDisabledForCustomerText = true;
+                                this.ForCustomerText = '';
+                                this.isDisabledForDealerText = false;
+                                this.isDisabledSecondaryDistributor = false;
+                                this.isMutualTransferGoods = true;
+                                break;
+                            default:
+                                this.isDisabledHospitalName = false;
+                                this.isDisabledForCustomerText = false;
+                                this.isDisabledForDealerText = false;
+                                this.isDisabledSecondaryDistributor = false;
+                        }
+                    }
+
+                    //濡傛灉hasHosPro = true 鍖婚櫌鐗逛环
+                    if (this.hasHosPro) {
+                        let object1 = {
+                            label: '鍖婚櫌鐗逛环',
+                            fieldName: 'hospitalSpecialOffer',
+                            type: 'boolean',
+                            hideDefaultActions: true
+                        };
+                        this.columns.push(object1);
+                        this.editColumns.push(object1);
+                    }
+                    //鍑哄簱鍗曚俊鎭�
+                    this.isSummonsFlag =
+                        r.entity.SummonsFlag == 'visible' ? true : false;
+                    console.log(
+                        'r.entity.provinceOptsMap = ' + r.entity.provinceOptsMap
+                    );
+                    for (var key in r.entity.provinceOptsMap) {
+                        let object = {};
+                        object['label'] = r.entity.provinceOptsMap[key];
+                        object['value'] = key;
+                        this.secondaryDistributorOptions.push(object);
+                    }
+                    for (var key in r.entity.outOutPatternOptionMap) {
+                        let object = {};
+                        object['label'] = r.entity.outOutPatternOptionMap[key];
+                        object['value'] = key;
+                        this.outOutPatternOptionList.push(object);
+                    }
+                    console.log(
+                        'this.secondaryDistributorOptions = ' +
+                            JSON.stringify(this.secondaryDistributorOptions)
+                    );
+                    this.HospitalName = r.entity.HospitalName;
+                    this.sumPrice = r.entity.sumPrice.toFixed(2) + '鍏�';
+                    this.isShowSpinner = false;
+                    this.showTable = true;
+                    console.log('ESetid = ' + this.ESetid);
+                } else {
+                    console.log('r = ' + JSON.stringify(r));
+                    this.showToast('Error', r.msg);
                 }
-                //鍑哄簱鍗曚俊鎭�
-                this.isSummonsFlag = r.entity.SummonsFlag == "visible" ? true : false;
-                console.log("r.entity.provinceOptsMap = " + r.entity.provinceOptsMap);
-                for (var key in r.entity.provinceOptsMap) {
-                    let object = {};
-                    object["label"] = r.entity.provinceOptsMap[key];
-                    object["value"] = key;
-                    this.secondaryDistributorOptions.push(object);
-                }
-                for (var key in r.entity.outOutPatternOptionMap) {
-                    let object = {};
-                    object["label"] = r.entity.outOutPatternOptionMap[key];
-                    object["value"] = key;
-                    this.outOutPatternOptionList.push(object);
-                }
-                console.log(
-                    "this.secondaryDistributorOptions = " +
-                    JSON.stringify(this.secondaryDistributorOptions)
-                );
-                this.HospitalName = r.entity.HospitalName;
-                this.sumPrice = r.entity.sumPrice.toFixed(2) + "鍏�";
-                this.isShowSpinner = false;
-                this.showTable = true;
-                console.log("ESetid = " + this.ESetid);
-            } else {
-                console.log("r = " + JSON.stringify(r));
-                this.showToast("Error", r.msg);
-            }
-        }).catch((error) => {
-            console.log("error = " + JSON.stringify(error));
-        });
+            })
+            .catch((error) => {
+                console.log('error = ' + JSON.stringify(error));
+            });
     }
 
     ChangeDirction(event) {
         let value = event.target.value;
         this.summonsForDirction = value;
-        this.cocLwc["SummonsForDirction__c"] = value;
-        console.log("閫夋嫨浜� = " + value);
+        this.cocLwc['SummonsForDirction__c'] = value;
+        console.log('閫夋嫨浜� = ' + value);
         switch (value) {
-            case "鐩存帴閿�鍞粰鍖婚櫌":
+            case '鐩存帴閿�鍞粰鍖婚櫌':
                 this.isDisabledHospitalName = false;
                 this.isDisabledForCustomerText = false;
-                this.secondaryDistributor = "";
-                this.ForDealerText = "";
+                this.secondaryDistributor = '';
+                this.ForDealerText = '';
                 this.isDisabledForDealerText = true;
                 this.isDisabledSecondaryDistributor = true;
                 this.isMutualTransferGoods = false;
                 break;
-            case "鍖婚櫌璇曠敤":
+            case '鍖婚櫌璇曠敤':
                 this.isDisabledHospitalName = false;
                 this.isDisabledForCustomerText = false;
                 this.isDisabledForDealerText = false;
                 this.isDisabledSecondaryDistributor = false;
                 break;
-            case "閿�鍞粰浜岀骇缁忛攢鍟�":
+            case '閿�鍞粰浜岀骇缁忛攢鍟�':
                 this.isDisabledHospitalName = false;
                 this.isDisabledForCustomerText = false;
                 this.isDisabledForDealerText = false;
                 this.isDisabledSecondaryDistributor = false;
                 break;
-            case "浜掔浉璋冭揣":
+            case '浜掔浉璋冭揣':
                 this.isDisabledHospitalName = true;
-                this.HospitalName = "";
-                this.OECId = "";
+                this.HospitalName = '';
+                this.OECId = '';
                 this.isDisabledForCustomerText = true;
-                this.ForCustomerText = "";
+                this.ForCustomerText = '';
                 this.isDisabledForDealerText = false;
                 this.isDisabledSecondaryDistributor = false;
                 this.isMutualTransferGoods = true;
@@ -974,39 +1163,39 @@
     }
 
     dataChange(event) {
-        let fieldName = event.target.getAttribute("data-field");
+        let fieldName = event.target.getAttribute('data-field');
         let value = event.detail.value;
-        console.log("fieldName = " + fieldName + " value = " + value);
+        console.log('fieldName = ' + fieldName + ' value = ' + value);
         switch (fieldName) {
-            case "summonsForDirction":
+            case 'summonsForDirction':
                 this.summonsForDirction = value;
                 break;
-            case "secondaryDistributor":
+            case 'secondaryDistributor':
                 this.secondaryDistributor = value;
                 break;
-            case "HospitalName":
+            case 'HospitalName':
                 this.HospitalName = value;
                 break;
-            case "ForDealerText":
+            case 'ForDealerText':
                 this.ForDealerText = value;
-                this.cocLwc["Order_ForDealerText__c"] = value;
+                this.cocLwc['Order_ForDealerText__c'] = value;
                 break;
-            case "ForCustomerText":
-                this.cocLwc["Order_ForCustomerText__c"] = value;
+            case 'ForCustomerText':
+                this.cocLwc['Order_ForCustomerText__c'] = value;
                 this.ForCustomerText = value;
                 break;
-            case "sumPrice":
+            case 'sumPrice':
                 this.sumPrice = value.toFixed(2);
                 break;
-            case "NoConfirmedPrice":
+            case 'NoConfirmedPrice':
                 this.NoConfirmedPrice = !this.NoConfirmedPrice;
-                this.cocLwc["NoConfirmedPrice__c"] = this.NoConfirmedPrice;
-                console.log("this.NoConfirmedPrice = " + this.NoConfirmedPrice);
+                this.cocLwc['NoConfirmedPrice__c'] = this.NoConfirmedPrice;
+                console.log('this.NoConfirmedPrice = ' + this.NoConfirmedPrice);
                 break;
-            case "consumableName":
+            case 'consumableName':
                 this.consumableName = value;
                 break;
-            case "Category3":
+            case 'Category3':
                 this.Category3 = value;
                 //璋冪敤鍚庡彴鏄剧ず绗洓浜斿垎绫�
                 this.showAllCate();
@@ -1015,7 +1204,7 @@
                     this.Category5 = '';
                 }
                 break;
-            case "Category4":
+            case 'Category4':
                 this.Category4 = value;
                 //璋冪敤鍚庡彴鏄剧ず绗簲鍒嗙被
                 this.showCate();
@@ -1023,85 +1212,93 @@
                     this.Category5 = '';
                 }
                 break;
-            case "Category5":
+            case 'Category5':
                 this.Category5 = value;
                 break;
-            case "searchHospitalName":
+            case 'searchHospitalName':
                 this.searchHospitalName = value;
                 break;
-            case "Barcode":
+            case 'Barcode':
                 this.Barcode = value;
                 break;
         }
     }
 
     showAllCate() {
-        console.log('showAllCate')
+        console.log('showAllCate');
         categoryAllload({
             category3Lwc: this.Category3
-        }).then((r) => {
-            r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
-            if (r.status == "Success") {
-                this.category4Options = [];
-                this.category5Options = [];
-                //绗�4鍒嗙被
-                for (var key in r.entity.category4OptionMap) {
-                    let object = {};
-                    object["label"] = r.entity.category4OptionMap[key];
-                    object["value"] = key;
-                    this.category4Options.push(object);
+        })
+            .then((r) => {
+                r = JSON.parse(JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
+                    this.category4Options = [];
+                    this.category5Options = [];
+                    //绗�4鍒嗙被
+                    for (var key in r.entity.category4OptionMap) {
+                        let object = {};
+                        object['label'] = r.entity.category4OptionMap[key];
+                        object['value'] = key;
+                        this.category4Options.push(object);
+                    }
+                    console.log(
+                        'this.category4Options = ' + this.category4Options
+                    );
+                    //绗�5鍒嗙被
+                    for (var key in r.entity.category5OptionMap) {
+                        let object = {};
+                        object['label'] = r.entity.category5OptionMap[key];
+                        object['value'] = key;
+                        this.category5Options.push(object);
+                    }
+                } else {
+                    console.log('r = ' + JSON.stringify(r));
+                    this.showToast('Error', r.msg);
                 }
-                console.log("this.category4Options = " + this.category4Options);
-                //绗�5鍒嗙被
-                for (var key in r.entity.category5OptionMap) {
-                    let object = {};
-                    object["label"] = r.entity.category5OptionMap[key];
-                    object["value"] = key;
-                    this.category5Options.push(object);
-                }
-            } else {
-                console.log("r = " + JSON.stringify(r));
-                this.showToast("Error", r.msg);
-            }
-        }).catch((error) => {
-            console.log("error" + JSON.stringify(error));
-        });
+            })
+            .catch((error) => {
+                console.log('error' + JSON.stringify(error));
+            });
     }
 
     showCate() {
-        console.log('showAllCate')
+        console.log('showAllCate');
         categoryload({
             category3Lwc: this.Category3,
             category4Lwc: this.Category4
-        }).then((r) => {
-            r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
-            if (r.status == "Success") {
-                this.category4Options = [];
-                this.category5Options = [];
-                //绗�4鍒嗙被
-                for (var key in r.entity.category4OptionMap) {
-                    let object = {};
-                    object["label"] = r.entity.category4OptionMap[key];
-                    object["value"] = key;
-                    this.category4Options.push(object);
+        })
+            .then((r) => {
+                r = JSON.parse(JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
+                    this.category4Options = [];
+                    this.category5Options = [];
+                    //绗�4鍒嗙被
+                    for (var key in r.entity.category4OptionMap) {
+                        let object = {};
+                        object['label'] = r.entity.category4OptionMap[key];
+                        object['value'] = key;
+                        this.category4Options.push(object);
+                    }
+                    console.log(
+                        'this.category4Options = ' + this.category4Options
+                    );
+                    //绗�5鍒嗙被
+                    for (var key in r.entity.category5OptionMap) {
+                        let object = {};
+                        object['label'] = r.entity.category5OptionMap[key];
+                        object['value'] = key;
+                        this.category5Options.push(object);
+                    }
+                } else {
+                    console.log('r = ' + JSON.stringify(r));
+                    this.showToast('Error', r.msg);
                 }
-                console.log("this.category4Options = " + this.category4Options);
-                //绗�5鍒嗙被
-                for (var key in r.entity.category5OptionMap) {
-                    let object = {};
-                    object["label"] = r.entity.category5OptionMap[key];
-                    object["value"] = key;
-                    this.category5Options.push(object);
-                }
-            } else {
-                console.log("r = " + JSON.stringify(r));
-                this.showToast("Error", r.msg);
-            }
-        }).catch((error) => {
-            console.log("error" + JSON.stringify(error));
-        });
+            })
+            .catch((error) => {
+                console.log('error' + JSON.stringify(error));
+            });
     }
 
     invoiceChange(event) {
@@ -1112,38 +1309,41 @@
     showToast(type, msg) {
         this.isShowSpinner = false;
         this.showLoadingSpinner = false;
+        this.isEditShowSpinner = false;
         const event = new ShowToastEvent({
             title: type,
             variant: type,
-            message: msg,
+            message: msg
         });
         this.dispatchEvent(event);
     }
 
     searchProductJs() {
-        this.isShowSpinner = true;
+        this.isEditShowSpinner = true;
         //this.showTable = false;
         //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
-        const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+        const selectedRows = this.template
+            .querySelector('c-lex-custom-lightning-datatable')
+            .getSelectedRows();
         console.log('selectedRows = ' + selectedRows);
         for (var i in this.data) {
-            this.data[i]["check"] = false;
+            this.data[i]['check'] = false;
         }
         for (var i in this.data) {
             for (var j in selectedRows) {
                 if (this.data[i].Id == selectedRows[j].Id) {
-                    this.data[i]["check"] = true;
+                    this.data[i]['check'] = true;
                 }
             }
         }
 
         let cloneData = this.data;
         for (var i in cloneData) {
-            cloneData[i]["Name"] = cloneData[i].Name__c;
-            cloneData[i]["Category3"] = cloneData[i].Category3__c;
-            cloneData[i]["Category4"] = cloneData[i].Category4__c;
-            cloneData[i]["Category5"] = cloneData[i].Category5__c;
-            cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c;
+            cloneData[i]['Name'] = cloneData[i].Name__c;
+            cloneData[i]['Category3'] = cloneData[i].Category3__c;
+            cloneData[i]['Category4'] = cloneData[i].Category4__c;
+            cloneData[i]['Category5'] = cloneData[i].Category5__c;
+            cloneData[i]['BoxPiece'] = cloneData[i].Box_Piece__c;
             delete cloneData[i].Name__c;
             delete cloneData[i].Category3__c;
             delete cloneData[i].Category4__c;
@@ -1151,7 +1351,7 @@
             delete cloneData[i].Box_Piece__c;
         }
 
-        console.log("cloneData = " + JSON.stringify(cloneData));
+        console.log('cloneData = ' + JSON.stringify(cloneData));
         searchConsumableorderdetails({
             agencyProTypeLwc: this.agencyProType,
             accountNameLwc: this.accountName,
@@ -1163,161 +1363,194 @@
             category5: this.Category5,
             editAbleLwc: this.EditAble,
             pageRecordsLwcLwc: cloneData,
-            consumableproductdetailsRecordsLwc: this.consumableproductdetailsRecords,
+            consumableproductdetailsRecordsLwc:
+                this.consumableproductdetailsRecords,
             arriveorderLwc: this.arriveorder,
+            pageSizeLWC: this.pageSize,
+            pageTokenLWC: this.currentPageToken
         }).then((r) => {
             r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
-            if (r.status == "Success") {
+            console.log('r = ' + JSON.stringify(r));
+            if (r.status == 'Success') {
+                //鍒嗛〉
+                console.log(
+                    'r.entity.paginatedAccounts = ' +
+                        JSON.stringify(r.entity.paginatedAccounts)
+                );
+                this.nextPageToken = r.entity.paginatedAccounts.nextPageToken;
+                this.totalRecords = r.entity.paginatedAccounts.totalRecords;
+                this.recordStart = r.entity.paginatedAccounts.recordStart;
+                this.recordEnd = r.entity.paginatedAccounts.recordEnd;
+                this.totalPages = Math.ceil(
+                    r.entity.paginatedAccounts.totalRecords / this.pageSize
+                );
+                console.log('this.totalPages = ' + this.totalPages);
+
+                this.SearchDone = r.entity.SearchDone;
                 let tempData = [];
-                //this.data = r.entity.pageRecords;
+                this.selectedRows = [];
                 tempData = r.entity.pageRecords;
                 for (var i in tempData) {
                     let unitOptions = [];
                     for (var key in tempData[i].boxorpieceMap) {
                         let unitOption = {};
-                        unitOption["label"] = tempData[i].boxorpieceMap[key];
-                        unitOption["value"] = key;
+                        unitOption['label'] = tempData[i].boxorpieceMap[key];
+                        unitOption['value'] = key;
                         unitOptions.push(unitOption);
                     }
-                    tempData[i]["unitOptions"] = unitOptions;
-                    tempData[i]["unitValue"] = tempData[i]["unitValue"] == null ? unitOptions[0].value : tempData[i]["unitValue"];
+                    tempData[i]['unitOptions'] = unitOptions;
+                    tempData[i]['unitValue'] =
+                        tempData[i]['unitValue'] == null
+                            ? unitOptions[0].value
+                            : tempData[i]['unitValue'];
                     if (this.EditAble) {
-                        tempData[i].orderdetails1["Box_Piece__c"] = tempData[i].orderdetails1["Box_Piece__c"] == null ? unitOptions[0].value : tempData[i].orderdetails1["Box_Piece__c"];
-                        tempData[i].orderdetails1["Shipment_Count__c"] = tempData[i].orderdetails1["Shipment_Count__c"] == null ? 0 : tempData[i].orderdetails1["Shipment_Count__c"];
-                        tempData[i].orderdetails1["Delivery_List_RMB__c"] = tempData[i].orderdetails1["Delivery_List_RMB__c"] == null ? 0.0 : tempData[i].orderdetails1["Delivery_List_RMB__c"];
+                        tempData[i].orderdetails1['Box_Piece__c'] =
+                            tempData[i].orderdetails1['Box_Piece__c'] == null
+                                ? unitOptions[0].value
+                                : tempData[i].orderdetails1['Box_Piece__c'];
+                        tempData[i].orderdetails1['Shipment_Count__c'] =
+                            tempData[i].orderdetails1['Shipment_Count__c'] ==
+                            null
+                                ? 0
+                                : tempData[i].orderdetails1[
+                                      'Shipment_Count__c'
+                                  ];
+                        tempData[i].orderdetails1['Delivery_List_RMB__c'] =
+                            tempData[i].orderdetails1['Delivery_List_RMB__c'] ==
+                            null
+                                ? 0.0
+                                : tempData[i].orderdetails1[
+                                      'Delivery_List_RMB__c'
+                                  ];
                     } else {
-                        tempData[i]["InvoiceProNot_count__c"] =
+                        tempData[i]['InvoiceProNot_count__c'] =
                             tempData[i].orderdetails1.InvoiceProNot_count__c;
-                        tempData[i]["RrturnPro_count__c"] =
+                        tempData[i]['RrturnPro_count__c'] =
                             tempData[i].orderdetails1.RrturnPro_count__c;
-                        tempData[i]["Invoiced_Procount__c"] =
+                        tempData[i]['Invoiced_Procount__c'] =
                             tempData[i].orderdetails1.Invoiced_Procount__c;
                     }
-                    tempData[i]["shipmentNumber"] = tempData[i].orderdetails1["Shipment_Count__c"];
-                    tempData[i]["shippingUnitPrice"] = tempData[i].orderdetails1["Delivery_List_RMB__c"];
+                    tempData[i]['shipmentNumber'] =
+                        tempData[i].orderdetails1['Shipment_Count__c'];
+                    tempData[i]['shippingUnitPrice'] =
+                        tempData[i].orderdetails1['Delivery_List_RMB__c'];
 
-                    tempData[i]["recordId"] = tempData[i].Prod.Id;
-                    tempData[i]["Id"] = tempData[i].Prod.Id;
-                    tempData[i]["Name__c"] = tempData[i].Prod.Name__c;
-                    tempData[i]["SFDA_Status__c"] = tempData[i].Prod.SFDA_Status__c;
-                    tempData[i]["Category3__c"] = tempData[i].Prod.Category3__c;
-                    tempData[i]["Category4__c"] = tempData[i].Prod.Category4__c;
-                    tempData[i]["Category5__c"] = tempData[i].Prod.Category5__c;
-                    tempData[i]["Box_Piece__c"] = tempData[i].orderdetails1.Box_Piece__c;
-                    tempData[i]["shipmentAmount"] = tempData[i].orderdetails1.Shipment_amount__c;
-                    tempData[i]["Shipment_amount__c"] = tempData[i].orderdetails1.Shipment_amount__c;
-                    tempData[i]["Shipment_Count__c"] = tempData[i].orderdetails1.Shipment_Count__c;
+                    tempData[i]['recordId'] = tempData[i].Prod.Id;
+                    console.log(
+                        'tempData[i]["hospitalSpecialOffer"] = ' +
+                            tempData[i]['hospitalSpecialOffer']
+                    );
+                    if (tempData[i]['hospitalSpecialOffer']) {
+                        tempData[i]['Id'] = tempData[i].Prod.Id + 'ishos';
+                    } else {
+                        tempData[i]['Id'] = tempData[i].Prod.Id + 'nothos';
+                    }
+                    tempData[i]['Name__c'] = tempData[i].Prod.Name__c;
+                    tempData[i]['SFDA_Status__c'] =
+                        tempData[i].Prod.SFDA_Status__c;
+                    tempData[i]['Category3__c'] = tempData[i].Prod.Category3__c;
+                    tempData[i]['Category4__c'] = tempData[i].Prod.Category4__c;
+                    tempData[i]['Category5__c'] = tempData[i].Prod.Category5__c;
+                    tempData[i]['Box_Piece__c'] =
+                        tempData[i].orderdetails1.Box_Piece__c;
+                    tempData[i]['shipmentAmount'] =
+                        tempData[i].orderdetails1.Shipment_amount__c;
+                    tempData[i]['Shipment_amount__c'] =
+                        tempData[i].orderdetails1.Shipment_amount__c;
+                    tempData[i]['Shipment_Count__c'] =
+                        tempData[i].orderdetails1.Shipment_Count__c;
 
-                    if (tempData[i]["shippingUnitPrice"] && tempData[i]["shipmentNumber"])
-                        tempData[i]["shipmentAmount"] = this.amend(
-                            tempData[i]["shipmentNumber"],
-                            tempData[i]["shippingUnitPrice"],
-                            "*"
+                    if (
+                        tempData[i]['shippingUnitPrice'] &&
+                        tempData[i]['shipmentNumber']
+                    )
+                        tempData[i]['shipmentAmount'] = this.amend(
+                            tempData[i]['shipmentNumber'],
+                            tempData[i]['shippingUnitPrice'],
+                            '*'
                         );
 
                     if (tempData[i]['check']) {
                         this.selectedRows.push(tempData[i].Id);
                     }
-
                 }
-                // for (var i in tempData) {
-                //     let unitOptions = [];
-                //     for (var key in tempData[i].boxorpieceMap) {
-                //         let unitOption = {};
-                //         unitOption["label"] = tempData[i].boxorpieceMap[key];
-                //         unitOption["value"] = key;
-                //         unitOptions.push(unitOption);
-                //     }
-                //     tempData[i]["unitOptions"] = unitOptions;
-                //     tempData[i]["unitValue"] = unitOptions[0].value;
-                //     tempData[i]["recordId"] = tempData[i].Prod.Id;
-                //     tempData[i]["Id"] = tempData[i].Prod.Id;
-                //     tempData[i]["Name__c"] = tempData[i].Prod.Name__c;
-                //     tempData[i]["SFDA_Status__c"] = tempData[i].Prod.SFDA_Status__c;
-                //     tempData[i]["Category3__c"] = tempData[i].Prod.Category3__c;
-                //     tempData[i]["Category4__c"] = tempData[i].Prod.Category4__c;
-                //     tempData[i]["Category5__c"] = tempData[i].Prod.Category5__c;
-                //     tempData[i]["Box_Piece__c"] = tempData[i].orderdetails1.Box_Piece__c;
-                //     tempData[i]["shipmentNumber"] = tempData[i].orderdetails1.Shipment_Count__c;
-                //     tempData[i]["shippingUnitPrice"] = tempData[i].orderdetails1.Delivery_List_RMB__c;
-                //     console.log(
-                //         "shippingUnitPrice = " + tempData[i]["shippingUnitPrice"]
-                //     );
-                // if (tempData[i]["shippingUnitPrice"] && tempData[i]["shipmentNumber"])
-                //     tempData[i]["shipmentAmount"] = this.amend(
-                //         tempData[i]["shipmentNumber"],
-                //         tempData[i]["shippingUnitPrice"],
-                //         "*"
-                //     );
-                // }
                 this.data = tempData;
-                console.log("this.data = " + JSON.stringify(this.data));
+                console.log('this.data = ' + JSON.stringify(this.data));
+                console.log(
+                    ' this.selectedRows = ' + JSON.stringify(this.selectedRows)
+                );
                 //this.showTable = true;
-                this.isShowSpinner = false;
+                this.isEditShowSpinner = false;
             } else {
-                console.log("r = " + JSON.stringify(r));
-                this.showToast("Error", r.msg);
+                console.log('r = ' + JSON.stringify(r));
+                this.showToast('Error', r.msg);
             }
         });
     }
 
     searchHospitalNameModal() {
-        console.log("searchHospitalNameModal");
+        console.log('searchHospitalNameModal');
         hospitalInit({
-            ctype: this.agencyProType,
+            ctype: this.agencyProType
         }).then((r) => {
             r = JSON.parse(JSON.stringify(r));
-            if (r.status == "Success") {
+            if (r.status == 'Success') {
                 this.hospitalList = r.entity.at;
                 for (var i in this.hospitalList) {
-                    this.hospitalList[i]["stateMasterName"] =
+                    this.hospitalList[i]['stateMasterName'] =
                         this.hospitalList[i].State_Master__r.Name;
                 }
-                console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
+                console.log(
+                    'hospitalInit r = ' + JSON.stringify(this.hospitalList)
+                );
                 this.isModalOpen = true;
             }
         });
     }
 
     searchHospital() {
-        console.log("this.searchHospitalName = " + this.searchHospitalName);
+        console.log('this.searchHospitalName = ' + this.searchHospitalName);
         serContact({
             searchName: this.searchHospitalName,
-            ctype: this.agencyProType,
+            ctype: this.agencyProType
         }).then((r) => {
             r = JSON.parse(JSON.stringify(r));
-            if (r.status == "Success") {
+            if (r.status == 'Success') {
                 this.hospitalList = r.entity.at;
                 for (var i in this.hospitalList) {
-                    this.hospitalList[i]["stateMasterName"] =
+                    this.hospitalList[i]['stateMasterName'] =
                         this.hospitalList[i].State_Master__r.Name;
                 }
-                console.log("hospitalInit r = " + JSON.stringify(this.hospitalList));
+                console.log(
+                    'hospitalInit r = ' + JSON.stringify(this.hospitalList)
+                );
             }
         });
     }
 
     searchHandleRowAction(event) {
-        console.log("searchHandleRowAction");
+        console.log('searchHandleRowAction');
         let row = event.detail.row;
         this.OECId = row.Id;
         this.HospitalName = row.Name;
         console.log(
-            "this.OECId = " + this.OECId + " this.HospitalName = " + this.HospitalName
+            'this.OECId = ' +
+                this.OECId +
+                ' this.HospitalName = ' +
+                this.HospitalName
         );
         this.isModalOpen = false;
-        console.log("this.isModalOpen = " + this.isModalOpen);
+        console.log('this.isModalOpen = ' + this.isModalOpen);
     }
 
     clearAgencyI(event) {
         this.HospitalName = event.target.value;
-        if (this.HospitalName == "" || this.HospitalName == null) {
-            this.OECId = "";
+        if (this.HospitalName == '' || this.HospitalName == null) {
+            this.OECId = '';
         }
-        console.log("this.HospitalName = " + this.HospitalName);
-        console.log("this.OECId = " + this.OECId);
-        if (this.OECId != null && this.OECId != "") {
+        console.log('this.HospitalName = ' + this.HospitalName);
+        console.log('this.OECId = ' + this.OECId);
+        if (this.OECId != null && this.OECId != '') {
             this.checkOutPattern();
         }
     }
@@ -1334,9 +1567,9 @@
             }
         }
         if (ishos > 0) {
-            this.cocLwc["OutPattern__c"] = true;
+            this.cocLwc['OutPattern__c'] = true;
         } else {
-            this.cocLwc["OutPattern__c"] = false;
+            this.cocLwc['OutPattern__c'] = false;
         }
     }
 
@@ -1345,28 +1578,31 @@
     }
 
     handleUnitChange(event) {
-        console.log("handleUnitChange");
+        console.log('handleUnitChange');
         const unitDetail = event.detail;
-        console.log("unitDetail = " + JSON.stringify(unitDetail));
+        console.log('unitDetail = ' + JSON.stringify(unitDetail));
         for (var i in this.data) {
             if (this.data[i].recordId == unitDetail.data.recordId) {
                 this.data[i].unitValue = unitDetail.data.unitValue;
-                this.data[i].orderdetails1["Box_Piece__c"] = unitDetail.data.unitValue;
+                this.data[i].orderdetails1['Box_Piece__c'] =
+                    unitDetail.data.unitValue;
             }
         }
-        console.log("this.data = " + JSON.stringify(this.data));
+        console.log('this.data = ' + JSON.stringify(this.data));
     }
 
     handleShipmentNumber(event) {
-        console.log("handleShipmentNumber");
+        console.log('handleShipmentNumber');
         const numberDetail = event.detail;
-        console.log("numberDetail = " + JSON.stringify(numberDetail));
+        console.log('numberDetail = ' + JSON.stringify(numberDetail));
         let index = 0;
         for (var i in this.data) {
             if (this.data[i].recordId == numberDetail.data.recordId) {
                 index = i;
-                this.data[i].shipmentNumber = Number(numberDetail.data.shipmentnumber);
-                this.data[i].orderdetails1["Shipment_Count__c"] = Number(
+                this.data[i].shipmentNumber = Number(
+                    numberDetail.data.shipmentnumber
+                );
+                this.data[i].orderdetails1['Shipment_Count__c'] = Number(
                     numberDetail.data.shipmentnumber
                 );
             }
@@ -1379,7 +1615,7 @@
     }
 
     handleShipmentUnitPrice(event) {
-        console.log("handleShipmentUnitPrice");
+        console.log('handleShipmentUnitPrice');
         const priceDetail = event.detail;
         let index = 0;
         for (var i in this.data) {
@@ -1388,7 +1624,7 @@
                 this.data[i].shippingUnitPrice = Number(
                     priceDetail.data.shipmentunitprice
                 );
-                this.data[i].orderdetails1["Delivery_List_RMB__c"] = Number(
+                this.data[i].orderdetails1['Delivery_List_RMB__c'] = Number(
                     priceDetail.data.shipmentunitprice
                 );
             }
@@ -1401,20 +1637,21 @@
     }
 
     ComputePrice(index, number, price) {
-        console.log("index = " + index);
-        console.log("number = " + number);
-        console.log("price = " + price);
-        let shipmentAmount = this.amend(number, price, "*");
-        console.log("shipmentAmount = " + shipmentAmount);
+        console.log('index = ' + index);
+        console.log('number = ' + number);
+        console.log('price = ' + price);
+        let shipmentAmount = this.amend(number, price, '*');
+        console.log('shipmentAmount = ' + shipmentAmount);
         let sumPrice = 0.0;
         this.data[index].shipmentAmount = shipmentAmount;
         for (var i in this.data) {
-            if (this.data[i].shipmentAmount) sumPrice += this.data[i].shipmentAmount;
+            if (this.data[i].shipmentAmount)
+                sumPrice += this.data[i].shipmentAmount;
         }
-        this.sumPrice = sumPrice.toFixed(2) + "鍏�";
+        this.sumPrice = sumPrice.toFixed(2) + '鍏�';
         //瀛樹笅閫夋嫨琛岋紝涓嶄細琚竻绌�
-        if (this.selectedRows.indexOf(this.data[index].Id) == -1)
-            this.selectedRows.push(this.data[index].Id);
+        // if (this.selectedRows.indexOf(this.data[index].Id) == -1)
+        //     this.selectedRows.push(this.data[index].Id);
         // this.selectedRows = [];
         // for (var i in this.data) {
         //     if (this.data[i].check) {
@@ -1422,9 +1659,9 @@
         //     }
         // }
         this.data = [...this.data];
-        this.selectedRows = [...this.selectedRows]
-        console.log("this.selectedRows = " + JSON.stringify(this.selectedRows));
-        console.log("this.data = " + JSON.stringify(this.data));
+        this.selectedRows = [...this.selectedRows];
+        console.log('this.selectedRows = ' + JSON.stringify(this.selectedRows));
+        console.log('this.data = ' + JSON.stringify(this.data));
     }
 
     //num1 num2浼犲叆涓や釜鍊�  symbol +-*/绗﹀彿
@@ -1436,12 +1673,12 @@
             str2Length;
         //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉�
         try {
-            str1Length = str1.split(".")[1].length;
+            str1Length = str1.split('.')[1].length;
         } catch (error) {
             str1Length = 0;
         }
         try {
-            str2Length = str2.split(".")[1].length;
+            str2Length = str2.split('.')[1].length;
         } catch (error) {
             str2Length = 0;
         }
@@ -1449,16 +1686,16 @@
         //
         console.log(step);
         switch (symbol) {
-            case "+":
+            case '+':
                 result = (num1 * step + num2 * step) / step;
                 break;
-            case "-":
+            case '-':
                 result = (num1 * step - num2 * step) / step;
                 break;
-            case "*":
+            case '*':
                 result = (num1 * step * (num2 * step)) / step / step;
                 break;
-            case "/":
+            case '/':
                 result = (num1 * step) / (num2 * step);
                 break;
             default:
@@ -1469,10 +1706,27 @@
 
     getSelectedRows(event) {
         let selectedRowsEvent = event.detail.selectedRows;
+        console.log('selectedRowsEvent = ' + JSON.stringify(selectedRowsEvent));
         this.selectedRows = [];
         for (var i in selectedRowsEvent) {
-            this.selectedRows.push(selectedRowsEvent[i].Id)
+            this.selectedRows.push(selectedRowsEvent[i].Id);
         }
+        // for (var i in this.data) {
+        //     for (var j in selectedRowsEvent) {
+        //         if (this.data[i].Id == selectedRowsEvent[j].Prod.Id) {
+        //             this.ComputePrice(
+        //                 i,
+        //                 this.data[i].shipmentNumber,
+        //                 this.data[i].shippingUnitPrice
+        //             );
+        //         }
+        //     }
+        // }
+        // this.ComputePrice(
+        //     index,
+        //     this.data[index].shipmentNumber,
+        //     this.data[index].shippingUnitPrice
+        // );
         // const selectedRows = event.detail.selectedRows;
         // console.log("this.selectedRows = " + this.selectedRows);
         // for (var i in this.data) {
@@ -1488,8 +1742,8 @@
     }
 
     saveConfirmJs() {
-        let msg = "鍑哄簱浠锋牸浠呭彲鎿嶄綔涓�娆″彉鏇达紝淇濆瓨鍚庡皢鏃犳硶淇敼銆俓n\n璇风‘璁わ紒";
-        if (this.SummonsStatus == "浠锋牸鏈畾") {
+        let msg = '鍑哄簱浠锋牸浠呭彲鎿嶄綔涓�娆″彉鏇达紝淇濆瓨鍚庡皢鏃犳硶淇敼銆俓n\n璇风‘璁わ紒';
+        if (this.SummonsStatus == '浠锋牸鏈畾') {
             if (confirm(msg) == true) {
                 this.saveConfirm();
             }
@@ -1502,42 +1756,44 @@
         this.isShowSpinner = true;
 
         //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
-        const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+        const selectedRows = this.template
+            .querySelector('c-lex-custom-lightning-datatable')
+            .getSelectedRows();
         console.log('selectedRows = ' + selectedRows);
         for (var i in this.data) {
-            this.data[i]["check"] = false;
+            this.data[i]['check'] = false;
         }
         for (var i in this.data) {
             for (var j in selectedRows) {
                 if (this.data[i].Id == selectedRows[j].Id) {
-                    this.data[i]["check"] = true;
+                    this.data[i]['check'] = true;
                 }
             }
         }
 
         let cloneData = this.data;
         for (var i in cloneData) {
-            cloneData[i]["Name"] = cloneData[i].Name__c;
-            cloneData[i]["Category3"] = cloneData[i].Category3__c;
-            cloneData[i]["Category4"] = cloneData[i].Category4__c;
-            cloneData[i]["Category5"] = cloneData[i].Category5__c;
-            cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c;
+            cloneData[i]['Name'] = cloneData[i].Name__c;
+            cloneData[i]['Category3'] = cloneData[i].Category3__c;
+            cloneData[i]['Category4'] = cloneData[i].Category4__c;
+            cloneData[i]['Category5'] = cloneData[i].Category5__c;
+            cloneData[i]['BoxPiece'] = cloneData[i].Box_Piece__c;
             delete cloneData[i].Name__c;
             delete cloneData[i].Category3__c;
             delete cloneData[i].Category4__c;
             delete cloneData[i].Category5__c;
             delete cloneData[i].Box_Piece__c;
         }
-        console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
-        console.log("this.OECId = " + this.OECId);
-        console.log("this.HospitalName = " + this.HospitalName);
-        console.log("this.secondaryDistributor = " + this.secondaryDistributor);
-        console.log("this.pageRecordsLwc = " + JSON.stringify(cloneData));
-        console.log("this.accountid = " + this.accountid);
-        console.log("this.ESetid = " + this.ESetid);
+        console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc));
+        console.log('this.OECId = ' + this.OECId);
+        console.log('this.HospitalName = ' + this.HospitalName);
+        console.log('this.secondaryDistributor = ' + this.secondaryDistributor);
+        console.log('this.pageRecordsLwc = ' + JSON.stringify(cloneData));
+        console.log('this.accountid = ' + this.accountid);
+        console.log('this.ESetid = ' + this.ESetid);
         console.log(
-            "this.consumableproductdetailsRecords = " +
-            JSON.stringify(this.consumableproductdetailsRecords)
+            'this.consumableproductdetailsRecords = ' +
+                JSON.stringify(this.consumableproductdetailsRecords)
         );
         save({
             cocLwc: this.cocLwc,
@@ -1547,79 +1803,87 @@
             pageRecordsLwc: cloneData,
             accountidLwc: this.accountid,
             ESetIdLwc: this.ESetid,
-            consumableproductdetailsRecordsLwc: this.consumableproductdetailsRecords,
+            consumableproductdetailsRecordsLwc:
+                this.consumableproductdetailsRecords,
             agencyProTypeLwc: this.agencyProType,
             userWorkLocationLwc: this.userWorkLocation
-        }).then((r) => {
-            r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
-            debugger
-            if (r.status == "Success") {
-                let url = "/lexsummonscreat?ESetid=" + r.entity.ESetId;
-                this[NavigationMixin.Navigate]({
-                    type: "standard__webPage",
-                    attributes: {
-                        url: url,
-                    },
-                });
-            } else {
-                console.log("r.msg = " + r.msg);
-                this.showToast("Error", r.msg);
-            }
-        }).catch((error) => {
-            console.log("error = " + JSON.stringify(error));
-        });
+        })
+            .then((r) => {
+                r = JSON.parse(JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
+                debugger;
+                if (r.status == 'Success') {
+                    let url = '/lexsummonscreat?ESetid=' + r.entity.ESetId;
+                    this[NavigationMixin.Navigate]({
+                        type: 'standard__webPage',
+                        attributes: {
+                            url: url
+                        }
+                    });
+                } else {
+                    console.log('r.msg = ' + r.msg);
+                    this.showToast('Error', r.msg);
+                }
+            })
+            .catch((error) => {
+                console.log('error = ' + JSON.stringify(error));
+            });
     }
 
     //鎵撳嵃鎸囩ず鍗�
     PraseToPDFJs() {
-        console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
-        console.log("this.ESetId = " + this.ESetid);
+        console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc));
+        console.log('this.ESetId = ' + this.ESetid);
         PraseToPDF({
             cocLwc: this.cocLwc,
-            ESetId: this.ESetid,
+            ESetId: this.ESetid
         }).then((r) => {
             r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
-            if (r.status == "Success") {
-                window.open("/customer/summonsPDF?ESetid=" + r.entity.ESetId);
+            console.log('r = ' + JSON.stringify(r));
+            if (r.status == 'Success') {
+                window.open('/customer/summonsPDF?ESetid=' + r.entity.ESetId);
             } else {
-                console.log("r.msg = " + r.msg);
-                this.showToast("Error", r.msg);
+                console.log('r.msg = ' + r.msg);
+                this.showToast('Error', r.msg);
             }
         });
     }
 
     //鏄剧ず鏄庣粏
     openReportJs() {
-        console.log("openReportJs");
+        console.log('openReportJs');
         var reportId = this.ESetid;
         reportId = reportId.substring(0, 15);
-        let reportFilters = '[{"operator":"equals","value":"' + reportId + '","column":"FK_CUSTENT_ID"}]';
-        let url = "/report/00O0l000000zZtpEAE?reportFilters=" + encodeURIComponent(reportFilters);
-        console.log("url = " + url);
+        let reportFilters =
+            '[{"operator":"equals","value":"' +
+            reportId +
+            '","column":"FK_CUSTENT_ID"}]';
+        let url =
+            '/report/00O0l000000zZtpEAE?reportFilters=' +
+            encodeURIComponent(reportFilters);
+        console.log('url = ' + url);
         this[NavigationMixin.Navigate]({
-            type: "standard__webPage",
+            type: 'standard__webPage',
             attributes: {
-                url: url,
-            },
+                url: url
+            }
         });
     }
 
     vpClear2Delay(event) {
-        console.log("vpClear2Delay");
-        if (this.summonsForDirction != "浜掔浉璋冭揣") {
-            this.cocLwc["Order_ForDealerText__c"] = event.target.value;
-            console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+        console.log('vpClear2Delay');
+        if (this.summonsForDirction != '浜掔浉璋冭揣') {
+            this.cocLwc['Order_ForDealerText__c'] = event.target.value;
+            console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc));
         } else {
             //console.log('Order_ForDealerTextID__c = ' + this.cocLwc['Order_ForDealerTextID__c'])
-            this.cocLwc["Order_ForDealerText__c"] =
-                this.cocLwc["Order_ForDealerTextID__c"] == "" ||
-                    this.cocLwc["Order_ForDealerTextID__c"] == null ||
-                    this.cocLwc["Order_ForDealerTextID__c"] == undefined
-                    ? ""
-                    : this.cocLwc["Order_ForDealerText__c"];
-            console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+            this.cocLwc['Order_ForDealerText__c'] =
+                this.cocLwc['Order_ForDealerTextID__c'] == '' ||
+                this.cocLwc['Order_ForDealerTextID__c'] == null ||
+                this.cocLwc['Order_ForDealerTextID__c'] == undefined
+                    ? ''
+                    : this.cocLwc['Order_ForDealerText__c'];
+            console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc));
             // console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc));
             // this.ForDealerText = this.cocLwc['Order_ForDealerText__c'];
             // event.target.value = this.cocLwc['Order_ForDealerText__c'];
@@ -1628,28 +1892,28 @@
     }
     handleSearch(event) {
         const lookupElement = event.target;
-        console.log("event.detail = " + JSON.stringify(event.detail));
+        console.log('event.detail = ' + JSON.stringify(event.detail));
         apexSearch({
-            searchTerm: event.detail.searchTerm,
+            searchTerm: event.detail.searchTerm
         })
             .then((results) => {
                 lookupElement.setSearchResults(results);
             })
             .catch((error) => {
-                console.log("error" + JSON.stringify(error));
+                console.log('error' + JSON.stringify(error));
             });
     }
 
     handleSelectionChange(event) {
         const selection = event.target.getSelection();
-        console.log("selection = " + JSON.stringify(selection));
-        this.cocLwc["Order_ForDealerTextID__c"] = selection[0].id;
-        this.cocLwc["Order_ForDealerText__c"] = selection[0].title;
-        console.log("this.cocLwc = " + JSON.stringify(this.cocLwc));
+        console.log('selection = ' + JSON.stringify(selection));
+        this.cocLwc['Order_ForDealerTextID__c'] = selection[0].id;
+        this.cocLwc['Order_ForDealerText__c'] = selection[0].title;
+        console.log('this.cocLwc = ' + JSON.stringify(this.cocLwc));
     }
 
     handleFilesChange(event) {
-        console.log("handleFilesChange");
+        console.log('handleFilesChange');
         if (event.target.files.length > 0) {
             this.filesUploaded = event.target.files;
             this.fileName = event.target.files[0].name;
@@ -1657,11 +1921,11 @@
     }
 
     handleSave() {
-        console.log("saveFile");
+        console.log('saveFile');
         if (this.filesUploaded.length > 0) {
             this.file = this.filesUploaded[0];
             if (this.file.size > this.MAX_FILE_SIZE) {
-                this.showToast("Error", "鏂囦欢杩囧ぇ");
+                this.showToast('Error', '鏂囦欢杩囧ぇ');
                 return;
             }
             this.showPopSpinner = true;
@@ -1669,60 +1933,62 @@
 
             this.fileReader.onloadend = () => {
                 this.fileContents = this.fileReader.result;
-                let base64 = "base64,";
-                this.content = this.fileContents.indexOf(base64) + base64.length;
+                let base64 = 'base64,';
+                this.content =
+                    this.fileContents.indexOf(base64) + base64.length;
                 this.fileContents = this.fileContents.substring(this.content);
                 this.saveToFile();
             };
             this.fileReader.readAsDataURL(this.file);
         } else {
-            this.fileName = "閫夋嫨涓�涓枃浠朵笂浼�";
+            this.fileName = '閫夋嫨涓�涓枃浠朵笂浼�';
         }
     }
 
     saveToFile() {
-        console.log("saveToFile");
-        console.log("base64Data = " + encodeURIComponent(this.fileContents));
+        console.log('saveToFile');
+        console.log('base64Data = ' + encodeURIComponent(this.fileContents));
         saveFile({
             recordId: this.ESetid,
             fileName: this.fileName,
-            base64Data: encodeURIComponent(this.fileContents),
+            base64Data: encodeURIComponent(this.fileContents)
         })
             .then((r) => {
                 this.showPopSpinner = false;
                 r = JSON.parse(JSON.stringify(r));
-                console.log("r = " + JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
                 this.closePop();
-                this.showToast("Success", "涓婁紶鎴愬姛");
+                this.showToast('Success', '涓婁紶鎴愬姛');
                 this.getFiles();
             })
             .catch((error) => {
                 this.showPopSpinner = false;
-                console.log("error = " + error.message);
-                this.showToast("Error", "涓婁紶澶辫触");
+                console.log('error = ' + error.message);
+                this.showToast('Error', '涓婁紶澶辫触');
             });
     }
 
     getFiles() {
-        console.log("getFiles");
+        console.log('getFiles');
         this.showLoadingSpinner = true;
         getFiles({
-            recordId: this.ESetid,
+            recordId: this.ESetid
         })
             .then((r) => {
                 r = JSON.parse(JSON.stringify(r));
-                console.log("r = " + JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
                 this.fileData = r.entity.cvList;
                 for (var i in this.fileData) {
-                    this.fileData[i]["CreatedByName"] = this.fileData[i].CreatedBy.Name;
-                    this.fileData[i]["url"] = "/" + this.fileData[i].Id;
+                    this.fileData[i]['CreatedByName'] =
+                        this.fileData[i].CreatedBy.Name;
+                    this.fileData[i]['url'] = '/' + this.fileData[i].Id;
                 }
-                console.log("this.fileData = " + this.fileData);
+                console.log('this.fileData = ' + this.fileData);
                 this.showLoadingSpinner = false;
             })
             .catch((error) => {
-                console.log("error = " + error.message);
-                this.showToast("Error", "鑾峰彇闄勪欢澶辫触");
+                console.log('error = ' + error.message);
+                this.showToast('Error', '鑾峰彇闄勪欢澶辫触');
             });
     }
 
@@ -1730,93 +1996,100 @@
         this.isShowSpinner = true;
 
         //鏌ヨ鏈夊摢浜涢�夋嫨浜嗙殑鐒跺悗check
-        const selectedRows = this.template.querySelector('c-lex-custom-lightning-datatable').getSelectedRows();
+        const selectedRows = this.template
+            .querySelector('c-lex-custom-lightning-datatable')
+            .getSelectedRows();
         console.log('selectedRows = ' + selectedRows);
         for (var i in this.data) {
-            this.data[i]["check"] = false;
+            this.data[i]['check'] = false;
         }
         for (var i in this.data) {
             for (var j in selectedRows) {
                 if (this.data[i].Id == selectedRows[j].Id) {
-                    this.data[i]["check"] = true;
+                    this.data[i]['check'] = true;
                 }
             }
         }
 
         let cloneData = this.data;
         for (var i in cloneData) {
-            cloneData[i]["Name"] = cloneData[i].Name__c;
-            cloneData[i]["Category3"] = cloneData[i].Category3__c;
-            cloneData[i]["Category4"] = cloneData[i].Category4__c;
-            cloneData[i]["Category5"] = cloneData[i].Category5__c;
-            cloneData[i]["BoxPiece"] = cloneData[i].Box_Piece__c;
+            cloneData[i]['Name'] = cloneData[i].Name__c;
+            cloneData[i]['Category3'] = cloneData[i].Category3__c;
+            cloneData[i]['Category4'] = cloneData[i].Category4__c;
+            cloneData[i]['Category5'] = cloneData[i].Category5__c;
+            cloneData[i]['BoxPiece'] = cloneData[i].Box_Piece__c;
             delete cloneData[i].Name__c;
             delete cloneData[i].Category3__c;
             delete cloneData[i].Category4__c;
             delete cloneData[i].Category5__c;
             delete cloneData[i].Box_Piece__c;
         }
-        console.log("cloneData = " + JSON.stringify(cloneData));
+        console.log('cloneData = ' + JSON.stringify(cloneData));
         GoodsDelivery({
             cocLwc: this.cocLwc,
             ESetId: this.ESetid,
-            pageRecordsLwcLwc: cloneData,
+            pageRecordsLwcLwc: cloneData
         })
             .then((r) => {
                 r = JSON.parse(JSON.stringify(r));
-                console.log("r = " + JSON.stringify(r));
-                if (r.status == "Success") {
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
                     console.log(
-                        "Summons_Order_type__c = " + this.cocLwc["Summons_Order_type__c"]
+                        'Summons_Order_type__c = ' +
+                            this.cocLwc['Summons_Order_type__c']
                     );
                     this.isSales =
-                        this.cocLwc["Summons_Order_type__c"] == "閿�鍞�" ? true : false;
+                        this.cocLwc['Summons_Order_type__c'] == '閿�鍞�'
+                            ? true
+                            : false;
                     this.GoodsDeliveryInit();
                 } else {
-                    console.log("r.msg = " + r.msg);
-                    this.showToast("Error", r.msg);
+                    console.log('r.msg = ' + r.msg);
+                    this.showToast('Error', r.msg);
                 }
                 this.isShippingSales = true;
             })
             .catch((error) => {
-                console.log("error = " + error.message);
-                this.showToast("Error", "璺宠浆澶辫触");
+                console.log('error = ' + error.message);
+                this.showToast('Error', '璺宠浆澶辫触');
             });
     }
 
     GoodsDeliveryInit() {
-        console.log("GoodsDeliveryInit");
+        console.log('GoodsDeliveryInit');
         GoodsDeliveryInit({
-            ESetId: this.ESetid,
+            ESetId: this.ESetid
         })
             .then((r) => {
                 r = JSON.parse(JSON.stringify(r));
-                console.log("r = " + JSON.stringify(r));
-                if (r.status == "Success") {
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
                     this.salesCoc = r.entity.coc;
                     this.salesAccountName = r.entity.accountName;
                     this.salesUserWorkLocation = r.entity.userWorkLocation;
                     this.salesAccountid = r.entity.accountid;
                     this.salesOrderdetails = r.entity.orderdetails;
                     this.salesData = r.entity.consumableorderdetailsRecords;
-                    this.salesErrorData = r.entity.consumableorderdetailsRecordserror;
+                    this.salesErrorData =
+                        r.entity.consumableorderdetailsRecordserror;
                     this.salesOrderpieceorboxMap = r.entity.orderpieceorboxMap;
                     this.salesOrderpriceMap = r.entity.orderpriceMap;
-                    this.salesOrderagencypriceMap = r.entity.orderagencypriceMap;
+                    this.salesOrderagencypriceMap =
+                        r.entity.orderagencypriceMap;
                     this.isShowSpinner = false;
                 } else {
-                    console.log("r.msg = " + r.msg);
-                    this.showToast("Error", r.msg);
+                    console.log('r.msg = ' + r.msg);
+                    this.showToast('Error', r.msg);
                 }
             })
             .catch((error) => {
-                console.log("error = " + error.message);
-                this.showToast("Error", "鍒濆鍖栧け璐�");
+                console.log('error = ' + error.message);
+                this.showToast('Error', '鍒濆鍖栧け璐�');
             });
     }
 
     SalesearchProductJs() {
-        console.log("this.Barcode = " + this.Barcode);
+        console.log('this.Barcode = ' + this.Barcode);
         this.isShowSpinner = true;
         SearchPro({
             cocLwc: this.salesCoc,
@@ -1825,55 +2098,65 @@
             userWorkLocation: this.salesUserWorkLocation,
             accountid: this.salesAccountid,
             orderdetails: this.salesOrderdetails,
-            orderpieceorboxMap: this.salesOrderpieceorboxMap,
+            orderpieceorboxMap: this.salesOrderpieceorboxMap
         })
             .then((r) => {
                 r = JSON.parse(JSON.stringify(r));
-                console.log("r = " + JSON.stringify(r));
-                if (r.status == "Success") {
-                    console.log("SearchPro success");
-                    this.salesErrorData = r.entity.consumableorderdetailsRecordserror;
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
+                    console.log('SearchPro success');
+                    this.salesErrorData =
+                        r.entity.consumableorderdetailsRecordserror;
                     this.salesData = r.entity.consumableorderdetailsRecords;
                     for (var i in this.salesErrorData) {
-                        this.salesErrorData[i]["Consumable_order_minor__c"] =
-                            this.salesErrorData[i].orderdetails2.Consumable_order_minor__c;
-                        this.salesErrorData[i]["orderdetails2Name"] =
+                        this.salesErrorData[i]['Consumable_order_minor__c'] =
+                            this.salesErrorData[
+                                i
+                            ].orderdetails2.Consumable_order_minor__c;
+                        this.salesErrorData[i]['orderdetails2Name'] =
                             this.salesErrorData[i].orderdetails2.Name;
-                        this.salesErrorData[i]["ProdName"] =
+                        this.salesErrorData[i]['ProdName'] =
                             this.salesErrorData[i].Prod.Name;
-                        this.salesErrorData[i]["Box_Piece__c"] =
+                        this.salesErrorData[i]['Box_Piece__c'] =
                             this.salesErrorData[i].orderdetails2.Box_Piece__c;
-                        this.salesErrorData[i]["Bar_Code__c"] =
+                        this.salesErrorData[i]['Bar_Code__c'] =
                             this.salesErrorData[i].orderdetails2.Bar_Code__c;
-                        this.salesErrorData[i]["Sterilization_limit__c"] =
-                            this.salesErrorData[i].orderdetails2.Sterilization_limit__c;
+                        this.salesErrorData[i]['Sterilization_limit__c'] =
+                            this.salesErrorData[
+                                i
+                            ].orderdetails2.Sterilization_limit__c;
                     }
                     for (var i in this.salesData) {
-                        this.salesData[i]["Consumable_order_minor__c"] =
-                            this.salesData[i].orderdetails2.Consumable_order_minor__c;
-                        this.salesData[i]["orderdetails2Name"] =
+                        this.salesData[i]['Consumable_order_minor__c'] =
+                            this.salesData[
+                                i
+                            ].orderdetails2.Consumable_order_minor__c;
+                        this.salesData[i]['orderdetails2Name'] =
                             this.salesData[i].orderdetails2.Name;
-                        this.salesData[i]["orderdetails2NameUrl"] =
-                            "/" + this.salesData[i].orderdetails2.Id;
-                        this.salesData[i]["Box_Piece__c"] =
+                        this.salesData[i]['orderdetails2NameUrl'] =
+                            '/' + this.salesData[i].orderdetails2.Id;
+                        this.salesData[i]['Box_Piece__c'] =
                             this.salesData[i].orderdetails2.Box_Piece__c;
-                        this.salesData[i]["ProdName"] = this.salesData[i].Prod.Name;
-                        this.salesData[i]["Deliver_date__c"] =
+                        this.salesData[i]['ProdName'] =
+                            this.salesData[i].Prod.Name;
+                        this.salesData[i]['Deliver_date__c'] =
                             this.salesData[i].orderdetails2.Deliver_date__c;
-                        this.salesData[i]["Bar_Code__c"] =
+                        this.salesData[i]['Bar_Code__c'] =
                             this.salesData[i].orderdetails2.Bar_Code__c;
-                        this.salesData[i]["Sterilization_limit__c"] =
-                            this.salesData[i].orderdetails2.Sterilization_limit__c;
+                        this.salesData[i]['Sterilization_limit__c'] =
+                            this.salesData[
+                                i
+                            ].orderdetails2.Sterilization_limit__c;
                     }
                     this.isShowSpinner = false;
                 } else {
-                    console.log("r.msg = " + r.msg);
-                    this.showToast("Error", r.msg);
+                    console.log('r.msg = ' + r.msg);
+                    this.showToast('Error', r.msg);
                 }
             })
             .catch((error) => {
-                console.log("error = " + JSON.stringify(error.message));
-                this.showToast("Error", "鍒濆鍖栧け璐�");
+                console.log('error = ' + JSON.stringify(error.message));
+                this.showToast('Error', '鍒濆鍖栧け璐�');
             });
     }
 
@@ -1888,7 +2171,7 @@
             delete cloneSalesData[i].Deliver_date__c;
             delete cloneSalesData[i].Bar_Code__c;
             delete cloneSalesData[i].Sterilization_limit__c;
-            cloneSalesData[i]["ErrorReason"] = "";
+            cloneSalesData[i]['ErrorReason'] = '';
         }
         this.isShowSpinner = true;
         ProSale({
@@ -1900,28 +2183,28 @@
             consumableorderdetailsRecordsLwc: JSON.stringify(cloneSalesData),
             orderdetails: this.salesOrderdetails,
             orderpriceMap: this.salesOrderpriceMap,
-            orderagencypriceMap: this.salesOrderagencypriceMap,
+            orderagencypriceMap: this.salesOrderagencypriceMap
         })
             .then((r) => {
                 r = JSON.parse(JSON.stringify(r));
-                console.log("r = " + JSON.stringify(r));
-                if (r.status == "Success") {
-                    console.log("ProdElivery success");
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
+                    console.log('ProdElivery success');
                     this.isShowSpinner = false;
                     this[NavigationMixin.Navigate]({
-                        type: "standard__webPage",
+                        type: 'standard__webPage',
                         attributes: {
-                            url: "/lexsaleanddelivery",
-                        },
+                            url: '/lexsaleanddelivery'
+                        }
                     });
                 } else {
-                    console.log("r.msg = " + r.msg);
-                    this.showToast("Error", r.msg);
+                    console.log('r.msg = ' + r.msg);
+                    this.showToast('Error', r.msg);
                 }
             })
             .catch((error) => {
-                console.log("error = " + JSON.stringify(error.message));
-                this.showToast("Error", "ProSale2澶辫触");
+                console.log('error = ' + JSON.stringify(error.message));
+                this.showToast('Error', 'ProSale2澶辫触');
             });
     }
 
@@ -1936,7 +2219,7 @@
             delete cloneSalesData[i].Deliver_date__c;
             delete cloneSalesData[i].Bar_Code__c;
             delete cloneSalesData[i].Sterilization_limit__c;
-            cloneSalesData[i]["ErrorReason"] = "";
+            cloneSalesData[i]['ErrorReason'] = '';
         }
         this.isShowSpinner = true;
         ProdElivery({
@@ -1948,28 +2231,28 @@
             consumableorderdetailsRecordsLwc: JSON.stringify(cloneSalesData),
             orderdetails: this.salesOrderdetails,
             orderpriceMap: this.salesOrderpriceMap,
-            orderagencypriceMap: this.salesOrderagencypriceMap,
+            orderagencypriceMap: this.salesOrderagencypriceMap
         })
             .then((r) => {
                 r = JSON.parse(JSON.stringify(r));
-                console.log("r = " + JSON.stringify(r));
-                if (r.status == "Success") {
-                    console.log("ProdElivery success");
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
+                    console.log('ProdElivery success');
                     this.isShowSpinner = false;
                     this[NavigationMixin.Navigate]({
-                        type: "standard__webPage",
+                        type: 'standard__webPage',
                         attributes: {
-                            url: "/lexsaleanddelivery",
-                        },
+                            url: '/lexsaleanddelivery'
+                        }
                     });
                 } else {
-                    console.log("r.msg = " + r.msg);
-                    this.showToast("Error", r.msg);
+                    console.log('r.msg = ' + r.msg);
+                    this.showToast('Error', r.msg);
                 }
             })
             .catch((error) => {
-                console.log("error = " + JSON.stringify(error.message));
-                this.showToast("Error", "鍒濆鍖栧け璐�");
+                console.log('error = ' + JSON.stringify(error.message));
+                this.showToast('Error', '鍒濆鍖栧け璐�');
             });
     }
 
@@ -1978,15 +2261,23 @@
         let url = '';
         console.log('this.invoiceId = ' + this.invoiceId);
         if (this.invoiceId.length > 0 && this.invoiceId != '000000000000000') {
-            url = "/lexconinvoiceview?deliveryId=" + this.ESetid + "&invoiceId=" + this.invoiceId + "&KeyWords=Redirect";
+            url =
+                '/lexconinvoiceview?deliveryId=' +
+                this.ESetid +
+                '&invoiceId=' +
+                this.invoiceId +
+                '&KeyWords=Redirect';
         } else {
-            url = "/lexconinvoiceview?deliveryId=" + this.ESetid + "&KeyWords=Redirect";
+            url =
+                '/lexconinvoiceview?deliveryId=' +
+                this.ESetid +
+                '&KeyWords=Redirect';
         }
         this[NavigationMixin.Navigate]({
-            type: "standard__webPage",
+            type: 'standard__webPage',
             attributes: {
-                url: url,
-            },
+                url: url
+            }
         });
     }
 
@@ -1994,33 +2285,35 @@
     DeleteConsumable() {
         this.isShowSpinner = true;
         DelConsumable({
-            ESetId: this.ESetid,
-        }).then((r) => {
-            r = JSON.parse(JSON.stringify(r));
-            console.log("r = " + JSON.stringify(r));
-            if (r.status == "Success") {
-                let url = "/lexsaleanddelivery";
-                this[NavigationMixin.Navigate]({
-                    type: "standard__webPage",
-                    attributes: {
-                        url: url,
-                    },
-                });
-            } else {
-                console.log("r.msg = " + r.msg);
-                this.showToast("Error", r.msg);
-            }
-        }).catch((error) => {
-            console.log("error = " + error.message);
-            this.showToast("Error", "璺宠浆澶辫触");
-        });
+            ESetId: this.ESetid
+        })
+            .then((r) => {
+                r = JSON.parse(JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
+                    let url = '/lexsaleanddelivery';
+                    this[NavigationMixin.Navigate]({
+                        type: 'standard__webPage',
+                        attributes: {
+                            url: url
+                        }
+                    });
+                } else {
+                    console.log('r.msg = ' + r.msg);
+                    this.showToast('Error', r.msg);
+                }
+            })
+            .catch((error) => {
+                console.log('error = ' + error.message);
+                this.showToast('Error', '璺宠浆澶辫触');
+            });
     }
 
     handleLoad() {
-        console.log('handleLoad')
+        console.log('handleLoad');
         try {
             const style = document.createElement('style');
-            style.innerText = '.slds-button__icon {display: none;}';
+            //style.innerText = '.slds-button__icon {display: none;}';
             this.template.querySelector('.hideHelpText').appendChild(style);
         } catch (error) {
             console.log(error);
@@ -2028,14 +2321,15 @@
     }
 
     handleLoad2() {
-        console.log('handleLoad2')
+        console.log('handleLoad2');
         try {
             const style = document.createElement('style');
-            style.innerText = '.slds-button__icon {display: none;}';
+            // style.innerText = '.slds-button__icon {display: none;}';
             this.template.querySelector('.hideHelpText').appendChild(style);
 
             const style2 = document.createElement('style');
-            style2.innerText = '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
+            style2.innerText =
+                '.hehe-layoutItem  .slds-form-element__label {padding : 0px}';
             this.template.querySelector('.hideHelpText').appendChild(style2);
         } catch (error) {
             console.log(error);
@@ -2043,12 +2337,13 @@
     }
     //缂栬緫鍑哄簱鍗�
     EditConsumable() {
-        let url = "/lexsummonscreat?ESetid=" + this.ESetid + "&KeyWords=Redirect";
+        let url =
+            '/lexsummonscreat?ESetid=' + this.ESetid + '&KeyWords=Redirect';
         this[NavigationMixin.Navigate]({
-            type: "standard__webPage",
+            type: 'standard__webPage',
             attributes: {
-                url: url,
-            },
+                url: url
+            }
         });
     }
 
@@ -2068,7 +2363,11 @@
 
     //鏄惁鏄剧ず闄勪欢绉婚櫎
     get attDelBtn() {
-        if (this.fileName != '' && this.fileName != null && this.fileName != '璇烽�夋嫨涓�涓枃浠朵笂浼�') {
+        if (
+            this.fileName != '' &&
+            this.fileName != null &&
+            this.fileName != '璇烽�夋嫨涓�涓枃浠朵笂浼�'
+        ) {
             return true;
         } else {
             return false;
@@ -2095,4 +2394,211 @@
         this.Category5 = '';
         this.searchProductJs();
     }
-}
\ No newline at end of file
+
+    sortBy(field, reverse, primer) {
+        const key = primer
+            ? function (x) {
+                  return primer(x[field]);
+              }
+            : function (x) {
+                  return x[field];
+              };
+
+        return function (a, b) {
+            a = key(a);
+            b = key(b);
+            return reverse * ((a > b) - (b > a));
+        };
+    }
+
+    onHandleSort(event) {
+        //灏嗗凡缁忛�夊ソ浜嗙殑鏀惧埌鍓嶉潰锛屼笉杩涜鎺掑簭
+        if (this.EditAble) {
+            const { fieldName: sortedBy, sortDirection } = event.detail;
+            const cloneData = [...this.data];
+            cloneData.sort(
+                this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1)
+            );
+            let index = 0;
+            let selectedRows = this.template
+                .querySelector('c-lex-custom-lightning-datatable')
+                .getSelectedRows();
+            let selectedRowsIds = [];
+            for (var i in selectedRows) {
+                selectedRowsIds.push(selectedRows[i].Id);
+            }
+            console.log('selectedRowsIds = ' + JSON.stringify(selectedRowsIds));
+            for (var i = 0; i < cloneData.length; i++) {
+                if (selectedRowsIds.indexOf(cloneData[i].Id) != -1) {
+                    if (i != 0) {
+                        let temp = cloneData[index];
+                        cloneData[index] = cloneData[i];
+                        cloneData[i] = temp;
+                    }
+                    index++;
+                }
+            }
+            this.data = cloneData;
+            this.sortDirection = sortDirection;
+            this.sortedBy = sortedBy;
+        } else {
+            const { fieldName: sortedBy, sortDirection } = event.detail;
+            const cloneData = [...this.editData];
+            cloneData.sort(
+                this.sortBy(sortedBy, sortDirection === 'asc' ? 1 : -1)
+            );
+            this.editData = cloneData;
+            this.sortDirection = sortDirection;
+            this.sortedBy = sortedBy;
+        }
+    }
+
+    handlePrevious() {
+        this.currentPageToken =
+            Number(this.currentPageToken) - Number(this.pageSize);
+        this.searchProductJs();
+    }
+
+    handleNext() {
+        this.currentPageToken =
+            Number(this.currentPageToken) + Number(this.pageSize);
+        this.searchProductJs();
+    }
+    handleFirst() {
+        this.currentPageToken = 0;
+        this.searchProductJs();
+    }
+
+    handleLast() {
+        this.currentPageToken =
+            this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+        this.searchProductJs();
+    }
+
+    handlePageschange(event) {
+        console.log(event.detail);
+        this.pageSize = event.detail;
+        this.currentPageToken = 0;
+        this.searchProductJs();
+    }
+
+    editHandlePrevious() {
+        this.currentPageToken =
+            Number(this.currentPageToken) - Number(this.pageSize);
+        this.searchEditProductJs();
+    }
+
+    editHandleNext() {
+        this.currentPageToken =
+            Number(this.currentPageToken) + Number(this.pageSize);
+        this.searchEditProductJs();
+    }
+    editHandleFirst() {
+        this.currentPageToken = 0;
+        this.searchEditProductJs();
+    }
+
+    editHandleLast() {
+        this.currentPageToken =
+            this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+        this.searchEditProductJs();
+    }
+
+    editHandlePageschange(event) {
+        console.log(event.detail);
+        this.pageSize = event.detail;
+        this.currentPageToken = 0;
+        this.searchEditProductJs();
+    }
+
+    searchEditProductJs() {
+        this.isEditShowSpinner = true;
+        this.showTable = false;
+        init({
+            ESetidJs: this.ESetid,
+            statusEdit: this.statusEdit,
+            pageSizeLWC: this.pageSize,
+            pageTokenLWC: this.currentPageToken
+        })
+            .then((r) => {
+                r = JSON.parse(JSON.stringify(r));
+                console.log('r = ' + JSON.stringify(r));
+                if (r.status == 'Success') {
+                    //鍒嗛〉
+                    console.log(
+                        'r.entity.paginatedAccounts = ' +
+                            JSON.stringify(r.entity.paginatedAccounts)
+                    );
+                    this.nextPageToken =
+                        r.entity.paginatedAccounts.nextPageToken;
+                    this.totalRecords = r.entity.paginatedAccounts.totalRecords;
+                    this.recordStart = r.entity.paginatedAccounts.recordStart;
+                    this.recordEnd = r.entity.paginatedAccounts.recordEnd;
+                    this.totalPages = Math.ceil(
+                        r.entity.paginatedAccounts.totalRecords / this.pageSize
+                    );
+                    console.log('this.totalPages = ' + this.totalPages);
+
+                    this.editData = r.entity.pageRecords;
+                    console.log(
+                        'this.data start = ' + JSON.stringify(this.data)
+                    );
+                    for (var i in this.editData) {
+                        this.editData[i]['unitValue'] =
+                            this.editData[i]['unitValue'];
+                        this.editData[i]['InvoiceProNot_count__c'] =
+                            this.editData[
+                                i
+                            ].orderdetails1.InvoiceProNot_count__c;
+                        this.editData[i]['RrturnPro_count__c'] =
+                            this.editData[i].orderdetails1.RrturnPro_count__c;
+                        this.editData[i]['Invoiced_Procount__c'] =
+                            this.editData[i].orderdetails1.Invoiced_Procount__c;
+                        this.editData[i]['shipmentNumber'] =
+                            this.editData[i].orderdetails1['Shipment_Count__c'];
+                        this.editData[i]['shippingUnitPrice'] =
+                            this.editData[i].orderdetails1[
+                                'Delivery_List_RMB__c'
+                            ];
+
+                        this.editData[i]['recordId'] = this.editData[i].Prod.Id;
+                        this.editData[i]['Id'] = this.editData[i].Prod.Id;
+                        this.editData[i]['Name__c'] =
+                            this.editData[i].Prod.Name__c;
+                        this.editData[i]['SFDA_Status__c'] =
+                            this.editData[i].Prod.SFDA_Status__c;
+                        this.editData[i]['Category3__c'] =
+                            this.editData[i].Prod.Category3__c;
+                        this.editData[i]['Category4__c'] =
+                            this.editData[i].Prod.Category4__c;
+                        this.editData[i]['Category5__c'] =
+                            this.editData[i].Prod.Category5__c;
+                        this.editData[i]['Box_Piece__c'] =
+                            this.editData[i].orderdetails1.Box_Piece__c;
+                        this.editData[i]['shipmentAmount'] =
+                            this.editData[i].orderdetails1.Shipment_amount__c;
+                        this.editData[i]['Shipment_amount__c'] =
+                            this.editData[i].orderdetails1.Shipment_amount__c;
+                        this.editData[i]['Shipment_Count__c'] =
+                            this.editData[i].orderdetails1.Shipment_Count__c;
+                    }
+                    this.showTable = true;
+                    this.isEditShowSpinner = false;
+                } else {
+                    console.log('r = ' + JSON.stringify(r));
+                    this.showToast('Error', r.msg);
+                }
+            })
+            .catch((error) => {
+                console.log('error = ' + JSON.stringify(error));
+            });
+    }
+
+    get previousButtonDisabled() {
+        return this.currentPageToken === 0;
+    }
+
+    get nextButtonDisabled() {
+        return this.nextPageToken === undefined;
+    }
+}
diff --git a/force-app/main/default/lwc/paginatedList/paginatedList.html b/force-app/main/default/lwc/paginatedList/paginatedList.html
index 808aba7..e4c7e1a 100644
--- a/force-app/main/default/lwc/paginatedList/paginatedList.html
+++ b/force-app/main/default/lwc/paginatedList/paginatedList.html
@@ -1,6 +1,9 @@
 <template>
     <template if:true={loader}>
-        <lightning-spinner alternative-text="Loading..." size="small"></lightning-spinner>
+        <lightning-spinner
+            alternative-text="Loading..."
+            size="small"
+        ></lightning-spinner>
     </template>
     <template if:true={records}>
         <div class="table-container">
@@ -14,14 +17,13 @@
             >
             </lightning-datatable>
         </div>
-        <c-paginator    
-            if:true={paginationVisibility}
+        <c-paginator
             onprevious={handlePrevious}
             onnext={handleNext}
             onpageschange={handlePageschange}
             onfirst={handleFirst}
             onlast={handleLast}
-            page-size-options={pageSizeOptions}          
+            page-size-options={pageSizeOptions}
             previous-button-disabled={previousButtonDisabled}
             next-button-disabled={nextButtonDisabled}
             record-start={recordStart}
@@ -32,4 +34,4 @@
     <template if:true={error}>
         <c-error-panel errors={error}></c-error-panel>
     </template>
-</template>
\ No newline at end of file
+</template>
diff --git a/force-app/main/default/lwc/paginatedList/paginatedList.js b/force-app/main/default/lwc/paginatedList/paginatedList.js
index b016d13..243ca83 100644
--- a/force-app/main/default/lwc/paginatedList/paginatedList.js
+++ b/force-app/main/default/lwc/paginatedList/paginatedList.js
@@ -1,36 +1,36 @@
-import { LightningElement, api, track } from "lwc";
-import getAccountsPaginated from "@salesforce/apex/PaginatedListControllerLwc.getAccountsPaginated";
+import { LightningElement, api, track } from 'lwc';
+import getAccountsPaginated from '@salesforce/apex/PaginatedListControllerLwc.getAccountsPaginated';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { reduceErrors } from 'c/ldsUtils';
-import ACCOUNT_NAME_FIELD from "@salesforce/schema/Account.Name";
-import ACCOUNT_TYPE_FIELD from "@salesforce/schema/Account.Type";
-import ACCOUNT_PHONE_FIELD from "@salesforce/schema/Account.Type";
-import ACCOUNT_EMPLOYEES_FIELD from "@salesforce/schema/Account.NumberOfEmployees";
+import ACCOUNT_NAME_FIELD from '@salesforce/schema/Account.Name';
+import ACCOUNT_TYPE_FIELD from '@salesforce/schema/Account.Type';
+import ACCOUNT_PHONE_FIELD from '@salesforce/schema/Account.Type';
+import ACCOUNT_EMPLOYEES_FIELD from '@salesforce/schema/Account.NumberOfEmployees';
 
 const COLUMNS = [
     {
-        label: "Account Name",
+        label: 'Account Name',
         fieldName: ACCOUNT_NAME_FIELD.fieldApiName,
-        type: "text",
-        sortable: "true"
+        type: 'text',
+        sortable: 'true'
     },
-    { label: "Type", fieldName: ACCOUNT_TYPE_FIELD.fieldApiName, type: "text" },
+    { label: 'Type', fieldName: ACCOUNT_TYPE_FIELD.fieldApiName, type: 'text' },
     {
-        label: "Phone",
+        label: 'Phone',
         fieldName: ACCOUNT_PHONE_FIELD.fieldApiName,
-        type: "phone"
+        type: 'phone'
     },
     {
-        label: "Employees",
+        label: 'Employees',
         fieldName: ACCOUNT_EMPLOYEES_FIELD.fieldApiName,
-        type: "Number"
+        type: 'Number'
     }
 ];
 
 export default class PaginatedList extends LightningElement {
     columns = COLUMNS;
-    @track sortBy = "Name";
-    @track sortDirection = "asc";
+    @track sortBy = 'Name';
+    @track sortDirection = 'asc';
     @track pageSize = 10;
     error;
     records;
@@ -61,8 +61,11 @@
                     this.totalRecords = result.totalRecords;
                     this.recordStart = result.recordStart;
                     this.recordEnd = result.recordEnd;
-                    this.totalPages = Math.ceil(result.totalRecords / this.pageSize);
-                    this.paginationVisibility = this.totalPages > 1 ? true : false;
+                    this.totalPages = Math.ceil(
+                        result.totalRecords / this.pageSize
+                    );
+                    this.paginationVisibility =
+                        this.totalPages > 1 ? true : false;
                 }
             })
             .catch((error) => {
@@ -78,7 +81,7 @@
             });
     }
     doSorting(event) {
-        console.log("Sort");
+        console.log('Sort');
         this.sortBy = event.detail.fieldName;
         this.sortDirection = event.detail.sortDirection;
         this.currentPageToken = 0;
@@ -86,12 +89,14 @@
     }
 
     handlePrevious() {
-        this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+        this.currentPageToken =
+            Number(this.currentPageToken) - Number(this.pageSize);
         this.getAccounts();
     }
 
     handleNext() {
-        this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+        this.currentPageToken =
+            Number(this.currentPageToken) + Number(this.pageSize);
         this.getAccounts();
     }
     handleFirst() {
@@ -100,7 +105,8 @@
     }
 
     handleLast() {
-        this.currentPageToken = this.totalPages > 1? (this.totalPages-1)* this.pageSize:0;
+        this.currentPageToken =
+            this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
         this.getAccounts();
     }
 
@@ -117,4 +123,4 @@
     get nextButtonDisabled() {
         return this.nextPageToken === undefined;
     }
-}
\ No newline at end of file
+}
diff --git a/force-app/main/default/pages/summonsCreat.page b/force-app/main/default/pages/summonsCreat.page
index a153471..e78d033 100644
--- a/force-app/main/default/pages/summonsCreat.page
+++ b/force-app/main/default/pages/summonsCreat.page
@@ -1,489 +1,643 @@
-<apex:page Controller="summonsCreatController" showHeader="true" tabStyle="SaleAndDelivery__tab" sidebar="true" id="allPage" action="{!init}" title="鍑哄簱鍗曠鐞�">
-<apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
-<apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
-<apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
-<apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
-<apex:includeScript value="{!URLFOR($Resource.summonsCreatJs)}"/>
-<apex:stylesheet value="{!URLFOR($Resource.jquerysuggestcss)}"/>
-<apex:includeScript value="{!URLFOR($Resource.jquerysuggestjs)}"/>
-<apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
-<apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
-<script type="text/javascript">
-function setFocusOnLoad() {}
-function bodyOnLoad(){setFocusOnLoad();}
-function searchsearchAgencyH(str){
-    //update by rentx 2021-3-1 start
-    //鍏堝垽鏂綋鍓嶇粡閿�鍟嗕笅鏄惁鏈夌淮鎶ょ壒浠峰尰闄� 濡傛灉娌℃湁缁存姢鐗逛环鍖婚櫌 閭d箞鐩存帴鏌ヨ鎵�鏈夊尰闄�
-    var flag = j$(escapeVfId('allPage:allForm:allBlock:Editable:OutPattern01')).value();
-    j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).attr('readonly',true);
-    if ({!hasHos == false}) {
-        openPopup('/customer/searchAgencyHospital?Ctype=' + str+'&ishos=', 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
-    }else{
-        var noOfRecords = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount')).value();
-        var ishosNum = 0;
-        for (var i = 0; i < noOfRecords; i++) {
-            var tempCheckVar = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:'+i+':variableinfo:consumablesCountproRowCheckbox')).value();
-            var tempHosVar = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:'+i+':hosOffer')).value();
-            var tempHosProVar = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:'+i+':hosPro')).value();
-            console.log('tempHosProVar:'+tempHosProVar);
-            if (((tempCheckVar == true || tempCheckVar == 'on') || {!Existarrive}) && (tempHosVar == true || tempHosVar == 'true') && (tempHosProVar == true || tempHosProVar == 'true')) {   
-                ishosNum ++;   
-            }
-
-        }
-        // alert({!Existarrive} + flag);
-        console.log('34:'+ishosNum);
-        if (ishosNum > 0 || ({!Existarrive} && flag == 'true')) {
-        // if (ishosNum > 0) {
-            openPopup('/customer/searchAgencyHospital?Ctype=' + str+'&ishos=true', 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
-        }else{
-            openPopup('/customer/searchAgencyHospital?Ctype=' + str+'&ishos=', 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
-        }
-    }
-    //update by rentx 2021-01-29 start
-    // j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).attr('readonly',true);
-    // openPopup('/customer/searchAgencyHospital?Ctype=' + str, 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
-    // var flag = j$(escapeVfId('allPage:allForm:allBlock:Editable:OutPattern01')).value();
-    // j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).attr('readonly',true);
-    // openPopup('/customer/searchAgencyHospital?Ctype=' + str+'&ishos='+flag, 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
-    //update by rentx 2021-01-29 end
-    //update by rentx 2021-3-1 end
-}
-function clearAgencyI(){
-    var agencyname = j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).value();
-    if (agencyname == '' || agencyname == null) {
-        document.getElementById('allPage:allForm:allBlock:Editable:OECId').value = "";
-    }
-
-    var accid = j$(escapeVfId('allPage:allForm:allBlock:Editable:OECId')).value();
-    if (accid != null && accid != '') {
-        checkOutPatternFn();
-    }
-
-
-}
-// vivek update start
-function saveConfirmJs(str){
-    var msg = "鍑哄簱浠锋牸浠呭彲鎿嶄綔涓�娆″彉鏇达紝淇濆瓨鍚庡皢鏃犳硶淇敼銆俓n\n璇风‘璁わ紒";
-    if(str == '浠锋牸鏈畾'){
-        if(confirm(msg)==true){
-            saveJs();
-        }
-    }else{
-        saveJs();
-    }
-}
-// vivek update end
-
-function setVisitorPlace(){
-    var x = j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value();
-    if (x == '浜掔浉璋冭揣') {
-        try{
-            var str = 'allPage:allForm:allBlock:Editable:Order_ForDealerText';
-            var strPage = null;
-            var options = {};
-            var ros = j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).value();
-            strPage = '/customer/apex/ConSearchAgencyPlace?r=' + encodeURI(ros);
-            options = {minchars:3, minwords:1, resultsClass:'visitorplace_results'};
-            jQuery(escapeVfId(str)).unbind();
-            if (strPage != null) {
-                jQuery(escapeVfId(str)).suggest(strPage,options);
-            }
-        }catch(e){
-            alert(e);
-        }
-    }
-    else{
-        var agencytext = j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).value();
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden')).val(agencytext);
-        //alert('1' + agencytext);
-        //alert('2' + j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden')).value());
-    }
-
-}
-
-function vpClear2_delay(){
-    var x = j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value();
-    if (x == '浜掔浉璋冭揣') {
-        var vp = 'allPage:allForm:allBlock:Editable:Order_ForDealerText';
-        var vpHidden = 'allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden';
-        setTimeout(
-            function() {
-                if(j$(escapeVfId(vp)).attr("jquerysuggest_skip_flag") == "false") {
-                    if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value()) {
-                        vpClear2();
-                    }
-                }
-            },
-            200
-        );
-    }
-    else{
-        var agencytext = j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).value();
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden')).val(agencytext);
-    }
-}
-function vpClear2(){
-  var vp = 'allPage:allForm:allBlock:Editable:Order_ForDealerText';
-  var vpHidden = 'allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden';
-  // alert('vp=' + j$(escapeVfId(vp)).value());
-  // alert('vpHidden=' + j$(escapeVfId(vpHidden)).value());
-  // if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value()) {
-  //   changeFlg = 'false';
-  //   //alert('changeFlg+' +changeFlg);
-  //   if(changeFlg == 'true'){
-  //       vpBefore = j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden')).value();
-  //       j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).val(vpBefore);
-  //       document.getElementById('allPage:allForm:allBlock:Editable:Order_ForDealerText').blur();
-  //       return;
-  //   }
-  // }
-  resetValue('allPage:allForm:allBlock:Editable:Order_ForDealerText');
-}
-function FilesUaplodJs(){
-    //涓婁紶鏂囦欢
-    FilesUpload();
-}
-
-function refreshPageSizeJs() {
-    refreshPageSize();
-}
-
-function CommitConsumable(){
-    //纭鎻愪氦
-    approval();
-    //openPDF();
-}
-function openPDF(){
-    window.open("/customer/summonsPDF?ESetid="+'{!URLENCODE(IdCheck)}');
-}
-
-function openReportJs(){
-    //鎵撳紑鎶ヨ〃
-    var reportId = '{!IdCheck}';
-    reportId = reportId.substring(0,15);
-    window.open("/customer/" +'{!URLENCODE($Label.ConsumableOut_report)}'+ "?pv1="+ encodeURI(reportId));
-}
-
-function openToInvoiceJs(){
-    //鎵撳紑鍙戠エ
-    //upchangeorder();
-    var invoiceId = j$(escapeVfId('allPage:allForm:allBlock:unEditable:ConInvoice_Code_lkid')).value();
-    if (invoiceId.length > 0 && invoiceId != '000000000000000') {
-        window.open("/customer/ConInvoiceView?deliveryId="+'{!URLENCODE(IdCheck)}' + "&invoiceId=" + encodeURI(invoiceId) + "&KeyWords=Redirect","_self");
-    }else{
-        window.open("/customer/ConInvoiceView?deliveryId="+'{!URLENCODE(IdCheck)}' + "&KeyWords=Redirect","_self");
-    }
-}
-
-function PraseToPDFJs(){
-    //鎵撳嵃鎴怭DF
-    PraseToPDF();
-    window.open("/customer/summonsPDF?ESetid="+'{!URLENCODE(IdCheck)}');
-}
-
-function ChangeDirction(j){
-    var a = j.id;
-    var x = j$(escapeVfId(a)).value();
-    var productCount = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount')).value();
-    if(x == '鐩存帴閿�鍞粰鍖婚櫌'){
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',true);
-        document.getElementById('allPage:allForm:allBlock:Editable:province').value = "";
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',true);
-        document.getElementById('allPage:allForm:allBlock:Editable:Order_ForDealerText').value = "";
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
-        //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
-        // }
-    }else if(x == '鍖婚櫌璇曠敤'){
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
-        //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
-        // }
-    }else if(x == '閿�鍞粰浜岀骇缁忛攢鍟�'){
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',false);
-        // }
-    }else if(x == '浜掔浉璋冭揣'){
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',true);
-        document.getElementById('allPage:allForm:allBlock:Editable:OEC').value = "";
-        document.getElementById('allPage:allForm:allBlock:Editable:OECId').value = "";
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',true);
-        document.getElementById('allPage:allForm:allBlock:Editable:Order_ForCustomer').value = "";
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
-        //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
-        // }
-    }else{
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
-        //document.getElementById('allPage:allForm:allBlock:Editable:province').value = "";
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
-        //document.getElementById('allPage:allForm:allBlock:Editable:Order_ForDealerText').value = "";
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',false);
-        //     //document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
-        // }
-    }
-}
-//椤甸潰鍒锋柊閲嶆柊璁$畻閲戦
-function CountCounttestPrice(){
-    var numberDetails =j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount')).value();
-    for(var i = 0; i < numberDetails ; i++){
-        var ckeck = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableinfo' + ':consumablesCountproRowCheckbox')).value();
-
-        if (ckeck == 'on') {
-            var a=document.getElementById ("allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:" + i +":variableAllprice:consumablesCounttestPrice");
-            if ({!Existarrive}) {
-                z  =  parseFloat(j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i +':consumablesCount_UnEditout:consumablesCount_UnEditin')).value());
+<apex:page
+    Controller="summonsCreatController"
+    showHeader="true"
+    tabStyle="SaleAndDelivery__tab"
+    sidebar="true"
+    id="allPage"
+    action="{!init}"
+    title="鍑哄簱鍗曠鐞�"
+>
+    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}" />
+    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}" />
+    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}" />
+    <apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}" />
+    <apex:includeScript value="{!URLFOR($Resource.summonsCreatJs)}" />
+    <apex:stylesheet value="{!URLFOR($Resource.jquerysuggestcss)}" />
+    <apex:includeScript value="{!URLFOR($Resource.jquerysuggestjs)}" />
+    <apex:includeScript value="{!URLFOR($Resource.connection20)}" />
+    <apex:includeScript value="{!URLFOR($Resource.apex20)}" />
+    <script type="text/javascript">
+        console.log('hasHosPro = ' + '{!hasHosPro}')
+        console.log('EditAble = ' + '{!EditAble}')
+        console.log('pageRecords = ' + '{!pageRecords}')
+        console.log('coc = ' + '{!coc}')
+        console.log('provinceOpts = ' + '{!provinceOpts}')
+        console.log('Existarrive = ' + '{!Existarrive}')
+        console.log('SecondDealer = ' + '{!SecondDealer}')
+        function setFocusOnLoad() {}
+        function bodyOnLoad(){setFocusOnLoad();}
+        function searchsearchAgencyH(str){
+            //update by rentx 2021-3-1 start
+            //鍏堝垽鏂綋鍓嶇粡閿�鍟嗕笅鏄惁鏈夌淮鎶ょ壒浠峰尰闄� 濡傛灉娌℃湁缁存姢鐗逛环鍖婚櫌 閭d箞鐩存帴鏌ヨ鎵�鏈夊尰闄�
+            var flag = j$(escapeVfId('allPage:allForm:allBlock:Editable:OutPattern01')).value();
+            j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).attr('readonly',true);
+            if ({!hasHos == false}) {
+                openPopup('/customer/searchAgencyHospital?Ctype=' + str+'&ishos=', 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
             }else{
-                z  =  parseFloat(j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i+':variable:consumablesCount')).value());
+                var noOfRecords = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount')).value();
+                var ishosNum = 0;
+                for (var i = 0; i < noOfRecords; i++) {
+                    var tempCheckVar = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:'+i+':variableinfo:consumablesCountproRowCheckbox')).value();
+                    var tempHosVar = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:'+i+':hosOffer')).value();
+                    var tempHosProVar = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:'+i+':hosPro')).value();
+                    console.log('tempHosProVar:'+tempHosProVar);
+                    if (((tempCheckVar == true || tempCheckVar == 'on') || {!Existarrive}) && (tempHosVar == true || tempHosVar == 'true') && (tempHosProVar == true || tempHosProVar == 'true')) {
+                        ishosNum ++;
+                    }
+
+                }
+                // alert({!Existarrive} + flag);
+                console.log('34:'+ishosNum);
+                if (ishosNum > 0 || ({!Existarrive} && flag == 'true')) {
+                // if (ishosNum > 0) {
+                    openPopup('/customer/searchAgencyHospital?Ctype=' + str+'&ishos=true', 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
+                }else{
+                    openPopup('/customer/searchAgencyHospital?Ctype=' + str+'&ishos=', 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
+                }
+            }
+            //update by rentx 2021-01-29 start
+            // j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).attr('readonly',true);
+            // openPopup('/customer/searchAgencyHospital?Ctype=' + str, 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
+            // var flag = j$(escapeVfId('allPage:allForm:allBlock:Editable:OutPattern01')).value();
+            // j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).attr('readonly',true);
+            // openPopup('/customer/searchAgencyHospital?Ctype=' + str+'&ishos='+flag, 'setsearch', 800, 600, 'width=800,height=600,scrollbars=yes', true);
+            //update by rentx 2021-01-29 end
+            //update by rentx 2021-3-1 end
+        }
+        function clearAgencyI(){
+            var agencyname = j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).value();
+            if (agencyname == '' || agencyname == null) {
+                document.getElementById('allPage:allForm:allBlock:Editable:OECId').value = "";
+            }
+
+            var accid = j$(escapeVfId('allPage:allForm:allBlock:Editable:OECId')).value();
+            if (accid != null && accid != '') {
+                checkOutPatternFn();
+            }
+
+
+        }
+        // vivek update start
+        function saveConfirmJs(str){
+            console.log('pageRecords = ' + '{!pageRecords}')
+            debugger
+            var msg = "鍑哄簱浠锋牸浠呭彲鎿嶄綔涓�娆″彉鏇达紝淇濆瓨鍚庡皢鏃犳硶淇敼銆俓n\n璇风‘璁わ紒";
+            if(str == '浠锋牸鏈畾'){
+                if(confirm(msg)==true){
+                    saveJs();
+                }
+            }else{
+                saveJs();
+            }
+        }
+        // vivek update end
+
+        function setVisitorPlace(){
+            var x = j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value();
+            if (x == '浜掔浉璋冭揣') {
+                try{
+                    var str = 'allPage:allForm:allBlock:Editable:Order_ForDealerText';
+                    var strPage = null;
+                    var options = {};
+                    var ros = j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).value();
+                    strPage = '/customer/apex/ConSearchAgencyPlace?r=' + encodeURI(ros);
+                    options = {minchars:3, minwords:1, resultsClass:'visitorplace_results'};
+                    jQuery(escapeVfId(str)).unbind();
+                    if (strPage != null) {
+                        console.log('杩涘叆strPage != null')
+                        jQuery(escapeVfId(str)).suggest(strPage,options);
+                    }
+                }catch(e){
+                    alert(e);
+                }
+            }
+            else{
+                var agencytext = j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).value();
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden')).val(agencytext);
+                //alert('1' + agencytext);
+                //alert('2' + j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden')).value());
+            }
+
+        }
+
+        function vpClear2_delay(){
+            var x = j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value();
+            if (x == '浜掔浉璋冭揣') {
+                var vp = 'allPage:allForm:allBlock:Editable:Order_ForDealerText';
+                var vpHidden = 'allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden';
+                setTimeout(
+                    function() {
+                        if(j$(escapeVfId(vp)).attr("jquerysuggest_skip_flag") == "false") {
+                            if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value()) {
+                                vpClear2();
+                            }
+                        }
+                    },
+                    200
+                );
+            }
+            else{
+                var agencytext = j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).value();
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden')).val(agencytext);
+            }
+        }
+        function vpClear2(){
+          var vp = 'allPage:allForm:allBlock:Editable:Order_ForDealerText';
+          var vpHidden = 'allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden';
+          // alert('vp=' + j$(escapeVfId(vp)).value());
+          // alert('vpHidden=' + j$(escapeVfId(vpHidden)).value());
+          // if (j$(escapeVfId(vp)).value() != j$(escapeVfId(vpHidden)).value()) {
+          //   changeFlg = 'false';
+          //   //alert('changeFlg+' +changeFlg);
+          //   if(changeFlg == 'true'){
+          //       vpBefore = j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerTextHidden')).value();
+          //       j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).val(vpBefore);
+          //       document.getElementById('allPage:allForm:allBlock:Editable:Order_ForDealerText').blur();
+          //       return;
+          //   }
+          // }
+          resetValue('allPage:allForm:allBlock:Editable:Order_ForDealerText');
+        }
+        function FilesUaplodJs(){
+            //涓婁紶鏂囦欢
+            FilesUpload();
+        }
+
+        function refreshPageSizeJs() {
+            refreshPageSize();
+        }
+
+        function CommitConsumable(){
+            //纭鎻愪氦
+            approval();
+            //openPDF();
+        }
+        function openPDF(){
+            window.open("/customer/summonsPDF?ESetid="+'{!URLENCODE(IdCheck)}');
+        }
+
+        function openReportJs(){
+            //鎵撳紑鎶ヨ〃
+            var reportId = '{!IdCheck}';
+            reportId = reportId.substring(0,15);
+            window.open("/customer/" +'{!URLENCODE($Label.ConsumableOut_report)}'+ "?pv1="+ encodeURI(reportId));
+        }
+
+        function openToInvoiceJs(){
+            //鎵撳紑鍙戠エ
+            //upchangeorder();
+            var invoiceId = j$(escapeVfId('allPage:allForm:allBlock:unEditable:ConInvoice_Code_lkid')).value();
+            if (invoiceId.length > 0 && invoiceId != '000000000000000') {
+                window.open("/customer/ConInvoiceView?deliveryId="+'{!URLENCODE(IdCheck)}' + "&invoiceId=" + encodeURI(invoiceId) + "&KeyWords=Redirect","_self");
+            }else{
+                window.open("/customer/ConInvoiceView?deliveryId="+'{!URLENCODE(IdCheck)}' + "&KeyWords=Redirect","_self");
+            }
+        }
+
+        function PraseToPDFJs(){
+            //鎵撳嵃鎴怭DF
+            PraseToPDF();
+            window.open("/customer/summonsPDF?ESetid="+'{!URLENCODE(IdCheck)}');
+        }
+
+        function ChangeDirction(j){
+            var a = j.id;
+            var x = j$(escapeVfId(a)).value();
+            var productCount = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount')).value();
+            if(x == '鐩存帴閿�鍞粰鍖婚櫌'){
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',true);
+                document.getElementById('allPage:allForm:allBlock:Editable:province').value = "";
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',true);
+                document.getElementById('allPage:allForm:allBlock:Editable:Order_ForDealerText').value = "";
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
+                //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
+                // }
+            }else if(x == '鍖婚櫌璇曠敤'){
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
+                //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
+                // }
+            }else if(x == '閿�鍞粰浜岀骇缁忛攢鍟�'){
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',false);
+                // }
+            }else if(x == '浜掔浉璋冭揣'){
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',true);
+                document.getElementById('allPage:allForm:allBlock:Editable:OEC').value = "";
+                document.getElementById('allPage:allForm:allBlock:Editable:OECId').value = "";
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',true);
+                document.getElementById('allPage:allForm:allBlock:Editable:Order_ForCustomer').value = "";
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
+                //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
+                // }
+            }else{
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
+                //document.getElementById('allPage:allForm:allBlock:Editable:province').value = "";
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
+                //document.getElementById('allPage:allForm:allBlock:Editable:Order_ForDealerText').value = "";
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',false);
+                //     //document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
+                // }
+            }
+        }
+        //椤甸潰鍒锋柊閲嶆柊璁$畻閲戦
+        function CountCounttestPrice(){
+            var numberDetails =j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount')).value();
+            for(var i = 0; i < numberDetails ; i++){
+                var ckeck = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableinfo' + ':consumablesCountproRowCheckbox')).value();
+
+                if (ckeck == 'on') {
+                    var a=document.getElementById ("allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:" + i +":variableAllprice:consumablesCounttestPrice");
+                    if ({!Existarrive}) {
+                        z  =  parseFloat(j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i +':consumablesCount_UnEditout:consumablesCount_UnEditin')).value());
+                    }else{
+                        z  =  parseFloat(j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i+':variable:consumablesCount')).value());
+                    }
+                    //z= z.replace(/,/g,'');
+                    if(isNaN(z)){z=0.00;}
+                    //alert(z);
+                    x = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i +':variableMoneyinfo:productOrderMoneyinfo')).value().replace(/,/g,'');
+                    c = parseFloat(z * x).toFixed(2);
+                    //c = number_format_common (c,2,'.',',');
+                    a.innerHTML = c;
+                    SumCompute();
+                }
+            }
+        }
+
+        function ComputePriceCheck(j){ // FIXME lineNo 銇仐銇︺亸銇犮仌銇�
+            var z,x,c;
+            var a = j.id;
+            var i=a.substring(0,a.lastIndexOf(':'));// <apex:variable value="{!1}" var="lineNo" />
+            i=i.substring(0,i.lastIndexOf(':'));
+            var a=document.getElementById (i+":variableAllprice:consumablesCounttestPrice");
+            if ({!Existarrive}) {
+                z  =  parseFloat(j$(escapeVfId(i+':consumablesCount_UnEditout:consumablesCount_UnEditin')).value());
+            }else{
+                z  =  parseFloat(j$(escapeVfId(i+':variable:consumablesCount')).value());
             }
             //z= z.replace(/,/g,'');
             if(isNaN(z)){z=0.00;}
             //alert(z);
-            x = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i +':variableMoneyinfo:productOrderMoneyinfo')).value().replace(/,/g,'');
+            x = j$(escapeVfId(i +':variableMoneyinfo:productOrderMoneyinfo')).value().replace(/,/g,'');
             c = parseFloat(z * x).toFixed(2);
             //c = number_format_common (c,2,'.',',');
             a.innerHTML = c;
             SumCompute();
         }
-    }
-}
 
-function ComputePriceCheck(j){ // FIXME lineNo 銇仐銇︺亸銇犮仌銇�
-    var z,x,c;
-    var a = j.id;
-    var i=a.substring(0,a.lastIndexOf(':'));// <apex:variable value="{!1}" var="lineNo" />
-    i=i.substring(0,i.lastIndexOf(':'));
-    var a=document.getElementById (i+":variableAllprice:consumablesCounttestPrice");
-    if ({!Existarrive}) {
-        z  =  parseFloat(j$(escapeVfId(i+':consumablesCount_UnEditout:consumablesCount_UnEditin')).value());
-    }else{
-        z  =  parseFloat(j$(escapeVfId(i+':variable:consumablesCount')).value());
-    }
-    //z= z.replace(/,/g,'');
-    if(isNaN(z)){z=0.00;}
-    //alert(z);
-    x = j$(escapeVfId(i +':variableMoneyinfo:productOrderMoneyinfo')).value().replace(/,/g,'');
-    c = parseFloat(z * x).toFixed(2);
-    //c = number_format_common (c,2,'.',',');
-    a.innerHTML = c;
-    SumCompute();
-}
+        function showCate() {
+            //var productCount = j$(escapeVfId('allPage:allForm:allBlock:searchBlock:category3Search')).value();
+            categoryload();
+        }
 
-function showCate() {
-    //var productCount = j$(escapeVfId('allPage:allForm:allBlock:searchBlock:category3Search')).value();
-    categoryload();
-}
+        function showAllCate() {
+            categoryAllload();
+        }
 
-function showAllCate() {
-    categoryAllload();
-}
+        //椤甸潰鍔犺浇 椤圭洰鍒濆鍖�
+        function onLoadDirction(){
+            var x = j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value();
+            var productCount = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount')).value();
 
-//椤甸潰鍔犺浇 椤圭洰鍒濆鍖�
-function onLoadDirction(){
-    var x = j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value();
-    var productCount = j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount')).value();
+            if(x == '鐩存帴閿�鍞粰鍖婚櫌'){
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',true);
+                document.getElementById('allPage:allForm:allBlock:Editable:province').value = "";
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',true);
+                document.getElementById('allPage:allForm:allBlock:Editable:Order_ForDealerText').value = "";
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
+                //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
+                // }
+            }else if(x == '鍖婚櫌璇曠敤'){
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
+                //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
+                // }
+            }else if(x == '閿�鍞粰浜岀骇缁忛攢鍟�'){
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',false);
+                // }
+            }else if(x == '浜掔浉璋冭揣'){
+                //鍖婚櫌
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',true);
+                document.getElementById('allPage:allForm:allBlock:Editable:OEC').value = "";
+                document.getElementById('allPage:allForm:allBlock:Editable:OECId').value = "";
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',true);
+                document.getElementById('allPage:allForm:allBlock:Editable:Order_ForCustomer').value = "";
+                //浜岀骇缁忛攢鍟�
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
+                j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
 
-    if(x == '鐩存帴閿�鍞粰鍖婚櫌'){
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',true);
-        document.getElementById('allPage:allForm:allBlock:Editable:province').value = "";
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',true);
-        document.getElementById('allPage:allForm:allBlock:Editable:Order_ForDealerText').value = "";
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
-        //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
-        // }
-    }else if(x == '鍖婚櫌璇曠敤'){
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
-        //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
-        // }
-    }else if(x == '閿�鍞粰浜岀骇缁忛攢鍟�'){
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',false);
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',false);
-        // }
-    }else if(x == '浜掔浉璋冭揣'){
-        //鍖婚櫌
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:OEC')).prop('disabled',true);
-        document.getElementById('allPage:allForm:allBlock:Editable:OEC').value = "";
-        document.getElementById('allPage:allForm:allBlock:Editable:OECId').value = "";
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForCustomer')).prop('disabled',true);
-        document.getElementById('allPage:allForm:allBlock:Editable:Order_ForCustomer').value = "";
-        //浜岀骇缁忛攢鍟�
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:province')).prop('disabled',false);
-        j$(escapeVfId('allPage:allForm:allBlock:Editable:Order_ForDealerText')).prop('disabled',false);
+                // for (var i = 0; i < productCount; i++) {
+                //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
+                //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
+                // }
+            }
+        }
 
-        // for (var i = 0; i < productCount; i++) {
-        //     j$(escapeVfId('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency')).prop('disabled',true);
-        //     document.getElementById('allPage:allForm:allBlock:ConsumableorderdetailsSection:ConsumableorderdetailsTable:' + i + ':variableMoneyinfo:Unitpriceagency').value = "";
-        // }
-    }
-}
-
-window.sfdcPage.appendToOnloadQueue(function() { onLoadDirction(); });
-
-</script>
-<style>
-    .visitorplace_results {
-        border: 1px solid gray;
-        background-color: white;
-        padding: 0;
-        margin: 0;
-        list-style: none;
-        position: absolute;
-        z-index: 10000;
-        display: none;
-        overflow:auto;
-        white-space:nowrap;
-        width:400px;
-        height:250px;
-    }
-    .visitorplace_results li {
-        padding: 2px 5px 2px 0px;
-        margin-left : 2px;
-        color: #101010;
-        text-align: left;
-    }
-    .panelGridCenter td,.panelGridCenter tr {
-        text-align: center;
-    }
-    .dateFormat  {
-        display: none;
-    }
-    tr.dataRow {
-        background-color:white;
-    }
-    td.columus {
-        background-color:white;
-        text-align: right;
-    }
-    tr.dataRow:hover {
-        background-color: #e3f3ff;
-    }
-</style>
+        window.sfdcPage.appendToOnloadQueue(function() { onLoadDirction(); });
+    </script>
+    <style>
+        .visitorplace_results {
+            border: 1px solid gray;
+            background-color: white;
+            padding: 0;
+            margin: 0;
+            list-style: none;
+            position: absolute;
+            z-index: 10000;
+            display: none;
+            overflow: auto;
+            white-space: nowrap;
+            width: 400px;
+            height: 250px;
+        }
+        .visitorplace_results li {
+            padding: 2px 5px 2px 0px;
+            margin-left: 2px;
+            color: #101010;
+            text-align: left;
+        }
+        .panelGridCenter td,
+        .panelGridCenter tr {
+            text-align: center;
+        }
+        .dateFormat {
+            display: none;
+        }
+        tr.dataRow {
+            background-color: white;
+        }
+        td.columus {
+            background-color: white;
+            text-align: right;
+        }
+        tr.dataRow:hover {
+            background-color: #e3f3ff;
+        }
+    </style>
     <apex:form id="allForm">
-    <!-- //add  by rentx 2021-2-26 -->
-        <apex:actionFunction name="checkOutPatternFn" action="{!checkOutPattern}" status="fetchStatus" reRender="ConsumableorderdetailsSection,message,OutPattern01" onComplete="CountCounttestPrice();onLoadDirction();"/>
-    <!-- //add by rentx 2021-2-26 -->
-        <apex:actionFunction name="refreshPageSize" action="{!refreshPageSize}" status="fetchStatus" reRender="ConsumableorderdetailsSection,message" onComplete="CountCounttestPrice();onLoadDirction();"/>
-        <apex:actionFunction name="save" action="{!save}" rerender=" message,Editable,ConsumableorderdetailsSection" onComplete="unblockUI();CountCounttestPrice();onLoadDirction();">
+        <!-- //add  by rentx 2021-2-26 -->
+        <apex:actionFunction
+            name="checkOutPatternFn"
+            action="{!checkOutPattern}"
+            status="fetchStatus"
+            reRender="ConsumableorderdetailsSection,message,OutPattern01"
+            onComplete="CountCounttestPrice();onLoadDirction();"
+        />
+        <!-- //add by rentx 2021-2-26 -->
+        <apex:actionFunction
+            name="refreshPageSize"
+            action="{!refreshPageSize}"
+            status="fetchStatus"
+            reRender="ConsumableorderdetailsSection,message"
+            onComplete="CountCounttestPrice();onLoadDirction();"
+        />
+        <apex:actionFunction
+            name="save"
+            action="{!save}"
+            rerender=" message,Editable,ConsumableorderdetailsSection"
+            onComplete="unblockUI();CountCounttestPrice();onLoadDirction();"
+        >
         </apex:actionFunction>
-        <apex:actionFunction name="categoryload" action="{!categoryload}" rerender="searchBlock" onComplete="unblockUI();">
+        <apex:actionFunction
+            name="categoryload"
+            action="{!categoryload}"
+            rerender="searchBlock"
+            onComplete="unblockUI();"
+        >
         </apex:actionFunction>
-         <apex:actionFunction name="categoryAllload" action="{!categoryAllload}" rerender="searchBlock" onComplete="unblockUI();">
+        <apex:actionFunction
+            name="categoryAllload"
+            action="{!categoryAllload}"
+            rerender="searchBlock"
+            onComplete="unblockUI();"
+        >
         </apex:actionFunction>
-        <apex:actionFunction name="searchConsumableorderdetails" action="{!searchConsumableorderdetails}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CountCounttestPrice();onLoadDirction();">
+        <apex:actionFunction
+            name="searchConsumableorderdetails"
+            action="{!searchConsumableorderdetails}"
+            rerender="ConsumableorderdetailsSection, message"
+            onComplete="unblockUI();CountCounttestPrice();onLoadDirction();"
+        >
         </apex:actionFunction>
-        <apex:actionFunction name="setEditAble" action="{!setEditAble}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();">
+        <apex:actionFunction
+            name="setEditAble"
+            action="{!setEditAble}"
+            rerender="ConsumableorderdetailsSection, message"
+            onComplete="unblockUI();"
+        >
         </apex:actionFunction>
-        <apex:actionFunction name="approval" action="{!approval}" rerender="allForm" onComplete="unblockUI();openPDF();">
+        <apex:actionFunction
+            name="approval"
+            action="{!approval}"
+            rerender="allForm"
+            onComplete="unblockUI();openPDF();"
+        >
         </apex:actionFunction>
-         <apex:actionFunction name="DelConsumable" action="{!DelConsumable}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();">
+        <apex:actionFunction
+            name="DelConsumable"
+            action="{!DelConsumable}"
+            rerender="ConsumableorderdetailsSection, message"
+            onComplete="unblockUI();"
+        >
         </apex:actionFunction>
-        <apex:actionFunction name="PraseToPDF" action="{!PraseToPDF}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();">
+        <apex:actionFunction
+            name="PraseToPDF"
+            action="{!PraseToPDF}"
+            rerender="ConsumableorderdetailsSection, message"
+            onComplete="unblockUI();"
+        >
         </apex:actionFunction>
-        <apex:actionFunction name="GoodsDelivery" action="{!GoodsDelivery}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();">
+        <apex:actionFunction
+            name="GoodsDelivery"
+            action="{!GoodsDelivery}"
+            rerender="ConsumableorderdetailsSection, message"
+            onComplete="unblockUI();"
+        >
         </apex:actionFunction>
-        <apex:actionFunction name="SortLimited" action="{!SortLimited}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();CountCounttestPrice();onLoadDirction();">
+        <apex:actionFunction
+            name="SortLimited"
+            action="{!SortLimited}"
+            rerender="ConsumableorderdetailsSection, message"
+            onComplete="unblockUI();CountCounttestPrice();onLoadDirction();"
+        >
             <apex:param name="firstParam" assignTo="{!sortKey}" value="" />
         </apex:actionFunction>
         <!--<apex:actionFunction name="SortStore" action="{!SortStore}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();">
             <apex:param name="firstParam" assignTo="{!sortKey}" value="" />
         </apex:actionFunction>-->
-        <apex:actionFunction name="FilesUpload" action="{!FilesUpload}" rerender="ConsumableorderdetailsSection, message" onComplete="unblockUI();">
+        <apex:actionFunction
+            name="FilesUpload"
+            action="{!FilesUpload}"
+            rerender="ConsumableorderdetailsSection, message"
+            onComplete="unblockUI();"
+        >
         </apex:actionFunction>
 
         <apex:outputPanel id="allPanel">
-        <input type="hidden" id="userState" value="{!localuser.State_Hospital__c}"/>
-            <apex:pageBlock id="allBlock" >
+            <input
+                type="hidden"
+                id="userState"
+                value="{!localuser.State_Hospital__c}"
+            />
+            <apex:pageBlock id="allBlock">
                 <table>
                     <colgroup>
-                        <col width="150px"/>
-                        <col width="200px"/>
-                        <col width="200px"/>
-                        <col width="200px"/>
-                        <col width="200px"/>
-                        <col width="200px"/>
-                        <col width="90px"/>
-                        <col width="100px"/>
-                        <col width="10px"/>
-                        <col width="85px"/>
-                        <col width="100px"/>
-                        <col width="10px"/>
-                        <col width="70px"/>
-                        <col width="100px"/>
+                        <col width="150px" />
+                        <col width="200px" />
+                        <col width="200px" />
+                        <col width="200px" />
+                        <col width="200px" />
+                        <col width="200px" />
+                        <col width="90px" />
+                        <col width="100px" />
+                        <col width="10px" />
+                        <col width="85px" />
+                        <col width="100px" />
+                        <col width="10px" />
+                        <col width="70px" />
+                        <col width="100px" />
                     </colgroup>
                     <tr>
                         <td></td>
-                        <td  colspan="4"><apex:commandButton onclick="saveConfirmJs('{!coc.SummonsStatus_c__c}');" value="淇濆瓨" style="width:150px" rerender="dummy" rendered="{!(EditDelCommitBtnDisabled||EditAble)}"/></td>
+                        <td colspan="4">
+                            <apex:commandButton
+                                onclick="saveConfirmJs('{!coc.SummonsStatus_c__c}');"
+                                value="淇濆瓨"
+                                style="width: 150px"
+                                rerender="dummy"
+                                rendered="{!(EditDelCommitBtnDisabled||EditAble)}"
+                            />
+                        </td>
                     </tr>
                     <tr>
                         <td></td>
-                        <td ><apex:commandButton onclick="EditConsumable();"   value="缂栬緫鍑哄簱鍗�" style="width:150px" rerender="dummy" rendered="{!!(EditDelCommitBtnDisabled||EditAble)}" disabled="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�',true,false)}"/></td>
+                        <td>
+                            <apex:commandButton
+                                onclick="EditConsumable();"
+                                value="缂栬緫鍑哄簱鍗�"
+                                style="width: 150px"
+                                rerender="dummy"
+                                rendered="{!!(EditDelCommitBtnDisabled||EditAble)}"
+                                disabled="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�',true,false)}"
+                            />
+                        </td>
                         <!--CHAN-B65CAZ 20181105 UpdateStart-->
                         <!-- <td ><apex:commandButton onclick="CommitConsumable();" value="鎻愪氦鍑哄簱鍗�" style="width:150px" rerender="dummy" rendered="{!!(EditDelCommitBtnDisabled||EditAble)}" disabled="{!IF(coc.SummonsStatus_c__c='鎵瑰噯'||coc.SummonsStatus_c__c='宸查攢鍞緟涓婁紶绾冲搧涔�'||coc.SummonsStatus_c__c='鍑哄簱鍗曞凡鎵撳嵃'||coc.SummonsStatus_c__c='宸插畬鎴�',true,false)}"/></td> -->
-                        <td ><apex:commandButton onclick="GoodsDeliveryJs();"  value="鍑鸿揣/閿�鍞�"     style="width:150px" rerender="dummy" rendered="{!!(EditDelCommitBtnDisabled||EditAble)}" disabled="{!IF(coc.SummonsStatus_c__c='宸查攢鍞緟涓婁紶绾冲搧涔�'||coc.SummonsStatus_c__c='宸插畬鎴�'||coc.SummonsStatus_c__c='浠锋牸鏈畾',true,false)}"/></td>
+                        <td>
+                            <apex:commandButton
+                                onclick="GoodsDeliveryJs();"
+                                value="鍑鸿揣/閿�鍞�"
+                                style="width: 150px"
+                                rerender="dummy"
+                                rendered="{!!(EditDelCommitBtnDisabled||EditAble)}"
+                                disabled="{!IF(coc.SummonsStatus_c__c='宸查攢鍞緟涓婁紶绾冲搧涔�'||coc.SummonsStatus_c__c='宸插畬鎴�'||coc.SummonsStatus_c__c='浠锋牸鏈畾',true,false)}"
+                            />
+                        </td>
                         <!-- CHAN-B65CAZ 20181105 UpdateEnd-->
-                        <td ><apex:commandButton onclick="openToInvoiceJs();return false;" value="寮�绁�" style="width:150px" rerender="dummy" rendered="{!!(EditDelCommitBtnDisabled||EditAble)}" disabled="{!IF(((coc.Billed_Status__c !='鍏ㄩ儴寮�绁�' &&coc.SummonsStatus_c__c='宸插畬鎴�') || coc.Onchange_order__c = true) && coc.SummonsForDirction__c!='浜掔浉璋冭揣',false,true)}"/></td>
+                        <td>
+                            <apex:commandButton
+                                onclick="openToInvoiceJs();return false;"
+                                value="寮�绁�"
+                                style="width: 150px"
+                                rerender="dummy"
+                                rendered="{!!(EditDelCommitBtnDisabled||EditAble)}"
+                                disabled="{!IF(((coc.Billed_Status__c !='鍏ㄩ儴寮�绁�' &&coc.SummonsStatus_c__c='宸插畬鎴�') || coc.Onchange_order__c = true) && coc.SummonsForDirction__c!='浜掔浉璋冭揣',false,true)}"
+                            />
+                        </td>
                     </tr>
                     <tr>
                         <td></td>
                         <!--CHAN-B65CAZ 20181105 UpdateStart-->
-                        <td ><apex:commandButton onclick="PraseToPDFJs();" value="鎵撳嵃鎸囩ず鍗�" style="width:150px" rerender="dummy" rendered="{!!(EditDelCommitBtnDisabled||EditAble)}" disabled="{!IF(coc.SummonsStatus_c__c='宸查攢鍞緟涓婁紶绾冲搧涔�'||coc.SummonsStatus_c__c='鎵瑰噯'||coc.SummonsStatus_c__c='鍑哄簱鍗曞凡鎵撳嵃'||coc.SummonsStatus_c__c='鑽夋涓�',false,true)}"/></td>
-                        <!-- CHAN-B65CAZ 20181105 UpdateEnd-->
-                        <td ><apex:commandButton onclick="openReportJs(); return false;" value="鏄剧ず鏄庣粏" style="width:150px" rerender="dummy" rendered="{!!(EditDelCommitBtnDisabled||EditAble)}" disabled="{!IF(coc.Billed_Status__c !='杩樻病寮�绁�' || coc.SummonsStatus_c__c='宸插畬鎴�',false,true)}"/></td>
-                        <td ><apex:commandButton onclick="DeleteConsumable();" value="鍒犻櫎" style="width:150px" rerender="dummy" rendered="{!!(EditDelCommitBtnDisabled||EditAble)}" disabled="{!IF(coc.SummonsStatus_c__c='宸查攢鍞緟涓婁紶绾冲搧涔�'||coc.SummonsStatus_c__c='浠锋牸鏈畾'||coc.SummonsStatus_c__c='鎵瑰噯'||coc.SummonsStatus_c__c='鍑哄簱鍗曞凡鎵撳嵃'||coc.SummonsStatus_c__c='宸插畬鎴�',true,false)}"/></td>
-                        <td >
+                        <td>
+                            <apex:commandButton
+                                onclick="PraseToPDFJs();"
+                                value="鎵撳嵃鎸囩ず鍗�"
+                                style="width: 150px"
+                                rerender="dummy"
+                                rendered="{!!(EditDelCommitBtnDisabled||EditAble)}"
+                                disabled="{!IF(coc.SummonsStatus_c__c='宸查攢鍞緟涓婁紶绾冲搧涔�'||coc.SummonsStatus_c__c='鎵瑰噯'||coc.SummonsStatus_c__c='鍑哄簱鍗曞凡鎵撳嵃'||coc.SummonsStatus_c__c='鑽夋涓�',false,true)}"
+                            />
                         </td>
+                        <!-- CHAN-B65CAZ 20181105 UpdateEnd-->
+                        <td>
+                            <apex:commandButton
+                                onclick="openReportJs(); return false;"
+                                value="鏄剧ず鏄庣粏"
+                                style="width: 150px"
+                                rerender="dummy"
+                                rendered="{!!(EditDelCommitBtnDisabled||EditAble)}"
+                                disabled="{!IF(coc.Billed_Status__c !='杩樻病寮�绁�' || coc.SummonsStatus_c__c='宸插畬鎴�',false,true)}"
+                            />
+                        </td>
+                        <td>
+                            <apex:commandButton
+                                onclick="DeleteConsumable();"
+                                value="鍒犻櫎"
+                                style="width: 150px"
+                                rerender="dummy"
+                                rendered="{!!(EditDelCommitBtnDisabled||EditAble)}"
+                                disabled="{!IF(coc.SummonsStatus_c__c='宸查攢鍞緟涓婁紶绾冲搧涔�'||coc.SummonsStatus_c__c='浠锋牸鏈畾'||coc.SummonsStatus_c__c='鎵瑰噯'||coc.SummonsStatus_c__c='鍑哄簱鍗曞凡鎵撳嵃'||coc.SummonsStatus_c__c='宸插畬鎴�',true,false)}"
+                            />
+                        </td>
+                        <td></td>
                     </tr>
                 </table>
                 <apex:outputPanel id="message">
                     <apex:pageMessages />
-                 </apex:outputPanel>
-<!--==============20160314====INSERT_CODE_END=======================================-->
-                <apex:pageBlock title="鍑哄簱鍗曚俊鎭�" id="Editable" rendered="{!EditAble}">
-                <!-- update start by vivek 2019-7-15 -->
+                </apex:outputPanel>
+                <!--==============20160314====INSERT_CODE_END=======================================-->
+                <apex:pageBlock
+                    title="鍑哄簱鍗曚俊鎭�"
+                    id="Editable"
+                    rendered="{!EditAble}"
+                >
+                    <!-- update start by vivek 2019-7-15 -->
                     <!-- <table>
                         <colgroup>
                             <col width="150px"/>
@@ -501,162 +655,308 @@
                             <col width="70px"/>
                             <col width="100px"/>
                         </colgroup> -->
-                <!-- update end by vivek 2019-7-15 -->
-                        <!-- update start by vivek 2019-7-15 -->
-                        <apex:outputPanel rendered="{! If(coc.SummonsStatus_c__c == '浠锋牸鏈畾',true,false) }">
+                    <!-- update end by vivek 2019-7-15 -->
+                    <!-- update start by vivek 2019-7-15 -->
+                    <apex:outputPanel
+                        rendered="{! If(coc.SummonsStatus_c__c == '浠锋牸鏈畾',true,false) }"
+                    >
                         <table>
-                        <colgroup>
-                            <col width="150px"/>
-                            <col width="300px"/>
-                            <col width="150px"/>
-                            <col width="300px"/>
-                            <col width="80px"/>
-                            <col width="10px"/>
-                            <col width="90px"/>
-                            <col width="100px"/>
-                            <col width="10px"/>
-                            <col width="85px"/>
-                            <col width="100px"/>
-                            <col width="10px"/>
-                            <col width="70px"/>
-                            <col width="100px"/>
-                        </colgroup>
-                                <tr>
+                            <colgroup>
+                                <col width="150px" />
+                                <col width="300px" />
+                                <col width="150px" />
+                                <col width="300px" />
+                                <col width="80px" />
+                                <col width="10px" />
+                                <col width="90px" />
+                                <col width="100px" />
+                                <col width="10px" />
+                                <col width="85px" />
+                                <col width="100px" />
+                                <col width="10px" />
+                                <col width="70px" />
+                                <col width="100px" />
+                            </colgroup>
+                            <tr>
                                 <td align="right">鍑哄簱鍗曞彿锛�</td>
-                                <td align="left"><apex:outputField id="OrderCode_out2"  value="{!coc.Name}" style="width:300px"/></td>
+                                <td align="left">
+                                    <apex:outputField
+                                        id="OrderCode_out2"
+                                        value="{!coc.Name}"
+                                        style="width: 300px"
+                                    />
+                                </td>
                                 <td align="right">鍑哄簱鍗曠姸鎬侊細</td>
-                                <td align="left"><apex:outputField id="OrderStatus_out2" value="{!coc.SummonsStatus_c__c}" style="width:300px"/></td>
+                                <td align="left">
+                                    <apex:outputField
+                                        id="OrderStatus_out2"
+                                        value="{!coc.SummonsStatus_c__c}"
+                                        style="width: 300px"
+                                    />
+                                </td>
                             </tr>
                             <tr>
                                 <td align="right">鐩殑锛�</td>
-                                <td align="left"><apex:outputField id="OrderDirction_out2"  value="{!coc.SummonsForDirction__c}" style="width:300px"/></td>
+                                <td align="left">
+                                    <apex:outputField
+                                        id="OrderDirction_out2"
+                                        value="{!coc.SummonsForDirction__c}"
+                                        style="width: 300px"
+                                    />
+                                </td>
                                 <td align="right">寮�绁ㄧ姸鎬侊細</td>
                                 <td align="left">
-                                <apex:outputField id="SecondDealer_level22" value="{!coc.Billed_Status__c}" style="width:300px"/>
+                                    <apex:outputField
+                                        id="SecondDealer_level22"
+                                        value="{!coc.Billed_Status__c}"
+                                        style="width: 300px"
+                                    />
                                 </td>
-
                             </tr>
-                            <tr style="{!IF(coc.SummonsForDirction__c='閿�鍞粰浜岀骇缁忛攢鍟�','','display:none')}">
+                            <tr
+                                style="{!IF(coc.SummonsForDirction__c='閿�鍞粰浜岀骇缁忛攢鍟�','','display:none')}"
+                            >
                                 <td align="right">浜岀骇缁忛攢鍟嗭細</td>
-                                <td align="left"><apex:outputField id="SecondDealer_out2" value="{!coc.Order_Dealer_Info__c}" style="width:300px"/></td>
+                                <td align="left">
+                                    <apex:outputField
+                                        id="SecondDealer_out2"
+                                        value="{!coc.Order_Dealer_Info__c}"
+                                        style="width: 300px"
+                                    />
+                                </td>
                                 <td align="right"></td>
                                 <td align="left"></td>
                             </tr>
                             <tr>
                                 <td align="right">瀹㈡埛鍚嶏細</td>
-                                <td align="left"><apex:outputField id="OrderForHospital_out2" value="{!coc.ShipmentAccount__c}" style="width:300px"/></td>
-                                <td align="right"><apex:outputText value="鍙戠エ锛�" rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"/></td>
-                                <td align="left"><apex:inputField value="{!coc.ConInvoice_Code__c}" rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}" id="ConInvoice_Code2"/>
-                                <c:helpicon helpText="宸插紑绁ㄧ殑鎹㈣揣鐨勬椂鍊欙紝閫夋嫨宸插紑绁ㄧ殑鍙戠エ銆�" rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"/>
+                                <td align="left">
+                                    <apex:outputField
+                                        id="OrderForHospital_out2"
+                                        value="{!coc.ShipmentAccount__c}"
+                                        style="width: 300px"
+                                    />
+                                </td>
+                                <td align="right">
+                                    <apex:outputText
+                                        value="鍙戠エ锛�"
+                                        rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"
+                                    />
+                                </td>
+                                <td align="left">
+                                    <apex:inputField
+                                        value="{!coc.ConInvoice_Code__c}"
+                                        rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"
+                                        id="ConInvoice_Code2"
+                                    />
+                                    <c:helpicon
+                                        helpText="宸插紑绁ㄧ殑鎹㈣揣鐨勬椂鍊欙紝閫夋嫨宸插紑绁ㄧ殑鍙戠エ銆�"
+                                        rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"
+                                    />
                                 </td>
                             </tr>
                             <tr>
                                 <td align="right">绉戝锛�</td>
                                 <td align="left">
-                                    <apex:outputField id="Order_ForDealerText2" value="{!coc.Order_ForCustomerText__c}" style="width:170px"/>
+                                    <apex:outputField
+                                        id="Order_ForDealerText2"
+                                        value="{!coc.Order_ForCustomerText__c}"
+                                        style="width: 170px"
+                                    />
                                 </td>
                                 <td align="right">鍑哄簱閲戦锛�</td>
-                                <td align="left"><apex:outputField id="sumPrice_buttom2" value="{!coc.Shipment_total_amount__c}" style="width:300px"/> 鍏�</td>
+                                <td align="left">
+                                    <apex:outputField
+                                        id="sumPrice_buttom2"
+                                        value="{!coc.Shipment_total_amount__c}"
+                                        style="width: 300px"
+                                    />
+                                    鍏�
+                                </td>
                             </tr>
                             <tr>
                                 <td align="right">娌℃湁纭畾浠锋牸锛�</td>
                                 <td align="left">
-                                    <apex:inputCheckbox id="NoConfirmedPrice_out2" value="{!coc.NoConfirmedPrice__c}" disabled="true" />
+                                    <apex:inputCheckbox
+                                        id="NoConfirmedPrice_out2"
+                                        value="{!coc.NoConfirmedPrice__c}"
+                                        disabled="true"
+                                    />
                                 </td>
 
                                 <!-- ===add by rentx 2020-12-04 start -->
                                 <!-- <apex:detail rendered="{!agencyProType == 'ENG'}"> -->
-                                    <!-- <td align="right">鏄惁鍖婚櫌鐗逛环鍑哄簱 : </td> -->
-                                    <!-- <td align="left"> -->
-                                        <apex:inputHidden id="OutPattern02" value="{!coc.OutPattern__c}"  />
-                                        <!-- <apex:outputField id="OutPattern02" value="{!coc.OutPattern__c}"  /> -->
-                                        <!-- <apex:inputCheckbox id="OutPattern02" value="{!coc.OutPattern__c}" disabled="true"  /> -->
+                                <!-- <td align="right">鏄惁鍖婚櫌鐗逛环鍑哄簱 : </td> -->
+                                <!-- <td align="left"> -->
+                                <apex:inputHidden
+                                    id="OutPattern02"
+                                    value="{!coc.OutPattern__c}"
+                                />
+                                <!-- <apex:outputField id="OutPattern02" value="{!coc.OutPattern__c}"  /> -->
+                                <!-- <apex:inputCheckbox id="OutPattern02" value="{!coc.OutPattern__c}" disabled="true"  /> -->
 
-                                        <!-- <apex:inputField id="OutPattern" value="{!coc.DeliveryMode__c}" style="width:160px"/> -->
-                                    <!-- </td> -->
+                                <!-- <apex:inputField id="OutPattern" value="{!coc.DeliveryMode__c}" style="width:160px"/> -->
+                                <!-- </td> -->
                                 <!-- </apex:detail> -->
                                 <!-- ===add by rentx 2020-12-04 end -->
                             </tr>
                         </table>
-                            </apex:outputPanel>
-                        <apex:outputPanel rendered="{! If(coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false) }">
+                    </apex:outputPanel>
+                    <apex:outputPanel
+                        rendered="{! If(coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false) }"
+                    >
                         <table>
-                        <colgroup>
-                            <col width="150px"/>
-                            <col width="300px"/>
-                            <col width="150px"/>
-                            <col width="300px"/>
-                            <col width="80px"/>
-                            <col width="10px"/>
-                            <col width="90px"/>
-                            <col width="100px"/>
-                            <col width="10px"/>
-                            <col width="85px"/>
-                            <col width="100px"/>
-                            <col width="10px"/>
-                            <col width="70px"/>
-                            <col width="100px"/>
-                        </colgroup>
-                            <tr id = "SummonsFlag" style="visibility:{!SummonsFlag}">
+                            <colgroup>
+                                <col width="150px" />
+                                <col width="300px" />
+                                <col width="150px" />
+                                <col width="300px" />
+                                <col width="80px" />
+                                <col width="10px" />
+                                <col width="90px" />
+                                <col width="100px" />
+                                <col width="10px" />
+                                <col width="85px" />
+                                <col width="100px" />
+                                <col width="10px" />
+                                <col width="70px" />
+                                <col width="100px" />
+                            </colgroup>
+                            <tr
+                                id="SummonsFlag"
+                                style="visibility:{!SummonsFlag}"
+                            >
                                 <td align="right">鍑哄簱鍗曞彿锛�</td>
-                                <td align="left"><apex:outputField id="OrderCode"  value="{!coc.Name}" style="width:100px"/></td>
+                                <td align="left">
+                                    <apex:outputField
+                                        id="OrderCode"
+                                        value="{!coc.Name}"
+                                        style="width: 100px"
+                                    />
+                                </td>
                                 <td align="right">鍑哄簱鍗曠姸鎬侊細</td>
-                                <td align="left"><apex:outputField id="SummonsStatus_c__c" value="{!coc.SummonsStatus_c__c}" style="width:100px"/></td>
+                                <td align="left">
+                                    <apex:outputField
+                                        id="SummonsStatus_c__c"
+                                        value="{!coc.SummonsStatus_c__c}"
+                                        style="width: 100px"
+                                    />
+                                </td>
                             </tr>
                             <tr>
                                 <td align="right">鐩殑锛�</td>
-                                <td align="left"><div style="width:3px;height:20px;background-color:red; position:absolute;margin-right:5px;"></div>
-                                <apex:inputField onchange="ChangeDirction(this)" id="SummonsForDirction__c" value="{!coc.SummonsForDirction__c}" style="width:160px"/></td>
+                                <td align="left">
+                                    <div
+                                        style="
+                                            width: 3px;
+                                            height: 20px;
+                                            background-color: red;
+                                            position: absolute;
+                                            margin-right: 5px;
+                                        "
+                                    ></div>
+                                    <apex:inputField
+                                        onchange="ChangeDirction(this)"
+                                        id="SummonsForDirction__c"
+                                        value="{!coc.SummonsForDirction__c}"
+                                        style="width: 160px"
+                                    />
+                                </td>
                                 <td align="right">浜岀骇缁忛攢鍟嗭細</td>
                                 <td align="left">
-                                <apex:selectList id="province" value="{!SecondDealer}" style="width:160px" size="1" >
-                                    <apex:selectOptions value="{!provinceOpts}"/>
-                                </apex:selectList>
+                                    <apex:selectList
+                                        id="province"
+                                        value="{!SecondDealer}"
+                                        style="width: 160px"
+                                        size="1"
+                                    >
+                                        <apex:selectOptions
+                                            value="{!provinceOpts}"
+                                        />
+                                    </apex:selectList>
                                 </td>
                             </tr>
                             <tr>
                                 <td align="right">瀹㈡埛鍚嶏細</td>
                                 <td align="left">
-                                    <apex:inputText id="OEC" value="{!HospitalName}" onclick="searchsearchAgencyH('{!agencyProType}'); return false;" onblur="clearAgencyI();return false;" style="width:155px"  />
-                                    <apex:inputHidden value="{!HospitalInfo}" id="OECId" />
+                                    <apex:inputText
+                                        id="OEC"
+                                        value="{!HospitalName}"
+                                        onclick="searchsearchAgencyH('{!agencyProType}'); return false;"
+                                        onblur="clearAgencyI();return false;"
+                                        style="width: 155px"
+                                    />
+                                    <apex:inputHidden
+                                        value="{!HospitalInfo}"
+                                        id="OECId"
+                                    />
                                 </td>
                                 <td align="right">缁忛攢鍟�(褰曞叆)锛�</td>
                                 <td align="left">
-                                    <apex:inputField id="Order_ForDealerText" value="{!coc.Order_ForDealerText__c}" onfocus="setVisitorPlace();" style="width:155px" onblur="if (j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value() == '浜掔浉璋冭揣'){vpClear2_delay();}"/>
-<!--                                    <apex:inputField id="Order_ForDealerText" value="{!coc.Order_ForDealerText__c}"  style="width:155px" onblur="if (j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value() == '浜掔浉璋冭揣'){vpClear2_delay();}"/>-->
-                                    <apex:inputHidden id="Order_ForDealerTextHidden" value="{!coc.Order_ForDealerText__c}" />
-                                    <apex:inputHidden id="Order_ForDealerTextId" value="{!coc.Order_ForDealerTextID__c}" />
-                                    <apex:inputHidden id="Order_ForDealerTextHiddenId" value="{!coc.Order_ForDealerTextID__c}" />
+                                    <apex:inputField
+                                        id="Order_ForDealerText"
+                                        value="{!coc.Order_ForDealerText__c}"
+                                        onfocus="setVisitorPlace();"
+                                        style="width: 155px"
+                                        onblur="if (j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value() == '浜掔浉璋冭揣'){vpClear2_delay();}"
+                                    />
+                                    <!--                                    <apex:inputField id="Order_ForDealerText" value="{!coc.Order_ForDealerText__c}"  style="width:155px" onblur="if (j$(escapeVfId('allPage:allForm:allBlock:Editable:SummonsForDirction__c')).value() == '浜掔浉璋冭揣'){vpClear2_delay();}"/>-->
+                                    <apex:inputHidden
+                                        id="Order_ForDealerTextHidden"
+                                        value="{!coc.Order_ForDealerText__c}"
+                                    />
+                                    <apex:inputHidden
+                                        id="Order_ForDealerTextId"
+                                        value="{!coc.Order_ForDealerTextID__c}"
+                                    />
+                                    <apex:inputHidden
+                                        id="Order_ForDealerTextHiddenId"
+                                        value="{!coc.Order_ForDealerTextID__c}"
+                                    />
                                 </td>
                             </tr>
                             <tr>
                                 <td align="right">绉戝锛�</td>
                                 <td align="left">
-                                    <apex:inputField id="Order_ForCustomer" value="{!coc.Order_ForCustomerText__c}" style="width:155px"/>
+                                    <apex:inputField
+                                        id="Order_ForCustomer"
+                                        value="{!coc.Order_ForCustomerText__c}"
+                                        style="width: 155px"
+                                    />
                                 </td>
                                 <td align="right">鎬婚噾棰濓細</td>
-                                <td align="left"><apex:outputText id="sumPrice_buttom" value="{!sumPrice}"/> 鍏�</td>
+                                <td align="left">
+                                    <apex:outputText
+                                        id="sumPrice_buttom"
+                                        value="{!sumPrice}"
+                                    />
+                                    鍏�
+                                </td>
                             </tr>
                             <tr>
                                 <td align="right">娌℃湁纭畾浠锋牸锛�</td>
                                 <td align="left">
-                                    <apex:inputCheckbox id="NoConfirmedPrice" value="{!coc.NoConfirmedPrice__c}" />
+                                    <apex:inputCheckbox
+                                        id="NoConfirmedPrice"
+                                        value="{!coc.NoConfirmedPrice__c}"
+                                    />
                                 </td>
 
                                 <!-- ===add by rentx 2020-12-04 start 鍥犱负鐩墠缁存姢浜嗙壒浠蜂骇鍝佺殑鍖婚櫌閮芥槸ENG鍖婚櫌,鎵�浠ュ彧鏈塃NG鐨勬椂鍊欏睍绀� 鏄惁鍖婚櫌鐗逛环鍑哄簱 鍗冲彲-->
                                 <!-- <apex:detail rendered="{!agencyProType == 'ENG'}"> -->
-                                    <!-- <td align="right" >鏄惁鍖婚櫌鐗逛环鍑哄簱 : </td> -->
-                                    <!-- <td align="left"> -->
-                                        <!-- <apex:outputField id="OutPattern01" value="{!coc.OutPattern__c}" /> -->
-                                        <apex:inputHidden id="OutPattern01" value="{!coc.OutPattern__c}" />
+                                <!-- <td align="right" >鏄惁鍖婚櫌鐗逛环鍑哄簱 : </td> -->
+                                <!-- <td align="left"> -->
+                                <!-- <apex:outputField id="OutPattern01" value="{!coc.OutPattern__c}" /> -->
+                                <apex:inputHidden
+                                    id="OutPattern01"
+                                    value="{!coc.OutPattern__c}"
+                                />
 
-                                    <!-- </td> -->
+                                <!-- </td> -->
                                 <!-- </apex:detail> -->
                                 <!-- ===add by rentx 2020-12-04 end -->
-
                             </tr>
                         </table>
-                        </apex:outputPanel>
+                    </apex:outputPanel>
 
                     <!-- <tr id = "SummonsFlag" style="visibility:{!SummonsFlag}">
                             <td align="right">鍑哄簱鍗曞彿锛�</td>
@@ -704,193 +1004,374 @@
                     </table> -->
                     <!-- update end by vivek2019-7-12 -->
                 </apex:pageBlock>
-<!--==============20160314====INSERT_CODE_START=======================================-->
-                 <apex:pageBlock title="鍑哄簱鍗曚俊鎭�" id="unEditable" rendered="{!!EditAble}">
+                <!--==============20160314====INSERT_CODE_START=======================================-->
+                <apex:pageBlock
+                    title="鍑哄簱鍗曚俊鎭�"
+                    id="unEditable"
+                    rendered="{!!EditAble}"
+                >
                     <table>
                         <colgroup>
-                            <col width="150px"/>
-                            <col width="300px"/>
-                            <col width="150px"/>
-                            <col width="300px"/>
-                            <col width="100px"/>
-                            <col width="70px"/>
-                            <col width="90px"/>
-                            <col width="100px"/>
-                            <col width="10px"/>
-                            <col width="85px"/>
-                            <col width="100px"/>
-                            <col width="10px"/>
-                            <col width="70px"/>
-                            <col width="100px"/>
+                            <col width="150px" />
+                            <col width="300px" />
+                            <col width="150px" />
+                            <col width="300px" />
+                            <col width="100px" />
+                            <col width="70px" />
+                            <col width="90px" />
+                            <col width="100px" />
+                            <col width="10px" />
+                            <col width="85px" />
+                            <col width="100px" />
+                            <col width="10px" />
+                            <col width="70px" />
+                            <col width="100px" />
                         </colgroup>
                         <tr>
                             <td align="right">鍑哄簱鍗曞彿锛�</td>
-                            <td align="left"><apex:outputField id="OrderCode_out"  value="{!coc.Name}" style="width:300px"/></td>
+                            <td align="left">
+                                <apex:outputField
+                                    id="OrderCode_out"
+                                    value="{!coc.Name}"
+                                    style="width: 300px"
+                                />
+                            </td>
                             <td align="right">鍑哄簱鍗曠姸鎬侊細</td>
-                            <td align="left"><apex:outputField id="OrderStatus_out" value="{!coc.SummonsStatus_c__c}" style="width:300px"/></td>
+                            <td align="left">
+                                <apex:outputField
+                                    id="OrderStatus_out"
+                                    value="{!coc.SummonsStatus_c__c}"
+                                    style="width: 300px"
+                                />
+                            </td>
                         </tr>
                         <tr>
                             <td align="right">鐩殑锛�</td>
-                            <td align="left"><apex:outputField id="OrderDirction_out"  value="{!coc.SummonsForDirction__c}" style="width:300px"/></td>
+                            <td align="left">
+                                <apex:outputField
+                                    id="OrderDirction_out"
+                                    value="{!coc.SummonsForDirction__c}"
+                                    style="width: 300px"
+                                />
+                            </td>
                             <td align="right">寮�绁ㄧ姸鎬侊細</td>
                             <td align="left">
-                            <apex:outputField id="SecondDealer_level2" value="{!coc.Billed_Status__c}" style="width:300px"/>
+                                <apex:outputField
+                                    id="SecondDealer_level2"
+                                    value="{!coc.Billed_Status__c}"
+                                    style="width: 300px"
+                                />
                             </td>
-
                         </tr>
-                        <tr style="{!IF(coc.SummonsForDirction__c='閿�鍞粰浜岀骇缁忛攢鍟�','','display:none')}">
+                        <tr
+                            style="{!IF(coc.SummonsForDirction__c='閿�鍞粰浜岀骇缁忛攢鍟�','','display:none')}"
+                        >
                             <td align="right">浜岀骇缁忛攢鍟嗭細</td>
-                            <td align="left"><apex:outputField id="SecondDealer_out" value="{!coc.Order_Dealer_Info__c}" style="width:300px"/></td>
+                            <td align="left">
+                                <apex:outputField
+                                    id="SecondDealer_out"
+                                    value="{!coc.Order_Dealer_Info__c}"
+                                    style="width: 300px"
+                                />
+                            </td>
                             <td align="right"></td>
                             <td align="left"></td>
                         </tr>
                         <tr>
                             <td align="right">瀹㈡埛鍚嶏細</td>
-                            <td align="left"><apex:outputField id="OrderForHospital_out" value="{!coc.ShipmentAccount__c}" style="width:300px"/></td>
-                            <td align="right"><apex:outputText value="鍙戠エ锛�" rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"/></td>
-                            <td align="left"><apex:inputField value="{!coc.ConInvoice_Code__c}" rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}" id="ConInvoice_Code"/>
-                            <c:helpicon helpText="宸插紑绁ㄧ殑鎹㈣揣鐨勬椂鍊欙紝閫夋嫨宸插紑绁ㄧ殑鍙戠エ銆�" rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"/>
+                            <td align="left">
+                                <apex:outputField
+                                    id="OrderForHospital_out"
+                                    value="{!coc.ShipmentAccount__c}"
+                                    style="width: 300px"
+                                />
+                            </td>
+                            <td align="right">
+                                <apex:outputText
+                                    value="鍙戠エ锛�"
+                                    rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"
+                                />
+                            </td>
+                            <td align="left">
+                                <apex:inputField
+                                    value="{!coc.ConInvoice_Code__c}"
+                                    rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"
+                                    id="ConInvoice_Code"
+                                />
+                                <c:helpicon
+                                    helpText="宸插紑绁ㄧ殑鎹㈣揣鐨勬椂鍊欙紝閫夋嫨宸插紑绁ㄧ殑鍙戠エ銆�"
+                                    rendered="{!IF(coc.SummonsStatus_c__c='宸插畬鎴�' && coc.SummonsForDirction__c!='浜掔浉璋冭揣',true,false)}"
+                                />
                             </td>
                         </tr>
                         <tr>
                             <td align="right">绉戝锛�</td>
                             <td align="left">
-                                <apex:outputField id="Order_ForDealerText" value="{!coc.Order_ForCustomerText__c}" style="width:170px"/>
+                                <apex:outputField
+                                    id="Order_ForDealerText"
+                                    value="{!coc.Order_ForCustomerText__c}"
+                                    style="width: 170px"
+                                />
                             </td>
                             <td align="right">鍑哄簱閲戦锛�</td>
-                            <td align="left"><apex:outputField id="sumPrice_buttom" value="{!coc.Shipment_total_amount__c}" style="width:300px"/> 鍏�</td>
-                        <!--    <td/>
+                            <td align="left">
+                                <apex:outputField
+                                    id="sumPrice_buttom"
+                                    value="{!coc.Shipment_total_amount__c}"
+                                    style="width: 300px"
+                                />
+                                鍏�
+                            </td>
+                            <!--    <td/>
 
                             <td align="right" style="visibility:hidden">鍑哄簱鍗曟棩鏈�:</td>
                             <td align="right" style="visibility:hidden"><apex:outputField id="OrderDate_out" value="{!coc.Order_date__c}" style="width:300px"/></td> -->
-
                         </tr>
                         <!-- update start by vivek2019-7-12 -->
                         <tr>
                             <td align="right">娌℃湁纭畾浠锋牸锛�</td>
                             <td align="left">
-                                <apex:inputCheckbox id="NoConfirmedPrice_out" value="{!coc.NoConfirmedPrice__c}" disabled="true" />
+                                <apex:inputCheckbox
+                                    id="NoConfirmedPrice_out"
+                                    value="{!coc.NoConfirmedPrice__c}"
+                                    disabled="true"
+                                />
                             </td>
 
                             <!-- ===add by rentx 2020-12-04 start -->
                             <!-- <apex:detail rendered="{!agencyProType == 'ENG'}"> -->
-                                <!-- <td align="right">鏄惁鍖婚櫌鐗逛环鍑哄簱 : </td> -->
-                                <!-- <td align="left"> -->
-                                    <!-- <apex:outputField id="OutPattern" value="{!coc.OutPattern__c}"/> -->
-                                    <apex:inputHidden id="OutPattern" value="{!coc.OutPattern__c}"/>
-                                <!-- </td> -->
+                            <!-- <td align="right">鏄惁鍖婚櫌鐗逛环鍑哄簱 : </td> -->
+                            <!-- <td align="left"> -->
+                            <!-- <apex:outputField id="OutPattern" value="{!coc.OutPattern__c}"/> -->
+                            <apex:inputHidden
+                                id="OutPattern"
+                                value="{!coc.OutPattern__c}"
+                            />
+                            <!-- </td> -->
                             <!-- </apex:detail> -->
                             <!-- ===add by rentx 2020-12-04 end -->
                         </tr>
                         <!-- update end by vivek2019-7-12 -->
                     </table>
                 </apex:pageBlock>
-<!--==============20160314====INSERT_CODE_END=======================================-->
+                <!--==============20160314====INSERT_CODE_END=======================================-->
 
-<!--==============20160310====鍒拌揣鑱斿姩鏃朵笉闇�瑕佹绱�====================================-->
+                <!--==============20160310====鍒拌揣鑱斿姩鏃朵笉闇�瑕佹绱�====================================-->
                 <!-- update start by vivek 2019-7-15 -->
-                <apex:pageBlock id="searchBlock" rendered="{!IF(!Existarrive && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}">
-                <!-- apex:pageBlock id="searchBlock" rendered="{!IF(!Existarrive && EditAble,true,false)}"> -->
-                <!-- update end by vivek 2019-7-15 -->
+                <apex:pageBlock
+                    id="searchBlock"
+                    rendered="{!IF(!Existarrive && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}"
+                >
+                    <!-- apex:pageBlock id="searchBlock" rendered="{!IF(!Existarrive && EditAble,true,false)}"> -->
+                    <!-- update end by vivek 2019-7-15 -->
                     <table>
                         <colgroup>
-                            <col width="160px"/>
-                            <col width="200"/>
-                            <col width="15px"/>
-                            <col width="120px"/>
-                            <col width="200px"/>
-                            <col width="20px"/>
-                            <col width="120px"/>
-                            <col width="200px"/>
-                            <col width="20px"/>
-                            <col width="120px"/>
-                            <col width="200px"/>
-                            <col width="20px"/>
-                            <col width="90px"/>
-                            <col width="100px"/>
-                            <col width="10px"/>
-                            <col width="85px"/>
-                            <col width="100px"/>
-                            <col width="10px"/>
-                            <col width="70px"/>
-                            <col width="100px"/>
+                            <col width="160px" />
+                            <col width="200" />
+                            <col width="15px" />
+                            <col width="120px" />
+                            <col width="200px" />
+                            <col width="20px" />
+                            <col width="120px" />
+                            <col width="200px" />
+                            <col width="20px" />
+                            <col width="120px" />
+                            <col width="200px" />
+                            <col width="20px" />
+                            <col width="90px" />
+                            <col width="100px" />
+                            <col width="10px" />
+                            <col width="85px" />
+                            <col width="100px" />
+                            <col width="10px" />
+                            <col width="70px" />
+                            <col width="100px" />
                         </colgroup>
                         <tr>
                             <td align="right">娑堣�楀搧鍚嶇О</td>
-                            <td><apex:inputText id="OrderDateSearch" value="{!category1}" style="width:100px"/></td>
-                            <td/>
+                            <td>
+                                <apex:inputText
+                                    id="OrderDateSearch"
+                                    value="{!category1}"
+                                    style="width: 100px"
+                                />
+                            </td>
+                            <td />
                             <td align="right">绗�3鍒嗙被</td>
                             <td>
-                             <apex:selectList id="category3Search" value="{!category3}" style="width:100px" size="1" onchange="showAllCate();">
-                                <apex:selectOptions value="{!categoryOptionList}"/>
-                            </apex:selectList>
+                                <apex:selectList
+                                    id="category3Search"
+                                    value="{!category3}"
+                                    style="width: 100px"
+                                    size="1"
+                                    onchange="showAllCate();"
+                                >
+                                    <apex:selectOptions
+                                        value="{!categoryOptionList}"
+                                    />
+                                </apex:selectList>
                             </td>
-                            <td/>
-                             <td align="right">绗�4鍒嗙被</td>
+                            <td />
+                            <td align="right">绗�4鍒嗙被</td>
                             <td>
-                             <apex:selectList id="category4Search" value="{!category4}" style="width:100px" size="1" onchange="showCate();">
-                                <apex:selectOptions value="{!category4OptionList}"/>
-                            </apex:selectList>
+                                <apex:selectList
+                                    id="category4Search"
+                                    value="{!category4}"
+                                    style="width: 100px"
+                                    size="1"
+                                    onchange="showCate();"
+                                >
+                                    <apex:selectOptions
+                                        value="{!category4OptionList}"
+                                    />
+                                </apex:selectList>
                             </td>
-                            <td/>
-                             <td align="right">绗�5鍒嗙被</td>
-                             <td>
-                             <apex:selectList id="category5Search" value="{!category5}" style="width:100px" size="1">
-                                <apex:selectOptions value="{!category5OptionList}"/>
-                            </apex:selectList>
+                            <td />
+                            <td align="right">绗�5鍒嗙被</td>
+                            <td>
+                                <apex:selectList
+                                    id="category5Search"
+                                    value="{!category5}"
+                                    style="width: 100px"
+                                    size="1"
+                                >
+                                    <apex:selectOptions
+                                        value="{!category5OptionList}"
+                                    />
+                                </apex:selectList>
                             </td>
-                            <td/>
+                            <td />
                             <!-- //add by rentx start -->
                             <apex:detail rendered="{!hasHosPro}">
                                 <td align="right" width="120px">鍖婚櫌鐗逛环</td>
-                                 <td>
-                                 <apex:selectList id="outOutPattern" value="{!outOutPattern}" style="width:100px" size="1">
-                                    <apex:selectOptions value="{!outOutPatternOptionList}"/>
-                                </apex:selectList>
+                                <td>
+                                    <apex:selectList
+                                        id="outOutPattern"
+                                        value="{!outOutPattern}"
+                                        style="width: 100px"
+                                        size="1"
+                                    >
+                                        <apex:selectOptions
+                                            value="{!outOutPatternOptionList}"
+                                        />
+                                    </apex:selectList>
                                 </td>
-                                </apex:detail>
-                            <td/>
+                            </apex:detail>
+                            <td />
                             <!-- //add by rentx end -->
 
                             <!-- <td align="right">浜у搧鍨嬪彿</td>
                             <td><apex:inputText id="OrderCodeSearch" value="{!category_Goods}" style="width:100px"/></td> -->
                             <td align="right"></td>
-                            <td><apex:commandButton value="妫�绱�" style="width: 100px;" onclick="searchProductJs(); return false;" /></td>
-                            <td><input type="button" value="娓呯┖" style="width: 100px;" onclick="ClearJs()" class="btn"/></td>
-                            <td/>
+                            <td>
+                                <apex:commandButton
+                                    value="妫�绱�"
+                                    style="width: 100px"
+                                    onclick="searchProductJs(); return false;"
+                                />
+                            </td>
+                            <td>
+                                <input
+                                    type="button"
+                                    value="娓呯┖"
+                                    style="width: 100px"
+                                    onclick="ClearJs()"
+                                    class="btn"
+                                />
+                            </td>
+                            <td />
                         </tr>
                         <tr>
                             <td></td>
                         </tr>
                     </table>
                 </apex:pageBlock>
-                <div id="ErrorName" style="color: red;font-weight: bold;">{!alertMessage}</div>
-                <apex:pageBlock title="鍑哄簱鍗曟槑缁�" id="ConsumableorderdetailsSection">
+                <div id="ErrorName" style="color: red; font-weight: bold">
+                    {!alertMessage}
+                </div>
+                <apex:pageBlock
+                    title="鍑哄簱鍗曟槑缁�"
+                    id="ConsumableorderdetailsSection"
+                >
                     <!--<apex:inputHidden id="consumableorderdetailsCnt" value="{!consumableorderdetailsCount}"/>-->
-                    <input type="hidden" id="allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount" value="{!consumableorderdetailsCount}" />
-                    <table class="list" border="0" cellpadding="0" cellspacing="0" id="ConsumableorderdetailsTable">
-                         <tr class="headerRow">
+                    <input
+                        type="hidden"
+                        id="allPage:allForm:allBlock:ConsumableorderdetailsSection:consumableorderdetailsCount"
+                        value="{!consumableorderdetailsCount}"
+                    />
+                    <table
+                        class="list"
+                        border="0"
+                        cellpadding="0"
+                        cellspacing="0"
+                        id="ConsumableorderdetailsTable"
+                    >
+                        <tr class="headerRow">
                             <!-- update start by vivek 2019-7-15 -->
-                            <apex:variable var="v" value="" rendered="{!IF(!Existarrive && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}">
-                            <!-- <apex:variable var="v" value="" rendered="{!IF(!Existarrive && EditAble,true,false)}"> -->
-                            <!-- update start by vivek 2019-7-15 -->
-                                <th><input type='checkbox' onClick='checkAll()' id='checker'/>閫夋嫨</th>
+                            <apex:variable
+                                var="v"
+                                value=""
+                                rendered="{!IF(!Existarrive && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}"
+                            >
+                                <!-- <apex:variable var="v" value="" rendered="{!IF(!Existarrive && EditAble,true,false)}"> -->
+                                <!-- update start by vivek 2019-7-15 -->
+                                <th>
+                                    <input
+                                        type="checkbox"
+                                        onClick="checkAll()"
+                                        id="checker"
+                                    />閫夋嫨
+                                </th>
                             </apex:variable>
-                            <th><a href="#" onclick="SortLimitedJs('0');return false;" style="text-decoration: underline;">娑堣�楀搧鍚嶇О</a>{!sortOrder[0]}</th>
-                        <!--    <th><a href="#" onclick="SortLimitedJs('1');return false;" style="text-decoration: underline;">浜у搧鍨嬪彿</a>{!sortOrder[1]}</th>-->
+                            <th>
+                                <a
+                                    href="#"
+                                    onclick="SortLimitedJs('0');return false;"
+                                    style="text-decoration: underline"
+                                    >娑堣�楀搧鍚嶇О</a
+                                >{!sortOrder[0]}
+                            </th>
+                            <!--    <th><a href="#" onclick="SortLimitedJs('1');return false;" style="text-decoration: underline;">浜у搧鍨嬪彿</a>{!sortOrder[1]}</th>-->
 
                             <!-- TODO 鏈暘鏆備笉鏄剧ず -->
                             <apex:variable var="v" value="">
-                            <th style="width: 80px;text-align:center;">瑙勬牸</th>
+                                <th style="width: 80px; text-align: center">
+                                    瑙勬牸
+                                </th>
                             </apex:variable>
                             <th>CFDA鐘舵��</th>
                             <th>娉ㄥ唽璇佺紪鐮佸彿</th>
                             <th>娉ㄥ唽璇佹晥鏈�</th>
 
-                            <apex:variable var="v" value="" rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble,true,false)}">
-                             <th><a href="#" onclick="SortLimitedJs('5');return false;" style="text-decoration: underline;">绗�3鍒嗙被</a>{!sortOrder[5]}</th>
-                            <th><a href="#" onclick="SortLimitedJs('6');return false;" style="text-decoration: underline;">绗�4鍒嗙被</a>{!sortOrder[6]}</th>
-                            <th><a href="#" onclick="SortLimitedJs('7');return false;" style="text-decoration: underline;">绗�5鍒嗙被</a>{!sortOrder[7]}</th>
+                            <apex:variable
+                                var="v"
+                                value=""
+                                rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble,true,false)}"
+                            >
+                                <th>
+                                    <a
+                                        href="#"
+                                        onclick="SortLimitedJs('5');return false;"
+                                        style="text-decoration: underline"
+                                        >绗�3鍒嗙被</a
+                                    >{!sortOrder[5]}
+                                </th>
+                                <th>
+                                    <a
+                                        href="#"
+                                        onclick="SortLimitedJs('6');return false;"
+                                        style="text-decoration: underline"
+                                        >绗�4鍒嗙被</a
+                                    >{!sortOrder[6]}
+                                </th>
+                                <th>
+                                    <a
+                                        href="#"
+                                        onclick="SortLimitedJs('7');return false;"
+                                        style="text-decoration: underline"
+                                        >绗�5鍒嗙被</a
+                                    >{!sortOrder[7]}
+                                </th>
                             </apex:variable>
                             <th>鍗曚綅</th>
                             <th>鍑鸿揣鏁伴噺</th>
@@ -906,23 +1387,50 @@
                                 <th>鍑鸿揣鍗曚环(鍏�)</th>
                             </apex:variable>-->
 
-                            <apex:variable var="v" value="" rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble,true,false))}" id="BoxPiece_UnEditout">
+                            <apex:variable
+                                var="v"
+                                value=""
+                                rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble,true,false))}"
+                                id="BoxPiece_UnEditout"
+                            >
                             </apex:variable>
-                            <apex:variable var="v" value="" rendered="{!if(EditAble,true,false)}">
-                            <th>鍑鸿揣閲戦(鍏�)</th>
-                            <!--<th><a href="#" onclick="SortStoreJs('3');return false;" style="text-decoration: underline;width: 100px;text-align: center;">鏈夋晥鏈熷唴搴撳瓨</a>{!sortOrder[3]}</th>-->
-                            <th>鏈夋晥鏈熷唴搴撳瓨(鐩�)</th>
-                            <th>鏈夋晥鏈熷唴搴撳瓨(涓�)</th>
+                            <apex:variable
+                                var="v"
+                                value=""
+                                rendered="{!if(EditAble,true,false)}"
+                            >
+                                <th>鍑鸿揣閲戦(鍏�)</th>
+                                <!--<th><a href="#" onclick="SortStoreJs('3');return false;" style="text-decoration: underline;width: 100px;text-align: center;">鏈夋晥鏈熷唴搴撳瓨</a>{!sortOrder[3]}</th>-->
+                                <th>鏈夋晥鏈熷唴搴撳瓨(鐩�)</th>
+                                <th>鏈夋晥鏈熷唴搴撳瓨(涓�)</th>
                             </apex:variable>
 
-                            <apex:variable var="v" value="" rendered="{!!EditAble}">
-                                <th>{!$ObjectType.Consumable_Orderdetails__c.fields.InvoiceProNot_count__c.label}</th>
+                            <apex:variable
+                                var="v"
+                                value=""
+                                rendered="{!!EditAble}"
+                            >
+                                <th>
+                                    {!$ObjectType.Consumable_Orderdetails__c.fields.InvoiceProNot_count__c.label}
+                                </th>
                             </apex:variable>
-                            <apex:variable var="v" value="" rendered="{!!EditAble}">
-                                <th>{!$ObjectType.Consumable_Orderdetails__c.fields.RrturnPro_count__c.label}</th>
+                            <apex:variable
+                                var="v"
+                                value=""
+                                rendered="{!!EditAble}"
+                            >
+                                <th>
+                                    {!$ObjectType.Consumable_Orderdetails__c.fields.RrturnPro_count__c.label}
+                                </th>
                             </apex:variable>
-                            <apex:variable var="v" value="" rendered="{!!EditAble}">
-                                <th>{!$ObjectType.Consumable_Orderdetails__c.fields.Invoiced_Procount__c.label}</th>
+                            <apex:variable
+                                var="v"
+                                value=""
+                                rendered="{!!EditAble}"
+                            >
+                                <th>
+                                    {!$ObjectType.Consumable_Orderdetails__c.fields.Invoiced_Procount__c.label}
+                                </th>
                             </apex:variable>
 
                             <!-- //add by rentx 2020-11-27 start -->
@@ -931,117 +1439,294 @@
                             </apex:detail>
                             <!-- //add by rentx 2020-11-27 end -->
                         </tr>
-                        <apex:repeat value="{!pageRecords}" var="records" id="ConsumableorderdetailsTable">
+                        <apex:repeat
+                            value="{!pageRecords}"
+                            var="records"
+                            id="ConsumableorderdetailsTable"
+                        >
                             <tr class="dataRow">
                                 <!-- update start by vivek 2019-7-15 -->
                                 <!-- <apex:variable var="v" value="" rendered="{!IF(!Existarrive && EditAble,true,false)}" id="variableinfo"> -->
-                                <apex:variable var="v" value="" rendered="{!IF(!Existarrive && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}" id="variableinfo">
-                                <!-- update end by vivek 2019-7-15 -->
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    rendered="{!IF(!Existarrive && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}"
+                                    id="variableinfo"
+                                >
+                                    <!-- update end by vivek 2019-7-15 -->
                                     <td>
-                                    <apex:inputCheckbox value="{!records.check}" id="consumablesCountproRowCheckbox" disabled="{!!records.canSelect}"/>
-                                     <apex:inputCheckbox value="{!records.oldCheck}" id="proRowOldCheckbox" style="display:none"/></td>
-                                 </apex:variable>
+                                        <apex:inputCheckbox
+                                            value="{!records.check}"
+                                            id="consumablesCountproRowCheckbox"
+                                            disabled="{!!records.canSelect}"
+                                        />
+                                        <apex:inputCheckbox
+                                            value="{!records.oldCheck}"
+                                            id="proRowOldCheckbox"
+                                            style="display: none"
+                                        />
+                                    </td>
+                                </apex:variable>
                                 <td class="dataCell">
-                                    <apex:outputText id="ProductName" value="{!IF(records.oldCheck=false,records.Prod.Name__c,records.orderdetails1.Consumable_Product__r.Name__c)}"/>
+                                    <apex:outputText
+                                        id="ProductName"
+                                        value="{!IF(records.oldCheck=false,records.Prod.Name__c,records.orderdetails1.Consumable_Product__r.Name__c)}"
+                                    />
                                 </td>
-                            <!--    <td>{!records.Prod.Asset_Model_No__c}</td>
+                                <!--    <td>{!records.Prod.Asset_Model_No__c}</td>
                                  -->
-                                <td style="width: 80px;text-align:center;">{!records.packinglist}</td>
-                                <td class="dataCell">{!records.Prod.SFDA_Status__c}</td>
-                                <td class="dataCell">{!records.approbation_No}</td>
+                                <td style="width: 80px; text-align: center">
+                                    {!records.packinglist}
+                                </td>
                                 <td class="dataCell">
-                                    <apex:outputText value="{0, date, yyyy/MM/dd}">
-                                        <apex:param value="{!records.expiration_Date}" />
+                                    {!records.Prod.SFDA_Status__c}
+                                </td>
+                                <td class="dataCell">
+                                    {!records.approbation_No}
+                                </td>
+                                <td class="dataCell">
+                                    <apex:outputText
+                                        value="{0, date, yyyy/MM/dd}"
+                                    >
+                                        <apex:param
+                                            value="{!records.expiration_Date}"
+                                        />
                                     </apex:outputText>
                                 </td>
-                                <apex:variable var="v" value="" rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble,true,false)}" id="variableCategory3">
-                                 <td class="dataCell">{!records.Prod.Category3__c}</td>
-                                 <td class="dataCell">{!records.Prod.Category4__c}</td>
-                                 <td class="dataCell">{!records.Prod.Category5__c}</td>
-                                <!-- update start by vivek 2019-7-15 -->
-                                <apex:variable var="v" value="" rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}" id="BoxPiece_UnEditout1">
-                                 <td class="dataCell">
-                                    <apex:selectList value="{!records.orderdetails1.Box_Piece__c}" size="1" style="width:60px;" id="BoxPiece">
-                                    <apex:selectOptions value="{!records.boxorpiece}"/>
-                                    </apex:selectList>
-                                </td>
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble,true,false)}"
+                                    id="variableCategory3"
+                                >
+                                    <td class="dataCell">
+                                        {!records.Prod.Category3__c}
+                                    </td>
+                                    <td class="dataCell">
+                                        {!records.Prod.Category4__c}
+                                    </td>
+                                    <td class="dataCell">
+                                        {!records.Prod.Category5__c}
+                                    </td>
+                                    <!-- update start by vivek 2019-7-15 -->
+                                    <apex:variable
+                                        var="v"
+                                        value=""
+                                        rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}"
+                                        id="BoxPiece_UnEditout1"
+                                    >
+                                        <td class="dataCell">
+                                            <apex:selectList
+                                                value="{!records.orderdetails1.Box_Piece__c}"
+                                                size="1"
+                                                style="width: 60px"
+                                                id="BoxPiece"
+                                            >
+                                                <apex:selectOptions
+                                                    value="{!records.boxorpiece}"
+                                                />
+                                            </apex:selectList>
+                                        </td>
+                                    </apex:variable>
+                                    <!-- update end by vivek 2019-7-15 -->
                                 </apex:variable>
-                                <!-- update end by vivek 2019-7-15 -->
-                                 </apex:variable>
 
                                 <!-- update start by vivek 2019-7-15 -->
-                                <apex:variable var="v" value="" rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false))}" id="BoxPiece_UnEditout1">
-                                <!-- <apex:variable var="v" value="" rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble,true,false))}" id="BoxPiece_UnEditout"> -->
-                                <!-- update end by vivek 2019-7-15 -->
-                                <td><apex:outputField id="BoxPiece_UnEditin" value="{!records.orderdetails1.Box_Piece__c}"/></td>
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false))}"
+                                    id="BoxPiece_UnEditout1"
+                                >
+                                    <!-- <apex:variable var="v" value="" rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble,true,false))}" id="BoxPiece_UnEditout"> -->
+                                    <!-- update end by vivek 2019-7-15 -->
+                                    <td>
+                                        <apex:outputField
+                                            id="BoxPiece_UnEditin"
+                                            value="{!records.orderdetails1.Box_Piece__c}"
+                                        />
+                                    </td>
                                 </apex:variable>
                                 <!-- update start by vivek 2019-7-15 -->
-                                <apex:variable var="v" value="" rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false))}" id="consumablesCount_UnEditout">
-                                <!-- <apex:variable var="v" value="" rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble,true,false))}" id="consumablesCount_UnEditout"> -->
-                                <!-- update start by vivek 2019-7-15 -->
-                                <!--<td style="text-align:right;"><apex:outputField id="consumablesCount_Unagency" value="{!records.orderdetails1.Unitprice_To_agency__c}"/></td>-->
-                                <td style="text-align:center;"><apex:outputField id="consumablesCount_UnEditin" value="{!records.orderdetails1.Shipment_Count__c}"/></td>
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false))}"
+                                    id="consumablesCount_UnEditout"
+                                >
+                                    <!-- <apex:variable var="v" value="" rendered="{!NOT(IF(arriveorder ='' && Existarrive = false && EditAble,true,false))}" id="consumablesCount_UnEditout"> -->
+                                    <!-- update start by vivek 2019-7-15 -->
+                                    <!--<td style="text-align:right;"><apex:outputField id="consumablesCount_Unagency" value="{!records.orderdetails1.Unitprice_To_agency__c}"/></td>-->
+                                    <td style="text-align: center">
+                                        <apex:outputField
+                                            id="consumablesCount_UnEditin"
+                                            value="{!records.orderdetails1.Shipment_Count__c}"
+                                        />
+                                    </td>
                                 </apex:variable>
                                 <!-- update start by vivek 2019-7-15 -->
-                                <apex:variable var="v" value="" rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}" id="variable">
-                                 <!-- <apex:variable var="v" value="" rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble,true,false)}" id="variable"> -->
-                                <!-- update end by vivek 2019-7-15 -->
-                                <td class="dataCell">
-                                    <div style="width:2px;height:20px;background-color:red; position:absolute;margin-right:5px;"></div>
-                                    <apex:inputField onblur="ComputePrice(this)" id="consumablesCount" value="{!records.orderdetails1.Shipment_Count__c}" style="width: 100px;" /></td>
-                                 </apex:variable>
-                                <apex:variable var="v" value="" rendered="{!EditAble}" id="variableMoneyinfo">
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble && coc.SummonsStatus_c__c != '浠锋牸鏈畾',true,false)}"
+                                    id="variable"
+                                >
+                                    <!-- <apex:variable var="v" value="" rendered="{!IF(arriveorder ='' && Existarrive = false && EditAble,true,false)}" id="variable"> -->
+                                    <!-- update end by vivek 2019-7-15 -->
                                     <td class="dataCell">
-                                    <div style="width:2px;height:20px;background-color:red; position:absolute;margin-right:5px;"></div>
-                                    <apex:inputField onblur="ComputePriceCheck(this)" value="{!records.orderdetails1.Delivery_List_RMB__c}" style="width: 100px;" id="productOrderMoneyinfo"/>
+                                        <div
+                                            style="
+                                                width: 2px;
+                                                height: 20px;
+                                                background-color: red;
+                                                position: absolute;
+                                                margin-right: 5px;
+                                            "
+                                        ></div>
+                                        <apex:inputField
+                                            onblur="ComputePrice(this)"
+                                            id="consumablesCount"
+                                            value="{!records.orderdetails1.Shipment_Count__c}"
+                                            style="width: 100px"
+                                        />
+                                    </td>
+                                </apex:variable>
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    rendered="{!EditAble}"
+                                    id="variableMoneyinfo"
+                                >
+                                    <td class="dataCell">
+                                        <div
+                                            style="
+                                                width: 2px;
+                                                height: 20px;
+                                                background-color: red;
+                                                position: absolute;
+                                                margin-right: 5px;
+                                            "
+                                        ></div>
+                                        <apex:inputField
+                                            onblur="ComputePriceCheck(this)"
+                                            value="{!records.orderdetails1.Delivery_List_RMB__c}"
+                                            style="width: 100px"
+                                            id="productOrderMoneyinfo"
+                                        />
                                     </td>
                                     <!-- <td class="dataCell">
                                     <apex:inputField id="Unitpriceagency" value="{!records.orderdetails1.Unitprice_To_agency__c}"  style="width: 100px;"/>
                                     </td> -->
                                 </apex:variable>
-                                <apex:variable var="v" value="" rendered="{!!EditAble}">
-                                    <td class="dataCell" style="text-align:center;">
-                                    <apex:outputText id="consumablesCountDealerPrice_Unedit" value="{!IF(records.orderdetails1.Delivery_List_RMB__c==null,0.00,records.orderdetails1.Delivery_List_RMB__c)}"/>
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    rendered="{!!EditAble}"
+                                >
+                                    <td
+                                        class="dataCell"
+                                        style="text-align: center"
+                                    >
+                                        <apex:outputText
+                                            id="consumablesCountDealerPrice_Unedit"
+                                            value="{!IF(records.orderdetails1.Delivery_List_RMB__c==null,0.00,records.orderdetails1.Delivery_List_RMB__c)}"
+                                        />
                                     </td>
                                     <!-- <td style="text-align:center;"><apex:outputField id="consumablesCount_Unagency" value="{!records.orderdetails1.Unitprice_To_agency__c}"/></td> -->
                                 </apex:variable>
 
-                                <apex:variable var="v" value="" id="variableAllprice" rendered="{!EditAble}">
-                                <td class="dataCell" style="text-align:center;">
-                                    <apex:outputField id="consumablesCounttestPrice" value="{!records.orderdetails1.Shipment_amount__c}"/>
-                                </td>
-                                <!--<td class="dataCell" style="text-align:right;width: 50px;">{!records.allnumber}</td>-->
-                                <td class="dataCell" style="text-align:center;width: 50px;">{!records.Boxnumber}</td>
-                                <td class="dataCell" style="text-align:center;width: 50px;">{!records.Piecenumber}</td>
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    id="variableAllprice"
+                                    rendered="{!EditAble}"
+                                >
+                                    <td
+                                        class="dataCell"
+                                        style="text-align: center"
+                                    >
+                                        <apex:outputField
+                                            id="consumablesCounttestPrice"
+                                            value="{!records.orderdetails1.Shipment_amount__c}"
+                                        />
+                                    </td>
+                                    <!--<td class="dataCell" style="text-align:right;width: 50px;">{!records.allnumber}</td>-->
+                                    <td
+                                        class="dataCell"
+                                        style="text-align: center; width: 50px"
+                                    >
+                                        {!records.Boxnumber}
+                                    </td>
+                                    <td
+                                        class="dataCell"
+                                        style="text-align: center; width: 50px"
+                                    >
+                                        {!records.Piecenumber}
+                                    </td>
                                 </apex:variable>
-                                <apex:variable var="v" value="" rendered="{!!EditAble}">
-                                    <td class="dataCell" style="text-align:center;"><apex:outputField value="{!records.orderdetails1.InvoiceProNot_count__c}"/></td>
-                                    <td class="dataCell" style="text-align:center;"><apex:outputField value="{!records.orderdetails1.RrturnPro_count__c}"/></td>
-                                    <td class="dataCell" style="text-align:center;"><apex:outputField value="{!records.orderdetails1.Invoiced_Procount__c}"/></td>
+                                <apex:variable
+                                    var="v"
+                                    value=""
+                                    rendered="{!!EditAble}"
+                                >
+                                    <td
+                                        class="dataCell"
+                                        style="text-align: center"
+                                    >
+                                        <apex:outputField
+                                            value="{!records.orderdetails1.InvoiceProNot_count__c}"
+                                        />
+                                    </td>
+                                    <td
+                                        class="dataCell"
+                                        style="text-align: center"
+                                    >
+                                        <apex:outputField
+                                            value="{!records.orderdetails1.RrturnPro_count__c}"
+                                        />
+                                    </td>
+                                    <td
+                                        class="dataCell"
+                                        style="text-align: center"
+                                    >
+                                        <apex:outputField
+                                            value="{!records.orderdetails1.Invoiced_Procount__c}"
+                                        />
+                                    </td>
                                 </apex:variable>
-                                    <!-- add by rentx 2020-11-26 start -->
-                                <apex:detail rendered="{!hasHosPro}" >
+                                <!-- add by rentx 2020-11-26 start -->
+                                <apex:detail rendered="{!hasHosPro}">
                                     <td>
                                         <!-- <apex:outputField value="{!records.orderdetails2.hospitalSpecialOffer__c}"/> -->
-                                        <apex:detail rendered="{!records.hospitalSpecialOffer}" >
-                                            <apex:inputHidden value="{!records.hospitalSpecialOffer}"  id="hosOffer"/>
-                                            <apex:inputHidden value="{!records.hosPro}"  id="hosPro"/>
+                                        <apex:detail
+                                            rendered="{!records.hospitalSpecialOffer}"
+                                        >
+                                            <apex:inputHidden
+                                                value="{!records.hospitalSpecialOffer}"
+                                                id="hosOffer"
+                                            />
+                                            <apex:inputHidden
+                                                value="{!records.hosPro}"
+                                                id="hosPro"
+                                            />
                                             鈭�
                                         </apex:detail>
                                     </td>
                                 </apex:detail>
-                            <!-- add by rentx 2020-11-26 end -->
+                                <!-- add by rentx 2020-11-26 end -->
                             </tr>
                         </apex:repeat>
                     </table>
                     <table style="width: 100%">
-                         <tr>
+                        <tr>
                             <td>
                                 <!-- Page X of Y -->
                                 <!-- PageNumber锛氬綋鍓嶉〉闈㈡墍鍦ㄤ綅缃紝ResultSize锛氳褰曟�绘潯鏁帮紝PageSize锛氭瘡椤佃褰曟潯鏁� -->
-                                <apex:outputText value="{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,
-                                 (setCon.pageNumber * size))} 鍏� {!noOfRecords} 涓�" />
-                                 <!--<apex:outputPanel >
+                                <apex:outputText
+                                    value="{!(setCon.pageNumber * size)+1-size}-{!IF((setCon.pageNumber * size)>noOfRecords, noOfRecords,
+                                 (setCon.pageNumber * size))} 鍏� {!noOfRecords} 涓�"
+                                />
+                                <!--<apex:outputPanel >
                                     <apex:actionStatus id="fetchStatus" >
                                         <apex:facet name="start" >
                                           <img src="/img/loading.gif" />
@@ -1051,64 +1736,162 @@
                             </td>
                             <td align="center">
                                 <div class="paginator line1">
-                                <span class="prevNextLinks">
-                                <!-- 鏈夎繛鎺� -->
-                                <apex:outputPanel rendered="{!setCon.hasPrevious}">
-                                <span class="prevNext">
-                                <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!setCon.first}" oncomplete="refreshPageSizeJs();" title="棣栭〉" >
-                                <img src="/s.gif" title="棣栭〉" alt="棣栭〉" class="{!if((setCon.hasPrevious),'first','firstoff')}"/>
-                                </apex:commandLink>
-                                </span>
-                                <span class="prevNext">
-                                <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection"  action="{!setCon.previous}" oncomplete="refreshPageSizeJs();"  title="涓婁竴椤�">
-                                <img src="/s.gif" title="涓婁竴椤�" alt="涓婁竴椤�" class="{!if((setCon.hasPrevious),'prev','prevoff')}"/>涓婁竴椤�
-                                </apex:commandLink>
-                                </span>
-                                </apex:outputPanel>
-                                <!-- 鏃犺繛鎺� -->
-                                <apex:outputPanel rendered="{!!setCon.hasPrevious}">
-                                <span class="prevNext">
-                                <apex:commandLink status="fetchStatus" oncomplete="onLoadDirction();" reRender="ConsumableorderdetailsSection" title="棣栭〉" >
-                                <img src="/s.gif" title="棣栭〉" alt="棣栭〉" class="{!if((setCon.hasPrevious),'first','firstoff')}"/>
-                                </apex:commandLink>
-                                </span>
-                                <span class="prevNext">
-                                <apex:commandLink status="fetchStatus" oncomplete="onLoadDirction();" reRender="ConsumableorderdetailsSection"  title="涓婁竴椤�">
-                                <img src="/s.gif" title="涓婁竴椤�" alt="涓婁竴椤�" class="{!if((setCon.hasPrevious),'prev','prevoff')}"/>涓婁竴椤�
-                                </apex:commandLink>
-                                </span>
-                                </apex:outputPanel>
-                                <!-- 鏈夎繛鎺� -->
-                                <apex:outputPanel rendered="{!setCon.hasNext}">
-                                <span class="prevNext" rendered = "{!!setCon.hasNext}">
-                                <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!setCon.next}" oncomplete="refreshPageSizeJs();" title="涓嬩竴椤�" rendered="{!setCon.hasNext}">涓嬩竴椤�
-                                <img src="/s.gif" title="涓嬩竴椤�" alt="涓嬩竴椤�" class="{!if((setCon.hasNext),'next','nextoff')}" />
-                                </apex:commandLink>
-                                </span>
-                                <span class="prevNext">
-                                <apex:commandLink status="fetchStatus" reRender="ConsumableorderdetailsSection" action="{!setCon.last}"  oncomplete="refreshPageSizeJs();" title="灏鹃〉">
-                                <img src="/s.gif" title="灏鹃〉" alt="灏鹃〉" class="{!if((setCon.hasNext),'last','lastoff')}"/>
-                                </apex:commandLink>
-                                </span>
-                                </apex:outputPanel>
-                                <!-- 鏃犺繛鎺� -->
-                                <apex:outputPanel rendered="{!!setCon.hasNext}">
-                                <span class="prevNext" rendered = "{!setCon.hasNext}">
-                                <apex:commandLink status="fetchStatus" oncomplete="onLoadDirction();" reRender="ConsumableorderdetailsSection"  title="涓嬩竴椤�">涓嬩竴椤�
-                                <img src="/s.gif" title="涓嬩竴椤�" alt="涓嬩竴椤�" class="{!if((setCon.hasNext),'next','nextoff')}" />
-                                </apex:commandLink>
-                                </span>
-                                <span class="prevNext">
-                                <apex:commandLink status="fetchStatus" oncomplete="onLoadDirction();" reRender="ConsumableorderdetailsSection" title="灏鹃〉">
-                                <img src="/s.gif" title="灏鹃〉" alt="灏鹃〉" class="{!if((setCon.hasNext),'last','lastoff')}"/>
-                                </apex:commandLink>
-                                </span>
-                                </apex:outputPanel>
-                                </span>
+                                    <span class="prevNextLinks">
+                                        <!-- 鏈夎繛鎺� -->
+                                        <apex:outputPanel
+                                            rendered="{!setCon.hasPrevious}"
+                                        >
+                                            <span class="prevNext">
+                                                <apex:commandLink
+                                                    status="fetchStatus"
+                                                    reRender="ConsumableorderdetailsSection"
+                                                    action="{!setCon.first}"
+                                                    oncomplete="refreshPageSizeJs();"
+                                                    title="棣栭〉"
+                                                >
+                                                    <img
+                                                        src="/s.gif"
+                                                        title="棣栭〉"
+                                                        alt="棣栭〉"
+                                                        class="{!if((setCon.hasPrevious),'first','firstoff')}"
+                                                    />
+                                                </apex:commandLink>
+                                            </span>
+                                            <span class="prevNext">
+                                                <apex:commandLink
+                                                    status="fetchStatus"
+                                                    reRender="ConsumableorderdetailsSection"
+                                                    action="{!setCon.previous}"
+                                                    oncomplete="refreshPageSizeJs();"
+                                                    title="涓婁竴椤�"
+                                                >
+                                                    <img
+                                                        src="/s.gif"
+                                                        title="涓婁竴椤�"
+                                                        alt="涓婁竴椤�"
+                                                        class="{!if((setCon.hasPrevious),'prev','prevoff')}"
+                                                    />涓婁竴椤�
+                                                </apex:commandLink>
+                                            </span>
+                                        </apex:outputPanel>
+                                        <!-- 鏃犺繛鎺� -->
+                                        <apex:outputPanel
+                                            rendered="{!!setCon.hasPrevious}"
+                                        >
+                                            <span class="prevNext">
+                                                <apex:commandLink
+                                                    status="fetchStatus"
+                                                    oncomplete="onLoadDirction();"
+                                                    reRender="ConsumableorderdetailsSection"
+                                                    title="棣栭〉"
+                                                >
+                                                    <img
+                                                        src="/s.gif"
+                                                        title="棣栭〉"
+                                                        alt="棣栭〉"
+                                                        class="{!if((setCon.hasPrevious),'first','firstoff')}"
+                                                    />
+                                                </apex:commandLink>
+                                            </span>
+                                            <span class="prevNext">
+                                                <apex:commandLink
+                                                    status="fetchStatus"
+                                                    oncomplete="onLoadDirction();"
+                                                    reRender="ConsumableorderdetailsSection"
+                                                    title="涓婁竴椤�"
+                                                >
+                                                    <img
+                                                        src="/s.gif"
+                                                        title="涓婁竴椤�"
+                                                        alt="涓婁竴椤�"
+                                                        class="{!if((setCon.hasPrevious),'prev','prevoff')}"
+                                                    />涓婁竴椤�
+                                                </apex:commandLink>
+                                            </span>
+                                        </apex:outputPanel>
+                                        <!-- 鏈夎繛鎺� -->
+                                        <apex:outputPanel
+                                            rendered="{!setCon.hasNext}"
+                                        >
+                                            <span
+                                                class="prevNext"
+                                                rendered="{!!setCon.hasNext}"
+                                            >
+                                                <apex:commandLink
+                                                    status="fetchStatus"
+                                                    reRender="ConsumableorderdetailsSection"
+                                                    action="{!setCon.next}"
+                                                    oncomplete="refreshPageSizeJs();"
+                                                    title="涓嬩竴椤�"
+                                                    rendered="{!setCon.hasNext}"
+                                                    >涓嬩竴椤�
+                                                    <img
+                                                        src="/s.gif"
+                                                        title="涓嬩竴椤�"
+                                                        alt="涓嬩竴椤�"
+                                                        class="{!if((setCon.hasNext),'next','nextoff')}"
+                                                    />
+                                                </apex:commandLink>
+                                            </span>
+                                            <span class="prevNext">
+                                                <apex:commandLink
+                                                    status="fetchStatus"
+                                                    reRender="ConsumableorderdetailsSection"
+                                                    action="{!setCon.last}"
+                                                    oncomplete="refreshPageSizeJs();"
+                                                    title="灏鹃〉"
+                                                >
+                                                    <img
+                                                        src="/s.gif"
+                                                        title="灏鹃〉"
+                                                        alt="灏鹃〉"
+                                                        class="{!if((setCon.hasNext),'last','lastoff')}"
+                                                    />
+                                                </apex:commandLink>
+                                            </span>
+                                        </apex:outputPanel>
+                                        <!-- 鏃犺繛鎺� -->
+                                        <apex:outputPanel
+                                            rendered="{!!setCon.hasNext}"
+                                        >
+                                            <span
+                                                class="prevNext"
+                                                rendered="{!setCon.hasNext}"
+                                            >
+                                                <apex:commandLink
+                                                    status="fetchStatus"
+                                                    oncomplete="onLoadDirction();"
+                                                    reRender="ConsumableorderdetailsSection"
+                                                    title="涓嬩竴椤�"
+                                                    >涓嬩竴椤�
+                                                    <img
+                                                        src="/s.gif"
+                                                        title="涓嬩竴椤�"
+                                                        alt="涓嬩竴椤�"
+                                                        class="{!if((setCon.hasNext),'next','nextoff')}"
+                                                    />
+                                                </apex:commandLink>
+                                            </span>
+                                            <span class="prevNext">
+                                                <apex:commandLink
+                                                    status="fetchStatus"
+                                                    oncomplete="onLoadDirction();"
+                                                    reRender="ConsumableorderdetailsSection"
+                                                    title="灏鹃〉"
+                                                >
+                                                    <img
+                                                        src="/s.gif"
+                                                        title="灏鹃〉"
+                                                        alt="灏鹃〉"
+                                                        class="{!if((setCon.hasNext),'last','lastoff')}"
+                                                    />
+                                                </apex:commandLink>
+                                            </span>
+                                        </apex:outputPanel>
+                                    </span>
                                 </div>
-                             </td>
-                             <td align="right" width="20%">
                             </td>
+                            <td align="right" width="20%"></td>
                         </tr>
                     </table>
                     <!--
@@ -1138,49 +1921,87 @@
             </apex:panelGrid>-->
                 </apex:pageBlock>
 
-                <apex:pageBlock title="鍙戠エ鏄庣粏" rendered="{!IF((coc.Billed_Status__c !='杩樻病寮�绁�') && IdCheck != null,true,false)}">
-                     <apex:pageblocksection columns="1" id="consumableInvoiceRecordsSection">
-                        <apex:pageblocktable value="{!consumableInvoiceRecords}" var="records" id="consumableInvoiceRecordsTable">
-                             <apex:column width="80">
-                                 <apex:facet name="header">鍙戠エ鍙�</apex:facet>
-                                 <apex:outputField value="{!records.Name}"/>
-                             </apex:column>
-                              <apex:column width="80">
-                                 <apex:facet name="header">鍙戠エ鏃�</apex:facet>
-                                 <apex:outputField value="{!records.Invoice_Date__c}"/>
-                             </apex:column>
-                             <apex:column width="80" style="text-align: center;">
-                                 <apex:facet name="header">鍙戠エ绁ㄩ潰閲戦(鍏�)</apex:facet>
-                                 <apex:outputField value="{!records.Invoice_total_amount__c}"/>
-                             </apex:column>
-                             <apex:column width="80">
-                                 <apex:facet name="header">鍙戠エ鐘舵��</apex:facet>
-                                 <apex:outputField value="{!records.Invoice_status__c}"/>
-                             </apex:column>
+                <apex:pageBlock
+                    title="鍙戠エ鏄庣粏"
+                    rendered="{!IF((coc.Billed_Status__c !='杩樻病寮�绁�') && IdCheck != null,true,false)}"
+                >
+                    <apex:pageblocksection
+                        columns="1"
+                        id="consumableInvoiceRecordsSection"
+                    >
+                        <apex:pageblocktable
+                            value="{!consumableInvoiceRecords}"
+                            var="records"
+                            id="consumableInvoiceRecordsTable"
+                        >
+                            <apex:column width="80">
+                                <apex:facet name="header">鍙戠エ鍙�</apex:facet>
+                                <apex:outputField value="{!records.Name}" />
+                            </apex:column>
+                            <apex:column width="80">
+                                <apex:facet name="header">鍙戠エ鏃�</apex:facet>
+                                <apex:outputField
+                                    value="{!records.Invoice_Date__c}"
+                                />
+                            </apex:column>
+                            <apex:column width="80" style="text-align: center">
+                                <apex:facet name="header"
+                                    >鍙戠エ绁ㄩ潰閲戦(鍏�)</apex:facet
+                                >
+                                <apex:outputField
+                                    value="{!records.Invoice_total_amount__c}"
+                                />
+                            </apex:column>
+                            <apex:column width="80">
+                                <apex:facet name="header">鍙戠エ鐘舵��</apex:facet>
+                                <apex:outputField
+                                    value="{!records.Invoice_status__c}"
+                                />
+                            </apex:column>
                         </apex:pageblocktable>
                     </apex:pageblocksection>
                 </apex:pageBlock>
 
-                <apex:pageBlock title="鍑哄簱浜у搧鏄庣粏" rendered="{!IF(consumableorderdetails2Count > 0,true,false)}">
-                <apex:pageblocksection columns="1" id="Consumableorderdetails2Section">
-                    <apex:pageblocktable value="{!consumableorderdetails2Records}" var="records" id="Consumableorderdetails2Table">
-                         <apex:column width="80">
-                             <apex:facet name="header">娑堣�楀搧鍚嶇О</apex:facet>
-                             <apex:outputField value="{!records.Prod.name}"/>
-                         </apex:column>
-                          <apex:column width="80">
-                             <apex:facet name="header">鎵规鍙�</apex:facet>
-                             <apex:outputField value="{!records.orderdetails2.SerialLotNo__c}" />
-                         </apex:column>
-                          <apex:column width="80">
-                             <apex:facet name="header">绠$悊缂栫爜</apex:facet>
-                             <apex:outputField value="{!records.orderdetails2.TracingCode__c}"/>
-                         </apex:column>
-                          <apex:column width="80">
-                             <apex:facet name="header">浣跨敤鏈熼檺</apex:facet>
-                             <apex:outputField value="{!records.orderdetails2.Sterilization_limit__c}"/>
-                         </apex:column>
-                        <!-- <apex:column width="80">
+                <apex:pageBlock
+                    title="鍑哄簱浜у搧鏄庣粏"
+                    rendered="{!IF(consumableorderdetails2Count > 0,true,false)}"
+                >
+                    <apex:pageblocksection
+                        columns="1"
+                        id="Consumableorderdetails2Section"
+                    >
+                        <apex:pageblocktable
+                            value="{!consumableorderdetails2Records}"
+                            var="records"
+                            id="Consumableorderdetails2Table"
+                        >
+                            <apex:column width="80">
+                                <apex:facet name="header"
+                                    >娑堣�楀搧鍚嶇О</apex:facet
+                                >
+                                <apex:outputField
+                                    value="{!records.Prod.name}"
+                                />
+                            </apex:column>
+                            <apex:column width="80">
+                                <apex:facet name="header">鎵规鍙�</apex:facet>
+                                <apex:outputField
+                                    value="{!records.orderdetails2.SerialLotNo__c}"
+                                />
+                            </apex:column>
+                            <apex:column width="80">
+                                <apex:facet name="header">绠$悊缂栫爜</apex:facet>
+                                <apex:outputField
+                                    value="{!records.orderdetails2.TracingCode__c}"
+                                />
+                            </apex:column>
+                            <apex:column width="80">
+                                <apex:facet name="header">浣跨敤鏈熼檺</apex:facet>
+                                <apex:outputField
+                                    value="{!records.orderdetails2.Sterilization_limit__c}"
+                                />
+                            </apex:column>
+                            <!-- <apex:column width="80">
                              <apex:facet name="header">寮�绁ㄦ棩</apex:facet>
                              <apex:outputField value="{!records.orderdetails2.Invoice_Date__c}" />
                          </apex:column>
@@ -1190,28 +2011,39 @@
                                 <apex:outputText value="{!records.orderdetails2.Invoice_No__r.Name}" />
                              </apex:outputLink>
                          </apex:column> -->
-                    </apex:pageblocktable>
-                </apex:pageblocksection>
-            </apex:pageBlock>
+                        </apex:pageblocktable>
+                    </apex:pageblocksection>
+                </apex:pageBlock>
             </apex:pageBlock>
         </apex:outputPanel>
-        <apex:pageBlock title="闄勪欢" id="ConsumableConsumeSection" rendered="{!!editAble}">
-        <apex:pageBlockTable value="{!AttachmentRecoeds}" var="a" >
-        <apex:column headerValue="鏍囬" style="width: 33%">
-        <apex:outputLink value="{!a.Concc.Id}" target="LINK_{!a.Concc.Id}">
-            {!a.Concc.name}
-        </apex:outputLink>
-        </apex:column>
-        <apex:column headerValue="鍒涘缓浜�">
-            <apex:outputField value="{!a.Concc.OwnerId}"/>
-        </apex:column>
-        </apex:pageBlockTable>
-        <apex:pageBlockButtons location="top" >
-            <apex:commandButton onclick="FilesUaplodJs();" value="涓婁紶闄勪欢" style="margin-left:30px;width:100px" rerender="dummy" rendered="{!!(EditDelCommitBtnDisabled||EditAble)}"/>
-        </apex:pageBlockButtons>
-    </apex:pageBlock>
+        <apex:pageBlock
+            title="闄勪欢"
+            id="ConsumableConsumeSection"
+            rendered="{!!editAble}"
+        >
+            <apex:pageBlockTable value="{!AttachmentRecoeds}" var="a">
+                <apex:column headerValue="鏍囬" style="width: 33%">
+                    <apex:outputLink
+                        value="{!a.Concc.Id}"
+                        target="LINK_{!a.Concc.Id}"
+                    >
+                        {!a.Concc.name}
+                    </apex:outputLink>
+                </apex:column>
+                <apex:column headerValue="鍒涘缓浜�">
+                    <apex:outputField value="{!a.Concc.OwnerId}" />
+                </apex:column>
+            </apex:pageBlockTable>
+            <apex:pageBlockButtons location="top">
+                <apex:commandButton
+                    onclick="FilesUaplodJs();"
+                    value="涓婁紶闄勪欢"
+                    style="margin-left: 30px; width: 100px"
+                    rerender="dummy"
+                    rendered="{!!(EditDelCommitBtnDisabled||EditAble)}"
+                />
+            </apex:pageBlockButtons>
+        </apex:pageBlock>
     </apex:form>
-<script>
-
-</script>
-</apex:page>
\ No newline at end of file
+    <script></script>
+</apex:page>
diff --git a/manifest/packageForSign.xml b/manifest/packageForSign.xml
index 18de9c6..c0c2ef3 100644
--- a/manifest/packageForSign.xml
+++ b/manifest/packageForSign.xml
@@ -9,7 +9,8 @@
         <members>DNUpsertBatchTest</members>
         <members>SyncProvinceWIndowToSignForm</members>
         <members>SyncProvinceWIndowToSignFormTest</members>
+        <members>LexArriveGoodsController</members>
         <name>ApexClass</name>
     </types>
     <version>52.0</version>
-</Package>
\ No newline at end of file
+</Package>

--
Gitblit v1.9.1