| | |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_Tasks; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using static Dm.net.buffer.ByteArrayBuffer; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers |
| | |
| | | var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum); |
| | | //æ¯å¦åå¨è¾é线ä½å¾
AGVæ¬è¿ä»»å¡ |
| | | var taskExecutes = _taskRepository.QueryData(x => x.NextAddress == task.CurrentAddress && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt() && x.TaskType == TaskTypeEnum.InProduct.ObjToInt()); |
| | | var taskExecutesFL = _taskRepository.QueryData(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && x.DeviceCode=="AGV_FL" && !string.IsNullOrEmpty(x.DeviceCode)); |
| | | if (task == null) throw new Exception($"æªæ¾å°ä»»å¡,ä»»å¡å·ã{agvUpdateModel.TaskCode}ã"); |
| | | |
| | | switch (agvUpdateModel.Method.ToUpper()) |
| | |
| | | _taskRepository.UpdateData(task); |
| | | } |
| | | } |
| | | else //æ´æ¹è¾
æåè´§ |
| | | { |
| | | //æ¯å¦åå¨è¾é线ä½å¾
AGVæ¬è¿ä»»å¡ |
| | | if (taskExecutesFL.Count > 0) |
| | | { |
| | | //è°ç¨AGVé¢è°åº¦æ¥å£ |
| | | AgvScheduleTaskDTO agvScheduleTask = new AgvScheduleTaskDTO() |
| | | { |
| | | PositionCode = task.CurrentAddress, |
| | | NextTask = "60", |
| | | UseableLayers = "1", |
| | | CacheCount = "1", |
| | | Update = "0", |
| | | AgvTyp = "11", |
| | | PreTaskQty = "1", |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), |
| | | ReqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | }; |
| | | WebResponseContent contentFL = _taskService.AgvPreScheduleTask(agvScheduleTask); |
| | | if (!contentFL.Status) |
| | | { |
| | | agvResponseContent.Code = "1"; |
| | | agvResponseContent.Message = contentFL.Message; |
| | | return agvResponseContent; |
| | | } |
| | | } |
| | | //è·åè°å
¥åæ° |
| | | AGVBoxApplyPassDTO boxApplyPassDTO = new AGVBoxApplyPassDTO() |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), |
| | | ReqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | TaskCode = task.AgvTaskNum |
| | | }; |
| | | boxApplyPassDTO.Type = "1"; |
| | | //è¯·æ±æç®±åè°æ¥å£ |
| | | WebResponseContent content = _taskService.AgvBoxApplyPass(boxApplyPassDTO); |
| | | if (content.Status && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | task.ExceptionMessage = content.Message; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.Exception); |
| | | } |
| | | } |
| | | break; |
| | | case "APPLYFROMAGV": |
| | | //æ´æ¹æååºAGVæ¾è´§ä»»å¡ç¶æ |
| | | if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt()) |
| | | { |
| | | //if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt()) |
| | | //{ |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_WaitToExecute); |
| | | } |
| | | //} |
| | | break; |
| | | case "OUTBIN": |
| | | if (task.TaskType == TaskTypeEnum.InProduct.ObjToInt() || task.TaskType == TaskTypeEnum.InProductBack.ObjToInt()) |
| | |
| | | /// <param name="code"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PutFinish"), AllowAnonymous] |
| | | public WebResponseContent PutFinish(string code) |
| | | public WebResponseContent PutFinish(string code,string barCode="",string taskNum="") |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | |
| | | if (!barCode.IsNullOrEmpty() && !taskNum.IsNullOrEmpty()) |
| | | { |
| | | otherDevice.SetValue(W_ConveyorLineFLDB.Barcode, barCode, stationManger.StationCode); |
| | | Thread.Sleep(500); |
| | | otherDevice.SetValue(W_ConveyorLineFLDB.TaskNum, taskNum, stationManger.StationCode); |
| | | Thread.Sleep(500); |
| | | } |
| | | otherDevice.SetValue(GroundStationDBName.W_PutFinish, true, stationManger.StationCode); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |