| | |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | using System.Linq; |
| | | using System.Reflection.Metadata; |
| | | using System.Text; |
| | | using System.Text.Unicode; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.Helper; |
| | |
| | | _routerService = routerService; |
| | | _routerExtension = routerExtension; |
| | | } |
| | | |
| | | /* |
| | | 1å·ä½åºåºå£å
许æ¾ç®± 0 |
| | | 1å·ä½æ¾ç®±å®æä¿¡å· 21 |
| | | 6å·ä½æ£éä½æç®±å°è¾¾ 1 |
| | | 6å·ä½æ£éä½æç®±æ¡ç 2 |
| | | 6å·ä½æ£éä½æç®±æµå¨ 22 |
| | | 8å·ä½å
¥åºå£å
许åç®± 11 |
| | | 8å·ä½å
¥åºå£æç®±æ¡ç 12 |
| | | 8å·ä½æºå¨äººåç®±å®æ 23 |
| | | */ |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | |
| | | OtherDevice device = (OtherDevice)value; |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | |
| | | foreach (var item in stationMangers) |
| | | foreach (var station in stationMangers) |
| | | { |
| | | byte[] bytesPut = device.Communicator.Read("22", 1); |
| | | ; |
| | | device.Communicator.Write("22", new byte[] { 2, 0 }); |
| | | byte[] bytesPuted = device.Communicator.Read("22",1); |
| | | device.Communicator.Write("22", new byte[] { 0, 0 }); |
| | | if (station.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()) |
| | | { |
| | | |
| | | //æ£éç³è¯· |
| | | short pickArrived = device.Communicator.Read<short>("1"); |
| | | if (pickArrived == 256) |
| | | { |
| | | byte[] bytesPick = device.Communicator.Read("2", 5); |
| | | string pickBarCode = Encoding.UTF8.GetString(bytesPick).Replace("\0", "").Replace("\\0", ""); |
| | | //䏿¥WMSæç®±å°è¾¾ |
| | | if (pickBarCode.IsNotEmptyOrNull()) |
| | | { |
| | | WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, pickBarCode); |
| | | if (content.Status) |
| | | { |
| | | WriteInfo(device.DeviceCode, $"{station.PickStationCode}æ£éç³è¯·ä¸æ¥æå{pickBarCode}"); |
| | | } |
| | | else |
| | | { |
| | | WriteError(device.DeviceCode, $"{station.PickStationCode}æ£éç³è¯·ä¸æ¥WMSé误{pickBarCode}ï¼ä¿¡æ¯{content.Message}"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteError(device.DeviceCode, $"{station.PickStationCode}æ£éç³è¯·ä¸º{pickArrived}æ¡ç 为空å¼"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //å
¥åºç³è¯· |
| | | short InTake = device.Communicator.Read<short>("11"); |
| | | byte[] bytesIn = device.Communicator.Read("12", 5); |
| | | string InBarCode = Encoding.UTF8.GetString(bytesIn).Replace("\0", "").Replace("\\0", ""); |
| | | if (InTake==256 && InBarCode.IsNotEmptyOrNull()) |
| | | { |
| | | //ç³è¯·å
¥åºä»»å¡ |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == InBarCode && x.TaskType == TaskTypeEnum.Inbound.ObjToInt() && x.TaskState != TaskStatusEnum.CL_Executing.ObjToInt()); |
| | | if (task != null) continue; |
| | | |
| | | WebResponseContent content = _taskService.RequestInTask(station.StationCode, InBarCode); |
| | | if (content.Status) |
| | | { |
| | | WriteInfo(device.DeviceCode, $"ç«å°{station.StationCode}æç®±{InBarCode}ç³è¯·å
¥åºæå"); |
| | | } |
| | | else |
| | | { |
| | | WriteError(device.DeviceCode, $"ç«å°{station.StationCode}æç®±{InBarCode}ç³è¯·å
¥åºä»»å¡é误ï¼ä¿¡æ¯{content.Message}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |