| | |
| | | using LogLibrary.Log; |
| | | using Microsoft.Extensions.Configuration; |
| | | using Microsoft.Extensions.Hosting; |
| | | using Microsoft.Extensions.Logging; |
| | | using MimeKit; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using Org.BouncyCastle.Tls; |
| | | using System; |
| | | using System.Net; |
| | | using System.Net.Sockets; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Middlewares; |
| | | using WIDESEA_DTO.AGV; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_IStorageBasicRepository; |
| | | using WIDESEA_IStorageSocketServices; |
| | | using WIDESEA_IStorageTaskRepository; |
| | | using WIDESEA_IStorageTaskServices; |
| | | using WIDESEA_Model.Models.AGV; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | //using static MailKit.Telemetry; |
| | | using WIDESEAWCS_Model.Models; |
| | | using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using AutoMapper; |
| | | using Mapster; |
| | |
| | | { |
| | | //OK |
| | | case "0": |
| | | //UpdateTaskLocation(parseMessage); |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == parseMessage.body.ToLocation); |
| | | if (location == null) |
| | | { |
| | | return; |
| | | } |
| | | if (location.LocationStatus == (int)LocationEnum.Free) |
| | | { |
| | | InsertWMSTask(parseMessage); |
| | | Thread.Sleep(500); |
| | | //915 |
| | | JobReady("0"); |
| | | break; |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | //todoè´§ä½æè´§éå¤å
¥åº |
| | | return; |
| | | } |
| | | //NG |
| | | case "1": |
| | | break; |
| | |
| | | { |
| | | //OK |
| | | case "0": |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == parseMessage.body.ToLocation); |
| | | if (location == null) |
| | | { |
| | | return; |
| | | } |
| | | if (location.LocationStatus == (int)LocationEnum.InStock) |
| | | { |
| | | var task = InsertWMSTask(parseMessage); |
| | | BaseDal.AddData(task); |
| | | InsertAGVTask(task); |
| | |
| | | Thread.Sleep(500); |
| | | //104 |
| | | DeviceReceiveJobResponse("0"); |
| | | } |
| | | else |
| | | { |
| | | //todoè´§ä½æ 货空åºåº |
| | | return; |
| | | } |
| | | |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | var taskStation = BaseDal.QueryFirst(x => x.SourceAddress == item.stationName || x.TargetAddress == item.stationName); |
| | | outStationStatus.Add(new OutStationStatus() |
| | | { |
| | | StationName = item.stationName, |
| | | StationName = item.HostName, |
| | | StationEnable = station.StationEnable == "1" ? "0" : "1", |
| | | IsDistributionTask = taskStation == null ? "0" : "1", |
| | | Spare1 = "00" |
| | |
| | | /// </summary> |
| | | public void DeviceStatusReportRequest() |
| | | { |
| | | AGVStatusRespone status = GetAGVStatus(); |
| | | |
| | | HOSTAGVStatus AgvStatus = new HOSTAGVStatus() |
| | | { |
| | | RuntimeStatus = "R", |
| | | AutoStatus = "1", |
| | | Ready = "1" |
| | | RuntimeStatus = CapitalizeFirstLetter(status.RuntimeStatus), |
| | | AutoStatus = status.AutoStatus == "MaintenanceMode" ? "1" : "0", |
| | | Ready = status.AutoStatus == "MaintenanceMode" ? "0" : "1", |
| | | }; |
| | | string axis = "000000"; |
| | | DeviceStatusReportResponse(AgvStatus, axis, axis); |
| | |
| | | { |
| | | d_task_type = task.TaskType == (int)TaskTypeEnum.Inbound ? 1 : 2, |
| | | d_floor = 1, |
| | | d_involed1 = task.SourceAddress, |
| | | d_involed2 = task.TargetAddress, |
| | | d_involed1 = InsertHyphenEveryTwoChars(task.SourceAddress), |
| | | d_involed2 = InsertHyphenEveryTwoChars(task.TargetAddress), |
| | | d_involed5 = task.TaskNum, |
| | | }; |
| | | |
| | |
| | | |
| | | public StationStatus GetStationStatus(string stationName) |
| | | { |
| | | string urlnew = url + "/ilns/strl/getStat"; |
| | | string urlnew = url + "/ilns/strl/getState"; |
| | | var result = HttpsClient.PostAsync(urlnew, JsonConvert.DeserializeObject<Dictionary<string, object>>(new { strlName = stationName }.ToJson())).Result; |
| | | return JsonConvert.DeserializeObject<StationStatus>(result.ToString()); |
| | | } |
| | |
| | | char firstChar = s[0]; |
| | | return char.ToUpper(firstChar).ToString(); |
| | | } |
| | | public string InsertHyphenEveryTwoChars(string input) |
| | | { |
| | | if (string.IsNullOrEmpty(input)) |
| | | { |
| | | return input; |
| | | } |
| | | |
| | | StringBuilder result = new StringBuilder(); |
| | | |
| | | for (int i = 0; i < input.Length; i += 2) |
| | | { |
| | | // æ·»å 两个å符 |
| | | result.Append(input.Substring(i, 2)); |
| | | |
| | | // 妿䏿¯æå两个åç¬¦ï¼æ·»å ä¸ä¸ªè¿å符 |
| | | if (i + 2 < input.Length) |
| | | { |
| | | result.Append('-'); |
| | | } |
| | | } |
| | | |
| | | return result.ToString(); |
| | | } |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | | |
| | | public WebResponseContent CompleteInboundTask(Dt_Task task) |