| 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskErrorMessageService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_TaskErrorMessage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskErrorMessageController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskErrorMessageService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs
@@ -98,19 +98,19 @@ List<Dt_RGVLocationInfo> dt_RGVLocationInfos = BaseDal.QueryData(x => x.RoadwayNo == items.Key);//æ¥æ¾å½åå··éå·è´§ä½ if (item.LocationType == 1) { rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault();//å¤ææµ æ·±åº¦è´§ä½æ¯å¦æè´§ rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus != LocationStatusEnum.Free.ObjToInt()).FirstOrDefault();//å¤ææµ æ·±åº¦è´§ä½æ¯å¦æè´§ if (rGVLocationInfo != null) break; return item; } else { rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).OrderByDescending(x => x.Depth).FirstOrDefault();//å¤ææµ æ·±åº¦è´§ä½æ¯å¦æè´§ rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus != LocationStatusEnum.Free.ObjToInt()).OrderByDescending(x => x.Depth).FirstOrDefault();//å¤ææµ æ·±åº¦è´§ä½æ¯å¦æè´§ if (rGVLocationInfo != null) { rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).OrderBy(x => x.Depth).FirstOrDefault(); if (rGVLocationInfo != null) { if (dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).Any()) rGVLocationInfo = null; if (dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus != LocationStatusEnum.Free.ObjToInt()).Any()) rGVLocationInfo = null; else return rGVLocationInfo; } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskErrorMessageService.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_ITaskInfoService { public interface ITaskErrorMessageService : IService<Dt_TaskErrorMessage> { /// <summary> /// ä»å¨å±(æ°æ®åºè®¿é®) /// </summary> IRepository<Dt_TaskErrorMessage> Repository { get; } } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -210,7 +210,7 @@ /// <param name="taskNum">ä»»å¡å·</param> /// <returns>è¿åå¤çç»æ</returns> WebResponseContent TaskStatusRecovery(int taskNum); WebResponseContent ErrorTaskFeedback(Dt_Task dt_Task, bool Del); WebResponseContent ErrorTaskFeedback(Dt_Task dt_Task, bool Del = false, string ErrorCode = ""); /// <summary> /// 忻任å¡ç¶æ /// </summary> ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/TaskInfo/Dt_TaskErrorMessage.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,55 @@ using Magicodes.ExporterAndImporter.Core; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Core.DB.Models; namespace WIDESEAWCS_Model.Models { [SugarTable(nameof(Dt_TaskErrorMessage), "ä»»å¡å¼å¸¸ä¿¡æ¯")] public class Dt_TaskErrorMessage : BaseEntity { /// <summary> /// ä¸»é® /// </summary> [ImporterHeader(Name = "主é®")] [ExporterHeader(DisplayName = "主é®")] [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] public int TaskId { get; set; } /// <summary> /// é误代ç /// </summary> [ImporterHeader(Name = "é误代ç ")] [ExporterHeader(DisplayName = "é误代ç ")] [SugarColumn(IsNullable = false, ColumnDescription = "é误代ç ")] public int ErrorCode { get; set; } /// <summary> /// å¼å¸¸ä¿¡æ¯è±æ /// </summary> [ImporterHeader(Name = "å¼å¸¸ä¿¡æ¯è±æ")] [ExporterHeader(DisplayName = "å¼å¸¸ä¿¡æ¯è±æ")] [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "å¼å¸¸ä¿¡æ¯è±æ")] public string ErrorMessage { get; set; } /// <summary> /// å¼å¸¸ä¿¡æ¯ /// </summary> [ImporterHeader(Name = "å¼å¸¸ä¿¡æ¯")] [ExporterHeader(DisplayName = "å¼å¸¸ä¿¡æ¯")] [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "å¼å¸¸ä¿¡æ¯")] public string ExceptionMessage { get; set; } /// <summary> /// 设å¤ç±»åï¼0å¯ä¹å£«ï¼1海康ï¼2åå车 /// </summary> [ImporterHeader(Name = "设å¤ç±»å")] [ExporterHeader(DisplayName = "设å¤ç±»å")] [SugarColumn(IsNullable = false, ColumnDescription = "设å¤ç±»å")] public int DeviceType { get; set; } } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskErrorMessageController.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,23 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseController; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_WCSServer.Controllers.Task { [Route("api/TaskErrorMessage")] [ApiController] public class TaskErrorMessageController : ApiBaseController<ITaskErrorMessageService, Dt_TaskErrorMessage> { private readonly IHttpContextAccessor _httpContextAccessor; public TaskErrorMessageController(ITaskErrorMessageService service, IHttpContextAccessor httpContextAccessor) : base(service) { _httpContextAccessor = httpContextAccessor; } } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskErrorMessageService.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,21 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_TaskInfoService { public class TaskErrorMessageService : ServiceBase<Dt_TaskErrorMessage, IRepository<Dt_TaskErrorMessage>>, ITaskErrorMessageService { public TaskErrorMessageService(IRepository<Dt_TaskErrorMessage> BaseDal) : base(BaseDal) { } public IRepository<Dt_TaskErrorMessage> Repository => BaseDal; } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs
@@ -8,6 +8,7 @@ using System.Reflection.Metadata; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; using System.Threading.Tasks; using WIDESEAWCS_Common; using WIDESEAWCS_Common.LocationEnum; @@ -393,12 +394,18 @@ } if (Rgv.content.status == 5) { if (task.TaskState == (int)TaskStatusEnum.Execut) task.ExceptionMessage = Rgv.content.errorReason; var Error = _taskErrorMessageService.Repository.QueryFirst(x => x.ErrorCode == Rgv.content.errorCode && x.DeviceType == (int)deviceTypeEnum); if (Error != null) { task.TaskState = (int)TaskStatusEnum.New; task.Remark = "åå车åé¦å¤±è´¥,éæ°ä¸å"; BaseDal.UpdateData(task); task.ExceptionMessage = Error.ExceptionMessage; MatchCollection matches = Regex.Matches(Rgv.content.errorReason, @"\(([^)]+)\)"); if (matches.Count > 0) task.ExceptionMessage = ReplacePlaceholders(Rgv.content.errorReason, Error.ExceptionMessage); ErrorTaskFeedback(task, true, Error.ErrorCode.ToString()); } else ErrorTaskFeedback(task, true); } } } @@ -414,6 +421,30 @@ _trackloginfoService.AddTrackLog(TaskDTO, content, $"{deviceName}ä»»å¡ç¶æåé¦", "", ""); } return content; } #endregion #region å¼å¸¸ä¿¡æ¯è½¬æ¢ /// <summary> /// å¼å¸¸ä¿¡æ¯()å å®¹è½¬æ¢ /// </summary> /// <param name="source"></param> /// <param name="targetTemplate"></param> /// <returns></returns> public string ReplacePlaceholders(string source, string targetTemplate) { // æåæºå符串ä¸çæææ¬å·å¼ var values = Regex.Matches(source, @"\(([^)]+)\)") .Cast<Match>() .Select(m => m.Groups[1].Value) .ToList(); // æ¿æ¢ç®æ 模æ¿ä¸çææ (%v) int idx = 0; string result = Regex.Replace(targetTemplate, @"\(\%v\)", _ => idx < values.Count ? values[idx++] : ""); return result; } #endregion @@ -692,7 +723,7 @@ } #endregion #region 失败任å¡ä¸æ¥WMSå¹¶å é¤ä»»å¡ public WebResponseContent ErrorTaskFeedback(Dt_Task dt_Task, bool Del) public WebResponseContent ErrorTaskFeedback(Dt_Task dt_Task, bool Del = false, string ErrorCode = "") { WebResponseContent content = new WebResponseContent(); WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback(); @@ -708,7 +739,7 @@ boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress; boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress; boundCompleteFeedback.status = 3; boundCompleteFeedback.custStatus = ""; boundCompleteFeedback.custStatus = ErrorCode; boundCompleteFeedback.memo = dt_Task.ExceptionMessage; string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize()); agvContent = response.DeserializeObject<WMSReturn>(); @@ -729,15 +760,12 @@ finally { _trackloginfoService.AddTrackLog(boundCompleteFeedback, content, "åºå ¥åºä»»å¡ç¶æåé¦WMS", "", ""); if (agvContent != null && agvContent.code == 200 && Del) BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.èªå¨å é¤); if (agvContent != null && agvContent.code == 200 && Del) BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.èªå¨å é¤); else BaseDal.UpdateData(dt_Task); } return content; } #endregion } } ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -57,6 +57,7 @@ private readonly IApiInfoService _apiInfoService; private readonly IStationMangerService _stationMangerService; private readonly IStationInfoService _stationInfo; private readonly ITaskErrorMessageService _taskErrorMessageService; private readonly IMapper _mapper; private Dictionary<string, OrderByType> _taskOrderBy = new() @@ -76,7 +77,7 @@ /// </summary> public IRepository<Dt_Task> Repository => BaseDal; public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService, IApiInfoService apiInfoService, ITrackloginfoService trackloginfoService, IStationMangerService stationMangerService, IStationInfoService stationInfo) : base(BaseDal) public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService, IApiInfoService apiInfoService, ITrackloginfoService trackloginfoService, IStationMangerService stationMangerService, IStationInfoService stationInfo, ITaskErrorMessageService taskErrorMessageService) : base(BaseDal) { _routerService = routerService; _taskExecuteDetailService = taskExecuteDetailService; @@ -89,6 +90,7 @@ _trackloginfoService = trackloginfoService; _stationMangerService = stationMangerService; _stationInfo = stationInfo; _taskErrorMessageService = taskErrorMessageService; } public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs) {