|
|
|
@ -52,8 +52,160 @@ namespace Mesnac.Action.ChemicalWeighing.FinishBatch
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 启动服务
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (this.runState)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
lock (String.Empty)
|
|
|
|
|
{
|
|
|
|
|
Mesnac.Equips.Factory.Instance.SetMinHZReadDataEvent(ReadData);
|
|
|
|
|
this.runState = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<FinishBatchService>.Error("自动更新计划状态服务异常:" + ex.Message, ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 停止服务
|
|
|
|
|
|
|
|
|
|
public void Stop()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!this.runState)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
lock (String.Empty)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<FinishBatchService>.Debug("开始停止生产数据存盘服务...");
|
|
|
|
|
Mesnac.Equips.Factory.Instance.ClearMinHZReadDataEvent(ReadData);
|
|
|
|
|
ICSharpCode.Core.LoggingService<FinishBatchService>.Debug("停止生产数据存盘服务完毕!");
|
|
|
|
|
this.runState = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<FinishBatchService>.Error("停止生产数据存盘业务服务异常:" + ex.Message, ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 事件处理
|
|
|
|
|
|
|
|
|
|
private void ReadData(object sender, Mesnac.Equips.ReadEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
lock(String.Empty)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region 0、实时刷新自动保存报警
|
|
|
|
|
|
|
|
|
|
SaveHelper.AlarmSaveHelper.Instance.Save();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 2、将等待计划数写入PLC
|
|
|
|
|
|
|
|
|
|
//ChemicalWeighingPlc.PlcPlanHelper.WaitPlanNumToPLC();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 3、更新计划状态
|
|
|
|
|
|
|
|
|
|
//ChemicalWeighingPlc.PlcPlanHelper.UpdatePlanStateFromPlc();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 4、HMI配方列表请求处理
|
|
|
|
|
|
|
|
|
|
//ChemicalWeighingPlc.PlcRecipeHelper.DownloadRecipeNameListToPLC();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 5、HMI计划添加请求处理
|
|
|
|
|
|
|
|
|
|
//ChemicalWeighingPlc.PlcPlanHelper.AutoAddPlan();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 6、HMI计划修改请求处理
|
|
|
|
|
|
|
|
|
|
//ChemicalWeighingPlc.PlcPlanHelper.ChangePlan();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 7、自动存盘处理
|
|
|
|
|
|
|
|
|
|
//FinishBatchHelper.SaveGHData();
|
|
|
|
|
|
|
|
|
|
//ReportDryMixerSaveHelper.Instance.Save();
|
|
|
|
|
ReportWetMixerSaveHelper.Instance.SaveWetMixerReport();
|
|
|
|
|
//ReportGelDoserSaveHelper.Instance.SaveGelDoserReport();
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 8、更新物料名称
|
|
|
|
|
|
|
|
|
|
//ChemicalWeighingPlc.PlcPlanHelper.UpdateMaterialNameToPlc();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 9、修改PC心跳信号
|
|
|
|
|
|
|
|
|
|
//ChemicalWeighingPlc.PlcPlanHelper.HeartBeatChange();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 10、自动换班
|
|
|
|
|
|
|
|
|
|
ChemicalWeighingPlc.PlcPlanHelper.shiftIDAutoChange();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ICSharpCode.Core.LoggingService<FinishBatchService>.Error(ex.Message, ex);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
|
#region 6、设置PCok信号为空闲
|
|
|
|
|
|
|
|
|
|
//#region 保存存盘
|
|
|
|
|
|
|
|
|
|
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.ReportSave_MixWeight_PC_PCok, new object[] { 1 }, false);
|
|
|
|
|
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.ReportSave_Mix_PC_PCok, new object[] { 1 }, false);
|
|
|
|
|
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.ReportSave_MillWeight_PC_PCok, new object[] { 1 }, false);
|
|
|
|
|
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.ReportSave_Mill_PC_PCok, new object[] { 1 }, false);
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 配方交互
|
|
|
|
|
|
|
|
|
|
//BasePlcHelper.Instance.PlcWriteByDataKey(BasePlcHelper.Instance.Mix_RecipeDL_PC_PCok, new object[] { 1 }, false);
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|