buli
2023-05-04 50b39c4b52bf5fd61ec46ada365c51e05a16d2ae
force-app/main/default/classes/LexSaleAndDeliveryController.cls
@@ -20,11 +20,8 @@
            Map<String,object> data = new Map<String,object>();
            res.entity = data;
            userinfoId = UserInfo.getUserId();
            List<user> Useracc = New List<user>();
            Useracc = [SELECT
                            accountid, Work_Location__c,UserPro_Type__c
                        FROM user
            WHERE id =:userinfoId];
            List<user> Useracc = new List<user>();
            Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userinfoId];
            accountid = Useracc[0].accountid;
            agencyProType = Useracc[0].UserPro_Type__c;
            if(String.isBlank(Useracc[0].UserPro_Type__c)){
@@ -35,7 +32,16 @@
            data.put('accountid',accountid);
            data.put('agencyProType',agencyProType);
            data.put('userWorkLocation',userWorkLocation);
            System.debug('userinfoId = ' + userinfoId + ' accountid = ' + accountid + ' agencyProType = ' + agencyProType + ' userWorkLocation = ' + userWorkLocation);
            System.debug(
                'userinfoId = ' +
                userinfoId +
                ' accountid = ' +
                accountid +
                ' agencyProType = ' +
                agencyProType +
                ' userWorkLocation = ' +
                userWorkLocation
            );
            //默认检索显示未完成的指示单
            List<Consumable_order__c> raesList = new List<Consumable_order__c>();
            String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
@@ -59,7 +65,15 @@
    // 已出库未开票的出库单
    @AuraEnabled
    public static ResponseBodyLWC searchOrderInstatus(String orderDate,String deliverDate,String accountid,String agencyProType,String userWorkLocation,String category1,String category2) {
    public static ResponseBodyLWC searchOrderInstatus(
        String orderDate,
        String deliverDate,
        String accountid,
        String agencyProType,
        String userWorkLocation,
        String category1,
        String category2
    ) {
        try {
            ResponseBodyLWC res = new ResponseBodyLWC();
            Map<String,object> data = new Map<String,object>();
@@ -108,13 +122,23 @@
    //还没出库的出库单
    @AuraEnabled
    public static ResponseBodyLWC searchConsumableorderdetails(String orderDate,String deliverDate,String accountid,String agencyProType,String userWorkLocation,String category1,String category2) {
    public static ResponseBodyLWC searchConsumableorderdetails(
        String orderDate,
        String deliverDate,
        String accountid,
        String agencyProType,
        String userWorkLocation,
        String category1,
        String category2
    ) {
        try {
            ResponseBodyLWC res = new ResponseBodyLWC();
            Map<String,object> data = new Map<String,object>();
            res.entity = data;
            Date cate2 = String.isEmpty(orderDate) ? null : Date.valueOf(orderDate.replace('/', '-'));
            Date cate3 = String.isEmpty(deliverDate) ? null : Date.valueOf(deliverDate.replace('/', '-'));
            System.debug('cate2 = ' + cate2);
            System.debug('cate3 = ' + cate3);
            // 获得订单一览
            List<Consumable_order__c> raesList = new List<Consumable_order__c>();
            String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
@@ -154,7 +178,15 @@
    // 已出库已开票的出库单
    @AuraEnabled
    public static ResponseBodyLWC searchConsumableorFinish(String orderDate,String deliverDate,String accountid,String agencyProType,String userWorkLocation,String category1,String category2) {
    public static ResponseBodyLWC searchConsumableorFinish(
        String orderDate,
        String deliverDate,
        String accountid,
        String agencyProType,
        String userWorkLocation,
        String category1,
        String category2
    ) {
        try {
            ResponseBodyLWC res = new ResponseBodyLWC();
            Map<String,object> data = new Map<String,object>();
@@ -196,4 +228,35 @@
            return new ResponseBodyLWC('Error',500, e.getMessage(), '');
        }
    }
    @AuraEnabled
    public static ResponseBodyLWC cleanUp(String accountid, String agencyProType, String userWorkLocation) {
        try {
            ResponseBodyLWC res = new ResponseBodyLWC();
            Map<String, object> data = new Map<String, object>();
            res.entity = data;
            // 获得显示数据
            List<Consumable_order__c> raesList = new List<Consumable_order__c>();
            String soql = 'select Id, Name,ShipmentAccount__c,SummonsStatus_c__c,Billed_Status__c,CreatedDate,Outbound_Date__c,Order_ForCustomerText__c,InvoiceNotPro_total_amount__c,InvoiceNotPro_money__c from Consumable_order__c';
            soql += '  WHERE Order_type__c = \'' + '传票' + '\'  ';
            soql += ' and Order_ProType__c =\'' + agencyProType + '\' ';
            soql += 'and SummonsStatus_c__c != \'' + '已完成' + '\' and Dealer_Info__c =\'' + accountid + '\' ';
            soql += 'and Order_Owner_WorkLocal__c = \'' + userWorkLocation + '\' ';
            soql += 'order by SummonsStatus_c__c';
            System.debug('soql = ' + soql);
            raesList = Database.query(soql);
            data.put('raesList', raesList);
            if (raesList.size() > 0) {
                res.msg = '共有' + raesList.size() + '个出库单';
            } else {
                res.msg = '没有搜索到相关出库单。';
            }
            res.status = 'Success';
            res.code = 200;
            return res;
        } catch (Exception e) {
            return new ResponseBodyLWC('Error', 500, e.getMessage(), '');
        }
    }
}