| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | |
| | | namespace WIDESEAWCS_BasicInfoService |
| | | { |
| | | public class TrackloginfoService : ServiceBase<Dt_trackloginfo, IRepository<Dt_trackloginfo>>, ITrackloginfoService |
| | | { |
| | | public TrackloginfoService(IRepository<Dt_trackloginfo> BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | public IRepository<Dt_trackloginfo> Repository => BaseDal; |
| | | |
| | | |
| | | public WebResponseContent AddTrackLog<T>(T entity, WebResponseContent content, string logName, string logCode, string description) |
| | | { |
| | | WebResponseContent content1 = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (entity == null || content == null) |
| | | return content1; |
| | | if (!content.Status) |
| | | { |
| | | //string sql = @"select top 3 tracklog_message from dt_trackloginfo ORDER BY tracklog_createtime desc"; |
| | | List<string> obj = BaseDal.QueryData().OrderByDescending(x => x.tracklog_createtime).Select(x => x.tracklog_message).Take(3).ToList(); |
| | | if (null != obj) |
| | | { |
| | | if (obj.Contains(content.Message)) |
| | | return content1; |
| | | } |
| | | } |
| | | Dt_trackloginfo trackloginfo = new Dt_trackloginfo() |
| | | { |
| | | tracklog_name = logName, |
| | | tracklog_content = JsonConvert.SerializeObject(entity), |
| | | tracklog_createtime = DateTime.Now, |
| | | tracklog_type = content.Status ? "æå" : "失败", |
| | | tracklog_code = content.Status ? logCode : ("4" + logCode), |
| | | tracklog_des = description, |
| | | tracklog_message = content.Status ? "" : content.Message, |
| | | tracklog_operator = "system"/*UserContext.Current.UserName*/ |
| | | }; |
| | | |
| | | BaseDal.AddData(trackloginfo); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content1.Message = ex.Message; |
| | | } |
| | | return content1; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// é»ç¢æçæ¥è¯¢è¯·æ±å
容DTO |
| | | /// </summary> |
| | | public class GetBlockPodContentListDto |
| | | { |
| | | public List<GetBlockPodContentDto> content { get; set; } = new List<GetBlockPodContentDto>(); |
| | | } |
| | | |
| | | public class GetBlockPodContentDto |
| | | { |
| | | /// <summary> |
| | | /// åéæçå·å表 |
| | | /// </summary> |
| | | public List<string> CandidatePodIDs { get; set; } = new List<string>(); |
| | | public List<string> candidatePodIDs { get; set; } = new List<string>(); |
| | | |
| | | /// <summary> |
| | | /// éè¦åºåºçæ°é |
| | | /// 0-表示å
¨é¨åº |
| | | /// é0-表示ä»podIDsä¸ånum个é»ç¢æå°çæç |
| | | /// </summary> |
| | | public int Num { get; set; } = 0; |
| | | public int num { get; set; } = 0; |
| | | } |
| | | public class ReturnBlockPodResultDto |
| | | { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | |
| | | namespace WIDESEAWCS_IBasicInfoService |
| | | { |
| | | public interface ITrackloginfoService : IService<Dt_trackloginfo> |
| | | { |
| | | public IRepository<Dt_trackloginfo> Repository { get; } |
| | | |
| | | /// <summary> |
| | | /// è®°å½æ¥å¿ |
| | | /// </summary> |
| | | /// <typeparam name="TEntity"></typeparam> |
| | | /// <param name="entity">åæ°</param> |
| | | /// <param name="content">è¿åç»æ</param> |
| | | /// <param name="logName">æ¥å¿åç§°</param> |
| | | /// <param name="logCode">æ¥å¿ä»£ç </param> |
| | | /// <param name="description">æä½è¯´æ</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AddTrackLog<T>(T entity, WebResponseContent content, string logName, string logCode, string description); |
| | | } |
| | | |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel.DataAnnotations.Schema; |
| | | using System.ComponentModel.DataAnnotations; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Core.DB.Models; |
| | | using SqlSugar; |
| | | |
| | | namespace WIDESEAWCS_Model.Models |
| | | { |
| | | [SugarTable(nameof(Dt_trackloginfo), "æ¥å£æ¥å¿")] |
| | | public class Dt_trackloginfo : BaseEntity |
| | | { |
| | | /// <summary> |
| | | ///ä¸»é® |
| | | /// </summary> |
| | | [Key] |
| | | [Display(Name = "主é®")] |
| | | [Column(TypeName = "int")] |
| | | [Required(AllowEmptyStrings = false)] |
| | | public int tracklog_id { get; set; } |
| | | |
| | | /// <summary> |
| | | ///æä½åç§° |
| | | /// </summary> |
| | | [Display(Name = "æä½åç§°")] |
| | | [MaxLength(100)] |
| | | [Column(TypeName = "nvarchar(100)")] |
| | | [Required(AllowEmptyStrings = false)] |
| | | public string tracklog_name { get; set; } |
| | | |
| | | /// <summary> |
| | | ///åæ°ä¼ éå
容 |
| | | /// </summary> |
| | | [Display(Name = "åæ°ä¼ éå
容")] |
| | | [Column(TypeName = "nvarchar(max)")] |
| | | public string tracklog_content { get; set; } |
| | | |
| | | /// <summary> |
| | | ///ç±»å |
| | | /// </summary> |
| | | [Display(Name = "ç±»å")] |
| | | [MaxLength(20)] |
| | | [Column(TypeName = "nvarchar(20)")] |
| | | [Required(AllowEmptyStrings = false)] |
| | | public string tracklog_type { get; set; } |
| | | |
| | | /// <summary> |
| | | ///æè¿° |
| | | /// </summary> |
| | | [Display(Name = "æè¿°")] |
| | | [Column(TypeName = "nvarchar(max)")] |
| | | [Required(AllowEmptyStrings = false)] |
| | | public string tracklog_des { get; set; } |
| | | |
| | | /// <summary> |
| | | ///æ¥å¿ä»£ç |
| | | /// </summary> |
| | | [Display(Name = "æ¥å¿ä»£ç ")] |
| | | [MaxLength(20)] |
| | | [Column(TypeName = "nvarchar(20)")] |
| | | [Required(AllowEmptyStrings = false)] |
| | | public string tracklog_code { get; set; } |
| | | |
| | | /// <summary> |
| | | ///éè¯¯ä¿¡æ¯ |
| | | /// </summary> |
| | | [Display(Name = "é误信æ¯")] |
| | | [Column(TypeName = "nvarchar(max)")] |
| | | public string tracklog_message { get; set; } |
| | | |
| | | /// <summary> |
| | | ///æä½è
|
| | | /// </summary> |
| | | [Display(Name = "æä½è
")] |
| | | [MaxLength(40)] |
| | | [Column(TypeName = "nvarchar(40)")] |
| | | [Required(AllowEmptyStrings = false)] |
| | | public string tracklog_operator { get; set; } |
| | | |
| | | /// <summary> |
| | | ///å建æ¶é´" |
| | | /// </summary> |
| | | [Display(Name = "å建æ¶é´")] |
| | | [Column(TypeName = "datetime")] |
| | | [Required(AllowEmptyStrings = false)] |
| | | public DateTime tracklog_createtime { get; set; } |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Text.Json; |
| | | using System.Threading.Tasks; |
| | |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | public WebResponseContent UpdateTaskStatus(object TaskDTO, DeviceTypeEnum deviceTypeEnum) |
| | | { |
| | | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | GALAXISUpdateTaskStatus gALAXIS = new(); |
| | | try |
| | | { |
| | | if (deviceTypeEnum == DeviceTypeEnum.GALAXIS) |
| | | { |
| | | GALAXISUpdateTaskStatus? gALAXIS = TaskDTO.Serialize().DeserializeObject<GALAXISUpdateTaskStatus>(); |
| | | //GALAXISUpdateTaskStatus? gALAXIS = TaskDTO.Serialize().DeserializeObject<GALAXISUpdateTaskStatus>(); |
| | | if (gALAXIS == null) throw new Exception("åæ°è½¬æ¢å¤±è´¥ï¼"); |
| | | var task = BaseDal.QueryFirst(x => x.WMSTaskNum == gALAXIS.taskId); |
| | | if (task == null) throw new Exception($"æªæ¾å°ä»»å¡,ä»»å¡ç¼å·ã{gALAXIS.taskId}ã"); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(gALAXIS, content, "ä¸åå¯ä¹å£«AGVä»»å¡", "", ""); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | |
| | | { |
| | | public partial class TaskService : ServiceBase<Dt_Task, IRepository<Dt_Task>>, ITaskService |
| | | { |
| | | private readonly ITrackloginfoService _trackloginfoService; |
| | | private readonly IRouterService _routerService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IHKLocationInfoService _hKLocationInfoService; |
| | |
| | | /// </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) : 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) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _kLSLocationInfoService = kLSLocationInfoService; |
| | | _rGVLocationInfoService = rGVLocationInfoService; |
| | | _hKLocationInfoService = hKLocationInfoService; |
| | | _apiInfoService = apiInfoService; |
| | | _apiInfoService = apiInfoService; |
| | | _trackloginfoService = trackloginfoService; |
| | | } |
| | | public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs) |
| | | { |
| | |
| | | if (agvContent.success == true && agvContent.code == 0) |
| | | { |
| | | |
| | | BaseDal.UpdateData(dt_Task); |
| | | return content.OK("ä¿®æ¹ä»»å¡ä¼å
级æå", dt_Task); |
| | | } |
| | | else { |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_Model.Models; |
| | |
| | | #region ä¸åå¯ä¹å£«AGVä»»å¡ |
| | | public void SendGALAXISTask(List<Dt_Task> tasks) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); // å建ååºå¯¹è±¡ |
| | | GALAXISTaskInfo gALAXISTaskInfo = new(); |
| | | try |
| | | { |
| | |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(GALAXISTaskInfo)) ?? throw new Exception("æªæ¾å°å¯ä¹å£«AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, gALAXISTaskInfo.Serialize()); |
| | | GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | content.Data = agvContent; |
| | | if (agvContent.success) |
| | | { |
| | | if (agvContent.data.returnStatus != 0) throw new Exception(agvContent.data.returnInfo); |
| | |
| | | { |
| | | task.TaskState = (int)TaskStatusEnum.Execut; |
| | | }); |
| | | content.OK(); |
| | | _taskService.UpdateData(tasks); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(TaskJob), ex.Message, ex); |
| | | content.Error(ex.Message); |
| | | //WriteError(nameof(TaskJob), ex.Message, ex); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(gALAXISTaskInfo.Serialize(), content, "ä¸åå¯ä¹å£«AGVä»»å¡","",""); |
| | | //dt_trackloginfoService.Instance.AddTrackLog(outTaskInfo, content, "æ¥æ¶å®èªWMSåºåºä»»å¡ä¸å", "", $"{msg},åæ´ç»æ:{content.Status}"); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | using System; |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn.returnCode == 0) |
| | | { |
| | | FOURBOTnewMovePodTaskResponseData fOURBO = fOURBOTReturn.data as FOURBOTnewMovePodTaskResponseData ?? throw new Exception("æªè·åå°åå车è¿åçä»»å¡ID"); |
| | | string dataJson = fOURBOTReturn.data.ToString(); |
| | | FOURBOTnewMovePodTaskResponseData? fOURBO = JsonConvert.DeserializeObject<FOURBOTnewMovePodTaskResponseData>(dataJson); |
| | | if (fOURBO == null || fOURBO.taskID == 0) |
| | | { |
| | | throw new Exception($"æªè·åå°åå车è¿åçä»»å¡IDï¼è¿åæ°æ®ï¼{response}"); |
| | | } |
| | | //FOURBOTnewMovePodTaskResponseData fOURBO = fOURBOTReturn.data as FOURBOTnewMovePodTaskResponseData ?? throw new Exception("æªè·åå°åå车è¿åçä»»å¡ID"); |
| | | item.RGVTaskId = fOURBO.taskID; |
| | | item.TaskState = (int)TaskStatusEnum.Execut; |
| | | } |
| | |
| | | { |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(GetBlockPodContentDto)) ?? throw new Exception("æªæ¾å°åå车任å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | List<Dt_Task> dt_Tasks = new List<Dt_Task>(); |
| | | //var PalletCodes = tasks.Select(x => x.PalletCode).ToList(); |
| | | GetBlockPodContentDto content = new GetBlockPodContentDto(); |
| | | content.CandidatePodIDs = tasks.Select(x => x.PalletCode).ToList(); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, content.Serialize()); |
| | | var PalletCodes = tasks.Select(x => x.PalletCode).ToList(); |
| | | //GetBlockPodContentDto content = new GetBlockPodContentDto(); |
| | | var request = new GetBlockPodContentListDto |
| | | { |
| | | content = new List<GetBlockPodContentDto> |
| | | { |
| | | new GetBlockPodContentDto |
| | | { |
| | | candidatePodIDs = PalletCodes, |
| | | num = 0 // 0表示å
¨é¨åºï¼å¦æéè¦éå¶æ°éå¯ä»¥è°æ´ |
| | | } |
| | | } |
| | | }; |
| | | //content.candidatePodIDs = tasks.Select(x => x.PalletCode).ToList(); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn.returnCode == 0) |
| | | { |
| | |
| | | Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.CPOutbound).ToList(); |
| | | if (Tasks.Count > 0) IsMoveTask(Tasks); |
| | | #endregion |
| | | |
| | | |
| | | #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); |
| | |
| | | try |
| | | { |
| | | #region ä¸åå¤å½¢æ£æµéè¿çååè½¦ä»»å¡ |
| | | var Tasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == (int)TaskStatusEnum.CheckShapeingOk && x.ExceptionMessage.IsNullOrEmpty()).ToList(); |
| | | var Tasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == (int)TaskStatusEnum.CheckShapeingOk && string.IsNullOrEmpty(x.ExceptionMessage)).ToList(); |
| | | if (Tasks.Count > 0) SendCheckShapeingOkTask(Tasks); |
| | | #endregion |
| | | |
| | |
| | | |
| | | #region ä¸ååå车æ¹éç§»åºä»»å¡ |
| | | Tasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == (int)TaskStatusEnum.RGV_NewMoveTask).ToList(); |
| | | if (Tasks.Count > 0) SendMoveTasks(Tasks); |
| | | if (Tasks.Count > 0) SendMoveTasks(Tasks); |
| | | #endregion |
| | | |
| | | #region å¤çå¾
ç§»åºååå车åºåºä»»å¡ |
| | |
| | | private readonly IApiInfoService _apiInfoService; |
| | | private readonly IRGVLocationInfoService _rGVLocationInfoService; |
| | | private readonly IStationMangerService _stationMangerService; |
| | | private readonly ITrackloginfoService _trackloginfoService; |
| | | |
| | | public TaskJob(ITaskService taskService, IApiInfoService apiInfoService, IRGVLocationInfoService rGVLocationInfoService, IStationMangerService stationMangerService) |
| | | public TaskJob(ITaskService taskService, IApiInfoService apiInfoService, IRGVLocationInfoService rGVLocationInfoService, IStationMangerService stationMangerService, ITrackloginfoService trackloginfoService) |
| | | { |
| | | _taskService = taskService;//注å
¥ |
| | | _apiInfoService = apiInfoService; |
| | | _rGVLocationInfoService = rGVLocationInfoService; |
| | | _stationMangerService = stationMangerService; |
| | | _trackloginfoService = trackloginfoService; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |