using System.Collections.Generic; namespace Mesnac.Action.ChemicalWeighing.LjProportional { public class ProportionalPlc { private static BasePlcHelper GetPlcHelper => BasePlcHelper.Instance; private static void Down614(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.conveyV1_SV, view.SV); } } private static ProportionalSettingView Up614() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 1, PV = basePlcHelper.conveyV1_PV.NowValue.ToFloat(), SV = basePlcHelper.conveyV1_SV.NowValue.ToFloat() }; return vi; } private static void Down622(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.purgeV1_SV, view.SV); } } private static ProportionalSettingView Up622() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 2, PV = basePlcHelper.purgeV1_PV.NowValue.ToFloat(), SV = basePlcHelper.purgeV1_SV.NowValue.ToFloat() }; return vi; } private static void Down630(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.conveyV2_SV, view.SV); } } private static ProportionalSettingView Up630() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 3, PV = basePlcHelper.conveyV2_PV.NowValue.ToFloat(), SV = basePlcHelper.conveyV2_SV.NowValue.ToFloat() }; return vi; } private static void Down638(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.purgeV2_SV, view.SV); } } private static ProportionalSettingView Up638() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 4, PV = basePlcHelper.purgeV2_PV.NowValue.ToFloat(), SV = basePlcHelper.purgeV2_SV.NowValue.ToFloat() }; return vi; } private static void Down646(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.conveyV3_SV, view.SV); } } private static ProportionalSettingView Up646() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 5, PV = basePlcHelper.conveyV3_PV.NowValue.ToFloat(), SV = basePlcHelper.conveyV3_SV.NowValue.ToFloat() }; return vi; } private static void Down654(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.purgeV3_SV, view.SV); } } private static ProportionalSettingView Up654() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 6, PV = basePlcHelper.purgeV3_PV.NowValue.ToFloat(), SV = basePlcHelper.purgeV3_SV.NowValue.ToFloat() }; return vi; } private static void Down662(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.conveyV4_SV, view.SV); } } private static ProportionalSettingView Up662() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 7, PV = basePlcHelper.conveyV4_PV.NowValue.ToFloat(), SV = basePlcHelper.conveyV4_SV.NowValue.ToFloat() }; return vi; } private static void Down670(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.purgeV4_SV, view.SV); } } private static ProportionalSettingView Up670() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 8, PV = basePlcHelper.purgeV4_PV.NowValue.ToFloat(), SV = basePlcHelper.purgeV4_SV.NowValue.ToFloat() }; return vi; } private static void Down678(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.conveyV5_SV, view.SV); } } private static ProportionalSettingView Up678() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 9, PV = basePlcHelper.conveyV5_PV.NowValue.ToFloat(), SV = basePlcHelper.conveyV5_SV.NowValue.ToFloat() }; return vi; } private static void Down686(ProportionalSettingView view) { if (null != view) { var basePlcHelper = GetPlcHelper; basePlcHelper.PlcWriteFloatByDataKey(basePlcHelper.purgeV5_SV, view.SV); } } private static ProportionalSettingView Up686() { var basePlcHelper = GetPlcHelper; ProportionalSettingView vi = new ProportionalSettingView() { Id = 10, PV = basePlcHelper.purgeV5_PV.NowValue.ToFloat(), SV = basePlcHelper.purgeV5_SV.NowValue.ToFloat() }; return vi; } public static void DownToPlc(IEnumerable views) { foreach (var v in views) { switch (v.Id) { case 1: Down614(v); break; case 2: Down622(v); break; case 3: Down630(v); break; case 4: Down638(v); break; case 5: Down646(v); break; case 6: Down654(v); break; case 7: Down662(v); break; case 8: Down670(v); break; case 9: Down678(v); break; case 10: Down686(v); break; } } } public static ProportionalSettingView UpFromPlc(int id) { switch (id) { case 1: return Up614(); case 2: return Up622(); case 3: return Up630(); case 4: return Up638(); case 5: return Up646(); case 6: return Up654(); case 7: return Up662(); case 8: return Up670(); case 9: return Up678(); case 10: return Up686(); } return null; } public static IEnumerable UpFromPlc() { ICollection co = new List(); co.Add(Up614()); co.Add(Up622()); co.Add(Up630()); co.Add(Up638()); co.Add(Up646()); co.Add(Up654()); co.Add(Up662()); co.Add(Up670()); co.Add(Up678()); co.Add(Up686()); return co; } } }