From fa01cf80171eb10c7f1b4f1764376397b714c526 Mon Sep 17 00:00:00 2001
From: 高章伟 <gaozhangwei@prec-tech.com>
Date: 星期二, 28 三月 2023 15:22:55 +0800
Subject: [PATCH] ET产品-效期修改

---
 force-app/main/default/classes/NFM110Rest.cls |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/force-app/main/default/classes/NFM110Rest.cls b/force-app/main/default/classes/NFM110Rest.cls
index 0af0ae8..202903c 100644
--- a/force-app/main/default/classes/NFM110Rest.cls
+++ b/force-app/main/default/classes/NFM110Rest.cls
@@ -780,7 +780,15 @@
 								rac.Deliver_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
 								rac.Arrive_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
 								rac.Used_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
+								// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� start
+								if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8
+											&& Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) {
+									rac.Sterilization_limit__c = null;
+								}else{
 								rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+								}
+								// rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+								// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� end
 								rac.Consumable_product__c     = prdSearch.Id;
 								rac.Bar_Code__c               = dnInfo.Barcode;
 								rac.Used_account__c           = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c);
@@ -936,7 +944,15 @@
 										rac.Deliver_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
 										rac.Arrive_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
 										rac.Used_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
+										// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� start
+										if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8
+													&& Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) {
+											rac.Sterilization_limit__c = null;
+										}else{
 										rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+										}
+										// rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+										// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� end
 										rac.Consumable_product__c     = prdSearch.Id;
 										rac.Bar_Code__c               = dnInfo.Barcode;
 										rac.Used_account__c           = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c);
@@ -1052,7 +1068,15 @@
 							// update by vivek srart 2020-02-13
 							// orderdetInfo.Account_province_txt__c = accsMap.get(infoH.EndUserNo).OCM_man_province_txt__c;
 							// update by vivek end 2020-02-13
+							// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� start
+							if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8
+										&& Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) {
+								orderdetInfo.Sterilization_limit__c = null;
+							}else{
 							orderdetInfo.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+							}
+							// orderdetInfo.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+							// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� end
 							//orderdetInfo.Bar_Code__c               = dnInfo.Barcode;
 							orderdetInfo.DeliveryNote__c           = infoH.DeliveryNote;
 							// update by Gaozw start 20200514
@@ -1247,7 +1271,15 @@
 							rac.Asset_Model_No__c         = prdSearch.Asset_Model_No__c;
 							rac.Consumable_order_minor__c = order.Id;
 							rac.Deliver_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
+							// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� start
+							if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8
+										&& Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) {
+								rac.Sterilization_limit__c = null;
+							}else{
 							rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+							}
+							// 	rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+							// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� end
 							rac.Consumable_product__c     = prdSearch.Id;
 							rac.Bar_Code__c               = dnInfo.Barcode;
 							rac.Used_account__c           = accsMap.get(infoH.EndUserNo).Id;
@@ -1611,7 +1643,15 @@
 						}
 						rac.Asset_Model_No__c         = prdSearch.Asset_Model_No__c;
 						rac.Deliver_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
+						// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� start
+						if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8
+									&& Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) {
+							rac.Sterilization_limit__c = null;
+						}else{
 						rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+						}
+						// rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+						// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� end
 						rac.Consumable_product__c     = prdSearch.Id;
 						rac.Bar_Code__c               = dnInfo.Barcode;
 						rac.Used_account__c           = accsMap.get(infoH.EndUserNo).Id;
@@ -1918,7 +1958,15 @@
 						rac.Deliver_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
 						rac.Arrive_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
 						rac.Used_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
+						// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� start
+						if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8
+									&& Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) {
+							rac.Sterilization_limit__c = null;
+						}else{
 						rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+						}
+						// rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+						// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� end
 						rac.Consumable_product__c     = prdSearch.Id;
 						rac.Bar_Code__c               = dnInfo.Barcode;
 						rac.Used_account__c           = addressNameApiMap.get(oppMap.get(InquiryNoStr).SAP_Province__c);
@@ -2274,7 +2322,15 @@
 						// rac.Arrive_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
 						// rac.Used_date__c           = NFMUtil.parseStr2Date(infoH.DeliveryDate);
 						// 鑷姩淇敼鏈�缁堢敤鎴� update by vivek end
+						// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� start
+						if (dnInfo.ValidTo !=null && dnInfo.ValidTo.length() == 8
+									&& Integer.valueOf(dnInfo.ValidTo.substring(0, 4)) <= Integer.valueOf(Date.today().Year())) {
+							rac.Sterilization_limit__c = null;
+						}else{
 						rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+						}
+						// rac.Sterilization_limit__c    = NFMUtil.parseStr2Date(dnInfo.ValidTo);
+						// gzw DB202301244151 淇濅慨鏈熼檺楠岃瘉鏃ユ湡鍙鎬ц皟鏁� end
 						rac.Consumable_product__c     = prdSearch.Id;
 						rac.Bar_Code__c               = dnInfo.Barcode;
 						rac.Used_account__c           = oppMap.get(InquiryNoStr).Agency1__c;

--
Gitblit v1.9.1