MVP!
This commit is contained in:
67
MisDataFunction/Function1052/OpcServer/Barcode.cs
Normal file
67
MisDataFunction/Function1052/OpcServer/Barcode.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System;
|
||||
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
///1.扫描配送单号,用于接收物料,扫描单号的时候,将接收的物料信息显示在“物料拉动”Tab区域
|
||||
///2.扫描料箱标签/看板卡,用于追溯物料批次信息
|
||||
///3.扫描零件条码,根据零件图号进行防错
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void Barcode(object e)
|
||||
{
|
||||
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
try
|
||||
{
|
||||
// 自动工位不进行物料扫码
|
||||
// 但是150工位需要扫模组码进行二次校验~
|
||||
// 读取PLC中的信息
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm; // 工单号
|
||||
int PartPallet_Code;//托盘编号
|
||||
bool PartLoad_EngineGetOver_PLC;
|
||||
|
||||
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 EngineTypeID2);
|
||||
if (!MisDataBaseFun.CheckMesApiIsOk(OpName, EngineID, "miFindCustomAndSfcData")) return; // 验证入站接口是否成功!
|
||||
|
||||
// 验证托盘码
|
||||
int ScanPalletCodeStatu = MisDataBaseFun.ScanPalletCode(OpName, barcode, EngineID);
|
||||
if (ScanPalletCodeStatu != 2)
|
||||
{
|
||||
// 走传递机型的流程
|
||||
// 机型信息写入数据库
|
||||
MisDataFun.OpName_MIS_MOBY_Insert(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm, 0, 0, "");
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:Barcode");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
40
MisDataFunction/Function1052/OpcServer/ConfirmOkGo.cs
Normal file
40
MisDataFunction/Function1052/OpcServer/ConfirmOkGo.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
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)
|
||||
{
|
||||
|
||||
//BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
//更新订单完工数量及物料
|
||||
// Sendmessage("24", "11", OpName);
|
||||
|
||||
//工作完成
|
||||
//MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
71
MisDataFunction/Function1052/OpcServer/EngineGetOver.cs
Normal file
71
MisDataFunction/Function1052/OpcServer/EngineGetOver.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using MisDataSaveDate;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
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 EngineTypeID_2);
|
||||
SendMessageFun.SendMessage("5", "1", OpName);
|
||||
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")
|
||||
{
|
||||
// 机型信息写入数据库
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
45
MisDataFunction/Function1052/OpcServer/FalseGO.cs
Normal file
45
MisDataFunction/Function1052/OpcServer/FalseGO.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
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)
|
||||
{
|
||||
//不合格放行信号
|
||||
//MIS_BASE.Write_FalseGO(OpName, true);
|
||||
//总合格标志2(不合格)
|
||||
|
||||
// BaseDataSystemMES.Material_Insert_NG(OpName, 2);
|
||||
|
||||
// Sendmessage("24", "11", OpName);
|
||||
|
||||
//工作完成
|
||||
//MIS_BASE.Write_MesWorkFinish(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
MisDataFunction/Function1052/OpcServer/HeartBeat.cs
Normal file
34
MisDataFunction/Function1052/OpcServer/HeartBeat.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeat(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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
151
MisDataFunction/Function1052/OpcServer/MesRead.cs
Normal file
151
MisDataFunction/Function1052/OpcServer/MesRead.cs
Normal file
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using MesDataFunction;
|
||||
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", "MIS", "PLC允许保存数据!");
|
||||
MIS_BASE.Read_QualityMask(OpName, out int qualityMask);
|
||||
|
||||
#region 工位特殊操作部分
|
||||
//// 判断是否需要手动选择OK/NG 不需要了 按照PLC给的合格标志做
|
||||
//if (MisDataFun.GetSpecialOpExist(OpName, "手动OKNG放行"))
|
||||
//{
|
||||
// MIS_BASE.Read_ConfirmOkGo(OpName, out bool okGo);
|
||||
// MIS_BASE.Read_FalseGo(OpName, out bool falseGo);
|
||||
// if (!okGo && !falseGo)
|
||||
// {
|
||||
// string errMsg = $"【{OpName}】请在界面选择 OK/NG 放行";
|
||||
// MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", errMsg);
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, errMsg);
|
||||
// return;
|
||||
// }
|
||||
// if (okGo) qualityMask = 1;
|
||||
// if (falseGo) qualityMask = 2;
|
||||
//}
|
||||
#endregion
|
||||
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
|
||||
string code;
|
||||
string message;
|
||||
if (MisDataFun.GetSpecialOpExist(OpName, "自动入箱工位"))
|
||||
{
|
||||
// 把模组码和箱体码绑定到执行计划列表中 DBB640-679
|
||||
string TrunEngineID = MIS_BASE.Read_TagValueByTagTypeID(203, OpName);
|
||||
// 调用接口进行物料装配验证
|
||||
CallWebService.Call_miAssmebleAndCollectDataForSfc(OpName, EngineID, TrunEngineID,"", out code, out message);
|
||||
if (code != "0")
|
||||
{
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "MIS", "PACK装配模组失败!message: " + message);
|
||||
return;
|
||||
}
|
||||
// 把PLC给得 模组码存入Pack中 同时给 模组记录Pack信息
|
||||
MisDataFun.WorkPlan_TurnLine(EngineID, TrunEngineID, 1);
|
||||
}
|
||||
|
||||
// PDC产线plc只写了发动机号和机型代码,其余要从数据库中读取
|
||||
MisDataFun.Moby_Select_PDC(EngineID, out OrderForm, out EngineType, out EngineTypeID);
|
||||
|
||||
// 保存质量数据
|
||||
MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
|
||||
//MisDataFun.MOM_SaveQDataToUpload(OpName, EngineID); // 数据存至临时表
|
||||
MisDataFun.WorkStartInsert(OpName, qualityMask); // 保存不合格过站信息
|
||||
|
||||
// 判断是否存在首件标志
|
||||
if (MIS_BASE.Read_TagValueByTagTypeID(62, OpName) == "1") MisDataFun.Save_FristWorkData(OpName, EngineID); // 第一个产品 存首件数据
|
||||
|
||||
// 保存物料数据
|
||||
MisDataFun.Material_Insert(OpName, qualityMask);
|
||||
// 从数据库查出质量数据组 MOM_质量数据_上传_查询
|
||||
MisDataFun.GetPartQualityGroupParams(OpName, EngineID, out DataTable dt_quality);
|
||||
// 调用工厂MES出站接口
|
||||
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") // 质量判定不合格 走不合格放行
|
||||
{
|
||||
qualityMask = 2;
|
||||
MIS_BASE.Write_OpNameIsOk(OpName, qualityMask);
|
||||
MisDataFun.WorkStartInsert(OpName, qualityMask); // 保存不合格过站信息
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "出站失败:" + EngineID + ",code:" + code + ",message:" + message;
|
||||
MisDataFun.LogRecording_OP(OpName, "ERROR", "MOM", msg);
|
||||
return;
|
||||
}
|
||||
// 保存过站信息
|
||||
MisDataFun.WorkStartInsert(OpName, qualityMask);
|
||||
|
||||
// 如果不合格 同时 是人工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", "MIS", "MES保存数据完成!");
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "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", "MIS", "PLC允许保存数据取消!");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
54
MisDataFunction/Function1052/OpcServer/MesReadOver.cs
Normal file
54
MisDataFunction/Function1052/OpcServer/MesReadOver.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
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);
|
||||
// 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");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
MisDataFunction/Function1052/OpcServer/MesSaveNowData.cs
Normal file
39
MisDataFunction/Function1052/OpcServer/MesSaveNowData.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES保存实时质量数据
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesSaveNowData(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
// 直接发送实时的 质量数据
|
||||
string message = MisDataSaveDateMesRead.Funtion.GetRealTimeQualityData(OpName);
|
||||
//推送质量数据到MES的页面
|
||||
SendMessage.AsyncSendMessage("MES|ShowTimelyQuality_Resources|" + OpName + "|" + message);
|
||||
//SendMessageFun.SendMessageMESToWEB("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
352
MisDataFunction/Function1052/OpcServer/WebSubmit.cs
Normal file
352
MisDataFunction/Function1052/OpcServer/WebSubmit.cs
Normal file
@@ -0,0 +1,352 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using MesDataFunction;
|
||||
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);
|
||||
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 "FixAllow"://重新拧紧
|
||||
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 "PrintCode": // 打印条码 前端发起
|
||||
PrinterCommandCenter.PrintToPrinter(OpName, m_Value);
|
||||
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);
|
||||
//通知PLC,MES保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
MisDataFun.LogRecording_OP(OpName, "INFO", "MIS", "人工确认不合格放行成功!");
|
||||
}
|
||||
break;
|
||||
//case "selectOkGo":
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, true);
|
||||
// MIS_BASE.Write_FalseGO(OpName, false);
|
||||
// // 判断是否有允许保存 如果有 则出发保存流程
|
||||
// MIS_BASE.Read_MesRead(OpName, out bolVal);
|
||||
// msgEvent.TagValue = "1";
|
||||
// msgEvent.TagID = "1";
|
||||
// if (bolVal) MesRead(msgEvent);
|
||||
// break;
|
||||
//case "selectFalseGo":
|
||||
// MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
// MIS_BASE.Write_FalseGO(OpName, true);
|
||||
// // 判断是否有允许保存 如果有 则出发保存流程
|
||||
// MIS_BASE.Read_MesRead(OpName, out bolVal);
|
||||
// msgEvent.TagValue = "1";
|
||||
// msgEvent.TagID = "1";
|
||||
// if (bolVal) MesRead(msgEvent);
|
||||
// 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);
|
||||
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);
|
||||
}
|
||||
//----------------------------------------------------
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
44
MisDataFunction/Function1052/OpcServer/WorkIsOk.cs
Normal file
44
MisDataFunction/Function1052/OpcServer/WorkIsOk.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工位合格标志
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void IsOk(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int qualityMask;
|
||||
MIS_BASE.Read_QualityMask(OpName, out qualityMask);
|
||||
//判断是否合格
|
||||
if (qualityMask == 1)
|
||||
{
|
||||
qualityMask = 1;
|
||||
} else {
|
||||
qualityMask = 0;
|
||||
}
|
||||
//通知WEB修改状态
|
||||
string message = "MES|QualityMask|" + OpName + "|" + qualityMask.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
62
MisDataFunction/Function1052/OpcServer/WorkStart.cs
Normal file
62
MisDataFunction/Function1052/OpcServer/WorkStart.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Threading;
|
||||
//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_MachineTime_ReadOver(OpName, false); // 托盘校验完成
|
||||
MIS_BASE.Write_NotAllowWork(OpName, false); // 不允许工作
|
||||
MIS_BASE.Write_MesErrorType(OpName, 0); // MES报警点
|
||||
MIS_BASE.Write_TagValueByTagTypeID(116, OpName, ""); // PACK码校验 前40位
|
||||
MIS_BASE.Write_TagValueByTagTypeID(117, OpName, ""); // PACK码校验 40位后
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataFun.LogRecording_OP("Function1051", "INFO", "WorkStart", err.Message.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1052/OpcServer/vssver2.scc
Normal file
BIN
MisDataFunction/Function1052/OpcServer/vssver2.scc
Normal file
Binary file not shown.
Reference in New Issue
Block a user