| | |
| | | public static String[] proLimitAndDate = new List<String>{}; |
| | | /*****************画面表示Bean******************/ |
| | | private static List<ConsumableorderdetailsInfo> consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview { |
| | | get; |
| | | set; |
| | | } |
| | | public static List<ConsumableorderdetailsInfo> consumableorderdetailsRecordsview { get; set; } |
| | | public static Integer ConsumableorderdetailsCount { |
| | | get { |
| | | return consumableorderdetailsRecords == null |
| | | ? 0 |
| | | : consumableorderdetailsRecords.size(); |
| | | return consumableorderdetailsRecords == null ? 0 : consumableorderdetailsRecords.size(); |
| | | } |
| | | } |
| | | public static Integer ConsumableorderdetailsviewCount { |
| | | get { |
| | | return consumableorderdetailsRecordsview == null |
| | | ? 0 |
| | | : consumableorderdetailsRecordsview.size(); |
| | | return consumableorderdetailsRecordsview == null ? 0 : consumableorderdetailsRecordsview.size(); |
| | | } |
| | | } |
| | | public static List<String> lower = new List<String>(); |
| | |
| | | consumableorderdetailsRecordsview = reSet; |
| | | } |
| | | Integer pagestartNo = (con.getPageNumber() * size) - size; |
| | | Integer pageendNo = (con.getPageNumber() * size) > noOfRecords |
| | | ? noOfRecords |
| | | : (con.getPageNumber() * size - 1); |
| | | Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1); |
| | | Integer addNo = 0; |
| | | for ( |
| | | Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++ |
| | | ) { |
| | | for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) { |
| | | addNo++; |
| | |
| | | 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; |
| | |
| | | decisionCode = ''; |
| | | sumPrice = 0; |
| | | specialCampaign = false; |
| | | if ( |
| | | ESetId != null && |
| | | ESetId != '' && |
| | | statusEdit == '' && |
| | | statusEdit == null |
| | | ) { |
| | | if (ESetId != null && ESetId != '' && statusEdit == '' && statusEdit == null) { |
| | | editAble = false; |
| | | } else if ( |
| | | (ESetId == null || ESetId == '') && |
| | | (statusEdit == '' || |
| | | statusEdit == null) |
| | | ) { |
| | | } else if ((ESetId == null || ESetId == '') && (statusEdit == '' || statusEdit == null)) { |
| | | editAble = true; |
| | | } else if ( |
| | | ESetId != null && |
| | | ESetId != '' && |
| | | statusEdit != '' && |
| | | statusEdit != null |
| | | ) { |
| | | } else if (ESetId != null && ESetId != '' && statusEdit != '' && statusEdit != null) { |
| | | editAble = true; |
| | | } |
| | | 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; |
| | |
| | | agencyProType = 'ET'; |
| | | } |
| | | //错误信息提示 |
| | | if ( |
| | | String.isNotBlank(methodType) && |
| | | methodType.equals('hospitalorder') && |
| | | agencyProType == 'ET' |
| | | ) { |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder') && agencyProType == 'ET') { |
| | | // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '您没有订货医院特价产品的权限!')); |
| | | errorMsgList.add('您没有订货医院特价产品的权限!'); |
| | | } |
| | |
| | | DealerProductMap = new Map<Id, Dealer_Product__c>(); |
| | | DealerProductId = getDealerProductId(); |
| | | Account accountInfo = [ |
| | | SELECT |
| | | Name, |
| | | Dealer_discount__c, |
| | | Product_Limit_Date__c, |
| | | Product_Limit_DateENG__c |
| | | SELECT Name, Dealer_discount__c, Product_Limit_Date__c, Product_Limit_DateENG__c |
| | | FROM account |
| | | WHERE id = :accountid |
| | | ]; |
| | |
| | | product2Selected = Database.query(soql); |
| | | |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | consumableorderdetailsRecords.add( |
| | | new ConsumableorderdetailsInfo(product2Selected[i]) |
| | | ); |
| | | MidMap.put( |
| | | product2Selected[i].Id, |
| | | new ConsumableorderdetailsInfo(product2Selected[i]) |
| | | ); |
| | | consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | //只有在协议订货时会走这个for循环 其他两种订货模式都走的searchorderdetails方法 |
| | | if ( |
| | | String.isBlank(methodType) || |
| | | (!methodType.equals('promotionorder') && |
| | | !methodType.equals('hospitalorder')) |
| | | ) { |
| | | if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | if ( |
| | | countDel[i].promotionorder__c == false && |
| | | countDel[i].hospitalSpecialOffer__c == false |
| | | ) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | //经销商定价 计算 |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf( |
| | | bss.Prod.Product2__r.Packing_list_manual__c |
| | | ); |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id) |
| | | .Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id) |
| | | .Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id) |
| | | .OrderGoods_Limit__c; |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | consumableorderdetailsRecords.sort(); |
| | | if ( |
| | | methodType != null && |
| | | methodType != '' && |
| | | (methodType.equals('hospitalorder') || |
| | | methodType.equals('promotionorder')) |
| | | ) { |
| | | if (methodType != null && methodType != '' && (methodType.equals('hospitalorder') || methodType.equals('promotionorder'))) { |
| | | searchorderdetails( |
| | | methodType, |
| | | accountid, |
| | |
| | | } else { |
| | | if (methodType != null && methodType.equals('hospitalorder')) { |
| | | List<Consumable_order__c> oclist = [ |
| | | SELECT |
| | | orderPattern__c, |
| | | Order_ForHospital__c, |
| | | Order_ForHospital__r.Name |
| | | SELECT orderPattern__c, Order_ForHospital__c, Order_ForHospital__r.Name |
| | | FROM Consumable_order__c |
| | | WHERE id = :ESetid |
| | | ]; |
| | |
| | | contractName = coc.Order_effective_contact__r.Name; |
| | | contractId = coc.Order_effective_contact__r.Id; |
| | | } |
| | | if ( |
| | | qs[0].Order_status__c == '已提交' || |
| | | qs[0].Order_status__c == '批准' || |
| | | qs[0].Order_status__c == '附件上传完成' |
| | | ) { |
| | | if (qs[0].Order_status__c == '已提交' || qs[0].Order_status__c == '批准' || qs[0].Order_status__c == '附件上传完成') { |
| | | saveBtnDisabled = true; |
| | | sorderBtnDisabled = true; |
| | | editDelCommitBtnDisabled = false; |
| | |
| | | initStandardController(); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put( |
| | | product2Selected[i].Id, |
| | | new ConsumableorderdetailsInfo(product2Selected[i]) |
| | | ); |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | //add by rentx 2020-12-09 |
| | | if ( |
| | | String.isNotBlank(methodType) && methodType.equals('hospitalorder') |
| | | ) { |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if ( |
| | | String.isBlank(methodType) || methodType.equals('promotionorder') |
| | | ) { |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } else if ( |
| | | String.isBlank(methodType) || |
| | | (!methodType.equals('promotionorder') && |
| | | !methodType.equals('hospitalorder')) |
| | | String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder')) |
| | | ) { |
| | | if ( |
| | | countDel[i].promotionorder__c == false && |
| | | countDel[i].hospitalSpecialOffer__c == false |
| | | ) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | //再把map里的值从新赋给ConsumableorderdetailsRecords |
| | | for (ConsumableorderdetailsInfo bss : MidMap.values()) { |
| | | bss.packing_list = Integer.valueOf( |
| | | bss.Prod.Product2__r.Packing_list_manual__c |
| | | ); |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id) |
| | | .Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id) |
| | | .Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id) |
| | | .OrderGoods_Limit__c; |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | consumableorderdetailsRecords.add(bss); |
| | | } |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | ass.sortBy = sortOrderAsc; |
| | | for ( |
| | | Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected |
| | | ) { |
| | | for (Consumable_Orderdetails__c cdc1 : ConsumableorderdetailsSelected) { |
| | | sumPrice += cdc1.Sum_of_money__c; |
| | | if (ass.prod.Id == cdc1.Consumable_Product__c) { |
| | | ass.check = true; |
| | |
| | | // attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i])); |
| | | // } |
| | | // } |
| | | List<ContentDocumentLink> links = [ |
| | | SELECT Id, ContentDocumentId |
| | | FROM ContentDocumentLink |
| | | WHERE LinkedEntityId = :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 |
| | | SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId |
| | | FROM ContentVersion |
| | | WHERE ContentDocumentId IN :documentIds |
| | | ]; |
| | |
| | | List<String> upper = new List<String>(); |
| | | if (String.isNotBlank(ESetid)) { |
| | | for (ConsumableorderdetailsInfo bss : consumableorderdetailsRecords) { |
| | | if ( |
| | | bss.esd.Consumable_count__c != null && |
| | | bss.allnumber != null && |
| | | bss.upperlimit != null |
| | | ) { |
| | | if (bss.esd.Consumable_count__c != null && bss.allnumber != null && bss.upperlimit != null) { |
| | | if (bss.esd.Consumable_count__c + bss.allnumber > bss.upperlimit) { |
| | | upper.add(bss.esd.Consumable_Product__r.Name__c); |
| | | } |
| | |
| | | AggregateResult[] categoryList = [ |
| | | SELECT Count(id), Category3_text__c c3c |
| | | FROM Product2__c |
| | | WHERE |
| | | Estimation_Entry_Possibility__c = '○' |
| | | AND Product_Type__c LIKE :agencyProType |
| | | AND Category3_text__c != NULL |
| | | WHERE Estimation_Entry_Possibility__c = '○' AND Product_Type__c LIKE :agencyProType AND Category3_text__c != NULL |
| | | GROUP BY Category3_text__c |
| | | ]; |
| | | //categoty3 |
| | |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results categoryAllload( |
| | | String agencyProTypeStr, |
| | | String category3Str |
| | | ) { |
| | | public static Results categoryAllload(String agencyProTypeStr, String category3Str) { |
| | | Results results = new Results(); |
| | | agencyProType = agencyProTypeStr; |
| | | category3 = category3Str; |
| | |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static Results categoryload( |
| | | String agencyProTypeStr, |
| | | String category3Str, |
| | | String category4Str |
| | | ) { |
| | | public static Results categoryload(String agencyProTypeStr, String category3Str, String category4Str) { |
| | | Results results = new Results(); |
| | | agencyProType = agencyProTypeStr; |
| | | category3 = category3Str; |
| | |
| | | List<Product2__c> product2Selected = [ |
| | | SELECT Id, Name, Name__c, Intra_Trade_List_RMB__c, Asset_Model_No__c |
| | | FROM Product2__c |
| | | WHERE |
| | | Pro2_Dealer_Object__c = TRUE |
| | | AND Estimation_Entry_Possibility__c = '○' |
| | | WHERE Pro2_Dealer_Object__c = TRUE AND Estimation_Entry_Possibility__c = '○' |
| | | ]; |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | lowerRecord.add(new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | //先把ConsumableorderdetailsRecords 做成map |
| | | midMaprecord.put( |
| | | product2Selected[i].Id, |
| | | new ConsumableorderdetailsInfo(product2Selected[i]) |
| | | ); |
| | | midMaprecord.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | midMaprecord.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if ( |
| | | String.isBlank(methodType) || methodType.equals('promotionorder') |
| | | ) { |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | midMaprecord.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if ( |
| | | String.isBlank(methodType) || |
| | | (!methodType.equals('promotionorder') && |
| | | !methodType.equals('hospitalorder')) |
| | | ) { |
| | | if ( |
| | | countDel[i].promotionorder__c == false && |
| | | countDel[i].hospitalSpecialOffer__c == false |
| | | ) { |
| | | } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (midMaprecord.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = midMaprecord.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c) |
| | | .subString( |
| | | 0, |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') |
| | | ) |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c) |
| | | .subString( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1 |
| | | ) |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //全部库存上下限 |
| | | private static void allProductLimt( |
| | | List<ConsumableorderdetailsInfo> lowerRecord |
| | | ) { |
| | | private static void allProductLimt(List<ConsumableorderdetailsInfo> lowerRecord) { |
| | | String nowName = null, nowRightAsstModelNo = null; |
| | | Map<String, String> productLimt = new Map<String, String>(); |
| | | for (Integer i = 0; i < proLimitAndDate.size(); i++) { |
| | |
| | | for (ConsumableorderdetailsInfo ass : lowerRecord) { |
| | | if (productLimt.containsKey(ass.Prod.Asset_Model_No__c)) { |
| | | ass.lowerlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c) |
| | | .subString( |
| | | 0, |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') |
| | | ) |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(0, productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|')) |
| | | ); |
| | | ass.upperlimit = decimal.valueOf( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c) |
| | | .subString( |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1 |
| | | ) |
| | | productLimt.get(ass.Prod.Asset_Model_No__c).subString(productLimt.get(ass.Prod.Asset_Model_No__c).indexOf('|') + 1) |
| | | ); |
| | | } |
| | | } |
| | |
| | | methodType = methodTypeStr; |
| | | editAble = editAbleStr; |
| | | proLimitAndDate = proLimitAndDateList; |
| | | dealerProductId = (List<String>) JSON.deserialize( |
| | | dealerProductIdStr, |
| | | List<String>.class |
| | | ); |
| | | dealerProductId = (List<String>) JSON.deserialize(dealerProductIdStr, List<String>.class); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | consumableorderdetailsRecordsviewStr, |
| | | List<ConsumableorderdetailsInfo>.class |
| | |
| | | ]; |
| | | List<Product2__c> product2Selected = new List<Product2__c>(); |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | soql = makeSoql( |
| | | category1, |
| | | category_Goods, |
| | | category3, |
| | | category4, |
| | | category5, |
| | | specialCampaign, |
| | | DealerProductId |
| | | ); |
| | | soql = makeSoql(category1, category_Goods, category3, category4, category5, specialCampaign, DealerProductId); |
| | | size = Integer.valueOf(System.Label.orderdetLimitsize); |
| | | initStandardController(); |
| | | System.debug('soql:' + soql); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put( |
| | | product2Selected[i].Id, |
| | | new ConsumableorderdetailsInfo(product2Selected[i]) |
| | | ); |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | for (Integer i = 0; i < countDel.size(); i++) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if ( |
| | | String.isNotBlank(methodType) && methodType.equals('hospitalorder') |
| | | ) { |
| | | if (String.isNotBlank(methodType) && methodType.equals('hospitalorder')) { |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if ( |
| | | String.isBlank(methodType) || methodType.equals('promotionorder') |
| | | ) { |
| | | } else if (String.isBlank(methodType) || methodType.equals('promotionorder')) { |
| | | if (countDel[i].promotionorder__c == true) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | MidMap.put(countDel[i].Consumable_Product__c, Jstage); |
| | | } |
| | | } |
| | | } else if ( |
| | | String.isBlank(methodType) || |
| | | (!methodType.equals('promotionorder') && |
| | | !methodType.equals('hospitalorder')) |
| | | ) { |
| | | if ( |
| | | countDel[i].promotionorder__c == false && |
| | | countDel[i].hospitalSpecialOffer__c == false |
| | | ) { |
| | | } else if (String.isBlank(methodType) || (!methodType.equals('promotionorder') && !methodType.equals('hospitalorder'))) { |
| | | if (countDel[i].promotionorder__c == false && countDel[i].hospitalSpecialOffer__c == false) { |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | continue; |
| | | } else { |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id) |
| | | .Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id) |
| | | .Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id) |
| | | .OrderGoods_Limit__c; |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf( |
| | | bss.Prod.Product2__r.Packing_list_manual__c |
| | | ); |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsRecords.add(bss); |
| | |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Success'; |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | results.errorMsg = |
| | | '搜索到' + |
| | | consumableorderdetailsRecords.size() + |
| | | '件产品'; |
| | | results.errorMsg = '搜索到' + consumableorderdetailsRecords.size() + '件产品'; |
| | | } else { |
| | | getConsumableShowTableFieldValue(); |
| | | results.result = 'Fail'; |
| | |
| | | List<Dealer_Product__c> dpclist = [ |
| | | SELECT Id, Dealer_Product2__c |
| | | FROM Dealer_Product__c |
| | | WHERE |
| | | Dealer_Contact__c = :contractId |
| | | AND (Special_Discount__c != NULL |
| | | OR Special_Campaign_Price__c != NULL) |
| | | WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | if (dpclist != null && dpclist.size() > 0) { |
| | | String ids = '('; |
| | |
| | | consumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); |
| | | product2Selected = Database.query(soql); |
| | | for (Integer i = 0; i < product2Selected.size(); i++) { |
| | | MidMap.put( |
| | | product2Selected[i].Id, |
| | | new ConsumableorderdetailsInfo(product2Selected[i]) |
| | | ); |
| | | MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i])); |
| | | } |
| | | List<Consumable_order_details2__c> countDel = [ |
| | | SELECT |
| | |
| | | if (countDel[i].hospitalSpecialOffer__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | if (countDel[i].promotionorder__c == true) { |
| | | //然后循环CountDel去修改map里的allnumber |
| | | if (MidMap.containsKey(countDel[i].Consumable_Product__c)) { |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get( |
| | | countDel[i].Consumable_Product__c |
| | | ); |
| | | ConsumableorderdetailsInfo Jstage = MidMap.get(countDel[i].Consumable_Product__c); |
| | | if (countDel[i].Box_Piece__c == '盒') { |
| | | Jstage.allnumber = Jstage.allnumber + 1; |
| | | } else { |
| | |
| | | continue; |
| | | } else { |
| | | if (DealerProductMap.containsKey(bss.Prod.Id)) { |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id) |
| | | .Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id) |
| | | .Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id) |
| | | .OrderGoods_Limit__c; |
| | | bss.SpecialCampaignPrice = DealerProductMap.get(bss.Prod.Id).Special_Campaign_Price__c; |
| | | bss.Campaign_EndDate = DealerProductMap.get(bss.Prod.Id).Campaign_EndDate__c; |
| | | bss.orderGoods_Limit = DealerProductMap.get(bss.Prod.Id).OrderGoods_Limit__c; |
| | | } |
| | | bss.sortBy = sortOrderAsc; |
| | | bss.packing_list = Integer.valueOf( |
| | | bss.Prod.Product2__r.Packing_list_manual__c |
| | | ); |
| | | bss.packing_list = Integer.valueOf(bss.Prod.Product2__r.Packing_list_manual__c); |
| | | bss.approbation_No = bss.Prod.Product2__r.SFDA_Approbation_No__c; |
| | | bss.expiration_Date = bss.Prod.Product2__r.SFDA_Expiration_Date__c; |
| | | consumableorderdetailsRecords.add(bss); |
| | |
| | | results.consumableorderdetailsRecordsview = consumableorderdetailsRecordsview; |
| | | if (consumableorderdetailsRecordsview.size() > 0) { |
| | | results.result = 'Success'; |
| | | results.errorMsg = |
| | | '共搜索到' + |
| | | consumableorderdetailsRecordsview.size() + |
| | | '条数据'; |
| | | results.errorMsg = '共搜索到' + consumableorderdetailsRecordsview.size() + '条数据'; |
| | | } else { |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '没有搜索到相关数据'; |
| | |
| | | consumableorderdetailsRecordsview = reSet; |
| | | } |
| | | Integer pagestartNo = (con.getPageNumber() * size) - size; |
| | | Integer pageendNo = (con.getPageNumber() * size) > noOfRecords |
| | | ? noOfRecords |
| | | : (con.getPageNumber() * size - 1); |
| | | Integer pageendNo = (con.getPageNumber() * size) > noOfRecords ? noOfRecords : (con.getPageNumber() * size - 1); |
| | | Integer addNo = 0; |
| | | for ( |
| | | Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++ |
| | | ) { |
| | | for (Integer i = pagestartNo; i < consumableorderdetailsRecords.size(); i++) { |
| | | Consumable_Orderdetails__c orderdetails1 = new Consumable_Orderdetails__c(); |
| | | if (selectedIdMap.containsKey(consumableorderdetailsRecords[i].Prod.Id)) { |
| | | addNo++; |
| | |
| | | continue; |
| | | } else { |
| | | ProductId.add(dealerProduct.Dealer_Product2__c); |
| | | DealerProductIdMap.put( |
| | | dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Dealer_Product2__c |
| | | ); |
| | | DealerProductIdMap.put(dealerProduct.Dealer_Product2__c, dealerProduct.Dealer_Product2__c); |
| | | } |
| | | } |
| | | return ProductId; |
| | |
| | | List<Dealer_Product__c> dpclist = [ |
| | | SELECT Id, Dealer_Product2__c |
| | | FROM Dealer_Product__c |
| | | WHERE |
| | | Dealer_Contact__c = :contractId |
| | | AND (Special_Discount__c != NULL |
| | | OR Special_Campaign_Price__c != NULL) |
| | | WHERE Dealer_Contact__c = :contractId AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | |
| | | if (dpclist != null && dpclist.size() > 0) { |
| | |
| | | ESetId = eSetidStr; |
| | | try { |
| | | statusEdit = 'Redirect'; |
| | | 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; |
| | | 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; |
| | | } catch (Exception e) { |
| | |
| | | returnOrder = true; |
| | | try { |
| | | statusEdit = 'Redirect'; |
| | | 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; |
| | | 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; |
| | | } catch (Exception e) { |
| | |
| | | |
| | | //上传附件 |
| | | @AuraEnabled |
| | | public static Results filesUpload( |
| | | String pId, |
| | | String fileName, |
| | | String base64Data |
| | | ) { |
| | | public static Results filesUpload(String pId, String fileName, String base64Data) { |
| | | Results results = new Results(); |
| | | try { |
| | | base64Data = EncodingUtil.urlDecode(base64Data, 'UTF-8'); |
| | |
| | | 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'; |
| | |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE Consumable_order__c = :ESetId |
| | | ]) { |
| | | prodMap.put( |
| | | cod1.Consumable_product__r.Product2__c, |
| | | cod1.Consumable_product__r.Name__c |
| | | ); |
| | | prodMap.put(cod1.Consumable_product__r.Product2__c, cod1.Consumable_product__r.Name__c); |
| | | } |
| | | // GZW 提交产品无效 出错误消息 |
| | | System.debug(prodMap); |
| | | Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide( |
| | | prodMap, |
| | | accountid, |
| | | '' |
| | | ); |
| | | Map<String, String> chkMap = OpportunityWebService.MapCheckProRegisterDecide(prodMap, accountid, ''); |
| | | System.debug(chkMap); |
| | | if (chkMap.size() > 0) { |
| | | if (chkMap.containsKey('agency')) { |
| | |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.Error, '产品 ' + prodMap.get(proId) + ' 没有有效的注册证。') |
| | | // ); |
| | | errorMsgList.add( |
| | | '产品 ' + prodMap.get(proId) + ' 没有有效的注册证。' |
| | | ); |
| | | errorMsgList.add('产品 ' + prodMap.get(proId) + ' 没有有效的注册证。'); |
| | | } else if (chkMap.get(proId) == '2') { |
| | | // ApexPages.addmessage( |
| | | // new ApexPages.message(ApexPages.severity.Error, '产品 ' + prodMap.get(proId) + ' 超过经销商经营范围。') |
| | | // ); |
| | | errorMsgList.add( |
| | | '产品 ' + prodMap.get(proId) + ' 超过经销商经营范围。' |
| | | ); |
| | | errorMsgList.add('产品 ' + prodMap.get(proId) + ' 超过经销商经营范围。'); |
| | | } |
| | | } |
| | | } |
| | |
| | | contractId = contractIdStr; |
| | | agencyProType1 = agencyProType1Str; |
| | | OSHFLG = OSHFLGStr; |
| | | coc = (Consumable_order__c) JSON.deserialize( |
| | | cocStr, |
| | | Consumable_order__c.class |
| | | ); |
| | | contactDealer = (List<String>) JSON.deserialize( |
| | | contactDealerStr, |
| | | List<String>.class |
| | | ); |
| | | System.debug( |
| | | 'consumableorderdetailsRecordsviewStr:' + |
| | | consumableorderdetailsRecordsviewStr |
| | | ); |
| | | coc = (Consumable_order__c) JSON.deserialize(cocStr, Consumable_order__c.class); |
| | | contactDealer = (List<String>) JSON.deserialize(contactDealerStr, List<String>.class); |
| | | System.debug('consumableorderdetailsRecordsviewStr:' + consumableorderdetailsRecordsviewStr); |
| | | consumableorderdetailsRecordsview = (List<ConsumableorderdetailsInfo>) JSON.deserialize( |
| | | consumableorderdetailsRecordsviewStr, |
| | | List<ConsumableorderdetailsInfo>.class |
| | |
| | | return results; |
| | | } |
| | | List<Account> contract = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Contract_Department_Class__c, |
| | | Contract_Quote_Decide_Flag__c |
| | | SELECT Id, Name, Contract_Department_Class__c, Contract_Quote_Decide_Flag__c |
| | | FROM account |
| | | WHERE |
| | | Name = :contractName |
| | |
| | | //add by rentx 2020-11-25 |
| | | List<String> tpids = new List<String>(); |
| | | //add by rentx 2020-11-25 |
| | | for ( |
| | | ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview |
| | | ) { |
| | | for (ConsumableorderdetailsInfo CheckCount : consumableorderdetailsRecordsview) { |
| | | FLG = FLG + 1; |
| | | if (CheckCount.check == false) { |
| | | Count = Count + 1; |
| | |
| | | //add by rentx 2020-11-25 |
| | | tpids.add(CheckCount.Prod.Id); |
| | | //add by rentx 2020-11-25 |
| | | if ( |
| | | CheckCount.esd.Consumable_Count__c == null || |
| | | CheckCount.esd.Consumable_Count__c == 0 |
| | | ) { |
| | | if (CheckCount.esd.Consumable_Count__c == null || CheckCount.esd.Consumable_Count__c == 0) { |
| | | // CheckCount.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | |
| | | } |
| | | if ( |
| | | CheckCount.orderGoods_Limit > 0 && |
| | | math.mod( |
| | | Integer.valueOf(CheckCount.esd.Consumable_Count__c), |
| | | Integer.valueOf(CheckCount.orderGoods_Limit) |
| | | ) > 0 |
| | | math.mod(Integer.valueOf(CheckCount.esd.Consumable_Count__c), Integer.valueOf(CheckCount.orderGoods_Limit)) > 0 |
| | | ) { |
| | | // CheckCount.esd.Consumable_Count__c.addError('请输入促销数量的倍数'); |
| | | results.result = 'Fail'; |
| | |
| | | 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 |
| | | WHERE product__c IN :tpids AND mPrice__c != NULL AND account__c = :accountid |
| | | ]; |
| | | for (hospitalprice__c dealerProduct : hplist) { |
| | | if (dealerProduct.mPrice__c != null) { |
| | | dealerHospitalmMap.put( |
| | | '' + dealerProduct.hospital__c + dealerProduct.product__c, |
| | | dealerProduct.mPrice__c |
| | | ); |
| | | dealerHospitalmMap.put('' + dealerProduct.hospital__c + dealerProduct.product__c, dealerProduct.mPrice__c); |
| | | } |
| | | } |
| | | //促销订货 根据经销商产品中的数据计算金额 |
| | |
| | | Special_Discount__c, |
| | | OrderGoods_Limit__c |
| | | FROM Dealer_Product__c |
| | | WHERE |
| | | Dealer_Contact__c IN :contactDealer |
| | | AND (Special_Discount__c != NULL |
| | | OR Special_Campaign_Price__c != NULL) |
| | | WHERE Dealer_Contact__c IN :contactDealer AND (Special_Discount__c != NULL OR Special_Campaign_Price__c != NULL) |
| | | ]; |
| | | for (Dealer_Product__c dealerProduct : DealerProductList) { |
| | | //如果促销价格为null 则设置特殊折扣(百分比)到集合 |
| | | if (dealerProduct.Special_Campaign_Price__c == null) { |
| | | dealerPDiscountMap.put( |
| | | '' + |
| | | dealerProduct.Dealer_Contact__c + |
| | | dealerProduct.Dealer_Product2__c, |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Discount__c |
| | | ); |
| | | } else { |
| | | dealerMPDiscountMap.put( |
| | | '' + |
| | | dealerProduct.Dealer_Contact__c + |
| | | dealerProduct.Dealer_Product2__c, |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Campaign_Price__c |
| | | ); |
| | | } |
| | |
| | | for (Dealer_Product__c dealerProduct : haveDateList) { |
| | | if (dealerProduct.Special_Campaign_Price__c == null) { |
| | | dealerPDiscountMap.put( |
| | | '' + |
| | | dealerProduct.Dealer_Contact__c + |
| | | dealerProduct.Dealer_Product2__c, |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Discount__c |
| | | ); |
| | | dealerMPDiscountMap.remove( |
| | | '' + |
| | | dealerProduct.Dealer_Contact__c + |
| | | dealerProduct.Dealer_Product2__c |
| | | ); |
| | | dealerMPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c); |
| | | } else { |
| | | dealerMPDiscountMap.put( |
| | | '' + |
| | | dealerProduct.Dealer_Contact__c + |
| | | dealerProduct.Dealer_Product2__c, |
| | | '' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c, |
| | | dealerProduct.Special_Campaign_Price__c |
| | | ); |
| | | dealerPDiscountMap.remove( |
| | | '' + |
| | | dealerProduct.Dealer_Contact__c + |
| | | dealerProduct.Dealer_Product2__c |
| | | ); |
| | | dealerPDiscountMap.remove('' + dealerProduct.Dealer_Contact__c + dealerProduct.Dealer_Product2__c); |
| | | } |
| | | } |
| | | } |
| | | //=======================================经销商合同折扣 |
| | | List<Account> at = [ |
| | | SELECT |
| | | id, |
| | | Name, |
| | | State_Master__c, |
| | | State_Master__r.Name, |
| | | Sales_Section__c, |
| | | Dealer_discount__c |
| | | SELECT id, Name, State_Master__c, State_Master__r.Name, Sales_Section__c, Dealer_discount__c |
| | | FROM Account |
| | | WHERE |
| | | Name = :contractName |
| | |
| | | p.orderPattern__c = methodType; |
| | | } |
| | | insert p; |
| | | List<Consumable_order__c> Consumable_order = [ |
| | | SELECT Name, orderPattern__c |
| | | FROM Consumable_order__c |
| | | WHERE id = :p.id |
| | | ]; |
| | | for ( |
| | | ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview |
| | | ) { |
| | | 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) { |
| | | if ( |
| | | ass.esd.Consumable_Count__c == null || |
| | | ass.esd.Consumable_Count__c == 0 |
| | | ) { |
| | | if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) { |
| | | // ass.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | |
| | | if (methodType.equals('agreementorder')) { |
| | | Consumable_order[0].orderPattern__c = 'agreementorder'; |
| | | |
| | | InsAfterDel.Intra_Trade_List_RMB__c = |
| | | ass.Prod.Intra_Trade_List_RMB__c * |
| | | disCount / |
| | | 100; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100; |
| | | //=====================================================================================update by rentx 2020-11-25 |
| | | } else if (methodType.equals('promotionorder')) { |
| | | Consumable_order[0].orderPattern__c = 'promotionorder'; |
| | | //促销订货 |
| | | //如果促销价格不为null 则直接使用促销价格来计算金额 |
| | | if ( |
| | | dealerMPDiscountMap.containsKey( |
| | | '' + contract[0].Id + ass.Prod.Id |
| | | ) |
| | | ) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get( |
| | | '' + contract[0].Id + ass.Prod.Id |
| | | ); |
| | | if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id); |
| | | system.debug('cai 0' + InsAfterDel.Intra_Trade_List_RMB__c); |
| | | } else if ( |
| | | dealerPDiscountMap.containsKey( |
| | | '' + contract[0].Id + ass.Prod.Id |
| | | ) |
| | | ) { |
| | | } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = |
| | | ass.Prod.Intra_Trade_List_RMB__c * |
| | | dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) / |
| | |
| | | dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null |
| | | ) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get( |
| | | '' + hospitalId + ass.Prod.Id |
| | | ); |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get('' + hospitalId + ass.Prod.Id); |
| | | } |
| | | } else if (DealerProductMap.containsKey(ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get( |
| | | ass.Prod.Id |
| | | ) |
| | | .Special_Campaign_Price__c; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | system.debug('cai 2' + InsAfterDel.Intra_Trade_List_RMB__c); |
| | | InsAfterDel.Purchase_Unitprtprice_From__c = '促销'; |
| | | InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get( |
| | | ass.Prod.Id |
| | | ) |
| | | .Special_Campaign_Price__c; |
| | | InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | } |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | | i++; |
| | |
| | | //修改,获取消耗品订单 |
| | | List<Consumable_order__c> cocinfo = new List<Consumable_order__c>(); |
| | | cocinfo = [ |
| | | SELECT |
| | | Id, |
| | | Name, |
| | | Order_status__c, |
| | | Dealer_Info__c, |
| | | Deliver_date__c, |
| | | Order_Reason__c, |
| | | Offers_Price__c |
| | | SELECT Id, Name, Order_status__c, Dealer_Info__c, Deliver_date__c, Order_Reason__c, Offers_Price__c |
| | | FROM Consumable_order__c |
| | | WHERE Id = :ESetId |
| | | ]; |
| | |
| | | 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 |
| | | FROM Consumable_Orderdetails__c |
| | | WHERE |
| | | Consumable_order__c = :ESetId |
| | | AND Consumable_order__r.Dealer_Info__c = :accountid |
| | | WHERE Consumable_order__c = :ESetId AND Consumable_order__r.Dealer_Info__c = :accountid |
| | | ]; |
| | | if (qs.size() > 0) { |
| | | delete qs; |
| | | } |
| | | Integer i = 1; |
| | | for ( |
| | | ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview |
| | | ) { |
| | | for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsview) { |
| | | if (ass.check == true) { |
| | | Consumable_Orderdetails__c InsAfterDel = new Consumable_Orderdetails__c(); |
| | | if ( |
| | | ass.esd.Consumable_Count__c == null || |
| | | ass.esd.Consumable_Count__c == 0 |
| | | ) { |
| | | if (ass.esd.Consumable_Count__c == null || ass.esd.Consumable_Count__c == 0) { |
| | | // ass.esd.Consumable_Count__c.addError('请输入采购数量'); |
| | | results.result = 'Fail'; |
| | | results.errorMsg = '请输入采购数量'; |
| | |
| | | //协议订货 |
| | | if (methodType.equals('agreementorder')) { |
| | | Consumable_order[0].orderPattern__c = 'agreementorder'; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = |
| | | ass.Prod.Intra_Trade_List_RMB__c * |
| | | disCount / |
| | | 100; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c * disCount / 100; |
| | | } else if (methodType.equals('promotionorder')) { |
| | | Consumable_order[0].orderPattern__c = 'promotionorder'; |
| | | //促销订货 |
| | | if ( |
| | | dealerMPDiscountMap.containsKey( |
| | | '' + contract[0].Id + ass.Prod.Id |
| | | ) |
| | | ) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get( |
| | | '' + contract[0].Id + ass.Prod.Id |
| | | ); |
| | | } else if ( |
| | | dealerPDiscountMap.containsKey( |
| | | '' + contract[0].Id + ass.Prod.Id |
| | | ) |
| | | ) { |
| | | if (dealerMPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerMPDiscountMap.get('' + contract[0].Id + ass.Prod.Id); |
| | | } else if (dealerPDiscountMap.containsKey('' + contract[0].Id + ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = |
| | | ass.Prod.Intra_Trade_List_RMB__c * |
| | | dealerPDiscountMap.get('' + contract[0].Id + ass.Prod.Id) / |
| | |
| | | dealerHospitalmMap.get(hospitalId + ass.Prod.Id) != null |
| | | ) { |
| | | //直接根据促销金额计算 |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get( |
| | | '' + hospitalId + ass.Prod.Id |
| | | ); |
| | | InsAfterDel.Intra_Trade_List_RMB__c = dealerHospitalmMap.get('' + hospitalId + ass.Prod.Id); |
| | | } |
| | | } else if (DealerProductMap.containsKey(ass.Prod.Id)) { |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get( |
| | | ass.Prod.Id |
| | | ) |
| | | .Special_Campaign_Price__c; |
| | | InsAfterDel.Intra_Trade_List_RMB__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | InsAfterDel.Purchase_Unitprtprice_From__c = '促销'; |
| | | InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get( |
| | | ass.Prod.Id |
| | | ) |
| | | .Special_Campaign_Price__c; |
| | | InsAfterDel.Special_Campaign_Price__c = DealerProductMap.get(ass.Prod.Id).Special_Campaign_Price__c; |
| | | } |
| | | // ==================================================之前的促销订货的逻辑 |
| | | InsAfterDel.RecordTypeId = System.Label.RT_ConOrderDetail1_Order; |
| | |
| | | public static Results deleteAtt(String contentVersionId, String cocId) { |
| | | Results results = new Results(); |
| | | try { |
| | | List<ContentVersion> cvInfo = [ |
| | | SELECT Id |
| | | FROM ContentVersion |
| | | WHERE FirstPublishLocationId = :cocId |
| | | ]; |
| | | 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 |
| | | ]; |
| | | Consumable_order__c c = [SELECT Id FROM Consumable_order__c WHERE Id = :cocId]; |
| | | c.Consumable_pdf_insert_day__c = null; |
| | | update c; |
| | | } |