| | |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using WIDESEA_DTO.Agv; |
| | | using WIDESEA_External.Model; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.LogHelper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_DTO.Agv; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | |
| | | } |
| | | else//åºåºæ¾è´§è¯·æ± |
| | | { |
| | | var content = PutRequest(task.NextAddress, task.PalletType); |
| | | var content = PutRequest(task.NextAddress, task); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | |
| | | } |
| | | else//å
¥åºæ¾è´§è¯·æ± |
| | | { |
| | | var content = PutRequest(task.NextAddress, task.TaskNum); |
| | | var content = PutRequest(task.NextAddress, task); |
| | | if (!content.Status) |
| | | { |
| | | throw new Exception(content.Message); |
| | |
| | | /// <param name="palletType"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PutRequest"), AllowAnonymous] |
| | | public WebResponseContent PutRequest(string code, int taskNum) |
| | | public WebResponseContent PutRequest(string code, Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | { |
| | | return content.Error($"æªæ¾å°ç«å°é
ç½®"); |
| | | } |
| | | #region todo:临æ¶é»è¾ |
| | | if (stationManger.StationDeviceCode=="MES") |
| | | { |
| | | |
| | | RequestAGVArriveDTO requestAGVArriveDTO =new RequestAGVArriveDTO() |
| | | { |
| | | SD_WorkCentreAgvArriveNoticeInfo=new List<AgvArriveNotice> { new AgvArriveNotice() |
| | | { |
| | | DispatchPlanMaterialId=task.DispatchPlanId, |
| | | WorkCentreCode=task.WorkCentreCode, |
| | | LocationCode=code, |
| | | CallId=Guid.NewGuid().ToString().Replace("-","") |
| | | } } |
| | | }; |
| | | MESResponse response = _taskService.MESAvgArriveNotice(requestAGVArriveDTO).DeserializeObject<MESResponse>() ?? throw new Exception("æªè·åå°è¿åä¿¡æ¯"); |
| | | if (!response.Result) |
| | | { |
| | | throw new Exception($"è°ç¨MESå°è½¦å
许æ¾è´§æ¥é,MESè¿åä¿¡æ¯"+ Regex.Replace(response.Msg, @"\\u([0-9a-fA-F]{4})", match => { |
| | | return ((char)Convert.ToInt32(match.Groups[1].Value, 16)).ToString(); |
| | | })); |
| | | } |
| | | if (response.Obj) |
| | | { |
| | | return content.Error($"å
许åæ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error($"ç¦æ¢æ¾æ"); |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | |
| | | bool RequestPut = otherDevice.GetValue<CoveryorDB, bool>(CoveryorDB.C_RequestPut, stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(CoveryorDB.C_InTaskNum, taskNum, stationManger.StationDeviceCode); |
| | | otherDevice.SetValue(CoveryorDB.C_InTaskNum, task.TaskNum, stationManger.StationDeviceCode); |
| | | otherDevice.SetValue(CoveryorDB.C_RequestPut, true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | |
| | | } |
| | | else if (device.DeviceCode.Contains("TrussCarton"))//æ¡æ¶ |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | bool RequestPut = otherDevice.GetValue<W_TrussCartonDB, bool>(GetCartonRequest(stationManger.StackerCraneStationCode), stationManger.StationDeviceCode); |
| | | if (!RequestPut) |
| | | { |
| | | otherDevice.SetValue(GetCartonRequest(stationManger.StackerCraneStationCode), true, stationManger.StationDeviceCode); |
| | | Thread.Sleep(1000); |
| | | } |
| | | bool AllowFinish = otherDevice.GetValue<R_TrussCartonDB, bool>(GetCarton(stationManger.StackerCraneStationCode), stationManger.StationDeviceCode); |
| | | if (AllowFinish) |
| | | { |
| | | content.OK("å
è®¸æ¾æ"); |
| | | } |
| | | else |
| | | { |
| | | return content.Error("ç¦æ¢æ¾æ"); |
| | | } |
| | | } |
| | | } |
| | | return content; |
| | |
| | | return W_TrussCartonDB.W_CartonPut5; |
| | | case "6": |
| | | return W_TrussCartonDB.W_CartonPut6; |
| | | default: |
| | | throw new Exception("æªå®ä¹å·¥ä½"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// è·åæ¡æ¶è¯·æ±ä¿¡å· |
| | | /// </summary> |
| | | public W_TrussCartonDB GetCartonRequest(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | | { |
| | | case "1": |
| | | return W_TrussCartonDB.W_CartonRequest1; |
| | | case "2": |
| | | return W_TrussCartonDB.W_CartonRequest2; |
| | | case "3": |
| | | return W_TrussCartonDB.W_CartonRequest3; |
| | | case "4": |
| | | return W_TrussCartonDB.W_CartonRequest4; |
| | | case "5": |
| | | return W_TrussCartonDB.W_CartonRequest5; |
| | | case "6": |
| | | return W_TrussCartonDB.W_CartonRequest6; |
| | | default: |
| | | throw new Exception("æªå®ä¹å·¥ä½"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// è·åæ¡æ¶è¿å
¥ä¿¡å· |
| | | /// </summary> |
| | | public R_TrussCartonDB GetCarton(string StationCode) |
| | | { |
| | | switch (StationCode) |
| | | { |
| | | case "1": |
| | | return R_TrussCartonDB.R_CartonAllow1; |
| | | case "2": |
| | | return R_TrussCartonDB.R_CartonAllow2; |
| | | case "3": |
| | | return R_TrussCartonDB.R_CartonAllow3; |
| | | case "4": |
| | | return R_TrussCartonDB.R_CartonAllow4; |
| | | case "5": |
| | | return R_TrussCartonDB.R_CartonAllow5; |
| | | case "6": |
| | | return R_TrussCartonDB.R_CartonAllow6; |
| | | default: |
| | | throw new Exception("æªå®ä¹å·¥ä½"); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | //[HttpPost, HttpGet, Route("TakeFinish"), AllowAnonymous] |
| | | /// <summary> |
| | | /// åè´§å®æ |
| | | /// </summary> |