Bläddra i källkod

1、添加批量更新数据策略:从报表中获取最新的报表,然后更新绩效系统中的数据,如果报表中没有,还是从维德系统中获取数据更新,以此来减少访问维德系统的次数来减少更新时间
2、修改从维德系统中获取案件信息代码,案号只给前面的部分,避免流程那边修改了案号的后缀导致检索不到的问题

luocaiyang 3 veckor sedan
förälder
incheckning
a9913b4152

+ 1 - 1
wispro.sp.api/Controllers/SystemDataController.cs

@@ -24,7 +24,7 @@ namespace wispro.sp.api.Controllers
 
         public ApiSaveResponse UpdateJXData()
         {
-            System.Threading.Tasks.Task.Run(() => new UpdateJXDataFromIPEasyJob().Execute(null));
+            System.Threading.Tasks.Task.Run(() => new BatchUpdateJXDataJob().Execute(null));
 
             return new ApiSaveResponse()
             {

+ 445 - 0
wispro.sp.api/Job/BatchUpdateJXDataJob.cs

@@ -0,0 +1,445 @@
+using Microsoft.EntityFrameworkCore;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+using wispro.sp.entity;
+using wispro.sp.utility;
+
+namespace wispro.sp.api.Job
+{
+    /// <summary>
+    /// 批量更新绩效数据任务
+    /// 先从IPEasy批量下载报表数据,然后与本月数据比对更新
+    /// 对于报表中不存在的记录,再使用网页抓取方式单独更新
+    /// </summary>
+    public class BatchUpdateJXDataJob : IJob
+    {
+        private spDbContext spDb = new spDbContext();
+
+        string strLogFile = null;
+        public Task Execute(IJobExecutionContext context)
+        {
+            strLogFile = null;
+            Log($"{DateTime.Now}\t批量更新任务开始");
+
+            try
+            {
+                // 1. 获取本月需要更新的绩效记录
+                var lstItem = spDb.PerformanceItems.Where<PerformanceItem>(p =>
+                    ((p.AgentFeedbackMemo != "已算绩效" || p.AgentFeedbackMemo == null)
+                        && p.CalMonth.Status == 0 &&
+                        !p.CaseNo.StartsWith("J")))
+                    .Include(p => p.Reviewer)
+                    .Include(p => p.CalMonth)
+                    .Include(p => p.Customer)
+                    .Include(p => p.ItemStaffs).ThenInclude(p => p.DoPerson)
+                    .ToList<PerformanceItem>();
+
+                if (lstItem == null || lstItem.Count == 0)
+                {
+                    Log($"{DateTime.Now}\t没有需要更新的数据");
+                    return Task.CompletedTask;
+                }
+
+                Log($"{DateTime.Now}\t共需要更新 {lstItem.Count} 条记录");
+
+                // 2. 从IPEasy批量下载报表数据(两个报表)
+                DataTable batchData1 = null;
+                DataTable batchData2 = null;
+                
+                try
+                {
+                    Log($"{DateTime.Now}\t开始从IPEasy下载批量报表数据【每月绩效统计--上个月递交完成案件】...");
+                    batchData1 = IPEasyUtility.DownloadReport("每月绩效统计--上个月递交完成案件", true);
+                    
+                    if (batchData1 != null && batchData1.Rows.Count > 0)
+                    {
+                        Log($"{DateTime.Now}\t报表1下载成功,共 {batchData1.Rows.Count} 条数据");
+                    }
+                    else
+                    {
+                        Log($"{DateTime.Now}\t报表1下载失败或无数据");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    Log($"{DateTime.Now}\t报表1下载异常: {ex.Message}");
+                }
+
+                try
+                {
+                    Log($"{DateTime.Now}\t开始从IPEasy下载批量报表数据【每月绩效统计--中国一次OA授权表】...");
+                    batchData2 = IPEasyUtility.DownloadReport("每月绩效统计--中国一次OA授权表", true);
+                    
+                    if (batchData2 != null && batchData2.Rows.Count > 0)
+                    {
+                        Log($"{DateTime.Now}\t报表2下载成功,共 {batchData2.Rows.Count} 条数据");
+                    }
+                    else
+                    {
+                        Log($"{DateTime.Now}\t报表2下载失败或无数据");
+                    }
+                }
+                catch (Exception ex)
+                {
+                    Log($"{DateTime.Now}\t报表2下载异常: {ex.Message}");
+                }
+
+                // 3. 合并两个报表数据到统一字典
+                Dictionary<string, DataRow> batchDataDict = new Dictionary<string, DataRow>();
+                
+                // 3.1 处理报表1数据
+                if (batchData1 != null && batchData1.Rows.Count > 0)
+                {
+                    foreach (DataRow row in batchData1.Rows)
+                    {
+                        try
+                        {
+                            string caseNo = row["我方文号"].ToString().Trim();
+                            string doItem = row["处理事项"].ToString().Trim();
+                            string key = $"{caseNo}|{doItem}";
+                            batchDataDict[key] = row;
+                        }
+                        catch { }
+                    }
+                    Log($"{DateTime.Now}\t报表1数据已加入索引,当前共 {batchDataDict.Count} 个唯一案件");
+                }
+
+                // 3.2 处理报表2数据(中国一次OA授权表)
+                if (batchData2 != null && batchData2.Rows.Count > 0)
+                {
+                    foreach (DataRow row in batchData2.Rows)
+                    {
+                        try
+                        {
+                            string caseNo = row["我方文号"].ToString().Trim();
+                            // 一次OA授权表的处理事项固定为"发明一次OA授权"
+                            string doItem = "发明一次OA授权";
+                            string key = $"{caseNo}|{doItem}";
+                            batchDataDict[key] = row;
+                        }
+                        catch { }
+                    }
+                    Log($"{DateTime.Now}\t报表2数据已加入索引,当前共 {batchDataDict.Count} 个唯一案件");
+                }
+
+                Log($"{DateTime.Now}\t批量数据索引创建完成,总共 {batchDataDict.Count} 个唯一案件");
+
+                // 4. 逐条处理绩效记录
+                int totalCount = lstItem.Count;
+                int batchMatchCount = 0;
+                int singleFetchCount = 0;
+                int errorCount = 0;
+
+                for (int i = 0; i < totalCount; i++)
+                {
+                    var item = lstItem[i];
+
+                    //调查案不更新
+                    if (item.CaseNo.Trim().StartsWith("S"))
+                    {
+                        Log($"{DateTime.Now}\t[{i + 1}/{totalCount}]\t{item.CaseNo}\t专案忽略!");
+                        continue;
+                    }
+
+                    System.Threading.Thread.Sleep(100);
+
+                    try
+                    {
+                        string key = $"{item.CaseNo}|{item.DoItem}";
+                        bool updated = false;
+
+                        // 先尝试从批量数据中匹配
+                        if (batchDataDict.ContainsKey(key))
+                        {
+                            try
+                            {
+                                DataRow matchedRow = batchDataDict[key];
+                                UpdateFromDataRow(item, matchedRow, spDb);
+                                batchMatchCount++;
+                                updated = true;
+                                Log($"{DateTime.Now}\t[{i + 1}/{totalCount}]\t{item.CaseNo}\t批量匹配成功");
+                            }
+                            catch (Exception ex)
+                            {
+                                Log($"{DateTime.Now}\t[{i + 1}/{totalCount}]\t{item.CaseNo}\t批量更新失败: {ex.Message},尝试单条抓取");
+                            }
+                        }
+
+                        // 如果批量匹配失败,使用单条抓取
+                        if (!updated)
+                        {
+                            int iTryCount = 0;
+                        TryAgain:
+                            try
+                            {
+                                iTryCount++;
+                                UpdateFromIPEasy(item, spDb);
+                                singleFetchCount++;
+                                Log($"{DateTime.Now}\t[{i + 1}/{totalCount}]\t{item.CaseNo}\t单条抓取成功");
+                            }
+                            catch (Exception ex)
+                            {
+                                if (iTryCount <= 3)
+                                {
+                                    goto TryAgain;
+                                }
+                                errorCount++;
+                                Log($"{DateTime.Now}\t[{i + 1}/{totalCount}]\t{item.CaseNo}\t更新失败: {ex.Message}");
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        errorCount++;
+                        Log($"{DateTime.Now}\t[{i + 1}/{totalCount}]\t{item.CaseNo}\t处理异常: {ex.Message}");
+                    }
+                }
+
+                // 5. 输出统计信息
+                Log($"{DateTime.Now}\t批量更新任务完成");
+                Log($"{DateTime.Now}\t总记录数: {totalCount}");
+                Log($"{DateTime.Now}\t批量匹配更新: {batchMatchCount} ({(batchMatchCount * 100.0 / totalCount):F2}%)");
+                Log($"{DateTime.Now}\t单条抓取更新: {singleFetchCount} ({(singleFetchCount * 100.0 / totalCount):F2}%)");
+                Log($"{DateTime.Now}\t更新失败: {errorCount} ({(errorCount * 100.0 / totalCount):F2}%)");
+            }
+            catch (Exception ex)
+            {
+                Log($"{DateTime.Now}\t批量更新任务异常: {ex.ToString()}");
+            }
+
+            return Task.CompletedTask;
+        }
+
+        /// <summary>
+        /// 从DataRow更新绩效记录(批量数据)
+        /// </summary>
+        private void UpdateFromDataRow(PerformanceItem item, DataRow row, spDbContext spDb)
+        {
+            var appealAJXS = spDb.AppealTypes.FirstOrDefault(p => p.Name.Contains("案件系数"));
+            var appealCLSXXS = spDb.AppealTypes.FirstOrDefault(p => p.Name.Contains("处理事项系数"));
+            var caseXS = (spDb.AppealRecords.FirstOrDefault(p => p.ItemId == item.Id && p.TypeId == appealAJXS.Id && p.State == 1) == null);
+            var doItemXS = (spDb.AppealRecords.FirstOrDefault(p => p.ItemId == item.Id && p.TypeId == appealCLSXXS.Id && p.State == 1) == null);
+
+            // 处理事项系数
+            if (row.Table.Columns.Contains("处理事项系数") && doItemXS)
+            {
+                string doItemCoef = row["处理事项系数"].ToString().Trim();
+                if (!string.IsNullOrEmpty(doItemCoef) && item.DoItemCoefficient != doItemCoef)
+                {
+                    item.DoItemCoefficient = doItemCoef;
+                }
+            }
+
+            // 翻译字数
+            if (row.Table.Columns.Contains("翻译字数"))
+            {
+                string wordCountStr = row["翻译字数"].ToString().Trim();
+                if (!string.IsNullOrEmpty(wordCountStr))
+                {
+                    if (int.TryParse(wordCountStr, out int wordCount))
+                    {
+                        if (wordCount != item.WordCount)
+                        {
+                            item.WordCount = wordCount;
+                        }
+                    }
+                }
+            }
+
+            // 核稿人
+            if (row.Table.Columns.Contains("案件核稿人"))
+            {
+                string reviewer = row["案件核稿人"].ToString().Trim();
+                if (!string.IsNullOrEmpty(reviewer) && (item.Reviewer == null || item.Reviewer.Name != reviewer))
+                {
+                    string temName = reviewer.Split('-')[0].Trim();
+                    if (!reviewer.Contains("君龙"))
+                    {
+                        temName = reviewer;
+                    }
+                    var temReviewer = spDb.Staffs.Where<Staff>(s => s.Name == temName).FirstOrDefault();
+                    if (temReviewer != null)
+                    {
+                        item.ReviewerId = temReviewer.Id;
+                    }
+                }
+            }
+
+            // 申请类型
+            if (row.Table.Columns.Contains("申请类型"))
+            {
+                string applicationType = row["申请类型"].ToString().Trim();
+                if (!string.IsNullOrEmpty(applicationType) && item.ApplicationType != applicationType)
+                {
+                    item.ApplicationType = applicationType;
+                }
+            }
+
+            // 案件系数
+            if (row.Table.Columns.Contains("案件系数") && caseXS)
+            {
+                string caseCoef = row["案件系数"].ToString().Trim();
+                if (!string.IsNullOrEmpty(caseCoef) && item.CaseCoefficient != caseCoef)
+                {
+                    item.CaseCoefficient = caseCoef;
+                }
+            }
+
+            // 案件类型
+            if (row.Table.Columns.Contains("案件类型"))
+            {
+                string caseType = row["案件类型"].ToString().Trim();
+                if (!string.IsNullOrEmpty(caseType) && item.CaseType != caseType)
+                {
+                    item.CaseType = caseType;
+                }
+            }
+
+            // 案件阶段
+            if (row.Table.Columns.Contains("案件阶段"))
+            {
+                string caseStage = row["案件阶段"].ToString().Trim();
+                if (!string.IsNullOrEmpty(caseStage) && item.CaseStage != caseStage)
+                {
+                    item.CaseStage = caseStage;
+                }
+            }
+
+            // 如果有变化,重新计算绩效点
+            if (spDb.Entry(item).State != EntityState.Unchanged)
+            {
+                if (item.AgentFeedbackMemo != "特殊点数申诉")
+                {
+                    new Controllers.PerformanceItemController(spDb, new Services.FileTaskCacheService()).RefreshPoint(item);
+                }
+                else
+                {
+                    // 特殊点数申诉:只保存字段更新,不重算点数
+                    spDb.SaveChanges();
+                }
+            }
+        }
+
+        /// <summary>
+        /// 从IPEasy单条抓取更新(网页抓取)
+        /// </summary>
+        private void UpdateFromIPEasy(PerformanceItem item, spDbContext spDb)
+        {
+            dynamic retObj = IPEasyUtility.GetPerformanceRecord(item.CaseNo, item.DoItem, item.CaseStage);
+
+            var appealAJXS = spDb.AppealTypes.FirstOrDefault(p => p.Name.Contains("案件系数"));
+            var appealCLSXXS = spDb.AppealTypes.FirstOrDefault(p => p.Name.Contains("处理事项系数"));
+            var caseXS = (spDb.AppealRecords.FirstOrDefault(p => p.ItemId == item.Id && p.TypeId == appealAJXS.Id && p.State == 1) == null);
+            var doItemXS = (spDb.AppealRecords.FirstOrDefault(p => p.ItemId == item.Id && p.TypeId == appealCLSXXS.Id && p.State == 1) == null);
+
+            IDictionary<String, Object> keyValuePairs = (IDictionary<String, Object>)retObj;
+
+            if (keyValuePairs.ContainsKey("DoItemCoefficient") && item.DoItemCoefficient != retObj.DoItemCoefficient && doItemXS)
+            {
+                item.DoItemCoefficient = retObj.DoItemCoefficient;
+            }
+
+            if (keyValuePairs.ContainsKey("WordCount"))
+            {
+                if (!string.IsNullOrEmpty(retObj.WordCount))
+                {
+                    var wordCount = int.Parse(retObj.WordCount);
+                    if (wordCount != item.WordCount)
+                        item.WordCount = wordCount;
+                }
+            }
+
+            if (keyValuePairs.ContainsKey("Reviewer") && (item.Reviewer == null || item.Reviewer.Name != retObj.Reviewer) && !string.IsNullOrEmpty(retObj.Reviewer))
+            {
+                string name = retObj.Reviewer;
+                if (!string.IsNullOrEmpty(name))
+                {
+                    string temName = name.Split('-')[0].Trim();
+                    if (!name.Contains("君龙"))
+                    {
+                        temName = name;
+                    }
+                    var temReviewer = spDb.Staffs.Where<Staff>(s => s.Name == temName).FirstOrDefault();
+                    if (temReviewer != null)
+                    {
+                        item.ReviewerId = temReviewer.Id;
+                    }
+                }
+            }
+
+            if (keyValuePairs.ContainsKey("ExternalHandler") && (item.ExternalHandler == null || item.ExternalHandler.Name != retObj.ExternalHandler) && !string.IsNullOrEmpty(retObj.ExternalHandler))
+            {
+                string name = retObj.ExternalHandler;
+                if (!string.IsNullOrEmpty(name))
+                {
+                    string temName = name.Split('-')[0].Trim();
+                    if (!name.Contains("君龙"))
+                    {
+                        temName = name;
+                    }
+                    var temExternalHandler = spDb.Staffs.Where<Staff>(s => s.Name == temName).FirstOrDefault();
+                    if (temExternalHandler != null)
+                    {
+                        item.ExternalHandlerId = temExternalHandler.Id;
+                    }
+                }
+            }
+
+            if (keyValuePairs.ContainsKey("ApplicationType") && item.ApplicationType != retObj.ApplicationType && !string.IsNullOrEmpty(retObj.ApplicationType))
+            {
+                item.ApplicationType = retObj.ApplicationType;
+            }
+
+            if (keyValuePairs.ContainsKey("CaseCoefficient") && item.CaseCoefficient != retObj.CaseCoefficient && caseXS)
+            {
+                if (!(retObj.CaseCoefficient == null && string.IsNullOrEmpty(item.CaseCoefficient)))
+                    item.CaseCoefficient = retObj.CaseCoefficient;
+            }
+
+            if (keyValuePairs.ContainsKey("CaseType") && item.CaseType != retObj.CaseType && !string.IsNullOrEmpty(retObj.CaseType))
+            {
+                item.CaseType = retObj.CaseType;
+            }
+
+            if (keyValuePairs.ContainsKey("CaseStage") && item.CaseStage != retObj.CaseStage && !string.IsNullOrEmpty(retObj.CaseStage))
+            {
+                item.CaseStage = retObj.CaseStage;
+            }
+
+            if (spDb.Entry(item).State != EntityState.Unchanged)
+            {
+                if (item.AgentFeedbackMemo != "特殊点数申诉")
+                {
+                    new Controllers.PerformanceItemController(spDb, new Services.FileTaskCacheService()).RefreshPoint(item);
+                }
+                else
+                {
+                    // 特殊点数申诉:只保存字段更新,不重算点数
+                    spDb.SaveChanges();
+                }
+            }
+        }
+
+        private void Log(string strMessage)
+        {
+            try
+            {
+                if(string.IsNullOrEmpty(strLogFile))
+                {
+                    strLogFile = $"c:\\temp\\{DateTime.Now.ToString("yyyyMMdd")}-Batch_Update_log.txt";
+                }
+                StreamWriter sw = File.AppendText(strLogFile);
+                sw.WriteLine($"{strMessage}");
+                sw.Flush();
+                sw.Close();
+                sw.Dispose();
+            }
+            catch { }
+        }
+    }
+}

+ 6 - 1
wispro.sp.api/Job/UpdateJXDataFromIPEasyJob.cs

@@ -1,4 +1,4 @@
-using Microsoft.Data.SqlClient;
+using Microsoft.Data.SqlClient;
 using Microsoft.EntityFrameworkCore;
 using Newtonsoft.Json.Schema;
 using Quartz;
@@ -404,6 +404,11 @@ namespace wispro.sp.api.Job
                 {
                     new Controllers.PerformanceItemController(spDb, new Services.FileTaskCacheService()).RefreshPoint(Item);
                 }
+                else
+                {
+                    // 特殊点数申诉:只保存字段更新,不重算点数
+                    spDb.SaveChanges();
+                }
             }
 
         }

+ 15 - 15
wispro.sp.api/Program.cs

@@ -27,11 +27,11 @@ namespace wispro.sp.api
 
                     if (result)
                     {
-                        System.Diagnostics.Debug.Write("数据库创建成功!");
+                        System.Diagnostics.Debug.Write("鏁版嵁搴撳垱寤烘垚鍔燂紒");
                     }
                     else
                     {
-                        System.Diagnostics.Debug.Write("数据库创建失败!");
+                        System.Diagnostics.Debug.Write("鏁版嵁搴撳垱寤哄け璐ワ紒");
                     }
 
                 }
@@ -42,10 +42,10 @@ namespace wispro.sp.api
                 }
             }
 
-            #region 每月获取绩效数据Job
+            #region 姣忔湀鑾峰彇缁╂晥鏁版嵁Job
             JobKey jobKey = new JobKey("ImportReportData");
             var trigger = TriggerBuilder.Create()
-                .WithDescription("导入每月报表")
+                .WithDescription("瀵煎叆姣忔湀鎶ヨ〃")
                 .WithSchedule(CronScheduleBuilder.CronSchedule(utility.ConfigHelper.GetSectionValue("IPEasySetting:ScheduleSetting")).WithMisfireHandlingInstructionDoNothing())
                 .Build();
 
@@ -53,10 +53,10 @@ namespace wispro.sp.api
             _ = QuartzUtil.Add(typeof(ImportReportJob), jobKey, trigger);
             #endregion
 
-            #region 每月获取绩效数据Job
+            #region 姣忔湀鑾峰彇缁╂晥鏁版嵁Job
             JobKey jobProject = new JobKey("ImportProject");
             var triggerProject = TriggerBuilder.Create()
-                .WithDescription("同步专案信息")
+                .WithDescription("鍚屾�涓撴�淇℃伅")
                 .WithSchedule(CronScheduleBuilder.CronSchedule(utility.ConfigHelper.GetSectionValue("ImportProjectScheduleSetting")).WithMisfireHandlingInstructionDoNothing())
                 .Build();
 
@@ -64,20 +64,20 @@ namespace wispro.sp.api
             _ = QuartzUtil.Add(typeof(ImportProjectInfoJob), jobProject, triggerProject);
             #endregion
 
-            #region 每天更新绩效数据
+            #region 姣忓ぉ鏇存柊缁╂晥鏁版嵁
             JobKey jobKey1 = new JobKey("UpdateSchedule");
             var trigger1 = TriggerBuilder.Create()
-                .WithDescription("更新绩效数据")
+                .WithDescription("鎵归噺鏇存柊缁╂晥鏁版嵁")
                 .WithSchedule(CronScheduleBuilder.CronSchedule(utility.ConfigHelper.GetSectionValue("UpdateScheduleSetting")).WithMisfireHandlingInstructionDoNothing())
                 .Build();
 
 
-            _ = QuartzUtil.Add(typeof(UpdateJXDataFromIPEasyJob), jobKey1, trigger1);
+            _ = QuartzUtil.Add(typeof(BatchUpdateJXDataJob), jobKey1, trigger1);
             #endregion
-            #region 疑似绩效数据通知
+            #region 鐤戜技缁╂晥鏁版嵁閫氱煡
             JobKey jobKey2 = new JobKey("InvalidData");
             var trigger2 = TriggerBuilder.Create()
-                .WithDescription("疑似绩效数据通知")
+                .WithDescription("鐤戜技缁╂晥鏁版嵁閫氱煡")
                 .WithSchedule(CronScheduleBuilder.CronSchedule(utility.ConfigHelper.GetSectionValue("InvalidDataScheduleSetting")).WithMisfireHandlingInstructionDoNothing())
                 .Build();
 
@@ -85,20 +85,20 @@ namespace wispro.sp.api
             _ = QuartzUtil.Add(typeof(InvalidDataMessageJob), jobKey2, trigger2);
             #endregion
 
-            #region 通知代理人反馈
+            #region 通知代理人反馈
             JobKey jobKey3 = new JobKey("AgentMessage");
             var trigger3 = TriggerBuilder.Create()
-                .WithDescription("通知代理人开始反馈")
+                .WithDescription("通知代理人开始反馈")
                 .WithSchedule(CronScheduleBuilder.CronSchedule(utility.ConfigHelper.GetSectionValue("AgentMessageScheduleSetting")).WithMisfireHandlingInstructionDoNothing())
                 .Build();
 
             _ = QuartzUtil.Add(typeof(AgentMessageJob), jobKey3, trigger3);
             #endregion
 
-            #region 每天计算绩效数据
+            #region 姣忓ぉ璁$畻缁╂晥鏁版嵁
             JobKey jobCalJX = new JobKey("jobCalJX");
             var triggerCalJX = TriggerBuilder.Create()
-                .WithDescription("绩效数据计算")
+                .WithDescription("缁╂晥鏁版嵁璁$畻")
                 .WithSchedule(CronScheduleBuilder.CronSchedule("0 30 5 * * ?").WithMisfireHandlingInstructionDoNothing())
                 .Build();
 

+ 1 - 1
wispro.sp.api/appsettings.json

@@ -30,7 +30,7 @@
     "isHeadless": "false",
     "Account": "caiyangl",
     "Password": "j)wx*lier*@3",
-    "ChormeDriverPath": "e:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\133.0.6943.126",
+    "ChormeDriverPath": "e:\\source\\repos\\StaffPerformance\\packages\\ChormeDriver\\142",
     "ScheduleSetting": "00 55 15 16 * ? *",
     "IPEasyWeb": "http://47.106.94.35/Login.aspx"
   },

+ 6 - 3
wispro.sp.utility/IPEasyUtility.cs

@@ -1726,6 +1726,9 @@ namespace wispro.sp.utility
             retObject.CaseNo = caseNo.Trim();
             retObject.DoItem = doItemName;
 
+            var splitNos= caseNo.Split(new char[] { '-' },StringSplitOptions.RemoveEmptyEntries);
+            var temNo = splitNos[0].Trim();
+
             using (var Service = ChromeDriverService.CreateDefaultService(ConfigHelper.GetSectionValue("IPEasySetting:ChormeDriverPath")))
             {
 
@@ -1758,7 +1761,7 @@ namespace wispro.sp.utility
 
                         });
 
-                        inputSearch.SendKeys(caseNo.Trim());
+                        inputSearch.SendKeys(temNo);
 
                         var btnSearch = waitGetElementById(wait, "btn_Search");
                         btnSearch.Click();
@@ -1767,7 +1770,7 @@ namespace wispro.sp.utility
                         {
                             try
                             {
-                                return d.FindElement(By.XPath($"//a[normalize-space()='{caseNo.Trim()}']"));
+                                return d.FindElement(By.XPath($"//a[starts-with(normalize-space(), '{temNo}')]"));
                             }
                             catch
                             {
@@ -1776,7 +1779,7 @@ namespace wispro.sp.utility
 
                         });
                         caseLink.Click();
-                        System.Threading.Thread.Sleep(200);
+                        System.Threading.Thread.Sleep(1000);
                         var DoItemLinks = wait.Until((d) =>
                         {
                             d.SwitchTo().DefaultContent().SwitchTo().Frame(2);

+ 1 - 1
wispro.sp.winClient/appsettings.json

@@ -17,7 +17,7 @@
 
   },
   "InvalidDataMessageMails": "罗才洋|luocaiyang@china-wispro.com,何青瓦|heqingwa@china-wispro.com,钟子敏|zhongzimin@china-wispro.com,吴芳|wufang@china-wispro.com,邢丽霞|xinglixia@china-wispro.com,田婵玉|tianchanyu@china-wispro.com,周珊珊|zhoushanshan@china-wispro.com",
-  "APIBaseUri": "http://1.116.113.26:81",
+  "APIBaseUri": "http://localhost:39476",
   "lastDate": "2025-02-01"
 
 }