From 7aa252390ad86a90312bee95cef7b7d9d536837e Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周六, 14 9月 2024 05:45:16 +0800
Subject: [PATCH] 监控点位OP1004

---
 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Enums/PieceLogTypeEnum.cs                                 |   13 ++++++
 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/MonitorHelper.cs                                    |   86 +++++++++++++++++++++++++++++++++++++++++++
 DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1004.cs |    2 
 3 files changed, 100 insertions(+), 1 deletions(-)

diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1004.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1004.cs
index d66f6ba..661f4d7 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1004.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/Special/DataCaptureHandler_OP1004.cs
@@ -123,7 +123,7 @@
                                 }
 
                                 //鐩戞帶涓婄嚎
-                                MonitorHelper.MonitorTestForLine(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID);
+                                MonitorHelper.MonitorTestForOP1004(_dataCaptureConfig, value, colConfig, wplog.WorkPieceID, wplog);
                             }
                             else
                             {
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Enums/PieceLogTypeEnum.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Enums/PieceLogTypeEnum.cs
index 067ff8e..c850d17 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Enums/PieceLogTypeEnum.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Enums/PieceLogTypeEnum.cs
@@ -24,5 +24,18 @@
         /// </summary>
         [Description("HMI淇敼璐ㄩ噺鐘舵��")]
         HMI淇敼璐ㄩ噺鐘舵�� = 2,
+
+        /// <summary>
+        /// 浜岀淮鐮佽瘑鍒け璐�
+        /// </summary>
+        [Description("浜岀淮鐮佽瘑鍒け璐�")]
+        浜岀淮鐮佽瘑鍒け璐� = 3,
+
+        /// <summary>
+        /// 鐘舵�佷笉鏄�
+        /// </summary>
+        [Description("鐘舵�佷笉鏄�")]
+        鐘舵�佷笉鏄� = 4,
+
     }
 }
\ No newline at end of file
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/MonitorHelper.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/MonitorHelper.cs
index 3c66585..c202ef8 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/MonitorHelper.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/Utils/MonitorHelper.cs
@@ -103,5 +103,91 @@
                 }
             });
         }
+
+
+        /// <summary>
+        /// 鐩戞帶鐐逛綅OP1004
+        /// </summary>
+        /// <param name="value"></param>
+        /// <returns></returns>
+        public static void MonitorTestForOP1004(DataCaptureConfig _dataCaptureConfig, object value, List<DataCaptureColumnConfig> colConfig, string workPieceID, WorkPieceLogMiddle wplog)
+        {
+            Task.Run(() =>
+            {
+                LogType _LogType = PLCManger.GetLogTypeForOnLine(_dataCaptureConfig.DataCapturePointCode);
+                try
+                {
+                    //璁板綍涓� 瑙﹀彂鐨勭偣浣嶅拰鎵惧埌鐨勪簩缁寸爜鍊�
+                    var str = "";
+
+
+                    str += $",鑾峰彇浜岀淮鐮佸�� ,鍊兼槸{workPieceID}";
+                    //str += $",鏁翠綋瀵硅薄 wplog鏄瘂JsonConvert.SerializeObject(wplog)}";
+
+                    Log4NetHelper.WriteInfoLog(_LogType, str);
+
+                    //涓嶆甯哥殑鐮佸啓鍏ユ暟鎹簱
+                    var _MyRemarks = "";
+                    var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(workPieceID);
+                    PieceLogTypeEnum pieceLogTypeEnum = PieceLogTypeEnum.姝e父;
+                    if (isRight == false)
+                    {
+                        pieceLogTypeEnum = PieceLogTypeEnum.璇荤爜鍊煎紓甯�;
+                        if (wplog.OP10Flag == "5")
+                        {
+                            pieceLogTypeEnum = PieceLogTypeEnum.浜岀淮鐮佽瘑鍒け璐�;
+                            _MyRemarks = $"浜岀淮鐮佽瘑鍒け璐�,鏈哄簥杩斿洖鏍囪:{wplog.OP10Flag}";
+                        }
+                    }
+                    else
+                    {
+
+                    }
+                    switch (wplog.OP10Flag)
+                    {
+                        case "1":
+                            _MyRemarks = $"NOOK鎺ㄥ嚭,鏈哄簥杩斿洖鏍囪:{wplog.OP10Flag}";
+                            break;
+                        case "2":
+                        case "3":
+                            _MyRemarks = $"SPC鎺ㄥ嚭,鏈哄簥杩斿洖鏍囪:{wplog.OP10Flag}";
+                            break;
+                        case "4":
+                            pieceLogTypeEnum = PieceLogTypeEnum.鐘舵�佷笉鏄�;
+                            _MyRemarks = $"鐘舵�佷笉鏄�,鏈哄簥杩斿洖鏍囪:{wplog.OP10Flag}";
+                            break;
+                        case "5":
+                            pieceLogTypeEnum = PieceLogTypeEnum.浜岀淮鐮佽瘑鍒け璐�;
+                            _MyRemarks = $"浜岀淮鐮佽瘑鍒け璐�,鏈哄簥杩斿洖鏍囪:{wplog.OP10Flag}";
+                            break;
+                        default:
+                            break;
+                    }
+                   
+                    WorkPieceLog workPieceLog = new WorkPieceLog()
+                    {
+                        Id = Yitter.IdGenerator.YitIdHelper.NextId(),
+                        WorkPieceID = workPieceID,
+                        WorkingProcedure = _dataCaptureConfig.WorkingProcedure,
+                        CreatedTime = DateTime.Now,
+                        CreatedUserName = _dataCaptureConfig.DataCapturePointCode,
+                        DataCapturePointCname = _dataCaptureConfig.DataCapturePointCname,
+                        MyRemarks = _MyRemarks,
+                        Remarks = pieceLogTypeEnum.ToString(),
+                        PieceLogType = (int)pieceLogTypeEnum,
+                        PieceLogTypeName = pieceLogTypeEnum.ToString()
+                    };
+                    using (DbModel db = new DbModel())
+                    {
+                        db.WorkPieceLog.Add(workPieceLog);
+                        db.SaveChanges();
+                    }
+                }
+                catch (Exception ex)
+                {
+                    Log4NetHelper.WriteErrorLog(_LogType, "MonitorTestForOP1004寮傚父:" + ex.Message, ex);
+                }
+            });
+        }
     }
 }

--
Gitblit v1.9.3