| | |
| | | task.Creater = "WMS"; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | if (task.TargetAddress == "002-021-001") |
| | | if (task.TargetAddress == "002-021-001" && task.Roadway.Contains("JZ") && task.TaskType == (int)TaskOutboundTypeEnum.OutTray) |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | task.CurrentAddress = item.SourceAddress; |
| | | task.NextAddress = item.TargetAddress; |
| | | } |
| | | else |
| | | { |
| | |
| | | task.NextAddress = routers.FirstOrDefault().ChildPosi; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task.CurrentAddress = "002-021-001"; |
| | | task.NextAddress = item.TargetAddress; |
| | | } |
| | | } |
| | | tasks.Add(task); |
| | | } |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | var hasTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode); |
| | | if (hasTask != null) |
| | | { |
| | | return content.OK("当前托盘存在任务"); |
| | | } |
| | | |
| | | 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.RequestTask)?.ConfigValue; |
| | | if (wmsBase == null || requestTask == null) |
| | | var wmsIpAddrss = string.Empty; |
| | | var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == sourceAddress); |
| | | if (stationManager.stationType == 5) |
| | | { |
| | | throw new InvalidOperationException("WMS IP 未配置"); |
| | | wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestInBoundTaskNG); |
| | | } |
| | | var wmsIpAddrss = wmsBase + requestTask; |
| | | else |
| | | { |
| | | wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestTask); |
| | | } |
| | | //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.RequestTask)?.ConfigValue; |
| | | //if (wmsBase == null || requestTask == null) |
| | | //{ |
| | | // throw new InvalidOperationException("WMS IP 未配置"); |
| | | //} |
| | | //var wmsIpAddrss = wmsBase + requestTask; |
| | | |
| | | var result = await HttpHelper.PostAsync(wmsIpAddrss, new { Position = sourceAddress, PalletCode = palletCode }.ToJsonString()); |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | |
| | | { |
| | | return BaseDal.QueryFirst(x => x.PalletCode == barcode && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy); |
| | | } |
| | | |
| | | |
| | | private string GetIpAddress(string baseIp,string name) |
| | | { |
| | | var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wcsBasez = configz.Where(x => x.ConfigKey == baseIp).FirstOrDefault()?.ConfigValue; |
| | | var address = configz.Where(x => x.ConfigKey == name).FirstOrDefault()?.ConfigValue; |
| | | if (wcsBasez == null || address == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP 未配置"); |
| | | } |
| | | return wcsBasez + address; |
| | | } |
| | | } |
| | | } |