| | |
| | | //public Id qlistId { get; set; } |
| | | //lastbuy 2022/2/9 fy start |
| | | public Boolean filg { get; set; } |
| | | public Integer flglastbuy { get; set; } |
| | | public String errorProductmodel { get; set; } |
| | | //lastbuy 2022/2/9 fy end |
| | | |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy start |
| | | public Boolean SkipQuotefilg { get; set; } |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy end |
| | | public String excel_text { get; set; } |
| | | public Integer select_index { get; set; } // excelImport専用ですが、jsにて制御することになるので、TODO katsu 削除予定 |
| | | public String Product_text { get; set; } |
| | |
| | | } |
| | | |
| | | public PageReference init() { |
| | | |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy start |
| | | SkipQuotefilg = false; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy end |
| | | system.debug('============start init=============='); |
| | | boolean quoteflg = true; |
| | | WinOrDecideAlert = false; |
| | |
| | | ,PricebookEntry.Product2.Intra_Trade_Foreign_RMB__c |
| | | //NoDiscount 金额(USD) |
| | | ,PricebookEntry.Product2.NoDiscount_Foreign__c |
| | | //fy 预留产品标识 |
| | | ,PricebookEntry.Product2.LastbuyProductFLG__c |
| | | ,Quote.Opportunity.Trade__c |
| | | //外贸多年保 2021/01/04 精琢技术 wql end |
| | | |
| | |
| | | if (copyQuoId == null) { |
| | | } else { |
| | | // copyの場合、quoIdをnullに戻す |
| | | system.debug('id空6:'); |
| | | quoId = null; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy start |
| | | SkipQuotefilg = true; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy end |
| | | } |
| | | if (quoList.size() > 0) { |
| | | //添加行 |
| | |
| | | //外贸多年保 2021/01/04 精琢技术 wql start |
| | | //维修合同报价(USD) |
| | | ,Repair_Contract_USD__c |
| | | //fy 预留产品标识 |
| | | ,LastbuyProductFLG__c |
| | | //计提金额(不含税,USD) |
| | | ,Intra_Trade_Foreign_RMB__c |
| | | //NoDiscount 金额(USD) |
| | |
| | | errormessage = null; |
| | | //20220214 fy lastbuy start |
| | | if(!ReservedProductVerification()){ |
| | | errorflg = true; |
| | | errormessage = '产品数量不可超过产品预留数量' ; |
| | | return null; |
| | | system.debug('flglastbuy++++'+flglastbuy); |
| | | if(flglastbuy==1){ |
| | | errorflg = true; |
| | | errormessage = '预留产品表中没有该询价,请通过本部窗口联系营业管理课' ; |
| | | return null; |
| | | }else if(flglastbuy==2){ |
| | | errorflg = true; |
| | | errormessage = errorProductmodel+'产品数量不可超过产品预留数量' ; |
| | | return null; |
| | | }else if(flglastbuy==3){ |
| | | errorflg = true; |
| | | errormessage = '预留产品'+errorProductmodel+'未录入预留产品表'; |
| | | return null; |
| | | } |
| | | } |
| | | //20220214 fy lastbuy end |
| | | // 2022-01-12 ssm 报价计算check |
| | |
| | | if (dataCheck() == false) { |
| | | return null; |
| | | } |
| | | |
| | | // 2022-04-06 SWAG-CC6AFQ【委托】又有询价跳过了报价计算 ssm start |
| | | // 判断条件修改 |
| | | // 1.如果保存方法返回false,return |
| | | // 2.如果保存通过但创建了新报价,return |
| | | // 3.继续做decide |
| | | if (dataEntry() == false) { |
| | | return null; |
| | | } else { |
| | | //引合に見積決定をオン |
| | | if (oppId == null) { |
| | | system.debug('Error is Opportunityid null!!!'); |
| | | } else { |
| | | List<Opportunity> opps = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId]; |
| | | if (opps.size() > 0) { |
| | | opps[0].Estimation_Decision__c = true; |
| | | /*↓↓↓見積同期↓↓↓2012/11/28 未使用 |
| | | opps[0].SyncedQuoteId = quoId; |
| | | ↑↑↑ ↑↑↑*/ |
| | | ControllerUtil.updOpp(opps[0]); |
| | | } |
| | | |
| | | errorflg = true; |
| | | errorMessage = System.Label.Message_002; |
| | | |
| | | // cic 134906 start |
| | | Quote q = [select Id from Quote where Id = :quoId]; |
| | | q.Quote_Decision_Date__c = date.Today(); |
| | | update q; |
| | | // cic 134906 end |
| | | |
| | | QuoteDecision = true; |
| | | enableContract = true; |
| | | //--Savebutton |
| | | Save_button = true; |
| | | //--Decisionbutton判定 |
| | | if (verified == true) { |
| | | Decision_button = false; |
| | | } else if (QuoteCorrect == false) { |
| | | Decision_button = true; |
| | | } else if (QuoteDecision == true) { |
| | | Decision_button = true; |
| | | } else { |
| | | Decision_button = false; |
| | | } |
| | | //--SAPButton |
| | | if (QuoteDecision == false) { |
| | | sap_button = true; |
| | | } else if (specialAuthority == false) { |
| | | sap_button = true; |
| | | } else { |
| | | sap_button = false; |
| | | } |
| | | //--決定ボタン使えないようにする |
| | | Decision_button = true; |
| | | |
| | | pageArrange(); |
| | | } |
| | | } |
| | | if(SkipQuotefilg){ |
| | | errorflg = true; |
| | | errormessage = '画面配置变更,已生成新的报价单,请重新做报价计算'; |
| | | quo.IsQuoteTrial__c = false; |
| | | return null; |
| | | } |
| | | //引合に見積決定をオン |
| | | if (oppId == null) { |
| | | system.debug('Error is Opportunityid null!!!'); |
| | | } else { |
| | | List<Opportunity> opps = [Select Id, Estimation_Decision__c From Opportunity Where Id = : oppId]; |
| | | if (opps.size() > 0) { |
| | | opps[0].Estimation_Decision__c = true; |
| | | /*↓↓↓見積同期↓↓↓2012/11/28 未使用 |
| | | opps[0].SyncedQuoteId = quoId; |
| | | ↑↑↑ ↑↑↑*/ |
| | | ControllerUtil.updOpp(opps[0]); |
| | | } |
| | | |
| | | errorflg = true; |
| | | errorMessage = System.Label.Message_002; |
| | | |
| | | // cic 134906 start |
| | | Quote q = [select Id from Quote where Id = :quoId]; |
| | | q.Quote_Decision_Date__c = date.Today(); |
| | | update q; |
| | | // cic 134906 end |
| | | |
| | | QuoteDecision = true; |
| | | enableContract = true; |
| | | //--Savebutton |
| | | Save_button = true; |
| | | //--Decisionbutton判定 |
| | | if (verified == true) { |
| | | Decision_button = false; |
| | | } else if (QuoteCorrect == false) { |
| | | Decision_button = true; |
| | | } else if (QuoteDecision == true) { |
| | | Decision_button = true; |
| | | } else { |
| | | Decision_button = false; |
| | | } |
| | | //--SAPButton |
| | | if (QuoteDecision == false) { |
| | | sap_button = true; |
| | | } else if (specialAuthority == false) { |
| | | sap_button = true; |
| | | } else { |
| | | sap_button = false; |
| | | } |
| | | //--決定ボタン使えないようにする |
| | | Decision_button = true; |
| | | |
| | | pageArrange(); |
| | | } |
| | | // 2022-04-06 SWAG-CC6AFQ【委托】又有询价跳过了报价计算 ssm end |
| | | } catch (DmlException de) { |
| | | Database.rollback(sp); |
| | | errorflg = true; |
| | |
| | | // ここを修正したら、NFM007.triggerも要確認 |
| | | prd2LatestValMap = new Map<Id, Product2>(); |
| | | integer cntPrd2 = 0; |
| | | for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c |
| | | for (Product2 prd2 : [Select Id, Estimation_Entry_Possibility__c, SFDA_Status__c, Packing_list_manual__c, |
| | | //fy 预留产品标识 |
| | | LastbuyProductFLG__c |
| | | From Product2 Where Id IN :product2Ids]) { |
| | | cntPrd2 = cntPrd2 + 1; |
| | | if (prd2.Estimation_Entry_Possibility__c != '○') { |
| | |
| | | oppNo = oppNo.substring(oppNo.length() - 2); |
| | | |
| | | Quote q = New Quote(); |
| | | System.debug('quoId: ' + quoId); |
| | | System.debug('changedAfterPrint: ' + changedAfterPrint); |
| | | if (changedAfterPrint) { |
| | | system.debug('id空1:'); |
| | | quoId = null; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy start |
| | | SkipQuotefilg = true; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy end |
| | | } |
| | | // false伝票から新規作成 |
| | | System.debug('changedAfterBid: ' + changedAfterBid); |
| | | if (changedAfterBid) { |
| | | system.debug('id空2:'); |
| | | quoId = null; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy start |
| | | SkipQuotefilg = true; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy end |
| | | } |
| | | // CHAN-AVG3PW 询价报价画面规则变更 |
| | | System.debug('newQuoteFlag: ' + newQuoteFlag); |
| | | if (newQuoteFlag) { |
| | | system.debug('id空3:'); |
| | | quoId = null; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy start |
| | | SkipQuotefilg = true; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy end |
| | | } |
| | | // 多年保修 start |
| | | //报价试算 增加经销商前后对比 精琢技术 wql 20210508 start |
| | | System.debug('quoteGurantee_Period: ' + quoteGurantee_Period); |
| | | System.debug('quo.Gurantee_Period__c: ' + quo.Gurantee_Period__c); |
| | | System.debug('quotemultiYearWarranty: ' + quotemultiYearWarranty); |
| | | System.debug('quo.multiYearWarranty__c: ' + quo.multiYearWarranty__c); |
| | | System.debug('agency1Name: ' + agency1Name); |
| | | System.debug('quo.Agency1__c: ' + quo.Agency1__c); |
| | | System.debug('agency2Name: ' + agency2Name); |
| | | System.debug('quo.Agency2__c: ' + quo.Agency2__c); |
| | | if ((quoteGurantee_Period != null && |
| | | !quoteGurantee_Period.equals(quo.Gurantee_Period__c)) |
| | | || |
| | |
| | | || |
| | | (agency2Name !=null &&!agency2Name.equals(quo.Agency2__c)) |
| | | ) { |
| | | system.debug('id空8:'); |
| | | quoId = null; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy start |
| | | SkipQuotefilg = true; |
| | | //SWAG-CC6AFQ【委托】又有询价跳过了报价计算 fy end |
| | | } |
| | | agency1Name = quo.Agency1__c; |
| | | agency2Name = quo.Agency2__c; |
| | |
| | | } |
| | | //lastbuy 2022/2/9 fy start |
| | | public boolean ReservedProductVerification() { |
| | | |
| | | filg=true; |
| | | Map<string,QuoteLineItem> quotlinitMap = new Map<string,QuoteLineItem>(); |
| | | List<Id> lastProductFLGList = new List<Id>(); |
| | | for(QELine qli : activities){ |
| | | lastProductFLGList.add(qli.pageObject.PricebookEntry.Product2Id); |
| | | quotlinitMap.put(qli.pageObject.PricebookEntry.Product2Id,qli.pageObject); |
| | | List<Id> lastProductFLGListId = new List<Id>(); |
| | | List<QuoteLineItem> lastProductFLGList = new List<QuoteLineItem>(); |
| | | List<QuoteLineItem> act = new List<QuoteLineItem>(); |
| | | List<QuoteLineItem> act2 = new List<QuoteLineItem>(); |
| | | for(QELine aaa :activities){ |
| | | if(aaa.pageObject.PricebookEntry.Product2Id!=null){ |
| | | act.add(aaa.pageObject); |
| | | } |
| | | } |
| | | System.debug('activities!!!'+activities); |
| | | act2=act.deepClone(); |
| | | Map<String,QuoteLineItem> map1 = new Map<String,QuoteLineItem>(); |
| | | System.debug('activities1111111111112为所当为多多!!!'+activities); |
| | | integer i =0; |
| | | for(QuoteLineItem pspsc :act2){ |
| | | if(pspsc.PricebookEntry.Product2Id!=null){ |
| | | if(map1.containsKey(pspsc.PricebookEntry.Product2Id)){ |
| | | QuoteLineItem quoteLine = map1.get(pspsc.PricebookEntry.Product2Id); |
| | | quoteLine.Quantity__c =quoteLine.Quantity__c+pspsc.Quantity__c; |
| | | map1.put(pspsc.PricebookEntry.Product2Id,quoteLine); |
| | | }else{ |
| | | map1.put(pspsc.PricebookEntry.Product2Id,pspsc); |
| | | } |
| | | System.debug('34499879!!!'+activities); |
| | | } |
| | | } |
| | | System.debug('3434343!!!'+activities); |
| | | System.debug('5656565!!!'+map1); |
| | | for (QuoteLineItem value : map1.values()) { |
| | | if(value.PricebookEntry.Product2.LastbuyProductFLG__c){ |
| | | lastProductFLGListId.add(value.PricebookEntry.Product2Id); |
| | | quotlinitMap.put(value.PricebookEntry.Product2Id,value); |
| | | lastProductFLGList.add(value); |
| | | } |
| | | } |
| | | System.debug('activities++++!!!'+activities); |
| | | System.debug('activities!!!'+map1.values()); |
| | | System.debug('oppId!!!'+oppId); |
| | | System.debug('lastProductFLGList!!!'+lastProductFLGList); |
| | | if(lastProductFLGList!=null){ |
| | | List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGList and effectiveFLG__c = true]; |
| | | if(LastbuyObjList!=null){ |
| | | for(LastbuyProduct__c lastbuypr :LastbuyObjList){ |
| | | Decimal quoteLItemNum=0; |
| | | if(quotlinitMap.containsKey(lastbuypr.ProductName__c)){ |
| | | quoteLItemNum=quotlinitMap.get(lastbuypr.ProductName__c).Quantity__c; |
| | | }else{ |
| | | continue; |
| | | } |
| | | if(lastbuypr.LastbuyQuantity__c<quoteLItemNum){ |
| | | filg=false; |
| | | break; |
| | | } |
| | | System.debug('lastProductFLGList!!!'+lastProductFLGListId); |
| | | if(lastProductFLGListId!=null&&lastProductFLGListId.size()!=0){ |
| | | List<LastbuyProduct__c> LastbuyObjList=[select id,LastbuyQuantity__c,InquiryCode__c,ProductName__c,effectiveFLG__c from LastbuyProduct__c where InquiryCode__c= : oppId and ProductName__c in :lastProductFLGListId and effectiveFLG__c = true]; |
| | | Map<string,LastbuyProduct__c> LastbuyObjMap = new Map<string,LastbuyProduct__c>(); |
| | | System.debug('LastbuyObjList+++++!!!'+LastbuyObjList); |
| | | if(LastbuyObjList!=null&&LastbuyObjList.size()!=0){ |
| | | for(LastbuyProduct__c lastbuypr :LastbuyObjList){ |
| | | LastbuyObjMap.put(lastbuypr.ProductName__c,lastbuypr); |
| | | } |
| | | }else{ |
| | | flglastbuy=1; |
| | | filg=false; |
| | | return filg; |
| | | } |
| | | System.debug('LastbuyObjMap!!!'+LastbuyObjMap); |
| | | System.debug('lastProductFLGList+++++++!!!'+lastProductFLGList); |
| | | if(lastProductFLGList!=null&&lastProductFLGList.size()!=0){ |
| | | for(QuoteLineItem lastbuypr :lastProductFLGList){ |
| | | Decimal quoteLItemNum=0; |
| | | if(LastbuyObjMap.containsKey(lastbuypr.PricebookEntry.Product2Id)){ |
| | | quoteLItemNum=LastbuyObjMap.get(lastbuypr.PricebookEntry.Product2Id).LastbuyQuantity__c; |
| | | System.debug('quoteLItemNum!!!'+quoteLItemNum); |
| | | System.debug('lastbuypr.pageObject.Quantity__c+++!!!'+lastbuypr.Quantity__c); |
| | | if(lastbuypr.Quantity__c>quoteLItemNum){ |
| | | errorProductmodel=lastbuypr.Asset_Model_No__c; |
| | | flglastbuy=2; |
| | | filg=false; |
| | | break; |
| | | } |
| | | }else{ |
| | | errorProductmodel=lastbuypr.Asset_Model_No__c; |
| | | flglastbuy=3; |
| | | filg=false; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | system.debug('filg====='+filg); |