huangxiaoqiang
8 天以前 d325cca91328031262c0e6134c37cac441192ee4
ÏîÄ¿´úÂë/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
@@ -5,10 +5,12 @@
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WIDESEA_Common.Log;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.StackerHandTask;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_Model.BasicInfo;
using WIDESEAWCS_Model.Models;
@@ -54,6 +56,8 @@
        private async Task RequestTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, Dt_StationManager stationManager)
        {
            try
            {
            var hasTask = await _taskRepository.QueryFirstAsync(x => x.SourceAddress == childDeviceCode && x.TaskState < (int)TaskInStatusEnum.RGV_InExecutingFinish && x.TaskState >= (int)TaskInStatusEnum.InNew);
            if (hasTask != null)
            {
@@ -89,6 +93,16 @@
            };
            _taskRepository.AddData(task);
            }
            catch (Exception ex)
            {
                var log = $"【{conveyorLine._deviceName}】输送线【{childDeviceCode}】【{ex.Message}】";
                ConsoleHelper.WriteWarningLine(log);
                await _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
                WriteInfo(conveyorLine.DeviceName, log);
            }
        }
        private void RequestWMSTask(CommonConveyorLine conveyorLine,  Dt_StationManager stationManager)
        {
@@ -145,6 +159,7 @@
                    }
                    var wmsIpAddress = wmsBase + requestTask;
                    var result = WIDESEA_Comm.Http.HttpHelper.PostAsync(wmsIpAddress, taskDTO.ToJsonString()).Result;
                    WriteLog.GetLog("WMS接口返回信息").Write(JsonConvert.SerializeObject(result), "WMS接口返回信息");
                }
            }
            else
@@ -153,6 +168,7 @@
                var x = conveyorLine.Communicator.Read(devicePro.DeviceProAddress, 10);
                string Barcode = Encoding.UTF8.GetString(x);
                if (Barcode == null || Barcode == "" || Barcode.Trim().Contains("\0"))
                {
                    conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, Convert.ToSByte(3), stationManager.stationChildCode);
@@ -160,7 +176,8 @@
                var task = _taskRepository.QueryFirst(x => x.PalletCode == Barcode);
                if (task != null)
                {
                    var log = $"【{conveyorLine._deviceName}】站台【{stationManager.stationChildCode}】请求取货、已存在任务任务号{task.TaskNum}";
                    LogAndWarn(conveyorLine.DeviceName, log);
                }
                else
                {
@@ -180,6 +197,7 @@
                    }
                    var wmsIpAddress = wmsBase + requestTask;
                    var result = WIDESEA_Comm.Http.HttpHelper.PostAsync(wmsIpAddress, taskDTO.ToJsonString()).Result;
                    WriteLog.GetLog("WMS接口返回信息").Write(JsonConvert.SerializeObject(result), "WMS接口返回信息");
                }
            } 
        }