1. 修改高度检测和长宽检测精度为小数点后5位
2. 添加启动时写入产品结果NA
3. 添加连续NG报警和数据库报警配置
1 文件已重命名
5个文件已修改
65 ■■■■ 已修改文件
CarrierBarcodeCtrl.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HeightDetection.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
M423DATA脚本/dbo.WarningConfigure-update20201117.sql 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
MainForm.cs 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
SizeDetection.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app.config 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CarrierBarcodeCtrl.cs
@@ -93,8 +93,10 @@
            else
            {
                if (temp.Length == 13)
                {
                    CarrierBarcode = temp;
                temp = "";
                    temp = "";
                }
            }
        }
    }
HeightDetection.cs
@@ -305,11 +305,11 @@
            double standardGap = opcConfig.batteryHeightLimit.Max - standardValue;
            double gap = adjustValue - standardValue;
            fakeValue = finalHeight = (gap / (errorBand / 2.0)) * standardGap + standardValue;
            fakeValue = finalHeight = Math.Round(((gap / (errorBand / 2.0)) * standardGap + standardValue), 5);
            if (finalHeight < opcConfig.batteryHeightLimit.Min || finalHeight > opcConfig.batteryHeightLimit.Max)
            {
                fakeValue = standardValue + (CommonUtil.random.NextDouble() - 0.5) * 2.0 * standardGap;
                fakeValue = Math.Round((standardValue + (CommonUtil.random.NextDouble() - 0.5) * 2.0 * standardGap), 5);
            }
            if (isEnableRawData)
M423DATA½Å±¾/dbo.WarningConfigure-update20201117.sql
File was renamed from M423DATA½Å±¾/dbo.WarningConfigure-update20200510.sql
@@ -341,3 +341,7 @@
(Val,Type,Content,Solution)
values(48,1,N'下料工位感应光纤异常报警',N'1.下料工位本该有产品,但是传感器没有检测得到或者是产品被认为取走的情况,会造成此报警;
2.下料工位本没有产品,但是传感器检测到了信号,可能是传感器误感应或者当前的下料工位上有异物或者是认为放置了产品。')
insert into WarningConfigure
(Val,Type,Content,Solution)
values(2000,1,N'产品连续NG超过设定次数报警',N'请通报相关人员,设备复位即可继续')
MainForm.cs
@@ -203,6 +203,20 @@
            CommonUtil.IsRunning = true;
            SetControls();
            opc.Write(OPCOutputTag.DetectResult_OK, false);
            opc.Write(OPCOutputTag.DetectResult_NG, false);
            CommonUtil.WriteLog(LogType.Inf, "初始化下料NA");
            string continuousNGStr = ConfigurationManager.AppSettings["ContinuousNGThreshold"];
            if (int.TryParse(continuousNGStr, out int temp))
            {
                _continuousNGThreshold = temp;
            }
            else
            {
                _continuousNGThreshold = 999;
            }
        }
        public void Stop()
@@ -592,6 +606,9 @@
            lblEmptyQuantity.Text = measureResultTTL.EmptyQuantity.ToString();
        }
        int _continuousNGThreshold = 999;
        int _continuousNG = 0;
        #region PLC ç›‘听
        void OPCEventHandler(object sender, EventTool.ListenEventArgs e)
        {
@@ -611,11 +628,12 @@
                        MeasureState pState = MeasureState.NA;
                        int detectID = CommonUtil.StepControl.GetUnloadStepID();
                        ProductMeasureResult x = null;
                        if (detectID > 0)
                        {
                            var x = (from t in productTestCollection
                                     where t.DetectID == detectID
                                     select t
                            x = (from t in productTestCollection
                                 where t.DetectID == detectID
                                 select t
                                    ).FirstOrDefault();
                            if (x != default(ProductMeasureResult))
                            {
@@ -647,18 +665,28 @@
                            case MeasureState.OK:
                                opc.Write(OPCOutputTag.DetectResult_OK, true);
                                opc.Write(OPCOutputTag.DetectResult_NG, false);
                                CommonUtil.WriteLog(LogType.Inf, $"{x.DetectID}|{x.ProductNo}产品应放入OK Tray");
                                _continuousNG = 0;
                                break;
                            case MeasureState.NG:
                                opc.Write(OPCOutputTag.DetectResult_OK, false);
                                opc.Write(OPCOutputTag.DetectResult_NG, true);
                                CommonUtil.WriteLog(LogType.Inf, $"{x.DetectID}|{x.ProductNo}产品应放入NG Tray");
                                CommonUtil.StepControl.RemoveById(detectID);
                                _continuousNG++;
                                break;
                            default:
                                opc.Write(OPCOutputTag.DetectResult_OK, false);
                                opc.Write(OPCOutputTag.DetectResult_NG, false);
                                CommonUtil.WriteLog(LogType.Inf, $"{x.DetectID}|{x.ProductNo}产品应放入NA Tray");
                                CommonUtil.StepControl.RemoveById(detectID);
                                _continuousNG = 0;
                                break;
                        }
                        #endregion
@@ -682,6 +710,15 @@
                            DisplayCycleTime((int)Math.Round(ts.TotalMilliseconds));
                        }
                        unloadTime = DateTime.Now;
                        if (_continuousNG >= _continuousNGThreshold)
                        {
                            //脚本中设置报警码2000表示连续NG次数到达设定报警上限
                            opc.Write(OPCInputTag.Alarm, 2000);
                            CommonUtil.WriteLog(LogType.Inf, $"产品连续NG{_continuousNG}次,报警提示");
                            _continuousNG = 0;
                        }
                        //
                    }
                    break;
@@ -878,8 +915,10 @@
                    if ((bool)item.value)
                    {
                        //opc.Write(OPCInputTag.UnloadBatteryDone, false);
                        int batteryId = CommonUtil.StepControl.GetUnloadBatteryID();
                        CommonUtil.WriteLog(LogType.Inf, $"电池下料到位,Id:{batteryId}");
                        CommonUtil.StepControl.RemoveById(batteryId);
                        detectionData.SaveTrayBarcode(batteryId);
                    }
SizeDetection.cs
@@ -334,6 +334,10 @@
                        btyLength += compL;
                        btyWidth += compW;
                        //限制精度5位
                        btyLength = Math.Round(btyLength, 5);
                        btyWidth = Math.Round(btyWidth, 5);
                        lengthMeasureState = (btyLength >= opcConfig.batteryLengthLimit.Min && btyLength <= opcConfig.batteryLengthLimit.Max) ? MeasureState.OK : MeasureState.NG;
                        widthMeasureState = (btyWidth >= opcConfig.batteryWidthLimit.Min && btyWidth <= opcConfig.batteryWidthLimit.Max) ? MeasureState.OK : MeasureState.NG;
app.config
@@ -46,6 +46,8 @@
    <add key="EnableRawData" value="false"/>
    <add key="HeightStandard" value="4.4"/>
    <add key="ErrorBand" value="2.0"/>
    <add key="ContiousNGThreshold" value="3"/>
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>