1
刘磊
2024-11-26 ec233a6f745c1a0fb8241f7a761282656f4cc9ea
1
已修改1个文件
已添加2个文件
534 ■■■■■ 文件已修改
.gitignore 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs 330 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -1516,3 +1516,6 @@
/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_WMSServer.csproj.user
/项目资料/项目图纸/电芯2F图纸与电气编号对照(08项目)/08二楼输送布局点位图1106(4).dwg.lck
/项目资料/项目图纸/包装2F图纸与电气编号对照(09项目)/09二楼包装输送布局点位图1109.dwg.bak
*.props
*.a
/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.csproj.BuildWithSkipAnalyzers
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,330 @@
#region MyRegion
#region << ç‰ˆ æœ¬ æ³¨ é‡Š >>
/*----------------------------------------------------------------
 * å‘½åç©ºé—´ï¼šWIDESEAWCS_Tasks.ConveyorLineJob
 * åˆ›å»ºè€…:胡童庆
 * åˆ›å»ºæ—¶é—´ï¼š2024/8/2 16:13:36
 * ç‰ˆæœ¬ï¼šV1.0.0
 * æè¿°ï¼š
 *
 * ----------------------------------------------------------------
 * ä¿®æ”¹äººï¼š
 * ä¿®æ”¹æ—¶é—´ï¼š
 * ç‰ˆæœ¬ï¼šV1.0.1
 * ä¿®æ”¹è¯´æ˜Žï¼š
 *
 *----------------------------------------------------------------*/
#endregion << ç‰ˆ æœ¬ æ³¨ é‡Š >>
using AutoMapper;
using HslCommunication;
using Microsoft.AspNetCore.Server.HttpSys;
using Newtonsoft.Json;
using Quartz;
using SqlSugar;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Threading.Tasks;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_IProcessRepository;
using WIDESEAWCS_ISystemRepository;
using WIDESEAWCS_ISystemServices;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.DTO;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_Tasks.ConveyorLineJob;
namespace WIDESEAWCS_Tasks
{
    [DisallowConcurrentExecution]
    public partial class CommonConveyorLine_GWJob : JobBase, IJob
    {
        public readonly ITaskService _taskService;
        private readonly ITaskRepository _taskRepository;
        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
        private readonly IRouterService _routerService;
        private readonly IPlatFormRepository _platFormRepository;
        private readonly ISys_ConfigService _sys_ConfigService;
        private readonly IMapper _mapper;
        private readonly IDt_StationManagerRepository _stationManagerRepository;
        public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository)
        {
            _taskService = taskService;
            _taskExecuteDetailService = taskExecuteDetailService;
            _routerService = routerService;
            _mapper = mapper;
            _taskRepository = taskRepository;
            _platFormRepository = platFormRepository;
            _sys_ConfigService = sys_ConfigService;
            _stationManagerRepository = stationManagerRepository;
        }
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
                CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)context.JobDetail.JobDataMap.Get("JobParams");
                if (conveyorLine != null)
                {
                    #region ç«™å°æ–¹å¼
                    //List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
                    //foreach (var station in stationManagers)
                    //{
                    //    ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(station.stationChildCode);
                    //    DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString());
                    //    if (deviceProtocolDetails != null)
                    //    {
                    //        MethodInfo? method = GetType().GetMethod(deviceProtocolDetails.ProtocolDetailType);
                    //        if (method != null)
                    //        {
                    //            method.Invoke(this, new object[] { conveyorLine, command, station });
                    //        }
                    //    }
                    //}
                    #endregion
                    #region è·¯ç”±æ–¹å¼
                    List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
                    foreach (string childDeviceCode in childDeviceCodes)
                    {
                        ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode);
                        if (command.ConveyorLineBarcode.Trim().Contains("\0")) command.ConveyorLineBarcode = "";
                        DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString());
                        if (deviceProtocolDetails != null)
                        {
                            MethodInfo? method = GetType().GetMethod(deviceProtocolDetails.ProtocolDetailType);
                            if (method != null)
                            {
                                method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode });
                            }
                        }
                     }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(nameof(CommonConveyorLine_AfterJob) + ":" + ex.ToString());
            }
            finally
            {
                //WriteDebug("CommonConveyorLineJob", "test");
                //Console.Out.WriteLine(DateTime.Now);
            }
            return Task.CompletedTask;
        }
        /// <summary>
        /// è¾“送线请求入库
        /// </summary>
        /// <param name="conveyorLine">输送线实例对象</param>
        /// <param name="command">读取的请求信息</param>
        /// <param name="childDeviceCode">子设备编号</param>
        /// <param name="ProtocalDetailValue">线体当前bool读取偏移地址</param>
        public void RequestInbound(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
        {
            try
            {
                var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode);
                //HandleTaskOut(conveyorLine, command, childDeviceCode, task);
                // && command.ConveyorLineBarcode != "NoRead" && !command.ConveyorLineBarcode.IsNotEmptyOrNull()
                if (task == null)
                {
                    HandleNewTask(conveyorLine, command, childDeviceCode);
                }
            }
            catch (Exception ex)
            {
                Console.Out.WriteLine(ex.ToString());
            }
        }
        /// <summary>
        /// è¾“送线入库完成
        /// </summary>
        /// <param name="conveyorLine">输送线实例对象</param>
        /// <param name="command">读取的请求信息</param>
        /// <param name="childDeviceCode">子设备编号</param>
        /// <param name="ProtocalDetailValue">线体当前bool读取偏移地址</param>
        public void ConveyorLineInFinish(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
        {
            var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
            if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
            {
                //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
                if(content.Status)
                {
                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode);
                }
                Console.Out.WriteLine(content.Serialize());
            }
        }
        /// <summary>
        /// è¾“送线请求出信息
        /// </summary>
        /// <param name="conveyorLine">输送线实例对象</param>
        /// <param name="command">读取的请求信息</param>
        /// <param name="childDeviceCode">子设备编号</param>
        /// <param name="ProtocalDetailValue">线体当前bool读取偏移地址</param>
        public void RequestOutbound(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int ProtocalDetailValue)
        {
            var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
            if (task != null)
            {
                ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
                taskCommand.InteractiveSignal = command.InteractiveSignal;
                conveyorLine.SendCommand(taskCommand, childDeviceCode);
                //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                _taskService.UpdateTaskStatusToNext(task);
            }
        }
        /// <summary>
        /// è¾“送线出库完成
        /// </summary>
        /// <param name="conveyorLine">输送线实例对象</param>
        /// <param name="command">读取的请求信息</param>
        /// <param name="childDeviceCode">子设备编号</param>
        public void ConveyorLineOutFinish(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
        {
            var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
            if (task != null)
            {
                WebResponseContent content = new WebResponseContent();
                ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
                taskCommand.InteractiveSignal = command.InteractiveSignal;
                if (task.PalletCode != command.ConveyorLineBarcode)
                {
                    var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == task.TargetAddress).Capacity;
                    taskCommand.ConveyorLineTargetAddress = (short)NGAddress;
                }
                else
                {
                    taskCommand.ConveyorLineTargetAddress = 1000;
                }
                conveyorLine.SendCommand(taskCommand, childDeviceCode);
                //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                content = _taskService.UpdateTaskStatusToNext(task);
            }
        }
        /// <summary>
        /// è¾“送线交互完成
        /// </summary>
        /// <param name="conveyorLine">输送线实例对象</param>
        /// <param name="childDeviceCode">子设备编号</param>
        /// <param name="ProtocalDetailValue">线体当前bool读取偏移地址</param>
        /// <param name="value">值</param>
        //public void ConveyorLineSendFinish(CommonConveyorLine conveyorLine, string childDeviceCode, int ProtocalDeValue, bool value)
        //{
        //    DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
        //    string[] x = devicePro.DeviceProAddress.Split('.');
        //    x[x.Length - 1] = (ProtocalDetailValue + 1).ToString();
        //    string DeviceProAddress = string.Join(".", x);
        //    conveyorLine.Communicator.Write(DeviceProAddress, value);
        //}
        /// <summary>
        /// ç›‘测空托盘实盘出库
        /// </summary>
        /// <param name="conveyorLine">输送线实例对象</param>
        /// <param name="command">读取的请求信息</param>
        /// <param name="childDeviceCode">子设备编号</param>
        /// <param name="index">线体当前bool读取偏移地址</param>
        public async void EmptyTrayReturn(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int index, Platform platform)
        {
            try
            {
                TaskOutboundTypeEnum taskOutboundTypeEnum;
                if (platform.PlatformType.Contains("OutTray"))
                    taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
                else
                    taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
                await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker);
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// æ£€æŸ¥ä»»åŠ¡å¹¶åˆ›å»ºæ–°ä»»åŠ¡
        /// </summary>
        private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, List<string> roadways = null)
        {
            var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
            if (tasks.Count < index)
            {
                #region è°ƒç”¨WMS获取出库任务
                WMSTaskDTO taskDTO = new WMSTaskDTO();
                // èŽ·å–WMSip地址
                var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
                var requestTrayOutTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTrayOutTask)?.ConfigValue;
                if (wmsBase == null || requestTrayOutTask == null)
                {
                    throw new InvalidOperationException("WMS IP æœªé…ç½®");
                }
                var wmsIpAddress = wmsBase + requestTrayOutTask;
                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, roadways = roadways }.ToJsonString());
                //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
                WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
                // æ£€æŸ¥çŠ¶æ€å¹¶è¿”å›ž
                if (!content.Status)
                    return;
                taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
                #endregion
                CreateAndSendTask(taskDTO);
            }
        }
        /// <summary>
        /// åˆ›å»ºä»»åŠ¡
        /// </summary>
        public WebResponseContent CreateAndSendTask(WMSTaskDTO taskDTO)
        {
            var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
            if (content.Status)
            {
                Console.WriteLine($"{taskDTO.TaskType}呼叫成功");
            }
            return content;
        }
    }
}
#endregion
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,201 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_Core;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_Tasks.ConveyorLineJob;
using HslCommunication;
using WIDESEAWCS_DTO.WMS;
using WIDESEAWCS_Common;
namespace WIDESEAWCS_Tasks
{
    public partial class CommonConveyorLine_GWJob
    {
        /// <summary>
        /// å¤„理出库任务
        /// </summary>
        private void HandleTaskOut(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int ProtocalDetailValue, Dt_Task taskOut)
        {
            if (taskOut == null) return;
            var taskCommand = MapTaskCommand(taskOut, command);
            bool isOutTray = taskOut.TaskType == (int)TaskOutboundTypeEnum.OutTray;
            bool isOutboundAndOutFinish = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.SC_OutFinish;
            bool isOutboundAndLineOutExecuting = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting;
            if (isOutTray || isOutboundAndOutFinish || !isOutboundAndLineOutExecuting)
            {
                conveyorLine.SendCommand(taskCommand, childDeviceCode);
                //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                _taskService.UpdateTaskStatusToNext(taskOut);
            }
            else if (taskOut.TaskType == (int)TaskOutboundTypeEnum.OutTray && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
            {
                CompleteWmsTask(taskOut, command, conveyorLine, childDeviceCode, ProtocalDetailValue);
            }
        }
        /// <summary>
        /// å¤„理新任务
        /// </summary>
        private void HandleNewTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
        {
            Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
            if ((conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") || (conveyorLine.DeviceCode == "1005" && childDeviceCode == "1048"))
            {
                CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode);
            }
            else if (stationManager.stationType == 1)
            {
                var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode);
                if (task != null)
                {
                    ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
                }
                else
                {
                    RequestWmsTask(conveyorLine, command, childDeviceCode);
                }
            }
            else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1068"))
            {
                ConveyorLineOutFinish(conveyorLine, command, childDeviceCode);
            }
        }
        /// <summary>
        /// æ˜ å°„任务命令
        /// </summary>
        private ConveyorLineTaskCommand_After MapTaskCommand(Dt_Task task, ConveyorLineTaskCommand_After command)
        {
            var comm = _mapper.Map<ConveyorLineTaskCommand_After>(task);
            comm.InteractiveSignal = command.InteractiveSignal;
            return comm;
        }
        /// <summary>
        /// å®ŒæˆWMS任务
        /// </summary>
        private void CompleteWmsTask(Dt_Task taskOut, ConveyorLineTaskCommand_After command, CommonConveyorLine_GW conveyorLine, string childDeviceCode, int ProtocalDetailValue)
        {
            if (command.ConveyorLineBarcode == "NoRead")
            {
                var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == taskOut.TargetAddress).Capacity;
                taskOut.TargetAddress = NGAddress.ToString();
            }
            var keys = new Dictionary<string, object>()
            {
                {"taskNum", taskOut.TaskNum}
            };
            var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
            var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
            var completeTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.CompleteTask)?.ConfigValue;
            if (wmsBase == null || completeTask == null)
            {
                throw new InvalidOperationException("WMS IP æœªé…ç½®");
            }
            var wmsIpAddress = wmsBase + completeTask;
            var result = HttpHelper.GetAsync(wmsIpAddress, keys).Result;
            WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
            if (content.Status)
            {
                //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                _taskService.UpdateTaskStatusToNext(taskOut);
            }
        }
        /// <summary>
        /// åˆ›å»ºå¹¶å‘送空托盘任务
        /// </summary>
        public void CreateAndSendEmptyTrayTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
        {
            if (command.ConveyorLineBarcode != "NoRead")
            {
                var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode);
                if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null)
                {
                    WriteInfo(conveyorLine.DeviceName, "当前托盘存在任务");
                    return;
                }
                var content = CreateAndSendTask(taskDTO);
                if (content.Status)
                {
                    var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
                    if (task != null)
                    {
                        var taskCommand = MapTaskCommand(task, command);
                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
                        //ConveyorLineSendFinish(conveyorLine, childDeviceCode, true);
                        _taskService.UpdateTaskStatusToNext(task);
                    }
                }
            }
        }
        /// <summary>
        /// åˆ›å»ºç©ºæ‰˜ç›˜ä»»åŠ¡DTO
        /// </summary>
        private WMSTaskDTO CreateEmptyTrayTaskDto(string barcode, string childDeviceCode)
        {
            var request = new RequestTaskDto()
            {
                Position = childDeviceCode,
                PalletCode = barcode,
            };
            var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
            var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
            var requestTrayInTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTrayInTask)?.ConfigValue;
            if (wmsBase == null || requestTrayInTask == null)
            {
                throw new InvalidOperationException("WMS IP æœªé…ç½®");
            }
            var wmsIpAddrss = wmsBase + requestTrayInTask;
            var result = HttpHelper.PostAsync(wmsIpAddrss, request.ToJsonString()).Result;
            if (result == null)
                return new WMSTaskDTO();
            WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
            if (!content.Status)
                return new WMSTaskDTO();
            return JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
        }
        /// <summary>
        /// è¯·æ±‚WMS任务
        /// </summary>
        private async void RequestWmsTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode)
        {
            var content = await _taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode);
            if (content.Status)
            {
                var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode);
                if (task != null)
                {
                    conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode);
                    conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode);
                    //conveyorLine.SendCommand(taskCommand, childDeviceCode);
                    //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                    _taskService.UpdateTaskStatusToNext(task);
                }
            }
            else
                WriteInfo(conveyorLine.DeviceName, content.Message);
        }
    }
}