binxie
2023-06-26 00e147ec892cb1e89d0698787a8c60da1014cdb7
force-app/main/default/classes/LexSummonsCreatController.cls
@@ -245,11 +245,17 @@
    // 画面初始化
    @AuraEnabled
    public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC) {
        // try {
    public static ResponseBodyLWC init(
        String ESetidJs,
        String statusEdit,
        Integer pageSizeLWC,
        Integer pageTokenLWC,
        String arriveorderLWC
    ) {
        try {
        firstInit(ESetidJs);
        statusEdit = statusEdit;
        arriveorder = '';
            arriveorder = arriveorderLWC;
        HospitalName = '';
        provinceOpts = new List<SelectOption>();
        provinceOptsMap = new Map<String, String>();
@@ -1393,9 +1399,9 @@
        res.code = 200;
        System.debug('res = ' + res);
        return res;
        // } catch (Exception e) {
        //     return new ResponseBodyLWC('Error',500, e.getMessage(), '');
        // }
        } catch (Exception e) {
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
        }
    }
    @AuraEnabled
@@ -1698,6 +1704,7 @@
        data.put('paginatedAccounts', paginatedAccounts);
        data.put('pageRecords', pageRecordsTemp);
        data.put('SearchDone', SearchDone);
        data.put('hasHosPro', hasHosPro);
        res.status = 'Success';
        res.code = 200;
        System.debug('res = ' + res);
@@ -2121,11 +2128,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) + ' 的特价',
                        ''
                    );
                }
@@ -2177,22 +2180,22 @@
            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                if (ass.check == true) {
                    if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
                        ass.orderdetails1.Delivery_List_RMB__c == 0 &&
                        (coc.SummonsForDirction__c == '销售给二级经销商' ||
                        coc.SummonsForDirction__c == '直接销售给医院')
                    ) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Shipment_Count__c == null || ass.orderdetails1.Shipment_Count__c == 0) {
@@ -2217,9 +2220,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2235,9 +2236,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2340,14 +2339,13 @@
            for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                if (ass.check == true) {
                    if (ass.orderdetails1.Delivery_List_RMB__c < 0) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入正确的出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', '');
                    }
                    Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c();
                    if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                    if (
                        (ass.orderdetails1.Delivery_List_RMB__c == null || ass.orderdetails1.Delivery_List_RMB__c == 0) &&
                        coc.SummonsForDirction__c != '医院试用'
                    ) {
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (
@@ -2355,8 +2353,6 @@
                        (coc.SummonsForDirction__c == '销售给二级经销商' ||
                        coc.SummonsForDirction__c == '直接销售给医院')
                    ) {
                        // ass.orderdetails1.Delivery_List_RMB__c.addError('请输入出货单价 (元)');
                        // return null;
                        return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', '');
                    }
                    if (ass.orderdetails1.Box_Piece__c == null || ass.orderdetails1.Box_Piece__c == '') {
@@ -2375,9 +2371,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2392,9 +2386,7 @@
                                return new ResponseBodyLWC(
                                    'Error',
                                    500,
                                    '消耗品' +
                                    ass.orderdetails1.Consumable_Product__r.Name__c +
                                    '库存不足',
                                    '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足',
                                    ''
                                );
                            }
@@ -2569,7 +2561,6 @@
        //     ];
        // }
        Date today = Date.today();
        //Date today = Date.newInstance(2023, 3, 1);
        Integer thisMonth = today.month();
@@ -2588,7 +2579,7 @@
        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){
@@ -2695,6 +2686,20 @@
        return res;
    }
    //删除附件
    @AuraEnabled
    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];
            delete conDocument;
            return new ResponseBodyLWC('Success', 200, '', '');
        } catch (Exception e) {
            return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), '');
        }
    }
    //跳转出货/销售
    @AuraEnabled
    public static ResponseBodyLWC GoodsDelivery(
@@ -2770,6 +2775,7 @@
    }
    // Data Bean
    @TestVisible
    class ConsumableorderdetailsInfo implements Comparable {
        @AuraEnabled
        public Boolean check { get; set; }
@@ -2910,6 +2916,7 @@
        }
    }
    @TestVisible
    class ConsumableorderdetailsInfoLwc {
        @AuraEnabled
        public Boolean check { get; set; }