| | |
| | | private readonly IApiInfoService _apiInfoService; |
| | | private readonly IStationMangerService _stationMangerService; |
| | | private readonly IStationInfoService _stationInfo; |
| | | private readonly ITaskErrorMessageService _taskErrorMessageService; |
| | | private readonly IMapper _mapper; |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | |
| | | /// </summary> |
| | | public IRepository<Dt_Task> Repository => BaseDal; |
| | | |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService, IApiInfoService apiInfoService, ITrackloginfoService trackloginfoService, IStationMangerService stationMangerService, IStationInfoService stationInfo) : base(BaseDal) |
| | | public TaskService(IRepository<Dt_Task> BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, IRepository<Dt_TaskExecuteDetail> taskExecuteDetailRepository, IMapper mapper, IKLSLocationInfoService kLSLocationInfoService, IRGVLocationInfoService rGVLocationInfoService, IHKLocationInfoService hKLocationInfoService, IApiInfoService apiInfoService, ITrackloginfoService trackloginfoService, IStationMangerService stationMangerService, IStationInfoService stationInfo, ITaskErrorMessageService taskErrorMessageService) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _trackloginfoService = trackloginfoService; |
| | | _stationMangerService = stationMangerService; |
| | | _stationInfo = stationInfo; |
| | | _taskErrorMessageService = taskErrorMessageService; |
| | | } |
| | | public WebResponseContent ReceiveWMSTask([NotNull] List<WMSTasksDTO> taskDTOs) |
| | | { |
| | |
| | | content = HKF01Transport(task, item.taskType); |
| | | break; |
| | | case (int)TaskTypeEnum.F04: |
| | | case (int)TaskTypeEnum.F03: |
| | | case (int)TaskTypeEnum.F02: |
| | | case (int)TaskTypeEnum.RK3F: |
| | | case (int)TaskTypeEnum.F02: |
| | | case (int)TaskTypeEnum.F03: |
| | | case (int)TaskTypeEnum.CK3F: |
| | | content = CJCarryTaske(task, item.taskType); |
| | | objects.Add(content.Data); |
| | |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | public WebResponseContent ContainerRequest(WMSContainerFlow wMSContainerFlow) |
| | | { |
| | | WebResponseContent content =new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerService.Repository.QueryFirst(x => x.StationCode == wMSContainerFlow.slotCode) ?? throw new Exception($"æªæ¾å°ç«å°ã{wMSContainerFlow.slotCode}ãä¿¡æ¯"); |
| | |
| | | if (wMSContainerFlow.direction == "200") |
| | | { |
| | | stationManger.IsOccupied = LocationStatusEnum.Free.ObjToInt(); |
| | | stationManger.Remark = ""; |
| | | FOURBOToccupyStation fOURBOToccupyStation = new FOURBOToccupyStation() |
| | | { |
| | | stationCode = wMSContainerFlow.slotCode, |
| | | }; |
| | | string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOToccupyStation.Serialize()); |
| | | FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>(); |
| | | content.OK(data:fOURBOTReturn); |
| | | if (fOURBOTReturn.returnCode != 0) throw new Exception(fOURBOTReturn.returnUserMsg); |
| | | _stationMangerService.UpdateData(stationManger); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | return content.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(wMSContainerFlow, content, "容卿µå¨è¯·æ±", "", ""); |
| | | } |
| | | } |
| | | /// <summary> |
| | |
| | | //task.TaskState = (int)TaskStatusEnum.Execut; |
| | | //BaseDal.UpdateData(task); |
| | | #endregion |
| | | |
| | | #region 䏿¶ä¸éè¦å°ç«å°ç¶ææ¹ä¸ºå ç¨ ç»å®å®¹å¨ç¼ç |
| | | stationManger.IsOccupied = LocationStatusEnum.Lock.ObjToInt(); |
| | | stationManger.Remark = iQC.ContainerCode; |
| | | _stationMangerService.UpdateData(stationManger); |
| | | #endregion |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(iQC, content, "IQCè´¨æ£ç»æåé¦", "", ""); |
| | | } |
| | | } |
| | | |
| | |
| | | /// <exception cref="NotImplementedException"></exception> |
| | | public WebResponseContent multiSetNodeStatus(FOURBOTStorageStatusNotify fOURBOTStorageStatusNotify) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | var Agvlocation = _rGVLocationInfoService.Repository.QueryData(x => fOURBOTStorageStatusNotify.storageCode.Contains(x.LocationCode)); |
| | |
| | | item.EnableStatus = (int)(fOURBOTStorageStatusNotify.disable == 0 ? EnableStatusEnum.Normal : EnableStatusEnum.Disable); |
| | | } |
| | | _rGVLocationInfoService.UpdateData(Agvlocation); |
| | | return WebResponseContent.Instance.OK(); |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | _trackloginfoService.AddTrackLog(fOURBOTStorageStatusNotify,content, "æ¹éæ´æ°å¨ä½ç¶æ", "", ""); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¡éªä»»å¡ç¸å
³çåºä½ç¶æåç»å®å
³ç³» |
| | | /// </summary> |
| | | /// <param name="taskType">ä»»å¡ç±»å</param> |
| | | /// <param name="taskDTO">ä»»å¡DTO</param> |
| | | /// <returns>è¿åèµ·ç¹åºä½åç»ç¹åºä½ä¿¡æ¯</returns> |
| | | /// <exception cref="Exception">æ ¡éªå¤±è´¥æ¶æåºå¼å¸¸</exception> |
| | | private WebResponseContent ValidateLocationForTask(int taskType, TaskDTO taskDTO) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | #region |
| | | // å
¥åºç±»ä»»å¡ï¼éè¦æ ¡éªç»ç¹åºä½ï¼ |
| | | if (taskType == (int)TaskTypeEnum.CK3F || taskType == (int)TaskTypeEnum.F03) |
| | | { |
| | | var toStation = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.toLocationCode) |
| | | ?? throw new Exception($"æªæ¾å°ç»ç¹åºä½ã{taskDTO.toLocationCode}ãï¼"); |
| | | |
| | | if (toStation.StationName != LocationStatusEnum.Free.ToString()) |
| | | throw new Exception($"ç»ç¹åºä½ã{taskDTO.toLocationCode}ãåºä½ç¶æä¸å¯å
¥åºï¼"); |
| | | } |
| | | // åºåºç±»ä»»å¡ï¼éè¦æ ¡éªèµ·ç¹åºä½ï¼ |
| | | else if (taskType == (int)TaskTypeEnum.RK3F || taskType == (int)TaskTypeEnum.F04) |
| | | { |
| | | var fromStation = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.fromLocationCode) |
| | | ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | |
| | | if (fromStation.StationName != LocationStatusEnum.InStock.ToString()) |
| | | throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | |
| | | if (fromStation.PalletCode != taskDTO.containerCode) |
| | | throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãç»å®æç®±å·ã{fromStation.PalletCode}ãä¸ä»»å¡æç®±å·ã{taskDTO.containerCode}ãä¸å¹é
ï¼"); |
| | | } |
| | | // ç§»åºç±»ä»»å¡ï¼éè¦åæ¶æ ¡éªèµ·ç¹åç»ç¹ï¼ |
| | | else if (taskType == (int)TaskTypeEnum.F02) |
| | | { |
| | | // æ ¡éªç»ç¹åºä½ |
| | | var toStation = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.toLocationCode) |
| | | ?? throw new Exception($"æªæ¾å°ç»ç¹åºä½ã{taskDTO.toLocationCode}ãï¼"); |
| | | |
| | | if (toStation.StationName != LocationStatusEnum.Free.ToString()) |
| | | throw new Exception($"ç»ç¹åºä½ã{taskDTO.toLocationCode}ãåºä½ç¶æä¸å¯å
¥åºï¼"); |
| | | |
| | | // æ ¡éªèµ·ç¹åºä½ |
| | | var fromStation = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.fromLocationCode) |
| | | ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãï¼"); |
| | | |
| | | if (fromStation.StationName != LocationStatusEnum.InStock.ToString()) |
| | | throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | |
| | | if (fromStation.PalletCode != taskDTO.containerCode) |
| | | throw new Exception($"èµ·ç¹åºä½ã{taskDTO.fromLocationCode}ãç»å®æç®±å·ã{fromStation.PalletCode}ãä¸ä»»å¡æç®±å·ã{taskDTO.containerCode}ãä¸å¹é
ï¼"); |
| | | } |
| | | #endregion |
| | | return content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return content.Error(ex.Message); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |