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.

50 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using System.Text;
using System.Linq;
using System.Data;
using System.Threading;
using Mesnac.Action.Base;
using Mesnac.Controls.Base;
using System.Windows.Forms;
using Mesnac.Codd.Session;
using System.IO;
namespace Mesnac.Action.Feeding.ProducingPlan
{
/// <summary>
/// 终止称量
/// </summary>
public class StopWeight : FeedingPlcAction, IAction
{
private readonly string zhongzhichengliangxinhao = "终止称量信号";
public void Run(RuntimeParameter runtime)
{
base.LogDebug("终止称量...");
if (MessageBox.Show("确认终止称量吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
{
return;
}
DataSet ds_CurrentRecipe = base.CurrentRecipe();
string recipeName = ds_CurrentRecipe.Tables[0].Rows[0]["RecipeName"].ToString();
base.LogInfo("终止称量:" + recipeName);
object[] buff = null;
if (!base.ProcessRead(zhongzhichengliangxinhao, out buff))
{
MessageBox.Show("数据读取失败!");
return;
}
int readword = (int)buff[1];
readword = readword | 2;
if (base.ProcessWrite(zhongzhichengliangxinhao, new object[1] { readword }))
{
MessageBox.Show("写入终止称量失败!");
return;
}
MessageBox.Show("写入终止称量成功!");
}
}
}