From 0850ca67bbc4b7581a595ab985904f7acb8ecb5e Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周四, 05 9月 2024 13:39:10 +0800
Subject: [PATCH] 特殊处理 OP05上线? 不再判断 时间,而是判断 最后一个工件

---
 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501 - 复制.cs |  353 ++++++++++++++++++++++++++++++++
 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs                            |  246 ++++++++++++----------
 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs      |   10 
 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj                     |    1 
 4 files changed, 495 insertions(+), 115 deletions(-)

diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs
index 0a641a4..0a6611e 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/BLL/WorkPieceInfoManager.cs
@@ -183,7 +183,7 @@
                                 info.Remarks = $"宸ヤ欢浜岀淮鐮佺涓�娆″嚭鐜扮殑宸ュ簭{loginfo.WorkingProcedure}涓嶆槸OP05,鏁版嵁缂哄け,璇风‘璁ゆ儏鍐靛苟鍋氱浉搴斿鐞嗭紒";
                             }
                             else
-                            {
+                            {//OP05宸ュ簭
                                 info.QualityState = (int)QualityStateEnum.OK;//姝ゅ闇�瑕佹敞鎰忥紝鍒ゆ柇鎵�鏈夊伐搴忚川閲忥紝鐒跺悗鍐嶈祴鍊� //榛樿鍚堟牸锛孫P05榛樿鏄悎鏍�
                                 info.Remarks = "OP05鏂板宸ヤ欢淇℃伅";
                             }
@@ -203,20 +203,29 @@
                                 return;
                             }
                         }
-                        info.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();//
-                        info.WorkingProcedureEndTime = null;
-                        info.WorkPieceState = (int)WorkPieceState.WIP;
-                        info.EquipmentID = loginfo.EquipmentID;
-                        info.QualityStateUpdateUser = loginfo.UpdatedUserName;
-                        info.QualityStateUpdateTime = loginfo.UpdatedTime.Value.LocalDateTime;
-                        info.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
-                        info.UpdatedUserName = loginfo.MonitoringPoint;
-                        SystemBussinessHelper.SetWorkPieceInfoMiddleForUpdateDataCapturePointCname(ref info, loginfo.DataCapturePointCname);
-                        info.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
-                        info.WorkPieceCurrentPosition = loginfo.WorkingProcedure;
-                        info.WorkPieceCurrentPositionOrder = info.WorkingProcedurePlan.IndexOf(loginfo.WorkingProcedure) / 2;
-                        info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
-                        info.Remarks = $"{info.WorkingProcedureCurrent}宸ヤ欢涓婄嚎";
+                        if ((info.WorkingProcedureCurrent.Equals("OP05") && isAddWorkPieceInfo == false))
+                        {
+                            //濡傛灉鏄疧P05鐨勶紝骞朵笖鏄� 涓嶉渶瑕佹柊澧� 琛╓orkPieceInfo锛岄偅涔堝氨涓嶉渶瑕佹洿鏂拌〃 WorkPieceInfo
+                        }
+                        else
+                        {
+                            info.WorkingProcedureStartTime = DateTimeHelper.GetDateTime();//
+                            info.WorkingProcedureEndTime = null;
+                            info.WorkPieceState = (int)WorkPieceState.WIP;
+                            info.EquipmentID = loginfo.EquipmentID;
+                            info.QualityStateUpdateUser = loginfo.UpdatedUserName;
+                            info.QualityStateUpdateTime = loginfo.UpdatedTime.Value.LocalDateTime;
+                            info.QualityStateUpdateMode = QualityStateUpdateMode.Auto.ToString();
+                            info.UpdatedUserName = loginfo.MonitoringPoint;
+                            SystemBussinessHelper.SetWorkPieceInfoMiddleForUpdateDataCapturePointCname(ref info, loginfo.DataCapturePointCname);
+                            info.UpdatedTime = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Local);
+
+                            info.WorkPieceCurrentPosition = loginfo.WorkingProcedure;
+                            info.WorkPieceCurrentPositionOrder = info.WorkingProcedurePlan.IndexOf(loginfo.WorkingProcedure) / 2;
+                            info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
+                            info.Remarks = $"{info.WorkingProcedureCurrent}宸ヤ欢涓婄嚎";
+                        }
+
 
                         //淇涓� op35 鍚屼竴涓欢 涓嬬嚎鏃堕棿璺熶笅涓�涓笂绾挎椂闂翠竴妯′竴鏍风殑闂  銆怑ditby shaocx,2024-08-27銆�
                         var isNeedAddNewProcess = true;
@@ -274,116 +283,127 @@
                             new_process.Remarks = "";
                             new_process.MyRemarks = "璇荤爜涓婄嚎鏃讹紝姣忔鎵弿涓婄嚎閮芥彃鍏ヨ拷婧〃";
                             if (loginfo.WorkingProcedure.Equals("OP05"))
-                            {
+                            {//鐗规畩澶勭悊OP05宸ュ簭
                                 new_process.EndTime = new_process.StartTime;
+
+                                //濡傛灉宸茬粡瀛樺湪鍏朵粬宸ュ簭锛岄偅涔堝氨蹇呴』瑕佹寜鐓у叾浠栧伐搴忕殑鏃堕棿寰�鍓嶆帹鏁版嵁 銆怑ditby shaocx,2024-09-05銆�
+                                var op05OtherProccss = db.WorkPieceProcess.Where(o => o.WorkPieceID == loginfo.WorkPieceID).OrderBy(x => x.StartTime).FirstOrDefault();
+                                if (op05OtherProccss != null)
+                                {//璇存槑鏈夛紝閭d箞鏃堕棿灏辨寜鐓ц繖涓椂闂村線鍓嶆帹
+                                    var _time = op05OtherProccss.StartTime.AddHours(-1);
+                                    new_process.StartTime = _time;
+                                    new_process.EndTime = _time;
+                                    new_process.CreatedTime = _time;
+                                    new_process.UpdatedTime = _time;
+                                }
+                                db.WorkPieceProcess.Add(new_process);
                             }
-                            db.WorkPieceProcess.Add(new_process);
-                        }
 
-                        //db.Database.AutoTransactionsEnabled = false;// 鍚屼竴涓猄aveChanges榛樿浜嬪姟锛� 鍏抽棴榛樿浜嬪姟锛�... 濂藉儚涓嶈兘鐢ㄥ晩锛屽悗闈㈠啀鐮旂┒鍚�
-                        if (isAddWorkPieceInfo)
-                        {
-                            db.WorkPieceInfo.Add(info);
-                        }
-                        else
-                        {//涓嶇‘瀹歩nfo鏄洿鎺ヤ細淇敼杩樻槸闇�瑕佸啀娆℃煡璇紝寰呮祴璇�
-                         //info.Remarks = "淇敼锛屽叿浣撲慨鏀归�昏緫寰呭畾";
-                        }
-
-                        #region 鍒ゆ柇鏄惁璺冲簭,鎴栬川閲忎笉绗﹀悎 鐒跺悗鍙嶉PLC
-                        if (IsFeedback.HasValue && IsFeedback.Value == (int)FeedbackMode.FeedbackPLC)
-                        {
-                            bool checkQualityInfoCompleteFlag = false;
-                            bool plcFlag = true;//鍙嶉缁橮LC鐨勬爣璁�
-                            string message = "";
-                            checkQualityInfoCompleteFlag = WorkPieceInfoManager.CheckQualityInfoComplete(info, loginfo, type);
-
-                            if (!checkQualityInfoCompleteFlag || info.QualityState != (int)QualityStateEnum.OK)
+                            //db.Database.AutoTransactionsEnabled = false;// 鍚屼竴涓猄aveChanges榛樿浜嬪姟锛� 鍏抽棴榛樿浜嬪姟锛�... 濂藉儚涓嶈兘鐢ㄥ晩锛屽悗闈㈠啀鐮旂┒鍚�
+                            if (isAddWorkPieceInfo)
                             {
-                                plcFlag = false;
-                                message = !checkQualityInfoCompleteFlag ? "璺冲簭锛�" : "";
-                                message += info.QualityState != (int)QualityStateEnum.OK ? "璐ㄩ噺涓嶇鍚�" : "";
+                                db.WorkPieceInfo.Add(info);
                             }
-                            ////鍙嶉缁橮LC锛岋紙鍐欏叆鐐瑰緟瀹氾級
-                            //MessageModel fr = null;
-                            //fr = plcService.WriteValuePoint("", "", plcFlag, PLCManger.GetTypeForString("bool"));
-                            //if (fr.result)
-                            //{
-                            //    Log4NetHelper.WriteInfoLog(type, $" 宸ヤ欢{info.WorkPieceID} {loginfo.WorkingProcedure}宸ュ簭鍙嶉缁橮LC 鎴愬姛锛� 鍑虹幇 {message}");
-                            //}
-                            //else
-                            //{
-                            //    Log4NetHelper.WriteErrorLog(type, $" 宸ヤ欢{info.WorkPieceID} {loginfo.WorkingProcedure}宸ュ簭鍙嶉缁橮LC 澶辫触锛� 鍑虹幇 {message} 锛屽け璐ュ師鍥狅細{fr.resMsg}");
-                            //}
+                            else
+                            {//涓嶇‘瀹歩nfo鏄洿鎺ヤ細淇敼杩樻槸闇�瑕佸啀娆℃煡璇紝寰呮祴璇�
+                             //info.Remarks = "淇敼锛屽叿浣撲慨鏀归�昏緫寰呭畾";
+                            }
 
-                            //#region 鍙嶉PLC
+                            #region 鍒ゆ柇鏄惁璺冲簭,鎴栬川閲忎笉绗﹀悎 鐒跺悗鍙嶉PLC
+                            if (IsFeedback.HasValue && IsFeedback.Value == (int)FeedbackMode.FeedbackPLC)
+                            {
+                                bool checkQualityInfoCompleteFlag = false;
+                                bool plcFlag = true;//鍙嶉缁橮LC鐨勬爣璁�
+                                string message = "";
+                                checkQualityInfoCompleteFlag = WorkPieceInfoManager.CheckQualityInfoComplete(info, loginfo, type);
 
-                            //bool checkQualityInfoCompleteFlag = false;
-                            //bool plcFlag = true;//鍙嶉缁橮LC鐨勬爣璁�
-                            //string message = "";
-                            //checkQualityInfoCompleteFlag = WorkPieceInfoManager.CheckQualityInfoComplete(info, wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
+                                if (!checkQualityInfoCompleteFlag || info.QualityState != (int)QualityStateEnum.OK)
+                                {
+                                    plcFlag = false;
+                                    message = !checkQualityInfoCompleteFlag ? "璺冲簭锛�" : "";
+                                    message += info.QualityState != (int)QualityStateEnum.OK ? "璐ㄩ噺涓嶇鍚�" : "";
+                                }
+                                ////鍙嶉缁橮LC锛岋紙鍐欏叆鐐瑰緟瀹氾級
+                                //MessageModel fr = null;
+                                //fr = plcService.WriteValuePoint("", "", plcFlag, PLCManger.GetTypeForString("bool"));
+                                //if (fr.result)
+                                //{
+                                //    Log4NetHelper.WriteInfoLog(type, $" 宸ヤ欢{info.WorkPieceID} {loginfo.WorkingProcedure}宸ュ簭鍙嶉缁橮LC 鎴愬姛锛� 鍑虹幇 {message}");
+                                //}
+                                //else
+                                //{
+                                //    Log4NetHelper.WriteErrorLog(type, $" 宸ヤ欢{info.WorkPieceID} {loginfo.WorkingProcedure}宸ュ簭鍙嶉缁橮LC 澶辫触锛� 鍑虹幇 {message} 锛屽け璐ュ師鍥狅細{fr.resMsg}");
+                                //}
 
-                            //if (!checkQualityInfoCompleteFlag || info.QualityState != (int)QualityState.OK)
-                            //{
-                            //    plcFlag = false;
-                            //    message = !checkQualityInfoCompleteFlag ? "璺冲簭锛�" : "";
-                            //message += info.QualityState != (int)QualityState.OK ? "璐ㄩ噺涓嶇鍚�" : "";
-                            //}
-                            ////鍙嶉缁橮LC锛岋紙鍐欏叆鐐瑰緟瀹氾級
-                            //MessageModel fr = null;
-                            //fr = plcService.WriteValuePoint("", "", plcFlag, PLCManger.GetTypeForString("bool"));
-                            //if (fr.result)
-                            //{
-                            //    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" 宸ヤ欢{wplog.WorkPieceID} {WorkingProcedure}宸ュ簭鍙嶉缁橮LC 鎴愬姛锛� 鍑虹幇 {message}");
-                            //}
-                            //else
-                            //{
-                            //    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" 宸ヤ欢{wplog.WorkPieceID} {WorkingProcedure}宸ュ簭鍙嶉缁橮LC 澶辫触锛� 鍑虹幇 {message} 锛屽け璐ュ師鍥狅細{fr.resMsg}");
-                            //}
-                            //#endregion
+                                //#region 鍙嶉PLC
+
+                                //bool checkQualityInfoCompleteFlag = false;
+                                //bool plcFlag = true;//鍙嶉缁橮LC鐨勬爣璁�
+                                //string message = "";
+                                //checkQualityInfoCompleteFlag = WorkPieceInfoManager.CheckQualityInfoComplete(info, wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure));
+
+                                //if (!checkQualityInfoCompleteFlag || info.QualityState != (int)QualityState.OK)
+                                //{
+                                //    plcFlag = false;
+                                //    message = !checkQualityInfoCompleteFlag ? "璺冲簭锛�" : "";
+                                //message += info.QualityState != (int)QualityState.OK ? "璐ㄩ噺涓嶇鍚�" : "";
+                                //}
+                                ////鍙嶉缁橮LC锛岋紙鍐欏叆鐐瑰緟瀹氾級
+                                //MessageModel fr = null;
+                                //fr = plcService.WriteValuePoint("", "", plcFlag, PLCManger.GetTypeForString("bool"));
+                                //if (fr.result)
+                                //{
+                                //    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" 宸ヤ欢{wplog.WorkPieceID} {WorkingProcedure}宸ュ簭鍙嶉缁橮LC 鎴愬姛锛� 鍑虹幇 {message}");
+                                //}
+                                //else
+                                //{
+                                //    Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" 宸ヤ欢{wplog.WorkPieceID} {WorkingProcedure}宸ュ簭鍙嶉缁橮LC 澶辫触锛� 鍑虹幇 {message} 锛屽け璐ュ師鍥狅細{fr.resMsg}");
+                                //}
+                                //#endregion
+                            }
+                            else
+                            {//璇荤爜瀹屾垚鑻ュ伐浠惰川閲忎笉绗﹀悎鎴栧彂鐢熻烦搴忥紝涓嶇敤绠¤澶囨槸鍚︽妸宸ヤ欢鏀捐繃鍘伙紝鏁伴噰绯荤粺閮戒笉鍙樻洿褰撳墠宸ュ簭锛屽弽棣堣澶嘝LC宸ヤ欢涓嶇鍚堬紝
+                             //鑻ュ伐搴忓悗缁敹闆嗙偣鏀跺埌鐩稿叧宸ヤ欢淇℃伅鍐嶅彉鏇村綋鍓嶅伐搴忥紝  浣嗚川閲忎俊鎭笉鍙�
+
+                                info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
+                            }
+                            #endregion
+
+                            #region 鏇存柊璁惧瀹炴椂琛�
+
+                            bool isAddEquipmentCurrentMonitor = false;
+                            EquipmentCurrentMonitor equinfo = new EquipmentCurrentMonitor();
+                            equinfo = db.EquipmentCurrentMonitor.Where(o => o.EquipmentID == loginfo.EquipmentID).FirstOrDefault();
+                            if (equinfo == null || equinfo.Id < 1)
+                            {//娌℃湁宸ヤ欢淇℃伅锛屼笉鍋氭洿鏂�
+                                Log4NetHelper.WriteErrorLog(type, $"璁惧{loginfo.EquipmentID} 鍛婅鐩戞帶{loginfo.WorkingProcedure} 娌℃湁鑾峰彇鍒拌澶囩洃鎺т俊鎭紝鐜版柊澧�");
+                                equinfo = EntityPropHelper.Mapper<EquipmentCurrentMonitor, WorkPieceLog>(loginfo);
+                                equinfo.OnlineTime = DateTime.Now;
+                                isAddEquipmentCurrentMonitor = true;
+                            }
+                            else
+                            {//鏇存柊宸ヤ欢
+                                equinfo.WorkPieceID = loginfo.WorkPieceID;
+                                equinfo.UpdatedUserName = loginfo.MonitoringPoint;
+                                equinfo.UpdatedTime = DateTime.Now;
+                                equinfo.OnlineTime = DateTime.Now;
+                            }
+                            if (isAddEquipmentCurrentMonitor)
+                            {
+                                equinfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
+                                db.EquipmentCurrentMonitor.Add(equinfo);
+                            }
+                            #endregion
+                            //db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo));
+                            db.WorkPieceInfoLog.Add(GetAddWorkPieceInfoLog(info));
+                            //UpdateKnifeToolLift(db, loginfo);//鏇存柊鍒�鍏峰鍛戒俊鎭�
                         }
                         else
-                        {//璇荤爜瀹屾垚鑻ュ伐浠惰川閲忎笉绗﹀悎鎴栧彂鐢熻烦搴忥紝涓嶇敤绠¤澶囨槸鍚︽妸宸ヤ欢鏀捐繃鍘伙紝鏁伴噰绯荤粺閮戒笉鍙樻洿褰撳墠宸ュ簭锛屽弽棣堣澶嘝LC宸ヤ欢涓嶇鍚堬紝
-                         //鑻ュ伐搴忓悗缁敹闆嗙偣鏀跺埌鐩稿叧宸ヤ欢淇℃伅鍐嶅彉鏇村綋鍓嶅伐搴忥紝  浣嗚川閲忎俊鎭笉鍙�
-
-                            info.WorkingProcedureCurrent = loginfo.WorkingProcedure;
-                        }
-                        #endregion
-
-                        #region 鏇存柊璁惧瀹炴椂琛�
-
-                        bool isAddEquipmentCurrentMonitor = false;
-                        EquipmentCurrentMonitor equinfo = new EquipmentCurrentMonitor();
-                        equinfo = db.EquipmentCurrentMonitor.Where(o => o.EquipmentID == loginfo.EquipmentID).FirstOrDefault();
-                        if (equinfo == null || equinfo.Id < 1)
-                        {//娌℃湁宸ヤ欢淇℃伅锛屼笉鍋氭洿鏂�
-                            Log4NetHelper.WriteErrorLog(type, $"璁惧{loginfo.EquipmentID} 鍛婅鐩戞帶{loginfo.WorkingProcedure} 娌℃湁鑾峰彇鍒拌澶囩洃鎺т俊鎭紝鐜版柊澧�");
-                            equinfo = EntityPropHelper.Mapper<EquipmentCurrentMonitor, WorkPieceLog>(loginfo);
-                            equinfo.OnlineTime = DateTime.Now;
-                            isAddEquipmentCurrentMonitor = true;
-                        }
-                        else
-                        {//鏇存柊宸ヤ欢
-                            equinfo.WorkPieceID = loginfo.WorkPieceID;
-                            equinfo.UpdatedUserName = loginfo.MonitoringPoint;
-                            equinfo.UpdatedTime = DateTime.Now;
-                            equinfo.OnlineTime = DateTime.Now;
-                        }
-                        if (isAddEquipmentCurrentMonitor)
                         {
-                            equinfo.Id = Yitter.IdGenerator.YitIdHelper.NextId();
-                            db.EquipmentCurrentMonitor.Add(equinfo);
-                        }
-                        #endregion
-                        //db.WorkPieceLog.Add(GetAddWorkPieceLog(loginfo));
-                        db.WorkPieceInfoLog.Add(GetAddWorkPieceInfoLog(info));
-                        //UpdateKnifeToolLift(db, loginfo);//鏇存柊鍒�鍏峰鍛戒俊鎭�
-                    }
-                    else
-                    {
-                        loginfo.Remarks = $"涓婄嚎瀹屾垚璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}寮傚父";
-                        Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}涓婄嚎鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{loginfo.WorkPieceID ?? "绌�"}]鏃跺紓甯革細");
+                            loginfo.Remarks = $"涓婄嚎瀹屾垚璇诲彇浜岀淮鐮亄loginfo.WorkPieceID ?? "绌�"}寮傚父";
+                            Log4NetHelper.WriteErrorLog(type, $" {loginfo.WorkingProcedure}涓婄嚎鐩戞帶璇荤爜鏍囪 璇诲彇宸ヤ欢鐮佹暟鎹甗{loginfo.WorkPieceID ?? "绌�"}]鏃跺紓甯革細");
 
+                        }
                     }
                 }
                 catch (Exception e)
diff --git "a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501 - \345\244\215\345\210\266.cs" "b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501 - \345\244\215\345\210\266.cs"
new file mode 100644
index 0000000..24e8dc4
--- /dev/null
+++ "b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501 - \345\244\215\345\210\266.cs"
@@ -0,0 +1,353 @@
+锘�//using iWare_SCADA_BusinessLogical.BLL;
+//using iWare_SCADA_BusinessLogical.Utils;
+//using iWare_SCADA_Model;
+//using System;
+//using System.Collections.Generic;
+//using System.Data;
+//using System.Globalization;
+//using System.IO;
+//using System.Linq;
+//using System.Text;
+//using System.Threading;
+//using System.Threading.Tasks;
+//using System.Web.UI.WebControls;
+
+//namespace iWare_SCADA_BusinessLogical
+//{
+//    /// <summary>
+//    /// OP05 鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅
+//    /// </summary>
+//    public class DataCaptureHandler_OP0501 : DataCaptureHandler
+//    {
+//        public static readonly DataCaptureHandler_OP0501 Instance = new DataCaptureHandler_OP0501();
+
+//        public DataCaptureHandler_OP0501()
+//        {
+//        }
+
+//        public override string WorkingProcedure
+//        {
+//            get { return _dataCaptureConfig.WorkingProcedure; }
+//        }
+
+//        public override string DataCapturePointCode
+//        {
+//            get { return _dataCaptureConfig.DataCapturePointCode; }
+//        }
+//        public override string DataCapturePointCname
+//        {
+//            get { return _dataCaptureConfig.DataCapturePointCname; }
+//        }
+//        public override void RefreshDataList(List<DataCaptureConfig> dataCaptureConfig)
+//        {
+
+//        }
+//        public override void DataCaptureStart()
+//        {
+//            if (IsCaptureflag)
+//            {
+//                //// plc杩炴帴
+//                //var plcService = PLCManger.GetSinglePLCService(_dataCaptureConfig);
+//                //if (plcService == null)
+//                //{
+//                //    SystemValue.lbl_Alert_OP0501 = $"{RandomHelper.GenerateRandomCode(4)} 娌℃湁鎵惧埌{_dataCaptureConfig.WorkingProcedure}鐨凱LC璁惧";
+//                //    return;
+//                //}
+//                //if (plcService != null && !plcService.IsConnected)
+//                //{
+//                //    plcService.Close();
+//                //    plcService.OpenService();
+//                //}
+
+//                while (true)
+//                {
+//                    ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor();
+//                    threadStatusMonitor.Threadcode = DataCapturePointCode;
+//                    threadStatusMonitor.Threadcname = DataCapturePointCname;
+//                    threadStatusMonitor.Threadendtime = DateTime.Now;
+//                    //threadStatusMonitor.Threadlastmodifytime = DateTime.Now;
+//                    threadStatusMonitor.Threadstatue = 0;
+//                    threadStatusMonitor.ThreadId = Thread.CurrentThread.ManagedThreadId.ToString();
+//                    try
+//                    {
+//                        ////_dataCaptureConfig
+//                        //if (plcService == null || !plcService.IsConnected)
+//                        //{
+//                        //    SystemValue.lbl_Alert_OP0501 = $" {RandomHelper.GenerateRandomCode(4)} {_dataCaptureConfig.WorkingProcedure} PLC杩炴帴宸叉柇寮�锛屾鍦ㄥ皾璇曟墦寮�!";
+//                        //    plcService.Close();
+//                        //    plcService.OpenService();
+//                        //    Thread.Sleep(100);
+//                        //    continue;
+//                        //}
+//                        //else
+//                        {
+//                            //var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
+//                            //if (SystemValue.value_OP0501.Equals("0") && value.ToString().Equals("1"))
+//                            {//褰撲笂涓�鏍囪浣�0锛屽綋鍓嶈幏鍙栨爣璁颁负1鏃讹紝
+//                             //瑙﹀彂鎿嶄綔,  骞剁粰闈欐�佸彉閲忚祴鍊间负1
+//                             //涓氬姟浠g爜
+//                             //璇荤爜瀹屾垚娌″暐涓氬姟鎿嶄綔锛岃幏鍙栦簩缁寸爜锛岀劧鍚庢斁鍒伴槦鍒椾腑
+//                                #region 浠庡伐鎺ф満鑾峰彇鐩稿叧浜岀淮鐮�
+//                                var path = ConfigHelper.GetConfigString("WorkPeiceIDPath");//鎵撶爜鏈烘墦鐮佷簩缁寸爜璺緞
+//                                //鎵弿鍏变韩鐩綍骞跺皢鏂扮殑鏂囦欢鎵弿杩斿洖  涓�鑸妭鎷嶅湪15绉掑乏鍙筹紙鍙互纭涓�涓嬶級
+//                                //鎵弿淇敼鏃堕棿鍦ㄤ笂娆℃壂鎻忔椂闂翠箣鍓�10绉掑埌褰撳墠鏃堕棿鐨勪箣闂寸殑鏂囦欢
+//                                var dataTime = CommonManager.Instance.CheackPath(Environment.CurrentDirectory + "\\LastModifyTime\\OP05-LastScapTime.txt", 4, -10);
+//                                var scapEndTime = DateTimeHelper.GetDateTime();
+//                                var newFiles = FileHelper.DetectNewFilesCSV(path, 60, Convert.ToDateTime(dataTime), scapEndTime);
+
+
+//                                Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
+//                                    $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭璇诲彇宸ユ帶鏈轰腑浜岀淮鐮佷俊鎭紑濮�:{dataTime}");
+
+//                                foreach (System.IO.FileInfo file in newFiles)
+//                                {
+//                                    threadStatusMonitor.Threadlastmodifytime = DateTime.Now;
+//                                    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
+//                                        $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭璇诲彇宸ユ帶鏈轰腑浜岀淮鐮佷俊鎭�,鏂囦欢鍚�:{file.FullName}");
+//                                    DataTable dt = null;
+//                                    dt = CSVHelper.ReadCSV(file.FullName);
+//                                    if (dt == null)
+//                                    {
+//                                        continue;
+//                                    }
+//                                    lock (SystemValue.lock5QRcodeList)
+//                                    {
+//                                        #region 娓呰繃鏈熺紦瀛�
+//                                        try
+//                                        {
+//                                            //娓呰繃鏈熺紦瀛�
+//                                            var lstRemoveKey = SystemValue.QRcodeList
+//                                                .Where(p => p.Value < DateTimeHelper.GetDateTime().AddMinutes(-600))
+//                                                .Select(p => p.Key).ToList();
+//                                            if (lstRemoveKey.Count > 0)
+//                                            {
+//                                                foreach (var key in lstRemoveKey) SystemValue.QRcodeList.Remove(key);
+//                                                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"娓呴櫎缂撳瓨鏁伴噺锛氾紙{lstRemoveKey.Count}锛� 鍓╀綑缂撳瓨鏁伴噺锛氾紙{SystemValue.QRcodeList.Count}锛�");
+//                                            }
+//                                        }
+//                                        catch (Exception ex)
+//                                        {
+//                                            Log4NetHelper.WriteErrorLog(LogType.PLCOP05, "娓呴櫎鍛婅鎶ユ枃ID缂撳瓨閿欒锛�", ex);
+//                                        }
+//                                        #endregion
+
+//                                        ////绛涢�夐渶瑕佸鐞嗙殑浜岀淮鐮佷俊鎭�
+//                                        //DataRow[] drArr = dt.Select(" 鎵爜缁撴灉='鎴愬姛'");    //鏌ヨ
+//                                        //DataTable dtNew = dt.Clone();
+//                                        //for (int i = 0; i < drArr.Length; i++)
+//                                        //{
+//                                        //    var now = DateTime.Now;
+//                                        //    var list = drArr[i]["鏃堕棿"].ToString().Split(':');
+//                                        //    var d = new DateTime(now.Year, now.Month, now.Day, Convert.ToInt32(list[0]), Convert.ToInt32(list[1]), Convert.ToInt32(list[2]), DateTimeKind.Local);
+//                                        //    //and 鏃堕棿> '19:19:34:547'
+//                                        //    if (Convert.ToDateTime(DateTime.Now.ToShortDateString() + " " +drArr[i]["鏃堕棿"]).TimeOfDay> Convert.ToDateTime(DateTime.Now.ToShortDateString() + " 19:19:34:547").TimeOfDay)
+//                                        //        dtNew.ImportRow(drArr[i]);
+//                                        //    //鑾峰彇鍒扮殑宸ヤ欢鍙峰紓甯�
+//                                        //    SystemValue.lbl_Alert_OP0501 = $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛氥��" + WorkPieceID + "銆戦暱搴﹀紓甯革紝闀垮害涓嶇瓑浜�22浣�";
+//                                        //    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
+//                                        //        $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛氥��" + WorkPieceID + "銆戦暱搴﹀紓甯革紝闀垮害涓嶇瓑浜�22浣�");
+//                                        //}
+//                                        DataTable newDt = new DataTable();
+//                                        var dates = file.Name.Split('-', '.');
+//                                        var date = string.Format("{0:D4}-{1:D2}-{2:D2}", int.Parse(dates[0]), int.Parse(dates[1]), int.Parse(dates[2]));
+//                                        if (DateTimeHelper.GetDateTime().Date != Convert.ToDateTime(date) && DateTimeHelper.GetDateTime().AddDays(-1).Date != Convert.ToDateTime(date))
+//                                        {
+//                                            continue;
+//                                        }
+//                                        DataRow[] filteredRows = new DataRow[dt.Rows.Count];
+//                                        if (dt.Rows.Count > 0)
+//                                        {
+//                                            int j = 0;
+//                                            var cache = DataCache.GetCache("OP501-LastTime");
+//                                            DateTime? lasttime = null;
+//                                            if (cache != null)
+//                                            {
+//                                                lasttime = Convert.ToDateTime(cache);
+//                                            }
+
+//                                            Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
+//                                                $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭璇诲彇宸ユ帶鏈轰腑浜岀淮鐮佷俊鎭�,宸ヤ欢鏈�鏂版椂闂�:{(cache == null ? "鏃犵紦瀛�" : cache.ToString())}");
+//                                            for (int i = dt.Rows.Count - 1; i >= 0; i--)
+//                                            {//闄嶅簭锛屽嵆浼樺厛璇诲彇鏈�鍚庝竴鏉℃暟鎹�
+//                                                string timeValue = " ";
+//                                                try
+//                                                {
+//                                                    timeValue = dt.Rows[i]["鏃堕棿"].ToString();
+//                                                    string[] timeComponents = timeValue.Split(':');
+//                                                    string correctedTime = string.Format("{0:D2}:{1:D2}:{2:D2}", int.Parse(timeComponents[0]), int.Parse(timeComponents[1]), int.Parse(timeComponents[2]));
+//                                                    var newTime = date + " " + correctedTime;
+//                                                    dt.Rows[i]["鏃堕棿"] = newTime;
+
+//                                                    var currrentTime = Convert.ToDateTime(dt.Rows[i]["鏃堕棿"]);
+//                                                    if (cache == null)
+//                                                    {
+//                                                        if (j == 0)
+//                                                        {
+//                                                            if (currrentTime > DateTimeHelper.GetDateTime().AddHours(-10))
+//                                                            {
+//                                                                lasttime = currrentTime;
+//                                                            }
+//                                                        }
+//                                                        var oldTime = DateTime.Now.AddMinutes(-10);
+//                                                        if (currrentTime <= oldTime)
+//                                                        {//濡傛灉excel閲岀殑鏃堕棿瑕佹瘮 褰撳墠鍓�10鍒嗛挓鏃堕棿瑕佹棭锛岄偅涔堟垜灏卞拷鐣ヤ笉澶勭悊銆�
+//                                                            break;
+//                                                        }
+//                                                        filteredRows[j] = dt.Rows[i];
+//                                                    }
+//                                                    else
+//                                                    {
+//                                                        var cacheTime = Convert.ToDateTime(cache);
+//                                                        if (currrentTime <= cacheTime)
+//                                                        {//濡傛灉excel閲岀殑鏃堕棿瑕佹瘮 鎴戠紦瀛樹腑鐨勬椂闂磋鏃╋紝閭d箞鎴戝氨蹇界暐涓嶅鐞嗐��
+//                                                            break;
+//                                                        }
+//                                                        filteredRows[j] = dt.Rows[i];
+//                                                    }
+
+//                                                    if (currrentTime > DateTimeHelper.GetDateTime().AddHours(-10))
+//                                                    {
+//                                                        if (lasttime != null && lasttime < currrentTime)
+//                                                        {
+//                                                            lasttime = currrentTime;
+//                                                        }
+//                                                    }
+//                                                    j++;
+//                                                }
+//                                                catch (Exception ex)
+//                                                {
+//                                                    SystemValue.lbl_Alert_OP0501 = $" {_dataCaptureConfig.WorkingProcedure}鏂囦欢鎵撴爣鏃堕棿[{timeValue}]寮傚父锛岃鏌ョ湅鏃ュ織锛�";
+//                                                    Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $" {_dataCaptureConfig.WorkingProcedure}鏂囦欢鎵撴爣鏃堕棿,鍑虹幇寮傚父锛�", ex);
+//                                                }
+//                                            }
+
+//                                            filteredRows = filteredRows.Where(item => item != null).ToArray();
+//                                            // 璁剧疆缂撳瓨鍊�
+//                                            DateTime absoluteExpiration = DateTime.Now.AddDays(30);
+//                                            TimeSpan slidingExpiration = TimeSpan.FromMinutes(20);
+//                                            if (slidingExpiration == TimeSpan.Zero)
+//                                            {
+//                                                absoluteExpiration = DateTime.Now.AddDays(30);
+//                                            }
+//                                            else
+//                                            {
+//                                                absoluteExpiration = DateTime.MaxValue;
+//                                            }
+//                                            DataCache.SetCache("OP501-LastTime", lasttime, absoluteExpiration, slidingExpiration);
+//                                            if (filteredRows.Count() <= 0)
+//                                            {
+//                                                continue;
+//                                            }
+//                                            if (file.LastAccessTime < Convert.ToDateTime(dataTime)) continue;
+//                                            using (StreamWriter writer = new StreamWriter(Environment.CurrentDirectory + "\\OP05-LastScapTime.txt", false))
+//                                            {
+//                                                dataTime = file.LastAccessTime.ToString();
+//                                                writer.Write(dataTime);
+//                                            }
+//                                            Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"璇诲彇鍒皗filteredRows.Count()}琛屾暟鎹紝鏃堕棿鑼冨洿鏄瘂filteredRows[j - 1]["鏃堕棿"]}-{filteredRows[0]["鏃堕棿"]}");
+//                                        }
+
+//                                        //// 宸ヤ欢鍙凤紙浜岀淮鐮佸�硷級
+//                                        //string WorkPieceID = dt.Rows[0][""].ToString();
+//                                        //if (WorkPieceID.Length != 22)
+//                                        //{
+//                                        //    //鑾峰彇鍒扮殑宸ヤ欢鍙峰紓甯�
+//                                        //    SystemValue.lbl_Alert_HMI01 = $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛氥��" + WorkPieceID + "銆戦暱搴﹀紓甯革紝闀垮害涓嶇瓑浜�22浣�";
+//                                        //    Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
+//                                        //        $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛氥��" + WorkPieceID + "銆戦暱搴﹀紓甯革紝闀垮害涓嶇瓑浜�22浣�");
+//                                        //}
+
+
+//                                        //SystemValue.QRcodeList.Add("", DateTimeHelper.GetDateTime());//浜岀淮鐮佹坊鍔犲埌鍒楄〃涓�
+
+//                                        WorkPieceLog wplog = new WorkPieceLog();
+//                                        wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
+//                                        wplog.WorkingProcedure = _dataCaptureConfig.WorkingProcedure; ;
+//                                        //wplog.EquipmentID = WorkingProcedure;
+//                                        wplog.Remarks = "cs";
+//                                        wplog.MonitoringPoint = DataCapturePointCode;
+//                                        //wplog.CreatedUserName = DataCapturePointCode;
+//                                        SystemBussinessHelper.SetWorkPieceLogMiddleForCreatedUserName(ref wplog, DataCapturePointCode, DataCapturePointCname);
+//                                        wplog.CreatedTime = DateTimeHelper.GetDateTime();
+//                                        wplog.UpdatedTime = DateTimeHelper.GetDateTime();
+//                                        wplog.UpdatedUserName = Environment.MachineName + "鑷姩" + Thread.CurrentThread.ManagedThreadId.ToString();
+//                                        wplog.IsDeleted = false;
+//                                        wplog.EquipmentID = _dataCaptureConfig.EquipmentID;
+
+//                                        wplog.OnlineTime = DateTimeHelper.GetDateTime();//缁欎笂绾挎椂闂寸敤
+
+//                                        //wplog.QualityState = 1;
+//                                        wplog.QualityState = (int)QualityStateEnum.OK;//榛樿鍚堟牸锛孫P05榛樿鍚堟牸
+
+//                                        wplog.ProcessingDuration = 1;
+//                                        wplog.MachineToolState = 1;
+//                                        wplog.AlertType = 1;
+//                                        wplog.WorkPieceNumber = 1;
+//                                        wplog.WorkPieceOnlineTime = Convert.ToDateTime(dataTime);
+//                                        wplog.WorkPieceOfflineTime = Convert.ToDateTime(dataTime).AddHours(1);
+//                                        wplog.WorkPieceStartMachiningTime = Convert.ToDateTime(dataTime);
+//                                        wplog.WorkPieceEndMachiningTime = DateTime.Now.AddDays(7);
+//                                        wplog.KnifeEdgeNumber = 10;
+//                                        wplog.KnifeToolLife = 10;
+//                                        wplog.KnifeToolEarlyWarningLife = 3;
+//                                        wplog.KnifeToolSurplusLife = 10;
+
+//                                        foreach (var item in filteredRows)
+//                                        {
+//                                            Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure),
+//                                                   $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭璇诲彇宸ユ帶鏈轰腑浜岀淮鐮佷俊鎭�,璇诲彇宸ヤ欢浜岀淮鐮�:{item["鎵撴爣鍐呭"].ToString()}");
+
+//                                            if (item == null) break;
+//                                            wplog.Id = Yitter.IdGenerator.YitIdHelper.NextId();
+//                                            wplog.WorkPieceID = item["鎵撴爣鍐呭"].ToString();
+//                                            wplog.OfflineTime = Convert.ToDateTime(dataTime);
+//                                            wplog.Remarks = item["鏃堕棿"].ToString() + "|" + item["鎵撴爣鍐呭"].ToString() + "|" + item["鎵撴爣鍐呭"].ToString() + "|" + item["鎵爜绛夌骇"].ToString() + "|" + item["鎵爜缁撴灉"].ToString();
+//                                            WorkPieceInfoManager.ReadQRcode(wplog, PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), null, _dataCaptureConfig.IsFeedback);
+
+//                                            threadStatusMonitor.Threadstatue = 1;
+//                                        }
+
+
+//                                    }
+//                                }
+
+
+//                                #endregion
+//                                //var fileCount = ((iWare_SCADA_BusinessLogical.Utils.FindFiles)newFiles).;
+//                                //Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"鎵弿瀹屾垚锛屽叡鎵弿鍒帮細锛坽fileCount.Count()}锛変釜鏂囦欢");
+//                            }
+//                            //SystemValue.value_OP0501 = value.ToString();
+//                        }
+//                    }
+//                    catch (Exception ex)
+//                    {
+//                        threadStatusMonitor.ErrorMsg = $" {_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅,鍑虹幇寮傚父锛岃鏌ョ湅鏃ュ織锛�";
+
+//                        SystemValue.lbl_Alert_OP0501 = $" {_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅,鍑虹幇寮傚父锛岃鏌ョ湅鏃ュ織锛�";
+//                        Log4NetHelper.WriteErrorLog(LogType.PLCOP05, $" {_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅,鍑虹幇寮傚父锛�", ex);
+//                    }
+//                    finally
+//                    {
+//                        WorkPieceInfoManager.ThreadMonitor(threadStatusMonitor);
+//                    }
+//                    //绾跨▼澶氫箙鎵ц涓�娆★紙涓嶅寘鍚笟鍔″鐞嗘椂闂达級
+//                    if (!_dataCaptureConfig.DataCaptureFrequency.HasValue || _dataCaptureConfig.DataCaptureFrequency < 10)
+//                    {
+//                        Thread.Sleep(3000);
+//                    }
+//                    else
+//                    {
+//                        Thread.Sleep(_dataCaptureConfig.DataCaptureFrequency.Value);
+//                    }
+//                }
+//            }
+//            else
+//            {
+//                SystemValue.lbl_Alert_OP0501 = $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛屼笉鍋氭牎楠岋紝璇风‘璁ら厤缃俊鎭紒";
+//                Log4NetHelper.WriteInfoLog(LogType.PLCOP05, $"{_dataCaptureConfig.WorkingProcedure}宸ュ簭鎵撴爣瀹屾垚鏍囪锛岃鍙栧伐鎺ф満涓墦鍗颁簩缁寸爜淇℃伅锛屼笉鍋氭牎楠岋紝璇风‘璁ら厤缃紓甯�");
+//            }
+
+//        }
+
+//    }
+//}
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs
index 484a428..740b5d8 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_OP0501.cs
@@ -59,6 +59,8 @@
                 //    plcService.OpenService();
                 //}
 
+                string lastHandlerWorkPileIDForOP0501 = "";//鏈�鍚庝竴娆″鐞嗙殑宸ヤ欢鍙�
+
                 while (true)
                 {
                     ThreadStatusMonitor threadStatusMonitor = new ThreadStatusMonitor();
@@ -189,7 +191,8 @@
                                                             }
                                                         }
                                                         var oldTime = DateTime.Now.AddMinutes(-10);
-                                                        if (currrentTime <= oldTime)
+                                                        // if (currrentTime <= oldTime)
+                                                        if (lastHandlerWorkPileIDForOP0501 == Convert.ToString(dt.Rows[i]["鎵撴爣鍐呭"]))
                                                         {//濡傛灉excel閲岀殑鏃堕棿瑕佹瘮 褰撳墠鍓�10鍒嗛挓鏃堕棿瑕佹棭锛岄偅涔堟垜灏卞拷鐣ヤ笉澶勭悊銆�
                                                             break;
                                                         }
@@ -198,7 +201,8 @@
                                                     else
                                                     {
                                                         var cacheTime = Convert.ToDateTime(cache);
-                                                        if (currrentTime <= cacheTime)
+                                                        //if (currrentTime <= cacheTime)
+                                                        if (lastHandlerWorkPileIDForOP0501 == Convert.ToString(dt.Rows[i]["鎵撴爣鍐呭"]))
                                                         {//濡傛灉excel閲岀殑鏃堕棿瑕佹瘮 鎴戠紦瀛樹腑鐨勬椂闂磋鏃╋紝閭d箞鎴戝氨蹇界暐涓嶅鐞嗐��
                                                             break;
                                                         }
@@ -308,6 +312,8 @@
                                         }
 
 
+                                        //璁板綍涓嬫渶鍚庝竴涓爜
+                                        lastHandlerWorkPileIDForOP0501 = Convert.ToString(dt.Rows[dt.Rows.Count - 1]["鎵撴爣鍐呭"]);
                                     }
                                 }
 
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj
index c0b7d90..a65e5ef 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/iWare_SCADA_BusinessLogical.csproj
@@ -83,6 +83,7 @@
     <Compile Include="BLL\SystemValue.cs" />
     <Compile Include="BLL\WorkPieceInfoManager.cs" />
     <Compile Include="BLL\WorkPieceLogManager.cs" />
+    <Compile Include="DataCaptureHandlerV2\DataCaptureHandler_OP0501 - 澶嶅埗.cs" />
     <Compile Include="DataCaptureHandlerV2\DeleteDataHandler.cs" />
     <Compile Include="DataCaptureHandlerV2\OP80QualityDataHandler.cs" />
     <Compile Include="DataCaptureHandlerV2\DataCaptureHandler_01.cs" />

--
Gitblit v1.9.3