| | |
| | | using WIDESEAWCS_Common.StationEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.PDA; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | |
| | | //string Region = "ååºæ¿1"; |
| | | //ModbusTcp modbusTcp = new ModbusTcp(ip, port, Region); |
| | | //modbusTcp.Connect(); |
| | | Baseconversion baseconversion = new Baseconversion(); |
| | | Dictionary<int, int> Signal = new Dictionary<int, int>() { [10] = 2, [30] = 3, [50] = 4, [70] = 5 }; |
| | | Dictionary<int, int> FeedingPoint = new Dictionary<int, int>() { [10] = 2001, [30] = 2002, [50] = 2003, [70] = 2004 }; // 嫿çç¹ä½ ç»ç¹ä½ç½® |
| | | // Dictionary<int, int> Signal = new Dictionary<int, int>() { [10] = 2, [30] = 3, [50] = 4, [70] = 5 }; |
| | | // Dictionary<int, int> FeedingPoint = new Dictionary<int, int>() { [10] = 2001, [30] = 2002, [50] = 2003, [70] = 2004 }; // 嫿çç¹ä½ ç»ç¹ä½ç½® |
| | | |
| | | Baseconversion baseconversion = new Baseconversion(); |
| | | try |
| | | { |
| | | for (int i = 10; i < 90; i += 20) |
| | | { |
| | | byte[] SignalNumber = device.Communicator.Read(Signal[i].ToString(), 1); // ä¿¡å· 1ï¼å«æ 2ï¼æåºç©ºæ¡ |
| | | List<Dt_StationManager> dt_StationManagers = _stationManagerRepository.QueryData(x => |
| | | x.StationStatus == ((int)StationEnum.Enable).ToString() |
| | | && x.StationArea == ((int)StationEnum.Rearbaseplate1).ToString() |
| | | && x.Remark == "ä¸çº¿ç¹").ToList(); |
| | | |
| | | Dt_StationManager dt_StationManager = _stationManagerRepository.QueryFirst( |
| | | x => x.StationLocation == FeedingPoint[i].ToString() |
| | | && x.StationStatus != ((int)StationEnum.Disable).ToString()); |
| | | if (dt_StationManager == null) |
| | | { |
| | | // è¿éåºè¯¥è¦å æ¥å¿ è®°å½æ¾ä¸å°ç«å°çä¿¡æ¯ |
| | | Console.WriteLine($"{DateTime.Now} å½åç«å°ã{FeedingPoint[i].ToString()} æªé
ç½®æå·²ç¦ç¨ã"); |
| | | continue; |
| | | } |
| | | foreach (var item in dt_StationManagers) |
| | | { |
| | | byte[] SignalNumber = device.Communicator.Read(item.StationChildCode, 1); // ä¿¡å· 1ï¼å«æ 2ï¼æåºç©ºæ¡ |
| | | |
| | | if (SignalNumber[1] == 1) |
| | | { |
| | | byte[] PartNumber = device.Communicator.Read(i.ToString(), 20); // 读åé¶ä»¶å· |
| | | byte[] PartNumber = device.Communicator.Read(item.StationDeviceCode, 20); // 读åé¶ä»¶å· |
| | | |
| | | string Ku1_Value = baseconversion.TenthTurn16(PartNumber); |
| | | if (Ku1_Value != "" && Ku1_Value != null) |
| | | if (Ku1_Value.IsNotEmptyOrNull()) |
| | | { |
| | | // çåè½æµè¯å®ï¼è¿éè¦åæ¥å¿è®°å½ |
| | | |
| | |
| | | // æ¾å¯¹åºçé¶ä»¶å·æ¯å¦å·²ç»ç»å®(ç»ç) // è¿éè¦æ¹è¦å åºå å æ¯å¦å·²çæä»»å¡ è¿è¦æ ¹æ®æ¶é´æåº å
ç»å®çå
åè¿å» |
| | | Dt_MaterialInfo? dt_MaterialInfo = _IDt_MaterialInfoRepository.QueryData(x => x.MaterialName == Ku1_Value |
| | | && x.Region == ((int)StationEnum.Rearbaseplate1).ToString() |
| | | && (x.EndPosition == null || x.EndPosition == "")).OrderBy(x => x.CreateDate).FirstOrDefault(); |
| | | && (x.IsNotEmptyOrNull())).OrderBy(x => x.CreateDate).FirstOrDefault(); |
| | | |
| | | if (dt_MaterialInfo != null) |
| | | { |
| | |
| | | dt_Task = new Dt_Task(); |
| | | dt_Task.PalletCode = dt_MaterialInfo.ContainerCode; |
| | | dt_Task.SourceAddress = dt_MaterialInfo.Position; // å½åä½ç½® |
| | | dt_Task.TargetAddress = FeedingPoint[i].ToString(); // ç»ç¹ä½ç½® |
| | | dt_Task.TargetAddress = item.StationLocation; // ç»ç¹ä½ç½® |
| | | dt_Task.Grade = 2; |
| | | dt_Task.TaskState = TaskAGVCarryStatusEnum.AGV_CarryNew.ObjToInt(); |
| | | dt_Task.TaskType = TaskAGVCarryTypeEnum.Carry.ObjToInt(); |
| | | dt_Task.Roadway = (Signal[i] - 1).ToString(); // åº1 嫿é£å°±æ¯1å··é |
| | | dt_Task.TaskState = (int)TaskAGVCarryStatusEnum.AGV_CarryNew; |
| | | dt_Task.TaskType = (int)TaskAGVCarryTypeEnum.Carry; |
| | | dt_Task.Roadway = (int.Parse(item.StationChildCode) - 1).ToString(); // åº1 嫿é£å°±æ¯1å··é |
| | | dt_Task.CurrentAddress = dt_MaterialInfo.Position; // å½åä½ç½® |
| | | dt_Task.NextAddress = FeedingPoint[i].ToString(); // ç»ç¹ä½ç½® |
| | | dt_Task.NextAddress = item.StationLocation; // ç»ç¹ä½ç½® |
| | | |
| | | dt_MaterialInfo.EndPosition = FeedingPoint[i].ToString(); // ç»ç¹ä½ç½® |
| | | dt_MaterialInfo.EndPosition = item.StationLocation; // ç»ç¹ä½ç½® |
| | | |
| | | dt_StationManager.StationStatus = ((int)StationEnum.Thereisatask).ToString(); |
| | | dt_StationManager.StationRemark = dt_MaterialInfo.ContainerCode; |
| | | _stationManagerRepository.UpdateData(dt_StationManager); |
| | | |
| | | item.StationStatus = ((int)StationEnum.Thereisatask).ToString(); |
| | | item.StationRemark = dt_MaterialInfo.ContainerCode; |
| | | _stationManagerRepository.UpdateData(item); |
| | | |
| | | _taskRepository.AddData(dt_Task); |
| | | _IDt_MaterialInfoRepository.UpdateData(dt_MaterialInfo); |
| | |
| | | |
| | | if (SignalNumber[1] == 2) // 表示æåºç©ºæ¡ |
| | | { |
| | | Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.SourceAddress == FeedingPoint[i].ToString() && x.TaskType == (int)TaskAGVCarryTypeEnum.CarryEmpty); |
| | | Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationLocation && x.TaskType == (int)TaskAGVCarryTypeEnum.CarryEmpty); |
| | | if (dt_Task != null) continue; |
| | | |
| | | Dt_StationManager RecyclingpointStation = _stationManagerRepository.QueryFirst(x => |
| | |
| | | continue; |
| | | } |
| | | dt_Task = new Dt_Task(); |
| | | dt_Task.PalletCode = dt_StationManager.StationRemark; |
| | | dt_Task.SourceAddress = FeedingPoint[i].ToString(); |
| | | dt_Task.PalletCode = item.StationRemark; |
| | | dt_Task.SourceAddress = item.StationLocation; |
| | | dt_Task.TargetAddress = RecyclingpointStation.StationLocation; |
| | | dt_Task.Grade = 2; |
| | | dt_Task.TaskState = TaskAGVCarryStatusEnum.AGV_CarryNew.ObjToInt(); |
| | | dt_Task.TaskType = TaskAGVCarryTypeEnum.CarryEmpty.ObjToInt(); |
| | | dt_Task.Roadway = (Signal[i] - 1).ToString(); // åº1 嫿é£å°±æ¯1å··é |
| | | dt_Task.CurrentAddress = FeedingPoint[i].ToString(); // å½åä½ç½® |
| | | dt_Task.TaskState = (int)TaskAGVCarryStatusEnum.AGV_CarryNew; |
| | | dt_Task.TaskType = (int)TaskAGVCarryTypeEnum.CarryEmpty; |
| | | dt_Task.Roadway = (int.Parse(item.StationChildCode) - 1).ToString(); // åº1 嫿é£å°±æ¯1å··é |
| | | dt_Task.CurrentAddress = item.StationLocation; // å½åä½ç½® |
| | | dt_Task.NextAddress = RecyclingpointStation.StationLocation;// ç»ç¹ä½ç½® |
| | | |
| | | RecyclingpointStation.StationStatus = ((int)StationEnum.Thereisatask).ToString(); |
| | |
| | | _stationManagerRepository.UpdateData(RecyclingpointStation); |
| | | _taskRepository.AddData(dt_Task); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception) |