From c39b6196509ee07d5799cd2a6611700995948f5b Mon Sep 17 00:00:00 2001
From: patrick.xu <patrick.xu@broconcentric.com>
Date: 星期三, 29 十二月 2021 14:23:45 +0800
Subject: [PATCH] 抽样时日期比对添加年数配置修改

---
 SizeDetection.cs |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/SizeDetection.cs b/SizeDetection.cs
index 5a5e868..df03200 100644
--- a/SizeDetection.cs
+++ b/SizeDetection.cs
@@ -656,8 +656,25 @@
         {
             GregorianCalendar gc = new GregorianCalendar();
             int weekOfYear = gc.GetWeekOfYear(dt, CalendarWeekRule.FirstDay, DayOfWeek.Monday);
+
+            var weekPlusStr = ConfigurationManager.AppSettings["WeekPlus"];
+            int weekPlus = 0;
+            if (!int.TryParse(weekPlusStr, out weekPlus))
+            {
+                weekPlus = 0;
+            }
+            weekOfYear += weekPlus;
             string week = weekOfYear.ToString().Length == 1 ? "0" + weekOfYear.ToString() : weekOfYear.ToString();
+
+            var yearPlusStr = ConfigurationManager.AppSettings["YearPlus"];
+            int yearPlus = 0;
+            if (!int.TryParse(yearPlusStr, out yearPlus))
+            {
+                yearPlus = 0;
+            }
             string year = dt.Year.ToString().Substring(dt.Year.ToString().Length - 1, 1);
+            year = (int.Parse(year) + yearPlus).ToString();
+
             return year + week;
         }
     }

--
Gitblit v1.8.0