添加静置NG入库功能,更新相关接口和配置,优化代码结构
| | |
| | | /// </summary> |
| | | public const string RequestOutTaskToBZ = "RequestOutTaskToBZ"; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 静置NG入库 |
| | | /// </summary> |
| | | public const string RequestInBoundTaskNG = "RequestInBoundTaskNG"; |
| | | } |
| | | } |
| | |
| | | //连接字符串 |
| | | //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=", |
| | | //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=True;ApplicationIntent=ReadWrite;MultiSubnetFailover=True", |
| | | "ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //跨域 |
| | | "Cors": { |
| | | "PolicyName": "CorsIpAccess", //策略名称 |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_SignalR; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | |
| | | public async Task Execute(IJobExecutionContext context) |
| | | { |
| | | string jobName = context.JobDetail.Key.Name; |
| | | if (MemoryLockManager.TryAcquireLock(jobName)) |
| | | //if (MemoryLockManager.TryAcquireLock(jobName)) |
| | | //{ |
| | | try |
| | | { |
| | | try |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (conveyorLine != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (conveyorLine != null) |
| | | { |
| | | List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); |
| | | var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList(); |
| | | await Task.WhenAll(tasks); |
| | | List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); |
| | | var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList(); |
| | | await Task.WhenAll(tasks); |
| | | |
| | | List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode); |
| | | foreach (var station in stationManagers) |
| | | List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode); |
| | | foreach (var station in stationManagers) |
| | | { |
| | | if (station.stationType == 11) |
| | | { |
| | | if (station.stationType == 11) |
| | | ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode); |
| | | ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand"); |
| | | if (command != null && commandWrite != null) |
| | | { |
| | | ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode); |
| | | ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand"); |
| | | if (command != null && commandWrite != null) |
| | | var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | if (structs[0] == true) |
| | | { |
| | | var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | if (structs[0] == true) |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】空托盘请求扫码入库"); |
| | | NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation); |
| | | } |
| | | else |
| | | { |
| | | ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false); |
| | | } |
| | | } |
| | | } |
| | | else if (station.stationType == 5) |
| | | { |
| | | ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode); |
| | | ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand"); |
| | | if (command != null && commandWrite != null) |
| | | { |
| | | var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | if (structs[0] == true) |
| | | { |
| | | if (_taskRepository.QueryData(x => x.SourceAddress == station.stationChildCode).Count() > 0) |
| | | { |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】空托盘请求扫码入库"); |
| | | NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation); |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false); |
| | | } |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】异常口请求扫码入库"); |
| | | HandleNewTask(conveyorLine, command, station.stationChildCode, 0); |
| | | } |
| | | else |
| | | { |
| | | ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString()); |
| | | } |
| | | finally |
| | | { |
| | | MemoryLockManager.ReleaseLock(jobName); |
| | | } |
| | | } |
| | | else |
| | | catch (Exception ex) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]【{jobName}】任务已被锁定,无法处理"); |
| | | Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString()); |
| | | } |
| | | // finally |
| | | // { |
| | | // MemoryLockManager.ReleaseLock(jobName); |
| | | // } |
| | | //} |
| | | //else |
| | | //{ |
| | | // ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]【{jobName}】任务已被锁定,无法处理"); |
| | | //} |
| | | return; |
| | | } |
| | | |
| | |
| | | { |
| | | if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线入库完成,下一目标地址【等待分配货位,并写入1000】"); |
| | | |
| | |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | //if ((conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") || (conveyorLine.DeviceCode == "1005" && childDeviceCode == "1048")) |
| | | //{ |
| | | // await CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue); |
| | | //} |
| | | //else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088") || (conveyorLine.DeviceCode == "1004" && childDeviceCode == "1339")) |
| | | //{ |
| | | // await RequestWmsTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue); |
| | | //} |
| | | //else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1068")) |
| | | //{ |
| | | // ConveyorLineOutFinish(conveyorLine, command, childDeviceCode, ProtocalDetailValue); |
| | | //} |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private async Task RequestWmsTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue) |
| | | { |
| | | |
| | | var content = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode); |
| | | if (content.Status) |
| | | { |
| | | var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | if (task.TargetAddress == childDeviceCode) |
| | | if (task.SourceAddress == "1059-4") |
| | | { |
| | | |
| | | conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); |
| | | |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{task.TaskNum}】,托盘条码:【{task.PalletCode}】已到达【{childDeviceCode}】请求扫码入库(实盘),下一目标地址【{1000}】"); |
| | | ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | |
| | | stackerCraneTaskCommand.StartCommand = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//判断是否是入库任务 |
| | | { |
| | | if (task.Roadway.Contains("JZ")) |
| | | if (task.SourceAddress == "1359-4" && task.Roadway.Contains("JZ")) |
| | | { |
| | | string[] souredCodes = task.CurrentAddress.Split("-"); |
| | | if (souredCodes.Length == 3) |
| | |
| | | } |
| | | else |
| | | { |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | if (routers.Count > 0) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(routers.FirstOrDefault().SrmRow); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(routers.FirstOrDefault().SrmColumn); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(routers.FirstOrDefault().SrmLayer); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //数据配置错误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】"); |
| | | return null; |
| | | } |
| | | if (task.TargetAddress == "002-021-001" && task.Roadway.Contains("JZ") && task.TaskType == (int)TaskOutboundTypeEnum.OutTray) |
| | | { |
| | | string[] endCodes = task.NextAddress.Split("-"); |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(endCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(endCodes[2]); |
| | | string[] sourceCodes = task.SourceAddress.Split("-"); |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法获取对应的堆垛机放货站台信息"); |
| | | return null; |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | if (routers.Count > 0) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(routers.FirstOrDefault().SrmRow); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(routers.FirstOrDefault().SrmColumn); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(routers.FirstOrDefault().SrmLayer); |
| | | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //数据配置错误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】"); |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法获取对应的堆垛机放货站台信息"); |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | Task<WebResponseContent> CreateAndSendOutboundTask(string locationCode, string palletCode); |
| | | |
| | | /// <summary> |
| | | /// 指定任务出库 |
| | | /// </summary> |
| | | /// <param name="palletCode">托盘号</param> |
| | | /// <param name="position">位置</param> |
| | | /// <returns></returns> |
| | | Task<WebResponseContent> CreateAndSendInboundTask(string palletCode, string position); |
| | | |
| | | /// <summary> |
| | | /// 常温补空托盘至分容 |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_DTO.WMS; |
| | |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (task.TaskType == (int)TaskInboundTypeEnum.InNG) |
| | | if (task.TaskType == (int)TaskInboundTypeEnum.InNG || task.TaskType == (int)TaskInboundTypeEnum.InQuality) |
| | | { |
| | | task.TaskState = (int)TaskInStatusEnum.SC_InFinish; |
| | | // 创建历史任务实例模型 |
| | |
| | | area = _areaInfoRepository.QueryFirst(x => x.AreaID == 6); |
| | | else if (boxing.ProcessCode == "OCVB") |
| | | area = _areaInfoRepository.QueryFirst(x => x.AreaID == 7); |
| | | else |
| | | area = _areaInfoRepository.QueryFirst(x => x.AreaID == loation.AreaId); |
| | | |
| | | if (area == null) |
| | | throw new Exception("未找到对应区域信息"); |
| | |
| | | case (int)TaskInboundTypeEnum.Inbound: |
| | | case (int)TaskInboundTypeEnum.InTray: |
| | | case (int)TaskInboundTypeEnum.InNG: |
| | | case (int)TaskInboundTypeEnum.InQuality: |
| | | LogFactory.GetLog("任务完成").InfoFormat(true, "入库任务", ""); |
| | | return await CompleteInboundTaskAsync(task); |
| | | |
| | |
| | | var stockInfo = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode); |
| | | if (stockInfo == null) |
| | | { |
| | | var taskOld = BaseDal.QueryFirst(x => x.PalletCode == palletCode); |
| | | if (!taskOld.IsNullOrEmpty()) |
| | | {// 创建WMS任务 |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | { |
| | | TaskNum = taskOld.TaskNum.Value, |
| | | Grade = 1, |
| | | PalletCode = taskOld.PalletCode, |
| | | RoadWay = taskOld.Roadway, |
| | | SourceAddress = taskOld.CurrentAddress, |
| | | TargetAddress = taskOld.TargetAddress, |
| | | TaskState = taskOld.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = taskOld.TaskType, |
| | | }; |
| | | return content.OK(data: taskDTO); |
| | | } |
| | | var area = _areaInfoRepository.QueryFirst(x => x.AreaID == 2); |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == position); |
| | | TrayCellsStatusDto trayCells = CreateTrayCellsStatusDto(area, palletCode); |
| | | content = await GetTrayCellStatusAsync(trayCells); |
| | | if (!content.Status) return content; |
| | | |
| | | ConsoleHelper.WriteErrorLine(content.ToJsonString()); |
| | | var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString()); |
| | | if (!result.Success) |
| | | if (result.SerialNos.Count > 0) |
| | | { |
| | | if (result.SerialNos.Count <= 0) |
| | | var location = await GetLocationDistributeAsync(station.Roadway); |
| | | |
| | | ConsoleHelper.WriteErrorLine(location.ToJsonString()); |
| | | // 创建新任务实例 |
| | | var task = new Dt_Task |
| | | { |
| | | var location = await GetLocationDistributeAsync(station.Roadway); |
| | | // 创建新任务实例 |
| | | var task = new Dt_Task |
| | | { |
| | | CurrentAddress = station.stationLocation, |
| | | Grade = 1, |
| | | Roadway = station.Roadway, |
| | | TargetAddress = location.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = location.LocationCode, |
| | | OrderNo = null, |
| | | PalletCode = palletCode, |
| | | SourceAddress = position, |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | CurrentAddress = station.stationLocation, |
| | | Grade = 1, |
| | | Roadway = station.Roadway, |
| | | TargetAddress = location.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = location.LocationCode, |
| | | OrderNo = null, |
| | | PalletCode = palletCode, |
| | | SourceAddress = position, |
| | | TaskState = (int)TaskInStatusEnum.Line_InFinish, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskNum = await BaseDal.GetTaskNo(), |
| | | Creater = "Systeam" |
| | | }; |
| | | |
| | | // 创建WMS任务 |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = 1, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.Roadway, |
| | | TaskState = task.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = task.TaskType, |
| | | }; |
| | | // 创建WMS任务 |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO() |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = 1, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.TargetAddress, |
| | | TaskState = task.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = task.TaskType, |
| | | }; |
| | | |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | // 添加任务到数据库 |
| | | await BaseDal.AddDataAsync(task); |
| | | // 更新库存位置状态为不可用 |
| | | location.LocationStatus = (int)LocationEnum.InStockDisable; |
| | | await _locationRepository.UpdateDataAsync(location); |
| | | }); |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | // 添加任务到数据库 |
| | | await BaseDal.AddDataAsync(task); |
| | | // 更新库存位置状态为不可用 |
| | | location.LocationStatus = (int)LocationEnum.InStockDisable; |
| | | await _locationRepository.UpdateDataAsync(location); |
| | | }); |
| | | |
| | | content.OK(data: taskDTO); |
| | | } |
| | | else |
| | | content.Error(result.MOMMessage); |
| | | content.OK(data: taskDTO); |
| | | } |
| | | else |
| | | content.Error(result.MOMMessage); |
| | | } |
| | | else |
| | | { |
| | |
| | | var content = new WebResponseContent(); |
| | | |
| | | // 获取目标地址和更新任务状态 |
| | | |
| | | |
| | | input.Position = Regex.Replace(input.Position, @"-(\d+)", ""); |
| | | if (Convert.ToInt32(input.Position) > 1999) |
| | | { |
| | | input.Position = (Convert.ToInt32(input.Position) - 1000).ToString(); |
| | | } |
| | | |
| | | if (task.TaskType == (int)TaskInboundTypeEnum.InNG) |
| | | { |
| | | // TODO 根据巷道查找对应NG口,现在默认去静置堆垛机的异常口货位号 |
| | |
| | | } |
| | | else if (task.TaskType == (int)TaskInboundTypeEnum.InQuality) |
| | | { |
| | | var stockInfo = _stockInfoRepository.QueryFirst(x => x.PalletCode == input.PalletCode); |
| | | var stockInfo = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == input.PalletCode); |
| | | task.CurrentAddress = input.Position; |
| | | task.TargetAddress = stockInfo.LocationInfo.LocationCode; |
| | | task.NextAddress = stockInfo.LocationInfo.LocationCode; |
| | |
| | | //var station = stationManagers.Select(x => x.stationChildCode).ToList(); |
| | | |
| | | //// 获取WCSip地址相关配置 |
| | | //var wcsIpAddrss = GetWCSIpAddress(); |
| | | var wcsIpAddrss = GetWCSIpAddress(); |
| | | //if (wcsIpAddrss == null) |
| | | //{ |
| | | // throw new InvalidOperationException("WCS IP 未配置"); |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 静置NG入库 |
| | | /// </summary> |
| | | /// <param name="locationCode">货位号</param> |
| | | /// <param name="palletCode">托盘号</param> |
| | | /// <returns></returns> |
| | | [HttpPost, AllowAnonymous, Route("RequestInBoundTaskNG")] |
| | | public async Task<WebResponseContent> RequestInBoundTaskNG([FromBody] RequestTaskDto input) |
| | | { |
| | | return await Service.CreateAndSendInboundTask(input.PalletCode, input.Position); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 常温补空托盘至分容 |
| | | /// </summary> |
| | | /// <param name="input">请求数据</param> |
| | |
| | | "MainDB": "DB_WIDESEA", //当前项目的主库,所对应的连接字符串的Enabled必须为true |
| | | //连接字符串 |
| | | //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=", |
| | | //"ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionString": "Data Source=192.168.5.251;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | |
| | | //跨域 |