chore: 初始化合力驱动桥MES采集程序
This commit is contained in:
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 正常逻辑工作(传递机型)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="EngineTypeID"></param>
|
||||
/// <param name="EngineType"></param>
|
||||
/// <param name="EngineID"></param>
|
||||
/// <param name="PartPallet_Code"></param>
|
||||
private void EngineTypeGetOver_PLC_Work(string OpName, int EngineTypeID, string EngineType, string EngineID, int PartPallet_Code, string OrderForm)
|
||||
{
|
||||
int IsAllowWork;
|
||||
int RepairPartStatusPLC = 0;
|
||||
int MES_QualityMask = 1;
|
||||
|
||||
string OpName_MainLine = "OP050";
|
||||
string OpName_SubLine = "OPA90";
|
||||
|
||||
|
||||
//电子看板_装配零件_临时表_增加_北汽
|
||||
//第二步,将零件信息转移到零件_临时表中
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOverBQ(OpName);
|
||||
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("123", "111", OpName);
|
||||
//MIS_BASE.Read_PalletInfo(OpName, out MES_QualityMask);//合格标志 合格标志暂时改为即时响应式的
|
||||
//MIS_BASE.Read_RepairStatus_PLC(OpName, out RepairPartStatusPLC);//返修标志
|
||||
//SendMessageFun.SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);//显示合格标志
|
||||
//SendMessageFun.SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);//显示返修标志
|
||||
|
||||
// 去将该工件之前的件都标记为异常件
|
||||
BaseDataSystemMES.OPA90CheckQiaoKeErrorData(EngineID);
|
||||
|
||||
// 1.判断052工位给的是否在050 工位干活的信号 若不在该工位干则直接退出Function
|
||||
Db.OP051_OP050_NeedWork_Search(EngineID, out int IsWork);
|
||||
if(IsWork == 2)
|
||||
{
|
||||
// 2 写入托盘不需要工作后退出方法
|
||||
MIS_BASE.WritePLC(77, OpName, 2);// 托盘不需要工作
|
||||
return;
|
||||
}
|
||||
|
||||
// 正常流程托盘需要工作
|
||||
MIS_BASE.WritePLC(77, OpName, 1);// 托盘需要工作
|
||||
|
||||
// 2. 读取是否存在两个已匹配的轮毂 若存在则可以允许工作
|
||||
bool result = Db.OPA90_TO_OP50_CheckTwoFinish(out int isNeedWork);
|
||||
if(isNeedWork == 1)
|
||||
{
|
||||
string LunGuCode1 = MIS_BASE.ReadPLC(123, OpName).ToString();
|
||||
string LunGuCode2 = MIS_BASE.ReadPLC(124, OpName).ToString();
|
||||
if ((LunGuCode1 == "0" || LunGuCode1 == "" || LunGuCode1.Length < 5 || LunGuCode1.IndexOf("\0") != -1) || (LunGuCode2 == "0" || LunGuCode2 == "" || LunGuCode2.Length < 5 || LunGuCode2.IndexOf("\0") != -1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Db.OPA92_DeleteLineData(EngineID, LunGuCode1, LunGuCode2);
|
||||
MIS_BASE.Write_FixAllow(OpName, true); // 允许工作
|
||||
|
||||
// 绑定关系 同时 删除记录
|
||||
//Db.OPA92_DeleteLineData(EngineID);
|
||||
}
|
||||
|
||||
// 判断主线是否 传递机型
|
||||
//if (EngineGetOver_MainLine)
|
||||
//{
|
||||
// string EngineTypeID_MainLine;
|
||||
// int EngineTypeID_MainLineQiaoKe;
|
||||
|
||||
// // 读取主线桥壳机型
|
||||
// MIS_BASE.Read_EngineTypeID(OpName_MainLine, out EngineTypeID_MainLineQiaoKe);
|
||||
// // 读取分线存储的桥壳机型
|
||||
// MIS_BASE.Read_TagTypeID(38, OpName_SubLine, out EngineTypeID_MainLine);
|
||||
|
||||
// if (Convert.ToInt32(EngineTypeID_MainLine) == EngineTypeID)
|
||||
// {
|
||||
// Db.OP50_OPA90_MatchResult(EngineTypeID, Convert.ToInt32(EngineTypeID_MainLine), EngineTypeID_MainLineQiaoKe, out int MatchResult);
|
||||
|
||||
// if (MatchResult == 0) // 不匹配
|
||||
// {
|
||||
// // 主线
|
||||
// MIS_BASE.Write_Match(OpName_MainLine, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_MainLine, false);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_MainLine, false); // 允许工作
|
||||
// // 分线
|
||||
// MIS_BASE.Write_Match(OpName_SubLine, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_SubLine, false);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_SubLine, false); // 允许工作
|
||||
|
||||
// // 写入分线 等待 0
|
||||
// MIS_BASE.WritePLC(29, OpName_SubLine, "0");
|
||||
// }
|
||||
// if (MatchResult == 1) // 允许抓
|
||||
// {
|
||||
// // 主线
|
||||
// MIS_BASE.Write_Match(OpName_MainLine, true);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_MainLine, true);// 匹配完成
|
||||
// // 分线
|
||||
// MIS_BASE.Write_Match(OpName_SubLine, true);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_SubLine, true);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_MainLine, true); // 允许工作
|
||||
|
||||
// // 写入分线 等待 0
|
||||
// MIS_BASE.WritePLC(29, OpName_SubLine, "0");
|
||||
// }
|
||||
// if (MatchResult == 2) // 等待
|
||||
// {
|
||||
// // 写入分线 等待 1
|
||||
// MIS_BASE.WritePLC(29, OpName_SubLine, "1");
|
||||
// }
|
||||
|
||||
// }
|
||||
// else // 不匹配
|
||||
// {
|
||||
// // 主线
|
||||
// MIS_BASE.Write_Match(OpName_MainLine, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_MainLine, false);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_MainLine, false); // 允许工作
|
||||
// // 分线
|
||||
// MIS_BASE.Write_Match(OpName_SubLine, false);// 匹配结果
|
||||
// MIS_BASE.Write_MatchingCompleted(OpName_SubLine, false);// 匹配完成
|
||||
// MIS_BASE.Write_FixAllow(OpName_SubLine, false); // 允许工作
|
||||
|
||||
// // 写入分线 等待 0
|
||||
// MIS_BASE.WritePLC(29, OpName_SubLine, "0");
|
||||
// }
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_two(string OpName)
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, Convert.ToInt32(PartPallet_Code), OrderForm);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 跳过二次工作
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
private void EngineTypeGetOver_PLC_Work_Skip(string OpName)
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返修件需要工作
|
||||
/// </summary>
|
||||
/// <param name="OpName">工位号</param>
|
||||
private void IsNeedRepaire_OK(string OpName)
|
||||
{
|
||||
string orderForm = "";
|
||||
int engineTypeID;
|
||||
string engineType = "";
|
||||
string engineID = "";
|
||||
string palletCode = "";
|
||||
int isRepair;
|
||||
string repairCode = "";
|
||||
//从监控系统中查询出本工位信息
|
||||
BaseDataSystemMES.OpName_MIS_Moby_Select(OpName,
|
||||
out orderForm, out engineTypeID, out engineType,
|
||||
out engineID, out palletCode, out isRepair, out repairCode);
|
||||
|
||||
EngineTypeGetOver_PLC_Work(OpName, engineTypeID, engineType, engineID, Convert.ToInt32(palletCode), orderForm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 此类用于向WEB发送各种类型消息
|
||||
/// </summary>
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 批量发送WEB消息(Value为BOOL值)
|
||||
/// </summary>
|
||||
/// <param name="MessageNumm">消息编号组合</param>
|
||||
/// <param name="Value">消息值组合</param>
|
||||
/// <param name="OpName">工位号</param>
|
||||
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>
|
||||
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,53 @@
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using DataLinkMesWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 发送信息到MES通讯服务器或者其他的
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private string AsyncSendMessage(string Message)
|
||||
{
|
||||
return MIS_BASE.asyncSendMessage(Message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送提示消息
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
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>
|
||||
/// 发送信息到打印机
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private void asyncSendMessageToMark(string Message)
|
||||
{
|
||||
string messageSend = (string)Message;
|
||||
//UDPClientSend.Send_ALL(ApplicationConfig.MES_MarkPortNum, messageSend);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送信息到LED
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
private void asyncSendMessageLED(string OpName)
|
||||
{
|
||||
//发送到大屏幕显示 41104
|
||||
string strMessage = "MIS|" + OpName + "|" + "0" + "|" + "1";
|
||||
//UDPClientSend.Send_ALL(ApplicationConfig.Port_ShowLED_ProductCount, strMessage);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user