buli
2023-07-11 80a3f59e2d3df07805bc67e329300b8de90a5b3a
force-app/main/default/classes/LexConsumableGoodsInfo.cls
@@ -1,5 +1,4 @@
public without sharing class LexConsumableGoodsInfo {
    //所有产品一览
    @AuraEnabled
    public static Results initTotalNum(String ordId, String type){
@@ -12,28 +11,44 @@
        try {
            if(!(orderId.size() > 0)){
                String userId = UserInfo.getUserId();
                List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
                List<User> userList = [
                    SELECT accountid, Work_Location__c, UserPro_Type__c
                                FROM user
                                WHERE id = :userId ];
                    WHERE id = :userId
                ];
                String accountid = userList[0].accountid;
                String userPro_Type = userList[0].UserPro_Type__c;
                String userWorklocation = userList[0].Work_Location__c;
                String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
                List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
                //20200916 ljh update start
                if(Test.isRunningTest()){
                    if(type !=null && type.equals('all')){
                        conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                    conorderlist = [
                        SELECT id, Owner.Name
                        FROM Consumable_order__c
                        WHERE
                            Order_type__c = '订单'
                            AND recordtypeid = :rtTypeDelivery
                            AND Dealer_Info__c = :accountid
                            AND (OrderNumber_notarrive__c > 0
                            OR Delivery_detail_count__c > 0)
                            AND Order_ProType__c = :userPro_Type
                            AND Order_Owner_WorkLocal__c = :userWorklocation
                            AND showFalseNotshowTrue__c = FALSE
                    ];
                    }else{
                        conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                    }
                }else{
                    if(type !=null && type.equals('all')){
                        conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                    }else{
                        conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                    }
                    conorderlist = [
                        SELECT id, Owner.Name
                        FROM Consumable_order__c
                        WHERE
                            Order_type__c = '订单'
                            AND recordtypeid = :rtTypeDelivery
                            AND Dealer_Info__c = :accountid
                            AND Delivery_detail_count__c > 0
                            AND Order_ProType__c = :userPro_Type
                            AND Order_Owner_WorkLocal__c = :userWorklocation
                            AND showFalseNotshowTrue__c = FALSE
                    ];
                }
                for(Consumable_order__c conorder : conorderlist){
                    String temp = (String)conorder.Id;
@@ -42,11 +57,12 @@
                System.debug('ANY o'+orderId);
            }
            List<Consumable_Orderdetails__c> conOrderList1 = new List<Consumable_Orderdetails__c>();
            if(Test.isRunningTest()){
                conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c];
            }else{
                conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =:orderId];
            }
            conOrderList1 = [
                SELECT Asset_Model_No__c, Consumable_count__c
                FROM Consumable_Orderdetails__c
                WHERE Consumable_order__c = :orderId
            ];
            
            Map<String,Decimal> allConOrderMap = new Map<String,Decimal>();
            for(Consumable_Orderdetails__c con : conOrderList1){
@@ -82,7 +98,11 @@
        Results results = new Results();
        List<ShowRecords> arrDetIifo = new List<ShowRecords>();
        try{
            List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId];
            List<Consumable_order_details2__c> conList = [
                SELECT id, Bar_Code__c
                FROM Consumable_order_details2__c
                WHERE Dealer_Arrive__c = TRUE AND Consumable_order_minor__c = :orderId
            ];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
                srtMap.put(con.Bar_Code__c, con.Id);
@@ -91,9 +111,12 @@
            for(String s : srtMap.keySet()){
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                            WHERE Id =: str
                            GROUP BY Asset_Model_No__c];
                GROUP BY Asset_Model_No__c
            ];
            for(Integer i = 0 ; i< arrDetList.size();i++){
                arrDetIifo.add(new showRecords(arrDetList[i]));
            }
@@ -113,9 +136,11 @@
        List<ShowRecords> allArrDetIifo = new List<ShowRecords>();
        try{
            String userId = UserInfo.getUserId();
            List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
            List<User> userList = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                            FROM user
                            WHERE id = :userId ];
                WHERE id = :userId
            ];
            String accountid = userList[0].accountid;
            String userPro_Type = userList[0].UserPro_Type__c;
            String userWorklocation = userList[0].Work_Location__c;
@@ -123,21 +148,34 @@
            String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            if(Test.isRunningTest()){
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            }else{
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND (OrderNumber_notarrive__c > 0
                        OR Delivery_detail_count__c > 0)
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND Delivery_detail_count__c > 0
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order__c> conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
@@ -151,18 +189,29 @@
            }
            System.debug('ANY o'+orderId);
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            if(Test.isRunningTest()){
                conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
            }else{
                //20200916 ljh update start
                //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                if(type !=null && type.equals('all')){
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = TRUE
                        AND Consumable_order_minor__c = :orderId
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                }else{
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = TRUE
                        AND Consumable_order_minor__c = :orderId
                        AND Deliver_date__c < :orderdate
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                }
                //20200916 ljh update end  
            }
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
@@ -172,9 +221,12 @@
            for(String s : srtMap.keySet()){
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                            WHERE Id =: str 
                            GROUP BY Asset_Model_No__c];
                GROUP BY Asset_Model_No__c
            ];
            // List<showRecords> allArrDetIifo = new List<showRecords>();
            for(Integer i = 0 ; i< arrDetList.size();i++){
                allArrDetIifo.add(new showRecords(arrDetList[i]));
@@ -194,10 +246,12 @@
        Results results = new Results();
        List<ShowRecords> notArrDetIifo = new List<ShowRecords>();
        try{
            List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                        WHERE Dealer_Arrive__c = false
                        AND Consumable_order_minor__c = :orderId
                        GROUP BY Asset_Model_No__c];
            List<AggregateResult> notArrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Dealer_Arrive__c = FALSE AND Consumable_order_minor__c = :orderId
                GROUP BY Asset_Model_No__c
            ];
            for(Integer i = 0 ; i< notArrDetList.size();i++){
                notArrDetIifo.add(new showRecords(notArrDetList[i]));
            }
@@ -217,9 +271,11 @@
        List<ShowRecords> allNotArrDetIifo = new List<ShowRecords>();
        try{
            String userId = UserInfo.getUserId();
            List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
            List<User> userList = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                            FROM user
                            WHERE id = :userId ];
                WHERE id = :userId
            ];
            String accountid = userList[0].accountid;
            String userPro_Type = userList[0].UserPro_Type__c;
            String userWorklocation = userList[0].Work_Location__c;
@@ -227,21 +283,34 @@
            String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            if(Test.isRunningTest()){
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation  and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            }else{
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND (OrderNumber_notarrive__c > 0
                        OR Delivery_detail_count__c > 0)
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND Delivery_detail_count__c > 0
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order__c> conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
@@ -255,18 +324,29 @@
            }
            System.debug('ANY o'+orderId);
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            if(Test.isRunningTest()){
                conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
            }else{
                //20200916 ljh update start
                //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                if(type !=null && type.equals('all')){
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = FALSE
                        AND Consumable_order_minor__c = :orderId
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                }else{
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = FALSE
                        AND Consumable_order_minor__c = :orderId
                        AND Deliver_date__c < :orderdate
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                }
                //20200916 ljh update end   
            }
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
@@ -276,9 +356,12 @@
            for(String s : srtMap.keySet()){
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str and Cancellation_Flag__c = false
                            GROUP BY Asset_Model_No__c];
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Id = :str AND Cancellation_Flag__c = FALSE
                GROUP BY Asset_Model_No__c
            ];
            // List<showRecords> allArrDetIifo = new List<showRecords>();
            for(Integer i = 0 ; i< arrDetList.size();i++){
                allNotArrDetIifo.add(new showRecords(arrDetList[i]));
@@ -303,7 +386,11 @@
            List<showRecords> notArrDetIifo = new List<showRecords>();
            List<showRecords> allArrDetIifo = new List<showRecords>();
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = true AND Consumable_order_minor__c = :orderId];
            List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId];
            List<Consumable_order_details2__c> conList = [
                SELECT id, Bar_Code__c
                FROM Consumable_order_details2__c
                WHERE Consumable_order_minor__c = :orderId
            ];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
                srtMap.put(con.Bar_Code__c, con.Id);
@@ -312,17 +399,22 @@
            for(String s : srtMap.keySet()){
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str AND Dealer_Arrive__c = true
                            GROUP BY Asset_Model_No__c];
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Id = :str AND Dealer_Arrive__c = TRUE
                GROUP BY Asset_Model_No__c
            ];
            for(Integer i = 0 ; i< arrDetList.size();i++){
                arrDetIifo.add(new showRecords(arrDetList[i]));
            }
            List<AggregateResult> notArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Dealer_Arrive__c = false
                            AND Consumable_order_minor__c = :orderId
                            GROUP BY Asset_Model_No__c];
            List<AggregateResult> notArrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Dealer_Arrive__c = FALSE AND Consumable_order_minor__c = :orderId
                GROUP BY Asset_Model_No__c
            ];
            for(Integer i = 0 ; i< notArrDetList.size();i++){
                notArrDetIifo.add(new showRecords(notArrDetList[i]));
            }
@@ -330,8 +422,11 @@
            // List<AggregateResult> allArrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
            //                 WHERE Id =: str
            //                 GROUP BY Asset_Model_No__c];
            List<Consumable_Orderdetails__c> allArrDetList = [SELECT Asset_Model_No__c,Consumable_count__c FROM Consumable_Orderdetails__c
                            WHERE Consumable_order__c =: orderId];
            List<Consumable_Orderdetails__c> allArrDetList = [
                SELECT Asset_Model_No__c, Consumable_count__c
                FROM Consumable_Orderdetails__c
                WHERE Consumable_order__c = :orderId
            ];
            // for(Integer i = 0 ; i< allArrDetList.size();i++){
            //     allArrDetIifo.add(new showRecords(notArrDetList[i]));
            // }
@@ -386,9 +481,11 @@
        List<ShowRecords> allOtherDetIifo = new List<ShowRecords>();
        try{
            String userId = UserInfo.getUserId();
            List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
            List<User> userList = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                            FROM user
                            WHERE id = :userId ];
                WHERE id = :userId
            ];
            String accountid = userList[0].accountid;
            String userPro_Type = userList[0].UserPro_Type__c;
            String userWorklocation = userList[0].Work_Location__c;
@@ -396,21 +493,34 @@
            String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            if(Test.isRunningTest()){
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            }else{
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND (OrderNumber_notarrive__c > 0
                        OR Delivery_detail_count__c > 0)
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND Delivery_detail_count__c > 0
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            }
            //20200916 ljh update end
            // List<Consumable_order__c> conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and Delivery_detail_count__c > 0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
@@ -424,18 +534,25 @@
            }
            System.debug('ANY o'+orderId);
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            if(Test.isRunningTest()){
                conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
            }else{
                //20200916 ljh update start
                //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE  Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                if(type !=null && type.equals('all')){
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE  Consumable_order_minor__c = :orderId  AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                }else{
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE  Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Consumable_order_minor__c = :orderId
                        AND Deliver_date__c < :orderdate
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                }
                //20200916 ljh update end   
            }
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
@@ -445,15 +562,22 @@
            for(String s : srtMap.keySet()){
                str.add(srtMap.get(s));
            }
            List<AggregateResult> arrDetList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str and Cancellation_Flag__c = false
                            GROUP BY Asset_Model_No__c];
            List<AggregateResult> arrDetList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE Id = :str AND Cancellation_Flag__c = FALSE
                GROUP BY Asset_Model_No__c
            ];
            Map<String,Decimal> conOrderMap = new Map<String,Decimal>();
            for(AggregateResult agg : arrDetList){
                conOrderMap.put(String.valueOf(agg.get('prodModel')), Integer.valueOf(agg.get('recordCount')));
            }
            List<Consumable_Orderdetails__c> conOrderList1 = [SELECT Asset_Model_No__c ,Consumable_count__c FROM Consumable_Orderdetails__c WHERE Consumable_order__c =: orderId ];
            List<Consumable_Orderdetails__c> conOrderList1 = [
                SELECT Asset_Model_No__c, Consumable_count__c
                FROM Consumable_Orderdetails__c
                WHERE Consumable_order__c = :orderId
            ];
            Map<String,Decimal> allConOrderMap = new Map<String,Decimal>();
            for(Consumable_Orderdetails__c con : conOrderList1){
                if(con.Consumable_count__c == null){
@@ -495,15 +619,19 @@
        Results results = new Results();
        List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>();
        try{
            List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Consumable_order_minor__c != null
                            AND Dealer_Shipment__c = false
                            AND Dealer_Arrive__c = false
                            AND Dealer_Saled__c = false
                            AND Consumable_order_minor__r.showFalseNotshowTrue__c = false
            List<AggregateResult> morethan7daysList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE
                    Consumable_order_minor__c != NULL
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Arrive__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Consumable_order_minor__r.showFalseNotshowTrue__c = FALSE
                            AND Deliver_date__c < LAST_N_DAYS:7
                            AND Consumable_order_minor__c = :orderId
                            GROUP BY Asset_Model_No__c];
                GROUP BY Asset_Model_No__c
            ];
                            
            for(Integer i = 0 ; i< morethan7daysList.size() ; i++){
                morethansevendaysIifo.add(new showRecords(morethan7daysList[i]));
@@ -524,9 +652,11 @@
        List<ShowRecords> morethansevendaysIifo = new List<ShowRecords>();
        try{
            String userId = UserInfo.getUserId();
            List<User> userList = [SELECT accountid, Work_Location__c,UserPro_Type__c
            List<User> userList = [
                SELECT accountid, Work_Location__c, UserPro_Type__c
                            FROM user
                            WHERE id = :userId ];
                WHERE id = :userId
            ];
            String accountid = userList[0].accountid;
            String userPro_Type = userList[0].UserPro_Type__c;
            String userWorklocation = userList[0].Work_Location__c;
@@ -534,21 +664,34 @@
            String rtTypeDelivery = System.Label.RT_ConOrder_Delivery;
            List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
            //20200916 ljh update start
            if(Test.isRunningTest()){
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c >= 0 or Delivery_detail_count__c >=0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation  and showFalseNotshowTrue__c = false];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >=0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
            }else{
                //conorderlist  = [select id,name,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation];
                if(type !=null && type.equals('all')){
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and (OrderNumber_notarrive__c > 0 or Delivery_detail_count__c >0)  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND (OrderNumber_notarrive__c > 0
                        OR Delivery_detail_count__c > 0)
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
                }else{
                    conorderlist  = [select id,Owner.Name from Consumable_order__c where Order_type__c = '订单' and  recordtypeid = :rtTypeDelivery and Dealer_Info__c = :accountid and  Delivery_detail_count__c >0  and Order_ProType__c = :userPro_Type and Order_Owner_WorkLocal__c = :userWorklocation and showFalseNotshowTrue__c = false];
                }
                conorderlist = [
                    SELECT id, Owner.Name
                    FROM Consumable_order__c
                    WHERE
                        Order_type__c = '订单'
                        AND recordtypeid = :rtTypeDelivery
                        AND Dealer_Info__c = :accountid
                        AND Delivery_detail_count__c > 0
                        AND Order_ProType__c = :userPro_Type
                        AND Order_Owner_WorkLocal__c = :userWorklocation
                        AND showFalseNotshowTrue__c = FALSE
                ];
            }
            system.debug('==============>conorderlist'+conorderlist);
            system.debug('==============>conorderlist'+conorderlist.size());
@@ -564,22 +707,33 @@
            }
            System.debug('ANY o'+orderId);
            List<Consumable_order_details2__c> conList = new List<Consumable_order_details2__c>();
            if(Test.isRunningTest()){
                conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c ];
            }else{
                //20200916 ljh update start
                //conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                if(type !=null && type.equals('all')){
                    system.debug('all============');
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = FALSE
                        AND Consumable_order_minor__c = :orderId
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                    system.debug('allconList==========='+conList.size());
                }else{
                    system.debug('notall=============');
                    conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
                conList = [
                    SELECT id, Bar_Code__c
                    FROM Consumable_order_details2__c
                    WHERE
                        Dealer_Arrive__c = FALSE
                        AND Consumable_order_minor__c = :orderId
                        AND Deliver_date__c < :orderdate
                        AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery
                ];
                    system.debug('notallconList==========='+conList.size());
                }
                //20200916 ljh update end   
            }
            // List<Consumable_order_details2__c> conList = [SELECT id,Bar_Code__c FROM Consumable_order_details2__c WHERE Dealer_Arrive__c = false AND Consumable_order_minor__c = :orderId AND Deliver_date__c < :orderdate AND recordtypeid = :System.Label.RT_ConOrderDetail2_Delivery];
            Map<String,String> srtMap = new Map<String,String>();
            for(Consumable_order_details2__c con : conList){
@@ -589,15 +743,20 @@
            for(String s : srtMap.keySet()){
                str.add(srtMap.get(s));
            }
            List<AggregateResult> morethan7daysList = [SELECT Asset_Model_No__c prodModel,count(Id) recordCount FROM Consumable_order_details2__c
                            WHERE Id =: str and Cancellation_Flag__c = false
                            AND Consumable_order_minor__c != null
                            AND Dealer_Shipment__c = false
                            AND Dealer_Arrive__c = false
                            AND Dealer_Saled__c = false
                            AND Consumable_order_minor__r.showFalseNotshowTrue__c = false
            List<AggregateResult> morethan7daysList = [
                SELECT Asset_Model_No__c prodModel, count(Id) recordCount
                FROM Consumable_order_details2__c
                WHERE
                    Id = :str
                    AND Cancellation_Flag__c = FALSE
                    AND Consumable_order_minor__c != NULL
                    AND Dealer_Shipment__c = FALSE
                    AND Dealer_Arrive__c = FALSE
                    AND Dealer_Saled__c = FALSE
                    AND Consumable_order_minor__r.showFalseNotshowTrue__c = FALSE
                            AND Deliver_date__c < LAST_N_DAYS:7
                            GROUP BY Asset_Model_No__c];
                GROUP BY Asset_Model_No__c
            ];
            system.debug('Morethan7daysList================>'+morethan7daysList.size());
            for(Integer i = 0 ; i< morethan7daysList.size() ; i++){
                morethansevendaysIifo.add(new showRecords(morethan7daysList[i]));
@@ -621,14 +780,14 @@
        public List<ShowRecords> recordList;
    }
    public class ShowRecords implements Comparable {
        @AuraEnabled
        public Decimal recordCount { get; set; }
        @AuraEnabled
        public String prodModel { get; set; }
        public ShowRecords() {}
        public ShowRecords() {
        }
        public ShowRecords(AggregateResult e) {
            recordCount =Integer.valueOf(e.get('recordCount'));