|
|
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.EngineeringDebuggingMode.ElectronicMachinery;
|
|
|
using Mesnac.Action.ChemicalWeighing.EngineeringDebuggingMode.ValveStateControl;
|
|
|
using Mesnac.Action.ChemicalWeighing.Entity;
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMetageFormula;
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMixFormula;
|
|
|
using Mesnac.Action.ChemicalWeighing.LjMixManager;
|
|
|
using Mesnac.Action.ChemicalWeighing.LjPlanning;
|
|
|
using Mesnac.Action.ChemicalWeighing.LjProdcutLine;
|
|
|
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;
|
|
|
|
|
|
|
|
|
ValveStateControl Form = new ValveStateControl();
|
|
|
Form.Show();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//ParametersWithPc.B1.FirstWord 256 768
|
|
|
|
|
|
//badc1el26587193265870
|
|
|
|
|
|
|
|
|
var s= BasePlcHelper.Instance.dryerA_dos0_eqNo.LastValue.ToInt();
|
|
|
|
|
|
var read = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.dryerA_dos0_eqNo, out int[] sq);
|
|
|
|
|
|
var ss= BasePlcHelper.Instance.dryerA_dos0_eqNo.LastValue.ToInt();
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
|
|
|
|
//192.168.153.100
|
|
|
// var firstWordNowValue = BasePlcHelper.Instance.test;
|
|
|
// var a = BasePlcHelper.Instance.tst0;
|
|
|
// var b = BasePlcHelper.Instance.tst1;
|
|
|
// var bs = BasePlcHelper.Instance.tst2;
|
|
|
|
|
|
|
|
|
// var bo = BasePlcHelper.Instance.PlcRead("ParametersWithPc", "3", 2, 2, out short[] f);
|
|
|
// var a2 = Mesnac.Basic.DataProcessor.Swap(f[0]); //注意:西门子PLC需要高低位转换
|
|
|
//
|
|
|
// bo = BasePlcHelper.Instance.PlcRead("ParametersWithPc", "3", 0, 1, out short[] aaaaa);
|
|
|
// var aa = Mesnac.Basic.DataProcessor.Swap(aaaaa[0]); //注意:西门子PLC需要高低位转换
|
|
|
// var qq = Convert.ToBoolean(aa);
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
// var aa = Mesnac.Basic.DataProcessor.Swap(aaaaa[0]); //注意:西门子PLC需要高低位转换
|
|
|
//
|
|
|
// var bytesa = BitConverter.GetBytes(aa);
|
|
|
//
|
|
|
// bool[] bitsa = new bool[8];
|
|
|
//
|
|
|
// for (int i = 0; i < 8; i++)
|
|
|
// {
|
|
|
// bitsa[i] = (bytesa[0] & (1 << i)) != 0;
|
|
|
// }
|
|
|
|
|
|
|
|
|
// var plcReadds = BasePlcHelper.Instance.PlcRead("ParametersWithPc", "3", 1, 1, out short[] bbbb);
|
|
|
// var bSwap = Mesnac.Basic.DataProcessor.Swap(bbbb[0]); //注意:西门子PLC需要高低位转换
|
|
|
//
|
|
|
// var bytesa = BitConverter.GetBytes(bSwap);
|
|
|
//
|
|
|
// bool[] bits = new bool[8];
|
|
|
//
|
|
|
// for (int i = 0; i <8; i++)
|
|
|
// {
|
|
|
// bits[i] = (bytesa[0] & (1 << i)) != 0;
|
|
|
//
|
|
|
// }
|
|
|
// bool[] bits2 = new bool[8];
|
|
|
//
|
|
|
// for (int i = 0; i <8; i++)
|
|
|
// {
|
|
|
// bits2[i] = (bytesa[1] & (1 << i)) != 0;
|
|
|
//
|
|
|
// }
|
|
|
//
|
|
|
// var ss = "asdf";
|
|
|
//
|
|
|
// short test = ssss[0];
|
|
|
// var bytes = BitConverter.GetBytes(test);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// DataKeyValue dataKeyRecipePause = new DataKeyValue("RecipePause");
|
|
|
//
|
|
|
|
|
|
// var swap = DataProcessor.Swap(ghPcSave3ThActs[0]);
|
|
|
// DataProcessor.ParseBinaryValue()
|
|
|
// 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("小料Action1事件测试", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|