chore: initial commit
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user