using HslCommunication; 
 | 
using MoYu; 
 | 
using System; 
 | 
using System.Collections.Generic; 
 | 
using System.Linq; 
 | 
using System.Text; 
 | 
using System.Threading.Tasks; 
 | 
using WIDESEAWCS_ITaskInfoRepository; 
 | 
using WIDESEAWCS_Model.Models; 
 | 
using WIDESEAWCS_QuartzJob; 
 | 
  
 | 
namespace WIDESEAWCS_Tasks.ConveyorLineJob.StationHandler 
 | 
{ 
 | 
    public class ExceptionPortStationHandler : IStationHandler 
 | 
    { 
 | 
        private readonly CommonConveyorLineJob _commonConveyorLineJob; 
 | 
        private readonly ITaskRepository _taskRepository = App.GetService<ITaskRepository>(); 
 | 
        public ExceptionPortStationHandler(CommonConveyorLineJob commonConveyorLineJob) 
 | 
        { 
 | 
            _commonConveyorLineJob = commonConveyorLineJob; 
 | 
        } 
 | 
        public async Task HandleStationAsync(CommonConveyorLine conveyorLine, Dt_StationManager station, ConveyorLineTaskCommand command, ConveyorLineTaskCommandWrite commandWrite) 
 | 
        { 
 | 
            var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray(); 
 | 
            if (structs[0]) 
 | 
            { 
 | 
                if (_taskRepository.QueryData(x => x.SourceAddress == station.stationChildCode).Count() > 0) 
 | 
                { 
 | 
                    return; 
 | 
                } 
 | 
                var log = $"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】【{station.stationRemark}】异常口请求扫码入库"; 
 | 
                await _commonConveyorLineJob.LogAndWarn(conveyorLine.DeviceName, log); 
 | 
                await _commonConveyorLineJob.HandleNewTaskAsync(conveyorLine, command, station.stationChildCode, 0); 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                _commonConveyorLineJob.ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false); 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
} 
 |