From 00e147ec892cb1e89d0698787a8c60da1014cdb7 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 17:42:22 +0800
Subject: [PATCH] Community升级

---
 force-app/main/default/classes/LexSaleOrderController.cls |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/force-app/main/default/classes/LexSaleOrderController.cls b/force-app/main/default/classes/LexSaleOrderController.cls
index b81004a..29616ff 100644
--- a/force-app/main/default/classes/LexSaleOrderController.cls
+++ b/force-app/main/default/classes/LexSaleOrderController.cls
@@ -201,6 +201,7 @@
 
         //BarCodelist鍋氭垚
         barCodeListP = ParseBarCode(barcode);
+        System.debug('barCodeListP:' + barCodeListP);
         //閽堝鎵�鏈夊晢鍝佸埌璐х‘璁�
         reSet1 = [
             SELECT
@@ -235,6 +236,7 @@
                 AND Arrive_Owner_Work_Location__c = :userWorkLocation
             ORDER BY RemoveBox_No__c DESC
         ];
+        System.debug('reSet1:' + reSet1);
         List<Consumable_order_details2__c> newdet2 = new List<Consumable_order_details2__c>();
         Set<Id> proIds = new Set<Id>();
 
@@ -242,6 +244,7 @@
             Integer idx = 0;
             for (Consumable_order_details2__c cod2 : reSet1) {
                 if (cod2.Bar_Code__c == barcode) {
+                    System.debug('cod2.Bar_Code__c:' + cod2.Bar_Code__c);
                     newdet2.add(cod2);
                     reSet1.remove(idx);
                     proIds.add(cod2.Consumable_product__c);
@@ -676,10 +679,22 @@
                     } else if (!checkBarcodeResult.containsKey(newdet2[j].Bar_Code__c)) {
                         Matcher n = Pattern.compile('[0-9]').matcher(newdet2[j].TracingCode__c);
                         if (n.find()) {
-                            String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
-                            consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
-                            errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
-                            continue;
+                            if (newdet2[j].TracingCode__c.length() == 5) {
+                                String tr = newdet2[j].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(newdet2[j], str));
+                                    errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+                                    continue;
+                                }
+                            }
+                            // String str = '绠$悊缂栫爜涓湁鏁板瓧锛岃涓庣鐞嗗憳纭鏄惁閿欒銆�';
+                            // consumableorderdetailsRecordserror.add(new ConsumableorderdetailsInfo(newdet2[j], str));
+                            // errorIdMap.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
+                            // continue;
                         }
                         checkBarcodeResult.put(newdet2[j].Bar_Code__c, newdet2[j].Bar_Code__c);
                         consumableorderdetailsRecords.add(new ConsumableorderdetailsInfo(newdet2[j]));
@@ -1064,11 +1079,16 @@
         for (ConsumableorderdetailsInfo ass : consumableorderdetailsRecords) {
             String key = '' + ass.orderdetails2.Bar_Code__c;
             Integer deliverycnt = BarcodeCntMap.get(key);
-            if (ass.orderdetails2.Box_Piece__c == '涓�' &&(ass.outboundCount == null || String.valueof(ass.outboundCount) == '' || ass.outboundCount <= 0)) {
+            if (
+                ass.orderdetails2.Box_Piece__c == '涓�' &&
+                (ass.outboundCount == null ||
+                String.valueof(ass.outboundCount) == '' ||
+                ass.outboundCount <= 0)
+            ) {
                 // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '璇疯緭鍏ヤ骇鍝� '+ ass.Prod.Name +' 鐨勫嚭璐ф暟閲�'));
                 // return null;
-                System.debug('ass.orderdetails2.Box_Piece__c = '  + ass.orderdetails2.Box_Piece__c);
-                System.debug('ass.outboundCount = '  + ass.outboundCount);
+                System.debug('ass.orderdetails2.Box_Piece__c = ' + ass.orderdetails2.Box_Piece__c);
+                System.debug('ass.outboundCount = ' + ass.outboundCount);
                 return new ResponseBodyLWC('Error', 500, '璇疯緭鍏ヤ骇鍝� ' + ass.Prod.Name + ' 鐨勫嚭璐ф暟閲�', '');
             }
             if (ass.outboundCount > deliverycnt) {
@@ -1253,6 +1273,7 @@
         return consumableorderdetails2Nobox.size();
     }
 
+    @TestVisible
     class ConsumableorderdetailsInfo implements Comparable {
         @AuraEnabled
         public Consumable_orderdetails__c orderdetails1 { get; set; }

--
Gitblit v1.9.1