| | |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡éæ°ä¸å |
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ResendTask(int taskNum) |
| | | { |
| | | try |
| | | { |
| | | Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (task != null) |
| | | { |
| | | if (task.TaskState == (int)TaskStatusEnum.SC_Executing) |
| | | { |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | } |
| | | else if(task.TaskState == (int)TaskStatusEnum.AGV_Executing) |
| | | { |
| | | task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error($"æ¤ä»»å¡ { taskNum } ææ¶ä¸è½éæ°ä¸åä»»å¡"); |
| | | } |
| | | BaseDal.UpdateData(task); |
| | | } |
| | | else |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ä»»å¡æ¶æ¯"); |
| | | } |
| | | return WebResponseContent.Instance.OK("ä»»å¡éæ°ä¸åæå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥æ¶WMSä»»å¡ä¿¡æ¯ |
| | | /// </summary> |
| | |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
置信æ¯"); |
| | | } |
| | | //è·åè·¯ç±ä¿¡æ¯ |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi)); |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi) && x.Depth==1); |
| | | router = routers.FirstOrDefault(); |
| | | if (router == null) |
| | | { |
| | |
| | | } |
| | | return content; |
| | | } |
| | | public WebResponseContent MESAvgArriveNotice(RequestAGVArriveDTO requestAGVArriveDTO) |
| | | /// <summary> |
| | | /// 夿å
许æ¾è´§ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string MESAvgArriveNotice(RequestAGVArriveDTO requestAGVArriveDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.MESAvgArriveNotice.ToString()); |
| | | |
| | | string response = Post(apiInfo.ApiAddress, JsonConvert.SerializeObject(requestAGVArriveDTO)); |
| | | |
| | | return response; |
| | | } |
| | | public static string Post(string serviceAddress, string requestJson = "", string contentType = "application/json", Dictionary<string, string>? headers = null) |
| | | { |
| | | string result = string.Empty; |
| | | DateTime beginDate = DateTime.Now; |
| | | try |
| | | { |
| | | string address = AppSettings.Get("WMSApiAddress"); |
| | | if (string.IsNullOrEmpty(address)) |
| | | using (HttpContent httpContent = new StringContent(requestJson)) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°WMSApiå°å"); |
| | | httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); |
| | | |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 30); |
| | | string LoginToken = AppSettings.Get("MESLoginToken"); |
| | | headers = new Dictionary<string, string> |
| | | { |
| | | //æ£å¼ |
| | | { "LoginToken", LoginToken } |
| | | }; |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | HttpResponseMessage responseMessage = httpClient.PostAsync(serviceAddress, httpContent).Result; |
| | | result = responseMessage.Content.ReadAsStringAsync().Result; |
| | | } |
| | | string responseStr = HttpHelper.Post($"{address}/api/Mes/MESAvgArriveNotice", requestAGVArriveDTO.Serialize()); |
| | | return content.OK(responseStr); |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | catch (Exception e) |
| | | { |
| | | content = WebResponseContent.Instance.Error(ex.Message); |
| | | throw new Exception(e.Message); |
| | | } |
| | | return content; |
| | | finally |
| | | { |
| | | Logger.Add(serviceAddress, requestJson == null ? "" : requestJson, result, beginDate); |
| | | } |
| | | } |
| | | public WebResponseContent CPEmptyInbound(string palletCode,string SourceAddress) |
| | | { |