´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/HKLocationInfoService.cs
@@ -1,10 +1,13 @@ using System; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common.LocationEnum; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_IBasicInfoService; using WIDESEAWCS_Model.Models; @@ -15,7 +18,19 @@ public HKLocationInfoService(IRepository<Dt_HKLocationInfo> BaseDal) : base(BaseDal) { } private Dictionary<string, OrderByType> _emptyAssignOrderBy = new Dictionary<string, OrderByType>() { { nameof(Dt_HKLocationInfo.Depth), OrderByType.Desc }, { nameof(Dt_HKLocationInfo.Layer), OrderByType.Asc }, { nameof(Dt_HKLocationInfo.Column), OrderByType.Asc }, { nameof(Dt_HKLocationInfo.Row), OrderByType.Asc }, }; public IRepository<Dt_HKLocationInfo> Repository => BaseDal; public Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode) { Dt_HKLocationInfo hKLocationInfo = BaseDal.QueryFirst(x => x.WarehouseId.ToString() == toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy); return hKLocationInfo; } } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IHKLocationInfoService.cs
@@ -12,5 +12,7 @@ public interface IHKLocationInfoService : IService<Dt_HKLocationInfo> { public IRepository<Dt_HKLocationInfo> Repository { get; } Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode); } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_Task.cs
@@ -66,7 +66,7 @@ /// </summary> [ImporterHeader(Name = "åºå")] [ExporterHeader(DisplayName = "åºå")] [SugarColumn(IsNullable = true, Length = 10, ColumnDescription = "åºå")] [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "åºå")] public string Roadway { get; set; } /// <summary> ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -33,7 +33,7 @@ "DBSeedEnable": false, "QuartzDBSeedEnable": false, "LogDeubgEnable": true, //æ¯å¦è®°å½è°è¯æ¥å¿ "PrintSql": false, //æå°SQLè¯å¥ "PrintSql": true, //æå°SQLè¯å¥ "LogAOPEnable": true, //æ¯å¦è®°å½AOPæ¥å¿ "WebSocketEnable": true, //æ¯å¦å¼å¯WebSocketæå¡ "WebSocketPort": 9296 //WebSocketæå¡ç«¯å£ ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs
@@ -27,10 +27,8 @@ { try { int containerType = taskDTO.containerCode.Contains("LX") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt(); //è·åè´§ä½ä¿¡æ¯ Dt_HKLocationInfo? kLSLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.WarehouseId.ToString() == taskDTO.toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == containerType); if (kLSLocationInfo == null) throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); Dt_HKLocationInfo? hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode) ?? throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); ; Dt_Task dt_Task = new Dt_Task() { TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), @@ -38,19 +36,19 @@ //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), Grade = taskDTO.taskPriority, PalletCode = taskDTO.containerCode, Roadway = kLSLocationInfo.RoadwayNo, Roadway = hKLocationInfo.RoadwayNo, TaskState = TaskStatusEnum.New.ObjToInt(), TaskType = taskType, SourceAddress = taskDTO.fromLocationCode, CurrentAddress = taskDTO.fromLocationCode, NextAddress = kLSLocationInfo.LocationCode, TargetAddress = kLSLocationInfo.LocationCode, NextAddress = hKLocationInfo.LocationCode, TargetAddress = hKLocationInfo.LocationCode, Creater = "WMS", }; kLSLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); hKLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); Db.Ado.BeginTran(); BaseDal.AddData(dt_Task); _hKLocationInfoService.Repository.UpdateData(kLSLocationInfo); _hKLocationInfoService.Repository.UpdateData(hKLocationInfo); Db.Ado.CommitTran(); return WebResponseContent.Instance.OK(); } @@ -70,8 +68,7 @@ { try { Dt_HKLocationInfo? hKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode); if (hKLocationInfo == null) throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); Dt_HKLocationInfo? hKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); if (hKLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); Dt_Task dt_Task = new Dt_Task() { ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs
@@ -103,7 +103,15 @@ #region 5 跨楼å±è¿è¾ä»»å¡å建 public WebResponseContent CarryTask(TaskDTO taskDTO, int taskType) { return WebResponseContent.Instance.OK(); try { return WebResponseContent.Instance.OK(); } catch (Exception ex) { throw new Exception(ex.Message); } } #endregion ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/HKTaskExtend.cs
@@ -1,18 +1,46 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection.Metadata; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Core; using WIDESEAWCS_DTO.AGV.HIKROBOT; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_Tasks { public partial class TaskJob { #region ä¸å海康AGVä»»å¡ public void SendHIKROBOTTask(List<Dt_Task> tasks) #region å¤ç海康AGVä»»å¡ public void HIKROBOTTask(List<Dt_Task> tasks) { foreach (var item in tasks) { SendHIKROBOTTask(item); } } #endregion #region ä¸å海康AGVä»»å¡ public void SendHIKROBOTTask(Dt_Task task) { WebResponseContent content = new WebResponseContent(); HIKROBOTTaskSubmit hIKROBOTTaskSubmit = new HIKROBOTTaskSubmit(); try { hIKROBOTTaskSubmit.taskType = ""; hIKROBOTTaskSubmit.targetRoute = new List<TargetRouteDto> { new TargetRouteDto() }; hIKROBOTTaskSubmit.initPriority = task.Grade; } catch (Exception ex) { content.Error(ex.Message); } finally { } } #endregion } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs
@@ -7,6 +7,7 @@ using WIDESEAWCS_Common; using WIDESEAWCS_Common.LocationEnum; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO; using WIDESEAWCS_DTO.RGV.FOURBOT; @@ -128,56 +129,98 @@ /// <param name="tasks"></param> public void SendCheckShapeingOkTask(List<Dt_Task> tasks) { FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new(); try { Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("æªæ¾å°åå车任å¡ä¸åæ¥å£é 置信æ¯ï¼è¯·æ£æ¥æ¥å£é ç½®"); List<Dt_RGVLocationInfo> rGVLocationInfos = new List<Dt_RGVLocationInfo>(); List<Dt_StationManger> stationMangers = new List<Dt_StationManger>(); var tasksToUpdate = new List<Dt_Task>(); var locationsToUpdate = new List<Dt_RGVLocationInfo>(); var stationsToUpdate = new List<Dt_StationManger>(); #region ä»»å¡ä¸å foreach (var item in tasks) { #region è·åè´§ä½ var rGVLocationInfo = _rGVLocationInfoService.GetFreeLocationInfo(item.Roadway); if (rGVLocationInfo == null) try { item.ExceptionMessage = $"æªæ¾å°ç»ç¹åºåºã{item.Roadway}ãå¯ç¨ç©ºè´§ä½ï¼"; } #endregion else { #region è·åè´§ä½ var rGVLocationInfo = _rGVLocationInfoService.GetFreeLocationInfo(item.Roadway); if (rGVLocationInfo == null) { item.ExceptionMessage = $"æªæ¾å°ç»ç¹åºåºã{item.Roadway}ãå¯ç¨ç©ºè´§ä½ï¼"; continue; } #endregion var fOURBOTnewMovePodTask = new FOURBOTnewMovePodTask { priority = item.Grade, podID = item.PalletCode, destination = rGVLocationInfo.LocationCode, desExt = new { unload = 1 }, // æ¯å¦æ¾ä¸å®¹å¨,0å¦1æ¯ desType = 2 }; item.CurrentAddress = item.NextAddress; item.NextAddress = rGVLocationInfo.LocationCode; item.Roadway = rGVLocationInfo.RoadwayNo; fOURBOTnewMovePodTask.priority = item.Grade; fOURBOTnewMovePodTask.podID = item.PalletCode; fOURBOTnewMovePodTask.destination = item.NextAddress; fOURBOTnewMovePodTask.desExt = new { unload = 1//æ¯å¦æ¾ä¸å®¹å¨,0å¦1æ¯ }; fOURBOTnewMovePodTask.desType = 2; string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize()); FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); var fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); if (fOURBOTReturn.returnCode == 0) { FOURBOTnewMovePodTaskResponseData fOURBO = fOURBOTReturn.data as FOURBOTnewMovePodTaskResponseData ?? throw new Exception("æªè·åå°åå车è¿åçä»»å¡ID"); var data = fOURBOTReturn.data.ToString(); var fOURBO = data.DeserializeObject<FOURBOTnewMovePodTaskResponseData>(); item.RGVTaskId = fOURBO.taskID; item.TaskState = (int)TaskStatusEnum.Puting; rGVLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); rGVLocationInfos.Add(rGVLocationInfo); locationsToUpdate.Add(rGVLocationInfo); #region éæ¾å ¥åºç«å° Dt_StationManger stationManger = _stationMangerService.GetInStationInfo(item.SourceAddress); stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt(); stationMangers.Add(stationManger); var stationManger = _stationMangerService.GetInStationInfo(item.SourceAddress); if (stationManger != null) { stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt(); stationsToUpdate.Add(stationManger); } #endregion } else { item.ExceptionMessage = $"åå车æ¥å£è¿åé误ï¼{fOURBOTReturn.returnMsg}"; // è®°å½å¤±è´¥çä»»å¡ } } } _taskService.Db.Ado.BeginTran(); _taskService.UpdateData(tasks); _rGVLocationInfoService.UpdateData(rGVLocationInfos); _stationMangerService.UpdateData(stationMangers); _taskService.Db.Ado.CommitTran(); catch (Exception ex) { item.ExceptionMessage = $"å¤çä»»å¡å¼å¸¸ï¼{ex.Message}"; WriteError($"{nameof(TaskJob)}-{item.TaskId}", ex.Message, ex); } tasksToUpdate.Add(item); } #endregion #region æ´æ°æ°æ® // 妿æéè¦æ´æ°çæ°æ®ï¼ææ§è¡äºå¡ if (tasksToUpdate.Any() || locationsToUpdate.Any() || stationsToUpdate.Any()) { try { _unitOfWorkManage.BeginTran(); if (tasksToUpdate.Any()) _taskService.UpdateData(tasksToUpdate); if (locationsToUpdate.Any()) _rGVLocationInfoService.UpdateData(locationsToUpdate); if (stationsToUpdate.Any()) _stationMangerService.UpdateData(stationsToUpdate); _unitOfWorkManage.CommitTran(); } catch (Exception ex) { _unitOfWorkManage.RollbackTran(); WriteError(nameof(TaskJob), ex.Message, ex); } } #endregion } catch (Exception ex) { ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskExtend.cs
@@ -39,7 +39,7 @@ #region æ¥æ¾æµ·åº·AGVä»»å¡ Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.Carry || x.TaskType == (int)TaskTypeEnum.CJCarry || x.TaskType == (int)TaskTypeEnum.CJInbound || x.TaskType == (int)TaskTypeEnum.CJOutbound).ToList(); if (Tasks.Count > 0) SendHIKROBOTTask(Tasks); if (Tasks.Count > 0) HIKROBOTTask(Tasks); #endregion } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskJob.cs
@@ -4,6 +4,7 @@ using Microsoft.VisualBasic.FileIO; using Quartz; using SixLabors.ImageSharp.PixelFormats; using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel; @@ -13,6 +14,7 @@ using System.Threading.Tasks; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Communicator; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_IBasicInfoService; using WIDESEAWCS_ITaskInfoService; @@ -31,14 +33,16 @@ private readonly IRGVLocationInfoService _rGVLocationInfoService; private readonly IStationMangerService _stationMangerService; private readonly ITrackloginfoService _trackloginfoService; private readonly IUnitOfWorkManage _unitOfWorkManage; public TaskJob(ITaskService taskService, IApiInfoService apiInfoService, IRGVLocationInfoService rGVLocationInfoService, IStationMangerService stationMangerService, ITrackloginfoService trackloginfoService) public TaskJob(ITaskService taskService, IApiInfoService apiInfoService, IRGVLocationInfoService rGVLocationInfoService, IStationMangerService stationMangerService, ITrackloginfoService trackloginfoService, IUnitOfWorkManage unitOfWorkManage) { _taskService = taskService;//æ³¨å ¥ _apiInfoService = apiInfoService; _rGVLocationInfoService = rGVLocationInfoService; _stationMangerService = stationMangerService; _trackloginfoService = trackloginfoService; _unitOfWorkManage = unitOfWorkManage; } public Task Execute(IJobExecutionContext context)