From cd05a7b0ab8dd5838f8998fb36fc0435fd9c5b84 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期二, 11 七月 2023 14:07:40 +0800
Subject: [PATCH] LEX Community Code Deploy0711

---
 force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html            |   10 
 force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js              |   15 
 force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html      |   64 
 force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js                  |   10 
 force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js                        |   14 
 force-app/main/default/lwc/lexTopPage/lexTopPage.js                                  |    7 
 force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css                       |   56 
 force-app/main/default/lwc/customMydrComp/customMydrComp.js                          |   16 
 force-app/main/default/classes/LexConsumableOrderManageController.cls                |  684 +++--
 force-app/main/default/classes/LexSaleOrderController.cls                            |    1 
 force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html              |    1 
 force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js              | 1615 +++++++-------
 force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml     |    5 
 force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml          |   28 
 force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml             |   28 
 force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml                 |    5 
 force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls                    |   69 
 force-app/main/default/contentassets/OlympusCommunityLogo.asset                      |    0 
 force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js                |   12 
 force-app/main/default/contentassets/OlympusCommunityLoginBG.asset                   |    0 
 force-app/main/default/lwc/customMydrComp/customMydrComp.html                        |   10 
 force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml |    5 
 manifest/package.xml                                                                 |    2 
 force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml           |    5 
 force-app/main/default/classes/Batch_FixAttachmentToFiles.cls                        |   44 
 force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html        |    7 
 force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js          |    3 
 force-app/main/default/classes/LexSummonsCreatControllerTest.cls                     | 3845 +++++++++++++++++++++++++++++++++-
 28 files changed, 5,169 insertions(+), 1,392 deletions(-)

diff --git a/force-app/main/default/classes/Batch_FixAttachmentToFiles.cls b/force-app/main/default/classes/Batch_FixAttachmentToFiles.cls
index e7b7f7a..06af07c 100644
--- a/force-app/main/default/classes/Batch_FixAttachmentToFiles.cls
+++ b/force-app/main/default/classes/Batch_FixAttachmentToFiles.cls
@@ -29,8 +29,10 @@
   global void execute(Database.BatchableContext BC, List<Attachment> scope) {
     List<ContentVersion> insertContents = new List<ContentVersion>();
     Map<string, id> nameParentMaps = new Map<string, id>();
+    Set<String> attachmentIds = new Set<String>();
     for (Attachment att : scope) {
       nameParentMaps.put(att.Name, att.ParentId);
+      attachmentIds.add(att.Id);
       ContentVersion cVersion = new ContentVersion();
       cVersion.ContentLocation = 'S'; //S-Document is in Salesforce. E-Document is outside of Salesforce. L-Document is on a Social Netork.
       cVersion.PathOnClient = att.Name; //File name with extention
@@ -42,7 +44,12 @@
     if (insertContents.isEmpty()) {
       return;
     }
-    insert insertContents;
+    //Insert insertContents;
+    List<Database.SaveResult> saveResultsContents = Database.insert(
+      insertContents,
+      false
+    );
+    insertLog(saveResultsContents, attachmentIds);
     set<Id> contentIds = new Set<Id>();
     for (ContentVersion cv : insertContents) {
       contentIds.add(cv.id);
@@ -61,7 +68,40 @@
       cDocLink.Visibility = 'AllUsers';
       insertDocLinks.add(cDocLink);
     }
-    insert insertDocLinks;
+    //Insert insertDocLinks;
+    List<Database.SaveResult> saveResultsLinks = Database.insert(
+      insertDocLinks,
+      false
+    );
+    insertLog(saveResultsLinks, attachmentIds);
+  }
+
+  global void insertLog(
+    List<Database.SaveResult> saveResults,
+    Set<String> attachmentIds
+  ) {
+    Transaction_Log__c traLog = new Transaction_Log__c();
+    List<Map<String, String>> logMapList = new List<Map<String, String>>();
+    for (Database.SaveResult result : saveResults) {
+      String recordId = result.getId();
+      if (!result.isSuccess()) {
+        for (Database.Error error : result.getErrors()) {
+          Map<String, String> logMap = new Map<String, String>();
+          String errorMsg = error.getMessage();
+          logMap.put('recordId', recordId);
+          logMap.put('errorMsg', errorMsg);
+          logMapList.add(logMap);
+        }
+      }
+    }
+    if (logMapList.size() > 0) {
+      Map<String, String> attachmentIdMap = new Map<String, String>();
+      attachmentIdMap.put('attachmentIds', JSON.serialize(attachmentIds));
+      logMapList.add(attachmentIdMap);
+      traLog.Response__c = JSON.serialize(logMapList);
+      traLog.Module__c = 'Attachment COnvert Transaction ';
+      insert traLog;
+    }
   }
 
   global void finish(Database.BatchableContext BC) {
diff --git a/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
new file mode 100644
index 0000000..88d691b
--- /dev/null
+++ b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls
@@ -0,0 +1,69 @@
+@isTest(SeeAllData=true)
+private class Batch_FixAttachmentToFilesTest {
+  @isTest(SeeAllData=true)
+  static void testInit() {
+    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('Agency')
+      .getRecordTypeId();
+    Account accountItem1 = new Account(
+      Name = 'Testaccount001',
+      RecordTypeId = rectCo
+    );
+    insert accountItem1;
+
+    Consumable_order__c consOrder = new Consumable_order__c();
+    consOrder.Name = 'test01';
+    consOrder.Order_status__c = '鎵瑰噯';
+    consOrder.Deliver_date__c = Date.today();
+    consOrder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+    consOrder.Order_type__c = '璁㈠崟';
+    consOrder.Order_ProType__c = 'ENG';
+    consOrder.Dealer_Info__c = accountItem1.Id;
+    consOrder.Delivery_detail_count__c = 5;
+    insert consOrder;
+
+    List<Attachment> attachList = new List<Attachment>();
+    Attachment attach = new Attachment();
+    attach.Name = 'A-65224941-20200923--1.docx';
+    Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+    attach.body = bodyBlob;
+    attach.ParentId = consOrder.Id;
+    attachList.add(attach);
+    insert attachList;
+
+    Set<String> Id = new Set<String>();
+    String objectType;
+    Datetime creStartDate;
+    Datetime creEndDate;
+
+    List<Attachment> attachmentList = [
+      SELECT
+        Id,
+        Name,
+        OwnerId,
+        ParentId,
+        Parent.Name,
+        Parent.Type,
+        Body,
+        CreatedDate,
+        CreatedById
+      FROM Attachment
+      WHERE Id = :attachList[0].Id
+      ORDER BY CreatedDate ASC
+      LIMIT 1
+    ];
+    for (Attachment att : attachmentList) {
+      Id.add(att.ParentId);
+      objectType = att.Parent.Name;
+      creStartDate = att.CreatedDate;
+      creEndDate = att.CreatedDate.addDays(1);
+    }
+    System.Test.startTest();
+    Database.executeBatch(
+      new Batch_FixAttachmentToFiles(objectType, creStartDate, creEndDate),
+      1
+    );
+    Database.executeBatch(new Batch_FixAttachmentToFiles(Id), 1);
+    System.Test.stopTest();
+  }
+}
diff --git a/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml
new file mode 100644
index 0000000..a9fd6e9
--- /dev/null
+++ b/force-app/main/default/classes/Batch_FixAttachmentToFilesTest.cls-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>57.0</apiVersion>
+    <status>Active</status>
+</ApexClass>
diff --git a/force-app/main/default/classes/LexConsumableOrderManageController.cls b/force-app/main/default/classes/LexConsumableOrderManageController.cls
index 0f4fc14..6f82bf0 100644
--- a/force-app/main/default/classes/LexConsumableOrderManageController.cls
+++ b/force-app/main/default/classes/LexConsumableOrderManageController.cls
@@ -5,328 +5,376 @@
  *
  */
 public without sharing class LexConsumableOrderManageController {
-    public static Consumable_order__c coc { get; set; }
-    public static String agencyProType { get; set; }
-    public static String category1 { get; set; }
-    public static String baseUrl { get; private set; }
-    private static String[] columus = new List<String>{ 'Product2__c.Name' };
-    public static List<SelectOption> provinceOpts { get; set; }
-    public static List<CusOption> provinceCusOpts;
-    private static String accountid = null;
-    public static List<String> title { get; private set; }
-    public static List<String> column;
-    public static List<List<String>> columns { get; private set; }
-    public static List<Consumable_order__c> raesList { get; private set; }
-    private static String userWorkLocation;
-    public static Boolean hasHop { get; set; }
-    public static Boolean hasSpecial { get; set; }
-    public LexConsumableOrderManageController() {
-        baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+  public static Consumable_order__c coc { get; set; }
+  public static String agencyProType { get; set; }
+  public static String category1 { get; set; }
+  public static String baseUrl { get; private set; }
+  private static String[] columus = new List<String>{ 'Product2__c.Name' };
+  public static List<SelectOption> provinceOpts { get; set; }
+  public static List<CusOption> provinceCusOpts;
+  private static String accountid = null;
+  public static List<String> title { get; private set; }
+  public static List<String> column;
+  public static List<List<String>> columns { get; private set; }
+  public static List<Consumable_order__c> raesList { get; private set; }
+  private static String userWorkLocation;
+  public static Boolean hasHop { get; set; }
+  public static Boolean hasSpecial { get; set; }
+  public LexConsumableOrderManageController() {
+    baseUrl = URL.getSalesforceBaseUrl().toExternalForm();
+  }
+
+  @AuraEnabled
+  public static Results init1() {
+    Results results = new Results();
+    results.isNoteStay = LexUtility.getIsNoteStay();
+    try {
+      String userId = UserInfo.getUserId();
+      // String userId = '0050l000007CAieAAG';
+      List<user> Useracc = new List<user>();
+      Useracc = [
+        SELECT accountid, Work_Location__c, UserPro_Type__c
+        FROM user
+        WHERE id = :userId
+      ];
+      accountid = Useracc[0].accountid;
+      agencyProType = Useracc[0].UserPro_Type__c;
+      if (String.isBlank(Useracc[0].UserPro_Type__c)) {
+        agencyProType = 'ET';
+      }
+      userWorkLocation = Useracc[0].Work_Location__c;
+      coc = new Consumable_order__c();
+      // 鑾峰緱璁㈠崟涓�瑙�
+      Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe()
+        .get('Consumable_order__c')
+        .getDescribe()
+        .fieldSets.getMap();
+      Schema.FieldSet fs = fsMap.get('order_view');
+      // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+      List<FieldSetMember> fsmList = fs.getFields();
+      // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+      title = new List<String>();
+      column = new List<String>();
+      columns = new List<List<String>>();
+      List<CusCol> cols = new List<CusCol>();
+      for (FieldSetMember fsm : fsmList) {
+        //add by Link
+        if (
+          fsm.getFieldPath() == 'Order_ForHospital__c' &&
+          agencyProType == 'ET'
+        ) {
+        } else {
+          CusCol col = new CusCol();
+          col.label = fsm.getLabel();
+          col.fieldName = fsm.getFieldPath();
+          col.hideDefaultActions = true;
+          // col.sortable = true;
+          col.wrapText = true;
+          if (fsm.getFieldPath() == 'Order_ForHospital__c') {
+            col.type = 'url';
+            col.fieldName = 'hosUrl';
+            TypeAttr typeAttributes1 = new TypeAttr();
+            CusLable cusLabel = new CusLable();
+            cusLabel.fieldName = 'hosName';
+            typeAttributes1.label = cusLabel;
+            typeAttributes1.target = '_blank';
+            col.typeAttributes = typeAttributes1;
+          }
+          if (fsm.getFieldPath() == 'Name') {
+            col.type = 'url';
+            col.fieldName = 'nameUrl';
+            TypeAttr typeAttributes1 = new TypeAttr();
+            CusLable cusLabel = new CusLable();
+            cusLabel.fieldName = 'Name';
+            typeAttributes1.label = cusLabel;
+            typeAttributes1.target = '_blank';
+            col.typeAttributes = typeAttributes1;
+          }
+          cols.add(col);
+        }
+        //update by rentx 2020-12-22 start
+        if (
+          fsm.getLabel() == '鍖婚櫌' &&
+          agencyProType != null &&
+          agencyProType == 'ET'
+        ) {
+        } else {
+          title.add(fsm.getLabel());
+        }
+        if (
+          fsm.getFieldPath() == 'Order_ForHospital__c' &&
+          agencyProType != null &&
+          agencyProType == 'ET'
+        ) {
+        } else {
+          column.add(fsm.getFieldPath());
+          columns.add(fsm.getFieldPath().split('\\.'));
+        }
+      }
+      provinceOpts = new List<SelectOption>();
+      provinceOpts.add(new SelectOption('', '-鏃�-'));
+      provinceOpts.add(new SelectOption('鑽夋涓�', '鑽夋涓�'));
+      provinceOpts.add(new SelectOption('宸叉彁浜�', '宸叉彁浜�'));
+      provinceOpts.add(new SelectOption('鎵瑰噯', '鎵瑰噯'));
+      provinceOpts.add(new SelectOption('椹冲洖', '椹冲洖'));
+      //閽堝lwc鐨勮嚜瀹氫箟option
+      provinceCusOpts = new List<CusOption>();
+      provinceCusOpts.add(new CusOption('-鏃�-', ''));
+      provinceCusOpts.add(new CusOption('鑽夋涓�', '鑽夋涓�'));
+      provinceCusOpts.add(new CusOption('宸叉彁浜�', '宸叉彁浜�'));
+      provinceCusOpts.add(new CusOption('鎵瑰噯', '鎵瑰噯'));
+      provinceCusOpts.add(new CusOption('椹冲洖', '椹冲洖'));
+      // 鑾峰緱鏄剧ず鏁版嵁
+      raesList = new List<Consumable_order__c>();
+      String soql = 'select Id';
+      for (String s : column) {
+        soql += ',' + s;
+      }
+      soql +=
+        ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' +
+        '璁㈠崟' +
+        '\'';
+      soql += ' and RecordtypeId = \'' + System.Label.RT_ConOrder_Order + '\'';
+      soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\'';
+      soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+      soql +=
+        ' and Dealer_Info__c =\'' +
+        accountid +
+        '\' order by Order_status__c ';
+      System.debug('====soql====' + soql);
+      raesList = Database.query(soql);
+      //add by rentx 2021-3-10 start
+      //涓� hasHop 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
+      List<hospitalprice__c> hopList = [
+        SELECT id, hospital__c
+        FROM hospitalprice__c
+        WHERE account__c = :accountid
+      ];
+      if (hopList == null || hopList.size() == 0) {
+        hasHop = false;
+      } else {
+        hasHop = true;
+      }
+      //涓� hasSpecial 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈変績閿�鍟嗗搧
+      //鏌ヨ褰撳墠缁忛攢鍟嗕笅鐨勬湁鏁堝悎鍚�
+      List<Account> contractList = [
+        SELECT Id, Name, RecordType.DeveloperName
+        FROM Account
+        WHERE
+          RecordType.DeveloperName = 'AgencyContract'
+          AND Contact_Type__c LIKE :agencyProType
+          AND Agent_Ref__c = :accountid
+      ];
+      List<Id> dealIds = new List<Id>();
+      if (contractList != null && contractList.size() > 0) {
+        for (Account acc : contractList) {
+          dealIds.add(acc.Id);
+        }
+        List<Dealer_Product__c> deList = [
+          SELECT id
+          FROM Dealer_Product__c
+          WHERE Dealer_Contact__c IN :dealIds
+        ];
+        if (deList == null || deList.size() == 0) {
+          hasSpecial = false;
+        } else {
+          hasSpecial = true;
+        }
+      } else {
+        hasSpecial = false;
+      }
+      results.result = 'Success';
+      results.provinceOpts = provinceCusOpts;
+      results.raesList = raesList;
+      results.agencyProType = agencyProType;
+      results.userWorkLocation = userWorkLocation;
+      results.accountid = accountid;
+      results.hasHop = hasHop;
+      results.hasSpecial = hasSpecial;
+      results.title = title;
+      results.cols = cols;
+    } catch (Exception e) {
+      results.result = 'Fail';
+      results.raesList = new List<Consumable_order__c>();
+      results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+    }
+    return results;
+  }
+
+  @AuraEnabled
+  public static Results searchConsumableorderdetails(
+    String categoryStr,
+    Date orderDate,
+    String orderStatus,
+    String accountidStr,
+    String agencyProTypeStr,
+    String userWorkLocationStr
+  ) {
+    Results results = new Results();
+    agencyProType = agencyProTypeStr;
+    userWorkLocation = userWorkLocationStr;
+    accountid = accountidStr;
+    if (String.isBlank(categoryStr)) {
+      category1 = null;
+    } else {
+      category1 = categoryStr;
+    }
+    coc = new Consumable_order__c();
+    if (String.isBlank(orderStatus)) {
+      coc.Order_status__c = null;
+    } else {
+      coc.Order_status__c = orderStatus;
+    }
+    coc.Order_date__c = orderDate;
+    try {
+      Date cate2 = coc.Order_date__c;
+      String cate3 = coc.Order_status__c;
+      // 鑾峰緱璁㈠崟涓�瑙�
+      Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe()
+        .get('Consumable_order__c')
+        .getDescribe()
+        .fieldSets.getMap();
+      Schema.FieldSet fs = fsMap.get('order_view');
+      // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
+      List<FieldSetMember> fsmList = fs.getFields();
+      // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
+      title = new List<String>();
+      column = new List<String>();
+      columns = new List<List<String>>();
+      for (FieldSetMember fsm : fsmList) {
+        //update by rentx 2020-12-22 start
+        if (
+          fsm.getLabel() == '鍖婚櫌' &&
+          agencyProType != null &&
+          agencyProType == 'ET'
+        ) {
+        } else {
+          title.add(fsm.getLabel());
+        }
+        if (
+          fsm.getFieldPath() == 'Order_ForHospital__c' &&
+          agencyProType != null &&
+          agencyProType == 'ET'
+        ) {
+        } else {
+          column.add(fsm.getFieldPath());
+          columns.add(fsm.getFieldPath().split('\\.'));
+        }
+      }
+      // 鑾峰緱鏄剧ず鏁版嵁
+      raesList = new List<Consumable_order__c>();
+      String soql = 'select Id';
+      for (String s : column) {
+        soql += ',' + s;
+      }
+      soql +=
+        ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' +
+        '璁㈠崟' +
+        '\' and RecordtypeId = \'' +
+        System.Label.RT_ConOrder_Order +
+        '\' and Dealer_Info__c =\'' +
+        accountid +
+        '\' ';
+      soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
+      soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
+      if (!String.isBlank(category1)) {
+        soql +=
+          ' and Name like \'%' +
+          String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) +
+          '%\' ';
+      }
+      if (cate2 != null) {
+        soql += ' and Order_date__c = :cate2';
+      }
+      if (cate3 != null) {
+        soql += ' and Order_status__c = :cate3 ';
+      }
+      soql += ' order by Order_status__c ';
+      system.debug('====soql:' + soql);
+      raesList = Database.query(soql);
+      system.debug('====raesList:' + raesList);
+      if (raesList.size() > 0) {
+        results.result = 'Success';
+        results.raesList = raesList;
+        results.errorMsg = '鍏辨湁' + raesList.size() + '涓鍗�';
+      } else {
+        results.result = 'Fail';
+        results.raesList = new List<Consumable_order__c>();
+        results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏宠鍗�';
+      }
+    } catch (Exception e) {
+      results.result = 'Fail';
+      results.raesList = new List<Consumable_order__c>();
+      results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
+    }
+    return results;
+  }
+
+  public class Results {
+    @AuraEnabled
+    public String result;
+    @AuraEnabled
+    public String errorMsg;
+    @AuraEnabled
+    public List<CusOption> provinceOpts;
+    @AuraEnabled
+    public List<String> title;
+    @AuraEnabled
+    public String accountid;
+    @AuraEnabled
+    public String agencyProType;
+    @AuraEnabled
+    public String userWorkLocation;
+    @AuraEnabled
+    public Boolean hasHop;
+    @AuraEnabled
+    public Boolean hasSpecial;
+    @AuraEnabled
+    public List<Consumable_order__c> raesList;
+    @AuraEnabled
+    public List<CusCol> cols;
+    @AuraEnabled
+    public Boolean isNoteStay;
+  }
+
+  public class CusOption {
+    CusOption(String label, String value) {
+      this.label = label;
+      this.value = value;
     }
 
     @AuraEnabled
-    public static Results init1() {
-        Results results = new Results();
-        results.isNoteStay = LexUtility.getIsNoteStay();
-        try {
-            String userId = UserInfo.getUserId();
-            // String userId = '0050l000007CAieAAG';
-            List<user> Useracc = new List<user>();
-            Useracc = [
-                SELECT accountid, Work_Location__c, UserPro_Type__c
-                FROM user
-                WHERE id = :userId
-            ];
-            accountid = Useracc[0].accountid;
-            agencyProType = Useracc[0].UserPro_Type__c;
-            if (String.isBlank(Useracc[0].UserPro_Type__c)) {
-                agencyProType = 'ET';
-            }
-            userWorkLocation = Useracc[0].Work_Location__c;
-            coc = new Consumable_order__c();
-            // 鑾峰緱璁㈠崟涓�瑙�
-            Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
-            Schema.FieldSet fs = fsMap.get('order_view');
-            // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
-            List<FieldSetMember> fsmList = fs.getFields();
-            // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
-            title = new List<String>();
-            column = new List<String>();
-            columns = new List<List<String>>();
-            List<CusCol> cols = new List<CusCol>();
-            for (FieldSetMember fsm : fsmList) {
-                //add by Link
-                CusCol col = new CusCol();
-                col.label = fsm.getLabel();
-                col.fieldName = fsm.getFieldPath();
-                col.hideDefaultActions = true;
-                // col.sortable = true;
-                col.wrapText = true;
-                if (fsm.getFieldPath() == 'Order_ForHospital__c') {
-                    col.type = 'url';
-                    col.fieldName = 'hosUrl';
-                    TypeAttr typeAttributes1 = new TypeAttr();
-                    CusLable cusLabel = new CusLable();
-                    cusLabel.fieldName = 'hosName';
-                    typeAttributes1.label = cusLabel;
-                    typeAttributes1.target = '_blank';
-                    col.typeAttributes = typeAttributes1;
-                }
-                if (fsm.getFieldPath() == 'Name') {
-                    col.type = 'url';
-                    col.fieldName = 'nameUrl';
-                    TypeAttr typeAttributes1 = new TypeAttr();
-                    CusLable cusLabel = new CusLable();
-                    cusLabel.fieldName = 'Name';
-                    typeAttributes1.label = cusLabel;
-                    typeAttributes1.target = '_blank';
-                    col.typeAttributes = typeAttributes1;
-                }
-                cols.add(col);
-                //update by rentx 2020-12-22 start
-                if (fsm.getLabel() == '鍖婚櫌' && agencyProType != null && agencyProType == 'ET') {
-                } else {
-                    title.add(fsm.getLabel());
-                }
-                if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') {
-                } else {
-                    column.add(fsm.getFieldPath());
-                    columns.add(fsm.getFieldPath().split('\\.'));
-                }
-            }
-            provinceOpts = new List<SelectOption>();
-            provinceOpts.add(new SelectOption('', '-鏃�-'));
-            provinceOpts.add(new SelectOption('鑽夋涓�', '鑽夋涓�'));
-            provinceOpts.add(new SelectOption('宸叉彁浜�', '宸叉彁浜�'));
-            provinceOpts.add(new SelectOption('鎵瑰噯', '鎵瑰噯'));
-            provinceOpts.add(new SelectOption('椹冲洖', '椹冲洖'));
-            //閽堝lwc鐨勮嚜瀹氫箟option
-            provinceCusOpts = new List<CusOption>();
-            provinceCusOpts.add(new CusOption('-鏃�-', ''));
-            provinceCusOpts.add(new CusOption('鑽夋涓�', '鑽夋涓�'));
-            provinceCusOpts.add(new CusOption('宸叉彁浜�', '宸叉彁浜�'));
-            provinceCusOpts.add(new CusOption('鎵瑰噯', '鎵瑰噯'));
-            provinceCusOpts.add(new CusOption('椹冲洖', '椹冲洖'));
-            // 鑾峰緱鏄剧ず鏁版嵁
-            raesList = new List<Consumable_order__c>();
-            String soql = 'select Id';
-            for (String s : column) {
-                soql += ',' + s;
-            }
-            soql += ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' + '璁㈠崟' + '\'';
-            soql += ' and RecordtypeId = \'' + System.Label.RT_ConOrder_Order + '\'';
-            soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\'';
-            soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
-            soql += ' and Dealer_Info__c =\'' + accountid + '\' order by Order_status__c ';
-            System.debug('====soql====' + soql);
-            raesList = Database.query(soql);
-            //add by rentx 2021-3-10 start
-            //涓� hasHop 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
-            List<hospitalprice__c> hopList = [SELECT id, hospital__c FROM hospitalprice__c WHERE account__c = :accountid];
-            if (hopList == null || hopList.size() == 0) {
-                hasHop = false;
-            } else {
-                hasHop = true;
-            }
-            //涓� hasSpecial 璧嬪�� 鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈変績閿�鍟嗗搧
-            //鏌ヨ褰撳墠缁忛攢鍟嗕笅鐨勬湁鏁堝悎鍚�
-            List<Account> contractList = [
-                SELECT Id, Name, RecordType.DeveloperName
-                FROM Account
-                WHERE RecordType.DeveloperName = 'AgencyContract' AND Contact_Type__c LIKE :agencyProType AND Agent_Ref__c = :accountid
-            ];
-            List<Id> dealIds = new List<Id>();
-            if (contractList != null && contractList.size() > 0) {
-                for (Account acc : contractList) {
-                    dealIds.add(acc.Id);
-                }
-                List<Dealer_Product__c> deList = [SELECT id FROM Dealer_Product__c WHERE Dealer_Contact__c IN :dealIds];
-                if (deList == null || deList.size() == 0) {
-                    hasSpecial = false;
-                } else {
-                    hasSpecial = true;
-                }
-            } else {
-                hasSpecial = false;
-            }
-            results.result = 'Success';
-            results.provinceOpts = provinceCusOpts;
-            results.raesList = raesList;
-            results.agencyProType = agencyProType;
-            results.userWorkLocation = userWorkLocation;
-            results.accountid = accountid;
-            results.hasHop = hasHop;
-            results.hasSpecial = hasSpecial;
-            results.title = title;
-            results.cols = cols;
-        } catch (Exception e) {
-            results.result = 'Fail';
-            results.raesList = new List<Consumable_order__c>();
-            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
-        }
-        return results;
-    }
-
+    public String label;
     @AuraEnabled
-    public static Results searchConsumableorderdetails(
-        String categoryStr,
-        Date orderDate,
-        String orderStatus,
-        String accountidStr,
-        String agencyProTypeStr,
-        String userWorkLocationStr
-    ) {
-        Results results = new Results();
-        agencyProType = agencyProTypeStr;
-        userWorkLocation = userWorkLocationStr;
-        accountid = accountidStr;
-        if (String.isBlank(categoryStr)) {
-            category1 = null;
-        } else {
-            category1 = categoryStr;
-        }
-        coc = new Consumable_order__c();
-        if (String.isBlank(orderStatus)) {
-            coc.Order_status__c = null;
-        } else {
-            coc.Order_status__c = orderStatus;
-        }
-        coc.Order_date__c = orderDate;
-        try {
-            Date cate2 = coc.Order_date__c;
-            String cate3 = coc.Order_status__c;
-            // 鑾峰緱璁㈠崟涓�瑙�
-            Map<String, Schema.FieldSet> fsMap = Schema.getGlobalDescribe().get('Consumable_order__c').getDescribe().fieldSets.getMap();
-            Schema.FieldSet fs = fsMap.get('order_view');
-            // 鑾峰緱璁㈠崟涓殑鎵�鏈夐」鐩�
-            List<FieldSetMember> fsmList = fs.getFields();
-            // 鑾峰緱瀛楁鏍囩鍜屽瓧娈靛悕
-            title = new List<String>();
-            column = new List<String>();
-            columns = new List<List<String>>();
-            for (FieldSetMember fsm : fsmList) {
-                //update by rentx 2020-12-22 start
-                if (fsm.getLabel() == '鍖婚櫌' && agencyProType != null && agencyProType == 'ET') {
-                } else {
-                    title.add(fsm.getLabel());
-                }
-                if (fsm.getFieldPath() == 'Order_ForHospital__c' && agencyProType != null && agencyProType == 'ET') {
-                } else {
-                    column.add(fsm.getFieldPath());
-                    columns.add(fsm.getFieldPath().split('\\.'));
-                }
-            }
-            // 鑾峰緱鏄剧ず鏁版嵁
-            raesList = new List<Consumable_order__c>();
-            String soql = 'select Id';
-            for (String s : column) {
-                soql += ',' + s;
-            }
-            soql +=
-                ',Order_ForHospital__r.Name from Consumable_order__c where Order_type__c = \'' +
-                '璁㈠崟' +
-                '\' and RecordtypeId = \'' +
-                System.Label.RT_ConOrder_Order +
-                '\' and Dealer_Info__c =\'' +
-                accountid +
-                '\' ';
-            soql += ' and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
-            soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
-            if (!String.isBlank(category1)) {
-                soql += ' and Name like \'%' + String.escapeSingleQuotes(category1.replaceAll('%', '\\%')) + '%\' ';
-            }
-            if (cate2 != null) {
-                soql += ' and Order_date__c = :cate2';
-            }
-            if (cate3 != null) {
-                soql += ' and Order_status__c = :cate3 ';
-            }
-            soql += ' order by Order_status__c ';
-            system.debug('====soql:' + soql);
-            raesList = Database.query(soql);
-            system.debug('====raesList:' + raesList);
-            if (raesList.size() > 0) {
-                results.result = 'Success';
-                results.raesList = raesList;
-                results.errorMsg = '鍏辨湁' + raesList.size() + '涓鍗�';
-            } else {
-                results.result = 'Fail';
-                results.raesList = new List<Consumable_order__c>();
-                results.errorMsg = '娌℃湁鎼滅储鍒扮浉鍏宠鍗�';
-            }
-        } catch (Exception e) {
-            results.result = 'Fail';
-            results.raesList = new List<Consumable_order__c>();
-            results.errorMsg = e.getLineNumber() + '---' + e.getMessage();
-        }
-        return results;
-    }
+    public String value;
+  }
 
-    public class Results {
-        @AuraEnabled
-        public String result;
-        @AuraEnabled
-        public String errorMsg;
-        @AuraEnabled
-        public List<CusOption> provinceOpts;
-        @AuraEnabled
-        public List<String> title;
-        @AuraEnabled
-        public String accountid;
-        @AuraEnabled
-        public String agencyProType;
-        @AuraEnabled
-        public String userWorkLocation;
-        @AuraEnabled
-        public Boolean hasHop;
-        @AuraEnabled
-        public Boolean hasSpecial;
-        @AuraEnabled
-        public List<Consumable_order__c> raesList;
-        @AuraEnabled
-        public List<CusCol> cols;
-        @AuraEnabled
-        public Boolean isNoteStay;
-    }
+  public class CusCol {
+    @AuraEnabled
+    public String label;
+    @AuraEnabled
+    public String fieldName;
+    @AuraEnabled
+    public String type;
+    @AuraEnabled
+    public Boolean sortable;
+    @AuraEnabled
+    public Boolean wrapText;
+    @AuraEnabled
+    public Boolean hideDefaultActions;
+    @AuraEnabled
+    public TypeAttr typeAttributes;
+  }
 
-    public class CusOption {
-        CusOption(String label, String value) {
-            this.label = label;
-            this.value = value;
-        }
+  public class TypeAttr {
+    @AuraEnabled
+    public CusLable label;
+    @AuraEnabled
+    public String target;
+  }
 
-        @AuraEnabled
-        public String label;
-        @AuraEnabled
-        public String value;
-    }
-
-    public class CusCol {
-        @AuraEnabled
-        public String label;
-        @AuraEnabled
-        public String fieldName;
-        @AuraEnabled
-        public String type;
-        @AuraEnabled
-        public Boolean sortable;
-        @AuraEnabled
-        public Boolean wrapText;
-        @AuraEnabled
-        public Boolean hideDefaultActions;
-        @AuraEnabled
-        public TypeAttr typeAttributes;
-    }
-
-    public class TypeAttr {
-        @AuraEnabled
-        public CusLable label;
-        @AuraEnabled
-        public String target;
-    }
-
-    public class CusLable {
-        @AuraEnabled
-        public String fieldName;
-    }
-}
\ No newline at end of file
+  public class CusLable {
+    @AuraEnabled
+    public String fieldName;
+  }
+}
diff --git a/force-app/main/default/classes/LexSaleOrderController.cls b/force-app/main/default/classes/LexSaleOrderController.cls
index df18586..11d88ab 100644
--- a/force-app/main/default/classes/LexSaleOrderController.cls
+++ b/force-app/main/default/classes/LexSaleOrderController.cls
@@ -784,7 +784,6 @@
             Matcher n = Pattern.compile('[0-9]')
               .matcher(newdet2[j].TracingCode__c);
             if (n.find()) {
-              // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start
               if (newdet2[j].TracingCode__c.length() == 5) {
                 String tr = newdet2[j].TracingCode__c;
                 String Ctr = tr.substring(tr.length() - 3, tr.length());
diff --git a/force-app/main/default/classes/LexSummonsCreatControllerTest.cls b/force-app/main/default/classes/LexSummonsCreatControllerTest.cls
index e46778e..63245bf 100644
--- a/force-app/main/default/classes/LexSummonsCreatControllerTest.cls
+++ b/force-app/main/default/classes/LexSummonsCreatControllerTest.cls
@@ -2,61 +2,987 @@
 private class LexSummonsCreatControllerTest {
   @isTest
   static void testInit() {
-    System.Test.startTest();
     Account accountItem1;
     Account accountItem2;
     User userTest;
-    User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
-    System.runAs(thisUser) {
-      List<RecordType> rectCo = [
-        SELECT Id
-        FROM RecordType
-        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
-      ];
-      if (rectCo.size() == 0) {
-        return;
-      }
-      List<RecordType> rectHp = [
-        SELECT Id
-        FROM RecordType
-        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
-      ];
-      if (rectHp.size() == 0) {
-        return;
-      }
-      List<RecordType> rectHos = [
-        SELECT Id
-        FROM RecordType
-        WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
-      ];
-      if (rectHos.size() == 0) {
-        return;
-      }
+    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('Agency')
+      .getRecordTypeId();
+    String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('HP')
+      .getRecordTypeId();
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    accountItem1 = new Account(
+      Name = 'Testaccount001',
+      RecordTypeId = rectCo,
+      AgentCode_Ext__c = '9999900'
+    );
+    insert accountItem1;
+    accountItem2 = new Account(
+      Name = 'Testaccount002',
+      RecordTypeId = rectHp,
+      AgentCode_Ext__c = '9999999',
+      ParentId = accountItem1.Id,
+      Contract_Decide_Start_Date__c = Date.today(),
+      ENG_Dealer__c = true,
+      BillingCity = null
+    );
+    insert accountItem2;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountId = accountItem1.Id
+    );
+    insert core;
 
-      Profile prof = [
-        SELECT Id
-        FROM Profile
-        WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    Agency_Hospital_Link__c ahl = new Agency_Hospital_Link__c();
+    ahl.Name = 'test1缁忛攢鍟嗗尰闄�';
+    ahl.Hospital__c = accountItem2.Id;
+    ahl.Agency__c = accountItem1.Id;
+    insert new List<Agency_Hospital_Link__c>{ ahl };
+
+    System.runAs(new user(ID = UserInfo.getUserID())) {
+      userTest = new User(
+        ContactId = core.id,
+        Alias = 'newUser',
+        Email = 'newuser@testorg.com',
+        EmailEncodingKey = 'UTF-8',
+        LastName = 'TestUser',
+        LanguageLocaleKey = 'zh_CN',
+        LocaleSidKey = 'zh_CN',
+        ProfileId = prof.Id,
+        TimeZoneSidKey = 'Asia/Shanghai',
+        UserName = 'testUser@testorg.com',
+        UserPro_Type__c = 'ENG',
+        Work_Location__c = '鍖椾含'
+      );
+      insert userTest;
+    }
+    //鍙戣揣
+    Consumable_order__c consOrder = new Consumable_order__c();
+    consOrder.Name = 'test01';
+    consOrder.Order_status__c = '鎵瑰噯';
+    consOrder.Deliver_date__c = Date.today();
+    consOrder.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+    consOrder.Order_type__c = '璁㈠崟';
+    consOrder.Order_ProType__c = 'ENG';
+    consOrder.Dealer_Info__c = accountItem1.Id;
+    consOrder.Delivery_detail_count__c = 5;
+    insert consOrder;
+
+    // create ContentVersions
+    list<ContentVersion> cvList = new List<ContentVersion>();
+    cvList.add(
+      new ContentVersion(
+        Title = 'test1',
+        PathOnClient = '/' + 'Test1.txt',
+        VersionData = Blob.valueOf('test data 1'),
+        IsMajorVersion = true
+      )
+    );
+    cvList.add(
+      new ContentVersion(
+        Title = 'test2',
+        PathOnClient = '/' + 'Test2.txt',
+        VersionData = Blob.valueOf('test data 2'),
+        IsMajorVersion = true
+      )
+    );
+    cvList.add(
+      new ContentVersion(
+        Title = 'test3',
+        PathOnClient = '/' + 'Test3.txt',
+        VersionData = Blob.valueOf('test data 3'),
+        IsMajorVersion = true
+      )
+    );
+    insert cvList;
+    // retrieve Ids for ContentDocuments created on insert of ContentVersions
+    list<Id> cdIdList = new List<Id>();
+    for (ContentDocument cd : [
+      SELECT Id, LatestPublishedVersionId
+      FROM ContentDocument
+      WHERE
+        LatestPublishedVersionId = :cvList[0].Id
+        OR LatestPublishedVersionId = :cvList[1].Id
+        OR LatestPublishedVersionId = :cvList[2].Id
+      ORDER BY Title
+    ]) {
+      cdIdList.add(cd.Id);
+    }
+    system.assertEquals(3, cdIdList.size());
+    list<ContentDocumentLink> cdlList = new List<ContentDocumentLink>();
+    cdlList.add(
+      new ContentDocumentLink(
+        ContentDocumentId = cdIdList[0],
+        LinkedEntityId = consOrder.Id,
+        ShareType = 'V'
+      )
+    );
+    insert cdlList;
+    LexSummonsCreatController.saveFile(
+      consOrder.Id,
+      'A-65224941-20200923--1.docx',
+      'Unit Test Attachment Body'
+    );
+    LexSummonsCreatController.getFiles(consOrder.Id);
+    LexSummonsCreatController.deleteAtt(cvList[0].Id);
+    System.runAs(userTest) {
+      String userId = UserInfo.getUserId();
+      User thisUserInfo = [
+        SELECT
+          accountid,
+          UserPro_Type__c,
+          ContactId,
+          Contact.AccountId,
+          Contact.Account.Name,
+          Work_Location__c
+        FROM User
+        WHERE id = :userId
       ];
-      accountItem1 = new Account(
-        Name = 'Testaccount001',
-        RecordTypeId = rectCo[0].Id,
-        AgentCode_Ext__c = '9999900'
+      String accountId = thisUserInfo.accountid;
+      String accountName = thisUserInfo.Contact.Account.Name;
+      String agencyProType = thisUserInfo.UserPro_Type__c;
+      String userWorkLocation = thisUserInfo.Work_Location__c;
+      thisUserInfo.UserPro_Type__c = '';
+      update thisUserInfo;
+      if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+        agencyProType = 'ET';
+      }
+      Product2 prod07 = new Product2(
+        Name = 'Test07',
+        ProductCode = 'Test07',
+        Asset_Model_No__c = 'Test07',
+        Category3__c = 'CDS',
+        Category4__c = 'OER',
+        Category5__c = 'Celon',
+        SFDA_Status__c = '鏈夊姽',
+        Product_Status__c = '姝e父閿�鍞�',
+        SFDA_Approbated_Status__c = '鏈夋晥',
+        Dealer_special_Object__c = true,
+        SFDA_Approbation_No__c = 'Test002',
+        Packing_list_manual__c = 1,
+        SFDA_Expiration_Date__c = Date.today(),
+        Manual_Entry__c = false
       );
-      insert accountItem1;
-      accountItem2 = new Account(
-        Name = 'Testaccount002',
-        RecordTypeId = rectHp[0].Id,
-        AgentCode_Ext__c = '9999999'
+      insert new List<Product2>{ prod07 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'MH-155:鐧藉钩琛″附',
+        OT_CODE_Text__c = 'Test001',
+        Product2__c = prod07.Id,
+        Category3_text__c = 'test123',
+        Category4_text__c = 'test123',
+        Category5_text__c = 'test123'
       );
-      insert accountItem2;
-      Contact core = new Contact(
-        email = 'jplumber@salesforce.com',
-        firstname = 'Joe',
-        lastname = 'Plumber',
-        accountId = accountItem1.Id
+      insert new List<Product2__c>{ pro1 };
+      //鍙戣揣
+      Consumable_order__c createIdSend = new Consumable_order__c();
+      createIdSend.Name = 'testMing1';
+      createIdSend.Order_status__c = '鎵瑰噯';
+      createIdSend.Deliver_date__c = Date.today();
+      createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend.Order_type__c = '璁㈠崟';
+      createIdSend.Order_ProType__c = 'ENG';
+      createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
+      createIdSend.Order_ForDealerText__c = 'Testaccount003';
+      createIdSend.Order_ForCustomerText__c = 'Test000';
+      createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend.Dealer_Info__c = accountItem1.Id;
+      createIdSend.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend1 = new Consumable_order__c();
+      createIdSend1.Name = 'testMing2';
+      createIdSend1.Order_status__c = '鎵瑰噯';
+      createIdSend1.Deliver_date__c = Date.today();
+      createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend1.Order_type__c = '璁㈠崟';
+      createIdSend1.Order_ProType__c = 'ENG';
+      createIdSend1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+      createIdSend1.Order_ForCustomerText__c = '';
+      createIdSend1.Order_ForDealerText__c = 'Testaccount003';
+      createIdSend1.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend1.Dealer_Info__c = accountItem1.Id;
+      createIdSend1.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend2 = new Consumable_order__c();
+      createIdSend2.Name = 'testMing2';
+      createIdSend2.Order_status__c = '鎵瑰噯';
+      createIdSend2.Deliver_date__c = Date.today();
+      createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend2.Order_type__c = '璁㈠崟';
+      createIdSend2.Order_ProType__c = 'ENG';
+      createIdSend2.SummonsForDirction__c = '';
+      createIdSend2.Order_ForCustomerText__c = '';
+      createIdSend2.Order_ForDealerText__c = 'Testaccount003';
+      createIdSend2.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend2.Dealer_Info__c = accountItem1.Id;
+      createIdSend2.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend3 = new Consumable_order__c();
+      createIdSend3.Name = 'testMing123456';
+      createIdSend3.Order_status__c = '鎵瑰噯';
+      createIdSend3.Deliver_date__c = Date.today();
+      createIdSend3.Arrive_Order__c = createIdSend.Id;
+      createIdSend3.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend3.Order_type__c = '璁㈠崟';
+      createIdSend3.Order_ProType__c = 'ENG';
+      createIdSend3.SummonsForDirction__c = '浜掔浉璋冭揣';
+      createIdSend3.Order_ForDealerText__c = '';
+      createIdSend3.Order_ForCustomerText__c = 'Test001';
+      createIdSend3.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend3.Dealer_Info__c = accountItem1.Id;
+      createIdSend3.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend4 = new Consumable_order__c();
+      createIdSend4.Name = 'testMing1';
+      createIdSend4.Order_status__c = '鎵瑰噯';
+      createIdSend4.Deliver_date__c = Date.today();
+      createIdSend4.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend4.Order_type__c = '璁㈠崟';
+      createIdSend4.Order_ProType__c = 'ENG';
+      createIdSend4.SummonsForDirction__c = '鍖婚櫌璇曠敤';
+      createIdSend4.Order_ForDealerText__c = '';
+      createIdSend4.Order_ForCustomerText__c = 'Test000';
+      createIdSend4.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend4.Dealer_Info__c = accountItem1.Id;
+      createIdSend4.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend5 = new Consumable_order__c();
+      createIdSend5.Name = 'testMing1111111';
+      createIdSend5.Order_status__c = '鎵瑰噯';
+      createIdSend5.Deliver_date__c = Date.today();
+      createIdSend5.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend5.Order_type__c = '璁㈠崟';
+      createIdSend5.Order_ProType__c = 'ENG';
+      createIdSend5.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+      createIdSend5.Order_ForDealerText__c = '';
+      createIdSend5.Order_ForCustomerText__c = '';
+      createIdSend5.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend5.Dealer_Info__c = accountItem1.Id;
+      createIdSend5.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend6 = new Consumable_order__c();
+      createIdSend6.Name = 'testMing222222';
+      createIdSend6.Order_status__c = '鎵瑰噯';
+      createIdSend6.Deliver_date__c = Date.today();
+      createIdSend6.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend6.Order_type__c = '璁㈠崟';
+      createIdSend6.Order_ProType__c = 'ENG';
+      createIdSend6.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+      createIdSend6.Order_ForDealerText__c = '';
+      createIdSend6.Order_ForCustomerText__c = '';
+      createIdSend6.SummonsStatus_c__c = '';
+      createIdSend6.Dealer_Info__c = accountItem1.Id;
+      createIdSend6.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend7 = new Consumable_order__c();
+      createIdSend7.Name = 'testMing222222';
+      createIdSend7.Order_status__c = '鎵瑰噯';
+      createIdSend7.Deliver_date__c = Date.today();
+      createIdSend7.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend7.Order_type__c = '璁㈠崟';
+      createIdSend7.Order_ProType__c = 'ENG';
+      createIdSend7.SummonsForDirction__c = '浜掔浉璋冭揣';
+      createIdSend7.Order_ForDealerText__c = '';
+      createIdSend7.Order_ForCustomerText__c = '';
+      createIdSend7.SummonsStatus_c__c = '';
+      createIdSend7.Dealer_Info__c = accountItem1.Id;
+      createIdSend7.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend8 = new Consumable_order__c();
+      createIdSend8.Name = 'testMing222222';
+      createIdSend8.Order_status__c = '鎵瑰噯';
+      createIdSend8.Deliver_date__c = Date.today();
+      createIdSend8.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend8.Order_type__c = '璁㈠崟';
+      createIdSend8.Order_ProType__c = 'ENG';
+      createIdSend8.SummonsForDirction__c = '娴嬭瘯001';
+      createIdSend8.Order_ForDealerText__c = '';
+      createIdSend8.Order_ForCustomerText__c = '';
+      createIdSend8.SummonsStatus_c__c = '';
+      createIdSend8.Dealer_Info__c = accountItem1.Id;
+      createIdSend8.Delivery_detail_count__c = 5;
+
+      //鍙戠エ淇℃伅
+      Consumable_order__c createIdSend9 = new Consumable_order__c();
+      createIdSend9.Name = 'invoice01';
+      createIdSend9.Invoice_status__c = '宸插畬鎴�';
+      createIdSend9.Order_type__c = '鍙戠エ';
+      createIdSend9.RecordTypeid = System.Label.RT_ConOrder_Invoice;
+      createIdSend9.Order_status__c = '鑽夋涓�';
+      createIdSend9.Invoice_Date__c = Date.Today();
+      createIdSend9.Order_ProType__c = 'ENG';
+      createIdSend9.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+
+      Consumable_order__c createIdSend10 = new Consumable_order__c();
+      createIdSend10.Name = 'OCMtest';
+      createIdSend10.Order_status__c = '鎵瑰噯';
+      createIdSend10.Order_type__c = '鍒拌揣';
+      createIdSend10.Dealer_Info__c = accountItem1.Id;
+      createIdSend10.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+      createIdSend10.Order_ProType__c = 'ET';
+
+      Consumable_order__c createIdSend11 = new Consumable_order__c();
+      createIdSend11.Name = 'OCM_01_002';
+      createIdSend11.Order_status__c = '鎵瑰噯';
+      createIdSend11.Order_type__c = '浼犵エ';
+      createIdSend11.Arrive_Order__c = createIdSend9.Id;
+      createIdSend11.Dealer_Info__c = accountItem1.Id;
+      createIdSend11.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+      createIdSend11.RecordTypeid = System.Label.RT_ConOrder_Order;
+      createIdSend11.Order_ProType__c = 'ET';
+
+      Consumable_order__c testList1 = new Consumable_order__c();
+      testList1.Name = 'Test1';
+      testList1.Summons_Sale_Status__c = '鍑鸿揣';
+      testList1.SummonsStatus_c__c = '宸插畬鎴�';
+      testList1.Arrive_Order__c = createIdSend9.Id;
+      testList1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+      testList1.Order_status__c = '鑽夋涓�';
+      testList1.Order_type__c = '浼犵エ';
+      testList1.Dealer_info__c = accountItem1.Id;
+      testList1.ConInvoice_Code__c = createIdSend9.id;
+
+      //鍒拌揣
+      Consumable_order__c createIdArrived = new Consumable_order__c();
+      createIdArrived.Name = 'testMing2';
+      createIdArrived.Order_status__c = '鎵瑰噯';
+      createIdArrived.Deliver_date__c = Date.today();
+      createIdArrived.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+      createIdArrived.Order_type__c = '璁㈠崟';
+      createIdArrived.Order_ProType__c = 'ET';
+      createIdArrived.orderPattern__c = 'promotionorder';
+      createIdArrived.Dealer_Info__c = accountItem1.Id;
+      createIdArrived.Delivery_detail_count__c = 5;
+      insert new List<Consumable_order__c>{
+        createIdSend,
+        createIdSend1,
+        createIdSend2,
+        createIdSend3,
+        createIdSend4,
+        createIdSend5,
+        createIdSend6,
+        createIdSend7,
+        createIdSend8,
+        createIdSend9,
+        createIdSend10,
+        createIdSend11,
+        createIdArrived,
+        testList1
+      };
+
+      System.debug('createIdSend9.id = ' + createIdSend9.id);
+
+      Consumable_order_LinkTable__c order_LinkTable1 = new Consumable_order_LinkTable__c(
+        Name = 'order_LinkTable1',
+        Outboundorder_Code_link__c = testList1.Id,
+        Invoice_Code_link__c = createIdSend9.Id
       );
-      insert core;
+      insert new List<Consumable_order_LinkTable__c>{ order_LinkTable1 };
+
+      Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+      coc.Name = 'Too001';
+      coc.Dealer_Custom_Price__c = 999.00;
+      coc.Consumable_count__c = 3;
+      coc.Consumable_product__c = pro1.Id;
+      coc.Box_Piece__c = '鐩�';
+      coc.isOutPattern__c = true;
+      coc.Consumable_order__c = createIdSend.Id;
+      coc.Unitprice_To_agency__c = 999.00;
+      coc.Delivery_List_RMB__c = 999.00;
+      coc.Shipment_Count__c = null;
+      coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+      Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+      coc1.Name = 'Too001';
+      coc1.Dealer_Custom_Price__c = 999.00;
+      coc1.Consumable_count__c = 3;
+      coc1.Consumable_product__c = pro1.Id;
+      coc1.Box_Piece__c = '鐩�';
+      coc1.isOutPattern__c = true;
+      coc1.Consumable_order__c = createIdSend3.Id;
+      coc1.Unitprice_To_agency__c = 999.00;
+      coc1.Delivery_List_RMB__c = 999.00;
+      coc1.Shipment_Count__c = 9999.00;
+      coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+      Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+      coc2.Name = 'Too001';
+      coc2.Dealer_Custom_Price__c = 999.00;
+      coc2.Consumable_count__c = 3;
+      coc2.Consumable_product__c = pro1.Id;
+      coc2.Box_Piece__c = '鐩�';
+      coc2.isOutPattern__c = true;
+      coc2.Consumable_order__c = createIdSend3.Id;
+      coc2.Unitprice_To_agency__c = 999.00;
+      coc2.Delivery_List_RMB__c = -999.00;
+      coc2.Shipment_Count__c = 9999.00;
+      coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      insert new List<Consumable_orderdetails__c>{ coc, coc1, coc2 };
+
+      Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+      conOrderDetail1.Name = 'OCM_01_001001';
+      conOrderDetail1.Consumable_ZS_order__c = createIdArrived.Id;
+      conOrderDetail1.Consumable_Product__c = pro1.Id;
+      conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      conOrderDetail1.Bar_Code__c = '11111';
+      conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+      conOrderDetail1.Send_Date__c = null;
+      conOrderDetail1.Used_date__c = null;
+      conOrderDetail1.Return_date__c = null;
+      conOrderDetail1.Consumable_order_minor__c = createIdArrived.Id;
+      conOrderDetail1.Lose_Flag__c = false;
+      conOrderDetail1.exchangeOutPattern__c = false;
+      conOrderDetail1.Cancellation_Flag__c = false;
+      conOrderDetail1.Box_Piece__c = '鐩�';
+      conOrderDetail1.Sterilization_limit__c = Date.Today();
+      insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
+
+      hospitalprice__c hp1 = new hospitalprice__c();
+      hp1.hospital__c = accountId;
+      hp1.account__c = accountId;
+      hp1.product__c = pro1.Id;
+      insert new List<hospitalprice__c>{ hp1 };
+
+      Dealer_elationship__c dealerelationship = new Dealer_elationship__c(
+        Dealer_principal__c = accountItem1.id,
+        Dealer_subordinate__c = accountItem1.id
+      );
+      Dealer_elationship__c dealerelationship1 = new Dealer_elationship__c(
+        Dealer_principal__c = accountItem1.id,
+        Dealer_subordinate__c = accountItem1.id
+      );
+      insert new List<Dealer_elationship__c>{
+        dealerelationship,
+        dealerelationship1
+      };
+
+      LexSummonsCreatController.ConsumableorderdetailsInfo c0 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      c0.packinglist = 0;
+      c0.approbation_No = null;
+      c0.expiration_Date = Date.Today();
+      c0.boxorpiecein = null;
+      c0.hospitalSpecialOffer = true;
+      LexSummonsCreatController.ConsumableorderdetailsInfo c1 = new LexSummonsCreatController.ConsumableorderdetailsInfo(
+        coc
+      );
+      c1.check = true;
+      c1.oldCheck = true;
+      c1.orderdetails1 = coc;
+      c1.orderdetails2 = null;
+      c1.Prod = coc.Consumable_Product__r;
+      c1.oldConsumableCount = coc.Shipment_Count__c;
+      c1.canSelect = true;
+      c1.allnumber = 0.00;
+      c1.Boxnumber = 0.00;
+      c1.Piecenumber = 0.00;
+      c1.BoxPiece = coc.Box_Piece__c;
+      c1.hospitalSpecialOffer = true;
+      c1.hosPro = false;
+      List<SelectOption> boxorpiece = new List<SelectOption>();
+      boxorpiece.add(new SelectOption('鐩�', '鐩�'));
+      boxorpiece.add(new SelectOption('涓�', '涓�'));
+      Map<String, String> boxorpieceMap = new Map<String, String>();
+      boxorpieceMap.put('鐩�', '鐩�');
+      boxorpieceMap.put('涓�', '涓�');
+      LexSummonsCreatController.ConsumableorderdetailsInfo coder = new LexSummonsCreatController.ConsumableorderdetailsInfo(
+        conOrderDetail1
+      );
+      coder.check = true;
+      coder.oldCheck = true;
+      coder.hospitalSpecialOffer = true;
+      coder.orderdetails1 = null;
+      coder.orderdetails2 = conOrderDetail1;
+      coder.Prod = conOrderDetail1.Consumable_Product__r;
+      coder.canSelect = true;
+      coder.allnumber = 0;
+      coder.Boxnumber = 0;
+      coder.Piecenumber = 0;
+      coder.hosPro = false;
+      LexSummonsCreatController.ConsumableorderdetailsInfo c2 = new LexSummonsCreatController.ConsumableorderdetailsInfo(
+        pro1
+      );
+      c2.sortBy = true;
+      c2.Boxnumber = 20;
+      c1.compareTo(c2);
+      c1.Boxnumber = 20;
+      c2.Boxnumber = 10;
+      c1.compareTo(c2);
+      c1.Boxnumber = 10;
+      c2.Boxnumber = 20;
+      c2.compareTo(c1);
+      c1.Boxnumber = 20;
+      c2.Boxnumber = 10;
+      c2.compareTo(c1);
+      LexSummonsCreatController.ConsumableorderdetailsInfo c3 = new LexSummonsCreatController.ConsumableorderdetailsInfo(
+        pro1
+      );
+      c3.sortBy = false;
+      c3.Boxnumber = 10;
+      c1.compareTo(c3);
+      c1.Boxnumber = 20;
+      c3.Boxnumber = 10;
+      c1.compareTo(c3);
+      c3.Boxnumber = 10;
+      c1.Boxnumber = 20;
+      c3.compareTo(c1);
+      c3.Boxnumber = 20;
+      c3.Boxnumber = 10;
+      c1.compareTo(c1);
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c4 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c4.check = true;
+      c4.oldCheck = true;
+      c4.orderdetails1 = null;
+      c4.orderdetails2 = null;
+      c4.Prod = null;
+      c4.Boxnumber = 0.00;
+      c4.Piecenumber = 0.00;
+      c4.allnumber = 0.00;
+      c4.oldConsumableCount = 0.00;
+      c4.canSelect = true;
+      c4.sortBy = true;
+      c4.packinglist = 1;
+      c4.approbation_No = null;
+      c4.expiration_Date = Date.Today();
+      c4.boxorpiecein = null;
+      c4.boxorpiece = null;
+      c4.boxorpieceMap = null;
+      c4.concc = null;
+      c4.BoxPiece = null;
+      c4.hospitalSpecialOffer = true;
+      c4.hosPro = true;
+      c4.unitOptions = null;
+      c4.unitValue = null;
+      c4.shipmentNumber = 1;
+      c4.shippingUnitPrice = 0.00;
+      c4.recordId = null;
+      c4.Id = null;
+      c4.Name = null;
+      c4.Category3 = null;
+      c4.Category4 = null;
+      c4.Category5 = null;
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c5 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c5.check = true;
+      c5.orderdetails1 = coc;
+      c5.hospitalSpecialOffer = true;
+      c5.allnumber = 1999.00;
+      pageRecordsLwcLwc.add(c5);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c6.check = true;
+      c6.oldCheck = true;
+      c6.hospitalSpecialOffer = true;
+      c6.orderdetails1 = coc1;
+      c6.orderdetails2 = conOrderDetail1;
+      c6.Prod = pro1;
+      c6.Boxnumber = 0.00;
+      c6.Piecenumber = 0.00;
+      c6.allnumber = 1999.00;
+      c6.oldConsumableCount = 1999.00;
+      c6.canSelect = true;
+      c6.sortBy = true;
+      c6.packinglist = 1;
+      c6.approbation_No = '';
+      c6.expiration_Date = Date.Today();
+      c6.boxorpiecein = '';
+      c6.boxorpiece = null;
+      c6.boxorpieceMap = null;
+      c6.concc = null;
+      c6.BoxPiece = null;
+      c6.hosPro = true;
+      pageRecords.add(c6);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c7.check = true;
+      c7.oldCheck = true;
+      c7.hospitalSpecialOffer = true;
+      c7.orderdetails1 = coc2;
+      c7.orderdetails2 = conOrderDetail1;
+      c7.Prod = pro1;
+      c7.Boxnumber = 0.00;
+      c7.Piecenumber = 0.00;
+      c7.allnumber = 1999.00;
+      c7.oldConsumableCount = 1999.00;
+      c7.canSelect = true;
+      c7.sortBy = true;
+      c7.packinglist = 1;
+      c7.approbation_No = '';
+      c7.expiration_Date = Date.Today();
+      c7.boxorpiecein = '';
+      c7.boxorpiece = null;
+      c7.boxorpieceMap = null;
+      c7.concc = null;
+      c7.BoxPiece = null;
+      c7.hosPro = true;
+      pageRecordsLwc.add(c7);
+
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi.check = true;
+      codi.hospitalSpecialOffer = true;
+      codi.packinglist = 0;
+      codi.approbation_No = null;
+      codi.expiration_Date = Date.Today();
+      codi.boxorpiecein = null;
+      codi.orderdetails1 = coc;
+      codi.Prod = pro1;
+      consumable.add(codi);
+      List<SelectOption> categoryOptionList = new List<SelectOption>();
+      System.Test.startTest();
+      Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
+      String ESetId = null;
+      String statusEdit = null;
+      String arrive = null;
+      String alertMessage = null;
+
+      String category1 = '3400PK:PK閽� 5mm脳33cm';
+      String Category3 = '鑵硅厰闀滄墜鏈�';
+      String Category4 = 'PK';
+      String Category5 = 'G400';
+      LexSummonsCreatController.category1 = category1;
+      LexSummonsCreatController.Category3 = Category3;
+      LexSummonsCreatController.Category4 = Category4;
+      LexSummonsCreatController.Category5 = Category5;
+      LexSummonsCreatController.statusEdit = statusEdit;
+      LexSummonsCreatController.alertMessage = alertMessage;
+      LexSummonsCreatController.zaikuId = new List<String>();
+      LexSummonsCreatController.categoryOptionMap = new Map<String, String>();
+      LexSummonsCreatController.category4OptionMap = new Map<String, String>();
+      LexSummonsCreatController.category5OptionMap = new Map<String, String>();
+      LexSummonsCreatController.orderpieceorboxMap = new Map<String, String>();
+      LexSummonsCreatController.orderagencypriceMap = new Map<String, Decimal>();
+      LexSummonsCreatController.orderpriceMap = new Map<String, Decimal>();
+      LexSummonsCreatController.orderdetCountMap = new Map<String, Decimal>();
+      LexSummonsCreatController.hasSpecialHos = false;
+      LexSummonsCreatController.outOutPattern = null;
+      LexSummonsCreatController.provinceOptsMap = new Map<String, String>();
+      LexSummonsCreatController.categoryOptionList = new List<SelectOption>();
+      LexSummonsCreatController.category4OptionList = new List<SelectOption>();
+      LexSummonsCreatController.category5OptionList = new List<SelectOption>();
+      LexSummonsCreatController.outOutPatternOptionList = new List<SelectOption>();
+      LexSummonsCreatController.orderdetails = new List<Consumable_orderdetails__c>();
+      LexSummonsCreatController.consumableorderdetailsRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.consumableorderdetailsRecordserror = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      List<SelectOption> cityOpts1 = new List<SelectOption>();
+      cityOpts1.add(new SelectOption('', '--鏃�--'));
+      cityOpts1.add(new SelectOption('ishos', '鍖婚櫌鐗逛环浜у搧'));
+      cityOpts1.add(new SelectOption('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�'));
+      Map<String, String> optionMap = new Map<String, String>();
+      optionMap.put('', '-鏃�-');
+      optionMap.put('ishos', '鍖婚櫌鐗逛环浜у搧');
+      optionMap.put('nothos', '闈炲尰闄㈢壒浠蜂骇鍝�');
+
+      Integer count = LexSummonsCreatController.consumableorderdetailsCount;
+      Consumable_order__c cocOrderId = new Consumable_order__c();
+      LexSummonsCreatController.coc = cocOrderId;
+      String consumableorderId = LexSummonsCreatController.consumableorderId;
+      LexSummonsCreatController summonCC = new LexSummonsCreatController();
+
+      LexSummonsCreatController.init(
+        testList1.Id,
+        'Test',
+        1,
+        100,
+        testList1.Id
+      );
+      LexSummonsCreatController.firstInit(ESetId);
+      LexSummonsCreatController.init(ESetId, statusEdit, 1, 100, arrive);
+      LexSummonsCreatController.init(
+        ESetId,
+        statusEdit,
+        1,
+        100,
+        createIdSend.Id
+      );
+      LexSummonsCreatController.init(
+        createIdSend.Id,
+        statusEdit,
+        1,
+        100,
+        arrive
+      );
+      LexSummonsCreatController.init(
+        createIdSend.Id,
+        'Test',
+        1,
+        100,
+        createIdSend3.Id
+      );
+      LexSummonsCreatController.init(ESetId, 'Test', 1, 100, createIdSend.Id);
+      LexSummonsCreatController.searchConsumableorderdetails(
+        'ENG',
+        'Testaccount001',
+        '鍖椾含',
+        'ishos',
+        'Test07',
+        'CDS',
+        'OER',
+        'Celon',
+        true,
+        pageRecords,
+        consumable,
+        '',
+        1,
+        100
+      );
+      LexSummonsCreatController.searchConsumableorderdetails(
+        'ENG',
+        'Testaccount001',
+        '鍖椾含',
+        'nothos',
+        'Test07',
+        'CDS',
+        'OER',
+        'Celon',
+        true,
+        pageRecords,
+        consumable,
+        '',
+        1,
+        100
+      );
+      LexSummonsCreatController.save(
+        createIdSend2,
+        '',
+        '',
+        '',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend2.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend1,
+        '',
+        '',
+        'Test',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend1.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend1,
+        'Test',
+        'Test',
+        'Test',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend1.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend7,
+        '',
+        '',
+        accountItem1.Id,
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend7.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        'Test',
+        'Test',
+        'Test',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend3,
+        'Test',
+        'Test',
+        '',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend3.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend3,
+        '',
+        '',
+        'Test',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend3.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend3,
+        'Test',
+        'Test',
+        'Test',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend3.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend4,
+        '',
+        '',
+        '',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend4.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend5,
+        '',
+        '',
+        '',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend5.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend5,
+        '',
+        '',
+        'Test',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend5.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend5,
+        'Test',
+        'Test',
+        'Test',
+        pageRecordsLwcLwc,
+        accountId,
+        createIdSend5.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend8,
+        accountId,
+        'Test',
+        accountId,
+        pageRecords,
+        accountId,
+        createIdSend8.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend8,
+        accountId,
+        'Test',
+        null,
+        pageRecordsLwc,
+        accountId,
+        createIdSend8.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.checkOutPattern();
+      LexSummonsCreatController.PraseToPDF(createIdSend, createIdSend.Id);
+      LexSummonsCreatController.search('Testaccount001');
+      LexSummonsCreatController.GoodsDelivery(
+        createIdSend,
+        createIdSend.Id,
+        pageRecordsLwcLwc
+      );
+      LexSummonsCreatController.GoodsDelivery(
+        createIdSend3,
+        createIdSend3.Id,
+        pageRecords
+      );
+      LexSummonsCreatController.GoodsDelivery(
+        createIdSend1,
+        createIdSend1.Id,
+        pageRecordsLwcLwc
+      );
+      LexSummonsCreatController.GoodsDelivery(
+        createIdSend6,
+        createIdSend6.Id,
+        pageRecordsLwcLwc
+      );
+      LexSummonsCreatController.DelConsumable(createIdSend.Id);
+      System.Test.stopTest();
+    }
+  }
+
+  @isTest
+  static void testSaveMethod() {
+    Account accountItem1;
+    Account accountItem2;
+    User userTest;
+    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('Agency')
+      .getRecordTypeId();
+    String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('HP')
+      .getRecordTypeId();
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    accountItem1 = new Account(
+      Name = 'Testaccount001',
+      RecordTypeId = rectCo,
+      AgentCode_Ext__c = '9999900'
+    );
+    insert accountItem1;
+    accountItem2 = new Account(
+      Name = 'Testaccount002',
+      RecordTypeId = rectHp,
+      AgentCode_Ext__c = '9999999',
+      ParentId = accountItem1.Id,
+      Contract_Decide_Start_Date__c = Date.today(),
+      ENG_Dealer__c = true,
+      BillingCity = null
+    );
+    insert accountItem2;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountId = accountItem1.Id
+    );
+    insert core;
+    System.runAs(new user(ID = UserInfo.getUserID())) {
       userTest = new User(
         ContactId = core.id,
         Alias = 'newUser',
@@ -81,27 +1007,19 @@
           UserPro_Type__c,
           ContactId,
           Contact.AccountId,
+          Contact.Account.Name,
           Work_Location__c
         FROM User
         WHERE id = :userId
       ];
       String accountId = thisUserInfo.accountid;
+      String accountName = thisUserInfo.Contact.Account.Name;
       String agencyProType = thisUserInfo.UserPro_Type__c;
       String userWorkLocation = thisUserInfo.Work_Location__c;
       thisUserInfo.UserPro_Type__c = '';
       update thisUserInfo;
       if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
         agencyProType = 'ET';
-      }
-      String accountName;
-      Account[] accountInfo = [
-        SELECT Name
-        FROM account
-        WHERE id = :accountId
-        LIMIT 1
-      ];
-      if (accountInfo.size() > 0) {
-        accountName = accountInfo[0].Name;
       }
       Product2 prod07 = new Product2(
         Name = 'Test07',
@@ -115,32 +1033,7 @@
         Packing_list_manual__c = 1,
         Manual_Entry__c = false
       );
-      Product2 prod08 = new Product2(
-        Name = 'Test08',
-        ProductCode = 'Test08',
-        Asset_Model_No__c = 'Test08',
-        Category3__c = 'Test8',
-        Category4__c = 'Test88',
-        Category5__c = 'Test888',
-        SFDA_Status__c = '鏈夊姽',
-        Dealer_special_Object__c = true,
-        Packing_list_manual__c = 1,
-        Manual_Entry__c = false
-      );
-      Product2 prod09 = new Product2(
-        Name = 'Test09',
-        ProductCode = 'Test09',
-        Asset_Model_No__c = 'Test09',
-        Category3__c = 'Test9',
-        Category4__c = 'Test99',
-        Category5__c = 'Test999',
-        SFDA_Status__c = '鏈夊姽',
-        Dealer_special_Object__c = true,
-        Packing_list_manual__c = 1,
-        Manual_Entry__c = false
-      );
-      insert new List<Product2>{ prod07, prod08, prod09 };
-
+      insert new List<Product2>{ prod07 };
       Product2__c pro1 = new Product2__c(
         Name = 'MH-155:鐧藉钩琛″附',
         OT_CODE_Text__c = 'Test001',
@@ -149,16 +1042,1338 @@
         Category4_text__c = 'test123',
         Category5_text__c = 'test123'
       );
-      insert pro1;
-      Product2__c proH = new Product2__c(
-        Name = 'MB-677:BNC鐢电紗',
-        OT_CODE_Text__c = 'Test002',
-        Product2__c = prod08.Id,
+      insert new List<Product2__c>{ pro1 };
+      Consumable_order__c createIdSend = new Consumable_order__c();
+      createIdSend.Name = 'testMing1';
+      createIdSend.Order_status__c = '鎵瑰噯';
+      createIdSend.Deliver_date__c = Date.today();
+      createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend.Order_type__c = '璁㈠崟';
+      createIdSend.Order_ProType__c = 'ENG';
+      createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
+      createIdSend.Order_ForDealerText__c = 'Testaccount003';
+      createIdSend.Order_ForCustomerText__c = 'Test000';
+      createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend.Dealer_Info__c = accountItem1.Id;
+      createIdSend.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend1 = new Consumable_order__c();
+      createIdSend1.Name = 'testMing1';
+      createIdSend1.Order_status__c = '鎵瑰噯';
+      createIdSend1.Deliver_date__c = Date.today();
+      createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend1.Order_type__c = '璁㈠崟';
+      createIdSend1.Order_ProType__c = 'ENG';
+      createIdSend1.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+      createIdSend1.Order_ForDealerText__c = 'Testaccount003';
+      createIdSend1.Order_ForCustomerText__c = 'Test000';
+      createIdSend1.SummonsStatus_c__c = '浠锋牸鏈畾';
+      createIdSend1.Dealer_Info__c = accountItem1.Id;
+      createIdSend1.Delivery_detail_count__c = 5;
+      insert new List<Consumable_order__c>{ createIdSend, createIdSend1 };
+
+      Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+      coc.Name = 'Too001';
+      coc.Dealer_Custom_Price__c = 999.00;
+      coc.Consumable_count__c = 3;
+      coc.Consumable_product__c = pro1.Id;
+      coc.Box_Piece__c = '鐩�';
+      coc.isOutPattern__c = true;
+      coc.Consumable_order__c = createIdSend.Id;
+      coc.Unitprice_To_agency__c = 999.00;
+      coc.Delivery_List_RMB__c = -999.00;
+      coc.Shipment_Count__c = 9999.00;
+      coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+      Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+      coc1.Name = 'Too001';
+      coc1.Dealer_Custom_Price__c = 999.00;
+      coc1.Consumable_count__c = 3;
+      coc1.Consumable_product__c = pro1.Id;
+      coc1.Box_Piece__c = '鐩�';
+      coc1.isOutPattern__c = true;
+      coc1.Consumable_order__c = createIdSend.Id;
+      coc1.Unitprice_To_agency__c = 999.00;
+      coc1.Delivery_List_RMB__c = null;
+      coc1.Shipment_Count__c = 9999.00;
+      coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+      Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+      coc2.Name = 'Too001';
+      coc2.Dealer_Custom_Price__c = 999.00;
+      coc2.Consumable_count__c = 3;
+      coc2.Consumable_product__c = pro1.Id;
+      coc2.Box_Piece__c = '';
+      coc2.isOutPattern__c = true;
+      coc2.Consumable_order__c = createIdSend.Id;
+      coc2.Unitprice_To_agency__c = 999.00;
+      coc2.Delivery_List_RMB__c = 999.00;
+      coc2.Shipment_Count__c = 9999.00;
+      coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+      Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
+      coc3.Name = 'Too001';
+      coc3.Dealer_Custom_Price__c = 999.00;
+      coc3.Consumable_count__c = 3;
+      coc3.Consumable_product__c = pro1.Id;
+      coc3.Box_Piece__c = '鐩�';
+      coc3.isOutPattern__c = true;
+      coc3.Consumable_order__c = createIdSend1.Id;
+      coc3.Unitprice_To_agency__c = 999.00;
+      coc3.Delivery_List_RMB__c = 100.00;
+      coc3.Shipment_Count__c = 9999.00;
+      coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      insert new List<Consumable_orderdetails__c>{ coc, coc1, coc2, coc3 };
+
+      Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+      conOrderDetail1.Name = 'OCM_01_001001';
+      conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+      conOrderDetail1.Consumable_Product__c = pro1.Id;
+      conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      conOrderDetail1.Bar_Code__c = '11111';
+      conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+      conOrderDetail1.Send_Date__c = null;
+      conOrderDetail1.Used_date__c = null;
+      conOrderDetail1.Return_date__c = null;
+      conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+      conOrderDetail1.Lose_Flag__c = false;
+      conOrderDetail1.Cancellation_Flag__c = false;
+      conOrderDetail1.Box_Piece__c = '鐩�';
+      conOrderDetail1.Sterilization_limit__c = Date.Today();
+      insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
+
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c0 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c0.check = true;
+      c0.oldCheck = true;
+      c0.hospitalSpecialOffer = true;
+      c0.orderdetails1 = coc;
+      c0.orderdetails2 = conOrderDetail1;
+      c0.Prod = pro1;
+      c0.Boxnumber = 0.00;
+      c0.Piecenumber = 0.00;
+      c0.allnumber = 1999.00;
+      c0.oldConsumableCount = 1999.00;
+      c0.canSelect = true;
+      c0.sortBy = true;
+      c0.packinglist = 1;
+      c0.approbation_No = '';
+      c0.expiration_Date = Date.Today();
+      c0.boxorpiecein = '';
+      c0.boxorpiece = null;
+      c0.boxorpieceMap = null;
+      c0.concc = null;
+      c0.BoxPiece = null;
+      c0.hosPro = true;
+      pageRecords.add(c0);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c1 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c1.check = true;
+      c1.oldCheck = false;
+      c1.hospitalSpecialOffer = true;
+      c1.orderdetails1 = coc1;
+      c1.orderdetails2 = conOrderDetail1;
+      c1.Prod = pro1;
+      c1.Boxnumber = 0.00;
+      c1.Piecenumber = 0.00;
+      c1.allnumber = 1999.00;
+      c1.oldConsumableCount = 1999.00;
+      c1.canSelect = true;
+      c1.sortBy = true;
+      c1.packinglist = 1;
+      c1.approbation_No = '';
+      c1.expiration_Date = Date.Today();
+      c1.boxorpiecein = '';
+      c1.boxorpiece = null;
+      c1.boxorpieceMap = null;
+      c1.concc = null;
+      c1.BoxPiece = null;
+      c1.hosPro = true;
+      pageRecords1.add(c1);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c2 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c2.check = true;
+      c2.oldCheck = false;
+      c2.hospitalSpecialOffer = true;
+      c2.orderdetails1 = coc2;
+      c2.orderdetails2 = conOrderDetail1;
+      c2.Prod = pro1;
+      c2.Boxnumber = 0.00;
+      c2.Piecenumber = 0.00;
+      c2.allnumber = 1999.00;
+      c2.oldConsumableCount = 1999.00;
+      c2.canSelect = true;
+      c2.sortBy = true;
+      c2.packinglist = 1;
+      c2.approbation_No = '';
+      c2.expiration_Date = Date.Today();
+      c2.boxorpiecein = '';
+      c2.boxorpiece = null;
+      c2.boxorpieceMap = null;
+      c2.concc = null;
+      c2.BoxPiece = null;
+      c2.hosPro = true;
+      pageRecords2.add(c2);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c3 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c3.check = true;
+      c3.oldCheck = false;
+      c3.hospitalSpecialOffer = true;
+      c3.orderdetails1 = coc3;
+      c3.orderdetails2 = conOrderDetail1;
+      c3.Prod = pro1;
+      c3.Boxnumber = 0.00;
+      c3.Piecenumber = 0.00;
+      c3.allnumber = 1999.00;
+      c3.oldConsumableCount = 1999.00;
+      c3.canSelect = true;
+      c3.sortBy = true;
+      c3.packinglist = 1;
+      c3.approbation_No = '';
+      c3.expiration_Date = Date.Today();
+      c3.boxorpiecein = '';
+      c3.boxorpiece = null;
+      c3.boxorpieceMap = null;
+      c3.concc = null;
+      c3.BoxPiece = null;
+      c3.hosPro = true;
+      pageRecords3.add(c3);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords0 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c001 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c001.check = true;
+      c001.oldCheck = true;
+      c001.hospitalSpecialOffer = true;
+      c001.orderdetails1 = coc3;
+      c001.orderdetails2 = conOrderDetail1;
+      c001.Prod = pro1;
+      c001.Boxnumber = 0.00;
+      c001.Piecenumber = 0.00;
+      c001.allnumber = 1999.00;
+      c001.oldConsumableCount = 1999.00;
+      c001.canSelect = true;
+      c001.sortBy = true;
+      c001.packinglist = 1;
+      c001.approbation_No = '';
+      c001.expiration_Date = Date.Today();
+      c001.boxorpiecein = '';
+      c001.boxorpiece = null;
+      c001.boxorpieceMap = null;
+      c001.concc = null;
+      c001.BoxPiece = null;
+      c001.hosPro = true;
+      pageRecords0.add(c001);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords4 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c4 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c4.check = true;
+      c4.oldCheck = true;
+      c4.hospitalSpecialOffer = true;
+      c4.orderdetails1 = coc2;
+      c4.orderdetails2 = conOrderDetail1;
+      c4.Prod = pro1;
+      c4.Boxnumber = 0.00;
+      c4.Piecenumber = 0.00;
+      c4.allnumber = 1999.00;
+      c4.oldConsumableCount = 1999.00;
+      c4.canSelect = true;
+      c4.sortBy = true;
+      c4.packinglist = 1;
+      c4.approbation_No = '';
+      c4.expiration_Date = Date.Today();
+      c4.boxorpiecein = '';
+      c4.boxorpiece = null;
+      c4.boxorpieceMap = null;
+      c4.concc = null;
+      c4.BoxPiece = null;
+      c4.hosPro = true;
+      pageRecords4.add(c4);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi.check = true;
+      codi.hospitalSpecialOffer = true;
+      codi.packinglist = 0;
+      codi.approbation_No = null;
+      codi.expiration_Date = Date.Today();
+      codi.boxorpiecein = null;
+      codi.orderdetails1 = coc;
+      codi.Prod = pro1;
+      consumable.add(codi);
+      System.Test.startTest();
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords1,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords2,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords3,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords0,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords4,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      System.Test.stopTest();
+    }
+  }
+
+  @isTest
+  static void testSaveMethod1() {
+    Account accountItem1;
+    Account accountItem2;
+    User userTest;
+    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('Agency')
+      .getRecordTypeId();
+    String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('HP')
+      .getRecordTypeId();
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    accountItem1 = new Account(
+      Name = 'Testaccount001',
+      RecordTypeId = rectCo,
+      AgentCode_Ext__c = '9999900'
+    );
+    insert accountItem1;
+    accountItem2 = new Account(
+      Name = 'Testaccount002',
+      RecordTypeId = rectHp,
+      AgentCode_Ext__c = '9999999',
+      ParentId = accountItem1.Id,
+      Contract_Decide_Start_Date__c = Date.today(),
+      ENG_Dealer__c = true,
+      BillingCity = null
+    );
+    insert accountItem2;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountId = accountItem1.Id
+    );
+    insert core;
+    System.runAs(new user(ID = UserInfo.getUserID())) {
+      userTest = new User(
+        ContactId = core.id,
+        Alias = 'newUser',
+        Email = 'newuser@testorg.com',
+        EmailEncodingKey = 'UTF-8',
+        LastName = 'TestUser',
+        LanguageLocaleKey = 'zh_CN',
+        LocaleSidKey = 'zh_CN',
+        ProfileId = prof.Id,
+        TimeZoneSidKey = 'Asia/Shanghai',
+        UserName = 'testUser@testorg.com',
+        UserPro_Type__c = 'ENG',
+        Work_Location__c = '鍖椾含'
+      );
+      insert userTest;
+    }
+    System.runAs(userTest) {
+      String userId = UserInfo.getUserId();
+      User thisUserInfo = [
+        SELECT
+          accountid,
+          UserPro_Type__c,
+          ContactId,
+          Contact.AccountId,
+          Contact.Account.Name,
+          Work_Location__c
+        FROM User
+        WHERE id = :userId
+      ];
+      String accountId = thisUserInfo.accountid;
+      String accountName = thisUserInfo.Contact.Account.Name;
+      String agencyProType = thisUserInfo.UserPro_Type__c;
+      String userWorkLocation = thisUserInfo.Work_Location__c;
+      thisUserInfo.UserPro_Type__c = '';
+      update thisUserInfo;
+      if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+        agencyProType = 'ET';
+      }
+      Product2 prod07 = new Product2(
+        Name = 'Test07',
+        ProductCode = 'Test07',
+        Asset_Model_No__c = 'Test07',
+        Category3__c = 'Test7',
+        Category4__c = 'Test77',
+        Category5__c = 'Test777',
+        SFDA_Status__c = '鏈夊姽',
+        Intra_Trade_List_RMB_End_Date1__c = Date.Today(),
+        Intra_Trade_List_RMB_Date2__c = null,
+        Intra_Trade_List_RMB_1__c = 1,
+        Dealer_special_Object__c = true,
+        Packing_list_manual__c = 1,
+        Manual_Entry__c = false
+      );
+      insert new List<Product2>{ prod07 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'MH-155:鐧藉钩琛″附',
+        OT_CODE_Text__c = 'Test001',
+        Product2__c = prod07.Id,
         Category3_text__c = 'test123',
         Category4_text__c = 'test123',
         Category5_text__c = 'test123'
       );
-      insert proH;
+      insert new List<Product2__c>{ pro1 };
+      Consumable_order__c createIdSend = new Consumable_order__c();
+      createIdSend.Name = 'testMing1';
+      createIdSend.Order_status__c = '鎵瑰噯';
+      createIdSend.Deliver_date__c = Date.today();
+      createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend.Order_type__c = '璁㈠崟';
+      createIdSend.Order_ProType__c = 'ENG';
+      createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
+      createIdSend.Order_ForDealerText__c = 'Testaccount003';
+      createIdSend.Order_ForCustomerText__c = 'Test000';
+      createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend.Dealer_Info__c = accountItem1.Id;
+      createIdSend.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend1 = new Consumable_order__c();
+      createIdSend1.Name = 'testMing2';
+      createIdSend1.Order_status__c = '鎵瑰噯';
+      createIdSend1.Deliver_date__c = Date.today();
+      createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend1.Order_type__c = '璁㈠崟';
+      createIdSend1.Order_ProType__c = 'ENG';
+      createIdSend1.SummonsForDirction__c = '閿�鍞粰浜岀骇缁忛攢鍟�';
+      createIdSend1.Order_ForDealerText__c = 'Testaccount003';
+      createIdSend1.Order_ForCustomerText__c = 'Test000';
+      createIdSend1.SummonsStatus_c__c = '浠锋牸鏈畾';
+      createIdSend1.Dealer_Info__c = accountItem1.Id;
+      createIdSend1.Delivery_detail_count__c = 5;
+      insert new List<Consumable_order__c>{ createIdSend, createIdSend1 };
+
+      Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+      coc.Name = 'Too001';
+      coc.Dealer_Custom_Price__c = 999.00;
+      coc.Consumable_count__c = 3;
+      coc.Consumable_product__c = pro1.Id;
+      coc.Box_Piece__c = '涓�';
+      coc.isOutPattern__c = true;
+      coc.Consumable_order__c = createIdSend.Id;
+      coc.Unitprice_To_agency__c = 999.00;
+      coc.Delivery_List_RMB__c = 999.00;
+      coc.Shipment_Count__c = 9999.00;
+      coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+      Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+      coc1.Name = 'Too002';
+      coc1.Dealer_Custom_Price__c = 999.00;
+      coc1.Consumable_count__c = 3;
+      coc1.Consumable_product__c = pro1.Id;
+      coc1.Box_Piece__c = '涓�';
+      coc1.isOutPattern__c = true;
+      coc1.Consumable_order__c = createIdSend.Id;
+      coc1.Unitprice_To_agency__c = 999.00;
+      coc1.Delivery_List_RMB__c = 999.00;
+      coc1.Shipment_Count__c = null;
+      coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+      Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+      coc2.Name = 'Too003';
+      coc2.Dealer_Custom_Price__c = 999.00;
+      coc2.Consumable_count__c = 3;
+      coc2.Consumable_product__c = pro1.Id;
+      coc2.Box_Piece__c = '涓�';
+      coc2.isOutPattern__c = true;
+      coc2.Consumable_order__c = createIdSend.Id;
+      coc2.Unitprice_To_agency__c = 999.00;
+      coc2.Delivery_List_RMB__c = 0;
+      coc2.Shipment_Count__c = 100.00;
+      coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
+      coc3.Name = 'Too004';
+      coc3.Dealer_Custom_Price__c = 999.00;
+      coc3.Consumable_count__c = 3;
+      coc3.Consumable_product__c = pro1.Id;
+      coc3.Box_Piece__c = '';
+      coc3.isOutPattern__c = true;
+      coc3.Consumable_order__c = createIdSend1.Id;
+      coc3.Unitprice_To_agency__c = 999.00;
+      coc3.Delivery_List_RMB__c = 0.00;
+      coc3.Shipment_Count__c = 9999.00;
+      coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc4 = new Consumable_orderdetails__c();
+      coc4.Name = 'Too005';
+      coc4.Dealer_Custom_Price__c = 999.00;
+      coc4.Consumable_count__c = 3;
+      coc4.Consumable_product__c = pro1.Id;
+      coc4.Box_Piece__c = '';
+      coc4.isOutPattern__c = true;
+      coc4.Consumable_order__c = createIdSend1.Id;
+      coc4.Unitprice_To_agency__c = 999.00;
+      coc4.Delivery_List_RMB__c = 9999.00;
+      coc4.Shipment_Count__c = 100.00;
+      coc4.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc5 = new Consumable_orderdetails__c();
+      coc5.Name = 'Too006';
+      coc5.Dealer_Custom_Price__c = 999.00;
+      coc5.Consumable_count__c = 3;
+      coc5.Consumable_product__c = pro1.Id;
+      coc5.Box_Piece__c = '鐩�';
+      coc5.isOutPattern__c = true;
+      coc5.Consumable_order__c = createIdSend1.Id;
+      coc5.Unitprice_To_agency__c = 999.00;
+      coc5.Delivery_List_RMB__c = 9999.00;
+      coc5.Shipment_Count__c = 9999.00;
+      coc5.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc6 = new Consumable_orderdetails__c();
+      coc6.Name = 'Too007';
+      coc6.Dealer_Custom_Price__c = 999.00;
+      coc6.Consumable_count__c = 3;
+      coc6.Consumable_product__c = pro1.Id;
+      coc6.Box_Piece__c = '涓�';
+      coc6.isOutPattern__c = true;
+      coc6.Consumable_order__c = createIdSend1.Id;
+      coc6.Unitprice_To_agency__c = 999.00;
+      coc6.Delivery_List_RMB__c = 9999.00;
+      coc6.Shipment_Count__c = 9999.00;
+      coc6.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc7 = new Consumable_orderdetails__c();
+      coc7.Name = 'Too008';
+      coc7.Dealer_Custom_Price__c = 999.00;
+      coc7.Consumable_count__c = 3;
+      coc7.Consumable_product__c = pro1.Id;
+      coc7.Box_Piece__c = '鐩�';
+      coc7.isOutPattern__c = true;
+      coc7.Consumable_order__c = createIdSend1.Id;
+      coc7.Unitprice_To_agency__c = 999.00;
+      coc7.Delivery_List_RMB__c = 100;
+      coc7.Shipment_Count__c = 0;
+      coc7.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      insert new List<Consumable_orderdetails__c>{
+        coc,
+        coc1,
+        coc2,
+        coc3,
+        coc4,
+        coc5,
+        coc6,
+        coc7
+      };
+
+      Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+      conOrderDetail1.Name = 'OCM_01_001001';
+      conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+      conOrderDetail1.Consumable_Product__c = pro1.Id;
+      conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      conOrderDetail1.Bar_Code__c = '11111';
+      conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+      conOrderDetail1.Send_Date__c = null;
+      conOrderDetail1.Used_date__c = null;
+      conOrderDetail1.Return_date__c = null;
+      conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+      conOrderDetail1.Lose_Flag__c = false;
+      conOrderDetail1.Cancellation_Flag__c = false;
+      conOrderDetail1.Box_Piece__c = '鐩�';
+      conOrderDetail1.Sterilization_limit__c = Date.Today();
+      insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c0 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c0.check = true;
+      c0.oldCheck = false;
+      c0.hospitalSpecialOffer = true;
+      c0.orderdetails1 = coc;
+      c0.orderdetails2 = conOrderDetail1;
+      c0.Prod = pro1;
+      c0.Boxnumber = 0.00;
+      c0.Piecenumber = 0.00;
+      c0.allnumber = 1999.00;
+      c0.oldConsumableCount = 1999.00;
+      c0.canSelect = true;
+      c0.sortBy = true;
+      c0.packinglist = 1;
+      c0.approbation_No = '';
+      c0.expiration_Date = Date.Today();
+      c0.boxorpiecein = '';
+      c0.boxorpiece = null;
+      c0.boxorpieceMap = null;
+      c0.concc = null;
+      c0.BoxPiece = null;
+      c0.hosPro = true;
+      pageRecords.add(c0);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c1 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c1.check = true;
+      c1.oldCheck = true;
+      c1.hospitalSpecialOffer = true;
+      c1.orderdetails1 = coc;
+      c1.orderdetails2 = conOrderDetail1;
+      c1.Prod = pro1;
+      c1.Boxnumber = 0.00;
+      c1.Piecenumber = 0.00;
+      c1.allnumber = 1999.00;
+      c1.oldConsumableCount = 1999.00;
+      c1.canSelect = true;
+      c1.sortBy = true;
+      c1.packinglist = 1;
+      c1.approbation_No = '';
+      c1.expiration_Date = Date.Today();
+      c1.boxorpiecein = '';
+      c1.boxorpiece = null;
+      c1.boxorpieceMap = null;
+      c1.concc = null;
+      c1.BoxPiece = null;
+      c1.hosPro = true;
+      pageRecords1.add(c1);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c2 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c2.check = true;
+      c2.oldCheck = false;
+      c2.hospitalSpecialOffer = true;
+      c2.orderdetails1 = coc1;
+      c2.orderdetails2 = conOrderDetail1;
+      c2.Prod = pro1;
+      c2.Boxnumber = 0.00;
+      c2.Piecenumber = 0.00;
+      c2.allnumber = 1999.00;
+      c2.oldConsumableCount = 1999.00;
+      c2.canSelect = true;
+      c2.sortBy = true;
+      c2.packinglist = 1;
+      c2.approbation_No = '';
+      c2.expiration_Date = Date.Today();
+      c2.boxorpiecein = '';
+      c2.boxorpiece = null;
+      c2.boxorpieceMap = null;
+      c2.concc = null;
+      c2.BoxPiece = null;
+      c2.hosPro = true;
+      pageRecords2.add(c2);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c3 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c3.check = true;
+      c3.oldCheck = true;
+      c3.hospitalSpecialOffer = true;
+      c3.orderdetails1 = coc2;
+      c3.orderdetails2 = conOrderDetail1;
+      c3.Prod = pro1;
+      c3.Boxnumber = 0.00;
+      c3.Piecenumber = 0.00;
+      c3.allnumber = 199999.00;
+      c3.oldConsumableCount = 1999.00;
+      c3.canSelect = true;
+      c3.sortBy = true;
+      c3.packinglist = 1;
+      c3.approbation_No = '';
+      c3.expiration_Date = Date.Today();
+      c3.boxorpiecein = '';
+      c3.boxorpiece = null;
+      c3.boxorpieceMap = null;
+      c3.concc = null;
+      c3.BoxPiece = null;
+      c3.hosPro = true;
+      pageRecords3.add(c3);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi.check = true;
+      codi.hospitalSpecialOffer = true;
+      codi.packinglist = 0;
+      codi.approbation_No = null;
+      codi.expiration_Date = Date.Today();
+      codi.boxorpiecein = null;
+      codi.orderdetails1 = coc;
+      codi.Prod = pro1;
+      consumable.add(codi);
+      System.Test.startTest();
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords1,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords2,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords3,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      System.Test.stopTest();
+    }
+  }
+
+  @isTest
+  static void testSave() {
+    Account accountItem1;
+    Account accountItem2;
+    User userTest;
+    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('Agency')
+      .getRecordTypeId();
+    String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('HP')
+      .getRecordTypeId();
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    accountItem1 = new Account(
+      Name = 'Testaccount001',
+      RecordTypeId = rectCo,
+      AgentCode_Ext__c = '9999900',
+      Contract_Decide_Start_Date__c = Date.today(),
+      ENG_Dealer__c = true
+    );
+    insert accountItem1;
+    accountItem2 = new Account(
+      Name = 'Testaccount002',
+      RecordTypeId = rectHp,
+      AgentCode_Ext__c = '9999999',
+      ParentId = accountItem1.Id
+    );
+    insert accountItem2;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountId = accountItem1.Id
+    );
+    insert core;
+    System.runAs(new user(ID = UserInfo.getUserID())) {
+      userTest = new User(
+        ContactId = core.id,
+        Alias = 'newUser',
+        Email = 'newuser@testorg.com',
+        EmailEncodingKey = 'UTF-8',
+        LastName = 'TestUser',
+        LanguageLocaleKey = 'zh_CN',
+        LocaleSidKey = 'zh_CN',
+        ProfileId = prof.Id,
+        TimeZoneSidKey = 'Asia/Shanghai',
+        UserName = 'testUser@testorg.com',
+        UserPro_Type__c = 'ENG',
+        Work_Location__c = '鍖椾含'
+      );
+      insert userTest;
+    }
+    System.runAs(userTest) {
+      String userId = UserInfo.getUserId();
+      User thisUserInfo = [
+        SELECT
+          accountid,
+          UserPro_Type__c,
+          ContactId,
+          Contact.AccountId,
+          Contact.Account.Name,
+          Work_Location__c
+        FROM User
+        WHERE id = :userId
+      ];
+      String accountId = thisUserInfo.accountid;
+      String accountName = thisUserInfo.Contact.Account.Name;
+      String agencyProType = thisUserInfo.UserPro_Type__c;
+      String userWorkLocation = thisUserInfo.Work_Location__c;
+      thisUserInfo.UserPro_Type__c = '';
+      update thisUserInfo;
+      if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+        agencyProType = 'ET';
+      }
+      Product2 prod07 = new Product2(
+        Name = 'Test07',
+        ProductCode = 'Test07',
+        Asset_Model_No__c = 'Test07',
+        Category3__c = 'Test7',
+        Category4__c = 'Test77',
+        Category5__c = 'Test777',
+        SFDA_Status__c = '鏈夊姽',
+        Dealer_special_Object__c = true,
+        Packing_list_manual__c = 1,
+        Manual_Entry__c = false
+      );
+      insert new List<Product2>{ prod07 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'MH-155:鐧藉钩琛″附',
+        OT_CODE_Text__c = 'Test001',
+        Product2__c = prod07.Id,
+        Category3_text__c = 'test123',
+        Category4_text__c = 'test123',
+        Category5_text__c = 'test123'
+      );
+      insert new List<Product2__c>{ pro1 };
+
+      Consumable_order__c createIdSend = new Consumable_order__c();
+      createIdSend.Name = 'testMing1';
+      createIdSend.Order_status__c = '鎵瑰噯';
+      createIdSend.Deliver_date__c = Date.today();
+      createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend.Order_type__c = '璁㈠崟';
+      createIdSend.Order_ProType__c = 'ENG';
+      createIdSend.SummonsForDirction__c = 'Test123456';
+      createIdSend.Order_ForDealerText__c = '';
+      createIdSend.Order_ForDealer__c = accountItem1.Id;
+      createIdSend.Order_ForCustomerText__c = '';
+      createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend.Dealer_Info__c = accountItem1.Id;
+      createIdSend.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend1 = new Consumable_order__c();
+      createIdSend.Name = 'testMing1';
+      createIdSend.Order_status__c = '鎵瑰噯';
+      createIdSend.Deliver_date__c = Date.today();
+      createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend.Order_type__c = '璁㈠崟';
+      createIdSend.Order_ProType__c = 'ENG';
+      createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
+      createIdSend.Order_ForDealerText__c = 'Test';
+      createIdSend.Order_ForDealer__c = accountItem1.Id;
+      createIdSend.Order_ForCustomerText__c = '';
+      createIdSend.SummonsStatus_c__c = '';
+      createIdSend.Dealer_Info__c = accountItem1.Id;
+      createIdSend.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend2 = new Consumable_order__c();
+      createIdSend2.Name = 'testMing1';
+      createIdSend2.Order_status__c = '鎵瑰噯';
+      createIdSend2.Deliver_date__c = Date.today();
+      createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend2.Order_type__c = '璁㈠崟';
+      createIdSend2.Order_ProType__c = 'ENG';
+      createIdSend2.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+      createIdSend2.Order_ForDealerText__c = '';
+      createIdSend2.Order_ForDealer__c = accountItem1.Id;
+      createIdSend2.Order_ForCustomerText__c = '';
+      createIdSend2.SummonsStatus_c__c = '浠锋牸鏈畾';
+      createIdSend2.Dealer_Info__c = accountItem1.Id;
+      createIdSend2.Delivery_detail_count__c = 5;
+      insert new List<Consumable_order__c>{
+        createIdSend,
+        createIdSend1,
+        createIdSend2
+      };
+
+      Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+      coc.Name = 'Too001';
+      coc.Dealer_Custom_Price__c = 999.00;
+      coc.Consumable_count__c = 3;
+      coc.Consumable_product__c = pro1.Id;
+      coc.Box_Piece__c = '鐩�';
+      coc.isOutPattern__c = true;
+      coc.Consumable_order__c = createIdSend.Id;
+      coc.Unitprice_To_agency__c = 999.00;
+      coc.Delivery_List_RMB__c = 999.00;
+      coc.Shipment_Count__c = 10000;
+      coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+      coc1.Name = 'Too001';
+      coc1.Dealer_Custom_Price__c = 999.00;
+      coc1.Consumable_count__c = 3;
+      coc1.Consumable_product__c = pro1.Id;
+      coc1.Box_Piece__c = '鐩�';
+      coc1.isOutPattern__c = true;
+      coc1.Consumable_order__c = createIdSend.Id;
+      coc1.Unitprice_To_agency__c = 999.00;
+      coc1.Delivery_List_RMB__c = -999.00;
+      coc1.Shipment_Count__c = 10000;
+      coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+      coc2.Name = 'Too001';
+      coc2.Dealer_Custom_Price__c = 999.00;
+      coc2.Consumable_count__c = 3;
+      coc2.Consumable_product__c = pro1.Id;
+      coc2.Box_Piece__c = '涓�';
+      coc2.isOutPattern__c = true;
+      coc2.Consumable_order__c = createIdSend.Id;
+      coc2.Unitprice_To_agency__c = 999.00;
+      coc2.Delivery_List_RMB__c = null;
+      coc2.Shipment_Count__c = 10000;
+      coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc3 = new Consumable_orderdetails__c();
+      coc3.Name = 'Too001';
+      coc3.Dealer_Custom_Price__c = 999.00;
+      coc3.Consumable_count__c = 3;
+      coc3.Consumable_product__c = pro1.Id;
+      coc3.Box_Piece__c = '';
+      coc3.isOutPattern__c = true;
+      coc3.Consumable_order__c = createIdSend2.Id;
+      coc3.Unitprice_To_agency__c = 999.00;
+      coc3.Delivery_List_RMB__c = 0;
+      coc3.Shipment_Count__c = 10000;
+      coc3.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc4 = new Consumable_orderdetails__c();
+      coc4.Name = 'Too001';
+      coc4.Dealer_Custom_Price__c = 999.00;
+      coc4.Consumable_count__c = 3;
+      coc4.Consumable_product__c = pro1.Id;
+      coc4.Box_Piece__c = '';
+      coc4.isOutPattern__c = true;
+      coc4.Consumable_order__c = createIdSend2.Id;
+      coc4.Unitprice_To_agency__c = 999.00;
+      coc4.Delivery_List_RMB__c = 0;
+      coc4.Shipment_Count__c = 10000;
+      coc4.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc5 = new Consumable_orderdetails__c();
+      coc5.Name = 'Too001';
+      coc5.Dealer_Custom_Price__c = 999.00;
+      coc5.Consumable_count__c = 3;
+      coc5.Consumable_product__c = pro1.Id;
+      coc5.Box_Piece__c = '鐩�';
+      coc5.isOutPattern__c = true;
+      coc5.Consumable_order__c = createIdSend2.Id;
+      coc5.Unitprice_To_agency__c = 999.00;
+      coc5.Delivery_List_RMB__c = 100;
+      coc5.Shipment_Count__c = 10000;
+      coc5.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      insert new List<Consumable_orderdetails__c>{
+        coc,
+        coc1,
+        coc2,
+        coc3,
+        coc4,
+        coc5
+      };
+
+      Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+      conOrderDetail1.Name = 'OCM_01_001001';
+      conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+      conOrderDetail1.Consumable_Product__c = pro1.Id;
+      conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      conOrderDetail1.Bar_Code__c = '11111';
+      conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+      conOrderDetail1.Send_Date__c = null;
+      conOrderDetail1.Used_date__c = null;
+      conOrderDetail1.Return_date__c = null;
+      conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+      conOrderDetail1.Lose_Flag__c = false;
+      conOrderDetail1.Box_Piece__c = '鐩�';
+      insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
+
+      hospitalprice__c hp1 = new hospitalprice__c();
+      hp1.hospital__c = accountId;
+      hp1.account__c = accountId;
+      hp1.product__c = pro1.Id;
+      insert new List<hospitalprice__c>{ hp1 };
+
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc cod = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      cod.check = true;
+      cod.oldCheck = true;
+      cod.hospitalSpecialOffer = true;
+      cod.orderdetails1 = coc;
+      cod.orderdetails2 = conOrderDetail1;
+      cod.Prod = pro1;
+      cod.Boxnumber = 0.00;
+      cod.Piecenumber = 0.00;
+      cod.allnumber = 1999.00;
+      cod.oldConsumableCount = 1999.00;
+      cod.canSelect = true;
+      cod.sortBy = true;
+      cod.packinglist = 1;
+      cod.approbation_No = '';
+      cod.expiration_Date = Date.Today();
+      cod.boxorpiecein = '';
+      cod.boxorpiece = null;
+      cod.boxorpieceMap = null;
+      cod.concc = null;
+      cod.BoxPiece = null;
+      cod.hosPro = true;
+      pageRecordsList.add(cod);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c7.check = false;
+      c7.oldCheck = true;
+      c7.hospitalSpecialOffer = false;
+      c7.orderdetails1 = coc1;
+      c7.orderdetails2 = conOrderDetail1;
+      c7.Prod = pro1;
+      c7.Boxnumber = 0.00;
+      c7.Piecenumber = 0.00;
+      c7.allnumber = 1999.00;
+      c7.oldConsumableCount = 1999.00;
+      c7.canSelect = true;
+      c7.sortBy = true;
+      c7.packinglist = 1;
+      c7.approbation_No = '';
+      c7.expiration_Date = Date.Today();
+      c7.boxorpiecein = '';
+      c7.boxorpiece = null;
+      c7.boxorpieceMap = null;
+      c7.concc = null;
+      c7.BoxPiece = null;
+      c7.hosPro = true;
+      pageRecords.add(c7);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords2 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c9 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c9.check = true;
+      c9.oldCheck = true;
+      c9.hospitalSpecialOffer = true;
+      c9.orderdetails1 = coc3;
+      c9.orderdetails2 = conOrderDetail1;
+      c9.Prod = pro1;
+      c9.Boxnumber = 0.00;
+      c9.Piecenumber = 0.00;
+      c9.allnumber = 1999.00;
+      c9.oldConsumableCount = 1999.00;
+      c9.canSelect = true;
+      c9.sortBy = true;
+      c9.packinglist = 1;
+      c9.approbation_No = '';
+      c9.expiration_Date = Date.Today();
+      c9.boxorpiecein = '';
+      c9.boxorpiece = null;
+      c9.boxorpieceMap = null;
+      c9.concc = null;
+      c9.BoxPiece = null;
+      c9.hosPro = true;
+      pageRecords2.add(c9);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords3 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c10 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c10.check = true;
+      c10.oldCheck = false;
+      c10.hospitalSpecialOffer = true;
+      c10.orderdetails1 = coc4;
+      c10.orderdetails2 = conOrderDetail1;
+      c10.Prod = pro1;
+      c10.Boxnumber = 0.00;
+      c10.Piecenumber = 0.00;
+      c10.allnumber = 1999.00;
+      c10.oldConsumableCount = 1999.00;
+      c10.canSelect = true;
+      c10.sortBy = true;
+      c10.packinglist = 1;
+      c10.approbation_No = '';
+      c10.expiration_Date = Date.Today();
+      c10.boxorpiecein = '';
+      c10.boxorpiece = null;
+      c10.boxorpieceMap = null;
+      c10.concc = null;
+      c10.BoxPiece = null;
+      c10.hosPro = true;
+      pageRecords3.add(c10);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi.check = true;
+      codi.oldCheck = true;
+      codi.hospitalSpecialOffer = true;
+      codi.packinglist = 0;
+      codi.approbation_No = null;
+      codi.expiration_Date = Date.Today();
+      codi.boxorpiecein = null;
+      codi.orderdetails1 = coc;
+      codi.Prod = pro1;
+      consumable.add(codi);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumableList = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi1.check = false;
+      codi1.oldCheck = true;
+      codi1.hospitalSpecialOffer = false;
+      codi1.packinglist = 0;
+      codi1.approbation_No = null;
+      codi1.expiration_Date = Date.Today();
+      codi1.boxorpiecein = null;
+      codi1.orderdetails1 = coc;
+      codi1.Prod = pro1;
+      consumableList.add(codi1);
+      Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
+      String ESetId = createIdSend.Id;
+      String statusEdit = 'Test';
+      String arrive = createIdSend.Id;
+      System.Test.startTest();
+      LexSummonsCreatController.firstInit(ESetId);
+      LexSummonsCreatController.init(ESetId, statusEdit, 1, 100, arrive);
+      LexSummonsCreatController.init(ESetId, null, 1, 100, arrive);
+      LexSummonsCreatController.GoodsDelivery(
+        createIdSend2,
+        createIdSend2.Id,
+        pageRecords
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        accountId,
+        'Test',
+        accountItem1.Id,
+        pageRecordsList,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        accountId,
+        'Test',
+        accountItem1.Id,
+        pageRecords,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        accountId,
+        'Test',
+        accountItem1.Id,
+        null,
+        accountId,
+        createIdSend.Id,
+        null,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        accountId,
+        'Test',
+        accountItem1.Id,
+        pageRecords,
+        accountId,
+        null,
+        consumableList,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend2,
+        accountId,
+        'Test',
+        null,
+        pageRecords,
+        accountId,
+        createIdSend2.Id,
+        null,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend2,
+        accountId,
+        'Test',
+        null,
+        pageRecords2,
+        accountId,
+        createIdSend2.Id,
+        null,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend2,
+        accountId,
+        'Test',
+        null,
+        pageRecords3,
+        accountId,
+        createIdSend2.Id,
+        null,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend1,
+        '',
+        '',
+        accountItem1.Id,
+        pageRecords3,
+        accountId,
+        createIdSend2.Id,
+        null,
+        agencyProType,
+        userWorkLocation
+      );
+      System.Test.stopTest();
+    }
+  }
+  @isTest
+  static void testAttachment() {
+    Account accountItem1;
+    Account accountItem2;
+    User userTest;
+    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('Agency')
+      .getRecordTypeId();
+    String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('HP')
+      .getRecordTypeId();
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    accountItem1 = new Account(
+      Name = 'Testaccount001',
+      RecordTypeId = rectCo,
+      AgentCode_Ext__c = '9999900',
+      Contract_Decide_Start_Date__c = Date.today(),
+      ENG_Dealer__c = true
+    );
+    insert accountItem1;
+    accountItem2 = new Account(
+      Name = 'Testaccount002',
+      RecordTypeId = rectHp,
+      AgentCode_Ext__c = '9999999',
+      ParentId = accountItem1.Id
+    );
+    insert accountItem2;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountId = accountItem1.Id
+    );
+    insert core;
+    System.runAs(new user(ID = UserInfo.getUserID())) {
+      userTest = new User(
+        ContactId = core.id,
+        Alias = 'newUser',
+        Email = 'newuser@testorg.com',
+        EmailEncodingKey = 'UTF-8',
+        LastName = 'TestUser',
+        LanguageLocaleKey = 'zh_CN',
+        LocaleSidKey = 'zh_CN',
+        ProfileId = prof.Id,
+        TimeZoneSidKey = 'Asia/Shanghai',
+        UserName = 'testUser@testorg.com',
+        UserPro_Type__c = 'ENG',
+        Work_Location__c = '鍖椾含'
+      );
+      insert userTest;
+    }
+    System.runAs(userTest) {
+      String userId = UserInfo.getUserId();
+      User thisUserInfo = [
+        SELECT
+          accountid,
+          UserPro_Type__c,
+          ContactId,
+          Contact.AccountId,
+          Contact.Account.Name,
+          Work_Location__c
+        FROM User
+        WHERE id = :userId
+      ];
+      String accountId = thisUserInfo.accountid;
+      String accountName = thisUserInfo.Contact.Account.Name;
+      String agencyProType = thisUserInfo.UserPro_Type__c;
+      String userWorkLocation = thisUserInfo.Work_Location__c;
+      thisUserInfo.UserPro_Type__c = '';
+      update thisUserInfo;
+      if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+        agencyProType = 'ET';
+      }
+      Product2 prod07 = new Product2(
+        Name = 'Test07',
+        ProductCode = 'Test07',
+        Asset_Model_No__c = 'Test07',
+        Category3__c = 'Test7',
+        Category4__c = 'Test77',
+        Category5__c = 'Test777',
+        SFDA_Status__c = '鏈夊姽',
+        Dealer_special_Object__c = true,
+        Packing_list_manual__c = 1,
+        Manual_Entry__c = false
+      );
+      insert new List<Product2>{ prod07 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'MH-155:鐧藉钩琛″附',
+        OT_CODE_Text__c = 'Test001',
+        Product2__c = prod07.Id,
+        Category3_text__c = 'test123',
+        Category4_text__c = 'test123',
+        Category5_text__c = 'test123'
+      );
+      insert new List<Product2__c>{ pro1 };
       //鍙戣揣
       Consumable_order__c createIdSend = new Consumable_order__c();
       createIdSend.Name = 'testMing1';
@@ -167,56 +2382,75 @@
       createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
       createIdSend.Order_type__c = '璁㈠崟';
       createIdSend.Order_ProType__c = 'ENG';
+      createIdSend.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+      createIdSend.Order_ForDealerText__c = 'Test';
+      createIdSend.Order_ForCustomerText__c = 'Test';
+      createIdSend.SummonsStatus_c__c = '鎵瑰噯';
       createIdSend.Dealer_Info__c = accountItem1.Id;
       createIdSend.Delivery_detail_count__c = 5;
-      insert createIdSend;
 
-      //鍙戠エ淇℃伅
-      Consumable_order__c invoiceorder = new Consumable_order__c(
-        Name = 'invoice01',
-        Order_type__c = '鍙戠エ',
-        Invoice_status__c = '宸插畬鎴�',
-        Invoice_Date__c = Date.today(),
-        RecordTypeid = System.Label.RT_ConOrder_Invoice,
-        SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌',
-        Order_status__c = '鑽夋涓�',
-        Dealer_info__c = accountItem1.Id
-      );
-      insert invoiceorder;
+      Consumable_order__c createIdSend1 = new Consumable_order__c();
+      createIdSend1.Name = 'testMing1';
+      createIdSend1.Order_status__c = '鎵瑰噯';
+      createIdSend1.Deliver_date__c = Date.today();
+      createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend1.Order_type__c = '璁㈠崟';
+      createIdSend1.Order_ProType__c = 'ENG';
+      createIdSend1.SummonsForDirction__c = '鍖婚櫌璇曠敤';
+      createIdSend1.Order_ForDealerText__c = 'Test';
+      createIdSend1.Order_ForCustomerText__c = '';
+      createIdSend1.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend1.Dealer_Info__c = accountItem1.Id;
+      createIdSend1.Delivery_detail_count__c = 5;
 
-      //鍒拌揣
-      Consumable_order__c createIdArrived = new Consumable_order__c();
-      createIdArrived.Name = 'testMing2';
-      createIdArrived.Order_status__c = '鎵瑰噯';
-      createIdArrived.Deliver_date__c = Date.today();
-      createIdArrived.RecordTypeid = System.Label.RT_ConOrder_Arrive;
-      createIdArrived.Order_type__c = '璁㈠崟';
-      createIdArrived.Order_ProType__c = 'ENG';
-      createIdArrived.Arrive_Order__c = createIdSend.Id;
-      createIdArrived.Dealer_Info__c = accountItem1.Id;
-      createIdArrived.Delivery_detail_count__c = 5;
-      insert createIdArrived;
+      Consumable_order__c createIdSend2 = new Consumable_order__c();
+      createIdSend2.Name = 'testMing1';
+      createIdSend2.Order_status__c = '鎵瑰噯';
+      createIdSend2.Deliver_date__c = Date.today();
+      createIdSend2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend2.Order_type__c = '璁㈠崟';
+      createIdSend2.Order_ProType__c = 'ENG';
+      createIdSend2.SummonsForDirction__c = '浜掔浉璋冭揣';
+      createIdSend2.Order_ForDealerText__c = '';
+      createIdSend2.Order_ForCustomerText__c = 'Test';
+      createIdSend2.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend2.Dealer_Info__c = accountItem1.Id;
+      createIdSend2.Delivery_detail_count__c = 5;
+      insert new List<Consumable_order__c>{
+        createIdSend,
+        createIdSend1,
+        createIdSend2
+      };
 
-      List<Consumable_orderdetails__c> orderdetails = new List<Consumable_orderdetails__c>();
-      Consumable_orderdetails__c coc = new Consumable_orderdetails__c(
-        Name = 'Too001',
-        Dealer_Custom_Price__c = 999.00,
-        Consumable_count__c = 3,
-        Consumable_product__c = pro1.Id,
-        Box_Piece__c = '鐩�',
-        isOutPattern__c = true,
-        Consumable_order__c = createIdArrived.Id,
-        Unitprice_To_agency__c = 999.00,
-        Delivery_List_RMB__c = 999.00,
-        Shipment_Count__c = 999.00,
-        RecordTypeid = System.Label.RT_ConOrderDetail1_Order
-      );
-      orderdetails.add(coc);
-      insert orderdetails;
+      Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+      coc.Name = 'Too001';
+      coc.Dealer_Custom_Price__c = 999.00;
+      coc.Consumable_count__c = 3;
+      coc.Consumable_product__c = pro1.Id;
+      coc.Box_Piece__c = '鐩�';
+      coc.isOutPattern__c = true;
+      coc.Consumable_order__c = createIdSend.Id;
+      coc.Unitprice_To_agency__c = 999.00;
+      coc.Delivery_List_RMB__c = 999.00;
+      coc.Shipment_Count__c = null;
+      coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc2 = new Consumable_orderdetails__c();
+      coc2.Name = 'Too001';
+      coc2.Dealer_Custom_Price__c = 999.00;
+      coc2.Consumable_count__c = 3;
+      coc2.Consumable_product__c = pro1.Id;
+      coc2.Box_Piece__c = '涓�';
+      coc2.isOutPattern__c = true;
+      coc2.Consumable_order__c = createIdSend.Id;
+      coc2.Unitprice_To_agency__c = 999.00;
+      coc2.Delivery_List_RMB__c = 0;
+      coc2.Shipment_Count__c = 0;
+      coc2.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      insert new List<Consumable_orderdetails__c>{ coc, coc2 };
 
       Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
       conOrderDetail1.Name = 'OCM_01_001001';
-      conOrderDetail1.Consumable_ZS_order__c = createIdArrived.Id;
+      conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
       conOrderDetail1.Consumable_Product__c = pro1.Id;
       conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
       conOrderDetail1.Bar_Code__c = '11111';
@@ -224,69 +2458,1312 @@
       conOrderDetail1.Send_Date__c = null;
       conOrderDetail1.Used_date__c = null;
       conOrderDetail1.Return_date__c = null;
-      conOrderDetail1.Consumable_order_minor__c = createIdArrived.Id;
+      conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
       conOrderDetail1.Lose_Flag__c = false;
       conOrderDetail1.Box_Piece__c = '鐩�';
-      insert conOrderDetail1;
+      insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
+
+      hospitalprice__c hp1 = new hospitalprice__c();
+      hp1.hospital__c = accountId;
+      hp1.account__c = accountId;
+      hp1.product__c = pro1.Id;
+      insert new List<hospitalprice__c>{ hp1 };
+
+      Attachment attach = new Attachment();
+      attach.Name = 'A-65224941-20200923--1.docx';
+      Blob bodyBlob = Blob.valueOf('Unit Test Attachment Body');
+      attach.body = bodyBlob;
+      attach.ParentId = createIdSend.id;
+      attach.ContentType = 'application/pdf';
+      insert new List<Attachment>{ attach };
+
+      System.Test.startTest();
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwcLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c5 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c5.check = true;
+      c5.hospitalSpecialOffer = true;
+      c5.orderdetails1 = coc;
+      c5.allnumber = 1999.00;
+      pageRecordsLwcLwc.add(c5);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c8 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c8.check = true;
+      c8.hospitalSpecialOffer = true;
+      c8.orderdetails1 = coc2;
+      c8.allnumber = 1999.00;
+      pageRecordsList.add(c8);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c6.check = false;
+      c6.hospitalSpecialOffer = false;
+      c6.orderdetails1 = coc;
+      c6.allnumber = 1999.00;
+      pageRecords.add(c6);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c7.check = true;
+      c7.oldCheck = true;
+      c7.hospitalSpecialOffer = true;
+      c7.orderdetails1 = coc;
+      c7.orderdetails2 = conOrderDetail1;
+      c7.Prod = pro1;
+      c7.Boxnumber = 0.00;
+      c7.Piecenumber = 0.00;
+      c7.allnumber = 1999.00;
+      c7.oldConsumableCount = 1999.00;
+      c7.canSelect = true;
+      c7.sortBy = true;
+      c7.packinglist = 1;
+      c7.approbation_No = '';
+      c7.expiration_Date = Date.Today();
+      c7.boxorpiecein = '';
+      c7.boxorpiece = null;
+      c7.boxorpieceMap = null;
+      c7.concc = null;
+      c7.BoxPiece = null;
+      c7.hosPro = true;
+      pageRecordsLwc.add(c7);
+
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi.check = true;
+      codi.oldCheck = true;
+      codi.hospitalSpecialOffer = true;
+      codi.packinglist = 0;
+      codi.approbation_No = null;
+      codi.expiration_Date = Date.Today();
+      codi.boxorpiecein = null;
+      codi.orderdetails1 = coc;
+      codi.Prod = pro1;
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi1.check = false;
+      codi1.oldCheck = true;
+      codi1.hospitalSpecialOffer = false;
+      codi1.packinglist = 0;
+      codi1.approbation_No = null;
+      codi1.expiration_Date = Date.Today();
+      codi1.boxorpiecein = null;
+      codi1.orderdetails1 = coc;
+      codi1.Prod = pro1;
+      consumable.add(codi);
 
       Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
-      String ESetId = null;
-      String statusEdit = null;
-      String arrive = null;
+      String ESetId = createIdSend.Id;
+      String statusEdit = 'Test';
+      String arrive = createIdSend.Id;
       LexSummonsCreatController.firstInit(ESetId);
       LexSummonsCreatController.init(ESetId, statusEdit, 1, 100, arrive);
-      List<LexSummonsCreatController.ConsumableorderdetailsInfo> inList = LexSummonsCreatController.consumableorderdetailsRecords;
-      List<LexSummonsCreatController.ConsumableorderdetailsInfo> inList1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
-      for (LexSummonsCreatController.ConsumableorderdetailsInfo ass : inList) {
-        ass.orderdetails2 = conOrderDetail1;
-        inList1.add(ass);
-      }
-      LexSummonsCreatController.ConsumableorderdetailsInfo c0 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
-      LexSummonsCreatController.ConsumableorderdetailsInfo c1 = new LexSummonsCreatController.ConsumableorderdetailsInfo(
-        coc
+      LexSummonsCreatController.save(
+        createIdSend,
+        'Test',
+        'Test',
+        'Test',
+        pageRecordsLwc,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
       );
-      c1.check = true;
-      c1.oldCheck = true;
-      c1.orderdetails1 = coc;
-      c1.orderdetails2 = null;
-      c1.Prod = coc.Consumable_Product__r;
-      c1.oldConsumableCount = coc.Shipment_Count__c;
-      c1.canSelect = true;
-      c1.allnumber = 0;
-      c1.Boxnumber = 0;
-      c1.Piecenumber = 0;
-      c1.BoxPiece = coc.Box_Piece__c;
-      c1.hospitalSpecialOffer = false;
-      c1.hosPro = false;
-      List<SelectOption> boxorpiece = new List<SelectOption>();
-      boxorpiece.add(new SelectOption('鐩�', '鐩�'));
-      boxorpiece.add(new SelectOption('涓�', '涓�'));
-      Map<String, String> boxorpieceMap = new Map<String, String>();
-      boxorpieceMap.put('鐩�', '鐩�');
-      boxorpieceMap.put('涓�', '涓�');
-      LexSummonsCreatController.ConsumableorderdetailsInfo c2 = new LexSummonsCreatController.ConsumableorderdetailsInfo(
-        proH
+      LexSummonsCreatController.save(
+        createIdSend1,
+        'Test',
+        'Test',
+        'Test',
+        pageRecordsLwc,
+        accountId,
+        createIdSend1.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
       );
-      c2.sortBy = true;
-      c2.Boxnumber = 20;
-      c1.compareTo(c2);
-      c1.Boxnumber = 20;
-      c2.Boxnumber = 10;
-      c1.compareTo(c2);
-      c1.Boxnumber = 10;
-      c2.Boxnumber = 20;
-      c2.compareTo(c1);
-      c1.Boxnumber = 20;
-      c2.Boxnumber = 10;
-      c2.compareTo(c1);
-      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c3 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      LexSummonsCreatController.save(
+        createIdSend2,
+        '',
+        '',
+        '',
+        pageRecordsLwc,
+        accountId,
+        createIdSend2.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecordsList,
+        accountId,
+        null,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.searchConsumableorderdetails(
+        agencyProType,
+        accountName,
+        userWorkLocation,
+        'ishos',
+        'Test07',
+        'Test7',
+        'Test77',
+        'Test777',
+        true,
+        pageRecordsLwc,
+        consumable,
+        '',
+        1,
+        100
+      );
+      LexSummonsCreatController.ConsumableorderdetailsInfo con = new LexSummonsCreatController.ConsumableorderdetailsInfo(
+        attach
+      );
+      con.concc = attach;
+      con.hospitalSpecialOffer = false;
+      con.hosPro = false;
+      System.Test.stopTest();
     }
-    System.Test.stopTest();
   }
+
+  @isTest
+  static void testSave1() {
+    Account accountItem1;
+    Account accountItem2;
+    User userTest;
+    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('Agency')
+      .getRecordTypeId();
+    String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('HP')
+      .getRecordTypeId();
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    accountItem1 = new Account(
+      Name = 'Testaccount001',
+      RecordTypeId = rectCo,
+      AgentCode_Ext__c = '9999900',
+      Contract_Decide_Start_Date__c = Date.today(),
+      ENG_Dealer__c = true
+    );
+    insert accountItem1;
+    accountItem2 = new Account(
+      Name = 'Testaccount002',
+      RecordTypeId = rectHp,
+      AgentCode_Ext__c = '9999999',
+      ParentId = accountItem1.Id
+    );
+    insert accountItem2;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountId = accountItem1.Id
+    );
+    insert core;
+    System.runAs(new user(ID = UserInfo.getUserID())) {
+      userTest = new User(
+        ContactId = core.id,
+        Alias = 'newUser',
+        Email = 'newuser@testorg.com',
+        EmailEncodingKey = 'UTF-8',
+        LastName = 'TestUser',
+        LanguageLocaleKey = 'zh_CN',
+        LocaleSidKey = 'zh_CN',
+        ProfileId = prof.Id,
+        TimeZoneSidKey = 'Asia/Shanghai',
+        UserName = 'testUser@testorg.com',
+        UserPro_Type__c = 'ENG',
+        Work_Location__c = '鍖椾含'
+      );
+      insert userTest;
+    }
+    System.runAs(userTest) {
+      String userId = UserInfo.getUserId();
+      User thisUserInfo = [
+        SELECT
+          accountid,
+          UserPro_Type__c,
+          ContactId,
+          Contact.AccountId,
+          Contact.Account.Name,
+          Work_Location__c
+        FROM User
+        WHERE id = :userId
+      ];
+      String accountId = thisUserInfo.accountid;
+      String accountName = thisUserInfo.Contact.Account.Name;
+      String agencyProType = thisUserInfo.UserPro_Type__c;
+      String userWorkLocation = thisUserInfo.Work_Location__c;
+      thisUserInfo.UserPro_Type__c = '';
+      update thisUserInfo;
+      if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+        agencyProType = 'ET';
+      }
+      Product2 prod07 = new Product2(
+        Name = 'Test07',
+        ProductCode = 'Test07',
+        Asset_Model_No__c = 'Test07',
+        Category3__c = 'Test7',
+        Category4__c = 'Test77',
+        Category5__c = 'Test777',
+        SFDA_Status__c = '鏈夊姽',
+        Dealer_special_Object__c = true,
+        Packing_list_manual__c = 1,
+        Manual_Entry__c = false
+      );
+      insert new List<Product2>{ prod07 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'MH-155:鐧藉钩琛″附',
+        OT_CODE_Text__c = 'Test001',
+        Product2__c = prod07.Id,
+        Category3_text__c = 'test123',
+        Category4_text__c = 'test123',
+        Category5_text__c = 'test123'
+      );
+      insert new List<Product2__c>{ pro1 };
+
+      Consumable_order__c createIdSend = new Consumable_order__c();
+      createIdSend.Name = 'testMing1';
+      createIdSend.Order_status__c = '鎵瑰噯';
+      createIdSend.Deliver_date__c = Date.today();
+      createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend.Order_type__c = '璁㈠崟';
+      createIdSend.Order_ProType__c = 'ENG';
+      createIdSend.SummonsForDirction__c = '浜掔浉璋冭揣';
+      createIdSend.Order_ForDealerText__c = '';
+      createIdSend.Order_ForCustomerText__c = '';
+      createIdSend.SummonsStatus_c__c = '';
+      createIdSend.Dealer_Info__c = accountItem1.Id;
+      createIdSend.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend1 = new Consumable_order__c();
+      createIdSend1.Name = 'testMing1';
+      createIdSend1.Order_status__c = '鎵瑰噯';
+      createIdSend1.Deliver_date__c = Date.today();
+      createIdSend1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend1.Order_type__c = '璁㈠崟';
+      createIdSend1.Order_ProType__c = 'ENG';
+      createIdSend1.SummonsForDirction__c = '浜掔浉璋冭揣';
+      createIdSend1.Order_ForDealerText__c = '';
+      createIdSend1.Order_ForCustomerText__c = '';
+      createIdSend1.SummonsStatus_c__c = '';
+      createIdSend1.Arrive_Order__c = createIdSend.Id;
+      createIdSend1.Order_ForDealerTextID__c = accountItem1.Id;
+      createIdSend1.Dealer_Info__c = accountItem1.Id;
+      createIdSend1.Delivery_detail_count__c = 5;
+      insert new List<Consumable_order__c>{ createIdSend, createIdSend1 };
+
+      Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+      coc.Name = 'Too001';
+      coc.Dealer_Custom_Price__c = 999.00;
+      coc.Consumable_count__c = 3;
+      coc.Consumable_product__c = pro1.Id;
+      coc.Box_Piece__c = '鐩�';
+      coc.isOutPattern__c = true;
+      coc.Consumable_order__c = createIdSend.Id;
+      coc.Unitprice_To_agency__c = 999.00;
+      coc.Delivery_List_RMB__c = 999.00;
+      coc.Shipment_Count__c = null;
+      coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+      coc1.Name = 'Too001';
+      coc1.Dealer_Custom_Price__c = 999.00;
+      coc1.Consumable_count__c = 3;
+      coc1.Consumable_product__c = pro1.Id;
+      coc1.Box_Piece__c = '鐩�';
+      coc1.isOutPattern__c = true;
+      coc1.Consumable_order__c = createIdSend.Id;
+      coc1.Unitprice_To_agency__c = 999.00;
+      coc1.Delivery_List_RMB__c = null;
+      coc1.Shipment_Count__c = 10000;
+      coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      insert new List<Consumable_orderdetails__c>{ coc, coc1 };
+
+      Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+      conOrderDetail1.Name = 'OCM_01_001001';
+      conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+      conOrderDetail1.Consumable_Product__c = pro1.Id;
+      conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      conOrderDetail1.Bar_Code__c = '11111';
+      conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+      conOrderDetail1.Send_Date__c = null;
+      conOrderDetail1.Used_date__c = null;
+      conOrderDetail1.Return_date__c = null;
+      conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+      conOrderDetail1.Lose_Flag__c = false;
+      conOrderDetail1.Box_Piece__c = '鐩�';
+      insert new List<Consumable_order_details2__c>{ conOrderDetail1 };
+
+      hospitalprice__c hp1 = new hospitalprice__c();
+      hp1.hospital__c = accountId;
+      hp1.account__c = accountId;
+      hp1.product__c = pro1.Id;
+      insert new List<hospitalprice__c>{ hp1 };
+
+      Integer size = Integer.valueOf(System.Label.orderdetLimitsize);
+      String ESetId = createIdSend.Id;
+      String statusEdit = 'Test';
+      String arrive = createIdSend.Id;
+
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecordsLwc = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c7 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c7.check = true;
+      c7.oldCheck = true;
+      c7.hospitalSpecialOffer = true;
+      c7.orderdetails1 = coc;
+      c7.orderdetails2 = conOrderDetail1;
+      c7.Prod = pro1;
+      c7.Boxnumber = 0.00;
+      c7.Piecenumber = 0.00;
+      c7.allnumber = 1999.00;
+      c7.oldConsumableCount = 1999.00;
+      c7.canSelect = true;
+      c7.sortBy = true;
+      c7.packinglist = 1;
+      c7.approbation_No = '';
+      c7.expiration_Date = Date.Today();
+      c7.boxorpiecein = '';
+      c7.boxorpiece = null;
+      c7.boxorpieceMap = null;
+      c7.concc = null;
+      c7.BoxPiece = null;
+      c7.hosPro = true;
+      pageRecordsLwc.add(c7);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c8 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c8.check = true;
+      c8.oldCheck = true;
+      c8.hospitalSpecialOffer = true;
+      c8.orderdetails1 = coc1;
+      c8.orderdetails2 = conOrderDetail1;
+      c8.Prod = null;
+      c8.Boxnumber = 0.00;
+      c8.Piecenumber = 0.00;
+      c8.allnumber = 1999.00;
+      c8.oldConsumableCount = 1999.00;
+      c8.canSelect = true;
+      c8.sortBy = true;
+      c8.packinglist = 1;
+      c8.approbation_No = '';
+      c8.expiration_Date = Date.Today();
+      c8.boxorpiecein = '';
+      c8.boxorpiece = null;
+      c8.boxorpieceMap = null;
+      c8.concc = null;
+      c8.BoxPiece = null;
+      c8.hosPro = true;
+      pageRecords1.add(c8);
+
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi.check = true;
+      codi.oldCheck = true;
+      codi.hospitalSpecialOffer = true;
+      codi.packinglist = 0;
+      codi.approbation_No = null;
+      codi.expiration_Date = Date.Today();
+      codi.boxorpiecein = null;
+      codi.orderdetails1 = coc;
+      codi.Prod = pro1;
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi1 = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi1.check = false;
+      codi1.oldCheck = true;
+      codi1.hospitalSpecialOffer = false;
+      codi1.packinglist = 0;
+      codi1.approbation_No = null;
+      codi1.expiration_Date = Date.Today();
+      codi1.boxorpiecein = null;
+      codi1.orderdetails1 = coc;
+      codi1.Prod = pro1;
+      consumable.add(codi);
+      System.Test.startTest();
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecordsLwc,
+        accountId,
+        createIdSend.Id,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend1,
+        '',
+        '',
+        '',
+        pageRecordsLwc,
+        accountId,
+        null,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      LexSummonsCreatController.save(
+        createIdSend,
+        '',
+        '',
+        '',
+        pageRecords1,
+        accountId,
+        null,
+        consumable,
+        agencyProType,
+        userWorkLocation
+      );
+      System.Test.stopTest();
+    }
+  }
+
   static testMethod void testInnerClass() {
-    System.Test.startTest();
-    List<LexSummonsCreatController.ConsumableorderdetailsInfo> cro = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
-    cro.sort();
-    System.Test.stopTest();
+    Account accountItem1;
+    Account accountItem2;
+    User userTest;
+    String rectCo = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('Agency')
+      .getRecordTypeId();
+    String rectHp = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName()
+      .get('HP')
+      .getRecordTypeId();
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    accountItem1 = new Account(
+      Name = 'Testaccount001',
+      RecordTypeId = rectCo,
+      AgentCode_Ext__c = '9999900'
+    );
+    insert accountItem1;
+    accountItem2 = new Account(
+      Name = 'Testaccount002',
+      RecordTypeId = rectHp,
+      AgentCode_Ext__c = '9999999',
+      ParentId = accountItem1.Id,
+      Contract_Decide_Start_Date__c = Date.today(),
+      ENG_Dealer__c = true,
+      BillingCity = null
+    );
+    insert accountItem2;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountId = accountItem1.Id
+    );
+    insert core;
+    System.runAs(new user(ID = UserInfo.getUserID())) {
+      userTest = new User(
+        ContactId = core.id,
+        Alias = 'newUser',
+        Email = 'newuser@testorg.com',
+        EmailEncodingKey = 'UTF-8',
+        LastName = 'TestUser',
+        LanguageLocaleKey = 'zh_CN',
+        LocaleSidKey = 'zh_CN',
+        ProfileId = prof.Id,
+        TimeZoneSidKey = 'Asia/Shanghai',
+        UserName = 'testUser@testorg.com',
+        UserPro_Type__c = 'ENG',
+        Work_Location__c = '鍖椾含'
+      );
+      insert userTest;
+    }
+    System.runAs(userTest) {
+      String userId = UserInfo.getUserId();
+      User thisUserInfo = [
+        SELECT
+          accountid,
+          UserPro_Type__c,
+          ContactId,
+          Contact.AccountId,
+          Contact.Account.Name,
+          Work_Location__c
+        FROM User
+        WHERE id = :userId
+      ];
+      String accountId = thisUserInfo.accountid;
+      String accountName = thisUserInfo.Contact.Account.Name;
+      String agencyProType = thisUserInfo.UserPro_Type__c;
+      String userWorkLocation = thisUserInfo.Work_Location__c;
+      thisUserInfo.UserPro_Type__c = '';
+      update thisUserInfo;
+      if (String.isBlank(thisUserInfo.UserPro_Type__c)) {
+        agencyProType = 'ET';
+      }
+      Product2 prod07 = new Product2(
+        Name = 'Test07',
+        ProductCode = 'Test07',
+        Asset_Model_No__c = 'Test07',
+        ProductCode_Ext__c = 'Test07',
+        Category3__c = 'Test7',
+        Category4__c = 'Test77',
+        Category5__c = 'Test777',
+        SFDA_Status__c = '鏈夊姽',
+        Dealer_special_Object__c = true,
+        Packing_list_manual__c = 1,
+        Manual_Entry__c = false
+      );
+      insert new List<Product2>{ prod07 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'MH-155:鐧藉钩琛″附',
+        OT_CODE_Text__c = 'Test001',
+        Product2__c = prod07.Id,
+        Category3_text__c = 'test123',
+        Category4_text__c = 'test123',
+        Category5_text__c = 'test123'
+      );
+      insert new List<Product2__c>{ pro1 };
+      Consumable_order__c createIdSend = new Consumable_order__c();
+      createIdSend.Name = 'testMing1';
+      createIdSend.Order_status__c = '鎵瑰噯';
+      createIdSend.Deliver_date__c = Date.today();
+      createIdSend.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend.Order_type__c = '璁㈠崟';
+      createIdSend.Order_ProType__c = 'ENG';
+      createIdSend.SummonsForDirction__c = '娴嬭瘯0001';
+      createIdSend.Order_ForDealerText__c = 'Testaccount003';
+      createIdSend.Order_ForCustomerText__c = 'Test000';
+      createIdSend.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend.orderPattern__c = 'hospitalorder';
+      createIdSend.Dealer_Info__c = accountItem1.Id;
+      createIdSend.Delivery_detail_count__c = 5;
+
+      Consumable_order__c createIdSend3 = new Consumable_order__c();
+      createIdSend3.Name = 'testMing123456';
+      createIdSend3.Order_status__c = '鎵瑰噯';
+      createIdSend3.Deliver_date__c = Date.today();
+      createIdSend3.Arrive_Order__c = createIdSend.Id;
+      createIdSend3.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      createIdSend3.Order_type__c = '璁㈠崟';
+      createIdSend3.Order_ProType__c = 'ENG';
+      createIdSend3.SummonsForDirction__c = '浜掔浉璋冭揣';
+      createIdSend3.Order_ForDealerText__c = '';
+      createIdSend3.Order_ForCustomerText__c = 'Test001';
+      createIdSend3.SummonsStatus_c__c = '鎵瑰噯';
+      createIdSend3.Dealer_Info__c = accountItem1.Id;
+      createIdSend3.Delivery_detail_count__c = 5;
+      //鍒拌揣
+      Consumable_order__c createIdArrived = new Consumable_order__c();
+      createIdArrived.Name = 'testMing2';
+      createIdArrived.Order_status__c = '鎵瑰噯';
+      createIdArrived.Deliver_date__c = Date.today();
+      createIdArrived.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+      createIdArrived.Order_type__c = '璁㈠崟';
+      createIdArrived.Order_ProType__c = 'ET';
+      createIdArrived.Arrive_Order__c = createIdSend.Id;
+      createIdArrived.SummonsStatus_c__c = '宸叉彁浜�';
+      createIdArrived.orderPattern__c = 'promotionorder';
+      createIdArrived.Dealer_Info__c = accountItem1.Id;
+      createIdArrived.Delivery_detail_count__c = 5;
+      insert new List<Consumable_order__c>{
+        createIdSend,
+        createIdSend3,
+        createIdArrived
+      };
+
+      Consumable_orderdetails__c coc = new Consumable_orderdetails__c();
+      coc.Name = 'Too001';
+      coc.Dealer_Custom_Price__c = 999.00;
+      coc.Consumable_count__c = 3;
+      coc.Consumable_product__c = pro1.Id;
+      coc.Box_Piece__c = '鐩�';
+      coc.isOutPattern__c = true;
+      coc.Consumable_order__c = createIdSend.Id;
+      coc.Unitprice_To_agency__c = 999.00;
+      coc.Delivery_List_RMB__c = -999.00;
+      coc.Shipment_Count__c = 9999.00;
+      coc.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+
+      Consumable_orderdetails__c coc1 = new Consumable_orderdetails__c();
+      coc1.Name = 'Too001';
+      coc1.Dealer_Custom_Price__c = 999.00;
+      coc1.Consumable_count__c = 3;
+      coc1.Consumable_product__c = pro1.Id;
+      coc1.Box_Piece__c = '鐩�';
+      coc1.isOutPattern__c = true;
+      coc1.Consumable_order__c = createIdSend3.Id;
+      coc1.Unitprice_To_agency__c = 999.00;
+      coc1.Delivery_List_RMB__c = 999.00;
+      coc1.Shipment_Count__c = 9999.00;
+      coc1.RecordTypeid = System.Label.RT_ConOrderDetail1_Order;
+      insert new List<Consumable_orderdetails__c>{ coc, coc1 };
+
+      Consumable_order_details2__c conOrderDetail1 = new Consumable_order_details2__c();
+      conOrderDetail1.Name = 'OCM_01_001001';
+      conOrderDetail1.Consumable_ZS_order__c = createIdSend.Id;
+      conOrderDetail1.Consumable_Product__c = pro1.Id;
+      conOrderDetail1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      conOrderDetail1.Bar_Code__c = '11111';
+      conOrderDetail1.Arrive_date__c = Date.today().addDays(1);
+      conOrderDetail1.Send_Date__c = null;
+      conOrderDetail1.Used_date__c = null;
+      conOrderDetail1.Return_date__c = null;
+      conOrderDetail1.Consumable_Arrived_order__c = createIdSend.Id;
+      conOrderDetail1.Consumable_order_minor__c = createIdSend.Id;
+      conOrderDetail1.Lose_Flag__c = false;
+      conOrderDetail1.Cancellation_Flag__c = false;
+      conOrderDetail1.exchangeOutPattern__c = true;
+      conOrderDetail1.Box_Piece__c = '鐩�';
+      conOrderDetail1.Sterilization_limit__c = Date.Today();
+
+      Consumable_order_details2__c conOrderDetail2 = new Consumable_order_details2__c();
+      conOrderDetail2.Name = 'OCM_01_001002';
+      conOrderDetail2.Consumable_ZS_order__c = createIdArrived.Id;
+      conOrderDetail2.Consumable_Product__c = pro1.Id;
+      conOrderDetail2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      conOrderDetail2.Bar_Code__c = '22222';
+      conOrderDetail2.Arrive_date__c = Date.today().addDays(1);
+      conOrderDetail2.Send_Date__c = null;
+      conOrderDetail2.Used_date__c = null;
+      conOrderDetail2.Return_date__c = null;
+      conOrderDetail2.Consumable_Arrived_order__c = createIdArrived.Id;
+      conOrderDetail2.Consumable_order_minor__c = createIdArrived.Id;
+      conOrderDetail2.Lose_Flag__c = false;
+      conOrderDetail2.exchangeOutPattern__c = false;
+      conOrderDetail2.Cancellation_Flag__c = false;
+      conOrderDetail2.Box_Piece__c = '涓�';
+      conOrderDetail2.Sterilization_limit__c = Date.Today();
+      insert new List<Consumable_order_details2__c>{
+        conOrderDetail1,
+        conOrderDetail2
+      };
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c6 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c6.check = true;
+      c6.oldCheck = true;
+      c6.hospitalSpecialOffer = true;
+      c6.orderdetails1 = coc1;
+      c6.orderdetails2 = conOrderDetail1;
+      c6.Prod = pro1;
+      c6.Boxnumber = 0.00;
+      c6.Piecenumber = 0.00;
+      c6.allnumber = 1999.00;
+      c6.oldConsumableCount = 1999.00;
+      c6.canSelect = true;
+      c6.sortBy = true;
+      c6.packinglist = 1;
+      c6.approbation_No = '';
+      c6.expiration_Date = Date.Today();
+      c6.boxorpiecein = '';
+      c6.boxorpiece = null;
+      c6.boxorpieceMap = null;
+      c6.concc = null;
+      c6.BoxPiece = null;
+      c6.hosPro = true;
+      pageRecords.add(c6);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pageRecords1 = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc c111 = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      c111.check = true;
+      c111.oldCheck = true;
+      c111.hospitalSpecialOffer = false;
+      c111.orderdetails1 = coc1;
+      c111.orderdetails2 = conOrderDetail1;
+      c111.Prod = pro1;
+      c111.Boxnumber = 0.00;
+      c111.Piecenumber = 0.00;
+      c111.allnumber = 1999.00;
+      c111.oldConsumableCount = 1999.00;
+      c111.canSelect = true;
+      c111.sortBy = true;
+      c111.packinglist = 1;
+      c111.approbation_No = '';
+      c111.expiration_Date = Date.Today();
+      c111.boxorpiecein = '';
+      c111.boxorpiece = null;
+      c111.boxorpieceMap = null;
+      c111.concc = null;
+      c111.BoxPiece = null;
+      c111.hosPro = true;
+      pageRecords1.add(c111);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi.check = true;
+      codi.hospitalSpecialOffer = true;
+      codi.packinglist = 0;
+      codi.approbation_No = null;
+      codi.expiration_Date = Date.Today();
+      codi.boxorpiecein = null;
+      codi.orderdetails1 = coc;
+      codi.Prod = pro1;
+      consumable.add(codi);
+      System.Test.startTest();
+      LexSummonsCreatController.init(null, 'Test', 1, 100, createIdArrived.Id);
+      LexSummonsCreatController.init(null, 'Test', 1, 100, null);
+      LexSummonsCreatController.init(null, null, 1, 100, createIdArrived.Id);
+      LexSummonsCreatController.categoryAllload('Test7');
+      LexSummonsCreatController.categoryload('Test7', 'Test77');
+      LexSummonsCreatController.searchConsumableorderdetails(
+        'ET',
+        'Testaccount001',
+        '鍖椾含',
+        'ishos',
+        'Test07',
+        'Test7',
+        'Test77',
+        'Test777',
+        true,
+        pageRecords,
+        consumable,
+        '',
+        1,
+        1
+      );
+      LexSummonsCreatController.searchConsumableorderdetails(
+        'ET',
+        'Testaccount001',
+        '鍖椾含',
+        'nothos',
+        'Test07',
+        'Test7',
+        'Test77',
+        'Test777',
+        true,
+        pageRecords,
+        consumable,
+        '',
+        1,
+        1
+      );
+      LexSummonsCreatController.searchConsumableorderdetails(
+        'ET',
+        'Testaccount001',
+        '鍖椾含',
+        'ishos',
+        'Test07',
+        'Test7',
+        'Test77',
+        'Test777',
+        true,
+        pageRecords1,
+        consumable,
+        '',
+        1,
+        1
+      );
+      LexSummonsCreatController.searchConsumableorderdetails(
+        'ET',
+        'Testaccount001',
+        '鍖椾含',
+        'nothos',
+        'Test07',
+        'Test7',
+        'Test77',
+        'Test777',
+        true,
+        pageRecords1,
+        consumable,
+        '',
+        1,
+        1
+      );
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> cro = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      cro.sort();
+      System.Test.stopTest();
+    }
+  }
+
+  @isTest
+  static void saveMethodTest1() {
+    List<RecordType> rectCo = [
+      SELECT Id
+      FROM RecordType
+      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
+    ];
+    if (rectCo.size() == 0) {
+      return;
+    }
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    RecordType rectCoO = [
+      SELECT Id
+      FROM RecordType
+      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
+    ];
+    Account myAccount2 = new Account(
+      RecordTypeId = rectCoO.Id,
+      AgentCode_Ext__c = '9999900',
+      Name = 'olympus'
+    );
+    Account myAccount1 = new Account(
+      name = 'Testaccount001',
+      Dealer_discount__c = 30,
+      RecordTypeId = rectCo[0].Id
+    );
+    insert new List<account>{ myAccount1, myAccount2 };
+    hospitalprice__c hp1 = new hospitalprice__c();
+    hp1.hospital__c = myAccount2.Id;
+    hp1.account__c = myAccount1.Id;
+    insert hp1;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountid = myAccount1.id
+    );
+    insert core;
+    user MyUser_Test = new User(
+      ContactId = core.id,
+      Alias = 'newUser',
+      Email = 'newuser@testorg.com',
+      EmailEncodingKey = 'UTF-8',
+      LastName = 'TestUser',
+      LanguageLocaleKey = 'zh_CN',
+      LocaleSidKey = 'zh_CN',
+      ProfileId = prof.Id,
+      TimeZoneSidKey = 'Asia/Shanghai',
+      UserName = 'testUser@testorg.com',
+      UserPro_Type__c = 'ET',
+      Work_Location__c = '鍖椾含'
+    );
+    System.runAs(new User(Id = UserInfo.getUserId())) {
+      insert MyUser_Test;
+    }
+
+    System.runAs(MyUser_Test) {
+      Product2 prod01 = new Product2(
+        Name = 'Test01',
+        ProductCode = 'Test01',
+        Asset_Model_No__c = 'Test01',
+        SFDA_Status__c = '鏈夊姽',
+        JANCODE__c = '04953170200311',
+        Dealer_special_Object__c = true,
+        Manual_Entry__c = false
+      );
+      Product2 prod02 = new Product2(
+        Name = 'Test02',
+        ProductCode = 'Test02',
+        Asset_Model_No__c = 'Test02',
+        SFDA_Status__c = '鏈夊姽',
+        JANCODE__c = '04953170200312',
+        Dealer_special_Object__c = true,
+        Manual_Entry__c = false
+      );
+      insert new List<Product2>{ prod01, prod02 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'Pro001',
+        OT_CODE_Text__c = 'N3047730',
+        Product2__c = prod01.Id
+      );
+      Product2__c pro2 = new Product2__c(
+        Name = 'Pro002',
+        OT_CODE_Text__c = 'N3047731',
+        Product2__c = prod02.Id
+      );
+      insert new List<Product2__c>{ pro1, pro2 };
+
+      Consumable_order__c Order0 = new Consumable_order__c();
+      Order0.Name = 'OCM_01_000';
+      Order0.Order_status__c = '鎵瑰噯';
+      Order0.Order_type__c = '璁㈠崟';
+      Order0.Dealer_Info__c = myAccount1.id;
+      Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      Order0.Order_ProType__c = 'ET';
+      insert Order0;
+
+      Consumable_order__c Order1 = new Consumable_order__c();
+      Order1.Name = 'OCM_01_001';
+      Order1.Order_status__c = '鎵瑰噯';
+      Order1.Order_type__c = '璁㈠崟';
+      Order1.Dealer_Info__c = myAccount1.id;
+      Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      Order1.Order_ProType__c = 'ET';
+      Order1.OutPattern__c = true;
+      Order1.Arrive_Order__c = Order0.Id;
+      insert Order1;
+      Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+      Orderdet.Name = 'OCM_01_00101';
+      Orderdet.Consumable_order__c = Order1.Id;
+      Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+      Orderdet.Consumable_Product__c = pro1.Id;
+      Orderdet.Consumable_count__c = 4;
+      Orderdet.Shipment_Count__c = 10;
+      Orderdet.isOutPattern__c = true;
+      Orderdet.Delivery_List_RMB__c = 100;
+      Orderdet.Box_Piece__c = '鐩�';
+      insert Orderdet;
+      Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+      Orderdet1.Name = 'OCM_01_001001';
+      Orderdet1.Consumable_order_minor__c = Order1.Id;
+      Orderdet1.Consumable_Product__c = pro1.Id;
+      Orderdet1.Asset_Model_No__c = 'Test01';
+      Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+      Orderdet1.Cancellation_Date__c = null;
+      Orderdet1.TracingCode__c = 'BXJRF';
+      Orderdet1.SerialLotNo__c = '5ZK';
+      Orderdet1.Arrive_date__c = Date.today();
+      Orderdet1.exchangeOutPattern__c = true;
+      Orderdet1.Consumable_ZS_order__c = Order1.Id;
+      Orderdet1.Box_Piece__c = '鐩�';
+      insert Orderdet1;
+      System.Test.startTest();
+      LexSummonsCreatController.init(Order1.Id, 'edit', 10, 1, '');
+      List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc> pList = new List<LexSummonsCreatController.ConsumableorderdetailsInfoLwc>();
+      LexSummonsCreatController.ConsumableorderdetailsInfoLwc p = new LexSummonsCreatController.ConsumableorderdetailsInfoLwc();
+      p.check = true;
+      p.oldcheck = true;
+      p.hospitalSpecialOffer = true;
+      p.orderdetails1 = Orderdet;
+      p.orderdetails2 = Orderdet1;
+      p.Prod = pro1;
+      p.Boxnumber = 2;
+      p.Piecenumber = 2;
+      pList.add(p);
+      List<LexSummonsCreatController.ConsumableorderdetailsInfo> consumable = new List<LexSummonsCreatController.ConsumableorderdetailsInfo>();
+      LexSummonsCreatController.ConsumableorderdetailsInfo codi = new LexSummonsCreatController.ConsumableorderdetailsInfo();
+      codi.check = true;
+      codi.hospitalSpecialOffer = true;
+      codi.packinglist = 0;
+      codi.approbation_No = null;
+      codi.expiration_Date = Date.Today();
+      codi.boxorpiecein = null;
+      codi.orderdetails1 = Orderdet;
+      codi.orderdetails2 = Orderdet1;
+      codi.Prod = pro1;
+      consumable.add(codi);
+      LexSummonsCreatController.coc.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+      LexSummonsCreatController.coc.Order_ForCustomerText__c = '娑堝寲绉�';
+      LexSummonsCreatController.save(
+        LexSummonsCreatController.coc,
+        myAccount2.Id,
+        myAccount2.Name,
+        '',
+        pList,
+        myAccount1.Id,
+        '',
+        consumable,
+        'ET',
+        ''
+      );
+      Orderdet.Box_Piece__c = '涓�';
+      LexSummonsCreatController.save(
+        LexSummonsCreatController.coc,
+        myAccount2.Id,
+        myAccount2.Name,
+        '',
+        pList,
+        myAccount1.Id,
+        '',
+        consumable,
+        'ET',
+        ''
+      );
+      p.Piecenumber = 20;
+      LexSummonsCreatController.save(
+        LexSummonsCreatController.coc,
+        myAccount2.Id,
+        myAccount2.Name,
+        '',
+        pList,
+        myAccount1.Id,
+        '',
+        consumable,
+        'ET',
+        ''
+      );
+      System.Test.stopTest();
+    }
+  }
+
+  @isTest
+  static void initMethodTest1() {
+    List<RecordType> rectCo = [
+      SELECT Id
+      FROM RecordType
+      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
+    ];
+    if (rectCo.size() == 0) {
+      return;
+    }
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    RecordType rectCoO = [
+      SELECT Id
+      FROM RecordType
+      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
+    ];
+    Account myAccount2 = new Account(
+      RecordTypeId = rectCoO.Id,
+      AgentCode_Ext__c = '9999900',
+      Name = 'olympus'
+    );
+    Account myAccount1 = new Account(
+      name = 'Testaccount001',
+      Dealer_discount__c = 30,
+      RecordTypeId = rectCo[0].Id
+    );
+    insert new List<account>{ myAccount1, myAccount2 };
+    hospitalprice__c hp1 = new hospitalprice__c();
+    hp1.hospital__c = myAccount2.Id;
+    hp1.account__c = myAccount1.Id;
+    insert hp1;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountid = myAccount1.id
+    );
+    insert core;
+    user MyUser_Test = new User(
+      ContactId = core.id,
+      Alias = 'newUser',
+      Email = 'newuser@testorg.com',
+      EmailEncodingKey = 'UTF-8',
+      LastName = 'TestUser',
+      LanguageLocaleKey = 'zh_CN',
+      LocaleSidKey = 'zh_CN',
+      ProfileId = prof.Id,
+      TimeZoneSidKey = 'Asia/Shanghai',
+      UserName = 'testUser@testorg.com',
+      UserPro_Type__c = 'ET',
+      Work_Location__c = '鍖椾含'
+    );
+    System.runAs(new User(Id = UserInfo.getUserId())) {
+      insert MyUser_Test;
+    }
+
+    System.runAs(MyUser_Test) {
+      Product2 prod01 = new Product2(
+        Name = 'Test01',
+        ProductCode = 'Test01',
+        Asset_Model_No__c = 'Test01',
+        SFDA_Status__c = '鏈夊姽',
+        JANCODE__c = '04953170200311',
+        Dealer_special_Object__c = true,
+        Manual_Entry__c = false
+      );
+      Product2 prod02 = new Product2(
+        Name = 'Test02',
+        ProductCode = 'Test02',
+        Asset_Model_No__c = 'Test02',
+        SFDA_Status__c = '鏈夊姽',
+        JANCODE__c = '04953170200312',
+        Dealer_special_Object__c = true,
+        Manual_Entry__c = false
+      );
+      insert new List<Product2>{ prod01, prod02 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'Pro001',
+        OT_CODE_Text__c = 'N3047730',
+        Product2__c = prod01.Id
+      );
+      Product2__c pro2 = new Product2__c(
+        Name = 'Pro002',
+        OT_CODE_Text__c = 'N3047731',
+        Product2__c = prod02.Id
+      );
+      insert new List<Product2__c>{ pro1, pro2 };
+
+      Consumable_order__c Order0 = new Consumable_order__c();
+      Order0.Name = 'OCM_01_000';
+      Order0.Order_status__c = '鎵瑰噯';
+      Order0.Order_type__c = '璁㈠崟';
+      Order0.Dealer_Info__c = myAccount1.id;
+      Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      Order0.Order_ProType__c = 'ET';
+      insert Order0;
+
+      Consumable_order__c Order1 = new Consumable_order__c();
+      Order1.Name = 'OCM_01_001';
+      Order1.Order_status__c = '鎵瑰噯';
+      Order1.Order_type__c = '浼犵エ';
+      Order1.Dealer_Info__c = myAccount1.id;
+      Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      Order1.Order_ProType__c = 'ET';
+      Order1.OutPattern__c = true;
+      Order1.Arrive_Order__c = Order0.Id;
+      Order1.SummonsStatus_c__c = '宸叉彁浜�';
+      Order1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+      insert Order1;
+      Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+      Orderdet.Name = 'OCM_01_00101';
+      Orderdet.Consumable_order__c = Order1.Id;
+      Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+      Orderdet.Consumable_Product__c = pro1.Id;
+      Orderdet.Consumable_count__c = 4;
+      Orderdet.Shipment_Count__c = 10;
+      Orderdet.isOutPattern__c = true;
+      Orderdet.Delivery_List_RMB__c = 100;
+      Orderdet.Box_Piece__c = '鐩�';
+      insert Orderdet;
+      Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+      Orderdet1.Name = 'OCM_01_001001';
+      Orderdet1.Consumable_order_minor__c = Order1.Id;
+      Orderdet1.Consumable_Product__c = pro1.Id;
+      Orderdet1.Asset_Model_No__c = 'Test01';
+      Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+      Orderdet1.Cancellation_Date__c = null;
+      Orderdet1.TracingCode__c = 'BXJRF';
+      Orderdet1.SerialLotNo__c = '5ZK';
+      Orderdet1.Arrive_date__c = Date.today();
+      Orderdet1.exchangeOutPattern__c = true;
+      Orderdet1.Consumable_ZS_order__c = Order1.Id;
+      Orderdet1.Box_Piece__c = '鐩�';
+      insert Orderdet1;
+      System.Test.startTest();
+      LexSummonsCreatController.init(Order1.Id, 'edit', 10, 1, '');
+      System.Test.stopTest();
+    }
+  }
+
+  @isTest
+  static void initMethodTest2() {
+    List<RecordType> rectCo = [
+      SELECT Id
+      FROM RecordType
+      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '璨╁2搴�'
+    ];
+    if (rectCo.size() == 0) {
+      return;
+    }
+    Profile prof = [
+      SELECT Id
+      FROM Profile
+      WHERE Name = '901_缁忛攢鍟嗙ぞ鍖烘櫘閫氭潈闄恄2閲嶉獙璇�(ET)'
+    ];
+    RecordType rectCoO = [
+      SELECT Id
+      FROM RecordType
+      WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '鐥呴櫌'
+    ];
+    Account myAccount2 = new Account(
+      RecordTypeId = rectCoO.Id,
+      AgentCode_Ext__c = '9999900',
+      Name = 'olympus'
+    );
+    Account myAccount1 = new Account(
+      name = 'Testaccount001',
+      Dealer_discount__c = 30,
+      RecordTypeId = rectCo[0].Id
+    );
+    insert new List<account>{ myAccount1, myAccount2 };
+    hospitalprice__c hp1 = new hospitalprice__c();
+    hp1.hospital__c = myAccount2.Id;
+    hp1.account__c = myAccount1.Id;
+    insert hp1;
+    Contact core = new Contact(
+      email = 'jplumber@salesforce.com',
+      firstname = 'Joe',
+      lastname = 'Plumber',
+      accountid = myAccount1.id
+    );
+    insert core;
+    user MyUser_Test = new User(
+      ContactId = core.id,
+      Alias = 'newUser',
+      Email = 'newuser@testorg.com',
+      EmailEncodingKey = 'UTF-8',
+      LastName = 'TestUser',
+      LanguageLocaleKey = 'zh_CN',
+      LocaleSidKey = 'zh_CN',
+      ProfileId = prof.Id,
+      TimeZoneSidKey = 'Asia/Shanghai',
+      UserName = 'testUser@testorg.com',
+      UserPro_Type__c = 'ET'
+    );
+    System.runAs(new User(Id = UserInfo.getUserId())) {
+      insert MyUser_Test;
+    }
+
+    System.runAs(MyUser_Test) {
+      Product2 prod01 = new Product2(
+        Name = 'Test01',
+        ProductCode = 'Test01',
+        Asset_Model_No__c = 'Test01',
+        SFDA_Status__c = '鏈夊姽',
+        JANCODE__c = '04953170200311',
+        Dealer_special_Object__c = true,
+        Manual_Entry__c = false
+      );
+      Product2 prod02 = new Product2(
+        Name = 'Test02',
+        ProductCode = 'Test02',
+        Asset_Model_No__c = 'Test02',
+        SFDA_Status__c = '鏈夊姽',
+        JANCODE__c = '04953170200312',
+        Dealer_special_Object__c = true,
+        Manual_Entry__c = false
+      );
+      insert new List<Product2>{ prod01, prod02 };
+      Product2__c pro1 = new Product2__c(
+        Name = 'Pro001',
+        OT_CODE_Text__c = 'N3047730',
+        Product2__c = prod01.Id
+      );
+      Product2__c pro2 = new Product2__c(
+        Name = 'Pro002',
+        OT_CODE_Text__c = 'N3047731',
+        Product2__c = prod02.Id
+      );
+      insert new List<Product2__c>{ pro1, pro2 };
+
+      Consumable_order__c Order0 = new Consumable_order__c();
+      Order0.Name = 'OCM_01_000';
+      Order0.Order_status__c = '鎵瑰噯';
+      Order0.Order_type__c = '璁㈠崟';
+      Order0.Dealer_Info__c = myAccount1.id;
+      Order0.RecordTypeid = System.Label.RT_ConOrder_Delivery;
+      Order0.Order_ProType__c = 'ET';
+      insert Order0;
+
+      Consumable_order__c Order1 = new Consumable_order__c();
+      Order1.Name = 'OCM_01_001';
+      Order1.Order_status__c = '鎵瑰噯';
+      Order1.Order_type__c = '璁㈠崟';
+      Order1.Dealer_Info__c = myAccount1.id;
+      Order1.RecordTypeid = System.Label.RT_ConOrder_Arrive;
+      Order1.Order_ProType__c = 'ET';
+      Order1.OutPattern__c = true;
+      Order1.Arrive_Order__c = Order0.Id;
+      Order1.SummonsStatus_c__c = '宸叉彁浜�';
+      Order1.SummonsForDirction__c = '鐩存帴閿�鍞粰鍖婚櫌';
+      insert Order1;
+      Consumable_orderdetails__c Orderdet = new Consumable_orderdetails__c();
+      Orderdet.Name = 'OCM_01_00101';
+      Orderdet.Consumable_order__c = Order0.Id;
+      Orderdet.RecordTypeId = System.Label.RT_ConOrderDetail1_Order;
+      Orderdet.Consumable_Product__c = pro1.Id;
+      Orderdet.Consumable_count__c = 4;
+      Orderdet.Shipment_Count__c = 10;
+      Orderdet.isOutPattern__c = true;
+      Orderdet.Delivery_List_RMB__c = 100;
+      Orderdet.Box_Piece__c = '鐩�';
+      insert Orderdet;
+      Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
+      Orderdet1.Name = 'OCM_01_001001';
+      Orderdet1.Consumable_order_minor__c = Order1.Id;
+      Orderdet1.Consumable_Product__c = pro1.Id;
+      Orderdet1.Asset_Model_No__c = 'Test01';
+      Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
+      Orderdet1.Bar_Code__c = '01049531702003111115120017181000105ZK250BXJRF';
+      Orderdet1.Cancellation_Date__c = null;
+      Orderdet1.TracingCode__c = 'BXJRF';
+      Orderdet1.SerialLotNo__c = '5ZK';
+      Orderdet1.Arrive_date__c = Date.today();
+      Orderdet1.exchangeOutPattern__c = true;
+      Orderdet1.Consumable_ZS_order__c = Order1.Id;
+      Orderdet1.Box_Piece__c = '鐩�';
+      Orderdet1.Sterilization_limit__c = Date.today().addDays(2);
+      insert Orderdet1;
+      System.Test.startTest();
+      LexSummonsCreatController.init('', 'edit', 10, 1, Order1.Id);
+      System.Test.stopTest();
+    }
   }
 }
diff --git a/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset b/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset
new file mode 100644
index 0000000..b977872
--- /dev/null
+++ b/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset
Binary files differ
diff --git a/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml b/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml
new file mode 100644
index 0000000..e46f582
--- /dev/null
+++ b/force-app/main/default/contentassets/OlympusCommunityLoginBG.asset-meta.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ContentAsset xmlns="http://soap.sforce.com/2006/04/metadata">
+    <isVisibleByExternalUsers>true</isVisibleByExternalUsers>
+    <language>zh_CN</language>
+    <masterLabel>OlympusCommunityLoginBG</masterLabel>
+    <originNetwork>Consumable绯荤粺</originNetwork>
+    <relationships>
+        <network>
+            <access>VIEWER</access>
+            <name>Consumable绯荤粺</name>
+        </network>
+        <network>
+            <access>VIEWER</access>
+            <name>Partner Sales</name>
+        </network>
+        <workspace>
+            <access>INFERRED</access>
+            <isManagingWorkspace>true</isManagingWorkspace>
+            <name>sfdc_asset_company_assets</name>
+        </workspace>
+    </relationships>
+    <versions>
+        <version>
+            <number>1</number>
+            <pathOnClient>OlympusCommunityLoginBG.png</pathOnClient>
+        </version>
+    </versions>
+</ContentAsset>
diff --git a/force-app/main/default/contentassets/OlympusCommunityLogo.asset b/force-app/main/default/contentassets/OlympusCommunityLogo.asset
new file mode 100644
index 0000000..140b519
--- /dev/null
+++ b/force-app/main/default/contentassets/OlympusCommunityLogo.asset
Binary files differ
diff --git a/force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml b/force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml
new file mode 100644
index 0000000..2ec551c
--- /dev/null
+++ b/force-app/main/default/contentassets/OlympusCommunityLogo.asset-meta.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ContentAsset xmlns="http://soap.sforce.com/2006/04/metadata">
+    <isVisibleByExternalUsers>true</isVisibleByExternalUsers>
+    <language>zh_CN</language>
+    <masterLabel>OlympusCommunityLogo</masterLabel>
+    <originNetwork>Consumable绯荤粺</originNetwork>
+    <relationships>
+        <network>
+            <access>VIEWER</access>
+            <name>Consumable绯荤粺</name>
+        </network>
+        <network>
+            <access>VIEWER</access>
+            <name>Partner Sales</name>
+        </network>
+        <workspace>
+            <access>INFERRED</access>
+            <isManagingWorkspace>true</isManagingWorkspace>
+            <name>sfdc_asset_company_assets</name>
+        </workspace>
+    </relationships>
+    <versions>
+        <version>
+            <number>1</number>
+            <pathOnClient>OlympusCommunityLogo.png</pathOnClient>
+        </version>
+    </versions>
+</ContentAsset>
diff --git a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html
new file mode 100644
index 0000000..ce635b7
--- /dev/null
+++ b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.html
@@ -0,0 +1,10 @@
+<template>
+  <template if:false={isDisable}>
+    <lightning-formatted-url
+      value={accountUrl}
+      label={accountName}
+      target="_blank"
+    ></lightning-formatted-url>
+  </template>
+  <template if:true={isDisable}> {accountName} </template>
+</template>
diff --git a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js
new file mode 100644
index 0000000..93504a2
--- /dev/null
+++ b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js
@@ -0,0 +1,15 @@
+import { LightningElement, api } from "lwc";
+
+export default class CustomAccountUrlComp extends LightningElement {
+  @api accountName;
+  @api accountUrl;
+  @api isDisable;
+
+  connectedCallback() {
+    console.log("zhj");
+    console.log("杩涘叆CustomAccountUrlComp");
+    console.log("accountName = " + this.accountName);
+    console.log("accountUrl = " + this.accountUrl);
+    console.log("isDisable = " + this.isDisable);
+  }
+}
diff --git a/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml
new file mode 100644
index 0000000..a1a42a8
--- /dev/null
+++ b/force-app/main/default/lwc/customAccountUrlComp/customAccountUrlComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>57.0</apiVersion>
+    <isExposed>false</isExposed>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html
new file mode 100644
index 0000000..3bd017b
--- /dev/null
+++ b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.html
@@ -0,0 +1,7 @@
+<template>
+  <lightning-textarea
+    name="input1"
+    label="Enter some text"
+    variant="label-hidden"
+  ></lightning-textarea>
+</template>
diff --git a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js
new file mode 100644
index 0000000..7a8e135
--- /dev/null
+++ b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js
@@ -0,0 +1,3 @@
+import { LightningElement } from "lwc";
+
+export default class CustomDeleteReasonComp extends LightningElement {}
diff --git a/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml
new file mode 100644
index 0000000..a1a42a8
--- /dev/null
+++ b/force-app/main/default/lwc/customDeleteReasonComp/customDeleteReasonComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>57.0</apiVersion>
+    <isExposed>false</isExposed>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/customMydrComp/customMydrComp.html b/force-app/main/default/lwc/customMydrComp/customMydrComp.html
new file mode 100644
index 0000000..4ca1adf
--- /dev/null
+++ b/force-app/main/default/lwc/customMydrComp/customMydrComp.html
@@ -0,0 +1,10 @@
+<template>
+  <lightning-input
+    type="checkbox"
+    label="浠匨yDr"
+    checked={isCheckedMyDr}
+    onchange={dataChange}
+    variant="label-hidden"
+    data-field="MyDr"
+  ></lightning-input>
+</template>
diff --git a/force-app/main/default/lwc/customMydrComp/customMydrComp.js b/force-app/main/default/lwc/customMydrComp/customMydrComp.js
new file mode 100644
index 0000000..35ef793
--- /dev/null
+++ b/force-app/main/default/lwc/customMydrComp/customMydrComp.js
@@ -0,0 +1,16 @@
+import { LightningElement, track, api } from "lwc";
+
+export default class CustomMydrComp extends LightningElement {
+  @api recordId;
+  @api isCheckedMyDr;
+
+  connectedCallback() {
+    console.log("this.recordId = " + this.recordId);
+    console.log("this.isCheckedMyDr = " + this.isCheckedMyDr);
+  }
+
+  dataChange(event) {
+    this.isCheckedMyDr = event.target.checked;
+    console.log("this.isCheckedMyDr = " + this.isCheckedMyDr);
+  }
+}
diff --git a/force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml b/force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml
new file mode 100644
index 0000000..a1a42a8
--- /dev/null
+++ b/force-app/main/default/lwc/customMydrComp/customMydrComp.js-meta.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
+    <apiVersion>57.0</apiVersion>
+    <isExposed>false</isExposed>
+</LightningComponentBundle>
diff --git a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
index 0585f10..f18743e 100644
--- a/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
+++ b/force-app/main/default/lwc/lexConsumableAccount/lexConsumableAccount.js
@@ -1,865 +1,822 @@
-import { LightningElement, wire, api, track } from 'lwc';
-import { ShowToastEvent } from 'lightning/platformShowToastEvent';
-import init from '@salesforce/apex/LexConsumableAccountController.init';
-import changeFiscalYearView from '@salesforce/apex/LexConsumableAccountController.changeFiscalYearView';
-import changelistView from '@salesforce/apex/LexConsumableAccountController.changelistView';
-import accountInit from '@salesforce/apex/LexConsumableAccountInfoController.init';
+import { LightningElement, wire, api, track } from "lwc";
+import { ShowToastEvent } from "lightning/platformShowToastEvent";
+import init from "@salesforce/apex/LexConsumableAccountController.init";
+import changeFiscalYearView from "@salesforce/apex/LexConsumableAccountController.changeFiscalYearView";
+import changelistView from "@salesforce/apex/LexConsumableAccountController.changelistView";
+import accountInit from "@salesforce/apex/LexConsumableAccountInfoController.init";
 //table css
-import { loadStyle } from 'lightning/platformResourceLoader';
-import WrappedHeaderTable from '@salesforce/resourceUrl/lexdatatable';
+import { loadStyle } from "lightning/platformResourceLoader";
+import WrappedHeaderTable from "@salesforce/resourceUrl/lexdatatable";
 
 const columns = [
-    {
-        label: '瀹㈡埛鍚�',
-        fieldName: 'NameUrl',
-        hideDefaultActions: true,
-        wrapText: true,
-        initialWidth: 200,
-        sortable: true,
-        type: 'url',
-        typeAttributes: {
-            label: {
-                fieldName: 'Name'
-            },
-            target: '_blank'
-        }
-    },
-    // {
-    //     label: "鐪�",
-    //     fieldName: "StateMasterUrl",
-    //     hideDefaultActions: true,
-    //     wrapText: true,
-    //     sortable: true,
-    //     type: "url",
-    //     typeAttributes: {
-    //         label: {
-    //             fieldName: "StateMasterName",
-    //         },
-    //         target: "_blank",
-    //     },
-    // },
-    {
-        label: '鐪�',
-        fieldName: 'StateMasterName',
-        hideDefaultActions: true,
-        wrapText: true,
-        sortable: true
-    },
-    {
-        label: '閿�鍞湰閮ㄥ尰闄�',
-        fieldName: 'Salesdepartment_HP__c',
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true
-    },
-    {
-        label: '鍒涘缓鏃ユ湡',
-        fieldName: 'CreatedDate',
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true,
-        type: 'date',
-        typeAttributes: {
-            timeZone: 'Asia/Shanghai',
-            day: 'numeric',
-            month: 'numeric',
-            year: 'numeric'
-        }
-    },
-    {
-        label: '鏈夋晥/鏃犳晥',
-        fieldName: 'Is_Active__c',
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true
-    },
-    // {
-    //     label: "瀹㈡埛璁板綍绫诲瀷",
-    //     fieldName: "RecordTypeName",
-    //     hideDefaultActions: true,
-    //     sortable: true,
-    //     wrapText: true,
-    //     initialWidth: 130,
-    // },
-    {
-        label: '鏀垮簻绛夌骇',
-        fieldName: 'Grade__c',
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true
-    },
-    // {
-    //     label: "OCSM鍒嗙被(鍖婚櫌)",
-    //     fieldName: "OCM_Category__c",
-    //     hideDefaultActions: true,
-    //     sortable: true,
-    //     wrapText: true,
-    // },
-    // {
-    //     label: "甯�",
-    //     fieldName: "CityMasterNameUrl",
-    //     hideDefaultActions: true,
-    //     sortable: true,
-    //     wrapText: true,
-    //     type: "url",
-    //     typeAttributes: {
-    //         label: {
-    //             fieldName: "CityMasterName",
-    //         },
-    //         target: "_blank",
-    //     },
-    // },
-    {
-        label: '甯�',
-        fieldName: 'CityMasterName',
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true
-    },
-    {
-        label: '鍘�/鍖�',
-        fieldName: 'Town__c',
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true
-    },
-    {
-        label: '瀹㈡埛鐢佃瘽',
-        fieldName: 'Phone',
-        hideDefaultActions: true,
-        sortable: true,
-        wrapText: true
+  {
+    label: "瀹㈡埛鍚�",
+    fieldName: "NameUrl",
+    hideDefaultActions: true,
+    wrapText: true,
+    initialWidth: 200,
+    sortable: true,
+    type: "url",
+    typeAttributes: {
+      label: {
+        fieldName: "Name"
+      },
+      target: "_blank"
     }
+  },
+  // {
+  //     label: "鐪�",
+  //     fieldName: "StateMasterUrl",
+  //     hideDefaultActions: true,
+  //     wrapText: true,
+  //     sortable: true,
+  //     type: "url",
+  //     typeAttributes: {
+  //         label: {
+  //             fieldName: "StateMasterName",
+  //         },
+  //         target: "_blank",
+  //     },
+  // },
+  {
+    label: "鐪�",
+    fieldName: "StateMasterName",
+    hideDefaultActions: true,
+    wrapText: true,
+    sortable: true
+  },
+  {
+    label: "閿�鍞湰閮ㄥ尰闄�",
+    fieldName: "Salesdepartment_HP__c",
+    hideDefaultActions: true,
+    sortable: true,
+    wrapText: true
+  },
+  {
+    label: "鍒涘缓鏃ユ湡",
+    fieldName: "CreatedDate",
+    hideDefaultActions: true,
+    sortable: true,
+    wrapText: true,
+    type: "date",
+    typeAttributes: {
+      timeZone: "Asia/Shanghai",
+      day: "numeric",
+      month: "numeric",
+      year: "numeric"
+    }
+  },
+  {
+    label: "鏈夋晥/鏃犳晥",
+    fieldName: "Is_Active__c",
+    hideDefaultActions: true,
+    sortable: true,
+    wrapText: true
+  },
+  // {
+  //     label: "瀹㈡埛璁板綍绫诲瀷",
+  //     fieldName: "RecordTypeName",
+  //     hideDefaultActions: true,
+  //     sortable: true,
+  //     wrapText: true,
+  //     initialWidth: 130,
+  // },
+  {
+    label: "鏀垮簻绛夌骇",
+    fieldName: "Grade__c",
+    hideDefaultActions: true,
+    sortable: true,
+    wrapText: true
+  },
+  // {
+  //     label: "OCSM鍒嗙被(鍖婚櫌)",
+  //     fieldName: "OCM_Category__c",
+  //     hideDefaultActions: true,
+  //     sortable: true,
+  //     wrapText: true,
+  // },
+  // {
+  //     label: "甯�",
+  //     fieldName: "CityMasterNameUrl",
+  //     hideDefaultActions: true,
+  //     sortable: true,
+  //     wrapText: true,
+  //     type: "url",
+  //     typeAttributes: {
+  //         label: {
+  //             fieldName: "CityMasterName",
+  //         },
+  //         target: "_blank",
+  //     },
+  // },
+  {
+    label: "甯�",
+    fieldName: "CityMasterName",
+    hideDefaultActions: true,
+    sortable: true,
+    wrapText: true
+  },
+  {
+    label: "鍘�/鍖�",
+    fieldName: "Town__c",
+    hideDefaultActions: true,
+    sortable: true,
+    wrapText: true
+  },
+  {
+    label: "瀹㈡埛鐢佃瘽",
+    fieldName: "Phone",
+    hideDefaultActions: true,
+    sortable: true,
+    wrapText: true
+  }
 ];
 
 const topColumns = [
-    {
-        label: '瀹㈡埛鍚�',
-        hideDefaultActions: true,
-        fieldName: 'accountName',
-        wrapText: true,
-        type: 'customShowAccountUrl',
-        typeAttributes: {
-            accountName: { fieldName: 'accountName' },
-            accountUrl: { fieldName: 'accountUrl' },
-            isDisable: { fieldName: 'isDisable' }
-        }
-    },
-    // {
-    //     label: "甯�",
-    //     fieldName: "CityMasterName",
-    //     hideDefaultActions: true,
-    //     wrapText: true,
-    //     type: "customShowAccountUrl",
-    //     typeAttributes: {
-    //         accountName: { fieldName: "CityMasterName" },
-    //         accountUrl: { fieldName: "CityMasterNameUrl" },
-    //         isDisable: { fieldName: "isDisable" },
-    //     },
-    // },
-    {
-        label: '甯�',
-        fieldName: 'CityMasterName',
-        hideDefaultActions: true,
-        wrapText: true
-    },
-    {
-        label: '鍘�/鍖�',
-        fieldName: 'Town__c',
-        hideDefaultActions: true,
-        wrapText: true
-    },
-    {
-        label: '閿�閲忓崰姣�',
-        fieldName: 'proportion',
-        hideDefaultActions: true,
-        wrapText: true,
-        initialWidth: 100,
-        cellAttributes: { alignment: 'right' }
-    },
-    {
-        label: '鎿嶄綔',
-        fieldName: 'Town__c',
-        type: 'weeklyReport',
-        initialWidth: 150,
-        typeAttributes: {
-            recordId: { fieldName: 'Id' },
-            hospitalName: { fieldName: 'Name' },
-            isShowButton: { fieldName: 'isShowButton' }
-        },
-        hideDefaultActions: true
+  {
+    label: "瀹㈡埛鍚�",
+    hideDefaultActions: true,
+    fieldName: "accountName",
+    wrapText: true,
+    type: "customShowAccountUrl",
+    typeAttributes: {
+      accountName: { fieldName: "accountName" },
+      accountUrl: { fieldName: "accountUrl" },
+      isDisable: { fieldName: "isDisable" }
     }
+  },
+  // {
+  //     label: "甯�",
+  //     fieldName: "CityMasterName",
+  //     hideDefaultActions: true,
+  //     wrapText: true,
+  //     type: "customShowAccountUrl",
+  //     typeAttributes: {
+  //         accountName: { fieldName: "CityMasterName" },
+  //         accountUrl: { fieldName: "CityMasterNameUrl" },
+  //         isDisable: { fieldName: "isDisable" },
+  //     },
+  // },
+  {
+    label: "甯�",
+    fieldName: "CityMasterName",
+    hideDefaultActions: true,
+    wrapText: true
+  },
+  {
+    label: "鍘�/鍖�",
+    fieldName: "Town__c",
+    hideDefaultActions: true,
+    wrapText: true
+  },
+  {
+    label: "閿�閲忓崰姣�",
+    fieldName: "proportion",
+    hideDefaultActions: true,
+    wrapText: true,
+    initialWidth: 100,
+    cellAttributes: { alignment: "right" }
+  },
+  {
+    label: "鎿嶄綔",
+    fieldName: "Town__c",
+    type: "weeklyReport",
+    initialWidth: 150,
+    typeAttributes: {
+      recordId: { fieldName: "Id" },
+      hospitalName: { fieldName: "Name" },
+      isShowButton: { fieldName: "isShowButton" }
+    },
+    hideDefaultActions: true
+  }
 ];
 export default class LexConsumableAccount extends LightningElement {
-    columns = columns;
-    topColumns = topColumns;
-    @track isShowSpinner = false;
-    @track pageRecords = [];
-    @track accountId = '';
-    @track agencyProType = '';
-    @track agencyProTypestr = '';
-    @track listViewOptions = [
-        {
-            label: '01. 鍖婚櫌_Hospital',
-            value: '01. 鍖婚櫌_Hospital'
-        },
-        // {
-        //     label: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
-        //     value: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
-        // },
-        // {
-        //     label: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
-        //     value: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
-        // },
-        {
-            label: '63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�',
-            value: '63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�'
-        }
-    ];
-    @track viewOption = '01. 鍖婚櫌_Hospital';
-
-    @track isShowAccountInfo = false;
-    @track topAccountData = [];
-
-    //鍓嶇鎺掑簭
-    defaultSortDirection = 'asc';
-    sortDirection = 'asc';
-    sortedBy;
-
-    //鍒嗛〉start
-    @track sortBy = '';
-    @track pageSize = 10;
-    error;
-    records;
-    currentPageToken = 0;
-    nextPageToken = this.pageSize;
-    @track totalRecords = 0;
-    @track loader = false;
-    @track pageNumber = 1;
-    @track paginationVisibility = false;
-    @track totalPages = 1;
-    pageSizeOptions = [10, 25, 50, 100];
-    @track recordStart = 0;
-    @track recordEnd = 0;
-    //end
-
-    @track AccId = '';
-    @track printUrl = '';
-    @track accountDataInfo = {
-        name: '',
-        ownerName: '',
-        site: '',
-        isActive: '',
-        aliasName2: '',
-        banOnUseReason: '',
-        grade: '',
-        attributeType: '',
-        oCMCategory: '',
-        specialityType: '',
-        stateMasterName: '',
-        phone: '',
-        cityMasterName: '',
-        phoneCall: '',
-        town: '',
-        fax: '',
-        street: '',
-        postalCode: '',
-        address: '',
-        parentName: ''
-    };
-
-    stylesLoaded = false;
-
-    //璐㈠勾
-    @track fiscalYearOptions = [
-        { label: '鏈储骞�', value: 'thisYear' },
-        { label: '涓婁竴璐㈠勾', value: 'lastYear' },
-        { label: '涓婁竴璐㈠勾+鏈储骞�', value: 'allYear' }
-    ];
-    @track fiscalYearOption = 'thisYear';
-    @track topInfo = [];
-
-    renderedCallback() {
-        if (!this.stylesLoaded) {
-            Promise.all([loadStyle(this, WrappedHeaderTable)])
-                .then(() => {
-                    console.log('Custom styles loaded');
-                    this.stylesLoaded = true;
-                })
-                .catch((error) => {
-                    console.error('Error loading custom styles');
-                });
-        }
+  columns = columns;
+  topColumns = topColumns;
+  @track isShowSpinner = false;
+  @track pageRecords = [];
+  @track accountId = "";
+  @track agencyProType = "";
+  @track agencyProTypestr = "";
+  @track listViewOptions = [
+    {
+      label: "01. 鍖婚櫌_Hospital",
+      value: "01. 鍖婚櫌_Hospital"
+    },
+    // {
+    //     label: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
+    //     value: "61. 鍖婚櫌_Hospital鑽夋涓殑鍖婚櫌",
+    // },
+    // {
+    //     label: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
+    //     value: "62. 鍖婚櫌_Hospital鐢宠涓殑鍖婚櫌",
+    // },
+    {
+      label: "63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�",
+      value: "63. 鍖婚櫌_Hospital涓婂懆鍒涘缓鐨勫尰闄�"
     }
+  ];
+  @track viewOption = "01. 鍖婚櫌_Hospital";
 
-    //鑾峰彇閾炬帴鍙傛暟
-    getQueryString(name) {
-        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]);
-        }
-        return null;
-    }
+  @track isShowAccountInfo = false;
+  @track topAccountData = [];
 
-    connectedCallback() {
-        this.isShowSpinner = true;
-        this.AccId = this.getQueryString('AccId');
-        this.AccId = this.AccId == null ? '' : this.AccId;
-        if (this.AccId != '') {
-            console.log('this.AccId = ' + this.AccId);
-            accountInit({
-                accId: this.AccId
-            })
-                .then((r) => {
-                    r = JSON.parse(JSON.stringify(r));
-                    console.log('r = ' + JSON.stringify(r));
-                    if (r.status == 'Success') {
-                        console.log(
-                            'r.entity.obj = ' + JSON.stringify(r.entity.obj)
-                        );
-                        this.accountDataInfo.name = r.entity.obj.Name;
-                        this.accountDataInfo.ownerName =
-                            r.entity.obj.Owner == null
-                                ? ''
-                                : r.entity.obj.Owner.Name;
-                        this.accountDataInfo.site = r.entity.obj.site;
-                        this.accountDataInfo.isActive =
-                            r.entity.obj.Is_Active__c;
-                        this.accountDataInfo.aliasName2 =
-                            r.entity.obj.Alias_Name2__c;
-                        this.accountDataInfo.banOnUseReason =
-                            r.entity.obj.Ban_On_Use_Reason__c;
-                        this.accountDataInfo.grade = r.entity.obj.Grade__c;
-                        this.accountDataInfo.attributeType =
-                            r.entity.obj.Attribute_Type__c;
-                        this.accountDataInfo.oCMCategory =
-                            r.entity.obj.OCM_Category__c;
-                        this.accountDataInfo.specialityType =
-                            r.entity.obj.Speciality_Type__c;
-                        this.accountDataInfo.stateMasterName =
-                            r.entity.obj.State_Master__r == null
-                                ? ''
-                                : r.entity.obj.State_Master__r.Name;
-                        this.accountDataInfo.phone = r.entity.obj.Phone;
-                        this.accountDataInfo.cityMasterName =
-                            r.entity.obj.City_Master__r == null
-                                ? ''
-                                : r.entity.obj.City_Master__r.Name;
-                        this.accountDataInfo.phoneCall =
-                            r.entity.obj.PhoneCall__c;
-                        this.accountDataInfo.town = r.entity.obj.Town__c;
-                        this.accountDataInfo.fax = r.entity.obj.Fax;
-                        this.accountDataInfo.street = r.entity.obj.Street__c;
-                        this.accountDataInfo.postalCode =
-                            r.entity.obj.Postal_Code__c;
-                        this.accountDataInfo.address = r.entity.obj.Address__c;
-                        this.accountDataInfo.parentName =
-                            r.entity.obj.Parent == null
-                                ? ''
-                                : r.entity.obj.Parent.Name;
-                        console.log(
-                            'this.accountDataInfo = ' +
-                                JSON.stringify(this.accountDataInfo)
-                        );
-                        this.printUrl =
-                            '/lexconsumableaccountinfoprint?AccId=' +
-                            this.AccId;
-                        this.isShowAccountInfo = true;
-                        this.isShowSpinner = false;
-                    } else {
-                        console.log('r = ' + JSON.stringify(r));
-                        this.showMyToast('Error', r.msg, 'Error');
-                    }
-                })
-                .catch((error) => {
-                    console.log('error = ' + JSON.stringify(error));
-                    this.showMyToast('Error', '鍒濆鍖栧け璐�', 'Error');
-                });
-        } else {
-            init({
-                pageSizeLWC: this.pageSize,
-                pageTokenLWC: this.currentPageToken,
-                fiscalYear: this.fiscalYearOption
-            })
-                .then((r) => {
-                    r = JSON.parse(JSON.stringify(r));
-                    console.log('r = ' + JSON.stringify(r));
-                    if (r.status == 'Success') {
-                        //鍒嗛〉
-                        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.paginationVisibility =
-                            this.totalPages > 1 ? true : false;
+  //鍓嶇鎺掑簭
+  defaultSortDirection = "asc";
+  sortDirection = "asc";
+  sortedBy;
 
-                        this.pageRecords = r.entity.pageRecords;
-                        this.accountId = r.entity.accountId;
-                        this.agencyProType = r.entity.agencyProType;
-                        this.agencyProTypestr = r.entity.agencyProTypestr;
-                        console.log(
-                            'this.agencyProTypestr = ' + this.agencyProTypestr
-                        );
-                        for (var i in this.pageRecords) {
-                            this.pageRecords[i]['Is_Active__c'] =
-                                this.pageRecords[i].Is_Active__c.replace(
-                                    '鍔�',
-                                    '鏁�'
-                                );
-                            this.pageRecords[i]['NameUrl'] =
-                                '/s/lexconsumableaccount?AccId=' +
-                                this.pageRecords[i].Id;
-                            this.pageRecords[i]['StateMasterName'] =
-                                this.pageRecords[i].State_Master__r.Name;
-                            this.pageRecords[i]['StateMasterUrl'] =
-                                '/' + this.pageRecords[i].State_Master__c;
-                            this.pageRecords[i]['CityMasterName'] =
-                                this.pageRecords[i].City_Master__r.Name;
-                            this.pageRecords[i]['CityMasterNameUrl'] =
-                                '/' + this.pageRecords[i].City_Master__c;
-                            this.pageRecords[i]['RecordTypeName'] =
-                                this.pageRecords[i].RecordType.Name;
-                        }
-                        console.log(
-                            'this.listViewOptions = ' +
-                                JSON.stringify(this.listViewOptions)
-                        );
+  //鍒嗛〉start
+  @track sortBy = "";
+  @track pageSize = 10;
+  error;
+  records;
+  currentPageToken = 0;
+  nextPageToken = this.pageSize;
+  @track totalRecords = 0;
+  @track loader = false;
+  @track pageNumber = 1;
+  @track paginationVisibility = false;
+  @track totalPages = 1;
+  pageSizeOptions = [10, 25, 50, 100];
+  @track recordStart = 0;
+  @track recordEnd = 0;
+  //end
 
-                        console.log(
-                            'r.entity.topInfo = ' +
-                                JSON.stringify(r.entity.topInfo)
-                        );
-                        //top10瀹㈡埛
-                        this.topInfo = r.entity.topInfo;
-                        console.log(
-                            'this.topInfo = ' + JSON.stringify(this.topInfo)
-                        );
-                        this.topAccountData = this.topInfo.acList;
-                        console.log(
-                            'this.topAccountData = ' +
-                                JSON.stringify(this.topAccountData)
-                        );
-                        console.log(
-                            '9/3 = ' +
-                                this.keepTwoDecimalStr(
-                                    this.amend(9, 3, '/').toFixed(2)
-                                )
-                        );
-                        let total = 100;
-                        try {
-                            for (var i in this.topAccountData) {
-                                console.log('i = ' + i);
-                                this.topAccountData[i]['accountName'] =
-                                    this.topAccountData[i].Name;
-                                this.topAccountData[i]['accountUrl'] =
-                                    '/s/lexconsumableaccount?AccId=' +
-                                    this.topAccountData[i].Id;
-                                this.topAccountData[i]['isDisable'] = false;
-                                this.topAccountData[i]['StateMasterName'] =
-                                    this.topAccountData[i].State_Master__r.Name;
-                                this.topAccountData[i]['StateMasterUrl'] =
-                                    '/' +
-                                    this.topAccountData[i].State_Master__c;
-                                this.topAccountData[i]['CityMasterName'] =
-                                    this.topAccountData[i].City_Master__r.Name;
-                                this.topAccountData[i]['CityMasterNameUrl'] =
-                                    '/' + this.topAccountData[i].City_Master__c;
-                                this.topAccountData[i]['RecordTypeName'] =
-                                    this.topAccountData[i].RecordType.Name;
-                                this.topAccountData[i]['isShowButton'] = true;
-                                let number = this.keepTwoDecimalStr(
-                                    (
-                                        this.amend(
-                                            this.topInfo.deList[i],
-                                            this.topInfo.saleAmount,
-                                            '/'
-                                        ) * 100
-                                    ).toFixed(2)
-                                );
-                                total -= number;
-                                this.topAccountData[i]['proportion'] =
-                                    number + '%';
-                            }
+  @track AccId = "";
+  @track printUrl = "";
+  @track accountDataInfo = {
+    name: "",
+    ownerName: "",
+    site: "",
+    isActive: "",
+    aliasName2: "",
+    banOnUseReason: "",
+    grade: "",
+    attributeType: "",
+    oCMCategory: "",
+    specialityType: "",
+    stateMasterName: "",
+    phone: "",
+    cityMasterName: "",
+    phoneCall: "",
+    town: "",
+    fax: "",
+    street: "",
+    postalCode: "",
+    address: "",
+    parentName: ""
+  };
 
-                            console.log(
-                                'this.topAccountData = ' +
-                                    JSON.stringify(this.topAccountData)
-                            );
+  stylesLoaded = false;
 
-                            //鍏朵粬
-                            if (total != 100) {
-                                this.topAccountData.push({
-                                    accountName: '...',
-                                    accountUrl: '/s/lexconsumableaccount',
-                                    isDisable: true,
-                                    proportion: total.toFixed(2) + '%',
-                                    CityMasterName: '...',
-                                    CityMasterNameUrl: '/lexconsumableaccount',
-                                    Town__c: '...',
-                                    isShowButton: false
-                                });
-                            } else {
-                                let title = '';
-                                for (var key in this.fiscalYearOptions) {
-                                    if (
-                                        this.fiscalYearOption ==
-                                        this.fiscalYearOptions[key].value
-                                    )
-                                        title =
-                                            this.fiscalYearOptions[key].label;
-                                }
-                                this.showMyToast(title, '鏃犳暟鎹�', 'Error');
-                            }
-                            this.isShowSpinner = false;
-                        } catch (error) {
-                            console.log('error = ' + error.message);
-                        }
-                    } else {
-                        console.log('r = ' + JSON.stringify(r));
-                        this.showMyToast('Error', r.msg, 'Error');
-                    }
-                })
-                .catch((error) => {
-                    console.log('error = ' + JSON.stringify(error));
-                    this.showMyToast(
-                        'Error',
-                        '閿�閲忓墠鍗佸鎴峰垵濮嬪寲澶辫触',
-                        'Error'
-                    );
-                });
-        }
-    }
+  //璐㈠勾
+  @track fiscalYearOptions = [
+    { label: "鏈储骞�", value: "thisYear" },
+    { label: "涓婁竴璐㈠勾", value: "lastYear" },
+    { label: "涓婁竴璐㈠勾+鏈储骞�", value: "allYear" }
+  ];
+  @track fiscalYearOption = "thisYear";
+  @track topInfo = [];
 
-    amend(num1, num2, symbol) {
-        console.log('num1 = ' + num1);
-        console.log('num2 = ' + num2);
-        console.log('symbol = ' + symbol);
-        var str1 = num1.toString(),
-            str2 = num2.toString(),
-            result,
-            str1Length,
-            str2Length;
-        //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉�
-        try {
-            str1Length = str1.split('.')[1].length;
-        } catch (error) {
-            str1Length = 0;
-        }
-        try {
-            str2Length = str2.split('.')[1].length;
-        } catch (error) {
-            str2Length = 0;
-        }
-        var step = Math.pow(10, Math.max(str1Length, str2Length));
-        console.log(step);
-        switch (symbol) {
-            case '+':
-                result = (num1 * step + num2 * step) / step;
-                break;
-            case '-':
-                result = (num1 * step - num2 * step) / step;
-                break;
-            case '*':
-                result = (num1 * step * (num2 * step)) / step / step;
-                break;
-            case '/':
-                result = (num1 * step) / (num2 * step);
-                break;
-            default:
-                break;
-        }
-        return result;
-    }
-
-    keepTwoDecimalStr(num) {
-        const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
-        let s = result.toString();
-        let rs = s.indexOf('.');
-        if (rs < 0) {
-            rs = s.length;
-            s += '.';
-        }
-        while (s.length <= rs + 2) {
-            s += '0';
-        }
-        return s;
-    }
-
-    dataChange(event) {
-        let fieldName = event.target.getAttribute('data-field');
-        let value = event.detail.value;
-        console.log('fieldName = ' + fieldName + ' value = ' + value);
-        switch (fieldName) {
-            case 'viewOption':
-                this.viewOption = value;
-                this.changelistView();
-                break;
-            case 'fiscalYearOption':
-                this.fiscalYearOption = value;
-                this.changeFiscalYear();
-                break;
-        }
-    }
-
-    changeFiscalYear() {
-        this.isShowSpinner = true;
-        changeFiscalYearView({
-            fiscalYear: this.fiscalYearOption
+  renderedCallback() {
+    if (!this.stylesLoaded) {
+      Promise.all([loadStyle(this, WrappedHeaderTable)])
+        .then(() => {
+          console.log("Custom styles loaded");
+          this.stylesLoaded = true;
         })
-            .then((r) => {
-                r = JSON.parse(JSON.stringify(r));
-                console.log('r = ' + JSON.stringify(r));
-                if (r.status == 'Success') {
-                    //top10瀹㈡埛
-                    this.topInfo = r.entity.topInfo;
-                    console.log(
-                        'this.topInfo = ' + JSON.stringify(this.topInfo)
-                    );
-                    this.topAccountData = this.topInfo.acList;
-                    console.log(
-                        'this.topAccountData = ' +
-                            JSON.stringify(this.topAccountData)
-                    );
-                    let total = 100;
-                    for (var i in this.topAccountData) {
-                        console.log('i = ' + i);
-                        this.topAccountData[i]['accountName'] =
-                            this.topAccountData[i].Name;
-                        this.topAccountData[i]['accountUrl'] =
-                            '/s/lexconsumableaccount?AccId=' +
-                            this.topAccountData[i].Id;
-                        this.topAccountData[i]['isDisable'] = false;
-                        this.topAccountData[i]['StateMasterName'] =
-                            this.topAccountData[i].State_Master__r.Name;
-                        this.topAccountData[i]['StateMasterUrl'] =
-                            '/' + this.topAccountData[i].State_Master__c;
-                        this.topAccountData[i]['CityMasterName'] =
-                            this.topAccountData[i].City_Master__r.Name;
-                        this.topAccountData[i]['CityMasterNameUrl'] =
-                            '/' + this.topAccountData[i].City_Master__c;
-                        this.topAccountData[i]['RecordTypeName'] =
-                            this.topAccountData[i].RecordType.Name;
-                        this.topAccountData[i]['isShowButton'] = true;
-                        let number = this.keepTwoDecimalStr(
-                            (
-                                this.amend(
-                                    this.topInfo.deList[i],
-                                    this.topInfo.saleAmount,
-                                    '/'
-                                ) * 100
-                            ).toFixed(2)
-                        );
-                        total -= number;
-                        this.topAccountData[i]['proportion'] = number + '%';
-                    }
-
-                    // //鍏朵粬
-                    if (total != 100) {
-                        this.topAccountData.push({
-                            accountName: '...',
-                            accountUrl: '/s/lexconsumableaccount',
-                            isDisable: true,
-                            proportion: total.toFixed(2) + '%',
-                            CityMasterName: '...',
-                            CityMasterNameUrl: '/lexconsumableaccount',
-                            Town__c: '...',
-                            isShowButton: false
-                        });
-                    } else {
-                        let title = '';
-                        for (var key in this.fiscalYearOptions) {
-                            if (
-                                this.fiscalYearOption ==
-                                this.fiscalYearOptions[key].value
-                            )
-                                title = this.fiscalYearOptions[key].label;
-                        }
-                        this.showMyToast(title, '鏃犳暟鎹�', 'Error');
-                    }
-
-                    this.isShowSpinner = false;
-                } else {
-                    console.log('r = ' + JSON.stringify(r));
-                    this.showMyToast('Error', r.msg, 'Error');
-                }
-            })
-            .catch((error) => {
-                console.log('error = ' + JSON.stringify(error));
-                this.showMyToast('Error', '閿�閲忓墠鍗佸鎴峰垵濮嬪寲澶辫触', 'Error');
-            });
+        .catch((error) => {
+          console.error("Error loading custom styles");
+        });
     }
+  }
 
-    changelistView() {
-        this.isShowSpinner = true;
-        changelistView({
-            filterNameLwc: this.viewOption,
-            accountIdLwc: this.accountId,
-            agencyProTypeLwc: this.agencyProType,
-            pageSizeLWC: this.pageSize,
-            pageTokenLWC: this.currentPageToken,
-            sortFieldLWC: this.sortBy,
-            sortOrderLWC: this.sortDirection
+  //鑾峰彇閾炬帴鍙傛暟
+  getQueryString(name) {
+    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]);
+    }
+    return null;
+  }
+
+  connectedCallback() {
+    this.isShowSpinner = true;
+    this.AccId = this.getQueryString("AccId");
+    this.AccId = this.AccId == null ? "" : this.AccId;
+    if (this.AccId != "") {
+      console.log("this.AccId = " + this.AccId);
+      accountInit({
+        accId: this.AccId
+      })
+        .then((r) => {
+          r = JSON.parse(JSON.stringify(r));
+          console.log("r = " + JSON.stringify(r));
+          if (r.status == "Success") {
+            console.log("r.entity.obj = " + JSON.stringify(r.entity.obj));
+            this.accountDataInfo.name = r.entity.obj.Name;
+            this.accountDataInfo.ownerName =
+              r.entity.obj.Owner == null ? "" : r.entity.obj.Owner.Name;
+            this.accountDataInfo.site = r.entity.obj.site;
+            this.accountDataInfo.isActive = r.entity.obj.Is_Active__c;
+            this.accountDataInfo.aliasName2 = r.entity.obj.Alias_Name2__c;
+            this.accountDataInfo.banOnUseReason =
+              r.entity.obj.Ban_On_Use_Reason__c;
+            this.accountDataInfo.grade = r.entity.obj.Grade__c;
+            this.accountDataInfo.attributeType = r.entity.obj.Attribute_Type__c;
+            this.accountDataInfo.oCMCategory = r.entity.obj.OCM_Category__c;
+            this.accountDataInfo.specialityType =
+              r.entity.obj.Speciality_Type__c;
+            this.accountDataInfo.stateMasterName =
+              r.entity.obj.State_Master__r == null
+                ? ""
+                : r.entity.obj.State_Master__r.Name;
+            this.accountDataInfo.phone = r.entity.obj.Phone;
+            this.accountDataInfo.cityMasterName =
+              r.entity.obj.City_Master__r == null
+                ? ""
+                : r.entity.obj.City_Master__r.Name;
+            this.accountDataInfo.phoneCall = r.entity.obj.PhoneCall__c;
+            this.accountDataInfo.town = r.entity.obj.Town__c;
+            this.accountDataInfo.fax = r.entity.obj.Fax;
+            this.accountDataInfo.street = r.entity.obj.Street__c;
+            this.accountDataInfo.postalCode = r.entity.obj.Postal_Code__c;
+            this.accountDataInfo.address = r.entity.obj.Address__c;
+            this.accountDataInfo.parentName =
+              r.entity.obj.Parent == null ? "" : r.entity.obj.Parent.Name;
+            console.log(
+              "this.accountDataInfo = " + JSON.stringify(this.accountDataInfo)
+            );
+            this.printUrl =
+              "/lexconsumableaccountinfoprint?AccId=" + this.AccId;
+            this.isShowAccountInfo = true;
+            this.isShowSpinner = false;
+          } else {
+            console.log("r = " + JSON.stringify(r));
+            this.showMyToast("Error", r.msg, "Error");
+          }
         })
-            .then((r) => {
-                r = JSON.parse(JSON.stringify(r));
-                console.log('r = ' + JSON.stringify(r));
-                if (r.status == 'Success') {
-                    //鍒嗛〉
-                    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.paginationVisibility =
-                        this.totalPages > 1 ? true : false;
+        .catch((error) => {
+          console.log("error = " + JSON.stringify(error));
+          this.showMyToast("Error", "鍒濆鍖栧け璐�", "Error");
+        });
+    } else {
+      init({
+        pageSizeLWC: this.pageSize,
+        pageTokenLWC: this.currentPageToken,
+        fiscalYear: this.fiscalYearOption
+      })
+        .then((r) => {
+          r = JSON.parse(JSON.stringify(r));
+          console.log("r = " + JSON.stringify(r));
+          if (r.status == "Success") {
+            //鍒嗛〉
+            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.paginationVisibility = this.totalPages > 1 ? true : false;
 
-                    this.pageRecords = r.entity.pageRecords;
-                    console.log(
-                        'this.pageRecords = ' + JSON.stringify(this.pageRecords)
-                    );
-                    for (var i in this.pageRecords) {
-                        this.pageRecords[i]['Is_Active__c'] = this.pageRecords[
-                            i
-                        ].Is_Active__c.replace('鍔�', '鏁�');
-                        this.pageRecords[i]['NameUrl'] =
-                            '/s/lexconsumableaccount?AccId=' +
-                            this.pageRecords[i].Id;
-                        this.pageRecords[i]['StateMasterName'] =
-                            this.pageRecords[i].State_Master__r.Name;
-                        this.pageRecords[i]['StateMasterUrl'] =
-                            '/' + this.pageRecords[i].State_Master__c;
-                        this.pageRecords[i]['CityMasterName'] =
-                            this.pageRecords[i].City_Master__r.Name;
-                        this.pageRecords[i]['CityMasterNameUrl'] =
-                            '/' + this.pageRecords[i].City_Master__c;
-                        this.pageRecords[i]['RecordTypeName'] =
-                            this.pageRecords[i].RecordType.Name;
-                    }
-                    this.isShowSpinner = false;
-                } else {
-                    this.showMyToast('Error', r.msg, 'Error');
-                }
-            })
-            .catch((error) => {
-                console.log('error = ' + JSON.stringify(error.message));
-            });
-    }
+            this.pageRecords = r.entity.pageRecords;
+            this.accountId = r.entity.accountId;
+            this.agencyProType = r.entity.agencyProType;
+            this.agencyProTypestr = r.entity.agencyProTypestr;
+            console.log("this.agencyProTypestr = " + this.agencyProTypestr);
+            for (var i in this.pageRecords) {
+              this.pageRecords[i]["Is_Active__c"] = this.pageRecords[
+                i
+              ].Is_Active__c.replace("鍔�", "鏁�");
+              this.pageRecords[i]["NameUrl"] =
+                "/s/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
+              this.pageRecords[i]["StateMasterName"] =
+                this.pageRecords[i].State_Master__r.Name;
+              this.pageRecords[i]["StateMasterUrl"] =
+                "/" + this.pageRecords[i].State_Master__c;
+              this.pageRecords[i]["CityMasterName"] =
+                this.pageRecords[i].City_Master__r.Name;
+              this.pageRecords[i]["CityMasterNameUrl"] =
+                "/" + this.pageRecords[i].City_Master__c;
+              this.pageRecords[i]["RecordTypeName"] =
+                this.pageRecords[i].RecordType.Name;
+            }
+            console.log(
+              "this.listViewOptions = " + JSON.stringify(this.listViewOptions)
+            );
 
-    showMyToast(title, message, variant) {
-        this.isShowSpinner = false;
-        console.log('show custom message');
-        var iconName = '';
-        var content = '';
-        if (variant.toLowerCase() == 'success') {
-            iconName = 'utility:check';
-        } else {
-            iconName = 'utility:error';
-        }
-        if (message != '') {
-            content =
-                '<h2><strong>' +
-                title +
-                '<strong/></h2><h5>' +
-                message +
-                '</h5>';
-        } else {
-            content = '<h2><strong>' + title + '<strong/></h2>';
-        }
-        this.template
-            .querySelector('c-common-toast')
-            .showToast(variant, content, iconName, 10000);
-    }
-
-    sortByMethod(field, reverse, primer) {
-        const key = primer
-            ? function (x) {
-                  return primer(x[field]);
+            console.log(
+              "r.entity.topInfo = " + JSON.stringify(r.entity.topInfo)
+            );
+            //top10瀹㈡埛
+            this.topInfo = r.entity.topInfo;
+            console.log("this.topInfo = " + JSON.stringify(this.topInfo));
+            this.topAccountData = this.topInfo.acList;
+            console.log(
+              "this.topAccountData = " + JSON.stringify(this.topAccountData)
+            );
+            console.log(
+              "9/3 = " +
+                this.keepTwoDecimalStr(this.amend(9, 3, "/").toFixed(2))
+            );
+            let total = 100;
+            try {
+              for (var i in this.topAccountData) {
+                this.topAccountData[i]["accountName"] =
+                  this.topAccountData[i].Name;
+                this.topAccountData[i]["accountUrl"] =
+                  "/s/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
+                this.topAccountData[i]["isDisable"] = false;
+                this.topAccountData[i]["StateMasterName"] =
+                  this.topAccountData[i].State_Master__r.Name;
+                this.topAccountData[i]["StateMasterUrl"] =
+                  "/" + this.topAccountData[i].State_Master__c;
+                this.topAccountData[i]["CityMasterName"] =
+                  this.topAccountData[i].City_Master__r.Name;
+                this.topAccountData[i]["CityMasterNameUrl"] =
+                  "/" + this.topAccountData[i].City_Master__c;
+                this.topAccountData[i]["RecordTypeName"] =
+                  this.topAccountData[i].RecordType.Name;
+                this.topAccountData[i]["isShowButton"] = true;
+                let number = this.keepTwoDecimalStr(
+                  (
+                    this.amend(
+                      this.topInfo.deList[i],
+                      this.topInfo.saleAmount,
+                      "/"
+                    ) * 100
+                  ).toFixed(2)
+                );
+                console.log(
+                  "this.amend = " +
+                    this.amend(
+                      this.topInfo.deList[i],
+                      this.topInfo.saleAmount,
+                      "/"
+                    ) *
+                      100
+                );
+                total -= number;
+                this.topAccountData[i]["proportion"] = number + "%";
               }
-            : function (x) {
-                  return x[field];
-              };
 
-        return function (a, b) {
-            a = key(a);
-            b = key(b);
-            return reverse * ((a > b) - (b > a));
-        };
+              console.log(
+                "this.topAccountData = " + JSON.stringify(this.topAccountData)
+              );
+
+              //鍏朵粬
+              console.log(
+                "(total.toFixed(2) > 0.00 ? total.toFixed(2) : 0.00) = " +
+                  (total.toFixed(2) > 0.0 ? total.toFixed(2) : "0.00")
+              );
+              if (total != 100) {
+                this.topAccountData.push({
+                  accountName: "...",
+                  accountUrl: "/s/lexconsumableaccount",
+                  isDisable: true,
+                  proportion:
+                    (total.toFixed(2) > 0.0 ? total.toFixed(2) : "0.00") + "%",
+                  CityMasterName: "...",
+                  CityMasterNameUrl: "/lexconsumableaccount",
+                  Town__c: "...",
+                  isShowButton: false
+                });
+              } else {
+                let title = "";
+                for (var key in this.fiscalYearOptions) {
+                  if (
+                    this.fiscalYearOption == this.fiscalYearOptions[key].value
+                  )
+                    title = this.fiscalYearOptions[key].label;
+                }
+                this.showMyToast(title, "鏃犳暟鎹�", "Error");
+              }
+              this.isShowSpinner = false;
+            } catch (error) {
+              console.log("error = " + error.message);
+            }
+          } else {
+            console.log("r = " + JSON.stringify(r));
+            this.showMyToast("Error", r.msg, "Error");
+          }
+        })
+        .catch((error) => {
+          console.log("error = " + JSON.stringify(error));
+          this.showMyToast("Error", "閿�閲忓墠鍗佸鎴峰垵濮嬪寲澶辫触", "Error");
+        });
     }
+  }
 
-    onHandleSort(event) {
-        this.sortBy = event.detail.fieldName;
-        switch (this.sortBy) {
-            case 'NameUrl':
-                this.sortBy = 'Name';
-                break;
-            case 'StateMasterUrl':
-                this.sortBy = 'State_Master__r.Name';
-                break;
-            case 'RecordTypeName':
-                this.sortBy = 'RecordType.Name';
-                break;
-            case 'CityMasterNameUrl':
-                this.sortBy = 'City_Master__r.Name';
-                break;
+  amend(num1, num2, symbol) {
+    console.log("num1 = " + num1);
+    console.log("num2 = " + num2);
+    console.log("symbol = " + symbol);
+    var str1 = num1.toString(),
+      str2 = num2.toString(),
+      result,
+      str1Length,
+      str2Length;
+    //瑙e喅鏁存暟娌℃湁灏忔暟鐐规柟娉�
+    try {
+      str1Length = str1.split(".")[1].length;
+    } catch (error) {
+      str1Length = 0;
+    }
+    try {
+      str2Length = str2.split(".")[1].length;
+    } catch (error) {
+      str2Length = 0;
+    }
+    var step = Math.pow(10, Math.max(str1Length, str2Length));
+    console.log(step);
+    switch (symbol) {
+      case "+":
+        result = (num1 * step + num2 * step) / step;
+        break;
+      case "-":
+        result = (num1 * step - num2 * step) / step;
+        break;
+      case "*":
+        result = (num1 * step * (num2 * step)) / step / step;
+        break;
+      case "/":
+        result = (num1 * step) / (num2 * step);
+        break;
+      default:
+        break;
+    }
+    return result;
+  }
+
+  keepTwoDecimalStr(num) {
+    const result = Number(num.toString().match(/^\d+(?:\.\d{0,2})?/));
+    let s = result.toString();
+    let rs = s.indexOf(".");
+    if (rs < 0) {
+      rs = s.length;
+      s += ".";
+    }
+    while (s.length <= rs + 2) {
+      s += "0";
+    }
+    return s;
+  }
+
+  dataChange(event) {
+    let fieldName = event.target.getAttribute("data-field");
+    let value = event.detail.value;
+    console.log("fieldName = " + fieldName + " value = " + value);
+    switch (fieldName) {
+      case "viewOption":
+        this.viewOption = value;
+        this.changelistView();
+        break;
+      case "fiscalYearOption":
+        this.fiscalYearOption = value;
+        this.changeFiscalYear();
+        break;
+    }
+  }
+
+  changeFiscalYear() {
+    this.isShowSpinner = true;
+    changeFiscalYearView({
+      fiscalYear: this.fiscalYearOption
+    })
+      .then((r) => {
+        r = JSON.parse(JSON.stringify(r));
+        console.log("r = " + JSON.stringify(r));
+        if (r.status == "Success") {
+          //top10瀹㈡埛
+          this.topInfo = r.entity.topInfo;
+          console.log("this.topInfo = " + JSON.stringify(this.topInfo));
+          this.topAccountData = this.topInfo.acList;
+          console.log(
+            "this.topAccountData = " + JSON.stringify(this.topAccountData)
+          );
+          let total = 100;
+          for (var i in this.topAccountData) {
+            console.log("i = " + i);
+            this.topAccountData[i]["accountName"] = this.topAccountData[i].Name;
+            this.topAccountData[i]["accountUrl"] =
+              "/s/lexconsumableaccount?AccId=" + this.topAccountData[i].Id;
+            this.topAccountData[i]["isDisable"] = false;
+            this.topAccountData[i]["StateMasterName"] =
+              this.topAccountData[i].State_Master__r.Name;
+            this.topAccountData[i]["StateMasterUrl"] =
+              "/" + this.topAccountData[i].State_Master__c;
+            this.topAccountData[i]["CityMasterName"] =
+              this.topAccountData[i].City_Master__r.Name;
+            this.topAccountData[i]["CityMasterNameUrl"] =
+              "/" + this.topAccountData[i].City_Master__c;
+            this.topAccountData[i]["RecordTypeName"] =
+              this.topAccountData[i].RecordType.Name;
+            this.topAccountData[i]["isShowButton"] = true;
+            let number = this.keepTwoDecimalStr(
+              (
+                this.amend(
+                  this.topInfo.deList[i],
+                  this.topInfo.saleAmount,
+                  "/"
+                ) * 100
+              ).toFixed(2)
+            );
+            total -= number;
+            this.topAccountData[i]["proportion"] = number + "%";
+          }
+
+          // //鍏朵粬
+          if (total != 100) {
+            this.topAccountData.push({
+              accountName: "...",
+              accountUrl: "/s/lexconsumableaccount",
+              isDisable: true,
+              proportion:
+                (total.toFixed(2) > 0.0 ? total.toFixed(2) : "0.00") + "%",
+              CityMasterName: "...",
+              CityMasterNameUrl: "/lexconsumableaccount",
+              Town__c: "...",
+              isShowButton: false
+            });
+          } else {
+            let title = "";
+            for (var key in this.fiscalYearOptions) {
+              if (this.fiscalYearOption == this.fiscalYearOptions[key].value)
+                title = this.fiscalYearOptions[key].label;
+            }
+            this.showMyToast(title, "鏃犳暟鎹�", "Error");
+          }
+
+          this.isShowSpinner = false;
+        } else {
+          console.log("r = " + JSON.stringify(r));
+          this.showMyToast("Error", r.msg, "Error");
         }
-        this.sortDirection = event.detail.sortDirection;
-        this.currentPageToken = 0;
-        console.log('this.sortBy = ' + this.sortBy);
-        console.log('this.sortDirection = ' + this.sortDirection);
-        this.changelistView();
-        const { fieldName: sortedBy, sortDirection } = event.detail;
-        this.sortByMethod(sortedBy, sortDirection === 'asc' ? 1 : -1);
-        this.sortDirection = sortDirection;
-        this.sortedBy = sortedBy;
-    }
+      })
+      .catch((error) => {
+        console.log("error = " + JSON.stringify(error));
+        this.showMyToast("Error", "閿�閲忓墠鍗佸鎴峰垵濮嬪寲澶辫触", "Error");
+      });
+  }
 
-    handlePrevious() {
-        this.currentPageToken =
-            Number(this.currentPageToken) - Number(this.pageSize);
-        this.changelistView();
-    }
+  changelistView() {
+    this.isShowSpinner = true;
+    changelistView({
+      filterNameLwc: this.viewOption,
+      accountIdLwc: this.accountId,
+      agencyProTypeLwc: this.agencyProType,
+      pageSizeLWC: this.pageSize,
+      pageTokenLWC: this.currentPageToken,
+      sortFieldLWC: this.sortBy,
+      sortOrderLWC: this.sortDirection
+    })
+      .then((r) => {
+        r = JSON.parse(JSON.stringify(r));
+        console.log("r = " + JSON.stringify(r));
+        if (r.status == "Success") {
+          //鍒嗛〉
+          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.paginationVisibility = this.totalPages > 1 ? true : false;
 
-    handleNext() {
-        this.currentPageToken =
-            Number(this.currentPageToken) + Number(this.pageSize);
-        this.changelistView();
-    }
-    handleFirst() {
-        this.currentPageToken = 0;
-        this.changelistView();
-    }
+          this.pageRecords = r.entity.pageRecords;
+          console.log("this.pageRecords = " + JSON.stringify(this.pageRecords));
+          for (var i in this.pageRecords) {
+            this.pageRecords[i]["Is_Active__c"] = this.pageRecords[
+              i
+            ].Is_Active__c.replace("鍔�", "鏁�");
+            this.pageRecords[i]["NameUrl"] =
+              "/s/lexconsumableaccount?AccId=" + this.pageRecords[i].Id;
+            this.pageRecords[i]["StateMasterName"] =
+              this.pageRecords[i].State_Master__r.Name;
+            this.pageRecords[i]["StateMasterUrl"] =
+              "/" + this.pageRecords[i].State_Master__c;
+            this.pageRecords[i]["CityMasterName"] =
+              this.pageRecords[i].City_Master__r.Name;
+            this.pageRecords[i]["CityMasterNameUrl"] =
+              "/" + this.pageRecords[i].City_Master__c;
+            this.pageRecords[i]["RecordTypeName"] =
+              this.pageRecords[i].RecordType.Name;
+          }
+          this.isShowSpinner = false;
+        } else {
+          this.showMyToast("Error", r.msg, "Error");
+        }
+      })
+      .catch((error) => {
+        console.log("error = " + JSON.stringify(error.message));
+      });
+  }
 
-    handleLast() {
-        this.currentPageToken =
-            this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
-        this.changelistView();
+  showMyToast(title, message, variant) {
+    this.isShowSpinner = false;
+    console.log("show custom message");
+    var iconName = "";
+    var content = "";
+    if (variant.toLowerCase() == "success") {
+      iconName = "utility:check";
+    } else {
+      iconName = "utility:error";
     }
+    if (message != "") {
+      content =
+        "<h2><strong>" + title + "<strong/></h2><h5>" + message + "</h5>";
+    } else {
+      content = "<h2><strong>" + title + "<strong/></h2>";
+    }
+    this.template
+      .querySelector("c-common-toast")
+      .showToast(variant, content, iconName, 10000);
+  }
 
-    handlePageschange(event) {
-        console.log(event.detail);
-        this.pageSize = event.detail;
-        this.currentPageToken = 0;
-        this.changelistView();
-    }
-    get previousButtonDisabled() {
-        return this.currentPageToken === 0;
-    }
+  sortByMethod(field, reverse, primer) {
+    const key = primer
+      ? function (x) {
+          return primer(x[field]);
+        }
+      : function (x) {
+          return x[field];
+        };
 
-    get nextButtonDisabled() {
-        return this.nextPageToken === undefined;
+    return function (a, b) {
+      a = key(a);
+      b = key(b);
+      return reverse * ((a > b) - (b > a));
+    };
+  }
+
+  onHandleSort(event) {
+    console.log("event.detail.fieldName = " + event.detail.fieldName);
+    this.sortBy = event.detail.fieldName;
+    switch (this.sortBy) {
+      case "NameUrl":
+        this.sortBy = "Name";
+        break;
+      case "StateMasterName":
+        this.sortBy = "State_Master__r.Name";
+        break;
+      case "RecordTypeName":
+        this.sortBy = "RecordType.Name";
+        break;
+      case "CityMasterName":
+        this.sortBy = "City_Master__r.Name";
+        break;
     }
-}
\ No newline at end of file
+    this.sortDirection = event.detail.sortDirection;
+    this.currentPageToken = 0;
+    console.log("this.sortBy = " + this.sortBy);
+    console.log("this.sortDirection = " + this.sortDirection);
+    this.changelistView();
+    const { fieldName: sortedBy, sortDirection } = event.detail;
+    this.sortByMethod(sortedBy, sortDirection === "asc" ? 1 : -1);
+    this.sortDirection = sortDirection;
+    this.sortedBy = sortedBy;
+  }
+
+  handlePrevious() {
+    this.currentPageToken =
+      Number(this.currentPageToken) - Number(this.pageSize);
+    this.changelistView();
+  }
+
+  handleNext() {
+    this.currentPageToken =
+      Number(this.currentPageToken) + Number(this.pageSize);
+    this.changelistView();
+  }
+  handleFirst() {
+    this.currentPageToken = 0;
+    this.changelistView();
+  }
+
+  handleLast() {
+    this.currentPageToken =
+      this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
+    this.changelistView();
+  }
+
+  handlePageschange(event) {
+    console.log(event.detail);
+    this.pageSize = event.detail;
+    this.currentPageToken = 0;
+    this.changelistView();
+  }
+  get previousButtonDisabled() {
+    return this.currentPageToken === 0;
+  }
+
+  get nextButtonDisabled() {
+    return this.nextPageToken === undefined;
+  }
+}
diff --git a/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
index 98db636..4192b57 100644
--- a/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
+++ b/force-app/main/default/lwc/lexCustomInventoryColor/lexCustomInventoryColor.html
@@ -1,17 +1,49 @@
 <template>
-    <template if:true={showNormal}>
-        <div style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;text-align: right;padding-right:10px;">
-            <lightning-formatted-number value={value}></lightning-formatted-number>
-        </div>
-    </template>
-    <template if:true={showRed}>
-        <div style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;background-color:red;text-align: right;padding-right:10px;">
-            <lightning-formatted-number value={value}></lightning-formatted-number>
-        </div>
-    </template>
-    <template if:true={showYellow}>
-        <div style="margin-left: 10px;margin-right: 10px;margin-top: 10px;margin-bottom: 10px;font-size:16px;background-color:yellow;text-align: right;padding-right:10px;">
-            <lightning-formatted-number value={value}></lightning-formatted-number>
-        </div>
-    </template>
-</template>
\ No newline at end of file
+  <template if:true={showNormal}>
+    <div
+      style="
+        margin-left: 10px;
+        margin-right: 10px;
+        margin-top: 10px;
+        margin-bottom: 10px;
+        font-size: 14px;
+        text-align: right;
+        padding-right: 10px;
+      "
+    >
+      <lightning-formatted-number value={value}></lightning-formatted-number>
+    </div>
+  </template>
+  <template if:true={showRed}>
+    <div
+      style="
+        margin-left: 10px;
+        margin-right: 10px;
+        margin-top: 10px;
+        margin-bottom: 10px;
+        font-size: 14px;
+        background-color: red;
+        text-align: right;
+        padding-right: 10px;
+      "
+    >
+      <lightning-formatted-number value={value}></lightning-formatted-number>
+    </div>
+  </template>
+  <template if:true={showYellow}>
+    <div
+      style="
+        margin-left: 10px;
+        margin-right: 10px;
+        margin-top: 10px;
+        margin-bottom: 10px;
+        font-size: 14px;
+        background-color: yellow;
+        text-align: right;
+        padding-right: 10px;
+      "
+    >
+      <lightning-formatted-number value={value}></lightning-formatted-number>
+    </div>
+  </template>
+</template>
diff --git a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
index c0f551c..61b3805 100644
--- a/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
+++ b/force-app/main/default/lwc/lexSaleAndDelivery/lexSaleAndDelivery.js
@@ -17,13 +17,13 @@
     type: "date",
     hideDefaultActions: true,
     sortable: true,
+    initialWidth: 180,
     wrapText: true
   },
   {
     label: "鍑哄簱鍗曞彿",
     fieldName: "url",
     type: "url",
-    initialWidth: 250,
     typeAttributes: {
       label: {
         fieldName: "Name"
@@ -38,7 +38,6 @@
     label: "瀹㈡埛鍚�",
     fieldName: "ShipmentAccount__c",
     hideDefaultActions: true,
-    initialWidth: 250,
     wrapText: true,
     sortable: true
   },
@@ -46,13 +45,14 @@
     label: "绉戝",
     fieldName: "Order_ForCustomerText__c",
     hideDefaultActions: true,
-    initialWidth: 130,
+    initialWidth: 100,
     wrapText: true
   },
   {
     label: "鍑哄簱鍗曠姸鎬�",
     fieldName: "SummonsStatus_c__c",
     hideDefaultActions: true,
+    initialWidth: 100,
     sortable: true,
     wrapText: true
   },
@@ -60,7 +60,7 @@
     label: "寮�绁ㄧ姸鎬�",
     fieldName: "Billed_Status__c",
     hideDefaultActions: true,
-    initialWidth: 130,
+    initialWidth: 100,
     sortable: true,
     wrapText: true
   },
@@ -68,6 +68,7 @@
     label: "鏈彂绁ㄩ噾棰�(鍏�)",
     fieldName: "InvoiceNotPro_money__c",
     hideDefaultActions: true,
+    initialWidth: 125,
     type: "number",
     typeAttributes: {
       minimumFractionDigits: 2
@@ -80,6 +81,7 @@
     hideDefaultActions: true,
     sortable: true,
     wrapText: true,
+    initialWidth: 180,
     type: "date",
     typeAttributes: {
       timeZone: "Asia/Shanghai",
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css
index 7e7956b..ce905ad 100644
--- a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.css
@@ -1,39 +1,43 @@
-@import 'c/lexCssUtility';
-.outerBorderCss{
-    border: 1px solid #D4D4D4;
-    border-radius : 5px;
-    border-top : 3px solid #565959;
+@import "c/lexCssUtility";
+.outerBorderCss {
+  border: 1px solid #d4d4d4;
+  border-radius: 5px;
+  border-top: 3px solid #565959;
 }
-.borderCss{
-    border: 1px solid #D4D4D4;
-    border-radius : 5px;
-    margin-bottom : 7px;
-    border-top : 3px solid #565959;
+.borderCss {
+  border: 1px solid #d4d4d4;
+  border-radius: 5px;
+  margin-bottom: 7px;
+  border-top: 3px solid #565959;
 }
-.headerDorderCss{
-    border-top: 1px solid #565959;
-    border-bottom: 1px solid #D4D4D4;
-    padding:3px;
+.headerDorderCss {
+  border-top: 1px solid #565959;
+  border-bottom: 1px solid #d4d4d4;
+  padding: 3px;
 }
-.centerCss{
-    text-align: center;
+.centerCss {
+  text-align: center;
 }
-.centerCss .left{
-    margin-left: 100px;
+.centerCss .left {
+  margin-left: 100px;
 }
 .datatable {
-    max-height: 400px !important;
+  max-height: 400px !important;
 }
 .tableColumn {
-    margin-top: 5px !important;
-    overflow-x: auto;
+  margin-top: 5px !important;
+  overflow-x: auto;
 }
 :host {
-    --lwc-inputStaticFontSize: 16px;
-    --lwc-formLabelFontSize: 16px;
+  --lwc-inputStaticFontSize: 16px;
+  --lwc-formLabelFontSize: 16px;
 }
 
 .fileUpload {
-    font-size: 16px;
-    --lwc-formLabelFontSize:16px;
-}
\ No newline at end of file
+  font-size: 16px;
+  --lwc-formLabelFontSize: 16px;
+}
+
+.disable-row-selection .slds-is-selected {
+  outline: none !important;
+}
diff --git a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
index f209d7b..f801425 100644
--- a/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
+++ b/force-app/main/default/lwc/lexSummonsCreat/lexSummonsCreat.js
@@ -1,5 +1,4 @@
 import { LightningElement, wire, api, track } from "lwc";
-save;
 import init from "@salesforce/apex/LexSummonsCreatController.init";
 import { ShowToastEvent } from "lightning/platformShowToastEvent";
 import searchConsumableorderdetails from "@salesforce/apex/LexSummonsCreatController.searchConsumableorderdetails";
@@ -186,7 +185,6 @@
       label: "娑堣�楀搧鍚嶇О",
       fieldName: "Name__c",
       hideDefaultActions: true,
-      initialWidth: 175,
       wrapText: true,
       sortable: true
     },
@@ -202,19 +200,21 @@
       label: "CFDA鐘舵��",
       fieldName: "SFDA_Status__c",
       hideDefaultActions: true,
+      initialWidth: 100,
       wrapText: true
     },
     {
       label: "娉ㄥ唽璇佺紪鐮佸彿",
       fieldName: "approbation_No",
       hideDefaultActions: true,
-      initialWidth: 130,
+      initialWidth: 170,
       wrapText: true
     },
     {
       label: "娉ㄥ唽璇佹晥鏈�",
       fieldName: "expiration_Date",
       hideDefaultActions: true,
+      initialWidth: 100,
       wrapText: true
     },
     {
@@ -248,6 +248,7 @@
     {
       label: "鍑鸿揣鏁伴噺",
       fieldName: "Shipment_Count__c",
+      initialWidth: 90,
       cellAttributes: { alignment: "right" },
       hideDefaultActions: true,
       wrapText: true
@@ -256,6 +257,7 @@
       label: "鍑鸿揣鍗曚环(鍏�)",
       fieldName: "shippingUnitPrice",
       type: "number",
+      initialWidth: 100,
       typeAttributes: {
         minimumFractionDigits: 2
       },
@@ -1035,6 +1037,7 @@
               label: this.InvoiceProNotLabel,
               fieldName: "InvoiceProNot_count__c",
               type: "number",
+              initialWidth: 105,
               typeAttributes: {
                 minimumFractionDigits: 2
               },
@@ -1044,12 +1047,14 @@
               label: this.RrturnProLabel,
               fieldName: "RrturnPro_count__c",
               cellAttributes: { alignment: "right" },
+              initialWidth: 100,
               hideDefaultActions: true
             };
             let object3 = {
               label: this.InvoicedLabel,
               fieldName: "Invoiced_Procount__c",
               type: "number",
+              initialWidth: 100,
               typeAttributes: {
                 minimumFractionDigits: 2
               },
@@ -1117,6 +1122,7 @@
           if (this.hasHosPro) {
             let object1 = {
               label: "鍖婚櫌鐗逛环",
+              initialWidth: 80,
               fieldName: "hospitalSpecialOffer",
               type: "boolean",
               hideDefaultActions: true
@@ -1579,7 +1585,7 @@
             label: "鍖婚櫌鐗逛环",
             fieldName: "hospitalSpecialOffer",
             type: "boolean",
-            initialWidth: 100,
+            initialWidth: 80,
             hideDefaultActions: true
           };
           this.columns.push(object1);
diff --git a/force-app/main/default/lwc/lexTopPage/lexTopPage.js b/force-app/main/default/lwc/lexTopPage/lexTopPage.js
index 12f470e..47589c0 100644
--- a/force-app/main/default/lwc/lexTopPage/lexTopPage.js
+++ b/force-app/main/default/lwc/lexTopPage/lexTopPage.js
@@ -629,8 +629,13 @@
 
   editProductLimit(event) {
     //add by Wang Xueqin 2023/05/05
+    //let url =
+    // '/LexProductLimitEdit?accountid=' +
+    // this.accountId +
+    // '&userPro_Type=' +
+    // this.userPro_Type;
     let url =
-      "/LexProductLimitEdit?accountid=" +
+      "/lexproductlimitedit?accountid=" +
       this.accountId +
       "&userPro_Type=" +
       this.userPro_Type;
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
index 14266ae..7986134 100644
--- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.html
@@ -267,6 +267,7 @@
               sorted-by={sortedBy}
               onsort={onHandleSort}
               hide-checkbox-column={hidecheckboxcolumn}
+              style="word-wrap: break-word; word-break: break-all"
               class="wrapped-header-datatable"
             >
             </c-lex-custom-lightning-datatable>
diff --git a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
index 4854e6c..c425b29 100644
--- a/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
+++ b/force-app/main/default/lwc/lexinventoryViewLWC/lexinventoryViewLWC.js
@@ -71,7 +71,7 @@
     {
       label: "绗笁鍒嗙被",
       fieldName: "Category3__c",
-      initialWidth: 84,
+      initialWidth: 102,
       cellAttributes: { alignment: "left" },
       hideDefaultActions: true,
       sortable: true,
@@ -81,7 +81,7 @@
       label: "绗洓鍒嗙被",
       fieldName: "Category4__c",
       cellAttributes: { alignment: "left" },
-      initialWidth: 84,
+      initialWidth: 102,
       hideDefaultActions: true,
       wrapText: true,
       sortable: true
@@ -90,7 +90,7 @@
       label: "绗簲鍒嗙被",
       fieldName: "Category5__c",
       cellAttributes: { alignment: "left" },
-      initialWidth: 84,
+      initialWidth: 102,
       hideDefaultActions: true,
       wrapText: true,
       sortable: true
@@ -141,7 +141,7 @@
       fieldName: "guaranteeperiod",
       cellAttributes: { alignment: "left" },
       hideDefaultActions: true,
-      initialWidth: 105
+      initialWidth: 95
     },
     {
       label: "鏈夋晥鏈熷唴搴撳瓨",
@@ -156,7 +156,7 @@
         boxPrice: { fieldName: "BoxPiece" }
       },
       hideDefaultActions: true,
-      initialWidth: 120
+      initialWidth: 110
     },
 
     {
@@ -164,7 +164,7 @@
       fieldName: "overlimitCount",
       hideDefaultActions: true,
       cellAttributes: { alignment: "right" },
-      initialWidth: 80
+      initialWidth: 78
     }
   ];
   defaultSortDirection = "asc";
diff --git a/manifest/package.xml b/manifest/package.xml
index ac07616..527d2f9 100644
--- a/manifest/package.xml
+++ b/manifest/package.xml
@@ -2,7 +2,7 @@
 <Package xmlns="http://soap.sforce.com/2006/04/metadata">
     <types>
         <members>lexSaleAndDelivery</members>
-        <members>LexSummonsCreat</members>
+        <members>lexSummonsCreat</members>
         <name>LightningComponentBundle</name>
     </types>
     <version>52.0</version>

--
Gitblit v1.9.1