From 980688a34936fb549b36b99566f7e4e23233f186 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 12 6月 2024 12:51:04 +0800
Subject: [PATCH] this.OP80NewCode = '' ;//每次刷完就清空输入框 【Editby shaocx,2024-06-12】
---
DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_02.cs | 114 ++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 88 insertions(+), 26 deletions(-)
diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_02.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_02.cs
index d57c64e..591b2ca 100644
--- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_02.cs
+++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_BusinessLogical/DataCaptureHandlerV2/DataCaptureHandler_02.cs
@@ -25,7 +25,7 @@
/// <summary>
/// 娴嬮噺瀹屾垚鏍囪
/// </summary>
- public class DataCaptureHandler_02: DataCaptureHandler
+ public class DataCaptureHandler_02 : DataCaptureHandler
{
public static readonly DataCaptureHandler_02 Instance = new DataCaptureHandler_02();
@@ -182,13 +182,23 @@
}
else
{
- var value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
+ object value;
+ //鍒ゆ柇DBNumber涓嶅悓 銆怑ditby shaocx,2024-06-07銆�
+ if (_dataCaptureConfig.DbNumber.ToUpper() == "M")
+ {
+ value = plcService.ReadValuePointV2(_dataCaptureConfig.DbNumber + _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
+ }
+ else
+ {
+ value = plcService.ReadValuePoint(_dataCaptureConfig.DbNumber, _dataCaptureConfig.Offset, PLCManger.GetTypeForString(_dataCaptureConfig.DataCaptureColumnType));
+ }
+
Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}娴嬮噺瀹屾垚銆恵value_02}銆戙�恵value.ToString()}銆戙�恵_dataCaptureConfig.PLCIP}銆戙�恵_dataCaptureConfig.DbNumber}銆戙�恵_dataCaptureConfig.Offset}銆慬{_dataCaptureConfig.DataCapturePLCType}][{plcService.IsConnected.ToString()}]");
if (value_02.ToUpper().Equals("FALSE") && value.ToString().ToUpper().Equals("TRUE"))
{//褰撲笂涓�鏍囪浣�0锛屽綋鍓嶈幏鍙栨爣璁颁负1鏃讹紝
//瑙﹀彂鎿嶄綔, 骞剁粰闈欐�佸彉閲忚祴鍊间负1
//涓氬姟浠g爜
- Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}杩涘叆娴嬮噺瀹屾垚銆恵value_02}銆戙�恵value.ToString()}銆�");
+ Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}杩涘叆娴嬮噺瀹屾垚銆恵value_02}銆戙�恵value.ToString()}銆�");
threadStatusMonitor.Threadlastmodifytime = DateTime.Now;
WorkPieceLogMiddle wplog = new WorkPieceLogMiddle();
@@ -199,7 +209,7 @@
wplog.MonitoringPoint = DataCapturePointCode;
wplog.CreatedTime = DateTimeHelper.GetDateTime();
wplog.CreatedUserName = DataCapturePointCode;
- wplog.UpdatedUserName = Environment.MachineName+"鑷姩" + Thread.CurrentThread.ManagedThreadId.ToString();
+ wplog.UpdatedUserName = Environment.MachineName + "鑷姩" + Thread.CurrentThread.ManagedThreadId.ToString();
wplog.UpdatedTime = DateTimeHelper.GetDateTime();
wplog.IsDeleted = false;
wplog.QualityType = QualityType.Online.ToString();
@@ -215,7 +225,7 @@
{
Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $" {DataCapturePointCode}宸ュ簭鐩戞帶娴嬮噺瀹屾垚鏍囪 璇诲彇宸ヤ欢鐮佸姩鎬佺敱浜庡瓧娈靛悕娌℃壘鍒帮紝璧嬪�笺�恵WorkingProcedure ?? "绌哄瓧绗︿覆"}銆戝け璐wplog.Id}");
}
- if(set.PropertyType.FullName.Equals("System.String"))
+ if (set.PropertyType.FullName.Equals("System.String"))
{
set.SetValue(wplog, valuecol.ToString());//缁欏姩鎬佸瓧娈佃祴鍊�
}
@@ -235,13 +245,13 @@
if (WorkingProcedure.Equals("OP30"))
{
var time = DateTimeHelper.GetDateTime();
- if (fileFindTime==null)
+ if (fileFindTime == null)
{
fileFindTime = time.AddMinutes(-10);
}
-
+
//鑾峰彇鏂囦欢澶瑰悕绉�
- List<string> directorylist = new List<string>();
+ List<string> directorylist = new List<string>();
string directory = time.ToString("yyyy-MM-dd_HH");
string directoryOther = time.AddSeconds(-30).ToString("yyyy-MM-dd_HH");
directorylist.Add(directory);
@@ -255,7 +265,7 @@
{
try
{
- if (DataCapturePointCode.Contains("CH3")|| DataCapturePointCode.Contains("CH6"))
+ if (DataCapturePointCode.Contains("CH3") || DataCapturePointCode.Contains("CH6"))
{//宸ヤ綅3 娑ㄦ柇鍔涚煩
//鎵弿褰撳墠鏃堕棿涓�30绉掑墠鍑虹幇鐨勬枃浠�,涓�鑸妭鎷嶅湪15绉掑乏鍙筹紙涓や釜鏈嶅姟鍣ㄦ椂闂翠笉涓�鏍蜂細瀵艰嚧鍙栦笉鍒版枃浠讹級
var newFiles = FileHelper.DetectNewFiles(path36 + @"\" + dir, "*.pdf", 10, fileFindTime.Value, time.AddMinutes(120));
@@ -264,7 +274,7 @@
files.Add((FileInfo)file);
}
}
- else if (DataCapturePointCode.Contains("CH4")|| DataCapturePointCode.Contains("CH5"))
+ else if (DataCapturePointCode.Contains("CH4") || DataCapturePointCode.Contains("CH5"))
{//宸ヤ綅4 棰勬嫥绱у姏鐭� SEQ_04
//鎵弿褰撳墠鏃堕棿涓�30绉掑墠鍑虹幇鐨勬枃浠�,涓�鑸妭鎷嶅湪15绉掑乏鍙筹紙涓や釜鏈嶅姟鍣ㄦ椂闂翠笉涓�鏍蜂細瀵艰嚧鍙栦笉鍒版枃浠讹級
@@ -275,21 +285,21 @@
}
}
}
- catch(Exception ex)
+ catch (Exception ex)
{
Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}娴嬮噺瀹屾垚璇诲彇鏂囦欢{dir}鏁版嵁鏃跺紓甯�,閲囬泦鏃堕棿{fileFindTime.Value},閬垮厤宸ュ簭瀹屾垚寮傚父1锛�", ex);
}
}
files = files.OrderByDescending(o => o.LastWriteTime).ToList();
- if(files.Count>0)
+ if (files.Count > 0)
{
- Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"宸ヤ綅銆恵DataCapturePointCode}銆戝伐浠躲�恵wplog.WorkPieceID??"绌哄瓧绗�"}銆戞枃浠秢files[0].FullName}娴嬮噺瀹屾垚璇诲彇鏂囦欢鏁版嵁寮�濮�");
+ Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"宸ヤ綅銆恵DataCapturePointCode}銆戝伐浠躲�恵wplog.WorkPieceID ?? "绌哄瓧绗�"}銆戞枃浠秢files[0].FullName}娴嬮噺瀹屾垚璇诲彇鏂囦欢鏁版嵁寮�濮�");
switch (DataCapturePointCode)
{
case "OP3002CH3":
wplog.OP30QualityFilePathCH3 = files[0].FullName;
- wplog.QualityStateStr= FileHelper.ReadPdfFileForSpire(files[0].FullName, "Result");
+ wplog.QualityStateStr = FileHelper.ReadPdfFileForSpire(files[0].FullName, "Result");
wplog.QualityOP30To1 = FileHelper.ReadPdfFileForSpire(files[0].FullName, "Y-Maximum");//娑ㄦ柇鍔涚煩
break;
case "OP3002CH4":
@@ -312,9 +322,9 @@
fileFindTime = files[0].LastWriteTime;
}
}
- else if(WorkingProcedure.Equals("OP35"))
+ else if (WorkingProcedure.Equals("OP35"))
{
- if(wplog.OP35OK)
+ if (wplog.OP35OK)
{
wplog.QualityStateStr = "OK";
}
@@ -323,8 +333,10 @@
wplog.QualityStateStr = "NG";
}
}
- else if(WorkingProcedure.Equals("OP60"))
+ else if (WorkingProcedure.Equals("OP60"))
{
+ //澧炲姞OP60 璐ㄩ噺淇℃伅璇诲彇鏍¢獙 銆怑ditby shaocx,2024-06-07銆�
+ if (wplog.Op60_Place_Flag == false) continue;
var time = DateTimeHelper.GetDateTime();
if (fileFindTime == null)
@@ -339,7 +351,7 @@
{
files.Add((FileInfo)file);
}
- if(files.Count()>0)
+ if (files.Count() > 0)
{
files = files.OrderByDescending(o => o.LastWriteTime).ToList();
List<OP60Info> op60Infos = new List<OP60Info>();
@@ -347,7 +359,7 @@
{//鍙栧�掑簭鍖归厤鐨勬枃浠跺悕涓哄伐浠跺彿鐨勬枃浠�
if (file.Name.Contains("SP-" + DataCapturePointCode.Substring(DataCapturePointCode.Length - 1, 1)))
{
- Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}涓嬬嚎瀹屾垚璇诲彇鍒版枃浠秢file.Name}锛屾槸鎸囧畾鐨勫伐浠�");
+ Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}涓嬬嚎瀹屾垚璇诲彇鍒版枃浠秢file.Name}锛屾槸鎸囧畾鐨勫伐浠秢wplog.WorkPieceID},涓婃鑾峰彇灏间集涓佹枃浠堕噷鐨勬椂闂村��:{(op60QualityTime == null ? "" : op60QualityTime.ToString())}");
var datatable = CSVHelper.ReadCSVList(file.FullName);
if (datatable.Count < 106)
@@ -374,11 +386,11 @@
op60Infos.Add(info);
}
}
- if(op60Infos.Count()>=2)
+ if (op60Infos.Count() >= 2)
{
- if(op60QualityTime.HasValue)
+ if (op60QualityTime.HasValue)
{
- if(op60Infos[0].datetimeHandle> op60QualityTime.Value)
+ if (op60Infos[0].datetimeHandle > op60QualityTime.Value)
{
wplog.QualityOP60To1 = op60Infos[0].value;
wplog.QualityOP60To2 = op60Infos[1].value;
@@ -409,6 +421,14 @@
}
else if (WorkingProcedure.Equals("OP20"))
{
+ //璁板綍鍏敤鍙橀噺锛屼繚瀛樼偣浣峂88鐨勪俊鎭� 銆怑ditby shaocx,2024-06-07銆�
+ if (DataCapturePointCode.Contains("OP2002C"))
+ {//浠嶰P2002C璇诲彇锛屽洜涓洪『搴忔槸 CBA锛岃�屼笉鏄疉BC
+ string sideValue = GetSideForOP20(plcService);
+ SystemValue.OP20_Side_Value = sideValue;
+ }
+ wplog.MonitoringPoint += SystemValue.OP20_Side_Value;
+ wplog.CreatedUserName = wplog.MonitoringPoint;
var time = DateTimeHelper.GetDateTime();
if (fileFindTime == null)
@@ -433,7 +453,7 @@
{//鍙栧�掑簭鍖归厤鐨勬枃浠跺悕涓哄伐浠跺彿鐨勬枃浠�
if (file.Name.Contains("SP-" + DataCapturePointCode.Substring(DataCapturePointCode.Length - 1, 1)))
{
- Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}涓嬬嚎瀹屾垚璇诲彇鍒版枃浠秢file.Name}锛屾槸鎸囧畾鐨勫伐浠�");
+ Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"{DataCapturePointCode}涓嬬嚎瀹屾垚璇诲彇鍒版枃浠秢file.Name}锛屾槸鎸囧畾鐨勫伐浠秢wplog.WorkPieceID},涓婃鑾峰彇灏间集涓佹枃浠堕噷鐨勬椂闂村��:{(op60QualityTime == null ? "" : op60QualityTime.ToString())}");
var datatable = CSVHelper.ReadCSVList(file.FullName);
if (datatable.Count < 57)
@@ -549,6 +569,48 @@
Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"璇粄DataCapturePointCode}宸ュ簭鐩戞帶娴嬮噺鏍囪 涓嶅仛鏍¢獙锛岃纭鏄惁閰嶇疆寮傚父");
}
}
+
+ /// <summary>
+ /// 鑾峰彇OP20鐨勫摢涓潰
+ /// </summary>
+ /// <param name="plcService"></param>
+ /// <returns></returns>
+ private string GetSideForOP20(PLCService plcService)
+ {
+ try
+ {
+ object value_M88 = plcService.ReadValuePointV2("M88", PLCManger.GetTypeForString("int"));
+ int i_value_M88 = 0;
+ var isRight = int.TryParse(value_M88.ToString(), out i_value_M88);
+ Log4NetHelper.WriteInfoLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"璇诲彇 {DataCapturePointCode}宸ュ簭鐩戞帶娴嬮噺鏍囪鏁版嵁鏃跺紓甯�,鑾峰彇OP20鐨勫摢涓潰,i_value_M88:{i_value_M88}");
+ if (isRight)
+ {
+ if (i_value_M88 == 64)
+ {
+ return "1";
+ }
+ else if (i_value_M88 == 256)
+ {
+ return "2";
+ }
+ else if (i_value_M88 == 1024)
+ {
+ return "3";
+ }
+ else if (i_value_M88 == 4096)
+ {
+ return "4";
+ }
+ }
+ return "";
+ }
+ catch (Exception ex)
+ {
+ Log4NetHelper.WriteErrorLog(PLCManger.GetLogTypeForWorkingProcedure(WorkingProcedure), $"璇诲彇 {DataCapturePointCode}宸ュ簭鐩戞帶娴嬮噺鏍囪鏁版嵁鏃跺紓甯�,鑾峰彇OP20鐨勫摢涓潰,锛�", ex);
+ return "";
+ }
+ }
+
public WorkPieceLogMiddle GetCH4Info(string FullName, WorkPieceLogMiddle wplog)
{
try
@@ -562,13 +624,13 @@
foreach (string line in lines2)
{
count++;
- if (count==4)
+ if (count == 4)
{//鑾峰彇璐ㄩ噺缁撴灉
var list = line.Split(' ');
- if(list.Count()>0)
+ if (list.Count() > 0)
{
var str = list[list.Count() - 1].ToString().Trim();
- wplog.QualityStateStr= str.Equals("OK")?"OK":"NG";
+ wplog.QualityStateStr = str.Equals("OK") ? "OK" : "NG";
}
}
// 澶勭悊姣忎竴琛岀殑閫昏緫
--
Gitblit v1.9.3