259 lines
12 KiB
C#
259 lines
12 KiB
C#
using MesServerWork;
|
||
using MisDataFunDll;
|
||
using MisDataSaveDate;
|
||
using System;
|
||
using System.Collections;
|
||
using System.Threading;
|
||
|
||
|
||
namespace MesServerFunctions
|
||
{
|
||
partial class FunctionMES
|
||
{
|
||
/// <summary>
|
||
/// 处理WEB页面发送过来的请求(m_Command + "|" + m_Value;)
|
||
/// </summary>
|
||
/// <param name="OpName"></param>
|
||
/// <param name="Content"></param>
|
||
private void WebSubmit(object e)
|
||
{
|
||
try
|
||
{
|
||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||
string OpName = Convert.ToString(msgEvent.OpName);
|
||
string Content = Convert.ToString(msgEvent.TagValue);
|
||
|
||
string opName_SubLine = "";
|
||
string engineID = "";//工件信息
|
||
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; //消息参数长度
|
||
|
||
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();
|
||
}
|
||
if (MIS_BASE.hashtable_OpNameRepair == null)
|
||
{
|
||
MIS_BASE.InitHashtable_MesServerCode();
|
||
}
|
||
var _e = new DeviceDriver_BasicData.CustomeEvetnArgs();
|
||
_e.OpName = OpName;
|
||
_e.TagValue = m_Value;
|
||
string msg;
|
||
bool bolVal;
|
||
|
||
//根据请求的命令处理逻辑
|
||
switch (m_Command)
|
||
{
|
||
case "Barcode":
|
||
if (m_Value_length > 1) return;
|
||
fun_Barcode(_e);
|
||
break;
|
||
case "ConfirmOkGo"://合格放行
|
||
//修改托盘状态
|
||
//BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||
MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||
MIS_BASE.Write_FalseGO(OpName, false);
|
||
Thread.Sleep(1000);
|
||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||
break;
|
||
case "FalseGO"://返修放行
|
||
//修改托盘状态
|
||
//BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Delete(OpName, engineID);
|
||
MIS_BASE.Write_FalseGO(OpName, true);
|
||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||
Thread.Sleep(1000);
|
||
MIS_BASE.Write_FalseGO(OpName, false);
|
||
break;
|
||
case "NgGO"://不合格放行
|
||
//修改托盘状态
|
||
//保存不合格信息(必须保存不合格放行信息,由于B5A的Moby没有不合格标志位)
|
||
//BaseDataSystemMES.BaseData_tagTable_Engine_IsNG_Insert(OpName, engineID, "", "");
|
||
MIS_BASE.Write_FalseGO(OpName, true);
|
||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||
Thread.Sleep(1000);
|
||
MIS_BASE.Write_FalseGO(OpName, false);
|
||
break;
|
||
case "RepairUplineMES"://返修上线
|
||
string[] dataArrayInfo = m_Value.Split('^'); // OP440^产品编号^订单号^产品型号^产品型号代码
|
||
|
||
if (dataArrayInfo.Length != 5)
|
||
{
|
||
MisDataFun.LogRecording_OP(OpName, "ERROR", "WEB", "MES申请返修上线信息错误!信息:" + m_Value);
|
||
return;
|
||
}
|
||
string repairUpline_opName = dataArrayInfo[0];
|
||
string EngineID = dataArrayInfo[1];
|
||
string OrderForm = dataArrayInfo[2];
|
||
string EngineType = dataArrayInfo[3];
|
||
int EngineTypeID = Convert.ToInt32(dataArrayInfo[4]);
|
||
// 向工厂MES申请返修上线 待做 成功之后写给PLC
|
||
|
||
// 写返修上线工位号给PLC
|
||
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID); // 机型代码(MES)
|
||
MIS_BASE.Write_EngineID_MES(OpName, EngineID); // 发动机号(MES)
|
||
MIS_BASE.Write_EngineType_MES(OpName, EngineType); // 机型(MES)
|
||
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm); // 订单号(MES)
|
||
MIS_BASE.Write_TagValueByTagTypeID(118, OpName, repairUpline_opName.Replace("OP", "")); // 再起始工位号
|
||
|
||
// 写申请返修上线给PLC
|
||
MIS_BASE.Write_TagValueByTagTypeID(28, OpName, 1);
|
||
// 通知前台写入完成
|
||
MisDataFun.LogRecording_OP(OpName, "INFO", "WEB", "MES申请返修上线!上线工位号:" + repairUpline_opName + ",上产产品:" + EngineID);
|
||
//MIS_BASE.Write_RepairUpline_MES(OpName, true);
|
||
SendMessage.AsyncSendNotOpMessage("RepairUplinePAD", "MES|" + "RepairUplineMES" + "|" + OpName + "|" + EngineID);
|
||
break;
|
||
case "EmptyUplineMES"://空托盘上线
|
||
MIS_BASE.Write_TagValueByTagTypeID(118, OpName, 999); // 再起始工位号
|
||
MIS_BASE.Write_TagValueByTagTypeID(28, OpName, 1); // 写申请返修上线给PLC
|
||
// 通知前台写入完成
|
||
MisDataFun.LogRecording_OP(OpName, "INFO", "WEB", "空托盘上线成功!");
|
||
SendMessage.AsyncSendNotOpMessage("RepairUplinePAD", "MES|" + "EmptyUplineMES" + "|" + OpName + "|999");
|
||
break;
|
||
//初始化网页信号
|
||
case "IniSingalToWeb":
|
||
InitializeSingalToWeb(OpName);
|
||
break;
|
||
default: break;
|
||
}
|
||
}
|
||
catch (Exception err)
|
||
{
|
||
////ApplicationLog.WriteLog(err, "Function08:WebSubmit");
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 网页重现登录,恢复关闭前的页面状态
|
||
/// </summary>
|
||
/// <param name="Opname">工位号</param>
|
||
private void InitializeSingalToWeb(string Opname)
|
||
{
|
||
int EngineTypeID;
|
||
string EngineType;
|
||
string EngineID;
|
||
int PartPallet_Code;
|
||
int ProcessCode;
|
||
bool S_FixOK;
|
||
bool S_FixOver;
|
||
bool S_FixAllow;//允许工作 DBX3.1
|
||
bool S_WorkStart;//工件到位 DBX0.1
|
||
bool S_PartLoad;//申请上线
|
||
bool S_EngineGetOver;//传递机型 DBX0.4
|
||
bool S_MesRead;//允许保存 DBX3.1
|
||
bool S_ReadOver;//保存完成
|
||
bool S_MaterialVerifyOver;//工作完成 DBX0.3
|
||
int BoltCode;
|
||
int workStepProperty;
|
||
int S_QualityMask;//合格标志 DBX588
|
||
string S_plcStatus = "false";//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||
|
||
//获取Moby
|
||
MIS_BASE.GetEngineTypeFromDB(Opname, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code);
|
||
|
||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||
MIS_BASE.Read_FixOK(Opname, out S_FixOK);
|
||
MIS_BASE.Read_FixOver(Opname, out S_FixOver);
|
||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||
MIS_BASE.Read_PartLoad(Opname, out S_PartLoad);
|
||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||
MIS_BASE.Read_QualityData_Read_CF(Opname, out S_MesRead);
|
||
MIS_BASE.Read_MesReadOver(Opname, out S_ReadOver);
|
||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||
MIS_BASE.Read_QualityMask(Opname, out S_QualityMask);
|
||
|
||
if (S_WorkStart == true)
|
||
{
|
||
SendMessageFun.SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_PartLoad == true)
|
||
{
|
||
SendMessageFun.SendInfomation("PartLoad", Convert.ToString(Convert.ToInt32(S_PartLoad)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_EngineGetOver == true)
|
||
{
|
||
SendMessageFun.SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||
//通知web显示
|
||
SendMessageFun.SendMessage("5123", "1111", Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_FixAllow == true)
|
||
{
|
||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_MesRead == true)
|
||
{
|
||
SendMessageFun.SendInfomation("MesRead", Convert.ToString(Convert.ToInt32(S_MesRead)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_ReadOver == true)
|
||
{
|
||
SendMessageFun.SendInfomation("MesReadOver", Convert.ToString(Convert.ToInt32(S_ReadOver)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_MaterialVerifyOver == true)
|
||
{
|
||
SendMessageFun.SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_QualityMask == 1)
|
||
{
|
||
SendMessageFun.SendInfomation("QualityMask", Convert.ToString(Convert.ToInt32(S_QualityMask)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_plcStatus.ToLower() == "false")
|
||
{
|
||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||
}
|
||
else
|
||
{
|
||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_FixAllow == true)
|
||
{
|
||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_FixOK == true)
|
||
{
|
||
SendMessageFun.SendInfomation("FixOK", Convert.ToString(Convert.ToInt32(S_FixOK)), Opname);
|
||
}
|
||
//----------------------------------------------------
|
||
if (S_FixOver == true)
|
||
{
|
||
SendMessageFun.SendInfomation("FixOver", Convert.ToString(Convert.ToInt32(S_FixOver)), Opname);
|
||
}
|
||
// 报警信息
|
||
InitAlarm(Opname);
|
||
}
|
||
private void InitAlarm(string Opname)
|
||
{
|
||
FuntionMesRead.Alarm_InitAlarm_Send(Opname, out Hashtable ht);
|
||
foreach (DictionaryEntry kv in ht)
|
||
{
|
||
var TagID = kv.Key.ToString();
|
||
var TagValue = kv.Value.ToString();
|
||
FuntionMesRead.Send_AlarmMsg(TagID, TagValue);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|
||
}
|