| | |
| | | using WIDESEAWCS_Common.LocationEnum; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using System.Reflection.Metadata; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | | { |
| | |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateKLSNewInTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | Dt_KLSLocationInfo? kLSLocationInfo = null; |
| | | try |
| | | { |
| | | int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt(); |
| | | int containerType = taskDTO.containerCode.Contains("LLM") ? (int)LocationTypeEnum.LargePallet : (int)LocationTypeEnum.SmallPallet; |
| | | #region ç¹å°ç¹ |
| | | if (!string.IsNullOrEmpty(taskDTO.toLocationCode)) |
| | | { |
| | | kLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"æªæ¾å°ç»ç¹è´§ä½ã{taskDTO.toLocationCode}ã"); |
| | | if (kLSLocationInfo.LocationStatus != (int)LocationStatusEnum.Free) throw new Exception($"ç»ç¹è´§ä½ã{taskDTO.toLocationCode}ãè´§ä½ç¶æä¸ä¸ºç©ºè´§ä½"); |
| | | } |
| | | #endregion |
| | | //è·åè´§ä½ä¿¡æ¯ |
| | | Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.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() |
| | | else |
| | | kLSLocationInfo = _kLSLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"æªæ¾å°ç»ç¹åºåºã{taskDTO.toAreaCode}ãå¯ç¨ç©ºè´§ä½ï¼"); |
| | | Dt_Task dt_Task = new() |
| | | { |
| | | 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, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | |
| | | TargetAddress = kLSLocationInfo.LocationCode, |
| | | 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(); |
| | | kLSLocationInfo.LocationStatus = (int)LocationStatusEnum.InLock; |
| | | #region ä¸åå¯ä¹å£«ä»»å¡ |
| | | content = SendKLSTask(dt_Task); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | dt_Task.TaskState = (int)TaskStatusEnum.Execut; |
| | | dt_Task.Dispatchertime = DateTime.Now; |
| | | #endregion |
| | | 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> |
| | |
| | | /// <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); |
| | | if (kLSLocationInfo == null) throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | if (kLSLocationInfo.LocationStatus != LocationStatusEnum.InStock.ObjToInt()) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | Dt_Task dt_Task = new Dt_Task() |
| | | Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | if (kLSLocationInfo.LocationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | if (kLSLocationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãç»å®æç®±å·ã{kLSLocationInfo.PalletCode}ãä¸ä»»å¡æç®±å·ã{taskDTO.containerCode}ãä¸å¹é
ï¼"); |
| | | Dt_Task dt_Task = new() |
| | | { |
| | | 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, |
| | | TaskState = TaskStatusEnum.New.ObjToInt(), |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | kLSLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt(); |
| | | Db.Ado.BeginTran(); |
| | | kLSLocationInfo.LocationStatus = (int)LocationStatusEnum.OutLock; |
| | | #region ä¸åå¯ä¹å£«ä»»å¡ |
| | | content = SendKLSTask(dt_Task); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | dt_Task.TaskState = (int)TaskStatusEnum.Execut; |
| | | dt_Task.Dispatchertime = DateTime.Now; |
| | | #endregion |
| | | 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) |
| | | { |
| | | content.Data = new |
| | | { |
| | | taskCode = taskDTO.taskCode, |
| | | Message = $"失败ï¼{ex.Message}" |
| | | }; |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ä¸åå¯ä¹å£«ä»»å¡ |
| | | public WebResponseContent SendKLSTask(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | GALAXISTaskInfo gALAXISTaskInfo = new(); |
| | | GALAXISReturn agvContent = new(); |
| | | try |
| | | { |
| | | gALAXISTaskInfo.groupId = DateTime.Now.ToString("yyMMddHHmmss") + task.TaskNum; |
| | | gALAXISTaskInfo.msgTime = DateTime.Now.ToString(); |
| | | 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()); |
| | | agvContent = response.DeserializeObject<GALAXISReturn>(); |
| | | content.OK(data: agvContent); |
| | | if (agvContent.success) |
| | | { |
| | | if (agvContent.data.returnStatus != 0) throw new Exception(agvContent.data.returnInfo); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(gALAXISTaskInfo, content, "ä¸åå¯ä¹å£«AGVä»»å¡", "", agvContent.data.returnInfo); |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #region 5 跨楼å±è¿è¾ä»»å¡å建 ï¼é½æ¯ç¹å°ç¹ï¼ |
| | | public WebResponseContent CarryTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger? stationInfo = null; |
| | | Dt_Task dt_Task = null; |
| | | //å
¥åº å°ä¸æ¥¼ä¸ä¸ªç«å°çä½ç½® |
| | | if (taskType == (int)TaskTypeEnum.Q3RK)//6-1楼 |
| | | { |
| | | var ionInfo = _stationMangerService.Repository.QueryFirst(x => x.StationCode == taskDTO.toLocationCode) ?? throw new Exception($"æªæ¾å°ç»ç¹ç«å°ã{taskDTO.toLocationCode}ãï¼"); |
| | | var StationInfo = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°{taskDTO.fromLocationCode}èµ·ç¹è´§ä½"); |
| | | if (StationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãç»å®æç®±å·ã{StationInfo.PalletCode}ãä¸ä»»å¡æç®±å·ã{taskDTO.containerCode}ãä¸å¹é
ï¼"); |
| | | if (StationInfo.StationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½åç¶æä¸å¯ä»¥åºåº"); |
| | | if (StationInfo.FloorNumber != "FF") throw new Exception($"ã{taskDTO.fromLocationCode}ãçæ¥¼å±åä»»å¡ç±»å楼å±ä¸å¹é
"); |
| | | |
| | | dt_Task = new Dt_Task() |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | WMSTaskNum = taskDTO.taskCode, |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = "1", |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | } |
| | | //åºåº |
| | | if (taskType == (int)TaskTypeEnum.Q3CK)//1-6楼 |
| | | { |
| | | var StationInfo = _stationInfo.Repository.QueryFirst(x => x.StationCode == taskDTO.toLocationCode) ?? throw new Exception($"æª{taskDTO.toLocationCode}ç»ç¹è´§ä½"); |
| | | if (StationInfo.StationStatus != (int)LocationStatusEnum.Free) throw new Exception($"ç»ç¹åºä½ã{taskDTO.toLocationCode}ãå½åç¶æä¸å¯ä»¥æ¾è´§"); |
| | | if (StationInfo.FloorNumber != "FF") throw new Exception($"ç»ç¹åºä½ã{taskDTO.toLocationCode}ãçæ¥¼å±ä¸ä»»å¡ç±»å楼å±ä¸å¹é
"); |
| | | |
| | | var ionInfo = _stationMangerService.Repository.QueryFirst(x => x.StationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹ç«å°ã{taskDTO.fromLocationCode}ãï¼"); |
| | | if (ionInfo.Remark != taskDTO.containerCode) throw new Exception($"èµ·ç¹ç«å°ã{taskDTO.fromLocationCode}ãç»å®æç®±å·ã{ionInfo.Remark}ãä¸ä»»å¡æç®±å·ã{taskDTO.containerCode}ãä¸å¹é
ï¼"); |
| | | |
| | | 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 = "1", |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | } |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | | BaseDal.AddData(dt_Task); |
| | | 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) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 6 è£åªéè´§ |
| | | public WebResponseContent CJCarryTaske(TaskDTO taskDTO, int taskType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | Dt_StationInfo? stationInfo = null; |
| | | try |
| | | { |
| | | #region æ¯å¦éè¦å¤æå¹³åºåºä½ç¶æ |
| | | var reslut = ValidateLocationForTask(taskType, taskDTO); |
| | | if (!reslut.Status) |
| | | { |
| | | throw new Exception(reslut.Message); |
| | | } |
| | | #endregion |
| | | |
| | | 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 = "", |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | content = SendHIKROBOTTask(dt_Task); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | dt_Task.TaskState = (int)TaskStatusEnum.Execut; |
| | | dt_Task.Dispatchertime = DateTime.Now; |
| | | BaseDal.AddData(dt_Task); |
| | | _kLSLocationInfoService.Repository.UpdateData(kLSLocationInfo); |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | throw new Exception(ex.Message); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #region RGVä»»å¡å建 |
| | | /// <summary> |
| | | /// å建åå车å
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateRGVNewInTask(TaskDTO taskDTO, int taskType) |
| | | |
| | | #region 5ç©ºè½¦è½¬è¿ |
| | | public WebResponseContent HKF01Transport(TaskDTO taskDTO, int taskType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | | var stationInfo = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | if (stationInfo.StationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸æ¯æè´§ï¼"); |
| | | if (stationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"å½ååºä½ã{taskDTO.fromLocationCode}ãç»å®æç®±å·ã{stationInfo.PalletCode}ãä¸ä»»å¡çæç®±å·ã{taskDTO.containerCode}ãä¸å¹é
"); |
| | | |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | |
| | | var stationInfo2 = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.toLocationCode) ?? throw new Exception($"æªæ¾å°ç»ç¹åºä½ã{taskDTO.toLocationCode}ãï¼"); |
| | | if (stationInfo2.StationStatus != (int)LocationStatusEnum.Free) throw new Exception($"ç»ç¹åºä½ã{taskDTO.toLocationCode}ãå½ååºä½ç¶æä¸æ¯ç©ºé²ï¼"); |
| | | |
| | | var 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 = "1", |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | content = SendHIKROBOTTask(dt_Task); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | dt_Task.Dispatchertime = DateTime.Now; |
| | | BaseDal.AddData(dt_Task); |
| | | } |
| | | 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(); |
| | | content.Error(ex.Message); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #region 海康AGVä»»å¡å建 |
| | | |
| | | |
| | | #region |
| | | /// <summary> |
| | | /// å建海康AGVå
¥åºä»»å¡ |
| | | /// 海康ä»ä½å°ä»ä½çè¿è¾ä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateHKNewInTask(TaskDTO taskDTO, int taskType) |
| | | public WebResponseContent HKSTUPTP(TaskDTO taskDTO, int taskType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | | var KLocationInfo = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.fromLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | if (KLocationInfo.LocationStatus != (int)LocationStatusEnum.InStock) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸æ¯æè´§ï¼"); |
| | | if (KLocationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"å½ååºä½ã{taskDTO.fromLocationCode}ãç»å®æç®±å·ã{KLocationInfo.PalletCode}ãä¸ä»»å¡çæç®±å·ã{taskDTO.containerCode}ãä¸å¹é
"); |
| | | |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | |
| | | var KLocationInfo2 = _hKLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"æªæ¾å°ç»ç¹åºä½ã{taskDTO.toLocationCode}ãï¼"); |
| | | if (KLocationInfo2.LocationStatus != (int)LocationStatusEnum.Free) throw new Exception($"ç»ç¹åºä½ã{taskDTO.toLocationCode}ãå½ååºä½ç¶æä¸æ¯ç©ºé²ï¼"); |
| | | |
| | | var 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 = "1", |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | content = SendHIKROBOTTask(dt_Task); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | dt_Task.Dispatchertime = DateTime.Now; |
| | | BaseDal.AddData(dt_Task); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// å建海康AGVåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateHKNewOutTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | try |
| | | { |
| | | Db.Ado.BeginTran(); |
| | | |
| | | Db.Ado.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | | content.Error(ex.Message); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | } |