chore: 初始化北汽福田MES采集程序
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
//using System.Windows.Forms;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
///1.扫描配送单号,用于接收物料,扫描单号的时候,将接收的物料信息显示在“物料拉动”Tab区域
|
||||
///2.扫描料箱标签/看板卡,用于追溯物料批次信息
|
||||
///3.扫描零件条码,根据零件图号进行防错
|
||||
///第一步,判断条码类型,根据条码类型,执行对应的存储过程
|
||||
///第二步,条码类型(将扫描的条码保存到对应的表中)
|
||||
///第三步,扫描完成之后给出允许工作信号
|
||||
/// 处理页面扫描条码
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="barcode"></param>
|
||||
public void Barcode(object e)
|
||||
{
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
string barcode = Convert.ToString(msgEvent.TagValue);
|
||||
SendMessageFun.SendInfomation("BarCodeData", barcode, OpName); // 将扫码值发送给前端
|
||||
string AlarmStr = "";
|
||||
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
bool isShowBarNGTipBox;
|
||||
|
||||
int IsAllowWork;
|
||||
bool IsSuccess = false;
|
||||
|
||||
// 判断是否存在异常导致不允许工作 输出msg到前端
|
||||
DataTable OpNameIsWorkDt = BaseDataSystemMES.OpNameIsAllowWork(OpName);
|
||||
if (Convert.ToInt32(OpNameIsWorkDt.Rows[0]["提示类型"]) == 3)
|
||||
{
|
||||
SendMessageFun.SendInfomation("ShowTipBox", OpNameIsWorkDt.Rows[0]["提示文本"].ToString(), OpName);
|
||||
return;
|
||||
}
|
||||
|
||||
bool EngineGetOver_PLC_NextWorkStep;
|
||||
//传递机型是否到位
|
||||
MIS_BASE.Read_EngineGetOver_PLC(OpName, out EngineGetOver_PLC_NextWorkStep);
|
||||
if (!EngineGetOver_PLC_NextWorkStep)
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "PLC未传递机型");
|
||||
return;
|
||||
}
|
||||
//物料验证
|
||||
//BaseDataSystemMES.PartMaterial_DM_Update(OpName, barcode, out IsSuccess);
|
||||
//if (!IsSuccess)
|
||||
//{
|
||||
// SendMessageFun.AsyncSendMessage_Notice(OpName, "条码无效,请确认");
|
||||
// return;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// SendMessageFun.SendInfomation("MaterialList", "1", OpName);//通知界面更新零件信息
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
if (barcode.Split(';').Length > 2 || barcode.Split(';').Length > 2)
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.GetNowWorkOrderData(OpName, 0);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
if (Convert.ToInt32(dt.Rows[0]["线首是否完成工作"]) == 4)
|
||||
{
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单所有总成号已在MA110工作完毕,不允许继续工作,请联系班长进行修改完工状态!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
EngineType = dt.Rows[0]["零件号"].ToString();
|
||||
EngineID = dt.Rows[0]["变速箱总成号"].ToString();
|
||||
OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
MIS_BASE.WritePLC(32, OpName, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单已生产完毕或无选中的生产订单,请选择其他订单进行生产!");
|
||||
return;
|
||||
}
|
||||
// 将扫码结果计入总分线记录表中
|
||||
BaseDataSystemMES.BusPartLine_Add(EngineID, barcode, OpName, OrderForm, EngineType);
|
||||
SendMessageFun.SendInfomation("BindRecordRefresh", "1", OpName);
|
||||
|
||||
|
||||
MIS_BASE.Write_EngineID_MES(OpName, barcode); // 将壳体码作为总成号来工作,到时候保存也存这个
|
||||
MIS_BASE.Write_OrderForm_MES(OpName, OrderForm);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineType_MES, EngineType);
|
||||
//SendMessageFun.SendMessage("1235", "1111", OpName);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
//MIS_BASE.Write_FixAllow(OpName, true);
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "扫码完成!");
|
||||
BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "此条码非前壳码,请确认!");
|
||||
isShowBarNGTipBox = BaseDataSystemMES.Check_BarCodeNGTemp(OpName, 1);
|
||||
if (isShowBarNGTipBox) SendMessageFun.SendInfomation("ShowTipBox", "多次扫描条码失败,请检查扫码位置是否正确!", OpName);
|
||||
}
|
||||
|
||||
|
||||
//获取是否允许工作
|
||||
BaseDataSystemMES.MesServer_Judge_IsCanWork(OpName, out IsAllowWork);
|
||||
|
||||
//此处逻辑有问题 需要考虑到批次扫描 提示PLC未传递机型的情况
|
||||
if (IsAllowWork == 1)
|
||||
{
|
||||
//BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
//更新订单完工数量及物料
|
||||
SendMessageFun.SendMessage("24", "11", OpName);
|
||||
|
||||
//工作完成
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
//if (!BaseDataSystemMES.QualityVerifyStatusOutline(OpName, out AlarmStr))
|
||||
//{
|
||||
// SendInfomation("LineoutAlert", AlarmStr, OpName);
|
||||
// return;
|
||||
//}
|
||||
//通知PLC允许工作,允许工作在保存完成时清空
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageFun.AsyncSendMessage_Notice(OpName, "请扫描物料!");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(4, e, "Fun1060", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:Barcode");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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 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)
|
||||
{
|
||||
|
||||
//BaseDataSystemMES.Material_Insert(OpName, 1);
|
||||
|
||||
////更新订单完工数量及物料
|
||||
//Sendmessage("24", "11", OpName);
|
||||
|
||||
////工作完成
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
//using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using bizFacade;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// PLC传递机型处理
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
|
||||
{
|
||||
try
|
||||
{
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
string OrderForm_MES;
|
||||
|
||||
int EngineTypeID_MES;//机型代码
|
||||
string EngineType_MES;//机型
|
||||
string EngineID_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;
|
||||
}
|
||||
|
||||
// 测试的时候用的 plc读取订单号有问题
|
||||
// OrderForm = BaseDataSystemMES.GetOrderDataBySn(EngineID);
|
||||
|
||||
if (EngineTypeID_MES == EngineTypeID & EngineID_MES == EngineID & EngineType_MES == EngineType)
|
||||
{
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.EngineTypeChange(OpName, EngineType);
|
||||
//提示机型发生变化
|
||||
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);
|
||||
}
|
||||
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());
|
||||
|
||||
//显示当前订单信息
|
||||
SendMessage.ShowMoby(OpName);
|
||||
|
||||
EngineTypeGetOver_PLC_Work(OpName, EngineTypeID, EngineType, EngineID, PartPallet_Code, OrderForm);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "PLC机型与MES机型不匹配!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(2, e, "Fun1060", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:EngineTypeGetOver_PLC");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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 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)
|
||||
{
|
||||
//总合格标志2(不合格)
|
||||
|
||||
//BaseDataSystemMES.Material_Insert_NG(OpName, 2);
|
||||
|
||||
//Sendmessage("24", "11", OpName);
|
||||
|
||||
////工作完成
|
||||
//MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
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
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using MisDataSaveDateMesRead;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Concurrent;
|
||||
using DoWhatPlc;
|
||||
//using SystemFramework;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许保存(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
{
|
||||
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);
|
||||
|
||||
// 如果是PA060 工位在允许保存的时候来找待生产数据 进行判断 若有就直接存往下走逻辑
|
||||
//if (OpName == "J07PA060")
|
||||
//{
|
||||
// DataTable dt;
|
||||
// dt = BaseDataSystemMES.GetNowWorkOrderData(OpName, 0);
|
||||
// if (dt.Rows.Count > 0)
|
||||
// {
|
||||
// EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
// EngineType = dt.Rows[0]["零件号"].ToString();
|
||||
// EngineID = dt.Rows[0]["变速箱总成号"].ToString();
|
||||
// OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
// MIS_BASE.WritePLC(32, OpName, false);
|
||||
|
||||
// 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);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// MIS_BASE.WritePLC(32, OpName, true);
|
||||
// SendMessage.AsyncSendMessage_Notice(OpName, "该订单已生产完毕或无选中的生产订单,请选择其他订单进行生产!");
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
//保存数据到线首表 先保存到 北汽福田变速器序列号总线上线 用于之前判断是否重号
|
||||
if (Db.UpLoadOpNameInsert(EngineID, EngineTypeID, EngineType, OpName))
|
||||
{
|
||||
int qualityMask = 1;
|
||||
//保存质量数据
|
||||
qualityMask = Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
//if (OpName == "J07PA060")
|
||||
//{
|
||||
// DataTable dt_WWW;
|
||||
// Hashtable valueList;
|
||||
// //读取工位全部数据
|
||||
// var rtList = MIS_BASE.ReadPLC_OpName(OpName); //GetDbAndMaxLengthByOpNameByBytes(opName);
|
||||
// var pp = JsonConvert.SerializeObject(rtList);
|
||||
// var tagValues = JsonConvert.DeserializeObject<ConcurrentDictionary<string, TagFormat>>(pp);
|
||||
// //过滤出来质量数据 //获得带合格标志的质量数据
|
||||
// valueList = Funtion.ReadPLC_OpName_Qd(tagValues);
|
||||
// List<List<string>> screwUpStrList = new List<List<string>>();
|
||||
// //获得带基本信息的质量数据表
|
||||
// Funtion.GetQualityDataTable(valueList, OpName, MIS_BASE.BasicDataTagValue,
|
||||
// MIS_BASE.BasicDataTagValueUpDown, out dt_WWW, screwUpStrList);
|
||||
// string tagID = msgEvent.TagID.ToString();
|
||||
// int id_tagCF;
|
||||
// Funtion.BaseData_tagTable_QualityData_B5A_IndexInsert(EngineID, tagID, EngineType, EngineTypeID, OpName, qualityMask, "0", out id_tagCF);
|
||||
// Funtion.BaseData_tagTable_QualityData_B5A_Insert(id_tagCF, EngineTypeID, EngineID, OpName, dt_WWW);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// qualityMask = Funtion.MesRead(OpName, tagValue.ToString(), msgEvent.TagID.ToString());
|
||||
//}
|
||||
//保存物料数据
|
||||
BaseDataSystemMES.Material_Insert(OpName, qualityMask);
|
||||
//测量数据发动机在线状态
|
||||
BaseDataSystemMES.WorkStartInsert(OpName, qualityMask);
|
||||
//推送质量数据到MES的页面
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
//统计在线产量,在线节拍
|
||||
SendMessage.SendActuallyCount(OpName, tagValue);
|
||||
|
||||
// 根据AMT 与 MT 来判断计数编号是哪个
|
||||
// 6.该订单计数加一
|
||||
// 计数 从总分线对应表中读取出条码来进行计数
|
||||
//string MainLineEngine = EngineID;
|
||||
|
||||
|
||||
//if (EngineTypeID == 1 || EngineTypeID == 4)
|
||||
//{
|
||||
// DataTable dt = BaseDataSystemMES.newSelectWorkOrder(OpName, EngineID);
|
||||
// MainLineEngine = dt.Rows[0]["主线总成号"].ToString();
|
||||
//}
|
||||
// 6.该订单计数加一
|
||||
int CountNumber = Convert.ToInt32(MIS_BASE.ReadPLC(38, OpName));
|
||||
// pa050 = 3 表示两个都需要存
|
||||
if (CountNumber == 2)
|
||||
{
|
||||
//BaseDataSystemMES.newAddOrderCount(OpName, MainLineEngine, OrderForm, 0);
|
||||
//BaseDataSystemMES.newAddOrderCount(OpName, MainLineEngine, OrderForm, 1);
|
||||
BaseDataSystemMES.newAddOrderCount(OpName, EngineID, OrderForm, 0);
|
||||
BaseDataSystemMES.newAddOrderCount(OpName, EngineID, OrderForm, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//BaseDataSystemMES.newAddOrderCount(OpName, MainLineEngine, OrderForm, CountNumber);
|
||||
BaseDataSystemMES.newAddOrderCount(OpName, EngineID, OrderForm, CountNumber);
|
||||
}
|
||||
|
||||
SendMessageFun.SendInfomation("FlushOverWorkList", "1", OpName);
|
||||
|
||||
//通知设备,MES的质量数据(和物料数据)保存完成
|
||||
MIS_BASE.Write_MesReadOver(OpName, true);
|
||||
//MES工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
|
||||
SendMessageFun.SendMessage("1235", "1111", OpName);
|
||||
}
|
||||
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, "Fun1060", err);
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
//using SystemFramework;
|
||||
using MesServerWork;
|
||||
using bizFacade;
|
||||
|
||||
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");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
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>
|
||||
/// 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,174 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 申请上线 43
|
||||
/// </summary>
|
||||
/// <param name="OpName"></param>
|
||||
/// <param name="tagValue"></param>
|
||||
private void PartLoad(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
|
||||
string OrderForm;
|
||||
|
||||
int PLCRcipe;
|
||||
|
||||
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue > 0)
|
||||
{
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.WorkStartIn, DateTime.Now.ToString());
|
||||
|
||||
int CountNumber = Convert.ToInt32(MIS_BASE.ReadPLC(38, OpName));
|
||||
DataTable isOutLineWorkDt;
|
||||
BaseDataSystemMES.Get_TempData(OpName, "非本线工作订单", out isOutLineWorkDt);
|
||||
if (isOutLineWorkDt.Rows.Count > 0)
|
||||
{
|
||||
// 判断是否值等于1 等于1 则直接给日期总成号 反之从生产订单中获取
|
||||
if(isOutLineWorkDt.Rows[0]["数值"].ToString() == "1")
|
||||
{
|
||||
System.DateTime currentTime = new System.DateTime();
|
||||
currentTime = System.DateTime.Now;
|
||||
EngineTypeID = 2;
|
||||
EngineType = "1384 033 002";
|
||||
EngineID = currentTime.ToString("g").Replace("/","").Replace(" ", "-").Replace(":", "");
|
||||
OrderForm = currentTime.ToString("g").Replace("/", "").Replace(" ", "-").Replace(":", "");
|
||||
MIS_BASE.WritePLC(32, OpName, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.GetNowWorkOrderData(OpName, CountNumber);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
if (Convert.ToInt32(dt.Rows[0]["线首是否完成工作"]) == 4)
|
||||
{
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单所有总成号已在MA110工作完毕,不允许继续工作,请联系班长进行修改完工状态!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
EngineType = dt.Rows[0]["零件号"].ToString();
|
||||
EngineID = dt.Rows[0]["变速箱总成号"].ToString();
|
||||
OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
MIS_BASE.WritePLC(32, OpName, false);
|
||||
|
||||
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);
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
// MES传递机型
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单已生产完毕或无选中的生产订单,请选择其他订单进行生产!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DataTable dt;
|
||||
dt = BaseDataSystemMES.GetNowWorkOrderData(OpName, 0);
|
||||
if (dt.Rows.Count > 0)
|
||||
{
|
||||
if (Convert.ToInt32(dt.Rows[0]["线首是否完成工作"]) == 4)
|
||||
{
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单所有总成号已在MA110工作完毕,不允许继续工作,请联系班长进行修改完工状态!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]);
|
||||
EngineType = dt.Rows[0]["零件号"].ToString();
|
||||
EngineID = dt.Rows[0]["变速箱总成号"].ToString();
|
||||
OrderForm = dt.Rows[0]["订单号"].ToString();
|
||||
MIS_BASE.WritePLC(32, OpName, false);
|
||||
|
||||
// 获取左置右置 35 (DBX 11.2)
|
||||
DataTable LeftRightDt = BaseDataSystemMES.GetNowWorkLeftRight(EngineType);
|
||||
if(Convert.ToInt32(LeftRightDt.Rows[0]["result"]) == 1)
|
||||
{
|
||||
MIS_BASE.WritePLC(35, OpName, true);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
// MES传递机型
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.WritePLC(32, OpName, true);
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, "该订单已生产完毕或无选中的生产订单,请选择其他订单进行生产!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 将产品信息写入PLC
|
||||
// 如果是 J07PA050 AMT 工件则直接不给传递机型了在扫码完成后传 反之继续传
|
||||
//if(!(OpName == "J07PA050" && (EngineTypeID == 1 || EngineTypeID == 4)))
|
||||
//{
|
||||
// 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);
|
||||
|
||||
// BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, MobyTagType.EngineID_MES, EngineID);
|
||||
// // MES传递机型
|
||||
// MIS_BASE.Write_EngineTypeGetOver_MES(OpName, true);
|
||||
//}
|
||||
}
|
||||
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_ConfirmOkGo(OpName, false);
|
||||
MIS_BASE.Write_EngineTypeGetOver_MES(OpName, false);
|
||||
MIS_BASE.WritePLC(35, OpName, false);
|
||||
//工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, false);
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
// 保存出错日志 1.申请上线 2.传递机型 3.允许保存 4.扫码
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(1, e, "Fun1060", err);
|
||||
////ApplicationLog.WriteLog(err, "Function02:FalseGO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
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[] 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;
|
||||
|
||||
//工件信息
|
||||
string engineID = "";
|
||||
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();
|
||||
}
|
||||
|
||||
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"://合格放行
|
||||
//删除不合格放行记录
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 1, false);
|
||||
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"://返修放行
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 3, false);
|
||||
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"://不合格放行
|
||||
//修改托盘状态
|
||||
//Update_PalletStatus(OpName, 2, false);
|
||||
//保存不合格信息(必须保存不合格放行信息,由于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 "Reset"://复位,将MES所有的信息都复位了
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
break;
|
||||
case "FixAllow"://重新拧紧
|
||||
MIS_BASE.Write_FixAllow(OpName, false);
|
||||
MIS_BASE.Write_FixAllow(OpName, true);
|
||||
break;
|
||||
case "IsAutoGetEngineID"://自动手动申请编号(线首)
|
||||
if (m_Value_length > 1) return;
|
||||
MIS_BASE.Write_IsAutoGetEngineID(OpName, Convert.ToInt32(m_Value));
|
||||
break;
|
||||
case "PartPalletGoOver"://空托盘放行
|
||||
int Is_PartPalletGoOver;
|
||||
MIS_BASE.Read_PartPalletGoOver(OpName, out Is_PartPalletGoOver);
|
||||
if (Is_PartPalletGoOver == 1)
|
||||
{
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MIS_BASE.Write_PartPalletGoOver(OpName,0);
|
||||
}
|
||||
break;
|
||||
case "SetMoby"://清空托盘(线首)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
//MIS_BASE.Write_PartPalletCode_PLC(OpName, 1);
|
||||
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.Write_PalletCode(OpName, Convert.ToInt32(m_Value));
|
||||
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_UpdatePalletOK(OpName, true);
|
||||
//直接给出工作完成
|
||||
MIS_BASE.Write_MaterialVerifyOver(OpName, true);
|
||||
}
|
||||
else
|
||||
{ }
|
||||
|
||||
break;
|
||||
case "ContinueMatch":
|
||||
BaseDataSystemMES.QualityVerifyStatus_Hash_Write(OpName, true);
|
||||
break;
|
||||
//初始化网页信号
|
||||
case "IniSingalToWeb":
|
||||
InitializeSingalToWeb(OpName);
|
||||
break;
|
||||
case "Reset_Engine"://返修上线(返修上线点)
|
||||
SetMoby(OpName);//将MES所有信号清空
|
||||
//fun_EngineTypeGetOverPLC(OpName, 0);
|
||||
//fun_EngineTypeGetOverPLC(OpName, 1);
|
||||
break;
|
||||
case "remedyWork"://补拧工件
|
||||
// 接受传来的补拧程序号 补拧数量 拆分
|
||||
string[] arr = m_Value.ToString().Split('&');
|
||||
string codeNumber = arr[0];
|
||||
string workCount = arr[1];
|
||||
// 写入地址 在工件离开后清空
|
||||
MIS_BASE.WritePLC(88, OpName, workCount);
|
||||
MIS_BASE.WritePLC(77, OpName, codeNumber);
|
||||
// 若这个点被置0了说明PLC那补拧结束了
|
||||
MIS_BASE.WritePLC(30, OpName, true);
|
||||
break;
|
||||
case "remedyWorkEnd"://补拧工件
|
||||
MIS_BASE.WritePLC(77, OpName, 0);
|
||||
MIS_BASE.WritePLC(88, OpName, 0);
|
||||
MIS_BASE.WritePLC(30, OpName, false);
|
||||
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, "Function02:WebSubmit");
|
||||
}
|
||||
}
|
||||
private void SetMoby(string OpName)
|
||||
{
|
||||
try
|
||||
{
|
||||
//清空Moby时,需要将MES信号清空
|
||||
MIS_BASE.Write_ClearMesMoby(OpName);
|
||||
|
||||
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||||
|
||||
Sendmessage("5123", "1111", OpName);
|
||||
|
||||
MIS_BASE.Write_ResetDevice(OpName, true);
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
MIS_BASE.Write_ResetDevice(OpName, false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/// 网页重现登录,恢复关闭前的页面状态
|
||||
/// </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
|
||||
|
||||
int IsCompleted = 0;
|
||||
int S_Match = 0;
|
||||
int PalletInfo_SubLine = 0;//显示分线托盘状态
|
||||
|
||||
MIS_BASE.Read_WorkStart(Opname, out S_WorkStart);
|
||||
|
||||
//5 显示订单、机型信息 线首工位用
|
||||
SendMessage.ShowMoby_FirstOpName(Opname);
|
||||
//3显示操作指导图片 PicShow_String_FirstOpName
|
||||
SendMessage.PicShow_FirstOpName(Opname);
|
||||
//1(直接在界面通过选择机型确认工序内容)
|
||||
SendMessage.ProcessList_FirstOpName(Opname);
|
||||
//界面显示物料信息
|
||||
SendMessage.MaterialList_FirstOpName(Opname);
|
||||
|
||||
InitAlarm(Opname);
|
||||
|
||||
DataTable tempDt;
|
||||
BaseDataSystemMES.Get_TempData(Opname, "登陆状态", out tempDt);
|
||||
if (tempDt.Rows.Count > 0) MIS_BASE.WritePLC(54, Opname, tempDt.Rows[0]["数值"]);
|
||||
|
||||
// 查询螺丝号是否存在 存在则发送给前端
|
||||
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_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_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 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,23 @@
|
||||
using bizFacade;
|
||||
using MesServerWork;
|
||||
using System;
|
||||
using System.Data;
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user