From ca08d1f380987254814242e2fe3ea9de28228132 Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期六, 04 一月 2025 09:36:21 +0800 Subject: [PATCH] 代码更新 --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/测试架仓/GroundStationJob_CSJ.cs | 3 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs | 15 ++ 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 2 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs | 96 +++++++++++-- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs | 127 ++++++++++------- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 16 + 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f68413a2-ad64-418c-b6b3-1cbbe0a09b03.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/WIDESEA_InboundService.csproj | 1 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/543d3d70-8433-4b19-aabd-dfd52610493b.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs | 4 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs | 4 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs | 46 +++-- /dev/null | 0 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs | 12 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs | 2 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs | 11 + 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs | 33 ++-- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 34 ++++ 19 files changed, 286 insertions(+), 122 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/543d3d70-8433-4b19-aabd-dfd52610493b.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/543d3d70-8433-4b19-aabd-dfd52610493b.vsidx" new file mode 100644 index 0000000..05aa72e --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/543d3d70-8433-4b19-aabd-dfd52610493b.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7c7b1759-5019-4f27-bae4-4d1504711d68.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7c7b1759-5019-4f27-bae4-4d1504711d68.vsidx" deleted file mode 100644 index 33aee32..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7c7b1759-5019-4f27-bae4-4d1504711d68.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" index 80b262c..13280ec 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" @@ -49,18 +49,18 @@ AGV_Executing = 310, /// <summary> - /// AGV瀹屾垚 - /// </summary> - [Description("AGV瀹屾垚")] - AGV_Finish = 330, - - /// <summary> /// AGV寰呯户缁墽琛� /// </summary> [Description("AGV寰呯户缁墽琛�")] AGV_WaitToExecute = 320, /// <summary> + /// AGV瀹屾垚 + /// </summary> + [Description("AGV瀹屾垚")] + AGV_Finish = 330, + + /// <summary> /// 浠诲姟瀹屾垚 /// </summary> [Description("浠诲姟瀹屾垚")] diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" index 102fe3a..fee17b8 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs" @@ -157,5 +157,7 @@ /// <param name="agvUpdateModel"></param> /// <returns></returns> AgvResponseContent AgvUpdateTask(AgvUpdateDTO agvUpdateModel); + + WebResponseContent SendSecureReplyToAgv(int taskNum); } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" index 000b58c..41866de 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGVController.cs" @@ -29,6 +29,9 @@ _taskService = taskService; _taskRepository = taskRepository; } + + + /// <summary> /// 瀹夊叏淇″彿鐢宠 AGV-WCS /// </summary> @@ -41,23 +44,23 @@ agvResponseContent.ReqCode = secureApplyModel.ReqCode; try { - var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode== x.AgvTaskNum); + var task = _taskRepository.QueryFirst(x => secureApplyModel.TaskCode == x.AgvTaskNum); if (task == null) throw new Exception("鏈壘鍒颁换鍔�"); if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) { var content = TakeRequest(task.CurrentAddress); - if (!content.Status) - { - throw new Exception(content.Message); - } + //if (!content.Status) + //{ + // throw new Exception(content.Message); + //} } else { var content = PutRequest(task.NextAddress, task.PalletType); - if (!content.Status) - { - throw new Exception(content.Message); - } + //if (!content.Status) + //{ + // throw new Exception(content.Message); + //} } task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); @@ -109,12 +112,12 @@ if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) { var content = TakeRequest(task.CurrentAddress); - if (!content.Status) throw new Exception(content.Message); + //if (!content.Status) throw new Exception(content.Message); } else { var content = PutRequest(task.NextAddress, task.PalletType); - if (!content.Status) throw new Exception(content.Message); + //if (!content.Status) throw new Exception(content.Message); } task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); @@ -127,14 +130,14 @@ { var content = PutFinish(task.NextAddress); if (!content.Status) throw new Exception(content.Message); - Dt_StationManger dt_Station=_stationMangerRepository.QueryFirst(x=>x.AGVStationCode== task.NextAddress); - if (dt_Station==null) + Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress); + if (dt_Station == null) { throw new Exception($"{task.NextAddress}AGV绔欏彴鏈畾涔�"); } task.CurrentAddress = dt_Station.StationCode; task.NextAddress = ""; - task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); + task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); task.DeviceCode = "SC01_CSJ"; var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -188,6 +191,7 @@ bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode); if (canPut) { + otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode); return WebResponseContent.Instance.OK(); } else @@ -271,6 +275,7 @@ bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); if (canPut) { + otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); return WebResponseContent.Instance.OK(); } else diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" index aab8236..9ed8a34 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" @@ -54,5 +54,16 @@ { return Service.RollbackTaskStatusToLast(taskNum); } + + /// <summary> + /// 鍥炲AGV瀹夊叏淇″彿 + /// </summary> + /// <param name="taskNum"></param> + /// <returns></returns> + [HttpPost, HttpGet, Route("SendSecureReplyToAgv")] + public WebResponseContent SendSecureReplyToAgv(int taskNum) + { + return Service.SendSecureReplyToAgv(taskNum); + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" index 64b2c52..08ad5c7 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/HostedService/WarehouseHostedService.cs" @@ -21,34 +21,40 @@ public Task StartAsync(CancellationToken cancellationToken) { - string connStr = AppSettings.GetValue("WMSConnectionStrings"); - if (string.IsNullOrEmpty(connStr)) + try { - throw new Exception("WMS杩炴帴瀛楃涓查敊璇�"); + string connStr = AppSettings.GetValue("WMSConnectionStrings"); + if (string.IsNullOrEmpty(connStr)) + { + throw new Exception("WMS杩炴帴瀛楃涓查敊璇�"); + } + SqlSugarClient sugarClient = new(new ConnectionConfig() + { + ConnectionString = connStr, + IsAutoCloseConnection = true, + DbType = DbType.SqlServer + }); + + //List<Dt_Warehouse> warehouses = sugarClient.Queryable<Dt_Warehouse>().ToList(); + + //_dbContext.Db.Deleteable<Dt_Warehouse>().ExecuteCommand(); + + //_dbContext.Db.Insertable(warehouses).ExecuteCommand(); + + List<Dt_ApiInfo> apiInfos = _dbContext.Db.Queryable<Dt_ApiInfo>().ToList(); + + _cacheService.AddOrUpdate(nameof(apiInfos), apiInfos); } - SqlSugarClient sugarClient = new(new ConnectionConfig() + catch (Exception ex) { - ConnectionString = connStr, - IsAutoCloseConnection = true, - DbType = DbType.SqlServer - }); - - List<Dt_Warehouse> warehouses = sugarClient.Queryable<Dt_Warehouse>().ToList(); - - _dbContext.Db.Deleteable<Dt_Warehouse>().ExecuteCommand(); - - _dbContext.Db.Insertable(warehouses).ExecuteCommand(); - - List<Dt_ApiInfo> apiInfos = _dbContext.Db.Queryable<Dt_ApiInfo>().ToList(); - - _cacheService.AddOrUpdate(nameof(apiInfos), apiInfos); - + Console.WriteLine(ex.ToString()); + } return Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) { - throw new NotImplementedException(); + return Task.CompletedTask; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" index 0fda9b9..9b5bdcc 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" @@ -27,6 +27,7 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; +using WIDESEA_DTO.Agv; using WIDESEAWCS_Common.APIEnum; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; @@ -44,6 +45,7 @@ using WIDESEAWCS_QuartzJob.Models; using WIDESEAWCS_QuartzJob.Repository; using WIDESEAWCS_QuartzJob.Service; +using WIDESEAWCS_TaskInfoRepository; using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; namespace WIDESEAWCS_TaskInfoService @@ -231,7 +233,7 @@ _taskExecuteDetailService.AddTaskExecuteDetail(tasks.Select(x => x.TaskNum).ToList(), "鎺ユ敹WMS浠诲姟"); - content = WebResponseContent.Instance.OK("鎴愬姛"); + content = tasks.Count > 0 ? WebResponseContent.Instance.OK("鎴愬姛") : WebResponseContent.Instance.Error("澶辫触"); } catch (Exception ex) { @@ -469,5 +471,35 @@ } return content; } + + public WebResponseContent SendSecureReplyToAgv(int taskNum) + { + try + { + Dt_Task WaitToTask = BaseDal.QueryFirst(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && x.TaskNum == taskNum); + AgvSecureReplyDTO replyDTO = new AgvSecureReplyDTO() + { + ReqCode = Guid.NewGuid().ToString().Replace("-", ""), //WaitToTask.TaskNum.ToString(), + taskCode = WaitToTask.AgvTaskNum, + }; + WebResponseContent content = AgvSecureReply(replyDTO); + if (content.Status) + { + WaitToTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); + } + else + { + WaitToTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); + WaitToTask.ExceptionMessage = content.Message; + } + UpdateData(WaitToTask); + + return WebResponseContent.Instance.OK(); + } + catch (Exception ex) + { + return WebResponseContent.Instance.Error(ex.Message); + } + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" index 42a710a..0afac43 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGVExtend.cs" @@ -1,6 +1,7 @@ 锘縰sing System; using System.Collections.Generic; using System.Linq; +using System.Reflection.Metadata; using System.Text; using System.Threading.Tasks; using WIDESEA_DTO.Agv; @@ -8,6 +9,8 @@ using WIDESEAWCS_Core; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Model.Models; +using static Dm.net.buffer.ByteArrayBuffer; +using WIDESEAWCS_QuartzJob; namespace WIDESEAWCS_Tasks { @@ -23,11 +26,13 @@ var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); foreach (var agvTask in newTasks) { - AgvTaskDTO taskDTO = new AgvTaskDTO() + try { - ReqCode = Guid.NewGuid().ToString().Replace("-", ""), - TaskTyp = AgvTaskType(agvTask.TaskType, agvTask.DeviceCode), - PositionCodePath = new List<CodePath>() + AgvTaskDTO taskDTO = new AgvTaskDTO() + { + ReqCode = Guid.NewGuid().ToString().Replace("-", ""), + TaskTyp = AgvTaskType(agvTask.TaskType, agvTask.DeviceCode), + PositionCodePath = new List<CodePath>() { new CodePath() { @@ -40,27 +45,35 @@ positionCode=agvTask.NextAddress } }, - TaskCode = agvTask.AgvTaskNum, - PodTyp = agvTask.PalletType < 3 ? "XX" : "DD", - }; - WebResponseContent content = _taskService.AgvSendTask(taskDTO); - if (content.Status) - { - agvTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); - //agvTask.Remark = content.Data.ObjToString(); + TaskCode = agvTask.AgvTaskNum, + PodTyp = agvTask.PalletType < 3 ? "XX" : "DD", + }; + WebResponseContent content = _taskService.AgvSendTask(taskDTO); + if (content.Status) + { + agvTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); + //agvTask.Remark = content.Data.ObjToString(); + } + else + { + agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); + //agvTask.Remark = content.Data.ObjToString(); + agvTask.ExceptionMessage = content.Message; + } } - else + catch (Exception ex) { agvTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); //agvTask.Remark = content.Data.ObjToString(); - agvTask.ExceptionMessage = content.Message; + agvTask.ExceptionMessage = ex.Message; + WriteError(nameof(AGVJob), ex.Message, ex); } } _taskService.UpdateData(newTasks); } catch (Exception ex) { - Console.Out.WriteLine(nameof(AGVJob) + ":" + ex.Message); + WriteError(nameof(AGVJob), ex.Message, ex); } } /// <summary> @@ -73,6 +86,57 @@ var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt()).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); foreach (var WaitToTask in WaitToTasks) { + if(WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.NextAddress); + if (stationManger == null) + { + continue; + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + continue; + } + OtherDevice otherDevice = (OtherDevice)device; + bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode); + bool requestPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_PutRequest, stationManger.StationCode); + if(!requestPut) + { + otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode); + continue; + } + else if (!canPut) + { + continue; + } + } + else + { + Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.CurrentAddress); + if (stationManger == null) + { + continue; + } + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); + if (device == null) + { + continue; + } + OtherDevice otherDevice = (OtherDevice)device; + bool canTake = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); + bool requestTake = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_TakeRequest, stationManger.StationCode); + if (!requestTake) + { + otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); + continue; + } + else if (!canTake) + { + continue; + } + } + AgvSecureReplyDTO replyDTO = new AgvSecureReplyDTO() { ReqCode = Guid.NewGuid().ToString().Replace("-", ""), //WaitToTask.TaskNum.ToString(), @@ -114,7 +178,7 @@ else return "22"; } default: - throw new NotImplementedException(); + throw new Exception($"璁惧缂栧彿閿欒"); } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/GroundStationJob_CSJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/GroundStationJob_CSJ.cs" index fe4ab19..e635bdd 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/GroundStationJob_CSJ.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/GroundStationJob_CSJ.cs" @@ -74,7 +74,7 @@ } if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()) { - Dt_Task task = _taskRepository.QueryFirst(x => (x.TargetAddress == item.StackerCraneCode || string.IsNullOrEmpty(x.TargetAddress) || x.NextAddress == item.StackerCraneCode || string.IsNullOrEmpty(x.NextAddress)) && (x.TaskState == TaskStatusEnum.New.ObjToInt() || x.TaskState == TaskStatusEnum.SC_Execute.ObjToInt()) && x.SourceAddress == item.StationCode || x.CurrentAddress==item.AGVStationCode); + Dt_Task task = _taskRepository.QueryFirst(x => (x.TargetAddress == item.StackerCraneCode || string.IsNullOrEmpty(x.TargetAddress) || x.NextAddress == item.StackerCraneCode || string.IsNullOrEmpty(x.NextAddress)) && (x.TaskState == TaskStatusEnum.New.ObjToInt() || x.TaskState == TaskStatusEnum.AGV_Finish.ObjToInt()) && (x.SourceAddress == item.StationCode || x.CurrentAddress == item.AGVStationCode || x.CurrentAddress == item.StationCode)); if (task != null) { string oldAddress = task.NextAddress; @@ -91,6 +91,7 @@ WriteInfo(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); break; } + task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); task.CurrentAddress = stationManger.StackerCraneStationCode; task.TargetAddress = locationCode; task.NextAddress = locationCode; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/06b6ba59-2c2a-4213-bfcb-89a257c39dfa.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/06b6ba59-2c2a-4213-bfcb-89a257c39dfa.vsidx" deleted file mode 100644 index a9a2335..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/06b6ba59-2c2a-4213-bfcb-89a257c39dfa.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/3bdb0da1-c42c-4531-99e8-2d9f1d8c02e8.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/3bdb0da1-c42c-4531-99e8-2d9f1d8c02e8.vsidx" deleted file mode 100644 index f50dced..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/3bdb0da1-c42c-4531-99e8-2d9f1d8c02e8.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8c2e982d-ad7f-4e3a-9e0e-ad39ee70751d.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8c2e982d-ad7f-4e3a-9e0e-ad39ee70751d.vsidx" deleted file mode 100644 index 678ee82..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/8c2e982d-ad7f-4e3a-9e0e-ad39ee70751d.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/aa4fa866-107a-485b-b7b2-6e3b1ee2a3e0.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/aa4fa866-107a-485b-b7b2-6e3b1ee2a3e0.vsidx" deleted file mode 100644 index bbbf9d1..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/aa4fa866-107a-485b-b7b2-6e3b1ee2a3e0.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b53658fa-fd6e-4ffe-a47a-525d35036fa2.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b53658fa-fd6e-4ffe-a47a-525d35036fa2.vsidx" deleted file mode 100644 index 9945a2a..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/b53658fa-fd6e-4ffe-a47a-525d35036fa2.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/be46b995-1948-4e27-9de5-d740316e7adb.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/be46b995-1948-4e27-9de5-d740316e7adb.vsidx" deleted file mode 100644 index a9ba207..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/be46b995-1948-4e27-9de5-d740316e7adb.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d09639a2-a943-4bea-b5bf-74c7d0c7ecaf.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d09639a2-a943-4bea-b5bf-74c7d0c7ecaf.vsidx" deleted file mode 100644 index 4186753..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d09639a2-a943-4bea-b5bf-74c7d0c7ecaf.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d8be537b-48e7-4c4e-b402-59d20119ef7a.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d8be537b-48e7-4c4e-b402-59d20119ef7a.vsidx" deleted file mode 100644 index 63b3d61..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d8be537b-48e7-4c4e-b402-59d20119ef7a.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/e4d2b89c-c9d8-4512-858a-0ac416e979cb.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/e4d2b89c-c9d8-4512-858a-0ac416e979cb.vsidx" deleted file mode 100644 index 8d8bf74..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/e4d2b89c-c9d8-4512-858a-0ac416e979cb.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f68413a2-ad64-418c-b6b3-1cbbe0a09b03.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f68413a2-ad64-418c-b6b3-1cbbe0a09b03.vsidx" new file mode 100644 index 0000000..b8d828b --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f68413a2-ad64-418c-b6b3-1cbbe0a09b03.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs" index 651618f..4fa9539 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IRecordService/ILocationStatusChangeRecordService.cs" @@ -15,7 +15,7 @@ { ILocationStatusChangeRecordRepository Repository { get; } - void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, LocationStatusEnum lastStatus, LocationChangeType changeType, string? orderNo = null, int? taskNum = null); + void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, LocationStatusEnum lastStatus, LocationStatusEnum newStatus, LocationChangeType changeType, string? orderNo = null, int? taskNum = null); void AddLocationStatusChangeRecord(List<Dt_LocationInfo> locationInfos, LocationStatusEnum newStatus, LocationChangeType changeType, string? orderNo = null, List<int>? taskNums = null); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" index 95dce0e..2979f71 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs" @@ -25,6 +25,7 @@ using WIDESEA_DTO.Basic; using WIDESEA_DTO.ERP; using WIDESEA_DTO.Inbound; +using WIDESEA_DTO.MES; using WIDESEA_External.ERPService; using WIDESEA_External.Model; using WIDESEA_IBasicRepository; @@ -35,6 +36,7 @@ using WIDESEA_IStockRepository; using WIDESEA_IStockService; using WIDESEA_ITaskInfoRepository; +using WIDESEA_ITaskInfoService; using WIDESEA_Model.Models; using WIDESEA_StockRepository; @@ -414,6 +416,14 @@ _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup); _unitOfWorkManage.CommitTran(); + //if (warehouse.WarehouseCode==WarehouseEnum.HA153.ToString()) + //{ + // //鍚屾娴嬭瘯鏋朵俊鎭� + // foreach (var model in models) + // { + // _taskService.TestSynStock(new TestToolSynInfo() { ToolCode = model.LotNo, Life = Initiallife }); + // } + //} content.OK(); } catch (Exception ex) @@ -526,6 +536,11 @@ } _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.MaterielGroup); _unitOfWorkManage.CommitTran(); + //鍚屾娴嬭瘯鏋朵俊鎭� + //foreach (var model in models) + //{ + // _taskService.TestSynStock(new TestToolSynInfo() { ToolCode = model.LotNo, Life = Initiallife }); + //} content.OK(); } catch (Exception ex) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/WIDESEA_InboundService.csproj" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/WIDESEA_InboundService.csproj" index 407bace..9b1e176 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/WIDESEA_InboundService.csproj" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/WIDESEA_InboundService.csproj" @@ -14,6 +14,7 @@ <ProjectReference Include="..\WIDESEA_IRecordService\WIDESEA_IRecordService.csproj" /> <ProjectReference Include="..\WIDESEA_IStockService\WIDESEA_IStockService.csproj" /> <ProjectReference Include="..\WIDESEA_ITaskInfoRepository\WIDESEA_ITaskInfoRepository.csproj" /> + <ProjectReference Include="..\WIDESEA_ITaskInfoService\WIDESEA_ITaskInfoService.csproj" /> </ItemGroup> </Project> diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs" index 9660b90..e55c598 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_RecordService/Service/LocationStatusChangeRecordService.cs" @@ -19,13 +19,13 @@ { public partial class LocationStatusChangeRecordService : ServiceBase<Dt_LocationStatusChangeRecord, ILocationStatusChangeRecordRepository>, ILocationStatusChangeRecordService { - public void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, LocationStatusEnum lastStatus, LocationChangeType changeType, string? orderNo = null, int? taskNum = null) + public void AddLocationStatusChangeRecord(Dt_LocationInfo locationInfo, LocationStatusEnum lastStatus, LocationStatusEnum newStatus, LocationChangeType changeType, string? orderNo = null, int? taskNum = null) { try { Dt_LocationStatusChangeRecord locationStatusChangeRecord = new Dt_LocationStatusChangeRecord() { - AfterStatus = locationInfo.LocationStatus, + AfterStatus = newStatus.ObjToInt(), BeforeStatus = lastStatus.ObjToInt(), ChangeType = changeType.ObjToInt(), LocationCode = locationInfo.LocationCode, diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" index 55e6f47..c944a34 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" @@ -28,6 +28,8 @@ { public partial class TaskService { + static object lock_out = new object(); + /// <summary> /// 娴嬭瘯鏋跺嚭浠� /// </summary> @@ -35,67 +37,82 @@ /// <returns></returns> public MesResponseContent TestToolOut(TestToolOutModel model) { - MesResponseContent responseContent = new MesResponseContent(); - try + lock (lock_out) { - Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA64.ToString()); - //鑾峰彇搴撳瓨璁板綍 - List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => - x.WarehouseId == warehouse.WarehouseId && - x.StockStatus == (int)StockStatusEmun.鍏ュ簱瀹屾垚).Includes(x => x.Details).ToList(); - Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == model.ToolCode)); - if (stockInfo == null) + MesResponseContent responseContent = new MesResponseContent(); + try { - return responseContent.Error($"娴嬭瘯鏋�:{model.ToolCode}鏃犲彲鐢ㄥ簱瀛�"); + Dt_Task exsit = Repository.QueryFirst(x => x.TargetAddress == model.TargetAddressCode); + if(exsit != null) + { + return responseContent.Error($"鐩爣鍦板潃閲嶅"); + } + + Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA64.ToString()); + //鑾峰彇搴撳瓨璁板綍 + List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => + x.WarehouseId == warehouse.WarehouseId && + x.StockStatus == (int)StockStatusEmun.鍏ュ簱瀹屾垚).Includes(x => x.Details).ToList(); + Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == model.ToolCode)); + if (stockInfo == null) + { + return responseContent.Error($"娴嬭瘯鏋�:{model.ToolCode}鏃犲彲鐢ㄥ簱瀛�"); + } + Dt_Task exsit2 = Repository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); + if (exsit2 != null) + { + return responseContent.Error($"娴嬭瘯鏋舵壒娆″彿閲嶅"); + } + + Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode && + x.WarehouseId == stockInfo.WarehouseId && + x.LocationStatus == (int)LocationStatusEnum.InStock && + (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut)); + if (locationInfo == null) + { + return responseContent.Error($"娴嬭瘯鏋惰揣浣�:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�"); + } + //鐢熸垚娴嬭瘯鏋跺嚭搴撲换鍔� 閿佸畾搴撳瓨 鏇存敼璐т綅鐘舵�� + Dt_Task taskOut = new() + { + CurrentAddress = stockInfo.LocationCode, + Grade = 0, + PalletCode = stockInfo.PalletCode, + NextAddress = "", + Roadway = locationInfo.RoadwayNo, + SourceAddress = stockInfo.LocationCode, + TargetAddress = model.TargetAddressCode, + TaskStatus = (int)TaskStatusEnum.New, + TaskType = (int)TaskTypeEnum.Outbound, + TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), + PalletType = stockInfo.PalletType, + WarehouseId = stockInfo.WarehouseId, + }; + stockInfo.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾; + LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus; + locationInfo.LocationStatus = (int)LocationStatusEnum.Lock; + //鍒ゆ柇鏄惁鏈夊嚭搴撳崟淇℃伅 + _unitOfWorkManage.BeginTran(); + //鏇存柊搴撳瓨鐘舵�� + _stockRepository.StockInfoRepository.UpdateData(stockInfo); + //鏇存柊璐т綅鐘舵�� + _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); + //鏂板缓浠诲姟 + BaseDal.AddData(taskOut); + //鍔犲叆璐т綅鍙樺姩璁板綍 + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum); + _unitOfWorkManage.CommitTran(); + //灏嗕换鍔℃帹閫佸埌WCS + PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV"); + responseContent.OK(); } - Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode && - x.WarehouseId == stockInfo.WarehouseId && - x.LocationStatus == (int)LocationStatusEnum.InStock && - (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut)); - if (locationInfo == null) + catch (Exception ex) { - return responseContent.Error($"娴嬭瘯鏋惰揣浣�:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�"); + _unitOfWorkManage.RollbackTran(); + responseContent.Error(ex.Message); } - //鐢熸垚娴嬭瘯鏋跺嚭搴撲换鍔� 閿佸畾搴撳瓨 鏇存敼璐т綅鐘舵�� - Dt_Task taskOut = new() - { - CurrentAddress = stockInfo.LocationCode, - Grade = 0, - PalletCode = stockInfo.PalletCode, - NextAddress = "", - Roadway = locationInfo.RoadwayNo, - SourceAddress = stockInfo.LocationCode, - TargetAddress = model.TargetAddressCode, - TaskStatus = (int)TaskStatusEnum.New, - TaskType = (int)TaskTypeEnum.Outbound, - TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), - PalletType = stockInfo.PalletType, - WarehouseId = stockInfo.WarehouseId, - }; - stockInfo.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾; - LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus; - locationInfo.LocationStatus = (int)LocationStatusEnum.Lock; - //鍒ゆ柇鏄惁鏈夊嚭搴撳崟淇℃伅 - _unitOfWorkManage.BeginTran(); - //鏇存柊搴撳瓨鐘舵�� - _stockRepository.StockInfoRepository.UpdateData(stockInfo); - //鏇存柊璐т綅鐘舵�� - _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); - //鏂板缓浠诲姟 - BaseDal.AddData(taskOut); - //鍔犲叆璐т綅鍙樺姩璁板綍 - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum); - _unitOfWorkManage.CommitTran(); - //灏嗕换鍔℃帹閫佸埌WCS - PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV"); - responseContent.OK(); + return responseContent; } - catch (Exception ex) - { - _unitOfWorkManage.RollbackTran(); - responseContent.Error(ex.Message); - } - return responseContent; } /// <summary> /// 娴嬭瘯鏋堕��搴� diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index 8528c0e..fd0f49f 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" @@ -32,6 +32,7 @@ using WIDESEA_Core.Enums; using WIDESEA_Core.Helper; using WIDESEA_DTO.Inbound; +using WIDESEA_DTO.MES; using WIDESEA_DTO.Stock; using WIDESEA_DTO.Task; using WIDESEA_External.ERPService; @@ -218,6 +219,15 @@ return WebResponseContent.Instance.Error($"鍏ュ簱鍚屾Erp澶辫触"); } } + + if ((stockInfo.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt() || stockInfo.StockStatus == StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt()) && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString()) + { + foreach (var model in stockInfo.Details) + { + TestSynStock(new TestToolSynInfo() { ToolCode = model.BatchNo, Life = int.TryParse(model.Remark, out int val) ? val : 1000 }); + } + } + //娴嬭瘯鏋跺叆搴撳簱瀛樼姸鎬� if (task.TaskType == TaskTypeEnum.Inbound.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString() && stockInfo.StockStatus != StockStatusEmun.鎵嬪姩缁勭洏鍏ュ簱纭.ObjToInt()) { @@ -237,7 +247,7 @@ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.InStock, stockInfo.WarehouseId); _stockRepository.StockInfoRepository.UpdateData(stockInfo); _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details); - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundCompleted); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted); _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum); if (inboundOrder != null) { @@ -305,7 +315,7 @@ } } - + _unitOfWorkManage.BeginTran(); if (outboundOrderDetails.Count > 0) { @@ -319,7 +329,7 @@ _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)stockInfo.PalletType, LocationStatusEnum.Free, stockInfo.WarehouseId); BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateTypeEnum.鑷姩瀹屾垚 : OperateTypeEnum.浜哄伐瀹屾垚); - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, (LocationStatusEnum)beforeStatus, LocationStatusEnum.Free, LocationChangeType.OutboundCompleted, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", task.TaskNum); _unitOfWorkManage.CommitTran(); if (warehouse.WarehouseCode != WarehouseEnum.HA64.ToString()) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" index 4bb32e3..25f273f 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" @@ -202,7 +202,7 @@ LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; _unitOfWorkManage.BeginTran(); - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationChangeType.InboundAssignLocation); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.Lock, LocationChangeType.InboundAssignLocation); _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, task.WarehouseId); BaseDal.UpdateData(task); _unitOfWorkManage.CommitTran(); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs" index cdccf92..a390a33 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Reloaction.cs" @@ -86,12 +86,12 @@ { LocationStatusEnum lastStatus = (LocationStatusEnum)newLocation.LocationStatus; _basicService.LocationInfoService.UpdateLocationStatus(newLocation, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(newLocation, lastStatus, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(newLocation, lastStatus, LocationStatusEnum.Lock, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum); } { LocationStatusEnum lastStatus = (LocationStatusEnum)needRelocationItem.LocationStatus; _basicService.LocationInfoService.UpdateLocationStatus(needRelocationItem, (PalletTypeEnum)task.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); - _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(needRelocationItem, lastStatus, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum); + _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(needRelocationItem, lastStatus, LocationStatusEnum.Lock, LocationChangeType.RelocationAssignLocation, taskNum: newTask.TaskNum); } stockInfo.StockStatus = StockStatusEmun.绉诲簱閿佸畾.ObjToInt(); _stockRepository.StockInfoRepository.UpdateData(stockInfo); -- Gitblit v1.9.3