diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
index 114f82e..a9bb455 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/BasePlcHelper.cs
@@ -3337,6 +3337,45 @@ namespace Mesnac.Action.ChemicalWeighing
/// 速度
///
public DataKeyValue dryer_mixSpeed { get; set; }
+
+
+
+ ///
+ /// 设备编号
+ ///
+ public DataKeyValue geler_dos_eqNo { get; set; }
+ ///
+ /// 批次号
+ ///
+ public DataKeyValue geler_dos_batch { get; set; }
+ ///
+ /// 物料代码
+ ///
+ public DataKeyValue geler_dos_matCode { get; set; }
+ ///
+ /// 设定重量
+ ///
+ public DataKeyValue geler_dos_setValue { get; set; }
+ ///
+ /// 设定公差
+ ///
+ public DataKeyValue geler_dos_setToler { get; set; }
+ ///
+ /// 实际重量
+ ///
+ public DataKeyValue geler_dos_actValue { get; set; }
+ ///
+ /// 实际公差
+ ///
+ public DataKeyValue geler_dos_actToLer { get; set; }
+
+
+
+
+
+
+
+
#endregion
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/Report/Report_GelDoser.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/Report/Report_GelDoser.cs
new file mode 100644
index 0000000..0d32b25
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/Report/Report_GelDoser.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Mesnac.Action.ChemicalWeighing.Entity.Report
+{
+ ///
+ /// 干混机报表
+ ///
+ public class Report_GelDoser
+ {
+ ///
+ /// 构造函数
+ ///
+ ///
+ public Report_GelDoser(Guid id = default)
+ {
+ report_Id = id == default ? Guid.NewGuid() : id;
+ }
+
+ ///
+ /// 报表Id
+ ///
+ public Guid report_Id { get; set; }
+
+ ///
+ /// Dos
+ ///
+ public List dos { get; set; }
+
+ ///
+ /// Mix
+ ///
+ public List mix { get; set; }
+ }
+
+ public class GelDoserDos_Water
+ {
+ ///
+ /// 设备编号
+ ///
+ public int eqNo { get; set; }
+ ///
+ /// 批次号
+ ///
+ public int batch { get; set; }
+ ///
+ /// 物料代码
+ ///
+ public int matCode { get; set; }
+ ///
+ /// 设定重量
+ ///
+ public double setValue { get; set; }
+ ///
+ /// 设定公差
+ ///
+ public double setToler { get; set; }
+ ///
+ /// 实际重量
+ ///
+ public double actValue { get; set; }
+ ///
+ /// 实际公差
+ ///
+ public double actToLer { get; set; }
+ ///
+ /// 步骤编号
+ ///
+ public int dos { get; set; }
+
+ ///
+ /// 记录时间
+ ///
+ public string recordTime { get; set; }
+ }
+
+
+
+
+
+ public class GelDoserMix
+ {
+ ///
+ /// 设备编号
+ ///
+ public int eqNo { get; set; }
+
+ ///
+ /// 批次
+ ///
+ public int mixBatch { get; set; }
+ ///
+ /// 步号
+ ///
+ public int mixStep { get; set; }
+ ///
+ /// 动作
+ ///
+ public int actCode { get; set; }
+ ///
+ /// 时间
+ ///
+ public int mixTime { get; set; }
+ ///
+ /// 温度
+ ///
+ public double mixTemp { get; set; }
+ ///
+ /// 速度
+ ///
+ public double mixSpeed { get; set; }
+
+ ///
+ /// 步骤编号
+ ///
+ public int mix { get; set; }
+
+ ///
+ /// 记录时间
+ ///
+ public string recordTime { get; set; }
+ }
+}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs
index 428f58f..f6a3a0a 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchService.cs
@@ -159,8 +159,9 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
//FinishBatchHelper.SaveGHData();
- ReportDryMixerSaveHelper.Instance.Save();
- ReportWetMixerSaveHelper.Instance.SaveWetMixerReport();
+ //ReportDryMixerSaveHelper.Instance.Save();
+ //ReportWetMixerSaveHelper.Instance.SaveWetMixerReport();
+ ReportGelDoserSaveHelper.Instance.SaveGelDoserReport();
#endregion
#region 8、更新物料名称
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportGelDoserHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportGelDoserHelper.cs
new file mode 100644
index 0000000..78fbfc2
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportGelDoserHelper.cs
@@ -0,0 +1,324 @@
+using Mesnac.Action.ChemicalWeighing.Entity.Report;
+using Mesnac.Codd.Session;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Threading.Tasks;
+using System.Web.Script.Serialization;
+
+namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
+{
+ public sealed class ReportGelDoserSaveHelper
+ {
+
+ private static readonly Lazy lazy = new Lazy(() => new ReportGelDoserSaveHelper());
+ public static ReportGelDoserSaveHelper Instance
+ {
+ get
+ {
+ return lazy.Value;
+ }
+ }
+
+ private ReportGelDoserSaveHelper() { }
+
+ ///
+ /// 糊化机报表数据保存
+ ///
+ public void SaveGelDoserReport()
+ {
+ try
+ {
+ ICSharpCode.Core.LoggingService.Debug("糊化机报表数据保存开始!!!");
+ //准备信号读取
+ //if (BasePlcHelper.Instance.RdyRpt_D1.NowValue.ToInt() == 1)
+ //{
+ // Report_GelDoser gelDoser_dos0 = readGelDoser("A"); //读取报表数据
+ // SaveReportDb(gelDoser_dos0); //保存报表数据
+ //}
+ //else if (BasePlcHelper.Instance.RdyRpt_D1.NowValue.ToInt() == 2)
+ //{
+ // Report_GelDoser gelDoser_dos0 = readGelDoser("B"); //读取报表数据
+ // SaveReportDb(gelDoser_dos0); //保存报表数据
+ //}
+ //else if (BasePlcHelper.Instance.RdyRpt_D1.NowValue.ToInt() == 3)
+ //{
+ // Report_GelDoser gelDoser_dos0 = readGelDoser("C"); //读取报表数据
+ // SaveReportDb(gelDoser_dos0); //保存报表数据
+ //}
+ //else if (BasePlcHelper.Instance.RdyRpt_D1.NowValue.ToInt() == 4)
+ //{
+ // Report_GelDoser gelDoser_dos0 = readGelDoser("D"); //读取报表数据
+ // SaveReportDb(gelDoser_dos0); //保存报表数据
+ //}
+
+ Report_GelDoser gelDoser_dos0 = readGelDoser("A"); //读取报表数据
+ SaveReportDb(gelDoser_dos0); //保存报表数据
+
+
+ }
+ catch (Exception ex)
+ {
+ ICSharpCode.Core.LoggingService.Error(String.Format("糊化机报表数据保存异常:{0}", ex.Message), ex);
+ }
+ }
+
+
+
+ ///
+ /// 通过PLC读取糊化机报表数据
+ ///
+ /// 糊化机A、糊化机B
+ /// 操作步骤:Dos[0]、Dos[1]、Dos[2]、Dos[3]
+ ///
+ private Report_GelDoser readGelDoser(string machineType)
+ {
+ Report_GelDoser _gelDoser = null;
+ try
+ {
+ _gelDoser = new Report_GelDoser();
+ _gelDoser.dos = readGelDoserDos(machineType, 6);
+ _gelDoser.mix = readGelDoserMix(machineType, 10);
+ }
+ catch (Exception ex)
+ {
+ ICSharpCode.Core.LoggingService.Error(String.Format("通过PLC读取糊化机报表数读取异常:{0}", ex.Message), ex);
+ }
+ return _gelDoser;
+ }
+
+
+
+ ///
+ /// 读取糊化机Dos数据
+ ///
+ ///
+ ///
+ ///
+ private List readGelDoserDos(string machineType, int amount)
+ {
+ List gelDoserDoes = new List();
+ for (int dos = 0; dos < amount; dos++)
+ {
+ #region 实例化参数
+ if (dos < 4)
+ {
+ BasePlcHelper.Instance.geler_dos_eqNo = new Entity.DataKeyValue($"gelDosing{machineType}_dos{dos}_eqNo");
+ BasePlcHelper.Instance.geler_dos_batch = new Entity.DataKeyValue($"gelDosing{machineType}_dos{dos}_batch");
+ BasePlcHelper.Instance.geler_dos_matCode = new Entity.DataKeyValue($"gelDosing{machineType}_dos{dos}_matCode");
+ BasePlcHelper.Instance.geler_dos_setValue = new Entity.DataKeyValue($"gelDosing{machineType}_dos{dos}_setValue");
+ BasePlcHelper.Instance.geler_dos_setToler = new Entity.DataKeyValue($"gelDosing{machineType}_dos{dos}_setToler");
+ BasePlcHelper.Instance.geler_dos_actValue = new Entity.DataKeyValue($"gelDosing{machineType}_dos{dos}_actValue");
+ BasePlcHelper.Instance.geler_dos_actToLer = new Entity.DataKeyValue($"gelDosing{machineType}_dos{dos}_actToLer");
+ }
+ else if (dos == 4)
+ {
+ BasePlcHelper.Instance.geler_dos_eqNo = new Entity.DataKeyValue($"gelDosing{machineType}_hotWater_eqNo");
+ BasePlcHelper.Instance.geler_dos_batch = new Entity.DataKeyValue($"gelDosing{machineType}_hotWater_batch");
+ BasePlcHelper.Instance.geler_dos_matCode = new Entity.DataKeyValue($"gelDosing{machineType}_hotWater_matCode");
+ BasePlcHelper.Instance.geler_dos_setValue = new Entity.DataKeyValue($"gelDosing{machineType}_hotWater_setValue");
+ BasePlcHelper.Instance.geler_dos_setToler = new Entity.DataKeyValue($"gelDosing{machineType}_hotWater_setToler");
+ BasePlcHelper.Instance.geler_dos_actValue = new Entity.DataKeyValue($"gelDosing{machineType}_hotWater_actValue");
+ BasePlcHelper.Instance.geler_dos_actToLer = new Entity.DataKeyValue($"gelDosing{machineType}_hotWater_actToLer");
+ }
+ else if(dos == 5)
+ {
+ BasePlcHelper.Instance.geler_dos_eqNo = new Entity.DataKeyValue($"gelDosing{machineType}_coolWater_eqNo");
+ BasePlcHelper.Instance.geler_dos_batch = new Entity.DataKeyValue($"gelDosing{machineType}_coolWater_batch");
+ BasePlcHelper.Instance.geler_dos_matCode = new Entity.DataKeyValue($"gelDosing{machineType}_coolWater_matCode");
+ BasePlcHelper.Instance.geler_dos_setValue = new Entity.DataKeyValue($"gelDosing{machineType}_coolWater_setValue");
+ BasePlcHelper.Instance.geler_dos_setToler = new Entity.DataKeyValue($"gelDosing{machineType}_coolWater_setToler");
+ BasePlcHelper.Instance.geler_dos_actValue = new Entity.DataKeyValue($"gelDosing{machineType}_coolWater_actValue");
+ BasePlcHelper.Instance.geler_dos_actToLer = new Entity.DataKeyValue($"gelDosing{machineType}_coolWater_actToLer");
+ }
+ #endregion
+
+ GelDoserDos_Water gelDoserDos = new GelDoserDos_Water()
+ {
+ eqNo = BasePlcHelper.Instance.geler_dos_eqNo.NowValue.ToInt(),
+ batch = BasePlcHelper.Instance.geler_dos_batch.NowValue.ToInt(),
+ matCode = BasePlcHelper.Instance.geler_dos_matCode.NowValue.ToInt(),
+ setValue = BasePlcHelper.Instance.geler_dos_setValue.NowValue.ToDouble(),
+ setToler = BasePlcHelper.Instance.geler_dos_setToler.NowValue.ToDouble(),
+ actValue = BasePlcHelper.Instance.geler_dos_actValue.NowValue.ToDouble(),
+ actToLer = BasePlcHelper.Instance.geler_dos_actToLer.NowValue.ToDouble(),
+ dos = dos,
+ recordTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+ };
+ gelDoserDoes.Add(gelDoserDos);
+ }
+ return gelDoserDoes;
+ }
+
+ ///
+ /// 读取糊化机Mix数据
+ ///
+ ///
+ ///
+ ///
+ private List readGelDoserMix(string machineType, int amount)
+ {
+ List gelDoserMixes = new List();
+ for (int mix = 0; mix < amount; mix++)
+ {
+ #region 实例化参数
+ var eqNo = new Entity.DataKeyValue($"gelDosing{machineType}_gelMixing{mix}_eqNo");
+ var mixBatch = new Entity.DataKeyValue($"gelDosing{machineType}_gelMixing{mix}_mixBatch");
+ var mixStep = new Entity.DataKeyValue($"gelDosing{machineType}_gelMixing{mix}_mixStep");
+ var actCode = new Entity.DataKeyValue($"gelDosing{machineType}_gelMixing{mix}_actCode");
+ var mixTime = new Entity.DataKeyValue($"gelDosing{machineType}_gelMixing{mix}_mixTime");
+ var mixTemp = new Entity.DataKeyValue($"gelDosing{machineType}_gelMixing{mix}_mixTemp");
+ var mixSpeed = new Entity.DataKeyValue($"gelDosing{machineType}_gelMixing{mix}_mixSpeed");
+ #endregion
+
+ GelDoserMix gelDoserMix = new GelDoserMix()
+ {
+ eqNo = eqNo.NowValue.ToInt(),
+ mixBatch = mixBatch.NowValue.ToInt(),
+ mixStep = mixStep.NowValue.ToInt(),
+ actCode = actCode.NowValue.ToInt(),
+ mixTime = mixTime.NowValue.ToInt(),
+ mixTemp = mixTemp.NowValue.ToDouble(),
+ mixSpeed = mixSpeed.NowValue.ToDouble(),
+ mix = mix,
+ recordTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+ };
+ gelDoserMixes.Add(gelDoserMix);
+ }
+
+ return gelDoserMixes;
+ }
+
+
+
+ ///
+ /// 保存糊化机报表数据至数据库
+ ///
+ ///
+ private void SaveReportDb(Report_GelDoser _gelDoser)
+ {
+ JavaScriptSerializer serializer = new JavaScriptSerializer();
+ try
+ {
+ string str = serializer.Serialize(_gelDoser);
+ if (_gelDoser != null)
+ {
+ if (_gelDoser.dos != null)
+ {
+ InsertReportGelDoser(_gelDoser.report_Id, _gelDoser.dos);
+ }
+ if (_gelDoser.mix != null)
+ {
+ InsertReportGelDoserDetail(_gelDoser.report_Id, _gelDoser.mix);
+ }
+ }
+
+
+ ICSharpCode.Core.LoggingService.Warn($"报表数据打印:{str}");
+ }
+ catch (Exception ex)
+ {
+ ICSharpCode.Core.LoggingService.Error(String.Format("保存报表数据至数据库异常:{0}", ex.Message), ex);
+ }
+ }
+
+
+
+ ///
+ /// 保存糊化机报表数据
+ ///
+ ///
+ ///
+ private void InsertReportGelDoser(Guid reportId, List gelDosers)
+ {
+ 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_GelDoser
+ (reportId, eqNo, batch, matCode, setValue, setToler, actValue, actToLer, dos)
+ values
+ (@reportId, @eqNo, @batch, @matCode, @setValue, @setToler, @actValue, @actToLer, @dos)";
+
+ foreach (GelDoserDos_Water _gelDoserDos in gelDosers)
+ {
+ if (_gelDoserDos.actValue == 0) continue;
+
+ dbHelper.ClearParameter();
+ dbHelper.CommandType = CommandType.Text;
+ dbHelper.CommandText = sqlStr;
+ dbHelper.AddParameter("@reportId", reportId);
+ dbHelper.AddParameter("@eqNo", _gelDoserDos.eqNo);
+ dbHelper.AddParameter("@batch", _gelDoserDos.batch);
+ dbHelper.AddParameter("@matCode", _gelDoserDos.matCode);
+ dbHelper.AddParameter("@setValue", _gelDoserDos.setValue);
+ dbHelper.AddParameter("@setToler", _gelDoserDos.setToler);
+ dbHelper.AddParameter("@actValue", _gelDoserDos.actValue);
+ dbHelper.AddParameter("@actToLer", _gelDoserDos.actToLer);
+ dbHelper.AddParameter("@dos", _gelDoserDos.dos);
+ dbHelper.ExecuteNonQuery();
+
+ }
+ });
+ }
+ catch (Exception ex)
+ {
+ ICSharpCode.Core.LoggingService.Error(String.Format("保存糊化机报表数据异常:{0}", ex.Message), ex);
+ }
+ }
+
+ ///
+ /// 保存糊化机报表明细数据
+ ///
+ ///
+ ///
+ private void InsertReportGelDoserDetail(Guid reportId, List gelDosers)
+ {
+ 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_GelDoser_Detail
+ (reportId, eqNo, mixBatch, mixStep, actCode, mixTime, mixTemp, mixSpeed, mix)
+ values
+ (@reportId, @eqNo, @mixBatch, @mixStep, @actCode, @mixTime, @mixTemp, @mixSpeed, @mix)";
+ foreach (GelDoserMix _gelDoserMix in gelDosers)
+ {
+ if (_gelDoserMix.actCode == 0) continue;
+
+ dbHelper.ClearParameter();
+ dbHelper.CommandType = CommandType.Text;
+ dbHelper.CommandText = sqlStr;
+ dbHelper.AddParameter("@reportId", reportId);
+ dbHelper.AddParameter("@eqNo", _gelDoserMix.eqNo);
+ dbHelper.AddParameter("@mixBatch", _gelDoserMix.mixBatch);
+ dbHelper.AddParameter("@mixStep", _gelDoserMix.mixStep);
+ dbHelper.AddParameter("@actCode", _gelDoserMix.actCode);
+ dbHelper.AddParameter("@mixTime", _gelDoserMix.mixTime);
+ dbHelper.AddParameter("@mixTemp", _gelDoserMix.mixTemp);
+ dbHelper.AddParameter("@mixSpeed", _gelDoserMix.mixSpeed);
+ dbHelper.AddParameter("@mix", _gelDoserMix.mix);
+ dbHelper.ExecuteNonQuery();
+ }
+ });
+ }
+ catch (Exception ex)
+ {
+ ICSharpCode.Core.LoggingService.Error(String.Format("保存糊化机报表明细数据异常:{0}", ex.Message), ex);
+ }
+ }
+
+
+ }
+}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
index 279b74c..923a0a2 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
@@ -214,11 +214,13 @@
+
+
@@ -505,6 +507,10 @@
+
+
+
+
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/ExportAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/ExportAction.cs
new file mode 100644
index 0000000..36b28b7
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/ExportAction.cs
@@ -0,0 +1,179 @@
+using DevExpress.Utils.Drawing.Helpers;
+using ICSharpCode.Core;
+using Mesnac.Action.Base;
+using Mesnac.Action.ChemicalWeighing.Entity.Report;
+using Mesnac.Action.ChemicalWeighing.Report.ProductionReport;
+using Microsoft.Office.Interop.Excel;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Mesnac.Action.ChemicalWeighing.Report.GelDoser
+{
+ ///
+ /// 糊化机报表导出事件
+ ///
+ public class ExportAction : ChemicalWeighingAction, Base.IAction
+ {
+ private Control _clientGridControl = null; //报表明细DGV
+ private DbMCControl _dgvGelDoser = null; //报表数据DGV
+
+ public void Run(RuntimeParameter runtime)
+ {
+ base.RunIni(runtime); //必须要调用的
+ ICSharpCode.Core.LoggingService.Debug("糊化机报表-导出...");
+
+ this._dgvGelDoser = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Report_GelDoser").FirstOrDefault();
+ DataGridView _GelDoserGridView = this._dgvGelDoser.BaseControl as DataGridView;
+
+ if (_GelDoserGridView != null)
+ {
+ GelDoserDos_Water gelDoserDos = new GelDoserDos_Water();
+ gelDoserDos.eqNo = ParseToInt(_GelDoserGridView.SelectedRows[0].Cells["eqNo"].Value.ToString());
+ gelDoserDos.dos = ParseToInt(_GelDoserGridView.SelectedRows[0].Cells["dos"].Value.ToString());
+ gelDoserDos.batch = ParseToInt(_GelDoserGridView.SelectedRows[0].Cells["batch"].Value.ToString());
+ gelDoserDos.matCode = ParseToInt(_GelDoserGridView.SelectedRows[0].Cells["matCode"].Value.ToString());
+ gelDoserDos.setValue = Convert.ToDouble(_GelDoserGridView.SelectedRows[0].Cells["setValue"].Value);
+ gelDoserDos.setToler = Convert.ToDouble(_GelDoserGridView.SelectedRows[0].Cells["setToler"].Value);
+ gelDoserDos.actValue = Convert.ToDouble(_GelDoserGridView.SelectedRows[0].Cells["actValue"].Value);
+ gelDoserDos.actToLer = Convert.ToDouble(_GelDoserGridView.SelectedRows[0].Cells["actToLer"].Value);
+ gelDoserDos.recordTime = _GelDoserGridView.SelectedRows[0].Cells["recordTime"].Value.ToString();
+
+ SaveFileDialog sfd = new SaveFileDialog();
+ sfd.Filter = "xls files(*.xls)|*.xls";
+ sfd.FileName = String.Format("糊化机报表_{0:yyyyMMdd}", DateTime.Now);
+ sfd.AddExtension = true;
+ DialogResult result = sfd.ShowDialog();
+
+ if (result == DialogResult.OK)
+ {
+ this._clientGridControl = GetAllControls().Where(x => x.Name.Contains("MultiColHeaderDgv")).FirstOrDefault();
+
+ if (_clientGridControl == null)
+ {
+ ICSharpCode.Core.LoggingService.Warn("{生产报表} 缺少缺少称量名细MultiColHeaderDgv控件...");
+ runtime.IsReturn = false;
+ return;
+ }
+
+ Mesnac.Controls.Default.MultiColHeaderDgv clientGrid = (this._clientGridControl as Mesnac.Controls.Default.MultiColHeaderDgv);
+ System.Data.DataTable dt = clientGrid.DataSource as System.Data.DataTable;
+
+ string fileName = sfd.FileName;
+ if (!String.IsNullOrEmpty(fileName))
+ {
+ try
+ {
+ //写入Excle
+ DataTabletoExcel(fileName, dt, gelDoserDos);
+ string msg1 = "糊化机报表导出成功"; //导出生产报表数据至Excel成功!
+ ICSharpCode.Core.LoggingService.Info(msg1);
+ MessageBox.Show(msg1, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ catch (Exception ex)
+ {
+ string msg1 = $"糊化机报表导出异常:{ex.Message}";
+ ICSharpCode.Core.LoggingService.Error(msg1);
+ MessageBox.Show(msg1, Mesnac.Basic.LanguageHelper.WarnCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ }
+ }
+ }
+ }
+
+ }
+
+ ///
+ /// 写入到Excel文件
+ ///
+ ///
+ ///
+ ///
+ public void DataTabletoExcel(string strFileName, System.Data.DataTable tmpDataTable, GelDoserDos_Water gelDoserDos)
+ {
+ ///先得到datatable的行数
+ int rowNum = tmpDataTable.Rows.Count;
+ ///列数
+ int columnNum = tmpDataTable.Columns.Count;
+ ///声明一个应用程序类实例
+ Microsoft.Office.Interop.Excel.Application xlApp = new ApplicationClass();
+
+ //创建一个新工作簿
+ Workbook xlBook = xlApp.Workbooks.Add();
+ ///在工作簿中得到sheet。
+ _Worksheet oSheet = (_Worksheet)xlBook.Worksheets[1];
+
+ #region 绘制列
+
+ //绘制配方名和开始时间
+ oSheet.Cells[1, 1] = "设备";
+ oSheet.Cells[1, 2] = "Dos";
+ oSheet.Cells[1, 3] = "批次号";
+ oSheet.Cells[1, 4] = "物料代码";
+ oSheet.Cells[1, 5] = "设定重量";
+ oSheet.Cells[1, 6] = "设定公差";
+ oSheet.Cells[1, 7] = "实际重量";
+ oSheet.Cells[1, 8] = "实际公差";
+ oSheet.Cells[1, 9] = "记录时间";
+ oSheet.Cells[2, 1] = gelDoserDos.eqNo;
+ oSheet.Cells[2, 2] = gelDoserDos.dos;
+ oSheet.Cells[2, 3] = gelDoserDos.batch;
+ oSheet.Cells[2, 4] = gelDoserDos.matCode;
+ oSheet.Cells[2, 5] = gelDoserDos.setValue;
+ oSheet.Cells[2, 6] = gelDoserDos.setToler;
+ oSheet.Cells[2, 7] = gelDoserDos.actValue;
+ oSheet.Cells[2, 8] = gelDoserDos.setToler;
+ oSheet.Cells[2, 9] = gelDoserDos.recordTime;
+
+
+
+ //自定义方法,绘制合并表头
+ oSheet.Cells[3, 1] = "设备";
+ oSheet.Cells[3, 2] = "Mix";
+ oSheet.Cells[3, 3] = "批次";
+ oSheet.Cells[3, 4] = "步号";
+ oSheet.Cells[3, 5] = "动作";
+ oSheet.Cells[3, 6] = "时间";
+ oSheet.Cells[3, 7] = "温度";
+ oSheet.Cells[3, 8] = "速度";
+ oSheet.Cells[3, 9] = "记录时间";
+
+ #endregion
+
+ //将DataTable中的数据导入Excel中
+ for (int i = 0; i < rowNum; i++)
+ {
+ for (int j = 0; j < columnNum; j++)
+ {
+ ///excel中的列是从1开始的
+ xlApp.Cells[i + 4, j + 1] = tmpDataTable.Rows[i][j].ToString();
+ }
+ }
+ oSheet.SaveAs(strFileName);
+ }
+
+ ///
+ /// 字符串转Int
+ ///
+ ///
+ ///
+ private int ParseToInt(string str)
+ {
+ int returnInt = 0;
+ if (str == null || str.Trim().Length < 1)
+ {
+ return returnInt;
+ }
+ if (int.TryParse(str, out returnInt))
+ {
+ return returnInt;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ }
+}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/InitFormAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/InitFormAction.cs
new file mode 100644
index 0000000..3857c5f
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/InitFormAction.cs
@@ -0,0 +1,38 @@
+using Mesnac.Action.Base;
+using Mesnac.Controls.Base;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Mesnac.Action.ChemicalWeighing.Report.GelDoser
+{
+ ///
+ /// 糊化机报表窗体初始化事件
+ ///
+ public class InitFormAction : ChemicalWeighingAction, IAction
+ {
+ public void Run(RuntimeParameter runtime)
+ {
+ base.RunIni(runtime); //必须要调用的
+ ICSharpCode.Core.LoggingService.Debug("糊化机报表-窗体初始化...");
+
+ #region 获取界面控件
+
+ DbMCControl clientGridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Report_GelDoser").FirstOrDefault(); //获取本机台计划网格控件
+
+ if (clientGridControl == null)
+ {
+ ICSharpCode.Core.LoggingService.Error("{糊化机报表-窗体加载} 缺少日志网格控件...");
+ return;
+ }
+
+ #endregion
+
+ List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
+ IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
+ startdate.MCValue = DateTime.Now.AddDays(-7);
+ }
+ }
+}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectAction.cs
new file mode 100644
index 0000000..f8b8c8d
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectAction.cs
@@ -0,0 +1,82 @@
+using Mesnac.Action.Base;
+using Mesnac.Codd.Session;
+using Mesnac.Controls.Base;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Mesnac.Action.ChemicalWeighing.Report.GelDoser
+{
+ ///
+ /// 糊化机报表查询事件
+ ///
+ public class SelectAction : ChemicalWeighingAction, IAction
+ {
+ public void Run(RuntimeParameter runtime)
+ {
+
+ base.RunIni(runtime); //必须要调用的
+
+ ICSharpCode.Core.LoggingService.Debug("糊化机报表-查询...");
+
+ DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
+ if (dbHelper == null)
+ {
+ ICSharpCode.Core.LoggingService.Error("获取本地数据连接失败...");
+ return;
+ }
+ dbHelper.ClearParameter();
+
+ StringBuilder sbSql = new StringBuilder(@"select t1.objId,t1.reportId,t2.Name as eqNo,t1.batch,t1.matCode,
+ t1.setValue,t1.setToler, t1.actValue,t1.actToLer,t1.dos,t1.recordTime
+ from Report_GelDoser t1
+ left join Device t2 on t1.eqNo = t2.Id
+ where 1=1");
+ List mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
+
+ IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
+ IBaseControl starttime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "starttime").FirstOrDefault().BaseControl;
+ if (startdate != null && starttime != null)
+ {
+ //Append
+ sbSql.AppendLine(@"AND t1.recordTime>='" + Convert.ToDateTime(startdate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(starttime.MCValue).ToShortTimeString() + "' ");
+ }
+ else
+ {
+ ICSharpCode.Core.LoggingService.Debug("{糊化机报表-查询} 缺少key值为startdate或者starttime的时间查询条件...");
+ return;
+ }
+
+ IBaseControl enddate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "enddate").FirstOrDefault().BaseControl;
+ IBaseControl endtime = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "endtime").FirstOrDefault().BaseControl;
+ if (enddate != null && endtime != null)
+ {
+ sbSql.AppendLine(@"AND t1.recordTime<='" + Convert.ToDateTime(enddate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(endtime.MCValue).ToShortTimeString() + "' ");
+ }
+ else
+ {
+ ICSharpCode.Core.LoggingService.Debug("{糊化机报表-查询} 缺少key值为enddate或者enddate的时间查询条件...");
+ return;
+ }
+ sbSql.Append(" ORDER BY t1.recordTime desc");
+
+ dbHelper.CommandText = sbSql.ToString();
+ dbHelper.CommandType = System.Data.CommandType.Text;
+ DataTable table = dbHelper.ToDataTable();
+
+ //刷新DataGridView数据
+ DbMCControl _dgvGelDoser = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Report_GelDoser").FirstOrDefault();
+ if (_dgvGelDoser == null || !(_dgvGelDoser.BaseControl is DataGridView))
+ {
+ ICSharpCode.Core.LoggingService.Warn("{糊化机报表-查询} 缺少系统日志DataGridView控件...");
+ runtime.IsReturn = false;
+ return;
+ }
+ _dgvGelDoser.BaseControl.BindDataSource = table;
+ }
+ }
+}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs
new file mode 100644
index 0000000..cb660c2
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Report/GelDoser/SelectRowAction.cs
@@ -0,0 +1,94 @@
+using Mesnac.Action.Base;
+using Mesnac.Action.ChemicalWeighing.Report.ProductionReport;
+using Mesnac.Codd.Session;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace Mesnac.Action.ChemicalWeighing.Report.GelDoser
+{
+ ///
+ /// 糊化机报表明细查询事件
+ ///
+ public class SelectRowAction : ChemicalWeighingAction, IAction
+ {
+ private Control _clientGridControl = null; //多维表控件
+
+ public void Run(RuntimeParameter runtime)
+ {
+ base.RunIni(runtime); //必须要调用的
+
+ ICSharpCode.Core.LoggingService.Debug("糊化机报表-明细查询...");
+
+ //获取报表数据
+ DbMCControl _dgvGelDoser = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Report_GelDoser").FirstOrDefault();
+ if (_dgvGelDoser == null || !(_dgvGelDoser.BaseControl is DataGridView))
+ {
+ ICSharpCode.Core.LoggingService.Warn("{生产报表} 缺少糊化机报表DataGridView控件...");
+ runtime.IsReturn = false;
+ return;
+ }
+
+ DataGridView _GelDoserGridView = _dgvGelDoser.BaseControl as DataGridView;
+
+ this._clientGridControl = GetAllControls().Where(x => x.Name.Contains("MultiColHeaderDgv")).FirstOrDefault();
+
+ if (_clientGridControl == null)
+ {
+ ICSharpCode.Core.LoggingService.Warn("{生产报表} 缺少缺少称量名细MultiColHeaderDgv控件...");
+ runtime.IsReturn = false;
+ return;
+ }
+
+ Mesnac.Controls.Default.MultiColHeaderDgv clientGrid = (this._clientGridControl as Mesnac.Controls.Default.MultiColHeaderDgv);
+
+ #region 明细控件格式化
+
+ clientGrid.myColHeaderTreeView = null;
+ clientGrid.DataSource = null;
+ clientGrid.iNodeLevels = 0;
+ clientGrid.ColLists.Clear();
+ clientGrid.ColumnHeadersHeight = 23;
+ clientGrid.ScrollBars = ScrollBars.Both;
+ clientGrid.AllowUserToAddRows = false;
+ clientGrid.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
+ clientGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
+ clientGrid.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font("宋体", 12);
+ clientGrid.DefaultCellStyle.Font = new System.Drawing.Font("宋体", 10);
+ clientGrid.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
+ #endregion
+
+ //获取选中行的ReportId,关联获取明细数据并赋值给明细控件
+ if (_GelDoserGridView.SelectedRows.Count == 1)
+ {
+ string lR_planID = _GelDoserGridView.SelectedRows[0].Cells["reportId"].Value as string;
+
+ //获取数据链接
+ DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
+ if (dbHelper == null)
+ {
+ ICSharpCode.Core.LoggingService.Error("获取本地数据连接失败...");
+ return;
+ }
+ dbHelper.ClearParameter();
+
+ //获取明细数据
+ StringBuilder sqlStr = new StringBuilder(@"select t2.Name as 设备编号,t1.mix as Mix,t1. mixBatch as 批次,t1.mixStep as 步号,t1.actCode as 动作,
+ t1.mixTime as 时间,t1.mixTemp as 温度,t1.mixSpeed as 速度,t1.recordTime as 记录时间
+ from Report_GelDoser_Detail t1
+ left join Device t2 on t1.eqNo = t2.Id
+ where t1.reportId = @reportId");
+ dbHelper.CommandText = sqlStr.ToString();
+ dbHelper.CommandType = System.Data.CommandType.Text;
+ dbHelper.AddParameter("@reportId", lR_planID);
+ DataTable table = dbHelper.ToDataTable();
+
+ clientGrid.DataSource = table;
+ }
+ }
+ }
+}
diff --git a/Main/MCEdit/Data/EventConfig/小料称量/工程调试.xml b/Main/MCEdit/Data/EventConfig/小料称量/工程调试.xml
deleted file mode 100644
index 457af53..0000000
--- a/Main/MCEdit/Data/EventConfig/小料称量/工程调试.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
- 初始化界面
- 初始化界面
-
-
- 打开
- 打开
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Main/MCEdit/Data/EventConfig/小料称量/榄菊报表.糊化机报表.xml b/Main/MCEdit/Data/EventConfig/小料称量/榄菊报表.糊化机报表.xml
new file mode 100644
index 0000000..f1201ac
--- /dev/null
+++ b/Main/MCEdit/Data/EventConfig/小料称量/榄菊报表.糊化机报表.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+ 窗体初始化
+ 窗体初始化
+
+
+ 查询
+ 查询糊化机报表
+
+
+ 报表明细
+ 报表明细
+
+
+
+ 导出
+ 导出糊化机报表
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Main/MCEdit/Data/MCProject/SCWSProject2.mprj b/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
index 84e19c7..2318ef7 100644
--- a/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
+++ b/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
@@ -36,7 +36,6 @@
-
@@ -44,6 +43,7 @@
+
diff --git a/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml b/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml
index 8a975bf..f427d1e 100644
--- a/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml
+++ b/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml
@@ -110,7 +110,7 @@