|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
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.Codd.Session;
|
|
|
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); //必须调用
|
|
|
|
|
|
|
|
|
string sql = "insert into ActionCode values (13,'test','',1) select @@IDENTITY";
|
|
|
|
|
|
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
|
|
|
if (dbHelper == null)
|
|
|
{
|
|
|
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
|
|
|
}
|
|
|
dbHelper.ClearParameter();
|
|
|
dbHelper.CommandType = CommandType.Text;
|
|
|
dbHelper.CommandText = sql;
|
|
|
|
|
|
dbHelper.ExecuteNonQuery();
|
|
|
|
|
|
|
|
|
//ParametersWithPc.B1.FirstWord 256 768
|
|
|
|
|
|
//badc1el26587193265870
|
|
|
|
|
|
|
|
|
// var instanceDryer0Speed = BasePlcHelper.Instance.Dryer0_speed;
|
|
|
//
|
|
|
// var plcWriteFloatByDataKey = BasePlcHelper.Instance.PlcWriteFloatByDataKey(BasePlcHelper.Instance.Dryer0_speed, 14.55f);
|
|
|
//
|
|
|
// var instanceDryer0Speeds = BasePlcHelper.Instance.Dryer0_speed;
|
|
|
//
|
|
|
// var instanceRecipeName0 = BasePlcHelper.Instance.recipeName0;
|
|
|
//
|
|
|
// //badc1e 2
|
|
|
// var read = BasePlcHelper.Instance.PlcRead(instanceRecipeName0, out int[] ss);
|
|
|
|
|
|
|
|
|
// 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(1,1)
|
|
|
|
|
|
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|