Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoRepository/Dt_needBarcodeRepository.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,29 @@ #region << ç æ¬ 注 é >> /*---------------------------------------------------------------- * å½å空é´ï¼WIDESEAWCS_TaskInfoRepository * å建è ï¼è¡ç«¥åº * å建æ¶é´ï¼2024/8/2 16:13:36 * çæ¬ï¼V1.0.0 * æè¿°ï¼ * * ---------------------------------------------------------------- * ä¿®æ¹äººï¼ * ä¿®æ¹æ¶é´ï¼ * çæ¬ï¼V1.0.1 * ä¿®æ¹è¯´æï¼ * *----------------------------------------------------------------*/ #endregion << ç æ¬ 注 é >> using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_BasicInfoRepository { public class Dt_needBarcodeRepository : RepositoryBase<dt_needBarcode>, IDt_needBarcodeRepository { public Dt_needBarcodeRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) { } } } Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/Dt_needBarcodeService.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,15 @@ using WIDESEAWCS_BasicInfoRepository; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_ISystemServices; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_BasicInfoService { public partial class dt_needBarcodeService : ServiceBase<dt_needBarcode, IDt_needBarcodeRepository>, Idt_needBarcodeService { public dt_needBarcodeService(IDt_needBarcodeRepository BaseDal) : base(BaseDal) { } } } Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoRepository/IDt_needBarcodeRepository.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,32 @@ #region << ç æ¬ 注 é >> /*---------------------------------------------------------------- * å½å空é´ï¼WIDESEAWCS_ITaskInfoRepository * å建è ï¼è¡ç«¥åº * å建æ¶é´ï¼2024/8/2 16:13:36 * çæ¬ï¼V1.0.0 * æè¿°ï¼ * * ---------------------------------------------------------------- * ä¿®æ¹äººï¼ * ä¿®æ¹æ¶é´ï¼ * çæ¬ï¼V1.0.1 * ä¿®æ¹è¯´æï¼ * *----------------------------------------------------------------*/ #endregion << ç æ¬ 注 é >> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_BasicInfoRepository { public interface IDt_needBarcodeRepository : IRepository<dt_needBarcode> { } } Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/IDt_needBarcodeService.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,29 @@ #region << ç æ¬ 注 é >> /*---------------------------------------------------------------- * å½å空é´ï¼WIDESEAWCS_ITaskInfoService * å建è ï¼è¡ç«¥åº * å建æ¶é´ï¼2024/8/2 16:13:36 * çæ¬ï¼V1.0.0 * æè¿°ï¼ * * ---------------------------------------------------------------- * ä¿®æ¹äººï¼ * ä¿®æ¹æ¶é´ï¼ * çæ¬ï¼V1.0.1 * ä¿®æ¹è¯´æï¼ * *----------------------------------------------------------------*/ #endregion << ç æ¬ 注 é >> using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_BasicInfoService { public interface Idt_needBarcodeService : IService<dt_needBarcode> { } } Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/BasicInfo/dt_needBarcode.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,72 @@ using SqlSugar; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text; using WIDESEAWCS_Core.DB.Models; namespace WIDESEAWCS_Model.Models { public class dt_needBarcode : BaseEntity { [Key] [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "主é®")] public int id { get; set; } /// <summary> /// ç®æ åºåº /// </summary> [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "ç®æ åºåº")] public string toArea { get; set; } /// <summary> /// æ¥æºåºåº /// </summary> [SugarColumn(IsNullable = false, Length = 10, ColumnDescription = "æ¥æºåºåº")] public string fromArea { get; set; } /// <summary> /// æçç±»å /// </summary> [SugarColumn(IsNullable = false, Length = 10, ColumnDescription = "æçç±»å")] public string barcodeType { get; set; } /// <summary> /// 产线 /// </summary> [SugarColumn(IsNullable = false, Length = 10, ColumnDescription = "æå±äº§çº¿")] public string productLine { get; set; } /// <summary> /// å¨éæ°é /// </summary> [SugarColumn(IsNullable = false, Length = 10, ColumnDescription = "å¨éæ°é")] public int inLineNum { get; set; } /// <summary> /// ç®æ ç¼åæ°é /// </summary> [SugarColumn(IsNullable = false, Length = 10, ColumnDescription = "å¯ç¼åæ°é")] public int cacheNum { get; set; } = 0; /// <summary> /// å·²å建åºåºä»»å¡æ°é /// </summary> [NotMapped] public int haveOutNum { get; set; } = 0; /// <summary> /// å¯å ¥æ°é /// </summary> [NotMapped] public int canInNum { get; set; } = 0; /// <summary> /// å·²å建åºåºä»»å¡ /// </summary> [NotMapped] public List<Dt_Task> haveOutList { get; set; } } } Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine_BZ.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,342 @@ #region << ç æ¬ 注 é >> /*---------------------------------------------------------------- * å½å空é´ï¼WIDESEAWCS_QuartzJob * å建è ï¼è¡ç«¥åº * å建æ¶é´ï¼2024/8/2 16:13:36 * çæ¬ï¼V1.0.0 * æè¿°ï¼ä¸è¬è¾é线å®ç°ç±» * * ---------------------------------------------------------------- * ä¿®æ¹äººï¼ * ä¿®æ¹æ¶é´ï¼ * çæ¬ï¼V1.0.1 * ä¿®æ¹è¯´æï¼ * *----------------------------------------------------------------*/ #endregion << ç æ¬ 注 é >> using HslCommunication; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Communicator; using WIDESEAWCS_QuartzJob.ConveyorLine.Enum; using WIDESEAWCS_QuartzJob.DeviceBase; using WIDESEAWCS_QuartzJob.DTO; using WIDESEAWCS_QuartzJob.StackerCrane.Enum; namespace WIDESEAWCS_QuartzJob { [Description("è¾é线")] public class CommonConveyorLine_BZ : IConveyorLine { #region Private Member /// <summary> /// å åæºé讯对象 /// </summary> private readonly BaseCommunicator _communicator; /// <summary> /// å åæºåè®®ä¿¡æ¯ /// </summary> private readonly List<DeviceProDTO> _deviceProDTOs; /// <summary> /// å åæºåè®®æç»ä¿¡æ¯ /// </summary> private readonly List<DeviceProtocolDetailDTO> _deviceProtocolDetailDTOs; /// <summary> /// 设å¤ç¼å· /// </summary> public readonly string _deviceCode; /// <summary> /// 设å¤åç§° /// </summary> public readonly string _deviceName; private bool _heartStatr = true; private bool _isConnected = true; #endregion #region Public Member /// <summary> /// è¾é线é讯对象 /// </summary> public BaseCommunicator Communicator => _communicator; /// <summary> /// è¾é线åè®®ä¿¡æ¯ /// </summary> public List<DeviceProDTO> DeviceProDTOs => _deviceProDTOs; /// <summary> /// è¾é线åè®®æç»ä¿¡æ¯ /// </summary> public List<DeviceProtocolDetailDTO> DeviceProtocolDetailDTOs => _deviceProtocolDetailDTOs; /// <summary> /// 设å¤ç¼å· /// </summary> public string DeviceCode => _deviceCode; /// <summary> /// 设å¤åç§° /// </summary> public string DeviceName => _deviceName; /// <summary> /// æ¯å¦ææ é /// </summary> public bool IsFault => false; /// <summary> /// é讯æ¯å¦å·²è¿æ¥ /// </summary> public bool IsConnected => Communicator.IsConnected && _isConnected; /// <summary> /// 设å¤ç¶æ /// </summary> public DeviceStatus Status => DeviceStatus.Offline; #endregion #region Constructor Function /// <summary> /// æé 彿° /// </summary> /// <param name="communicator">å åæºé讯对象</param> /// <param name="deviceProDTOs">å åæºå议信æ¯</param> /// <param name="deviceProtocolDetailDTOs">å åæºåè®®æç»ä¿¡æ¯</param> /// <param name="deviceCode">设å¤ç¼å·</param> /// <param name="deviceName">设å¤åç§°</param> public CommonConveyorLine_BZ(BaseCommunicator communicator, List<DeviceProDTO> deviceProDTOs, List<DeviceProtocolDetailDTO> deviceProtocolDetailDTOs, string deviceCode, string deviceName) { _communicator = communicator; _deviceProDTOs = deviceProDTOs; _deviceProtocolDetailDTOs = deviceProtocolDetailDTOs; _deviceCode = deviceCode; _deviceName = deviceName; CheckConnect(); } #endregion #region Private Method private void CheckConnect() { Task.Run(() => { while (_heartStatr) { try { DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(); if (devicePro == null) _isConnected = false; else Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); _isConnected = true; } catch (Exception ex) { _isConnected = false; } Thread.Sleep(500); } }); } #endregion #region Public Method /// <summary> /// 读åPLCåè®®å°åçæ°æ® /// </summary> /// <typeparam name="TEnum">å议信æ¯çæä¸¾å¯¹è±¡ä¿¡æ¯ã</typeparam> /// <typeparam name="TRsult">è¯»åæ°æ®çç±»å对象信æ¯ã</typeparam> /// <param name="value">æä¸¾å¼</param> /// <param name="deviceChildCode">设å¤åç¼å·</param> /// <returns>读åå°çæ°æ®</returns> public TRsult GetValue<TEnum, TRsult>(TEnum value, string deviceChildCode) where TEnum : Enum { if (!IsConnected) throw new Exception($"éè®¯è¿æ¥é误ï¼è¯·æ£æ¥ç½ç»"); DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == value.ToString() && x.DeviceChildCode == deviceChildCode); return devicePro == null ? throw new Exception() : (TRsult)Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); } /// <summary> /// ä¸è®¾å¤çå¿è·³ /// </summary> public void Heartbeat() { throw new NotImplementedException(); } /// <summary> /// /// </summary> /// <typeparam name="T"></typeparam> /// <param name="command"></param> /// <param name="deviceChildCode"></param> /// <returns></returns> /// <exception cref="Exception"></exception> public bool SendCommand<T>(T command, string deviceChildCode) where T : IDataTransfer, new() { if (!IsConnected) throw new Exception($"éè®¯è¿æ¥é误ï¼è¯·æ£æ¥ç½ç»"); DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); if (devicePro == null) { return false; } if (Communicator.WriteCustomer(devicePro.DeviceProAddress, command)) { return true; } return false; } /// <summary> /// 读åPLCæ°æ®ï¼è¿åèªå®ä¹å¯¹è±¡ /// </summary> /// <typeparam name="T">æ³å</typeparam> /// <param name="deviceChildCode">å设å¤ç¼å·</param> /// <returns>è¿åèªå®ä¹å¯¹è±¡ææåºå¼å¸¸</returns> /// <exception cref="Exception"></exception> public T ReadCustomer<T>(string deviceChildCode) where T : IDataTransfer, new() { if (!IsConnected) throw new Exception($"éè®¯è¿æ¥é误ï¼è¯·æ£æ¥ç½ç»"); DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == "DeviceCommand" && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); if (devicePro == null) { throw new Exception($"ã{_deviceCode}ã--æªæ¾å°ã{deviceChildCode}ãå议信æ¯"); } else { return Communicator.ReadCustomer<T>(devicePro.DeviceProAddress); } } /// <summary> /// 读åPLCæ°æ®ï¼è¿åèªå®ä¹å¯¹è±¡ /// </summary> /// <typeparam name="T">æ³å</typeparam> /// <param name="deviceChildCode">å设å¤ç¼å·</param> /// <param name="deviceProParamType">åæ°ç±»å</param> /// <returns>è¿åèªå®ä¹å¯¹è±¡ææåºå¼å¸¸</returns> /// <exception cref="Exception"></exception> public T ReadCustomer<T>(string deviceChildCode, string deviceProParamType) where T : IDataTransfer, new() { if (!IsConnected) throw new Exception($"éè®¯è¿æ¥é误ï¼è¯·æ£æ¥ç½ç»"); DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == deviceProParamType && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault(); if (devicePro == null) { throw new Exception($"æªæ¾å°ã{deviceChildCode}ãå议信æ¯"); } else { return Communicator.ReadCustomer<T>(devicePro.DeviceProAddress); } } /// <summary> /// æ ¹æ®åæ°åç§°ã设å¤åç¼å·åå ¥å¯¹åºçæ°æ®ã /// </summary> /// <typeparam name="TEnum">åæ°åç§°æä¸¾ç±»åã</typeparam> /// <typeparam name="TValue">è¦åå ¥çæ°æ®ç±»åã</typeparam> /// <param name="enum">åæ°åç§°ã</param> /// <param name="value">è¦åå ¥çæ°æ®ã</param> /// <param name="deviceChildCode">设å¤åç¼å·å</param> /// <returns>è¿ååå ¥æåæå¤±è´¥</returns> public bool SetValue<TEnum, TValue>(TEnum @enum, TValue value, string deviceChildCode) where TEnum : Enum where TValue : notnull { if (!IsConnected) throw new Exception($"éè®¯è¿æ¥é误ï¼è¯·æ£æ¥ç½ç»"); DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == @enum.ToString() && x.DeviceChildCode == deviceChildCode); return devicePro == null ? throw new Exception() : Communicator.WriteObj(devicePro.DeviceProAddress, devicePro.DeviceDataType, value); } /// <summary> /// æ ¹æ®åæ°åç§°ã设å¤åç¼å·è¯»å对åºçæ°æ®ã /// </summary> /// <typeparam name="TEnum">åæ°åç§°æä¸¾ç±»åã</typeparam> /// <param name="enum">åæ°åç§°ã</param> /// <param name="deviceChildCode">设å¤åç¼å·å</param> /// <returns>è¿ååå ¥æåæå¤±è´¥</returns> public object ReadValue<TEnum>(TEnum @enum, string deviceChildCode) where TEnum : Enum { if (!IsConnected) throw new Exception($"éè®¯è¿æ¥é误ï¼è¯·æ£æ¥ç½ç»"); DeviceProDTO? devicePro = _deviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == @enum.ToString() && x.DeviceChildCode == deviceChildCode); return devicePro == null ? throw new Exception() : Communicator.ReadAsObj(devicePro.DeviceProAddress, devicePro.DeviceDataType); } //public bool IsOccupied(string deviceChildCode) //{ // if (Communicator.IsConnected) // { // } //} /// <summary> /// /// </summary> /// <param name="deviceChildCode"></param> /// <returns></returns> /// <exception cref="Exception"></exception> public bool IsOccupied(string deviceChildCode) { if (Communicator.IsConnected) { List<DeviceProDTO> devicePros = _deviceProDTOs.Where(x => x.DeviceChildCode == deviceChildCode && x.DeviceProParamName == "InteractiveSignal").ToList(); if (devicePros.Count == 0) { //todo åè®®ä¿¡æ¯æªè·åå°æ¶æåºå¼å¸¸ throw new Exception(); } for (int i = 0; i < devicePros.Count; i++) { object readStatus = Communicator.ReadAsObj(devicePros[i].DeviceProAddress, devicePros[i].DeviceDataType); //todo åè®®æç»ä¿¡æ¯æªè·åå°æ¶æåºå¼å¸¸ DeviceProtocolDetailDTO? deviceProtocolDetail = _deviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == devicePros[i].DeviceProParamName) ?? throw new Exception(); deviceProtocolDetail = _deviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == "InteractiveSignal" && x.ProtocalDetailValue.Equals(readStatus.ToString())); if (deviceProtocolDetail != null) { return true; } return false; } } //todo é讯æªè¿æ¥æ¶æåºå¼å¸¸ return false; } public void Dispose() { _heartStatr = false; _communicator.Dispose(); GC.SuppressFinalize(this); } #endregion } } Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/Task_HtyController.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseController; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_ITaskInfo_HtyService; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; namespace WIDESEAWCS_WCSServer.Controllers.Task { [Route("api/Task_Hty")] [ApiController] public class Task_HtyController : ApiBaseController<ITask_HtyService, Dt_Task_Hty> { private readonly IHttpContextAccessor _httpContextAccessor; public Task_HtyController(ITask_HtyService service, IHttpContextAccessor httpContextAccessor) : base(service) { _httpContextAccessor = httpContextAccessor; } } } Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_BZ/CommonConveyorLine_BZJob.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,239 @@ #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.Net; 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.Caches; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Core.HttpContextUser; using WIDESEAWCS_DTO.MOM; 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_SignalR; using WIDESEAWCS_Tasks.ConveyorLineJob; using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; namespace WIDESEAWCS_Tasks { [DisallowConcurrentExecution] public partial class CommonConveyorLine_BZJob : 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_StationManagerService _stationManagerService; private readonly IDt_StationManagerRepository _stationManagerRepository; private readonly ICacheService _cacheService; private readonly INoticeService _noticeService; private readonly IDt_needBarcodeRepository _needBarcodeRepository; public CommonConveyorLine_BZJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDt_StationManagerService stationManagerService, IDt_needBarcodeRepository needBarcodeRepository) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _routerService = routerService; _mapper = mapper; _taskRepository = taskRepository; _platFormRepository = platFormRepository; _sys_ConfigService = sys_ConfigService; _stationManagerRepository = stationManagerRepository; _cacheService = cacheService; _noticeService = noticeService; _stationManagerService = stationManagerService; _needBarcodeRepository = needBarcodeRepository; } public Task Execute(IJobExecutionContext context) { try { CommonConveyorLine_BZ conveyorLine = (CommonConveyorLine_BZ)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 }); } } #region è°ç¨äºä»¶æ»çº¿éç¥å端 var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); if (tokenInfos == null || !tokenInfos.Any()) { //throw new Exception(conveyorLine.DeviceName + "ç¼å䏿ªæ¾å°Tokenç¼å"); continue; } var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList(); var userIds = tokenInfos?.Select(x => x.UserId).ToList(); object obj = new { station.stationChildCode, commandAfter = command, }; _noticeService.StackerData(userIds?.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, data = obj }); #endregion è°ç¨äºä»¶æ»çº¿éç¥å端 } #endregion #region è·¯ç±æ¹å¼ //List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); //foreach (string childDeviceCode in childDeviceCodes) //{ // ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode); // if (command == null) continue; // 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 }); // } // } // if (childDeviceCode == "1670") // { // Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active"); // if (platform != null) // { // if (command.HasPallet != 1) // { // MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod); // if (method != null) // { // int count = string.IsNullOrEmpty(platform.Location) ? 0 + 1 : platform.Location.Split(',').Count() + 1; // method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform }); // } // } // } // } //} #endregion } } catch (Exception ex) { Console.Out.WriteLine(nameof(CommonConveyorLine_BZJob) + ":" + 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="station">线ä½å½åbool读ååç§»å°å</param> public void RequestOutbound(CommonConveyorLine_BZ conveyorLine, ConveyorLineTaskCommand_After command, Dt_StationManager station) { //æ¥è¯¢å¯¹åºäº§çº¿çå¨éæ°æ® dt_needBarcode needBarcode = _needBarcodeRepository.QueryFirst(x => x.productLine == station.stationRemark); //needBarcode.haveOutNum //è¥å¨éæ°éå°äºç®æ ä½ç½®çç¼åæ°é å寻æ¾å¯¹åºå¸¸æ¸©åºåä¸å¸¸æ¸©3å·¥åºçå¯åºåºæ°æ® 并建ç«åºåºä»»å¡ if (needBarcode.inLineNum <= needBarcode.cacheNum) { if (_taskService.RequestOutTaskToBZAsync(station).Result.Status) { needBarcode.inLineNum++; _needBarcodeRepository.UpdateData(needBarcode); } } } /// <summary> /// å°è¾¾ç®æ ä½ç½®å å°å¯¹åºä»»å¡æ¸ é¤ å¹¶æ´æ°å¨éæ°æ® /// </summary> /// <param name="conveyorLine"></param> /// <param name="command"></param> /// <param name="station"></param> public void RecivcePalletBarcode(CommonConveyorLine_BZ conveyorLine, ConveyorLineTaskCommand_After command, Dt_StationManager station) { Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == command.ConveyorLineBarcode && x.CurrentAddress == station.stationChildCode); dt_needBarcode needBarcode = _needBarcodeRepository.QueryFirst(x => x.toArea == station.stationChildCode); if (needBarcode == null) throw new Exception($"æªé ç½®ç¸å ³{station.stationChildCode}ç产线å¨éæ°æ®"); if (task != null) { conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, station.stationChildCode); _taskRepository.DeleteData(task); } else { conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, station.stationNGChildCode, station.stationChildCode); } needBarcode.inLineNum--; _needBarcodeRepository.UpdateData(needBarcode); } } } #endregion