| | |
| | | ESetId = esetId; |
| | | methodType = type; |
| | | if(String.isBlank(methodType) && String.isNotBlank(ESetId)){ |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | List<Consumable_order__c> oclist = [ |
| | | SELECT orderPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE id = :ESetid |
| | | ]; |
| | | methodType = oclist.get(0).orderPattern__c; |
| | | } |
| | | statusEdit = keywordStr; |
| | |
| | | userId = UserInfo.getUserId(); |
| | | List<user> Useracc = new List<user>(); |
| | | //lt 20230517 安徽两票制 add ,OSHFLG__c |
| | | Useracc = [SELECT accountid, Work_Location__c,UserPro_Type__c,OSHFLG__c FROM user WHERE id = :userId ]; |
| | | Useracc = [ |
| | | SELECT accountid, Work_Location__c, UserPro_Type__c, OSHFLG__c |
| | | FROM user |
| | | WHERE id = :userId |
| | | ]; |
| | | accountid = Useracc[0].accountid; |
| | | userWorkLocation = Useracc[0].Work_Location__c; |
| | | agencyProType = Useracc[0].UserPro_Type__c; |
| | |
| | | OSHFLG = Useracc[0].OSHFLG__c; //lt 20230517 安徽两票制 add |
| | | if(OSHFLG){ |
| | | agencyProType1 = 'OSH'; |
| | | } |
| | | else if(String.isBlank(Useracc[0].UserPro_Type__c)){ |
| | | } else if (String.isBlank(Useracc[0].UserPro_Type__c)) { |
| | | agencyProType1 = 'ET'; |
| | | } |
| | | //lt 20230526 安徽两票制 end |
| | |
| | | RecordType.DeveloperName = 'AgencyContract' |
| | | AND Contract_Decide_Start_Date__c <= :dateToday |
| | | AND Contract_Decide_End_Date__c >= :dateToday |
| | | and Contact_Type__c like :agencyProType1//lt 20230517 安徽两票制 add 1 |
| | | and Agent_Ref__c =:accountid |
| | | and OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Agent_Ref__c = :accountid |
| | | AND OSH_Dealer__c = :OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | | for (Account contract : contractList) { |
| | | contactDealer.add(contract.Id); |
| | |
| | | FROM Account |
| | | WHERE |
| | | ParentId = :accountid |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | |
| | | } |
| | | consumableorderdetailsRecords.sort(); |
| | | if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) { |
| | | searchorderdetails(methodType,accountid,hospitalId,contractId,userWorkLocation,accountName,proLimitAndDate,editAble); |
| | | searchorderdetails( |
| | | methodType, |
| | | accountid, |
| | | hospitalId, |
| | | contractId, |
| | | userWorkLocation, |
| | | accountName, |
| | | proLimitAndDate, |
| | | editAble |
| | | ); |
| | | isfirst = true; |
| | | } |
| | | getPageInfo(); |
| | |
| | | // attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<ContentVersion> cvInfo = [SELECT Id, Title, OwnerId,Owner.Name, CreatedDate,ContentDocumentId FROM ContentVersion WHERE FirstPublishLocationId = :ESetId]; |
| | | List<ContentDocumentLink> links = [ |
| | | SELECT Id, ContentDocumentId |
| | | FROM ContentDocumentLink |
| | | WHERE LinkedEntityId = :ESetId |
| | | ]; |
| | | 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++) { |
| | | attachmentRecoeds.add(new ConsumableorderdetailsInfo(cvInfo[i])); |
| | | } |
| | | } |
| | | } |
| | | // |
| | |
| | | editAble = editAbleStr; |
| | | proLimitAndDate = proLimitAndDateList; |
| | | dealerProductId = (List<String>)JSON.deserialize(dealerProductIdStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | consumableorderdetailsRecordsviewStr, |
| | | List<ConsumableorderdetailsInfo>.class |
| | | ); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | pageLimit = Integer.valueOf(System.Label.orderdetPageLimitsize); |
| | | try { |
| | |
| | | ESetId = eSetidStr; |
| | | try { |
| | | statusEdit = 'Redirect'; |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | List<Consumable_order__c> oclist = [ |
| | | SELECT orderPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE id = :ESetid |
| | | ]; |
| | | String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c; |
| | | results.result = 'Success'; |
| | | results.url = url; |
| | |
| | | returnOrder = true; |
| | | try { |
| | | statusEdit = 'Redirect'; |
| | | List<Consumable_order__c> oclist = [SELECT orderPattern__c FROM Consumable_order__c WHERE id = :ESetid]; |
| | | List<Consumable_order__c> oclist = [ |
| | | SELECT orderPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE id = :ESetid |
| | | ]; |
| | | String url = '/lexconsumable?ESetid=' + ESetid + '&KeyWords=' + statusEdit + '&type=' + oclist.get(0).orderPattern__c; |
| | | results.result = 'Success'; |
| | | results.url = url; |
| | |
| | | cv.VersionData = EncodingUtil.base64Decode(base64Data); |
| | | cv.IsMajorVersion = true; |
| | | insert cv; |
| | | Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id =:pId]; |
| | | Consumable_order__c c = [ |
| | | SELECT Id |
| | | FROM Consumable_order__c |
| | | WHERE Id = :pId |
| | | ]; |
| | | c.Consumable_pdf_insert_day__c = Date.today(); |
| | | update c; |
| | | results.result = 'Success'; |
| | |
| | | Boolean OSHFLGStr |
| | | ) { |
| | | ESetId = ''; |
| | | return save(contractNameStr,cocStr,agencyProTypeStr,accountidStr,consumableorderdetailsRecordsviewStr,contactDealerStr,methodTypeStr,ESetId,hospitalIdStr,contractIdStr,agencyProType1Str,OSHFLGStr); |
| | | return save( |
| | | contractNameStr, |
| | | cocStr, |
| | | agencyProTypeStr, |
| | | accountidStr, |
| | | consumableorderdetailsRecordsviewStr, |
| | | contactDealerStr, |
| | | methodTypeStr, |
| | | ESetId, |
| | | hospitalIdStr, |
| | | contractIdStr, |
| | | agencyProType1Str, |
| | | OSHFLGStr |
| | | ); |
| | | } |
| | | |
| | | //保存按钮 |
| | |
| | | OSHFLG = OSHFLGStr; |
| | | coc = (Consumable_order__c)JSON.deserialize(cocStr, Consumable_order__c.class); |
| | | contactDealer = (List<String>)JSON.deserialize(contactDealerStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>)JSON.deserialize(consumableorderdetailsRecordsviewStr, List<ConsumableorderdetailsInfo>.class); |
| | | System.debug('consumableorderdetailsRecordsviewStr:' + consumableorderdetailsRecordsviewStr); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | consumableorderdetailsRecordsviewStr, |
| | | List<ConsumableorderdetailsInfo>.class |
| | | ); |
| | | if(coc.Offers_Price__c != null){ |
| | | String offerStr = String.valueOf(coc.Offers_Price__c); |
| | | bargainPrice = Decimal.valueOf(offerStr.replace(',','')); |
| | |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Agent_Ref__c =:accountid |
| | | AND OSH_Dealer__c =: OSHFLG //lt 20230517 安徽两票制 add |
| | | ]; |
| | |
| | | } |
| | | //=======================================医院特价,有金额的话取金额 |
| | | Map<String, Decimal> dealerHospitalmMap = new Map<String, Decimal>(); |
| | | List<hospitalprice__c> hplist = [select Id,hospital__c,mPrice__c,pPrice__c,product__c,account__c |
| | | from hospitalprice__c |
| | | where product__c in :tpids and mPrice__c <> null and account__c=:accountid |
| | | List<hospitalprice__c> hplist = [ |
| | | SELECT Id, hospital__c, mPrice__c, pPrice__c, product__c, account__c |
| | | FROM hospitalprice__c |
| | | WHERE product__c IN :tpids AND mPrice__c != NULL AND account__c = :accountid |
| | | ]; |
| | | for (hospitalprice__c dealerProduct : hplist) { |
| | | if (dealerProduct.mPrice__c != null) { |
| | |
| | | WHERE |
| | | Name = :contractName |
| | | AND Id =: contractId //lt 20230517 安徽两票制 add |
| | | AND Contact_Type__c like :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contact_Type__c LIKE :agencyProType1 //lt 20230517 安徽两票制 add 1 |
| | | AND Contact_Type__c LIKE :agencyProType |
| | | AND Contract_Decide_Start_Date__c <= :Date.Today() |
| | | AND Contract_Decide_End_Date__c >= :Date.Today() |
| | |
| | | p.orderPattern__c = methodType; |
| | | } |
| | | insert p; |
| | | List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id]; |
| | | List<Consumable_order__c> Consumable_order = [ |
| | | SELECT Name, orderPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE id = :p.id |
| | | ]; |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | Roll = Roll + 1; |
| | | if (ass.check == true) { |
| | |
| | | //医院特价 |
| | | Consumable_order[0].Order_ForHospital__c = hospitalId; |
| | | Consumable_order[0].orderPattern__c = 'hospitalorder'; |
| | | if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { |
| | | if ( |
| | | dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && |
| | | dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null |
| | | ) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); |
| | | } |
| | |
| | | p.Offers_Price__c = bargainPrice; |
| | | } |
| | | update p; |
| | | List<Consumable_order__c> Consumable_order = [SELECT Name, orderPattern__c FROM Consumable_order__c WHERE id = :p.id]; |
| | | List<Consumable_order__c> Consumable_order = [ |
| | | SELECT Name, orderPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE id = :p.id |
| | | ]; |
| | | List<Consumable_Orderdetails__c> qs = new List<Consumable_Orderdetails__c>(); |
| | | qs = [ |
| | | SELECT Id |
| | |
| | | Consumable_order[0].orderPattern__c = 'hospitalorder'; |
| | | //医院特价 |
| | | Consumable_order[0].Order_ForHospital__c = hospitalId; |
| | | if (dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null) { |
| | | if ( |
| | | dealerHospitalmMap.containsKey(hospitalId + ass.Prod.Id) && |
| | | dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null |
| | | ) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get(''+ hospitalId + ass.Prod.Id); |
| | | } |
| | |
| | | |
| | | //删除附件 |
| | | @AuraEnabled |
| | | public static Results deleteAtt(String contentVersionId){ |
| | | public static Results deleteAtt(String contentVersionId, String cocId) { |
| | | Results results = new Results(); |
| | | try { |
| | | ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId]; |
| | | List<ContentVersion> cvInfo = [ |
| | | SELECT Id |
| | | FROM ContentVersion |
| | | WHERE FirstPublishLocationId = :cocId |
| | | ]; |
| | | 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; |
| | | if (cvInfo.size() <= 1) { |
| | | Consumable_order__c c = [ |
| | | SELECT Id |
| | | FROM Consumable_order__c |
| | | WHERE Id = :cocId |
| | | ]; |
| | | c.Consumable_pdf_insert_day__c = null; |
| | | update c; |
| | | } |
| | | results.result = 'Success'; |
| | | } catch (Exception e) { |
| | | results.result = 'Fail'; |
| | |
| | | } |
| | | } |
| | | |
| | | class ConsumableorderdetailsInfo implements Comparable { |
| | | public class ConsumableorderdetailsInfo implements Comparable { |
| | | @AuraEnabled |
| | | public Boolean check { get; set; } |
| | | @AuraEnabled |
| | |
| | | public Decimal prodIntraTradeList { get; set; } |
| | | @AuraEnabled |
| | | public Decimal consumableCount { get; set; } |
| | | |
| | | |
| | | // 已存产品明细 |
| | | public ConsumableorderdetailsInfo(Consumable_Orderdetails__c e) { |