diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs index b7d1f07..6c2b2d4 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs @@ -115,7 +115,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch #region 0、实时刷新自动保存报警 - ReportWetMixerSaveHelper.Instance.SaveWetMixerReport(); + #endregion } diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportWetMixerSaveHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportWetMixerSaveHelper.cs index 6ecff10..c9a4bab 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportWetMixerSaveHelper.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportWetMixerSaveHelper.cs @@ -30,34 +30,34 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper { try { - ICSharpCode.Core.LoggingService.Debug("湿混机报表数据保存开始!!!"); - - - //准备信号读取 - if (BasePlcHelper.Instance.RdyRpt_D1.NowValue.ToInt() == 1) - { - Report_WetMixer wetMixer_dos0 = readWetMixer("A"); //读取报表数据 - SaveReportDb(wetMixer_dos0); //保存报表数据 - BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.RdyRpt_D1, new object[] { 0 }); - } - else if (BasePlcHelper.Instance.RdyRpt_D2.NowValue.ToInt() == 1) - { - Report_WetMixer wetMixer_dos0 = readWetMixer("B"); //读取报表数据 - SaveReportDb(wetMixer_dos0); //保存报表数据 - BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.RdyRpt_D2, new object[] { 0 }); - } - else if (BasePlcHelper.Instance.RdyRpt_D3.NowValue.ToInt() == 1) - { - Report_WetMixer wetMixer_dos0 = readWetMixer("C"); //读取报表数据 - SaveReportDb(wetMixer_dos0); //保存报表数据 - BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.RdyRpt_D3, new object[] { 0 }); - } - else if (BasePlcHelper.Instance.RdyRpt_D4.NowValue.ToInt() == 1) - { - Report_WetMixer wetMixer_dos0 = readWetMixer("D"); //读取报表数据 - SaveReportDb(wetMixer_dos0); //保存报表数据 - BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.RdyRpt_D4, new object[] { 0 }); - } + + + + ////准备信号读取 + //if (BasePlcHelper.Instance.RdyRpt_D1.NowValue.ToInt() == 1) + //{ + // Report_WetMixer wetMixer_dos0 = readWetMixer("A"); //读取报表数据 + // SaveReportDb(wetMixer_dos0); //保存报表数据 + // BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.RdyRpt_D1, new object[] { 0 }); + //} + //else if (BasePlcHelper.Instance.RdyRpt_D2.NowValue.ToInt() == 1) + //{ + // Report_WetMixer wetMixer_dos0 = readWetMixer("B"); //读取报表数据 + // SaveReportDb(wetMixer_dos0); //保存报表数据 + // BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.RdyRpt_D2, new object[] { 0 }); + //} + //else if (BasePlcHelper.Instance.RdyRpt_D3.NowValue.ToInt() == 1) + //{ + // Report_WetMixer wetMixer_dos0 = readWetMixer("C"); //读取报表数据 + // SaveReportDb(wetMixer_dos0); //保存报表数据 + // BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.RdyRpt_D3, new object[] { 0 }); + //} + //else if (BasePlcHelper.Instance.RdyRpt_D4.NowValue.ToInt() == 1) + //{ + // Report_WetMixer wetMixer_dos0 = readWetMixer("D"); //读取报表数据 + // SaveReportDb(wetMixer_dos0); //保存报表数据 + // BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.RdyRpt_D4, new object[] { 0 }); + //} @@ -158,68 +158,35 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper /// private void SaveReportDb(Report_WetMixer _wetMixer) { - JavaScriptSerializer serializer = new JavaScriptSerializer(); - try - { - string str = serializer.Serialize(_wetMixer); - if (_wetMixer != null) - { - if (_wetMixer.wetmixer != null) - { - InsertReportWetMixer(_wetMixer.report_Id, _wetMixer.wetmixer); - } - if (_wetMixer.mix != null) - { - InsertReportWetMixerDetail(_wetMixer.report_Id, _wetMixer.mix); - } - } - - - ICSharpCode.Core.LoggingService.Warn($"报表数据打印:{str}"); - } - catch (Exception ex) - { - ICSharpCode.Core.LoggingService.Error(String.Format("保存报表数据至数据库异常:{0}", ex.Message), ex); - } + //JavaScriptSerializer serializer = new JavaScriptSerializer(); + //try + //{ + // string str = serializer.Serialize(_wetMixer); + // if (_wetMixer != null) + // { + // if (_wetMixer.wetmixer != null) + // { + // InsertReportWetMixer(_wetMixer.report_Id, _wetMixer.wetmixer); + // } + // if (_wetMixer.mix != null) + // { + // InsertReportWetMixerDetail(_wetMixer.report_Id, _wetMixer.mix); + // } + // } + + + // ICSharpCode.Core.LoggingService.Warn($"报表数据打印:{str}"); + //} + //catch (Exception ex) + //{ + // ICSharpCode.Core.LoggingService.Error(String.Format("保存报表数据至数据库异常:{0}", ex.Message), ex); + //} } - /// - /// 保存湿混机报表数据 - /// - /// - /// - private void InsertReportWetMixer(Guid reportId, WetMixerDevice wetMixer) - { - try - { - - Task.Run(() => - { - DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local); - if (dbHelper == null) - { - throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError); - } - string sqlStr = @"insert into Report_WetMixer (reportId, eqNo) values (@reportId, @eqNo)"; - - - dbHelper.ClearParameter(); - dbHelper.CommandType = CommandType.Text; - dbHelper.CommandText = sqlStr; - dbHelper.AddParameter("@eqNo", wetMixer.eqNo); - dbHelper.AddParameter("@reportId", reportId); - dbHelper.ExecuteNonQuery(); - - }); - } - catch (Exception ex) - { - ICSharpCode.Core.LoggingService.Error(String.Format("保存湿混机报表数据异常:{0}", ex.Message), ex); - } - } + /// /// 保存湿混机报表明细数据 diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs index 172b43c..5a8901f 100644 --- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs +++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Test/TestAction.cs @@ -66,9 +66,6 @@ namespace Mesnac.Action.ChemicalWeighing.Test int[] ssss = new int [] { }; var ss2s = BasePlcHelper.Instance.PlcReadByRunName("BU1BLT01_Set", out ssss); - - - mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.None);//获取所有待初始化控件 startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "MCLabel153".ToLower()).FirstOrDefault().BaseControl; diff --git a/Main/MCRun/MCRun.csproj b/Main/MCRun/MCRun.csproj index 6a6ddad..345b2a2 100644 --- a/Main/MCRun/MCRun.csproj +++ b/Main/MCRun/MCRun.csproj @@ -77,6 +77,21 @@ ..\..\A3Lib\FastReport\FastReport.Editor.dll + + ..\..\packages\FreeSql.3.2.800\lib\net451\FreeSql.dll + + + ..\..\packages\FreeSql.DbContext.3.2.800\lib\net45\FreeSql.DbContext.dll + + + ..\..\packages\FreeSql.Extensions.LazyLoading.3.2.800\lib\net45\FreeSql.Extensions.LazyLoading.dll + + + ..\..\packages\FreeSql.Provider.SqlServer.3.2.800\lib\net451\FreeSql.Provider.SqlServer.dll + + + ..\..\packages\FreeSql.Repository.3.2.800\lib\net45\FreeSql.Repository.dll + False ..\..\Libraries\Host.dll @@ -137,6 +152,12 @@ + + ..\..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll + + + ..\..\packages\System.Data.SqlClient.4.8.5\lib\net451\System.Data.SqlClient.dll + @@ -204,6 +225,7 @@ PreserveNewest + SettingsSingleFileGenerator diff --git a/Main/MCRun/packages.config b/Main/MCRun/packages.config new file mode 100644 index 0000000..9088add --- /dev/null +++ b/Main/MCRun/packages.config @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file