You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Mesnac.Action.Feeding.BasicInfo;
|
|
|
|
|
|
|
|
|
|
namespace Mesnac.Action.Feeding.FinishBatch
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 重置存盘信号,把地址位(1)置为0..地址位从0开始
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class ResetFinishedBatch
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 执行存盘信号复位
|
|
|
|
|
/// </summary>
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|