192 lines
7.5 KiB
C#
192 lines
7.5 KiB
C#
using System;
|
||
using System.Data;
|
||
using bizFacade;
|
||
using MesServerWork;
|
||
|
||
namespace MesServerFunctions
|
||
{
|
||
partial class Functions_BASE_26
|
||
{
|
||
/// <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)
|
||
{
|
||
int IsrepairBarcode = 0;//拆解返修标志
|
||
int RepairPartStatusPLC = 0;
|
||
int MES_QualityMask = 1;
|
||
|
||
string OrderForm = "";//订单号
|
||
string repairBarcode = "";//拆解返修条码
|
||
DataTable dt;
|
||
//OP050
|
||
|
||
int PartPalletCode;
|
||
// 1 读取机型等信息,保存到监控表
|
||
|
||
//DtWebApi.ReadWritePLC.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPalletCode);
|
||
|
||
|
||
|
||
BaseDataSystemMES.GetEngineID_Select(OpName, EngineID, out dt);//查询订单信息
|
||
|
||
if (dt != null&&dt.Rows.Count > 0)
|
||
{
|
||
OrderForm = Convert.ToString(dt.Rows[0]["订单号"]);
|
||
IsrepairBarcode = Convert.ToInt32(dt.Rows[0]["拆解标志"]);
|
||
repairBarcode = Convert.ToString(dt.Rows[0]["拆解返修条码"]);
|
||
}
|
||
|
||
BaseDataSystemMES.OpName_MIS_MOBY_Insert(OpName, OrderForm, EngineTypeID, EngineType, EngineID, PartPallet_Code, 0, IsrepairBarcode, repairBarcode);
|
||
SaveMobyMessage(OpName, EngineTypeID, EngineType, EngineID, OrderForm);
|
||
Sendmessage("5", "1", OpName);
|
||
SendInfomation("QualityMask", Convert.ToString(MES_QualityMask), OpName);
|
||
SendInfomation("RepairPartStatusPLC", Convert.ToString(RepairPartStatusPLC), OpName);
|
||
BaseDataSystemMES.MesServer_Process_EngineTypeOver(OpName);
|
||
Sendmessage("123", "111", OpName);//向前台发送显示操作指南、物料、图片的命令
|
||
|
||
BaseDataSystemMES.MaterialPush_EngineIDStatus_Insert(OpName);
|
||
//比对缓存库上线(OP0050)
|
||
MathEngineTypePartLoad(OpName, EngineType);
|
||
}
|
||
/// <summary>
|
||
/// 比对缓存库上线(OP0050)
|
||
/// </summary>
|
||
/// <param name="OpName"></param>
|
||
public void MathEngineTypePartLoad(string OpName,string engineType)
|
||
{
|
||
//获得 盆子码(发动机号)、小车号、机型代码、机型
|
||
try
|
||
{
|
||
//int engineTypeID;
|
||
//string engineID;
|
||
//string engineType;
|
||
string PartCode_engineType;
|
||
byte kuweiNum;
|
||
//if (tagValue == "1")
|
||
{
|
||
|
||
string[] PartCodeList = new string[6];
|
||
PartCodeList[0] = DtWebApi.ReadWritePLC.ReadPLC("2001", OpName).ToString();
|
||
PartCodeList[1] = DtWebApi.ReadWritePLC.ReadPLC("2002", OpName).ToString();
|
||
PartCodeList[2] = DtWebApi.ReadWritePLC.ReadPLC("2003", OpName).ToString();
|
||
PartCodeList[3] = DtWebApi.ReadWritePLC.ReadPLC("2004", OpName).ToString();
|
||
PartCodeList[4] = DtWebApi.ReadWritePLC.ReadPLC("2005", OpName).ToString();
|
||
PartCodeList[5] = DtWebApi.ReadWritePLC.ReadPLC("2006", OpName).ToString();
|
||
int codeID = 2007;//2007 2008 2009 2010 2011 2012
|
||
bool IsMath = false;
|
||
for (int i = 0; i < PartCodeList.Length; i++)
|
||
{
|
||
codeID = codeID + i;
|
||
//处理字符串 测量数据发动机在线状态_下线工位_是否存在_查询
|
||
PartCode_engineType = GetEngineTypeByEngineID(PartCodeList[i], OpName);
|
||
|
||
if (PartCode_engineType == engineType)
|
||
{
|
||
DtWebApi.ReadWritePLC.WritePLC(codeID.ToString(), OpName, 1);
|
||
IsMath = true;
|
||
}
|
||
else
|
||
{
|
||
DtWebApi.ReadWritePLC.WritePLC(codeID.ToString(), OpName, 2);
|
||
}
|
||
|
||
}
|
||
if (IsMath)
|
||
{
|
||
DtWebApi.ReadWritePLC.WritePLC("2014", OpName, 1);
|
||
|
||
}
|
||
else
|
||
{
|
||
DtWebApi.ReadWritePLC.WritePLC("2014", OpName, 2);
|
||
|
||
}
|
||
}
|
||
}
|
||
catch (Exception err)
|
||
{
|
||
////ApplicationLog.WriteLog(err, "Function03:PartLoad");
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 测量数据发动机在线状态_下线工位_是否存在_查询
|
||
/// </summary>
|
||
/// <param name="PartCode"></param>
|
||
/// <returns></returns>
|
||
private static string GetEngineTypeByEngineID(string engineID, string opName)
|
||
{
|
||
string engineType = "";
|
||
DataTable dt;
|
||
BaseDataSystemMES.GetEngineTypeByEngineID(engineID, opName, out dt);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
engineType = dt.Rows[0]["机型"].ToString();
|
||
}
|
||
return engineType;
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 保存MOBY信息
|
||
/// </summary>
|
||
/// <param name="OpName"></param>
|
||
/// <param name="engineTypeID"></param>
|
||
/// <param name="engineType"></param>
|
||
/// <param name="engineID"></param>
|
||
private void SaveMobyMessage(string OpName, int engineTypeID, string engineType, string engineID, string orderForm)
|
||
{
|
||
if(MIS_BASE.hashtable_EngineGetOver_EngineTypeID==null)
|
||
{
|
||
MIS_BASE.InitHashtable_MesServerCode();
|
||
}
|
||
if (MIS_BASE.hashtable_EngineGetOver_EngineTypeID.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_EngineGetOver_EngineTypeID[OpName] = engineTypeID;
|
||
}
|
||
if (MIS_BASE.hashtable_EngineGetOver_EngineType.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_EngineGetOver_EngineType[OpName] = engineType;
|
||
}
|
||
if (MIS_BASE.hashtable_EngineGetOver_EngineID.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_EngineGetOver_EngineID[OpName] = engineID;
|
||
}
|
||
if (MIS_BASE.hashtable_EngineGetOver_OrderForm.ContainsKey(OpName))
|
||
{
|
||
MIS_BASE.hashtable_EngineGetOver_OrderForm[OpName] = orderForm;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 返修件需要工作
|
||
/// </summary>
|
||
/// <param name="OpName">工位号</param>
|
||
private void IsNeedRepaire_OK(string OpName)
|
||
{
|
||
|
||
int isRepair;
|
||
int engineTypeID;
|
||
|
||
string engineType = "";
|
||
string engineID = "";
|
||
string palletCode = "";
|
||
string orderForm = "";
|
||
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));
|
||
}
|
||
|
||
}
|
||
}
|