89 lines
3.2 KiB
C#
89 lines
3.2 KiB
C#
using System;
|
|
using bizFacade;
|
|
using MesServerWork;
|
|
using WebApiCall;
|
|
|
|
namespace MesServerFunctions
|
|
{
|
|
partial class FunctionMES
|
|
{
|
|
/// <summary>
|
|
/// 叫料
|
|
/// </summary>
|
|
/// <param name="OpName"></param>
|
|
/// <param name="tagValue"></param>
|
|
private void CallMaterials(object e)
|
|
{
|
|
try
|
|
{
|
|
DoWhatPlc.CustomeEvetnArgs msgEvent = (DoWhatPlc.CustomeEvetnArgs)e;
|
|
string OpName = Convert.ToString(msgEvent.OpName);
|
|
int tagValue = Convert.ToInt32(msgEvent.TagValue);
|
|
|
|
// 信号名称、库位1变量号、库位2变量号
|
|
// 请求叫料 1 206 2 211
|
|
// 请求退料 1 207 2 212
|
|
// 允许进入 1 208 2 213
|
|
// 退料类型 1 209 2 214
|
|
// 叫料类型 1 210 2 215
|
|
// 到料类型 1 202 2 205
|
|
// 请求进入 1 200 2 203
|
|
// AGV已离开1 201 2 204
|
|
|
|
int tagType = Convert.ToInt32(msgEvent.TagType);
|
|
|
|
if (tagValue == 1)
|
|
{
|
|
// 根据变量类型代码 获取 位置号 与 叫料类型
|
|
string positionName = "-1"; // 位置号
|
|
string engineType = "-1"; // 型号 1 3 吨
|
|
string type = "叫料"; // 操作类型 分 叫料 退料 退余料
|
|
|
|
// 206 库位1
|
|
if(tagType == 206)
|
|
{
|
|
positionName = "H1";
|
|
engineType = MIS_BASE.ReadPLC(210,OpName).ToString();
|
|
}
|
|
// 211 库位2
|
|
else if (tagType == 211)
|
|
{
|
|
positionName = "H2";
|
|
engineType = MIS_BASE.ReadPLC(215, OpName).ToString();
|
|
}
|
|
|
|
// 1.调用WebApi通知叫料
|
|
bool isOk = AGVWebApiCall.MES_To_AGV_CallGoods(positionName,engineType);
|
|
|
|
if (isOk)
|
|
{
|
|
// 2.叫料成功后 记录叫料日志
|
|
BaseDataSystemMES.Get_AGV_CallRecord(OpName, positionName, engineType, type);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (tagType == 206)
|
|
{
|
|
MIS_BASE.WritePLC(200,OpName,false); // AGV已离开
|
|
MIS_BASE.WritePLC(201, OpName, false); // 请求进入
|
|
MIS_BASE.WritePLC(202, OpName, false); // 叫料类型
|
|
}
|
|
// 211 库位2
|
|
else if (tagType == 211)
|
|
{
|
|
MIS_BASE.WritePLC(203, OpName, false); // AGV已离开
|
|
MIS_BASE.WritePLC(204, OpName, false); // 请求进入
|
|
MIS_BASE.WritePLC(205, OpName, false); // 叫料类型
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception err)
|
|
{
|
|
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
|
|
}
|
|
}
|
|
}
|
|
}
|