init: 潍柴发动机线 中央控制程序 项目首次入库
This commit is contained in:
132
SCADA/MES_A95/MIS_ImmediateParam.cs
Normal file
132
SCADA/MES_A95/MIS_ImmediateParam.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using DC_A95;
|
||||
using Opc.Ua;
|
||||
using OpcBasic;
|
||||
using Rhino.DocObjects;
|
||||
using SlMesDbIterface;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using SystemFramework;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
namespace MesWork
|
||||
{
|
||||
/// <summary>
|
||||
/// 即时数据的处理
|
||||
/// </summary>
|
||||
public partial class MesWorkForm
|
||||
{
|
||||
/// <summary>
|
||||
/// 即时数据的处理
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void MIS_ImmediateParam(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (OpcData.CustomeEvetnArgs)e;
|
||||
if (msgEvent.TagValue == null) return;
|
||||
|
||||
var tagID = msgEvent.TagID.ToString();
|
||||
var opName = msgEvent.OpName.ToString();
|
||||
var tagTypeCodeID = (int)msgEvent.TagTypeCodeID;
|
||||
var tagTypeID = (EnumTagTypeID)msgEvent.TagTypeID;
|
||||
// var TagTypeCodeID = (EnumTagTypeCodeID)tagTypeCodeID;
|
||||
string tagValue;
|
||||
switch (tagTypeID)
|
||||
{
|
||||
case EnumTagTypeID.BOOL:
|
||||
tagValue = (Convert.ToInt32(msgEvent.TagValue)).ToString();
|
||||
break;
|
||||
default:
|
||||
tagValue = msgEvent.TagValue.ToString();
|
||||
break;
|
||||
}
|
||||
|
||||
switch (tagTypeCodeID)
|
||||
{
|
||||
case 100000://自动模式
|
||||
case 100001://运行中
|
||||
case 100002://手动模式
|
||||
case 100004://故障
|
||||
case 100005://警告
|
||||
case 100006://堵料
|
||||
case 100007://缺料
|
||||
ExecuteDB.Update_ImmediateParam(opName, tagTypeCodeID, tagValue, tagID);
|
||||
|
||||
if (tagTypeCodeID == 100000)
|
||||
{
|
||||
ht_Signal__Station_Auto[opName] = tagValue;
|
||||
}
|
||||
if (tagTypeCodeID == 100001)
|
||||
{
|
||||
ht_Signal__Station_Running[opName] = tagValue;
|
||||
}
|
||||
if (tagTypeCodeID == 100002)
|
||||
{
|
||||
ht_Signal__Station_Manual[opName] = tagValue;
|
||||
}
|
||||
if (tagTypeCodeID == 100004)
|
||||
{
|
||||
ht_Signal__Station_Alarm[opName] = tagValue;
|
||||
}
|
||||
|
||||
break;
|
||||
case 200001://工件离开,这个时候复位信号
|
||||
if (tagValue == "1")
|
||||
{
|
||||
/*
|
||||
//100060 当前循环时间
|
||||
//100080 上一工件的循环时间
|
||||
//100100 平均循环时间
|
||||
//100120 总计数(当前班次)
|
||||
//100160 合格工件计数(总计)
|
||||
//100200 不合格工件计数(总计)
|
||||
*/
|
||||
var list = new List<Int32>() { 100060, 100080, 100100, 100120, 100160, 100200 };
|
||||
foreach (var _TagTypeCodeID in list)
|
||||
{
|
||||
if (int.Parse(opName.Replace("OP", "")) > 4000 && int.Parse(opName.Replace("OP", "")) < 4100)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var _Value = ReadPLC(_TagTypeCodeID, opName).ToString();
|
||||
ExecuteDB.Update_ImmediateParam(opName, _TagTypeCodeID, _Value, $"{opName}_{_TagTypeCodeID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{ }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user