| | |
| | | using MoYu.Localization; |
| | | using Newtonsoft.Json; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | |
| | | var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; |
| | | var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.TransferCheck)?.ConfigValue; |
| | | if (wmsBase == null || requestTask == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | | } |
| | | var wmsIpAddrss = wmsBase + requestTask; |
| | | |
| | | var result = HttpHelper.Post(wmsIpAddrss, new { taskNum = taskNum }.ToJsonString()); |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | |
| | | if (!content.Status) |
| | | { |
| | | // wms失败 |
| | | throw new Exception(); |
| | | } |
| | | |
| | | |
| | | //todo ä¼å 妿ªæ¥è¯¢å°ä»»å¡åå¤ç |
| | | //if (content.Data != null) |
| | | //{ |
| | | var task = JsonConvert.DeserializeObject<Dt_Task>(content.Data.ToString()); |
| | | |
| | | Dt_Task? Relocationtask = null; |
| | | |
| | | //妿¥è¯¢ç§»åºä»»å¡æ¶åå¨å
ä¾§åºåºä»»å¡åç´æ¥æ§è¡å
ä¾§åºåºä»»å¡ |
| | | var currentExistOutTask = BaseDal.QueryFirst(x => x.TaskNum == task.TaskNum && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup); |
| | | if (currentExistOutTask != null ) |
| | | { |
| | | return currentExistOutTask; |
| | | } |
| | | |
| | | if (task.TaskNum != taskNum) |
| | | { |
| | | |
| | | BaseDal.AddData(task); |
| | | Relocationtask = BaseDal.QueryFirst(x => x.TaskNum == task.TaskNum); |
| | | } |
| | | //} |
| | | |
| | | if (Relocationtask != null) |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception($"请æ±å¼å¸¸ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®æçå·ãèµ·å§å°ååWMS请æ±ä»»å¡ï¼å
¥åºçæ¬) |
| | | /// </summary> |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <param name="sourceAddress">èµ·å§å°å</param> |
| | | /// <returns></returns> |
| | | public Dt_Task? InBeforeCheck(int taskNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; |
| | | var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.InTransferCheck)?.ConfigValue; |
| | | if (wmsBase == null || requestTask == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 车轮æµååé
æ¥è¯¢åå²è¯·æ± |
| | | /// </summary> |
| | | /// <param name="czCode"></param> |
| | | /// <param name="stationManager"></param> |
| | | /// <returns></returns> |
| | | public string RequestWheletHty(string czCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | Dt_Task_Hty dt_Task_Hty = _taskHtyRepository.QueryFirst(x => x.task_CZInfo == czCode && x.CreateDate >= DateTime.Now.AddMinutes(-30)); |
| | | if (dt_Task_Hty == null) return null; |
| | | |
| | | if (dt_Task_Hty.Towhereabouts == "2032" || dt_Task_Hty.Towhereabouts == "2042") |
| | | { |
| | | return dt_Task_Hty.Towhereabouts; |
| | | |
| | | }else if(dt_Task_Hty.TargetAddress == "2032" || dt_Task_Hty.TargetAddress == "2042") |
| | | { |
| | | return dt_Task_Hty.TargetAddress; |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | // æ£æ¥å½åæçæ¯å¦åå¨ä»»å¡ |
| | | private async Task<bool> HasTask(string palletCode) |
| | | { |
| | |
| | | task.wheels_mttype = taskDTO.wheels_mttype; |
| | | task.WheelsNewOrOld = taskDTO.WheelsNewOrOld; |
| | | task.WheelsLX = taskDTO.WheelsLX; |
| | | if(taskDTO.axle_czh !=null && taskDTO.axle_czh != "") |
| | | { |
| | | task.axle_czh = taskDTO.axle_czh; |
| | | } |
| | | |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationLocation == taskDTO.TargetAddress && x.Roadway == taskDTO.RoadWay); |
| | | |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | if (task.SourceAddress == "2009") |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish; |
| | | } |
| | | |
| | | task.CurrentAddress = taskDTO.RoadWay; |
| | | task.NextAddress = stationinfo.stationChildCode; |
| | | task.SourceAddress = taskDTO.SourceAddress; |