dep_nodyang
nodyang 1 year ago
parent f2fe90ef1a
commit af59930b1b

@ -115,7 +115,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
#region 0、实时刷新自动保存报警
ReportWetMixerSaveHelper.Instance.SaveWetMixerReport();
#endregion
}

@ -30,34 +30,34 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
{
try
{
ICSharpCode.Core.LoggingService<ReportWetMixerSaveHelper>.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
/// <param name="_wetMixer"></param>
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<ReportWetMixerSaveHelper>.Warn($"报表数据打印:{str}");
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService<ReportWetMixerSaveHelper>.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<ReportWetMixerSaveHelper>.Warn($"报表数据打印:{str}");
//}
//catch (Exception ex)
//{
// ICSharpCode.Core.LoggingService<ReportWetMixerSaveHelper>.Error(String.Format("保存报表数据至数据库异常:{0}", ex.Message), ex);
//}
}
/// <summary>
/// 保存湿混机报表数据
/// </summary>
/// <param name="reportId"></param>
/// <param name="_wetMixerDos"></param>
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<ReportWetMixerSaveHelper>.Error(String.Format("保存湿混机报表数据异常:{0}", ex.Message), ex);
}
}
/// <summary>
/// 保存湿混机报表明细数据

@ -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;

@ -77,6 +77,21 @@
<Reference Include="FastReport.Editor">
<HintPath>..\..\A3Lib\FastReport\FastReport.Editor.dll</HintPath>
</Reference>
<Reference Include="FreeSql, Version=3.2.800.0, Culture=neutral, PublicKeyToken=a33928e5d4a4b39c, processorArchitecture=MSIL">
<HintPath>..\..\packages\FreeSql.3.2.800\lib\net451\FreeSql.dll</HintPath>
</Reference>
<Reference Include="FreeSql.DbContext, Version=3.2.800.0, Culture=neutral, PublicKeyToken=d6971b25f8f033dc, processorArchitecture=MSIL">
<HintPath>..\..\packages\FreeSql.DbContext.3.2.800\lib\net45\FreeSql.DbContext.dll</HintPath>
</Reference>
<Reference Include="FreeSql.Extensions.LazyLoading, Version=3.2.800.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\FreeSql.Extensions.LazyLoading.3.2.800\lib\net45\FreeSql.Extensions.LazyLoading.dll</HintPath>
</Reference>
<Reference Include="FreeSql.Provider.SqlServer, Version=3.2.800.0, Culture=neutral, PublicKeyToken=d313b98af285bd88, processorArchitecture=MSIL">
<HintPath>..\..\packages\FreeSql.Provider.SqlServer.3.2.800\lib\net451\FreeSql.Provider.SqlServer.dll</HintPath>
</Reference>
<Reference Include="FreeSql.Repository, Version=3.2.800.0, Culture=neutral, PublicKeyToken=e2c05379863de526, processorArchitecture=MSIL">
<HintPath>..\..\packages\FreeSql.Repository.3.2.800\lib\net45\FreeSql.Repository.dll</HintPath>
</Reference>
<Reference Include="Host, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Libraries\Host.dll</HintPath>
@ -137,6 +152,12 @@
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Common, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Data.Common.4.3.0\lib\net451\System.Data.Common.dll</HintPath>
</Reference>
<Reference Include="System.Data.SqlClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Data.SqlClient.4.8.5\lib\net451\System.Data.SqlClient.dll</HintPath>
</Reference>
<Reference Include="System.Design" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
@ -204,6 +225,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Localization\Chinese %28Simplified%29.frl" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FreeSql" version="3.2.800" targetFramework="net452" />
<package id="FreeSql.DbContext" version="3.2.800" targetFramework="net452" />
<package id="FreeSql.Extensions.LazyLoading" version="3.2.800" targetFramework="net452" />
<package id="FreeSql.Provider.SqlServer" version="3.2.800" targetFramework="net452" />
<package id="FreeSql.Repository" version="3.2.800" targetFramework="net452" />
<package id="System.Data.Common" version="4.3.0" targetFramework="net452" />
<package id="System.Data.SqlClient" version="4.8.5" targetFramework="net452" />
</packages>
Loading…
Cancel
Save