buli
2023-06-27 8e07b5f23afd4c93d7e8d1f04d2e8dbca2628e5e
Community LEX Upgarde
11个文件已修改
2个文件已添加
2252 ■■■■ 已修改文件
.sf/config.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoiceViewController.cls 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexConInvoicedetailsController.cls 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryController.cls 572 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryViewController.cls 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryViewControllerTest.cls 1122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOutboundorderImportController.cls 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexOverdueStockController.cls 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/LexSaleOrderController.cls 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NewRepairController.cls 158 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/NewAndEditReport.page 142 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest/packageForLex copy.xml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.sf/config.json
@@ -1,3 +1,3 @@
{
  "target-org": "OlympusStage"
    "target-org": "OlympusStageEnv"
}
force-app/main/default/classes/LexConInvoiceViewController.cls
@@ -388,7 +388,11 @@
        //         attachmentRecoeds.add(new InvoiceOrderInfo(attachmentinfo[i]));
        //     }
        // }
        List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :invoiceId];
        List<ContentVersion> cvInfo = [
            SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
            FROM ContentVersion
            WHERE FirstPublishLocationId = :invoiceId
        ];
        if (cvInfo.size() > 0) {
            for (Integer i = 0; i < cvInfo.size(); i++) {
                attachmentRecoeds.add(new InvoiceOrderInfo(cvInfo[i]));
@@ -424,7 +428,6 @@
        System.debug('res = ' + res);
        return res;
    }
    
    //保存
    @AuraEnabled
@@ -533,7 +536,6 @@
                }
            } else {
                if (HospitalInfo != null && HospitalInfo != '') {
                    System.debug('++++++++++++' + ass.esd.Order_ForHospital__c + '   ' + shipmentAccountString);
                    if (ass.esd.Order_ForHospital__c != shipmentAccountString) {
                        System.debug('HospitalInfo != null ass.esd.Order_ForHospital__c != shipmentAccountString');
@@ -552,7 +554,9 @@
                        (ass.esd.Order_ForDealerText__c != null || ass.esd.Order_ForDealerText__c != '') &&
                        ass.esd.ShipmentAccount__c != shipmentAccountString
                    ) {
                        System.debug('HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString');
                        System.debug(
                            'HospitalInfo == null && ass.esd.Order_ForDealerText__c != null ass.esd.ShipmentAccount__c != shipmentAccountString'
                        );
                        invoiceOrderAccountList.add(ass.esd.Name);
                    }
                }
@@ -849,6 +853,8 @@
                    delete invoiceLinkdetList;
                }
                //新建发票明细1
                System.debug('===>' + chukudanID);
                System.debug('===>' + chukudanID.size());
                if (chukudanID.size() > 0) {
                    newinvoicedetails1(chukudanID);
                }
@@ -1299,7 +1305,16 @@
    // 检索(未开发票出库单)
    @AuraEnabled
    public static ResponseBodyLWC InvoiceorderSearch(Consumable_order__c cocLwc,String invoiceIdLwc,String accountidLwc,String userWorkLocationLwc,String agencyProTypeLwc,String HospitalInfoLwc,String SecondDealerLwc,String invoiceOrderRecoedsLwc) {
    public static ResponseBodyLWC InvoiceorderSearch(
        Consumable_order__c cocLwc,
        String invoiceIdLwc,
        String accountidLwc,
        String userWorkLocationLwc,
        String agencyProTypeLwc,
        String HospitalInfoLwc,
        String SecondDealerLwc,
        String invoiceOrderRecoedsLwc
    ) {
        System.debug('进入 InvoiceorderSearch');
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
@@ -1429,7 +1444,11 @@
    // 提交按钮
    @AuraEnabled
    public static ResponseBodyLWC approval(List<String> outOrderStringListLwc,Map<String, Consumable_Orderdetails__c> outordercountMapLwc,String invoiceIdLwc) {
    public static ResponseBodyLWC approval(
        List<String> outOrderStringListLwc,
        Map<String, Consumable_Orderdetails__c> outordercountMapLwc,
        String invoiceIdLwc
    ) {
        System.debug('进入 approval');
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
@@ -1501,6 +1520,8 @@
                        outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c
                    )
                    .Invoice_Unitprice__c;
                System.debug('====>procount' + invoiceUpdte1.Invoiced_Procount__c);
                System.debug('===>RMB' + outOrderdet1List[i].Delivery_List_RMB__c);
                invoiceUpdte1.InvoicedProCost_RMB__c = invoiceUpdte1.Invoiced_Procount__c * outOrderdet1List[i].Delivery_List_RMB__c;
                Decimal invoicedProcount = 0;
@@ -1521,6 +1542,8 @@
                    invoicedProcount = outordercountMap.get(outOrderdet1List[i].Consumable_order__c + outOrderdet1List[i].Asset_Model_No__c)
                        .Invoiced_Count__c;
                }
                System.debug('发票数量===>' + outOrderdet1List[i].InvoiceProNot_count__c);
                System.debug('还没发票数量===>' + invoicedProcount);
                if (outOrderdet1List[i].InvoiceProNot_count__c < invoicedProcount) {
                    // ApexPages.addmessage(
@@ -1534,7 +1557,16 @@
                    //     )
                    // );
                    // return null;
                    return new ResponseBodyLWC('Error', 500, '出库单' + outOrderdet1List[i].Consumable_order__r.Name + '中,' + outOrderdet1List[i].Asset_Model_No__c + '还没开票数量小于发票数量,请确认是否有返品', '');
                    return new ResponseBodyLWC(
                        'Error',
                        500,
                        '出库单' +
                            outOrderdet1List[i].Consumable_order__r.Name +
                            '中,' +
                            outOrderdet1List[i].Asset_Model_No__c +
                            '还没开票数量小于发票数量,请确认是否有返品',
                        ''
                    );
                }
                outOrderdetUp1List.add(invoiceUpdte1);
@@ -1570,7 +1602,7 @@
        System.debug('res = ' + res);
        return res;
    }
    @TestVisible
    class InvoiceOrderInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
force-app/main/default/classes/LexConInvoicedetailsController.cls
@@ -101,6 +101,7 @@
            FROM Consumable_Orderdetails__c
            WHERE Consumable_order__c = :orderId
        ];
        System.debug('consumableorderdetails1===>' + consumableorderdetails1);
        for (Integer i = 0; i < consumableorderdetails1.size(); i++) {
            consumableorderdetails1Records.add(new ConsumableorderdetailsInfo(consumableorderdetails1[i]));
        }
@@ -153,7 +154,10 @@
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
        consumableorderdetails1Records= (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetails1RecordsLwc, List<ConsumableorderdetailsInfo>.class);
        consumableorderdetails1Records = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            consumableorderdetails1RecordsLwc,
            List<ConsumableorderdetailsInfo>.class
        );
        invoiceId = invoiceIdLwc;
        orderId = orderIdLwc;
        System.debug('consumableorderdetails1Records = ' + consumableorderdetails1Records);
@@ -352,6 +356,7 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -379,10 +384,11 @@
            invoiceAllprice = 0;
            Packing_list_manual = e.Consumable_Product__r.Packing_list_manual__c;
            if (!Test.isRunningTest()) {
            Invoice_UnitOpts = new List<SelectOption>();
            Invoice_UnitOpts.add(new SelectOption('盒', '盒'));
            Invoice_UnitOpts.add(new SelectOption('个', '个'));
            }
            Invoice_UnitOptsMap = new Map<String,String>();
            Invoice_UnitOptsMap.put('盒', '盒');
force-app/main/default/classes/LexInventoryController.cls
@@ -20,7 +20,8 @@
    public static  Boolean done { get; set; }
    /*****************画面表示Bean******************/
    //页面主数据显示用
    private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
    // private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords;
    //盘点到的产品
    public static  List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>();
    public static  List<Consumable_order_details2__c> showcod2nid = new List<Consumable_order_details2__c>();
@@ -31,7 +32,7 @@
    public static  List<ConsumableorderdetailsInfo> consumableorderdetailsRecordserrordummy;  // 丢失和巡回的,实际炒作用
    @AuraEnabled
    public static  List<List<ConsumableorderdetailsInfo>> consumableorderdetailsRecordsview { get; set; }       // 产品单位的List
    public static  List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>();
    public static List<Consumable_order_details2__c> InsListUp = new List<Consumable_order_details2__c>();
    public static List<ConsumableorderdetailsInfo> consumableorderdetailsviewRecords;
   
@@ -74,13 +75,21 @@
    private static void initStandardController(){
        // init standard controller
        List<Consumable_order_details2__c> showcod2 = [select Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
        List<Consumable_order_details2__c> showcod2 = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                            Bar_Code_search__c
                        FROM Consumable_order_details2__c
                        WHERE Id in :pandiandetailsMap.keySet()
                        order by Name desc];
            WHERE Id IN :pandiandetailsMap.keySet()
            ORDER BY Name DESC
        ];
        setConDetails2 = showcod2;
        System.debug('setConDetails2===>'+setConDetails2);
        // setCon = new ApexPages.StandardSetController(showcod2);
@@ -113,8 +122,6 @@
    // 画面初始化
    @AuraEnabled
    public static ResponseBodyLWC init() {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String,object> data = new Map<String,object>();
        res.entity = data;
@@ -123,13 +130,21 @@
        setConDetails2 = new List<Consumable_order_details2__c>();
        String url = '在库调整一览';
        fileName = EncodingUtil.urlEncode(url, 'UTF-8');
        List<Consumable_order_details2__c> showcod2 = [select Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
        List<Consumable_order_details2__c> showcod2 = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                            Bar_Code_search__c
                        FROM Consumable_order_details2__c
                        WHERE Id in :pandiandetailsMap.keySet()
                        order by Name];
            WHERE Id IN :pandiandetailsMap.keySet()
            ORDER BY Name
        ];
                        System.debug('pandiandetailsMap====>'+pandiandetailsMap);
        initStandardController();
        makepagerecords();
@@ -142,7 +157,7 @@
        String userId = UserInfo.getUserId();
        //String userId = '00510000006k82X';
        //String userId = '00510000005QO75';
        user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =:userId];
        user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
        accountid = Useracc.Accountid;
        userWorkLocation = Useracc.Work_Location__c;
        agencyProType = Useracc.UserPro_Type__c;
@@ -170,33 +185,40 @@
        //     midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
        // }
        //查询库存 追加返品库存
        List<Consumable_order_details2__c> ProductCount_Res = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c
        List<Consumable_order_details2__c> ProductCount_Res = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c
                            FROM Consumable_order_details2__c
                            WHERE Dealer_Arrive__c = true
                            AND Dealer_Shipment__c = false
                            AND Dealer_Saled__c = false
                            AND Dealer_Returned__c = false
                            AND Lose_Flag__c = false
                            AND Cancellation_Flag__c = false
                            AND Bar_Code__c !=null
                            AND Product_Type__c like : sqlagencyProType
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
                            AND  Dealer_Info_text__c = :accountName];
                AND Dealer_Info_text__c = :accountName
        ];
        //DB202302357027 消耗品追溯系统无法正常使用——盘点页面操作即报错 fy start
        //开始制作表头数据
        Set<Id> Product2cIdSet = new Set<Id>();
        for(Consumable_order_details2__c con_or_d2item: ProductCount_Res){
            Product2cIdSet.add(con_or_d2item.Consumable_Product__c);
        }
        List<Product2__c> productCount_Unfull_bak = [select Id, Name,Name__c,
                                                            SFDA_Status__c,Packing_list_manual__c,
                                                            Asset_Model_No__c
                                                        from Product2__c
        List<Product2__c> productCount_Unfull_bak = [
            SELECT Id, Name, Name__c, SFDA_Status__c, Packing_list_manual__c, Asset_Model_No__c
            FROM Product2__c
                                                        //where Estimation_Entry_Possibility__c = '○'
                                                         where Id in:Product2cIdSet
                                                         and Product_Type__c like : sqlagencyProType
            WHERE Id IN :Product2cIdSet AND Product_Type__c LIKE :sqlagencyProType
                                                        ];
        for(integer i = 0;i < productCount_Unfull_bak.size() ; i++){
            midMap.put(productCount_Unfull_bak[i].Id, productCount_Unfull_bak[i]);
@@ -209,9 +231,11 @@
        for(Integer i = 0 ; i< ProductCount_Res.size();i++){
            //然后循环CountDel做Box和piece2个map
            if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '盒'){
                if(newMidBoxMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){
                    ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone();
                    ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
                            ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
                        )
                        .clone();
                    Jstage.countid = Jstage.countid+1 ;
                    if(ProductCount_Res[i].Isoverdue__c == 1){
                        Jstage.limitCount = Jstage.limitCount + 1;
@@ -219,7 +243,9 @@
                    Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
                    newMidBoxMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
                }else{
                    ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c));
                    ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
                        MidMap.get(ProductCount_Res[i].Consumable_Product__c)
                    );
                    Jstage.countid = Jstage.countid+1 ;
                    if(ProductCount_Res[i].Isoverdue__c == 1){
                        Jstage.limitCount = Jstage.limitCount + 1;
@@ -229,7 +255,10 @@
                }
            }else if(MidMap.containsKey(ProductCount_Res[i].Consumable_Product__c) && ProductCount_Res[i].Box_Piece__c == '个'){
                if(newMidPieceMap.containsKey(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c)){
                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c).clone();
                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                            ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
                        )
                        .clone();
                    Jstage.countid = Jstage.countid+1 ;
                    if(ProductCount_Res[i].Isoverdue__c == 1){
                        Jstage.limitCount = Jstage.limitCount + 1;
@@ -237,7 +266,9 @@
                    Jstage.boxPiece = ProductCount_Res[i].Box_Piece__c;
                    newMidPieceMap.put(ProductCount_Res[i].Consumable_Product__c+ProductCount_Res[i].Box_Piece__c, Jstage);
                }else{
                    ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(ProductCount_Res[i].Consumable_Product__c));
                    ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
                        MidMap.get(ProductCount_Res[i].Consumable_Product__c)
                    );
                    Jstage.countid = Jstage.countid+1 ;
                    if(ProductCount_Res[i].Isoverdue__c == 1){
                        Jstage.limitCount = Jstage.limitCount + 1;
@@ -268,10 +299,6 @@
        }
        //consumableorderdetailsCount = consumableorderdetailsRecords.size();
        listCut();
        data.put('ConsumableorderdetailsRecordsview',JSON.serialize(ConsumableorderdetailsRecordsview));
        data.put('userWorkLocation',userWorkLocation);
@@ -318,7 +345,7 @@
    //========20160311======ADD_Start================================
    public static  List<String> ParseBarCode(String Code){
        Map<String,Integer> barcodeCountMap = new Map<String,Integer>();
        String[] Cache = new String[]{};
        String[] Cache = new List<String>{};
        Cache = Code.split('\n');
        List <String> Buff = new List<String>();
        for(String A : Cache){
@@ -331,10 +358,7 @@
            Buff.add(A + barcodeCountMap.get(A));
        }
        return Buff;
    }
    //test
@@ -345,14 +369,27 @@
    //========20160311======ADD_End==================================
    // BarCode录入
    @AuraEnabled
    public static ResponseBodyLWC searchConsumableorderdetails(String agencyProType,String userWorkLocation,String accountName,String barcode,String consumableorderdetailsRecordsLWC,Integer pageSizeLWC, Integer pageTokenLWC, String sortFieldLWC, String sortOrderLWC){
    public static ResponseBodyLWC searchConsumableorderdetails(
        String agencyProType,
        String userWorkLocation,
        String accountName,
        String barcode,
        String consumableorderdetailsRecordsLWC,
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String sortFieldLWC,
        String sortOrderLWC
    ) {
        pageSize = pageSizeLWC;
        pageToken = pageTokenLWC;
        sortField = sortFieldLWC;
        sortOrder = sortOrderLWC;
        System.debug('===>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC);
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            consumableorderdetailsRecordsLWC,
            List<ConsumableorderdetailsInfo>.class
        );
        // ConsumableorderdetailsInfo[] consumableorderdetailsRecords=(List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
       system.debug('=====>consumableorderdetailsRecordsLWC'+consumableorderdetailsRecordsLWC);
        ResponseBodyLWC res = new ResponseBodyLWC();
@@ -360,9 +397,9 @@
        res.entity = data;
        sqlagencyProType = '%' + agencyProType + '%';
        System.debug('sqlagencyProType==>' + sqlagencyProType);
        System.debug('accountName==>' + accountName);
        System.debug('userWorkLocation==>' + userWorkLocation);
        /* BarCodelist做成 */
        //FIXME barcodeSet 做成,ProductCount_ResSet 做成
@@ -370,22 +407,34 @@
        pandiandetailsListShow = new List<List<Consumable_order_details2__c>>();
        done = false;
        List<String> BarCodeListP = ParseBarCode( barcode );
        System.debug('BarCodeListP===>' + BarCodeListP);
        //查询库存 追加返品库存
        List<Consumable_order_details2__c> ProductCount_Res = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
        List<Consumable_order_details2__c> ProductCount_Res = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Dealer_Info_text__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Dealer_Arrive__c = true
                            AND Dealer_Shipment__c = false
                            AND Dealer_Saled__c = false
                            AND Dealer_Returned__c = false
                            AND Lose_Flag__c = false
                            AND Cancellation_Flag__c = false
                            AND Bar_Code__c !=null
                            AND Product_Type__c like : sqlagencyProType
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                            AND Arrive_Owner_Work_Location__c =: userWorkLocation
                            AND  Dealer_Info_text__c = :accountName ];
                AND Dealer_Info_text__c = :accountName
        ];
        System.debug('ProductCount_Res==>' + ProductCount_Res);
        reFindProduct.clear();
        Map<String,ConsumableorderdetailsInfo> barCodeListAdjustMap = new  Map<String,ConsumableorderdetailsInfo>();
        //barCodeListLoseMap.clear();
@@ -408,11 +457,14 @@
                if(ass.check==true){
                    //ass.Diff = ass.countid - ass.Pandian;
                    for(integer i = 0 ; i < ProductCount_Res.size();i++){
                        System.debug('Pro==>' + ProductCount_Res[i].Consumable_Product__c);
                        System.debug('ProId==>' + ass.Prod.Id);
                        System.debug('ass.boxPiece ==>' + ass.boxPiece);
                        System.debug('boxPiece ==>' + ProductCount_Res[i].Box_Piece__c);
                        if(ProductCount_Res[i].Consumable_Product__c == ass.Prod.Id && ass.boxPiece == ProductCount_Res[i].Box_Piece__c){
                            if(carCodeListLose.contains(ProductCount_Res[i].Bar_Code__c)){
                                continue;
                            }else{
                                //consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'丢失'));
                                //pandiandetailsMap.put(ProductCount_Res[i].Id, '丢失');
                                ////barCodeListLoseMap.put(ProductCount_Res[i].Id, new ConsumableorderdetailsInfo(ProductCount_Res[i]));
@@ -424,47 +476,65 @@
            }
            //已经出库的产品
            List<Consumable_order_details2__c>  reSet1 = [SELECT Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                            Bar_Code_search__c,Dealer_Info_text__c
            List<Consumable_order_details2__c> reSet1 = [
                SELECT
                    Id,
                    Name,
                    Consumable_Product__c,
                    Bar_Code__c,
                    Consumable_Product__r.Name__c,
                    Asset_Model_No__c,
                    Isoverdue__c,
                    Box_Piece__c,
                    Bar_Code_search__c,
                    Dealer_Info_text__c
                        FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = TRUE
                WHERE
                    Dealer_Arrive__c = TRUE
                        AND  (Dealer_Shipment__c= TRUE
                        or  Dealer_Saled__c = TRUE)
                    OR Dealer_Saled__c = TRUE)
                        AND  Dealer_Returned__c = FALSE
                        AND  Cancellation_Flag__c = FALSE
                        AND  Bar_Code__c in :carCodeListLose
                    AND Bar_Code__c IN :carCodeListLose
                        AND Dealer_Info_text__c = :accountName
                        ORDER BY Name ];
                ORDER BY Name
            ];
            Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>();
            for(Consumable_order_details2__c cod2 :reSet1){
                needreturnMap.put(cod2.Bar_Code__c,cod2);
            }
            // 经销商之间或者同一经销商不同工作地调货
            reSet1 = [SELECT Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                            Bar_Code_search__c,Dealer_Info_text__c
            reSet1 = [
                SELECT
                    Id,
                    Name,
                    Consumable_Product__c,
                    Bar_Code__c,
                    Consumable_Product__r.Name__c,
                    Asset_Model_No__c,
                    Isoverdue__c,
                    Box_Piece__c,
                    Bar_Code_search__c,
                    Dealer_Info_text__c
                        FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = TRUE
                WHERE
                    Dealer_Arrive__c = TRUE
                        AND  Dealer_Shipment__c= FALSE
                        AND  Dealer_Saled__c = FALSE
                        AND  Dealer_Returned__c = FALSE
                        AND  Cancellation_Flag__c = FALSE
                        AND  Bar_Code__c in :carCodeListLose
                    AND Bar_Code__c IN :carCodeListLose
                        AND (Dealer_Info_text__c != :accountName
                            OR (Dealer_Info_text__c = :accountName
                                AND Arrive_Owner_Work_Location__c != :userWorkLocation)
                        )
                        ORDER BY Name ];
                    AND Arrive_Owner_Work_Location__c != :userWorkLocation))
                ORDER BY Name
            ];
            Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
            for(Consumable_order_details2__c cod2 :reSet1){
                otherAgProMap.put(cod2.Bar_Code__c,cod2);
            }
            carCodeListLose.clear();
            for(ConsumableorderdetailsInfo ass : consumableorderdetailsRecords){
                if(ass.check==true){
@@ -475,21 +545,33 @@
                                continue;
                            }else{
                                if(needreturnMap.containsKey(ProductCount_Res[i].Bar_Code__c)){
                                    consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品未返品'));
                                    consumableorderdetailsRecordserrordummy.add(
                                        new ConsumableorderdetailsInfo(ProductCount_Res[i], '该产品未返品')
                                    );
                                    pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品未返品');
                                    carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
                                    continue;
                                }
                                if(otherAgProMap.containsKey(ProductCount_Res[i].Bar_Code__c)){
                                    consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。'));
                                    pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。');
                                    consumableorderdetailsRecordserrordummy.add(
                                        new ConsumableorderdetailsInfo(
                                            ProductCount_Res[i],
                                            '该产品归属于' +
                                                otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c +
                                                '的库存。'
                                        )
                                    );
                                    pandiandetailsMap.put(
                                        ProductCount_Res[i].Id,
                                        '该产品归属于' + otherAgProMap.get(ProductCount_Res[i].Bar_Code__c).Dealer_Info_text__c + '的库存。'
                                    );
                                    carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
                                    continue;
                                }
                                if (ProductCount_Res[i].Isoverdue__c == 0) {
                                    consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品已经过有效期,请销存。'));
                                    consumableorderdetailsRecordserrordummy.add(
                                        new ConsumableorderdetailsInfo(ProductCount_Res[i], '该产品已经过有效期,请销存。')
                                    );
                                    pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。');
                                    carCodeListLose.add(ProductCount_Res[i].Bar_Code_search__c);
                                    ass.Diff--;
@@ -508,13 +590,21 @@
            }
            List<Consumable_order_details2__c> showcod2 = new List<Consumable_order_details2__c>();
            if (pandiandetailsMap.keySet().size() > 0) {
                showcod2 = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                showcod2 = [
                    SELECT
                        Id,
                        Name,
                        Consumable_Product__c,
                        Bar_Code__c,
                        Consumable_Product__r.Name__c,
                        Asset_Model_No__c,
                        Isoverdue__c,
                        Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Id in :pandiandetailsMap.keySet()
                            order by Name];
                    WHERE Id IN :pandiandetailsMap.keySet()
                    ORDER BY Name
                ];
            }
            initStandardController();
            showcod2nid = cod2s();
@@ -524,15 +614,17 @@
            }
            iSinventory = true;
            if(codPageRecords.size() > 0) done = true;
            if (codPageRecords.size() > 0)
                done = true;
            consumableorderdetailsRecordserrordummy.clear();
            //pandiandetailsList = new list<Consumable_order_details2__c>();
            pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c,
                                    Box_Piece__c,Lose_reason__c
            pandiandetailsList = [
                SELECT Id, Bar_Code__c, Consumable_Product__r.Name__c, Box_Piece__c, Lose_reason__c
                                FROM Consumable_order_details2__c
                                WHERE Id in :pandiandetailsMap.keySet()
                                order by Name];
                WHERE Id IN :pandiandetailsMap.keySet()
                ORDER BY Name
            ];
            for(Consumable_order_details2__c codDet : pandiandetailsList){
                codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
            }
@@ -587,10 +679,7 @@
            res.status = 'Success1';
         
            return res;
        }
        //CHAN-B7J4NB 只有一个时,盘点不到
        //init();
@@ -602,21 +691,23 @@
// ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCodeListP' + BarCodeListP));
        /***************************************************************************/
        // BarCode的检索  所有在库
        reSet = [select Id,Consumable_Product__c,Consumable_Product__r.Name__c,
                        Box_Piece__c,Bar_Code_search__c,Isoverdue__c
                    from Consumable_order_details2__c
                    where Bar_Code_search__c in :BarCodeListP
                    AND Dealer_Arrive__c = true
                    AND Dealer_Shipment__c = false
                    AND Dealer_Saled__c = false
                    AND Dealer_Returned__c = false
                    AND Lose_Flag__c = false
                    AND Cancellation_Date__c = null
                    and Bar_Code__c !=null
                    AND Product_Type__c like : sqlagencyProType
        reSet = [
            SELECT Id, Consumable_Product__c, Consumable_Product__r.Name__c, Box_Piece__c, Bar_Code_search__c, Isoverdue__c
            FROM Consumable_order_details2__c
            WHERE
                Bar_Code_search__c IN :BarCodeListP
                AND Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Lose_Flag__c = FALSE
                AND Cancellation_Date__c = NULL
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
                    AND  Dealer_Info_text__c = :accountName
                    order by Name];
            ORDER BY Name
        ];
                    System.debug('reSet===>'+reSet);
        Map<String, Integer> pandianProdIdCountMap = new Map<String, Integer>();        // ProdId 単位
        // 20200509 add gzw 记录需要销存数量
@@ -639,34 +730,52 @@
                if (pandianoverdueCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
                    pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
                } else {
                    pandianoverdueCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianoverdueCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1);
                    pandianoverdueCountMap.put(
                        rs.Consumable_Product__c + rs.Box_Piece__c,
                        pandianoverdueCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1
                    );
                }
                continue;
            }
            if (pandianProdIdCountMap.containsKey(rs.Consumable_product__c + rs.Box_Piece__c) == false) {
                pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, 1);
            } else {
                pandianProdIdCountMap.put(rs.Consumable_Product__c + rs.Box_Piece__c, pandianProdIdCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1);
                pandianProdIdCountMap.put(
                    rs.Consumable_Product__c + rs.Box_Piece__c,
                    pandianProdIdCountMap.get(rs.Consumable_Product__c + rs.Box_Piece__c) + 1
                );
            }
        }
        // 经销商之间或者同一经销商不同工作地调货
        List<Consumable_order_details2__c> reSet1 = [SELECT Id,  Name,Consumable_Product__c,
                        Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Shipment__c,Dealer_Saled__c,
                        Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Dealer_Arrive__c,
                        Bar_Code_search__c,Dealer_Info_text__c
        List<Consumable_order_details2__c> reSet1 = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Dealer_Shipment__c,
                Dealer_Saled__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Dealer_Arrive__c,
                Bar_Code_search__c,
                Dealer_Info_text__c
                    FROM Consumable_order_details2__c
                    WHERE (Dealer_Arrive__c = TRUE
                    or  Dealer_Shipment__c= TRUE
                    or  Dealer_Saled__c = TRUE)
            WHERE
                (Dealer_Arrive__c = TRUE
                OR Dealer_Shipment__c = TRUE
                OR Dealer_Saled__c = TRUE)
                    AND  Dealer_Returned__c = FALSE
                    AND  Cancellation_Flag__c = FALSE
                    AND  Bar_Code_search__c in :BarCodeListP
                AND Bar_Code_search__c IN :BarCodeListP
                    AND (Dealer_Info_text__c != :accountName
                        OR (Dealer_Info_text__c = :accountName
                            AND Arrive_Owner_Work_Location__c != :userWorkLocation)
                    )
                    ORDER BY Name ];
                AND Arrive_Owner_Work_Location__c != :userWorkLocation))
            ORDER BY Name
        ];
        Map<String,Consumable_order_details2__c> otherAgProMap = new Map<String,Consumable_order_details2__c>();
        for(Consumable_order_details2__c cod2 :reSet1){
            otherAgProMap.put(cod2.Bar_Code__c,cod2);
@@ -682,28 +791,40 @@
                reFindProductList.add(cod2);
                proIdNotinpage.put(cod2.Consumable_Product__c, cod2.Box_Piece__c);
            }
            if(!barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c)
                && otherAgProMap.containsKey(cod2.Bar_Code__c)
                && (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true
                || otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true) ){
            if (
                !barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) &&
                otherAgProMap.containsKey(cod2.Bar_Code__c) &&
                (otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == true ||
                otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == true)
            ) {
                consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'无此产品的库存,请入库。'));
                pandiandetailsMap.put(cod2.Id, '无此产品的库存,请入库。');
            }
        }
        //寻回明细
        List<Consumable_order_details2__c> productAdjust = new List<Consumable_order_details2__c>();
        productAdjust = [select Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,Lose_reason__c,
                            Asset_Model_No__c,Box_Piece__c,Bar_Code_search__c,Isoverdue__c
                        from Consumable_order_details2__c
                        where Bar_Code_search__c in :BarCodeListP
                          and Bar_Code__c !=null
                          and Lose_Flag__c = true
                          AND Product_Type__c like : sqlagencyProType
        productAdjust = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Lose_reason__c,
                Asset_Model_No__c,
                Box_Piece__c,
                Bar_Code_search__c,
                Isoverdue__c
            FROM Consumable_order_details2__c
            WHERE
                Bar_Code_search__c IN :BarCodeListP
                AND Bar_Code__c != NULL
                AND Lose_Flag__c = TRUE
                AND Product_Type__c LIKE :sqlagencyProType
                          AND  Dealer_Info_text__c = :accountName
                          AND Arrive_Owner_Work_Location__c =: userWorkLocation
                        order by Name];
            ORDER BY Name
        ];
        for (Consumable_order_details2__c rs : productAdjust){
            // 过期库存销存 20200427 gzw add srart
@@ -737,18 +858,22 @@
            List<ConsumableorderdetailsInfo> boxRecords = new List<ConsumableorderdetailsInfo>();
            Map<String,ConsumableorderdetailsInfo> newMidBoxMap = new Map<String,ConsumableorderdetailsInfo>();
            Map<String,ConsumableorderdetailsInfo> newMidPieceMap = new Map<String,ConsumableorderdetailsInfo>();
            List<Product2__c> product_Refind = [select Id, Name,Name__c,SFDA_Status__c,Packing_list_manual__c,Asset_Model_No__c
                                    from Product2__c
                                    WHERE Id in :proIdNotinpage.keySet()];
            List<Product2__c> product_Refind = [
                SELECT Id, Name, Name__c, SFDA_Status__c, Packing_list_manual__c, Asset_Model_No__c
                FROM Product2__c
                WHERE Id IN :proIdNotinpage.keySet()
            ];
            for(Product2__c pro : product_Refind){
                midMap.put(pro.Id, pro);
            }
            for(Integer i = 0 ; i< reFindProductList.size();i++){
                //然后循环CountDel做Box和piece2个map
                if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '盒'){
                    if(newMidBoxMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){
                        ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c).clone();
                        ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
                                reFindProductList[i].Consumable_Product__c + reFindProductList[i].Box_Piece__c
                            )
                            .clone();
                        Jstage.countid = 0 ;
                        if(reFindProductList[i].Isoverdue__c == 1){
                            Jstage.limitCount = 0;
@@ -756,7 +881,9 @@
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidBoxMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
}else{
                                            ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c));
                        ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
                            MidMap.get(reFindProductList[i].Consumable_Product__c)
                        );
                        Jstage.countid = 0 ;
                        if(reFindProductList[i].Isoverdue__c == 1){
                            Jstage.limitCount = 0;
@@ -766,7 +893,10 @@
                    }
                }else if(MidMap.containsKey(reFindProductList[i].Consumable_Product__c) && reFindProductList[i].Box_Piece__c == '个'){
                    if(newMidPieceMap.containsKey(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c)){
                        ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(reFindProductList[i].Consumable_product__c+reFindProductList[i].Box_Piece__c).clone();
                        ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                                reFindProductList[i].Consumable_product__c + reFindProductList[i].Box_Piece__c
                            )
                            .clone();
                        Jstage.countid = 0 ;
                        if(reFindProductList[i].Isoverdue__c == 1){
                            Jstage.limitCount = 0;
@@ -774,7 +904,9 @@
                        Jstage.boxPiece = reFindProductList[i].Box_Piece__c;
                        newMidPieceMap.put(reFindProductList[i].Consumable_Product__c+reFindProductList[i].Box_Piece__c, Jstage);
                    }else{
                        ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(MidMap.get(reFindProductList[i].Consumable_Product__c));
                        ConsumableorderdetailsInfo Jstage = new ConsumableorderdetailsInfo(
                            MidMap.get(reFindProductList[i].Consumable_Product__c)
                        );
                        Jstage.countid = 0 ;
                        if(reFindProductList[i].Isoverdue__c == 1){
                            Jstage.limitCount = 0;
@@ -825,19 +957,29 @@
            }
        }
        //已经出库的产品
        List<Consumable_order_details2__c>  reSet2 = [SELECT Id,  Name,Consumable_Product__c,
                        Bar_Code__c,Consumable_Product__r.Name__c,
                        Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
                        Bar_Code_search__c,Dealer_Info_text__c
        List<Consumable_order_details2__c> reSet2 = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Bar_Code_search__c,
                Dealer_Info_text__c
                    FROM Consumable_order_details2__c
                    WHERE Dealer_Arrive__c = TRUE
            WHERE
                Dealer_Arrive__c = TRUE
                    AND  (Dealer_Shipment__c= TRUE
                    or  Dealer_Saled__c = TRUE)
                OR Dealer_Saled__c = TRUE)
                    AND  Dealer_Returned__c = FALSE
                    AND  Cancellation_Flag__c = FALSE
                    AND  Bar_Code_search__c in :BarCodeListP
                AND Bar_Code_search__c IN :BarCodeListP
                    AND Dealer_Info_text__c = :accountName
                    ORDER BY Name ];
            ORDER BY Name
        ];
        Map<String,Consumable_order_details2__c> needreturnMap = new Map<String,Consumable_order_details2__c>();
        for(Consumable_order_details2__c cod2 :reSet2){
            needreturnMap.put(cod2.Bar_Code__c,cod2);
@@ -873,12 +1015,23 @@
                            continue;
                        }
                        if (ProductCount_Res[i].Isoverdue__c == 0) {
                            consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(ProductCount_Res[i],'该产品已经过有效期,请销存。'));
                            consumableorderdetailsRecordserrordummy.add(
                                new ConsumableorderdetailsInfo(ProductCount_Res[i], '该产品已经过有效期,请销存。')
                            );
                            pandiandetailsMap.put(ProductCount_Res[i].Id, '该产品已经过有效期,请销存。');
                            if (pandianoverdueCountMap.containsKey(ProductCount_Res[i].Consumable_product__c + ProductCount_Res[i].Box_Piece__c) == false) {
                            if (
                                pandianoverdueCountMap.containsKey(
                                    ProductCount_Res[i].Consumable_product__c + ProductCount_Res[i].Box_Piece__c
                                ) == false
                            ) {
                                pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, 1);
                            } else {
                                pandianoverdueCountMap.put(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c, pandianoverdueCountMap.get(ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c) + 1);
                                pandianoverdueCountMap.put(
                                    ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c,
                                    pandianoverdueCountMap.get(
                                        ProductCount_Res[i].Consumable_Product__c + ProductCount_Res[i].Box_Piece__c
                                    ) + 1
                                );
                            }
                            continue;
                        }
@@ -890,12 +1043,22 @@
                // 同时存在其他经销商库存产品
                for(Consumable_order_details2__c cod2 : reSet1){
                    if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){
                        if(barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c)
                            && otherAgProMap.containsKey(cod2.Bar_Code__c)
                            && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false
                            && otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false ){
                            consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。'));
                            pandiandetailsMap.put(cod2.Id, '该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。');
                        if (
                            barCodeListPandianMap.containsKey(cod2.Bar_Code_search__c) &&
                            otherAgProMap.containsKey(cod2.Bar_Code__c) &&
                            otherAgProMap.get(cod2.Bar_Code__c).Dealer_Saled__c == false &&
                            otherAgProMap.get(cod2.Bar_Code__c).Dealer_Shipment__c == false
                        ) {
                            consumableorderdetailsRecordserrordummy.add(
                                new ConsumableorderdetailsInfo(
                                    cod2,
                                    '该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。'
                                )
                            );
                            pandiandetailsMap.put(
                                cod2.Id,
                                '该产品归属于' + otherAgProMap.get(cod2.Bar_Code__c).Dealer_Info_text__c + '的库存。'
                            );
                            continue;
                        }
                    }
@@ -904,7 +1067,9 @@
                for(Consumable_order_details2__c cod2 : reSet2){
                    if(cod2.Consumable_Product__c == ass.Prod.Id && ass.boxPiece == cod2.Box_Piece__c){
                        if(needreturnMap.containsKey(cod2.Bar_Code__c)){
                            consumableorderdetailsRecordserrordummy.add(new ConsumableorderdetailsInfo(cod2,'该产品目前出库状态,请返品。'));
                            consumableorderdetailsRecordserrordummy.add(
                                new ConsumableorderdetailsInfo(cod2, '该产品目前出库状态,请返品。')
                            );
                            pandiandetailsMap.put(cod2.Id, '该产品目前出库状态,请返品。');
                            continue;
                        }
@@ -942,7 +1107,6 @@
            }
        }
        //寻回做成
        for(ConsumableorderdetailsInfo ass :consumableorderdetailsRecords){
            for(ConsumableorderdetailsInfo adjust :consumableorderdetailsRecordsAdjust){
@@ -958,28 +1122,37 @@
            }
        }
        if (pandiandetailsMap.keySet().size() > 0) {
            List<Consumable_order_details2__c> showcod2 = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
            List<Consumable_order_details2__c> showcod2 = [
                SELECT
                    Id,
                    Name,
                    Consumable_Product__c,
                    Bar_Code__c,
                    Consumable_Product__r.Name__c,
                    Asset_Model_No__c,
                    Isoverdue__c,
                    Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Id in :pandiandetailsMap.keySet()
                            order by Name];
                WHERE Id IN :pandiandetailsMap.keySet()
                ORDER BY Name
            ];
            initStandardController();
            showcod2nid = cod2s();
        }
        for (Consumable_order_details2__c cod2 : showcod2nid) {
            codPageRecords.add(new ConsumableorderdetailsInfo(cod2,pandiandetailsMap.get(cod2.Id)));
        }
        if(codPageRecords.size() > 0) done = true;
        if (codPageRecords.size() > 0)
            done = true;
        iSinventory = true;
        consumableorderdetailsRecordserrordummy.clear();
        pandiandetailsList = [select Id, Bar_Code__c,Consumable_Product__r.Name__c,
                                Box_Piece__c,Lose_reason__c
        pandiandetailsList = [
            SELECT Id, Bar_Code__c, Consumable_Product__r.Name__c, Box_Piece__c, Lose_reason__c
                            FROM Consumable_order_details2__c
                            WHERE Id in :pandiandetailsMap.keySet()
                            order by Name];
            WHERE Id IN :pandiandetailsMap.keySet()
            ORDER BY Name
        ];
        for(Consumable_order_details2__c codDet : pandiandetailsList){
            codDet.Lose_reason__c = pandiandetailsMap.get(codDet.Id);
        }
@@ -1039,8 +1212,18 @@
    
    // 保存按钮
    @AuraEnabled
    public static ResponseBodyLWC save(Boolean iSinventory,String consumableorderdetailsRecordsLWC,String accountid,String agencyProType,Map<Id,String> pandiandetailsMap,List<Consumable_order_details2__c> reSet) {
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsLWC,List<ConsumableorderdetailsInfo>.class);
    public static ResponseBodyLWC save(
        Boolean iSinventory,
        String consumableorderdetailsRecordsLWC,
        String accountid,
        String agencyProType,
        Map<Id, String> pandiandetailsMap,
        List<Consumable_order_details2__c> reSet
    ) {
        List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = (List<ConsumableorderdetailsInfo>) JSON.deserialize(
            consumableorderdetailsRecordsLWC,
            List<ConsumableorderdetailsInfo>.class
        );
        agencyProType = agencyProType;
        accountid =accountid;
        pandiandetailsMap = pandiandetailsMap;
@@ -1098,9 +1281,9 @@
            insert  Po;
            eSetId = Po.id;
            List<Consumable_order__c> Consumable_order = [SELECT Name FROM Consumable_order__c WHERE id =:Po.id];
            List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>();
            List<Consumable_order_details2__c> InsListUp = New List<Consumable_order_details2__c>();
            List<Consumable_order_details2__c> updListAdjust = New List<Consumable_order_details2__c>();
            List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>();
            List<Consumable_order_details2__c> InsListUp = new List<Consumable_order_details2__c>();
            List<Consumable_order_details2__c> updListAdjust = new List<Consumable_order_details2__c>();
            Map<String,String> ErrorName = new Map<String,String>();
            Map<String,Boolean> CheckTF = new Map<String,Boolean>();
            for(ConsumableorderdetailsInfo header : consumableorderdetailsRecords){
@@ -1129,13 +1312,21 @@
            if(InsList.size()>0){
                insert InsList;
            }
            List<Consumable_order_details2__c> showcod2 = [select Id,  Name,Consumable_Product__c,
                                Bar_Code__c,Consumable_Product__r.Name__c,
                                Asset_Model_No__c,Isoverdue__c,Box_Piece__c,
            List<Consumable_order_details2__c> showcod2 = [
                SELECT
                    Id,
                    Name,
                    Consumable_Product__c,
                    Bar_Code__c,
                    Consumable_Product__r.Name__c,
                    Asset_Model_No__c,
                    Isoverdue__c,
                    Box_Piece__c,
                                Bar_Code_search__c
                            FROM Consumable_order_details2__c
                            WHERE Id in :pandiandetailsMap.keySet()
                            order by Name];
                WHERE Id IN :pandiandetailsMap.keySet()
                ORDER BY Name
            ];
            for(Consumable_order_details2__c cod : showcod2){
                Consumable_order_details2__c InsDetail = new Consumable_order_details2__c();
                InsDetail.Id =cod.Id;
@@ -1164,7 +1355,6 @@
            if(InsListUp.size()>0){
                ControllerUtil.updateOrderDetailsSatus(InsListUp);// Commented By DTT - Li Jun for testing 20230407
            }
        }catch (Exception e) {
            Database.rollback(sp);
            // ApexPages.addMessages(ex);
@@ -1209,6 +1399,7 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -1241,7 +1432,6 @@
        @AuraEnabled
        public String boxPiece { get; set; }
        public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) {
            orderdetails2 = e;
            Prod = e.Consumable_Product__r;
            //e.Lose_reason__c = str;
force-app/main/default/classes/LexInventoryViewController.cls
@@ -32,7 +32,7 @@
    // };
    public static String[] proLimitAndDate = new List<String>{};
    private static Map<String, Date> productkucun = new Map<String, Date>();
    public static Map<String, Date> productkucun = new Map<String, Date>();
    public static List<SelectOption> categoryOptionList { get; set; }
    @AuraEnabled
    public static Map<String, String> categoryOptionMap { get; set; }
@@ -49,7 +49,7 @@
    public static String category1 { get; set; }
    public static Boolean editAble { get; set; }
    // 经销商在库产品ID
    public static List<String> orderDetZaikuList = new List<String>();
    public static List<String> orderDetZaikuList { get; set; }
    // 产品 ID
    public static String ESetId { get; set; }
    public static String idCheck { get; set; }
@@ -69,6 +69,7 @@
    // add by rentx 2021-3-10
    public LexInventoryViewController() {
        orderDetZaikuList = new List<String>();
        consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>();
        consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>();
        editAble = false;
@@ -97,7 +98,6 @@
        categoryOptionMap = new Map<String, String>();
        category4OptionMap = new Map<String, String>();
        category5OptionMap = new Map<String, String>();
        // 取用户ID
        String userId = UserInfo.getUserId();
@@ -239,9 +239,7 @@
                }
                if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
                    ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                            CountDel[i].Consumable_Product__c +
                            CountDel[i].Box_Piece__c +
                            tex
                            CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
                        )
                        .clone();
                    Jstage.allnumber = Jstage.allnumber + 1;
@@ -407,9 +405,11 @@
        data.put('consumableorderdetailsRecords', consumableorderdetailsRecords);
        data.put('hasHos', hasHos);
        data.put('productLimtAndDate',proLimitAndDate);
        data.put('productkucun', productkucun);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
        System.debug('productkucun = ' + productkucun);
        return res;
    }
    @AuraEnabled
@@ -528,15 +528,19 @@
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String sortFieldLWC,
        String sortOrderLWC
        String sortOrderLWC,
        Map<String, Date> productkucunLWC
    ) {
        try {
            System.debug('orderDetZaikuListLWC===>'+orderDetZaikuListLWC);
            System.debug('productkucun===>' + productkucun);
            pageSize = pageSizeLWC;
            pageToken = pageTokenLWC;
            sortField = sortFieldLWC;
            sortOrder = sortOrderLWC;
            productkucun = new Map<String, Date>();
            orderDetZaikuList = new List<String>();
            productkucun = productkucunLWC;
            orderDetZaikuList = orderDetZaikuListLWC;
            sqlagencyProType = '%' + agencyProType + '%';
@@ -623,9 +627,7 @@
                    }
                    if (newMidBoxMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
                        ConsumableorderdetailsInfo Jstage = newMidBoxMap.get(
                                CountDel[i].Consumable_Product__c +
                                CountDel[i].Box_Piece__c +
                                tex
                                CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
                            )
                            .clone();
                        Jstage.allnumber = Jstage.allnumber + 1;
@@ -655,9 +657,7 @@
                    }
                    if (newMidPieceMap.containsKey(CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex)) {
                        ConsumableorderdetailsInfo Jstage = newMidPieceMap.get(
                                CountDel[i].Consumable_Product__c +
                                CountDel[i].Box_Piece__c +
                                tex
                                CountDel[i].Consumable_Product__c + CountDel[i].Box_Piece__c + tex
                            )
                            .clone();
                        Jstage.allnumber = Jstage.allnumber + 1;
@@ -932,7 +932,6 @@
    //     pageRecords.sort();
    // }
  
    //检索sql文做成
    private static String makeSoql(String CateName, String CateCode, String Category3, String Category4, String Category5) {
        System.debug('orderDetZaikuList = ' + orderDetZaikuList);
@@ -1051,6 +1050,7 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Consumable_order_details2__c esd { get; set; }
force-app/main/default/classes/LexInventoryViewControllerTest.cls
New file
@@ -0,0 +1,1122 @@
@isTest
public class LexInventoryViewControllerTest {
    static testMethod void testInnerClass() {
        List<LexInventoryViewController.ConsumableorderdetailsInfo> cro = new List<LexInventoryViewController.ConsumableorderdetailsInfo>();
        cro.sort();
    }
    static testMethod void LexInventoryViewControllerTest() {
        user myUser_test;
        Account myAccount1;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            List<RecordType> rectHos = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'];
            if (rectHos.size() == 0) {
                return;
            }
            myAccount1 = new Account(
                name = 'testaccount001',
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
                AgentCode_Ext__c = '9999900'
            );
            insert myAccount1;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount1.id
            );
            insert core;
            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',
                Work_Location__c = '深圳'
            );
            insert myUser_test;
        }
        System.runAs(myUser_test) {
            Product2 prod01 = new Product2(
                Name = '3400PK:PK针 5mmx33cm',
                ProductCode = 'Test01',
                Asset_Model_No__c = '3400PK:PK针 5mmx33cm',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = 'Test001',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Category5__c = 'tset',
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = 'Test002',
                Packing_list_manual__c = 12,
                SFDA_Expiration_Date__c = Date.today(),
                Category5__c = 'tset',
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02 };
            Product2__c pro1 = new Product2__c(
                Name = '3400PK:PK针 5mmx33cm',
                OT_CODE_Text__c = 'Test001',
                Product2__c = prod01.Id,
                Category3_text__c = '腹腔镜手术',
                Category4_text__c = 'PK',
                Category5_text__c = 'G400'
            );
            Product2__c pro2 = new Product2__c(
                Name = 'Pro002',
                OT_CODE_Text__c = 'Test002',
                Product2__c = prod02.Id,
                Category3_text__c = '腹腔镜手术',
                Category4_text__c = 'PK',
                Category5_text__c = 'G400'
            );
            insert new List<Product2__c>{ pro1, pro2 };
            System.debug('pro2===》' + pro2);
            System.debug('pro1===》' + pro1);
            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_Inventory;
            Order1.Order_ProType__c = 'ET';
            insert Order1;
            Consumable_order__c Order2 = new Consumable_order__c();
            Order2.Name = 'OCM_01_001';
            Order2.Order_status__c = '批准';
            Order2.Order_type__c = '订单';
            Order2.Dealer_Info__c = myAccount1.Id;
            Order2.RecordTypeid = System.Label.RT_ConOrder_Inventory;
            Order2.Order_ProType__c = 'ENg';
            insert Order2;
            Consumable_order_details2__c Orderdet1 = new Consumable_order_details2__c();
            Orderdet1.Name = 'OCM_01_001001';
            //Orderdet1.Consumable_principal__c = Order1.Id;
            Orderdet1.Consumable_order_minor__c = Order1.Id;
            Orderdet1.Consumable_Product__c = pro1.Id;
            Orderdet1.Consumable_Arrived_order__c = Order1.Id;
            //Orderdet1.IsArrival__c = true;
            Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet1.Bar_Code__c = '11111';
            Orderdet1.Arrive_date__c = Date.today().addDays(1);
            Orderdet1.Send_Date__c = null;
            Orderdet1.Used_date__c = null;
            Orderdet1.Lose_Flag__c = false;
            Orderdet1.Box_Piece__c = '盒';
            Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
            Orderdet2.Name = 'OCM_01_001002';
            //Orderdet2.Consumable_principal__c = Order1.Id;
            Orderdet2.Consumable_order_minor__c = Order1.Id;
            Orderdet2.Consumable_Product__c = pro1.Id;
            Orderdet2.Consumable_Arrived_order__c = Order1.Id;
            //Orderdet2.IsArrival__c = true;
            Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet2.Bar_Code__c = '22222';
            Orderdet2.Arrive_date__c = Date.today().addDays(1);
            Orderdet2.Send_Date__c = null;
            Orderdet2.Used_date__c = null;
            Orderdet2.Lose_Flag__c = false;
            Orderdet2.Box_Piece__c = '个';
            Orderdet2.Sterilization_limit__c = Date.today();
            Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
            Orderdet3.Name = 'OCM_01_001003';
            //Orderdet3.Consumable_principal__c = Order1.Id;
            Orderdet3.Consumable_order_minor__c = Order1.Id;
            Orderdet3.Consumable_Product__c = pro2.Id;
            Orderdet3.Consumable_Arrived_order__c = Order1.Id;
            //Orderdet3.IsArrival__c = true;
            Orderdet3.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet3.Bar_Code__c = '33333';
            Orderdet3.Arrive_date__c = Date.today().addDays(1);
            Orderdet3.Send_Date__c = null;
            Orderdet3.Used_date__c = null;
            Orderdet3.Lose_Flag__c = false;
            Orderdet3.Box_Piece__c = '个';
            Orderdet3.Sterilization_limit__c = Date.today();
            Consumable_order_details2__c Orderdet4 = new Consumable_order_details2__c();
            Orderdet4.Name = 'OCM_01_001004';
            //Orderdet4.Consumable_principal__c = Order1.Id;
            Orderdet4.Consumable_order_minor__c = Order1.Id;
            Orderdet4.Consumable_Product__c = pro1.Id;
            Orderdet4.Consumable_Arrived_order__c = Order1.Id;
            //Orderdet4.IsArrival__c = true;
            Orderdet4.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet4.Bar_Code__c = '44444';
            Orderdet4.Arrive_date__c = Date.today().addDays(1);
            Orderdet4.Send_Date__c = null;
            Orderdet4.Used_date__c = null;
            Orderdet4.Lose_Flag__c = false;
            Orderdet4.Box_Piece__c = '个';
            insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2, Orderdet3, Orderdet4 };
            //制作盘点履历
            List<Consumable_order__c> InsPDlist = new List<Consumable_order__c>();
            for (integer i = 1; i < 35; i++) {
                String str = string.valueOf(i);
                if (str.length() == 1) {
                    str = '0' + str;
                }
                Consumable_order__c PDlist = new Consumable_order__c(name = 'testPandianLVL_' + str);
                //Date ThisDate = Date.newInstance(2016,4,20+i/5);
                //PDlist.Inventory_date__c = ThisDate;
                PDlist.Order_type__c = '盘点';
                PDlist.RecordTypeid = System.Label.RT_ConOrder_Inventory;
                PDlist.Inventory_date__c = Date.today().addDays(-i);
                PDlist.Dealer_Info__c = myAccount1.Id;
                InsPDlist.add(PDlist);
            }
            List<String> orderDetZaikuListLWC = new List<String>();
            LexInventoryViewController controller = new LexInventoryViewController();
            Integer pageSizeLWC = 1;
            Integer pageTokenLWC = 0;
            String sortFieldLWC = '';
            String sortOrderLWC = '';
            String category1 = '3400PK:PK针 5mm×33cm';
            String Category3 = '腹腔镜手术';
            String Category4 = 'PK';
            String Category5 = 'G400';
            String accountName = '捷尔医疗(海南)有限公司';
            string agencyProType = 'ENG';
            string userWorkLocation = '深圳';
            LexInventoryViewController.category1 = category1;
            LexInventoryViewController.Category3 = Category3;
            LexInventoryViewController.Category4 = Category4;
            LexInventoryViewController.Category5 = Category5;
            LexInventoryViewController.orderDetZaikuList = new List<String>();
            LexInventoryViewController.init(pageSizeLWC, pageTokenLWC, sortFieldLWC, sortOrderLWC);
            system.debug('order detail:' + JSON.serialize(LexInventoryViewController.orderDetZaikuList));
            orderDetZaikuListLWC = LexInventoryViewController.orderDetZaikuList;
            System.debug('orderDetZaikuListLWC' + orderDetZaikuListLWC);
            Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
            LexInventoryViewController.searchConsumableorderdetails(
                category1,
                '',
                '',
                '',
                orderDetZaikuListLWC,
                accountName,
                agencyProType,
                userWorkLocation,
                pageSizeLWC,
                pageTokenLWC,
                sortFieldLWC,
                sortOrderLWC,
                productkucunLWC
            );
            LexInventoryViewController.searchConsumableorderdetails(
                category1,
                Category3,
                Category4,
                Category5,
                orderDetZaikuListLWC,
                accountName,
                agencyProType,
                userWorkLocation,
                pageSizeLWC,
                pageTokenLWC,
                sortFieldLWC,
                sortOrderLWC,
                productkucunLWC
            );
        }
    }
    static testMethod void InventoryViewSearchTest() {
        user myUser_test;
        Account myAccount1;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            myAccount1 = new Account(
                name = 'testaccount001',
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
                AgentCode_Ext__c = '9999900'
            );
            insert myAccount1;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount1.id
            );
            insert core;
            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'
            );
            insert myUser_test;
        }
        System.runAs(myUser_test) {
            Product2 prod01 = new Product2(
                Name = 'Test01',
                ProductCode = 'Test01',
                Asset_Model_No__c = 'Test01',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = 'CDS',
                Category4__c = 'OER',
                Category5__c = '其它',
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = 'ENT',
                Category4__c = 'Celon',
                Category5__c = 'Celon',
                Manual_Entry__c = false
            );
            Product2 prod03 = new Product2(
                Name = 'Test03',
                ProductCode = 'Test03',
                Asset_Model_No__c = 'Test03',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = 'US',
                Category4__c = 'ALOKA',
                Category5__c = '体外超声',
                Manual_Entry__c = false
            );
            Product2 prod04 = new Product2(
                Name = 'Test04',
                ProductCode = 'Test04',
                Asset_Model_No__c = 'Test04',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = 'OCS',
                Category4__c = '附属品',
                Category5__c = 'S45',
                Manual_Entry__c = false
            );
            Product2 prod05 = new Product2(
                Name = 'Test05',
                ProductCode = 'Test05',
                Asset_Model_No__c = 'Test05',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                Category3__c = '光源',
                Category4__c = '附属品',
                Category5__c = 'OCS',
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02, prod03, prod04, prod05 };
            Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id);
            Product2__c pro3 = new Product2__c(Name = 'Pro003', OT_CODE_Text__c = 'Test003', Product2__c = prod03.Id);
            Product2__c pro4 = new Product2__c(Name = 'Pro004', OT_CODE_Text__c = 'Test004', Product2__c = prod04.Id);
            Product2__c pro5 = new Product2__c(Name = 'Pro005', OT_CODE_Text__c = 'Test005', Product2__c = prod05.Id);
            insert new List<Product2__c>{ pro1, pro2, pro3, pro4, pro5 };
            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_Inventory;
            Order1.Order_ProType__c = 'ET';
            insert Order1;
            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.Consumable_Arrived_order__c = Order1.Id;
            Orderdet1.Sterilization_limit__c = Date.today();
            Orderdet1.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet1.Bar_Code__c = '11111';
            Orderdet1.Arrive_date__c = Date.today().addDays(1);
            Orderdet1.Send_Date__c = null;
            Orderdet1.Used_date__c = null;
            Orderdet1.Lose_Flag__c = false;
            Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
            Orderdet2.Name = 'OCM_01_001002';
            Orderdet2.Consumable_order_minor__c = Order1.Id;
            Orderdet2.Consumable_Product__c = pro1.Id;
            Orderdet2.Consumable_Arrived_order__c = Order1.Id;
            Orderdet2.Sterilization_limit__c = Date.today();
            Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet2.Bar_Code__c = '22222';
            Orderdet2.Arrive_date__c = Date.today().addDays(1);
            Orderdet2.Send_Date__c = null;
            Orderdet2.Used_date__c = null;
            Orderdet2.Lose_Flag__c = false;
            insert new List<Consumable_order_details2__c>{ Orderdet1, Orderdet2 };
            Integer pageSizeLWC = 1;
            Integer pageTokenLWC = 0;
            String sortFieldLWC = '';
            String sortOrderLWC = '';
            String category3LWC = 'CDS';
            String agencyProTypeLWC = 'ENG';
            String category1 = '3400PK:PK针 5mm×33cm';
            String Category3 = '腹腔镜手术';
            String Category4 = 'PK';
            String Category5 = 'G400';
            String accountName = '捷尔医疗(海南)有限公司';
            string agencyProType = 'ENG';
            string userWorkLocation = '深圳';
            List<String> orderDetZaikuListLWC = new List<String>();
            LexInventoryViewController.init(pageSizeLWC, pageTokenLWC, sortFieldLWC, sortOrderLWC);
            LexInventoryViewController.categoryAllload(category3LWC, agencyProTypeLWC);
            LexInventoryViewController.categoryload();
            //  LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
        }
    }
    //add by rentx 2020-12-25 start 查询非医院特价盒 /个
    static testMethod void InventoryViewTest2() {
        user myUser_test;
        Account myAccount2;
        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 = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            //Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证'];
            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)']; //20200916 ljh update
            myAccount2 = new Account(
                name = 'Testaccount002',
                Dealer_discount__c = 20,
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
                AgentCode_Ext__c = '9999900'
            );
            insert myAccount2;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount2.id
            );
            insert core;
            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 = '北京'
            );
            insert MyUser_Test;
        }
        System.runAs(MyUser_Test) {
            System.Test.startTest();
            StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
            Product2 prod01 = new Product2(
                Name = 'Test01',
                ProductCode = 'Test01',
                Asset_Model_No__c = 'Test01',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02 };
            Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id);
            insert new List<Product2__c>{ pro1, pro2 };
            Consumable_order__c createId = new Consumable_order__c();
            createId.Name = 'testMing';
            createId.Order_status__c = '批准';
            createId.Deliver_date__c = Date.today();
            createId.Dealer_Info__c = myAccount2.Id;
            createId.RecordTypeid = System.Label.RT_ConOrder_Delivery;
            createId.Order_type__c = '订单';
            createId.Order_ProType__c = 'ET';
            createId.Dealer_Info__c = myAccount2.Id;
            createId.Delivery_detail_count__c = 5;
            insert createId;
            //pro1 盒 在库
            List<Consumable_order_details2__c> codListTemp = new List<Consumable_order_details2__c>();
            Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
            createDetail2 = new Consumable_order_details2__c();
            createDetail2.Consumable_Product__c = pro1.id;
            createDetail2.Asset_Model_No__c = 'Test01';
            createDetail2.Consumable_order_minor__c = createId.id;
            createDetail2.Consumable_Arrived_order__c = createId.id;
            createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            createDetail2.Asset_Model_No__c = pro1.Asset_Model_No__c;
            createDetail2.Bar_Code__c = '123';
            createDetail2.Box_Piece__c = '盒';
            createDetail2.Arrive_date__c = Date.today();
            codListTemp.add(createDetail2);
            //insert createDetail2;
            Consumable_order_details2__c createDetailpro1 = new Consumable_order_details2__c();
            createDetailpro1.Consumable_Product__c = pro1.id;
            createDetailpro1.Asset_Model_No__c = 'Test02';
            createDetailpro1.Consumable_order_minor__c = createId.id;
            createDetailpro1.Consumable_Arrived_order__c = createId.id;
            createDetailpro1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            createDetailpro1.Asset_Model_No__c = pro1.Asset_Model_No__c;
            createDetailpro1.Bar_Code__c = '12322';
            createDetailpro1.Box_Piece__c = '盒';
            createDetailpro1.Arrive_date__c = Date.today();
            codListTemp.add(createDetailpro1);
            //insert createDetailpro1;
            //pro1 个 在库
            Consumable_order_details2__c createDetailPiece1 = new Consumable_order_details2__c();
            createDetailPiece1.Consumable_Product__c = pro1.id;
            createDetailPiece1.Asset_Model_No__c = 'Test03';
            createDetailPiece1.Consumable_order_minor__c = createId.id;
            createDetailPiece1.Consumable_Arrived_order__c = createId.id;
            createDetailPiece1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            createDetailPiece1.Asset_Model_No__c = pro1.Asset_Model_No__c;
            createDetailPiece1.Bar_Code__c = '23456';
            createDetailPiece1.Box_Piece__c = '个';
            createDetailPiece1.Arrive_date__c = Date.today();
            codListTemp.add(createDetailPiece1);
            //insert createDetailPiece1;
            Consumable_order_details2__c createDetailPiece2 = new Consumable_order_details2__c();
            createDetailPiece2.Consumable_Product__c = pro1.id;
            createDetailPiece2.Asset_Model_No__c = 'Test04';
            createDetailPiece2.Consumable_order_minor__c = createId.id;
            createDetailPiece2.Consumable_Arrived_order__c = createId.id;
            createDetailPiece2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            createDetailPiece2.Asset_Model_No__c = pro1.Asset_Model_No__c;
            createDetailPiece2.Bar_Code__c = '122345';
            createDetailPiece2.Box_Piece__c = '个';
            createDetailPiece2.Arrive_date__c = Date.today();
            codListTemp.add(createDetailPiece2);
            //insert createDetailPiece2;
            //pro1 盒 在库 过期
            Consumable_order_details2__c createDetail21 = new Consumable_order_details2__c();
            createDetail21.Consumable_Product__c = pro1.id;
            createDetail21.Asset_Model_No__c = 'Test01';
            createDetail21.Sterilization_limit__c = Date.today();
            createDetail21.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            //createDetail.IsArrival__c = true;
            createDetail21.Asset_Model_No__c = prod02.Asset_Model_No__c;
            createDetail21.Bar_Code__c = '1223';
            createDetail21.Box_Piece__c = '盒';
            createDetail21.Arrive_date__c = Date.today();
            createDetail21.Deliver_date__c = Date.today().addDays(-8);
            createDetail21.Sterilization_limit__c = Date.today().addDays(-8);
            codListTemp.add(createDetail21);
            //insert createDetail2;
            insert codListTemp;
            PageReference page = new PageReference('/apex/TopPage');
            System.Test.setCurrentPage(page);
            TopPageController lPCTest = new TopPageController();
            lPCTest.pagesize = 1;
            List<Consumable_Orderdetails__c> coListTest = new List<Consumable_Orderdetails__c>();
            Consumable_Orderdetails__c conOrderDetail1 = new Consumable_Orderdetails__c();
            conOrderDetail1.Consumable_count__c = 10;
            conOrderDetail1.Consumable_Arrivecount__c = 5;
            conOrderDetail1.Consumable_product__c = pro2.id;
            conOrderDetail1.Consumable_order__c = createId.Id;
            coListTest.add(conOrderDetail1);
            Consumable_Orderdetails__c conOrderDetail2 = new Consumable_Orderdetails__c();
            conOrderDetail2.Consumable_product__c = pro2.id;
            conOrderDetail2.Consumable_order__c = createId.Id;
            coListTest.add(conOrderDetail2);
            insert coListTest;
            Integer pageSizeLWC = 1;
            Integer pageTokenLWC = 0;
            String sortFieldLWC = '';
            String sortOrderLWC = '';
            String category3LWC = 'CDS';
            String agencyProTypeLWC = 'ENG';
            // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
            LexInventoryViewController.categoryAllload('CDS', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            LexInventoryViewController.categoryAllload('光源', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            System.Test.stopTest();
        }
    }
    static testMethod void InventoryViewTest3() {
        user myUser_test;
        Account myAccount2;
        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 = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            //Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证'];
            // Profile prof = [select Id from Profile where Name ='901_经销商社区普通权限_2重验证(Email)'];//20200916 ljh update
            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)']; //20210329 RTX update
            myAccount2 = new Account(
                name = 'Testaccount002',
                Dealer_discount__c = 20,
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
                AgentCode_Ext__c = '9999900'
            );
            insert myAccount2;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount2.id
            );
            insert core;
            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 = 'ENG',
                Work_Location__c = '北京'
            );
            insert MyUser_Test;
        }
        System.runAs(MyUser_Test) {
            System.Test.startTest();
            StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
            Product2 prod01 = new Product2(
                Name = 'Test01',
                ProductCode = 'Test01',
                Asset_Model_No__c = 'Test01',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02 };
            Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id);
            insert new List<Product2__c>{ pro1, pro2 };
            Consumable_order__c createId = new Consumable_order__c();
            createId.Name = 'testMing1';
            createId.Order_status__c = '批准';
            createId.Deliver_date__c = Date.today();
            createId.Dealer_Info__c = myAccount2.Id;
            createId.RecordTypeid = System.Label.RT_ConOrder_Delivery;
            createId.Order_type__c = '订单';
            createId.Order_ProType__c = 'ENG';
            createId.Dealer_Info__c = myAccount2.Id;
            createId.Delivery_detail_count__c = 5;
            createId.orderPattern__c = 'hospitalorder';
            insert createId;
            //pro1 盒 在库
            Consumable_order_details2__c createDetail2 = new Consumable_order_details2__c();
            createDetail2.Consumable_Product__c = pro1.id;
            createDetail2.Asset_Model_No__c = 'Test01';
            createDetail2.Consumable_order_minor__c = createId.id;
            createDetail2.Consumable_Arrived_order__c = createId.id;
            createDetail2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            createDetail2.Asset_Model_No__c = pro1.Asset_Model_No__c;
            createDetail2.Bar_Code__c = '123';
            createDetail2.Box_Piece__c = '盒';
            createDetail2.Arrive_date__c = Date.today();
            insert createDetail2;
            List<Consumable_order_details2__c> codListTemp = new List<Consumable_order_details2__c>();
            Consumable_order_details2__c createDetailpro1 = new Consumable_order_details2__c();
            createDetailpro1.Consumable_Product__c = pro1.id;
            createDetailpro1.Asset_Model_No__c = 'Test02';
            createDetailpro1.Consumable_order_minor__c = createId.id;
            createDetailpro1.Consumable_Arrived_order__c = createId.id;
            createDetailpro1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            createDetailpro1.Asset_Model_No__c = pro1.Asset_Model_No__c;
            createDetailpro1.Bar_Code__c = '12322';
            createDetailpro1.Box_Piece__c = '盒';
            createDetailpro1.Arrive_date__c = Date.today();
            //insert createDetailpro1;
            codListTemp.add(createDetailpro1);
            //pro1 个 在库
            Consumable_order_details2__c createDetailPiece1 = new Consumable_order_details2__c();
            createDetailPiece1.Consumable_Product__c = pro1.id;
            createDetailPiece1.Asset_Model_No__c = 'Test03';
            createDetailPiece1.Consumable_order_minor__c = createId.id;
            createDetailPiece1.Consumable_Arrived_order__c = createId.id;
            createDetailPiece1.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            createDetailPiece1.Asset_Model_No__c = pro1.Asset_Model_No__c;
            createDetailPiece1.Bar_Code__c = '23456';
            createDetailPiece1.Box_Piece__c = '个';
            createDetailPiece1.Arrive_date__c = Date.today();
            codListTemp.add(createDetailPiece1);
            //insert createDetailPiece1;
            Consumable_order_details2__c createDetailPiece2 = new Consumable_order_details2__c();
            createDetailPiece2.Consumable_Product__c = pro1.id;
            createDetailPiece2.Asset_Model_No__c = 'Test04';
            createDetailPiece2.Consumable_order_minor__c = createId.id;
            createDetailPiece2.Consumable_Arrived_order__c = createId.id;
            createDetailPiece2.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            createDetailPiece2.Asset_Model_No__c = pro1.Asset_Model_No__c;
            createDetailPiece2.Bar_Code__c = '122345';
            createDetailPiece2.Box_Piece__c = '个';
            createDetailPiece2.Arrive_date__c = Date.today();
            codListTemp.add(createDetailPiece2);
            //insert createDetailPiece2;
            //pro1 盒 在库 过期
            Consumable_order_details2__c createDetail21 = new Consumable_order_details2__c();
            createDetail21.Consumable_Product__c = pro1.id;
            createDetail21.Asset_Model_No__c = 'Test01';
            createDetail21.Sterilization_limit__c = Date.today();
            createDetail21.RecordTypeid = System.Label.RT_ConOrderDetail2_Delivery;
            //createDetail.IsArrival__c = true;
            createDetail21.Asset_Model_No__c = prod02.Asset_Model_No__c;
            createDetail21.Bar_Code__c = '1223';
            createDetail21.Box_Piece__c = '盒';
            createDetail21.Arrive_date__c = Date.today();
            createDetail21.Deliver_date__c = Date.today().addDays(-8);
            createDetail21.Sterilization_limit__c = Date.today().addDays(-8);
            codListTemp.add(createDetail21);
            //insert createDetail21;
            insert codListTemp;
            PageReference page = new PageReference('/apex/TopPage');
            System.Test.setCurrentPage(page);
            TopPageController lPCTest = new TopPageController();
            lPCTest.pagesize = 1;
            List<Consumable_Orderdetails__c> coListTest = new List<Consumable_Orderdetails__c>();
            Consumable_Orderdetails__c conOrderDetail1 = new Consumable_Orderdetails__c();
            conOrderDetail1.Consumable_count__c = 10;
            conOrderDetail1.Consumable_Arrivecount__c = 5;
            conOrderDetail1.Consumable_product__c = pro2.id;
            conOrderDetail1.Consumable_order__c = createId.Id;
            coListTest.add(conOrderDetail1);
            Consumable_Orderdetails__c conOrderDetail2 = new Consumable_Orderdetails__c();
            conOrderDetail2.Consumable_product__c = pro2.id;
            conOrderDetail2.Consumable_order__c = createId.Id;
            coListTest.add(conOrderDetail2);
            insert coListTest;
            Integer pageSizeLWC = 1;
            Integer pageTokenLWC = 0;
            String sortFieldLWC = '';
            String sortOrderLWC = '';
            String category1 = '3400PK:PK针 5mm×33cm';
            String Category3 = '腹腔镜手术';
            String Category4 = 'PK';
            String Category5 = 'G400';
            List<String> orderDetZaikuListLWC = new List<String>();
            String accountName = '捷尔医疗(海南)有限公司';
            string agencyProType = 'ET';
            string userWorkLocation = '深圳';
            LexInventoryViewController.category1 = category1;
            LexInventoryViewController.Category3 = Category3;
            LexInventoryViewController.Category4 = Category4;
            LexInventoryViewController.Category5 = Category5;
            // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
            // LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC,accountName,agencyProType,userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
            LexInventoryViewController.categoryAllload('CDS', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            LexInventoryViewController.categoryAllload('光源', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
        }
    }
    static testMethod void InventoryViewTest4() {
        user myUser_test;
        Account myAccount2;
        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 = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET Email)']; //20210329 RTX update
            myAccount2 = new Account(
                name = 'Testaccount002',
                Dealer_discount__c = 20,
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|5|55,Test02|2|4',
                AgentCode_Ext__c = '9999900'
            );
            insert myAccount2;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount2.id
            );
            insert core;
            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 = '济南'
            );
            insert MyUser_Test;
        }
        System.runAs(MyUser_Test) {
            Integer pageSizeLWC = 1;
            Integer pageTokenLWC = 0;
            String sortFieldLWC = '';
            String sortOrderLWC = '';
            String category1 = '3400PK:PK针 5mm×33cm';
            String Category3 = '腹腔镜手术';
            String Category4 = 'PK';
            String Category5 = 'G400';
            String accountName = 'Testaccount002';
            string agencyProType = 'ET';
            string userWorkLocation = '济南';
            List<String> orderDetZaikuListLWC = new List<String>();
            List<String> productCodeList = new List<String>();
            Product2 prod01 = new Product2(
                Name = 'Test01',
                ProductCode = 'Test01',
                Asset_Model_No__c = 'Test01',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            Product2 prod02 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = '12124',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod01, prod02 };
            Product2__c pro1 = new Product2__c(Name = 'Pro001', OT_CODE_Text__c = 'Test001', Product2__c = prod01.Id);
            Product2__c pro2 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod02.Id);
            insert new List<Product2__c>{ pro1, pro2 };
            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 = myAccount2.Id;
            Order1.RecordTypeid = System.Label.RT_ConOrder_Delivery;
            Order1.Order_ProType__c = 'ENG';
            insert Order1;
            Consumable_order__c Order2 = new Consumable_order__c();
            Order2.Name = 'OCM_01_003';
            Order2.Order_status__c = '批准';
            Order2.Order_type__c = '订单';
            Order2.Dealer_Info__c = myAccount2.Id;
            Order2.RecordTypeid = System.Label.RT_ConOrder_Delivery;
            Order2.Order_ProType__c = 'ET';
            insert Order2;
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            Consumable_order_details2__c Orderdet2 = new Consumable_order_details2__c();
            Orderdet2.Name = 'OCM_01_001002';
            //Orderdet2.Consumable_principal__c = Order1.Id;
            Orderdet2.Consumable_order_minor__c = Order1.Id;
            Orderdet2.Consumable_Product__c = pro1.Id;
            Orderdet2.Consumable_Arrived_order__c = Order1.Id;
            //Orderdet2.IsArrival__c = true;
            Orderdet2.RecordTypeId = System.Label.RT_ConOrderDetail2_Delivery;
            Orderdet2.Bar_Code__c = '22222';
            Orderdet2.Arrive_date__c = Date.today().addDays(1);
            Orderdet2.Send_Date__c = null;
            Orderdet2.Used_date__c = Date.today();
            Orderdet2.Lose_Flag__c = false;
            Orderdet2.Box_Piece__c = '个';
            Orderdet2.Sterilization_limit__c = Date.today();
            Orderdet2.Return_date__c = Date.today();
            Orderdet2.Bar_Code__c = '1683272847250250WZIOF';
            Orderdet2.Cancellation_Flag__c = false;
            conList.add(Orderdet2);
            Consumable_order_details2__c Orderdet3 = new Consumable_order_details2__c();
            Orderdet3.Arrive_date__c = Date.today();
            Orderdet3.Send_Date__c = null;
            Orderdet3.Used_date__c = null;
            Orderdet3.Return_date__c = null;
            Orderdet3.Lose_Flag__c = false;
            Orderdet3.Cancellation_Flag__c = false;
            Orderdet3.Bar_Code__c = '1234';
            Orderdet3.Consumable_order_minor__c = Order2.Id;
            Orderdet2.Consumable_Product__c = pro1.Id;
            Orderdet3.Consumable_Arrived_order__c = Order2.Id;
            Orderdet3.Recordtypeid = '01210000000kUDKAA2';
            Orderdet3.Sterilization_limit__c = Date.today().addDays(1);
            conList.add(Orderdet3);
            insert conList;
            System.debug('conList==>' + conList);
            LexInventoryViewController.category1 = category1;
            LexInventoryViewController.Category3 = Category3;
            LexInventoryViewController.Category4 = Category4;
            LexInventoryViewController.Category5 = Category5;
            // LexInventoryViewController.init(pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
            Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
            LexInventoryViewController.searchConsumableorderdetails(
                category1,
                category3,
                category4,
                category5,
                orderDetZaikuListLWC,
                accountName,
                agencyProType,
                userWorkLocation,
                pageSizeLWC,
                pageTokenLWC,
                sortFieldLWC,
                sortOrderLWC,
                productkucunLWC
            );
            LexInventoryViewController.categoryAllload('CDS', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            LexInventoryViewController.categoryAllload('光源', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            // LexInventoryViewController.searchConsumableorderdetails(category1,category3,category4,category5,orderDetZaikuListLWC ,accountName,agencyProType,
            // userWorkLocation,pageSizeLWC,pageTokenLWC,sortFieldLWC,sortOrderLWC);
        }
    }
    static testMethod void supplementTest() {
        user myUser_test;
        Account myAccount1;
        User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()];
        System.runAs(thisUser) {
            Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)'];
            List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店'];
            if (rectCo.size() == 0) {
                return;
            }
            List<RecordType> rectHos = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院'];
            if (rectHos.size() == 0) {
                return;
            }
            myAccount1 = new Account(
                name = 'testaccount001',
                RecordTypeId = rectCo[0].Id,
                Product_Limit_Date__c = 'Test01|2|4,Test02|3|5',
                AgentCode_Ext__c = '9999900'
            );
            insert myAccount1;
            Contact core = new Contact(
                email = 'jplumber@salesforce.com',
                firstname = 'Joe',
                lastname = 'Plumber',
                accountid = myAccount1.id
            );
            insert core;
            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',
                Work_Location__c = '深圳'
            );
            insert myUser_test;
        }
        System.runAs(myUser_test) {
            Product2 prod05 = new Product2(
                Name = '3400PK:PK针 5mmx33cm',
                ProductCode = 'Test01',
                Asset_Model_No__c = '3400PK:PK针 5mmx33cm',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = 'Test001',
                Packing_list_manual__c = 1,
                SFDA_Expiration_Date__c = Date.today(),
                Manual_Entry__c = false
            );
            Product2 prod06 = new Product2(
                Name = 'Test02',
                ProductCode = 'Test02',
                Asset_Model_No__c = 'Test02',
                SFDA_Status__c = '有効',
                Dealer_special_Object__c = true,
                SFDA_Approbation_No__c = 'Test002',
                Packing_list_manual__c = 12,
                SFDA_Expiration_Date__c = Date.today(),
                Category5__c = 'tset',
                Manual_Entry__c = false
            );
            insert new List<Product2>{ prod05, prod06 };
            Product2__c pro11 = new Product2__c(
                Name = 'Pro001',
                OT_CODE_Text__c = 'Test001',
                Product2__c = prod05.Id,
                Category3_text__c = '分类3'
            );
            Product2__c pro22 = new Product2__c(Name = 'Pro002', OT_CODE_Text__c = 'Test002', Product2__c = prod06.Id);
            insert new List<Product2__c>{ pro11, pro22 };
            System.debug('pro11===>' + pro11);
            List<Consumable_order__c> orderList = new List<Consumable_order__c>();
            //发货
            Consumable_order__c Order4 = new Consumable_order__c();
            Order4.Name = 'OCM_0122';
            Order4.Order_status__c = '批准';
            Order4.Order_type__c = '订单';
            Order4.Dealer_Info__c = myAccount1.Id;
            Order4.RecordTypeid = '01210000000c9drAAA';
            Order4.Order_ProType__c = 'ET';
            Order4.ContractNo__c = '';
            orderList.add(Order4);
            insert orderList;
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            //orderDetZaiku init
            Consumable_order_details2__c con1 = new Consumable_order_details2__c();
            con1.Arrive_date__c = Date.today();
            con1.Send_Date__c = null;
            con1.Used_date__c = null;
            con1.Return_date__c = null;
            con1.Lose_Flag__c = false;
            con1.Cancellation_Flag__c = false;
            con1.Bar_Code__c = '1234';
            // con1.Consumable_order_minor__c = Order2.Id;
            con1.Consumable_Product__c = pro11.Id;
            con1.Consumable_Arrived_order__c = Order4.Id;
            con1.Recordtypeid = '01210000000kUDKAA2';
            // con1.Sterilization_limit__c = Date.today().addDays(1);
            conList.add(con1);
            Consumable_order_details2__c con2 = new Consumable_order_details2__c();
            con2.Arrive_date__c = Date.today();
            con2.Send_Date__c = null;
            con2.Used_date__c = null;
            con2.Return_date__c = null;
            con2.Lose_Flag__c = false;
            con2.Cancellation_Flag__c = false;
            con2.Bar_Code__c = '1234';
            // con1.Consumable_order_minor__c = Order2.Id;
            con2.Consumable_Product__c = pro11.Id;
            con2.Consumable_Arrived_order__c = Order4.Id;
            con2.Recordtypeid = '01210000000kUDKAA2';
            con2.Box_Piece__c = '个';
            // con1.Sterilization_limit__c = Date.today().addDays(1);
            conList.add(con2);
            insert conList;
            LexInventoryViewController.ESetId = '1111';
            LexInventoryViewController.idCheck = '2222';
            List<String> orderDetZaikuListLWC = new List<String>();
            LexInventoryViewController.init(1, 0, '', '');
            orderDetZaikuListLWC = LexInventoryViewController.orderDetZaikuList;
            LexInventoryViewController.categoryAllload('CDS', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            LexInventoryViewController.categoryAllload('光源', '捷尔医疗(海南)有限公司');
            LexInventoryViewController.categoryload();
            Map<String, Date> productkucunLWC = LexInventoryViewController.productkucun;
            LexInventoryViewController.searchConsumableorderdetails(
                '3400PK:PK针 5mmx33cm',
                '',
                '',
                '',
                orderDetZaikuListLWC,
                'testaccount001',
                'ET',
                '深圳',
                1,
                0,
                '',
                '',
                productkucunLWC
            );
        }
    }
}
force-app/main/default/classes/LexInventoryViewControllerTest.cls-meta.xml
New file
@@ -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>
force-app/main/default/classes/LexOutboundorderImportController.cls
@@ -50,6 +50,7 @@
        res.status = 'Success';
        res.code = 200;
        res.msg = '';
        System.debug('res:' + res);
        return res;
    }
@@ -102,7 +103,7 @@
                            barcodePieceMap.put(csvRecordData[6], Integer.valueOf(csvRecordData[7]));
                        }
                    }
                    String[] csvRecordDataStr = new List<String>(13);
                    String[] csvRecordDataStr = new String[13];
                    for (Integer j = 0; j < csvRecordData.size(); j++) {
                        csvRecordDataStr[j] = csvRecordData[j];
                    }
@@ -753,9 +754,7 @@
                string[] csvRecordData = csvRecordStr[i];
                if (orderdetMap.containsKey(csvRecordData[0] + csvRecordData[12] + csvRecordData[9])) {
                    orderdetMap.put(
                        csvRecordData[0] +
                        csvRecordData[12] +
                        csvRecordData[9],
                        csvRecordData[0] + csvRecordData[12] + csvRecordData[9],
                        orderdetMap.get(csvRecordData[0] + csvRecordData[12] + csvRecordData[9]) + Decimal.valueOf(csvRecordData[7])
                    );
                    continue;
@@ -864,7 +863,7 @@
            return null;
        }
    }
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Consumable_order__c order { get; set; }
force-app/main/default/classes/LexOverdueStockController.cls
@@ -1,5 +1,4 @@
public with sharing class LexOverdueStockController {
    /*****************検索用******************/
    public static String barcode { get; set; }
@@ -29,7 +28,6 @@
    }
    public LexOverdueStockController() {
    }
    // 画面初始化
@@ -42,7 +40,7 @@
        codPageRecords = new List<orderBean>();
        overduePageRecords = new List<orderBean>();
        // 获取用户和经销商信息
        user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
        user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
        userWorkLocation = Useracc.Work_Location__c;
        agencyProType = Useracc.UserPro_Type__c;
        if(String.isBlank(Useracc.UserPro_Type__c)){
@@ -51,23 +49,23 @@
        sqlagencyProType = '%' + agencyProType + '%';
        accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
        // 过期库存汇总信息
        List<AggregateResult>  orderDetZaiku = [SELECT count(Id) countsum,
                        Consumable_Product__c prodid,
                        Consumable_Product__r.Name_Text__c prodname,
                        Box_Piece__c boxPiece
        List<AggregateResult> orderDetZaiku = [
            SELECT count(Id) countsum, Consumable_Product__c prodid, Consumable_Product__r.Name_Text__c prodname, Box_Piece__c boxPiece
                        FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = true
                        AND Dealer_Shipment__c = false
                        AND Dealer_Saled__c = false
                        AND Lose_Flag__c = false
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Lose_Flag__c = FALSE
                        AND Isoverdue__c = 0
                        AND Dealer_Returned__c = false
                        AND Cancellation_Flag__c = false
                        AND Bar_Code__c !=null
                        AND Product_Type__c like : sqlagencyProType
                AND Dealer_Returned__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                        AND Dealer_Info_text__c = :accountInfo.Name
                        AND Arrive_Owner_Work_Location__c = :userWorkLocation
                        group by Consumable_Product__c,Box_Piece__c,Consumable_Product__r.Name_Text__c];
            GROUP BY Consumable_Product__c, Box_Piece__c, Consumable_Product__r.Name_Text__c
        ];
        for(AggregateResult overdue : orderDetZaiku){
            codPageRecords.add(new orderBean(overdue));
@@ -83,12 +81,17 @@
        res.code = 200;
        System.debug('res = ' + res);
        return res;
    }
    // BarCode录入
    @AuraEnabled
    public static ResponseBodyLWC searchorderBean(String agencyProTypeLWC,String userWorkLocationLWC,String accountNameLWC,String barcodeLWC,String codPageRecordsLWC){
    public static ResponseBodyLWC searchorderBean(
        String agencyProTypeLWC,
        String userWorkLocationLWC,
        String accountNameLWC,
        String barcodeLWC,
        String codPageRecordsLWC
    ) {
        ResponseBodyLWC res = new ResponseBodyLWC();
        Map<String, object> data = new Map<String, object>();
        res.entity = data;
@@ -100,9 +103,8 @@
        userWorkLocation = userWorkLocationLWC;
        // add by Wang Xueqin 2023/04/12
        // 获取用户和经销商信息
        user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
        user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
        accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
       
        iSinventory = true;
        Set<String> barCodeoverdue = new Set<String>();
@@ -113,22 +115,33 @@
            codPage.pandian = 0;
        }
        // 查询所有过期库存
        List<Consumable_order_details2__c>  orderDetZaiku = [select Id,  Name,Consumable_Product__c,
                            Bar_Code__c,Consumable_Product__r.Name__c,Dealer_Info_text__c,
                            Asset_Model_No__c,Isoverdue__c,Box_Piece__c,Sterilization_limit__c,
        List<Consumable_order_details2__c> orderDetZaiku = [
            SELECT
                Id,
                Name,
                Consumable_Product__c,
                Bar_Code__c,
                Consumable_Product__r.Name__c,
                Dealer_Info_text__c,
                Asset_Model_No__c,
                Isoverdue__c,
                Box_Piece__c,
                Sterilization_limit__c,
                            Bar_Code_search__c
                        FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = true
                        AND Dealer_Shipment__c = false
                        AND Dealer_Saled__c = false
                        AND Lose_Flag__c = false
            WHERE
                Dealer_Arrive__c = TRUE
                AND Dealer_Shipment__c = FALSE
                AND Dealer_Saled__c = FALSE
                AND Lose_Flag__c = FALSE
                        AND Isoverdue__c = 0
                        AND Dealer_Returned__c = false
                        AND Cancellation_Flag__c = false
                        AND Bar_Code__c !=null
                        AND Product_Type__c like : sqlagencyProType
                AND Dealer_Returned__c = FALSE
                AND Cancellation_Flag__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                        AND Dealer_Info_text__c = :accountInfo.Name
                        AND Arrive_Owner_Work_Location__c = :userWorkLocation];
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
        ];
        // 没有输入条码时,循环页面,所有打钩产品全部销存
        // 取得所有
        overdueList = new List<Consumable_order_details2__c>();
@@ -147,11 +160,12 @@
            }
            // return;
            System.debug('overduePageRecords = ' + overduePageRecords);
            System.debug('overdueList = ' + overdueList);
        data.put('overduePageRecords',JSON.serialize(overduePageRecords));
        data.put('codPageRecords',JSON.serialize(codPageRecords));
        data.put('iSinventory',iSinventory);
        data.put('overdueList',overdueList);
        res.status = 'Success';
            res.status = 'Success1';
        res.code = 200;
        // res.msg = '请输入BarCode号';
        System.debug('res = ' + res);
@@ -161,27 +175,42 @@
        // 输入barcode时
        // BarCode的检索  所有在库
        List<Consumable_order_details2__c> reSet = [select Id,Consumable_Product__c,
                        Consumable_Product__r.Name__c,Box_Piece__c,Bar_Code_search__c,
                        Dealer_Shipment__c,Dealer_Saled__c,Lose_Flag__c,Bar_Code__c,
                        Cancellation_Flag__c,Isoverdue__c,Sterilization_limit__c
                    from Consumable_order_details2__c
                    where Bar_Code_search__c in :BarCodeListP
                    AND Dealer_Arrive__c = true
                    AND Cancellation_Flag__c = false
                    and Dealer_Returned__c = false
                    and Bar_Code__c !=null
                    AND Product_Type__c like : sqlagencyProType
        List<Consumable_order_details2__c> reSet = [
            SELECT
                Id,
                Consumable_Product__c,
                Consumable_Product__r.Name__c,
                Box_Piece__c,
                Bar_Code_search__c,
                Dealer_Shipment__c,
                Dealer_Saled__c,
                Lose_Flag__c,
                Bar_Code__c,
                Cancellation_Flag__c,
                Isoverdue__c,
                Sterilization_limit__c
            FROM Consumable_order_details2__c
            WHERE
                Bar_Code_search__c IN :BarCodeListP
                AND Dealer_Arrive__c = TRUE
                AND Cancellation_Flag__c = FALSE
                AND Dealer_Returned__c = FALSE
                AND Bar_Code__c != NULL
                AND Product_Type__c LIKE :sqlagencyProType
                    AND Arrive_Owner_Work_Location__c =: userWorkLocation
                    AND  Dealer_Info_text__c = :accountInfo.Name
                    order by Name];
            ORDER BY Name
        ];
                
                    System.debug('reSet===>'+reSet);
        for(Consumable_order_details2__c cod2 : reSet){
            if ((cod2.Dealer_Shipment__c == false &&  cod2.Dealer_Saled__c == false
                && cod2.Lose_Flag__c == false && cod2.Cancellation_Flag__c == false) &&  cod2.Isoverdue__c == 0) {
            if (
                (cod2.Dealer_Shipment__c == false &&
                cod2.Dealer_Saled__c == false &&
                cod2.Lose_Flag__c == false &&
                cod2.Cancellation_Flag__c == false) && cod2.Isoverdue__c == 0
            ) {
                for (orderBean codPage : codPageRecords) {
                    if(cod2.Consumable_Product__c == codPage.prodid && cod2.Box_Piece__c == codPage.boxPiece){
                        overduePageRecords.add(new orderBean(cod2,'过期库存销存'));
@@ -207,7 +236,6 @@
        return res;
    }
    // 保存按钮
    @AuraEnabled
    public static ResponseBodyLWC save(Boolean iSinventory,string saveCodPageRecords,List<Consumable_order_details2__c> saveoverdueList) {
@@ -226,7 +254,7 @@
        // List<Consumable_order_details2__c> overdueList = (List<Consumable_order_details2__c>)JSON.deserialize(saveoverdueList,List<Consumable_order_details2__c>.class);
         // add by Wang Xueqin 2023/04/12
        // 获取用户和经销商信息
        user Useracc = [select Accountid, Work_Location__c,UserPro_Type__c from user where id =: UserInfo.getUserId()];
        user Useracc = [SELECT Accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :UserInfo.getUserId()];
        accountInfo = [SELECT id,Name,Dealer_discount__c FROM account WHERE id =:Useracc.accountid];
        // 跳过明细2不必要更新
@@ -261,7 +289,7 @@
        try{
            insert  po;
            Consumable_order__c order = [SELECT Name FROM Consumable_order__c WHERE id =:po.id];
            List<Consumable_orderdetails__c> InsList = New List<Consumable_orderdetails__c>();
            List<Consumable_orderdetails__c> InsList = new List<Consumable_orderdetails__c>();
            for(orderBean header : codPageRecords){
                if(header.check==true){
                    Consumable_orderdetails__c insPan = new Consumable_orderdetails__c();
@@ -290,12 +318,10 @@
                cod.Inventory_date__c = Date.today();
                cod.Lose_reason__c = '过期库存销存';
                cod.Lose_Flag__c = true;
            }
            if(overdueList.size()>0){
                ControllerUtil.updateOrderDetailsSatus(overdueList);
            }
        }catch (Exception ex) {
            Database.rollback(sp);
            ApexPages.addMessages(ex);
@@ -312,7 +338,7 @@
    // 将页面或取得BarCode去掉重复的,转换成List
    public static List<String> ParseBarCode(String Code){
        Map<String,Integer> barcodeCountMap = new Map<String,Integer>();
        String[] Cache = new String[]{};
        String[] Cache = new List<String>{};
        Cache = Code.split('\n');
        List <String> Buff = new List<String>();
        for(String A : Cache){
@@ -328,6 +354,7 @@
    }
     // Data Bean
    @TestVisible
    class orderBean implements Comparable {
        @AuraEnabled
        public Consumable_order_details2__c orderdetails2 { get; set; }
force-app/main/default/classes/LexSaleOrderController.cls
@@ -201,6 +201,7 @@
        //BarCodelist做成
        barCodeListP = ParseBarCode(barcode);
        System.debug('barCodeListP:' + barCodeListP);
        //针对所有商品到货确认
        reSet1 = [
            SELECT
@@ -235,6 +236,7 @@
                AND Arrive_Owner_Work_Location__c = :userWorkLocation
            ORDER BY RemoveBox_No__c DESC
        ];
        System.debug('reSet1:' + reSet1);
        List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
        Set<Id> proIds = new Set<Id>();
@@ -242,6 +244,7 @@
            Integer idx = 0;
            for (Consumable_order_details2__c cod2 : reSet1) {
                if (cod2.Bar_Code__c == barcode) {
                    System.debug('cod2.Bar_Code__c:' + cod2.Bar_Code__c);
                    newdet2.add(cod2);
                    reSet1.remove(idx);
                    proIds.add(cod2.Consumable_product__c);
@@ -1076,7 +1079,12 @@
        for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
            String key = '' + ass.orderdetails2.Bar_Code__c;
            Integer deliverycnt = BarcodeCntMap.get(key);
            if (ass.orderdetails2.Box_Piece__c == '个' &&(ass.outboundCount == null || String.valueof(ass.outboundCount) == '' || ass.outboundCount <= 0)) {
            if (
                ass.orderdetails2.Box_Piece__c == '个' &&
                (ass.outboundCount == null ||
                String.valueof(ass.outboundCount) == '' ||
                ass.outboundCount <= 0)
            ) {
                // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '请输入产品 '+ ass.Prod.Name +' 的出货数量'));
                // return null;
                System.debug('ass.orderdetails2.Box_Piece__c = '  + ass.orderdetails2.Box_Piece__c);
@@ -1265,6 +1273,7 @@
        return consumableorderdetails2Nobox.size();
    }
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Consumable_orderdetails__c orderdetails1 { get; set; }
force-app/main/default/classes/NewRepairController.cls
@@ -5,36 +5,38 @@
*/
global without sharing class NewRepairController {
    public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute
    public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;}
    public String awsToken{set;get;}
    public List<LayoutDescriberHelper.LayoutSection> layoutSections { get; set; }
    public String awsToken { get; set; }
    public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
    public static String sobjectTypeValue = 'Repair__c';
    public Boolean isNewMode{set;get;}
    public Boolean isNewMode { get; set; }
    public String rtTypeId {get; set;}
    public String AWSDataId{set;get;}
    public String DecryptAWSDataId{set;get;}
    public String ContactAWSDataId{set;get;}
    public List<String> encryptedAPIList{set;get;}
    public String AWSDataId { get; set; }
    public String DecryptAWSDataId { get; set; }
    public String ContactAWSDataId { get; set; }
    public List<String> encryptedAPIList { get; set; }
    public String staticResource {get; set;}
    public String staticResourceContact {get; set;}
    public String staticResourceAddress {get; set;}
    public String requiredFieldAPIListStr {get; set;}
    public String fieldAPIToLabelMapStr {get; set;}
    public String Input_Required_Field_Msg{set;get;}
    public String PIPL_Name_Label{set;get;}
    public String PIPL_Input_Account_Error_Msg{set;get;}
    public String sobjectPrefix{set;get;}
    public String sobjecttypeForFrontEnd{set;get;}
    public String sobjectId{set;get;}
    public String workLocationSelect{set;get;}
    public String RepairSubOrderAWSDataId{set;get;}
    public String staticResourceRepairSubOrder{set;get;}
    public String Input_Required_Field_Msg { get; set; }
    public String PIPL_Name_Label { get; set; }
    public String PIPL_Input_Account_Error_Msg { get; set; }
    public String sobjectPrefix { get; set; }
    public String sobjecttypeForFrontEnd { get; set; }
    public String sobjectId { get; set; }
    public String workLocationSelect { get; set; }
    public String RepairSubOrderAWSDataId { get; set; }
    public String staticResourceRepairSubOrder { get; set; }
    public String VLookUpFieldsJson{get;private set;}
    //zhj MEBG新方案改造 2022-11-29 start
    public String staticResourceV2 {get; set;}
    //zhj MEBG新方案改造 2022-11-29 end
    public NewRepairController(ApexPages.StandardController controller) {
        sobjectId = [SELECT CustomObjectId,CustomObjectName  FROM CustomObjectUserLicenseMetrics   where CustomObjectName ='Repair' limit 1].CustomObjectId;
        //sobjectId = [SELECT CustomObjectId,CustomObjectName  FROM CustomObjectUserLicenseMetrics   where CustomObjectName ='Repair' limit 1].CustomObjectId;
        sobjectId = [SELECT id, QualifiedApiName, DurableId, IsCustomizable FROM EntityDefinition WHERE QualifiedApiName = 'Repair__c']
        .DurableId;
        isNewMode = true;
        Input_Required_Field_Msg = Label.Input_Required_Field_Msg;
        PIPL_Name_Label = Label.PIPL_Name_Label;
@@ -50,7 +52,21 @@
        if(obj.Id != null){
            //更新
            isNewMode = false;
            Repair__c repairData = [select Id,RecordTypeId,AWS_Data_Id__c,Address_AWS_Data_Id__c,Contact_AWS_Data_Id__c,Address_Contacts_Encrypt__c,Address_Contacts_Name_Encrypt__c,Address_Telephone_Encrypt__c,Address_ZipCode_Encrypt__c,Detailed_Address_Encrypt__c from Repair__c where id =: obj.Id];
            Repair__c repairData = [
                SELECT
                    Id,
                    RecordTypeId,
                    AWS_Data_Id__c,
                    Address_AWS_Data_Id__c,
                    Contact_AWS_Data_Id__c,
                    Address_Contacts_Encrypt__c,
                    Address_Contacts_Name_Encrypt__c,
                    Address_Telephone_Encrypt__c,
                    Address_ZipCode_Encrypt__c,
                    Detailed_Address_Encrypt__c
                FROM Repair__c
                WHERE id = :obj.Id
            ];
            rtTypeId = repairData.RecordTypeId;
            AWSDataId = repairData.AWS_Data_Id__c;
            DecryptAWSDataId = String.valueOf(repairData.Address_AWS_Data_Id__c);
@@ -157,8 +173,6 @@
            // if(mso.containsKey('00N10000006P1dw')){
            //     controller.getRecord().put('PaperRepairRequestNo__c',mso.get('00N10000006P1dw'));
            // }
            
            // //市场多年保修 有偿/无偿修理00N10000008rG4p
            // if(mso.containsKey('00N10000008rG4p')){
@@ -283,7 +297,7 @@
                String repairSubOrderId = mso.get('CF00N10000009H1rR_lkid');
                System.debug('repairSubOrderId = ' + repairSubOrderId);
                //查询AWSDataId
                List<RepairSubOrder__c> rso = [select AWS_Data_Id__c from RepairSubOrder__c where Id=:repairSubOrderId];
                List<RepairSubOrder__c> rso = [SELECT AWS_Data_Id__c FROM RepairSubOrder__c WHERE Id = :repairSubOrderId];
                if(rso.size() > 0){
                    RepairSubOrderAWSDataId = rso[0].AWS_Data_Id__c;
                }
@@ -294,7 +308,22 @@
            if (mso.containsKey('retURL')) {
                String RepairId = mso.get('retURL').substring(1);
                System.debug('RepairId = ' + RepairId);
                rc = [select Hospital__c,Department_Class__c,Account__c,Dealer__c,Incharge_Staff_Contact__c,Incharge_Staff__c,  RepairSubOrder__c,On_Call_ID__c,QIS_ID__c,    InsReport__c,Rental_Apply_Equipment_Set_Detail__c from Repair__c where id =:RepairId ];
                rc = [
                    SELECT
                        Hospital__c,
                        Department_Class__c,
                        Account__c,
                        Dealer__c,
                        Incharge_Staff_Contact__c,
                        Incharge_Staff__c,
                        RepairSubOrder__c,
                        On_Call_ID__c,
                        QIS_ID__c,
                        InsReport__c,
                        Rental_Apply_Equipment_Set_Detail__c
                    FROM Repair__c
                    WHERE id = :RepairId
                ];
                System.debug('rc = ' + rc);
                if(rc.size() > 0){
                     //医院
@@ -312,7 +341,7 @@
                    //报修子单RepairSubOrder__c
                    controller.getRecord().put('RepairSubOrder__c',rc[0].RepairSubOrder__c);
                    //查询AWSDataId
                    List<RepairSubOrder__c> rso = [select AWS_Data_Id__c from RepairSubOrder__c where Id=:rc[0].RepairSubOrder__c];
                    List<RepairSubOrder__c> rso = [SELECT AWS_Data_Id__c FROM RepairSubOrder__c WHERE Id = :rc[0].RepairSubOrder__c];
                    if(rso.size() > 0){
                        RepairSubOrderAWSDataId = rso[0].AWS_Data_Id__c;
                    }
@@ -325,16 +354,21 @@
                    //借出备品配套一览明细Rental_Apply_Equipment_Set_Detail__c
                    controller.getRecord().put('Rental_Apply_Equipment_Set_Detail__c',rc[0].Rental_Apply_Equipment_Set_Detail__c);
                }
            }
            
            rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
            if(String.isBlank(rtTypeId)||String.isEmpty(rtTypeId)){
                List<RecordType> rtList = new List<RecordType>([select Id,DeveloperName from RecordType  where SobjectType ='Repair__c' and DeveloperName ='Repair']);
                List<RecordType> rtList = new List<RecordType>(
                    [SELECT Id, DeveloperName FROM RecordType WHERE SobjectType = 'Repair__c' AND DeveloperName = 'Repair']
                );
                rtTypeId = rtList[0].Id;
            }
        }
        LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Repair__c','classic');
        LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(
            rtTypeId,
            'Repair__c',
            'classic'
        );
        layoutSections = LayoutWrapperValue.layoutSections;
        layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute
        List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList;
@@ -367,9 +401,9 @@
    }
    global class Response{
        public String recordId{set;get;}
        public String message{set;get;}
        public String status{set;get;}
        public String recordId { get; set; }
        public String message { get; set; }
        public String status { get; set; }
    }
    
    @RemoteAction
@@ -384,7 +418,7 @@
                reps.add(new Repair__c(Id='a0J1m000001QqXk',Encrypt_Update_Flag__c=false));
            }
        }else{
            reps = [select id,Encrypt_Update_Flag__c from Repair__c where id =:rid];
            reps = [SELECT id, Encrypt_Update_Flag__c FROM Repair__c WHERE id = :rid];
        }        
        if(reps.size()==0){
            r.status = 'failed';
@@ -435,7 +469,10 @@
            Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType();  
            String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); 
            if(String.valueOf(fielddataType)=='DATE'){
                repairInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-')));
                repairInfo.put(
                    fieldAPI,
                    (String.isBlank(fieldValue) || String.isEmpty(fieldValue)) ? null : Date.valueOf(fieldValue.replace('/', '-'))
                );
            }else if(String.valueOf(fielddataType)=='DATETIME'){
                if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){
                    fieldValue = fieldValue.replace('T',' ');
@@ -447,9 +484,16 @@
                }else{
                    repairInfo.put(fieldAPI, null);
                }
            }else if(String.valueOf(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='CURRENCY'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){
                repairInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?null:Decimal.valueOf(fieldValue.replace(',', '')));
            } else if (
                String.valueOf(fielddataType) == 'PERCENT' ||
                String.valueOf(fielddataType) == 'CURRENCY' ||
                String.valueOf(fielddataType) == 'Number' ||
                String.valueOf(fielddataType) == 'DOUBLE'
            ) {
                repairInfo.put(
                    fieldAPI,
                    (String.isBlank(fieldValue) || String.isEmpty(fieldValue)) ? null : Decimal.valueOf(fieldValue.replace(',', ''))
                );
            } else if(String.valueof(fielddataType)=='BOOLEAN'){
                 //check repair check value 
                if(fieldAPI == 'Return_Without_Repair__c'&&Boolean.valueof(fieldValueMap.get(fieldAPI))){
@@ -474,7 +518,11 @@
                System.debug('into update');
                String awsDataId = (String)repairInfo.get('AWS_Data_Id__c');
                System.debug('awsDataId = ' + awsDataId);
                Repair__c[] repairs = [select id,Return_Without_Repair_Reason__c,SAP_Transfer_time__c from Repair__c where AWS_Data_Id__c =:awsDataId];
                Repair__c[] repairs = [
                    SELECT id, Return_Without_Repair_Reason__c, SAP_Transfer_time__c
                    FROM Repair__c
                    WHERE AWS_Data_Id__c = :awsDataId
                ];
                if(!updateRepairCheck){
                    repairInfo.put('Return_Without_Repair_Reason__c',repairs[0].Return_Without_Repair_Reason__c);
                }
@@ -492,7 +540,6 @@
            resp.status = status;
            System.debug('resp from sfdx back-end' + resp);
            return resp;
        } catch(DmlException e) {
            rid=repairInfo.Id;
            Integer index = 0;
@@ -510,14 +557,29 @@
            Database.rollback(sp);
            resp.status = 'Exception';
            resp.message ='保存失败,原因:'+ e.getDmlMessage(index);
            PIHelper.saveTransLog(sobjectTypeValue,(String)repairInfo.get('AWS_Data_Id__c'),rid,transId, repairJson ,status,e.getMessage()+e.getStackTraceString());
            PIHelper.saveTransLog(
                sobjectTypeValue,
                (String) repairInfo.get('AWS_Data_Id__c'),
                rid,
                transId,
                repairJson,
                status,
                e.getMessage() + e.getStackTraceString()
            );
            return resp;
        } catch(Exception e) {
            System.debug('into catch'+e.getMessage());
            Database.rollback(sp);
            status = 'fail';
            PIHelper.saveTransLog(sobjectTypeValue,(String)repairInfo.get('AWS_Data_Id__c'),rid,transId, repairJson ,status,e.getMessage()+e.getStackTraceString());
            PIHelper.saveTransLog(
                sobjectTypeValue,
                (String) repairInfo.get('AWS_Data_Id__c'),
                rid,
                transId,
                repairJson,
                status,
                e.getMessage() + e.getStackTraceString()
            );
            resp.message = e.getMessage();            
            resp.status = status;
            return resp;
@@ -526,11 +588,24 @@
    // 从url参数赋值到当前页面
    public static void AssignValueFromUrl(Map<string,string> mso, sobject sobj){
        String sobject_name = sobj.getSObjectType().getDescribe().getName();
        Map<string,object> temp = new Map<string,object>();
        Map<string,FieldDefinition> fdm = new Map<string,FieldDefinition>();
        List<FieldDefinition> fds = [SELECT Id, DurableId, QualifiedApiName,ValueTypeId , EntityDefinitionId, NamespacePrefix,EntityDefinition.NamespacePrefix, DeveloperName, MasterLabel, Label FROM FieldDefinition where EntityDefinition.QualifiedApiName = :sobject_name];
        List<FieldDefinition> fds = [
            SELECT
                Id,
                DurableId,
                QualifiedApiName,
                ValueTypeId,
                EntityDefinitionId,
                NamespacePrefix,
                EntityDefinition.NamespacePrefix,
                DeveloperName,
                MasterLabel,
                Label
            FROM FieldDefinition
            WHERE EntityDefinition.QualifiedApiName = :sobject_name
        ];
        for(FieldDefinition fd : fds){
            //system.debug(fd.DurableId);
            fdm.put(fd.DurableId.split('\\.')[1],fd);
@@ -619,7 +694,6 @@
                        system.debug(ee.getStackTraceString());
                        continue;
                    }
                }else if(type_id == 'id' || type_id == 'string'){
                    val = val_str;
                }else{
force-app/main/default/pages/NewAndEditReport.page
@@ -1,6 +1,12 @@
<apex:page standardController="Report__c" extensions="NewAndEditReportController" id="page" lightningStylesheets="true">
<apex:page
    standardController="Report__c"
    extensions="NewAndEditReportController"
    id="page"
>
    <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/>
    <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
    <apex:includeScript
        value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"
    />
    <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/>
    <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/>
    <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
@@ -638,16 +644,24 @@
    <div class="bPageTitle">
        <div class="ptBody">
            <div class="content">
                <img src="/img/s.gif" alt="报告书" class="pageTitleIcon" title="报告书" />
                <h1 class="pageType">报告书
                <img
                    src="/img/s.gif"
                    alt="报告书"
                    class="pageTitleIcon"
                    title="报告书"
                />
                <h1 class="pageType">
                    报告书
                    <span class="titleSeparatingColon">:</span>
                </h1>
                <h2 class="pageDescription"> 新建报告书</h2>
                <div class="blank">&nbsp;</div>
            </div>
            <div class="links">
                <a href="javascript:openPopupFocusEscapePounds(%27https://help.salesforce.com/apex/htdoor?loc=help&amp;target=leads_edit.htm&amp;section=Leads&amp;language=zh_CN&amp;release=234.18.8&amp;instance=CS117&amp;showSplash=true%27, %27Help%27, 700, 600, %27width=700,height=600,resizable=yes,toolbar=yes,status=no,scrollbars=yes,menubar=yes,directories=no,location=no,dependant=no%27, false, false);"
                    title="此页面的帮助 (新窗口)">
                <a
                    href="javascript:openPopupFocusEscapePounds(%27https://help.salesforce.com/apex/htdoor?loc=help&amp;target=leads_edit.htm&amp;section=Leads&amp;language=zh_CN&amp;release=234.18.8&amp;instance=CS117&amp;showSplash=true%27, %27Help%27, 700, 600, %27width=700,height=600,resizable=yes,toolbar=yes,status=no,scrollbars=yes,menubar=yes,directories=no,location=no,dependant=no%27, false, false);"
                    title="此页面的帮助 (新窗口)"
                >
                    <span class="helpLink">此页面的帮助</span>
                    <img src="/img/s.gif" alt="" class="helpIcon" />
                </a>
@@ -667,20 +681,44 @@
                    <tbody>
                        <tr>
                            <td class="pbTitle">
                                <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />
                                <img
                                    src="/img/s.gif"
                                    alt=""
                                    class="minWidth"
                                    title=""
                                    width="1"
                                    height="1"
                                />
                                <h2 class="mainTitle">报告书编辑</h2>
                            </td>
                            <td class="pbButton" id="topButtonRow" style="pointer-events: none; opacity: 0.4;">
                                <input class="btn" type="Button" value="保存" onclick="saveReportProcess('Save')" />
                                <input class="btn" type="Button" value="保存并新建" onclick="saveReportProcess('SaveAndNew')" />
                                <apex:commandButton action="{!cancel}" value="取消" />
                            <td
                                class="pbButton"
                                id="topButtonRow"
                                style="pointer-events: none; opacity: 0.4"
                            >
                                <input
                                    class="btn"
                                    type="Button"
                                    value="保存"
                                    onclick="saveReportProcess('Save')"
                                />
                                <input
                                    class="btn"
                                    type="Button"
                                    value="保存并新建"
                                    onclick="saveReportProcess('SaveAndNew')"
                                />
                                <apex:commandButton
                                    action="{!cancel}"
                                    value="取消"
                                />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <!-- Error Msg-->
            <div style="text-align: center;">
            <div style="text-align: center">
                <apex:outputPanel id="errorMsg">
                    <apex:pageMessages id="msgContent" escape="false" />
                </apex:outputPanel>
@@ -688,23 +726,44 @@
            <br/>
            <!-- Iterate the layoutSections, which is a list of sections -->
            <apex:repeat value="{!layoutSections}" var="layoutSection">
                <apex:pageBlockSection title="{!layoutSection.name}" showHeader="{!layoutSection.useHeader}" collapsible="{!layoutSection.allowCollapse}"
                    columns="{!layoutSection.columns}">
                <apex:pageBlockSection
                    title="{!layoutSection.name}"
                    showHeader="{!layoutSection.useHeader}"
                    collapsible="{!layoutSection.allowCollapse}"
                    columns="{!layoutSection.columns}"
                >
                    <!--Each section has layoutFields, let's iterate them as well-->
                    <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField">
                    <apex:repeat
                        value="{!layoutSection.layoutFields}"
                        var="layoutField"
                    >
                        <!-- <apex:inputField html-title="{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}"  styleClass="{!ApiPrefix} {!ApiPrefix}_{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}"
                            required="{!layoutField.isRequired}" /> -->
                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                            required="{!layoutField.isRequired}" />
                        <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
                            required="{!layoutField.isRequired}" />
                        <apex:outputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Report__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
                        <apex:inputField
                            styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}"
                            html-data-id="{!layoutField.fieldAPI}"
                            value="{!Report__c[layoutField.fieldAPI]}"
                            rendered="{!not(layoutField.isPlaceHOlder)&&isNewMode}"
                            required="{!layoutField.isRequired}"
                        />
                        <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}">
                        <apex:inputField
                            styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}"
                            html-data-id="{!layoutField.fieldAPI}"
                            value="{!Report__c[layoutField.fieldAPI]}"
                            rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI!='RecordTypeId'}"
                            required="{!layoutField.isRequired}"
                        />
                        <apex:outputField
                            styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}"
                            html-data-id="{!layoutField.fieldAPI}"
                            value="{!Report__c[layoutField.fieldAPI]}"
                            rendered="{!not(layoutField.isPlaceHOlder)&&not(isNewMode)&&layoutField.fieldAPI=='RecordTypeId'}"
                        />
                        <apex:pageblocksectionitem
                            rendered="{!layoutField.isPlaceHolder}"
                        >
                        </apex:pageblocksectionitem>
                    </apex:repeat>
                </apex:pageBlockSection>
            </apex:repeat>
            <script>
@@ -721,7 +780,6 @@
                }
                console.log(api_id_map);
                sfdcPage.appendToOnloadQueue(function () {
                    debugger
                    //判断是否为只读选项
                    var layoutSections = JSON.parse('{!layoutSectionsStr}');
                    for (let m = 0; m < layoutSections.length; m++) {
@@ -823,17 +881,41 @@
                    <tbody>
                        <tr>
                            <td class="pbTitle">
                                <img src="/img/s.gif" alt="" class="minWidth" title="" width="1" height="1" />&nbsp;</td>
                            <td class="pbButtonb" id="bottomButtonRow" style="pointer-events: none; opacity: 0.4;">
                                <input class="btn" type="Button" value="保存" onclick="saveReportProcess('Save')" />
                                <input class="btn" type="Button" value="保存并新建" onclick="saveReportProcess('SaveAndNew')" />
                                <apex:commandButton action="{!cancel}" value="取消" />
                                <img
                                    src="/img/s.gif"
                                    alt=""
                                    class="minWidth"
                                    title=""
                                    width="1"
                                    height="1"
                                />&nbsp;
                            </td>
                            <td
                                class="pbButtonb"
                                id="bottomButtonRow"
                                style="pointer-events: none; opacity: 0.4"
                            >
                                <input
                                    class="btn"
                                    type="Button"
                                    value="保存"
                                    onclick="saveReportProcess('Save')"
                                />
                                <input
                                    class="btn"
                                    type="Button"
                                    value="保存并新建"
                                    onclick="saveReportProcess('SaveAndNew')"
                                />
                                <apex:commandButton
                                    action="{!cancel}"
                                    value="取消"
                                />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </apex:pageblock>
    </apex:form>
</apex:page>
manifest/packageForLex copy.xml
@@ -1,8 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>LightningComponentBundle</name>
        <members>LexSaleOrderController</members>
        <members>LexConInvoiceViewController</members>
        <members>LexConInvoicedetailsController</members>
        <members>LexInventoryController</members>
        <members>LexOutboundorderImportController</members>
        <members>LexOverdueStockController</members>
        <members>LexInventoryViewControllerTest</members>
        <name>ApexClass</name>
    </types>
    <version>52.0</version>
</Package>