| | |
| | | let loadingInstance; |
| | | let loadingStatus = false; |
| | | if (process.env.NODE_ENV == 'development') { |
| | | // axios.defaults.baseURL = 'http://127.0.0.1:9291/'; |
| | | axios.defaults.baseURL = 'http://192.168.20.251:9291/'; |
| | | axios.defaults.baseURL = 'http://127.0.0.1:9291/'; |
| | | // axios.defaults.baseURL = 'http://192.168.20.251:9291/'; |
| | | } |
| | | else if (process.env.NODE_ENV == 'debug') { |
| | | axios.defaults.baseURL = 'http://127.0.0.1:8098/'; |
| | |
| | | { |
| | | // 使用 myScopedService 执行任务 |
| | | |
| | | await DBSeed.SeedAsync(_dbContext, _webRootPath); |
| | | //await DBSeed.SeedAsync(_dbContext, _webRootPath); |
| | | |
| | | //多租户 同步 |
| | | //await DBSeed.TenantSeedAsync(_dbContext); |
| | |
| | | WebResponseContent ReceiveByWMSTask([NotNull] WMSTaskDTO taskDTOs); |
| | | |
| | | /// <summary> |
| | | /// 接收WMS任务信息 |
| | | /// </summary> |
| | | /// <param name="taskDTOs">WMS任务对象集合</param> |
| | | /// <returns>返回处理结果</returns> |
| | | WebResponseContent ReceiveByWMSGWTask([NotNull] WMSTaskDTO taskDTO); |
| | | |
| | | /// <summary> |
| | | /// 根据托盘号、起始地址向WMS请求任务 |
| | | /// </summary> |
| | | /// <param name="palletCode">托盘号</param> |
| | |
| | | public int stationID { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 站台类型 1-入库站台 2-出库站台 3-异常排出站台 4-NG工站放料 5-NG工站取料 6-空框入库 7-空框出库 |
| | | /// 站台类型 1-入库站台 2-出库站台 3-异常排出站台 4-NG工站放料 5-NG工站取料 6-空框入库 7-空框出库,8-入库线体扫码确认,9-入库站台确认 |
| | | /// </summary> |
| | | [ImporterHeader(Name = "站台类型")] |
| | | [ExporterHeader(DisplayName = "站台类型")] |
| | |
| | | return Service.ReceiveByWMSTask(taskDTOs); |
| | | } |
| | | |
| | | [HttpPost, Route("ReceiveByWMSGWTask"), AllowAnonymous] |
| | | public WebResponseContent ReceiveByWMSGWTask([FromBody] WMSTaskDTO taskDTOs) |
| | | { |
| | | return Service.ReceiveByWMSGWTask(taskDTOs); |
| | | } |
| | | |
| | | |
| | | [HttpPost, HttpGet, Route("UpdateTaskExceptionMessage")] |
| | | public WebResponseContent UpdateTaskExceptionMessage(int taskNum, string message) |
| | |
| | | /// <summary> |
| | | /// 配置构造函数,用来创建关系映射 |
| | | /// </summary> |
| | | public CustomProfile() |
| | | public CustomProfile() |
| | | { |
| | | CreateMap<Dt_DeviceInfo,DeviceInfoDTO>(); |
| | | CreateMap<Dt_DeviceInfo, DeviceInfoDTO>(); |
| | | CreateMap<WMSTaskDTO, Dt_Task>().ForMember(a => a.WMSId, b => b.MapFrom(b => b.Id)); |
| | | CreateMap<Dt_Task, ConveyorLineTaskCommand>().ForMember(a => a.TargetAddress, b => b.MapFrom(b => b.NextAddress)).ForMember(a => a.Barcode, b => b.MapFrom(b => b.PalletCode)).ForMember(a => a.TaskNum, b => b.MapFrom(b => b.TaskNum)); |
| | | CreateMap<Dt_Task,ConveyorLineTaskCommand_After>().ForMember(a => a.ConveyorLineBarcode, b => b.MapFrom(b => b.PalletCode)).ForMember(a => a.ConveyorLineTaskNum, b => b.MapFrom(b => b.TaskNum)); |
| | | CreateMap<Dt_Task, ConveyorLineTaskCommand>() |
| | | .ForMember(a => a.TargetAddress, b => b.MapFrom(b => b.NextAddress)) |
| | | .ForMember(a => a.Barcode, b => b.MapFrom(b => b.PalletCode)) |
| | | .ForMember(a => a.TaskNum, b => b.MapFrom(b => b.TaskNum)); |
| | | CreateMap<Dt_Task, ConveyorLineTaskCommand_After>() |
| | | .ForMember(a => a.ConveyorLineBarcode, b => b.MapFrom(b => b.PalletCode)) |
| | | .ForMember(a => a.ConveyorLineTaskNum, b => b.MapFrom(b => b.TaskNum)) |
| | | .ForMember(a => a.ConveyorLineTargetAddress, b => b.MapFrom(b => b.NextAddress)); |
| | | } |
| | | } |
| | | } |
| | |
| | | app.ConfigureApplication();//配置文件 |
| | | app.UseApplicationSetup();//启动配置 |
| | | app.UseSession(); |
| | | if (app.Environment.IsDevelopment()) |
| | | //if (app.Environment.IsDevelopment()) |
| | | { |
| | | //todo |
| | | //app.UseSwaggerAuthorized(); |
| | |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 高温出库 |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ReceiveByWMSGWTask([NotNull] WMSTaskDTO taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | if (BaseDal.QueryFirst(x => x.TaskNum == taskDTO.TaskNum || x.PalletCode == taskDTO.PalletCode) != null) |
| | | { |
| | | return content.OK(); |
| | | } |
| | | Dt_Task task = _mapper.Map<Dt_Task>(taskDTO); |
| | | task.Creater = "WMS"; |
| | | |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutNew; |
| | | task.CurrentAddress = taskDTO.RoadWay; |
| | | task.NextAddress = "002-000-002"; |
| | | task.SourceAddress = taskDTO.SourceAddress; |
| | | task.TargetAddress = taskDTO.TargetAddress; |
| | | } |
| | | BaseDal.AddData(task); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.WMSId, "接收WMS任务"); |
| | | |
| | | content = WebResponseContent.Instance.OK("成功"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content = WebResponseContent.Instance.Error($"任务接收错误,错误信息:{ex.Message}"); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 接收WMS任务信息 |
| | |
| | | |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting) |
| | | { |
| | | var routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress); |
| | | if (!routers.Any()) return WebResponseContent.Instance.Error($"未找到设备路由信息"); |
| | | if (!task.Roadway.Contains("GW")) |
| | | { |
| | | var routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress); |
| | | if (!routers.Any()) return WebResponseContent.Instance.Error($"未找到设备路由信息"); |
| | | |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); |
| | | task.TaskState = nextStatus; |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.NextAddress = routers.FirstOrDefault().ChildPosi; |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | | BaseDal.UpdateData(task); |
| | | int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>(); |
| | | task.TaskState = nextStatus; |
| | | task.CurrentAddress = task.NextAddress; |
| | | task.NextAddress = routers.FirstOrDefault().ChildPosi; |
| | | task.ModifyDate = DateTime.Now; |
| | | task.Modifier = "System"; |
| | | BaseDal.UpdateData(task); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库完成"); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库完成"); |
| | | } |
| | | else |
| | | { |
| | | task.TaskState = (int)TaskOutStatusEnum.OutFinish; |
| | | BaseDal.UpdateData(task); |
| | | |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库完成"); |
| | | } |
| | | |
| | | |
| | | //暂不考虑多个出库口 |
| | |
| | | task.Remark = "NG"; |
| | | BaseDal.UpdateData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库完成,MOM返回NG"); |
| | | } |
| | | else if (task.Roadway.Contains("GW")) |
| | | { |
| | | BaseDal.DeleteData(task); |
| | | _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"堆垛机出库完成,高温库数据删除"); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | { |
| | | ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode); |
| | | |
| | | if (command == null) continue; |
| | | if (command.ConveyorLineBarcode.Trim().Contains("\0")) command.ConveyorLineBarcode = ""; |
| | | |
| | | DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString()); |
| | |
| | | method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (childDeviceCode == "1670") |
| | | { |
| | | Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active"); |
| | | if (platform != null) |
| | | { |
| | | if (command.HasPallet != 1) |
| | | { |
| | | MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod); |
| | | if (method != null) |
| | | { |
| | | int count = string.IsNullOrEmpty(platform.Location) ? 0 + 1 : platform.Location.Split(',').Count() + 1; |
| | | method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!string.IsNullOrEmpty(platform.Location)) |
| | | { |
| | | var strings = platform.Location.Split(',').ToList(); |
| | | foreach (var ite in strings) |
| | | { |
| | | int index = strings.FindIndex(p => p == ite); |
| | | ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite); |
| | | if (command1.InteractiveSignal != 2) |
| | | { |
| | | MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod); |
| | | if (method != null) |
| | | { |
| | | int count = strings.Count - index; |
| | | method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | if (task == null) |
| | | { |
| | | HandleNewTask(conveyorLine, command, childDeviceCode); |
| | | |
| | | } |
| | | else |
| | | { |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(ex.ToString()); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输送线请求入库下一地址 |
| | | /// </summary> |
| | | /// <param name="conveyorLine">输送线实例对象</param> |
| | | /// <param name="command">读取的请求信息</param> |
| | | /// <param name="childDeviceCode">子设备编号</param> |
| | | public void RequestInNextAddress(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | if (newTask != null) |
| | | { |
| | | |
| | | //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, newTask.TaskNum, childDeviceCode); |
| | | //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, newTask.NextAddress, childDeviceCode); |
| | | //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, command.ConveyorLineBarcode, childDeviceCode); |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask); |
| | | //taskCommand.InteractiveSignal = command.InteractiveSignal; |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); |
| | | |
| | | if(content.Status) |
| | | if (content.Status) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); |
| | | } |
| | |
| | | /// <param name="command">读取的请求信息</param> |
| | | /// <param name="childDeviceCode">子设备编号</param> |
| | | /// <param name="ProtocalDetailValue">线体当前bool读取偏移地址</param> |
| | | public void RequestOutbound(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode, int ProtocalDetailValue) |
| | | public void RequestOutbound(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) |
| | | { |
| | | var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task); |
| | | taskCommand.InteractiveSignal = command.InteractiveSignal; |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); |
| | | |
| | | //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | |
| | | /// <param name="conveyorLine">输送线实例对象</param> |
| | | /// <param name="command">读取的请求信息</param> |
| | | /// <param name="childDeviceCode">子设备编号</param> |
| | | public void RequestOutNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode) |
| | | public void RequestOutNextAddress(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) |
| | | { |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | if (newTask != null) |
| | | { |
| | | ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask); |
| | | taskCommand.InteractiveSignal = command.InteractiveSignal; |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(newTask); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | taskCommand.ConveyorLineTargetAddress = 1000; |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode); |
| | | taskCommand.ConveyorLineTargetAddress = Convert.ToInt16( stationManager.stationLocation); |
| | | } |
| | | |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); |
| | | //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | content = _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | |
| | | private void HandleNewTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) |
| | | { |
| | | Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode); |
| | | //if ((conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") || (conveyorLine.DeviceCode == "1005" && childDeviceCode == "1048")) |
| | | //{ |
| | | // CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode); |
| | | //} |
| | | if (stationManager.stationType == 1) |
| | | |
| | | if (stationManager.stationType == 8) |
| | | { |
| | | var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | RequestInNextAddress(conveyorLine, command, childDeviceCode); |
| | | } |
| | | } |
| | | else if (stationManager.stationType == 9) |
| | | { |
| | | var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | ConveyorLineInFinish(conveyorLine, command, childDeviceCode); |
| | | } |
| | | else |
| | | { |
| | | RequestWmsTask(conveyorLine, command, childDeviceCode); |
| | | } |
| | | |
| | | } |
| | | //else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1068")) |
| | | //{ |
| | | // ConveyorLineOutFinish(conveyorLine, command, childDeviceCode); |
| | | //} |
| | | else if (stationManager.stationType == 1) |
| | | { |
| | | if (stationManager.stationArea.Contains("GW")) |
| | | { |
| | | var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && x.TaskState == (int)TaskOutStatusEnum.OutFinish); |
| | | if (taskGW != null) |
| | | { |
| | | command.ConveyorLineBarcode = taskGW.PalletCode; |
| | | } |
| | | } |
| | | RequestWmsTask(conveyorLine, command, childDeviceCode); |
| | | } |
| | | else if (stationManager.stationType == 10) |
| | | { |
| | | var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | RequestOutbound(conveyorLine, command, childDeviceCode); |
| | | } |
| | | } |
| | | else if (stationManager.stationType == 11) |
| | | { |
| | | var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | RequestOutNextAddress(conveyorLine, command, childDeviceCode); |
| | | } |
| | | } |
| | | else if (stationManager.stationType == 12) |
| | | { |
| | | var task = _taskService.QueryExecutingConveyorLineTask(command.ConveyorLineTaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | RequestOutNextAddress(conveyorLine, command, childDeviceCode); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | private async void RequestWmsTask(CommonConveyorLine_GW conveyorLine, ConveyorLineTaskCommand_After command, string childDeviceCode) |
| | | { |
| | | var taskGW = _taskRepository.QueryFirst(x => x.TargetAddress == childDeviceCode && x.TaskState == (int)TaskOutStatusEnum.OutFinish); |
| | | if (taskGW != null) |
| | | _taskRepository.DeleteData(taskGW); |
| | | var content = await _taskService.RequestWMSTask(command.ConveyorLineBarcode, childDeviceCode); |
| | | if (content.Status) |
| | | { |
| | | var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, task.TaskNum, childDeviceCode); |
| | | //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode); |
| | | //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, command.ConveyorLineBarcode, childDeviceCode); |
| | | ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, task.NextAddress, childDeviceCode); |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | //ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | WriteInfo(conveyorLine.DeviceName, content.Message); |
| | | _taskRepository.AddData(taskGW); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return task; |
| | | } |
| | | else |
| | | { |
| | | List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); |
| | | List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); |
| | | foreach (var item in tasks) |
| | | { |
| | | if (OutTaskStationIsOccupied(task) != null) |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | } |
| | | //else |
| | | //{ |
| | | // List<string> otherOutStaionCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress).Select(x => x.ChildPosi).ToList(); |
| | | // List<Dt_Task> tasks = _taskService.QueryStackerCraneOutTasks(commonStackerCrane.DeviceCode, otherOutStaionCodes); |
| | | // foreach (var item in tasks) |
| | | // { |
| | | // if (OutTaskStationIsOccupied(task) != null) |
| | | // { |
| | | // return task; |
| | | // } |
| | | // } |
| | | // task = _taskService.QueryStackerCraneInTask(commonStackerCrane.DeviceCode); |
| | | //} |
| | | } |
| | | else if (task == null) |
| | | { |
| | |
| | | /// <returns>如果未被占用,返回传入的任务信息,否则,返回null</returns> |
| | | private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task) |
| | | { |
| | | if (task.Roadway.Contains("GW")) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1015"); |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device; |
| | | if (conveyorLine.IsOccupied(task.TargetAddress))//出库站台未被占用 |
| | | { |
| | | return task; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.TargetAddress}】对应的通讯对象,无法判断出库站台是否被占用"); |
| | | } |
| | | } |
| | | Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault(); |
| | | if (router != null) |
| | | { |
| | |
| | | if (device != null) |
| | | { |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | //if (conveyorLine.IsOccupied(router.ChildPosi))//出库站台未被占用 |
| | | if (conveyorLine.IsOccupied(router.ChildPosi))//出库站台未被占用 |
| | | { |
| | | return task; |
| | | } |
| | |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | List<Dt_Router> routers = _routerService.QueryNextRoutes(task.Roadway, task.TargetAddress); |
| | | if (routers.Count > 0) |
| | | if (task.Roadway.Contains("GW")) |
| | | { |
| | | 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]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | | else |
| | | { |
| | | //数据配置错误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"出库任务起点错误,起点:【{task.CurrentAddress}】"); |
| | | return null; |
| | | } |
| | | 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]); |
| | | 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]); |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup) |
| | |
| | | let loadingInstance |
| | | let loadingStatus = false |
| | | if (process.env.NODE_ENV == 'development') { |
| | | // axios.defaults.baseURL = 'http://localhost:5000/'; |
| | | axios.defaults.baseURL = 'http://192.168.20.251:5000/'; |
| | | axios.defaults.baseURL = 'http://localhost:5000/'; |
| | | // axios.defaults.baseURL = 'http://192.168.20.251:5000/'; |
| | | } |
| | | else if (process.env.NODE_ENV == 'debug') { |
| | | axios.defaults.baseURL = 'http://127.0.0.1:9991/'; |
| | |
| | | /// 请求WCS任务 |
| | | /// </summary> |
| | | public const string ReceiveByWMSTask = "ReceiveByWMSTask"; |
| | | |
| | | /// <summary> |
| | | /// 请求WCS任务 |
| | | /// </summary> |
| | | public const string ReceiveTask = "ReceiveTask"; |
| | | } |
| | | } |
| | |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | |
| | | result = await httpClient.GetAsync(serviceAddress).Result.Content.ReadAsStringAsync(); |
| | | return result; |
| | |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | if (headers != null) |
| | | { |
| | | foreach (var header in headers) |
| | | httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); |
| | | } |
| | | |
| | | result = await httpClient.PostAsync(serviceAddress, httpContent).Result.Content.ReadAsStringAsync(); |
| | | } |
| | |
| | | { |
| | | // 使用 myScopedService 执行任务 |
| | | |
| | | await DBSeed.SeedAsync(_dbContext, _webRootPath); |
| | | //await DBSeed.SeedAsync(_dbContext, _webRootPath); |
| | | |
| | | //多租户 同步 |
| | | //await DBSeed.TenantSeedAsync(_dbContext); |
| | |
| | | |
| | | public IEnumerable<Claim> GetClaimsIdentity() |
| | | { |
| | | var claims = _accessor.HttpContext.User.Claims.ToList(); |
| | | var headers = _accessor.HttpContext.Request.Headers; |
| | | foreach (var header in headers) |
| | | if (_accessor.HttpContext != null) |
| | | { |
| | | claims.Add(new Claim(header.Key, header.Value)); |
| | | } |
| | | |
| | | return claims; |
| | | var claims = _accessor.HttpContext.User.Claims.ToList(); |
| | | var headers = _accessor.HttpContext.Request.Headers; |
| | | foreach (var header in headers) |
| | | { |
| | | claims.Add(new Claim(header.Key, header.Value)); |
| | | } |
| | | return claims; |
| | | } |
| | | return ArraySegment<Claim>.Empty; |
| | | } |
| | | |
| | | public List<string> GetClaimValueByType(string ClaimType) |
| | |
| | | |
| | | public string UserName { get; set; } |
| | | |
| | | public int UserId { get; set; } |
| | | public int UserId { get; set; } |
| | | |
| | | public string UserTrueName { get; set; } |
| | | |
| | |
| | | <PackageReference Include="OfficeOpenXml.Core.ExcelPackage" Version="1.0.0" /> |
| | | <PackageReference Include="SkiaSharp" Version="2.88.8" /> |
| | | <PackageReference Include="SqlSugarCore" Version="5.1.4.152" /> |
| | | <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> |
| | | <PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.0" /> |
| | | <PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.5" /> |
| | | <PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="6.5.0" /> |
| | | <PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" /> |
| | |
| | | /// <returns></returns> |
| | | Task<WebResponseContent> UpdateTaskStatus(int taskNum, int taskState); |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent StockCheckingAsync(); |
| | | |
| | | } |
| | |
| | | public string Remark { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 当前工序 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "当前工序")] |
| | | public string ProcessCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 下一工序 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "下一工序")] |
| | | public string NextProcessCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库存明细 |
| | | /// </summary> |
| | | [MinItemsCount(1)] // 检测集合元素最少1个 |
| | |
| | | public int StockStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 当前工序 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "当前工序")] |
| | | public string ProcessCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 下一工序 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "下一工序")] |
| | | public string NextProcessCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 库存明细 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "StockInfoDetails")] |
| | |
| | | using Mapster; |
| | | |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_DTO.WMS; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | using WIDESEA_StorageBasicRepository; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | |
| | | { |
| | | private readonly LogFactory LogFactory = new LogFactory(); |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IDt_OutOrderRepository _outOrderRepository; |
| | | private readonly IStockInfoRepository _stockInfoRepository; |
| | | private readonly IStockInfoDetailRepository _stockInfoDetailRepository; |
| | | private readonly IDt_Task_HtyRepository _task_HtyRepository; |
| | | private readonly IDt_OutOrderAndStockRepository _outOrderAndStockRepository; |
| | | private readonly IDt_OutOrderAndStock_HtyRepository _outOrderAndStock_HtyRepository; |
| | | private readonly IMapper _mapper; |
| | | private readonly IDt_MaterielInfoRepository _materielInfoRepository; |
| | | private readonly ILocationInfoRepository _locationRepository; |
| | | private readonly IDt_WareAreaInfoRepository _wareAreaInfoRepository; |
| | | private readonly IPointStackerRelationRepository _pointStackerRelationRepository; |
| | | private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository; |
| | | private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository; |
| | | private readonly IBoxingInfoRepository _boxingInfoRepository; //组盘 |
| | |
| | | private readonly IProcessApplyService _processApplyService; //工艺路线 |
| | | private readonly IDt_AreaInfoRepository _areaInfoRepository; //区域 |
| | | private readonly IAgingInOrOutInputService _agingInOrOutInputService; //静置\陈化 |
| | | private readonly IProductionRepository _productionRepository; //生产 |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ISys_ConfigService _configService; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | | IDt_OutOrderRepository outOrderRepository, |
| | | IStockInfoRepository stockInfoRepository, |
| | | IDt_OutOrderAndStockRepository dt_OutOrderAndStockRepository, |
| | | IDt_OutOrderAndStock_HtyRepository dt_OutOrderAndStock_HtyRepository, |
| | | IDt_Task_HtyRepository task_HtyRepository, |
| | | IMapper mapper, |
| | | IDt_MaterielInfoRepository materielInfoRepository, |
| | | ILocationInfoRepository locationRepository, |
| | | IDt_WareAreaInfoRepository wareAreaInfoRepository, |
| | | IPointStackerRelationRepository pointStackerRelationRepository, |
| | | ITaskExecuteDetailRepository taskExecuteDetailRepository, |
| | | ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository, |
| | | IBoxingInfoRepository boxingInfoRepository, |
| | |
| | | IDt_AreaInfoRepository areaInfoRepository, |
| | | IAgingInOrOutInputService agingInOrOutInputService, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IProductionRepository productionRepository, |
| | | IDt_StationManagerRepository stationManagerRepository) : base(BaseDal) |
| | | IDt_StationManagerRepository stationManagerRepository, |
| | | ISys_ConfigService configService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _outOrderRepository = outOrderRepository; |
| | | _stockInfoRepository = stockInfoRepository; |
| | | _outOrderAndStockRepository = dt_OutOrderAndStockRepository; |
| | | _outOrderAndStock_HtyRepository = dt_OutOrderAndStock_HtyRepository; |
| | | _task_HtyRepository = task_HtyRepository; |
| | | _mapper = mapper; |
| | | _materielInfoRepository = materielInfoRepository; |
| | | _locationRepository = locationRepository; |
| | | _wareAreaInfoRepository = wareAreaInfoRepository; |
| | | _pointStackerRelationRepository = pointStackerRelationRepository; |
| | | _taskExecuteDetailRepository = taskExecuteDetailRepository; |
| | | _locationStatusChangeRecordRepository = locationStatusChangeRecordRepository; |
| | | _boxingInfoRepository = boxingInfoRepository; |
| | |
| | | _areaInfoRepository = areaInfoRepository; |
| | | _agingInOrOutInputService = agingInOrOutInputService; |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _productionRepository = productionRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | } |
| | | |
| | | #region 外部接口方法 |
| | |
| | | var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stock.ParameterInfos).FirstOrDefault(y => y.Description.Contains("时间")); |
| | | if (parameterInfo == null) throw new Exception(""); |
| | | |
| | | var outHours = (DateTime.Now - stock.OutboundTime.Value).TotalHours; |
| | | var outHours = (DateTime.Now - (stock.LinedProcessFeedbackTime == null ? stock.CreateDate : stock.LinedProcessFeedbackTime.ToDateTime())).TotalHours; |
| | | |
| | | //if (stock.LinedProcessFeedbackTime == null) |
| | | //{ |
| | | // outHours = (DateTime.Now - stock.CreateDate).TotalHours; |
| | | //} |
| | | //else |
| | | //{ |
| | | // outHours = (DateTime.Now - stock.LinedProcessFeedbackTime.ToDateTime()).TotalHours; |
| | | //} |
| | | |
| | | var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble() && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble(); |
| | | |
| | | var defectCode = string.Empty; |
| | | if (!isNG) defectCode = "TQCK"; |
| | | return new AgingOutputDto |
| | |
| | | |
| | | // 如果状态为false,则返回null |
| | | if (!content.Status) return content.Error("工艺申请失败"); |
| | | var resultProcessApply = JsonConvert.DeserializeObject<ResultProcessApply>(content.Data.ToString()); |
| | | if ((resultProcessApply.Success)) return content.Error("工艺申请失败"); |
| | | |
| | | //// 调用GetProcessResponseAsync方法,获取工艺响应 |
| | | var par = resultProcessApply.ProcessInfo.Where(x => x.ProcessCode == boxing.ProcessCode).FirstOrDefault().Number.ToInt32(); |
| | | |
| | | |
| | | // 调用GetProcessResponseAsync方法,获取工艺响应 |
| | | //var processResponse = await GetProcessResponseAsync(process, input.Position); |
| | | |
| | | //List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" }; |
| | | ////List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" }; |
| | | Console.WriteLine(area.AreaCode+"-----------------------"); |
| | | Console.WriteLine(input.Position + "-----------------------"); |
| | | var stationManagers = _stationManagerRepository.QueryData(x => x.stationType == 1 && x.stationChildCode == input.Position && x.stationArea == area.AreaCode).ToList(); |
| | | if (stationManagers.Count <= 0) |
| | | { |
| | |
| | | { |
| | | PalletCode = palletCode, |
| | | IsFull = true, |
| | | ProcessCode = result.ProcessCode, |
| | | BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail |
| | | { |
| | | SerialNumber = serialNoObj.SerialNo, |
| | |
| | | if (hasTask != null) |
| | | { |
| | | WMSTaskDTO taskDTO1 = CreateTaskDTO(hasTask); |
| | | return content.OK("已存在空盘出库任务", data: taskDTO1); |
| | | return content.OK("已存在出库任务", data: taskDTO1); |
| | | } |
| | | |
| | | // 创建新任务实例 |
| | |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | TaskType = tag == (int)TaskOutboundTypeEnum.Outbound ? (int)TaskOutboundTypeEnum.Outbound : (int)TaskOutboundTypeEnum.OutTray, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | Creater = "System" // 修正拼写错误 |
| | | Creater = "System", // 修正拼写错误 |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | }; |
| | | } |
| | | |
| | |
| | | #endregion 内部调用方法 |
| | | |
| | | #region private 内部方法 |
| | | |
| | | /// <summary> |
| | | /// 更新出库订单和库存信息 |
| | | /// </summary> |
| | | /// <param name="stock">库存实例</param> |
| | | /// <param name="barCode">条码</param> |
| | | /// <returns>更新后的订单和库存信息</returns> |
| | | private async Task<Dt_OutOrderAndStock> UpdateOrderAndStockAsync(DtStockInfo stock, string barCode) |
| | | { |
| | | //根据PalletCode获取订单和库存信息 |
| | | var orderStock = await _outOrderAndStockRepository.GetOrderAndStock(palletCode: barCode); |
| | | |
| | | //完成数量增加 |
| | | orderStock.CompletedQuantity += stock.StockInfoDetails.Sum(x => x.StockQuantity); |
| | | |
| | | //订单详情完成数量增加 |
| | | orderStock.OrderList.OrderDetailList.CompletedQuantity += stock.StockInfoDetails.Sum(x => x.StockQuantity); |
| | | |
| | | //返回更新后的订单和库存信息 |
| | | return orderStock; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 判断订单是否完成 |
| | | /// </summary> |
| | | /// <param name="orderStock">订单和库存信息</param> |
| | | /// <returns>是否完成</returns> |
| | | // 判断订单是否完成 |
| | | private bool IsOrderComplete(Dt_OutOrderAndStock orderStock) |
| | | { |
| | | // 如果出库数量等于完成出库数量,则订单完成 |
| | | return orderStock.CompletedQuantity == orderStock.OutboundQuantity; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 创建历史任务记录 |
| | |
| | | using log4net.Core; |
| | | |
| | | using log4net.Core; |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using Masuit.Tools.Models; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using SixLabors.Fonts.Tables.AdvancedTypographic; |
| | | using System.Diagnostics; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_DTO; |
| | | using WIDESEA_DTO.MOM; |
| | | using WIDESEA_DTO.WMS; |
| | |
| | | } |
| | | |
| | | //创建一个TrayCellsStatusDto对象,并赋值 |
| | | TrayCellsStatusDto trayCells = new TrayCellsStatusDto() |
| | | { |
| | | Software = "WMS", |
| | | TrayBarcode = input.PalletCode, |
| | | //EquipmentCode = "EQ_CWJZ01" |
| | | EquipmentCode = input.EquiCodeMOM |
| | | }; |
| | | TrayCellsStatusDto trayCells = new TrayCellsStatusDto() |
| | | { |
| | | Software = "WMS", |
| | | TrayBarcode = input.PalletCode, |
| | | //EquipmentCode = "EQ_CWJZ01" |
| | | EquipmentCode = input.EquiCodeMOM |
| | | }; |
| | | |
| | | // 调用GetTrayCellStatusAsync方法,获取整盘电芯 |
| | | content = await GetTrayCellStatusAsync(trayCells); |
| | |
| | | //// return content.Error("料框属性不存在"); |
| | | |
| | | //// 调用CreateBoxingInfo方法,创建组盘信息 |
| | | var boxing = CreateBoxingInfo(result, input.PalletCode); |
| | | var boxing = CreateBoxingInfo(result, input.PalletCode); |
| | | if (boxing == null) return content.Error("组盘失败"); |
| | | |
| | | //// 调用GetProcessApplyAsync方法,获取工艺路线 |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 检测高温库是否有可出库库存 |
| | | |
| | | public WebResponseContent StockCheckingAsync() |
| | | { |
| | | |
| | | WebResponseContent webResponseContent = new WebResponseContent(); |
| | | try |
| | | { |
| | | Task.Run(async () => |
| | | { |
| | | while (true) |
| | | { |
| | | Thread.Sleep(10000); |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == "GWSC1"); |
| | | |
| | | var stockInfo = await _stockInfoRepository.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.LocationInfo) // 预加载LocationInfo |
| | | .Includes(x => x.StockInfoDetails) // 预加载StockInfoDetails |
| | | .Where(x => x.AreaCode == area.AreaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 过滤条件 |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 过滤条件 |
| | | .OrderBy(x => x.OutboundTime) // 排序 |
| | | .ToListAsync(); // 获取第一个元素 |
| | | |
| | | if (stockInfo.Count <= 0) continue; |
| | | foreach (var item in stockInfo) |
| | | { |
| | | |
| | | var hasTask = BaseDal.QueryFirst(x => x.PalletCode == item.PalletCode); |
| | | if (hasTask != null) |
| | | { |
| | | Console.WriteLine("已存在出库任务"); |
| | | continue; |
| | | } |
| | | |
| | | string position = string.Empty; |
| | | if (item.LocationInfo.RoadwayNo == "GWSC1") |
| | | position = "1059"; |
| | | else |
| | | position = "1065"; |
| | | |
| | | var task = CreateTask(item, position, (int)TaskOutboundTypeEnum.Outbound); |
| | | task.NextAddress = "002-000-002"; |
| | | // 创建任务DTO |
| | | WMSTaskDTO taskDTO = CreateTaskDTO(task); |
| | | |
| | | |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue; |
| | | var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveTask)?.ConfigValue; |
| | | if (wmsBase == null || ipAddress == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP 未配置"); |
| | | } |
| | | var wmsIpAddress = wmsBase + ipAddress; |
| | | |
| | | var result = HttpHelper.PostAsync(wmsIpAddress, taskDTO.ToJsonString()).Result; |
| | | var content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | if (content.Status) |
| | | { |
| | | await BaseDal.AddDataAsync(task); |
| | | // 更新库存位置状态为不可用 |
| | | item.LocationInfo.LocationStatus = (int)LocationEnum.InStockDisable; |
| | | await _locationRepository.UpdateDataAsync(item.LocationInfo); |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | return webResponseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine(ex.Message.ToString()); |
| | | return webResponseContent.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |
| | |
| | | return await Service.UpdateTaskStatus(input.TaskNum, input.TaskState); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取高温可出库库存 |
| | | /// </summary> |
| | | /// <param name="input">请求数据</param> |
| | | /// <returns></returns> |
| | | [HttpGet, AllowAnonymous, Route("StockCheckingAsync")] |
| | | public WebResponseContent StockCheckingAsync() |
| | | { |
| | | return Service.StockCheckingAsync(); |
| | | } |
| | | } |
| | |
| | | app.UseAuthorization(); |
| | | |
| | | |
| | | |
| | | app.MapControllers(); |
| | | |
| | | app.Run(); |