|  |  |  | 
|---|
|  |  |  | using Quartz; | 
|---|
|  |  |  | using Microsoft.IdentityModel.Tokens; | 
|---|
|  |  |  | using Newtonsoft.Json; | 
|---|
|  |  |  | using Quartz; | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | using System.Linq; | 
|---|
|  |  |  | 
|---|
|  |  |  | using WIDESEAWCS_Common.Helper; | 
|---|
|  |  |  | using WIDESEAWCS_Common.TaskEnum; | 
|---|
|  |  |  | using WIDESEAWCS_Core; | 
|---|
|  |  |  | using WIDESEAWCS_Core.Caches; | 
|---|
|  |  |  | using WIDESEAWCS_Core.Helper; | 
|---|
|  |  |  | using WIDESEAWCS_IBasicInfoRepository; | 
|---|
|  |  |  | using WIDESEAWCS_ITaskInfoRepository; | 
|---|
|  |  |  | 
|---|
|  |  |  | [DisallowConcurrentExecution] | 
|---|
|  |  |  | public class ConveyorLineJob_GM : JobBase, IJob | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private readonly ICacheService _cacheService; | 
|---|
|  |  |  | private readonly ITaskService _taskService; | 
|---|
|  |  |  | private readonly ITaskExecuteDetailService _taskExecuteDetailService; | 
|---|
|  |  |  | private readonly ITaskRepository _taskRepository; | 
|---|
|  |  |  | private readonly IStationMangerRepository _stationMangerRepository; | 
|---|
|  |  |  | private readonly IRouterRepository _routerRepository; | 
|---|
|  |  |  | private readonly List<Dt_WarehouseDevice> warehouseDevices; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public ConveyorLineJob_GM(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository) | 
|---|
|  |  |  | public ConveyorLineJob_GM(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, ICacheService | 
|---|
|  |  |  | cacheService) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _cacheService = cacheService; | 
|---|
|  |  |  | _taskService = taskService; | 
|---|
|  |  |  | _taskExecuteDetailService = taskExecuteDetailService; | 
|---|
|  |  |  | _taskRepository = taskRepository; | 
|---|
|  |  |  | _stationMangerRepository = stationMangerRepository; | 
|---|
|  |  |  | _routerRepository = routerRepository; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); | 
|---|
|  |  |  | if (!string.IsNullOrEmpty(warehouseDevicesStr)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | warehouseDevices = new List<Dt_WarehouseDevice>(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Task Execute(IJobExecutionContext context) | 
|---|
|  |  |  | 
|---|
|  |  |  | if (flag && value != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OtherDevice device = (OtherDevice)value; | 
|---|
|  |  |  | Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == device.DeviceCode); | 
|---|
|  |  |  | if (warehouseDevice == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WriteError(device.DeviceName, $"请é
ç½®ä»åºè®¾å¤ä¿¡æ¯"); | 
|---|
|  |  |  | return Task.CompletedTask; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); | 
|---|
|  |  |  | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); | 
|---|
|  |  |  | foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | R_ConveyorLineInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineInfo>(deviceProRead.DeviceProAddress); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | W_ConveyorLineInfo conveyorLineInfoWrite = device.Communicator.ReadCustomer<W_ConveyorLineInfo>(deviceProWrite.DeviceProAddress); | 
|---|
|  |  |  | if (conveyorLineInfoRead == null || conveyorLineInfoWrite == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | R_ConveyorLineStatus conveyorLineStatus = conveyorLineInfoRead.Status.ByteToBoolObject<R_ConveyorLineStatus>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | W_ConveyorLineInfo conveyorLineInfoWrite = device.Communicator.ReadCustomer<W_ConveyorLineInfo>(deviceProWrite.DeviceProAddress); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ConveyorLineSignal conveyorLineSignalWrite = conveyorLineInfoWrite.Signal.ByteToBoolObject<ConveyorLineSignal>(); | 
|---|
|  |  |  | if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //å¹²èå
¥åºç«å°äº¤äº | 
|---|
|  |  |  | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode)) | 
|---|
|  |  |  | string boxcode = device.GetValue<R_ConveyorLineDB, string>(R_ConveyorLineDB.Boxcode, item.StationCode); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!string.IsNullOrEmpty(boxcode)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode); | 
|---|
|  |  |  | string sc = device.Communicator.Read<string>("DB900.478.0"); | 
|---|
|  |  |  | WriteError(device.DeviceName, $"读åå¼ï¼{boxcode},对æ¯{sc}"); | 
|---|
|  |  |  | string boxEndCode = ""; | 
|---|
|  |  |  | if (boxcode.LastIndexOf(",PO:") >=0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | boxEndCode = "M"+ boxcode.Substring(0,boxcode.LastIndexOf(",PO:")) + sc.Substring(sc.IndexOf(",PO:")).Replace("\0", ""); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //å
¥åºç³è¯·ä»»å¡ | 
|---|
|  |  |  | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode, boxEndCode); | 
|---|
|  |  |  | if (content.Status) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, true); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, false); | 
|---|
|  |  |  | string boxcode = device.GetValue<R_ConveyorLineDB, string>(R_ConveyorLineDB.Boxcode, item.StationCode); | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && boxcode.Contains(x.PalletCode) && x.TaskState == TaskStatusEnum.New.ObjToInt()); | 
|---|
|  |  |  | if (task != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: item.StackerCraneStationCode, deviceCode: task.Roadway, nextAddress: task.TargetAddress); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && !conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.WarehouseId== warehouseDevice.WarehouseId && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && !string.IsNullOrEmpty(x.NextAddress)); | 
|---|
|  |  |  | if (task != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StationCode, deviceCode: item.StackerCraneCode, targetAddress: item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)//å
¥åº | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.NextAddress == item.StackerCraneCode); | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.TaskNum && x.NextAddress == item.StationCode); | 
|---|
|  |  |  | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); | 
|---|
|  |  |  | if (stationManger == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WriteInfo(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | WriteError(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //å
¥åºç³è¯·åé
è´§ä½ | 
|---|
|  |  |  | string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode); | 
|---|
|  |  |  | if (string.IsNullOrEmpty(locationCode)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WriteInfo(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | WriteError(item.StationName, $"请æ±åé
è´§ä½è¿åä¿¡æ¯é误,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | string oldAddress = task.NextAddress; | 
|---|
|  |  |  | int oldStatus = task.TaskState; | 
|---|
|  |  |  | task.CurrentAddress = stationManger.StackerCraneStationCode; | 
|---|
|  |  |  | task.TargetAddress = locationCode; | 
|---|
|  |  |  | task.NextAddress = locationCode; | 
|---|
|  |  |  | task.DeviceCode = stationManger.StackerCraneCode; | 
|---|
|  |  |  | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); | 
|---|
|  |  |  | _taskRepository.UpdateData(task); | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, currentAddress: stationManger.StackerCraneStationCode, targetAddress: locationCode, nextAddress: locationCode, deviceCode: stationManger.StackerCraneCode); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt()); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, true); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, false); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //å¹²èåºåºç«å°äº¤äº | 
|---|
|  |  |  | if (!conveyorLineSignalWrite.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt()); | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt() && x.DeviceCode == item.StationDeviceCode); | 
|---|
|  |  |  | if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); | 
|---|
|  |  |  | if (stationManger == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WriteInfo(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | WriteError(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && (task.CurrentAddress == x.StartPosi)); | 
|---|
|  |  |  | if (router == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | WriteInfo(item.StationName, $"æªæ¾å°è·¯ç±é
置信æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | WriteError(item.StationName, $"æªæ¾å°è·¯ç±é
置信æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string oldAddress = task.NextAddress; | 
|---|
|  |  |  | int oldStatus = task.TaskState; | 
|---|
|  |  |  | task.NextAddress = router.NextPosi; | 
|---|
|  |  |  | task.TargetAddress = router.NextPosi; | 
|---|
|  |  |  | task.TaskState = TaskStatusEnum.Line_Executing.ObjToInt(); | 
|---|
|  |  |  | _taskRepository.UpdateData(task); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"ç³»ç»èªå¨æµç¨,ç®æ å°åç±{oldAddress}åæ´ä¸º{task.NextAddress},ä»»å¡ç¶æç±{oldStatus}åæ´ä¸º{task.TaskState}"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt()); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.STB, true); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.EndPos, router.NextPosi, item.StationCode); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, nextAddress: router.NextPosi, targetAddress: router.NextPosi); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Goods) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _taskService.TaskCompleted(conveyorLineInfoRead.TaskNum); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.STB, false); | 
|---|
|  |  |  | //宿干èåºåºä»»å¡ | 
|---|
|  |  |  | _taskService.TaskCompleted(conveyorLineInfoWrite.TaskNum); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK && !conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); | 
|---|
|  |  |  | if (task != null) | 
|---|
|  |  |  | Dt_Task outTask = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState != TaskStatusEnum.New.ObjToInt() && x.TaskState != TaskStatusEnum.SC_Execute.ObjToInt() && x.TargetAddress == item.StationCode); | 
|---|
|  |  |  | if (outTask == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //todo è¾éçº¿å·¥ä½æ¨¡å¼éè¦å¤æ | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt()); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.STB, true); | 
|---|
|  |  |  | Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType)); | 
|---|
|  |  |  | if (task != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //todo è¾éçº¿å·¥ä½æ¨¡å¼éè¦å¤æ | 
|---|
|  |  |  | _taskService.UpdateTask(task, TaskStatusEnum.Line_Execute); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.STB, true, item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && !conveyorLineStatus.Alarm) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.STB, false); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.STB, false, item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (!conveyorLineSignalRead.STB && conveyorLineSignalWrite.ACK && !conveyorLineStatus.Alarm) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, false); | 
|---|
|  |  |  | device.SetValue(W_ConveyorLineDB.ACK, false, item.StationCode); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|