buli
2023-07-14 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7
force-app/main/default/classes/LexConsumableGoodsInfo.cls
@@ -1,4 +1,5 @@
public without sharing class LexConsumableGoodsInfo {
    //所有产品一览
    @AuraEnabled
    public static Results initTotalNum(String ordId, String type) {
@@ -11,11 +12,9 @@
        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;
@@ -23,32 +22,9 @@
                List<Consumable_order__c> conorderlist = new List<Consumable_order__c>();
                //20200916 ljh update start
                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];
                }
                for (Consumable_order__c conorder : conorderlist) {
                    String temp = (String) conorder.Id;
@@ -58,11 +34,7 @@
            }
            List<Consumable_Orderdetails__c> conOrderList1 = new List<Consumable_Orderdetails__c>();
            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) {
@@ -98,11 +70,7 @@
        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);
@@ -111,12 +79,9 @@
            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]));
            }
@@ -136,11 +101,9 @@
        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;
@@ -150,32 +113,9 @@
            //20200916 ljh update start
            //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];
@@ -192,24 +132,9 @@
            //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];
@@ -221,12 +146,9 @@
            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]));
@@ -246,12 +168,10 @@
        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]));
            }
@@ -271,11 +191,9 @@
        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;
@@ -285,32 +203,9 @@
            //20200916 ljh update start
            //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];
@@ -327,24 +222,9 @@
            //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];
@@ -356,12 +236,9 @@
            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]));
@@ -386,11 +263,7 @@
            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);
@@ -399,22 +272,17 @@
            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]));
            }
@@ -422,11 +290,8 @@
            // 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]));
            // }
@@ -481,11 +346,9 @@
        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;
@@ -495,32 +358,9 @@
            //20200916 ljh update start
            //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];
@@ -537,20 +377,9 @@
            //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];
@@ -562,22 +391,15 @@
            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) {
@@ -619,19 +441,15 @@
        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]));
@@ -652,11 +470,9 @@
        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;
@@ -666,32 +482,9 @@
            //20200916 ljh update start
            //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());
@@ -711,26 +504,11 @@
            //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
@@ -743,20 +521,15 @@
            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]));
@@ -780,14 +553,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'));