| | |
| | | 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 |
| | | { |
| | |
| | | /// <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}ãå¯ç¨ç©ºè´§ä½ï¼"); |
| | | #region ç¹å°ç¹ |
| | | //if (!string.IsNullOrEmpty(taskDTO.toLocationCode)) |
| | | //{ |
| | | // var LocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"æªæ¾å°ç»ç¹è´§ä½ã{taskDTO.toLocationCode}ã"); |
| | | // if (LocationInfo.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"ç»ç¹è´§ä½ã{taskDTO.toLocationCode}ãè´§ä½ç¶æä¸ä¸ºç©ºè´§ä½"); |
| | | //} |
| | | #endregion |
| | | 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, |
| | |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = stationManger.Remark,//æ¾å
¥åºç«å°å¯¹åºçå¤å½¢æ£æµç¼å· |
| | | 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(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | content.Data = new |
| | | { |
| | | taskCode = taskDTO.taskCode, |
| | | Message = $"失败ï¼{ex.Message}" |
| | | }; |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | /// <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}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | if (rGVLocationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãç»å®æç®±å·ã{rGVLocationInfo.PalletCode}ãä¸ä»»å¡æç®±å·ã{taskDTO.containerCode}ãä¸å¹é
ï¼"); |
| | | 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, |
| | |
| | | Creater = "WMS", |
| | | }; |
| | | rGVLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt(); |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.AddData(dt_Task); |
| | | _rGVLocationInfoService.Repository.UpdateData(rGVLocationInfo); |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.AddData(dt_Task); |
| | | _rGVLocationInfoService.Repository.UpdateData(rGVLocationInfo); |
| | | 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(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | content.Data = new |
| | | { |
| | | taskCode = taskDTO.taskCode, |
| | | Message = $"失败ï¼{ex.Message}" |
| | | }; |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | #endregion |