using System;
using bizFacade;
//using SystemFramework;
using MesServerWork;
using WebApiCall;
namespace MesServerFunctions
{
partial class FunctionMES
{
///
/// 请求退料
///
///
///
private void QuitMaterials(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 tagType = Convert.ToInt32(msgEvent.TagType);
// 根据变量类型代码 获取 位置号 与 叫料类型
string positionName; // 位置号
string engineType = "-1";
string quitType; // 1 退空托 2 退1T余料 3 退3T余料
string type = ""; // 操作类型 分 叫料 退料 退余料
// 206 库位1
if (tagType == 207)
{
positionName = "H1";
quitType = MIS_BASE.ReadPLC(209, OpName).ToString();
}
// 211 库位2 212
else
{
positionName = "H2";
quitType = MIS_BASE.ReadPLC(214, OpName).ToString();
}
if (quitType == "1")
{
type = "退空托";
}
if (quitType == "2")
{
type = "退余料";
engineType = "1";
}
if (quitType == "3")
{
type = "退余料";
engineType = "3";
}
// 1.调用WebApi通知退料
int returnType = 0; // 默认空托退料
if (quitType == "2" || quitType == "3") returnType = 1; // 余料退料
bool isOk = AGVWebApiCall.MES_To_AGV_ReturnGoods(positionName, engineType, returnType);
if (isOk)
{
// 2.叫料成功后 记录叫料日志
BaseDataSystemMES.Get_AGV_CallRecord(OpName, positionName, engineType, type);
}
}
}
catch (Exception err)
{
////ApplicationLog.WriteLog(err, "Function02:ConfirmOkGo");
}
}
}
}