yanjinhui
8 小时以前 52ba6b195a4126df405ef453d52ba6eaab6521da
优化3-4楼提升机以及添加报错接口
已添加1个文件
已修改12个文件
211 ■■■■ 文件已修改
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/ApiInfoService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/HKLocationInfoService.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/PLCAlarmDTO.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IHKLocationInfoService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/KHAGVController.cs 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJExtend.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskExtend.cs 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskJob.cs 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/ApiInfoService.cs
@@ -46,7 +46,7 @@
                response = HttpHelper.Post(apiInfo.ApiAddress, requestParameters);
                requestHash = ComputeHash(requestParameters);
                responseHash = ComputeHash(response);
                if (apiInfo.Remark.Contains("四向车"))
                if (apiInfo.Remark.Contains("四向穿梭车"))
                {
                    FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
                    if (fOURBOTReturn == null) throw new Exception($"{apiInfo.Remark}响应内容转换实体失败!");
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/HKLocationInfoService.cs
@@ -27,10 +27,11 @@
        };
        public IRepository<Dt_HKLocationInfo> Repository => BaseDal;
        public Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode)
        public Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode, int containerType)
        {
            Dt_HKLocationInfo hKLocationInfo = BaseDal.QueryFirst(x => x.WarehouseId.ToString() == toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy);
            Dt_HKLocationInfo hKLocationInfo = BaseDal.QueryFirst(x => x.WarehouseId.ToString() == toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == containerType, _emptyAssignOrderBy);
            return hKLocationInfo;
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/WMS/PLCAlarmDTO.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEAWCS_DTO.WMS
{
    public class PLCAlarmDTO
    {
        /// <summary>
        /// æŠ¥è­¦ä¿¡æ¯
        /// </summary>
        public string errorMsg { get; set; }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IHKLocationInfoService.cs
@@ -13,6 +13,6 @@
    {
        public IRepository<Dt_HKLocationInfo> Repository { get; }
        Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode);
        Dt_HKLocationInfo? GetFreeLocationInfo(string toAreaCode, int containerType);
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -336,5 +336,11 @@
        /// <returns></returns>
         WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO);
        WebResponseContent PLCAlarmtoWMS(string ErrorMsg);
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/KHAGVController.cs
@@ -3,7 +3,9 @@
using Microsoft.AspNetCore.Mvc;
using WIDESEAWCS_Common;
using WIDESEAWCS_DTO;
using WIDESEAWCS_DTO.AGV.HIKROBOT;
using WIDESEAWCS_DTO.RGV.FOURBOT;
using WIDESEAWCS_DTO.WMS;
using WIDESEAWCS_ITaskInfoService;
namespace WIDESEAWCS_Server.Controllers.AGV
@@ -41,5 +43,31 @@
            return returnHK;
        }
        /// <summary>
        /// æµ·åº·è®¾å¤‡æŠ¥è­¦æŽ¥å£
        /// </summary>
        /// <param name="taskDTOs"></param>
        /// <returns></returns>
        [HttpPost, Route("HKDeviceAlarm"), AllowAnonymous]
        public HIKROBOTReturn HKDeviceAlarm([FromBody]HKDeviceAalarmDTO hKDeviceAalarmDTO)
        {
            HIKROBOTReturn returnHK = new HIKROBOTReturn();
            var take = _taskService.HKDeviceAlarm(hKDeviceAalarmDTO);
            if (take.Status)
            {
                returnHK.code = "SUCCESS";
                returnHK.message = "succ";
            }
            else
            {
                returnHK.code = "404";
                returnHK.message = take.Message;
            }
            return returnHK;
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs
@@ -34,6 +34,7 @@
            try
            {
                Dt_HKLocationInfo? hKLocationInfo = null;
                int containerType = taskDTO.containerCode.Contains("LXM") ? (int)LocationTypeEnum.LargePallet : (int)LocationTypeEnum.SmallPallet;
                if (taskType == (int)TaskTypeEnum.STURR)
                {
                    var reslut = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"未找到起点货位【{taskDTO.fromLocationCode}】");
@@ -47,7 +48,7 @@
                #endregion
                //获取货位信息
                else
                    hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode) ?? throw new Exception($"未找到终点库区【{taskDTO.toAreaCode}】可用空货位!");
                    hKLocationInfo = _hKLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"未找到终点库区【{taskDTO.toAreaCode}】可用空货位!");
                if (taskType == (int)TaskTypeEnum.Q1TSJ4)
                {
                    var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
@@ -466,6 +467,11 @@
        /// <summary>
        /// æµ·åº·è®¾å¤‡æŠ¥è­¦
        /// </summary>
        /// <param name="hKDeviceAalarmDTO"></param>
        /// <returns></returns>
        public WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO)
        {
            WebResponseContent content = new WebResponseContent();
@@ -485,7 +491,7 @@
                    extra = hKDeviceAalarmDTO.extra,
                };
                string response = HttpHelper.Post(apiInfo.ApiAddress, hIKROBOTDeviceAlarm.Serialize());
                string response = HttpHelper.Post(apiInfo.ApiAddress,hIKROBOTDeviceAlarm.Serialize());
                wMSReturn = response.DeserializeObject<WMSReturn>();
                if (wMSReturn.success == true && wMSReturn.message == "success")
                {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs
@@ -102,36 +102,39 @@
                                //入提升机
                                if (task.TaskType == TaskTypeEnum.RK3F.ObjToInt() && task.TaskState == (int)TaskStatusEnum.CheckPalletCodeFinish)
                                {
                                    var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
                                    if (device == null) task.ExceptionMessage = "未找到提升机信息";
                                    else
                                    if (task.CurrentAddress==task.TargetAddress)
                                    {
                                        bool Work = false;
                                        try
                                        var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "TSJ") as OtherDevice;
                                        if (device == null) task.ExceptionMessage = "未找到提升机信息";
                                        else
                                        {
                                            if (device.IsConnected)
                                            bool Work = false;
                                            try
                                            {
                                                int i = 0;
                                                while (!Work && i <= 3)
                                                if (device.IsConnected)
                                                {
                                                    i++;
                                                    Work = device.SetValue(HoistEnum.Inboundboxon, 1, task.TargetAddress);
                                                    Thread.Sleep(500);
                                                    int i = 0;
                                                    while (!Work && i <= 3)
                                                    {
                                                        i++;
                                                        Work = device.SetValue(HoistEnum.Inboundboxon, 1, task.CurrentAddress);
                                                        Thread.Sleep(500);
                                                    }
                                                }
                                                if (!Work)
                                                {
                                                    task.ExceptionMessage = $"【{task.CurrentAddress}】写入3楼入库箱放到位失败";
                                                    task.Remark = $"{device.DeviceCode}_Inboundboxon_{1}_{task.CurrentAddress}";
                                                }
                                            }
                                            if (!Work)
                                            catch (Exception ex)
                                            {
                                                task.ExceptionMessage = $"【{task.TargetAddress}】写入3楼入库箱放到位失败";
                                                task.Remark = $"{device.DeviceCode}_Inboundboxon_{1}_{task.TargetAddress}";
                                                task.ExceptionMessage = $"【{task.CurrentAddress}】写入3楼入库箱放到位失败!{ex.Message}";
                                                task.Remark = $"{device.DeviceCode}_Inboundboxon_{1}_{task.CurrentAddress}";
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            task.ExceptionMessage = $"【{task.TargetAddress}】写入3楼入库箱放到位失败!{ex.Message}";
                                            task.Remark = $"{device.DeviceCode}_Inboundboxon_{1}_{task.TargetAddress}";
                                        }
                                        BaseDal.UpdateData(task);
                                    }
                                    BaseDal.UpdateData(task);
                                }
                                //3 å‡ºæå‡æœº ä¹‹å‰æ˜¯AGV_ToExecute
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -1286,6 +1286,7 @@
        {
            throw new NotImplementedException();
        }
        public WebResponseContent InboundElevatorExit(string LocationCode, string containerCode)
        {
            WebResponseContent content = new WebResponseContent();
@@ -1868,5 +1869,36 @@
                return content.Error($"更新站台状态失败:{ex.Message}");
            }
        }
        /// <summary>
        /// PLC报警信息
        /// </summary>
        /// <param name="ErrorMsg"></param>
        /// <returns></returns>
        public WebResponseContent PLCAlarmtoWMS(string ErrorMsg)
        {
            PLCAlarmDTO PLCAlarmDTO = new PLCAlarmDTO();
            WebResponseContent content = new WebResponseContent();
            try
            {
                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(PLCAlarmDTO)) ?? throw new Exception("未找到PLC报警信息接口配置信息!请检查接口配置");
                PLCAlarmDTO.errorMsg = ErrorMsg;
                string response = HttpHelper.Post(apiInfo.ApiAddress, PLCAlarmDTO.Serialize());
                content.OK(data: response);
                WMSReturn wMSReturn = response.DeserializeObject<WMSReturn>();
                if (wMSReturn == null) throw new Exception("WMS返回结果转换失败!");
                if (!wMSReturn.success) throw new Exception(wMSReturn.message);
               return content.OK();
            }
            catch (Exception ex)
            {
                return content.Error(ex.Message);
            }
            finally
            {
                _trackloginfoService.AddTrackLog(PLCAlarmDTO, content, "PLC报警信息上报WMS", "", "");
            }
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJExtend.cs
@@ -207,6 +207,11 @@
                                RK3FTask.TargetAddress = Location.StationCode;
                                _taskService.UpdateData(RK3FTask);
                            }
                            else //成功
                            {
                                RK3FTask.CurrentAddress = RK3FTask.TargetAddress;
                                _taskService.UpdateData(RK3FTask);
                            }
                            //调用海康进行执行完成接口
                            var result = _taskService.Hikvisiontaskscontinue(RK3FTask.WMSTaskNum, RK3FTask.NextAddress);
                            if (result.Status)
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/TSJJob.cs
@@ -54,6 +54,8 @@
                PalletNumConfirmation(device);
                PalletReportingToWMS(device);
                TSJAlarm(device);
            }
            else
            {
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskExtend.cs
@@ -7,9 +7,12 @@
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DTO;
namespace WIDESEAWCS_Tasks
{
@@ -44,7 +47,7 @@
                    //#endregion
                    #region ä¸‹å‘海康1到6楼的AGV任务/下发海康6到1楼的AGV任务
                    Tasks = newTasks.Where(x => (x.TaskType == (int)TaskTypeEnum.Q3CK) || x.TaskType == (int)TaskTypeEnum.Q3RK||x.TaskType==(int)TaskTypeEnum.F01).OrderByDescending(x => x.Grade).ToList();
                    Tasks = newTasks.Where(x => (x.TaskType == (int)TaskTypeEnum.Q3CK) || x.TaskType == (int)TaskTypeEnum.Q3RK || x.TaskType == (int)TaskTypeEnum.F01).OrderByDescending(x => x.Grade).ToList();
                    if (Tasks.Count > 0) SendAGVTask(Tasks);
@@ -126,5 +129,35 @@
            }
        }
        #endregion
        /// <summary>
        /// å¤„理写入设备信号异常任务
        /// </summary>
        public void HandleTasks()
        {
            #region
            var tasks = _taskService.Repository.QueryData(x => x.TaskState == TaskStatusEnum.Finish.ObjToInt() && !string.IsNullOrEmpty(x.Remark));
            if (tasks.Count > 0)
            {
                List<Dt_Task> list = new List<Dt_Task>();
                foreach (var item in tasks)
                {
                    var infos = item.Remark.Split("_");
                    var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == infos[0]) as OtherDevice;
                    if (device != null && device.IsConnected)
                    {
                        DeviceProDTO? devicePro = device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == infos[1] && x.DeviceChildCode == infos[3]);
                        if (devicePro != null)
                        {
                            var W = device.Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, infos[2]);
                            if (W) list.Add(item);
                        }
                    }
                }
                _taskService.Repository.DeleteAndMoveIntoHty(list, OperateTypeEnum.自动删除);
            }
            #endregion
        }
    }
}
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/TaskJob.cs
@@ -11,6 +11,7 @@
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_BasicInfoService;
@@ -61,28 +62,8 @@
                SendWaitToTask();
                #region å¤„理写入设备信号异常任务
                var tasks = _taskService.Repository.QueryData(x => x.TaskState == TaskStatusEnum.Finish.ObjToInt() && !string.IsNullOrEmpty(x.Remark));
                if (tasks.Count > 0)
                {
                    List<Dt_Task> list = new List<Dt_Task>();
                    foreach (var item in tasks)
                    {
                        var infos = item.Remark.Split("_");
                        var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == infos[0]) as OtherDevice;
                        if (device != null && device.IsConnected)
                        {
                            DeviceProDTO? devicePro = device.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == infos[1] && x.DeviceChildCode == infos[3]);
                            if (devicePro != null)
                            {
                                var W = device.Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, infos[2]);
                                if (W) list.Add(item);
                            }
                        }
                    }
                    _taskService.Repository.DeleteAndMoveIntoHty(list, OperateTypeEnum.自动删除);
                }
                #endregion
                HandleTasks();
            }
            catch (Exception ex)
            {