//#region << 版 本 注 释 >> ///*---------------------------------------------------------------- // * 命名空间:WIDESEAWCS_Tasks.ConveyorLineJob // * 创建者:胡童庆 // * 创建时间:2024/8/2 16:13:36 // * 版本:V1.0.0 // * 描述: // * // * ---------------------------------------------------------------- // * 修改人: // * 修改时间: // * 版本:V1.0.1 // * 修改说明: // * // *----------------------------------------------------------------*/ //#endregion << 版 本 注 释 >> //using AutoMapper; //using Quartz; //using System.Text.RegularExpressions; //using WIDESEA_Common.Log; //using WIDESEAWCS_Common.TaskEnum; //using WIDESEAWCS_DTO.Enum; //using WIDESEAWCS_ISystemServices; //using WIDESEAWCS_ITaskInfoService; //using WIDESEAWCS_Model.Models; //using WIDESEAWCS_Model.Models.System; //using WIDESEAWCS_QuartzJob; //using WIDESEAWCS_QuartzJob.Service; //using WIDESEAWCS_Tasks.ConveyorLineJob; //namespace WIDESEAWCS_Tasks //{ // [DisallowConcurrentExecution] // public class CommonConveyorLineJob : IJob // { // private readonly ITaskService _taskService; // private readonly ITaskExecuteDetailService _taskExecuteDetailService; // private readonly IRouterService _routerService; // private readonly IOrderDetailsService _OrderDetailsService; // private readonly IMapper _mapper; // public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IOrderDetailsService orderDetails, IMapper mapper) // { // _taskService = taskService; // _taskExecuteDetailService = taskExecuteDetailService; // _routerService = routerService; // _OrderDetailsService = orderDetails; // _mapper = mapper; // } // public Task Execute(IJobExecutionContext context) // { // try // { // CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); // if (conveyorLine != null) // { // if (conveyorLine.Communicator.Read("DB7.3030.0")) //申请 // { // string Barcodes = conveyorLine.Communicator.Read("DB7.3032"); //读条码 // string pattern = @"\d+"; // 匹配数字 // Match match = Regex.Match(Barcodes, pattern); // string barcodeNumber = match.Value; // if (barcodeNumber != "") // { // int toplc = _OrderDetailsService.GetOrderDetails(barcodeNumber); // if (toplc != -1) // { // conveyorLine.Communicator.Write("DB7.3022", (int)toplc); //写入去向 // conveyorLine.Communicator.Write("DB7.3028.0", (bool)true); //写入反馈 // WriteLog.Write_Log("扫码枪", "扫码站台", "成功", new { 信息 = $"条码:{barcodeNumber},写入去向{toplc}" }); // if (conveyorLine.Communicator.Read("DB7.3116")) // { // conveyorLine.Communicator.Write("DB7.3022", (int)0); //清除写入去向 // conveyorLine.Communicator.Write("DB7.3028.0", (bool)false); //清除写入反馈 // WriteLog.Write_Log("扫码枪", "扫码站台", "成功", new { 信息 = $"条码:{barcodeNumber},清除输送线反馈成功" }); // //调取反馈MES托盘条码 // var datast= _OrderDetailsService.ToMesBarc(int.Parse(barcodeNumber)); // if (datast.code==1) // { // WriteLog.Write_Log("ToMes", "条码反馈Mes", "成功", new { 信息 = $"条码:{barcodeNumber},反馈成功" }); // } // else // { // WriteLog.Write_Log("ToMes", "条码反馈Mes", "失败", new { 信息 = $"条码:{barcodeNumber},反馈失败" }); // } // } // else // { // WriteLog.Write_Log("扫码枪", "扫码站台", "错误", new { 信息 = $"条码:{barcodeNumber},清除输送线反馈失败" }); // } // } // else // { // conveyorLine.Communicator.Write("DB7.3028.1", (bool)true); // WriteLog.Write_Log("扫码枪", "扫码站台", "错误", new { 信息 = $"条码:{barcodeNumber},未找到数据明细详情长度,写入报警信息" }); // } // } // else // { // WriteLog.Write_Log("扫码枪", "扫码站台", "错误", new { 信息 = $"未读取到托盘条码,条码错误{barcodeNumber}" }); // } // } // else // { // WriteLog.Write_Log("扫码枪", "扫码站台", "错误", new { 信息 = "未读取到扫码枪申请" }); // } // } // } // catch (Exception ex) // { // //Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString()); // } // return Task.CompletedTask; // } // } //}