| | |
| | | using WIDESEAWCS_DTO; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_QuartzJob; |
| | | |
| | | namespace WIDESEAWCS_TaskInfoService |
| | | { |
| | |
| | | content = SendKLSTask(dt_Task); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | dt_Task.TaskState = (int)TaskStatusEnum.Execut; |
| | | dt_Task.Dispatchertime=DateTime.Now; |
| | | dt_Task.Dispatchertime = DateTime.Now; |
| | | #endregion |
| | | try |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 5 跨楼å±è¿è¾ä»»å¡å建 |
| | | #region 5 跨楼å±è¿è¾ä»»å¡å建 ï¼é½æ¯ç¹å°ç¹ï¼ |
| | | public WebResponseContent CarryTask(TaskDTO taskDTO, int taskType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_HKLocationInfo? hKLocationInfo = null; |
| | | Dt_StationInfo? stationInfo = null; |
| | | Dt_Task dt_Task = null; |
| | | //å
¥åº å°ä¸æ¥¼ä¸ä¸ªç«å°çä½ç½® |
| | | if (taskType == (int)TaskTypeEnum.Q3RK) |
| | | { |
| | | //读åå
çµä¿¡å· |
| | | var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "F1") as OtherDevice; |
| | | if (device == null) throw new Exception("æªæ¾å°1楼质æ£é¨è®¾å¤ä¿¡æ¯"); |
| | | if (!device.IsConnected) throw new Exception("PLC1楼质æ£é¨è®¾å¤è¿æ¥å¤±è´¥"); |
| | | bool value = device.GetValue<QualityInspectionCommandEnum, bool>(QualityInspectionCommandEnum.R_StockAvailableSymbol, taskDTO.toLocationCode); |
| | | if (value) |
| | | { |
| | | content.Error($"{taskDTO.toLocationCode}ç«å°æè´§ï¼æ æ³å
¥åº"); |
| | | } |
| | | dt_Task = new Dt_Task() |
| | | { |
| | | TaskNum = GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | WMSTaskNum = taskDTO.taskCode, |
| | | Grade = taskDTO.taskPriority, |
| | | PalletCode = taskDTO.containerCode, |
| | | Roadway = hKLocationInfo.RoadwayNo, |
| | | TaskState = (int)TaskStatusEnum.New, |
| | | TaskType = taskType, |
| | | SourceAddress = taskDTO.fromLocationCode, |
| | | CurrentAddress = taskDTO.fromLocationCode, |
| | | NextAddress = taskDTO.toLocationCode, |
| | | TargetAddress = taskDTO.toLocationCode, |
| | | Creater = "WMS", |
| | | }; |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | //åºåº |
| | | if (taskType == (int)TaskTypeEnum.Q3CK) |
| | | { |
| | | stationInfo = _stationInfo.Repository.QueryFirst(x => x.StationName == taskDTO.toLocationCode) ?? throw new Exception($"æªæ¾å°èµ·ç¹åºä½ã{taskDTO.toLocationCode}ãï¼"); |
| | | if (stationInfo.StationName != LocationStatusEnum.InStock.ToString()) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.toLocationCode}ãå½ååºä½ç¶æä¸å¯åºåºï¼"); |
| | | if (stationInfo.PalletCode != taskDTO.containerCode) throw new Exception($"èµ·ç¹åºä½ã{taskDTO.toLocationCode}ãç»å®æç®±å·ã{stationInfo.PalletCode}ãä¸ä»»å¡æç®±å·ã{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 = hKLocationInfo.RoadwayNo, |
| | | 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); |
| | | _hKLocationInfoService.Repository.UpdateData(hKLocationInfo); |
| | | _stationInfo.Repository.UpdateData(stationInfo); |
| | | 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) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | #region 6 è£åªéè´§ |
| | | public WebResponseContent CJCarryTaske(TaskDTO taskDTO, int taskType) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | 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); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | } |