´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs
@@ -40,10 +40,19 @@ /// </summary> /// <param name="AreaCode"></param> /// <returns></returns> public Dt_RGVLocationInfo GetInFreeLocationInfo(string AreaCode) public Dt_RGVLocationInfo? GetInFreeLocationInfo(string AreaCode) { Dt_RGVLocationInfo? rGVLocationInfo = BaseDal.QueryFirst(x => x.WarehouseId.ToString() == AreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy); Dt_RGVLocationInfo? rGVLocationInfo = null; List<Dt_RGVLocationInfo> rGVLocationInfos = BaseDal.QueryData(x => x.WarehouseId.ToString() == AreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy); if (rGVLocationInfos == null || rGVLocationInfos.Count < 1) return rGVLocationInfo; #region å¤æå··éæ¯å¦æè´§ List<string> LocationCodes = new List<string>(); foreach (var item in rGVLocationInfos) { Dt_RGVLocationInfo dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == item.RoadwayNo && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _emptyAssignOrderBy); if (dt_RGVLocationInfo == null) return dt_RGVLocationInfo; dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == item.RoadwayNo && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.Depth > item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _DepthAscOrderBy); } if (rGVLocationInfo != null) { List<string> NoRoadwayNos = new List<string>(); ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs
@@ -23,6 +23,7 @@ /// <returns></returns> public WebResponseContent CreateKLSNewInTask(TaskDTO taskDTO, int taskType) { WebResponseContent content = new WebResponseContent(); try { int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt(); @@ -45,16 +46,33 @@ Creater = "WMS", }; kLSLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); Db.Ado.BeginTran(); BaseDal.AddData(dt_Task); _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo); Db.Ado.CommitTran(); return WebResponseContent.Instance.OK(); try { Db.Ado.BeginTran(); BaseDal.AddData(dt_Task); _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo); Db.Ado.CommitTran(); } catch (Exception ex) { Db.Ado.RollbackTran(); throw new Exception(ex.Message); } return content.OK(data: new { taskCode = taskDTO.taskCode, Message = "æåï¼" }); } catch (Exception ex) { Db.Ado.RollbackTran(); throw new Exception(ex.Message); content.Data = new { taskCode = taskDTO.taskCode, Message = $"失败ï¼{ex.Message}" }; return content.Error(ex.Message); } } /// <summary> @@ -65,6 +83,7 @@ /// <returns></returns> public WebResponseContent CreateKLSNewOutTask(TaskDTO taskDTO, int taskType) { WebResponseContent content = new WebResponseContent(); try { Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); @@ -86,16 +105,32 @@ Creater = "WMS", }; kLSLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt(); Db.Ado.BeginTran(); BaseDal.AddData(dt_Task); _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo); Db.Ado.CommitTran(); return WebResponseContent.Instance.OK(); try { Db.Ado.BeginTran(); BaseDal.AddData(dt_Task); _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo); Db.Ado.CommitTran(); } catch (Exception ex) { Db.Ado.RollbackTran(); throw new Exception(ex.Message); } return content.OK(data: new { taskCode = taskDTO.taskCode, Message = "æåï¼" }); } catch (Exception ex) { Db.Ado.RollbackTran(); throw new Exception(ex.Message); content.Data = new { taskCode = taskDTO.taskCode, Message = $"失败ï¼{ex.Message}" }; return content.Error(ex.Message); } } #endregion ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs
@@ -10,6 +10,10 @@ using WIDESEAWCS_DTO.WMS; using WIDESEAWCS_Model.Models; using WIDESEAWCS_Core.Helper; using HslCommunication.Core.IMessage; using WIDESEAWCS_DTO.RGV.FOURBOT; using Newtonsoft.Json; using System.Reflection.Metadata; namespace WIDESEAWCS_TaskInfoService { @@ -24,19 +28,14 @@ /// <returns></returns> public WebResponseContent CreateRGVNewInTask(TaskDTO taskDTO, int taskType) { WebResponseContent content = new WebResponseContent(); try { //List<Dt_RGVLocationInfo>? rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData(x => x.WarehouseId.ToString() == taskDTO.toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt()); //if (rGVLocationInfos.Count < 1) throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); //var rGVLocationInfo = rGVLocationInfos.OrderBy(x => x.Depth).First(); //var rGVLocationInfo = _rGVLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode) ?? throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); Dt_StationManger stationManger = _stationMangerService.GetInStationInfo(taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹ä½ç½®ã{taskDTO.fromLocationCode}ãç«å°ä¿¡æ¯ï¼"); //if (stationManger.IsOccupied == 1) throw new Exception($"èµ·ç¹ä½ç½®ã{taskDTO.fromLocationCode}ãç«å°è¢«å ç¨ï¼è¯·éæ¾ï¼"); Dt_Task dt_Task = new() { TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), WMSTaskNum = taskDTO.taskCode, //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), Grade = taskDTO.taskPriority, PalletCode = taskDTO.containerCode, Roadway = taskDTO.toAreaCode, @@ -44,22 +43,25 @@ TaskType = taskType, SourceAddress = taskDTO.fromLocationCode, CurrentAddress = taskDTO.fromLocationCode, NextAddress = stationManger.RGVStationCode,//æ¾å ¥åºç«å°å¯¹åºçå¤å½¢æ£æµç¼å· NextAddress = stationManger.RGVStationCode, TargetAddress = "", //Remark = taskDTO.toAreaCode, Creater = "WMS", }; //rGVLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); //Db.Ado.BeginTran(); BaseDal.AddData(dt_Task); //_rGVLocationInfoService.Repository.UpdateData(rGVLocationInfo); //Db.Ado.CommitTran(); return WebResponseContent.Instance.OK(); return content.OK(data: new { taskCode = taskDTO.taskCode, Message = "æåï¼" }); } catch (Exception ex) { //Db.Ado.RollbackTran(); throw new Exception(ex.Message); content.Data = new { taskCode = taskDTO.taskCode, Message = $"失败ï¼{ex.Message}" }; return content.Error(ex.Message); } } /// <summary> @@ -70,17 +72,15 @@ /// <returns></returns> public WebResponseContent CreateRGVNewOutTask(TaskDTO taskDTO, int taskType) { WebResponseContent content = new WebResponseContent(); try { //Dt_Task dt_Task = BaseDal.QueryFirst(x => x.PalletCode == taskDTO.containerCode); //if (dt_Task != null) throw new Exception($"æçå·ã{taskDTO.containerCode}ãå·²åå¨ä»»å¡"); Dt_RGVLocationInfo rGVLocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); if (rGVLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); Dt_Task dt_Task = new() { TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), WMSTaskNum = taskDTO.taskCode, //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), Grade = taskDTO.taskPriority, PalletCode = taskDTO.containerCode, Roadway = rGVLocationInfo.RoadwayNo, @@ -105,11 +105,20 @@ Db.Ado.RollbackTran(); throw new Exception(ex.Message); } return WebResponseContent.Instance.OK(); return content.OK(data: new { taskCode = taskDTO.taskCode, Message = "æåï¼" }); } catch (Exception ex) { throw new Exception(ex.Message); content.Data = new { taskCode = taskDTO.taskCode, Message = $"失败ï¼{ex.Message}" }; return content.Error(ex.Message); } } #endregion ´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -89,49 +89,99 @@ WebResponseContent content = new WebResponseContent(); try { List<object> objects = new List<object>(); foreach (var item in taskDTOs) { foreach (var task in item.tasks) { #region 夿 content = TaskHelpMethods.isOkTaskInfo(task, true, true); if (!content.Status) throw new Exception(content.Message); if (!content.Status) { objects.Add(new { taskCode = task.taskCode, Message = $"ä»»å¡å·ã{task.taskCode}ã{content.Message}" }); continue; //throw new Exception(content.Message); } if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode) != null) throw new Exception($"ä»»å¡å·ã{task.taskCode}ãå·²åå¨ä»»å¡"); { objects.Add(new { taskCode = task.taskCode, Message = $"ä»»å¡å·ã{task.taskCode}ãå·²åå¨ä»»å¡" }); continue; //throw new Exception($"ä»»å¡å·ã{task.taskCode}ãå·²åå¨ä»»å¡"); } if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode) != null) throw new Exception($"æçå·ã{task.containerCode}ãå·²åå¨ä»»å¡"); { objects.Add(new { taskCode = task.taskCode, Message = $"æçå·ã{task.containerCode}ãå·²åå¨ä»»å¡" }); continue; //throw new Exception($"æçå·ã{task.containerCode}ãå·²åå¨ä»»å¡"); } if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode) != null) throw new Exception($"èµ·ç¹ä½ç½®ã{task.containerCode}ãå·²åå¨ä»»å¡"); { objects.Add(new { taskCode = task.taskCode, Message = $"èµ·ç¹ä½ç½®ã{task.containerCode}ãå·²åå¨ä»»å¡" }); continue; //throw new Exception($"èµ·ç¹ä½ç½®ã{task.containerCode}ãå·²åå¨ä»»å¡"); } #endregion switch (item.taskType) { case (int)TaskTypeEnum.MLInbound: CreateKLSNewInTask(task, item.taskType); content = CreateKLSNewInTask(task, item.taskType); objects.Add(content.Data); break; case (int)TaskTypeEnum.MLOutbound: CreateKLSNewOutTask(task, item.taskType); content = CreateKLSNewOutTask(task, item.taskType); objects.Add(content.Data); break; case (int)TaskTypeEnum.CPInbound: CreateRGVNewInTask(task, item.taskType); content= CreateRGVNewInTask(task, item.taskType); objects.Add(content.Data); break; case (int)TaskTypeEnum.CPOutbound: CreateRGVNewOutTask(task, item.taskType); content= CreateRGVNewOutTask(task, item.taskType); objects.Add(content.Data); break; case (int)TaskTypeEnum.CJInbound: CreateHKNewInTask(task, item.taskType); content = CreateHKNewInTask(task, item.taskType); objects.Add(content.Data); break; case (int)TaskTypeEnum.CJOutbound: CreateHKNewOutTask(task, item.taskType); content = CreateHKNewOutTask(task, item.taskType); objects.Add(content.Data); break; case (int)TaskTypeEnum.Carry: CarryTask(task, item.taskType); content = CarryTask(task, item.taskType); objects.Add(content.Data); break; case (int)TaskTypeEnum.CJCarry: CJCarryTaske(task, item.taskType); content = CJCarryTaske(task, item.taskType); objects.Add(content.Data); break; default: objects.Add(new { taskCode = task.taskCode, Message = $"æªå®ä¹çä»»å¡ç±»å" }); break; } } } content.Data = objects; } catch (Exception ex) {