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.
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using Mesnac.Action.Base;
|
|
using Mesnac.Action.ChemicalWeighing.LjMaterial;
|
|
using Mesnac.Action.ChemicalWeighing.LjMetage;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.LjElectrical
|
|
{
|
|
public class UpAction:ChemicalWeighingAction, IAction
|
|
{
|
|
|
|
private RuntimeParameter _runtime;
|
|
|
|
public static event EventHandler OnHandler;
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime); //必须调用
|
|
this._runtime = runtime;
|
|
DbMCControl materialGridControl =
|
|
this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "ElectricalSetting")
|
|
.FirstOrDefault(); //获取物料数据控件
|
|
|
|
|
|
DoWord();
|
|
|
|
}
|
|
|
|
|
|
public void DoWord()
|
|
{
|
|
var view = new ElectricalPlc().UpFromPlc();
|
|
foreach (var v in view)
|
|
{
|
|
string sql =
|
|
$"update ElectricalSetting set Speed={v.Speed} where Id={v.Id}";
|
|
DBHelp.ExecuteNonQuery(sql);
|
|
}
|
|
|
|
|
|
if (OnHandler != null)
|
|
{
|
|
OnHandler(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|
|
} |