From 43fdbff49764d55c7b3a19a1d6e7d8aeb62072ef Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 21 四月 2023 11:17:35 +0800 Subject: [PATCH] backup0421 --- force-app/main/default/classes/DNUpsertBatch.cls | 27 ++++++ force-app/main/default/classes/SyncProvinceWIndowToSignForm.cls | 51 ++++++++++++ force-app/main/default/lwc/lexConsumable/lexConsumable.html | 5 .sf/config.json | 2 force-app/main/default/lwc/paginatedList/paginatedList.js-meta.xml | 6 + force-app/main/default/classes/OCSMHandler.cls | 14 +++ force-app/main/default/classes/SyncProvinceWIndowToSignForm.cls-meta.xml | 5 + manifest/packageForSign.xml | 5 force-app/main/default/lwc/lexConsumable/lexConsumable.js | 67 ++++++++++++++-- 9 files changed, 164 insertions(+), 18 deletions(-) diff --git a/.sf/config.json b/.sf/config.json index baca826..202978e 100644 --- a/.sf/config.json +++ b/.sf/config.json @@ -1,3 +1,3 @@ { - "target-org": "LEXOlympusDev" + "target-org": "MEBGStage" } \ No newline at end of file diff --git a/force-app/main/default/classes/DNUpsertBatch.cls b/force-app/main/default/classes/DNUpsertBatch.cls index e6efbb2..b23a318 100644 --- a/force-app/main/default/classes/DNUpsertBatch.cls +++ b/force-app/main/default/classes/DNUpsertBatch.cls @@ -574,12 +574,30 @@ Statu_Achievements__r.orderType__c //鏃犲伩鍑哄簱鏍囪瘑 thh 2021-11-01 end //acc鏍囪瘑 end + //Add by Li Jun 20230420 start + ,Opportunity__r.OCM_man_province_cus__c + //Add By Li Jun 20230420 end from Statu_Achievements_DN__c where Name in: DNNoSet]; return DNList; } global void finish(Database.BatchableContext BC) { } + + //Add By Li Jun 0420 Start query management province + private static Map<String,OCM_Management_Province__c> provinceManagementMap{set;get;} + public static Map<String,OCM_Management_Province__c> getManagementProvince(){ + if(provinceManagementMap !=null && provinceManagementMap.keySet().size()>0 ){ + return provinceManagementMap; + } + provinceManagementMap = new Map<String,OCM_Management_Province__c>(); + List <OCM_Management_Province__c > ompList = [select id, Name, SalesManage__c,GI_assistant__c,Window1__c from OCM_Management_Province__c]; + for (OCM_Management_Province__c omp: ompList) { + provinceManagementMap.put(omp.Name,omp); + } + return provinceManagementMap; + } + //Add By Li Jun 0420 End /* 鏋勫缓绛炬敹鍗曪細 * eSFMap 鏄郴缁熼噷闈㈢幇鏈夌殑绛炬敹鍗� * key 涓� DN鍙凤紱 @@ -604,8 +622,13 @@ tempeSF.DNName__c = tempDN.Name; tempeSF.Statu_Achievements__c = tempDN.Statu_Achievements__c; tempeSF.Statu_Achievements_DN__c = tempDN.ID; - tempeSF.Sales_assistant_name_text__c = tempDN.Sales_assistant_name_text__c;//Updated By Li Jun 20230420 + //Updated By Li Jun 20230420 start + //tempeSF.Sales_assistant_name_text__c = tempDN.Sales_assistant_name_text__c; + tempeSF.Sales_assistant_name_text__c = tempDN.Opportunity__c != null && tempDN.Opportunity__r.OCM_man_province_cus__c != '' && getManagementProvince().containsKey(tempDN.Opportunity__r.OCM_man_province_cus__c)? + getManagementProvince().get(tempDN.Opportunity__r.OCM_man_province_cus__c).Window1__c: null; + tempeSF.RC_Manager__c = tempDN.RC_Manager__c; + //Updated By Li Jun 20230420 end //鐢熸垚绛炬敹鍗曟椂锛岀粰鏄惁鏃犲伩鍑哄簱璧嬪�� 绮剧悽鎶�鏈� thh 2021-10-15 start if(tempDN.Statu_Achievements__r.orderType__c == 'ZM16'){ tempeSF.isFreeDelivery__c = true; @@ -732,7 +755,7 @@ // 鐢靛瓙绛炬敹鍗� 璧嬪�艰惀涓氬姪鐞嗗拰钀ヤ笟绠$悊閮ㄦ媴褰� start //闆嗕腑閲囪喘鐨勮浠� 绮剧悽鎶�鏈� wql 2020/01/11 start //Add By Li Jun 20230420 Start - tempSADN.Sales_assistant_name_text__c =opp.OCM_man_province_cus__c!='' && provinceGIMap.containskey(opp.OCM_man_province_cus__c)?provinceGIMap.get(opp.OCM_man_province_cus__c):''; + tempSADN.Sales_assistant_name_text__c =opp.OCM_man_province_cus__c!='' && provinceGIMap.containskey(opp.OCM_man_province_cus__c)?provinceGIMap.get(opp.OCM_man_province_cus__c):null; //Add By Li Jun 20230420 End if(opp.Group_purchase_PCL__c){ //tempSADN.Sales_assistant_name_text__c = provinceGIMap.get('闆嗛噰璇�'); //Commented By Li Jun 20230420 diff --git a/force-app/main/default/classes/OCSMHandler.cls b/force-app/main/default/classes/OCSMHandler.cls index 221da45..a8aa3db 100644 --- a/force-app/main/default/classes/OCSMHandler.cls +++ b/force-app/main/default/classes/OCSMHandler.cls @@ -5,6 +5,9 @@ OCM_Management_Province__c old = null; List<String> noList = new List<String>(); + //Add By Li Jun 20230420 Start OCSM鐪佺殑銆愯惀涓氱獥鍙c�戜汉鍛樺彂鐢熷彉鍔ㄦ椂锛岄渶瑕佹洿鏂扮幇鏈夌殑鏈畬鎴愮殑绛炬敹鍗曠殑銆愯惀涓氬姪鐞嗐�戝�� + Set<String> changedWindowProvince = new set<String>(); + //Add By Li Jun 20230420 End for (OCM_Management_Province__c local : newList) { if (Trigger.isInsert) { @@ -45,12 +48,23 @@ noList.add(old.OnlinePlatformWindow3__c); } } + //Add By Li Jun 20230420 Start + if (local.Window1__c != null && local.Window1__c != old.Window1__c) { + changedWindowProvince.add(local.Name); + } + //Add By Li Jun 20230420 End + } } if (noList.size() > 0) { NFM621Controller.callout('', noList); } + //Add By Li Jun 20230420 Start + if(changedWindowProvince.size() > 0){ + SyncProvinceWIndowToSignForm.syncProvinceWIndow(changedWindowProvince); + } + //Add By Li Jun 20230420 End } } //LY 2021/11/12 end \ No newline at end of file diff --git a/force-app/main/default/classes/SyncProvinceWIndowToSignForm.cls b/force-app/main/default/classes/SyncProvinceWIndowToSignForm.cls new file mode 100644 index 0000000..76a8328 --- /dev/null +++ b/force-app/main/default/classes/SyncProvinceWIndowToSignForm.cls @@ -0,0 +1,51 @@ +global without sharing class SyncProvinceWIndowToSignForm implements Database.Batchable<sObject>,Database.Stateful{ + + private Set<String> changedWindowProvince{set;get;} + + global SyncProvinceWIndowToSignForm(Set<String> changedWindowProvince) { + this.changedWindowProvince = changedWindowProvince; + } + + global Database.QueryLocator start(Database.BatchableContext BC) { + String query = 'select Sales_assistant_name_text__c,isProcessed__c,OCM_man_province_cus__c from eSignForm__c '; + query += ' where isProcessed__c = false '; + if (changedWindowProvince != null && changedWindowProvince.size() >0 ) { + query += ' and OCM_man_province_cus__c = :changedWindowProvince '; + system.debug('SOQL' + query); + return Database.getQueryLocator(query); + } + return null; + } + + global void execute(Database.BatchableContext BC, List<eSignForm__c> signFormList) { + // 鍙栧緱OCM绠$悊鐪佷俊鎭� + Map<String, OCM_Management_Province__c> provinceMap = DNUpsertBatch.getManagementProvince(); + // 鍒ゆ柇闇�瑕佹洿鏂扮殑绛炬敹鍗� + List<eSignForm__c> updList = new List<eSignForm__c>(); + for (eSignForm__c temp : signFormList) { + String provinceName = temp.OCM_man_province_cus__c; + if( provinceName != '' && provinceMap.containsKey(provinceName) && provinceMap.get(provinceName).Window1__c != null){ + temp.Sales_assistant_name_text__c = provinceMap.get(provinceName).Window1__c; + updList.add(temp); + } + } + // 绛炬敹鍗曟洿鏂� + if (updList.size() > 0) { + Database.SaveResult[] lsr = Database.update(updList, false); + for (Integer tIdx = 0; tIdx < lsr.size(); tIdx++) { + Database.SaveResult sr = lsr[tIdx]; + if (!sr.isSuccess()) { + Database.Error emsg = sr.getErrors()[0]; + System.debug('=====Error Sign: ' + updList[tIdx].Id + ' msg: ' + emsg); + } + } + } + } + + global void finish(Database.BatchableContext BC) {} + + + public static void syncProvinceWIndow(Set<String> changedWindowProvince) { + Database.executeBatch(new SyncProvinceWIndowToSignForm(changedWindowProvince),200); + } +} \ No newline at end of file diff --git a/force-app/main/default/classes/SyncProvinceWIndowToSignForm.cls-meta.xml b/force-app/main/default/classes/SyncProvinceWIndowToSignForm.cls-meta.xml new file mode 100644 index 0000000..fbbad0a --- /dev/null +++ b/force-app/main/default/classes/SyncProvinceWIndowToSignForm.cls-meta.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> + <apiVersion>56.0</apiVersion> + <status>Active</status> +</ApexClass> diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.html b/force-app/main/default/lwc/lexConsumable/lexConsumable.html index 667681f..6ad483c 100644 --- a/force-app/main/default/lwc/lexConsumable/lexConsumable.html +++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.html @@ -225,7 +225,7 @@ <p style="font-size: 16px;"><strong>娑堣�楀搧鏄庣粏</strong></p> </div> <div style="padding:10px;"> - <table style="width: 100%;" class="conTable"> + <!-- <table style="width: 100%;" class="conTable"> <thead> <tr style="border-bottom: 1px solid #D4D4D4;"> <template if:true={editAble}> @@ -310,7 +310,8 @@ </tr> </template> </tbody> - </table> + </table> --> + <c-lex-custom-lightning-datatable hide-checkbox-column key-field="Id" data={consumableorderdetailsRecordForDT} columns={cols}></c-lex-custom-lightning-datatable> </div> </div> </div> diff --git a/force-app/main/default/lwc/lexConsumable/lexConsumable.js b/force-app/main/default/lwc/lexConsumable/lexConsumable.js index b41661e..c190ba2 100644 --- a/force-app/main/default/lwc/lexConsumable/lexConsumable.js +++ b/force-app/main/default/lwc/lexConsumable/lexConsumable.js @@ -42,6 +42,7 @@ @track category4Option = []; @track category5Option = []; @track consumableorderdetailsRecordsview = []; + @track consumableorderdetailsRecordForDT = []; @track attachmentRecoeds = []; @track contactDealer = []; @track proLimitAndDate = []; @@ -117,6 +118,38 @@ {label:'鍏佽鎶ヤ环鏈熼棿(缁撴潫鏃�)',fieldName:'Contract_Decide_End_Date__c',initialWidth:200,hideDefaultActions: true} ]; + //娑堣�楀搧鏁版嵁col + get cols(){ + var cols = []; + cols.push({label:'娑堣�楀搧鍚嶇О',fieldName:'prodName',wrapText:true,hideDefaultActions: true}); + cols.push({label:'瑙勬牸',fieldName:'packing_list',hideDefaultActions: true}); + cols.push({label:'CFDA鐘舵��',fieldName:'prodSFDAStatus',hideDefaultActions: true}); + cols.push({label:'娉ㄥ唽璇佺紪鐮佸彿',fieldName:'approbation_No',hideDefaultActions: true}); + cols.push({label:'娉ㄥ唽璇佹晥鏈�',fieldName:'expiration_Date',hideDefaultActions: true}); + cols.push({label:'绗�3鍒嗙被',fieldName:'prodCategory3',hideDefaultActions: true}); + cols.push({label:'绗�4鍒嗙被',fieldName:'prodCategory4',hideDefaultActions: true}); + cols.push({label:'绗�5鍒嗙被',fieldName:'prodCategory5',hideDefaultActions: true}); + if(this.cansee){ + cols.push({label:'鏍囧噯鍗曚环',fieldName:'prodIntraTradeList',hideDefaultActions: true}); + } + if(this.editAble){ + cols.push( + {label:'閲囪喘鏁伴噺', + type: "customTableInput",typeAttributes: { + recordId: { fieldName: "recordId" }, + inputValue: { fieldName: "consumableCount" }, + }, + hideDefaultActions: true}); + }else{ + cols.push({label:'閲囪喘鏁伴噺',fieldName:'consumableCount',hideDefaultActions: true}); + } + cols.push({label:'鍦ㄥ簱鏁颁笅闄�',fieldName:'lowerlimit',hideDefaultActions: true}); + cols.push({label:'鍦ㄥ簱鏁颁笂闄�',fieldName:'upperlimit',hideDefaultActions: true}); + cols.push({label:'鏈夋晥鏈熷簱瀛�(鐩�)',fieldName:'allnumber',hideDefaultActions: true}); + cols.push({label:'鏈夋晥鏈熷簱瀛�(涓�)',fieldName:'allnumber_piece',hideDefaultActions: true}); + return cols;l + } + @wire(CurrentPageReference) getStateParameters(currentPageReference) { console.log('CurrentPageReference'); @@ -147,11 +180,11 @@ this.contractName = result.contractName; this.contractLabel = '缁忛攢鍟嗘湁鏁堝悎鍚�'; this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview; + // this.consumableorderdetailsRecordForDT = result.consumableorderdetailsRecordsview; + this.getTableData(); this.attachmentRecoeds = result.attachmentRecoeds; this.errorMsgs = result.errorMsgList; this.warningMsgs = result.warningMsgList; - // this.hasError = result.hasError; - // this.hasWarning = result.hasWarning; this.userWorkLocation = result.userWorkLocation; this.accountName = result.accountName; this.accountid = result.accountid; @@ -202,20 +235,30 @@ } this.showSpinner = false; this.showPage = true; - // this.warningMsgs.push('warning1'); - // this.warningMsgs.push('warning2'); - // this.warningMsgs.push('warning3'); - // this.warningMsgs.push('warning4'); - // this.errorMsgs.push('error1'); - // this.errorMsgs.push('error2'); - // this.errorMsgs.push('error3'); - // this.errorMsgs.push('error4'); }else{ this.showSpinner = false; console.log("Error:"+result.errorMsg); this.showMyToast('鍒濆鍖栭〉闈㈠け璐�',result.errorMsg,'error'); } }) + } + + getTableData(){ + for(var i in this.consumableorderdetailsRecordForDT){ + if(!this.consumableorderdetailsRecordForDT[i].oldCheck){ + this.consumableorderdetailsRecordForDT[i]["prodName"] = this.consumableorderdetailsRecordForDT[i].Prod.Name__c; + }else{ + this.consumableorderdetailsRecordForDT[i]["prodName"] = this.consumableorderdetailsRecordForDT[i].esd.Consumable_Product__r.Name__c; + } + this.consumableorderdetailsRecordForDT[i]["prodSFDAStatus"] = this.consumableorderdetailsRecordForDT[i].Prod.SFDA_Status__c; + this.consumableorderdetailsRecordForDT[i]["prodCategory3"] = this.consumableorderdetailsRecordForDT[i].Prod.Category3__c; + this.consumableorderdetailsRecordForDT[i]["prodCategory4"] = this.consumableorderdetailsRecordForDT[i].Prod.Category4__c; + this.consumableorderdetailsRecordForDT[i]["prodCategory5"] = this.consumableorderdetailsRecordForDT[i].Prod.Category5__c; + this.consumableorderdetailsRecordForDT[i]["prodIntraTradeList"] = this.consumableorderdetailsRecordForDT[i].Prod.Intra_Trade_List_RMB__c; + this.consumableorderdetailsRecordForDT[i]["consumableCount"] = this.consumableorderdetailsRecordForDT[i].esd.Consumable_count__c; + } + console.log("ProdName1:"+this.consumableorderdetailsRecordForDT[0].prodName); + console.log("ProdName2:"+this.consumableorderdetailsRecordsview[0].prodName); } get hasWarning(){ @@ -304,6 +347,7 @@ .then(result=>{ if(result.result == 'Success'){ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview; + this.getTableData(); this.showSpinner = false; this.errorMsgs = result.errorMsgList; this.warningMsgs = result.warningMsgList; @@ -351,6 +395,7 @@ }).then(result=>{ if(result.result == 'Success'){ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview; + this.getTableData(); this.showSpinner = false; this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success'); }else{ @@ -786,6 +831,7 @@ }).then(result=>{ if(result.result == 'Success'){ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview; + this.getTableData(); this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success'); }else{ console.log("Error:"+result.errorMsg); @@ -901,6 +947,7 @@ }).then(result=>{ if(result.result == 'Success'){ this.consumableorderdetailsRecordsview = result.consumableorderdetailsRecordsview; + this.getTableData(); this.showMyToast('鎼滅储鎴愬姛',result.errorMsg,'success'); }else{ console.log("Error:"+result.errorMsg); diff --git a/force-app/main/default/lwc/paginatedList/paginatedList.js-meta.xml b/force-app/main/default/lwc/paginatedList/paginatedList.js-meta.xml index b9a3113..98de4a2 100644 --- a/force-app/main/default/lwc/paginatedList/paginatedList.js-meta.xml +++ b/force-app/main/default/lwc/paginatedList/paginatedList.js-meta.xml @@ -1,5 +1,9 @@ <?xml version="1.0" encoding="UTF-8" ?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> - <isExposed>false</isExposed> + <isExposed>true</isExposed> + <targets> + <target>lightning__AppPage</target> + <target>lightning__Tab</target> + </targets> </LightningComponentBundle> \ No newline at end of file diff --git a/manifest/packageForSign.xml b/manifest/packageForSign.xml index d9db94a..f63f744 100644 --- a/manifest/packageForSign.xml +++ b/manifest/packageForSign.xml @@ -3,8 +3,9 @@ <types> <members>updateESignBatch</members> <members>DNUpsertBatch</members> - <members>OCMManagementProvinceBatch</members> + <members>SyncProvinceWIndowToSignForm</members> + <members>OCSMHandler</members> <name>ApexClass</name> - </types> + </types> <version>52.0</version> </Package> -- Gitblit v1.9.1