yanjinhui
9 小时以前 52ba6b195a4126df405ef453d52ba6eaab6521da
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/HKTaskMethods.cs
@@ -34,9 +34,10 @@
            try
            {
                Dt_HKLocationInfo? hKLocationInfo = null;
                if (taskType==(int)TaskTypeEnum.STURR)
                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}】");
                    var reslut = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"未找到起点货位【{taskDTO.fromLocationCode}】");
                }
                #region ç‚¹åˆ°ç‚¹
                if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
@@ -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;
@@ -143,7 +144,7 @@
                        throw new Exception($"终点站台【{taskDTO.toLocationCode}】状态不为空闲!");
                    }
                }
                    Dt_Task dt_Task = new Dt_Task()
                Dt_Task dt_Task = new Dt_Task()
                {
                    TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                    WMSTaskNum = taskDTO.taskCode,
@@ -255,7 +256,7 @@
            {
                var tasktype = (TaskTypeEnum)Enum.GetValues(typeof(TaskTypeEnum)).GetValue(task.TaskType - 1);
                hIKROBOTTaskSubmit.initPriority = task.Grade;
                if (task.PalletCode== "MR-Q3-600LE-D(M)")
                if (task.PalletCode == "MR-Q3-600LE-D(M)")
                {
                    hIKROBOTTaskSubmit.robotType = "19"; //海康 è½¬è¿è½¦
                }
@@ -464,5 +465,53 @@
            return content;
        }
        /// <summary>
        /// æµ·åº·è®¾å¤‡æŠ¥è­¦
        /// </summary>
        /// <param name="hKDeviceAalarmDTO"></param>
        /// <returns></returns>
        public WebResponseContent HKDeviceAlarm(HKDeviceAalarmDTO hKDeviceAalarmDTO)
        {
            WebResponseContent content = new WebResponseContent();
            WMSReturn wMSReturn = null;
            HKDeviceAalarmDTO hIKROBOTDeviceAlarm = null;
            try
            {
                Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(HKDeviceAalarmDTO)) ?? throw new Exception("未找到上报海康AGV设备报警接口配置信息!请检查接口配置");
                hIKROBOTDeviceAlarm = new HKDeviceAalarmDTO()
                {
                    robotTaskCode = hKDeviceAalarmDTO.robotTaskCode,
                    taskWarnCode = hKDeviceAalarmDTO.taskWarnCode,
                    startTime = hKDeviceAalarmDTO.startTime,
                    singleRobotCode = hKDeviceAalarmDTO.singleRobotCode,
                    errorCode = hKDeviceAalarmDTO.errorCode,
                    errorMsg = hKDeviceAalarmDTO.errorMsg,
                    extra = hKDeviceAalarmDTO.extra,
                };
                string response = HttpHelper.Post(apiInfo.ApiAddress,hIKROBOTDeviceAlarm.Serialize());
                wMSReturn = response.DeserializeObject<WMSReturn>();
                if (wMSReturn.success == true && wMSReturn.message == "success")
                {
                    content.OK("上报海康AGV设备报警信息成功");
                }
                else
                {
                    content.Error(wMSReturn.message);
                }
            }
            catch (Exception ex)
            {
                content.Error(ex.Message);
            }
            finally
            {
                _trackloginfoService.AddTrackLog(hIKROBOTDeviceAlarm, content, "上报海康AGV设备报警信息", "", "");
            }
            return content;
        }
    }
}