using System.Collections; using System.Collections.Generic; namespace Mesnac.Action.ChemicalWeighing.LjElectrical { public class ElectricalPlc { private static BasePlcHelper GetPlcHelper => BasePlcHelper.Instance; private static void Down1324(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedD1, view.Speed); } } private static ElectricalView Up1324() { ElectricalView view = new ElectricalView(); view.Id = 1; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedD1.NowValue.ToFloat(); return view; } // // // // private static ElectricalView Up1328() { ElectricalView view = new ElectricalView(); view.Id = 2; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedD2.NowValue.ToFloat(); return view; } private static void Down1328(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedD2, view.Speed); } } private static ElectricalView Up1332() { ElectricalView view = new ElectricalView(); view.Id = 3; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedD3.NowValue.ToFloat(); return view; } private static void Down1332(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedD3, view.Speed); } } private static ElectricalView Up1336() { ElectricalView view = new ElectricalView(); view.Id = 4; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedD3.NowValue.ToFloat(); return view; } private static void Down1336(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedD4, view.Speed); } } private static ElectricalView Up1340() { ElectricalView view = new ElectricalView(); view.Id = 5; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedG1.NowValue.ToFloat(); return view; } private static void Down1340(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedG1, view.Speed); } } private static ElectricalView Up1344() { ElectricalView view = new ElectricalView(); view.Id = 6; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedG2.NowValue.ToFloat(); return view; } private static void Down1344(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedG2, view.Speed); } } private static ElectricalView Up1348() { ElectricalView view = new ElectricalView(); view.Id = 7; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedG3.NowValue.ToFloat(); return view; } private static void Down1348(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedG3, view.Speed); } } private static ElectricalView Up1352() { ElectricalView view = new ElectricalView(); view.Id = 8; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedG4.NowValue.ToFloat(); return view; } private static void Down1352(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedG4, view.Speed); } } private static ElectricalView Up1356() { ElectricalView view = new ElectricalView(); view.Id = 9; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedG5.NowValue.ToFloat(); return view; } private static void Down1356(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedG5, view.Speed); } } private static ElectricalView Up1360() { ElectricalView view = new ElectricalView(); view.Id = 10; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedG6.NowValue.ToFloat(); return view; } private static void Down1360(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedG6, view.Speed); } } private static ElectricalView Up1364() { ElectricalView view = new ElectricalView(); view.Id = 11; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedG7.NowValue.ToFloat(); return view; } private static void Down1364(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedG7, view.Speed); } } private static ElectricalView Up1368() { ElectricalView view = new ElectricalView(); view.Id = 12; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedG8.NowValue.ToFloat(); return view; } private static void Down1368(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedG8, view.Speed); } } private static ElectricalView Up1372() { ElectricalView view = new ElectricalView(); view.Id = 13; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedH1.NowValue.ToFloat(); return view; } private static void Down1372(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedH1, view.Speed); } } private static ElectricalView Up1376() { ElectricalView view = new ElectricalView(); view.Id = 14; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedH2.NowValue.ToFloat(); return view; } private static void Down1376(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedH2, view.Speed); } } private static ElectricalView Up1380() { ElectricalView view = new ElectricalView(); view.Id = 15; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedH3.NowValue.ToFloat(); return view; } private static void Down1380(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedH3, view.Speed); } } private static ElectricalView Up1384() { ElectricalView view = new ElectricalView(); view.Id = 16; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedH4.NowValue.ToFloat(); return view; } private static void Down1384(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedH4, view.Speed); } } private static ElectricalView Up1388() { ElectricalView view = new ElectricalView(); view.Id = 17; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedS1.NowValue.ToFloat(); return view; } private static void Down1388(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedS1, view.Speed); } } private static ElectricalView Up1392() { ElectricalView view = new ElectricalView(); view.Id = 18; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedS5.NowValue.ToFloat(); return view; } private static void Down1392(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedS5, view.Speed); } } private static ElectricalView Up1396() { ElectricalView view = new ElectricalView(); view.Id = 19; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedS7.NowValue.ToFloat(); return view; } private static void Down1396(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedS7, view.Speed); } } private static ElectricalView Up1400() { ElectricalView view = new ElectricalView(); view.Id = 20; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedS11.NowValue.ToFloat(); return view; } private static void Down1400(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedS11, view.Speed); } } private static ElectricalView Up1404() { ElectricalView view = new ElectricalView(); view.Id = 21; var basePlcHelper = GetPlcHelper; view.Speed = basePlcHelper.SpeedS15.NowValue.ToFloat(); return view; } private static void Down1404(ElectricalView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.SpeedS15, view.Speed); } } public static IList UpFromPlc() { IList ls = new List(); ls.Add(Up1324()); ls.Add(Up1328()); ls.Add(Up1332()); ls.Add(Up1336()); ls.Add(Up1340()); ls.Add(Up1344()); ls.Add(Up1348()); ls.Add(Up1352()); ls.Add(Up1356()); ls.Add(Up1360()); ls.Add(Up1364()); ls.Add(Up1368()); ls.Add(Up1372()); ls.Add(Up1376()); ls.Add(Up1380()); ls.Add(Up1384()); ls.Add(Up1388()); ls.Add(Up1392()); ls.Add(Up1396()); ls.Add(Up1400()); ls.Add(Up1404()); return ls; } public static ElectricalView UpFromPlc(int id) { ElectricalView view = new ElectricalView(); switch (id) { case 1: view = Up1324(); break; case 2: view = Up1328(); break; case 3: view = Up1332(); break; case 4: view = Up1336(); break; case 5: view = Up1340(); break; case 6: view = Up1344(); break; case 7: view = Up1348(); break; case 8: view = Up1352(); break; case 9: view = Up1356(); break; case 10: view = Up1360(); break; case 11: view = Up1364(); break; case 12: view = Up1368(); break; case 13: view = Up1372(); break; case 14: view = Up1376(); break; case 15: view = Up1380(); break; case 16: view = Up1384(); break; case 17: view = Up1388(); break; case 18: view = Up1392(); break; case 19: view = Up1396(); break; case 20: view = Up1400(); break; case 21: view = Up1404(); break; } return view; } public static void DownToPlc(List views) { foreach (var view in views) { switch (view.Id) { case 1: Down1324(view); break; case 2: Down1328(view); break; case 3: Down1332(view); break; case 4: Down1336(view); break; case 5: Down1340(view); break; case 6: Down1344(view); break; case 7: Down1348(view); break; case 8: Down1352(view); break; case 9: Down1356(view); break; case 10: Down1360(view); break; case 11: Down1364(view); break; case 12: Down1368(view); break; case 13: Down1372(view); break; case 14: Down1376(view); break; case 15: Down1380(view); break; case 16: Down1384(view); break; case 17: Down1388(view); break; case 18: Down1392(view); break; case 19: Down1396(view); break; case 20: Down1400(view); break; case 21: Down1404(view); break; } } } } }