修改钣金任务

dev
liulb@mesnac.com 1 year ago
parent 93581fbad0
commit 5b20bf5780

@ -20,31 +20,29 @@ namespace Admin.Core.Tasks
{
#region 钣金任务
/// <summary>
/// 实时任务信息-每日产量
/// 实时任务信息-每日产量、型号
/// </summary>
public delegate Task SmEverDayDelegate();
public static event SmEverDayDelegate SmEverDayDelegateEvent;
/// <summary>
/// 实时任务信息-展示
/// 实时任务信息
/// </summary>
public delegate Task SmShowDelegate(ExecutePlanInfo info);
public static event SmShowDelegate SmShowDelegateEvent;
public delegate Task SmTaskDelegate();
public static event SmTaskDelegate SmTaskDelegateEvent;
#endregion
private readonly ISmTaskExecutionServices _smTaskExecutionServices;
private readonly IExecutePlanInfoServices _taskExecutionServices;
public Job_SheetMetalTask_Quartz(ISysTasksQzService SysTasksQzService, ISysJobLogService sysJobLogService,
ISmTaskExecutionServices smTaskExecutionServices, IExecutePlanInfoServices taskExecutionServices)
IExecutePlanInfoServices taskExecutionServices)
{
_SysTasksQzService = SysTasksQzService;
_sysJobLogService = sysJobLogService;
_smTaskExecutionServices = smTaskExecutionServices;
_taskExecutionServices = taskExecutionServices;
}
public async Task Execute(IJobExecutionContext context)
{
//await ExecuteJob(context, async () => await Run(context));
await ExecuteJob(context, async () => await ShowRun(context));
await ExecuteJob(context, async () => await CompleteRun(context));
}
@ -60,8 +58,7 @@ namespace Admin.Core.Tasks
#region 实时计划显示
public async Task ShowRun(IJobExecutionContext context)
{
var model = await _taskExecutionServices.FirstAsync(d => d.ExecuteStatus == 2);
SmShowDelegateEvent?.Invoke(model);
await SmTaskDelegateEvent?.Invoke();
}
#endregion

@ -29,6 +29,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
public partial class IndexPageViewModel : ObservableObject
{
protected readonly IExecutePlanInfoServices? _taskExecutionPlanInfoServices;
private AppConfigHelper appConfig = new AppConfigHelper();
List<SelectModel> list = new List<SelectModel>() { new SelectModel()
{
@ -48,7 +49,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
_taskExecutionPlanInfoServices = App.ServiceProvider.GetService<IExecutePlanInfoServices>();
StationName = Appsettings.app("StoreInfo", "StationName");
//Job_SheetMetalTask_Quartz.SmEverDayDelegateEvent += InitEveryDayMethod;
//Job_SheetMetalTask_Quartz.SmShowDelegateEvent += UpdatePlanSHow;//计划内容展示
Job_SheetMetalTask_Quartz.SmTaskDelegateEvent += UpdatePlanSHow;//计划内容展示
WeakReferenceMessenger.Default.Register<string>(this, Recive);
Task.WaitAll(LoadData(), InitExecMethod());
@ -66,7 +67,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
private async Task InitExecMethod()
{
string station = "1001";
string station = Appsettings.app("StoreInfo", "StationCode");
ExecutePlanInfo info = await _taskExecutionPlanInfoServices.FirstAsync(d => d.ProductLineCode.Equals(station) && d.ExecuteStatus == 2);
if (info == null) return;
@ -224,7 +225,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
if (result)
{
PlanInfoDataGrid.Clear();
LoadData();
await LoadData();
}
}
#endregion
@ -572,9 +573,11 @@ namespace Aucma.Core.SheetMetal.ViewModels
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public Task UpdatePlanSHow(ExecutePlanInfo info)
public async Task UpdatePlanSHow()
{
if (info == null) return Task.CompletedTask;
string stationCode = Appsettings.app("StoreInfo", "StationCode");
var info =await _taskExecutionPlanInfoServices.FirstAsync(d=>d.ExecuteStatus==3&& d.ProductLineCode == stationCode);
if (info == null) return;
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() =>
{
@ -584,7 +587,6 @@ namespace Aucma.Core.SheetMetal.ViewModels
ProductModel = info.MaterialName;
BeginTime = info.BeginTime.ToString();
}));
return Task.CompletedTask;
}
#endregion

@ -1,4 +1,5 @@
using Admin.Core.IService;
using Admin.Core.Common;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Service;
using Aucma.Core.SheetMetal.Models;
@ -62,7 +63,8 @@ namespace Aucma.Core.SheetMetal.ViewModels
if (productPlanInfo != null)
{
//下传到PLC
var list = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals("1001"));
string stationCode = Appsettings.app("StoreInfo", "StationCode");
var list = await _executePlanInfoServices.QueryAsync(d => d.ProductLineCode.Equals(stationCode));
ExecutePlanInfo task = new ExecutePlanInfo();
task.ExecutePlanCode = Guid.NewGuid().ToString();
task.ProductPlanCode = PlanInfo.PlanCode;
@ -80,6 +82,7 @@ namespace Aucma.Core.SheetMetal.ViewModels
task.PlanAmount = PlanInfo.SpliteResidueAmount;
task.CompleteAmount = PlanInfo.CompleteAmount;
task.CreatedTime = DateTime.Now;
task.PlanType= productPlanInfo.PlanType;
var result = await _executePlanInfoServices.AddAsync(task);
if (result > 0)
{

@ -6,7 +6,7 @@ using System.Timers;
namespace Aucma.Core.Tasks
{
/// <summary>
/// 实时任务列表
/// 钣金实时任务列表
/// </summary>
public class AucamTaskService : IAucamTaskService
{
@ -15,6 +15,8 @@ namespace Aucma.Core.Tasks
System.Timers.Timer timer2 = new System.Timers.Timer(1000);
System.Timers.Timer timer3 = new System.Timers.Timer(1000);
bool qFlay=true;
bool hFlay = true;
public Task AucamTaskAsync()
{
timer1.Elapsed += new System.Timers.ElapsedEventHandler(Run1); //到达时间的时候执行事件;
@ -40,7 +42,17 @@ namespace Aucma.Core.Tasks
/// <param name="e"></param>
private void Run1(object? sender, ElapsedEventArgs e)
{
if (qFlay)
{
//执行存盘操作
//计划编号
//物料编号
//计划完成数
//计划下线数
//设备状态
//生产节拍
qFlay = true;
}
Console.WriteLine("前板");
}
/// <summary>
@ -50,15 +62,27 @@ namespace Aucma.Core.Tasks
/// <param name="e"></param>
private void Run2(object? sender, ElapsedEventArgs e)
{
if (hFlay)
{
//执行存盘操作
//计划编号
//物料编号
//计划完成数
//计划下线数
//设备状态
//生产节拍
hFlay = true;
}
Console.WriteLine("后板");
}
/// <summary>
/// 钣金——实时任务列表
/// 钣金—实时任务列表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Run3(object? sender, ElapsedEventArgs e)
{
Console.WriteLine("实时任务列表");
}

Loading…
Cancel
Save