change - 报表数据保存代码优化

master
wenjy 2 years ago
parent 4a9bef5fac
commit fcd32f6ee7

@ -160,7 +160,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
FinishBatchHelper.SaveGHData();
//GHFinshBatchHelper.SaveData();
ReportSaveHelper.SaveDryMixerReport();
ReportSaveHelper.Instance.SaveDryMixerReport();
#endregion
#region 8、更新物料名称

@ -3,6 +3,7 @@ using DevExpress.Office.Utils;
using DevExpress.XtraPrinting.Native.WebClientUIControl;
using Mesnac.Action.ChemicalWeighing.Entity.Report;
using Mesnac.Codd.Session;
using Mesnac.PlcUtils;
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
@ -14,12 +15,24 @@ using System.Web.Script.Serialization;
namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
{
public class ReportSaveHelper
public sealed class ReportSaveHelper
{
private static readonly Lazy<ReportSaveHelper> lazy = new Lazy<ReportSaveHelper>(() => new ReportSaveHelper());
public static ReportSaveHelper Instance
{
get
{
return lazy.Value;
}
}
private ReportSaveHelper() { }
/// <summary>
/// 干混机报表数据保存
/// </summary>
public static void SaveDryMixerReport()
public void SaveDryMixerReport()
{
try
{
@ -63,7 +76,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
/// <param name="machineType">干混机A、干混机B</param>
/// <param name="dos">操作步骤Dos[0]、Dos[1]、Dos[2]、Dos[3]</param>
/// <returns></returns>
private static Report_DryMixer readDryMixer( string machineType)
private Report_DryMixer readDryMixer( string machineType)
{
Report_DryMixer _dryMixer = null;
try
@ -86,7 +99,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
/// <param name="machineType"></param>
/// <param name="amount"></param>
/// <returns></returns>
private static List<DryMixerDos> readDryMixerDos(string machineType,int amount)
private List<DryMixerDos> readDryMixerDos(string machineType,int amount)
{
List<DryMixerDos> dryMixerDoes = new List<DryMixerDos>();
for (int dos = 0; dos < amount; dos++)
@ -124,7 +137,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
/// <param name="machineType"></param>
/// <param name="amount"></param>
/// <returns></returns>
private static List<DryMixerMix> readDryMixerMix(string machineType, int amount)
private List<DryMixerMix> readDryMixerMix(string machineType, int amount)
{
List<DryMixerMix> dryMixerMixes = new List<DryMixerMix>();
for (int mix = 0; mix < 10; mix++)
@ -160,7 +173,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
/// 保存报表数据至数据库
/// </summary>
/// <param name="_dryMixer"></param>
private static void SaveReportDb(Report_DryMixer _dryMixer)
private void SaveReportDb(Report_DryMixer _dryMixer)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
try
@ -191,7 +204,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
/// </summary>
/// <param name="reportId"></param>
/// <param name="_dryMixerDos"></param>
private static void InsertReportDryMixer(Guid reportId,List<DryMixerDos> dryMixers)
private void InsertReportDryMixer(Guid reportId,List<DryMixerDos> dryMixers)
{
try
{
@ -239,7 +252,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
/// </summary>
/// <param name="reportId"></param>
/// <param name="_dryMixerMix"></param>
private static void InsertReportDryMixerDetail(Guid reportId, List<DryMixerMix> dryMixers)
private void InsertReportDryMixerDetail(Guid reportId, List<DryMixerMix> dryMixers)
{
try
{

Loading…
Cancel
Save