@ -2,7 +2,12 @@
using System.Data ;
using System.Linq ;
using Mesnac.Action.Base ;
using Mesnac.Action.ChemicalWeighing.LjElectrical ;
using Mesnac.Action.ChemicalWeighing.LjMaterial ;
using Mesnac.Action.ChemicalWeighing.LjMetage ;
using Mesnac.Action.ChemicalWeighing.LjPressure ;
using Mesnac.Action.ChemicalWeighing.LjProportional ;
using Mesnac.Action.ChemicalWeighing.LjWeight ;
namespace Mesnac.Action.ChemicalWeighing.OliveEQSetting
{
@ -31,7 +36,7 @@ namespace Mesnac.Action.ChemicalWeighing.OliveEQSetting
UpActionProportional . Run ( runtime ) ;
UpActionWeight . Run ( runtime ) ;
LoadingHelper . CloseForm ( ) ;
}
private void InitEvent ( )
@ -140,11 +145,24 @@ namespace Mesnac.Action.ChemicalWeighing.OliveEQSetting
this . GetDbMCControlByKey ( Mesnac . Basic . DataSourceFactory . MCDbType . Local , "pressureSetting" )
. FirstOrDefault ( ) ; //获取物料数据控件
//table.Rows.Clear();
var pressureSettingViews = PressurePLC . UpdateFromPlc ( ) ;
foreach ( var v in pressureSettingViews )
{
string sql =
$"update PressureSetting set LowLimit={v.LowLimit},HighLimit={v.HighLimit} where Id={v.Id}" ;
DBHelp . ExecuteNonQuery ( sql ) ;
}
DataTable table =
DBHelp . GetTable ( @ "select Id,Name,ActualValue,LowLimit,HighLimit,Alarm,
DBHelp . GetTable ( @ "select Id,Name,ActualValue,LowLimit,HighLimit,Alarm,
case Alarm when 1 then ' 超 压 ' else ' 正 常 ' end as AlarmValue from pressureSetting ; ");
if ( materialGridControl ! = null & & materialGridControl . BaseControl ! = null )
{
@ -159,7 +177,17 @@ namespace Mesnac.Action.ChemicalWeighing.OliveEQSetting
DbMCControl materialGridControl =
this . GetDbMCControlByKey ( Mesnac . Basic . DataSourceFactory . MCDbType . Local , "ProportionalSetting" )
. FirstOrDefault ( ) ; //获取物料数据控件
var views = ProportionalPlc . UpFromPlc ( ) ;
foreach ( var v in views )
{
string sql =
$"update ProportionalSetting set SV={v.SV},PV={v.PV} where Id={v.Id}" ;
DBHelp . ExecuteNonQuery ( sql ) ;
}
DataTable table =
DBHelp . GetTable ( @"select Id, Name, PV, SV from ProportionalSetting" ) ;
@ -178,7 +206,16 @@ namespace Mesnac.Action.ChemicalWeighing.OliveEQSetting
DbMCControl materialGridControl =
this . GetDbMCControlByKey ( Mesnac . Basic . DataSourceFactory . MCDbType . Local , "WeightSetting" )
. FirstOrDefault ( ) ; //获取物料数据控件
var views = WeightSettingPlc . UpFromPlc ( ) ;
foreach ( var v in views )
{
string sql =
$"update WeightSetting set LowWeight={v.LowWeight},HighWeight={v.HighWeight} where Id={v.Id}" ;
DBHelp . ExecuteNonQuery ( sql ) ;
}
DataTable table =
DBHelp . GetTable ( @"select Id,Name,ActWeight,HighLevel,HighWeight,LowLevel,LowWeight from WeightSetting" ) ;
@ -195,7 +232,17 @@ namespace Mesnac.Action.ChemicalWeighing.OliveEQSetting
DbMCControl materialGridControl =
this . GetDbMCControlByKey ( Mesnac . Basic . DataSourceFactory . MCDbType . Local , "ElectricalSetting" )
. FirstOrDefault ( ) ; //获取物料数据控件
var view = ElectricalPlc . UpFromPlc ( ) ;
foreach ( var v in view )
{
string sql =
$"update ElectricalSetting set Speed={v.Speed} where Id={v.Id}" ;
DBHelp . ExecuteNonQuery ( sql ) ;
}
DataTable table =
DBHelp . GetTable ( @"select Id, Name, Speed from ElectricalSetting" ) ;
@ -212,7 +259,16 @@ namespace Mesnac.Action.ChemicalWeighing.OliveEQSetting
DbMCControl materialGridControl =
this . GetDbMCControlByKey ( Mesnac . Basic . DataSourceFactory . MCDbType . Local , "MetageSetting" )
. FirstOrDefault ( ) ; //获取物料数据控件
var view = MetagePlc . UpFromPlc ( ) ;
foreach ( var v in view )
{
string sql =
$"update MetageSetting set HighSpeed={v.HighSpeed},LowSpeed={v.LowSpeed},WeightSlow={v.WeightSlow},Precut={v.Precut},JogTime={v.JogTime} where Id={v.Id}" ;
DBHelp . ExecuteNonQuery ( sql ) ;
}
DataTable table =
DBHelp . GetTable ( @"select Id, Name, HighSpeed, LowSpeed, WeightSlow, Precut, JogTime from MetageSetting" ) ;