lss
3 天以前 17e3ef45fe0a6b6f8a147b50740834ac734f9317
HH.WCS.Mobox3/HH.WCS.Mobox3.DaYang/util/HttpHelper.cs
@@ -288,7 +288,7 @@
                var r = WebPost(url, date);
                LogHelper.Info($"获取设备状态:返回内容:{r}");
                deviceStatus = JsonConvert.DeserializeObject<Result<DeviceStatusModel>>(r);
                if (deviceStatus.Code == 200)
                if (deviceStatus != null && deviceStatus.Code == 200)
                {
                    LogHelper.Info($"获取设备状态成功");
                }
@@ -325,13 +325,12 @@
                taskPushModel.TaskType = task.S_TYPE;
                taskPushModel.CntrNo = task.S_CNTR_CODE;
              
                string date = JsonConvert.SerializeObject(taskPushModel);
                LogHelper.Info($"下发任务:地址:{url},内容:{date}");
                var r = WebPost(url, date);
                LogHelper.Info($"下发任务:返回内容:{r}");
                result = JsonConvert.DeserializeObject<Result<Empty>>(r);
                if (result.Code == 200)
                if (result!=null&&result.Code == 200)
                {
                    LogHelper.Info($"下发任务成功");
                }
@@ -363,24 +362,104 @@
            {
                string taskno=task.S_CODE;
                string date = JsonConvert.SerializeObject(taskno);
                LogHelper.Info($"下发任务:地址:{url},内容:{date}");
                LogHelper.Info($"任务取消:地址:{url},内容:{date}");
                var r = WebPost(url, date);
                LogHelper.Info($"下发任务:返回内容:{r}");
                LogHelper.Info($"任务取消:返回内容:{r}");
                result = JsonConvert.DeserializeObject<Result<Empty>>(r);
                if (result.Code == 200)
                if (result != null && result.Code == 200)
                {
                    LogHelper.Info($"下发任务成功");
                    LogHelper.Info($"任务取消成功");
                }
                else
                {
                    LogHelper.Info($"下发任务失败=>msg:{result.Msg}");
                    LogHelper.Info($"任务取消失败=>msg:{result.Msg}");
                }
                return result;
            }
            catch (Exception ex)
            {
                LogHelper.Info($"下发任务=>错误:error:{ex.Message},行号:{ex.StackTrace}");
                LogHelper.Info($"任务取消=>错误:error:{ex.Message},行号:{ex.StackTrace}");
                return result;
            }
        }
        /// <summary>
        /// 设备状态切换
        /// </summary>
        /// <param name="task"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public Result<Empty> ChangeStatus(string type, string url)
        {
            //返回信息
            Result<Empty> result = new Result<Empty>();
            try
            {
                ChangeStatusModel changeStatusModel=new ChangeStatusModel();
                changeStatusModel.Type = type;
                changeStatusModel.DeviceNo = "2";
                string date = JsonConvert.SerializeObject(changeStatusModel);
                LogHelper.Info($"设备状态切换:地址:{url},内容:{date}");
                var r = WebPost(url, date);
                LogHelper.Info($"设备状态切换:返回内容:{r}");
                result = JsonConvert.DeserializeObject<Result<Empty>>(r);
                if (result != null && result.Code == 200)
                {
                    LogHelper.Info($"设备状态切换成功");
                }
                else
                {
                    LogHelper.Info($"设备状态切换失败=>msg:{result.Msg}");
                }
                return result;
            }
            catch (Exception ex)
            {
                LogHelper.Info($"设备状态切换=>错误:error:{ex.Message},行号:{ex.StackTrace}");
                return result;
            }
        }
        /// <summary>
        /// 修改任务优先级
        /// </summary>
        /// <param name="task"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public Result<Empty> ChangePriority(string taskno,int priority, string url)
        {
            //返回信息
            Result<Empty> result = new Result<Empty>();
            try
            {
                ChangePriorityModel model = new ChangePriorityModel();
                model.TaskNo = taskno;
                model.Priority = priority;
                string date = JsonConvert.SerializeObject(model);
                LogHelper.Info($"修改任务优先级:地址:{url},内容:{date}");
                var r = WebPost(url, date);
                LogHelper.Info($"修改任务优先级:返回内容:{r}");
                result = JsonConvert.DeserializeObject<Result<Empty>>(r);
                if (result != null && result.Code == 200)
                {
                    LogHelper.Info($"修改任务优先级成功");
                }
                else
                {
                    LogHelper.Info($"修改任务优先级失败=>msg:{result.Msg}");
                }
                return result;
            }
            catch (Exception ex)
            {
                LogHelper.Info($"修改任务优先级=>错误:error:{ex.Message},行号:{ex.StackTrace}");
                return result;
            }