feat: 增加LG/TCS-AGV接口并完善物料校验与Function逻辑
This commit is contained in:
@@ -18,13 +18,15 @@ namespace MesServerFunctions
|
||||
/// <param name="tagValue"></param>
|
||||
private void EngineTypeGetOver_PLC(object e)
|
||||
{
|
||||
lock(lockBarcodeEngineTypeGetOver)
|
||||
string opName = "";
|
||||
lock (lockBarcodeEngineTypeGetOver)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
opName = OpName;
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
@@ -61,7 +63,7 @@ namespace MesServerFunctions
|
||||
MIS_BASE.GetEngineTypeFromPLC_MES(OpName, out EngineTypeID_MES, out EngineType_MES, out EngineID_MES, out OrderForm_MES);
|
||||
|
||||
// 读取MES区数据 校验MES区数据是否符合 同时判断是否此工件已工作过,若已工作过则弹出弹窗提示
|
||||
if (EngineTypeID == EngineTypeID_MES & EngineID == EngineID_MES & EngineType == EngineType_MES & OrderForm == OrderForm_MES)
|
||||
if (EngineTypeID == EngineTypeID_MES & EngineID == EngineID_MES & EngineType == EngineType_MES & OrderForm == OrderForm_MES)
|
||||
{
|
||||
if (EngineTypeID == 0 || EngineID == "" || EngineType == "" || OrderForm == "")
|
||||
{
|
||||
@@ -71,12 +73,12 @@ namespace MesServerFunctions
|
||||
return;
|
||||
}
|
||||
|
||||
DataTable checkTable = MisDataFun.WorkOrderCheck(OpName,EngineID_MES,OrderForm_MES,EngineType_MES);
|
||||
DataTable checkTable = MisDataFun.WorkOrderCheck(OpName, EngineID_MES, OrderForm_MES, EngineType_MES);
|
||||
int result = Convert.ToInt32(checkTable.Rows[0]["result"]);
|
||||
string resultMsg = checkTable.Rows[0]["msg"].ToString();
|
||||
if (result != 2)
|
||||
{
|
||||
|
||||
|
||||
if (result == 3)
|
||||
{
|
||||
string msg = "【" + OpName + "】" + resultMsg;
|
||||
@@ -123,13 +125,16 @@ namespace MesServerFunctions
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:EngineTypeGetOver_PLC");
|
||||
string logOpName = string.IsNullOrWhiteSpace(opName) ? "Function1051_EngineGetOver" : opName;
|
||||
string logText = $"EngineTypeGetOver异常:异常={err.Message}";
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(logOpName, logText, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
MyLog4Net.MyLogHelper.Error("Function1051_EngineGetOver", $"{logText}{Environment.NewLine}{err}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,33 @@ namespace MesServerFunctions
|
||||
//判断PLC机型与MES机型是否一致
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int EngineTypeID;//机型代码
|
||||
int PartPallet_Code;//托盘编号
|
||||
string EngineType;//机型
|
||||
string EngineID;//工件编号
|
||||
string OrderForm;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
int EngineTypeID = 0;//机型代码
|
||||
int PartPallet_Code = 0;//托盘编号
|
||||
string EngineType = "";//机型
|
||||
string OrderForm = "";
|
||||
MIS_BASE.Read_EngineID(OpName, out string PLCEngineID);
|
||||
MIS_BASE.Read_EngineID_MES(OpName, out string MESEngineID);
|
||||
string EngineID = string.IsNullOrEmpty(PLCEngineID) ? MESEngineID : PLCEngineID;
|
||||
|
||||
if (string.IsNullOrEmpty(EngineID))
|
||||
{
|
||||
string msg = $"【{OpName}】PLC与MES产品编号点位均为空,继续按空产品信息保存物料扫码记录!";
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "MaterialsVerify " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
}
|
||||
else
|
||||
{
|
||||
DataTable planDt = MisDataFun.XD_GetPlanInfoByEngineID(EngineID);
|
||||
if (planDt.Rows.Count > 0)
|
||||
{
|
||||
OrderForm = planDt.Rows[0]["订单号"].ToString();
|
||||
EngineType = planDt.Rows[0]["产品型号"].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = $"【{OpName}】产品:{EngineID} 未在生产计划_派工订单_执行计划中查询到记录,继续保存物料扫码记录!";
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(OpName, "MaterialsVerify " + msg, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
int MaterialsTypeCode = Convert.ToInt32(MIS_BASE.ReadPLC(201, OpName));
|
||||
string MaterialsCode = MIS_BASE.ReadPLC(40, OpName).ToString();
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
object lockMesRead = new object ();
|
||||
object lockMesRead = new object();
|
||||
/// <summary>
|
||||
/// 保存完成(针对半自动和手动压装工位)
|
||||
/// </summary>
|
||||
@@ -16,6 +16,9 @@ namespace MesServerFunctions
|
||||
/// <param name="tagValue"></param>
|
||||
private void MesRead(object e)
|
||||
{
|
||||
string opName = "";
|
||||
string engineID = "";
|
||||
string orderForm = "";
|
||||
try
|
||||
{
|
||||
int EngineTypeID;
|
||||
@@ -32,12 +35,15 @@ namespace MesServerFunctions
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
opName = OpName;
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
int qualityMask;
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID,out PartPallet_Code, out OrderForm);
|
||||
MIS_BASE.GetEngineTypeFromPLC(OpName, out EngineTypeID, out EngineType, out EngineID, out PartPallet_Code, out OrderForm);
|
||||
engineID = EngineID;
|
||||
orderForm = OrderForm;
|
||||
|
||||
//保存数据到线首表 先保存到 北汽福田变速器序列号总线上线 用于之前判断是否重号
|
||||
// 保存质量数据
|
||||
@@ -49,9 +55,12 @@ namespace MesServerFunctions
|
||||
// 保存过站信息
|
||||
MisDataFun.WorkStartInsert(OpName, qualityMask);
|
||||
|
||||
// 存追溯表数据 同时质量数据存入 接口表
|
||||
//保存质量数据到 接口表
|
||||
MisDataFun.SaveQualityInterfaceData(OpName, EngineID);
|
||||
|
||||
// 调用工位完工
|
||||
MisDataFun.WorkOrderOpWorkOver(OpName, EngineID, OrderForm);
|
||||
|
||||
|
||||
// 推送质量数据到MES的页面
|
||||
SendMessageFun.SendInfomation("ShowTimelyQuality", "1&" + qualityMask.ToString(), OpName);
|
||||
|
||||
@@ -76,7 +85,10 @@ namespace MesServerFunctions
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
////ApplicationLog.WriteLog(err, "Function08:MesReadOver");
|
||||
string logOpName = string.IsNullOrWhiteSpace(opName) ? "Function1051_MesRead" : opName;
|
||||
string logText = $"MesRead异常:订单号={orderForm}, 工件编号={engineID}, 异常={err.Message}";
|
||||
MisDataSaveDate.Helper.ApiLogHelper.SaveMesLog(logOpName, logText, MisDataSaveDate.Helper.MesLogType.ERROR);
|
||||
MyLog4Net.MyLogHelper.Error("Function1051_MesRead", $"{logText}{Environment.NewLine}{err}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user