init: 导入项目到 meswork Gitea
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
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 MesWork.PlcLinkForm.dt_BasicData.Select($"是否启用 = 1 and 监控属性代码 = '{ApplicationConfig.MES_Code.ToString()}'").CopyToDataTable<DataRow>();
|
||||
}
|
||||
|
||||
void InitMesReadTagKey()
|
||||
{
|
||||
DataTable dt = MesWork.PlcLinkForm.dt_BasicData.Select($"是否启用 = 1 and 变量类型代码=19 and 监控属性代码 = '{ApplicationConfig.MES_Code.ToString()}'").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,94 @@
|
||||
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 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
|
||||
{
|
||||
OpcData.CustomeEvetnArgs msgEvent = (OpcData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
string AlarmStr = "";
|
||||
|
||||
int IsAllowWork;
|
||||
int IsSuccess = 0;
|
||||
bool EngineGetOver_PLC_NextWorkStep;
|
||||
//传递机型是否到位
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
|
||||
|
||||
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||||
if (IsSuccess == 0)
|
||||
{
|
||||
AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//此处逻辑有问题 需要考虑到批次扫描 提示PLC未传递机型的情况
|
||||
if (EngineGetOver_PLC_NextWorkStep && IsSuccess == 1)
|
||||
{
|
||||
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
|
||||
{
|
||||
OpcData.CustomeEvetnArgs msgEvent = (OpcData.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,134 @@
|
||||
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 lockerEngineTypeGetOver_PLC_Work = new object();
|
||||
|
||||
|
||||
static public void EngineTypeGetOver_PLC_Work(string OpName, int EngineTypeID, string EngineType, string EngineID, int PartPallet_Code)
|
||||
{
|
||||
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.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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
OpcData.CustomeEvetnArgs msgEvent = (OpcData.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,58 @@
|
||||
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 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
|
||||
{
|
||||
OpcData.CustomeEvetnArgs msgEvent = (OpcData.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,161 @@
|
||||
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
|
||||
{
|
||||
|
||||
/// <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 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,277 @@
|
||||
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 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
|
||||
{
|
||||
OpcData.CustomeEvetnArgs msgEvent = (OpcData.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_EngineID.ContainsKey(OpName))
|
||||
{
|
||||
engineID = MIS_BASE.hashtable_EngineGetOver_EngineID[OpName].ToString();
|
||||
}
|
||||
|
||||
OpcData.CustomeEvetnArgs _e = new OpcData.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(OpcData.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 public void WorkStart(object e)
|
||||
{
|
||||
lock (lockerWorkStart)
|
||||
{
|
||||
try
|
||||
{
|
||||
OpcData.CustomeEvetnArgs msgEvent = (OpcData.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,784 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
|
||||
using System.Windows.Forms;
|
||||
using bizFacade;
|
||||
using System.Collections.Specialized;
|
||||
using MesWork;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
public partial class MIS_BASE: PlcLinkForm
|
||||
{
|
||||
/// <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返修下线)
|
||||
/// </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;
|
||||
/// <summary>
|
||||
/// 托盘代码(DBB86)(80)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
|
||||
/// <summary>
|
||||
/// 创建MesServerCode哈西表
|
||||
/// </summary>
|
||||
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 = BaseDataSystemMES.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]);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化工步属性
|
||||
hashtable_workStepProperty = new Hashtable();
|
||||
dt = BaseDataSystemMES.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 = BaseDataSystemMES.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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建合格标志哈西表
|
||||
/// </summary>
|
||||
private void InitHashtable_QualityData_GoodBad()
|
||||
{
|
||||
//列位置
|
||||
string index;
|
||||
//
|
||||
int tagID;
|
||||
DataTable dt ;
|
||||
dt = BaseDataSystemMES.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 = BaseDataSystemMES.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 = BaseDataSystemMES.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 = BaseDataSystemMES.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 = BaseDataSystemMES.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 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返修下线)
|
||||
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 = BaseDataSystemMES.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 = BaseDataSystemMES.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 = BaseDataSystemMES.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,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,418 @@
|
||||
using System;
|
||||
using SystemFramework;
|
||||
using OpcData;
|
||||
|
||||
namespace MesServerWork
|
||||
{
|
||||
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public delegate void DemoHandler(object sender, 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(MesDataFunction.OpcOperation.hashtable_TagType[cmd]);
|
||||
MesDataFunction.OpcOperation.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 private void Write_TagValueByTagTypeID(int tagTypeID, string opName, object tagValue)
|
||||
{
|
||||
string msg;
|
||||
object tagValueOb;
|
||||
object newTagValue= tagValue;
|
||||
try
|
||||
{
|
||||
MesDataFunction.OpcOperation.WriteTagValue(tagTypeID, opName, tagValue);
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ApplicationLog.WriteLog(err, "Write_TagValueByTagTypeID_FUNC");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 通过TagID写入PLC数据
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
static private void Write_TagValueByTagID(string TagID, object tagValue)
|
||||
{
|
||||
string msg;
|
||||
//tagValue = "0";
|
||||
try
|
||||
{
|
||||
MesDataFunction.OpcOperation.WritePLC(TagID, tagValue);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
ApplicationLog.WriteLog(err, "Write_TagValueByTagID_FUNC");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write_TagTypeID(int tagTypeID, string opName, object tagValue)
|
||||
{
|
||||
Write_TagValueByTagTypeID(tagTypeID, opName, tagValue);
|
||||
}
|
||||
|
||||
public static void Write_TagID(string TagID, object tagValue)
|
||||
{
|
||||
Write_TagValueByTagID(TagID, tagValue);
|
||||
}
|
||||
|
||||
|
||||
/// <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_MaterialVerifyOver(opName, false);
|
||||
MIS_BASE.Write_MesReadOver(opName, false);
|
||||
MIS_BASE.Write_MachineTime_ReadOver(opName, false);
|
||||
MIS_BASE.Write_MatchingCompleted(opName, false);
|
||||
}
|
||||
/// <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>
|
||||
/// MES保存完数据(必须MIS)(X102.2)(20)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MesReadOver(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "MesReadOver";
|
||||
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)
|
||||
{
|
||||
string cmd = "MachineTime_ReadOver";
|
||||
Write_TagValueByTagTypeName(cmd, 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)
|
||||
{
|
||||
string cmd = "EngineTypeGetOverMES";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工作完成(7)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MaterialVerifyOver(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "MaterialVerifyOver";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合格方式放行(51)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_ConfirmOkGo(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "ConfirmOkGo";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 允许拧紧(66)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_FixAllow(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "FixAllow";
|
||||
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)
|
||||
{
|
||||
string cmd = "FixOver";
|
||||
Write_TagValueByTagTypeName(cmd, 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)
|
||||
{
|
||||
string cmd = "RepairUplineMES";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 匹配完成(68)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_MatchingCompleted(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "MatchingCompleted";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 不合格放行(8)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_FalseGO(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "FalseGo";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 匹配结果(69)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_Match(string opName, bool tagValue)
|
||||
{
|
||||
string cmd = "Match";
|
||||
Write_TagValueByTagTypeName(cmd, 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)
|
||||
{
|
||||
string cmd = "EngineTypeID_MES";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
/// <summary>
|
||||
/// 变量类型代码=74,零件编号。DBB406~445 发动机编号
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_EngineID_MES(string opName, string tagValue)
|
||||
{
|
||||
string cmd = "EngineID_MES";
|
||||
Write_TagValueByTagTypeName(cmd, 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)
|
||||
{
|
||||
string cmd = "EngineType_MES";
|
||||
Write_TagValueByTagTypeName(cmd, opName, tagValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拧紧序号(77)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_ProcessCode(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "ProcessCode";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 套筒号(88)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_BoltCode(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "BoltCode";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(tagValue));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 空托盘放行(DBX2.2)(6)
|
||||
/// </summary>
|
||||
/// <param name="opName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
public static void Write_PartPalletGoOver(string opName, int tagValue)
|
||||
{
|
||||
string cmd = "PartPalletGoOver";
|
||||
Write_TagValueByTagTypeName(cmd, opName, Convert.ToInt16(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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
using BasicData;
|
||||
using bizFacade;
|
||||
using SystemFramework;
|
||||
using System.Configuration;
|
||||
|
||||
namespace MesDataFunctionWebApi
|
||||
{
|
||||
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();
|
||||
QualityDataType qualityDataType;
|
||||
qualityDataType = new QualityDataType();
|
||||
System.Data.DataTable dt;
|
||||
dt = BaseDataSystemMES.BaseData_tagTable_QualityData_Item_B5A();
|
||||
|
||||
object tagValueStr = "0";
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
if (opName == dt.Rows[i]["工位号"].ToString())
|
||||
{
|
||||
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_TagID(qualityDataType.tagID, out tagValueStr);
|
||||
|
||||
if (qualityDataType.tagTypeID == 18)
|
||||
{
|
||||
qualityDataType.tagValue = Convert.ToInt32(tagValueStr);//变量值
|
||||
}
|
||||
else
|
||||
{
|
||||
qualityDataType.tagValue = tagValueStr;//变量值
|
||||
}
|
||||
valueList.Add(qualityDataType.tagID, qualityDataType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Collections;
|
||||
using BasicData;
|
||||
using bizFacade;
|
||||
using SystemFramework;
|
||||
using System.Configuration;
|
||||
using MesWork;
|
||||
using MQTTnet.Client.Connecting;
|
||||
using MQTTnet.Client.Disconnecting;
|
||||
using MQTTnet.Client.Receiving;
|
||||
using MQTTnet;
|
||||
|
||||
namespace MesDataFunctionWebApi
|
||||
{
|
||||
public partial class MIS_BASE
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static string MqttTargetTopic = "";
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static new MesWebFun_base.MisWebInterface misWebInterface = new MesWebFun_base.MisWebInterface();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
static readonly Object locker = new Object();
|
||||
/// <summary>
|
||||
/// 发消息给通讯服务器
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
public static string asyncSendMessage(string Message)
|
||||
{
|
||||
lock (locker)
|
||||
{
|
||||
//"MES|MachinePlan|OpName|Value
|
||||
var array = Message.Split('|');
|
||||
var cmd = array[1];
|
||||
var opName = array[2];
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
|
||||
Mqtt.Publish(topic, Message);
|
||||
|
||||
var responseStr = misWebInterface.WebSocket_Function(Message);
|
||||
if (responseStr.Length > 0)
|
||||
{
|
||||
|
||||
Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}");
|
||||
}
|
||||
//return responseStr;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static string asyncSendMessageDemo(string Message)
|
||||
{
|
||||
lock (locker)
|
||||
{
|
||||
//"MES|MachinePlan|OpName|Value
|
||||
var array = Message.Split('|');
|
||||
var cmd = array[1];
|
||||
var opName = array[2];
|
||||
var topic = $"{MqttTargetTopic}/{opName}";
|
||||
|
||||
Mqtt.Publish(topic, Message);
|
||||
|
||||
var responseStr = misWebInterface.WebSocket_Function(Message);
|
||||
if (responseStr.Length > 0)
|
||||
{
|
||||
|
||||
Mqtt.Publish(topic, $"MES|{cmd}_Resources|{opName}|{responseStr}");
|
||||
}
|
||||
return responseStr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user