binxie
2023-06-16 da42e2995c00293af89c71fe5ba6e16cbb77e1b3
force-app/main/default/classes/LexConsumableGoodsInfo.cls
@@ -21,19 +21,10 @@
                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];
                    }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];
                    }
                }
                for(Consumable_order__c conorder : conorderlist){
                    String temp = (String)conorder.Id;
@@ -42,11 +33,8 @@
                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];
            }
            
            Map<String,Decimal> allConOrderMap = new Map<String,Decimal>();
            for(Consumable_Orderdetails__c con : conOrderList1){
@@ -123,21 +111,11 @@
            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];
                }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];
                }
            }
            //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,9 +129,6 @@
            }
            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')){
@@ -162,7 +137,6 @@
                    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){
@@ -227,21 +201,11 @@
            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];
                }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];
                }
            }
            //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,9 +219,6 @@
            }
            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')){
@@ -266,7 +227,6 @@
                    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){
@@ -396,21 +356,11 @@
            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];
                }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];
                }
            }
            //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,9 +374,6 @@
            }
            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')){
@@ -435,7 +382,6 @@
                    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){
@@ -534,21 +480,11 @@
            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];
                }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];
                }
            }
            system.debug('==============>conorderlist'+conorderlist);
            system.debug('==============>conorderlist'+conorderlist.size());
@@ -564,9 +500,6 @@
            }
            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')){
@@ -579,7 +512,6 @@
                    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){