diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
index 6f64835..f7564ad 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
@@ -1279,9 +1279,12 @@ namespace Mesnac.Action.ChemicalWeighing
public DataKeyValue conveyV4_SV { get; set; }
public DataKeyValue purgeV4_PV { get; set; }
public DataKeyValue purgeV4_SV { get; set; }
+
+
public DataKeyValue conveyV5_SV { get; set; }
- public DataKeyValue purgeV5_PV { get; set; }
+ public DataKeyValue conveyV5_PV { get; set; }
public DataKeyValue purgeV5_SV { get; set; }
+ public DataKeyValue purgeV5_PV { get; set; }
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/DownAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/DownAction.cs
index f5596c7..db3f5a5 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/DownAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/DownAction.cs
@@ -28,8 +28,25 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
if (MessageBox.Show("确定下发到PLC?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) ==
DialogResult.OK)
{
+ LoadingHelper.ShowLoadingScreen();
+ var watchDog = LjHelp.WatchDog;
+ if (watchDog == 0)
+ {
+ LoadingHelper.CloseForm();
+ MessageBox.Show("PLC通讯失败");
+ return;
+ }
+
DoWord();
+ LoadingHelper.CloseForm();
+
+ if (OnHandler != null)
+ {
+ OnHandler(this._runtime.BaseControl.MCRoot, System.EventArgs.Empty);
+ }
+
}
+
}
@@ -51,6 +68,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
}
ProportionalPlc.DownToPlc(lsView);
+
}
}
}
\ No newline at end of file
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/FrmProportional.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/FrmProportional.cs
index 857983b..913ced0 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/FrmProportional.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/FrmProportional.cs
@@ -43,11 +43,31 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
return;
}
+ var watchDoy = LjHelp.WatchDog;
+ if (watchDoy == 0)
+ {
+ LoadingHelper.CloseForm();
+ MessageBox.Show("PLC通讯失败");
+ return;
+ }
+
+
ProportionalSettingView view = new ProportionalSettingView();
view.Id = _id;
view.SV = Convert.ToSingle(sv);
+
+ var i = BasePlcHelper.Instance.WatchDog.LastValue.ToInt();
+ if (i == 0)
+ {
+ LoadingHelper.CloseForm();
+ MessageBox.Show("PLC通讯失败");
+ return;
+ }
+ LoadingHelper.ShowLoadingScreen();
ProportionalPlc.DownToPlc(new []{view});
-
+ ProportionalDB.Update(view);
+ LoadingHelper.CloseForm();
+ this.DialogResult = DialogResult.OK;
}
}
}
\ No newline at end of file
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/ProportionalDB.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/ProportionalDB.cs
new file mode 100644
index 0000000..2a3d353
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/ProportionalDB.cs
@@ -0,0 +1,18 @@
+using System.Runtime.CompilerServices;
+using Mesnac.Action.ChemicalWeighing.LjMaterial;
+
+namespace Mesnac.Action.ChemicalWeighing.LjProportional
+{
+ public class ProportionalDB:DBHelp
+ {
+ //select Id, Name, PV, SV from ProportionalSetting
+
+
+
+ public static void Update(ProportionalSettingView view)
+ {
+ string sql = $" update ProportionalSetting set SV='{view.SV}' where id={view.Id}";
+ ExecuteNonQuery(sql);
+ }
+ }
+}
\ No newline at end of file
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/ProportionalPlc.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/ProportionalPlc.cs
index 399d1f2..1c5f89e 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/ProportionalPlc.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/ProportionalPlc.cs
@@ -23,6 +23,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 1,
+ PV = basePlcHelper.conveyV1_PV.NowValue.ToFloat(),
SV = basePlcHelper.conveyV1_SV.NowValue.ToFloat()
};
return vi;
@@ -44,6 +45,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 2,
+ PV = basePlcHelper.purgeV1_PV.NowValue.ToFloat(),
SV = basePlcHelper.purgeV1_SV.NowValue.ToFloat()
};
return vi;
@@ -67,6 +69,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 3,
+ PV = basePlcHelper.conveyV2_PV.NowValue.ToFloat(),
SV = basePlcHelper.conveyV2_SV.NowValue.ToFloat()
};
return vi;
@@ -88,6 +91,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 4,
+ PV = basePlcHelper.purgeV2_PV.NowValue.ToFloat(),
SV = basePlcHelper.purgeV2_SV.NowValue.ToFloat()
};
return vi;
@@ -114,6 +118,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 5,
+ PV = basePlcHelper.conveyV3_PV.NowValue.ToFloat(),
SV = basePlcHelper.conveyV3_SV.NowValue.ToFloat()
};
return vi;
@@ -136,6 +141,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 6,
+ PV = basePlcHelper.purgeV3_PV.NowValue.ToFloat(),
SV = basePlcHelper.purgeV3_SV.NowValue.ToFloat()
};
return vi;
@@ -161,6 +167,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 7,
+ PV = basePlcHelper.conveyV4_PV.NowValue.ToFloat(),
SV = basePlcHelper.conveyV4_SV.NowValue.ToFloat()
};
return vi;
@@ -183,6 +190,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 8,
+ PV = basePlcHelper.purgeV4_PV.NowValue.ToFloat(),
SV = basePlcHelper.purgeV4_SV.NowValue.ToFloat()
};
return vi;
@@ -208,6 +216,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 9,
+ PV = basePlcHelper.conveyV5_PV.NowValue.ToFloat(),
SV = basePlcHelper.conveyV5_SV.NowValue.ToFloat()
};
return vi;
@@ -230,6 +239,7 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
ProportionalSettingView vi = new ProportionalSettingView()
{
Id = 10,
+ PV = basePlcHelper.purgeV5_PV.NowValue.ToFloat(),
SV = basePlcHelper.purgeV5_SV.NowValue.ToFloat()
};
return vi;
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/UpAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/UpAction.cs
index 91077c9..5c65c16 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/UpAction.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjProportional/UpAction.cs
@@ -24,18 +24,32 @@ namespace Mesnac.Action.ChemicalWeighing.LjProportional
if (MessageBox.Show("确定上传到数据库?","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Information) == DialogResult.OK)
{
+
+ LoadingHelper.ShowLoadingScreen();
+ var watchDog = LjHelp.WatchDog;
+ if (watchDog == 0)
+ {
+ LoadingHelper.CloseForm();
+ MessageBox.Show("PLC通讯失败");
+ return;
+ }
+
DoWord();
+ LoadingHelper.CloseForm();
};
}
private void DoWord()
{
+
+
+
var views = ProportionalPlc.UpFromPlc();
foreach (var v in views)
{
string sql =
- $"update ProportionalSetting set SV={v.SV} where Id={v.Id}";
+ $"update ProportionalSetting set SV={v.SV},PV={v.PV} where Id={v.Id}";
DBHelp.ExecuteNonQuery(sql);
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Loading.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Loading.cs
index 5d6397a..508a15f 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Loading.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Loading.cs
@@ -10,6 +10,7 @@ namespace Mesnac.Action.ChemicalWeighing
InitializeComponent();
this.ControlBox = true ;
this.MaximizeBox = false;
+ this.MinimizeBox = false;
}
private void loading_Load(object sender, EventArgs e)
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
index c99b1dd..83c6dd5 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
@@ -153,6 +153,9 @@
False
..\..\..\PlugInPlatform\Mesnac.PlugIn.dll
+
+ ..\..\Microsoft.Office.Interop.Excel.dll
+
@@ -463,6 +466,7 @@
FrmProportional.cs
+
diff --git a/Main/MCEdit/Data/MCProject/nodeDevice.xml b/Main/MCEdit/Data/MCProject/nodeDevice.xml
index 630fc30..aeba21b 100644
--- a/Main/MCEdit/Data/MCProject/nodeDevice.xml
+++ b/Main/MCEdit/Data/MCProject/nodeDevice.xml
@@ -252,26 +252,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+