using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mesnac.Action.Feeding.BasicInfo;
namespace Mesnac.Action.Feeding.FinishBatch
{
///
/// 重置存盘信号,把地址位(1)置为0..地址位从0开始
///
public class ResetFinishedBatch
{
///
/// 执行存盘信号复位
///
public static void ExecReset()
{
try
{
int readword = 0;
if (int.TryParse(PlcData.Instance.FinishedBatch.EquipData.LastBeforeMathValue.FirstOrDefault().ToString(), out readword))
{
readword = readword & (0xFFFF - 2);
if (PlcData.Instance.PlcWriteByDataKey(PlcData.Instance.FinishedBatch, new object[] { readword }))
{
ICSharpCode.Core.LoggingService.Debug("重置存盘信号成功!");
}
else
{
ICSharpCode.Core.LoggingService.Error("重置存盘信号失败:写入PLC失败!");
}
}
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService.Error("重置存盘信号失败:" + ex.Message, ex);
}
}
}
}