| | |
| | | using System; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | |
| | | public RGVLocationInfoService(IRepository<Dt_RGVLocationInfo> BaseDal) : base(BaseDal) |
| | | { |
| | | } |
| | | |
| | | private Dictionary<string, OrderByType> _emptyAssignOrderBy = new Dictionary<string, OrderByType>() |
| | | { |
| | | { nameof(Dt_RGVLocationInfo.Depth), OrderByType.Desc }, |
| | | { nameof(Dt_RGVLocationInfo.Layer), OrderByType.Asc }, |
| | | //{ nameof(Dt_RGVLocationInfo.Column), OrderByType.Asc }, |
| | | { nameof(Dt_RGVLocationInfo.Row), OrderByType.Asc }, |
| | | }; |
| | | public IRepository<Dt_RGVLocationInfo> Repository => BaseDal; |
| | | |
| | | public Dt_RGVLocationInfo GetFreeLocationInfo(string AreaCode) |
| | | { |
| | | Dt_RGVLocationInfo? rGVLocationInfo = BaseDal.QueryFirst(x => x.WarehouseId.ToString() == AreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy); |
| | | return rGVLocationInfo; |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | |
| | | } |
| | | |
| | | public IRepository<Dt_StationManger> Repository => BaseDal; |
| | | |
| | | public Dt_StationManger GetInStationInfo(string fromLocationCode) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.StationCode == fromLocationCode && x.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt()); |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_Common |
| | | { |
| | | public enum StationTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// å
¥åºç«å° |
| | | /// </summary> |
| | | StationType_OnlyInbound = 1, |
| | | |
| | | /// <summary> |
| | | /// åºåºç«å° |
| | | /// </summary> |
| | | StationType_OnlyOutbound = 2, |
| | | |
| | | /// <summary> |
| | | /// åºå
¥åºç«å° |
| | | /// </summary> |
| | | StationType_InboundAndOutbound = 3, |
| | | |
| | | /// <summary> |
| | | /// åºå
¥åºå£ |
| | | /// </summary> |
| | | StationType_InStartAndOutEnd = 33, |
| | | /// <summary> |
| | | /// æåèªå¨åç«å° |
| | | /// </summary> |
| | | StationType_ProductBackTake = 95, |
| | | /// <summary> |
| | | /// æåèªå¨è¡¥æ¡ |
| | | /// </summary> |
| | | StationType_ProductBack = 98, |
| | | /// <summary> |
| | | /// ç çæºç«å° |
| | | /// </summary> |
| | | StationType_PakcPallet = 99, |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | [Description("æ°å»ºä»»å¡")] |
| | | New, |
| | | ///// <summary> |
| | | ///// å¾
æ§è¡ |
| | | ///// </summary> |
| | | /// <summary> |
| | | /// å¾
æ§è¡ |
| | | /// </summary> |
| | | [Description("å¾
æ§è¡")] |
| | | Execut, |
| | | ///// <summary> |
| | | ///// åè´§ä¸ |
| | | ///// </summary> |
| | | /// <summary> |
| | | /// åè´§ä¸ |
| | | /// </summary> |
| | | [Description("åè´§ä¸")] |
| | | Takeing, |
| | | /// <summary> |
| | |
| | | [Description("å¤å½¢æ£æµä¸")] |
| | | CheckShapeing, |
| | | /// <summary> |
| | | /// å¤å½¢æ£æµæå |
| | | /// </summary> |
| | | [Description("å¤å½¢æ£æµæå")] |
| | | CheckShapeingOk, |
| | | /// <summary> |
| | | /// å¤å½¢æ£æµå¤±è´¥ |
| | | /// </summary> |
| | | [Description("å¤å½¢æ£æµå¤±è´¥")] |
| | | CheckShapeingNG, |
| | | /// <summary> |
| | | /// æçå·ç¡®è®¤ä¸ |
| | | /// </summary> |
| | | [Description("æçå·ç¡®è®¤ä¸")] |
| | |
| | | /// <summary> |
| | | /// ä¼å
级 |
| | | /// </summary> |
| | | public int priority { get; set; } = 3; |
| | | public int priority { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¬è¿ç±»å |
| | |
| | | /// <summary> |
| | | /// ååºæ°æ® |
| | | /// </summary> |
| | | public object data { get; set; } |
| | | public FOURBOTnewMovePodTaskResponseData data { get; set; } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | public interface IRGVLocationInfoService : IService<Dt_RGVLocationInfo> |
| | | { |
| | | public IRepository<Dt_RGVLocationInfo> Repository { get; } |
| | | /// <summary> |
| | | /// è·åå¯ç¨ç©ºè´§ä½ |
| | | /// </summary> |
| | | /// <param name="AreaCode"></param> |
| | | /// <param name="containerType"></param> |
| | | /// <returns></returns> |
| | | Dt_RGVLocationInfo GetFreeLocationInfo(string AreaCode); |
| | | } |
| | | } |
| | |
| | | public interface IStationMangerService : IService<Dt_StationManger> |
| | | { |
| | | public IRepository<Dt_StationManger> Repository { get; } |
| | | /// <summary> |
| | | /// è·åå
¥åºç«å° |
| | | /// </summary> |
| | | /// <param name="fromLocationCode"></param> |
| | | /// <returns></returns> |
| | | Dt_StationManger GetInStationInfo(string fromLocationCode); |
| | | } |
| | | } |
| | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "ç«å°æ¯å¦å¯ç¨")] |
| | | public int IsOccupied { get; set; } |
| | | /// <summary> |
| | | /// 夿³¨ |
| | | /// 夿³¨(å¤å½¢æ£æµç¹ID) |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "夿³¨")] |
| | | public string Remark { get; set; } |
| | |
| | | public int Grade { get; set; } |
| | | |
| | | /// <summary> |
| | | /// WMSä»»å¡ä¸»é® |
| | | /// åå车任å¡ID |
| | | /// </summary> |
| | | [ImporterHeader(Name = "WMSä»»å¡ä¸»é®")] |
| | | [ExporterHeader(DisplayName = "WMSä»»å¡ä¸»é®")] |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "WMSä»»å¡ä¸»é®")] |
| | | public int WMSId { get; set; } |
| | | [ImporterHeader(Name = "åå车任å¡ID")] |
| | | [ExporterHeader(DisplayName = "åå车任å¡ID")] |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "åå车任å¡ID")] |
| | | public int RGVTaskId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡ä¸åæ¶é´ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_Core.Helper; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | |
| | | #region 海康AGVä»»å¡å建 |
| | | /// <summary> |
| | | /// å建海康AGVå
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateHKNewInTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | try |
| | | { |
| | | int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt();//è¿éæä¸ç¥éæ¯ä»ä¹ç±»å |
| | | //è·åè´§ä½ä¿¡æ¯ |
| | | Dt_HKLocationInfo? kLSLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.WarehouseId.ToString() == taskDTO.toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == containerType); |
| | | if (kLSLocationInfo == null) throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); |
| | | Dt_Task dt_Task = new Dt_Task() |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | WMSTaskNum = taskDTO.taskCode, |
| | | //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = kLSLocationInfo.RoadwayNo, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = kLSLocationInfo.LocationCode, |
| | | TargetAddress = kLSLocationInfo.LocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | kLSLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.AddData(dt_Task); |
| | | _hKLocationInfoService.Repository.UpdateData(kLSLocationInfo); |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// å建海康AGVåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateHKNewOutTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | try |
| | | { |
| | | Dt_HKLocationInfo? hKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode); |
| | | if (hKLocationInfo == null) throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | if (hKLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | Dt_Task dt_Task = new Dt_Task() |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | WMSTaskNum = taskDTO.taskCode, |
| | | //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = hKLocationInfo.RoadwayNo, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | hKLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt(); |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.AddData(dt_Task); |
| | | _hKLocationInfoService.Repository.UpdateData(hKLocationInfo); |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | WMSTaskNum = taskDTO.taskCode, |
| | | WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | //WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = kLSLocationInfo.RoadwayNo, |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region RGVä»»å¡å建 |
| | | /// <summary> |
| | | /// å建åå车å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateRGVNewInTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | 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(); |
| | | Dt_Task dt_Task = new Dt_Task() |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | WMSTaskNum = taskDTO.taskCode, |
| | | WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = rGVLocationInfo.RoadwayNo, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = rGVLocationInfo.LocationCode,//æ¾å
¥åºç«å°å¯¹åºçå¤å½¢æ£æµç¼å· |
| | | TargetAddress = rGVLocationInfo.LocationCode, |
| | | 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(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// å建åå车åºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateRGVNewOutTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | | |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 海康AGVä»»å¡å建 |
| | | /// <summary> |
| | | /// å建海康AGVå
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateHKNewInTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | try |
| | | { |
| | | int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt();//è¿éæä¸ç¥éæ¯ä»ä¹ç±»å |
| | | //è·åè´§ä½ä¿¡æ¯ |
| | | Dt_HKLocationInfo? kLSLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.WarehouseId.ToString() == taskDTO.toAreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt() && x.LocationType == containerType); |
| | | if (kLSLocationInfo == null) throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); |
| | | Dt_Task dt_Task = new Dt_Task() |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | WMSTaskNum = taskDTO.taskCode, |
| | | WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = kLSLocationInfo.RoadwayNo, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = kLSLocationInfo.LocationCode, |
| | | TargetAddress = kLSLocationInfo.LocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | kLSLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.AddData(dt_Task); |
| | | _hKLocationInfoService.Repository.UpdateData(kLSLocationInfo); |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// å建海康AGVåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateHKNewOutTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | try |
| | | { |
| | | Dt_HKLocationInfo? hKLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode); |
| | | if (hKLocationInfo == null) throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | if (hKLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | Dt_Task dt_Task = new Dt_Task() |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | WMSTaskNum = taskDTO.taskCode, |
| | | WMSId = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = hKLocationInfo.RoadwayNo, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | hKLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt(); |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.AddData(dt_Task); |
| | | _hKLocationInfoService.Repository.UpdateData(hKLocationInfo); |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 5 跨楼å±è¿è¾ä»»å¡å建 |
| | | public WebResponseContent CarryTask(TaskDTO taskDTO, int taskType) |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_Core.Helper; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | | { |
| | | public partial class TaskService |
| | | { |
| | | #region RGVä»»å¡å建 |
| | | /// <summary> |
| | | /// å建åå车å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateRGVNewInTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | 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, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = stationManger.Remark,//æ¾å
¥åºç«å°å¯¹åºçå¤å½¢æ£æµç¼å· |
| | | 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(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// å建åå车åºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateRGVNewOutTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | | |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | private readonly IRGVLocationInfoService _rGVLocationInfoService; |
| | | private readonly IRepository<Dt_TaskExecuteDetail> _taskExecuteDetailRepository; |
| | | private readonly IApiInfoService _apiInfoService; |
| | | private readonly IStationMangerService _stationMangerService; |
| | | private readonly IMapper _mapper; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | public partial class TaskJob |
| | | { |
| | | #region ä¸å海康AGVä»»å¡ |
| | | public void SendHIKROBOTTask(List<Dt_Task> tasks) |
| | | { |
| | | |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | public partial class TaskJob |
| | | { |
| | | |
| | | #region ä¸åå¯ä¹å£«AGVä»»å¡ |
| | | public void SendGALAXISTask(List<Dt_Task> tasks) |
| | | { |
| | | GALAXISTaskInfo gALAXISTaskInfo = new(); |
| | | try |
| | | { |
| | | gALAXISTaskInfo.groupId = DateTime.Now.ToString("yyMMddHHmmss"); |
| | | gALAXISTaskInfo.msgTime = DateTime.Now.ToString(); |
| | | gALAXISTaskInfo.tasks = new List<GALAXISTask>(); |
| | | foreach (var task in tasks) |
| | | { |
| | | GALAXISTask gALAXISTask = new GALAXISTask() |
| | | { |
| | | taskId = task.WMSTaskNum, |
| | | taskType = task.TaskType == (int)TaskTypeEnum.MLInbound ? 0 : 1, |
| | | barCode = task.PalletCode, |
| | | endNode = task.TargetAddress, |
| | | startNode = task.SourceAddress, |
| | | priorityCode = task.Grade |
| | | }; |
| | | gALAXISTaskInfo.tasks.Add(gALAXISTask); |
| | | } |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(GALAXISTaskInfo)) ?? throw new Exception("æªæ¾å°å¯ä¹å£«AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, gALAXISTaskInfo.Serialize()); |
| | | GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | if (agvContent.success) |
| | | { |
| | | if (agvContent.data.returnStatus != 0) throw new Exception(agvContent.data.returnInfo); |
| | | tasks.ForEach(task => |
| | | { |
| | | task.TaskState = (int)TaskStatusEnum.Execut; |
| | | }); |
| | | _taskService.UpdateData(tasks); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(TaskJob), ex.Message, ex); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_DTO.RGV.FOURBOT; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | | public partial class TaskJob |
| | | { |
| | | |
| | | #region ä¸åååè½¦ä»»å¡ |
| | | public void SendRGVTask(List<Dt_Task> tasks) |
| | | { |
| | | FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new(); |
| | | try |
| | | { |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("æªæ¾å°åå车任å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | #region å
¥åº |
| | | var intasks = tasks.Where(x => x.TaskType == (int)TaskTypeEnum.CPInbound).ToList(); |
| | | foreach (var item in intasks) |
| | | { |
| | | fOURBOTnewMovePodTask.priority = item.Grade; |
| | | fOURBOTnewMovePodTask.podID = item.PalletCode; |
| | | fOURBOTnewMovePodTask.destination = item.NextAddress; |
| | | fOURBOTnewMovePodTask.desExt = new |
| | | { |
| | | unload = 0//æ¯å¦æ¾ä¸å®¹å¨,0å¦1æ¯ |
| | | }; |
| | | fOURBOTnewMovePodTask.desType = 2; |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn.returnCode == 0) |
| | | { |
| | | item.RGVTaskId = fOURBOTReturn.data.taskID; |
| | | item.TaskState = (int)TaskStatusEnum.Execut; |
| | | } |
| | | } |
| | | _taskService.UpdateData(intasks); |
| | | #endregion |
| | | |
| | | #region åºåº |
| | | var outtasks = tasks.Where(x => x.TaskType == (int)TaskTypeEnum.CPOutbound).ToList(); |
| | | foreach (var item in outtasks) |
| | | { |
| | | ///夿æ¯å¦éè¦ç§»åº |
| | | } |
| | | #endregion |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(TaskJob), ex.Message, ex); |
| | | } |
| | | } |
| | | #endregion |
| | | /// <summary> |
| | | /// ä¸åå¤å½¢æ£æµæåä»»å¡ |
| | | /// </summary> |
| | | /// <param name="tasks"></param> |
| | | public void SendCheckShapeingOkTask(List<Dt_Task> tasks) |
| | | { |
| | | FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new(); |
| | | try |
| | | { |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("æªæ¾å°åå车任å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | List<Dt_RGVLocationInfo> rGVLocationInfos = new List<Dt_RGVLocationInfo>(); |
| | | foreach (var item in tasks) |
| | | { |
| | | #region è·åè´§ä½ |
| | | var rGVLocationInfo = _rGVLocationInfoService.GetFreeLocationInfo(item.Roadway); |
| | | if (rGVLocationInfo == null) |
| | | { |
| | | item.ExceptionMessage = $"æªæ¾å°ç»ç¹åºåºã{item.Roadway}ãå¯ç¨ç©ºè´§ä½ï¼"; |
| | | } |
| | | #endregion |
| | | else |
| | | { |
| | | item.CurrentAddress = item.NextAddress; |
| | | item.NextAddress = rGVLocationInfo.LocationCode; |
| | | fOURBOTnewMovePodTask.priority = item.Grade; |
| | | fOURBOTnewMovePodTask.podID = item.PalletCode; |
| | | fOURBOTnewMovePodTask.destination = item.NextAddress; |
| | | fOURBOTnewMovePodTask.desExt = new |
| | | { |
| | | unload = 1//æ¯å¦æ¾ä¸å®¹å¨,0å¦1æ¯ |
| | | }; |
| | | fOURBOTnewMovePodTask.desType = 2; |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | if (fOURBOTReturn.returnCode == 0) |
| | | { |
| | | item.RGVTaskId = fOURBOTReturn.data.taskID; |
| | | item.TaskState = (int)TaskStatusEnum.Puting; |
| | | rGVLocationInfo.LocationStatus = LocationStatusEnum.InLock.ObjToInt(); |
| | | rGVLocationInfos.Add(rGVLocationInfo); |
| | | } |
| | | } |
| | | } |
| | | _taskService.Db.Ado.BeginTran(); |
| | | _taskService.UpdateData(tasks); |
| | | _rGVLocationInfoService.UpdateData(rGVLocationInfos); |
| | | _taskService.Db.Ado.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(TaskJob), ex.Message, ex); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | var Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.MLInbound || x.TaskType == (int)TaskTypeEnum.MLOutbound).ToList(); |
| | | if (Tasks.Count > 0) SendGALAXISTask(Tasks); |
| | | #endregion |
| | | |
| | | #region æ¥æ¾RGVä»»å¡ |
| | | Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.CPInbound || x.TaskType == (int)TaskTypeEnum.CPOutbound).ToList(); |
| | | if (Tasks.Count > 0) SendRGVTask(Tasks); |
| | | #endregion |
| | | |
| | | #region æ¥æ¾æµ·åº·AGVä»»å¡ |
| | | Tasks = newTasks.Where(x => x.TaskType == (int)TaskTypeEnum.Carry || x.TaskType == (int)TaskTypeEnum.CJCarry || x.TaskType == (int)TaskTypeEnum.CJInbound || x.TaskType == (int)TaskTypeEnum.CJOutbound).ToList(); |
| | | if (Tasks.Count > 0) SendHIKROBOTTask(Tasks); |
| | | #endregion |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | var Tasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == (int)TaskStatusEnum.CheckShapeingOk).ToList(); |
| | | SendCheckShapeingOkTask(Tasks); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(TaskJob), ex.Message, ex); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ä¸åå¯ä¹å£«AGVä»»å¡ |
| | | public void SendGALAXISTask(List<Dt_Task> tasks) |
| | | { |
| | | GALAXISTaskInfo gALAXISTaskInfo = new GALAXISTaskInfo(); |
| | | try |
| | | { |
| | | gALAXISTaskInfo.groupId = DateTime.Now.ToString("yyMMddHHmmss"); |
| | | gALAXISTaskInfo.msgTime = DateTime.Now.ToString(); |
| | | gALAXISTaskInfo.tasks = new List<GALAXISTask>(); |
| | | foreach (var task in tasks) |
| | | { |
| | | GALAXISTask gALAXISTask = new GALAXISTask() |
| | | { |
| | | taskId = task.WMSTaskNum, |
| | | taskType = task.TaskType == (int)TaskTypeEnum.MLInbound ? 0 : 1, |
| | | barCode = task.PalletCode, |
| | | endNode = task.TargetAddress, |
| | | startNode = task.SourceAddress, |
| | | priorityCode = task.Grade |
| | | }; |
| | | gALAXISTaskInfo.tasks.Add(gALAXISTask); |
| | | } |
| | | Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(GALAXISTaskInfo)) ?? throw new Exception("æªæ¾å°å¯ä¹å£«AGVä»»å¡ä¸åæ¥å£é
置信æ¯ï¼è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, gALAXISTaskInfo.Serialize()); |
| | | GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | if (agvContent.success) |
| | | { |
| | | if (agvContent.data.returnStatus != 0) throw new Exception(agvContent.data.returnInfo); |
| | | tasks.ForEach(task => |
| | | { |
| | | task.TaskState = (int)TaskStatusEnum.Execut; |
| | | }); |
| | | _taskService.UpdateData(tasks); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(TaskJob), ex.Message, ex); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ä¸åååè½¦ä»»å¡ |
| | | public void SendRGVTask(List<Dt_Task> tasks) |
| | | { |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region ä¸å海康AGVä»»å¡ |
| | | public void SendHIKROBOTTask(List<Dt_Task> tasks) |
| | | { |
| | | |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | { |
| | | private readonly ITaskService _taskService; |
| | | private readonly IApiInfoService _apiInfoService; |
| | | public TaskJob(ITaskService taskService, IApiInfoService apiInfoService) |
| | | private readonly IRGVLocationInfoService _rGVLocationInfoService; |
| | | public TaskJob(ITaskService taskService, IApiInfoService apiInfoService, IRGVLocationInfoService rGVLocationInfoService) |
| | | { |
| | | _taskService = taskService;//注å
¥ |
| | | _apiInfoService = apiInfoService; |
| | | _rGVLocationInfoService = rGVLocationInfoService; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |