chore: 初始化北汽福田MES采集程序
This commit is contained in:
@@ -0,0 +1,321 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
using bizFacade;
|
||||
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
//+*************DbName*****************
|
||||
string DbName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
SendMessageFun.SendInfomation("BarCodeData", barcode, OpName); // 将扫码值发送给前端
|
||||
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
int Recipe1;
|
||||
int Recipe2;
|
||||
|
||||
bool IsNotRepeatedNumber = false;
|
||||
//1:获得申请上线信息后,扫描条码才处理业务
|
||||
bool ispartload;
|
||||
//(115)
|
||||
int PTO;
|
||||
//(118)0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
int NgearSwitch;
|
||||
//(119)0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
int RgearSwitch;
|
||||
//(120)0=不检测;1=检测。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
int SpeedSensor;
|
||||
//(121)例如:5S 400。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
string PartTypeMid;
|
||||
//(122) 0=不检测;1=24V,2=12V。检测线上线工位扫描总成条码,根据BOM,查出
|
||||
int Tcu_V;
|
||||
//(123) 加有量检测线上线工位扫描总成条码,根据BOM,查出
|
||||
float addOil;
|
||||
//(124) 上线法兰凹凸 -- 5s 1 凸 2 凹 6s 4凸 8 凹
|
||||
int flange;
|
||||
//(17) 上线细一轴
|
||||
int Slender;
|
||||
//(35) 分泵推杆
|
||||
int Putters;
|
||||
|
||||
bool isShowBarNGTipBox = false;
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//判断工件是否到位
|
||||
|
||||
MIS_BASE.Read_WorkStart(OpName, out ispartload);
|
||||
if (!ispartload)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请检查设备是否到位(DBX500.1=1)");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
//判断设备是否申请上线 改为传递机型了
|
||||
MIS_BASE.Read_PartLoad(OpName, out ispartload);
|
||||
if (!ispartload)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请检查设备是否申请上线(DBX500.3=1)");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
// 判读条码是变速器序列号条码号还是物料号 小机型*日月年* 流水号(给起始号 + 数量)
|
||||
// 选小机型 从北汽福田BOM中选 得先维护BOM
|
||||
// 变速器序列号 '1333 050 062*16012023*30000001'
|
||||
|
||||
//扫描完变速器序列号条码号 true
|
||||
//扫描完变速器序列号条码号 true
|
||||
bool isGetOver_PLC = false;
|
||||
//判断上线工位,MES 是否将工件流水号、机型等信息已经写入到PLC了
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out isGetOver_PLC);
|
||||
|
||||
//如果工件流水号、机型等信息没有写入PLC,扫描的条码按工件流水号进行验证
|
||||
//否则按装配物料进行验证
|
||||
if (!isGetOver_PLC)
|
||||
{
|
||||
|
||||
if (barcode.Split('*').Length > 2)
|
||||
{
|
||||
//2: 判断是否重号, 从数据库获得机型、机型代码等信息
|
||||
string partSn = barcode;
|
||||
EngineID = barcode;
|
||||
|
||||
//判断是否返修件 若不是返修件则要校验是否在当前计划中
|
||||
DataTable backWorkDt = BaseDataSystemMES.Get_IsBarCodeBackWork(OpName, EngineID);
|
||||
if (Convert.ToInt32(backWorkDt.Rows[0]["Count"]) == 0)
|
||||
{
|
||||
// 判断扫的码是否在当前生产订单中
|
||||
if (OpName == "J07MA005")
|
||||
{
|
||||
DataTable BarCodeDt;
|
||||
BarCodeDt = BaseDataSystemMES.GetMainLineNowWorkOrderData(OpName, EngineID);
|
||||
if (BarCodeDt.Rows.Count == 0)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "当前工位订单可上线条码中不存在此条码,请在当前计划模块中查看!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
|
||||
//Db.GetEngineType( partSn, out EngineTypeID, out EngineType, out EngineID, out IsRepeatedNumber);
|
||||
//Db.GetEngineType( partSn, out EngineTypeID, out EngineType, out EngineID, out IsRepeatedNumber);
|
||||
|
||||
//IsRepeatedNumber true 不重号;false 重号;
|
||||
IsNotRepeatedNumber = BaseDataSystemMES.EngineTypeID_IsNotRepeatedNumber(partSn);
|
||||
if (IsNotRepeatedNumber)
|
||||
{
|
||||
bool isData = BaseDataSystemMES.GetEngineTypeUpLoadOpName(partSn, OpName, out EngineTypeID, out EngineType, out OrderForm, out Recipe1, out Recipe2);
|
||||
if (!isData)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "生产订单中无此条码,请在当前计划模块中查看确认!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
//MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
//MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
//MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
//MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
|
||||
BaseDataSystemMES.UpLoadPTO(EngineType, out PTO, out NgearSwitch, out RgearSwitch, out SpeedSensor, out PartTypeMid, out Tcu_V,out addOil,out flange,out Slender,out Putters);
|
||||
//PTO
|
||||
MIS_BASE.WritePLC(115, OpName, PTO);
|
||||
//空挡开关检测
|
||||
MIS_BASE.WritePLC(95, OpName, NgearSwitch);
|
||||
//倒挡开关检测
|
||||
MIS_BASE.WritePLC(96, OpName, RgearSwitch);
|
||||
//里程表检测
|
||||
MIS_BASE.WritePLC(97, OpName, SpeedSensor);
|
||||
//大机型扩展
|
||||
MIS_BASE.WritePLC(98, OpName, PartTypeMid);
|
||||
//TCU
|
||||
MIS_BASE.WritePLC(122, OpName, Tcu_V);
|
||||
//注油量
|
||||
MIS_BASE.WritePLC(123, OpName, addOil);
|
||||
// 法兰编号
|
||||
if(OpName == "J07ET010") MIS_BASE.WritePLC(124, OpName, flange);
|
||||
|
||||
// 写入是否存在PKB
|
||||
bool isExistPKB = BaseDataSystemMES.Get_IsExistPKB(EngineType);
|
||||
MIS_BASE.WritePLC(64, OpName, isExistPKB);
|
||||
|
||||
//细一轴
|
||||
MIS_BASE.WritePLC(17, OpName, Slender);
|
||||
|
||||
//分泵推杆
|
||||
MIS_BASE.WritePLC(35, OpName, Putters);
|
||||
|
||||
string tagStartAdr;//= "DB411.10";
|
||||
|
||||
// 先查询配方号 根据工位号 去moby表查配方号
|
||||
// 根据配方号 去配方表查配方数据
|
||||
// 写入配方数据
|
||||
BaseDataSystemMES.PLCRcipeCurrent(OpName, out byte[] bytes, out tagStartAdr);
|
||||
MIS_BASE.Write_TagValueByTagTypeID(94, OpName, System.Text.Encoding.ASCII.GetString(bytes));
|
||||
////将产品信息写入PLC
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, EngineTypeID);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, EngineType);
|
||||
MIS_BASE.Write_EngineID_MES(OpName, EngineID);
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
|
||||
//写入到数据库的[北汽福田工位状态监控MOBY]表中
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID_MES, EngineTypeID.ToString());
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType_MES, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm_MES, OrderForm);
|
||||
|
||||
|
||||
// 工位号],[订单号],[产品型号代码],[变速器序列号],[发动机型号],[机型基本代码],[变速器总成号] ,[托盘号]
|
||||
// [产品型号代码_MES],[变速器序列号_MES],[发动机型号_MES]
|
||||
// [机床上电],[循环开始],[机床故障],[上料无件],[下料堵塞],[工件到位]
|
||||
// [传递机型],[申请上件],[允许保存],[保存完成],[合格标志],[前序合格]
|
||||
// [工号],[班次],[是否返修件],[合格放行],[不合格放行],[扫描条码]
|
||||
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, "产品型号代码_MES", EngineTypeID.ToString());
|
||||
//BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, "发动机型号_MES", EngineType);
|
||||
|
||||
// 获取左置右置 只有测试线传
|
||||
if(OpName == "J07ET010")
|
||||
{
|
||||
int LeftRightData = 0;
|
||||
DataTable LeftRightDt = BaseDataSystemMES.Get_IsExistLeftRight(EngineType);
|
||||
LeftRightData = Convert.ToInt32(LeftRightDt.Rows[0]["type"]);
|
||||
MIS_BASE.WritePLC(114, OpName, LeftRightData);
|
||||
}
|
||||
|
||||
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
|
||||
//Thread.Sleep(5000);
|
||||
//MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
|
||||
//等待PLC将数据写入RFID;写入PLC的DB块,通知MES验证RFID机型数据是否正确传递
|
||||
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "扫码成功,请开始工作!");
|
||||
BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 2);
|
||||
//通知web显示
|
||||
SendMessage.ShowMoby(OpName);
|
||||
//SendMessageFun.SendMessage("1235", "1111", OpName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("EngineIDRepeat", "partSn", OpName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "变速器序列号格式不正确,请确认!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
}
|
||||
else//验证物料
|
||||
{
|
||||
//物料号
|
||||
{
|
||||
//读取PLC的传递机型信号
|
||||
bool tagValue;
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out tagValue);
|
||||
if (tagValue)
|
||||
{
|
||||
//验证物料
|
||||
BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out bool IsSuccess);
|
||||
if (!IsSuccess)//????
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
}
|
||||
//判断物料是否验证完成
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out int IsAllowWork);
|
||||
|
||||
if (IsSuccess)
|
||||
{
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//移到允许保存信号中
|
||||
//BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
////更新订单完工数量及物料
|
||||
SendMessageFun.SendMessage("24", "11", OpName);
|
||||
|
||||
//物料验证完成,通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//SendMessageFun.AsyncSendMessage_Notice(OpName, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "产品上线后,PLC获得变速器序列号后,再验证物料!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(4, e, "Fun1051", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:Barcode");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);//工作完成
|
||||
SendMessageFun.SendInfomation("OrderFormList","1", OpName);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
//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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
bool MesRead = false;
|
||||
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_MES;//工件编号
|
||||
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
|
||||
MIS_BASE.Read_QualityData_Read_CF(OpName, out MesRead);
|
||||
//第一步,判断允许保存和保存完成信号是否全部被清空,若未清空,则通知复位MES&PLC
|
||||
if (MesRead)
|
||||
{
|
||||
//未能清空信号,请求复位
|
||||
SendMessageFun.SendInfomation("AskReset", "1", OpName);
|
||||
return;
|
||||
}
|
||||
string OrderForm;
|
||||
string OrderForm_MES;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
MIS_BASE.GetEngineTypeFromPLC_MES(OpName, out EngineTypeID_MES, out EngineType_MES, out EngineID_MES, out OrderForm_MES);
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (EngineTypeID_MES == EngineTypeID & EngineID_MES == EngineID & EngineType_MES == EngineType & OrderForm_MES == OrderForm)
|
||||
{
|
||||
DataTable dt = BaseDataSystemMES.EngineTypeChange(OpName, EngineID);
|
||||
// 提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
|
||||
//写入到数据库的[北汽福田工位状态监控MOBY]表中
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineTypeID, EngineTypeID.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, EngineType);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, EngineID);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.OrderForm, OrderForm);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.PartPallet_Code, PartPallet_Code.ToString());
|
||||
|
||||
// 判断是否返修件 是否需要继续工作
|
||||
DataTable backWorkDt = BaseDataSystemMES.Get_IsBackWork(OpName, EngineID);
|
||||
if (backWorkDt.Rows[0]["result"].ToString() == "1")
|
||||
{
|
||||
// 写返修点并且退出方法
|
||||
MIS_BASE.WritePLC(33, OpName, true);
|
||||
string message = "MES|ShowTipBox|" + OpName + "|该工件为返工工件!";
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
return;
|
||||
}
|
||||
//判断该订单数据是否已经工作过,有的话则在WEB跳出弹窗选择 并同时禁止工作
|
||||
DataTable dt2 = BaseDataSystemMES.EngineIsTwoWork(OpName, OrderForm, EngineID);
|
||||
if (dt2.Rows[0]["result"].ToString() == "1") //已完成s
|
||||
{
|
||||
//不允许工作
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
//通知WEB校验重新工作还是跳过 点重新工作给允许工作,点跳过给工作完成
|
||||
string message = "MES|Engine_Is_TwoWork|" + OpName + "|1";
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
//正常传递机型流程
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
}
|
||||
|
||||
//EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "码块RFID机型与MES机型不匹配!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(2, e, "Fun1051", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 返修放行
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void FalseGO(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);//工作完成
|
||||
SendMessageFun.SendInfomation("OrderFormList", "1", OpName);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// MES与PLC心跳监听
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void HeartBeatMES(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//返写在MES心跳中
|
||||
//MIS_BASE.WritePLC(15, OpName, tagValue);
|
||||
|
||||
if(tagValue == 1)
|
||||
{
|
||||
//DataTable tempDt;
|
||||
//BaseDataSystemMES.Get_TempData(OpName, "登陆状态", out tempDt);
|
||||
//if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, OpName, tempDt.Rows[0]["数值"]);
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
int HeartBeatPLC;
|
||||
//读取PLC心跳数据
|
||||
HeartBeatPLC = Convert.ToInt32(MIS_BASE.ReadPLC(14, OpName));
|
||||
//通知WEB修改状态
|
||||
string message = "MES|HeartBeatPLC|" + OpName + "|" + HeartBeatPLC.ToString();
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockMesRead = new object ();
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
lock(lockMesRead)
|
||||
{
|
||||
try
|
||||
{
|
||||
int EngineTypeID;
|
||||
string EngineType;
|
||||
string EngineID;
|
||||
int PartPallet_Code;
|
||||
string OrderForm;
|
||||
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
//保存数据到线首表 先保存到 北汽福田变速器序列号总线上线 用于之前判断是否重号
|
||||
if (Db.UpLoadOpNameInsert(EngineID, EngineTypeID, EngineType, OpName))
|
||||
{
|
||||
// 保存质量数据
|
||||
int qualityMask = MisDataSaveDateMesRead.Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
// 推送质量数据到MES的页面
|
||||
MIS_BASE.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
|
||||
if (OpName == "J07MA005")
|
||||
{
|
||||
// 计数+1
|
||||
BaseDataSystemMES.newAddOrderCount(OpName, EngineID, OrderForm, 0);
|
||||
SendMessageFun.SendInfomation("FlushOverWorkList", "1", OpName);
|
||||
}
|
||||
|
||||
// 保存物料数据
|
||||
BaseDataSystemMES.Material_Insert(OpName, tagValue);
|
||||
// 测量数据发动机在线状态
|
||||
BaseDataSystemMES.WorkStartInsert(OpName, qualityMask);
|
||||
SendMessage.SendActuallyCount(OpName, tagValue);//统计在线产量,在线节拍
|
||||
|
||||
//通知设备,MES的质量数据(和物料数据)保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
// MES工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "保存上线数据失败!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(3, e, "Fun1051", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//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);
|
||||
//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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using bizFacade;
|
||||
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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if(tagValue == 1 ) {
|
||||
// 直接发送实时的 质量数据
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线(针对上线工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//上线工位清MES传递机型信号
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(1, e, "Fun1060", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,461 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
using System.Threading;
|
||||
using MisDataSaveDate;
|
||||
using System.Collections;
|
||||
using System.Data;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.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();
|
||||
}
|
||||
DoWhatPlc.CustomeEvetnArgs _e = new DoWhatPlc.CustomeEvetnArgs();
|
||||
_e.OpName = OpName;
|
||||
_e.TagValue = m_Value;
|
||||
|
||||
//根据请求的命令处理逻辑
|
||||
switch (m_Command)
|
||||
{
|
||||
case "Barcode":
|
||||
if (m_Value_length > 1) return;
|
||||
fun_Barcode(_e);
|
||||
break;
|
||||
case "ConfirmOkGo"://合格放行
|
||||
//修改托盘状态
|
||||
|
||||
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 "OnLineState"://在线0、离线1、屏蔽2
|
||||
try
|
||||
{
|
||||
if (m_Value_length > 1) return;
|
||||
int a = Convert.ToInt32(m_Value);
|
||||
if (a <= 2)
|
||||
{
|
||||
BaseDataSystemMES.IsOnLine_Update(OpName, m_Value.ToString());
|
||||
MIS_BASE.Write_OnLineState(OpName, Convert.ToInt32(m_Value));
|
||||
|
||||
if (a == 2) SendMessage.AsyncSendMessage_Notice(OpName, "屏蔽MES!");
|
||||
if (a == 0) SendMessage.AsyncSendMessage_Notice(OpName, "启用MES!");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case "NullWorkGo"://空托盘放行 0不放行 1放行
|
||||
try
|
||||
{
|
||||
int a = Convert.ToInt32(m_Value);
|
||||
//修改地址值
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName, a);
|
||||
if (a == 1)
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "开启空托盘放行!");
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "关闭空托盘放行!");
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case "Reset"://复位,将MES所有的信息都复位了
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
|
||||
break;
|
||||
case "FixAllow"://重新拧紧
|
||||
break;
|
||||
case "IsAutoGetEngineID"://自动手动申请编号(线首)
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.Write_IsAutoGetEngineID(OpName, Convert.ToInt32(m_Value));
|
||||
break;
|
||||
case "PartPalletGoOver"://空托盘放行
|
||||
MIS_BASE.Write_RepairUpline_MES(opName_SubLine, true);
|
||||
//MIS_BASE.Write_PalletInfo(opName_SubLine, 4);
|
||||
//MIS_BASE.Write_UpdatePalletOK(opName_SubLine, true);
|
||||
MIS_BASE.Write_MaterialVerifyOver(opName_SubLine, true);
|
||||
break;
|
||||
case "SetMoby"://清空托盘(线首)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
break;
|
||||
case "RepairUplineMES"://返修上线
|
||||
MIS_BASE.Write_RepairUpline_MES(OpName, true);
|
||||
break;
|
||||
case "CancelRepair"://将返修件置为正常件
|
||||
|
||||
break;
|
||||
case "PartPalletCode"://申请写入托盘号
|
||||
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
|
||||
break;
|
||||
case "WritePartPalletCode"://写入托盘号
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.WritePLC(113, OpName, Convert.ToInt32(m_Value));
|
||||
Thread.Sleep(500);
|
||||
MIS_BASE.WritePLC(70, 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_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
break;
|
||||
//强制匹配
|
||||
case "ForceMatch":
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
ForceMatch(OpName);
|
||||
}
|
||||
break;
|
||||
case "PalletGO":
|
||||
|
||||
if (Convert.ToInt32(m_Value) == 1)
|
||||
{
|
||||
//直接给出工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(opName_SubLine, true);
|
||||
}
|
||||
break;
|
||||
case "ContinueMatch":
|
||||
BaseDataSystemMES.QualityVerifyStatus_Hash_Write(OpName, true);
|
||||
fun_EngineTypeGetOverPLC(_e);
|
||||
break;
|
||||
//初始化网页信号
|
||||
case "IniSingalToWeb":
|
||||
InitializeSingalToWeb(OpName);
|
||||
break;
|
||||
//将指定托盘号写入托盘中(上线工位独有)
|
||||
case "Write_WorkNumber":
|
||||
//将工件号地址写入
|
||||
break;
|
||||
case "twoWorkSkip"://重新工作工件跳过工作(重新工作工件)
|
||||
//工作完成
|
||||
EngineTypeGetOver_PLC_Work_Skip(OpName);
|
||||
break;
|
||||
case "twoWork"://重新工作工件重新工作(重新工作工件)
|
||||
//允许工作
|
||||
EngineTypeGetOver_PLC_Work_two(OpName);
|
||||
break;
|
||||
case "FaultBackWork"://返修工件
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(34, OpName, true);
|
||||
break;
|
||||
case "FaultBackWorkUnpack"://返修 拆解返工
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(24, OpName, 1);
|
||||
break;
|
||||
case "FaultBackWorkSelect"://返修 选择工位返工
|
||||
// 写入地址
|
||||
MIS_BASE.WritePLC(24, OpName, 2);
|
||||
break;
|
||||
//放行空托盘(上线工位独有)
|
||||
///case "Write_WorkNumber":
|
||||
//将工件号地址写入
|
||||
// Convert.ToBoolean(m_Value)
|
||||
// break;
|
||||
case "closeWebWindow":// 前端窗口关闭
|
||||
// 将持久化存储表中工位的登陆状态设置为接受值
|
||||
BaseDataSystemMES.Set_TempData(OpName, "登陆状态", m_Value);
|
||||
MIS_BASE.WritePLC(54, OpName, false);
|
||||
break;
|
||||
case "SkipDiskBearing":// 跳过盘轴
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
Thread.Sleep(1000);
|
||||
MIS_BASE.WritePLC(32, OpName, false);
|
||||
break;
|
||||
case "QuitEngineTypeCheck":// 发送给服务器换型请求,等待服务器换型判断发送到页面端
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.EngineTypeChange(OpName, m_Value);
|
||||
//提示机型发生变化
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
string mesValue = Newtonsoft.Json.JsonConvert.SerializeObject(dt);//<DoWhatPlc.CustomeEvetnArgs>(recData);
|
||||
string message = "MES|MaterialList_Dif_Resources|" + OpName + "|" + mesValue;
|
||||
SendMessage.AsyncSendMessage(message);
|
||||
// 写入MOBY 写入机型信息与清空总成号
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType, mesValue);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID, "");
|
||||
//通知web显示
|
||||
SendMessageFun.SendMessage("5", "1", OpName);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:WebSubmit");
|
||||
}
|
||||
}
|
||||
|
||||
private void SetMoby(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//清空Moby时,需要将MES信号清空
|
||||
MIS_BASE.Write_ClearMesMoby(OpName);
|
||||
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||||
|
||||
SendMessageFun.SendMessage("5123", "1111", OpName);
|
||||
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 网页重现登录,恢复关闭前的页面状态
|
||||
/// </summary>
|
||||
/// <param name="Opname">工位号</param>
|
||||
private void InitializeSingalToWeb(string Opname)
|
||||
{
|
||||
bool S_WorkStart;//工件到位 DBX0.1
|
||||
bool S_EngineGetOver;//传递机型 DBX0.4
|
||||
bool S_FixAllow;//允许工作 DBX3.1
|
||||
bool S_MaterialVerifyOver;//工作完成 DBX2.3
|
||||
bool S_WorkOn; //申请上线
|
||||
string S_mesEmptyGo; // 空托盘放行
|
||||
|
||||
int IsCompleted = 0;
|
||||
int S_Match = 0;
|
||||
int PalletInfo_SubLine = 0;//显示分线托盘状态
|
||||
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
|
||||
DataTable tempDt;
|
||||
BaseDataSystemMES.Get_TempData(Opname , "登陆状态", out tempDt);
|
||||
if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, Opname, tempDt.Rows[0]["数值"]);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(Opname);
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(Opname);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(Opname);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(Opname);
|
||||
InitAlarm(Opname);
|
||||
// 新增查询MES 空托盘放行信号
|
||||
MIS_BASE.Read_TagTypeID(6, Opname, out S_mesEmptyGo);
|
||||
|
||||
// 查询螺丝号是否存在 存在则发送给前端
|
||||
string CodeNumber;
|
||||
MIS_BASE.Read_TagTypeID(125, Opname, out CodeNumber);
|
||||
if(CodeNumber != "0")
|
||||
{
|
||||
SendMessageFun.SendInfomation("CodeNumber", CodeNumber,Opname);
|
||||
}
|
||||
|
||||
// 查询螺丝号下拧紧排序是否存在 存在则发送给前端
|
||||
string CodeNumberWorkNumber;
|
||||
MIS_BASE.Read_TagTypeID(126, Opname, out CodeNumberWorkNumber);
|
||||
if (CodeNumberWorkNumber != "0")
|
||||
{
|
||||
SendMessageFun.SendInfomation("CodeNumberWorkNumber", CodeNumberWorkNumber,Opname);
|
||||
}
|
||||
|
||||
string S_plcStatus;//DBX501.5 PLC直通,1 强制放行 0 正常循环
|
||||
// 新增查询PLC直通状态 网页显示
|
||||
MIS_BASE.Read_TagTypeID(63, Opname, out S_plcStatus);
|
||||
if (Convert.ToInt32(S_plcStatus) == 0)
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("PlcStatus", "1", Opname);
|
||||
}
|
||||
if (S_mesEmptyGo.ToLower() == "false")
|
||||
{
|
||||
SendMessageFun.SendInfomation("emptyTrayGo", "0", Opname);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.SendInfomation("emptyTrayGo", "1", Opname);
|
||||
}
|
||||
|
||||
if (S_WorkStart == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("WorkStart", Convert.ToString(Convert.ToInt32(S_WorkStart)), Opname);
|
||||
//sendmessage(Opname, Convert.ToInt32(S_WorkStart), "WorkStart_Subline");
|
||||
}
|
||||
|
||||
//sendmessage(Opname, Convert.ToInt32(S_WorkStart), "EngineTypeGetOverMES_Subline");
|
||||
|
||||
MIS_BASE.Read_EngineGetOver_PLC(Opname, out S_EngineGetOver);
|
||||
if (S_EngineGetOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("EngineTypeGetOverPLC", Convert.ToString(Convert.ToInt32(S_EngineGetOver)), Opname);
|
||||
//sendmessage(Opname, Convert.ToInt32(S_EngineGetOver), "EngineTypeGetOverMES_Subline");
|
||||
}
|
||||
|
||||
MIS_BASE.Read_FixAllow(Opname, out S_FixAllow);
|
||||
|
||||
if (S_FixAllow == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("FixAllow", Convert.ToString(Convert.ToInt32(S_FixAllow)), Opname);
|
||||
}
|
||||
|
||||
MIS_BASE.Read_MaterialVerifyOver(Opname, out S_MaterialVerifyOver);
|
||||
|
||||
if (S_MaterialVerifyOver == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("MaterialVerifyOver", Convert.ToString(Convert.ToInt32(S_MaterialVerifyOver)), Opname);
|
||||
}
|
||||
|
||||
MIS_BASE.Read_PartLoad(Opname, out S_WorkOn);
|
||||
|
||||
if (S_WorkOn == true)
|
||||
{
|
||||
SendMessageFun.SendInfomation("WorkOn", Convert.ToString(Convert.ToInt32(S_WorkOn)), Opname);
|
||||
}
|
||||
|
||||
//MIS_BASE.Read_MatchingCompleted(Opname, out IsCompleted); //DBX1.3 是否匹配
|
||||
//MIS_BASE.Read_Match(Opname, out S_Match); //DBX1.4 匹配结果
|
||||
|
||||
//if (IsCompleted == 1 && S_Match == 1)//发送匹配完成和匹配结果信息
|
||||
//{
|
||||
// SendMessageFun.SendInfomation("MatchingCompleted", "1", Opname);
|
||||
// SendMessageFun.SendInfomation("Match", "1", Opname);
|
||||
// SendMessageFun.SendInfomation("MatchSuccess", "1", Opname);//界面显示匹配成功
|
||||
//}
|
||||
//else if (IsCompleted == 1 && S_Match == 0)
|
||||
//{
|
||||
// SendMessageFun.SendInfomation("MatchSuccess", "0", Opname);//界面显示匹配失败
|
||||
//}
|
||||
|
||||
//if (MIS_BASE.hashtable_OpNameRepair == null)
|
||||
//{
|
||||
// MIS_BASE.InitHashtable_MesServerCode();
|
||||
//}
|
||||
//string Opname_SubLine = "";
|
||||
//if (MIS_BASE.hashtable_OpNameRepair.ContainsKey(Opname))
|
||||
//{
|
||||
// Opname_SubLine = MIS_BASE.hashtable_OpNameRepair[Opname].ToString();
|
||||
//}
|
||||
//if (Opname_SubLine == "")
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
|
||||
//MIS_BASE.Read_PalletInfo(Opname, out PalletInfo_SubLine);
|
||||
//sendmessage(Opname, PalletInfo_SubLine, "SubQualityMask");
|
||||
//SendMessageFun.SendInfomation("ShowMobySubLine", Opname_SubLine, Opname);//显示分线机型及流水号
|
||||
}
|
||||
|
||||
//分线发送工件到位信号函数
|
||||
private void sendmessage(string OpName, int tagValue, string Command)
|
||||
{
|
||||
string SendMessage;
|
||||
SendMessage = "MES|" + Command + "|" + OpName + "|" + tagValue;
|
||||
SendMessageFun.AsyncSendMessage(SendMessage);
|
||||
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using bizFacade;
|
||||
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
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
//using SystemFramework;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 工件到位与离开时,清空MES自身信号
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void WorkStart(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//线首显示订单信息
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
MIS_BASE.Write_TagTypeID(115, OpName, 0);
|
||||
MIS_BASE.Write_TagTypeID(95, OpName, 0);
|
||||
MIS_BASE.Write_TagTypeID(96, OpName, 0);
|
||||
MIS_BASE.Write_TagTypeID(97, OpName, 0);
|
||||
MIS_BASE.Write_TagTypeID(98, OpName, "");
|
||||
MIS_BASE.WritePLC(123, OpName, 0);
|
||||
//清空MOBY的产品流水号
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStart, tagValue.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartOut, DateTime.Now.ToString());
|
||||
MIS_BASE.Write_MesReadOver(OpName, false);
|
||||
MIS_BASE.Write_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
//清除上线信息
|
||||
MIS_BASE.Write_EngineTypeID_MES(OpName, 0);
|
||||
MIS_BASE.Write_EngineType_MES(OpName, "");
|
||||
MIS_BASE.Write_EngineID_MES(OpName, "");
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, "");
|
||||
MIS_BASE.WritePLC(115, OpName, "0");
|
||||
//空挡开关检测
|
||||
MIS_BASE.WritePLC(95, OpName, "0");
|
||||
//倒挡开关检测
|
||||
MIS_BASE.WritePLC(96, OpName, "0");
|
||||
//里程表检测
|
||||
MIS_BASE.WritePLC(97, OpName, "0");
|
||||
//大机型扩展
|
||||
MIS_BASE.WritePLC(98, OpName, "");
|
||||
//TCU
|
||||
MIS_BASE.WritePLC(122, OpName, "0");
|
||||
//注油量
|
||||
MIS_BASE.WritePLC(123, OpName, "0");
|
||||
// 法兰编号
|
||||
if (OpName == "J07ET010") MIS_BASE.WritePLC(124, OpName, "0");
|
||||
|
||||
BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 2);
|
||||
|
||||
// 是否返修点
|
||||
MIS_BASE.WritePLC(33, OpName, false);
|
||||
MIS_BASE.WritePLC(34, OpName, false);
|
||||
|
||||
// 工件离开清除 左右置
|
||||
MIS_BASE.WritePLC(114, OpName, 0);
|
||||
}
|
||||
}
|
||||
catch(Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:WorkStart");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user