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

170 lines
6.1 KiB
C#

using System;
using System.Collections.Generic;
1 year ago
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.Action.ChemicalWeighing.LjMetageFormula;
1 year ago
using Mesnac.Action.ChemicalWeighing.LjMixFormula;
using Mesnac.Action.ChemicalWeighing.LjPlanning;
using Mesnac.Action.ChemicalWeighing.LjProdcutLine;
using Mesnac.Basic;
1 year ago
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); //必须调用
1 year ago
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);
}
1 year ago
// dbHelper.ClearParameter();
// dbHelper.CommandType = CommandType.Text;
// dbHelper.CommandText = sql;
FrmPlanning frmMetageFormula = new FrmPlanning();
frmMetageFormula.Show();
//ParametersWithPc.B1.FirstWord 256 768
//badc1el26587193265870
1 year ago
1 year ago
// 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);
1 year ago
//192.168.153.100
// var firstWordNowValue = BasePlcHelper.Instance.test;
// var a = BasePlcHelper.Instance.tst0;
// var b = BasePlcHelper.Instance.tst1;
// var bs = BasePlcHelper.Instance.tst2;
1 year ago
// 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);
1 year ago
//
//
//
//
// 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";
1 year ago
//
// short test = ssss[0];
// var bytes = BitConverter.GetBytes(test);
// DataKeyValue dataKeyRecipePause = new DataKeyValue("RecipePause");
//
1 year ago
// var swap = DataProcessor.Swap(ghPcSave3ThActs[0]);
// DataProcessor.ParseBinaryValue()
// var recipePause = BasePlcHelper.Instance.RecipePause.NowValue.ToInt();
//ParametersWithPc.B1.RecipePause
// 768 怎么调佣函数 怎么通过代码去写入
//或者调用控件
//Mesnac.Basic.DataProcessor.ToSiemen sInt32();
1 year ago
// var i = BasePlcHelper.Instance.Spare4.NowValue.ToInt();
// bool Spare4 = BasePlcHelper.Instance.PlcRead(BasePlcHelper.Instance.Spare4, out int[] spare4s);
//
//256 default-bit(11
1 year ago
// 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;
1 year ago
1 year ago
// ShowMsg("小料Action1事件测试", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}