diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/FrmMixA.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/FrmMixA.cs index f9655e9..feacff3 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/FrmMixA.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/FrmMixA.cs @@ -81,15 +81,30 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixManager LjMixManagerDb.UpdateMixA(view); view.Id = _id; + + List recipePlcViews = new List(); + List recipeSteps = new List(); + - //List recipePlcViews= + recipePlcViews = LjMixManagerDb.GetRecip(view.MetageAId); + recipeSteps=LjMixManagerDb.GetStep(view.MetageAId); + // 第一台干混机 switch (_id) { - case 1 : - // LjMixManagerPlc.DownD1Recipe() + case 1 : + LjMixManagerPlc.DownD1Recipe(recipePlcViews, recipeSteps); + break; + case 2 : + LjMixManagerPlc.DownD2Recipe(recipePlcViews, recipeSteps); + break; + case 3 : + LjMixManagerPlc.DownD3Recipe(recipePlcViews, recipeSteps); + break; + case 4 : + LjMixManagerPlc.DownD4Recipe(recipePlcViews, recipeSteps); break; } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/FrmMixB.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/FrmMixB.cs index e9a0898..7ce806b 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/FrmMixB.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/FrmMixB.cs @@ -99,6 +99,37 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixManager _view.MixBId = DrpMixB.SelectedValue.ToString(); _view.MixBName=DrpMixB.Text; LjMixManagerDb.UpdateMixB(_view); + + List rG1 = new List(); + List rG2 = new List(); + List recipeSteps = new List(); + + + rG1 = LjMixManagerDb.GetRecip(_view.MetageB1Id); + rG2 = LjMixManagerDb.GetRecip(_view.MetageB2Id); + + recipeSteps=LjMixManagerDb.GetStep( _view.MixBId); + + + // 第一台干混机 + + switch (_id) + { + case 1 : + LjMixManagerPlc.DownG1Recipe(rG1,rG2, recipeSteps); + break; + case 2 : + LjMixManagerPlc.DownG2Recipe(rG1,rG2, recipeSteps); + break; + case 3 : + LjMixManagerPlc.DownG2Recipe(rG1,rG2, recipeSteps); + break; + case 4 : + LjMixManagerPlc.DownG2Recipe(rG1,rG2, recipeSteps); + break; + } + + this.DialogResult = DialogResult.OK; } } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/LjMixManagerDb.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/LjMixManagerDb.cs index 8cf90b4..44502c8 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/LjMixManagerDb.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/LjMixManager/LjMixManagerDb.cs @@ -256,5 +256,55 @@ namespace Mesnac.Action.ChemicalWeighing.LjMixManager return ls; } + + + public static List GetRecip(string metageId) + { + string sql = $"select lsm.Code, a.Weight,a.Difference from lj_metage_detail a " + + $"left join dbo.lj_stock_material lsm on a.DeviceId = lsm.Id where a.MetageId='{metageId}'"; + + var dataTable = GetTable(sql); + List list = new List(); + foreach (DataRow dataTableRow in dataTable.Rows) + { + RecipePlcView view = new RecipePlcView() + { + Bin = Convert.ToInt32(dataTableRow["Code"]), + Set = Convert.ToSingle(dataTableRow["Weight"]), + TolErance = Convert.ToSingle(dataTableRow["Weight"]) + }; + + list.Add(view); + } + + return list; + } + + + public static List GetStep(string metageId) + { + string sql = + $" select Id, MixId, ActionId, ActionName, SecondTime, Temperature, Speed, Weight, Difference, Remark " + + $" from lj_mix_detail where MixId='{metageId}'"; + + var table = GetTable(sql); + + List list = new List(); + foreach (DataRow tableRow in table.Rows) + { + Step step = new Step(); + //代码 + step.MixCode = Convert.ToInt32(tableRow["ActionId"]); + //时间 + step.MixTime = Convert.ToInt32(tableRow["SecondTime"]); + //温度 + step.MixTemp = Convert.ToInt32(tableRow["SecondTime"]); + //速度 + step.MixSpeed = Convert.ToInt32(tableRow["SecondTime"]); + list.Add(step); + } + + return list; + } } } \ No newline at end of file diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index c010b52..5c98ca4 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -110,9 +110,8 @@ False ..\..\..\A3Lib\FastReport\FastReport.VSDesign.dll - - False - Z:\Desktop\日常代码\榄菊项目\程序设计\lj_plc\PlugInPlatform\HslCommunication.dll + + ..\..\..\PlugInPlatform\HslCommunication.dll False diff --git a/Main/MCEdit/Data/MCProject/SCWSProject2.mprj b/Main/MCEdit/Data/MCProject/SCWSProject2.mprj index b0943a0..e074223 100644 --- a/Main/MCEdit/Data/MCProject/SCWSProject2.mprj +++ b/Main/MCEdit/Data/MCProject/SCWSProject2.mprj @@ -15,8 +15,6 @@ - - diff --git a/Main/MCEdit/Data/MCProject/nodeDataSource.xml b/Main/MCEdit/Data/MCProject/nodeDataSource.xml index 57415b2..3600a0d 100644 --- a/Main/MCEdit/Data/MCProject/nodeDataSource.xml +++ b/Main/MCEdit/Data/MCProject/nodeDataSource.xml @@ -1,3 +1,3 @@ - + \ No newline at end of file