MVP!
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
//using DataLinkMesWork;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public class InitTagValueListData
|
||||
{
|
||||
public InitTagValueListData()
|
||||
{
|
||||
DataTable dt = ReadMesServerData();
|
||||
|
||||
InitMesReadTagKey();
|
||||
initAllItemValue(dt);
|
||||
}
|
||||
|
||||
DataTable ReadMesServerData()
|
||||
{
|
||||
return null;// MesWork.PlcLinkForm.dt_BasicData.Select($"是否启用 = 1 and 监控属性代码 = '{1}'").CopyToDataTable<DataRow>();
|
||||
}
|
||||
|
||||
void InitMesReadTagKey()
|
||||
{
|
||||
DataTable dt = null;// MesWork.PlcLinkForm.dt_BasicData.Select($"是否启用 = 1 and 变量类型代码=19 and 监控属性代码 = '{1}'").CopyToDataTable<DataRow>(); ;
|
||||
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
if (MesReadTagKey_Hash.ContainsKey(dt.Rows[i]["工位号"].ToString()))
|
||||
{
|
||||
MesReadTagKey_Hash[dt.Rows[i]["工位号"].ToString()] = dt.Rows[i]["TagID"].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
MesReadTagKey_Hash.Add(dt.Rows[i]["工位号"].ToString(), dt.Rows[i]["TagID"].ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
void initAllItemValue(DataTable dt)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
if (ItemValue_Hash.ContainsKey(dt.Rows[i]["TagID"]))
|
||||
{
|
||||
if (Convert.ToInt32(dt.Rows[i]["列位置"]) != 0)
|
||||
{
|
||||
ItemValue_Hash[dt.Rows[i]["TagID"]] = dt.Rows[i]["测量项目"].ToString() + "(" + dt.Rows[i]["列位置"].ToString() + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemValue_Hash[dt.Rows[i]["TagID"]] = dt.Rows[i]["测量项目"].ToString();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Convert.ToInt32(dt.Rows[i]["列位置"]) != 0)
|
||||
{
|
||||
ItemValue_Hash[dt.Rows[i]["TagID"]] = dt.Rows[i]["测量项目"].ToString() + "(" + dt.Rows[i]["列位置"].ToString() + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemValue_Hash[dt.Rows[i]["TagID"]] = dt.Rows[i]["测量项目"].ToString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Hashtable MesReadTagKey_Hash = new Hashtable();
|
||||
public static Hashtable ItemValue_Hash = new Hashtable();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
using bizFacade;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
static object lockerBarcode = new object();
|
||||
|
||||
/// <summary>
|
||||
///1.扫描配送单号,用于接收物料,扫描单号的时候,将接收的物料信息显示在“物料拉动”Tab区域
|
||||
///2.扫描料箱标签/看板卡,用于追溯物料批次信息
|
||||
///3.扫描零件条码,根据零件图号进行防错
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
static public void Barcode(object e)
|
||||
{
|
||||
lock (lockerBarcode)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
string AlarmStr = "";
|
||||
|
||||
int IsAllowWork;
|
||||
bool IsSuccess = false;
|
||||
bool EngineGetOver_PLC_NextWorkStep;
|
||||
//传递机型是否到位
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
|
||||
|
||||
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||||
if (!IsSuccess)
|
||||
{
|
||||
AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//此处逻辑有问题 需要考虑到批次扫描 提示PLC未传递机型的情况
|
||||
if (EngineGetOver_PLC_NextWorkStep && IsSuccess)
|
||||
{
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
//if (!BaseDataSystemMES.QualityVerifyStatusOutline(OpName, out AlarmStr))
|
||||
//{
|
||||
// SendInfomation("LineoutAlert", AlarmStr, OpName);
|
||||
// return;
|
||||
//}
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AsyncSendMessage_Notice(OpName, "PLC未传递机型");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:Barcode");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
static object lockerConfirmOkGo = new object();
|
||||
|
||||
static public void ConfirmOkGo(object e)
|
||||
{
|
||||
lock (lockerConfirmOkGo)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
//BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
//更新订单完工数量及物料
|
||||
Sendmessage("24", "11", OpName);
|
||||
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
using bizFacade;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
static object lockerEngineTypeGetOver_PLC_Work = new object();
|
||||
|
||||
|
||||
static public void EngineTypeGetOver_PLC_Work(string OpName, int EngineTypeID, string EngineType, string EngineID, int PartPallet_Code,string OrderForm)
|
||||
{
|
||||
lock (lockerEngineTypeGetOver_PLC_Work)
|
||||
{
|
||||
int IsAllowWork;
|
||||
int RepairPartStatusPLC = 0;
|
||||
int MES_QualityMask = 1;
|
||||
//string OrderForm = "";//订单号
|
||||
DataTable dt;
|
||||
|
||||
if (EngineTypeID <= 0)
|
||||
{
|
||||
AsyncSendMessage_Notice(OpName, "PLC传递机型为空");
|
||||
return;
|
||||
}
|
||||
|
||||
//第一步,查询订单号,保存机型、机型代码、总成号、托盘号、订单号到数据库
|
||||
BaseDataSystemMES.GetEngineID_Select(OpName, EngineID, out dt);
|
||||
if (dt != null && dt.Rows.Count > 0)
|
||||
{
|
||||
OrderForm = Convert.ToString(dt.Rows[0]["订单号"]);
|
||||
}
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, OrderForm, EngineTypeID, EngineType, EngineID, PartPallet_Code, 0, 0, "");
|
||||
SaveMobyMessage(OpName, EngineTypeID, EngineType, EngineID, OrderForm);
|
||||
|
||||
//第二步,将零件信息转移到零件_临时表中(本地BOM与订单BOM的选择显示关系)
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||||
|
||||
//通知web显示
|
||||
Sendmessage("5123", "1111", OpName);
|
||||
MIS_BASE.Read_PalletInfo(OpName, out MES_QualityMask);//合格标志
|
||||
MIS_BASE.Read_RepairStatus_PLC(OpName, out RepairPartStatusPLC);//返修标志
|
||||
SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);//显示合格标志
|
||||
SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);//显示返修标志
|
||||
|
||||
if (MES_QualityMask == 2)
|
||||
{
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
SendInfomation("NgGO", "1", OpName);//显示不合格标志
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//第三步,用于工件离开后完工数量统计及工件编号追溯
|
||||
BaseDataSystemMES.MaterialPush_EngineIDStatus_Insert(OpName);//更新订单产量
|
||||
|
||||
//第四步,获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存MOBY信息
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="engineTypeID"></param>
|
||||
/// <param name="engineType"></param>
|
||||
/// <param name="engineID"></param>
|
||||
static private void SaveMobyMessage(string OpName, int engineTypeID, string engineType, string engineID, string orderForm)
|
||||
{
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_EngineGetOver_EngineTypeID[OpName] = engineTypeID;
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineType.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_EngineGetOver_EngineType[OpName] = engineType;
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_EngineGetOver_EngineID[OpName] = engineID;
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_OrderForm.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_EngineGetOver_OrderForm[OpName] = orderForm;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返修件需要工作
|
||||
/// </summary>
|
||||
/// <param name="OpName">工位号</param>
|
||||
static private void IsNeedRepaire_OK(string OpName)
|
||||
{
|
||||
string orderForm = "";
|
||||
int engineTypeID;
|
||||
string engineType = "";
|
||||
string engineID = "";
|
||||
string palletCode = "";
|
||||
int isRepair;
|
||||
string repairCode = "";
|
||||
//从监控系统中查询出本工位信息
|
||||
BaseDataSystemMES.OpName_MIS_Moby_Select(OpName,
|
||||
out orderForm, out engineTypeID, out engineType,
|
||||
out engineID, out palletCode, out isRepair, out repairCode);
|
||||
|
||||
EngineTypeGetOver_PLC_Work(OpName, engineTypeID, engineType, engineID, Convert.ToInt32(palletCode),orderForm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
static object lockerFalseGO = new object();
|
||||
|
||||
|
||||
static public void FalseGO(object e)
|
||||
{
|
||||
lock (lockerConfirmOkGo)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
//总合格标志2(不合格)
|
||||
|
||||
//BaseDataSystemMES.Material_Insert_NG(OpName, 2);
|
||||
|
||||
Sendmessage("24", "11", OpName);
|
||||
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
using bizFacade;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
static object lockerMaterial_Insert = new object();
|
||||
|
||||
static public void Material_Insert(string OpName)
|
||||
{
|
||||
lock (lockerMaterial_Insert)
|
||||
{
|
||||
try
|
||||
{
|
||||
//int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
int IsAllowWork;
|
||||
//第四步,获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
bool EngineGetOver_PLC_NextWorkStep;
|
||||
//传递机型是否到位
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
|
||||
|
||||
//暂时先定义为扫描完成才能进行压装工作,因为考虑到工作完成后,操作工未必会去扫描物料的情况
|
||||
if (EngineGetOver_PLC_NextWorkStep&&IsAllowWork == 1)
|
||||
{
|
||||
BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
//更新订单完工数量及物料
|
||||
Sendmessage("24", "11", OpName);
|
||||
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
static object lockerMesReadOver = new object();
|
||||
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
static public void MesReadOver(object e)
|
||||
{
|
||||
lock (lockerMesReadOver)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
var tagValue = msgEvent.TagValue.ToString();
|
||||
|
||||
if (tagValue == "1" | tagValue.ToLower() == "true")
|
||||
{
|
||||
int qualityMask;
|
||||
MIS_BASE.Read_QualityMask(OpName, out qualityMask);
|
||||
|
||||
SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);//发给Web页面显示质量数据
|
||||
|
||||
if (qualityMask == 1)//全部OK,给出合格放行
|
||||
{
|
||||
//如果存在线外扫描工位,根据扫描条码绑定线外数据 需要时解除禁用
|
||||
//BaseDataSystemMES.TransLaunchDataByMainMaterial(OpName, EngineType, EngineID, EngineTypeID);
|
||||
|
||||
//如果存在线外排队工位,根据排队编号绑定线外数据 需要时解除禁用
|
||||
////BaseDataSystemMES.MailLineAndSubLineData_InsertByEngineID_Subline(OpName,EngineID, EngineTypeID, EngineType);
|
||||
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
//MIS_BASE.Write_FalseGO(OpName, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:MesReadOver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
using bizFacade;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 发送提示消息
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
static private void AsyncSendMessage_Notice(string opname, string notice)
|
||||
{
|
||||
//通知Web界面
|
||||
BaseDataSystemMES.Web_Notice_Insert(opname, notice);
|
||||
string SendMessage = "MES|Notice|" + opname + "|" + "1";
|
||||
MIS_BASE.asyncSendMessage(SendMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 向WEB发送信息(value为字符串)
|
||||
/// </summary>
|
||||
/// <param name="Command">消息种类</param>
|
||||
/// <param name="Value">消息内容</param>
|
||||
/// <param name="OpName">工位号</param>
|
||||
static public string SendInfomation(string Command, string Value, string OpName)
|
||||
{
|
||||
string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
|
||||
return AsyncSendMessage(SendMessage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送信息到MES通讯服务器或者其他的
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
static private string AsyncSendMessage(string Message)
|
||||
{
|
||||
return MIS_BASE.asyncSendMessage(Message);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 批量发送WEB消息(Value为BOOL值)
|
||||
/// </summary>
|
||||
/// <param name="MessageNumm">消息编号组合</param>
|
||||
/// <param name="Value">消息值组合</param>
|
||||
/// <param name="OpName">工位号</param>
|
||||
static void Sendmessage(string MessageNumm, string Value, string OpName)
|
||||
{
|
||||
for (int i = 0; i < MessageNumm.Length; i++)
|
||||
{
|
||||
Sendmessage(MessageNumm[i], Value[i].ToString(), OpName);
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 选择发送给WEB的消息
|
||||
/// </summary>
|
||||
/// <param name="Num">消息类型</param>
|
||||
/// <param name="OpName">消息工位</param>
|
||||
static string Sendmessage(char Num, string Value, string OpName)
|
||||
{
|
||||
string SendMessage;
|
||||
string result = "";
|
||||
switch (Num)
|
||||
{
|
||||
case '1':
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage = "MES|ProcessList|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '2':
|
||||
//2显示物料
|
||||
SendMessage = "MES|MaterialList|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '3':
|
||||
//3显示操作指导图片
|
||||
SendMessage = "MES|PicShow|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '4':
|
||||
//4订单完工模块刷新完成数量
|
||||
SendMessage = "MES|OrderFormList|" + OpName + "|" + Value;
|
||||
AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '5':
|
||||
SendMessage = "MES|ShowMoby|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '6':
|
||||
SendMessage = "MES|MaterialCheckPosition|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '7':
|
||||
SendMessage = "MES|WorkStart|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case '8'://清除MES生成编号
|
||||
|
||||
break;
|
||||
case '9':
|
||||
SendMessage = "MES|ConfirmOkGo|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
case 'a':
|
||||
SendMessage = "MES|FixAllow|" + OpName + "|" + Value;
|
||||
result = AsyncSendMessage(SendMessage);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
///// <summary>
|
||||
///// 向WEB发送信息(value为字符串)
|
||||
///// </summary>
|
||||
///// <param name="Command">消息种类</param>
|
||||
///// <param name="Value">消息内容</param>
|
||||
///// <param name="OpName">工位号</param>
|
||||
//string SendInfomation(string Command, string Value, string OpName)
|
||||
//{
|
||||
// string SendMessage = "MES|" + Command + "|" + OpName + "|" + Value;
|
||||
// return AsyncSendMessage(SendMessage);
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 发送在线产量、在线节拍
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void SendActuallyCount(string OpName, int tagValue)
|
||||
{
|
||||
//当工件离开时,更新在线产量、在线节拍
|
||||
if (tagValue == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
int opNameCount = 0;//在线产量
|
||||
int opNameCountTime = 0;//在线节拍
|
||||
//基本数据_工作日历_班次产量查询_New
|
||||
BaseDataSystemMES.OpNameCount_New(OpName, out opNameCount, out opNameCountTime);
|
||||
string SendMessage;
|
||||
SendMessage = "MES|ActuallyCount|" + OpName + "|" + opNameCount.ToString() + "&" + opNameCountTime.ToString();
|
||||
AsyncSendMessage(SendMessage);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:SendActuallyCount");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,282 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
using System.Threading;
|
||||
using bizFacade;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
static object lockerWebSubmit = new object();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="Content"></param>
|
||||
static public void WebSubmit(object e)
|
||||
{
|
||||
lock (lockerWebSubmit)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string Content = Convert.ToString(msgEvent.TagValue);
|
||||
|
||||
string[] dataArray = Content.Split('|');
|
||||
if (dataArray.Length != 2)
|
||||
return;
|
||||
//消息类型
|
||||
string m_Command = dataArray[0].ToString();
|
||||
//消息参数
|
||||
string m_Value = dataArray[1].ToString();
|
||||
//消息参数数量
|
||||
string[] m_Value_array = m_Value.Split('&');
|
||||
//消息参数长度
|
||||
int m_Value_length = m_Value_array.Length;
|
||||
|
||||
//工件信息
|
||||
string engineID = "";
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
|
||||
{
|
||||
engineID = MIS_BASE.hashtable_EngineGetOver_EngineID[OpName].ToString();
|
||||
}
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs _e = new DoWhatPlc.CustomeEvetnArgs();
|
||||
_e.OpName = OpName;
|
||||
_e.TagValue = m_Value;
|
||||
|
||||
//根据请求的命令处理逻辑
|
||||
switch (m_Command)
|
||||
{
|
||||
case "Barcode":
|
||||
if (m_Value_length > 1) return;
|
||||
fun_Barcode(_e);
|
||||
break;
|
||||
case "ConfirmOkGo"://合格放行
|
||||
//删除不合格放行记录
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 1, false);
|
||||
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
break;
|
||||
case "FalseGO"://返修放行
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 3, false);
|
||||
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
break;
|
||||
case "NgGO"://不合格放行
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 2, false);
|
||||
//保存不合格信息(必须保存不合格放行信息,由于B5A的Moby没有不合格标志位)
|
||||
BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Insert(OpName, engineID, "", "");
|
||||
MIS_BASE.Write_FalseGO(OpName, true);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
break;
|
||||
case "OnLineState"://在线0、离线1、屏蔽2
|
||||
try
|
||||
{
|
||||
if (m_Value_length > 1) return;
|
||||
int a = Convert.ToInt32(m_Value);
|
||||
if (a <= 2)
|
||||
{
|
||||
BaseDataSystemMES.IsOnLine_Update(OpName, m_Value.ToString());
|
||||
MIS_BASE.Write_OnLineState(OpName, Convert.ToInt32(m_Value));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case "Reset"://复位,将MES所有的信息都复位了
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
break;
|
||||
case "FixAllow"://重新拧紧
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
break;
|
||||
case "IsAutoGetEngineID"://自动手动申请编号(线首)
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.Write_IsAutoGetEngineID(OpName, Convert.ToInt32(m_Value));
|
||||
break;
|
||||
case "PartPalletGoOver"://空托盘放行
|
||||
int Is_PartPalletGoOver;
|
||||
MIS_BASE.Read_PartPalletGoOver(OpName, out Is_PartPalletGoOver);
|
||||
if (Is_PartPalletGoOver == 1)
|
||||
{
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName, 0);
|
||||
}
|
||||
break;
|
||||
case "SetMoby"://清空托盘(线首)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
|
||||
break;
|
||||
case "RepairUplineMES"://返修上线
|
||||
MIS_BASE.Write_RepairUpline_MES(OpName, true);
|
||||
break;
|
||||
case "CancelRepair"://将返修件置为正常件
|
||||
|
||||
break;
|
||||
case "PartPalletCode"://申请写入托盘号
|
||||
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
|
||||
break;
|
||||
case "WritePartPalletCode"://写入托盘号
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.Write_PalletCode(OpName, Convert.ToInt32(m_Value));
|
||||
break;
|
||||
case "Normal"://启用正常拧紧工位
|
||||
MIS_BASE.Write_Normal(OpName, 1);
|
||||
MIS_BASE.Write_UnNormal(OpName, 0);
|
||||
break;
|
||||
case "UnNormal"://启用备用拧紧工位
|
||||
MIS_BASE.Write_Normal(OpName, 0);
|
||||
MIS_BASE.Write_UnNormal(OpName, 1);
|
||||
break;
|
||||
case "ResetDevice"://复位设备
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
break;
|
||||
case "IsNeedRepaire"://返修上线(返修上线点)
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
//修改托盘状态
|
||||
MIS_BASE.Write_PalletInfo(OpName, 3);
|
||||
//通知修改成功
|
||||
MIS_BASE.Write_UpdatePalletOK(OpName, true);
|
||||
IsNeedRepaire_OK(OpName);
|
||||
|
||||
}
|
||||
else if (Convert.ToInt32(m_Value) == 0)
|
||||
{
|
||||
//通知修改成功
|
||||
MIS_BASE.Write_UpdatePalletOK(OpName, true);
|
||||
//直接给出工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
else
|
||||
{ }
|
||||
|
||||
break;
|
||||
case "ContinueMatch":
|
||||
BaseDataSystemMES.QualityVerifyStatus_Hash_Write(OpName, true);
|
||||
break;
|
||||
//初始化网页信号
|
||||
case "IniSingalToWeb":
|
||||
InitializeSingalToWeb(OpName);
|
||||
break;
|
||||
case "Reset_Engine"://返修上线(返修上线点)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
//fun_EngineTypeGetOverPLC(OpName, 0);
|
||||
//fun_EngineTypeGetOverPLC(OpName, 1);
|
||||
break;
|
||||
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WebSubmit");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//1.工件到位后,PLC给MES传递机型(DBX0.4)(44),
|
||||
//MES判断条码是否全部扫描完成
|
||||
//PLC给出允许保存(DBX100.2)(19),MES见到(DBX100.2)(19)为1后给出保存完成(DBX102.2)(20),
|
||||
//PLC见到保存完成(DBX102.2)(20)为1后,清空允许保存(DBX100.2)(19),
|
||||
//MES见到允许保存(DBX100.2)(19)为0后,清空保存完成(DBX102.2)(20)
|
||||
//MES判断总合格标志(INT104)(21)为1后,给出合格放行(DBX2.5)(51)
|
||||
/// <summary>
|
||||
/// 扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
static public void fun_Barcode(DoWhatPlc.CustomeEvetnArgs e)
|
||||
{
|
||||
ThreadPool.QueueUserWorkItem(Barcode, e);
|
||||
}
|
||||
static private void SetMoby(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//清空Moby时,需要将MES信号清空
|
||||
MIS_BASE.Write_ClearMesMoby(OpName);
|
||||
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||||
|
||||
Sendmessage("5123", "1111", OpName);
|
||||
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/// 网页重现登录,恢复关闭前的页面状态
|
||||
/// </summary>
|
||||
/// <param name="Opname">工位号</param>
|
||||
static private void InitializeSingalToWeb(string Opname)
|
||||
{
|
||||
|
||||
//工件到位 DBX0.1
|
||||
bool S_WorkStart;
|
||||
bool S_FixAllow;
|
||||
bool S_EngineGetOver;
|
||||
bool S_MaterialVerifyOver;
|
||||
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||||
|
||||
|
||||
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||||
}
|
||||
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
|
||||
SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
Sendmessage("5123", "1111", Opname);
|
||||
}
|
||||
if (S_FixAllow == true)
|
||||
{
|
||||
SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||||
}
|
||||
if (S_MaterialVerifyOver == true)
|
||||
{
|
||||
SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
////using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
//using MesWork;
|
||||
//using SystemFramework;
|
||||
using System.Threading;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
static object lockerWorkStart = new object();
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
static private void WorkStart(object e)
|
||||
{
|
||||
lock (lockerWorkStart)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:WorkStart");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,805 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
using MisDataFunDll;
|
||||
//using MesWork;
|
||||
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE // : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// 全部数据列表
|
||||
/// </summary>
|
||||
public static DataTable BasicDataTagValue;
|
||||
/// <summary>
|
||||
/// MES_基本数据_测量范围
|
||||
/// </summary>
|
||||
public static DataTable BasicDataTagValueUpDown;
|
||||
/// <summary>
|
||||
/// 是否通过监控系统保存数据
|
||||
/// 1:通过监控系统保存采集的质量数据;0:不通过监控系统保存采集的质量数据
|
||||
/// </summary>
|
||||
static public Hashtable hashtable_tagTable_OpName_SaveData;
|
||||
/// <summary>
|
||||
/// 变量代码与列位置
|
||||
/// </summary>
|
||||
static public Hashtable hashtable_tagTable_TagID_TagOrderBy;
|
||||
/// <summary>
|
||||
/// 变量代码与变量排序
|
||||
/// </summary>
|
||||
static public Hashtable hashtable_tagTable_TagID_TagItemOrderBy;
|
||||
/// <summary>
|
||||
/// 变量代码与变量特点
|
||||
/// 0:没定义1:工位合格标志2:需要合格标志的测量数据3:每个工位的合格标志4:物料5:IQA码6:压装数据7:压装合格标志8:(自动拧紧)工位合格标志
|
||||
/// </summary>
|
||||
static public Hashtable hashtable_tagTable_TagID_TagProperty;
|
||||
/// <summary>
|
||||
/// 发动机类型转换表
|
||||
/// SELECT ID,发动机机型代码 FROM MES_计划BOM_发动机型号代码
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineTypeID;
|
||||
|
||||
/// <summary>
|
||||
/// 工位号与工位上下线类型
|
||||
/// (0普通工位)(1正常上线)(2正常下线)(3返修上线)(4返修下线)
|
||||
/// (5分线上线 总线)(6分线上线 分线)
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_OpType;
|
||||
/// <summary>
|
||||
/// 工位号与大屏幕代码
|
||||
/// 对应LED大屏幕(1,2,3,4)
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_LedID;
|
||||
/// <summary>
|
||||
/// 大屏幕显示产量端口(41104)
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_LedID_Port;
|
||||
|
||||
/// <summary>
|
||||
/// 大屏幕显示Andon大屏幕代码 1
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_AndonID;
|
||||
|
||||
/// <summary>
|
||||
/// 大屏幕显示Andon端口 (41105)
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_AndonID_Port;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否有打印机(0,1)
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_IsPrinter;
|
||||
|
||||
/// <summary>
|
||||
/// 打印机通讯端口
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_IsPrinter_Port;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工位号与目标循环时间
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_TargetTime;
|
||||
/// <summary>
|
||||
/// 工位号与线体类型
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_LineType;
|
||||
/// <summary>
|
||||
/// 是否有工位计算机
|
||||
/// </summary>
|
||||
public static Hashtable hashtableOpName_IsHaveComputer;
|
||||
/// <summary>
|
||||
/// 变量名称
|
||||
/// </summary>
|
||||
public static Hashtable hashtableTagID_TagName;
|
||||
/// <summary>
|
||||
/// 工位号
|
||||
/// </summary>
|
||||
public static Hashtable hashtableTagID_OpName;
|
||||
/// <summary>
|
||||
/// 数据来源
|
||||
/// </summary>
|
||||
public static Hashtable hashtableTagID_OpNameFrom;
|
||||
|
||||
/// <summary>
|
||||
/// 工位名称
|
||||
/// </summary>
|
||||
static Hashtable hashtableTagID_OpName_Name;
|
||||
/// <summary>
|
||||
/// 测量位置
|
||||
/// </summary>
|
||||
public static Hashtable hashtableTagID_ShaftID;
|
||||
/// <summary>
|
||||
/// 测量项目
|
||||
/// </summary>
|
||||
public static Hashtable hashtableTagID_ItemVale;
|
||||
/// <summary>
|
||||
/// 变量代码与变量类型
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_tagTable_TagID_TagTypeID_All;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///工位号与机床状态
|
||||
/// [测量数据机床状态]
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatus_OpName;
|
||||
/// <summary>
|
||||
///工位号与工件离开 1->0 =0 无工件或工件离开
|
||||
///工位号与工件到位 0->1 =1 有工件或工件到达
|
||||
///[测量数据发动机在线状态]
|
||||
/// </summary>
|
||||
public static Hashtable m_WorkStart_OpName;
|
||||
|
||||
/// <summary>
|
||||
///工位号与工件到位时间
|
||||
///工位号与工件到位 0->1
|
||||
///[测量数据发动机在线状态]
|
||||
/// </summary>
|
||||
public static Hashtable m_WorkStart_OpName_Time;
|
||||
|
||||
/// <summary>
|
||||
///工位号与工件到位时间
|
||||
///工位号与工件到位 0->1,零件运动方向
|
||||
/// </summary>
|
||||
public static Hashtable m_WorkStart_OpName_PartMoveDirection;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///工位号与发动机号
|
||||
/// </summary>
|
||||
public static Hashtable m_EngineTrace_OpName;
|
||||
/// <summary>
|
||||
///工位号与发动机号_时间
|
||||
/// </summary>
|
||||
public static Hashtable m_EngineTrace_OpName_Time;
|
||||
/// <summary>
|
||||
///工位号与合格标志
|
||||
///[测量数据发动机在线状态]
|
||||
/// </summary>
|
||||
public static Hashtable m_QualityMask_OpName;
|
||||
|
||||
/// <summary>
|
||||
///工位号与机型
|
||||
///[测量数据发动机在线状态]
|
||||
/// </summary>
|
||||
public static Hashtable m_EngineNumberType_OpName;
|
||||
/// <summary>
|
||||
///工位号与发动机号
|
||||
///[测量数据发动机在线状态]
|
||||
/// </summary>
|
||||
public static Hashtable m_EngineNumber_OpName;
|
||||
|
||||
/// <summary>
|
||||
///工位号与订单号
|
||||
///[测量数据发动机在线状态]
|
||||
/// </summary>
|
||||
public static Hashtable m_OrderForm_OpName;
|
||||
/// <summary>
|
||||
///工位号与操作者工号
|
||||
///[测量数据发动机在线状态]
|
||||
/// </summary>
|
||||
public static Hashtable m_OperatorCode_OpName;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 测量合格标志
|
||||
/// 全部测量数据的测量工位
|
||||
/// 全部测量数据的测量工位的数据来源
|
||||
/// 全部测量数据的测量工位的数据来源的测量变量
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_QualityData_GoodBad_MIS_OpName;
|
||||
/// <summary>
|
||||
/// 列位置
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_QualityData_GoodBad_Index;
|
||||
|
||||
/// <summary>
|
||||
/// MesServerCode
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_MesServerCode;
|
||||
/// <summary>
|
||||
/// MesDll
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_MesDll;
|
||||
/// <summary>
|
||||
/// 各个工位是否允许工作
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_IsAllowWork;
|
||||
|
||||
/// <summary>
|
||||
/// 返修工位是否需要强制合格放行
|
||||
/// //20141104 ljl
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_IsConfirmOkGo;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工步属性哈西表
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_workStepProperty;
|
||||
|
||||
/// <summary>
|
||||
/// 工作顺序哈西表
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_WorkGroupIndex;
|
||||
|
||||
/// <summary>
|
||||
/// 返修工位哈西表
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_OpNameRepair;
|
||||
|
||||
/// <summary>
|
||||
/// 记录工件到位的发动机机型代码
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineGetOver_EngineTypeID;
|
||||
/// <summary>
|
||||
/// 记录工件到位的发动机机型
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineGetOver_EngineType;
|
||||
/// <summary>
|
||||
/// 记录工件到位的发动机号
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineGetOver_EngineID;
|
||||
/// <summary>
|
||||
/// 记录工件到位的订单号
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_EngineGetOver_OrderForm;
|
||||
|
||||
/// <summary>
|
||||
/// 拧紧/压装过程中的合格标志
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_QualityMesRead;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 物料检测哈希表
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_CheckMaterial;
|
||||
|
||||
/// <summary>
|
||||
/// 托盘状态哈希表
|
||||
/// </summary>
|
||||
public static Hashtable hashtable_PalletInfo;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位机床上电开始时间
|
||||
///机床上电产生 0->1
|
||||
///机床上电解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusPutOn_OpName_Time;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位循环开始 开始时间
|
||||
///循环开始产生 0->1
|
||||
///循环开始解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusWorkOn_OpName_Time;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位机床故障开始时间
|
||||
///机床故障产生 0->1
|
||||
///机床故障解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusAlarm_OpName_Time;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位上料无件开始时间
|
||||
///上料无件产生 0->1
|
||||
///上料无件解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusNoPart_OpName_Time;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位下料堵塞开始时间
|
||||
///下料堵塞产生 0->1
|
||||
///下料堵塞解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusBlock_OpName_Time;
|
||||
|
||||
/// <summary>
|
||||
///工位号与托盘离开 1->0
|
||||
///工位号与托盘到位 0->1
|
||||
///[测量数据_监控系统_托盘到位]
|
||||
/// </summary>
|
||||
public static Hashtable m_PartPalletStatus_OpName;
|
||||
/// <summary>
|
||||
///工位号与托盘离开 1->0
|
||||
///工位号与托盘到位 0->1
|
||||
///[测量数据_监控系统_托盘到位]
|
||||
/// </summary>
|
||||
public static Hashtable m_PartPalletStatus_OpName_Time;
|
||||
/// <summary>
|
||||
/// 托盘到位(1)托盘离开(0) (DBX101.7)(13)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位机床上电开始时间
|
||||
///机床上电产生 0->1
|
||||
///机床上电解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusPutOn_OpName;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位循环开始 开始时间
|
||||
///循环开始产生 0->1
|
||||
///循环开始解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusWorkOn_OpName;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位机床故障开始时间
|
||||
///机床故障产生 0->1
|
||||
///机床故障解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusAlarm_OpName;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位上料无件开始时间
|
||||
///上料无件产生 0->1
|
||||
///上料无件解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusNoPart_OpName;
|
||||
/// <summary>
|
||||
///[测量数据机床状态_分拆统计]
|
||||
///各个工位下料堵塞开始时间
|
||||
///下料堵塞产生 0->1
|
||||
///下料堵塞解除 1->0
|
||||
/// </summary>
|
||||
public static Hashtable m_MachineStatusBlock_OpName;
|
||||
|
||||
public static NameValueCollection hashtable_TagTypeDataType ;
|
||||
public static NameValueCollection hashtable_TagType;
|
||||
/// <summary>
|
||||
/// 托盘代码(DBB86)(80)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
|
||||
/// <summary>
|
||||
/// 创建MesServerCode哈西表
|
||||
/// </summary>
|
||||
static public void InitHashtable_MesServerCode()
|
||||
{
|
||||
hashtable_MesServerCode = new Hashtable();
|
||||
hashtable_IsAllowWork = new Hashtable();
|
||||
hashtable_WorkGroupIndex = new Hashtable();
|
||||
hashtable_EngineGetOver_EngineTypeID = new Hashtable();
|
||||
hashtable_EngineGetOver_EngineType = new Hashtable();
|
||||
hashtable_EngineGetOver_EngineID = new Hashtable();
|
||||
hashtable_EngineGetOver_OrderForm = new Hashtable();
|
||||
hashtable_QualityMesRead = new Hashtable();
|
||||
hashtable_CheckMaterial = new Hashtable();
|
||||
hashtable_PalletInfo = new Hashtable();
|
||||
hashtable_IsConfirmOkGo = new Hashtable();
|
||||
hashtable_MesDll = new Hashtable();
|
||||
|
||||
string OpName;
|
||||
string MesServerCode;
|
||||
string MesDll;
|
||||
string workStepProperty;
|
||||
string OpNameRepair;
|
||||
DataTable dt;
|
||||
dt = MisDataFun.GetMesServerCodeFromMIS();
|
||||
if (dt != null)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
OpName = dt.Rows[i]["工位号"].ToString();
|
||||
MesServerCode = dt.Rows[i]["MesServerCode"].ToString();
|
||||
MesDll = dt.Rows[i]["MesDll"].ToString();
|
||||
hashtable_MesDll.Add(OpName, MesDll);
|
||||
hashtable_MesServerCode.Add(OpName, MesServerCode);
|
||||
hashtable_IsAllowWork.Add(OpName, 1);
|
||||
hashtable_IsConfirmOkGo.Add(OpName, 0);//20141104 ljl
|
||||
hashtable_PalletInfo.Add(OpName, 0);//20141104 ljl
|
||||
hashtable_WorkGroupIndex.Add(OpName, 1);
|
||||
hashtable_EngineGetOver_EngineTypeID.Add(OpName, 0);
|
||||
hashtable_EngineGetOver_EngineType.Add(OpName, "");
|
||||
hashtable_EngineGetOver_EngineID.Add(OpName, "");
|
||||
hashtable_EngineGetOver_OrderForm.Add(OpName, "");
|
||||
hashtable_QualityMesRead.Add(OpName, 0);
|
||||
hashtable_CheckMaterial.Add(OpName, new bool[16]);
|
||||
}
|
||||
}
|
||||
HashtableList.hashtable_MesServerCode_Temp = hashtable_MesServerCode;
|
||||
HashtableList.hashtable_MesDll_Temp = hashtable_MesDll;
|
||||
|
||||
HashtableList.hashtable_EngineGetOver_EngineID_Temp = hashtable_EngineGetOver_EngineID;
|
||||
HashtableList.hashtable_EngineGetOver_EngineTypeID_Temp = hashtable_EngineGetOver_EngineTypeID;
|
||||
HashtableList.hashtable_EngineGetOver_EngineType_Temp = hashtable_EngineGetOver_EngineType;
|
||||
HashtableList.hashtable_EngineGetOver_OrderForm_Temp = hashtable_EngineGetOver_OrderForm;
|
||||
|
||||
//初始化工步属性
|
||||
hashtable_workStepProperty = new Hashtable();
|
||||
dt = MisDataFun.GetworkStepPropertyFromMIS();
|
||||
if (dt != null)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
OpName = dt.Rows[i]["工位号"].ToString();
|
||||
workStepProperty = dt.Rows[i]["工步属性"].ToString();
|
||||
hashtable_workStepProperty.Add(OpName, workStepProperty);
|
||||
}
|
||||
}
|
||||
|
||||
//返修工位
|
||||
hashtable_OpNameRepair = new Hashtable();
|
||||
dt = MisDataFun.GetOpNameRepairFromMIS();
|
||||
if (dt != null)
|
||||
{
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
OpName = dt.Rows[i]["工位号"].ToString();
|
||||
OpNameRepair = dt.Rows[i]["返修工位号"].ToString();
|
||||
hashtable_OpNameRepair.Add(OpName, OpNameRepair);
|
||||
}
|
||||
}
|
||||
|
||||
HashtableList.hashtable_OpNameRepair_Temp = hashtable_OpNameRepair;
|
||||
HashtableList.hashtable_workStepProperty_Temp = hashtable_workStepProperty;
|
||||
HashtableList.hashtable_QualityMesRead_Temp = hashtable_QualityMesRead;
|
||||
HashtableList.hashtable_IsAllowWork_Temp = hashtable_IsAllowWork;
|
||||
HashtableList.hashtable_WorkGroupIndex_Temp = hashtable_WorkGroupIndex;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建合格标志哈西表
|
||||
/// </summary>
|
||||
private static void InitHashtable_QualityData_GoodBad()
|
||||
{
|
||||
//列位置
|
||||
string index;
|
||||
//
|
||||
int tagID;
|
||||
DataTable dt ;
|
||||
dt = MisDataFun.BaseData_tagTable_All_B5A();
|
||||
|
||||
hashtable_QualityData_GoodBad_Index = new Hashtable();
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
tagID = Convert.ToInt32(dt.Rows[i]["TagID"]);
|
||||
index = (dt.Rows[i]["列位置"]).ToString();
|
||||
hashtable_QualityData_GoodBad_Index.Add(tagID, index);
|
||||
}
|
||||
|
||||
hashtable_EngineTypeID = new Hashtable();
|
||||
dt = MisDataFun.BaseData_tagTable_QualityData_EngineTypeID();
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
tagID = Convert.ToInt32(dt.Rows[i]["发动机机型代码"]);
|
||||
index = (dt.Rows[i]["ID"]).ToString();
|
||||
hashtable_EngineTypeID.Add(tagID, index);
|
||||
}
|
||||
//工位号
|
||||
DataTable dt_OpName;
|
||||
//工位号数据来源
|
||||
DataTable dt_OpNameFrom;
|
||||
//数据来源对应的TagID
|
||||
DataTable dt_OpNameTagID;
|
||||
string opName;
|
||||
string opNameFrom;
|
||||
hashtable_QualityData_GoodBad_MIS_OpName = new Hashtable();
|
||||
// 测量合格标志
|
||||
// 全部测量数据的测量工位的数据来源
|
||||
Hashtable hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom;
|
||||
|
||||
// 测量合格标志
|
||||
// 全部测量数据的测量工位的数据来源的测量变量
|
||||
Hashtable hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom_TagID;
|
||||
dt_OpName = MisDataFun.BaseData_tagTable_QualityData_GoodBad_MIS_OpName_B5A();
|
||||
if (dt_OpName != null)
|
||||
{
|
||||
//有不合格标志的测量工位
|
||||
for (int i = 0; i < dt_OpName.Rows.Count; i++)
|
||||
{
|
||||
//有不合格标志的测量工位 对应的 数据来源工位号
|
||||
hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom = new Hashtable();
|
||||
opName = dt_OpName.Rows[i]["工位号"].ToString();
|
||||
dt_OpNameFrom = MisDataFun.BaseData_tagTable_QualityData_GoodBad_MIS_OpName(opName);
|
||||
if (dt_OpNameFrom != null)
|
||||
{
|
||||
for (int j = 0; j < dt_OpNameFrom.Rows.Count; j++)
|
||||
{
|
||||
opNameFrom = dt_OpNameFrom.Rows[j]["数据来源"].ToString();
|
||||
dt_OpNameTagID = MisDataFun.BaseData_tagTable_QualityData_GoodBad_MIS_OpName(opName, opNameFrom);
|
||||
//
|
||||
hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom_TagID = new Hashtable();
|
||||
if (dt_OpNameTagID != null)
|
||||
{
|
||||
for (int k = 0; k < dt_OpNameTagID.Rows.Count; k++)
|
||||
{
|
||||
tagID = Convert.ToInt32(dt_OpNameTagID.Rows[k]["TagID"]);
|
||||
hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom_TagID.Add(tagID, tagID);
|
||||
}
|
||||
}
|
||||
tagID = Convert.ToInt32(dt_OpNameFrom.Rows[j]["TagID"]);
|
||||
//全部测量数据的测量工位的数据来源的测量变量
|
||||
hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom.Add(tagID, hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom_TagID);
|
||||
}
|
||||
}
|
||||
hashtable_QualityData_GoodBad_MIS_OpName.Add(opName, hashtable_QualityData_GoodBad_MIS_OpName_OpNameFrom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static NameValueCollection hashtable_TagTypeID_OpName_ToTagID;
|
||||
|
||||
/// <summary>
|
||||
/// 变量代码与其他字段的对应关系
|
||||
/// </summary>
|
||||
public static void InitHashtableTagID()
|
||||
{
|
||||
//变量代码
|
||||
string tagID;
|
||||
//变量名称
|
||||
string tagName;
|
||||
//工位号
|
||||
string opNmae;
|
||||
//测量位置
|
||||
string shaftID;
|
||||
//测量项目
|
||||
string itemVale;
|
||||
//变量排序
|
||||
int tagItemOrderBy;
|
||||
//变量特点
|
||||
// 0:没定义1:工位合格标志2:需要合格标志的测量数据3:每个工位的合格标志4:物料5:IQA码6:压装数据7:压装合格标志8:(自动拧紧)工位合格标志
|
||||
int tagProperty;
|
||||
//列位置
|
||||
int tagOrderBy;
|
||||
InitHashtable_QualityData_GoodBad();
|
||||
//MesServerCode哈希表创建
|
||||
InitHashtable_MesServerCode();
|
||||
//列位置
|
||||
hashtable_tagTable_TagID_TagOrderBy = new Hashtable();
|
||||
// 变量代码与变量排序
|
||||
hashtable_tagTable_TagID_TagItemOrderBy = new Hashtable();
|
||||
// 变量代码与变量特点
|
||||
// 0:没定义1:工位合格标志2:需要合格标志的测量数据3:每个工位的合格标志4:物料5:IQA码6:压装数据7:压装合格标志8:(自动拧紧)工位合格标志
|
||||
hashtable_tagTable_TagID_TagProperty = new Hashtable();
|
||||
hashtable_tagTable_OpName_SaveData = new Hashtable();
|
||||
//工位号与机床状态
|
||||
//[测量数据发动机在线状态]
|
||||
m_MachineStatus_OpName = new Hashtable();
|
||||
////工位号与工件离开 0
|
||||
////工位号与工件到位 1
|
||||
////[测量数据发动机在线状态]
|
||||
//m_WorkStart_OpName = new Hashtable();
|
||||
////工位号与工件到位时间
|
||||
////工位号与工件到位 0->1
|
||||
////[测量数据发动机在线状态]
|
||||
//m_WorkStart_OpName_Time = new Hashtable();
|
||||
//工位号与发动机号
|
||||
//[测量数据发动机在线状态]
|
||||
m_EngineTrace_OpName = new Hashtable();
|
||||
m_EngineTrace_OpName_Time = new Hashtable();
|
||||
//工位号与合格标志
|
||||
//[测量数据发动机在线状态]
|
||||
m_QualityMask_OpName = new Hashtable();
|
||||
//工位号与目标循环时间
|
||||
hashtableOpName_TargetTime = new Hashtable();
|
||||
//工位号与线体类型
|
||||
hashtableOpName_LineType = new Hashtable();
|
||||
//是否有工位计算机
|
||||
hashtableOpName_IsHaveComputer = new Hashtable();
|
||||
|
||||
//工位号与机型
|
||||
//[测量数据发动机在线状态]
|
||||
m_EngineNumberType_OpName = new Hashtable();
|
||||
//工位号与发动机号
|
||||
//[测量数据发动机在线状态]
|
||||
m_EngineNumber_OpName = new Hashtable();
|
||||
//工位号与订单号
|
||||
//[测量数据发动机在线状态]
|
||||
m_OrderForm_OpName = new Hashtable();
|
||||
//工位号与操作者工号
|
||||
//[测量数据发动机在线状态]
|
||||
m_OperatorCode_OpName = new Hashtable();
|
||||
|
||||
|
||||
// <summary>
|
||||
// 变量名称
|
||||
// </summary>
|
||||
hashtableTagID_TagName = new Hashtable();
|
||||
// <summary>
|
||||
// 工位号
|
||||
// </summary>
|
||||
hashtableTagID_OpName = new Hashtable();
|
||||
// <summary>
|
||||
// 数据来源
|
||||
// </summary>
|
||||
hashtableTagID_OpNameFrom = new Hashtable();
|
||||
// <summary>
|
||||
// 工位名称
|
||||
// </summary>
|
||||
hashtableTagID_OpName_Name = new Hashtable();
|
||||
// <summary>
|
||||
// 测量位置
|
||||
// </summary>
|
||||
hashtableTagID_ShaftID = new Hashtable();
|
||||
// <summary>
|
||||
// 测量项目
|
||||
// </summary>
|
||||
hashtableTagID_ItemVale = new Hashtable();
|
||||
|
||||
hashtable_tagTable_TagID_TagTypeID_All = new Hashtable();
|
||||
|
||||
// 工位号与工位上下线类型
|
||||
// (0普通工位)(1正常上线)(2正常下线)(3返修上线)(4返修下线)
|
||||
// (5 分线上线 总线) (6 分线上线 总线)
|
||||
hashtableOpName_OpType = new Hashtable();
|
||||
// 工位号与大屏幕代码
|
||||
// 对应LED大屏幕(1,2,3,4)
|
||||
hashtableOpName_LedID = new Hashtable();
|
||||
|
||||
|
||||
|
||||
|
||||
// 大屏幕显示产量端口(41104)
|
||||
hashtableOpName_LedID_Port = new Hashtable();
|
||||
// 大屏幕显示Andon大屏幕代码 1
|
||||
hashtableOpName_AndonID = new Hashtable();
|
||||
// 大屏幕显示Andon端口 (41105)
|
||||
hashtableOpName_AndonID_Port = new Hashtable();
|
||||
// 是否有打印机(0,1)
|
||||
hashtableOpName_IsPrinter = new Hashtable();
|
||||
// 打印机通讯端口 (缸盖打印机 41101) (发动机上线打印机 41102) (发动机下线打印机 41103)
|
||||
hashtableOpName_IsPrinter_Port = new Hashtable();
|
||||
|
||||
m_WorkStart_OpName_Time = new Hashtable();
|
||||
m_WorkStart_OpName = new Hashtable();
|
||||
|
||||
|
||||
m_MachineStatusPutOn_OpName_Time = new Hashtable();
|
||||
m_MachineStatusPutOn_OpName = new Hashtable();
|
||||
m_MachineStatusWorkOn_OpName_Time = new Hashtable();
|
||||
m_MachineStatusWorkOn_OpName = new Hashtable();
|
||||
m_MachineStatusAlarm_OpName_Time = new Hashtable();
|
||||
m_MachineStatusAlarm_OpName = new Hashtable();
|
||||
m_MachineStatusNoPart_OpName_Time = new Hashtable();
|
||||
m_MachineStatusNoPart_OpName = new Hashtable();
|
||||
m_MachineStatusBlock_OpName_Time = new Hashtable();
|
||||
m_MachineStatusBlock_OpName = new Hashtable();
|
||||
|
||||
|
||||
|
||||
|
||||
m_WorkStart_OpName_PartMoveDirection = new Hashtable();
|
||||
m_PartPalletStatus_OpName_Time = new Hashtable();
|
||||
m_PartPalletStatus_OpName = new Hashtable();
|
||||
|
||||
hashtable_TagTypeID_OpName_ToTagID = new NameValueCollection();
|
||||
|
||||
|
||||
|
||||
DataTable dt;
|
||||
DateTime dateTime;
|
||||
dateTime = DateTime.Now;
|
||||
dt = MisDataFun.BaseData_tagTable_All();
|
||||
|
||||
//变量类型代码
|
||||
int TagTypeID;
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
tagID = dt.Rows[i]["TagID"].ToString ();
|
||||
tagName = Convert.ToString(dt.Rows[i]["TagName"]);
|
||||
opNmae = Convert.ToString(dt.Rows[i]["工位号"]);
|
||||
shaftID = Convert.ToString(dt.Rows[i]["测量位置"]);
|
||||
itemVale = Convert.ToString(dt.Rows[i]["测量项目"]);
|
||||
TagTypeID = Convert.ToInt32(dt.Rows[i]["变量类型代码"]);
|
||||
tagItemOrderBy = Convert.ToInt32(dt.Rows[i]["变量排序"]);
|
||||
tagProperty = Convert.ToInt32(dt.Rows[i]["变量特点"]);
|
||||
tagOrderBy = Convert.ToInt32(dt.Rows[i]["列位置"]);
|
||||
|
||||
hashtableTagID_TagName.Add(tagID, tagName);
|
||||
hashtableTagID_OpName.Add(tagID, opNmae);
|
||||
hashtableTagID_ShaftID.Add(tagID, shaftID);
|
||||
hashtableTagID_ItemVale.Add(tagID, itemVale);//列位置
|
||||
hashtable_tagTable_TagID_TagTypeID_All.Add(tagID, TagTypeID);
|
||||
hashtable_tagTable_TagID_TagItemOrderBy.Add(tagID, tagItemOrderBy);
|
||||
hashtable_tagTable_TagID_TagProperty.Add(tagID, tagProperty);
|
||||
hashtable_tagTable_TagID_TagOrderBy.Add(tagID, tagOrderBy);
|
||||
|
||||
|
||||
}
|
||||
dt = MisDataFun.BaseData_tagTable_OpName();
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
//是否通过监控系统保存数据
|
||||
// 1:通过监控系统保存采集的质量数据;0:不通过监控系统保存采集的质量数据
|
||||
hashtable_tagTable_OpName_SaveData.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["是否通过监控系统保存数据"]));
|
||||
|
||||
hashtableOpName_TargetTime.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToString(dt.Rows[i]["目标循环时间"]));
|
||||
hashtableOpName_LineType.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToString(dt.Rows[i]["线体类型"]));
|
||||
hashtableOpName_IsHaveComputer.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToString(dt.Rows[i]["是否有工位计算机"]));
|
||||
//用于LED显示
|
||||
// [MES_计划BOM_工位与名称]
|
||||
// 工位上下线类型
|
||||
//(0普通工位)(1正常上线)(2正常下线)(3返修上线)(4返修下线)
|
||||
hashtableOpName_OpType.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["工位上下线类型"]));
|
||||
hashtableOpName_LedID.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["大屏幕代码"]));
|
||||
m_WorkStart_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
|
||||
m_WorkStart_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
|
||||
|
||||
|
||||
m_MachineStatusPutOn_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
|
||||
m_MachineStatusPutOn_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
|
||||
m_MachineStatusWorkOn_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
|
||||
m_MachineStatusWorkOn_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
|
||||
m_MachineStatusAlarm_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
|
||||
m_MachineStatusAlarm_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
|
||||
m_MachineStatusNoPart_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
|
||||
m_MachineStatusNoPart_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
|
||||
m_MachineStatusBlock_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
|
||||
m_MachineStatusBlock_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
|
||||
|
||||
|
||||
|
||||
m_WorkStart_OpName_PartMoveDirection.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
|
||||
|
||||
|
||||
m_PartPalletStatus_OpName_Time.Add(Convert.ToString(dt.Rows[i]["工位号"]), dateTime);
|
||||
m_PartPalletStatus_OpName.Add(Convert.ToString(dt.Rows[i]["工位号"]), 0);
|
||||
try
|
||||
{
|
||||
hashtableOpName_LedID_Port.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["大屏幕显示产量端口"]));
|
||||
}
|
||||
catch { }
|
||||
try
|
||||
{
|
||||
hashtableOpName_AndonID.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["大屏幕显示Andon大屏幕代码"]));
|
||||
}
|
||||
catch { }
|
||||
try
|
||||
{
|
||||
hashtableOpName_AndonID_Port.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["大屏幕显示Andon端口"]));
|
||||
}
|
||||
catch { }
|
||||
try { hashtableOpName_IsPrinter.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["是否有打印机"])); }
|
||||
catch { }
|
||||
try
|
||||
{
|
||||
hashtableOpName_IsPrinter_Port.Add(Convert.ToString(dt.Rows[i]["工位号"]), Convert.ToInt32(dt.Rows[i]["打印机通讯端口"]));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
|
||||
//20170310 CLB新加
|
||||
dt = MisDataFun.BaseData_tagTable_OpcServerMES_ALL_CF();
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
hashtable_TagTypeID_OpName_ToTagID.Add(Convert.ToString(dt.Rows[i]["工位号"]) + "_" + Convert.ToString(dt.Rows[i]["变量类型代码"]), Convert.ToString(dt.Rows[i]["TagID"]));
|
||||
//hashtable_TagTypeID_OpName_ToTagID;
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
using MisDataFunDll;
|
||||
//using MesWork;
|
||||
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE // : Form
|
||||
{
|
||||
public class HashtableList
|
||||
{
|
||||
/// <summary>
|
||||
/// MesServerCode
|
||||
/// </summary>
|
||||
static public Hashtable hashtable_MesServerCode_Temp;
|
||||
/// <summary>
|
||||
/// MesDll
|
||||
/// </summary>
|
||||
static public Hashtable hashtable_MesDll_Temp;
|
||||
static public NameValueCollection hashtable_TagTypeDataType_Temp;
|
||||
static public NameValueCollection hashtable_TagType_Temp;
|
||||
static public Hashtable hashtable_TagTypeTagName_Temp;
|
||||
|
||||
static public Hashtable hashtable_EngineGetOver_EngineTypeID_Temp;
|
||||
static public Hashtable hashtable_EngineGetOver_EngineType_Temp;
|
||||
static public Hashtable hashtable_EngineGetOver_EngineID_Temp;
|
||||
static public Hashtable hashtable_EngineGetOver_OrderForm_Temp;
|
||||
|
||||
static public Hashtable hashtable_OpNameRepair_Temp;
|
||||
|
||||
static public Hashtable hashtable_WorkGroupIndex_Temp;
|
||||
static public Hashtable hashtable_workStepProperty_Temp;
|
||||
static public Hashtable hashtable_QualityMesRead_Temp;
|
||||
static public Hashtable hashtable_IsAllowWork_Temp;
|
||||
/// <summary>
|
||||
/// 工位号与工位上下线类型
|
||||
/// (0普通工位)(1正常上线)(2正常下线)(3返修上线)(4返修下线)
|
||||
/// 5 分线上线(总线) 6 分线上线(分线)
|
||||
/// </summary>
|
||||
static public Hashtable hashtableOpName_OpType_Temp;
|
||||
|
||||
static public Hashtable hashtable_tagTable_OpName_SaveData_Temp;
|
||||
|
||||
|
||||
public Hashtable hashtable_tagTable_OpName_SaveData;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// 工位号与工位上下线类型
|
||||
/// (0普通工位)(1正常上线)(2正常下线)(3返修上线)(4返修下线)
|
||||
/// 5 分线上线(总线) 6 分线上线(分线)
|
||||
/// </summary>
|
||||
public Hashtable hashtableOpName_OpType;
|
||||
public Hashtable hashtable_IsAllowWork;
|
||||
public Hashtable hashtable_QualityMesRead;
|
||||
public Hashtable hashtable_workStepProperty;
|
||||
public Hashtable hashtable_OpNameRepair;
|
||||
/// <summary>
|
||||
/// MesServerCode
|
||||
/// </summary>
|
||||
public Hashtable hashtable_MesServerCode;
|
||||
public Hashtable hashtable_TagTypeTagName;
|
||||
|
||||
/// <summary>
|
||||
/// MesDll
|
||||
/// </summary>
|
||||
public Hashtable hashtable_MesDll;
|
||||
public NameValueCollection hashtable_TagTypeDataType;
|
||||
public NameValueCollection hashtable_TagType;
|
||||
|
||||
|
||||
public Hashtable hashtable_EngineGetOver_EngineTypeID;
|
||||
public Hashtable hashtable_EngineGetOver_EngineType;
|
||||
public Hashtable hashtable_EngineGetOver_EngineID;
|
||||
public Hashtable hashtable_EngineGetOver_OrderForm;
|
||||
|
||||
public Hashtable hashtable_WorkGroupIndex;
|
||||
|
||||
public DataTable BasicDataTagValue;
|
||||
public DataTable BasicDataTagValueUpDown;
|
||||
public Hashtable hashtable_EngineTypeID;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
//using bizFacade;
|
||||
//using DataLinkMesWork;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备保养计划
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="MachineType"></param>
|
||||
/// <param name="PlanID"></param>
|
||||
public delegate void MachinePlan_Invoke(string OpName, string MachineType, string PlanID);
|
||||
/// <summary>
|
||||
/// 设备保养计划
|
||||
/// </summary>
|
||||
public MachinePlan_Invoke machinePlan_Invoke;
|
||||
/// <summary>
|
||||
/// 设备保养
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="MachineType">设备保养类型</param>
|
||||
/// <param name="PlanID">工作日历流水号</param>
|
||||
public void MachinePlan(string OpName, string MachineType, string PlanID)
|
||||
{
|
||||
try
|
||||
{
|
||||
string SendMessage;
|
||||
SendMessage = "MES|MachinePlan|" + OpName + "|" + MachineType + "&" + PlanID;
|
||||
asyncSendMessage(SendMessage);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "MachinePlan");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设备保养计划Timer
|
||||
/// </summary>
|
||||
private Timer timer_Machine;
|
||||
/// <summary>
|
||||
/// 初始化设备保养计划
|
||||
/// </summary>
|
||||
public void InitMachinePlan(MachinePlan_Invoke machinePlan_Invoke)
|
||||
{
|
||||
this.machinePlan_Invoke = machinePlan_Invoke;
|
||||
timer_Machine = new Timer();
|
||||
timer_Machine.Interval = 60000;//每隔一分钟查询一次
|
||||
timer_Machine.Tick += new EventHandler(timer_Machine_Tick);
|
||||
timer_Machine.Start();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分钟调度
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void timer_Machine_Tick(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//if (ApplicationConfig.Is_MachinePlan == 1)
|
||||
//{
|
||||
// DataTable dt;
|
||||
// string opName;
|
||||
// string machineType;//保养类型代码
|
||||
// string planID;//工作日历流水号
|
||||
// BaseDataSystemMES.MachinePlan_Select(out dt);
|
||||
// if (dt != null)
|
||||
// {
|
||||
// if (dt.Rows.Count > 0)
|
||||
// {
|
||||
// for (int i = 0; i < dt.Rows.Count; i++)
|
||||
// {
|
||||
// opName = dt.Rows[i]["工位号"].ToString();
|
||||
// machineType = dt.Rows[i]["保养类型代码"].ToString();
|
||||
// planID = dt.Rows[i]["工作日历流水号"].ToString();
|
||||
// BaseDataSystemMES.Rolling_news_Add(opName, opName + "工位有设备保养计划,请相关人员进行保养!!!");
|
||||
// BeginInvoke(machinePlan_Invoke, new object[] { opName, machineType, planID });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "timer_Machine_Tick");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,574 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
|
||||
|
||||
//static public void WritePLC(int tagType, string opName, object tagValue)
|
||||
//{
|
||||
// Write_TagTypeID(tagType, opName, tagValue);
|
||||
//}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public delegate void DemoHandler(object sender, DeviceDriver_BasicData.CustomeEvetnArgs e);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static event DemoHandler OPCTagDataDemo;
|
||||
|
||||
/// <summary>
|
||||
/// 根据tagType,工位号写入PLC对应值
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
static private void Write_TagValueByTagTypeName(string cmd, string opName,object tagValue)
|
||||
{
|
||||
int tagTypeID = 0;
|
||||
string msg;
|
||||
try
|
||||
{
|
||||
tagTypeID = Convert.ToInt32(MIS_BASE.hashtable_TagType[cmd]);
|
||||
MIS_BASE.WriteTagValue(tagTypeID, opName, tagValue);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Write_TagValueByTagTypeName_FUNC");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据TagTypeID,工位号写入PLC对应值
|
||||
/// </summary>
|
||||
/// <param name="TagTypeID"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
static public void Write_TagValueByTagTypeID(int tagTypeID, string opName, object tagValue)
|
||||
{
|
||||
string msg;
|
||||
object tagValueOb;
|
||||
object newTagValue= tagValue;
|
||||
try
|
||||
{
|
||||
MIS_BASE.WriteTagValue(tagTypeID, opName, tagValue);
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Write_TagValueByTagTypeID_FUNC");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过TagID写入PLC数据
|
||||
/// </summary>
|
||||
/// <param name="TagID"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_TagID(string TagID, object tagValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
MIS_BASE.WritePLC(TagID, tagValue);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Write_TagValueByTagID_FUNC");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 清空MES信号 MES传递机型(5) 允许工作(66) 合格放行(51) 不合格放行(8) 拧紧结束(67) 工作完成(7) 保存完成(20) 加工时间保存完成(54) 匹配完成(68) 默认false
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="false"></param>
|
||||
public static void Write_ClearMesMoby(string opName)
|
||||
{
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(opName, false);
|
||||
MIS_BASE.Write_FixAllow(opName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(opName, false);
|
||||
MIS_BASE.Write_FalseGO(opName, false);
|
||||
MIS_BASE.Write_FixOver(opName, false);
|
||||
MIS_BASE.Write_MesWorkFinish(opName, false);
|
||||
MIS_BASE.Write_MesReadOver(opName, false);
|
||||
MIS_BASE.Write_MachineTime_ReadOver(opName, false);
|
||||
MIS_BASE.Write_MatchingCompleted(opName, false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单号(string)(25)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_OrderForm(string opName, string tagValue)
|
||||
{
|
||||
string cmd = "OrderForm";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 总成编号(string)(26)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_AssemblyCode(string opName, string tagValue)
|
||||
{
|
||||
string cmd = "AssemblyCode";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 配方号1(dint)(27)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_Recipe1(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "Recipe1";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 配方号2(dint)(28)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_Recipe2(string opName, int tagValue)
|
||||
{
|
||||
tagValue = 0;
|
||||
string cmd = "Recipe2";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 总成编号(string)(62)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_AssemblyCode_MES(string opName, string tagValue)
|
||||
{
|
||||
|
||||
string cmd = "AssemblyCode_MES";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 配方号1(dint)(63)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_Recipe1_MES(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "Recipe1_MES";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 配方号2(dint)(64)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_Recipe2_MES(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "Recipe2_MES";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 各个工位返修状态(4)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_RepairPathString(string opName, string tagValue)
|
||||
{
|
||||
string cmd = "RepairPathString";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 加工时间保存完数据 DBX102.1 (54)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MachineTime_ReadOver(string opName, bool tagValue)
|
||||
{
|
||||
|
||||
int tagTypeID = 54;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工位三种状态:在线、离线、屏蔽(0,1,2)(DBB116)(79)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_OnLineState(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "OnLineState";
|
||||
Write_TagValueByTagTypeName(cmd, opName,Convert .ToInt16 ( tagValue));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 托盘编号(PLC)(80)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_PalletCode(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "PartPalletCode";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES向PLC传递机型(5)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_EngineTypeGetOver_MES(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 5;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PLC向MES传递机型(44)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_EngineTypeGetOver_PLC(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "EngineTypeGetOverPLC";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PLC向MES质量数据可以读 允许保存(19) DBX587.0
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MesRead_PLC(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "MesRead";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 工件到位
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_WorkStart(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "WorkStart";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拧紧结束确认(67)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_FixOver(string opName, bool tagValue)
|
||||
{
|
||||
|
||||
int tagTypeID = 67;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///返修上线,在上线工位,MES依据工件情况,设定为返修件,PLC见到MES设定为1后,将返修标志写入到DBX0.2为1
|
||||
///MES设定完返修返修上线后,MES清空该信号
|
||||
///DBX3.7(72)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_RepairUpline_MES(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 72;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 匹配完成(68)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MatchingCompleted(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 68;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 匹配结果(69)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_Match(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 69;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 空托盘放行(DBX2.2)(6)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_PartPalletGoOver(string opName, int tagValue)
|
||||
{
|
||||
int tagTypeID = 6;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 自动手动申请工件编号,0是自动方式;1:手动方式。切换时,(DBX2.1)(71)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_IsAutoGetEngineID(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "IsAutoGetEngineID";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 正常拧紧时选择(DBX100.3)(81)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_Normal(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "Normal";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
/// <summary>
|
||||
/// 备用拧紧时选择(DBX100.4)(82)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_UnNormal(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "UnNormal";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 变量类型代码=52,复位设备(MES)DBX0.6
|
||||
/// 通知PLC复位设备
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_ResetDevice(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "PartLoadFinish";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///托盘状态(22)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_PalletInfo(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "PalletInfo";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
/// <summary>
|
||||
/// 返修标志(93)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_RepairStatusMES(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "RepairStatusMES";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES通知PLC修改托盘状态成功
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_UpdatePalletOK(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "UpdatePalletOK";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
#region MES交互区写值
|
||||
|
||||
/// <summary>
|
||||
/// 工作完成(7)(MES)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MesWorkFinish(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 7;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 合格方式放行(51)(MES)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_ConfirmOkGo(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 51;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许拧紧(66)(MES)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_FixAllow(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 66;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行(8)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_FalseGO(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 8;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拧紧序号(77)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_ProcessCode(string opName, int tagValue)
|
||||
{
|
||||
int tagTypeID = 77;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 套筒号(88)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_BoltCode(string opName, int tagValue)
|
||||
{
|
||||
int tagTypeID = 88;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// MES保存完数据(必须MIS)(X102.2)(20)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MesReadOver(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 20;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// MES报错信息类型(必须MIS)(X14)(111)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MesErrorType(string opName, int tagValue)
|
||||
{
|
||||
int tagTypeID = 111;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 变量类型代码=73,机型代码。DBB404~405 机型标志
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_EngineTypeID_MES(string opName, int tagValue)
|
||||
{
|
||||
int tagTypeID = 73;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
public static void Write_OpNameIsOk(string opName,int qualityMask)
|
||||
{
|
||||
|
||||
// -99 是复位
|
||||
if (qualityMask == -99)
|
||||
{
|
||||
Write_TagValueByTagTypeID(51, opName, false);
|
||||
Write_TagValueByTagTypeID(8, opName, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Write_TagValueByTagTypeID(51, opName, false);
|
||||
//Write_TagValueByTagTypeID(8, opName, false);
|
||||
Write_TagValueByTagTypeID(qualityMask == 1 ? 51 : 8, opName, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 变量类型代码=74,零件编号。DBB406~445 发动机编号
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_EngineID_MES(string opName, string tagValue)
|
||||
{
|
||||
int tagTypeID = 74;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 变量类型代码=75,零件机型。DBB446~485 发动机机型
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_EngineType_MES(string opName, string tagValue)
|
||||
{
|
||||
int tagTypeID = 75;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单号(string)(116)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_OrderForm_MES(string opName, string tagValue)
|
||||
{
|
||||
int tagTypeID = 116;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 不允许工作(bool)(116)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_NotAllowWork(string opName, bool tagValue)
|
||||
{
|
||||
int tagTypeID = 30;
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 读取质量数据
|
||||
/// </summary>
|
||||
/// <param name="valueList"></param>
|
||||
public static void ReadPLC_Sync_ValueList(string opName, out Hashtable valueList)
|
||||
{
|
||||
valueList = null;
|
||||
ReadPLCData(opName, out valueList);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据工位号 同步读取数据
|
||||
/// </summary>
|
||||
/// <param name="opName">工位号</param>
|
||||
/// <param name="valueList">PLC仅仅值列表</param>
|
||||
private static void ReadPLCData(string opName, out Hashtable valueList)
|
||||
{
|
||||
valueList = new Hashtable();
|
||||
|
||||
System.Data.DataTable dt;
|
||||
dt = MisDataFun.BaseData_tagTable_QualityData_Item_B5A();
|
||||
|
||||
object tagValueStr = "0";
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
if (opName == dt.Rows[i]["工位号"].ToString())
|
||||
{
|
||||
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs qualityDataType;
|
||||
qualityDataType = new DeviceDriver_BasicData.CustomeEvetnArgs();
|
||||
|
||||
qualityDataType.TagID = dt.Rows[i]["TagID"].ToString ();
|
||||
qualityDataType.TagTypeID = Convert.ToInt32(dt.Rows[i]["TagTypeID"]);//变量类型
|
||||
qualityDataType.OpName = opName;//
|
||||
qualityDataType.IsGoodBad = 192;//
|
||||
qualityDataType.TagQuality = 192;//
|
||||
qualityDataType.TagValueType = Convert.ToInt32(dt.Rows[i]["变量类型代码"]);
|
||||
qualityDataType.TagOrderBy = Convert.ToInt32(dt.Rows[i]["列位置"]);
|
||||
qualityDataType.TagItemOrderBy = Convert.ToInt32(dt.Rows[i]["变量排序"]);
|
||||
qualityDataType.TagProperty = Convert.ToInt32(dt.Rows[i]["变量特点"]); ;//变量特点
|
||||
|
||||
MIS_BASE.Read_TagValueByTagID(qualityDataType.TagID.ToString(), out tagValueStr);
|
||||
|
||||
if (Convert.ToInt32(qualityDataType.TagTypeID) == 18)
|
||||
{
|
||||
qualityDataType.TagValue = Convert.ToInt32(tagValueStr);//变量值
|
||||
}
|
||||
else
|
||||
{
|
||||
qualityDataType.TagValue = tagValueStr;//变量值
|
||||
}
|
||||
valueList.Add(qualityDataType.TagID, qualityDataType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class QualityDataSaveList
|
||||
{
|
||||
public Hashtable valuList;
|
||||
public DataTable BasicDataTagValue;
|
||||
public DataTable BasicDataTagValueUpDown;
|
||||
public Hashtable hashtable_EngineTypeID;
|
||||
public Hashtable hashtable_tagTable_OpName_SaveData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
using BasicData;
|
||||
|
||||
using MesWork;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.Util;
|
||||
using OpcBasic;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
|
||||
/*
|
||||
HeartBeatMIS 15
|
||||
EngineTypeGetOverMES 5
|
||||
PartPalletGoOver 6
|
||||
MaterialVerifyOver 7
|
||||
FalseGo 8
|
||||
ConfirmOkGo 51
|
||||
PartLoadFinish 52
|
||||
UnloadCompleted 53
|
||||
MachineTime_ReadOver 54
|
||||
FixAllow 66
|
||||
FixOver 67
|
||||
MatchingCompleted 68
|
||||
Match 69
|
||||
Reserved_1 70
|
||||
IsAutoGetEngineID 71
|
||||
RepairUplineMES 72
|
||||
ProcessCode 77
|
||||
BoltCode 88
|
||||
RepairStatus 93
|
||||
Reserved_3 24
|
||||
Reserved_4 25
|
||||
Reserved_5 26
|
||||
Reserved_6 27
|
||||
Reserved_7 28
|
||||
Reserved_8 29
|
||||
Reserved_9 30
|
||||
Reserved_10 31
|
||||
Reserved_11 32
|
||||
Reserved_12 33
|
||||
Reserved_13 34
|
||||
Reserved_14 35
|
||||
MesReadOver 20
|
||||
Reserved_15 110
|
||||
Reserved_16 111
|
||||
Reserved_17 112
|
||||
OnLineState 79
|
||||
EngineTypeID_MES 73
|
||||
EngineID_MES 74
|
||||
EngineType_MES 75
|
||||
MarkID 42
|
||||
RepairPathString 4
|
||||
SPareint1 113
|
||||
SPareint2 114
|
||||
SPareint3 115
|
||||
Sparestring1 116
|
||||
Sparestring2 117
|
||||
HeartBeatPLC 14
|
||||
WorkStart 2
|
||||
RepairPartStatusPLC 3
|
||||
PartLoad 43
|
||||
EngineTypeGetOverPLC 44
|
||||
PartLoadOK 48
|
||||
Reserved_18 49
|
||||
PalletDown 50
|
||||
Reserved_19 58
|
||||
FixOK 59
|
||||
Reserved_20 76
|
||||
Reserved_21 61
|
||||
Reserved_22 62
|
||||
Reserved_23 63
|
||||
Reserved_24 64
|
||||
Reserved_25 65
|
||||
EngineTypeID 9
|
||||
EngineID 10
|
||||
EngineType 11
|
||||
PartPalletCode 80
|
||||
PalletInfo 22
|
||||
MesRead 19
|
||||
PutOn 1000
|
||||
WorkOn 1001
|
||||
Alarm 1002
|
||||
NoPart 1003
|
||||
Block 1004
|
||||
PartPalletStatus 13
|
||||
TargetTimeRead 16
|
||||
QualityMask 21
|
||||
RepairStatusPLC 23
|
||||
MachineTargetTime 17
|
||||
MachineActualTime 18
|
||||
PLCSPareint1 36
|
||||
PLCSPareint2 37
|
||||
PLCSPareint3 38
|
||||
PLCSarestring1 39
|
||||
PLCSarestring2 40
|
||||
*/
|
||||
|
||||
|
||||
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
///引用程序集Hashtable
|
||||
/// </summary>
|
||||
public static Hashtable Hashtable_assembly = new Hashtable();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static public NameValueCollection hashtable_TagTypeTagName = null;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static public NameValueCollection hashtable_TagTypeChange = null;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static public NameValueCollection hashtable_WebTagTypeChange = null;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static public NameValueCollection hashtable_MesTagTypeChange = null;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static readonly object l = new object();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tagTypeCodeID"></param>
|
||||
/// <param name="opName"></param>
|
||||
/// <returns></returns>
|
||||
private static object ReadPLC(int tagTypeCodeID, string opName)
|
||||
{
|
||||
try
|
||||
{
|
||||
return PlcLinkForm.ReadPLC(tagTypeCodeID, opName);
|
||||
|
||||
}
|
||||
catch { return "-3"; }
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tagID"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private static object ReadPLC(string tagID)
|
||||
{
|
||||
return PlcLinkForm.ReadPLC(tagID);
|
||||
}
|
||||
/// <summary>
|
||||
/// 20230218
|
||||
/// 按组读质量数据,返回带合格标志的质量数据列表
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <returns></returns>
|
||||
public static Hashtable ReadPLC_Sync_DataList_MesRead_ByOnlyDataGroup(string opName)
|
||||
{
|
||||
lock (l)
|
||||
{
|
||||
|
||||
var tagValues = GetDbAndMaxLengthByOpNameByBytes(opName);
|
||||
|
||||
var keyValues = tagValues.OrderBy(x => x.Key).ToDictionary(k => k.Key, v => v.Value);
|
||||
|
||||
TagFormat tagFormatTemp;
|
||||
int tagIndex = 1;
|
||||
int isOK = 0;
|
||||
|
||||
Hashtable ht = new Hashtable();
|
||||
|
||||
|
||||
foreach (KeyValuePair<string, object> _cd in keyValues)
|
||||
{
|
||||
if (_cd.Key.ToString()[0].ToString() == "7")
|
||||
{
|
||||
tagFormatTemp = (TagFormat)_cd.Value;
|
||||
if (tagIndex % 3 == 1)
|
||||
{
|
||||
isOK = Convert.ToInt32(tagFormatTemp.TagValue);
|
||||
}
|
||||
else if (tagIndex % 3 == 2)
|
||||
{
|
||||
var TF = (TagFormat)_cd.Value;
|
||||
|
||||
QualityDataType qualityDataType;
|
||||
qualityDataType = GetQualityDataType(TF);
|
||||
qualityDataType.isGoodBad = isOK;
|
||||
ht.Add(qualityDataType.tagID, qualityDataType);
|
||||
}
|
||||
else if (tagIndex % 3 == 0)
|
||||
{
|
||||
var TF = (TagFormat)_cd.Value;
|
||||
|
||||
QualityDataType qualityDataType;
|
||||
qualityDataType = GetQualityDataType(TF);
|
||||
qualityDataType.isGoodBad = isOK;
|
||||
ht.Add(qualityDataType.tagID, qualityDataType);
|
||||
}
|
||||
|
||||
tagIndex++;
|
||||
}
|
||||
//Console.WriteLine($"key:{kv.Key} value:{kv.Value}");
|
||||
}
|
||||
return ht;
|
||||
}
|
||||
}
|
||||
|
||||
public static ConcurrentDictionary<string, object> GetDbAndMaxLengthByOpNameByBytes(string opName)
|
||||
{
|
||||
string tagStartAdr = "";
|
||||
ushort tagAdrListMaxLength = 0;
|
||||
PlcLinkForm.GetDbAndMaxLengthByOpName(opName, out tagStartAdr, out tagAdrListMaxLength);
|
||||
var tagAdrListTagFormat = PlcLinkForm.ReadQualityDataList(opName, tagStartAdr, tagAdrListMaxLength);
|
||||
return tagAdrListTagFormat;
|
||||
}
|
||||
|
||||
|
||||
public static BasicData.QualityDataType GetQualityDataType(TagFormat TF)
|
||||
{
|
||||
QualityDataType qualityDataType;
|
||||
|
||||
qualityDataType = new QualityDataType();
|
||||
|
||||
qualityDataType.tagID = TF.TagID;
|
||||
qualityDataType.tagTypeID = TF.TagTypeID;//变量类型
|
||||
qualityDataType.opName = TF.OpName;
|
||||
qualityDataType.tagQuality = TF.Code;
|
||||
qualityDataType.tagValueType = TF.TagTypeCodeID;
|
||||
int.TryParse(TF.TagOrderBy, out int TagOrderBy);
|
||||
qualityDataType.tagOrderBy = TagOrderBy;
|
||||
int.TryParse(TF.TagItemOrderBy, out int TagItemOrderBy);
|
||||
qualityDataType.tagItemOrderBy = TagItemOrderBy;
|
||||
qualityDataType.tagProperty = Convert.ToInt32( TF.TagProperty);//变量特点
|
||||
qualityDataType.tagValue = TF.TagValue;//变量值
|
||||
|
||||
return qualityDataType;
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tagTypeCodeID"></param>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private static void ReadTagValue(int tagTypeCodeID, string opName, out string tagValue)
|
||||
{
|
||||
tagValue = "0";
|
||||
try
|
||||
{
|
||||
var tagValueObj = PlcLinkForm.ReadPLC(tagTypeCodeID, opName);
|
||||
var type = tagValueObj.GetType().Name.ToLower();
|
||||
if (type == "bool" | type == "boolean")
|
||||
{
|
||||
var val = tagValueObj.ToString().ToLower();
|
||||
|
||||
if (val == "true")
|
||||
{
|
||||
tagValue = "1";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tagValue = tagValueObj.ToString();
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tagID"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
/// <returns></returns>
|
||||
private static bool WritePLC(string tagID, object tagValue)
|
||||
{
|
||||
return PlcLinkForm.WritePLC(tagID, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tagTypeCodeID"></param>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
/// <returns></returns>
|
||||
private static bool WritePLC(int tagTypeCodeID, string opName, object tagValue)
|
||||
{
|
||||
return PlcLinkForm.WritePLC(tagTypeCodeID, opName, tagValue);
|
||||
}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tagTypeCodeID"></param>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
/// <returns></returns>
|
||||
private static bool WriteTagValue(int tagTypeCodeID, string opName, object tagValue)
|
||||
{
|
||||
return PlcLinkForm.WritePLC(tagTypeCodeID, opName, tagValue);
|
||||
}
|
||||
|
||||
public static ConcurrentDictionary<string, DeviceDriver_BasicData.CustomeEvetnArgs> ReadPLC_OpName(string opName)
|
||||
{
|
||||
try
|
||||
{
|
||||
string tagStartAdr = "";
|
||||
ushort tagAdrListMaxLength = 0;
|
||||
PlcLinkForm.GetDbAndMaxLengthByOpName(opName, out tagStartAdr, out tagAdrListMaxLength);
|
||||
var tagAdrListTagFormat0 = PlcLinkForm.ReadQualityDataList(opName, tagStartAdr, tagAdrListMaxLength);
|
||||
|
||||
var pp = JsonConvert.SerializeObject(tagAdrListTagFormat0);
|
||||
var tagAdrListTagFormat = JsonConvert.DeserializeObject<ConcurrentDictionary<string, DeviceDriver_BasicData.CustomeEvetnArgs>>(pp);
|
||||
|
||||
|
||||
return tagAdrListTagFormat;
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user