1. 数据库脚本添加启动大复位报警提示
2. 开放上传数据时间限制
3. 添加软件报警输出配置,目前提供连续NG报警和启动时大复位报警
5个文件已修改
38 ■■■■ 已修改文件
DetectionData.cs 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
M423DATA脚本/dbo.WarningConfigure-update20201117.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MainForm.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
OPCTags.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.config 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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))
M423DATA½Å±¾/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'请执行大复位动作')
MainForm.cs
@@ -208,6 +208,10 @@
            opc.Write(OPCOutputTag.DetectResult_NG, false);
            CommonUtil.WriteLog(LogType.Inf, "初始化下料NA");
            //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}产品应放入OK Tray");
                                CommonUtil.WriteLog(LogType.Inf, $"{x?.DetectID}|{x?.ProductNo}产品应放入OK 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}产品应放入NG Tray");
                                CommonUtil.WriteLog(LogType.Inf, $"{x?.DetectID}|{x?.ProductNo}产品应放入NG 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}产品应放入NA Tray");
                                CommonUtil.WriteLog(LogType.Inf, $"{x?.DetectID}|{x?.ProductNo}产品应放入NA 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;
OPCTags.cs
@@ -184,6 +184,8 @@
        /// æ˜¯å¦æ˜¯æŠ½æ£€
        /// </summary>
        public const string SpotCheck = "M423.Box.Output.SpotCheck";
        public const string Alarm = "M423.Box.Output.Alarm";
    }
    #endregion
}
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"/>