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.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs

84 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.Core;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Basic;
using Mesnac.Controls.Base;
using Mesnac.Controls.Default;
namespace Mesnac.Action.ChemicalWeighing.Test
{
public class TestAction : DatabaseAction, IAction
{
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
//ParametersWithPc.B1.FirstWord 256 768
// var firstWordNowValue = BasePlcHelper.Instance.FirstWord.NowValue.ToInt();
// var plcRead = BasePlcHelper.Instance.PlcRead("ParametersWithPc", "1165", 0, 1, out short[] ssss);
//
// short test = ssss[0];
// var bytes = BitConverter.GetBytes(test);
// DataKeyValue dataKeyRecipePause = new DataKeyValue("RecipePause");
//
// bool Save3thActs = BasePlcHelper.Instance.PlcRead(dataKeyRecipePause, out int[] ghPcSave3ThActs);
// var swap = DataProcessor.Swap(ghPcSave3ThActs[0]);
// var recipePause = BasePlcHelper.Instance.RecipePause.NowValue.ToInt();
//ParametersWithPc.B1.RecipePause
// 768 怎么调佣函数 怎么通过代码去写入
//或者调用控件
//Mesnac.Basic.DataProcessor.ToSiemen sInt32();
var i = BasePlcHelper.Instance.Spare4.NowValue.ToInt();
bool Spare4 = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.Spare4, out int[] spare4s);
//256 default-bit(11
DbMCControl binGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "MCLabel153").FirstOrDefault();
var comboBox1 = base.GetControlById("MCButton1") as System.Windows.Forms.Button;
var comboBox1s = base.GetControlById("MCButton1") as Mesnac.Controls.Default.Button;
// List<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
// IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
// var firstWordNowValue = BasePlcHelper.Instance.FirstWord.NowValue.ToInt();
//
// BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.FirstWord, new object[] {1});
//
// var plcHelp = BasePlcHelper.Instance;
ShowMsg("小料Action事件测试", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}