From 52f362a9efd067ba31e24b30754681aabe8f991e Mon Sep 17 00:00:00 2001
From: fuyu <fuyu@prec-tech.com>
Date: 星期一, 06 三月 2023 13:28:09 +0800
Subject: [PATCH] 备份进口单证

---
 force-app/main/default/classes/AttachmentDisplayController.cls |  800 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 558 insertions(+), 242 deletions(-)

diff --git a/force-app/main/default/classes/AttachmentDisplayController.cls b/force-app/main/default/classes/AttachmentDisplayController.cls
index 8b36c5c..2dc1e57 100644
--- a/force-app/main/default/classes/AttachmentDisplayController.cls
+++ b/force-app/main/default/classes/AttachmentDisplayController.cls
@@ -14,15 +14,34 @@
         System.debug('DNId'+DNId);
         List<testInit> newinitList = new List<testInit>();
         List<testInit> initList = new List<testInit>();
-        List<FrameNumManage__c> FnmList =[SELECT Id, Name ,ManagementCode__c,InspectionCard__c
-        , ApplyList__c ,InspectionCard_Select__c ,InspectionCard_Select__r.ViewLink__c
-        ,InspectionCard_Select__r.DownloadLink__c, ApplyList_Select__c
-        ,ApplyList_Select__r.DownloadLink__c,ApplyList_Select__r.ViewLink__c,  Num__c 
-        , SerialNumber__c,Material__c , MaterialDepict__c
-        ,ApplyList_Select__r.AWS_File_Key__c,ApplyList_Select__r.FileName__c
-        ,InspectionCard_Select__r.AWS_File_Key__c,InspectionCard_Select__r.FileName__c
+        List<FrameNumManage__c> FnmList =[SELECT Id, Name 
+        ,ManagementCode__c
+        ,InspectionCard__c
+        ,ApplyList__c 
+        ,InspectionCard_Select__c 
+        ,InspectionCard_Select__r.ViewLink__c
+        ,InspectionCard_Select__r.DownloadLink__c
+        ,ApplyList_Select__c
+        ,ApplyList_Select__r.DownloadLink__c
+        ,ApplyList_Select__r.ViewLink__c
+        ,Num__c 
+        ,SerialNumber__c
+        ,Material__c 
+        ,MaterialDepict__c
+        ,ApplyList_Select__r.AWS_File_Key__c
+        ,ApplyList_Select__r.FileName__c
+        ,InspectionCard_Select__r.AWS_File_Key__c
+        ,InspectionCard_Select__r.FileName__c
         ,HomeBuy__c
-         from FrameNumManage__c where signInForm__c =:DNId order by ApplyList__c desc,SerialNumber__c desc];
+        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+        ,ApplyList_NoHave__c
+        ,InspectionCard_NoHave__c  
+        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+        from FrameNumManage__c where signInForm__c =:DNId 
+        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+       //  order by ApplyList__c desc,InspectionCard__c desc,SerialNumber__c desc];
+       order by ApplyList_NoHave__c desc,InspectionCard_NoHave__c desc ,SerialNumber__c desc];
+       //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
         set<String> FileStrSet = new set<String>();
         List<FileAddress__c> FileList = new List<FileAddress__c>();
         Map<String,String> FileStrMap = new Map<String,String>();
@@ -39,14 +58,18 @@
         // }
         List<FrameNumManage__c> FnmListhomebuy = new List<FrameNumManage__c>();
         List<FrameNumManage__c> notFnmListhomebuy = new List<FrameNumManage__c>();
-        for(FrameNumManage__c fr : FnmList){
-            if(fr.HomeBuy__c){
-                FnmListhomebuy.add(fr);
-            }else{
-                notFnmListhomebuy.add(fr);
-            }
-        }
+        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+        // for(FrameNumManage__c fr : FnmList){
+        //     if(fr.HomeBuy__c){
+        //         FnmListhomebuy.add(fr);
+        //     }else{
+        //         notFnmListhomebuy.add(fr);
+        //     }
+        // }
+        notFnmListhomebuy = FnmList;
+        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
         Integer n = 0; // 鍒濆鍖栧悎骞惰鏁�
+        Integer n_sj = 0; // 鍒濆鍖栧悎骞惰鏁帮紙鍟嗘璇侊級 2023-01-10 fy add
         for (Integer i=0;i<notFnmListhomebuy.size() ;i++ ) {
             testInit init = new testInit();
             if (i==0) {
@@ -61,40 +84,78 @@
                 // }else{
                 // 	init.code = '鏃�';
                 // } 
-                if (String.isNotBlank(notFnmListhomebuy[i].ApplyList__c)) {
-                	if (notFnmListhomebuy[i].ApplyList__c.equals('涓嶅嚭璇�')) {
-                		init.code = '涓嶅嚭璇�';
-                	}else{
-                		// 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
-                		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
-		                	init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
-		                }else{
-		                	init.codeyu = '';
-		                }
-                		// 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
-                		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
-		                	init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
-		                }else{
-		                	init.code = '';
-		                }
+                //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__c)) {
+                    // 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
+                        init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
+                    }else{
+                        init.codeyu = '';
+                    }
+                    // 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
+                        init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
+                    }else{
+                        init.code = '';
+                    }
+                    //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
+                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
+                        init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
+                    }else{
+                        init.awsKey = '';
+                    }
+                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
+                        init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
+                    }else{
+                        init.fileName = '';
+                    }
+                    //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+                }else {
+                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_NoHave__c)) {
+                        init.code = notFnmListhomebuy[i].ApplyList_NoHave__c;
+                    }else{
+                        init.code = '';
+                    }
+                    init.codeyu = '';
+                    init.awsKey = '';       // zhj 2022-12-08 
+                    init.fileName = '';     // zhj 2022-12-08
+                } 
+                // if (String.isNotBlank(notFnmListhomebuy[i].ApplyList__c)) {
+                // 	if (notFnmListhomebuy[i].ApplyList__c.equals('涓嶅嚭璇�')) {
+                // 		init.code = '涓嶅嚭璇�';
+                // 	}else{
+                // 		// 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+                // 		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
+		        //         	init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
+		        //         }else{
+		        //         	init.codeyu = '';
+		        //         }
+                // 		// 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+                // 		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
+		        //         	init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
+		        //         }else{
+		        //         	init.code = '';
+		        //         }
 
-                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
-		                	init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
-		                }else{
-		                	init.awsKey = '';
-		                }
-                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
-		                	init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
-		                }else{
-		                	init.fileName = '';
-		                }
-                	}
-                }else{
-                	init.code = '';
-                	init.codeyu = '';
-                    init.awsKey = '';
-                    init.fileName = '';
-                }
+                //         if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
+		        //         	init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
+		        //         }else{
+		        //         	init.awsKey = '';
+		        //         }
+                //         if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
+		        //         	init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
+		        //         }else{
+		        //         	init.fileName = '';
+		        //         }
+                // 	}
+                // }else{
+                // 	init.code = '';
+                // 	init.codeyu = '';
+                //     init.awsKey = '';
+                //     init.fileName = '';
+                // }
+                //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+                
                 // //2022-12-05 fy add 鎶ュ叧鍗曞垽鏂�
                 // //if (String.isNotBlank(FnmList[i].InspectionCard_Select__r.DownloadLink__c)) {
                 // if (notFnmListhomebuy[i].InspectionCard__c =='涓嶅嚭璇�') {
@@ -105,60 +166,114 @@
                 // 	init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
                 //     init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
                 // } //2022-12-05 fy add 鍟嗘璇佸垽鏂�
-                if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard__c)) {
-                	if (notFnmListhomebuy[i].InspectionCard__c.equals('涓嶅嚭璇�')) {
-                		init.sj_code = '涓嶅嚭璇�';
-                	}else{
-                		// 鍟嗘璇侀瑙堥摼鎺ュ垽鏂�
-                		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
-		                	init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
-		                }else{
-		                	init.sj_codeyu = '';
-		                }
-                		// 鍟嗘璇佷笅杞介摼鎺ュ垽鏂�
-                		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
-		                	init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
-		                }else{
-		                	init.sj_code = '';
-		                }
-                        //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 start
-                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
-		                	init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
-		                }else{
-		                	init.sj_awsKey = '';
-		                }
-                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
-		                	init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
-		                }else{
-		                	init.sj_fileName = '';
-		                }
-                        //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 end
-                	}
-                }else{
-                	init.sj_code = '';
-                	init.sj_codeyu = '';
-                    init.sj_awsKey = '';       // zhj 2022-12-19 
-                    init.sj_fileName = '';     // zhj 2022-12-19
-                }
-                //2022-12-26 fy add 鏀归�� end
-                
+                 //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                 if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__c)) {
+                    // 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
+                        init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
+                    }else{
+                        init.sj_codeyu = '';
+                    }
+                    // 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
+                        init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
+                    }else{
+                        init.sj_code = '';
+                    }
+                    //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
+                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
+                        init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
+                    }else{
+                        init.sj_awsKey = '';
+                    }
+                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
+                        init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
+                    }else{
+                        init.sj_fileName = '';
+                    }
+                    //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+                }else {
+                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_NoHave__c)) {
+                        init.sj_code = notFnmListhomebuy[i].InspectionCard_NoHave__c;
+                    }else{
+                        init.sj_code = '';
+                    }
+                    init.sj_codeyu = '';
+                    init.sj_awsKey = '';       // zhj 2022-12-08 
+                    init.sj_fileName = '';     // zhj 2022-12-08
+                } 
+                // if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard__c)) {
+                // 	if (notFnmListhomebuy[i].InspectionCard__c.equals('涓嶅嚭璇�')) {
+                // 		init.sj_code = '涓嶅嚭璇�';
+                // 	}else{
+                // 		// 鍟嗘璇侀瑙堥摼鎺ュ垽鏂�
+                // 		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
+		        //         	init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
+		        //         }else{
+		        //         	init.sj_codeyu = '';
+		        //         }
+                // 		// 鍟嗘璇佷笅杞介摼鎺ュ垽鏂�
+                // 		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
+		        //         	init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
+		        //         }else{
+		        //         	init.sj_code = '';
+		        //         }
+                //         //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 start
+                //         if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
+		        //         	init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
+		        //         }else{
+		        //         	init.sj_awsKey = '';
+		        //         }
+                //         if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
+		        //         	init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
+		        //         }else{
+		        //         	init.sj_fileName = '';
+		        //         }
+                //         //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 end
+                // 	}
+                // }else{
+                // 	init.sj_code = '';
+                // 	init.sj_codeyu = '';
+                //     init.sj_awsKey = '';       // zhj 2022-12-19 
+                //     init.sj_fileName = '';     // zhj 2022-12-19
+                // }
+                // //2022-12-26 fy add 鏀归�� end
+                //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+
                 // init.code = FileStrMap.get(FnmList[i].ApplyList__c);
                 init.Num = notFnmListhomebuy[i].Num__c;
                 init.Id = notFnmListhomebuy[i].Id;
                 init.FrameNo = notFnmListhomebuy[i].SerialNumber__c;
                 n = n+1;
+                n_sj = n_sj+1; // 2023-01-10   fy   add
                 if (i != notFnmListhomebuy.size()-1) {
                     // 鍒ゆ柇绗竴涓笌绗簩涓槸鍚︿竴鏍凤紝涓嶄竴鏍疯祴鍊�1
-                    if (notFnmListhomebuy[i].ApplyList__c != notFnmListhomebuy[i+1].ApplyList__c) {
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                    // if (notFnmListhomebuy[i].ApplyList__c != notFnmListhomebuy[i+1].ApplyList__c) {
+                    if (notFnmListhomebuy[i].ApplyList_NoHave__c != notFnmListhomebuy[i+1].ApplyList_NoHave__c) {
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
                         init.count = n;
                     }
+                    // 2023-01-10 fy  add start
+                    // 鍒ゆ柇绗竴涓笌涓嬩竴涓槸鍚︿竴鏍凤紝涓嶄竴鏍疯祴鍊�1鈥斺�斿晢妫�璇�
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                    // if (notFnmListhomebuy[i].InspectionCard__c != notFnmListhomebuy[i+1].InspectionCard__c) {
+                    if (notFnmListhomebuy[i].InspectionCard_NoHave__c != notFnmListhomebuy[i+1].InspectionCard_NoHave__c) {
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+                        init.count_sj = n_sj;
+                    }
+                    // 2023-01-10 fy  add end
                 }else if(notFnmListhomebuy.size() == 1){
                     init.count = 1;
+                    init.count_sj = 1; // 2023-01-10   fy   add   濡傛灉鍙湁涓�鏉�  璧嬪�煎悎骞惰鏁�
                 }
             System.debug('init1===='+init);
             }else {
                 // 鍒ゆ柇涓庡墠涓�涓紪鐮佹槸涓�鑷�
-                if (notFnmListhomebuy[i].ApplyList__c == notFnmListhomebuy[i-1].ApplyList__c) {
+                //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                // if (notFnmListhomebuy[i].ApplyList__c == notFnmListhomebuy[i-1].ApplyList__c) {
+                if (notFnmListhomebuy[i].ApplyList_NoHave__c == notFnmListhomebuy[i-1].ApplyList_NoHave__c) {
+                //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
                     init.Name = notFnmListhomebuy[i].ManagementCode__c;
                     init.ProductName = notFnmListhomebuy[i].Material__c + '-' + notFnmListhomebuy[i].MaterialDepict__c;
 
@@ -170,41 +285,80 @@
 	                // }else{
 	                // 	init.code = '鏃�';
 	                // } //2022-12-05 fy add 鎶ュ叧鍗曞垽鏂�
-                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList__c)) {
-	                	if (notFnmListhomebuy[i].ApplyList__c.equals('涓嶅嚭璇�')) {
-	                		init.code = '涓嶅嚭璇�';
-	                	}else{
-	                		// 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
-	                		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
-			                	init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
-			                }else{
-			                	init.codeyu = '';
-			                }
-	                		// 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
-	                		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
-			                	init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
-			                }else{
-			                	init.code = '';
-			                }
-                            //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
-                            if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
-                                init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
-                            }else{
-                                init.awsKey = '';
-                            }
-                            if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
-                                init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
-                            }else{
-                                init.fileName = '';
-                            }
-                            //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__c)) {
+                        // 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
+                            init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
+                        }else{
+                            init.codeyu = '';
                         }
-	                }else{
-	                	init.code = '';
-	                	init.codeyu = '';
+                        // 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
+                            init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
+                        }else{
+                            init.code = '';
+                        }
+                        //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
+                            init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
+                        }else{
+                            init.awsKey = '';
+                        }
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
+                            init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
+                        }else{
+                            init.fileName = '';
+                        }
+                        //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+                    }else {
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_NoHave__c)) {
+                            init.code = notFnmListhomebuy[i].ApplyList_NoHave__c;
+                        }else{
+                            init.code = '';
+                        }
+                        init.codeyu = '';
                         init.awsKey = '';       // zhj 2022-12-08 
                         init.fileName = '';     // zhj 2022-12-08
-	                }
+                    } 
+
+                    // if (String.isNotBlank(notFnmListhomebuy[i].ApplyList__c)) {
+	                // 	if (notFnmListhomebuy[i].ApplyList__c.equals('涓嶅嚭璇�')) {
+	                // 		init.code = '涓嶅嚭璇�';
+	                // 	}else{
+	                // 		// 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+	                // 		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
+			        //         	init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
+			        //         }else{
+			        //         	init.codeyu = '';
+			        //         }
+	                // 		// 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+	                // 		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
+			        //         	init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
+			        //         }else{
+			        //         	init.code = '';
+			        //         }
+                    //         //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
+                    //         if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
+                    //             init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
+                    //         }else{
+                    //             init.awsKey = '';
+                    //         }
+                    //         if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
+                    //             init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
+                    //         }else{
+                    //             init.fileName = '';
+                    //         }
+                    //         //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+                    //     }
+	                // }else{
+	                // 	init.code = '';
+	                // 	init.codeyu = '';
+                    //     init.awsKey = '';       // zhj 2022-12-08 
+                    //     init.fileName = '';     // zhj 2022-12-08
+	                // }
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+
                     //if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
                     // if (notFnmListhomebuy[i].InspectionCard__c =='涓嶅嚭璇�') {
                     //     init.sj_code = '涓嶅嚭璇�';
@@ -216,43 +370,81 @@
                     // }
                     // //2022-12-05 fy add 鍟嗘璇佸垽鏂�
 
-                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard__c)) {
-	                	if (notFnmListhomebuy[i].InspectionCard__c.equals('涓嶅嚭璇�')) {
-	                		init.sj_code = '涓嶅嚭璇�';
-	                	}else{
-	                		// 鍟嗘璇侀瑙堥摼鎺ュ垽鏂�
-	                		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
-			                	init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
-			                }else{
-			                	init.sj_codeyu = '';
-			                }
-	                		// 鍟嗘璇佷笅杞介摼鎺ュ垽鏂�
-	                		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
-			                	init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
-			                }else{
-			                	init.sj_code = '';
-			                }
-                            //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 start
-                            if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
-                                init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
-                            }else{
-                                init.sj_awsKey = '';
-                            }
-                            if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
-                                init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
-                            }else{
-                                init.sj_fileName = '';
-                            }
-                            //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 end
-	                	}
-	                }else{
-	                	init.sj_code = '';
-	                	init.sj_codeyu = '';
-                        init.sj_awsKey = '';       // zhj 2022-12-19 
-                        init.sj_fileName = '';     // zhj 2022-12-19
-	                }
-                    //2022-12-26 fy add 鏀归�� end
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__c)) {
+                        // 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
+                            init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
+                        }else{
+                            init.sj_codeyu = '';
+                        }
+                        // 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
+                            init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
+                        }else{
+                            init.sj_code = '';
+                        }
+                        //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
+                            init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
+                        }else{
+                            init.sj_awsKey = '';
+                        }
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
+                            init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
+                        }else{
+                            init.sj_fileName = '';
+                        }
+                        //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+                    }else {
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_NoHave__c)) {
+                            init.sj_code = notFnmListhomebuy[i].InspectionCard_NoHave__c;
+                        }else{
+                            init.sj_code = '';
+                        }
+                        init.sj_codeyu = '';
+                        init.sj_awsKey = '';       // zhj 2022-12-08 
+                        init.sj_fileName = '';     // zhj 2022-12-08
+                    } 
 
+                    // if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard__c)) {
+	                // 	if (notFnmListhomebuy[i].InspectionCard__c.equals('涓嶅嚭璇�')) {
+	                // 		init.sj_code = '涓嶅嚭璇�';
+	                // 	}else{
+	                // 		// 鍟嗘璇侀瑙堥摼鎺ュ垽鏂�
+	                // 		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
+			        //         	init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
+			        //         }else{
+			        //         	init.sj_codeyu = '';
+			        //         }
+	                // 		// 鍟嗘璇佷笅杞介摼鎺ュ垽鏂�
+	                // 		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
+			        //         	init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
+			        //         }else{
+			        //         	init.sj_code = '';
+			        //         }
+                    //         //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 start
+                    //         if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
+                    //             init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
+                    //         }else{
+                    //             init.sj_awsKey = '';
+                    //         }
+                    //         if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
+                    //             init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
+                    //         }else{
+                    //             init.sj_fileName = '';
+                    //         }
+                    //         //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 end
+	                // 	}
+	                // }else{
+	                // 	init.sj_code = '';
+	                // 	init.sj_codeyu = '';
+                    //     init.sj_awsKey = '';       // zhj 2022-12-19 
+                    //     init.sj_fileName = '';     // zhj 2022-12-19
+	                // }
+                    // //2022-12-26 fy add 鏀归�� end
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+                    
                     // init.code = FileStrMap.get(notFnmListhomebuy[i].ApplyList__c);
                     init.Num = notFnmListhomebuy[i].Num__c;
                     init.Id = notFnmListhomebuy[i].Id;
@@ -261,7 +453,10 @@
                     // 鍒ゆ柇鏄笉鏄渶鍚庝竴涓�
                     if (i != notFnmListhomebuy.size()-1) {
                         // 涓嶆槸鏈�鍚庝竴涓紝鍒ゆ柇涓庝笅涓�涓紪鐮佷竴鑷翠笉涓�鑷达紝涓嶄竴鑷寸洿鎺ヨ祴鍊�
-                        if (notFnmListhomebuy[i].ApplyList__c != notFnmListhomebuy[i+1].ApplyList__c) {
+                         //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                        // if (notFnmListhomebuy[i].ApplyList__c != notFnmListhomebuy[i+1].ApplyList__c) {
+                        if (notFnmListhomebuy[i].ApplyList_NoHave__c != notFnmListhomebuy[i+1].ApplyList_NoHave__c) {
+                        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
                             init.count = n;
                         }
                     }
@@ -284,41 +479,80 @@
 	                // }else{
 	                // 	init.code = '鏃�';
 	                // } //2022-12-05 fy add 鎶ュ叧鍗曞垽鏂�
-                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList__c)) {
-	                	if (notFnmListhomebuy[i].ApplyList__c.equals('涓嶅嚭璇�')) {
-	                		init.code = '涓嶅嚭璇�';
-	                	}else{
-	                		// 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
-	                		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
-			                	init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
-			                }else{
-			                	init.codeyu = '';
-			                }
-	                		// 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
-	                		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
-			                	init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
-			                }else{
-			                	init.code = '';
-			                }
-                            //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
-                            if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
-                                init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
-                            }else{
-                                init.awsKey = '';
-                            }
-                            if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
-                                init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
-                            }else{
-                                init.fileName = '';
-                            }
-                            //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
-	                	}
-	                }else{
-	                	init.code = '';
-	                	init.codeyu = '';
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                    if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__c)) {
+                        // 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
+                            init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
+                        }else{
+                            init.codeyu = '';
+                        }
+                        // 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
+                            init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
+                        }else{
+                            init.code = '';
+                        }
+                        //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
+                            init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
+                        }else{
+                            init.awsKey = '';
+                        }
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
+                            init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
+                        }else{
+                            init.fileName = '';
+                        }
+                        //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+                    }else {
+                        if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_NoHave__c)){
+                            init.code = notFnmListhomebuy[i].ApplyList_NoHave__c;
+                        }else{
+                            init.code = '';
+                        }
+                        init.codeyu = '';
                         init.awsKey = '';       // zhj 2022-12-08 
                         init.fileName = '';     // zhj 2022-12-08
-	                }
+                    } 
+
+                    // if (String.isNotBlank(notFnmListhomebuy[i].ApplyList__c)) {
+	                // 	if (notFnmListhomebuy[i].ApplyList__c.equals('涓嶅嚭璇�')) {
+	                // 		init.code = '涓嶅嚭璇�';
+	                // 	}else{
+	                // 		// 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+	                // 		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c)) {
+			        //         	init.codeyu = notFnmListhomebuy[i].ApplyList_Select__r.ViewLink__c;
+			        //         }else{
+			        //         	init.codeyu = '';
+			        //         }
+	                // 		// 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+	                // 		if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c)) {
+			        //         	init.code = notFnmListhomebuy[i].ApplyList_Select__r.DownloadLink__c;
+			        //         }else{
+			        //         	init.code = '';
+			        //         }
+                    //         //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
+                    //         if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c)) {
+                    //             init.awsKey = notFnmListhomebuy[i].ApplyList_Select__r.AWS_File_Key__c;
+                    //         }else{
+                    //             init.awsKey = '';
+                    //         }
+                    //         if (String.isNotBlank(notFnmListhomebuy[i].ApplyList_Select__r.FileName__c)) {
+                    //             init.fileName = notFnmListhomebuy[i].ApplyList_Select__r.FileName__c;
+                    //         }else{
+                    //             init.fileName = '';
+                    //         }
+                    //         //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+	                // 	}
+	                // }else{
+	                // 	init.code = '';
+	                // 	init.codeyu = '';
+                    //     init.awsKey = '';       // zhj 2022-12-08 
+                    //     init.fileName = '';     // zhj 2022-12-08
+	                // }
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+                    
                     //if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
                     // if (notFnmListhomebuy[i].InspectionCard__c =='涓嶅嚭璇�') {
                     //     init.sj_code = '涓嶅嚭璇�';
@@ -329,53 +563,129 @@
                     //     init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
                     // }
                     //2022-12-05 fy add 鍟嗘璇佸垽鏂�
-                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard__c)) {
-	                	if (notFnmListhomebuy[i].InspectionCard__c.equals('涓嶅嚭璇�')) {
-	                		init.sj_code = '涓嶅嚭璇�';
-	                	}else{
-	                		// 鍟嗘璇侀瑙堥摼鎺ュ垽鏂�
-	                		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
-			                	init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
-			                }else{
-			                	init.sj_codeyu = '';
-			                }
-	                		// 鍟嗘璇佷笅杞介摼鎺ュ垽鏂�
-	                		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
-			                	init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
-			                }else{
-			                	init.sj_code = '';
-			                }
-                            //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 start
-                            if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
-                                init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
-                            }else{
-                                init.sj_awsKey = '';
-                            }
-                            if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
-                                init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
-                            }else{
-                                init.sj_fileName = '';
-                            }
-                            //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 end
-	                	}
-	                }else{
-	                	init.sj_code = '';
-	                	init.sj_codeyu = '';
-                        init.sj_awsKey = '';       // zhj 2022-12-19 
-                        init.sj_fileName = '';     // zhj 2022-12-19
-	                }
-                    //2022-12-26 fy add 鏀归�� end
+
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                    if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__c)) {
+                        // 鎶ュ叧鍗曢瑙堥摼鎺ュ垽鏂�
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
+                            init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
+                        }else{
+                            init.sj_codeyu = '';
+                        }
+                        // 鎶ュ叧鍗曚笅杞介摼鎺ュ垽鏂�
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
+                            init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
+                        }else{
+                            init.sj_code = '';
+                        }
+                        //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 start
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
+                            init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
+                        }else{
+                            init.sj_awsKey = '';
+                        }
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
+                            init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
+                        }else{
+                            init.sj_fileName = '';
+                        }
+                        //鎶ュ叧鍗昦wkey,filename鍒ゆ柇 zhj 2022-12-08 end
+                    }else {
+                        if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_NoHave__c)) {
+                            init.sj_code = notFnmListhomebuy[i].InspectionCard_NoHave__c;
+                        }else{
+                            init.sj_code = '';
+                        }
+                        init.sj_codeyu = '';
+                        init.sj_awsKey = '';       // zhj 2022-12-08 
+                        init.sj_fileName = '';     // zhj 2022-12-08
+                    } 
+
+                    // if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard__c)) {
+	                // 	if (notFnmListhomebuy[i].InspectionCard__c.equals('涓嶅嚭璇�')) {
+	                // 		init.sj_code = '涓嶅嚭璇�';
+	                // 	}else{
+	                // 		// 鍟嗘璇侀瑙堥摼鎺ュ垽鏂�
+	                // 		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c)) {
+			        //         	init.sj_codeyu = notFnmListhomebuy[i].InspectionCard_Select__r.ViewLink__c;
+			        //         }else{
+			        //         	init.sj_codeyu = '';
+			        //         }
+	                // 		// 鍟嗘璇佷笅杞介摼鎺ュ垽鏂�
+	                // 		if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c)) {
+			        //         	init.sj_code = notFnmListhomebuy[i].InspectionCard_Select__r.DownloadLink__c;
+			        //         }else{
+			        //         	init.sj_code = '';
+			        //         }
+                    //         //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 start
+                    //         if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c)) {
+                    //             init.sj_awsKey = notFnmListhomebuy[i].InspectionCard_Select__r.AWS_File_Key__c;
+                    //         }else{
+                    //             init.sj_awsKey = '';
+                    //         }
+                    //         if (String.isNotBlank(notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c)) {
+                    //             init.sj_fileName = notFnmListhomebuy[i].InspectionCard_Select__r.FileName__c;
+                    //         }else{
+                    //             init.sj_fileName = '';
+                    //         }
+                    //         //鍟嗘璇乤wkey,filename鍒ゆ柇 zhj 2022-12-19 end
+	                // 	}
+	                // }else{
+	                // 	init.sj_code = '';
+	                // 	init.sj_codeyu = '';
+                    //     init.sj_awsKey = '';       // zhj 2022-12-19 
+                    //     init.sj_fileName = '';     // zhj 2022-12-19
+	                // }
+                    // //2022-12-26 fy add 鏀归�� end
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
 
                     // init.code = FileStrMap.get(notFnmListhomebuy[i].ApplyList__c);
                     init.Num = notFnmListhomebuy[i].Num__c;
                     init.Id = notFnmListhomebuy[i].Id;
                     init.FrameNo = notFnmListhomebuy[i].SerialNumber__c;
                     n = n+1;
-                    if((i<notFnmListhomebuy.size()-1 && notFnmListhomebuy[i].ApplyList__c != notFnmListhomebuy[i+1].ApplyList__c)||(i == notFnmListhomebuy.size()-1)){
+
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                    // if((i<notFnmListhomebuy.size()-1 && notFnmListhomebuy[i].ApplyList__c != notFnmListhomebuy[i+1].ApplyList__c)||(i == notFnmListhomebuy.size()-1)){
+                    if((i<notFnmListhomebuy.size()-1 && notFnmListhomebuy[i].ApplyList_NoHave__c != notFnmListhomebuy[i+1].ApplyList_NoHave__c)||(i == notFnmListhomebuy.size()-1)){
+                    //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+
                       init.count =n;
                     }
                 System.debug('init3===='+init);
                 }
+                // 2023-01-10   fy   add   start   鍟嗘璇佹帓搴忓悎骞�
+                //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                // if (notFnmListhomebuy[i].InspectionCard__c == notFnmListhomebuy[i-1].InspectionCard__c) {
+                if (notFnmListhomebuy[i].InspectionCard_NoHave__c == notFnmListhomebuy[i-1].InspectionCard_NoHave__c) {
+                //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+                    n_sj = n_sj+1;
+                    if (i != notFnmListhomebuy.size()-1) {
+                        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                        // if (notFnmListhomebuy[i].InspectionCard__c != notFnmListhomebuy[i+1].InspectionCard__c) {
+                        if (notFnmListhomebuy[i].InspectionCard_NoHave__c != notFnmListhomebuy[i+1].InspectionCard_NoHave__c) {
+                        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+                            init.count_sj = n_sj;
+                        }
+                    }else{
+                        init.count_sj = n_sj;
+                    }
+
+                }else{
+                    n_sj = 0;
+                    n_sj = n_sj+1;
+                    if (i == notFnmListhomebuy.size()-1) {
+                        init.count_sj = n_sj;
+                    }else{
+                        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+                        // if (notFnmListhomebuy[i].InspectionCard__c != notFnmListhomebuy[i+1].InspectionCard__c) {
+                            if (notFnmListhomebuy[i].InspectionCard_NoHave__c != notFnmListhomebuy[i+1].InspectionCard_NoHave__c) {
+                        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
+                            init.count_sj = n_sj;
+                        }
+                    }
+                }
+                // 2023-01-10   fy   add   end   鍟嗘璇佹帓搴忓悎骞�
             }
             //zhj 濡傛灉鏄痚SignSystem闇�瑕佸姞涓婅繖涓墠缂�閾炬帴  2023-01-04 start
             if(bool){
@@ -386,19 +696,21 @@
             //zhj 濡傛灉鏄痚SignSystem闇�瑕佸姞涓婅繖涓墠缂�閾炬帴  2023-01-04 end
             initList.add(init);
         }
-        List<testInit> newinitListhomebuy = new List<testInit>();
-        for(FrameNumManage__c fr : FnmListhomebuy){
-            testInit init = new testInit();
-            init.Name=fr.ManagementCode__c;
-            init.ProductName=fr.Material__c + '-' + fr.MaterialDepict__c;
-            init.FrameNo=fr.SerialNumber__c;
-            init.code='鍥藉唴閲囪喘';
-            init.sj_code='鍥藉唴閲囪喘';
-            init.Num=fr.Num__c;
-            init.Id=fr.Id;
-            init.count=1;
-            newinitListhomebuy.add(init);
-        }
+         //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+        // List<testInit> newinitListhomebuy = new List<testInit>();
+        // for(FrameNumManage__c fr : FnmListhomebuy){
+        //     testInit init = new testInit();
+        //     init.Name=fr.ManagementCode__c;
+        //     init.ProductName=fr.Material__c + '-' + fr.MaterialDepict__c;
+        //     init.FrameNo=fr.SerialNumber__c;
+        //     init.code='鍥藉唴閲囪喘';
+        //     init.sj_code='鍥藉唴閲囪喘';
+        //     init.Num=fr.Num__c;
+        //     init.Id=fr.Id;
+        //     init.count=1;
+        //     newinitListhomebuy.add(init);
+        // }
+        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
         // 鍊掑簭鏄剧ず
         for (Integer i = initList.size()-1; i>=0 ; i--) {
             testInit init = new testInit();
@@ -406,11 +718,13 @@
             newinitList.add(init);
         }
          // newinitList.addAll(newinitListhomebuy);
-         newinitListhomebuy.addAll(newinitList);
-         newinitList=newinitListhomebuy;
+        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 start
+        //  newinitListhomebuy.addAll(newinitList);
+        //  newinitList=newinitListhomebuy;
+        //2023 0208 fy add   鎶ュ叧鍗曞晢妫�璇佹柊闇�姹傦紝閲嶆柊鍒ゆ柇 end
         System.debug('newinitList'+newinitList);
         System.debug('FnmList'+FnmList);
-        System.debug('newinitListhomebuy'+newinitListhomebuy);
+        // System.debug('newinitListhomebuy'+newinitListhomebuy);
         return newinitList;
 
     }
@@ -439,6 +753,8 @@
         @AuraEnabled
         public Integer count;
         @AuraEnabled
+        public Integer count_sj;//2023-01-10 fy add 鍟嗘璇佸崟鐙悎骞�
+        @AuraEnabled
         public String awsKey;
         @AuraEnabled          
         public String fileName;

--
Gitblit v1.9.1