From 564616b7bf8561d36543f6c7004865ffd72053d7 Mon Sep 17 00:00:00 2001 From: wangsr Date: Wed, 1 Nov 2023 13:57:53 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E8=87=AA=E5=8A=A8=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E4=BB=A3=E7=A0=81=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoControl/AutoControl.cs | 1013 +---------------- .../AutoControl/AutoLogHelper.cs | 81 ++ .../AutoControl/ControlsHelper.cs | 72 ++ .../Entity/GelerWeterControlsEntity.cs | 1 - .../AutoControl/InitAction.cs | 322 +++--- .../AutoControl/PlcAutoWriteHelper.cs | 759 ++++++++++++ .../AutoControl/RefreshAction.cs | 318 ------ .../Mesnac.Action.ChemicalWeighing.csproj | 3 +- .../EventConfig/小料称量/自动控制.xml | 8 - .../Data/MCProject/nodeForm/AutoControlC.xml | 4 +- 10 files changed, 1111 insertions(+), 1470 deletions(-) create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoLogHelper.cs create mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs delete mode 100644 Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/RefreshAction.cs diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs index dc18be2..0aa63ec 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoControl.cs @@ -1,27 +1,17 @@ using DataBlockHelper.DBHelpers; using DataBlockHelper.Entity.DB2104Entity; -using DataBlockHelper.Entity.DB2106Entity; using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.AutoControl.DB; using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; using Mesnac.Action.ChemicalWeighing.LjMixManager; -using Mesnac.Controls.Base; -using Mesnac.Controls.Default; using System; using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; -using Button = System.Windows.Forms.Button; using Mesnac.Action.ChemicalWeighing.LjPlanning; -using System.Diagnostics.SymbolStore; -using Mesnac.Basic; -using Mesnac.Action.ChemicalWeighing.FreeDb; -using Microsoft.Office.Interop.Excel; -using System.Reflection; -using Mesnac.Action.ChemicalWeighing.MainDetailControl.Entity; -using Mesnac.Controls.ChemicalWeighing; using IAction = Mesnac.Action.Base.IAction; using Mesnac.Core.Service; +using static Mesnac.Action.ChemicalWeighing.AutoControl.AutoLogHelper; +using static Mesnac.Action.ChemicalWeighing.AutoControl.PlcAutoWriteHelper; namespace Mesnac.Action.ChemicalWeighing.AutoControl { @@ -67,245 +57,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl return; } - int b1 = Convert.ToInt32(ComboE.ChooseMaterial1.MCValue.ToString()); - int b2 = Convert.ToInt32(ComboE.ChooseMaterial2.MCValue.ToString()); - - short bin1 = (short)StockMaterrialDbHelp.GetCodeById(b1); - short bin2 = (short)StockMaterrialDbHelp.GetCodeById(b2); - - float MatTol1 = Convert.ToSingle(TextE.MaterialTolerance1.MCValue.ToString()); - float MatTol2 = Convert.ToSingle(TextE.MaterialTolerance2.MCValue.ToString()); - - float MatWei1 = Convert.ToSingle(TextE.MaterialWeight1.MCValue.ToString()); - float MatWei2 = Convert.ToSingle(TextE.MaterialWeight2.MCValue.ToString()); - - float GelSpeed = Convert.ToSingle(TextE.GelSpeedSet.MCValue.ToString()); - - float GelPosA = Convert.ToSingle(TextE.GelPosTimeA.MCValue.ToString()); - float GelNagB = Convert.ToSingle(TextE.GelNagTimeB.MCValue.ToString()); - short GelPosC = Convert.ToInt16(TextE.GelPosTimeC.MCValue.ToString()); - - short GelWater = Convert.ToInt16(TextE.GelWaterTime.MCValue.ToString()); - short GelWait = Convert.ToInt16(TextE.GelWaitTime.MCValue.ToString()); - short GelCloseHeat = Convert.ToInt16(TextE.GelCloseHeatTime.MCValue.ToString()); - float GelDelayTime = Convert.ToSingle(TextE.GelOutDelayTime.MCValue.ToString()); - - if (b2 == -1) - { - if (MatTol1 < 0.1) - { - MessageBox.Show("公差不能小于0.1!"); - return; - } - } - else - { - if (MatTol1 < 0.1 || MatTol2 < 0.1) - { - MessageBox.Show("公差不能小于0.1!"); - return; - } - } - - List recipes = new List(); - - RecipePlcView recipe1 = new RecipePlcView() - { - Bin = bin1, - Set = MatWei1, - Tolerance = MatTol1, - }; - RecipePlcView recipe2 = new RecipePlcView() - { - Bin = bin2, - Set = MatWei2, - Tolerance = MatTol2, - }; - - recipes.Add(recipe1); - recipes.Add(recipe2); - - List steps = new List(); - - Step step1 = new Step() - { - MixCode = 1, - MixSpeed = GelSpeed - }; - Step step2 = new Step() - { - MixCode = 2, - }; - Step step3 = new Step() - { - MixCode = 3, - MixTime = GelPosC, - MixTemp = GelPosA, - MixSpeed = GelNagB - }; - Step step4 = new Step() - { - MixCode = 4, - }; - Step step5 = new Step() - { - MixCode = 5, - MixTime = GelWater - }; - Step step6 = new Step() - { - MixCode = 6, - }; - Step step7 = new Step() - { - MixCode = 5, - MixTime = GelWait - }; - Step step8 = new Step() - { - MixCode = 7, - MixTime = GelCloseHeat, - MixTemp = GelDelayTime - }; - - steps.Add(step1); - steps.Add(step2); - steps.Add(step3); - steps.Add(step4); - steps.Add(step5); - steps.Add(step6); - steps.Add(step7); - steps.Add(step8); - - float WetDryWei = Convert.ToSingle(TextE.WetDryWeight.MCValue.ToString()); - short WetMix = Convert.ToInt16(TextE.WetMixTime.MCValue.ToString()); - short WetOutDelay = Convert.ToInt16(TextE.WetOutDelayTime.MCValue.ToString()); - - List mixSteps = new List(); - - MixStep mixStep1 = new MixStep() - { - MixCode = 1, - }; - MixStep mixStep2 = new MixStep() - { - MixCode = 2, - SetValue = WetDryWei - }; - MixStep mixStep3 = new MixStep() - { - MixCode = 3, - MixTime = WetMix - }; - MixStep mixStep4 = new MixStep() - { - MixCode = 4, - }; - MixStep mixStep5 = new MixStep() - { - MixCode = 5, - MixTime = WetOutDelay - }; - - mixSteps.Add(mixStep1); - mixSteps.Add(mixStep2); - mixSteps.Add(mixStep3); - mixSteps.Add(mixStep4); - mixSteps.Add(mixStep5); - - List materials = new List(); - - DeviceMaterrial deviceMaterial1 = new DeviceMaterrial() - { - DeviceId = SingleSelect(), - MaterrialId = b1, - Type = 2, - Code = StockMaterrialDbHelp.GetCodeById(b1) - }; - DeviceMaterrial deviceMaterial2 = new DeviceMaterrial() - { - DeviceId = SingleSelect(), - MaterrialId = b2, - Type = 2, - Code = StockMaterrialDbHelp.GetCodeById(b2) - }; - - materials.Add(deviceMaterial1); - materials.Add(deviceMaterial2); - - switch (SingleSelect()) - { - case 1: - LjPlanningPlcHelp.DownG1Recipe(recipes, steps); - LjPlanningPlcHelp.DownM1Recipe(mixSteps); - DeviceMaterrialService.Save(materials); - break; - case 2: - LjPlanningPlcHelp.DownG2Recipe(recipes, steps); - LjPlanningPlcHelp.DownM2Recipe(mixSteps); - DeviceMaterrialService.Save(materials); - break; - case 3: - LjPlanningPlcHelp.DownG3Recipe(recipes, steps); - LjPlanningPlcHelp.DownM3Recipe(mixSteps); - DeviceMaterrialService.Save(materials); - break; - case 4: - LjPlanningPlcHelp.DownG4Recipe(recipes, steps); - LjPlanningPlcHelp.DownM4Recipe(mixSteps); - DeviceMaterrialService.Save(materials); - break; - case 5: - LjPlanningPlcHelp.DownG5Recipe(recipes, steps); - LjPlanningPlcHelp.DownM5Recipe(mixSteps); - DeviceMaterrialService.Save(materials); - break; - case 6: - LjPlanningPlcHelp.DownG6Recipe(recipes, steps); - LjPlanningPlcHelp.DownM6Recipe(mixSteps); - DeviceMaterrialService.Save(materials); - break; - case 7: - LjPlanningPlcHelp.DownG7Recipe(recipes, steps); - LjPlanningPlcHelp.DownM7Recipe(mixSteps); - DeviceMaterrialService.Save(materials); - break; - case 8: - LjPlanningPlcHelp.DownG8Recipe(recipes, steps); - LjPlanningPlcHelp.DownM8Recipe(mixSteps); - DeviceMaterrialService.Save(materials); - break; - default: - MessageBox.Show("请选择一条产线!"); - return; - } - - Auto_Log log = new Auto_Log() - { - ActionKind = "糊化湿混数据下传", - LogTime = DateTime.Now, - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - LineNo = SingleSelect(), - MaterialBin1 = bin1, - MaterialBin2 = bin2, - MaterialWeight1 = MatWei1, - MaterialWeight2 = MatWei2, - MaterialTolerance1 = MatTol1, - MaterialTolerance2 = MatTol2, - GelSpeedSet = GelSpeed, - GelPosTimeA = GelPosA, - GelNagTimeB = GelNagB, - GelPosTimeC = GelPosC, - GelWaterTime = GelWater, - GelWaitTime = GelWait, - GelCloseHeatTime = GelCloseHeat, - GelOutDelayTime = GelDelayTime, - WetDryWeight = WetDryWei, - WetMixTime = WetMix, - WetOutDelayTime = WetOutDelay - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + GelWetDownload(TextE, ComboE, RadioE); MessageBox.Show("数据下传成功!"); } @@ -321,43 +73,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl return; } - WaterEntity HotA = new WaterEntity(); - WaterEntity ColdA = new WaterEntity(); - WaterEntity HotB = new WaterEntity(); - WaterEntity ColdB = new WaterEntity(); - - float hotASet, hotBSet, coldASet, coldBSet, hotATol, hotBTol, coldATol, coldBTol; - - if (float.TryParse(Convert.ToString(TextE.HotValueA.MCValue), out hotASet) && - float.TryParse(Convert.ToString(TextE.HotToleranceA.MCValue), out hotATol) && - float.TryParse(Convert.ToString(TextE.HotValueB.MCValue), out hotBSet) && - float.TryParse(Convert.ToString(TextE.HotToleranceB.MCValue), out hotBTol) && - float.TryParse(Convert.ToString(TextE.ColdValueA.MCValue), out coldASet) && - float.TryParse(Convert.ToString(TextE.ColdToleranceA.MCValue), out coldATol) && - float.TryParse(Convert.ToString(TextE.ColdValueB.MCValue), out coldBSet) && - float.TryParse(Convert.ToString(TextE.ColdToleranceB.MCValue), out coldBTol)) - { - HotA.Set = hotASet; - HotB.Set = hotBSet; - ColdA.Set = coldASet; - ColdB.Set = coldBSet; - HotA.Tolerance = hotATol; - HotB.Tolerance = hotBTol; - ColdA.Tolerance = coldATol; - ColdB.Tolerance = coldBTol; - Db2104WriteHelper.WriteAHostWater(HotA); - Db2104WriteHelper.WriteBHostWater(HotB); - Db2104WriteHelper.WriteAColWater(ColdA); - Db2104WriteHelper.WriteBColWater(ColdB); - MesnacServiceManager.Instance.LoggingService.Info("水称数据下发成功!"); - MessageBox.Show("水称数据下发成功"); - } - else - { - MesnacServiceManager.Instance.LoggingService.Info("输入数值的格式有误"); - MessageBox.Show("输入数值的格式有误!"); - return; - } + WaterDownload(TextE); } #endregion @@ -371,267 +87,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl return; } - int b1 = Convert.ToInt32(ComboE.DryM1.MCValue.ToString()); - int b2 = Convert.ToInt32(ComboE.DryM2.MCValue.ToString()); - int b3 = Convert.ToInt32(ComboE.DryM3.MCValue.ToString()); - int b4 = Convert.ToInt32(ComboE.DryM4.MCValue.ToString()); - int b5 = Convert.ToInt32(ComboE.DryM5.MCValue.ToString()); - int b6 = Convert.ToInt32(ComboE.DryM6.MCValue.ToString()); - int b7 = Convert.ToInt32(ComboE.DryM7.MCValue.ToString()); - int b8 = Convert.ToInt32(ComboE.DryM8.MCValue.ToString()); - int b9 = Convert.ToInt32(ComboE.DryM9.MCValue.ToString()); - int b10 = Convert.ToInt32(ComboE.DryM10.MCValue.ToString()); - int b11 = Convert.ToInt32(ComboE.DryM11.MCValue.ToString()); - int b12 = Convert.ToInt32(ComboE.DryM12.MCValue.ToString()); - - short bin1 = (short)StockMaterrialDbHelp.GetCodeById(b1); - short bin2 = (short)StockMaterrialDbHelp.GetCodeById(b2); - short bin3 = (short)StockMaterrialDbHelp.GetCodeById(b3); - short bin4 = (short)StockMaterrialDbHelp.GetCodeById(b4); - short bin5 = (short)StockMaterrialDbHelp.GetCodeById(b5); - short bin6 = (short)StockMaterrialDbHelp.GetCodeById(b6); - short bin7 = (short)StockMaterrialDbHelp.GetCodeById(b7); - short bin8 = (short)StockMaterrialDbHelp.GetCodeById(b8); - short bin9 = (short)StockMaterrialDbHelp.GetCodeById(b9); - short bin10 = (short)StockMaterrialDbHelp.GetCodeById(b10); - short bin11 = (short)StockMaterrialDbHelp.GetCodeById(b11); - short bin12 = (short)StockMaterrialDbHelp.GetCodeById(b12); - - int w1 = Convert.ToInt32(TextE.DryW1.MCValue.ToString()); - int w2 = Convert.ToInt32(TextE.DryW2.MCValue.ToString()); - int w3 = Convert.ToInt32(TextE.DryW3.MCValue.ToString()); - int w4 = Convert.ToInt32(TextE.DryW4.MCValue.ToString()); - int w5 = Convert.ToInt32(TextE.DryW5.MCValue.ToString()); - int w6 = Convert.ToInt32(TextE.DryW6.MCValue.ToString()); - int w7 = Convert.ToInt32(TextE.DryW7.MCValue.ToString()); - int w8 = Convert.ToInt32(TextE.DryW8.MCValue.ToString()); - int w9 = Convert.ToInt32(TextE.DryW9.MCValue.ToString()); - int w10 = Convert.ToInt32(TextE.DryW10.MCValue.ToString()); - int w11 = Convert.ToInt32(TextE.DryW11.MCValue.ToString()); - int w12 = Convert.ToInt32(TextE.DryW12.MCValue.ToString()); - - int t1 = Convert.ToInt32(TextE.DryT1.MCValue.ToString()); - int t2 = Convert.ToInt32(TextE.DryT2.MCValue.ToString()); - int t3 = Convert.ToInt32(TextE.DryT3.MCValue.ToString()); - int t4 = Convert.ToInt32(TextE.DryT4.MCValue.ToString()); - int t5 = Convert.ToInt32(TextE.DryT5.MCValue.ToString()); - int t6 = Convert.ToInt32(TextE.DryT6.MCValue.ToString()); - int t7 = Convert.ToInt32(TextE.DryT7.MCValue.ToString()); - int t8 = Convert.ToInt32(TextE.DryT8.MCValue.ToString()); - int t9 = Convert.ToInt32(TextE.DryT9.MCValue.ToString()); - int t10 = Convert.ToInt32(TextE.DryT10.MCValue.ToString()); - int t11 = Convert.ToInt32(TextE.DryT11.MCValue.ToString()); - int t12 = Convert.ToInt32(TextE.DryT12.MCValue.ToString()); - - List recipes = new List(); - - RecipePlcView recipe1 = new RecipePlcView() - { - Bin = bin1, - Set = w1, - Tolerance = t1, - }; - RecipePlcView recipe2 = new RecipePlcView() - { - Bin = bin2, - Set = w2, - Tolerance = t2, - }; - RecipePlcView recipe3 = new RecipePlcView() - { - Bin = bin3, - Set = w3, - Tolerance = t3, - }; - RecipePlcView recipe4 = new RecipePlcView() - { - Bin = bin4, - Set = w4, - Tolerance = t4, - }; - RecipePlcView recipe5 = new RecipePlcView() - { - Bin = bin5, - Set = w5, - Tolerance = t5, - }; - RecipePlcView recipe6 = new RecipePlcView() - { - Bin = bin6, - Set = w6, - Tolerance = t6, - }; - RecipePlcView recipe7 = new RecipePlcView() - { - Bin = bin7, - Set = w7, - Tolerance = t7, - }; - RecipePlcView recipe8 = new RecipePlcView() - { - Bin = bin8, - Set = w8, - Tolerance = t8, - }; - RecipePlcView recipe9 = new RecipePlcView() - { - Bin = bin9, - Set = w9, - Tolerance = t9, - }; - RecipePlcView recipe10 = new RecipePlcView() - { - Bin = bin10, - Set = w10, - Tolerance = t10, - }; - RecipePlcView recipe11 = new RecipePlcView() - { - Bin = bin11, - Set = w11, - Tolerance = t11, - }; - RecipePlcView recipe12 = new RecipePlcView() - { - Bin = bin12, - Set = w12, - Tolerance = t12, - }; - - recipes.Add(recipe1); - recipes.Add(recipe2); - recipes.Add(recipe3); - recipes.Add(recipe4); - recipes.Add(recipe5); - recipes.Add(recipe6); - recipes.Add(recipe7); - recipes.Add(recipe8); - recipes.Add(recipe9); - recipes.Add(recipe10); - recipes.Add(recipe11); - recipes.Add(recipe12); - - List steps = new List(); - - List materials = new List(); - - DeviceMaterrial deviceMaterial1 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b1, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b1) - }; - DeviceMaterrial deviceMaterial2 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b2, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b2) - }; - DeviceMaterrial deviceMaterial3 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b3, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b3) - }; - DeviceMaterrial deviceMaterial4 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b4, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b4) - }; - DeviceMaterrial deviceMaterial5 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b5, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b5) - }; - DeviceMaterrial deviceMaterial6 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b6, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b6) - }; - DeviceMaterrial deviceMaterial7 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b7, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b7) - }; - DeviceMaterrial deviceMaterial8 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b8, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b8) - }; - DeviceMaterrial deviceMaterial9 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b9, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b9) - }; - DeviceMaterrial deviceMaterial10 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b10, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b10) - }; - DeviceMaterrial deviceMaterial11 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b11, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b11) - }; - DeviceMaterrial deviceMaterial12 = new DeviceMaterrial() - { - DeviceId = DrySelect(), - MaterrialId = b12, - Type = 1, - Code = StockMaterrialDbHelp.GetCodeById(b12) - }; - - materials.Add(deviceMaterial1); - materials.Add(deviceMaterial2); - materials.Add(deviceMaterial3); - materials.Add(deviceMaterial4); - materials.Add(deviceMaterial5); - materials.Add(deviceMaterial6); - materials.Add(deviceMaterial7); - materials.Add(deviceMaterial8); - materials.Add(deviceMaterial9); - materials.Add(deviceMaterial10); - materials.Add(deviceMaterial11); - materials.Add(deviceMaterial12); - - switch (DrySelect()) - { - case 1: - LjPlanningPlcHelp.DownD1Recipe(recipes, steps); - DeviceMaterrialService.Save(materials); - break; - case 2: - LjPlanningPlcHelp.DownD2Recipe(recipes, steps); - DeviceMaterrialService.Save(materials); - break; - case 3: - LjPlanningPlcHelp.DownD3Recipe(recipes, steps); - DeviceMaterrialService.Save(materials); - break; - case 4: - LjPlanningPlcHelp.DownD4Recipe(recipes, steps); - DeviceMaterrialService.Save(materials); - break; - } + DryDownload(TextE, ComboE, RadioE); MessageBox.Show("数据下传成功!"); } @@ -649,39 +105,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl return; } - bool isReady; - - switch (SingleSelect()) - { - case 1: - isReady = DB2105WriteHelper.WriteG1Pd(); - break; - case 2: - isReady = DB2105WriteHelper.WriteG2Pd(); - break; - case 3: - isReady = DB2105WriteHelper.WriteG3Pd(); - break; - case 4: - isReady = DB2105WriteHelper.WriteG4Pd(); - break; - case 5: - isReady = DB2105WriteHelper.WriteG5Pd(); - break; - case 6: - isReady = DB2105WriteHelper.WriteG6Pd(); - break; - case 7: - isReady = DB2105WriteHelper.WriteG7Pd(); - break; - case 8: - isReady = DB2105WriteHelper.WriteG8Pd(); - break; - default: - isReady = true; - MessageBox.Show("当前未选择产线!"); - return; - } + bool isReady = GelPowderDownload(RadioE); if (!isReady) { @@ -689,15 +113,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } else { - Auto_Log log = new Auto_Log() - { - ActionKind = "手动下粉料", - LogTime = DateTime.Now, - LineNo = SingleSelect(), - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + SingleLog("手动下粉料", RadioE); MessageBox.Show("信号下达成功!"); } @@ -709,55 +125,16 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl { return; } - bool isReady; - - switch (SingleSelect()) - { - case 1: - isReady = DB2105WriteHelper.WriteG1Cw(); - break; - case 2: - isReady = DB2105WriteHelper.WriteG2Cw(); - break; - case 3: - isReady = DB2105WriteHelper.WriteG3Cw(); - break; - case 4: - isReady = DB2105WriteHelper.WriteG4Cw(); - break; - case 5: - isReady = DB2105WriteHelper.WriteG5Cw(); - break; - case 6: - isReady = DB2105WriteHelper.WriteG6Cw(); - break; - case 7: - isReady = DB2105WriteHelper.WriteG7Cw(); - break; - case 8: - isReady = DB2105WriteHelper.WriteG8Cw(); - break; - default: - isReady = true; - MessageBox.Show("当前未选择产线!"); - return; - } + bool isReady = GelColdWaterDownload(RadioE); + if (!isReady) { MessageBox.Show("信号未准备好!"); } else { - Auto_Log log = new Auto_Log() - { - ActionKind = "手动下冷水", - LogTime = DateTime.Now, - LineNo = SingleSelect(), - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + SingleLog("手动下冷水", RadioE); MessageBox.Show("信号下达成功!"); } @@ -771,39 +148,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl return; } - bool isReady; - - switch (SingleSelect()) - { - case 1: - isReady = DB2105WriteHelper.WriteG1Hw(); - break; - case 2: - isReady = DB2105WriteHelper.WriteG2Hw(); - break; - case 3: - isReady = DB2105WriteHelper.WriteG3Hw(); - break; - case 4: - isReady = DB2105WriteHelper.WriteG4Hw(); - break; - case 5: - isReady = DB2105WriteHelper.WriteG5Hw(); - break; - case 6: - isReady = DB2105WriteHelper.WriteG6Hw(); - break; - case 7: - isReady = DB2105WriteHelper.WriteG7Hw(); - break; - case 8: - isReady = DB2105WriteHelper.WriteG8Hw(); - break; - default: - isReady = true; - MessageBox.Show("当前未选择产线!"); - return; - } + bool isReady = GelHotWaterDownload(RadioE); if (!isReady) { @@ -811,15 +156,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } else { - Auto_Log log = new Auto_Log() - { - ActionKind = "手动下热水", - LogTime = DateTime.Now, - LineNo = SingleSelect(), - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + SingleLog("手动下热水", RadioE); MessageBox.Show("信号下达成功!"); } @@ -832,39 +169,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl return; } - bool isReady; - - switch (SingleSelect()) - { - case 1: - isReady = DB2105WriteHelper.WriteM1(); - break; - case 2: - isReady = DB2105WriteHelper.WriteM2(); - break; - case 3: - isReady = DB2105WriteHelper.WriteM3(); - break; - case 4: - isReady = DB2105WriteHelper.WriteM4(); - break; - case 5: - isReady = DB2105WriteHelper.WriteM5(); - break; - case 6: - isReady = DB2105WriteHelper.WriteM6(); - break; - case 7: - isReady = DB2105WriteHelper.WriteM7(); - break; - case 8: - isReady = DB2105WriteHelper.WriteM8(); - break; - default: - isReady = false; - MessageBox.Show("当前未选择产线!"); - return; - } + bool isReady = WetGelatDownload(RadioE); if (!isReady) { @@ -872,15 +177,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } else { - Auto_Log log = new Auto_Log() - { - ActionKind = "手动下糊化料", - LogTime = DateTime.Now, - LineNo = SingleSelect(), - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + SingleLog("手动下糊化料", RadioE); MessageBox.Show("信号下达成功!"); } @@ -893,74 +190,9 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl return; } - float t = Convert.ToSingle(TextE.ManualTolerance.MCValue.ToString()); - float w = Convert.ToSingle(TextE.ManualWeight.MCValue.ToString()); - if (t < 0.1) - { - MessageBox.Show("公差不能小于0.1!"); - return; - } - - SetValue value = new SetValue() - { - Value = w, - Toterance = t - }; - - switch (SingleSelect()) - { - case 1: - DB2105WriteHelper.WriteManScrewH1(); - DB2105WriteHelper.WriteSetValueH1(value); - break; - case 2: - DB2105WriteHelper.WriteManScrewH2(); - DB2105WriteHelper.WriteSetValueH1(value); - break; - case 3: - DB2105WriteHelper.WriteManScrewH3(); - DB2105WriteHelper.WriteSetValueH2(value); - break; - case 4: - DB2105WriteHelper.WriteManScrewH4(); - DB2105WriteHelper.WriteSetValueH2(value); - break; - - case 5: - DB2105WriteHelper.WriteManScrewH5(); - DB2105WriteHelper.WriteSetValueH3(value); - break; - case 6: - DB2105WriteHelper.WriteManScrewH6(); - DB2105WriteHelper.WriteSetValueH3(value); - break; - case 7: - DB2105WriteHelper.WriteManScrewH7(); - DB2105WriteHelper.WriteSetValueH4(value); - break; - case 8: - DB2105WriteHelper.WriteManScrewH8(); - DB2105WriteHelper.WriteSetValueH4(value); - break; - default: - MessageBox.Show("当前未选择产线!"); - return; - } - - Auto_Log log = new Auto_Log() - { - ActionKind = "手动下黑粉", - LogTime = DateTime.Now, - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - ManualTolerance = t, - LineNo = SingleSelect(), - ManualWeight = w, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + WetGelatDownload(TextE, RadioE); MessageBox.Show("数据下传成功!"); - } #endregion @@ -974,46 +206,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl return; } - switch (SingleSelect()) - { - case 1: - DB2105WriteHelper.WriteStartJob1(); - break; - case 2: - DB2105WriteHelper.WriteStartJob2(); - break; - case 3: - DB2105WriteHelper.WriteStartJob3(); - break; - case 4: - DB2105WriteHelper.WriteStartJob4(); - break; - case 5: - DB2105WriteHelper.WriteStartJob5(); - break; - case 6: - DB2105WriteHelper.WriteStartJob6(); - break; - case 7: - DB2105WriteHelper.WriteStartJob7(); - break; - case 8: - DB2105WriteHelper.WriteStartJob8(); - break; - default: - MessageBox.Show("请选择一条产线!"); - return; - } - - Auto_Log log = new Auto_Log() - { - ActionKind = "产线启动", - LogTime = DateTime.Now, - LineNo = SingleSelect(), - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + LineStart(RadioE); MessageBox.Show("产线已启动!"); @@ -1021,46 +214,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl if (ButtonE.LineStop == runtime.Sender) { - switch (SingleSelect()) - { - case 1: - DB2105WriteHelper.WriteStopJob1(); - break; - case 2: - DB2105WriteHelper.WriteStopJob2(); - break; - case 3: - DB2105WriteHelper.WriteStopJob3(); - break; - case 4: - DB2105WriteHelper.WriteStopJob4(); - break; - case 5: - DB2105WriteHelper.WriteStopJob5(); - break; - case 6: - DB2105WriteHelper.WriteStopJob6(); - break; - case 7: - DB2105WriteHelper.WriteStopJob7(); - break; - case 8: - DB2105WriteHelper.WriteStopJob8(); - break; - default: - MessageBox.Show("请选择一条产线!"); - return; - } - - Auto_Log log = new Auto_Log() - { - ActionKind = "产线停止", - LogTime = DateTime.Now, - LineNo = SingleSelect(), - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + LineStop(RadioE); MessageBox.Show("已经停止生产"); @@ -1072,140 +226,11 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl if(ButtonE.RepairMode == runtime.Sender) { - - - if (LabelE.RepairState.MCValue.ToString() == "关") - { - if (MessageBox.Show("是否开启维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - Db3000Helper.WriteModel(SingleSelect(), true); - LabelE.RepairState.MCValue = "开"; - - Auto_Log log = new Auto_Log() - { - ActionKind = "维修模式开启", - LogTime = DateTime.Now, - LineNo = SingleSelect(), - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); - - MessageBox.Show("维修模式已开启"); - - } - else - { - if (LabelE.RepairState.MCValue.ToString() == "开") - { - if (MessageBox.Show("是否关闭维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) - { - return; - } - Db3000Helper.WriteModel(SingleSelect(), false); - LabelE.RepairState.MCValue = "关"; - - Auto_Log log = new Auto_Log() - { - ActionKind = "维修模式关闭", - LogTime = DateTime.Now, - LineNo = SingleSelect(), - UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, - }; - - FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); - - MessageBox.Show("维修模式已关闭"); - - } - } - - + RepairOnOff(LabelE, RadioE); } #endregion - } - - #region 帮助类 - - /// - /// 单选选择 - /// - /// 返回单选的产线号 如果未选择返回0 - private int SingleSelect() - { - if (Convert.ToBoolean(RadioE.Line1.MCValue) == true) - { - return 1; - } - else if (Convert.ToBoolean(RadioE.Line2.MCValue) == true) - { - return 2; - } - else if (Convert.ToBoolean(RadioE.Line3.MCValue) == true) - { - return 3; - } - else if (Convert.ToBoolean(RadioE.Line4.MCValue) == true) - { - return 4; - } - else if (Convert.ToBoolean(RadioE.Line5.MCValue) == true) - { - return 5; - } - else if (Convert.ToBoolean(RadioE.Line6.MCValue) == true) - { - return 6; - } - else if (Convert.ToBoolean(RadioE.Line7.MCValue) == true) - { - return 7; - } - else if (Convert.ToBoolean(RadioE.Line8.MCValue) == true) - { - return 8; - } - else - { - return 0; - } - } - - /// - /// 单混机单选选择 - /// - /// - private int DrySelect() - { - if (Convert.ToBoolean(RadioE.Dry1.MCValue) == true) - { - return 1; - } - else if (Convert.ToBoolean(RadioE.Dry2.MCValue) == true) - { - return 2; - } - else if (Convert.ToBoolean(RadioE.Dry3.MCValue) == true) - { - return 3; - } - else if (Convert.ToBoolean(RadioE.Dry4.MCValue) == true) - { - return 4; - } - else - { - return 0; - } - } - - - #endregion - + } } - } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoLogHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoLogHelper.cs new file mode 100644 index 0000000..0eddb43 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/AutoLogHelper.cs @@ -0,0 +1,81 @@ +using Mesnac.Action.ChemicalWeighing.AutoControl.DB; +using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; +using Mesnac.Action.ChemicalWeighing.FreeDb; +using Mesnac.Action.ChemicalWeighing.LjMixManager; +using Mesnac.Basic; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Mesnac.Action.ChemicalWeighing.AutoControl +{ + public static class AutoLogHelper + { + /// + /// 无数据log + /// + /// log说明 + /// 产线选择 + public static void SingleLog(string logText, MCRadioButtonEntity RadioE) + { + Auto_Log log = new Auto_Log() + { + ActionKind = logText, + LogTime = DateTime.Now, + LineNo = ControlsHelper.SingleSelect(RadioE), + UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, + }; + + FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + + } + + + public static void ManualWeightLog(float w, float t, MCRadioButtonEntity RadioE) + { + Auto_Log log = new Auto_Log() + { + ActionKind = "手动下黑粉", + LogTime = DateTime.Now, + UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, + ManualTolerance = t, + LineNo = ControlsHelper.SingleSelect(RadioE), + ManualWeight = w, + }; + + FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + } + + public static void GWlog(List recipes, List steps, List mixSteps, MCRadioButtonEntity RadioE) + { + Auto_Log log = new Auto_Log() + { + ActionKind = "糊化湿混数据下传", + LogTime = DateTime.Now, + UserID = string.IsNullOrWhiteSpace(UserInfo.Instance.UserName) ? "Edit" : UserInfo.Instance.UserName, + LineNo = ControlsHelper.SingleSelect(RadioE), + MaterialBin1 = recipes[0].Bin, + MaterialBin2 = recipes[1].Bin, + MaterialWeight1 = recipes[0].Set, + MaterialWeight2 = recipes[1].Set, + MaterialTolerance1 = recipes[0].Tolerance, + MaterialTolerance2 = recipes[1].Tolerance, + GelSpeedSet = steps[0].MixSpeed, + GelPosTimeA = steps[2].MixTemp, + GelNagTimeB = steps[2].MixSpeed, + GelPosTimeC = steps[2].MixTime, + GelWaterTime = steps[4].MixTime, + GelWaitTime = steps[6].MixTime, + GelCloseHeatTime = steps[7].MixTime, + GelOutDelayTime = steps[7].MixTemp, + WetDryWeight = mixSteps[1].SetValue, + WetMixTime = mixSteps[2].MixTime, + WetOutDelayTime = mixSteps[4].MixTime + }; + + FreeSqlUnit.Instance.Insert(log).ExecuteIdentity(); + } + } +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/ControlsHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/ControlsHelper.cs index 552ae20..4810b2c 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/ControlsHelper.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/ControlsHelper.cs @@ -39,5 +39,77 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } } + /// + /// 单选选择 + /// + /// 返回单选的产线号 如果未选择返回0 + public static int SingleSelect(MCRadioButtonEntity RadioE) + { + int no = 0; + if (Convert.ToBoolean(RadioE.Line1.MCValue)) + { + no = 1; + } + else if (Convert.ToBoolean(RadioE.Line2.MCValue)) + { + no = 2; + } + else if (Convert.ToBoolean(RadioE.Line3.MCValue)) + { + no = 3; + } + else if (Convert.ToBoolean(RadioE.Line4.MCValue)) + { + no = 4; + } + else if (Convert.ToBoolean(RadioE.Line5.MCValue)) + { + no = 5; + } + else if (Convert.ToBoolean(RadioE.Line6.MCValue)) + { + no = 6; + } + else if (Convert.ToBoolean(RadioE.Line7.MCValue)) + { + no = 7; + } + else if (Convert.ToBoolean(RadioE.Line8.MCValue)) + { + no = 8; + } + + return no; + } + + + /// + /// 单混机单选选择 + /// + /// + public static int DrySelect(MCRadioButtonEntity RadioE) + { + if (Convert.ToBoolean(RadioE.Dry1.MCValue) == true) + { + return 1; + } + else if (Convert.ToBoolean(RadioE.Dry2.MCValue) == true) + { + return 2; + } + else if (Convert.ToBoolean(RadioE.Dry3.MCValue) == true) + { + return 3; + } + else if (Convert.ToBoolean(RadioE.Dry4.MCValue) == true) + { + return 4; + } + else + { + return 0; + } + } + } } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs index 0db7a1a..2dda8d6 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/Entity/GelerWeterControlsEntity.cs @@ -68,7 +68,6 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.Entity public Button GelManualHotWater { get; set; } public Button WetManualGel { get; set; } public Button RepairMode { get; set; } - public Button WaterConfrim { get; set; } public Button DryDownload { get; set; } public Button WaterDownload { get; set; } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs index 368e3db..10545df 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/InitAction.cs @@ -4,6 +4,7 @@ using Mesnac.Action.Base; using Mesnac.Action.ChemicalWeighing.AutoControl.DB; using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; using Mesnac.Action.ChemicalWeighing.FreeDb; +using Mesnac.Action.ChemicalWeighing.LjMixManager; using Mesnac.Action.ChemicalWeighing.LjPlanning; using Mesnac.Controls.Base; using Mesnac.Controls.Default; @@ -40,9 +41,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl ControlsHelper.ControlImport(TextE, ButtonE, ComboE, LabelE, RadioE, McControls); - RadioE.Line1.MCValue = true; - RadioE.Dry1.MCValue = true; - RadioE.Line1.BackColor = System.Drawing.Color.LightSkyBlue; + ControlInit(); RadioE.Line1.CheckedChanged += Mcradion_CheckedChanged; RadioE.Line2.CheckedChanged += Mcradion_CheckedChanged; @@ -53,7 +52,13 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl RadioE.Line7.CheckedChanged += Mcradion_CheckedChanged; RadioE.Line8.CheckedChanged += Mcradion_CheckedChanged; - ControlInitFromPLC(); + RadioE.Dry1.CheckedChanged += DMcradion_CheckedChanged; + RadioE.Dry2.CheckedChanged += DMcradion_CheckedChanged; + RadioE.Dry3.CheckedChanged += DMcradion_CheckedChanged; + RadioE.Dry4.CheckedChanged += DMcradion_CheckedChanged; + + RadioE.Line1.MCValue = true; + RadioE.Dry1.MCValue = true; timer = new Timer(); timer.Interval = 1000; @@ -61,7 +66,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl timer.Tick += new EventHandler(StateRefresh);//添加事件 } - #region 前端状态 + #region 前端Timer状态刷新 private void StateRefresh(object sender, EventArgs e) { @@ -95,7 +100,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl var rd = Db3000Helper.ReadModel(); - if (rd[SingleSelect() - 1]) + if (rd[ControlsHelper.SingleSelect(RadioE) - 1]) { LabelE.RepairState.MCValue = "开"; } @@ -129,6 +134,10 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } } + #endregion + + #region PLC读数刷新控件 + private void Mcradion_CheckedChanged(object sender, EventArgs e) { MCRadioButton mCRadio = sender as MCRadioButton; @@ -141,23 +150,43 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl RadioE.Line7.BackColor = backColor; RadioE.Line8.BackColor = backColor; mCRadio.BackColor = Color.LightSkyBlue; + int select = ControlsHelper.SingleSelect(RadioE); + GWInit(select); + switch (select) + { + case 1: + case 2: + RadioE.Dry1.MCValue = true; break; + case 3: + case 4: + RadioE.Dry2.MCValue = true; break; + case 5: + case 6: + RadioE.Dry3.MCValue = true; break; + case 7: + case 8: + RadioE.Dry4.MCValue = true; break; + default: break; + } } - #endregion - - /// - /// 控件从Plc初始化 - /// - private void ControlInitFromPLC() + private void DMcradion_CheckedChanged(object sender, EventArgs e) { + MCRadioButton mCRadio = sender as MCRadioButton; + RadioE.Dry1.BackColor = backColor; + RadioE.Dry2.BackColor = backColor; + RadioE.Dry3.BackColor = backColor; + RadioE.Dry4.BackColor = backColor; + mCRadio.BackColor = Color.LightSkyBlue; + DInit(ControlsHelper.DrySelect(RadioE)); + } - ComboE.ChooseMaterial1.DataSource = StockMaterrialDbHelp.GetSiloMaterrial(); - ComboE.ChooseMaterial2.DataSource = StockMaterrialDbHelp.GetSiloMaterrial(); + private void GWInit(int select) + { - var selected = FreeSqlUnit.Instance.Select(). - Where(x => x.DeviceId == SingleSelect() && x.Type == 2).ToList(); + var selected = FreeSqlUnit.Instance.Select().Where(x => x.DeviceId == select && x.Type == 2).ToList(); - if(selected.Count != 0) + if (selected.Count != 0) { ComboE.ChooseMaterial1.SelectedValue = selected[0].MaterrialId; ComboE.ChooseMaterial2.SelectedValue = selected[1].MaterrialId; @@ -170,49 +199,59 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl var getGelatG1 = LjPlanningPlcHelp.GetGelatG1; var getWeterM1 = LjPlanningPlcHelp.GetWeterM1; + var getGelatG2 = LjPlanningPlcHelp.GetGelatG2; + var getWeterM2 = LjPlanningPlcHelp.GetWeterM2; + var getGelatG3 = LjPlanningPlcHelp.GetGelatG3; + var getWeterM3 = LjPlanningPlcHelp.GetWeterM3; + var getGelatG4 = LjPlanningPlcHelp.GetGelatG4; + var getWeterM4 = LjPlanningPlcHelp.GetWeterM4; + var getGelatG5 = LjPlanningPlcHelp.GetGelatG5; + var getWeterM5 = LjPlanningPlcHelp.GetWeterM5; + var getGelatG6 = LjPlanningPlcHelp.GetGelatG6; + var getWeterM6 = LjPlanningPlcHelp.GetWeterM6; + var getGelatG7 = LjPlanningPlcHelp.GetGelatG7; + var getWeterM7 = LjPlanningPlcHelp.GetWeterM7; + var getGelatG8 = LjPlanningPlcHelp.GetGelatG8; + var getWeterM8 = LjPlanningPlcHelp.GetWeterM8; + + switch (select) + { + case 1: + GWDataShow(getGelatG1, getWeterM1); + break; + case 2: + GWDataShow(getGelatG2, getWeterM2); + break; + case 3: + GWDataShow(getGelatG3, getWeterM3); + break; + case 4: + GWDataShow(getGelatG4, getWeterM4); + break; + case 5: + GWDataShow(getGelatG5, getWeterM5); + break; + case 6: + GWDataShow(getGelatG6, getWeterM6); + break; + case 7: + GWDataShow(getGelatG7, getWeterM7); + break; + case 8: + GWDataShow(getGelatG8, getWeterM8); + break; + default: + return; - TextE.MaterialWeight1.MCValue = getGelatG1.RecipePlcViews[0].Set; - TextE.MaterialWeight2.MCValue = getGelatG1.RecipePlcViews[1].Set; - //TextE.MaterialTolerance1.MCValue = getGelatG1.RecipePlcViews[0].Tolerance; - //TextE.MaterialTolerance2.MCValue = getGelatG1.RecipePlcViews[1].Tolerance; - TextE.GelSpeedSet.MCValue = getGelatG1.RecipeSteps[0].MixSpeed; - TextE.GelPosTimeA.MCValue = getGelatG1.RecipeSteps[2].MixTemp; - TextE.GelNagTimeB.MCValue = getGelatG1.RecipeSteps[2].MixSpeed; - TextE.GelPosTimeC.MCValue = getGelatG1.RecipeSteps[2].MixTime; - TextE.GelWaterTime.MCValue = getGelatG1.RecipeSteps[4].MixTime; - TextE.GelWaitTime.MCValue = getGelatG1.RecipeSteps[6].MixTime; - TextE.GelCloseHeatTime.MCValue = getGelatG1.RecipeSteps[7].MixTime; - TextE.GelOutDelayTime.MCValue = getGelatG1.RecipeSteps[7].MixTemp; - TextE.WetDryWeight.MCValue = getWeterM1[1].SetValue; - TextE.WetMixTime.MCValue = getWeterM1[2].MixTime; - TextE.WetOutDelayTime.MCValue = getWeterM1[4].MixTime; - - DB2104Helper dB2104Helper = new DB2104Helper(); - - TextE.ColdValueA.MCValue = dB2104Helper.GetAColWater.Set; - TextE.ColdValueB.MCValue = dB2104Helper.GetBColWater.Set; - TextE.HotValueA.MCValue = dB2104Helper.GetAHotWater.Set; - TextE.HotValueB.MCValue = dB2104Helper.GetBHotWater.Set; - TextE.ColdToleranceA.MCValue = dB2104Helper.GetAColWater.Tolerance; - TextE.ColdToleranceB.MCValue = dB2104Helper.GetBColWater.Tolerance; - TextE.HotToleranceA.MCValue = dB2104Helper.GetAHotWater.Tolerance; - TextE.HotToleranceB.MCValue = dB2104Helper.GetBHotWater.Tolerance; + } - ComboE.DryM1.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM2.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM3.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM4.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM5.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM6.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM7.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM8.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM9.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM10.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM11.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM12.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + } + + private void DInit(int select) + { var drtSelected = FreeSqlUnit.Instance.Select(). - Where(x => x.DeviceId == DrySelect() && x.Type == 1).ToList(); + Where(x => x.DeviceId == select && x.Type == 1).ToList(); if (drtSelected.Count != 0) { @@ -246,107 +285,98 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl } var getDryerD1 = LjPlanningPlcHelp.GetDryerD1; + var getDryerD2 = LjPlanningPlcHelp.GetDryerD2; + var getDryerD3 = LjPlanningPlcHelp.GetDryerD3; + var getDryerD4 = LjPlanningPlcHelp.GetDryerD4; - TextE.DryW1.MCValue = getDryerD1.RecipePlcViews[0].Set; - TextE.DryW2.MCValue = getDryerD1.RecipePlcViews[1].Set; - TextE.DryW3.MCValue = getDryerD1.RecipePlcViews[2].Set; - TextE.DryW4.MCValue = getDryerD1.RecipePlcViews[3].Set; - TextE.DryW5.MCValue = getDryerD1.RecipePlcViews[4].Set; - TextE.DryW6.MCValue = getDryerD1.RecipePlcViews[5].Set; - TextE.DryW7.MCValue = getDryerD1.RecipePlcViews[6].Set; - TextE.DryW8.MCValue = getDryerD1.RecipePlcViews[7].Set; - TextE.DryW9.MCValue = getDryerD1.RecipePlcViews[8].Set; - TextE.DryW10.MCValue = getDryerD1.RecipePlcViews[9].Set; - TextE.DryW11.MCValue = getDryerD1.RecipePlcViews[10].Set; - TextE.DryW12.MCValue = getDryerD1.RecipePlcViews[11].Set; - - TextE.DryT1.MCValue = getDryerD1.RecipePlcViews[0].Tolerance; - TextE.DryT2.MCValue = getDryerD1.RecipePlcViews[1].Tolerance; - TextE.DryT3.MCValue = getDryerD1.RecipePlcViews[2].Tolerance; - TextE.DryT4.MCValue = getDryerD1.RecipePlcViews[3].Tolerance; - TextE.DryT5.MCValue = getDryerD1.RecipePlcViews[4].Tolerance; - TextE.DryT6.MCValue = getDryerD1.RecipePlcViews[5].Tolerance; - TextE.DryT7.MCValue = getDryerD1.RecipePlcViews[6].Tolerance; - TextE.DryT8.MCValue = getDryerD1.RecipePlcViews[7].Tolerance; - TextE.DryT9.MCValue = getDryerD1.RecipePlcViews[8].Tolerance; - TextE.DryT10.MCValue = getDryerD1.RecipePlcViews[9].Tolerance; - TextE.DryT11.MCValue = getDryerD1.RecipePlcViews[10].Tolerance; - TextE.DryT12.MCValue = getDryerD1.RecipePlcViews[11].Tolerance; - } + switch (select) + { + case 1: + DryDataShow(getDryerD1); + break; + case 2: + DryDataShow(getDryerD2); + break; + case 3: + DryDataShow(getDryerD3); + break; + case 4: + DryDataShow(getDryerD4); + break; + default: return; + } - #region 帮助类 + } /// - /// 单选选择 + /// 控件从Plc初始化 /// - /// 返回单选的产线号 如果未选择返回0 - private int SingleSelect() + private void ControlInit() { - int no = 0; - if (Convert.ToBoolean(RadioE.Line1.MCValue)) - { - no= 1; - } - else if (Convert.ToBoolean(RadioE.Line2.MCValue)) - { - no= 2; - } - else if (Convert.ToBoolean(RadioE.Line3.MCValue)) - { - no= 3; - } - else if (Convert.ToBoolean(RadioE.Line4.MCValue)) - { - no= 4; - } - else if (Convert.ToBoolean(RadioE.Line5.MCValue)) - { - no= 5; - } - else if (Convert.ToBoolean(RadioE.Line6.MCValue)) - { - no= 6; - } - else if (Convert.ToBoolean(RadioE.Line7.MCValue)) - { - no= 7; - } - else if (Convert.ToBoolean(RadioE.Line8.MCValue)) - { - no= 8; - } - - return no; + + ComboE.ChooseMaterial1.DataSource = StockMaterrialDbHelp.GetSiloMaterrial(); + ComboE.ChooseMaterial2.DataSource = StockMaterrialDbHelp.GetSiloMaterrial(); + + + DB2104Helper waterData = new DB2104Helper(); + + TextE.ColdValueA.MCValue = waterData.GetAColWater.Set; + TextE.ColdValueB.MCValue = waterData.GetBColWater.Set; + TextE.HotValueA.MCValue = waterData.GetAHotWater.Set; + TextE.HotValueB.MCValue = waterData.GetBHotWater.Set; + TextE.ColdToleranceA.MCValue = waterData.GetAColWater.Tolerance; + TextE.ColdToleranceB.MCValue = waterData.GetBColWater.Tolerance; + TextE.HotToleranceA.MCValue = waterData.GetAHotWater.Tolerance; + TextE.HotToleranceB.MCValue = waterData.GetBHotWater.Tolerance; + + ComboE.DryM1.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM2.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM3.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM4.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM5.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM6.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM7.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM8.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM9.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM10.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM11.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + ComboE.DryM12.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); + } + private void DryDataShow(DryerView Dry) + { + TextE.DryW1.MCValue = Dry.RecipePlcViews[0].Set; + TextE.DryW2.MCValue = Dry.RecipePlcViews[1].Set; + TextE.DryW3.MCValue = Dry.RecipePlcViews[2].Set; + TextE.DryW4.MCValue = Dry.RecipePlcViews[3].Set; + TextE.DryW5.MCValue = Dry.RecipePlcViews[4].Set; + TextE.DryW6.MCValue = Dry.RecipePlcViews[5].Set; + TextE.DryW7.MCValue = Dry.RecipePlcViews[6].Set; + TextE.DryW8.MCValue = Dry.RecipePlcViews[7].Set; + TextE.DryW9.MCValue = Dry.RecipePlcViews[8].Set; + TextE.DryW10.MCValue = Dry.RecipePlcViews[9].Set; + TextE.DryW11.MCValue = Dry.RecipePlcViews[10].Set; + TextE.DryW12.MCValue = Dry.RecipePlcViews[11].Set; + } - /// - /// 单混机单选选择 - /// - /// - private int DrySelect() + private void GWDataShow(DryerView Gel, List Wet) { - if (Convert.ToBoolean(RadioE.Dry1.MCValue) == true) - { - return 1; - } - else if (Convert.ToBoolean(RadioE.Dry2.MCValue) == true) - { - return 2; - } - else if (Convert.ToBoolean(RadioE.Dry3.MCValue) == true) - { - return 3; - } - else if (Convert.ToBoolean(RadioE.Dry4.MCValue) == true) - { - return 4; - } - else - { - return 0; - } + TextE.MaterialWeight1.MCValue = Gel.RecipePlcViews[0].Set; + TextE.MaterialWeight2.MCValue = Gel.RecipePlcViews[1].Set; + TextE.GelSpeedSet.MCValue = Gel.RecipeSteps[0].MixSpeed; + TextE.GelPosTimeA.MCValue = Gel.RecipeSteps[2].MixTemp; + TextE.GelNagTimeB.MCValue = Gel.RecipeSteps[2].MixSpeed; + TextE.GelPosTimeC.MCValue = Gel.RecipeSteps[2].MixTime; + TextE.GelWaterTime.MCValue = Gel.RecipeSteps[4].MixTime; + TextE.GelWaitTime.MCValue = Gel.RecipeSteps[6].MixTime; + TextE.GelCloseHeatTime.MCValue = Gel.RecipeSteps[7].MixTime; + TextE.GelOutDelayTime.MCValue = Gel.RecipeSteps[7].MixTemp; + TextE.WetDryWeight.MCValue = Wet[1].SetValue; + TextE.WetMixTime.MCValue = Wet[2].MixTime; + TextE.WetOutDelayTime.MCValue = Wet[4].MixTime; } + #endregion } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs new file mode 100644 index 0000000..95e7174 --- /dev/null +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/PlcAutoWriteHelper.cs @@ -0,0 +1,759 @@ +using DataBlockHelper.DBHelpers; +using DataBlockHelper.Entity.DB2104Entity; +using DevExpress.XtraEditors.Filtering.Templates; +using Mesnac.Action.ChemicalWeighing.AutoControl.DB; +using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; +using Mesnac.Action.ChemicalWeighing.LjMixManager; +using Mesnac.Action.ChemicalWeighing.LjPlanning; +using Mesnac.Controls.Default; +using Mesnac.Core.Service; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using static Mesnac.Action.ChemicalWeighing.AutoControl.AutoLogHelper; + + +namespace Mesnac.Action.ChemicalWeighing.AutoControl +{ + public static class PlcAutoWriteHelper + { + private static int TFlag = 0; + + #region 湿混糊化下传 + + public static void GelWetDownload(MCTextBoxEntity TextE, MCComboBoxEntity ComboE, MCRadioButtonEntity RadioE) + { + + int b1 = Convert.ToInt32(ComboE.ChooseMaterial1.MCValue.ToString()); + int b2 = Convert.ToInt32(ComboE.ChooseMaterial2.MCValue.ToString()); + + short bin1 = (short)StockMaterrialDbHelp.GetCodeById(b1); + short bin2 = (short)StockMaterrialDbHelp.GetCodeById(b2); + + float MatTol1 = Convert.ToSingle(TextE.MaterialTolerance1.MCValue.ToString()); + float MatTol2 = Convert.ToSingle(TextE.MaterialTolerance2.MCValue.ToString()); + + float MatWei1 = Convert.ToSingle(TextE.MaterialWeight1.MCValue.ToString()); + float MatWei2 = Convert.ToSingle(TextE.MaterialWeight2.MCValue.ToString()); + + float GelSpeed = Convert.ToSingle(TextE.GelSpeedSet.MCValue.ToString()); + + float GelPosA = Convert.ToSingle(TextE.GelPosTimeA.MCValue.ToString()); + float GelNagB = Convert.ToSingle(TextE.GelNagTimeB.MCValue.ToString()); + short GelPosC = Convert.ToInt16(TextE.GelPosTimeC.MCValue.ToString()); + + short GelWater = Convert.ToInt16(TextE.GelWaterTime.MCValue.ToString()); + short GelWait = Convert.ToInt16(TextE.GelWaitTime.MCValue.ToString()); + short GelCloseHeat = Convert.ToInt16(TextE.GelCloseHeatTime.MCValue.ToString()); + float GelDelayTime = Convert.ToSingle(TextE.GelOutDelayTime.MCValue.ToString()); + + if (b2 == -1) + { + if (MatTol1 < 0.1) + { + MessageBox.Show("公差不能小于0.1!"); + return; + } + } + else + { + if (MatTol1 < 0.1 || MatTol2 < 0.1) + { + MessageBox.Show("公差不能小于0.1!"); + return; + } + } + + List recipes = new List(); + + RecipePlcView recipe1 = new RecipePlcView() + { + Bin = bin1, + Set = MatWei1, + Tolerance = MatTol1, + }; + RecipePlcView recipe2 = new RecipePlcView() + { + Bin = bin2, + Set = MatWei2, + Tolerance = MatTol2, + }; + + recipes.Add(recipe1); + recipes.Add(recipe2); + + List steps = new List(); + + Step step1 = new Step() + { + MixCode = 1, + MixSpeed = GelSpeed + }; + Step step2 = new Step() + { + MixCode = 2, + }; + Step step3 = new Step() + { + MixCode = 3, + MixTime = GelPosC, + MixTemp = GelPosA, + MixSpeed = GelNagB + }; + Step step4 = new Step() + { + MixCode = 4, + }; + Step step5 = new Step() + { + MixCode = 5, + MixTime = GelWater + }; + Step step6 = new Step() + { + MixCode = 6, + }; + Step step7 = new Step() + { + MixCode = 5, + MixTime = GelWait + }; + Step step8 = new Step() + { + MixCode = 7, + MixTime = GelCloseHeat, + MixTemp = GelDelayTime + }; + + steps.Add(step1); + steps.Add(step2); + steps.Add(step3); + steps.Add(step4); + steps.Add(step5); + steps.Add(step6); + steps.Add(step7); + steps.Add(step8); + + float WetDryWei = Convert.ToSingle(TextE.WetDryWeight.MCValue.ToString()); + short WetMix = Convert.ToInt16(TextE.WetMixTime.MCValue.ToString()); + short WetOutDelay = Convert.ToInt16(TextE.WetOutDelayTime.MCValue.ToString()); + + List mixSteps = new List(); + + MixStep mixStep1 = new MixStep() + { + MixCode = 1, + }; + MixStep mixStep2 = new MixStep() + { + MixCode = 2, + SetValue = WetDryWei + }; + MixStep mixStep3 = new MixStep() + { + MixCode = 3, + MixTime = WetMix + }; + MixStep mixStep4 = new MixStep() + { + MixCode = 4, + }; + MixStep mixStep5 = new MixStep() + { + MixCode = 5, + MixTime = WetOutDelay + }; + + mixSteps.Add(mixStep1); + mixSteps.Add(mixStep2); + mixSteps.Add(mixStep3); + mixSteps.Add(mixStep4); + mixSteps.Add(mixStep5); + + List materials = new List(); + + DeviceMaterrial deviceMaterial1 = new DeviceMaterrial() + { + DeviceId = ControlsHelper.SingleSelect(RadioE), + MaterrialId = b1, + Type = 2, + Code = StockMaterrialDbHelp.GetCodeById(b1) + }; + + DeviceMaterrial deviceMaterial2 = new DeviceMaterrial() + { + DeviceId = ControlsHelper.SingleSelect(RadioE), + MaterrialId = b2, + Type = 2, + Code = StockMaterrialDbHelp.GetCodeById(b2) + }; + + materials.Add(deviceMaterial1); + materials.Add(deviceMaterial2); + + switch (ControlsHelper.SingleSelect(RadioE)) + { + case 1: + LjPlanningPlcHelp.DownG1Recipe(recipes, steps); + LjPlanningPlcHelp.DownM1Recipe(mixSteps); + DeviceMaterrialService.Save(materials); + break; + case 2: + LjPlanningPlcHelp.DownG2Recipe(recipes, steps); + LjPlanningPlcHelp.DownM2Recipe(mixSteps); + DeviceMaterrialService.Save(materials); + break; + case 3: + LjPlanningPlcHelp.DownG3Recipe(recipes, steps); + LjPlanningPlcHelp.DownM3Recipe(mixSteps); + DeviceMaterrialService.Save(materials); + break; + case 4: + LjPlanningPlcHelp.DownG4Recipe(recipes, steps); + LjPlanningPlcHelp.DownM4Recipe(mixSteps); + DeviceMaterrialService.Save(materials); + break; + case 5: + LjPlanningPlcHelp.DownG5Recipe(recipes, steps); + LjPlanningPlcHelp.DownM5Recipe(mixSteps); + DeviceMaterrialService.Save(materials); + break; + case 6: + LjPlanningPlcHelp.DownG6Recipe(recipes, steps); + LjPlanningPlcHelp.DownM6Recipe(mixSteps); + DeviceMaterrialService.Save(materials); + break; + case 7: + LjPlanningPlcHelp.DownG7Recipe(recipes, steps); + LjPlanningPlcHelp.DownM7Recipe(mixSteps); + DeviceMaterrialService.Save(materials); + break; + case 8: + LjPlanningPlcHelp.DownG8Recipe(recipes, steps); + LjPlanningPlcHelp.DownM8Recipe(mixSteps); + DeviceMaterrialService.Save(materials); + break; + default: + MessageBox.Show("请选择一条产线!"); + return; + } + + GWlog(recipes, steps, mixSteps, RadioE); + } + + #endregion + + #region 干混下传 + + public static void DryDownload(MCTextBoxEntity TextE, MCComboBoxEntity ComboE, MCRadioButtonEntity RadioE) + { + List recipes = new List(); + + List steps = new List(); + + List materials = new List(); + + DryerGetValue(ComboE.DryM1, TextE.DryW1, TextE.DryT1, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM2, TextE.DryW2, TextE.DryT2, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM3, TextE.DryW3, TextE.DryT3, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM4, TextE.DryW4, TextE.DryT4, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM5, TextE.DryW5, TextE.DryT5, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM6, TextE.DryW6, TextE.DryT6, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM7, TextE.DryW7, TextE.DryT7, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM8, TextE.DryW8, TextE.DryT8, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM9, TextE.DryW9, TextE.DryT9, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM10, TextE.DryW10, TextE.DryT10, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM11, TextE.DryW11, TextE.DryT11, recipes, materials, RadioE); + DryerGetValue(ComboE.DryM12, TextE.DryW12, TextE.DryT12, recipes, materials, RadioE); + + if (TFlag == 1) + { + MessageBox.Show("公差不能小于0.1!"); + TFlag = 0; + return; + } + + switch (ControlsHelper.DrySelect(RadioE)) + { + case 1: + LjPlanningPlcHelp.DownD1Recipe(recipes, steps); + DeviceMaterrialService.Save(materials); + break; + case 2: + LjPlanningPlcHelp.DownD2Recipe(recipes, steps); + DeviceMaterrialService.Save(materials); + break; + case 3: + LjPlanningPlcHelp.DownD3Recipe(recipes, steps); + DeviceMaterrialService.Save(materials); + break; + case 4: + LjPlanningPlcHelp.DownD4Recipe(recipes, steps); + DeviceMaterrialService.Save(materials); + break; + } + } + + #endregion + + #region 水称下传 + + public static void WaterDownload(MCTextBoxEntity TextE) + { + WaterEntity HotA = new WaterEntity(); + WaterEntity ColdA = new WaterEntity(); + WaterEntity HotB = new WaterEntity(); + WaterEntity ColdB = new WaterEntity(); + + float hotASet, hotBSet, coldASet, coldBSet, hotATol, hotBTol, coldATol, coldBTol; + + if (float.TryParse(Convert.ToString(TextE.HotValueA.MCValue), out hotASet) && + float.TryParse(Convert.ToString(TextE.HotToleranceA.MCValue), out hotATol) && + float.TryParse(Convert.ToString(TextE.HotValueB.MCValue), out hotBSet) && + float.TryParse(Convert.ToString(TextE.HotToleranceB.MCValue), out hotBTol) && + float.TryParse(Convert.ToString(TextE.ColdValueA.MCValue), out coldASet) && + float.TryParse(Convert.ToString(TextE.ColdToleranceA.MCValue), out coldATol) && + float.TryParse(Convert.ToString(TextE.ColdValueB.MCValue), out coldBSet) && + float.TryParse(Convert.ToString(TextE.ColdToleranceB.MCValue), out coldBTol)) + { + HotA.Set = hotASet; + HotB.Set = hotBSet; + ColdA.Set = coldASet; + ColdB.Set = coldBSet; + HotA.Tolerance = hotATol; + HotB.Tolerance = hotBTol; + ColdA.Tolerance = coldATol; + ColdB.Tolerance = coldBTol; + Db2104WriteHelper.WriteAHostWater(HotA); + Db2104WriteHelper.WriteBHostWater(HotB); + Db2104WriteHelper.WriteAColWater(ColdA); + Db2104WriteHelper.WriteBColWater(ColdB); + MesnacServiceManager.Instance.LoggingService.Info("水称数据下发成功!"); + MessageBox.Show("水称数据下发成功"); + } + else + { + MesnacServiceManager.Instance.LoggingService.Info("输入数值的格式有误"); + MessageBox.Show("输入数值的格式有误!"); + return; + } + } + + #endregion + + #region 手动控制 + + #region 糊化锅手动下粉料 + + public static bool GelPowderDownload(MCRadioButtonEntity RadioE) + { + bool isReady; + + switch (ControlsHelper.SingleSelect(RadioE)) + { + case 1: + isReady = DB2105WriteHelper.WriteG1Pd(); + break; + case 2: + isReady = DB2105WriteHelper.WriteG2Pd(); + break; + case 3: + isReady = DB2105WriteHelper.WriteG3Pd(); + break; + case 4: + isReady = DB2105WriteHelper.WriteG4Pd(); + break; + case 5: + isReady = DB2105WriteHelper.WriteG5Pd(); + break; + case 6: + isReady = DB2105WriteHelper.WriteG6Pd(); + break; + case 7: + isReady = DB2105WriteHelper.WriteG7Pd(); + break; + case 8: + isReady = DB2105WriteHelper.WriteG8Pd(); + break; + default: + isReady = false; + MessageBox.Show("当前未选择产线!"); + break; + } + + return isReady; + } + + #endregion + + #region 糊化锅手动加冷水 + + public static bool GelColdWaterDownload(MCRadioButtonEntity RadioE) + { + bool isReady; + + switch (ControlsHelper.SingleSelect(RadioE)) + { + case 1: + isReady = DB2105WriteHelper.WriteG1Cw(); + break; + case 2: + isReady = DB2105WriteHelper.WriteG2Cw(); + break; + case 3: + isReady = DB2105WriteHelper.WriteG3Cw(); + break; + case 4: + isReady = DB2105WriteHelper.WriteG4Cw(); + break; + case 5: + isReady = DB2105WriteHelper.WriteG5Cw(); + break; + case 6: + isReady = DB2105WriteHelper.WriteG6Cw(); + break; + case 7: + isReady = DB2105WriteHelper.WriteG7Cw(); + break; + case 8: + isReady = DB2105WriteHelper.WriteG8Cw(); + break; + default: + isReady = false; + MessageBox.Show("当前未选择产线!"); + break; + } + + return isReady; + } + + #endregion + + #region 糊化锅手动加热水 + + public static bool GelHotWaterDownload(MCRadioButtonEntity RadioE) + { + bool isReady; + + switch (ControlsHelper.SingleSelect(RadioE)) + { + case 1: + isReady = DB2105WriteHelper.WriteG1Hw(); + break; + case 2: + isReady = DB2105WriteHelper.WriteG2Hw(); + break; + case 3: + isReady = DB2105WriteHelper.WriteG3Hw(); + break; + case 4: + isReady = DB2105WriteHelper.WriteG4Hw(); + break; + case 5: + isReady = DB2105WriteHelper.WriteG5Hw(); + break; + case 6: + isReady = DB2105WriteHelper.WriteG6Hw(); + break; + case 7: + isReady = DB2105WriteHelper.WriteG7Hw(); + break; + case 8: + isReady = DB2105WriteHelper.WriteG8Hw(); + break; + default: + isReady = false; + MessageBox.Show("当前未选择产线!"); + break; + } + + return isReady; + } + + #endregion + + #region 湿混机手动下糊化料 + + public static bool WetGelatDownload(MCRadioButtonEntity RadioE) + { + bool isReady; + + switch (ControlsHelper.SingleSelect(RadioE)) + { + case 1: + isReady = DB2105WriteHelper.WriteM1(); + break; + case 2: + isReady = DB2105WriteHelper.WriteM2(); + break; + case 3: + isReady = DB2105WriteHelper.WriteM3(); + break; + case 4: + isReady = DB2105WriteHelper.WriteM4(); + break; + case 5: + isReady = DB2105WriteHelper.WriteM5(); + break; + case 6: + isReady = DB2105WriteHelper.WriteM6(); + break; + case 7: + isReady = DB2105WriteHelper.WriteM7(); + break; + case 8: + isReady = DB2105WriteHelper.WriteM8(); + break; + default: + isReady = false; + MessageBox.Show("当前未选择产线!"); + break; + } + + return isReady; + } + + #endregion + + #region 湿混机手动下粉料 + + public static void WetGelatDownload(MCTextBoxEntity TextE, MCRadioButtonEntity RadioE) + { + float t = Convert.ToSingle(TextE.ManualTolerance.MCValue.ToString()); + float w = Convert.ToSingle(TextE.ManualWeight.MCValue.ToString()); + + if (t < 0.1) + { + MessageBox.Show("公差不能小于0.1!"); + return; + } + + SetValue value = new SetValue() + { + Value = w, + Toterance = t + }; + + switch (ControlsHelper.SingleSelect(RadioE)) + { + case 1: + DB2105WriteHelper.WriteManScrewH1(); + DB2105WriteHelper.WriteSetValueH1(value); + break; + case 2: + DB2105WriteHelper.WriteManScrewH2(); + DB2105WriteHelper.WriteSetValueH1(value); + break; + case 3: + DB2105WriteHelper.WriteManScrewH3(); + DB2105WriteHelper.WriteSetValueH2(value); + break; + case 4: + DB2105WriteHelper.WriteManScrewH4(); + DB2105WriteHelper.WriteSetValueH2(value); + break; + + case 5: + DB2105WriteHelper.WriteManScrewH5(); + DB2105WriteHelper.WriteSetValueH3(value); + break; + case 6: + DB2105WriteHelper.WriteManScrewH6(); + DB2105WriteHelper.WriteSetValueH3(value); + break; + case 7: + DB2105WriteHelper.WriteManScrewH7(); + DB2105WriteHelper.WriteSetValueH4(value); + break; + case 8: + DB2105WriteHelper.WriteManScrewH8(); + DB2105WriteHelper.WriteSetValueH4(value); + break; + default: + MessageBox.Show("当前未选择产线!"); + return; + } + + ManualWeightLog(w, t, RadioE); + + } + + #endregion + + #endregion + + #region 产线启停 + + #region 产线启动 + + public static void LineStart(MCRadioButtonEntity RadioE) + { + switch (ControlsHelper.SingleSelect(RadioE)) + { + case 1: + DB2105WriteHelper.WriteStartJob1(); + break; + case 2: + DB2105WriteHelper.WriteStartJob2(); + break; + case 3: + DB2105WriteHelper.WriteStartJob3(); + break; + case 4: + DB2105WriteHelper.WriteStartJob4(); + break; + case 5: + DB2105WriteHelper.WriteStartJob5(); + break; + case 6: + DB2105WriteHelper.WriteStartJob6(); + break; + case 7: + DB2105WriteHelper.WriteStartJob7(); + break; + case 8: + DB2105WriteHelper.WriteStartJob8(); + break; + default: + MessageBox.Show("请选择一条产线!"); + return; + } + + SingleLog("产线启动", RadioE); + } + + #endregion + + #region 产线停止 + + public static void LineStop(MCRadioButtonEntity RadioE) + { + switch (ControlsHelper.SingleSelect(RadioE)) + { + case 1: + DB2105WriteHelper.WriteStopJob1(); + break; + case 2: + DB2105WriteHelper.WriteStopJob2(); + break; + case 3: + DB2105WriteHelper.WriteStopJob3(); + break; + case 4: + DB2105WriteHelper.WriteStopJob4(); + break; + case 5: + DB2105WriteHelper.WriteStopJob5(); + break; + case 6: + DB2105WriteHelper.WriteStopJob6(); + break; + case 7: + DB2105WriteHelper.WriteStopJob7(); + break; + case 8: + DB2105WriteHelper.WriteStopJob8(); + break; + default: + MessageBox.Show("请选择一条产线!"); + return; + } + + SingleLog("产线停止", RadioE); + } + + #endregion + + #endregion + + #region 维修模式 + + public static void RepairOnOff(MCLabelEntity LabelE, MCRadioButtonEntity RadioE) + { + if (LabelE.RepairState.MCValue.ToString() == "关") + { + + if (MessageBox.Show("是否开启维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + Db3000Helper.WriteModel(ControlsHelper.SingleSelect(RadioE), true); + LabelE.RepairState.MCValue = "开"; + + SingleLog("维修模式开启", RadioE); + + MessageBox.Show("维修模式已开启"); + + } + else + { + if (LabelE.RepairState.MCValue.ToString() == "开") + { + if (MessageBox.Show("是否关闭维修模式?", "维修模式确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) + { + return; + } + Db3000Helper.WriteModel(ControlsHelper.SingleSelect(RadioE), false); + LabelE.RepairState.MCValue = "关"; + + SingleLog("维修模式关闭", RadioE); + + MessageBox.Show("维修模式已关闭"); + + } + } + } + + #endregion + + #region 湿混机物料封装 + + /// + /// 干混机数据打包封装 + /// + /// 物料类型 + /// 重量 + /// 公差 + /// 物料集合 + /// 步骤集合 + /// 数据库物料记录 + private static void DryerGetValue(MCCombobox DryM, MCTextBox DryW, MCTextBox DryT, + List recipes, List materials, MCRadioButtonEntity RadioE) + { + int b = Convert.ToInt32(DryM.MCValue.ToString()); + short bin = (short)StockMaterrialDbHelp.GetCodeById(b); + float w = Convert.ToSingle(DryW.MCValue.ToString()); + float t = Convert.ToSingle(DryT.MCValue.ToString()); + + if (b != -1 && t < 0.1) + { + TFlag = 1; + } + + RecipePlcView recipe1 = new RecipePlcView() + { + Bin = bin, + Set = w, + Tolerance = t, + }; + + recipes.Add(recipe1); + + DeviceMaterrial deviceMaterial1 = new DeviceMaterrial() + { + DeviceId = ControlsHelper.DrySelect(RadioE), + MaterrialId = b, + Type = 1, + Code = StockMaterrialDbHelp.GetCodeById(b) + }; + + materials.Add(deviceMaterial1); + + } + + #endregion + } +} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/RefreshAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/RefreshAction.cs deleted file mode 100644 index b208072..0000000 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/AutoControl/RefreshAction.cs +++ /dev/null @@ -1,318 +0,0 @@ -using DataBlockHelper.Entity.DB2106Entity; -using HslCommunication.Instrument.DLT; -using Mesnac.Action.Base; -using Mesnac.Action.ChemicalWeighing.AutoControl.DB; -using Mesnac.Action.ChemicalWeighing.AutoControl.Entity; -using Mesnac.Action.ChemicalWeighing.FreeDb; -using Mesnac.Action.ChemicalWeighing.LjMixManager; -using Mesnac.Action.ChemicalWeighing.LjPlanning; -using Mesnac.Controls.Base; -using Mesnac.Controls.Default; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Mesnac.Action.ChemicalWeighing.AutoControl -{ - public class RefreshAction : ChemicalWeighingAction, IAction - { - private List McControls; - MCTextBoxEntity TextE = new MCTextBoxEntity(); - ButtonEntity ButtonE = new ButtonEntity(); - MCLabelEntity LabelE = new MCLabelEntity(); - MCComboBoxEntity ComboE = new MCComboBoxEntity(); - MCRadioButtonEntity RadioE = new MCRadioButtonEntity(); - - public void Run(RuntimeParameter runtime) - { - - base.RunIni(runtime); //必须要调用 - - McControls = GetAllControls(); - - ControlsHelper.ControlImport(TextE, ButtonE, ComboE, LabelE, RadioE, McControls); - - ControlInitFromPLC(); - - } - - - - #region 控件初始化 - - /// - /// 控件从Plc初始化 - /// - private void ControlInitFromPLC() - { - //switch (SingleSelect()) - //{ - // case 1: - // LjPlanningPlcHelp.GetGelatG1. - //} - ComboE.ChooseMaterial1.DataSource = StockMaterrialDbHelp.GetSiloMaterrial(); - ComboE.ChooseMaterial2.DataSource = StockMaterrialDbHelp.GetSiloMaterrial(); - - var selected = FreeSqlUnit.Instance.Select().Where(x => x.DeviceId == SingleSelect() && x.Type == 2).ToList(); - - if (selected.Count != 0) - { - ComboE.ChooseMaterial1.SelectedValue = selected[0].MaterrialId; - ComboE.ChooseMaterial2.SelectedValue = selected[1].MaterrialId; - } - else - { - ComboE.ChooseMaterial1.SelectedIndex = 0; - ComboE.ChooseMaterial2.SelectedIndex = 0; - } - - var getGelatG1 = LjPlanningPlcHelp.GetGelatG1; - var getWeterM1 = LjPlanningPlcHelp.GetWeterM1; - var getGelatG2 = LjPlanningPlcHelp.GetGelatG2; - var getWeterM2 = LjPlanningPlcHelp.GetWeterM2; - var getGelatG3 = LjPlanningPlcHelp.GetGelatG3; - var getWeterM3 = LjPlanningPlcHelp.GetWeterM3; - var getGelatG4 = LjPlanningPlcHelp.GetGelatG4; - var getWeterM4 = LjPlanningPlcHelp.GetWeterM4; - var getGelatG5 = LjPlanningPlcHelp.GetGelatG5; - var getWeterM5 = LjPlanningPlcHelp.GetWeterM5; - var getGelatG6 = LjPlanningPlcHelp.GetGelatG6; - var getWeterM6 = LjPlanningPlcHelp.GetWeterM6; - var getGelatG7 = LjPlanningPlcHelp.GetGelatG7; - var getWeterM7 = LjPlanningPlcHelp.GetWeterM7; - var getGelatG8 = LjPlanningPlcHelp.GetGelatG8; - var getWeterM8 = LjPlanningPlcHelp.GetWeterM8; - - switch (SingleSelect()) - { - case 1: - GWDataShow(getGelatG1, getWeterM1); - break; - case 2: - GWDataShow(getGelatG2, getWeterM2); - break; - case 3: - GWDataShow(getGelatG3, getWeterM3); - break; - case 4: - GWDataShow(getGelatG4, getWeterM4); - break; - case 5: - GWDataShow(getGelatG5, getWeterM5); - break; - case 6: - GWDataShow(getGelatG6, getWeterM6); - break; - case 7: - GWDataShow(getGelatG7, getWeterM7); - break; - case 8: - GWDataShow(getGelatG8, getWeterM8); - break; - default: - return; - - } - - ComboE.DryM1.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM2.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM3.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM4.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM5.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM6.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM7.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM8.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM9.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM10.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM11.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - ComboE.DryM12.DataSource = StockMaterrialDbHelp.GetDryerMaterrial(); - - var drtSelected = FreeSqlUnit.Instance.Select(). - Where(x => x.DeviceId == DrySelect() && x.Type == 1).ToList(); - - if (drtSelected.Count != 0) - { - ComboE.DryM1.SelectedValue = drtSelected[0].MaterrialId; - ComboE.DryM2.SelectedValue = drtSelected[1].MaterrialId; - ComboE.DryM3.SelectedValue = drtSelected[2].MaterrialId; - ComboE.DryM4.SelectedValue = drtSelected[3].MaterrialId; - ComboE.DryM5.SelectedValue = drtSelected[4].MaterrialId; - ComboE.DryM6.SelectedValue = drtSelected[5].MaterrialId; - ComboE.DryM7.SelectedValue = drtSelected[6].MaterrialId; - ComboE.DryM8.SelectedValue = drtSelected[7].MaterrialId; - ComboE.DryM9.SelectedValue = drtSelected[8].MaterrialId; - ComboE.DryM10.SelectedValue = drtSelected[9].MaterrialId; - ComboE.DryM11.SelectedValue = drtSelected[10].MaterrialId; - ComboE.DryM12.SelectedValue = drtSelected[11].MaterrialId; - } - else - { - ComboE.DryM1.SelectedIndex = 0; - ComboE.DryM2.SelectedIndex = 0; - ComboE.DryM3.SelectedIndex = 0; - ComboE.DryM4.SelectedIndex = 0; - ComboE.DryM5.SelectedIndex = 0; - ComboE.DryM6.SelectedIndex = 0; - ComboE.DryM7.SelectedIndex = 0; - ComboE.DryM8.SelectedIndex = 0; - ComboE.DryM9.SelectedIndex = 0; - ComboE.DryM10.SelectedIndex = 0; - ComboE.DryM11.SelectedIndex = 0; - ComboE.DryM12.SelectedIndex = 0; - } - - var getDryerD1 = LjPlanningPlcHelp.GetDryerD1; - var getDryerD2 = LjPlanningPlcHelp.GetDryerD2; - var getDryerD3 = LjPlanningPlcHelp.GetDryerD3; - var getDryerD4 = LjPlanningPlcHelp.GetDryerD4; - - switch (DrySelect()) - { - case 1: - DryDataShow(getDryerD1); - break; - case 2: - DryDataShow(getDryerD2); - break; - case 3: - DryDataShow(getDryerD3); - break; - case 4: - DryDataShow(getDryerD4); - break; - default: return; - } - - } - - private void DryDataShow(DryerView Dry) - { - TextE.DryW1.MCValue = Dry.RecipePlcViews[0].Set; - TextE.DryW2.MCValue = Dry.RecipePlcViews[1].Set; - TextE.DryW3.MCValue = Dry.RecipePlcViews[2].Set; - TextE.DryW4.MCValue = Dry.RecipePlcViews[3].Set; - TextE.DryW5.MCValue = Dry.RecipePlcViews[4].Set; - TextE.DryW6.MCValue = Dry.RecipePlcViews[5].Set; - TextE.DryW7.MCValue = Dry.RecipePlcViews[6].Set; - TextE.DryW8.MCValue = Dry.RecipePlcViews[7].Set; - TextE.DryW9.MCValue = Dry.RecipePlcViews[8].Set; - TextE.DryW10.MCValue = Dry.RecipePlcViews[9].Set; - TextE.DryW11.MCValue = Dry.RecipePlcViews[10].Set; - TextE.DryW12.MCValue = Dry.RecipePlcViews[11].Set; - - TextE.DryT1.MCValue = Dry.RecipePlcViews[0].Tolerance; - TextE.DryT2.MCValue = Dry.RecipePlcViews[1].Tolerance; - TextE.DryT3.MCValue = Dry.RecipePlcViews[2].Tolerance; - TextE.DryT4.MCValue = Dry.RecipePlcViews[3].Tolerance; - TextE.DryT5.MCValue = Dry.RecipePlcViews[4].Tolerance; - TextE.DryT6.MCValue = Dry.RecipePlcViews[5].Tolerance; - TextE.DryT7.MCValue = Dry.RecipePlcViews[6].Tolerance; - TextE.DryT8.MCValue = Dry.RecipePlcViews[7].Tolerance; - TextE.DryT9.MCValue = Dry.RecipePlcViews[8].Tolerance; - TextE.DryT10.MCValue = Dry.RecipePlcViews[9].Tolerance; - TextE.DryT11.MCValue = Dry.RecipePlcViews[10].Tolerance; - TextE.DryT12.MCValue = Dry.RecipePlcViews[11].Tolerance; - } - - private void GWDataShow(DryerView Gel, List Wet) - { - TextE.MaterialWeight1.MCValue = Gel.RecipePlcViews[0].Set; - TextE.MaterialWeight2.MCValue = Gel.RecipePlcViews[1].Set; - //TextE.MaterialTolerance1.MCValue = Gel.RecipePlcViews[0].Tolerance; - //TextE.MaterialTolerance2.MCValue = Gel.RecipePlcViews[1].Tolerance; - TextE.GelSpeedSet.MCValue = Gel.RecipeSteps[0].MixSpeed; - TextE.GelPosTimeA.MCValue = Gel.RecipeSteps[2].MixTemp; - TextE.GelNagTimeB.MCValue = Gel.RecipeSteps[2].MixSpeed; - TextE.GelPosTimeC.MCValue = Gel.RecipeSteps[2].MixTime; - TextE.GelWaterTime.MCValue = Gel.RecipeSteps[4].MixTime; - TextE.GelWaitTime.MCValue = Gel.RecipeSteps[6].MixTime; - TextE.GelCloseHeatTime.MCValue = Gel.RecipeSteps[7].MixTime; - TextE.GelOutDelayTime.MCValue = Gel.RecipeSteps[7].MixTemp; - TextE.WetDryWeight.MCValue = Wet[1].SetValue; - TextE.WetMixTime.MCValue = Wet[2].MixTime; - TextE.WetOutDelayTime.MCValue = Wet[4].MixTime; - } - - #endregion - - #region 辅助类 - - /// - /// 单选选择 - /// - /// 返回单选的产线号 如果未选择返回0 - private int SingleSelect() - { - if (Convert.ToBoolean(RadioE.Line1.MCValue) == true) - { - return 1; - } - else if (Convert.ToBoolean(RadioE.Line2.MCValue) == true) - { - return 2; - } - else if (Convert.ToBoolean(RadioE.Line3.MCValue) == true) - { - return 3; - } - else if (Convert.ToBoolean(RadioE.Line4.MCValue) == true) - { - return 4; - } - else if (Convert.ToBoolean(RadioE.Line5.MCValue) == true) - { - return 5; - } - else if (Convert.ToBoolean(RadioE.Line6.MCValue) == true) - { - return 6; - } - else if (Convert.ToBoolean(RadioE.Line7.MCValue) == true) - { - return 7; - } - else if (Convert.ToBoolean(RadioE.Line8.MCValue) == true) - { - return 8; - } - else - { - return 0; - } - } - - /// - /// 单混机单选选择 - /// - /// - private int DrySelect() - { - if (Convert.ToBoolean(RadioE.Dry1.MCValue) == true) - { - return 1; - } - else if (Convert.ToBoolean(RadioE.Dry2.MCValue) == true) - { - return 2; - } - else if (Convert.ToBoolean(RadioE.Dry3.MCValue) == true) - { - return 3; - } - else if (Convert.ToBoolean(RadioE.Dry4.MCValue) == true) - { - return 4; - } - else - { - return 0; - } - } - #endregion - - } -} diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj index 98ba46d..a6784d7 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj @@ -219,6 +219,7 @@ + @@ -227,7 +228,7 @@ - + diff --git a/Main/MCEdit/Data/EventConfig/小料称量/自动控制.xml b/Main/MCEdit/Data/EventConfig/小料称量/自动控制.xml index 994f815..72d01fc 100644 --- a/Main/MCEdit/Data/EventConfig/小料称量/自动控制.xml +++ b/Main/MCEdit/Data/EventConfig/小料称量/自动控制.xml @@ -10,10 +10,6 @@ 自动界面初始化 自动界面初始化 - - 刷新事件 - 刷新事件 - @@ -25,16 +21,12 @@ - - - - \ No newline at end of file diff --git a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml index 92d18b6..8745c84 100644 --- a/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml +++ b/Main/MCEdit/Data/MCProject/nodeForm/AutoControlC.xml @@ -1,6 +1,6 @@ - + AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAKAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIERCRTgxOTNENDE2MDRBRDVCOTRBRTNDMkQzNDc1MUQyBgYAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2BgcAAAAY6Ieq5Yqo5o6n5Yi25oyJ6ZKu5LqL5Lu2Cw== @@ -21,7 +21,7 @@ 水称下传 宋体, 12pt 516, 544 - WaterDownLoad + WaterDownload 174, 50 66