MVP!
This commit is contained in:
84
MisDataFunction/Function1061/OpcServer/Barcode.cs
Normal file
84
MisDataFunction/Function1061/OpcServer/Barcode.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using MesDataFunction;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockBarcode = new object();
|
||||
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void Barcode(object e)
|
||||
{
|
||||
lock(lockBarcode)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
|
||||
int IsAllowWork;
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out bool Read_EngineGetOver_PLC_Bool); // PLC传递机型
|
||||
MIS_BASE.GetEngineTypeFromPLC_MES(OpName, out int EngineTypeID_MES, out string EngineType_MES, out string EngineID_MES, out string OrderForm_MES);
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out int EngineTypeID, out string EngineType, out string EngineID, out int PartPallet_Code, out string OrderForm);
|
||||
|
||||
if (!Read_EngineGetOver_PLC_Bool)
|
||||
{
|
||||
string msg1 = "无法扫码,PLC未传递机型!";
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "Barcode", msg1);
|
||||
SendMessageFun.AsyncSendMessage_Notice_Error(OpName, msg1, "条码扫描");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MisDataBaseFun.CheckMesApiIsOk(OpName, EngineID, "miFindCustomAndSfcData")) return; // 验证入站接口是否成功!
|
||||
|
||||
// 上线工位的机型校验
|
||||
if (!MisDataBaseFun.EngineTypeVerifyOnLine(OpName, EngineID, EngineTypeID, EngineID_MES, EngineTypeID_MES)) return;
|
||||
|
||||
//物料验证
|
||||
string msg;
|
||||
//物料验证 先本地校验,成功之后在向工厂MES校验
|
||||
MisDataFun.PartMaterial_DM_Check(OpName, barcode, EngineID_MES, out int isOk, out bool MesCheck, out bool isAllBatchCheck, out bool ShowBox, out string DMmsg, out string MaterialsCode, out string batchCode, out int ID, out bool isBatch);
|
||||
MisDataFun.MesServer_Judge_IsCanWork(OpName, out IsAllowWork); //获取是否允许工作
|
||||
|
||||
//此处逻辑有问题 需要考虑到批次扫描 提示PLC未传递机型的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//string msg1 = "物料验证成功,进入拧紧流程!";
|
||||
//MisDataFun.LogRecording_OP(OpName, "INFO", "Barcode", msg1);
|
||||
//SendMessageFun.AsyncSendMessage_Notice(OpName, msg1);
|
||||
//SendMessageFun.SendMessage("2", "11", OpName);
|
||||
////拧紧逻辑
|
||||
//InitWorkStep(OpName, EngineTypeID, EngineType, EngineID);
|
||||
//更新订单完工数量及物料
|
||||
SendMessageFun.SendMessage("2", "11", OpName);
|
||||
if(EngineTypeID == 2 || EngineTypeID == 3) PrinterCommandCenter.PrintToPrinter(OpName, EngineID); // 打印PACK条码
|
||||
MIS_BASE.Write_FixAllow(OpName, true); // 允许工作
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "Barcode", "物料验证完成 允许工作!");
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:Barcode");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
37
MisDataFunction/Function1061/OpcServer/ConfirmOkGo.cs
Normal file
37
MisDataFunction/Function1061/OpcServer/ConfirmOkGo.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 合格放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void ConfirmOkGo(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
84
MisDataFunction/Function1061/OpcServer/EngineGetOver.cs
Normal file
84
MisDataFunction/Function1061/OpcServer/EngineGetOver.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockBarcodeEngineTypeGetOver = new object();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
lock(lockBarcodeEngineTypeGetOver)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC传递机型!");
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, OpName, false); // 复位报警(MES)
|
||||
|
||||
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm; // 工单号
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
// PDC产线plc只写了发动机号和机型代码,其余要从数据库中读取
|
||||
MisDataFun.Moby_Select_PDC(EngineID, out OrderForm, out EngineType, out int EngineTypeID1);
|
||||
|
||||
if (!MisDataBaseFun.EngineTypeVerify(OpName, EngineID, EngineTypeID)) return; // 机型校验
|
||||
if (!MisDataBaseFun.NotAllowWorkVerify(OpName, EngineID)) return; // 前序合格校验
|
||||
|
||||
// 调用进站接口
|
||||
CallWebService.Call_miFindCustomAndSfcData(OpName, EngineID, out string code, out string message);
|
||||
if (code == "0")
|
||||
{
|
||||
string msg = "进站成功:" + EngineID;
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MOM", msg);
|
||||
// 机型信息写入数据库
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm, 0, 0, "");
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "进站失败:" + EngineID + ",code:" + code + ",message:" + message;
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "MOM", msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC传递机型取消!");
|
||||
MIS_BASE.Write_FixAllow(OpName, false); // 允许PLC拧紧工作(MES)
|
||||
MIS_BASE.Write_NotAllowWork(OpName, false); // 不允许工作
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
38
MisDataFunction/Function1061/OpcServer/FalseGO.cs
Normal file
38
MisDataFunction/Function1061/OpcServer/FalseGO.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 返修放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FalseGO(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
85
MisDataFunction/Function1061/OpcServer/FixOK.cs
Normal file
85
MisDataFunction/Function1061/OpcServer/FixOK.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 拧紧完成(PLC)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FixOK(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
#region
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
int PartPallet_Code;//托盘编号
|
||||
MIS_BASE.GetEngineTypeFromDB(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code);///从PLC中获取MOBY信息
|
||||
#endregion
|
||||
|
||||
if (tagValue == 0)
|
||||
{
|
||||
MIS_BASE.Write_FixOver(OpName, false);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC本次拧紧完成!");
|
||||
//1:允许拧紧清零
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
if (MIS_BASE.hashtable_WorkGroupIndex == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
//获取当前拧紧序号
|
||||
int ProcessCode = 1;
|
||||
if (MIS_BASE.hashtable_WorkGroupIndex.ContainsKey(OpName))
|
||||
{
|
||||
ProcessCode = Convert.ToInt32(MIS_BASE.hashtable_WorkGroupIndex[OpName]);
|
||||
}
|
||||
//获取当前组号拧紧的合格标志及保存质量数据
|
||||
int isOK = GetTagValue(OpName, EngineTypeID, EngineType, EngineID, ProcessCode, PartPallet_Code);
|
||||
|
||||
//发动UDP,通知读取质量数据,实时显示质量数据,最后一段为合格标志(根据合格标志显示哭脸笑脸,2对应哭脸,1对应笑脸)
|
||||
SendInfomation("ShowTimelyQuality_Tight", ProcessCode.ToString() + "&" + isOK.ToString(), OpName);
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "PLC本次拧紧结果!" + isOK.ToString());
|
||||
//更新拧紧位置临时表
|
||||
bool IsFinish = true;
|
||||
MisDataFun.MesServer_ShaftPosition_Update(OpName, ProcessCode, isOK, out IsFinish);
|
||||
|
||||
//通知PLC接到拧紧数据
|
||||
MIS_BASE.Write_FixOver(OpName, true);
|
||||
if (MIS_BASE.hashtable_QualityMesRead == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
//记录拧紧/压装过程中的合格标志
|
||||
if (MIS_BASE.hashtable_QualityMesRead.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_QualityMesRead[OpName] = isOK;
|
||||
}
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES保存本次拧紧数据完成!");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function04:FixOK");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
176
MisDataFunction/Function1061/OpcServer/FixOver.cs
Normal file
176
MisDataFunction/Function1061/OpcServer/FixOver.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 拧紧结束确认(必须MES)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FixOver(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
#region
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
int PartPallet_Code;//托盘编号
|
||||
MIS_BASE.GetEngineTypeFromDB(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code);///从PLC中获取MOBY信息
|
||||
#endregion
|
||||
|
||||
int IsOK = 1;
|
||||
if (MIS_BASE.hashtable_QualityMesRead == null)
|
||||
{
|
||||
MIS_BASE.InitHashtable_MesServerCode();
|
||||
}
|
||||
if (MIS_BASE.hashtable_QualityMesRead.ContainsKey(OpName))
|
||||
{
|
||||
IsOK = Convert.ToInt32(MIS_BASE.hashtable_QualityMesRead[OpName]);
|
||||
}
|
||||
|
||||
int workStepProperty = 0;
|
||||
int BoltCode = 0;
|
||||
int ProcessCode = 0;
|
||||
bool isHaveNg = false;
|
||||
bool sn_WorkingStepIsOver = GetShaftWoringStepIsWorked_WorkGroup(OpName, EngineTypeID, EngineType, out ProcessCode, out BoltCode, out workStepProperty, out isHaveNg);
|
||||
|
||||
// 判断是否还有需要拧紧的组号
|
||||
if (!sn_WorkingStepIsOver)
|
||||
{
|
||||
//必须拧紧合格,才能给出允许拧紧
|
||||
if (IsOK == 1)
|
||||
{
|
||||
//发动UDP,通知MES工作站拧紧第几组
|
||||
SendInfomation("FixAllowGuid", Convert.ToString(ProcessCode) + "&" + Convert.ToString(BoltCode), OpName);//显示拧紧标志
|
||||
|
||||
//写入工作顺序
|
||||
MIS_BASE.Write_ProcessCode(OpName, ProcessCode);
|
||||
|
||||
//写入子程序(套筒号)
|
||||
MIS_BASE.Write_BoltCode(OpName, BoltCode);
|
||||
|
||||
//通知PLC允许工作
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES允许手动拧紧!位置:" + ProcessCode.ToString() + ",套筒:" + BoltCode.ToString());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 是否存在拧紧不合格的
|
||||
if (!isHaveNg)
|
||||
{
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
MIS_BASE.Write_FalseGO(OpName, false);
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES所有拧紧任务完成!");
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
// MIS_BASE.Write_FalseGO(OpName, true);
|
||||
// MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES所有拧紧任务完成 不合格放行!");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function04:FixOver");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 重新工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void WorkAgain(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 1:允许拧紧清零
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
// 2:从PLC获取当前拧紧序号
|
||||
int BoltCode = 0;
|
||||
int ProcessCode = 0;
|
||||
|
||||
MIS_BASE.Read_BoltCode(OpName, out BoltCode);
|
||||
MIS_BASE.Read_ProcessCode(OpName, out ProcessCode);
|
||||
if (BoltCode > 0 && ProcessCode > 0)
|
||||
{
|
||||
//记录当前拧紧序号
|
||||
if (MIS_BASE.hashtable_WorkGroupIndex.ContainsKey(OpName))
|
||||
{
|
||||
MIS_BASE.hashtable_WorkGroupIndex[OpName] = ProcessCode;
|
||||
}
|
||||
|
||||
// 更新当前位置为未拧紧状态
|
||||
MisDataFun.MesServer_ShaftPosition_FixAllow_Again(OpName, ProcessCode);
|
||||
//发动UDP,通知MES工作站拧紧第几组
|
||||
SendInfomation("FixAllowGuid", Convert.ToString(ProcessCode) + "&" + Convert.ToString(BoltCode), OpName);//显示拧紧标志
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function04:WorkAgain");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拧紧完成(PLC),不合格,但是要继续拧紧下一个
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FixOK_Ng_Next(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
int PartPallet_Code;//托盘编号
|
||||
MIS_BASE.GetEngineTypeFromDB(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code);///从PLC中获取MOBY信息
|
||||
|
||||
|
||||
int workStepProperty = 0;
|
||||
int BoltCode = 0;
|
||||
int ProcessCode = 0;
|
||||
bool isHaveNg = false;
|
||||
|
||||
bool sn_WorkingStepIsOver = GetShaftWoringStepIsWorked_WorkGroup(OpName, EngineTypeID, EngineType, out ProcessCode, out BoltCode, out workStepProperty, out isHaveNg);
|
||||
if (!sn_WorkingStepIsOver)
|
||||
{
|
||||
//发动UDP,通知MES工作站拧紧第几组
|
||||
SendInfomation("FixAllowGuid", Convert.ToString(ProcessCode) + "&" + Convert.ToString(BoltCode), OpName);//显示拧紧标志
|
||||
|
||||
//写入工作顺序
|
||||
MIS_BASE.Write_ProcessCode(OpName, ProcessCode);
|
||||
|
||||
//写入子程序(套筒号)
|
||||
MIS_BASE.Write_BoltCode(OpName, BoltCode);
|
||||
|
||||
//通知PLC允许工作
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "MES允许手动拧紧!位置:" + ProcessCode.ToString() + ",套筒:" + BoltCode.ToString());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function04:FixOK");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
56
MisDataFunction/Function1061/OpcServer/HeartBeat.cs
Normal file
56
MisDataFunction/Function1061/OpcServer/HeartBeat.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using MesServerWork;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeatMES(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//返写在MES心跳中
|
||||
MIS_BASE.Write_TagValueByTagTypeID(15, OpName, tagValue);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeatPLC(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int HeartBeatPLC;
|
||||
//读取PLC心跳数据
|
||||
HeartBeatPLC = Convert.ToInt32(MIS_BASE.Read_TagValueByTagTypeID(14, OpName));
|
||||
//通知WEB修改状态
|
||||
string message = "MES|HeartBeatPLC|" + OpName + "|" + HeartBeatPLC.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
110
MisDataFunction/Function1061/OpcServer/MesRead.cs
Normal file
110
MisDataFunction/Function1061/OpcServer/MesRead.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int EngineTypeID;
|
||||
string EngineType;
|
||||
string EngineID;
|
||||
int PartPallet_Code;
|
||||
string OrderForm;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据!");
|
||||
int qualityMask = Convert.ToInt32(MIS_BASE.Read_TagValueByTagTypeID(21, OpName));
|
||||
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID,out PartPallet_Code, out OrderForm);
|
||||
|
||||
// PDC产线plc只写了发动机号和机型代码,其余要从数据库中读取
|
||||
MisDataFun.Moby_Select_PDC(EngineID, out OrderForm, out EngineType, out EngineTypeID);
|
||||
|
||||
// 保存物料数据
|
||||
MisDataFun.Material_Insert(OpName, qualityMask);
|
||||
|
||||
// 保存过站信息
|
||||
MisDataFun.WorkStartInsert(OpName, qualityMask);
|
||||
|
||||
// 从数据库查出质量数据组 MOM_质量数据_上传_查询
|
||||
MisDataFun.GetPartQualityGroupParams(OpName, EngineID, out DataTable dt_quality);
|
||||
|
||||
// 调用工厂MES出站接口
|
||||
string code;
|
||||
string message;
|
||||
if (dt_quality.Rows.Count > 0)
|
||||
{
|
||||
CallWebService.Call_dataCollectForSfcEx(OpName, EngineID, dt_quality, qualityMask, out code, out message);
|
||||
}
|
||||
else
|
||||
{
|
||||
CallWebService.Call_sfcComplete(OpName, EngineID, qualityMask, out code, out message);
|
||||
}
|
||||
if (code == "0")
|
||||
{
|
||||
// 写入加工合格还是不合格 根据工位合格标志写
|
||||
MIS_BASE.Write_OpNameIsOk(OpName, qualityMask);
|
||||
}
|
||||
else if (code == "13921") // 质量判定不合格 走不合格放行
|
||||
{
|
||||
MIS_BASE.Write_OpNameIsOk(OpName, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "出站失败:" + EngineID + ",错误代码:" + code + ",消息:" + message;
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "MOM", msg);
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果不合格 同时 是人工PC工位 则 需要屏幕上点放行后才能放行
|
||||
if (qualityMask != 1 && MisDataFun.GetSpecialOpExist(OpName, "人工PC工位"))
|
||||
{
|
||||
SendInfomation("showOpWorkFalseGoBox", "1", OpName); // 显示不合格刷卡放行弹窗
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", $"{EngineID} 产品不合格 待人工确认后不合格放行!");
|
||||
return;
|
||||
}
|
||||
|
||||
//通知PLC,MES工作完成
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||
//通知PLC,MES保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES保存数据完成!");
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "MES工作完成!");
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, false);
|
||||
// 写入加工合格还是不合格 根据工位合格标志写
|
||||
MIS_BASE.Write_OpNameIsOk(OpName, -99);
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MesRead", "PLC允许保存数据取消!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
34
MisDataFunction/Function1061/OpcServer/MesReadOver.cs
Normal file
34
MisDataFunction/Function1061/OpcServer/MesReadOver.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesReadOver(object e)
|
||||
{
|
||||
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, tagValue);
|
||||
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
100
MisDataFunction/Function1061/OpcServer/PartLoad.cs
Normal file
100
MisDataFunction/Function1061/OpcServer/PartLoad.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线(针对上线工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "申请上线!");
|
||||
if (!MisDataFun.GetPartLoadIsAutoOnLineModel(OpName)) return; // 判断 申请模式是否为自动申请
|
||||
|
||||
// 调用接口/或者本地生成模组码 或者 PACK码
|
||||
CallWebService.Call_miReleaseSfcWithActivity(OpName, out string sfc, out string code, out string message);
|
||||
string msg1 = "申请条码完成:" + sfc + ",code:" + code + ",message:" + message;
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MOM", msg1);
|
||||
if (code != "0")
|
||||
{
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, OpName, true); // MES报警
|
||||
string msg = "【" + OpName + "】" + msg1;
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "PackPartLoad", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_TagValueByTagTypeID(34, OpName, false); // 清除报警
|
||||
|
||||
// 这里就是Pack码~
|
||||
string EngineID = sfc;
|
||||
|
||||
// 读取当前选择的计划中的机型, 发动机号,写入PLC
|
||||
MisDataFun.GetEngineType_PackOrder(sfc, out int EngineTypeID, out string EngineType, out string OrderForm, out int isCheckOk, out string msg2);
|
||||
|
||||
// 1.机型信息写入数据库,记录工位开始
|
||||
MIS_BASE.Read_PalletCode(OpName, out int PartPallet_Code);
|
||||
MisDataFun.OpName_MIS_MOBY_Insert_FirstOpName(OpName, EngineTypeID, EngineTypeID, EngineType, EngineType, EngineID, EngineID, PartPallet_Code, OrderForm, OrderForm);
|
||||
|
||||
//第一步,将操作指南转移到操作指南_临时表中
|
||||
MisDataFun.MesServer_ProcessList_EngineTypeOver(OpName);
|
||||
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
MisDataFun.MesServer_Process_EngineTypeOver(OpName);
|
||||
|
||||
//5 显示订单、机型信息
|
||||
SendMessage.ShowMoby_FirstOpName(OpName);
|
||||
|
||||
// 3显示操作指导图片 PicShow_String_FirstOpName
|
||||
// SendMessage.PicShow_FirstOpName(OpName);
|
||||
|
||||
//1 工序内容
|
||||
SendMessage.ProcessList_FirstOpName(OpName);
|
||||
|
||||
// 2界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(OpName);
|
||||
|
||||
string msg = "请扫描物料码!";
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "PackPartLoad", msg);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, msg);
|
||||
|
||||
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_EngineTypeGetOver_MES(OpName, true);// 传递机型(MES)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "申请上线取消!");
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);// 传递机型(MES)
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MyLog4Net.MyLogHelper.Error("PartLoad", err.Message.ToString());
|
||||
MisDataFun.LogRecording_OP("Function1051", "INFO", "PartLoad", err.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
371
MisDataFunction/Function1061/OpcServer/WebSubmit.cs
Normal file
371
MisDataFunction/Function1061/OpcServer/WebSubmit.cs
Normal file
@@ -0,0 +1,371 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using MisDataFunDll;
|
||||
|
||||
|
||||
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);
|
||||
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);
|
||||
break;
|
||||
case "FixAllow"://重新拧紧
|
||||
WorkAgain(OpName);
|
||||
break;
|
||||
case "FixAllow_Ng"://不合格后继续拧紧
|
||||
FixOK_Ng_Next(OpName);
|
||||
break;
|
||||
case "RepairUplineMES"://返修上线
|
||||
MIS_BASE.Write_RepairUpline_MES(OpName, true);
|
||||
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_MesWorkFinish(OpName, true);
|
||||
}
|
||||
break;
|
||||
case "PalletGO":
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
//直接给出工作完成
|
||||
MIS_BASE.Write_MesWorkFinish(opName_SubLine, true);
|
||||
}
|
||||
break;
|
||||
case "ContinueMatch":
|
||||
//BaseDataSystemMES.QualityVerifyStatus_Hash_Write(OpName, true);
|
||||
fun_EngineTypeGetOverPLC(_e);
|
||||
break;
|
||||
//初始化网页信号
|
||||
case "IniSingalToWeb":
|
||||
InitializeSingalToWeb(OpName);
|
||||
break;
|
||||
// 检查项 检查完成
|
||||
case "checkWorkOver":
|
||||
//MIS_BASE.Write_TagValueByTagTypeID(30, OpName,1);
|
||||
//msg = "MES|checkWorkOverIsShow|" + OpName + "|" + 0;
|
||||
//SendMessage.AsyncSendMessage(msg);
|
||||
break;
|
||||
// 重新申请上线
|
||||
case "againPartLoad":
|
||||
// 判断是否有工件到位
|
||||
MIS_BASE.Read_WorkStart(OpName, out bolVal);
|
||||
if (bolVal)
|
||||
{
|
||||
MIS_BASE.Write_TagValueByTagTypeID(35, OpName, 1);
|
||||
msg = "【" + OpName + "】" + "重新申请上线完成!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "【" + OpName + "】" + "当前无工件到位信号,请确认是否存在工件!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
break;
|
||||
// 跳过交互
|
||||
case "skipWork":
|
||||
// 判断是否有工件到位
|
||||
MIS_BASE.Read_WorkStart(OpName, out bolVal);
|
||||
if (bolVal)
|
||||
{
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true); // 传递机型
|
||||
MIS_BASE.Write_FixAllow(OpName, true); // 允许工作
|
||||
MIS_BASE.Write_TagValueByTagTypeID(30, OpName, 1); // 检查完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true); // 保存完成
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, true); // 工作完成
|
||||
msg = "【" + OpName + "】" + "跳过交互完成!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "【" + OpName + "】" + "当前无工件到位信号,请确认是否存在工件!";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
}
|
||||
break;
|
||||
case "twoWorkSkip"://重新工作工件跳过工作(重新工作工件)
|
||||
//工作完成
|
||||
EngineTypeGetOver_PLC_Work_Skip(OpName);
|
||||
break;
|
||||
case "twoWork"://重新工作工件重新工作(重新工作工件)
|
||||
//允许工作
|
||||
EngineTypeGetOver_PLC_Work_two(OpName);
|
||||
break;
|
||||
case "OpWorkFalseGoByWeb": // 人工不合格放行确认完毕!
|
||||
MIS_BASE.Read_FalseGo(OpName, out bool S_FalseGo);
|
||||
MIS_BASE.Read_MesRead(OpName, out bool S_MesRead);
|
||||
if (S_FalseGo && S_MesRead)
|
||||
{
|
||||
//通知PLC,MES工作完成
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "人工确认不合格放行成功!");
|
||||
}
|
||||
break;
|
||||
case "UpLinModelQut": // 上线模式切换
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
MIS_BASE.Write_TagValueByTagTypeID(27, OpName, true); // 10.2 通知PLC当前非自动上线模式
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_TagValueByTagTypeID(27, OpName, false); // 10.2 通知PLC当前自动上线模式
|
||||
}
|
||||
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;
|
||||
bool isHaveNg;
|
||||
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);
|
||||
MIS_BASE.Read_FalseGo(Opname, out bool S_FalseGo);
|
||||
|
||||
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);
|
||||
|
||||
// 判断是否还需要拧紧,需要的话就发送信息给web
|
||||
bool isNotTightWorkOver = GetShaftWoringStepIsWorked_WorkGroup(Opname, EngineTypeID, EngineType, out ProcessCode, out BoltCode, out workStepProperty, out isHaveNg);
|
||||
// 如果有允许拧紧 显示界面UI
|
||||
if (S_FixAllow)
|
||||
{
|
||||
if (!isNotTightWorkOver)
|
||||
{
|
||||
//通知web显示 拧紧位置
|
||||
SendMessageFun.SendInfomation("ShaftPosition", "1", Opname);
|
||||
//发动UDP,通知读取质量数据,实时显示质量数据,最后一段为合格标志(根据合格标志显示哭脸笑脸,2对应哭脸,1对应笑脸)
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality_Tight", ProcessCode.ToString() + "&" + 0, Opname);
|
||||
//发动UDP,通知MES工作站拧紧第几组
|
||||
SendMessageFun.SendInfomation("FixAllowGuid", Convert.ToString(ProcessCode) + "&" + Convert.ToString(BoltCode), Opname);//显示拧紧标志
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 判断最近拧紧是否不合格 如果不合格 弹窗提示重新拧紧
|
||||
if (MisDataFun.OP_Tight_isShowAgainWork(Opname))
|
||||
{
|
||||
//通知web显示 拧紧位置
|
||||
SendMessageFun.SendInfomation("ShaftPosition", "1", Opname);
|
||||
//获取当前组号拧紧的合格标志及保存质量数据
|
||||
int isOK = GetTagValue(Opname, EngineTypeID, EngineType, EngineID, ProcessCode, PartPallet_Code);
|
||||
//发动UDP,通知读取质量数据,实时显示质量数据,最后一段为合格标志(根据合格标志显示哭脸笑脸,2对应哭脸,1对应笑脸)
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality_Tight", ProcessCode.ToString() + "&" + 2, Opname);
|
||||
//发动UDP,通知MES工作站拧紧第几组
|
||||
SendMessageFun.SendInfomation("FixAllowGuid", Convert.ToString(ProcessCode) + "&" + Convert.ToString(BoltCode), 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_FalseGo && MisDataFun.GetSpecialOpExist(Opname, "人工PC工位")) SendInfomation("showOpWorkFalseGoBox", "1", 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
62
MisDataFunction/Function1061/OpcServer/WorkStart.cs
Normal file
62
MisDataFunction/Function1061/OpcServer/WorkStart.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void WorkStart(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string tagValue = msgEvent.TagValue.ToString();
|
||||
|
||||
if (tagValue == "1")
|
||||
{
|
||||
string msg = "工件到位!";
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", msg);
|
||||
MisDataFun.MOBY_TrayStart_Update(OpName); // 记录托盘到达时间
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "工件离开!";
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", msg);
|
||||
// 清除工位数据
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false); // 传递机型(MES)
|
||||
MIS_BASE.Write_MesWorkFinish(OpName, false); // 工作完成(MES)
|
||||
MIS_BASE.Write_FalseGO(OpName, false); // 不合格放行(MES)
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false); // 合格放行(MES)
|
||||
MIS_BASE.Write_FixAllow(OpName, false); // 允许PLC拧紧工作(MES)
|
||||
MIS_BASE.Write_ProcessCode(OpName, 0); // 拧紧序号(MES)
|
||||
MIS_BASE.Write_BoltCode(OpName, 0); // 套筒号(MES)
|
||||
MIS_BASE.Write_MesReadOver(OpName, false); // MES保存完数据(MES)
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0); // 机型标志(MES)
|
||||
MIS_BASE.Write_EngineID_MES(OpName, ""); // 工件编号(MES)
|
||||
MIS_BASE.Write_EngineType_MES(OpName, ""); // 产品型号(MES)
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, ""); // 订单号(MES)
|
||||
MIS_BASE.Write_TagValueByTagTypeID(77, OpName, 0); // 拧紧序号
|
||||
MIS_BASE.Write_TagValueByTagTypeID(88, OpName, 0); // 套筒号
|
||||
MIS_BASE.Write_TagValueByTagTypeID(67, OpName, 0); // 拧紧结束确认
|
||||
MIS_BASE.Write_NotAllowWork(OpName, false); // 不允许工作
|
||||
SendMessageFun.AsyncSendMessage_Materials_BarCode_Box(OpName, 0, "", "", ""); // 扫码指导弹窗
|
||||
MIS_BASE.Write_MesErrorType(OpName, 0); // MES报警点
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataFun.LogRecording_OP("Function1051", "INFO", "WorkStart", err.Message.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1061/OpcServer/vssver2.scc
Normal file
BIN
MisDataFunction/Function1061/OpcServer/vssver2.scc
Normal file
Binary file not shown.
Reference in New Issue
Block a user