From 663d9d2e658ab99a0c3598becd23b00b34b3e3d9 Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期五, 29 十一月 2024 13:55:22 +0800 Subject: [PATCH] 高常温逻辑 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs | 73 +++++- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 93 +++----- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs | 10 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 35 +- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs | 38 +++ Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HttpContextUser/AspNetUser.cs | 18 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 7 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 100 +++++--- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs | 2 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/HostedService/SeedDataHostedService.cs | 2 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs | 5 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs | 14 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs | 14 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 101 ++++++++ Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs | 97 +++++++- Code Management/WCS/WIDESEAWCS_Client/src/api/http.js | 4 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 6 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj | 2 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs | 12 + Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs | 1 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs | 12 + Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs | 2 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/BasicInfo/Dt_StationManager.cs | 2 Code Management/WMS/WIDESEA_WMSClient/src/api/http.js | 4 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs | 6 25 files changed, 489 insertions(+), 171 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Client/src/api/http.js b/Code Management/WCS/WIDESEAWCS_Client/src/api/http.js index fcb2646..f7d9a09 100644 --- a/Code Management/WCS/WIDESEAWCS_Client/src/api/http.js +++ b/Code Management/WCS/WIDESEAWCS_Client/src/api/http.js @@ -12,8 +12,8 @@ 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/'; diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/HostedService/SeedDataHostedService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/HostedService/SeedDataHostedService.cs index 2e1d6ac..3834529 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/HostedService/SeedDataHostedService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/HostedService/SeedDataHostedService.cs @@ -49,7 +49,7 @@ { // 浣跨敤 myScopedService 鎵ц浠诲姟 - await DBSeed.SeedAsync(_dbContext, _webRootPath); + //await DBSeed.SeedAsync(_dbContext, _webRootPath); //澶氱鎴� 鍚屾 //await DBSeed.TenantSeedAsync(_dbContext); diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs index 0215b0d..b2bd4ee 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs @@ -65,6 +65,13 @@ WebResponseContent ReceiveByWMSTask([NotNull] WMSTaskDTO taskDTOs); /// <summary> + /// 鎺ユ敹WMS浠诲姟淇℃伅 + /// </summary> + /// <param name="taskDTOs">WMS浠诲姟瀵硅薄闆嗗悎</param> + /// <returns>杩斿洖澶勭悊缁撴灉</returns> + WebResponseContent ReceiveByWMSGWTask([NotNull] WMSTaskDTO taskDTO); + + /// <summary> /// 鏍规嵁鎵樼洏鍙枫�佽捣濮嬪湴鍧�鍚慦MS璇锋眰浠诲姟 /// </summary> /// <param name="palletCode">鎵樼洏鍙�</param> diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/BasicInfo/Dt_StationManager.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/BasicInfo/Dt_StationManager.cs index cadc1b5..cd3d5b4 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/BasicInfo/Dt_StationManager.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/BasicInfo/Dt_StationManager.cs @@ -33,7 +33,7 @@ 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 = "绔欏彴绫诲瀷")] diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs index 31b2264..d2293fa 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs @@ -31,6 +31,12 @@ 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) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs index 8192070..9781647 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Filter/CustomProfile.cs @@ -17,12 +17,18 @@ /// <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)); } } } diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs index 4f4e913..e867020 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs @@ -107,7 +107,7 @@ app.ConfigureApplication();//配置文件 app.UseApplicationSetup();//启动配置 app.UseSession(); -if (app.Environment.IsDevelopment()) +//if (app.Environment.IsDevelopment()) { //todo //app.UseSwaggerAuthorized(); diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs index 6420913..a4a31d7 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs @@ -159,6 +159,44 @@ 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浠诲姟淇℃伅 diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs index 28a58a4..0091885 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs @@ -530,18 +530,28 @@ 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, $"鍫嗗灈鏈哄嚭搴撳畬鎴�"); + } //鏆備笉鑰冭檻澶氫釜鍑哄簱鍙� @@ -593,11 +603,6 @@ 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 diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs index 5e856c2..bf6ee84 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs @@ -104,6 +104,7 @@ { 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()); @@ -115,8 +116,48 @@ 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) @@ -149,12 +190,44 @@ 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); + } } } @@ -174,7 +247,7 @@ WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); - if(content.Status) + if (content.Status) { conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); } @@ -190,14 +263,14 @@ /// <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); @@ -210,17 +283,17 @@ /// <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); } } } @@ -246,10 +319,12 @@ } 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); } diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs index 8b20832..a05038e 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs @@ -50,27 +50,59 @@ 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> @@ -181,21 +213,30 @@ /// </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); + } } } } diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs index a5db635..262eaa4 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs @@ -141,19 +141,19 @@ { 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) { @@ -170,6 +170,22 @@ /// <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) { @@ -177,7 +193,7 @@ if (device != null) { CommonConveyorLine conveyorLine = (CommonConveyorLine)device; - //if (conveyorLine.IsOccupied(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤 + if (conveyorLine.IsOccupied(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤 { return task; } @@ -240,31 +256,45 @@ } 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) diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/api/http.js b/Code Management/WMS/WIDESEA_WMSClient/src/api/http.js index e91897e..67d289e 100644 --- a/Code Management/WMS/WIDESEA_WMSClient/src/api/http.js +++ b/Code Management/WMS/WIDESEA_WMSClient/src/api/http.js @@ -11,8 +11,8 @@ 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/'; diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs index 9b7608f..20bcbd6 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs @@ -125,5 +125,10 @@ /// 璇锋眰WCS浠诲姟 /// </summary> public const string ReceiveByWMSTask = "ReceiveByWMSTask"; + + /// <summary> + /// 璇锋眰WCS浠诲姟 + /// </summary> + public const string ReceiveTask = "ReceiveTask"; } } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs index 394f9de..54c3eba 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/HttpHelper.cs @@ -17,8 +17,11 @@ 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; @@ -41,8 +44,11 @@ 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(); } diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs index fe41350..21bbef2 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs @@ -49,7 +49,7 @@ { // 浣跨敤 myScopedService 鎵ц浠诲姟 - await DBSeed.SeedAsync(_dbContext, _webRootPath); + //await DBSeed.SeedAsync(_dbContext, _webRootPath); //澶氱鎴� 鍚屾 //await DBSeed.TenantSeedAsync(_dbContext); diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HttpContextUser/AspNetUser.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HttpContextUser/AspNetUser.cs index 36743dd..4dc19cc 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HttpContextUser/AspNetUser.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HttpContextUser/AspNetUser.cs @@ -153,14 +153,18 @@ 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) @@ -186,7 +190,7 @@ public string UserName { get; set; } - public int UserId { get; set; } + public int UserId { get; set; } public string UserTrueName { get; set; } diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj index 5833393..fbebee4 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj @@ -27,7 +27,7 @@ <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" /> diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs index 4ced415..43ff9cf 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs @@ -175,4 +175,10 @@ /// <returns></returns> Task<WebResponseContent> UpdateTaskStatus(int taskNum, int taskState); + /// <summary> + /// + /// </summary> + /// <returns></returns> + WebResponseContent StockCheckingAsync(); + } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs index ec24849..7cc810a 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtBoxingInfo.cs @@ -35,6 +35,18 @@ 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涓� diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs index b46fda9..c037cfe 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/BasicModel/DtStockInfo.cs @@ -87,6 +87,18 @@ 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")] diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs index 69b11ac..311ccd4 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs @@ -1,7 +1,9 @@ -锘縰sing 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; @@ -12,17 +14,11 @@ { 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; //缁勭洏 @@ -30,21 +26,16 @@ 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, @@ -53,20 +44,14 @@ 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; @@ -75,8 +60,8 @@ _areaInfoRepository = areaInfoRepository; _agingInOrOutInputService = agingInOrOutInputService; _stockInfoDetailRepository = stockInfoDetailRepository; - _productionRepository = productionRepository; _stationManagerRepository = stationManagerRepository; + _configService = configService; } #region 澶栭儴鎺ュ彛鏂规硶 @@ -141,8 +126,19 @@ 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 @@ -617,11 +613,18 @@ // 濡傛灉鐘舵�佷负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) { @@ -734,6 +737,7 @@ { PalletCode = palletCode, IsFull = true, + ProcessCode = result.ProcessCode, BoxingInfoDetails = result.SerialNos.Select(serialNoObj => new DtBoxingInfoDetail { SerialNumber = serialNoObj.SerialNo, @@ -791,7 +795,7 @@ if (hasTask != null) { WMSTaskDTO taskDTO1 = CreateTaskDTO(hasTask); - return content.OK("宸插瓨鍦ㄧ┖鐩樺嚭搴撲换鍔�", data: taskDTO1); + return content.OK("宸插瓨鍦ㄥ嚭搴撲换鍔�", data: taskDTO1); } // 鍒涘缓鏂颁换鍔″疄渚� @@ -885,7 +889,9 @@ 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, }; } @@ -1134,39 +1140,6 @@ #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> /// 鍒涘缓鍘嗗彶浠诲姟璁板綍 diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs index 637842f..0b561e4 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs @@ -1,8 +1,12 @@ -锘縰sing 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; @@ -387,13 +391,13 @@ } //鍒涘缓涓�涓猅rayCellsStatusDto瀵硅薄锛屽苟璧嬪�� - 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); @@ -413,7 +417,7 @@ //// return content.Error("鏂欐灞炴�т笉瀛樺湪"); //// 璋冪敤CreateBoxingInfo鏂规硶锛屽垱寤虹粍鐩樹俊鎭� - var boxing = CreateBoxingInfo(result, input.PalletCode); + var boxing = CreateBoxingInfo(result, input.PalletCode); if (boxing == null) return content.Error("缁勭洏澶辫触"); //// 璋冪敤GetProcessApplyAsync鏂规硶锛岃幏鍙栧伐鑹鸿矾绾� @@ -779,4 +783,83 @@ } #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) // 棰勫姞杞絃ocationInfo + .Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails + .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 + } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs index 686b224..067b924 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs @@ -122,4 +122,14 @@ 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(); + } } \ No newline at end of file diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs index d9f23b6..7dc8b26 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs @@ -146,7 +146,6 @@ app.UseAuthorization(); - app.MapControllers(); app.Run(); -- Gitblit v1.9.3