From 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 14 七月 2023 14:56:14 +0800 Subject: [PATCH] lex community --- force-app/main/default/classes/ArriveGoodsController.cls | 677 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 591 insertions(+), 86 deletions(-) diff --git a/force-app/main/default/classes/ArriveGoodsController.cls b/force-app/main/default/classes/ArriveGoodsController.cls index cb91f3b..190bd57 100644 --- a/force-app/main/default/classes/ArriveGoodsController.cls +++ b/force-app/main/default/classes/ArriveGoodsController.cls @@ -77,8 +77,9 @@ //public String[] proidList =new String[]{}; public Decimal orderCountAll = 0; public Decimal orderCountNotarrive = 0; - private id return_Order_id = null; - private id inventory_Order_id = null; + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + public id return_Order_id = null; + public id inventory_Order_id = null; public boolean ReturnFLGbln {get;set;} public boolean saveFLGbln {get;set;} public String ArrType{get;set;} @@ -91,6 +92,14 @@ public String product_Type = null; public Boolean EngFlag = false; public Boolean ETFlag = false; + + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + public Boolean isLwc = false; + public String returnError; + public List<String> warningList; + public List<String> errorList; + public String urlType; + public ArriveGoodsController(){ baseUrl = URL.getSalesforceBaseUrl().toExternalForm(); ESetId = ApexPages.currentPage().getParameters().get('esetId'); @@ -110,6 +119,29 @@ consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); //add by rentx 20210602 CHAN-C3K4ZQ end // OrderAllMap = new Map<String, String>(); + } + + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + public ArriveGoodsController(String eSetId, String arrType){ + this.ESetId = eSetId; + this.ArrType = arrType; + ConsumableorderdetailsRecords = new List<ConsumableorderdetailsInfo>(); + ConsumableorderdetailsRecordserror = new List<ConsumableorderdetailsInfo>(); + ConsumableorderdetailsRecordsdummy = new List<ConsumableorderdetailsInfo>(); + consumableInventory = new List<ConsumableorderdetailsInfo>(); + consumableorderdetailsRecordsUse = new List<ConsumableorderdetailsInfo>(); + consumableInventoryUse = new List<ConsumableorderdetailsInfo>(); + consumableorderdetails2Cancle = new List<Consumable_order_details2__c>(); + orderdetails2trMap = new Map<String,Consumable_order_details2__c>(); + detailsSummary = new List<ConsumableorderdetailsInfo>(); + saveFLGbln = FALSE; + consumableorderdetailsRecordsview = new List<List<ConsumableorderdetailsInfo>>(); + noboxBarcodeList = new Set<String>(); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + warningList = new List<String>(); + errorList = new List<String>(); + returnError = null; + urlType = null; } //add by rentx 20210602 CHAN-C3K4ZQ start 鍑洪敊鐨勫師鍥犳槸椤甸潰鏈�澶氬睍绀�1000鏉℃暟鎹�,浣嗘槸闇�瑕佸睍绀虹殑鏁版嵁瓒呰繃浜�1000鏉�,鐜板湪鎶婂睍绀轰笂绾挎敼涓�1000 * 1000 @@ -304,6 +336,16 @@ //========20160311======ADD_End================================== //鑾峰彇鏄庣粏 public void SearchPro() { + //浠庝笅杈圭Щ涓婃潵 by Link 2023-5-23 + if(barcode == null || barcode.trim() ==''){ + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = '璇疯緭鍏arCode鍙�'; + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��')); + } + return; + } notInlist = new list<String>(); otherAgencyMap = new Map<String, String>(); barMcodeMap = new Map<String, String>(); @@ -311,6 +353,10 @@ consumableInventoryUse = new List<ConsumableorderdetailsInfo>(); consumableorderdetails2Cancle = new List<Consumable_order_details2__c>(); orderdetails2trMap = new Map<String,Consumable_order_details2__c>(); + //update by Link 20230428 + if(isLwc){ + noboxBarcodeList = new Set<String>(); + } //add by rentx 2021-01-27 start HosErrorList = new List<String>(); HosErrorMap = new Map<String,String>(); @@ -381,10 +427,16 @@ List<Consumable_order_details2__c> Ins = New List<Consumable_order_details2__c>(); List<Consumable_order_details2__c> reSet = new List<Consumable_order_details2__c>(); List<Consumable_order_details2__c> reSet1 = new List<Consumable_order_details2__c>(); - if(barcode == null || barcode.trim() ==''){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��')); - return; - } + //绉诲埌鏈�涓婅竟 by Link 2023-5-23 + // if(barcode == null || barcode.trim() ==''){ + // //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + // if(isLwc){ + // returnError = '璇疯緭鍏arCode鍙�'; + // }else { + // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'璇疯緭鍏arCode鍙枫��')); + // } + // return; + // } //瀵规瘮鍏ㄩ儴搴撳瓨涓槸鍚﹀瓨鍦ㄧ鐞嗙紪鐮佷竴鏍凤紝barcode鍙蜂笉涓�鏍风殑浜у搧 reSet1 = [SELECT Id, Name,TracingCode__c,Bar_Code__c,Report_Product_Expiration__c FROM Consumable_order_details2__c @@ -407,7 +459,12 @@ }else{ for(String str : barMcodeMap.keySet()){ if(barMcodeMap.get(str) == reSet1[i].TracingCode__c){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, str + ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add(str + ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, str + ' 鐨勭鐞嗙紪鐮佸凡缁忓瓨鍦ㄤ簬绯荤粺鐨勫簱瀛樹腑锛岃纭杈撳叆淇℃伅鏄惁鏈夎銆�')); + } ErrorIdMap.put(str,str); ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); } @@ -443,6 +500,8 @@ } //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '绠$悊缂栫爜涓虹┖鐨勪骇鍝� ' + ErrorIdMap)); //鏁翠綋鍒拌揣 + System.debug('EsetId===>'+EsetId); + System.debug('ArrType===>'+ArrType); if(EsetId == null || EsetId == ''){ if(ArrType!='ReG'){ //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗� @@ -481,6 +540,42 @@ } } } + System.debug('reSet1===>'+reSet1); + //add by Wang Xueqin + //鍒拌揣浣嗕骇鍝佺被鍨嬩笌鐢ㄦ埛鐨勭被鍨嬩笉绗� + reSet1 = [SELECT Id,Name,Intra_Trade_List_RMB__c,Asset_Model_No__c, + Consumable_Product__c,Consumable_Product__r.Name, + Consumable_Product__r.Name__c,Consumable_Product__r.Asset_Model_No__c, + Sterilization_limit__c,Deliver_date__c,Bar_Code__c, + Arrive_date__c,Send_Date__c,Consumable_order_minor__r.Name, + Consumable_order_minor__c,Dealer_Arrive__c, + Guarantee_period_for_products__c,CFDA_Status__c, + ProductPacking_list_manual__c,Report_Product_Approbation__c, + Report_Product_Expiration__c,Box_Piece__c, Rrturn_count__c, + Product_Type__c + ,ContractNo_text__c + ,Consumable_order_minor__r.ContractNo__c + FROM Consumable_order_details2__c + WHERE Bar_Code__c in :BarCodeListP + AND ( not Product_Type__c like :userPro_Typestr) + ]; + + if(reSet1.size()>0){ + for (Integer i = 0; i < reSet1.size(); i++) { + if(ErrorIdMap.containsKey(reSet1[i].Bar_Code__c)){ + // 璺宠繃宸茬粡澶勭悊鐨勬秷鑰楀搧鏄庣粏 + continue; + }else{ + String str = '浜у搧绫诲瀷['+reSet1[i].Product_Type__c+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇'; + ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet1[i],str)); + ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); + } + } + } + System.debug('reSet1===>1'+reSet1); + //end + + //閿�鍞骇鍝� reSet1 = [SELECT Id, Name,Consumable_Product__r.Name__c, Consumable_Product__c,Consumable_Product__r.Name, Sterilization_limit__c, @@ -949,7 +1044,12 @@ str = '璇ュ晢鍝佸湪搴�';//娌″嚭搴� 锛屾病閿�鍞紝娌′涪澶卞氨鏄湪搴撱�� } if(reSet1[i].Lose_Flag__c == true && reSet1[i].ToDueDateDays__c >= 0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '浜у搧'+reSet1[i].Consumable_Product__r.Name+'瀛樺湪涓㈠け璁板綍'));//濡傛灉涓㈠け浜у搧灏辩粰鎻愮ず銆� + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + warningList.add('浜у搧'+reSet1[i].Consumable_Product__r.Name+'瀛樺湪涓㈠け璁板綍'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, '浜у搧'+reSet1[i].Consumable_Product__r.Name+'瀛樺湪涓㈠け璁板綍'));//濡傛灉涓㈠け浜у搧灏辩粰鎻愮ず銆� + } } if (reSet1[i].Lose_Flag__c == true && reSet1[i].ToDueDateDays__c < 0) { str = '杩囨湡宸查攢瀛樹骇鍝侊紝涓嶅厑璁歌繑鍝�'; @@ -1028,10 +1128,24 @@ }else{ Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c); if(n.find()){ - String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (reSet[i].TracingCode__c.length() == 5) { + String tr = reSet[i].TracingCode__c; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'; ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str)); ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); continue; + } + } + // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str)); + // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); + // continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end } if(otherAgencyMap.containsKey(reSet[i].Bar_Code__c)){ for (Integer j=0; j<consumableInventory.size(); j++) { @@ -1111,20 +1225,38 @@ continue; }else{ Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c); - if(n.find()){ - String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + if(n.find()){// gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (reSet[i].TracingCode__c.length() == 5) { + String tr = reSet[i].TracingCode__c; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'; ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str)); ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); continue; + } + } + // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str)); + // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); + // continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end } ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); for(String str : barMcodeMap.keySet()){ // BarCode涓嶄竴鑷存椂鐨勮鍛婁俊鎭� if(reSet[i].Bar_Code__c != str && reSet[i].TracingCode__c == barMcodeMap.get(str)){ - // 20220815 ljh SWAG-CH65B7 start - // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'姝ょ鐞嗙紪鐮佷笌瀹為檯鍙戣揣BarCode涓嶄竴鑷达紝璇锋牳瀵圭鐞嗙紪鐮�('+ str +')鐨勫叆搴撳強搴撳瓨鏁版嵁銆�')); - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'鏉″舰鐮佷负('+ str +')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�')); - // 20220815 ljh SWAG-CH65B7 end + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + warningList.add('鏉″舰鐮佷负('+ str +')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�'); + }else { + // 20220815 ljh SWAG-CH65B7 start + // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'姝ょ鐞嗙紪鐮佷笌瀹為檯鍙戣揣BarCode涓嶄竴鑷达紝璇锋牳瀵圭鐞嗙紪鐮�('+ str +')鐨勫叆搴撳強搴撳瓨鏁版嵁銆�')); + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'鏉″舰鐮佷负('+ str +')鐨勫叆搴撴暟鎹笌鍙戣揣鏁版嵁涓嶄竴鑷�')); + // 20220815 ljh SWAG-CH65B7 end + } } if(barMcodeMap.get(str) == reSet[i].TracingCode__c){ reSet[i].Bar_Code__c = str; @@ -1159,7 +1291,12 @@ }else{ for(String str : barMcodeMap.keySet()){ if(barMcodeMap.get(str) == reSet1[i].TracingCode__c){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'barcode' +str + '涓庡嚭搴撳崟' + reSet1[i].Sale_orderName__c + ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('barcode' +str + '涓庡嚭搴撳崟' + reSet1[i].Sale_orderName__c + ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'barcode' +str + '涓庡嚭搴撳崟' + reSet1[i].Sale_orderName__c + ' 涓殑绠$悊缂栫爜涓�鑷达紝浣咮arcode涓嶅悓锛岃纭鍏蜂綋鏁版嵁銆�')); + } ErrorIdMap.put(str,str); ErrorIdMap.put(reSet1[i].Bar_Code__c,reSet1[i].Bar_Code__c); } @@ -1199,11 +1336,21 @@ if(ArrType!='ReG'){ inventoryEntryNoESetId(notInlist); if(notInStorelist.size() > 0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦ㄣ��')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = 'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦�'; + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦ㄣ��')); + } return; } }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInlist + '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱銆�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = 'BarCode鍙�'+ notInlist + '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱'; + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInlist + '涓嶅瓨鍦紝鏃犲搴旂殑鍑哄簱鍗曪紝璇峰厛鎿嶄綔浜у搧鍏ュ簱銆�')); + } return; } } @@ -1211,8 +1358,12 @@ //add by rentx 2021-01-27 start if (HosErrorList.size() > 0) { for (String str : HosErrorList) { - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�:' + str + HosErrorMap.get(str)+'')); - + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('BarCode鍙�:' + str + HosErrorMap.get(str)+''); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�:' + str + HosErrorMap.get(str)+'')); + } } } //add by rentx 2021-01-27 end @@ -1421,10 +1572,24 @@ }else{ Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c); if(n.find()){ - String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (reSet[i].TracingCode__c.length() == 5) { + String tr = reSet[i].TracingCode__c; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'; ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str)); ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); continue; + } + } + // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str)); + // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); + // continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end } ConsumableorderdetailsRecordsdummy.add(new ConsumableorderdetailsInfo(reSet[i])); ConsumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(reSet[i])); @@ -1483,10 +1648,24 @@ }else{ Matcher n = Pattern.compile('[0-9]').matcher(reSet[i].TracingCode__c); if(n.find()){ - String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (reSet[i].TracingCode__c.length() == 5) { + String tr = reSet[i].TracingCode__c; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'; ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str)); ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); continue; + } + } + // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(reSet[i],str)); + // ErrorIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); + // continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end } ExistIdMap.put(reSet[i].Bar_Code__c,reSet[i].Bar_Code__c); for(String str : barMcodeMap.keySet()){ @@ -1524,7 +1703,12 @@ if(notInlist.size()>0){ inventoryEntry(notInlist); if(notInStorelist.size() > 0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦ㄣ��')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = 'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦�'; + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�'+ notInStorelist + '涓嶅瓨鍦ㄣ��')); + } return; } } @@ -1533,7 +1717,12 @@ //add by rentx 2021-01-27 start 褰撹鍗曚负鍖婚櫌鐗逛环绫诲瀷鐨勮鍗曟椂,濡傛灉鎵句笉鍒癰arcode,涓嶈В鏋�,骞朵笖榛樿璇arcode瀵瑰簲鐨勬槑缁�2涓洪潪鍖婚櫌鐗逛环浜у搧,鐩存帴鎶ラ敊 if (HosErrorList.size() > 0) { for (String str : HosErrorList) { - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�:' + str +'鏄潪鍖婚櫌鐗逛环浜у搧')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('BarCode鍙�:' + str +'鏄潪鍖婚櫌鐗逛环浜у搧'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙�:' + str +'鏄潪鍖婚櫌鐗逛环浜у搧')); + } } } @@ -1572,7 +1761,12 @@ //鐢熶骇鏃ユ湡 List<String> janCode = new List<String>(); if(barCodeList[i].length() < 16){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')); + } continue; }else { //if(barCodeList[i].substring(0,2) !='01'){ @@ -1583,13 +1777,23 @@ try{ Decimal test = Decimal.valueOf(janCodeMark); }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�')); + } continue; } } if(barCodeList[i].length() >= 22){ if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')); + } continue; } if( barCodeList[i].substring(16,18) =='11'){ @@ -1597,7 +1801,12 @@ productDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01' ; productionDate = Date.valueOf(productDateStr); }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�')); + } continue; } if(barCodeList[i].length() >=32){ @@ -1612,7 +1821,12 @@ expirationDate = Date.valueOf(expirationDateStr); } }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + } continue; } if(barCodeList[i].length() >= 42){ @@ -1636,7 +1850,12 @@ expirationDate = Date.valueOf(expirationDateStr); } }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + } continue; } if(barCodeList[i].length() >= 34){ @@ -1656,12 +1875,31 @@ tracingCode = barCodeList[i].substring(barCodeList[i].length() - 5,barCodeList[i].length()); Matcher n = Pattern.compile('[0-9]').matcher(tracingCode); if(n.find()){ - String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�')); - continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (tracingCode.length() == 5) { + String tr = tracingCode; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'; + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�')); + } + continue; + } + } } }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�')); + } continue; } } @@ -1706,13 +1944,23 @@ barCode01List.add(barCodeList[i]); }else if(barCodeList[i].substring(0,3) =='241'){ if(barCodeList[i].length() > 8 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')); + } continue; } List<String> otCodeList = new List<String>(); Map<String,String> otCodeMap = new Map<String,String>(); if(barCodeList[i].length() < 7){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')); + } continue; }else if(barCodeList[i].length() == 11){ String otCode4 = barCodeList[i].substring(3,7); @@ -1754,11 +2002,21 @@ barOtcodeMap.put(barCodeList[i], otCodeMap); barCode241List.add(barCodeList[i]); }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒')); + } continue; } }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')涓嶇鍚堣姹傦紒')); + } continue; } } @@ -1798,7 +2056,12 @@ } } if(errorMap.size() > 0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风被鍨媅'+userPro_Type+']涓嶇')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风被鍨媅'+userPro_Type+']涓嶇'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风被鍨媅'+userPro_Type+']涓嶇')); + } } } } @@ -1824,7 +2087,12 @@ } } if(errorMap.size() > 0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇')); + } } product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c, Pro2_Dealer_ENG__c,Pro2_Dealer_Object__c @@ -1850,7 +2118,12 @@ productDateStr = '20' + bar.substring(oTcodeLength + 5,oTcodeLength + 7) + '-' + bar.substring(oTcodeLength + 7,oTcodeLength + 9) + '-01' ; productionDate = Date.valueOf(productDateStr); }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�')); + } continue; } if(bar.length() >=oTcodeLength + 3 + 16){ @@ -1865,7 +2138,12 @@ expirationDate = Date.valueOf(expirationDateStr); } }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + } continue; } if(bar.length() >= oTcodeLength + 3 + 25){ @@ -1890,7 +2168,12 @@ expirationDate = Date.valueOf(expirationDateStr); } }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + } continue; } if(bar.length() >=oTcodeLength + 20){ @@ -1910,12 +2193,35 @@ tracingCode = bar.substring(bar.length() - 5,bar.length()); Matcher n = Pattern.compile('[0-9]').matcher(tracingCode); if(n.find()){ - String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�')); - continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (tracingCode.length() == 5) { + String tr = tracingCode; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�')); + } + continue; + } + } + // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; + // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�')); + // continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end } }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�')); + } continue; } } @@ -1982,20 +2288,35 @@ //鐢熶骇鏃ユ湡 List<String> janCode = new List<String>(); if(barCodeList[i].length() < 16){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')); + } continue; }else { janCodeMark = barCodeList[i].substring(2,16); try{ Decimal test = Decimal.valueOf(janCodeMark); }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨刯anCode閿欒锛�')); + } continue; } } if(barCodeList[i].length() >= 22){ if(barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')); + } continue; } if( barCodeList[i].substring(16,18) =='11'){ @@ -2003,7 +2324,12 @@ productDateStr = '20' + barCodeList[i].substring(18,20) + '-' + barCodeList[i].substring(20,22) + '-01' ; productionDate = Date.valueOf(productDateStr); }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�')); + } continue; } if(barCodeList[i].length() >=32){ @@ -2018,7 +2344,12 @@ expirationDate = Date.valueOf(expirationDateStr); } }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + } continue; } if(barCodeList[i].length() >= 42){ @@ -2042,7 +2373,12 @@ expirationDate = Date.valueOf(expirationDateStr); } }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + } continue; } if(barCodeList[i].length() >= 34){ @@ -2062,12 +2398,35 @@ tracingCode = barCodeList[i].substring(barCodeList[i].length() - 5,barCodeList[i].length()); Matcher n = Pattern.compile('[0-9]').matcher(tracingCode); if(n.find()){ - String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�')); - continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (tracingCode.length() == 5) { + String tr = tracingCode; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�')); + } + continue; + } + } + // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; + // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�')); + // continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end } }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨則racingCode閿欒锛�')); + } continue; } } @@ -2113,13 +2472,23 @@ barCode01List.add(barCodeList[i]); }else if(barCodeList[i].substring(0,3) =='241'){ if(barCodeList[i].length() > 8 && barCodeList[i].substring(barCodeList[i].length() - 8,barCodeList[i].length()-5)!='250'){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + barCodeList[i] + ')娌℃湁绠$悊缂栫爜锛�')); + } continue; } List<String> otCodeList = new List<String>(); Map<String,String> otCodeMap = new Map<String,String>(); if(barCodeList[i].length() < 7){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')鐨勪綅鏁颁笉瓒�16锛屼笉绗﹀悎瑕佹眰閿欒锛�')); + } continue; }else if(barCodeList[i].length() == 11){ String otCode4 = barCodeList[i].substring(3,7); @@ -2161,7 +2530,12 @@ barOtcodeMap.put(barCodeList[i], otCodeMap); barCode241List.add(barCodeList[i]); }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + barCodeList[i] + ')娌℃湁janCode鎴朞Tcode锛屼笉绗﹀悎瑕佹眰锛�')); + } continue; } } @@ -2188,7 +2562,12 @@ } } if(errorMap.size() > 0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴风殑绫诲瀷['+userPro_Type+']涓嶇')); + } } } product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c,Product2_Jancode__c, @@ -2253,7 +2632,12 @@ } } if(errorMap.size() > 0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'BarCode鍙穂'+ errorMap.values() +']浜у搧绫诲瀷['+product_Type+']涓庣敤鎴穂'+userPro_Type+']绫诲瀷涓嶇')); + } } product2InStore = [SELECT Id, Name,Name__c,Intra_Trade_List_RMB__c,Asset_Model_No__c,OT_CODE__c, Pro2_Dealer_Object__c,Pro2_Dealer_ENG__c @@ -2278,7 +2662,12 @@ productDateStr = '20' + bar.substring(oTcodeLength + 5,oTcodeLength + 7) + '-' + bar.substring(oTcodeLength + 7,oTcodeLength + 9) + '-01' ; productionDate = Date.valueOf(productDateStr); }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '浜у搧BarCode(' + bar + ')鐨勭敓浜ф棩鏈�' + productDateStr + '閿欒锛�')); + } continue; } if(bar.length() >=oTcodeLength + 3 + 16){ @@ -2294,7 +2683,12 @@ expirationDate = Date.valueOf(expirationDateStr); } }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + } continue; } if(bar.length() >= oTcodeLength + 3 + 25){ @@ -2319,7 +2713,12 @@ expirationDate = Date.valueOf(expirationDateStr); } }catch(Exception e){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨勬粎鑿屾湁鍔规湡闄�' + expirationDateStr + '閿欒锛�')); + } continue; } if(bar.length() >=oTcodeLength + 20){ @@ -2339,12 +2738,35 @@ tracingCode = bar.substring(bar.length() - 5,bar.length()); Matcher n = Pattern.compile('[0-9]').matcher(tracingCode); if(n.find()){ - String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�')); - continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (tracingCode.length() == 5) { + String tr = tracingCode; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�')); + } + continue; + } + } + // String str = '绠$悊缂栫爜涓嶆纭紝璇蜂笌绠$悊鍛樼‘璁ゆ槸鍚﹂敊璇��'; + // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒锛�')); + // continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end } }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + errorList.add('浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'浜у搧BarCode(' + bar + ')鐨則racingCode閿欒锛�')); + } continue; } } @@ -2388,9 +2810,19 @@ if(notEqualBARcodeCunMap.size() > 0){ for(String widget : notEqualBARcodeCunMap.keySet()) { if(notEqualBARcodeCunMap.get(widget).size() >0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '浠ヤ笅barcode浜у搧涓庤璐т骇鍝佷笉涓�鑷淬��')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + warningList.add('浠ヤ笅barcode浜у搧涓庤璐т骇鍝佷笉涓�鑷淬��'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '浠ヤ笅barcode浜у搧涓庤璐т骇鍝佷笉涓�鑷淬��')); + } for(String barcodeListTTT : (List<String>)notEqualBARcodeCunMap.get(widget)) { - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT)); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + warningList.add(barcodeListTTT); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT)); + } } } } @@ -2732,7 +3164,12 @@ Savepoint sp = Database.setSavepoint(); if(ConsumableorderdetailsRecords.size()<1 && consumableInventory.size()<1){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄥ埌璐ф槑缁�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = '涓嶅瓨鍦ㄥ埌璐ф槑缁�'; + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'涓嶅瓨鍦ㄥ埌璐ф槑缁�')); + } return null; } if(EsetId != null && EsetId != ''){ @@ -2740,9 +3177,19 @@ if(resultcheck.length() > 0){ for(String widget : overOrderBARcodeCunMap.keySet()) { if(overOrderBARcodeCunMap.get(widget).size() >0){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '浜у搧' + widget + '鏈鍒拌揣鏁伴噺瓒呰繃' + overOrderBARcodeCunMap.get(widget).size() +'涓璐х殑鏁伴噺銆�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + warningList.add('浜у搧' + widget + '鏈鍒拌揣鏁伴噺瓒呰繃' + overOrderBARcodeCunMap.get(widget).size() +'涓璐х殑鏁伴噺銆�'); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '浜у搧' + widget + '鏈鍒拌揣鏁伴噺瓒呰繃' + overOrderBARcodeCunMap.get(widget).size() +'涓璐х殑鏁伴噺銆�')); + } for(String barcodeListTTT : (List<String>)overOrderBARcodeCunMap.get(widget)) { - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT)); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + warningList.add(barcodeListTTT); + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, barcodeListTTT)); + } } } } @@ -2771,6 +3218,7 @@ arriveId = orderMain.id; Decimal arriveAmount =0; for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecordsUse) { + //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------1------')); Consumable_order_details2__c insDetails = new Consumable_order_details2__c(); insDetails.Id = ass.esd.Id; insDetails.Consumable_Arrived_order__c = orderMain.id; @@ -2808,7 +3256,7 @@ // }else{ // insAfterDel.Intra_Trade_List_RMB__c = 0; // } - insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c; + insAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c; //gzw 鎵嬪姩鍏ュ簱 榛樿浜у搧鍗曚环 20230307 insAfterDel.Asset_Model_No__c = ass.Prod.Asset_Model_No__c; if(EsetId != null && EsetId != ''){ @@ -2882,6 +3330,7 @@ if(updateconsumableorderdetails2.size() > 0){ update updateconsumableorderdetails2; } + List<Consumable_order_details2__c> insertconsumableorderdetails2 = new List<Consumable_order_details2__c>(); for(Consumable_order_details2__c Cod2 : consumableorderdetails2Insert){ //ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'------4------')); @@ -2913,7 +3362,7 @@ i++; } - // return null; + //return null; if(insertconsumableorderdetails2.size() >0){ insert insertconsumableorderdetails2; @@ -2959,7 +3408,12 @@ // Integer a = 1/0; }catch(Exception e){ Database.rollback(sp); - ApexPages.addMessages(e); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = e.getLineNumber()+'---'+e.getMessage(); + }else { + ApexPages.addMessages(e); + } return null; } if(resultcheck.length() > 0){ @@ -2967,6 +3421,7 @@ }else if(resultcheckWithoutOrder.size() >0){ return null; } else{ + urlType = 'UnabletoEdit'; return UnabletoEdit(); // return null; } @@ -3108,10 +3563,24 @@ Matcher n = Pattern.compile('[0-9]').matcher(codc.TracingCode__c); if(n.find()){ - String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 start + if (codc.TracingCode__c.length() == 5) { + String tr = codc.TracingCode__c; + String Ctr = tr.substring(tr.length() - 3,tr.length()); + String Btr = tr.substring(tr.length() - 4,tr.length()-3); + String Atr = tr.substring(tr.length() - 5,tr.length()-4); + if (Pattern.compile('[0-9]').matcher(Atr).find() || Pattern.compile('[0-9]').matcher(Ctr).find()) { + String str = '绠$悊缂栫爜鏈夎锛岃妫�鏌ユ潯褰㈢爜鏁版嵁銆�'; ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(codc,str)); ErrorIdMap.put(codc.Bar_Code__c,codc.Bar_Code__c); continue; + } + } + // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�'; + // ConsumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(codc,str)); + // ErrorIdMap.put(codc.Bar_Code__c,codc.Bar_Code__c); + // continue; + // gzw DB202305352696 鍏ュ簱绠$悊缂栫爜楠岃瘉绋嬪簭璋冩暣 end } if( CheckBarcodeResult.containsKey( codc.Bar_Code__c )){ GrList.add(codc.Bar_Code__c); @@ -3296,7 +3765,7 @@ Inventory_Order_Sheet.Order_ProType__c = userPro_Type; insert Inventory_Order_Sheet; inventory_Order_id = Inventory_Order_Sheet.id; - List<Consumable_order__c> consumable_order_Inv = [SELECT Name FROM Consumable_order__c WHERE id =:Inventory_Order_Sheet.id]; + //List<Consumable_order__c> consumable_order_Inv = [SELECT Name FROM Consumable_order__c WHERE id =:Inventory_Order_Sheet.id]; //Commented By Li Jun 20230616 // WYIN-BLZE48鐩樼偣涓㈠け浜у搧澧炲姞鍏ュ簱鏂瑰紡 update by vivek 2020-03-05 end List<Consumable_order_details2__c> codcList = new List<Consumable_order_details2__c>(); @@ -3312,7 +3781,11 @@ } if(codi.esd.Return_reason__c==null||codi.esd.Return_reason__c==''){ - codi.esd.Return_reason__c.addError('璇疯ˉ鍏呰繑鍝佸師鍥�'); + if(isLwc){ + returnError = '璇疯ˉ鍏呰繑鍝佸師鍥�'; + }else { + codi.esd.Return_reason__c.addError('璇疯ˉ鍏呰繑鍝佸師鍥�'); + } return null; } @@ -3321,7 +3794,11 @@ String key = '' + codi.esd.Consumable_ZS_order__c + codi.esd.Bar_Code__c; Integer deliverycnt = BarcodeCntMap.get(key); if(codi.esd.Rrturn_count__c > deliverycnt){ - codi.esd.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺'); + if(isLwc){ + returnError = '瓒呭嚭鍑哄簱鏁伴噺'; + }else { + codi.esd.Rrturn_count__c.addError('瓒呭嚭鍑哄簱鏁伴噺'); + } return null; } } @@ -3506,6 +3983,7 @@ codcList.add( codi.esd ); } } + //鏄庣粏2涓嶅瓨鍦ㄧ殑瀵瑰簲鐨勫埌璐ц鍗曟槑缁� 2017-07-05 Integer i = 1; //for(ConsumableorderdetailsInfo ass : consumableInventoryUse){ @@ -3519,7 +3997,12 @@ // } if(ass.ReturnReason==null || ass.ReturnReason==''){ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇疯ˉ鍏呰繑鍝佸師鍥�')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = '璇疯ˉ鍏呰繑鍝佸師鍥�'; + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'璇疯ˉ鍏呰繑鍝佸師鍥�')); + } return null; } @@ -3619,26 +4102,43 @@ // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start // return ToReturnGoodsPage(); if(hasLoseGoods){ + urlType = 'ToInventoryGoodsPage'; return ToInventoryGoodsPage(); // return null; }else{ + urlType = 'ToReturnGoodsPage'; return ToReturnGoodsPage(); // return null; } // WYIN-BPE3T4 铏氭嫙鐩樼偣鍗� update by vivek 2020-05-11 start } else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'娌℃湁闇�瑕佺櫥褰曠殑杩斿搧')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'; + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'娌℃湁闇�瑕佺櫥褰曠殑杩斿搧')); + } return null; } }else{ - ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'娌℃湁闇�瑕佺櫥褰曠殑杩斿搧')); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = '娌℃湁闇�瑕佺櫥褰曠殑杩斿搧'; + }else { + ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'娌℃湁闇�瑕佺櫥褰曠殑杩斿搧')); + } return null; } }catch(Exception e){ Database.rollback(sp); - ApexPages.addMessages(e); + //LWC:Lwcflag鍜屾姤閿欐彁閱� update by Link 2023-04-27 + if(isLwc){ + returnError = e.getLineNumber()+'---'+e.getMessage(); + }else { + ApexPages.addMessages(e); + } return null; } } @@ -3714,7 +4214,7 @@ return ref; } - class ConsumableorderdetailsInfo implements Comparable { + public class ConsumableorderdetailsInfo implements Comparable { public Consumable_order_details2__c esd { get; set; } public Product2__c Prod { get; set; } public String ProductName { get; set; } @@ -3732,6 +4232,11 @@ public Decimal arrivedCount { get; set; } public String ReportProductExpirationDate {get;set;} + + public ConsumableorderdetailsInfo(){ + + } + public ConsumableorderdetailsInfo(Consumable_order_details2__c e,string str) { esd = e; Prod = e.Consumable_Product__r; -- Gitblit v1.9.1