| | |
| | | |
| | | using Furion.Logging; |
| | | using IoTClient; |
| | | using Microsoft.AspNetCore.SignalR; |
| | | using System.Data; |
| | | |
| | | namespace WCS.Application; |
| | | public static class PLCService |
| | | { |
| | | private static readonly ISqlSugarClient _db = SqlSugarSetup.ITenant.GetConnectionScope(SqlSugarConst.MainConfigId); |
| | | private static readonly IHubContext<TaskLogHub, ITaskLogHub> _taskLogHubContext; |
| | | |
| | | static PLCService() |
| | | { |
| | | _taskLogHubContext = App.GetService<IHubContext<TaskLogHub, ITaskLogHub>>(); |
| | | } |
| | | |
| | | public static void OnChangeEvent(object sender, EventArgs e) |
| | | { |
| | |
| | | modTaskMonitor.InteractiveMsg = "起始储位为空!"; |
| | | |
| | | _db.Insertable(modTaskMonitor).ExecuteCommand(); |
| | | |
| | | // 通知任务界面任务已存在更新 请更新界面 |
| | | //if (TaskAction.refresh) |
| | | //{ |
| | | // wSChat.AlarmInformation("1"); |
| | | //} |
| | | //下发任务日志 |
| | | _taskLogHubContext.Clients.All.PublicTaskMonitor(modTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | break; |
| | | } |
| | | //给PLC写入任务数据 |
| | |
| | | EndLocat = outStationNum, |
| | | }; |
| | | _db.Insertable(modInsertTaskMonitor).ExecuteCommand(); |
| | | // 通知任务界面任务已存在更新 请更新界面 |
| | | //if (TaskAction.refresh) |
| | | //{ |
| | | // wSChat.AlarmInformation("1"); |
| | | //} |
| | | //下发任务日志 |
| | | _taskLogHubContext.Clients.All.PublicTaskMonitor(modInsertTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | //修改led屏信息 |
| | | //LedDisplay(modDevice.LedIP, "工位:" + modTask.EndLocate, "出库中 " + $"储位地址:{modTask.StartLocate}", "托盘号:" + modTask.PalletNo); |
| | | } |
| | |
| | | Status = TaskStatusEnum.Complete |
| | | }; |
| | | _db.Insertable(modTaskMonitor).ExecuteCommand(); |
| | | //通知任务界面任务已存在更新 请更新界面 |
| | | //if (TaskAction.refresh) |
| | | //{ |
| | | // wSChat.AlarmInformation("1"); |
| | | //} |
| | | //下发任务日志 |
| | | _taskLogHubContext.Clients.All.PublicTaskMonitor(modTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | |
| | | } |
| | | else if (modTask.TaskType.Value == TaskTypeEnum.Out) |
| | |
| | | Status = TaskStatusEnum.Complete |
| | | }; |
| | | _db.Insertable(modTaskMonitor).ExecuteCommand(); |
| | | //通知任务界面任务已存在更新 请更新界面 |
| | | //if (TaskAction.refresh) |
| | | //{ |
| | | // wSChat.AlarmInformation("1"); |
| | | //} |
| | | //下发任务日志 |
| | | _taskLogHubContext.Clients.All.PublicTaskMonitor(modTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | } |
| | | } |
| | | break; |
| | |
| | | Status = TaskStatusEnum.Complete |
| | | }; |
| | | _db.Insertable(modTaskMonitor).ExecuteCommand(); |
| | | // 通知任务界面任务已存在更新 请更新界面 |
| | | //if (TaskAction.refresh) |
| | | //{ |
| | | // wSChat.AlarmInformation("1"); |
| | | //} |
| | | //下发任务日志 |
| | | _taskLogHubContext.Clients.All.PublicTaskMonitor(modTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | } |
| | | else |
| | | { |
| | |
| | | }; |
| | | _db.Insertable(modTaskMonitor).ExecuteCommand(); |
| | | |
| | | // 通知任务界面任务已存在更新 请更新界面 |
| | | //if (TaskAction.refresh) |
| | | //{ |
| | | // wSChat.AlarmInformation("1"); |
| | | //} |
| | | //下发任务日志 |
| | | _taskLogHubContext.Clients.All.PublicTaskMonitor(modTaskMonitor.Adapt<WcsTaskMonitorOutput>()); |
| | | //todo:垛机出库不空跑 |
| | | } |
| | | |