| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | /// <param name="wMSCancelTask">åæ¶ä»»å¡å®ä½ç±»</param> |
| | | /// <returns></returns> |
| | | WebResponseContent CancelWMSTask(WMSCancelTask wMSCancelTask); |
| | | WebResponseContent CancelWMSTask(WMSCancelTask wMSCancelTask); |
| | | |
| | | /// <summary> |
| | | /// ä¿®æ¹ä»»å¡ä¼å
级 |
| | | /// </summary> |
| | | /// <param name="updateTaskPriority"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent UpdateWMSTaskPriority(WMSUpdateTaskPriority updateTaskPriority); |
| | | WebResponseContent UpdateWMSTaskPriority(WMSUpdateTaskPriority updateTaskPriority); |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®æçå·ãèµ·å§å°ååWMS请æ±ä»»å¡ |
| | |
| | | /// <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> |
| | |
| | | /// <param name="deviceTypeEnum"></param> |
| | | /// <param name="locationStatusEnum"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent UpdateLocationStatus(string locationCode,string palletCode, DeviceTypeEnum deviceTypeEnum, LocationStatusEnum locationStatusEnum); |
| | | WebResponseContent UpdateLocationStatus(string locationCode, string palletCode, DeviceTypeEnum deviceTypeEnum, LocationStatusEnum locationStatusEnum); |
| | | |
| | | |
| | | WebResponseContent ModifyWMSLayoutZone(WMSUpdateLocationArea wMSUpdateLocationArea); |
| | |
| | | /// <param name="taskCode">ä»»å¡å·</param> |
| | | /// <param name="containerCode">容å¨ç¼ç </param> |
| | | /// <returns></returns> |
| | | public WebResponseContent MaterialBoxInspection(string taskCode ,string containerCode); |
| | | public WebResponseContent MaterialBoxInspection(string taskCode, string containerCode); |
| | | |
| | | /// <summary> |
| | | /// 4Fæåæºåºå£æçå·ä¸æ¥WMS |
| | |
| | | /// </summary> |
| | | /// <param name="TaskCode">ä»»å¡å·</param> |
| | | /// <returns></returns> |
| | | WebResponseContent Hikvisiontaskscontinue(string TaskCode, string Address=null); |
| | | |
| | | WebResponseContent Hikvisiontaskscontinue(string TaskCode, string Address = null); |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | _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 |
| | | |
| | |
| | | } |
| | | #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(); |
| | |
| | | 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>(); |
| | |
| | | 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 |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | 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() |
| | |
| | | /// </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; |
| | |
| | | _trackloginfoService = trackloginfoService; |
| | | _stationMangerService = stationMangerService; |
| | | _stationInfo = stationInfo; |
| | | _taskErrorMessageService = taskErrorMessageService; |
| | | } |
| | | public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs) |
| | | { |