From 351cb734a84c10e90144551f7e7d6dd9a5c4abd2 Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期日, 22 十一月 2020 13:40:57 +0800
Subject: [PATCH] 1. 数据库脚本添加启动大复位报警提示 2. 开放上传数据时间限制 3. 添加软件报警输出配置,目前提供连续NG报警和启动时大复位报警
---
DetectionData.cs | 17 +++++++++++++++--
M423DATA脚本/dbo.WarningConfigure-update20201117.sql | 4 ++++
MainForm.cs | 12 ++++++++----
app.config | 3 ++-
OPCTags.cs | 2 ++
5 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/DetectionData.cs b/DetectionData.cs
index e0d4cb3..2544663 100644
--- a/DetectionData.cs
+++ b/DetectionData.cs
@@ -15,6 +15,7 @@
private SqlConnection connForUpload;
private string _standardCheckMode;
+ int enableUploadMinutes = 10;
private static readonly object synObj = new object();
public DetectionData()
{
@@ -39,6 +40,18 @@
catch (Exception)
{
CommonUtil.WriteLog(LogType.Err, "DataUpload杩炴帴鏁版嵁搴撳け璐ワ紒");
+ }
+
+ string enableUploadMinutesStr = ConfigurationManager.AppSettings["EnableUploadMinutes"];
+
+ int temp = 0;
+ if (int.TryParse(enableUploadMinutesStr, out temp))
+ {
+ enableUploadMinutes = temp;
+ }
+ else
+ {
+ enableUploadMinutes = 10;
}
}
@@ -205,8 +218,8 @@
AND ProductNoStatus = 'OK'
AND ProductStatus<>'NA'
AND (ISNULL(CarrierBarcode,'')<>'' OR ProductStatus = 'NG')
- AND DATEDIFF(DAY,'{0}',DetectTime)>=-1
- ORDER BY DetectTime DESC", DateTime.Now.ToString("yyyy-MM-dd"));
+ AND DATEDIFF(MINUTE,DetectTime,'{0}')<={1}
+ ORDER BY DetectTime DESC", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), enableUploadMinutes.ToString());
SqlDataReader dr = null;
using (SqlCommand cmd = new SqlCommand(sql, connForUpload))
diff --git "a/M423DATA\350\204\232\346\234\254/dbo.WarningConfigure-update20201117.sql" "b/M423DATA\350\204\232\346\234\254/dbo.WarningConfigure-update20201117.sql"
index aa7aae4..0e260d6 100644
--- "a/M423DATA\350\204\232\346\234\254/dbo.WarningConfigure-update20201117.sql"
+++ "b/M423DATA\350\204\232\346\234\254/dbo.WarningConfigure-update20201117.sql"
@@ -345,3 +345,7 @@
insert into WarningConfigure
(Val,Type,Content,Solution)
values(2000,1,N'浜у搧杩炵画NG瓒呰繃璁惧畾娆℃暟鎶ヨ',N'璇烽�氭姤鐩稿叧浜哄憳锛岃澶囧浣嶅嵆鍙户缁�')
+
+insert into WarningConfigure
+(Val,Type,Content,Solution)
+values(250,1,N'杞欢鍚姩澶у浣�',N'璇锋墽琛屽ぇ澶嶄綅鍔ㄤ綔')
diff --git a/MainForm.cs b/MainForm.cs
index 45e464d..dd776ae 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -208,6 +208,10 @@
opc.Write(OPCOutputTag.DetectResult_NG, false);
CommonUtil.WriteLog(LogType.Inf, "鍒濆鍖栦笅鏂橬A");
+ //250琛ㄧず鍚姩鏃堕渶瑕佸ぇ澶嶄綅鎶ヨ
+ opc.Write(OPCOutputTag.Alarm, 250);
+ CommonUtil.WriteLog(LogType.Inf, "杞欢鍚姩澶у浣�");
+
string continuousNGStr = ConfigurationManager.AppSettings["ContinuousNGThreshold"];
if (int.TryParse(continuousNGStr, out int temp))
{
@@ -666,7 +670,7 @@
opc.Write(OPCOutputTag.DetectResult_OK, true);
opc.Write(OPCOutputTag.DetectResult_NG, false);
- CommonUtil.WriteLog(LogType.Inf, $"{x.DetectID}|{x.ProductNo}浜у搧搴旀斁鍏K Tray");
+ CommonUtil.WriteLog(LogType.Inf, $"{x?.DetectID}|{x?.ProductNo}浜у搧搴旀斁鍏K Tray");
_continuousNG = 0;
break;
@@ -674,7 +678,7 @@
opc.Write(OPCOutputTag.DetectResult_OK, false);
opc.Write(OPCOutputTag.DetectResult_NG, true);
- CommonUtil.WriteLog(LogType.Inf, $"{x.DetectID}|{x.ProductNo}浜у搧搴旀斁鍏G Tray");
+ CommonUtil.WriteLog(LogType.Inf, $"{x?.DetectID}|{x?.ProductNo}浜у搧搴旀斁鍏G Tray");
CommonUtil.StepControl.RemoveById(detectID);
_continuousNG++;
@@ -683,7 +687,7 @@
opc.Write(OPCOutputTag.DetectResult_OK, false);
opc.Write(OPCOutputTag.DetectResult_NG, false);
- CommonUtil.WriteLog(LogType.Inf, $"{x.DetectID}|{x.ProductNo}浜у搧搴旀斁鍏A Tray");
+ CommonUtil.WriteLog(LogType.Inf, $"{x?.DetectID}|{x?.ProductNo}浜у搧搴旀斁鍏A Tray");
CommonUtil.StepControl.RemoveById(detectID);
_continuousNG = 0;
@@ -714,7 +718,7 @@
if (_continuousNG >= _continuousNGThreshold)
{
//鑴氭湰涓缃姤璀︾爜2000琛ㄧず杩炵画NG娆℃暟鍒拌揪璁惧畾鎶ヨ涓婇檺
- opc.Write(OPCInputTag.Alarm, 2000);
+ opc.Write(OPCOutputTag.Alarm, 2000);
CommonUtil.WriteLog(LogType.Inf, $"浜у搧杩炵画NG{_continuousNG}娆★紝鎶ヨ鎻愮ず");
_continuousNG = 0;
diff --git a/OPCTags.cs b/OPCTags.cs
index 1c4ea87..9e26439 100644
--- a/OPCTags.cs
+++ b/OPCTags.cs
@@ -184,6 +184,8 @@
/// 鏄惁鏄娊妫�
/// </summary>
public const string SpotCheck = "M423.Box.Output.SpotCheck";
+
+ public const string Alarm = "M423.Box.Output.Alarm";
}
#endregion
}
diff --git a/app.config b/app.config
index ad32d53..32da9a1 100644
--- a/app.config
+++ b/app.config
@@ -39,7 +39,7 @@
<!--鐢垫睜鏈�澶у昂瀵镐笅闄� -->
<add key="MaxCellLength" value="10"/>
<add key="MaxCellWidth" value="10"/>
- <!--鐢垫睜鏈�灏忓昂瀵镐笂wq闄� -->
+ <!--鐢垫睜鏈�灏忓昂瀵镐笂闄� -->
<add key="MinCellLength" value="0"/>
<add key="MinCellWidth" value="0"/>
<!--楂樺害宸绠�-->
@@ -48,6 +48,7 @@
<add key="ErrorBand" value="2.0"/>
<add key="ContiousNGThreshold" value="3"/>
+ <add key="EnableUploadMinutes" value="10"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
--
Gitblit v1.8.0