yanjinhui
2026-03-02 8f0d94b96853b2b12bd1dd10c862277edb5f685a
添加日志表
已添加3个文件
已修改7个文件
260 ■■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/TrackloginfoService.cs 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/RGV/FOURBOT/GetBlockPodContentDto.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/ITrackloginfoService.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/BasicInfo/Dt_trackloginfo.cs 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskExtend.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskJob.cs 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/TrackloginfoService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
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;
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/RGV/FOURBOT/GetBlockPodContentDto.cs
@@ -9,19 +9,24 @@
    /// <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
    {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/ITrackloginfoService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
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);
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/BasicInfo/Dt_trackloginfo.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,91 @@
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; }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
@@ -30,11 +31,14 @@
        /// <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}】");
@@ -66,6 +70,10 @@
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
            finally
            {
                _trackloginfoService.AddTrackLog(gALAXIS, content, "下发凯乐士AGV任务", "", "");
            }
        }
        #endregion
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -42,6 +42,7 @@
{
    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;
@@ -69,7 +70,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) : 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;
@@ -79,6 +80,7 @@
            _rGVLocationInfoService = rGVLocationInfoService;
            _hKLocationInfoService = hKLocationInfoService;
            _apiInfoService = apiInfoService;   
            _trackloginfoService = trackloginfoService;
        }
        public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs)
        {
@@ -256,6 +258,7 @@
                    if (agvContent.success == true && agvContent.code == 0)
                    {
                        BaseDal.UpdateData(dt_Task);
                        return content.OK("修改任务优先级成功", dt_Task);
                    }
                    else {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs
@@ -1,9 +1,11 @@
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;
@@ -16,6 +18,7 @@
        #region ä¸‹å‘凯乐士AGV任务
        public void SendGALAXISTask(List<Dt_Task> tasks)
        {
            WebResponseContent content = new WebResponseContent(); // åˆ›å»ºå“åº”对象
            GALAXISTaskInfo gALAXISTaskInfo = new();
            try
            {
@@ -38,6 +41,7 @@
                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);
@@ -45,12 +49,19 @@
                    {
                        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
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/RGVTaskExtend.cs
@@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -42,7 +43,13 @@
                    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;
                    }
@@ -67,10 +74,21 @@
            {
                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)
                {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskExtend.cs
@@ -59,7 +59,7 @@
            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
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskJob.cs
@@ -30,13 +30,15 @@
        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)