| | |
| | | ProductionReturn = 550, |
| | | |
| | | /// <summary> |
| | | /// MESéæ |
| | | /// </summary> |
| | | [Description("MESéæ")] |
| | | MesMatReturn = 560, |
| | | |
| | | /// <summary> |
| | | /// 线边ä»å
¥åº |
| | | /// </summary> |
| | | [Description("线边ä»å
¥åº")] |
| | | InboundXB = 560, |
| | | InboundXB = 580, |
| | | |
| | | /// <summary> |
| | | /// æºå°å
¥åº |
| | | /// </summary> |
| | | [Description("æºå°å
¥åº")] |
| | | InboundJT = 570, |
| | | InboundJT = 590, |
| | | |
| | | /// <summary> |
| | | /// 空箱å
¥åº |
| | |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSTask(string palletCode, string sourceAddress); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <param name="sourceAddress"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <param name="sourceAddress"></param> |
| | | /// <param name="roadway"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string roadway); |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | string? RequestAssignLocation(int taskNum, string roadwayNo); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | string? RequestAssignLocationByHeight(int taskNum, string roadwayNo, int heightType); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent TaskCompleted(int taskNum); |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="targetAddress">ä¿®æ¹åçç®æ å°å</param> |
| | | /// <param name="currentAddress">ä¿®æ¹åçå½åå°å</param> |
| | | /// <param name="nextAddress">ä¿®æ¹åçä¸ä¸å°å</param> |
| | | void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = ""); |
| | | void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = ""); |
| | | |
| | | /// <summary> |
| | | /// 请æ±åé
å··é |
| | |
| | | /// |
| | | /// </summary> |
| | | /// <param name="roadwayNos"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, int taskNum, int heightType); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="roadwayNos"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos); |
| | | } |
| | |
| | | [ExporterHeader(DisplayName = "ä»»å¡å·")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»»å¡å·")] |
| | | public int TaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»åºä¸»é® |
| | | /// </summary> |
| | | [ImporterHeader(Name = "ä»åºä¸»é®")] |
| | | [ExporterHeader(DisplayName = "ä»åºä¸»é®")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ä»åºä¸»é®")] |
| | | public int WarehouseId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// AGVä»»å¡å· |
| | | /// </summary> |
| | |
| | | [ExporterHeader(DisplayName = "AGVä»»å¡å·")] |
| | | [SugarColumn(IsNullable = true,Length =50, ColumnDescription = "AGVä»»å¡å·")] |
| | | public string AgvTaskNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æçç¼å· |
| | | /// </summary> |
| | |
| | | DbType = DbType.SqlServer |
| | | }); |
| | | |
| | | //List<Dt_Warehouse> warehouses = sugarClient.Queryable<Dt_Warehouse>().ToList(); |
| | | List<Dt_Warehouse> warehouses = sugarClient.Queryable<Dt_Warehouse>().ToList(); |
| | | |
| | | //_dbContext.Db.Deleteable<Dt_Warehouse>().ExecuteCommand(); |
| | | _dbContext.Db.Deleteable<Dt_Warehouse>().ExecuteCommand(); |
| | | |
| | | //_dbContext.Db.Insertable(warehouses).ExecuteCommand(); |
| | | _dbContext.Db.Insertable(warehouses).ExecuteCommand(); |
| | | |
| | | List<Dt_ApiInfo> apiInfos = _dbContext.Db.Queryable<Dt_ApiInfo>().ToList(); |
| | | |
| | | List<Dt_WarehouseDevice> warehouseDevices = _dbContext.Db.Queryable<Dt_WarehouseDevice>().ToList(); |
| | | |
| | | _cacheService.AddOrUpdate(nameof(Dt_WarehouseDevice), warehouseDevices); |
| | | |
| | | _cacheService.AddOrUpdate(nameof(apiInfos), apiInfos); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<Dt_WarehouseDevice> warehouseDevices = Db.Queryable<Dt_WarehouseDevice>().ToList(); |
| | | |
| | | bool flag = false; |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | foreach (var item in taskDTOs) |
| | | { |
| | | if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum || x.PalletCode == item.PalletCode) != null) |
| | | { |
| | | flag = true; |
| | | continue; |
| | | } |
| | | Dt_Task task = _mapper.Map<Dt_Task>(item); |
| | | task.Creater = "WMS"; |
| | | task.TaskState = (int)TaskStatusEnum.New; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | |
| | | List<Dt_WarehouseDevice> wades = warehouseDevices.Where(x => x.WarehouseId == item.WarehouseId).ToList(); |
| | | |
| | | Dt_Router? router; |
| | | |
| | |
| | | task.NextAddress = router.NextPosi; |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | } |
| | | else if (item.TaskType == TaskTypeEnum.MesMatReturn.ObjToInt() && !router.IsEnd) |
| | | { |
| | | task.NextAddress = router.NextPosi; |
| | | task.DeviceCode = router.ChildPosi; |
| | | } |
| | | else if (item.TaskType == TaskTypeEnum.MesOutbound.ObjToInt()) |
| | | { |
| | | task.NextAddress = router.NextPosi; |
| | |
| | | if (dt_Routers != null && dt_Routers.Count > 0) |
| | | { |
| | | task.NextAddress = dt_Routers.FirstOrDefault().NextPosi; |
| | | task.DeviceCode = dt_Routers.FirstOrDefault().ChildPosiDeviceCode; |
| | | task.DeviceCode = dt_Routers.FirstOrDefault().ChildPosi; |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "æ¥æ¶WMSä»»å¡"); |
| | | |
| | | content = tasks.Count > 0 ? WebResponseContent.Instance.OK("æå") : WebResponseContent.Instance.Error("失败"); |
| | | content = (flag || tasks.Count > 0) ? WebResponseContent.Instance.OK("æå") : WebResponseContent.Instance.Error("失败"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent RequestWMSTaskSimple(string palletCode, string sourceAddress) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}"); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); |
| | | if (taskDTO != null) |
| | | { |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress, string roadway) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åé
å··é |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="roadwayNos"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWMSAssignRoadway(int taskNum, List<string> roadwayNos) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åé
å··é |
| | | /// </summary> |
| | | /// <param name="roadwayNos"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos, int taskNum, int heightType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | } |
| | | string responseStr = HttpHelper.Post($"{address}/api/Task/AssignRoadway?taskNum={taskNum}&heightType={heightType}", roadwayNos.Serialize()); |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | return responseContent; |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åé
å··é |
| | | /// </summary> |
| | | /// <param name="roadwayNos"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestWMSAssignRoadway(List<string> roadwayNos) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public string? RequestAssignLocationByHeight(int taskNum, string roadwayNo, int heightType) |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) throw new Exception("æªæ¾å°WMSApiå°å"); |
| | | string responseStr = HttpHelper.Get($"{address}/api/Task/AssignInboundTaskLocationByHeight?taskNum={taskNum}&roadwayNo={roadwayNo}&heightType={heightType}"); |
| | | |
| | | WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr); |
| | | if (responseContent != null && responseContent.Status && responseContent.Data != null) |
| | | { |
| | | return responseContent.Data.ToString(); |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®è®¾å¤ç¼å·ãä»»å¡ç±»ååç»(å¯é)æç
§ä¼å
级以åå建æ¶é´æåºæ¥è¯¢ä»»å¡æ± æ°å¢çä»»å¡ |
| | | /// </summary> |
| | | /// <param name="deviceNo">设å¤ç¼å·</param> |
| | |
| | | /// <param name="targetAddress">ä¿®æ¹åçç®æ å°å</param> |
| | | /// <param name="currentAddress">ä¿®æ¹åçå½åå°å</param> |
| | | /// <param name="nextAddress">ä¿®æ¹åçä¸ä¸å°å</param> |
| | | public void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "") |
| | | public void UpdateTask(Dt_Task task, TaskStatusEnum taskStatus, string deviceCode = "", string sourceAddress = "", string targetAddress = "", string currentAddress = "", string nextAddress = "", string roadwayNo = "") |
| | | { |
| | | StringBuilder stringBuilder = new StringBuilder(App.User?.UserId == 0 ? $"ç³»ç»èªå¨æµç¨" : "人工æå¨æµç¨"); |
| | | if (task.DeviceCode != deviceCode && !string.IsNullOrEmpty(deviceCode)) |
| | |
| | | { |
| | | stringBuilder.Append($",ä¸ä¸ä½ç½®ç±{task.NextAddress}åæ´ä¸º{nextAddress}"); |
| | | task.NextAddress = nextAddress; |
| | | } |
| | | if (task.Roadway != roadwayNo && !string.IsNullOrEmpty(roadwayNo)) |
| | | { |
| | | stringBuilder.Append($",å··éå·ç±{task.Roadway}åæ´ä¸º{roadwayNo}"); |
| | | task.Roadway = roadwayNo; |
| | | } |
| | | if (task.TaskState != taskStatus.ObjToInt()) |
| | | { |
| | |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (!string.IsNullOrEmpty(address)) |
| | | { |
| | | //HttpHelper.Post($"{address}/api/Task/UpdateTaskInfo", task.Serialize()); |
| | | HttpHelper.Post($"{address}/api/Task/UpdateTaskInfo", task.Serialize()); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Sapre1 { get; set; } |
| | | public short Spare1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Sapre2 { get; set; } |
| | | public short Spare2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交äºä¿¡å· |
| | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Sapre1 { get; set; } |
| | | public short Spare1 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é¢ç |
| | | /// </summary> |
| | | public short Sapre2 { get; set; } |
| | | public short Spare2 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 交äºä¿¡å· |
| | |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.PalletCode == conveyorLineInfoRead.Barcode && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: item.StackerCraneStationCode); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: item.StackerCraneStationCode, deviceCode: task.Roadway, nextAddress: task.TargetAddress); |
| | | } |
| | | |
| | | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); |
| | |
| | | task.TaskState = TaskStatusEnum.Line_Execute.ObjToInt(); |
| | | task.CurrentAddress = stationManger.StationCode; |
| | | _taskRepository.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"ç³»ç»èªå¨æµç¨,ï¼ä»»å¡ç¶æä»ã{oldStatus}ã转å°ã{task.TaskState}ã"); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(taskNum, $"ç³»ç»èªå¨æµç¨,ä»»å¡ç¶æä»ã{oldStatus}ã转å°ã{task.TaskState}ã"); |
| | | //todo 宿 |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup || task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; |
| | | string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(url)) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | |
| | | using Quartz; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | using WIDESEAWCS_Common.Helper; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_TaskInfoService; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | [DisallowConcurrentExecution] |
| | | public class ConveyorLineJob_BC : JobBase, IJob |
| | | { |
| | | |
| | | private readonly ICacheService _cacheService; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IRouterExtension _routerExtension; |
| | | private readonly List<Dt_WarehouseDevice> warehouseDevices; |
| | | |
| | | public ConveyorLineJob_BC(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) |
| | | public ConveyorLineJob_BC(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) |
| | | { |
| | | _cacheService = cacheService; |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | |
| | | _routerRepository = routerRepository; |
| | | _routerService = routerService; |
| | | _routerExtension = routerExtension; |
| | | |
| | | string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); |
| | | if (!string.IsNullOrEmpty(warehouseDevicesStr)) |
| | | { |
| | | warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); |
| | | } |
| | | else |
| | | { |
| | | warehouseDevices = new List<Dt_WarehouseDevice>(); |
| | | } |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == device.DeviceCode); |
| | | if (warehouseDevice == null) |
| | | { |
| | | WriteError(device.DeviceName, $"请é
ç½®ä»åºè®¾å¤ä¿¡æ¯"); |
| | | return Task.CompletedTask; |
| | | } |
| | | List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) |
| | |
| | | |
| | | if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) |
| | | { |
| | | { |
| | | #region çæä»»å¡åç»è¾é线å¯å¨ä¿¡å· |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) /*&& x.DeviceCode == item.StationDeviceCode*/ && (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.WarehouseId == warehouseDevice.WarehouseId); |
| | | if (task != null && conveyorLineInfoWrite.Spare2 == 0) |
| | | { |
| | | List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList(); |
| | | WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations, task.TaskNum, conveyorLineInfoRead.Spare2); |
| | | if (responseContent.Status) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.Spare2, 1, item.StationCode); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute, deviceCode: item.StationDeviceCode, roadwayNo: responseContent.Data.ToString() ?? ""); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK) |
| | | { |
| | | if (conveyorLineInfoRead.TaskNum == 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))//éè´å
¥åº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | | #region ä»»å¡å·ä¸º0ï¼ä¸ææçå·ï¼åæ¯éè´å
¥åº |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt()) && x.PalletCode == conveyorLineInfoRead.Barcode && x.WarehouseId == warehouseDevice.WarehouseId); |
| | | if (task != null) |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.Spare2, 0, item.StationCode); |
| | | |
| | | string currentAddress = task.CurrentAddress; |
| | | string nextAddress = task.NextAddress; |
| | | string targetAddress = task.TargetAddress; |
| | | string deviceCode = task.DeviceCode; |
| | | TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, task.Roadway, task.TaskType); |
| | | if (routers == null || routers.Count == 0) |
| | | Dt_Router? router = routers.FirstOrDefault(); |
| | | if (routers == null || routers.Count == 0 || router == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | |
| | | WriteError(item.StationName, $"è·¯ç±ä¿¡æ¯é
ç½®é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | Dt_Router router = routers.FirstOrDefault(); |
| | | |
| | | if (router.IsEnd) |
| | | { |
| | | currentAddress = item.StackerCraneStationCode; |
| | | nextAddress = task.TargetAddress; |
| | | taskState = TaskStatusEnum.SC_Execute; |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); |
| | | string? targetLoca = _taskService.RequestAssignLocationByHeight(task.TaskNum, task.Roadway, conveyorLineInfoRead.Spare2); |
| | | if (!string.IsNullOrEmpty(targetLoca)) |
| | | { |
| | | currentAddress = item.StackerCraneStationCode; |
| | | targetAddress = targetLoca; |
| | | nextAddress = targetLoca; |
| | | taskState = TaskStatusEnum.SC_Execute; |
| | | deviceCode = item.StackerCraneCode; |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"请æ±åé
è´§ä½å¤±è´¥,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress); |
| | | _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress, targetAddress: targetAddress, deviceCode: deviceCode); |
| | | } |
| | | else |
| | | { |
| | | List<Dt_Router> routers = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()); |
| | | |
| | | List<string> stations = routers.Select(x => x.NextPosi).ToList(); |
| | | |
| | | WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations); |
| | | if (responseContent.Status) |
| | | { |
| | | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode, responseContent.Data.ToString()); |
| | | if (content.Status) |
| | | { |
| | | task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && (x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() || x.TaskState == TaskStatusEnum.New.ObjToInt())); |
| | | if (task != null) |
| | | { |
| | | Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == item.StationCode); |
| | | if (router == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | string currentAddress = task.CurrentAddress; |
| | | string nextAddress = task.NextAddress; |
| | | TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; |
| | | |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | if (router.NextPosi != task.NextAddress) |
| | | { |
| | | currentAddress = item.StackerCraneStationCode; |
| | | nextAddress = task.TargetAddress; |
| | | taskState = TaskStatusEnum.SC_Execute; |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | } |
| | | |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress); |
| | | //continue; |
| | | |
| | | //_taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | |
| | | //device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | //device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | //device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | //device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | //device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | else//ç产éåº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); // 带任å¡å·æ¥è¯¢ä»»å¡ |
| | | #region ç产éåº,带任å¡å·æ¥è¯¢ä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.WarehouseId == warehouseDevice.WarehouseId); // 带任å¡å·æ¥è¯¢ä»»å¡ |
| | | if (task != null) |
| | | { |
| | | Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && x.StartPosi == item.StationCode); |
| | | if (router == null) |
| | | List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList(); |
| | | WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(stations, task.TaskNum, conveyorLineInfoRead.Spare2); |
| | | if (responseContent.Status) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | string currentAddress = task.CurrentAddress; |
| | | string nextAddress = task.NextAddress; |
| | | string targetAddress = task.TargetAddress; |
| | | TaskStatusEnum taskState = TaskStatusEnum.Line_Executing; |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(item.StationCode, task.Roadway, task.TaskType); |
| | | Dt_Router? router = routers.FirstOrDefault(); |
| | | if (routers == null || routers.Count == 0 || router == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºè·¯ç±ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | if (routers.Count > 1) |
| | | { |
| | | WriteError(item.StationName, $"è·¯ç±ä¿¡æ¯é
ç½®é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | |
| | | if (router.IsEnd) |
| | | { |
| | | string? targetLoca = _taskService.RequestAssignLocationByHeight(task.TaskNum, task.Roadway, conveyorLineInfoRead.Spare2); |
| | | if (!string.IsNullOrEmpty(targetLoca)) |
| | | { |
| | | currentAddress = item.StackerCraneStationCode; |
| | | nextAddress = targetAddress; |
| | | taskState = TaskStatusEnum.SC_Execute; |
| | | targetAddress = targetLoca; |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.CurrentAddress, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | WriteError(item.StationName, $"请æ±åé
è´§ä½å¤±è´¥,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | } |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress, targetAddress: targetAddress); |
| | | } |
| | | |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | | if (stationManger == null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | |
| | | string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, router.NextPosi); |
| | | if (string.IsNullOrEmpty(locationCode)) |
| | | { |
| | | WriteError(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: stationManger.StackerCraneCode, targetAddress: locationCode, currentAddress: stationManger.StackerCraneStationCode, nextAddress: locationCode); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | #endregion |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum == 0)//åºåº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt()); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.DeviceCode == item.StationDeviceCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.WarehouseId == warehouseDevice.WarehouseId); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && string.IsNullOrEmpty(x.DeviceCode) && x.TaskState == TaskStatusEnum.New.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.CurrentAddress); |
| | | if (stationManger != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: stationManger.StackerCraneCode, currentAddress: stationManger.StackerCraneStationCode, nextAddress: task.TargetAddress); |
| | | } |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType) && string.IsNullOrEmpty(x.DeviceCode) && x.TaskState == TaskStatusEnum.New.ObjToInt() && x.WarehouseId == warehouseDevice.WarehouseId); |
| | | // if (task != null) |
| | | // { |
| | | // Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == task.CurrentAddress); |
| | | // if (stationManger != null) |
| | | // { |
| | | // _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: stationManger.StackerCraneCode, currentAddress: stationManger.StackerCraneStationCode, nextAddress: task.TargetAddress); |
| | | // } |
| | | // } |
| | | //} |
| | | } |
| | | else if (!conveyorLineSignalRead.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK) |
| | | { |
| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Microsoft.IdentityModel.Tokens; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | using WIDESEAWCS_Common.Helper; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | |
| | | [DisallowConcurrentExecution] |
| | | public class RGVJob_BC : JobBase, IJob |
| | | { |
| | | |
| | | private readonly ICacheService _cacheService; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly List<Dt_WarehouseDevice> warehouseDevices; |
| | | |
| | | public RGVJob_BC(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService) |
| | | public RGVJob_BC(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService) |
| | | { |
| | | _cacheService = cacheService; |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _routerRepository = routerRepository; |
| | | _routerService = routerService; |
| | | |
| | | string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); |
| | | if (!string.IsNullOrEmpty(warehouseDevicesStr)) |
| | | { |
| | | warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); |
| | | } |
| | | else |
| | | { |
| | | warehouseDevices = new List<Dt_WarehouseDevice>(); |
| | | } |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | |
| | | Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == device.DeviceCode); |
| | | if (warehouseDevice == null) |
| | | { |
| | | WriteError(device.DeviceName, $"请é
ç½®ä»åºè®¾å¤ä¿¡æ¯"); |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) |
| | |
| | | { |
| | | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//å
¥åº |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.PalletCode == conveyorLineInfoRead.Barcode && string.IsNullOrEmpty(x.DeviceCode) && string.IsNullOrEmpty(x.NextAddress) && string.IsNullOrEmpty(x.TargetAddress)); |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.Barcode, item.StationCode); |
| | | if (content.Status) |
| | | { |
| | | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | | if (stationManger == null) |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.Barcode && x.CurrentAddress == item.StationCode && x.DeviceCode == device.DeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); |
| | | if (task != null) |
| | | { |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && (task.Roadway == x.ChildPosiDeviceCode || task.Roadway == x.ChildPosi)); |
| | | Dt_Router? router = routers.FirstOrDefault(); |
| | | if (router == null) |
| | | { |
| | | WriteError(device.DeviceName, $"æªæ¾å°ä»»å¡ç±»å{task.TaskType}对åºçè·¯ç±ä¿¡æ¯"); |
| | | } |
| | | else |
| | | { |
| | | if (routers.Count == 1) |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: router.ChildPosi, targetAddress: router.NextPosi, nextAddress: router.StartPosi, currentAddress: item.StationCode); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, router.StartPosi, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | List<string> canInboundStations = new List<string>(); |
| | | List<string> stations = routers.Select(x => x.NextPosi).ToList(); |
| | | foreach (string station in stations) |
| | | { |
| | | Dt_StationManger stationManger1 = _stationMangerRepository.QueryFirst(x => x.StationCode == station); |
| | | if (stationManger1 != null) |
| | | { |
| | | IDevice? device1 = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger1.StationDeviceCode); |
| | | if (device1 != null) |
| | | { |
| | | OtherDevice otherDevice = (OtherDevice)device1; |
| | | //short workType = otherDevice.GetValue<R_ConveyorLineWorkType, short>(R_ConveyorLineWorkType.ConveyorLineWorkType, item.StationCode); |
| | | //if (workType == ConveyorWorkTypeEnum.Undefined.ObjToInt() || workType == ConveyorWorkTypeEnum.Inbound.ObjToInt()) |
| | | { |
| | | canInboundStations.Add(stationManger1.Remark); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(task.TaskNum, canInboundStations); |
| | | if (responseContent.Status) |
| | | { |
| | | List<Dt_Router> dt_Routers = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType); |
| | | |
| | | Dt_Router? routerTemp = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType).FirstOrDefault(); |
| | | if (routerTemp != null) |
| | | { |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.Roadway = responseContent.Data.ToString() ?? task.Roadway; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: routerTemp.ChildPosiDeviceCode, targetAddress: routerTemp.NextPosi, nextAddress: routerTemp.NextPosi, currentAddress: item.StationCode); |
| | | |
| | | device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, routerTemp.NextPosi, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | | WriteError(device.DeviceName, $"æªæ¾å°ä»»å¡ç±»å{task.TaskType},èµ·ç¹{item.StationCode},ç»ç¹{responseContent.Data.ToString()}çè·¯ç±ä¿¡æ¯"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(device.DeviceName, responseContent.Message); |
| | | } |
| | | } |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); |
| | | } |
| | | } |
| | | |
| | | #region |
| | | //Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.PalletCode == conveyorLineInfoRead.Barcode && string.IsNullOrEmpty(x.DeviceCode) && string.IsNullOrEmpty(x.NextAddress) && string.IsNullOrEmpty(x.TargetAddress)); |
| | | //if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | //{ |
| | | // Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); |
| | | // if (stationManger == null) |
| | | // { |
| | | // WriteError(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | // continue; |
| | | // } |
| | | // List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && (task.Roadway == x.ChildPosiDeviceCode || task.Roadway == x.ChildPosi)); |
| | | // Dt_Router? router = routers.FirstOrDefault(); |
| | | // if (router == null) |
| | | // { |
| | | // WriteError(device.DeviceName, $"æªæ¾å°ä»»å¡ç±»å{task.TaskType}对åºçè·¯ç±ä¿¡æ¯"); |
| | | // } |
| | | // else |
| | | // { |
| | | // if (routers.Count == 1) |
| | | // { |
| | | // task.Dispatchertime = DateTime.Now; |
| | | // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: router.ChildPosi, targetAddress: router.NextPosi, nextAddress: router.StartPosi, currentAddress: item.StationCode); |
| | | |
| | | // device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.EndPos, router.StartPosi, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | // } |
| | | // else |
| | | // { |
| | | // List<string> canInboundStations = new List<string>(); |
| | | // List<string> stations = routers.Select(x => x.NextPosi).ToList(); |
| | | // foreach (string station in stations) |
| | | // { |
| | | // Dt_StationManger stationManger1 = _stationMangerRepository.QueryFirst(x => x.StationCode == station); |
| | | // if (stationManger1 != null) |
| | | // { |
| | | // IDevice? device1 = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger1.StationDeviceCode); |
| | | // if (device1 != null) |
| | | // { |
| | | // OtherDevice otherDevice = (OtherDevice)device1; |
| | | // //short workType = otherDevice.GetValue<R_ConveyorLineWorkType, short>(R_ConveyorLineWorkType.ConveyorLineWorkType, item.StationCode); |
| | | // //if (workType == ConveyorWorkTypeEnum.Undefined.ObjToInt() || workType == ConveyorWorkTypeEnum.Inbound.ObjToInt()) |
| | | // { |
| | | // canInboundStations.Add(stationManger1.Remark); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(task.TaskNum, canInboundStations); |
| | | // if (responseContent.Status) |
| | | // { |
| | | // List<Dt_Router> dt_Routers = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType); |
| | | |
| | | // Dt_Router? routerTemp = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType).FirstOrDefault(); |
| | | // if (routerTemp != null) |
| | | // { |
| | | // task.Dispatchertime = DateTime.Now; |
| | | // task.Roadway = responseContent.Data.ToString() ?? task.Roadway; |
| | | // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: routerTemp.ChildPosiDeviceCode, targetAddress: routerTemp.NextPosi, nextAddress: routerTemp.NextPosi, currentAddress: item.StationCode); |
| | | |
| | | // device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.EndPos, routerTemp.NextPosi, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); |
| | | // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | // } |
| | | // else |
| | | // { |
| | | // WriteError(device.DeviceName, $"æªæ¾å°ä»»å¡ç±»å{task.TaskType},èµ·ç¹{item.StationCode},ç»ç¹{responseContent.Data.ToString()}çè·¯ç±ä¿¡æ¯"); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // WriteError(device.DeviceName, responseContent.Message); |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | #endregion |
| | | } |
| | | else if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//åºåº |
| | | { |
| | |
| | | using WIDESEAWCS_TaskInfoService; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using Autofac.Core; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private List<Dt_ApiInfo> apiInfos; |
| | | private readonly List<Dt_WarehouseDevice> warehouseDevices; |
| | | |
| | | public StackerCraneJob_BC(ITaskService taskService, ICacheService cacheService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository) |
| | | { |
| | |
| | | apiInfos = infos; |
| | | } |
| | | } |
| | | |
| | | |
| | | string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); |
| | | if (!string.IsNullOrEmpty(warehouseDevicesStr)) |
| | | { |
| | | warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); |
| | | } |
| | | else |
| | | { |
| | | warehouseDevices = new List<Dt_WarehouseDevice>(); |
| | | } |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == commonStackerCrane.DeviceCode); |
| | | if (warehouseDevice == null) |
| | | { |
| | | WriteError(commonStackerCrane.DeviceName, $"请é
ç½®ä»åºè®¾å¤ä¿¡æ¯"); |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | if (!commonStackerCrane.IsEventSubscribed) |
| | | { |
| | | commonStackerCrane.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(url)) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | WriteError(commonStackerCrane.DeviceCode, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | return null; |
| | | } |
| | | HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ |
| | | //string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress; |
| | | //if (string.IsNullOrEmpty(url)) |
| | | //{ |
| | | // _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | // WriteError(commonStackerCrane.DeviceCode, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | // _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | | // return null; |
| | | //} |
| | | //HttpHelper.Post($"{url}?taskNum={task.TaskNum}&locationCode={task.NextAddress}", "");//todo è°ç¨WMSä»»å¡å®ææ¹æ³ |
| | | } |
| | | |
| | | return task; |
| | |
| | | |
| | | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.FeedBackWMSTaskCompleted.ToString())?.ApiAddress; |
| | | string? url = apiInfos.FirstOrDefault(x => x.ApiCode == APIEnum.WMSIsReloaction.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(url)) |
| | | { |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"æªæ¾å°WMSç§»åºå¤ææ¥å£"); |
| | |
| | | "core-js": "^3.6.5", |
| | | "echarts": "^5.0.2", |
| | | "element-plus": "^2.2.14", |
| | | "jsbarcode": "^3.11.6", |
| | | "less": "^4.1.1", |
| | | "qrcode": "^1.5.4", |
| | | "vue": "^3.2.37", |
| | | "vue-barcode": "^1.3.0", |
| | | "vue-draggable-next": "^2.0.1", |
| | | "vue-qrcode": "^2.2.2", |
| | | "vue-router": "^4.0.0-0", |
| | |
| | | /// æçç±»å |
| | | /// </param> |
| | | /// <returns></returns> |
| | | public Dt_LocationInfo? AssignLocation_BC(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "") |
| | | public Dt_LocationInfo? AssignLocation_BC(string roadwayNo, int palletType, Dt_PalletTypeInfo palletTypeInfo, string beRelocationCode = "", int heightType = 0) |
| | | { |
| | | lock (_locker_BC) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | //å·²å®ä¹è´§ä½ç±»åçè´§ä½ |
| | | List<Dt_LocationInfo> definedTypeLocations = locationInfos.Where(x => x.LocationType == palletType.ObjToInt()).ToList(); |
| | | |
| | | //æªå®ä¹ç±»åçç©ºè´§ä½ |
| | | List<Dt_LocationInfo> undefinedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == LocationTypeEnum.Undefined.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).ToList(); |
| | | |
| | | List<Dt_LocationInfo> definedTypeEmptyLocations = locationInfos.Where(x => (x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() || x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == palletType.ObjToInt() && !lockLocationCodes.Contains(x.LocationCode)).OrderByDescending(x => x.Depth).ThenBy(x => x.Layer).ThenBy(x => x.Column).ThenBy(x => x.Row).ToList(); |
| | | |
| | | if(heightType == 1) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x=>x.Layer <= 3).ToList(); |
| | | definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer <= 3).ToList(); |
| | | } |
| | | else if(heightType == 2) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer == 4).ToList(); |
| | | definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer == 4).ToList(); |
| | | } |
| | | else if (heightType == 3) |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => x.Layer == 5).ToList(); |
| | | definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => x.Layer == 5).ToList(); |
| | | } |
| | | else |
| | | { |
| | | undefinedTypeEmptyLocations = undefinedTypeEmptyLocations.Where(x => false).ToList(); |
| | | definedTypeEmptyLocations = definedTypeEmptyLocations.Where(x => false).ToList(); |
| | | } |
| | | |
| | | if (palletTypeInfo.LocaitonCount == 2) |
| | | { |
| | | if (roadwayNo != "SC01_BC") |
| | |
| | | public partial class LocationInfoService |
| | | { |
| | | |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId) |
| | | public Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId, string beRelocationCode = "", int heightType = 0) |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); |
| | | if (warehouse == null) |
| | |
| | | |
| | | return warehouse.WarehouseCode switch |
| | | { |
| | | "HA57" => AssignLocation_BC(roadwayNo, palletType, palletTypeInfo), |
| | | "HA58" => AssignLocation_PP(roadwayNo, palletType, palletTypeInfo), |
| | | "HA152" => AssignLocation_GM(roadwayNo, palletType, palletTypeInfo), |
| | | "HA64" => AssignLocation_CSJ(roadwayNo, palletType, palletTypeInfo), |
| | | "é»çä»" => AssignLocation_ZH(roadwayNo, palletType, palletTypeInfo), |
| | | "HA57" => AssignLocation_BC(roadwayNo, palletType, palletTypeInfo, beRelocationCode, heightType), |
| | | "HA58" => AssignLocation_PP(roadwayNo, palletType, palletTypeInfo, beRelocationCode), |
| | | "HA152" => AssignLocation_GM(roadwayNo, palletType, palletTypeInfo, beRelocationCode), |
| | | "HA64" => AssignLocation_CSJ(roadwayNo, palletType, palletTypeInfo, beRelocationCode), |
| | | "é»çä»" => AssignLocation_ZH(roadwayNo, palletType, palletTypeInfo, beRelocationCode), |
| | | "HA153" => AssignLocation(roadwayNo), |
| | | "HA71" => AssignLocation(roadwayNo), |
| | | "HA60" => AssignLocation(roadwayNo), |
| | |
| | | [Description("æ£é宿")] |
| | | æ£é宿 =14, |
| | | |
| | | [Description("éåº")] |
| | | MESéåº = 21, |
| | | |
| | | [Description("ç»çæ¤é")] |
| | | ç»çæ¤é = 99, |
| | | |
| | |
| | | /// <param name="roadwayNo">å··éå·</param> |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId); |
| | | Dt_LocationInfo? AssignLocation(string roadwayNo, int palletType, int warehouseId, string beRelocationCode = "", int heightType = 0); |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹è´§ä½ç¶æåç±»å |
| | |
| | | WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode); |
| | | |
| | | /// <summary> |
| | | /// ä»
ç³è¯·ä»»å¡ï¼è®©WCSæ ¹æ®è·¯ç±ç¡®å®ä¸ä¸å°å |
| | | /// </summary> |
| | | /// <param name="stationCode"></param> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent DeviceRequestInboundTask(string stationCode, string palletCode); |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | |
| | | /// <param name="palletType">æçç±»å</param> |
| | | /// <returns></returns> |
| | | WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType); |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | MesResponseContent SubstrateBack(SubstrateBackModel model); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="roadwayNos"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent AssignRoadway(List<string> roadwayNos, int taskNum, int heightType = 0); |
| | | |
| | | /// <summary> |
| | | /// åé
å··é |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNos">å··éå·</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignRoadway(List<string> roadwayNos, int taskNum, int heightType = 0) |
| | | { |
| | | try |
| | | { |
| | | if(heightType == 0 || heightType > 3) |
| | | { |
| | | return WebResponseContent.Instance.Error($"é«åº¦é误"); |
| | | } |
| | | |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥å
¥åºä»»å¡"); |
| | | } |
| | | |
| | | if (_basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress) != null) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: task.TargetAddress); |
| | | } |
| | | string roadwayNo = ""; |
| | | if (heightType == 1) |
| | | { |
| | | List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer <= 3).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; |
| | | } |
| | | else if (heightType == 2) |
| | | { |
| | | List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 4).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; |
| | | } |
| | | else if (heightType == 3) |
| | | { |
| | | List<LocationCount> locationCounts = Db.Queryable<Dt_LocationInfo>().Where(x => (x.LocationType == task.PalletType || x.LocationType == LocationTypeEnum.Undefined.ObjToInt()) && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && roadwayNos.Contains(x.RoadwayNo) && x.Layer == 5).GroupBy(x => x.RoadwayNo).Select(x => new LocationCount { RoadwayNo = x.RoadwayNo, Count = SqlFunc.AggregateCount(x) }).ToList(); |
| | | roadwayNo = locationCounts.OrderBy(x => x.Count).FirstOrDefault()?.RoadwayNo ?? ""; |
| | | } |
| | | |
| | | return !string.IsNullOrEmpty(roadwayNo) ? WebResponseContent.Instance.OK(data: roadwayNo) : WebResponseContent.Instance.Error("æªæ¾å°å¯åé
å··é"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNos">å··éå·</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignRoadway(int taskNum, List<string> roadwayNos) |
| | | { |
| | | try |
| | |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡ç³è¯·åé
è´§ä½ |
| | | /// </summary> |
| | | /// <param name="taskNum">ä»»å¡å·</param> |
| | | /// <param name="roadwayNos">å··éå·</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignRoadway(List<string> roadwayNos) |
| | |
| | | OutboundQuantity = 0, |
| | | SerialNumber = stockInfoDetail_Hty?.SerialNumber ?? "0", |
| | | StockQuantity = model.Quantity, |
| | | Status = StockStatusEmun.ç»çæå.ObjToInt(), |
| | | Status = StockStatusEmun.MESéåº.ObjToInt(), |
| | | Unit = model.Unit |
| | | }; |
| | | |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | PalletCode = stockInfo.PalletCode, |
| | | CurrentAddress = "", |
| | | NextAddress = "", |
| | | PalletType = stockInfo.PalletType, |
| | | Roadway = "RGV01_BC", |
| | | SourceAddress = "RGV01_BC", |
| | | TargetAddress = "", |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | //Dt_Task task = new Dt_Task() |
| | | //{ |
| | | // PalletCode = stockInfo.PalletCode, |
| | | // CurrentAddress = "", |
| | | // NextAddress = "", |
| | | // PalletType = stockInfo.PalletType, |
| | | // Roadway = "RGV01_BC", |
| | | // SourceAddress = "RGV01_BC", |
| | | // TargetAddress = "", |
| | | // TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | // TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(), |
| | | // WarehouseId = warehouse.WarehouseId |
| | | //}; |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | | BaseDal.AddData(task); |
| | | //BaseDal.AddData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | return MesResponseContent.Instance.OK(); |
| | |
| | | if (task.TaskType == TaskTypeEnum.MesOutbound.ObjToInt()) |
| | | { |
| | | MesMaterialLotaAceptModel model = GetMesMaterialLotaAceptModel(stockInfo, stockInfo.Details.FirstOrDefault(), mesOutboundOrders.FirstOrDefault().TaskNo, warehouse.WarehouseCode, mesOutboundOrders.FirstOrDefault().OrderQuantity); |
| | | UploadMesMaterialLotaAcept(model); |
| | | UploadMesMaterialLotaAcept(model); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | |
| | | /// <summary> |
| | | /// ç³è¯·å
¥åºä»»å¡(PDA使ç¨ï¼ä»
æçç»å®å
¥åºç«å°ï¼ä¸åé
è´§ä½) |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="stationCode">ç«å°å·</param> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RequestInboundTask(SaveModel saveModel) |
| | | { |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å
¥ç©ºç®± |
| | | /// </summary> |
| | | /// <param name="barcode"></param> |
| | | /// <param name="address"></param> |
| | | /// <param name="WarehouseId"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent InEmpty(string barcode, string address, int WarehouseId) |
| | | { |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="qty"></param> |
| | | /// <param name="address"></param> |
| | | /// <param name="WarehouseId"></param> |
| | | /// <param name="barcode"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent OutEmpty(int qty, string address, int WarehouseId, string barcode) |
| | | { |
| | | try |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="stationCode"></param> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode) |
| | | { |
| | | try |
| | |
| | | Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (task != null) |
| | | { |
| | | PushTasksToWCS(new List<Dt_Task> { task }); |
| | | return WebResponseContent.Instance.OK($"该æçå·²çæä»»å¡", _mapper.Map<WMSTaskDTO>(task)); |
| | | } |
| | | |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.åºåºå®æ.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt()) |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.åºåºå®æ.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.éåº.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MESéåº.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | |
| | | PalletType = stockInfo.PalletType |
| | | }; |
| | | |
| | | |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | else if (stockInfo.StockStatus == StockStatusEmun.MESéåº.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, newTask.PalletType, LocationStatusEnum.Lock, newTask.WarehouseId); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask); |
| | | |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | if (newTask.WarehouseId == 5) PutFinish(stationCode); |
| | | return WebResponseContent.Instance.OK(data: wMSTaskDTO); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»
ç³è¯·ä»»å¡ï¼è®©WCSæ ¹æ®è·¯ç±ç¡®å®ä¸ä¸å°å |
| | | /// </summary> |
| | | /// <param name="stationCode"></param> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent DeviceRequestInboundTask(string stationCode, string palletCode) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (task != null) |
| | | { |
| | | PushTasksToWCS(new List<Dt_Task> { task }); |
| | | return WebResponseContent.Instance.OK($"该æçå·²çæä»»å¡", _mapper.Map<WMSTaskDTO>(task)); |
| | | } |
| | | |
| | | if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该ç«ç¹å·²ææªæ§è¡çä»»å¡"); |
| | | } |
| | | |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (stockInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç»çä¿¡æ¯"); |
| | | } |
| | | if (stockInfo.StockStatus != StockStatusEmun.ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æå¨ç»çæå.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.åºåºå®æ.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.æ£é宿.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.éåº.ObjToInt() && stockInfo.StockStatus != StockStatusEmun.MESéåº.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçç¶æä¸æ£ç¡®,ä¸å¯ç³è¯·å
¥åº"); |
| | | } |
| | | if (!string.IsNullOrEmpty(stockInfo.LocationCode)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æçå·²ç»å®è´§ä½"); |
| | | } |
| | | |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = stationCode, |
| | | Grade = 0, |
| | | NextAddress = "", |
| | | PalletCode = palletCode, |
| | | Roadway = "", |
| | | SourceAddress = stationCode, |
| | | TargetAddress = "", |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | }; |
| | | |
| | | |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.æå¨ç»çå
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | else if (stockInfo.StockStatus == StockStatusEmun.MESéåº.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.MesMatReturn.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | stockInfo.StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(); |
| | | } |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥å
¥åºä»»å¡"); |
| | | } |
| | | |
| | | if (_basicRepository.LocationInfoRepository.QueryFirst(x => x.LocationCode == task.TargetAddress) != null) |
| | | { |
| | | return WebResponseContent.Instance.OK(data: task.TargetAddress); |
| | | } |
| | | |
| | | Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(roadwayNo, task.PalletType, task.WarehouseId, heightType: heightType); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½åé
失败,æªæ¾å°å¯åé
è´§ä½"); |
| | | } |
| | | |
| | | task.Roadway = roadwayNo; |
| | | task.TargetAddress = locationInfo.LocationCode; |
| | | task.TaskStatus = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); |
| | | BaseDal.UpdateData(task); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(data: locationInfo.LocationCode); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | return Service.OutEmpty(qty, address, WarehouseId, barcode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// WCSç³è¯·å
¥åºä»»å¡(åé
è´§ä½) |
| | | /// </summary> |
| | | /// <param name="stationCode"></param> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("DeviceRequestInboundTask"), AllowAnonymous] |
| | | public WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode) |
| | | { |
| | | return Service.DeviceRequestInboundTask(stationCode, roadwayNo, palletCode); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// WCSç³è¯·å
¥åºä»»å¡(ä¸åé
è´§ä½) |
| | | /// </summary> |
| | | /// <param name="stationCode"></param> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("DeviceRequestInboundTaskSimple"), AllowAnonymous] |
| | | public WebResponseContent DeviceRequestInboundTaskSimple(string stationCode, string palletCode) |
| | | { |
| | | return Service.DeviceRequestInboundTask(stationCode, palletCode); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public WebResponseContent AssignInboundTaskLocation(int taskNum, string roadwayNo) |
| | | { |
| | | return Service.AssignInboundTaskLocation(taskNum, roadwayNo); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="roadwayNo"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("AssignInboundTaskLocationByHeight"), AllowAnonymous] |
| | | public WebResponseContent AssignInboundTaskLocationByHeight(int taskNum, string roadwayNo, int heightType) |
| | | { |
| | | return Service.AssignInboundTaskLocationByHeight(taskNum, roadwayNo, heightType); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åé
å··é |
| | | /// åé
å··é(带任å¡å·åé«åº¦) |
| | | /// </summary> |
| | | /// <param name="roadwayNos"></param> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="heightType"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("AssignRoadwayByHeight"), AllowAnonymous] |
| | | public WebResponseContent AssignRoadwayByHeight([FromBody] List<string> roadwayNos, int taskNum, int heightType = 0) |
| | | { |
| | | return Service.AssignRoadway(roadwayNos, taskNum, heightType); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åé
å··é(带任å¡å·) |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="roadwayNos"></param> |
| | |
| | | return Service.AssignRoadway(taskNum, roadwayNos); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// åé
å··é |
| | | /// </summary> |
| | | /// <param name="roadwayNos"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("SingleAssignRoadway"), AllowAnonymous] |
| | | public WebResponseContent AssignRoadway([FromBody] List<string> roadwayNos) |
| | | { |