| | |
| | | { |
| | | int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt(); |
| | | //è·åè´§ä½ä¿¡æ¯ |
| | | 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() |
| | | Dt_KLSLocationInfo? 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)), |
| | | 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(); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | { |
| | | 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 = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | kLSLocationInfo.LocationStatus = LocationStatusEnum.OutLock.ObjToInt(); |
| | | Db.Ado.BeginTran(); |
| | |
| | | catch (Exception ex) |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | #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 CarryTask(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); |
| | | } |
| | | } |
| | | /// <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); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | #endregion |
| | | |
| | | #region 海康AGVä»»å¡å建 |
| | | /// <summary> |
| | | /// å建海康AGVå
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateHKNewInTask(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); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// å建海康AGVåºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="taskDTO"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent CreateHKNewOutTask(TaskDTO taskDTO, int taskType) |
| | | #region 6 è£åªéè´§ |
| | | public WebResponseContent CJCarryTaske(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); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | #endregion |
| | | } |