buli
2023-07-14 e6068da47c1bef5517c9e5fdc8c726766867ad4e
force-app/main/default/classes/LexSummonsCreatController.cls
@@ -245,7 +245,13 @@
    // 画面初始化
    @AuraEnabled
    public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC,String arriveorderLWC) {
    public static ResponseBodyLWC init(
        String ESetidJs,
        String statusEdit,
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String arriveorderLWC
    ) {
        try {
            firstInit(ESetidJs);
            statusEdit = statusEdit;
@@ -1398,7 +1404,7 @@
            System.debug('res = ' + res);
            return res;
        } catch (Exception e) {
            return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), '');
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
        }
    }
@@ -2132,11 +2138,7 @@
                    return new ResponseBodyLWC(
                        'Error',
                        500,
                        '经销商:' +
                        coc.Order_ForDealerText__c +
                        ' 没有消耗品:' +
                        proStr.substring(0, proStr.length() - 1) +
                        ' 的特价',
                        '经销商:' + coc.Order_ForDealerText__c + ' 没有消耗品:' + proStr.substring(0, proStr.length() - 1) + ' 的特价',
                        ''
                    );
                }
@@ -2193,7 +2195,10 @@
                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') {
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    if ((ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) && coc.SummonsForDirction__c != '医院试用') {
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
@@ -2225,9 +2230,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2243,9 +2246,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2351,7 +2352,10 @@
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
                    if ((ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) && coc.SummonsForDirction__c != '医院试用') {
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
@@ -2377,9 +2381,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2394,9 +2396,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2545,7 +2545,7 @@
        //         FROM Account
        //         WHERE
        //             // Name = '奥林巴斯(北京)销售服务有限公司'
        //             // AND
        //             // AND
        //             Name LIKE :nameCondition
        //             AND RecordType.DeveloperName = 'AgencyContract'
        //             AND Contract_Decide_Start_Date__c >= :thisDatetime
@@ -2561,7 +2561,7 @@
        //         FROM Account
        //         WHERE
        //             // Name = '奥林巴斯(北京)销售服务有限公司'
        //             // AND
        //             // AND
        //             Name LIKE :nameCondition
        //             AND RecordType.DeveloperName = 'AgencyContract'
        //             AND Contract_Decide_Start_Date__c >= :thisDatetime
@@ -2572,7 +2572,6 @@
        //     ];
        // }
        Date today = Date.today();
        //Date today = Date.newInstance(2023, 3, 1);
        Integer thisMonth = today.month();
@@ -2581,7 +2580,7 @@
        Integer lastYear = today.year() - 1;
        Integer thisYear = today.year();
        Integer nextYear = today.year() + 1;
        Date lastDatetime = Date.newInstance(lastYear, 4, 1);
        Date thisDatetime = Date.newInstance(thisYear, 4, 1);
        Date thisDatetime2 = Date.newInstance(thisYear, 7, 1);
@@ -2591,14 +2590,14 @@
        System.debug('thisDatetime2 = ' + thisDatetime2);
        System.debug('nextDatetime = ' + nextDatetime);
        System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
        User UserProTypecTemp = [select UserPro_Type__c from User where id =: UserInfo.getUserId()];
        User UserProTypecTemp = [SELECT UserPro_Type__c FROM User WHERE id = :UserInfo.getUserId()];
        String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition ';
        if(thisMonth < 4){
        if (thisMonth < 4) {
            sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 ';
        }else if(thisMonth >= 4 && thisMonth <= 6){
        } else if (thisMonth >= 4 && thisMonth <= 6) {
            sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
        }else{
        } else {
            sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime ';
        }
        if (UserProTypecTemp.UserPro_Type__c == 'ENG') {
@@ -2698,7 +2697,7 @@
                FROM ContentVersion
                WHERE ContentDocumentId IN :documentIds
            ];
            if (cvInfo.size() > 0) {
                for (Integer i = 0; i < cvInfo.size(); i++) {
                    cvList.add(cvInfo[i]);
@@ -2719,15 +2718,15 @@
    //删除附件
    @AuraEnabled
    public static ResponseBodyLWC deleteAtt(String contentVersionId){
    public static ResponseBodyLWC deleteAtt(String contentVersionId) {
        try {
            ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
            String contentDocumentId = conVersion.ContentDocumentId;
            ContentDocument conDocument =  [SELECT Id FROM ContentDocument where Id = :contentDocumentId];
            ContentDocument conDocument = [SELECT Id FROM ContentDocument WHERE Id = :contentDocumentId];
            delete conDocument;
            return new ResponseBodyLWC('Success',200,'','');
            return new ResponseBodyLWC('Success', 200, '', '');
        } catch (Exception e) {
            return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), '');
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
        }
    }
@@ -2894,7 +2893,7 @@
            hospitalSpecialOffer = false;
            hosPro = false;
        }
        //附件
        @TestVisible
        public ConsumableorderdetailsInfo(Attachment e) {
@@ -3025,4 +3024,4 @@
        @AuraEnabled
        public Integer recordEnd { get; set; }
    }
}
}