diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/Report/Report_WetMixer.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/Report/Report_WetMixer.cs
new file mode 100644
index 0000000..6302610
--- /dev/null
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Entity/Report/Report_WetMixer.cs
@@ -0,0 +1,92 @@
+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_WetMixer
+ {
+ ///
+ /// 构造函数
+ ///
+ ///
+ public Report_WetMixer(Guid id = default)
+ {
+ report_Id = id == default ? Guid.NewGuid() : id;
+ }
+
+ ///
+ /// 报表Id
+ ///
+ public Guid report_Id { get; set; }
+
+ ///
+ /// Dos
+ ///
+ public List wetmixer { get; set; }
+
+ ///
+ /// Mix
+ ///
+ public List mix { get; set; }
+ }
+
+ public class WetMixer
+ {
+ ///
+ /// 设备编号
+ ///
+ public int eqNo { get; set; }
+ ///
+ /// 记录时间
+ ///
+ public string recordTime { get; set; }
+ }
+
+ public class WetMixerMix
+ {
+ ///
+ /// 设备编号
+ ///
+ 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/FinishBatchHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchHelper.cs
index f01e98a..1c27a6b 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/FinishBatchHelper.cs
@@ -467,17 +467,17 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
}
catch (Exception ex)
{
- ICSharpCode.Core.LoggingService.Error(String.Format("物料称量存盘异常:{1}", ex.Message), ex);
+ ICSharpCode.Core.LoggingService.Error(String.Format("物料称量存盘异常:{1}", ex.Message), ex);
}
#endregion
//存盘数据保存完成,写入反馈信号
- ICSharpCode.Core.LoggingService.Debug("数据存盘_PLC物料数据写入数据库处理完毕!");
+ ICSharpCode.Core.LoggingService.Debug("数据存盘_PLC物料数据写入数据库处理完毕!");
bool result = BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.ChemicalWeighing_PC_RpSaved, new object[] { 1 });
if (!result)
{
- ICSharpCode.Core.LoggingService.Debug("数据存盘后写入反馈信号失败!");
+ ICSharpCode.Core.LoggingService.Debug("数据存盘后写入反馈信号失败!");
}
//将车次与计划表中的数量比对,更新计划数量中的完成数量
if (recordSaveDataInfo.PlanId != "")
@@ -508,7 +508,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
}
catch (Exception ex)
{
- ICSharpCode.Core.LoggingService.Error(String.Format("生产数据存盘异常:{1}", ex.Message), ex);
+ ICSharpCode.Core.LoggingService.Error(String.Format("生产数据存盘异常:{1}", ex.Message), ex);
}
}
#endregion
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/AlarmSaveHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/AlarmSaveHelper.cs
index ee5cfb0..5d93bf8 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/AlarmSaveHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/AlarmSaveHelper.cs
@@ -159,7 +159,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
}
catch (Exception ex)
{
- ICSharpCode.Core.LoggingService.Error(String.Format("AlarmSaveHelper逻辑异常:{0}", ex.Message), ex);
+ ICSharpCode.Core.LoggingService.Error(String.Format("AlarmSaveHelper逻辑异常:{0}", ex.Message), ex);
}
}
diff --git a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportSaveHelper.cs b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportSaveHelper.cs
index 1d5b934..6a387eb 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportSaveHelper.cs
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/FinishBatch/SaveHelper/ReportSaveHelper.cs
@@ -1,15 +1,8 @@
-using DevExpress.DataAccess.Native.Json;
-using DevExpress.Office.Utils;
-using DevExpress.XtraPrinting.Native.WebClientUIControl;
-using Mesnac.Action.ChemicalWeighing.Entity.Report;
+using Mesnac.Action.ChemicalWeighing.Entity.Report;
using Mesnac.Codd.Session;
-using Mesnac.PlcUtils;
-using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Data;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
using System.Web.Script.Serialization;
@@ -36,7 +29,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
{
try
{
- ICSharpCode.Core.LoggingService.Debug("干混机报表数据保存开始!!!");
+ ICSharpCode.Core.LoggingService.Debug("干混机报表数据保存开始!!!");
//准备信号读取
//if (BasePlcHelper.Instance.RdyRpt_D1.NowValue.ToInt() == 1)
//{
@@ -66,7 +59,31 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
}
catch (Exception ex)
{
- ICSharpCode.Core.LoggingService.Error(String.Format("干混机报表数据保存异常:{0}", ex.Message), ex);
+ ICSharpCode.Core.LoggingService.Error(String.Format("干混机报表数据保存异常:{0}", ex.Message), ex);
+ }
+ }
+
+ ///
+ /// 湿混机报表数据保存
+ ///
+ public void SaveWetMixerReport()
+ {
+ try
+ {
+ ICSharpCode.Core.LoggingService.Debug("湿混机报表数据保存开始!!!");
+
+
+ //准备信号读取
+
+
+ Report_WetMixer WetMixer_dos0 = readWetMixer("A"); //读取报表数据
+ SaveReportDb(WetMixer_dos0); //保存报表数据
+
+
+ }
+ catch (Exception ex)
+ {
+ ICSharpCode.Core.LoggingService.Error(String.Format("湿混机报表数据保存异常:{0}", ex.Message), ex);
}
}
@@ -87,12 +104,33 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
}
catch (Exception ex)
{
- ICSharpCode.Core.LoggingService.Error(String.Format("通过PLC读取干混机报表数读取异常:{0}", ex.Message), ex);
+ ICSharpCode.Core.LoggingService.Error(String.Format("通过PLC读取干混机报表数读取异常:{0}", ex.Message), ex);
}
return _dryMixer;
}
-
+ ///
+ /// 通过PLC读取湿混机报表数据
+ ///
+ /// 湿混机A、湿混机B
+ ///
+ private Report_WetMixer readWetMixer(string machineType)
+ {
+ Report_WetMixer _wetMixer = null;
+ try
+ {
+ _wetMixer = new Report_WetMixer();
+ _wetMixer.wetmixer = readWetMixers(machineType, 4);
+ _wetMixer.mix = readWetMixerMix(machineType, 10);
+ }
+ catch (Exception ex)
+ {
+ ICSharpCode.Core.LoggingService.Error(String.Format("通过PLC读取湿混机报表数读取异常:{0}", ex.Message), ex);
+ }
+ return _wetMixer;
+ }
+
+
///
/// 读取干混机Dos数据
///
@@ -170,7 +208,73 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
}
///
- /// 保存报表数据至数据库
+ /// 读取湿混机数据
+ ///
+ ///
+ ///
+ ///
+ private List readWetMixers(string machineType, int amount)
+ {
+ List wetMixers = new List();
+ for (int mixer = 0; mixer < 10; mixer++)
+ {
+
+ #region 实例化参数
+ BasePlcHelper.Instance.dryer_eqNo = new Entity.DataKeyValue($"wetMixing{machineType}_{mixer}_eqNo");
+
+ #endregion
+
+ WetMixer wetMixer = new WetMixer()
+ {
+ eqNo = BasePlcHelper.Instance.dryer_eqNo.NowValue.ToInt(),
+ recordTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+ };
+ wetMixers.Add(wetMixer);
+ }
+
+ return wetMixers;
+ }
+
+ ///
+ /// 读取湿混机Mix数据
+ ///
+ ///
+ ///
+ ///
+ private List readWetMixerMix(string machineType, int amount)
+ {
+ List wetMixerMixes = new List();
+ for (int mix = 0; mix < 10; mix++)
+ {
+ #region 实例化参数
+ BasePlcHelper.Instance.dryer_mixBatch = new Entity.DataKeyValue($"wetMixing{machineType}_{mix}_mixBatch");
+ BasePlcHelper.Instance.dryer_mixStep = new Entity.DataKeyValue($"wetMixing{machineType}_{mix}_mixStep");
+ BasePlcHelper.Instance.dryer_actCode = new Entity.DataKeyValue($"wetMixing{machineType}_{mix}_actCode");
+ BasePlcHelper.Instance.dryer_mixTime = new Entity.DataKeyValue($"wetMixing{machineType}_{mix}_mixTime");
+ BasePlcHelper.Instance.dryer_mixTemp = new Entity.DataKeyValue($"wetMixing{machineType}_{mix}_mixTemp");
+ BasePlcHelper.Instance.dryer_mixSpeed = new Entity.DataKeyValue($"wetMixing{machineType}_{mix}_mixSpeed");
+ #endregion
+
+ WetMixerMix wetMixerMix = new WetMixerMix()
+ {
+ eqNo = BasePlcHelper.Instance.dryer_eqNo.NowValue.ToInt(),
+ mixBatch = BasePlcHelper.Instance.dryer_mixBatch.NowValue.ToInt(),
+ mixStep = BasePlcHelper.Instance.dryer_matCode.NowValue.ToInt(),
+ actCode = BasePlcHelper.Instance.dryer_actCode.NowValue.ToInt(),
+ mixTime = BasePlcHelper.Instance.dryer_mixTime.NowValue.ToInt(),
+ mixTemp = BasePlcHelper.Instance.dryer_mixTemp.NowValue.ToDouble(),
+ mixSpeed = BasePlcHelper.Instance.dryer_mixSpeed.NowValue.ToDouble(),
+ mix = mix,
+ recordTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
+ };
+ wetMixerMixes.Add(wetMixerMix);
+ }
+
+ return wetMixerMixes;
+ }
+
+ ///
+ /// 保存干混机报表数据至数据库
///
///
private void SaveReportDb(Report_DryMixer _dryMixer)
@@ -191,11 +295,42 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
}
- ICSharpCode.Core.LoggingService.Warn($"报表数据打印:{str}");
+ ICSharpCode.Core.LoggingService.Warn($"报表数据打印:{str}");
}
catch (Exception ex)
{
- ICSharpCode.Core.LoggingService.Error(String.Format("保存报表数据至数据库异常:{0}", ex.Message), ex);
+ ICSharpCode.Core.LoggingService.Error(String.Format("保存报表数据至数据库异常:{0}", ex.Message), ex);
+ }
+ }
+
+ ///
+ /// 保存湿混机报表数据至数据库
+ ///
+ ///
+ 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);
+ }
+ else 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);
}
}
@@ -243,7 +378,7 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
});
}catch (Exception ex)
{
- ICSharpCode.Core.LoggingService.Error(String.Format("保存干混机报表数据异常:{0}", ex.Message), ex);
+ ICSharpCode.Core.LoggingService.Error(String.Format("保存干混机报表数据异常:{0}", ex.Message), ex);
}
}
@@ -288,7 +423,92 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch.SaveHelper
});
}catch(Exception ex)
{
- ICSharpCode.Core.LoggingService.Error(String.Format("保存干混机报表明细数据异常:{0}", ex.Message), ex);
+ ICSharpCode.Core.LoggingService.Error(String.Format("保存干混机报表明细数据异常:{0}", ex.Message), ex);
+ }
+ }
+
+ ///
+ /// 保存湿混机报表数据
+ ///
+ ///
+ ///
+ private void InsertReportWetMixer(Guid reportId, List wetMixers)
+ {
+ 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)";
+
+ foreach (WetMixer _wetMixer in wetMixers)
+ {
+ 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);
+ }
+ }
+
+ ///
+ /// 保存湿混机报表明细数据
+ ///
+ ///
+ ///
+ private void InsertReportWetMixerDetail(Guid reportId, List wetMixers)
+ {
+ 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_Detail
+ (reportId, eqNo, mixBatch, mixStep, actCode, mixTime, mixTemp, mixSpeed, mix)
+ values
+ (@reportId, @eqNo, @mixBatch, @mixStep, @actCode, @mixTime, @mixTemp, @mixSpeed, @mix)";
+ foreach (WetMixerMix _wetMixerMix in wetMixers)
+ {
+ if (_wetMixerMix.actCode == 0) continue;
+
+ dbHelper.ClearParameter();
+ dbHelper.CommandType = CommandType.Text;
+ dbHelper.CommandText = sqlStr;
+ dbHelper.AddParameter("@reportId", reportId);
+ dbHelper.AddParameter("@eqNo", _wetMixerMix.eqNo);
+ dbHelper.AddParameter("@mixBatch", _wetMixerMix.mixBatch);
+ dbHelper.AddParameter("@mixStep", _wetMixerMix.mixStep);
+ dbHelper.AddParameter("@actCode", _wetMixerMix.actCode);
+ dbHelper.AddParameter("@mixTime", _wetMixerMix.mixTime);
+ dbHelper.AddParameter("@mixTemp", _wetMixerMix.mixTemp);
+ dbHelper.AddParameter("@mixSpeed", _wetMixerMix.mixSpeed);
+ dbHelper.AddParameter("@mix", _wetMixerMix.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 4db16b5..652dc5b 100644
--- a/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
+++ b/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Mesnac.Action.ChemicalWeighing.csproj
@@ -215,6 +215,7 @@
+
diff --git a/Main/MCEdit/Data/MCProject/SCWSProject2.mprj b/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
index f209b36..255e2aa 100644
--- a/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
+++ b/Main/MCEdit/Data/MCProject/SCWSProject2.mprj
@@ -42,8 +42,8 @@
-
+
diff --git a/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml b/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml
new file mode 100644
index 0000000..10d2dc5
--- /dev/null
+++ b/Main/MCEdit/Data/MCProject/nodeForm/湿混机报表.xml
@@ -0,0 +1,311 @@
+
+
diff --git a/Main/MCRun/Program.cs b/Main/MCRun/Program.cs
index b432696..11cc8c4 100644
--- a/Main/MCRun/Program.cs
+++ b/Main/MCRun/Program.cs
@@ -1,11 +1,8 @@
using System;
-using System.Collections.Generic;
using System.Reflection;
-using System.Text;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
-using ICSharpCode.Core.Services;
using Mesnac.Gui.Run.Global;
namespace MCRun
{
@@ -13,10 +10,7 @@ namespace MCRun
using Mesnac.DoUtils;
using Mesnac.Gui.Workbench;
using Mesnac.PlcUtils;
- using Mesnac.PlcUtils.common;
using Mesnac.PlcUtils.enumInfo;
- using Mesnac.PlcUtils.Impl;
- using System.Drawing.Drawing2D;
class Program
{