| | |
| | | |
| | | // 画面初始化 |
| | | @AuraEnabled |
| | | <<<<<<< HEAD |
| | | public static ResponseBodyLWC init( |
| | | String ESetidJs, |
| | | String statusEdit, |
| | |
| | | Integer pageTokenLWC, |
| | | String arriveorderLWC |
| | | ) { |
| | | ======= |
| | | public static ResponseBodyLWC init(String ESetidJs, String statusEdit, Integer pageSizeLWC, Integer pageTokenLWC,String arriveorderLWC) { |
| | | >>>>>>> LEXCommunityLiJun |
| | | try { |
| | | firstInit(ESetidJs); |
| | | statusEdit = statusEdit; |
| | |
| | | editAble = true; |
| | | } |
| | | userId = UserInfo.getUserId(); |
| | | <<<<<<< HEAD |
| | | localuser = [ |
| | | SELECT id, State_Hospital__c |
| | | FROM User |
| | |
| | | FROM user |
| | | WHERE id = :userId |
| | | ]; |
| | | ======= |
| | | localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()]; |
| | | //userId = '00510000005QO75'; |
| | | user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | accountid = Useracc.accountid; |
| | | userWorkLocation = Useracc.Work_Location__c; |
| | | agencyProType = Useracc.UserPro_Type__c; |
| | |
| | | ]; |
| | | |
| | | List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>(); |
| | | <<<<<<< HEAD |
| | | AgencyHospitalLink = [ |
| | | SELECT Id, Hospital__c, Hospital__r.Name |
| | | FROM Agency_Hospital_Link__c |
| | |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :accountid |
| | | ]; |
| | | ======= |
| | | AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid]; |
| | | |
| | | //add by rentx 2021-3-1 start |
| | | //判断当前经销商下是否有特价医院 |
| | | List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | if (hlist == null || hlist.size() == 0) { |
| | | hasHos = false; |
| | | } else { |
| | |
| | | for (AggregateResult orderdetail : orderdetailCount) { |
| | | zaikuId.add(String.valueOf(orderdetail.get('cpc'))); |
| | | } |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('orderdetailCount = ' + orderdetailCount); |
| | | >>>>>>> LEXCommunityLiJun |
| | | System.debug('sqlagencyProType = ' + sqlagencyProType); |
| | | System.debug('userWorkLocation = ' + userWorkLocation); |
| | | System.debug('accountName = ' + accountName); |
| | |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('MidMap = ' + MidMap); |
| | | >>>>>>> LEXCommunityLiJun |
| | | for (Integer i = 0; i < CountDel.size(); i++) { |
| | | String str = ''; |
| | | if (CountDel[i].hospitalSpecialOffer__c) { |
| | |
| | | } else { |
| | | str = 'notHos'; |
| | | } |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('CountDel[i].Consumable_Product__c= ' + CountDel[i].Consumable_Product__c); |
| | | System.debug('CountDel[i].Consumable_Product__c + str= ' + CountDel[i].Consumable_Product__c + str); |
| | | >>>>>>> LEXCommunityLiJun |
| | | //明细2对应的产品存在于MidMap中 |
| | | if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) { |
| | | //设置map中key的后缀 用于区分医院特价和非医院特价 |
| | |
| | | SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c |
| | | FROM Consumable_order__c |
| | | WHERE |
| | | <<<<<<< HEAD |
| | | Id IN ( |
| | | SELECT Invoice_Code_link__c |
| | | FROM Consumable_order_LinkTable__c |
| | | WHERE Outboundorder_Code_link__c = :ESetId |
| | | ) |
| | | ======= |
| | | Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId) |
| | | >>>>>>> LEXCommunityLiJun |
| | | AND Invoice_status__c != '草案中' |
| | | ]; |
| | | |
| | |
| | | // 显示数据条数信息 |
| | | // makeMessage(); |
| | | //附件 |
| | | <<<<<<< HEAD |
| | | attachmentinfo = [ |
| | | SELECT Id, Name, OwnerId |
| | | FROM Attachment |
| | | WHERE parentid = :ESetId |
| | | ]; |
| | | ======= |
| | | attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | if (attachmentinfo.size() > 0) { |
| | | for (Integer i = 0; i < attachmentinfo.size(); i++) { |
| | | attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | |
| | | System.debug('res = ' + res); |
| | | return res; |
| | | } catch (Exception e) { |
| | | <<<<<<< HEAD |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), ''); |
| | | ======= |
| | | return new ResponseBodyLWC('Error',500, e.getMessage() + e.getLineNumber(), ''); |
| | | >>>>>>> LEXCommunityLiJun |
| | | } |
| | | } |
| | | |
| | |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('category4List ' + category4List); |
| | | >>>>>>> LEXCommunityLiJun |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('category5List ' + category5List); |
| | | >>>>>>> LEXCommunityLiJun |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | |
| | | WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL |
| | | GROUP BY Category4_text__c |
| | | ]; |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('category4List ' + category4List); |
| | | >>>>>>> LEXCommunityLiJun |
| | | category4OptionList = new List<SelectOption>(); |
| | | category4OptionList.add(new SelectOption('', '-无-')); |
| | | category4OptionMap = new Map<String, String>(); |
| | |
| | | GROUP BY Category5_text__c |
| | | ]; |
| | | |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('category5List ' + category5List); |
| | | >>>>>>> LEXCommunityLiJun |
| | | category5OptionList = new List<SelectOption>(); |
| | | category5OptionList.add(new SelectOption('', '-无-')); |
| | | category5OptionMap = new Map<String, String>(); |
| | |
| | | AND Arrive_Owner_Work_Location__c = :userWorkLocationLwc |
| | | GROUP BY Consumable_Product__c, Box_Piece__c |
| | | ]; |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('orderdetailCount = ' + orderdetailCount); |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | for (AggregateResult orderdetail : orderdetailCount) { |
| | | zaikuId.add(String.valueOf(orderdetail.get('cpc'))); |
| | | } |
| | |
| | | //特价医院出库非本医院维护的特价商品时,报错 非特价医院出库维护在医院特价关系表的产品时 报错 |
| | | if (coc.SummonsForDirction__c != '互相调货') { |
| | | //非特价医院出库特价产品时 报错(当前经销商下没有特价医院除外) |
| | | <<<<<<< HEAD |
| | | List<hospitalprice__c> hopList = [ |
| | | SELECT id, hospital__c, product__c |
| | | FROM hospitalprice__c |
| | | WHERE account__c = :accountid |
| | | ]; |
| | | ======= |
| | | List<hospitalprice__c> hopList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | //经销商对应医院下的所有特价产品 |
| | | Map<String, String> proMap = new Map<String, String>(); |
| | | //经销商下的所有特价产品 |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | <<<<<<< HEAD |
| | | '经销商:' + coc.Order_ForDealerText__c + ' 没有消耗品:' + proStr.substring(0, proStr.length() - 1) + ' 的特价', |
| | | ======= |
| | | '经销商:' + |
| | | coc.Order_ForDealerText__c + |
| | | ' 没有消耗品:' + |
| | | proStr.substring(0, proStr.length() - 1) + |
| | | ' 的特价', |
| | | >>>>>>> LEXCommunityLiJun |
| | | '' |
| | | ); |
| | | } |
| | |
| | | if (ass.orderdetails1.Delivery_List_RMB__c == null && coc.SummonsForDirction__c != '医院试用') { |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | <<<<<<< HEAD |
| | | 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 != '医院试用') { |
| | | >>>>>>> LEXCommunityLiJun |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if ( |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | <<<<<<< HEAD |
| | | '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', |
| | | ======= |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | >>>>>>> LEXCommunityLiJun |
| | | '' |
| | | ); |
| | | } |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | <<<<<<< HEAD |
| | | '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', |
| | | ======= |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | >>>>>>> LEXCommunityLiJun |
| | | '' |
| | | ); |
| | | } |
| | |
| | | insert p; |
| | | ESetId = p.id; |
| | | List<Consumable_order__c> detailName = new List<Consumable_order__c>(); |
| | | <<<<<<< HEAD |
| | | detailName = [ |
| | | SELECT id, Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :ESetId |
| | | ]; |
| | | ======= |
| | | detailName = [SELECT id, Name FROM Consumable_order__c WHERE id = :ESetId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | Integer i = 1; |
| | | for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) { |
| | | if (ass.check == true) { |
| | |
| | | return new ResponseBodyLWC('Error', 500, '请输入正确的出货单价 (元)', ''); |
| | | } |
| | | Consumable_orderdetails__c InsAfterDel = new Consumable_orderdetails__c(); |
| | | <<<<<<< HEAD |
| | | 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 != '医院试用') { |
| | | >>>>>>> LEXCommunityLiJun |
| | | return new ResponseBodyLWC('Error', 500, '请输入出货单价 (元)', ''); |
| | | } |
| | | if ( |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | <<<<<<< HEAD |
| | | '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', |
| | | ======= |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | >>>>>>> LEXCommunityLiJun |
| | | '' |
| | | ); |
| | | } |
| | |
| | | return new ResponseBodyLWC( |
| | | 'Error', |
| | | 500, |
| | | <<<<<<< HEAD |
| | | '消耗品' + ass.orderdetails1.Consumable_Product__r.Name__c + '库存不足', |
| | | ======= |
| | | '消耗品' + |
| | | ass.orderdetails1.Consumable_Product__r.Name__c + |
| | | '库存不足', |
| | | >>>>>>> LEXCommunityLiJun |
| | | '' |
| | | ); |
| | | } |
| | |
| | | InsAfterDel.Name = p.name + '-' + str; |
| | | InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c; |
| | | InsAfterDel.Consumable_order__c = ESetId; |
| | | <<<<<<< HEAD |
| | | ======= |
| | | System.debug('ass.Prod.id:' + ass.Prod.id); |
| | | >>>>>>> LEXCommunityLiJun |
| | | InsAfterDel.Consumable_Product__c = ass.Prod.id; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c; |
| | | InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c; |
| | |
| | | } |
| | | update p; |
| | | List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>(); |
| | | <<<<<<< HEAD |
| | | qs = [ |
| | | SELECT Id |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]; |
| | | ======= |
| | | qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | if (qs.size() > 0) { |
| | | delete qs; |
| | | } |
| | |
| | | // FROM Account |
| | | // WHERE |
| | | // // Name = '奥林巴斯(北京)销售服务有限公司' |
| | | <<<<<<< HEAD |
| | | // // AND |
| | | ======= |
| | | // // AND |
| | | >>>>>>> LEXCommunityLiJun |
| | | // Name LIKE :nameCondition |
| | | // AND RecordType.DeveloperName = 'AgencyContract' |
| | | // AND Contract_Decide_Start_Date__c >= :thisDatetime |
| | |
| | | // FROM Account |
| | | // WHERE |
| | | // // Name = '奥林巴斯(北京)销售服务有限公司' |
| | | <<<<<<< HEAD |
| | | // // AND |
| | | ======= |
| | | // // AND |
| | | >>>>>>> LEXCommunityLiJun |
| | | // Name LIKE :nameCondition |
| | | // AND RecordType.DeveloperName = 'AgencyContract' |
| | | // AND Contract_Decide_Start_Date__c >= :thisDatetime |
| | |
| | | // ]; |
| | | // } |
| | | |
| | | <<<<<<< HEAD |
| | | ======= |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | Date today = Date.today(); |
| | | //Date today = Date.newInstance(2023, 3, 1); |
| | | Integer thisMonth = today.month(); |
| | |
| | | Integer lastYear = today.year() - 1; |
| | | Integer thisYear = today.year(); |
| | | Integer nextYear = today.year() + 1; |
| | | <<<<<<< HEAD |
| | | |
| | | ======= |
| | | |
| | | >>>>>>> LEXCommunityLiJun |
| | | Date lastDatetime = Date.newInstance(lastYear, 4, 1); |
| | | Date thisDatetime = Date.newInstance(thisYear, 4, 1); |
| | | Date thisDatetime2 = Date.newInstance(thisYear, 7, 1); |
| | |
| | | System.debug('thisDatetime2 = ' + thisDatetime2); |
| | | System.debug('nextDatetime = ' + nextDatetime); |
| | | System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId()); |
| | | <<<<<<< HEAD |
| | | User UserProTypecTemp = [ |
| | | SELECT UserPro_Type__c |
| | | FROM User |
| | |
| | | } else if (thisMonth >= 4 && thisMonth <= 6) { |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime '; |
| | | } else { |
| | | ======= |
| | | 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){ |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :thisDatetime2 '; |
| | | }else if(thisMonth >= 4 && thisMonth <= 6){ |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :lastDatetime AND Contract_Decide_End_Date__c < :nextDatetime '; |
| | | }else{ |
| | | >>>>>>> LEXCommunityLiJun |
| | | sql += 'AND Contract_Decide_Start_Date__c >= :thisDatetime AND Contract_Decide_End_Date__c < :nextDatetime '; |
| | | } |
| | | if (UserProTypecTemp.UserPro_Type__c == 'ENG') { |
| | |
| | | ResponseBodyLWC res = new ResponseBodyLWC(); |
| | | Map<String, object> data = new Map<String, object>(); |
| | | res.entity = data; |
| | | <<<<<<< HEAD |
| | | List<ContentVersion> cvList = [ |
| | | SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId |
| | | FROM ContentVersion |
| | | WHERE FirstPublishLocationId = :recordId |
| | | ]; |
| | | ======= |
| | | List<ContentVersion> cvList = new List<ContentVersion>(); |
| | | List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :recordId]; |
| | | if (links != null && links.size() > 0) { |
| | | List<String> documentIds = new List<String>(); |
| | | for (ContentDocumentLink link : links) { |
| | | documentIds.add(link.ContentDocumentId); |
| | | } |
| | | List<ContentVersion> cvInfo = [ |
| | | SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId |
| | | FROM ContentVersion |
| | | WHERE ContentDocumentId IN :documentIds |
| | | ]; |
| | | |
| | | if (cvInfo.size() > 0) { |
| | | for (Integer i = 0; i < cvInfo.size(); i++) { |
| | | cvList.add(cvInfo[i]); |
| | | } |
| | | } |
| | | } |
| | | // List<ContentVersion> cvList = [ |
| | | // SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId |
| | | // FROM ContentVersion |
| | | // WHERE FirstPublishLocationId = :recordId |
| | | // ]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | data.put('cvList', cvList); |
| | | res.status = 'Success'; |
| | | res.code = 200; |
| | |
| | | |
| | | //删除附件 |
| | | @AuraEnabled |
| | | <<<<<<< HEAD |
| | | public static ResponseBodyLWC deleteAtt(String contentVersionId) { |
| | | try { |
| | | ContentVersion conVersion = [ |
| | |
| | | return new ResponseBodyLWC('Success', 200, '', ''); |
| | | } catch (Exception e) { |
| | | return new ResponseBodyLWC('Error', 500, e.getMessage() + e.getLineNumber(), ''); |
| | | ======= |
| | | 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(), ''); |
| | | >>>>>>> LEXCommunityLiJun |
| | | } |
| | | } |
| | | |
| | |
| | | try { |
| | | List<Consumable_order__c> qs = new List<Consumable_order__c>(); |
| | | List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>(); |
| | | <<<<<<< HEAD |
| | | Dqs = [ |
| | | SELECT Id |
| | | FROM Consumable_orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]; |
| | | ======= |
| | | Dqs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId]; |
| | | >>>>>>> LEXCommunityLiJun |
| | | qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId]; |
| | | if (Dqs.size() > 0 || qs.size() > 0) { |
| | | delete Dqs; |
| | |
| | | hospitalSpecialOffer = false; |
| | | hosPro = false; |
| | | } |
| | | <<<<<<< HEAD |
| | | |
| | | //附件 |
| | | ======= |
| | | |
| | | //附件 |
| | | @TestVisible |
| | | >>>>>>> LEXCommunityLiJun |
| | | public ConsumableorderdetailsInfo(Attachment e) { |
| | | concc = e; |
| | | hospitalSpecialOffer = false; |
| | |
| | | @AuraEnabled |
| | | public Integer recordEnd { get; set; } |
| | | } |
| | | <<<<<<< HEAD |
| | | } |
| | | ======= |
| | | } |
| | | >>>>>>> LEXCommunityLiJun |