chore: initial commit
This commit is contained in:
51
MisDataFunction/Function1054/OpcServer/AllowAGVEnter.cs
Normal file
51
MisDataFunction/Function1054/OpcServer/AllowAGVEnter.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许AGV进入
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void AllowAGVEnter(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
string msg;
|
||||
|
||||
// PLC允许AGV离开信号被置位后,应调用AGV允许进入接口
|
||||
MIS_BASE.Read_EngineID(OpName, out string EngineID);
|
||||
bool isOk = MisDataSaveDate.AGV_BusinessLogic.PassAgvInOut(OpName, EngineID, "apply");
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV进入成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV进入失败!请注意!";
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("AllowAGVLeave", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVEnter", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
55
MisDataFunction/Function1054/OpcServer/AllowAGVLeave.cs
Normal file
55
MisDataFunction/Function1054/OpcServer/AllowAGVLeave.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许AGV离开
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void AllowAGVLeave(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg = $"【{OpName}】允许AGV离开";
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
|
||||
// PLC允许AGV离开信号被置位后,应调用AGV允许离开接口
|
||||
MIS_BASE.Read_EngineID(OpName,out string EngineID);
|
||||
bool isOk = MisDataSaveDate.AGV_BusinessLogic.PassAgvInOut(OpName, EngineID, "release");
|
||||
|
||||
if (isOk) {
|
||||
msg = $"【{OpName}】允许AGV离开失败!请注意!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV离开成功!";
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("AllowAGVLeave", msg);
|
||||
|
||||
// 记录允许AGV离开状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVLeave", "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVLeave", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
MisDataFunction/Function1054/OpcServer/AllowAGVLower.cs
Normal file
51
MisDataFunction/Function1054/OpcServer/AllowAGVLower.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许AGV下降
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void AllowAGVLower(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
string msg;
|
||||
|
||||
// PLC允许AGV下降信号被置位后,应调用AGV允许下降接口
|
||||
MIS_BASE.Read_EngineID(OpName, out string EngineID);
|
||||
bool isOk = MisDataSaveDate.AGV_BusinessLogic.PassAgvInOut(OpName, EngineID, "lower");
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV下降成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV下降失败!请注意!";
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("AllowAGVLower", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVLower", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
51
MisDataFunction/Function1054/OpcServer/AllowAGVRaise.cs
Normal file
51
MisDataFunction/Function1054/OpcServer/AllowAGVRaise.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许AGV举升
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void AllowAGVRaise(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
if (tagValue == 1)
|
||||
{
|
||||
string msg;
|
||||
|
||||
// PLC允许AGV举升信号被置位后,应调用AGV允许举升接口
|
||||
MIS_BASE.Read_EngineID(OpName, out string EngineID);
|
||||
bool isOk = MisDataSaveDate.AGV_BusinessLogic.PassAgvInOut(OpName, EngineID, "raise");
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV举升成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】允许AGV举升失败!请注意!";
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("AllowAGVRaise", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "AllowAGVRaise", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
MisDataFunction/Function1054/OpcServer/CallMaterials.cs
Normal file
68
MisDataFunction/Function1054/OpcServer/CallMaterials.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Data;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求叫料
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void CallMaterials(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
if (tagValue == 1)
|
||||
{
|
||||
|
||||
// 记录叫料请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "CallMaterials", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "2");
|
||||
// 调用叫料接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序
|
||||
DataTable outType = MisDataFun.GetRequestReturnMaterials_Type(OpName, "2");
|
||||
string sendType = outType.Rows[0]["type"].ToString();
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, sendType);
|
||||
if (isOk)
|
||||
{
|
||||
// 发送消息通知
|
||||
msg = $"【{OpName}】请求叫料成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】请求叫料失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("CallMaterials", msg);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "CallMaterials", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
MisDataFunction/Function1054/OpcServer/LoadEmptyTray.cs
Normal file
63
MisDataFunction/Function1054/OpcServer/LoadEmptyTray.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 上空托盘操作
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void LoadEmptyTray(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录上空托盘请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "LoadEmptyTray", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "6");
|
||||
|
||||
// 调用上空托盘接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序,5下空,6上空,7点对点
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "6");
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】上空托盘操作成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】上空托盘操作失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("LoadEmptyTray", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "LoadEmptyTray", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
64
MisDataFunction/Function1054/OpcServer/PointToPoint.cs
Normal file
64
MisDataFunction/Function1054/OpcServer/PointToPoint.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 点对点操作
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void PointToPoint(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录点对点请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "PointToPoint", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "7");
|
||||
|
||||
// 调用点对点接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序,5下空,6上空,7点对点
|
||||
// 注意:终点位置暂时为空,等业务明确后再补充
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "7");
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】点对点操作成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】点对点操作失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("PointToPoint", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "PointToPoint", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
121
MisDataFunction/Function1054/OpcServer/RequestReturnMaterial.cs
Normal file
121
MisDataFunction/Function1054/OpcServer/RequestReturnMaterial.cs
Normal file
@@ -0,0 +1,121 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Data;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求退料
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void RequestReturnMaterial(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录退料请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "RequestReturnMaterial", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "3");
|
||||
|
||||
// 调用退料接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序
|
||||
DataTable outType = MisDataFun.GetRequestReturnMaterials_Type(OpName, "3");
|
||||
string sendType = outType.Rows[0]["type"].ToString();
|
||||
bool isOk;
|
||||
if (sendType == "4")
|
||||
{
|
||||
// 调用转序接口 走转序流程
|
||||
string EngineID = DateTime.Now.ToString("yyyyMMddHHmm");
|
||||
string EngineType = "NONE";
|
||||
DataTable nextDT = MisDataFun.Rrunning_GetNextStoreData(OpName, EngineID, EngineType);
|
||||
string targetStoreCode = nextDT.Rows[0]["目标库位号"].ToString();
|
||||
string targetProcessCode = nextDT.Rows[0]["目标工序号"].ToString();
|
||||
string targetProcess = nextDT.Rows[0]["目标工序"].ToString();
|
||||
|
||||
|
||||
// 1. 调用AGV转序接口
|
||||
var agvResult = CALL_Inerface_DataHandle.CALL_Inerface_MaterialTransfer(OpName, targetStoreCode);
|
||||
int agvCode = 500;
|
||||
int.TryParse(agvResult["code"]?.ToString() ?? "500", out agvCode);
|
||||
|
||||
if (agvCode != 200)
|
||||
{
|
||||
// AGV调度失败
|
||||
isOk = false;
|
||||
msg = $"【{OpName}】AGV调度失败:{agvResult["message"]?.ToString() ?? "未知错误"}";
|
||||
}
|
||||
else
|
||||
{
|
||||
// 2. AGV调度成功,执行转序存储过程
|
||||
var param = new System.Data.SqlClient.SqlParameter[] {
|
||||
new System.Data.SqlClient.SqlParameter("@库位号", OpName),
|
||||
new System.Data.SqlClient.SqlParameter("@产品编号", EngineID),
|
||||
new System.Data.SqlClient.SqlParameter("@产品型号", EngineType),
|
||||
new System.Data.SqlClient.SqlParameter("@目标库位号", targetStoreCode),
|
||||
new System.Data.SqlClient.SqlParameter("@目标工序", targetProcess),
|
||||
new System.Data.SqlClient.SqlParameter("@目标工序号", targetProcessCode)
|
||||
};
|
||||
|
||||
DataLinkMesWork2.DataAccess2.ExecuteStoredProcedure("XD_磨合_开始下一序", ref param, out string errMessage);
|
||||
|
||||
if (!string.IsNullOrEmpty(errMessage))
|
||||
{
|
||||
isOk = false;
|
||||
msg = $"【{OpName}】AGV调度成功,但XD_磨合_开始下一序存储过程执行失败:{errMessage}";
|
||||
}
|
||||
else
|
||||
{
|
||||
isOk = true;
|
||||
msg = $"【{OpName}】转序操作成功";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, sendType);
|
||||
|
||||
}
|
||||
if (isOk)
|
||||
{
|
||||
// 发送消息通知
|
||||
msg = $"【{OpName}】请求退料成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】请求退料失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("RequestReturnMaterial", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "RequestReturnMaterial", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位 器具放置完毕
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
MisDataFunction/Function1054/OpcServer/RequestReturns.cs
Normal file
68
MisDataFunction/Function1054/OpcServer/RequestReturns.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using System.Data;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求退空
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void RequestReturns(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录退空请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "RequestReturns", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "1");
|
||||
|
||||
// 调用退料接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序
|
||||
DataTable outType = MisDataFun.GetRequestReturnMaterials_Type(OpName, "1");
|
||||
string sendType = outType.Rows[0]["type"].ToString();
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, sendType);
|
||||
if (isOk)
|
||||
{
|
||||
// 发送消息通知
|
||||
msg = $"【{OpName}】请求退空托成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】请求退空托失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("RequestReturns", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "RequestReturns", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位 器具放置完毕
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 退回并重新配送
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void ReturnAndRedispatch(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
//DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
//string OpName = Convert.ToString(msgEvent.OpName);
|
||||
//int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
//if (tagValue == 1)
|
||||
//{
|
||||
// // 这个流程不太对 具体流程待二次确认
|
||||
// // 记录退回并重新配送状态
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "ReturnAndRedispatch", "1");
|
||||
|
||||
// // 当器具码校验不通过时,PLC会置位此信号
|
||||
// // 需要通知AGV退回当前器具并重新配送正确的物料
|
||||
// // 调用工厂叫料接口,类型为送料(3)
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "3");
|
||||
// CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "3");
|
||||
|
||||
// // 发送消息通知
|
||||
// string msg = $"【{OpName}】请求退回物料,退回并重新配送";
|
||||
// SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
// MyLog4Net.MyLogHelper.Info("ReturnAndRedispatch", msg);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "ReturnAndRedispatch", "0");
|
||||
// MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
// MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
// MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
// MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
// MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
//}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
102
MisDataFunction/Function1054/OpcServer/ToolCodeScanOver.cs
Normal file
102
MisDataFunction/Function1054/OpcServer/ToolCodeScanOver.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using MesServerWork;
|
||||
using WebApi;
|
||||
using MisDataSaveDate.MOM;
|
||||
using System.Linq;
|
||||
using MisDataFunDll;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 器具码扫描完毕
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void ToolCodeScanOver(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录器具码扫描完毕状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "ToolCodeScanOver", "1");
|
||||
|
||||
// 获取器具号(318)
|
||||
string containerNo = MIS_BASE.ReadPLC(318, OpName).ToString();
|
||||
|
||||
// 记录器具号
|
||||
if (!string.IsNullOrEmpty(containerNo))
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "器具号", containerNo);
|
||||
}
|
||||
|
||||
// 调用器具信息查询接口
|
||||
DeviceInfoResponse deviceInfoResult = CALL_Inerface_DataHandle.CALL_Inerface_DeviceInfoQuery(OpName, containerNo);
|
||||
|
||||
// 处理器具信息查询结果
|
||||
bool isValid = true;
|
||||
string validationMsg = "";
|
||||
|
||||
//if (deviceInfoResult != null && deviceInfoResult.code == 200 && deviceInfoResult.data != null)
|
||||
//{
|
||||
// isValid = true;
|
||||
|
||||
// if (deviceInfoResult.data.businessdata != null && deviceInfoResult.data.businessdata.Count > 0)
|
||||
// {
|
||||
// var firstMaterial = deviceInfoResult.data.businessdata.First();
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "物料编号", firstMaterial.sku);
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "批次号", firstMaterial.batchno);
|
||||
// MisDataFun.Location_MIS_MOBY_Insert(OpName, "数量", firstMaterial.qty);
|
||||
|
||||
// validationMsg = $"器具验证成功,物料编号:{firstMaterial.sku}";
|
||||
// }
|
||||
|
||||
// // 调用物料配送确认接口
|
||||
// CALL_Inerface_DataHandle.CALL_Inerface_MaterialConfirm(OpName, containerNo);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // 器具信息查询失败
|
||||
// isValid = false;
|
||||
// validationMsg = deviceInfoResult?.message ?? "器具信息查询失败";
|
||||
//}
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_MaterialConfirm(OpName, containerNo);
|
||||
|
||||
// 根据校验结果写入验证结果
|
||||
// 送料信息验证结果(305):1 合格 2 不合格
|
||||
MIS_BASE.WritePLC(305, OpName, isOk ? "1" : "2");
|
||||
|
||||
// 送料信息验证完成(304)
|
||||
MIS_BASE.WritePLC(304, OpName, true);
|
||||
|
||||
// 更新验证状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "送料验证结果", isOk ? "1" : "2");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "当前状态", validationMsg);
|
||||
|
||||
// 发送消息通知
|
||||
string msg = $"【{OpName}】器具码扫描完毕,器具号:{containerNo},{validationMsg} 验证结果{isOk.ToString()}";
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("ToolCodeScanOver", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 清除验证完成信号
|
||||
MIS_BASE.WritePLC(305, OpName, "0");
|
||||
MIS_BASE.WritePLC(304, OpName, false);
|
||||
|
||||
// 记录器具码扫描完毕状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "ToolCodeScanOver", "0");
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
MisDataFunction/Function1054/OpcServer/TransferSequence.cs
Normal file
63
MisDataFunction/Function1054/OpcServer/TransferSequence.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 转序操作
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void TransferSequence(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
//// 记录转序请求状态
|
||||
//MisDataFun.Location_MIS_MOBY_Insert(OpName, "TransferSequence", "1");
|
||||
//MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "4");
|
||||
|
||||
//// 调用转序接口
|
||||
//// deliveryType: 1退托盘,2叫料,3送料,4转序,5下空,6上空,7点对点
|
||||
//bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "4");
|
||||
//if (isOk)
|
||||
//{
|
||||
// msg = $"【{OpName}】转序操作成功";
|
||||
// MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// msg = $"【{OpName}】转序操作失败";
|
||||
// MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
//}
|
||||
|
||||
//SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
//MyLog4Net.MyLogHelper.Info("TransferSequence", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "TransferSequence", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位 器具放置完毕
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
MisDataFunction/Function1054/OpcServer/UnloadEmptyTray.cs
Normal file
63
MisDataFunction/Function1054/OpcServer/UnloadEmptyTray.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using MesServerWork;
|
||||
using MisDataFunDll;
|
||||
using System;
|
||||
using WebApi;
|
||||
|
||||
namespace MesServerFunctions
|
||||
{
|
||||
partial class FunctionMES
|
||||
{
|
||||
/// <summary>
|
||||
/// 下空托盘操作
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
private void UnloadEmptyTray(object e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DeviceDriver_BasicData.CustomeEvetnArgs msgEvent = (DeviceDriver_BasicData.CustomeEvetnArgs)e;
|
||||
string OpName = Convert.ToString(msgEvent.OpName);
|
||||
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
||||
string msg;
|
||||
|
||||
if (tagValue == 1)
|
||||
{
|
||||
// 记录下空托盘请求状态
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "UnloadEmptyTray", "1");
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "配送类型", "5");
|
||||
|
||||
// 调用下空托盘接口
|
||||
// deliveryType: 1退托盘,2叫料,3送料,4转序,5下空,6上空,7点对点
|
||||
bool isOk = CALL_Inerface_DataHandle.CALL_Inerface_CallMaterial(OpName, "5");
|
||||
if (isOk)
|
||||
{
|
||||
msg = $"【{OpName}】下空托盘操作成功";
|
||||
MIS_BASE.WritePLC(306, OpName, 1); // 任务状态反馈
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = $"【{OpName}】下空托盘操作失败";
|
||||
MIS_BASE.WritePLC(306, OpName, 2); // 任务状态反馈
|
||||
}
|
||||
|
||||
SendMessage.AsyncSendMessage_Notice(OpName, msg);
|
||||
MyLog4Net.MyLogHelper.Info("UnloadEmptyTray", msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
MisDataFun.Location_MIS_MOBY_Insert(OpName, "UnloadEmptyTray", "0");
|
||||
MIS_BASE.WritePLC(301, OpName, false); // 请求进入
|
||||
MIS_BASE.WritePLC(302, OpName, false); // 托盘到位
|
||||
MIS_BASE.WritePLC(303, OpName, false); // AGV已离开
|
||||
MIS_BASE.WritePLC(305, OpName, "0"); // 比对结果
|
||||
MIS_BASE.WritePLC(304, OpName, false); // 比对完成
|
||||
MIS_BASE.WritePLC(306, OpName, 0); // 任务状态反馈
|
||||
}
|
||||
}
|
||||
catch (Exception err)
|
||||
{
|
||||
MisDataSaveDate.FuntionMesRead.Alarm_SaveFileLog4Error(System.Reflection.MethodBase.GetCurrentMethod().Name, e, "Fun1054", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
MisDataFunction/Function1054/OpcServer/vssver2.scc
Normal file
BIN
MisDataFunction/Function1054/OpcServer/vssver2.scc
Normal file
Binary file not shown.
Reference in New Issue
Block a user