´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs
@@ -100,6 +100,12 @@ AGV_TakeError = 335, /// <summary> /// AGVæ¾è´§åå ¥å¼å¸¸ /// </summary> [Description("AGVåè´§åå ¥å¼å¸¸")] AGV_PutError = 340, /// <summary> /// ä»»å¡å®æ /// </summary> [Description("ä»»å¡å®æ")] ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/AGVController.cs
@@ -46,22 +46,22 @@ { 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) //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) //{ // throw new Exception(content.Message); // var content = TakeRequest(task.CurrentAddress); // //if (!content.Status) // //{ // // throw new Exception(content.Message); // //} //} } else { var content = PutRequest(task.NextAddress, task.PalletType); //if (!content.Status) //else //{ // throw new Exception(content.Message); // var content = PutRequest(task.NextAddress, task.PalletType); // //if (!content.Status) // //{ // // throw new Exception(content.Message); // //} //} } task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -114,16 +114,16 @@ break; case "getSafetySignal"://å®å ¨ä¿¡å·ç³è¯· { if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) { var content = TakeRequest(task.CurrentAddress); //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 (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) //{ // var content = TakeRequest(task.CurrentAddress); // //if (!content.Status) throw new Exception(content.Message); //} //else //{ // var content = PutRequest(task.NextAddress, task.PalletType); // //if (!content.Status) throw new Exception(content.Message); //} task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -134,7 +134,12 @@ if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt()) { var content = PutFinish(task.NextAddress); if (!content.Status) throw new Exception(content.Message); if (!content.Status) { task.TaskState = TaskStatusEnum.AGV_PutError.ObjToInt(); _taskRepository.UpdateData(task); throw new Exception(content.Message); } Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress); if (dt_Station == null) { ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/AGV/ZH_AGVController.cs
@@ -46,22 +46,22 @@ { 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) //if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt()) //{ // throw new Exception(content.Message); // var content = TakeRequest(task.CurrentAddress); // //if (!content.Status) // //{ // // throw new Exception(content.Message); // //} //} } else { var content = PutRequest(task.NextAddress, task.PalletType); //if (!content.Status) //else //{ // throw new Exception(content.Message); // var content = PutRequest(task.NextAddress, task.PalletType); // //if (!content.Status) // //{ // // throw new Exception(content.Message); // //} //} } task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -101,7 +101,12 @@ if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { var content = TakeFinish(task.CurrentAddress); if (!content.Status) throw new Exception(content.Message); if (!content.Status) { task.TaskState = TaskStatusEnum.AGV_TakeError.ObjToInt(); _taskRepository.UpdateData(task); throw new Exception(content.Message); } task.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); var up = _taskRepository.DeleteAndMoveIntoHty(task, OperateTypeEnum.èªå¨å®æ); _taskService.TaskCompleted(task.TaskNum); @@ -112,16 +117,16 @@ break; case "getSafetySignal"://å®å ¨ä¿¡å·ç³è¯· { if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { var content = TakeRequest(task.CurrentAddress); //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 (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) //{ // var content = TakeRequest(task.CurrentAddress); // //if (!content.Status) throw new Exception(content.Message); //} //else //{ // var content = PutRequest(task.NextAddress, task.PalletType); // //if (!content.Status) throw new Exception(content.Message); //} task.TaskState = TaskStatusEnum.AGV_WaitToExecute.ObjToInt(); var up = _taskRepository.UpdateData(task); agvResponseContent.Code = up ? "0" : "1"; @@ -132,7 +137,12 @@ if (task.TaskType != TaskTypeEnum.Outbound.ObjToInt()) { var content = PutFinish(task.NextAddress); if (!content.Status) throw new Exception(content.Message); if (!content.Status) { task.TaskState = TaskStatusEnum.AGV_PutError.ObjToInt(); _taskRepository.UpdateData(task); throw new Exception(content.Message); } Dt_StationManger dt_Station = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == task.NextAddress); if (dt_Station == null) { ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJExtend.cs
@@ -13,6 +13,7 @@ using WIDESEAWCS_DTO.Agv; using SqlSugar; using static Dm.net.buffer.ByteArrayBuffer; using WIDESEAWCS_Core.Enums; namespace WIDESEAWCS_Tasks { @@ -190,6 +191,8 @@ } } _taskService.UpdateData(WaitToTasks); //åæ¾è´§å®æåå ¥å¼å¸¸å¤ç Dt_Task? TakeErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_TakeError.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).First(); if (TakeErroeTask!=null) { @@ -207,8 +210,31 @@ otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode); Thread.Sleep(1000); otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode); TakeErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); var up = _taskRepository.DeleteAndMoveIntoHty(TakeErroeTask, OperateTypeEnum.èªå¨å®æ); _taskService.TaskCompleted(TakeErroeTask.TaskNum); } Dt_Task? PutErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_PutError.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).First(); if (PutErroeTask != null) { Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == PutErroeTask.NextAddress); if (stationManger == null) { throw new Exception($"æªæ¾å°ç«å°é ç½®"); } IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); if (device == null) { throw new Exception($"æªæ¾å°ç«å°é ç½®"); } OtherDevice otherDevice = (OtherDevice)device; otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode); PutErroeTask.CurrentAddress = stationManger.StationCode; PutErroeTask.NextAddress = ""; PutErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); PutErroeTask.DeviceCode = "SC01_CSJ"; var up = _taskRepository.UpdateData(PutErroeTask); } } catch (Exception ex) { ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/AGV/AGV_CSJob.cs
@@ -13,6 +13,7 @@ using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; @@ -28,14 +29,16 @@ private readonly IRouterService _routerService; private readonly IStationMangerRepository _stationMangerRepository; private readonly IMapper _mapper; private readonly ITaskRepository _taskRepository; public AGV_CSJJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) public AGV_CSJJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper, ITaskRepository taskRepository) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _routerService = routerService; _stationMangerRepository = stationMangerRepository; _mapper = mapper; _taskRepository = taskRepository; } public Task Execute(IJobExecutionContext context) { ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP²Ö/StackerCraneJob_PP.cs
@@ -52,6 +52,20 @@ _stationMangerRepository = stationMangerRepository; _cacheService = cacheService; _mapper=mapper; string? apiInfoStr = _cacheService.Get("apiInfos"); if (!string.IsNullOrEmpty(apiInfoStr)) { List<Dt_ApiInfo>? infos = JsonConvert.DeserializeObject<List<Dt_ApiInfo>>(apiInfoStr); if (infos == null || infos.Count == 0) { apiInfos = new List<Dt_ApiInfo>(); } else { apiInfos = infos; } } } public Task Execute(IJobExecutionContext context) ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/³ÉÆ·²Ö/AGV_CPExtend.cs
@@ -21,11 +21,14 @@ { try { var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()|| x.TaskState == TaskStatusEnum.New.ObjToInt()) && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.TaskType!=999).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); if (newTasks.Count>0) var AllTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (nameof(AGV_CPJob).Contains(x.DeviceCode))).ToList(); var stationMangers = _stationMangerRepository.QueryData(); #region å ¥åºä»»å¡æ¨é { foreach (var task in newTasks) var newTasksIn = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && x.TaskType>=TaskTypeEnum.Inbound.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.TaskType!=999).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); if (newTasksIn.Count>0) { foreach (var task in newTasksIn) { try { @@ -87,11 +90,269 @@ task.ExceptionMessage = ex.Message; } } if (newTasks.Count > 0) if (newTasksIn.Count > 0) { _taskService.UpdateData(newTasks); _taskService.UpdateData(newTasksIn); } } } #endregion #region åºåºæ¨éä»»å¡1线 { var newTasksOut1 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress=="5236").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); var downTasksOut1 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5236").ToList(); Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5236"); IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); if (device != null) { OtherDevice otherDevice = (OtherDevice)device; short stationCurrentStatus = device.Communicator.Read<short>("DB29.112"); if (newTasksOut1.Count > 0 && downTasksOut1.Count <= 0 && stationCurrentStatus == 1) { foreach (var task in newTasksOut1) { try { if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) task.CurrentAddress = GetAGVAddress(task.CurrentAddress); else task.NextAddress = GetAGVAddress(task.NextAddress); AgvTaskDTO taskDTO = new AgvTaskDTO() { TaskCode = task.AgvTaskNum, ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", ctnrCode = task.PalletCode, PositionCodePath = new List<CodePath>() { new CodePath() { type = "05", positionCode = task.CurrentAddress }, new CodePath() { type = "05", positionCode = task.NextAddress } } }; if (taskDTO.TaskTyp == "CPC") { taskDTO.Priority = task.Grade.ToString(); } if (task.GroupId.IsNotEmptyOrNull()) { taskDTO.GroupId = task.GroupId; } if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) { taskDTO.Priority = "127"; } //åéAGVä»»å¡ WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); if (!content.Status) throw new Exception(content.Message); if (taskDTO.TaskTyp == "CPC") { task.Dispatchertime = DateTime.Now; _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); } else { task.Dispatchertime = DateTime.Now; _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); } } catch (Exception ex) { task.TaskState = TaskStatusEnum.Exception.ObjToInt(); task.ExceptionMessage = ex.Message; } } if (newTasksOut1.Count > 0) { _taskService.UpdateData(newTasksOut1); } } } } #endregion #region åºåºæ¨éä»»å¡2线 { var newTasksOut2 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); var downTasksOut2 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5243").ToList(); Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5243"); IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); if (device != null) { OtherDevice otherDevice = (OtherDevice)device; short stationCurrentStatus = device.Communicator.Read<short>("DB29.126"); if (newTasksOut2.Count > 0 && downTasksOut2.Count <= 0 && stationCurrentStatus == 1) { foreach (var task in newTasksOut2) { try { if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) task.CurrentAddress = GetAGVAddress(task.CurrentAddress); else task.NextAddress = GetAGVAddress(task.NextAddress); AgvTaskDTO taskDTO = new AgvTaskDTO() { TaskCode = task.AgvTaskNum, ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", ctnrCode = task.PalletCode, PositionCodePath = new List<CodePath>() { new CodePath() { type = "05", positionCode = task.CurrentAddress }, new CodePath() { type = "05", positionCode = task.NextAddress } } }; if (taskDTO.TaskTyp == "CPC") { taskDTO.Priority = task.Grade.ToString(); } if (task.GroupId.IsNotEmptyOrNull()) { taskDTO.GroupId = task.GroupId; } if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) { taskDTO.Priority = "127"; } //åéAGVä»»å¡ WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); if (!content.Status) throw new Exception(content.Message); if (taskDTO.TaskTyp == "CPC") { task.Dispatchertime = DateTime.Now; _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); } else { task.Dispatchertime = DateTime.Now; _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); } } catch (Exception ex) { task.TaskState = TaskStatusEnum.Exception.ObjToInt(); task.ExceptionMessage = ex.Message; } } if (newTasksOut2.Count > 0) { _taskService.UpdateData(newTasksOut2); } } //else //{ // WriteInfo(nameof(AGV_CPJob), $"2线æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}"); //} } } #endregion #region åºåºæ¨éä»»å¡3线 { var newTasksOut3 = AllTasks.Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").OrderBy(x => x.Grade).ThenBy(x => x.GroupId).Take(5).ToList(); var downTasksOut3 = AllTasks.Where(x => (x.TaskState > TaskStatusEnum.New.ObjToInt()) && x.TaskType < TaskTypeEnum.Inbound.ObjToInt() && x.NextAddress == "5250").ToList(); Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.AGVStationCode == "5250"); IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); if (device != null) { OtherDevice otherDevice = (OtherDevice)device; short stationCurrentStatus = device.Communicator.Read<short>("DB29.140"); if (newTasksOut3.Count > 0 && downTasksOut3.Count <= 0 && stationCurrentStatus == 1) { foreach (var task in newTasksOut3) { try { if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) task.CurrentAddress = GetAGVAddress(task.CurrentAddress); else task.NextAddress = GetAGVAddress(task.NextAddress); AgvTaskDTO taskDTO = new AgvTaskDTO() { TaskCode = task.AgvTaskNum, ReqCode = DateTime.Now.ToString("yyMMdd") + task.AgvTaskNum, TaskTyp = task.TaskType < TaskTypeEnum.Inbound.ObjToInt() ? "CPC" : "CPR", ctnrCode = task.PalletCode, PositionCodePath = new List<CodePath>() { new CodePath() { type = "05", positionCode = task.CurrentAddress }, new CodePath() { type = "05", positionCode = task.NextAddress } } }; if (taskDTO.TaskTyp == "CPC") { taskDTO.Priority = task.Grade.ToString(); } if (task.GroupId.IsNotEmptyOrNull()) { taskDTO.GroupId = task.GroupId; } if (task.TaskType == TaskTypeEnum.OutMesRworkProduct.ObjToInt()) { taskDTO.Priority = "127"; } //åéAGVä»»å¡ WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); if (!content.Status) throw new Exception(content.Message); if (taskDTO.TaskTyp == "CPC") { task.Dispatchertime = DateTime.Now; _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); } else { task.Dispatchertime = DateTime.Now; _taskService.UpdateTask(task, TaskStatusEnum.AGV_Takeing); } } catch (Exception ex) { task.TaskState = TaskStatusEnum.Exception.ObjToInt(); task.ExceptionMessage = ex.Message; } } if (newTasksOut3.Count > 0) { _taskService.UpdateData(newTasksOut3); } } //else //{ // WriteInfo(nameof(AGV_CPJob), $"3线æ ä»»å¡ï¼ç¶æ{stationCurrentStatus}"); //} } } #endregion #region ç©ºæ¡æ¬è¿ { var newTasksLocations = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode) && x.Remark == "æµè¯ç©ºæ¡").ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); if (newTasksLocations.Count>0) { @@ -138,6 +399,8 @@ } } } #endregion } catch (Exception ex) { WriteError(nameof(AGV_CPJob), ex.Message, ex); ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/×躸²Ö/AGV_ZHExtend.cs
@@ -7,6 +7,7 @@ using WIDESEAWCS_Common.APIEnum; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_Core.Enums; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; @@ -176,6 +177,50 @@ } } _taskService.UpdateData(WaitToTasks); //åæ¾è´§å®æåå ¥å¼å¸¸å¤ç Dt_Task? TakeErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_TakeError.ObjToInt() && nameof(AGV_ZHJob).Contains(x.DeviceCode)).First(); if (TakeErroeTask != null) { Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == TakeErroeTask.CurrentAddress); if (stationManger == null) { throw new Exception($"æªæ¾å°ç«å°é ç½®"); } IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); if (device == null) { throw new Exception($"æªæ¾å°å¯¹åºè®¾å¤"); } OtherDevice otherDevice = (OtherDevice)device; otherDevice.SetValue(GroundStationDBName.W_TakeFinish, true, stationManger.StationCode); Thread.Sleep(1000); otherDevice.SetValue(GroundStationDBName.W_TakeFinish, false, stationManger.StationCode); TakeErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); var up = _taskRepository.DeleteAndMoveIntoHty(TakeErroeTask, OperateTypeEnum.èªå¨å®æ); _taskService.TaskCompleted(TakeErroeTask.TaskNum); } Dt_Task? PutErroeTask = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_PutError.ObjToInt() && nameof(AGV_ZHJob).Contains(x.DeviceCode)).First(); if (PutErroeTask != null) { Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == PutErroeTask.NextAddress); if (stationManger == null) { throw new Exception($"æªæ¾å°ç«å°é ç½®"); } IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); if (device == null) { throw new Exception($"æªæ¾å°ç«å°é ç½®"); } OtherDevice otherDevice = (OtherDevice)device; otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode); PutErroeTask.CurrentAddress = stationManger.StationCode; PutErroeTask.NextAddress = ""; PutErroeTask.TaskState = TaskStatusEnum.AGV_Finish.ObjToInt(); PutErroeTask.DeviceCode = "SC01_ZH"; var up = _taskRepository.UpdateData(PutErroeTask); } } catch (Exception ex) { ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/×躸²Ö/AGV_ZHJob.cs
@@ -13,6 +13,7 @@ using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_IBasicInfoRepository; using WIDESEAWCS_ITaskInfoRepository; using WIDESEAWCS_ITaskInfoService; using WIDESEAWCS_Model.Models; using WIDESEAWCS_QuartzJob; @@ -28,14 +29,16 @@ private readonly IRouterService _routerService; private readonly IStationMangerRepository _stationMangerRepository; private readonly IMapper _mapper; private readonly ITaskRepository _taskRepository; public AGV_ZHJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper) public AGV_ZHJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IStationMangerRepository stationMangerRepository, IMapper mapper, ITaskRepository taskRepository) { _taskService = taskService; _taskExecuteDetailService = taskExecuteDetailService; _routerService = routerService; _stationMangerRepository = stationMangerRepository; _mapper = mapper; _taskRepository = taskRepository; } public Task Execute(IJobExecutionContext context) { ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_CSJ.cs
@@ -74,11 +74,13 @@ int maxDepth = locationInfos.Max(x => x.Depth); if (beRelocation.Row <= maxDepth) { locationInfos = locationInfos.Where(x => x.Row <= maxDepth).ToList(); //è¿æ»¤å½åç§»åºçåååå± locationInfos = locationInfos.Where(x => x.Row <= maxDepth && x.Column!= beRelocation.Column && x.Layer!=beRelocation.Layer).ToList(); } else if (beRelocation.Row > maxDepth) { locationInfos = locationInfos.Where(x => x.Row > maxDepth).ToList(); //è¿æ»¤å½åç§»åºçåååå± locationInfos = locationInfos.Where(x => x.Row > maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList(); } } @@ -120,12 +122,14 @@ { continue; } if (locationInfoExist.LocationType>0) { Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) { continue; } } } else { @@ -306,10 +310,10 @@ else { List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ åµ moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ åµ List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå ¥çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæµ è´§ä½è¢«ä½¿ç¨æè 被ç¦ç¨çæ åµ littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå ¥çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæµ è´§ä½è¢«ä½¿ç¨æè 被ç¦ç¨çæ åµ } //if (moreDepthFlag && littleDepthFlag) //{ @@ -337,10 +341,10 @@ else { List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ åµ moreDepthFlag = moreDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.InStock.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null;//æ¥è¯¢å¤§äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºæè´§çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæ·±è´§ä½ææªè¢«ä½¿ç¨çæ åµ List<Dt_LocationInfo> littleDepth = locations.Where(x => x.Depth <= emptyLocation.Depth).ToList(); littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt()) && x.LocationType != emptyLocation.LocationType) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå ¥çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæµ è´§ä½è¢«ä½¿ç¨æè 被ç¦ç¨çæ åµ littleDepthFlag = littleDepth.FirstOrDefault(x => x.LocationStatus != LocationStatusEnum.Free.ObjToInt() && (x.EnableStatus == EnableStatusEnum.OnlyIn.ObjToInt() || x.EnableStatus == EnableStatusEnum.Normal.ObjToInt())) == null; //æ¥è¯¢å°äºå½åè´§ä½æ·±åº¦çéåéæ¯å¦æç¶æä¸ä¸ºç©ºï¼ä¸ç¦ç¨ç¶æä¸ä¸ºç¦ç¨ä»¥ååªå ¥çè´§ä½ï¼å¦ææ¯trueï¼åè¡¨ç¤ºæµ è´§ä½è¢«ä½¿ç¨æè 被ç¦ç¨çæ åµ } //List<Dt_LocationInfo> moreDepth = locations.Where(x => x.Depth > emptyLocation.Depth).ToList(); ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_GM.cs
@@ -221,15 +221,20 @@ { continue; } if (locationInfoExist.LocationType > 0) { Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) { continue; } } if (locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() || locationInfoExist.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) { continue; } } locationCaches_GM.Add(new LocationCache { LocationCode = locationInfo.LocationCode, DateTime = DateTime.Now }); return locationInfo; ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_PP.cs
@@ -56,14 +56,15 @@ throw new Exception($"æªæ¾å°è´§ä½ä¿¡æ¯"); } int maxDepth = locationInfos.Max(x => x.Depth); int mathCurrentRow = beRelocation.Row - Convert.ToInt32(Math.Ceiling(beRelocation.Row / maxDepth / 2.0)) * maxDepth * 2; if (mathCurrentRow <= maxDepth) if (beRelocation.Row <= maxDepth) { locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 <= maxDepth).ToList(); //è¿æ»¤å½åç§»åºçåååå± locationInfos = locationInfos.Where(x => x.Row <= maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList(); } else else if (beRelocation.Row > maxDepth) { locationInfos = locationInfos.Where(x => x.Row - Convert.ToInt32(Math.Ceiling(x.Row / maxDepth / 2.0)) * maxDepth * 2 > maxDepth).ToList(); //è¿æ»¤å½åç§»åºçåååå± locationInfos = locationInfos.Where(x => x.Row > maxDepth && x.Column != beRelocation.Column && x.Layer != beRelocation.Layer).ToList(); } } ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/AssignLocation/LocationInfoService_ZH.cs
@@ -114,10 +114,13 @@ { continue; } if (locationInfoExist.LocationType > 0) { Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) { continue; } } } else @@ -137,11 +140,14 @@ { continue; } if (locationInfoExist.LocationType > 0) { Dt_PalletTypeInfo palletTypeInfoDepth = _basicRepository.PalletTypeInfoRepository.QueryFirst(x => x.WarehouseId == locationInfoExist.WarehouseId && x.PalletType == locationInfoExist.LocationType); if (palletTypeInfoDepth != null && palletTypeInfoDepth.LocaitonCount != palletTypeInfo.LocaitonCount) { continue; } } if (locationInfoExist.LocationStatus != LocationStatusEnum.Free.ObjToInt() || locationInfoExist.EnableStatus != EnableStatusEnum.Normal.ObjToInt()) { continue; ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Service/LocationInfoService_Common.cs
@@ -465,10 +465,52 @@ for (int j = location.Depth + 1; j <= maxDepth; j++) { Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row + 1)); if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) #region æµè¯æ¶ãPP夿åç»è´§ä½ if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) { locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } } if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); } } if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } } if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } } #endregion if (locationInfo != null) { groupLocations.Add(locationInfo); @@ -478,10 +520,41 @@ for (int j = location.Depth - 1; j >= 1; j--) { Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == (row -1)); if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) #region æµè¯æ¶ãPP夿åç»è´§ä½ if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) { locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); } } if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } } if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } } #endregion if (locationInfo != null) { groupLocations.Add(locationInfo); @@ -505,10 +578,52 @@ for (int j = location.Depth + 1; j <= maxDepth; j++) { Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1)); if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) #region æµè¯æ¶ãPP夿åç»è´§ä½ if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) { locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } } if (j == 3 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); } } if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } } if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } } #endregion if (locationInfo != null) { groupLocations.Add(locationInfo); @@ -518,10 +633,41 @@ for (int j = location.Depth - 1; j >= 1; j--) { Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 1 || x.Row == row - 1)); if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 3 || row == 4)) #region æµè¯æ¶ãPP夿åç»è´§ä½ if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) { locationInfo = locationInfos.FirstOrDefault(x => x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && (x.Row == row + 2 || x.Row == row - 2)); if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 2); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 2); } } if (j == 1 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 2 || row == 5)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } } if (j == 2 && (location.RoadwayNo.Contains("CSJ") || location.RoadwayNo.Contains("PP")) && (row == 1 || row == 6)) { if (row <= maxDepth) { locationInfo = locationInfos.FirstOrDefault(x => x.Row <= maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row + 1); } else { locationInfo = locationInfos.FirstOrDefault(x => x.Row > maxDepth && x.Depth == j && x.Column == location.Column && x.Layer == location.Layer && x.Row == row - 1); } } #endregion if (locationInfo != null) { groupLocations.Add(locationInfo); ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Inbound/ProInStaticDTO.cs
@@ -11,8 +11,21 @@ /// </summary> public class ProInStaticDTO { /// <summary> /// 产åç¼ç /// </summary> public string ProductCode { get; set; } /// <summary> /// 产åçæ¬ /// </summary> public string ProductVersion { get; set; } /// <summary> /// æ»PCSæ° /// </summary> public float SumPcs { get; set; } /// <summary> /// æ»é¢ç§¯ /// </summary> public float SumPcsArea { get; set; } } } ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/MES/MesBagInfoModel.cs
@@ -76,6 +76,10 @@ /// </summary> public float OKPCSQTY { get; set; } /// <summary> /// å å æ»é¢ç§¯ /// </summary> public float OKPCSArea { get; set; } /// <summary> /// 卿 /// </summary> public string DateCode { get; set; } ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -1813,6 +1813,10 @@ } return palletTypeInfo.PalletType; } else if (warehouse.WarehouseCode == WarehouseEnum.HA60.ObjToString()) { return 4; } return -1; } /// <summary> ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/ProInStatisticsService.cs
@@ -30,33 +30,29 @@ _invokeERPService = invokeERPService; _basicRepository = basicRepository; } /// <summary> /// ä¿åæ°æ® /// </summary> public void SaveStatic(MesBagInfoModel mesBagInfoModel) { List<ProInStaticDTO> mESBagDetails = mesBagInfoModel.BagDetails.GroupBy(x=>new { x.ProductCode, x.ProductVersion }).Select(x=>new ProInStaticDTO { ProductCode= x.Key.ProductCode, ProductVersion= x.Key.ProductVersion, SumPcs=x.Sum(x => x.OKPCSQTY) SumPcs = x.Sum(x => x.OKPCSQTY), SumPcsArea = x.Sum(x=>x.OKPCSArea) }).ToList(); List<Dt_ProInStatistics> proInStatistics= new List<Dt_ProInStatistics>(); Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==mesBagInfoModel.WarehouseCode); foreach (var m in mESBagDetails) { string response = _invokeERPService.InvokeProInErpStatic(m.ProductCode, m.ProductCode + m.ProductVersion); ErpProInErpStaticResponseContent erpProInErpStatic = response.DeserializeObject<ErpProInErpStaticResponseContent>(); if (erpProInErpStatic.Code != 200) { return; } float adjusted = (float)Math.Round(erpProInErpStatic.Data[0].UnitArea, 3); Dt_ProInStatistics inStatistics = new Dt_ProInStatistics() { WarehouseId = warehouse.WarehouseId, ProductCode = m.ProductCode, ProductRev = m.ProductVersion, PcsQty = m.SumPcs, SquareMeter = (float)Math.Round((adjusted * m.SumPcs), 3), SquareMeter = (float)Math.Round(m.SumPcsArea, 3), Remark = mesBagInfoModel.BatchNo }; proInStatistics.Add(inStatistics); ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs
@@ -285,39 +285,39 @@ _takeStockOrderDetailRepository.UpdateData(takeStockOrderDetail); BaseDal.UpdateData(takeStockOrder); //æäº¤ERPé»è¾ //if (takeStockOrder.TakeStockStatus== TakeStockStatusEnum.çç¹å®æ.ObjToInt()) //{ // ERPTakeStockModel eRPTakeStock = new ERPTakeStockModel() // { // Way = 1, // UniqueTag = takeStockOrder.Id.ToString(), // Code = takeStockOrder.OrderNo, // FiscalPeriotime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd"), // Name=takeStockOrder.OrderNo, // WarehouseCode= warehouse.WarehouseCode, // Createuser=takeStockOrder.Creater, // Createtime= takeStockOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), // Details=new List<TakeDetailsItem>() // }; // foreach (var item in takeStockOrderDetails) // { // TakeDetailsItem takeDetailsItem = new TakeDetailsItem() // { // MaterialsCode=item.MaterielCode, // LocationCode=item.LocationCode, // Lotno=item.BatchNo, // Sysqty=item.SysQty.ObjToDecimal(), // Qty=item.Qty.ObjToDecimal() // }; // eRPTakeStock.Details.Add(takeDetailsItem); // } // string response = _invokeERPService.InvokeTakeStockApi(eRPTakeStock); // ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>(); // if (erpRequestContent.res != 1) // { // throw new Exception("忥ERP失败,é误信æ¯:" + erpRequestContent.Data); // } //} if (takeStockOrder.TakeStockStatus == TakeStockStatusEnum.çç¹å®æ.ObjToInt()) { ERPTakeStockModel eRPTakeStock = new ERPTakeStockModel() { Way = 1, UniqueTag = takeStockOrder.Id.ToString(), Code = takeStockOrder.OrderNo, FiscalPeriotime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd"), Name = takeStockOrder.OrderNo, WarehouseCode = warehouse.WarehouseCode, Createuser = takeStockOrder.Creater, Createtime = takeStockOrder.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"), Details = new List<TakeDetailsItem>() }; foreach (var item in takeStockOrderDetails) { TakeDetailsItem takeDetailsItem = new TakeDetailsItem() { MaterialsCode = item.MaterielCode, LocationCode = item.LocationCode, Lotno = item.BatchNo, Sysqty = item.SysQty.ObjToDecimal(), Qty = item.Qty.ObjToDecimal() }; eRPTakeStock.Details.Add(takeDetailsItem); } string response = _invokeERPService.InvokeTakeStockApi(eRPTakeStock); ErpRequestContent erpRequestContent = response.DeserializeObject<ErpRequestContent>(); if (erpRequestContent.res != 1) { throw new Exception("忥ERP失败,é误信æ¯:" + erpRequestContent.Data); } } _unitOfWorkManage.CommitTran(); content.OK("çç¹æå"); } ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs
@@ -525,6 +525,7 @@ /// <returns></returns> public MesResponseContent SubstrateOut(SubstrateOutModel model) { MesResponseContent content = new MesResponseContent(); try { string line = string.Empty; @@ -539,15 +540,15 @@ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == line); if (warehouse == null) { return MesResponseContent.Instance.Error($"ä»åºåºç¡ä¿¡æ¯æªé ç½®"); return content.Error($"ä»åºåºç¡ä¿¡æ¯æªé ç½®"); } Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == model.MaterialCode); if (materielInfo == null) { return MesResponseContent.Instance.Error($"æªæ¾å°è¯¥ç©æä¿¡æ¯"); return content.Error($"æªæ¾å°è¯¥ç©æä¿¡æ¯"); } //çæMESæ¿æåºåºåæ® Dt_MesOutboundOrder mesOutboundOrder = new Dt_MesOutboundOrder() { CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), @@ -563,7 +564,6 @@ }; List<Dt_Task> tasks = new List<Dt_Task>(); List<Dt_StockInfo>? stockInfos = null; List<Dt_OutStockLockInfo>? outStockLockInfos = null; List<Dt_LocationInfo>? locationInfos = null; @@ -606,23 +606,26 @@ _outboundService.MesOutboundOrderService.Repository.AddData(mesOutboundOrder); if (stockInfos != null && stockInfos.Count > 0 && outStockLockInfos != null && outStockLockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) { WebResponseContent content = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); WebResponseContent contentResponse = _outboundService.MesOutboundOrderService.LockOutboundStockDataUpdate(stockInfos, outStockLockInfos, locationInfos, tasks: tasks); if (!content.Status) if (!contentResponse.Status) { _unitOfWorkManage.RollbackTran(); return MesResponseContent.Instance.Error(content.Message); return content.Error(contentResponse.Message); } } _unitOfWorkManage.CommitTran(); PushTasksToWCS(tasks); return MesResponseContent.Instance.OK(); //å°å¼æåé çåºåæçè¿åç»MES content.Content = new { VehicleCode = stockInfos?.Select(x => x.PalletCode).ToList() }; return content.OK(); } catch (Exception ex) { return MesResponseContent.Instance.Error(ex.Message); return content.Error(ex.Message); } } ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs
@@ -853,7 +853,7 @@ WebResponseContent content = new WebResponseContent(); try { //è·åæµè¯æ¶ååºåä¿¡æ¯ //è·åé»çåºåä¿¡æ¯ Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); //è·ååºåè®°å½ List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => @@ -872,21 +872,21 @@ { return content.Error($"æçç±»åä¿¡æ¯ä¸åå¨"); } ////è·åé»çæ¹æ¬¡ //WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); //if (!requestLotInfo.Status) //{ // return content.Error($"请æ±é»çæ¹æ¬¡ä¿¡æ¯å¤±è´¥,{requestLotInfo.Message}"); //} //MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); MesLotInfoModel mesLotInfo = new MesLotInfoModel() //è·åé»çæ¹æ¬¡ WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); if (!requestLotInfo.Status) { Product="FH001", ProductVersion="A1", Qty=20, LotNo= materialLot, IsFullNumber=true }; return content.Error($"请æ±é»çæ¹æ¬¡ä¿¡æ¯å¤±è´¥,{requestLotInfo.Message}"); } MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); //MesLotInfoModel mesLotInfo = new MesLotInfoModel() //{ // Product="FH001", // ProductVersion="A1", // Qty=20, // LotNo= materialLot, // IsFullNumber=true //}; Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() { MaterielSpec = mesLotInfo.ProductVersion, ´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/MES/MesController.cs
@@ -197,7 +197,7 @@ return _taskService.BoxStockin(model.Content); } /// <summary> /// MESæååºåºæ¥å£è°ç¨ /// MWMS忥æååºåºä¿¡æ¯è³MES /// </summary> /// <returns></returns> [HttpPost, Route("ShipmentOrderSync"), AllowAnonymous] @@ -206,7 +206,7 @@ return _taskService.ShipmentOrderSync(model); } /// <summary> /// MESæååºåºæ¥å£è°ç¨ /// WMS忥æååºåºä¿¡æ¯è³MESå¤å è£ æº /// </summary> /// <returns></returns> [HttpPost, Route("ShipmentOrderMESSync"), AllowAnonymous]