| | |
| | | required: true, |
| | | field: "areaId", |
| | | type: "string", |
| | | hidden:true, |
| | | }, |
| | | { |
| | | title: "å··éç¼å·", |
| | |
| | | title: "åºå主é®", |
| | | type: "string", |
| | | width: 90, |
| | | hidden:true, |
| | | align: "left", |
| | | bind: { |
| | | key: "areainfo", |
| | |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "nextAddress", |
| | |
| | | type: "string", |
| | | width: 120, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "exceptionMessage", |
| | |
| | | type: "datetime", |
| | | width: 150, |
| | | align: "left", |
| | | hidden: true, |
| | | }, |
| | | { |
| | | field: "wMSId", |
| | |
| | | Normal = 1, |
| | | |
| | | /// <summary> |
| | | /// ä¸æè´§ä½ |
| | | /// æåä½ |
| | | /// </summary> |
| | | [Description("ä¸æè´§ä½")] |
| | | [Description("æåä½")] |
| | | Feeding= 2, |
| | | |
| | | /// <summary> |
| | | /// å
¥åºå£è´§ä½ |
| | | /// </summary> |
| | | [Description("å
¥åºå£è´§ä½")] |
| | | [Description("æåæº")] |
| | | In = 3, |
| | | |
| | | /// <summary> |
| | | /// 空车åºåºå£è´§ä½ |
| | | /// 空车åºåºå£ |
| | | /// </summary> |
| | | [Description("空车åºåºå£è´§ä½")] |
| | | [Description("è¾é线")] |
| | | OutEmpty = 4, |
| | | |
| | | /// <summary> |
| | | /// çªç䏿æºè´§ä½ |
| | | /// ç»ç«æºä½ç½® |
| | | /// </summary> |
| | | [Description("çªç䏿æºè´§ä½")] |
| | | [Description("ç»ç«æº")] |
| | | OutWorkUnit = 5 |
| | | } |
| | | } |
| | |
| | | /// <returns>è¿åå¤çç»æ</returns> |
| | | WebResponseContent StackCraneTaskCompleted(int taskNum); |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¢å¤æèµ·ä»»å¡ |
| | | /// </summary> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.QuartzNet; |
| | | |
| | | namespace WIDESEAWCS_Server.Controllers.QuartzJob |
| | | { |
| | | [Route("api/Scheduler")] |
| | | [ApiController] |
| | | public class SchedulerController : ControllerBase |
| | | { |
| | | private readonly ISchedulerCenter _scheduler; |
| | | private readonly QuartzNetExtension _quartzNetExtension; |
| | | public SchedulerController(ISchedulerCenter scheduler, QuartzNetExtension quartzNetExtension) |
| | | { |
| | | _scheduler = scheduler; |
| | | _quartzNetExtension = quartzNetExtension; |
| | | } |
| | | |
| | | [HttpGet, Route("StartSchedule"), AllowAnonymous] |
| | | public async Task<WebResponseContent> StartSchedule() |
| | | { |
| | | try |
| | | { |
| | | await _quartzNetExtension.StartAsync(); |
| | | return WebResponseContent.Instance.OK("å¯å¨æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error("å¯å¨é误ï¼" + ex.Message); |
| | | } |
| | | } |
| | | |
| | | [HttpGet, Route("StopSchedule"), AllowAnonymous] |
| | | public Task<WebResponseContent> StopSchedule() |
| | | { |
| | | return _scheduler.StopScheduleAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æåæå®ç计åä»»å¡ |
| | | /// </summary> |
| | | /// <param name="sysSchedule"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("PauseJob"), AllowAnonymous] |
| | | public Task<WebResponseContent> PauseJob([FromBody] DispatchInfoDTO sysSchedule) |
| | | { |
| | | return _scheduler.PauseJob(sysSchedule); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¢å¤æå®ç计åä»»å¡ |
| | | /// </summary> |
| | | /// <param name="sysSchedule"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ResumeJob"), AllowAnonymous] |
| | | public Task<WebResponseContent> ResumeJob([FromBody] DispatchInfoDTO sysSchedule) |
| | | { |
| | | return _scheduler.ResumeJob(sysSchedule); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ·»å ä¸ä¸ªè®¡åä»»å¡ï¼æ å°ç¨åºéæå®IJobå®ç°ç±»ï¼ |
| | | /// </summary> |
| | | /// <param name="sysSchedule"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("AddScheduleJob"), AllowAnonymous] |
| | | public Task<WebResponseContent> AddScheduleJob([FromBody] DispatchInfoDTO sysSchedule) |
| | | { |
| | | return _scheduler.AddScheduleJobAsync(sysSchedule); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ç«å³æ§è¡ ä¸ä¸ªä»»å¡ æ§è¡ä¸æ¬¡ |
| | | /// </summary> |
| | | /// <param name="sysSchedule"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ExecuteJob"), AllowAnonymous] |
| | | public Task<WebResponseContent> ExecuteJob([FromBody] DispatchInfoDTO sysSchedule) |
| | | { |
| | | return _scheduler.ExecuteJobAsync(sysSchedule); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æåææè®¡åä»»å¡ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("PauseAllJob"), AllowAnonymous] |
| | | public Task<WebResponseContent> PauseAllJob() |
| | | { |
| | | //return _scheduler.PauseAllJobAsync(); |
| | | return null; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¢å¤ææè®¡åä»»å¡ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("ResumeAllJob"), AllowAnonymous] |
| | | public Task<WebResponseContent> ResumeAllJob() |
| | | { |
| | | //return _scheduler.ResumeAllJobAsync(); |
| | | return null; |
| | | } |
| | | |
| | | [HttpPost, Route("DeleteScheduleJob"), AllowAnonymous] |
| | | public Task<WebResponseContent> DeleteScheduleJob([FromBody] DispatchInfoDTO sysSchedule) |
| | | { |
| | | return _scheduler.StopScheduleJobAsync(sysSchedule); |
| | | } |
| | | } |
| | | } |
| | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "locationTypeEnum": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | |
| | | { |
| | | Type type = typeof(LocationTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(LocationTypeEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(LocationTypeEnum).GetField(((LocationTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | | data.Add(new { key = item.ToString(), value = description.Description }); |
| | | } |
| | | else |
| | | { |
| | | data.Add(new { key = item.ToString(), value = item.ToString() }); |
| | | } |
| | | index++; |
| | | } |
| | | } |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "stockStatusEmun": |
| | | { |
| | | List<object> data = new List<object>(); |
| | |
| | | "Microsoft.AspNetCore": "Warning" |
| | | } |
| | | }, |
| | | "dics": "deviceType,devicePlcType,jobAssembly,jobClassName,deviceStatus,taskType,taskState,inOutType,orderDetailStatusEnum,enableEnum,enableStatusEnum,locationStatusEnum,stockStatusEmun", |
| | | "dics": "deviceType,devicePlcType,jobAssembly,jobClassName,deviceStatus,taskType,taskState,inOutType,orderDetailStatusEnum,enableEnum,enableStatusEnum,locationStatusEnum,stockStatusEmun,locationTypeEnum", |
| | | "AllowedHosts": "*", |
| | | "ConnectionStringsEncryption": false, |
| | | "MainDB": "DB_WIDESEA", //å½å项ç®ç主åºï¼æå¯¹åºçè¿æ¥å符串çEnabledå¿
须为true |
| | |
| | | "ApiName": "WIDESEA", |
| | | "ExpMinutes": 120, |
| | | "QuartzJobAutoStart": true, |
| | | "LogDeubgEnable": true, |
| | | "MESApi": "http://10.0.250.12:8888/agv/v1/CMD", |
| | | "ConveyorLineApi": "http://10.0.250.12:8888/wcs/goBack" //空车åºåºä»»å¡ä¿¡æ¯è·åå°å |
| | | |
| | |
| | | } |
| | | else if (!int.TryParse(Enum.Parse<TaskOtherTypeEnum>(task.TaskType.ToString()).ToString(), out result)) |
| | | { |
| | | steps = Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>().Where(x => x <= (int)TaskOutStatusEnum.OutFinish).ToList(); |
| | | |
| | | foreach (var item in steps) |
| | | { |
| | | object obj; |
| | | FieldInfo? fieldInfo = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString()); |
| | | DescriptionAttribute? descriptionAttribute = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (descriptionAttribute != null) |
| | | { |
| | | obj = new { title = item, description = descriptionAttribute.Description }; |
| | | } |
| | | else |
| | | { |
| | | obj = new { title = item, description = ((TaskOutStatusEnum)item).ToString() }; |
| | | } |
| | | list.Add(obj); |
| | | } |
| | | |
| | | } |
| | | else |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | ServiceLogger.WriteDebug("ReceiveTask", $"任塿¥æ¶é误,é误信æ¯:{ex.Message}"); |
| | | ServiceLogger.WriteDebug("ReceiveTask", $"任塿¥æ¶é误,é误信æ¯:{ex.StackTrace}"); |
| | | content = WebResponseContent.Instance.Error($"任塿¥æ¶é误,é误信æ¯:{ex.Message}"); |
| | | } |
| | | return content; |
| | |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | //任塿§è¡å¤±è´¥ï¼è´§ä½ç¶æè¿å |
| | | ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"大å åæºæ§è¡åºåºä»»å¡å¤±è´¥ï¼,ä»»å¡å·:ã{taskNum}ã,失败信æ¯:ã{ex.Message}ã"); |
| | | content = WebResponseContent.Instance.Error($"大å åæºæ§è¡åºåºä»»å¡å¤±è´¥ï¼,ä»»å¡å·:ã{taskNum}ã,失败信æ¯:ã{ex.Message}ã"); |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | Dt_LocationInfo srcLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | //Dt_LocationInfo srcLocation = _locationInfoRepository.QueryFirst(x => x.LocationCode == task.SourceAddress); |
| | | //srcLocation.LocationStatus = (int)LocationStatusEnum.Free; |
| | | |
| | | |
| | |
| | | MESResponse res = ApiInvoke.SendTaskCMD(sendcmd); |
| | | if (res != null && res.code != 0) |
| | | { |
| | | ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"å°å åæºå®æåºåºä»»å¡ååä¼ MES失败ï¼,ä»»å¡å·:ã{taskNum}ã,失败信æ¯:ã{res.message}ã"); |
| | | content = WebResponseContent.Instance.Error($"å°å åæºå®æåºåºä»»å¡ååä¼ MES失败ï¼,ä»»å¡å·:ã{taskNum}ã,失败信æ¯:ã{res.message}ã"); |
| | | } |
| | | else |
| | | { |
| | | //夿æ¯å¦å®æçæåä¸å±ï¼èªå¨çæç©ºè½¦åºåºä»»å¡ |
| | | string[] Levels = task.Remark.Split("-"); |
| | | if (Levels.Length == 2) |
| | | { |
| | | if (!string.IsNullOrEmpty(Levels[0])&& !string.IsNullOrEmpty(Levels[1])) |
| | | { |
| | | //妿å½åæå屿°çäºæ»å±æï¼å表示æè½¦ææç屿°åå® |
| | | if(Convert.ToInt16(Levels[0])== Convert.ToInt16(Levels[1])) |
| | | { |
| | | string[] SourceCodes = task.SourceAddress.Split("-"); |
| | | string startPlan = ""; |
| | | if (SourceCodes.Length == 4) |
| | | { |
| | | startPlan= "101"+ SourceCodes[2].Substring(1,2); |
| | | } |
| | | DeliveryPlan send = new DeliveryPlan { startPlan = startPlan, isQuit = false, CarId = task.PalletCode }; |
| | | string inparam2 = JsonConvert.SerializeObject(send); |
| | | ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"å°å åæºæ§è¡åºåºä»»å¡åä¼ MESå
¥å{inparam2}"); |
| | | ApiInvoke.DeliveryPlanCMD(send);//åè°MESæ¥å£çæç©ºè½¦åºåºä»»å¡ |
| | | //else |
| | | //{ |
| | | // //夿æ¯å¦å®æçæåä¸å±ï¼èªå¨çæç©ºè½¦åºåºä»»å¡ |
| | | // string[] Levels = task.Remark.Split("-"); |
| | | // if (Levels.Length == 2) |
| | | // { |
| | | // if (!string.IsNullOrEmpty(Levels[0])&& !string.IsNullOrEmpty(Levels[1])) |
| | | // { |
| | | // //妿å½åæå屿°çäºæ»å±æï¼å表示æè½¦ææç屿°åå® |
| | | // if(Convert.ToInt16(Levels[0])== Convert.ToInt16(Levels[1])) |
| | | // { |
| | | // string[] SourceCodes = task.SourceAddress.Split("-"); |
| | | // string startPlan = ""; |
| | | // if (SourceCodes.Length == 4) |
| | | // { |
| | | // startPlan = "101" + SourceCodes[2].Substring(1, 2); |
| | | // } |
| | | // DeliveryPlan send = new DeliveryPlan { startPlan = startPlan, isQuit = false, CarId = task.PalletCode }; |
| | | // string inparam2 = JsonConvert.SerializeObject(send); |
| | | // ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"å°å åæºæ§è¡åºåºä»»å¡åä¼ MESå
¥å{inparam2}"); |
| | | // ApiInvoke.DeliveryPlanCMD(send);//åè°MESæ¥å£çæç©ºè½¦åºåºä»»å¡ |
| | | //ææç屿°é½åå®ï¼éè¦ææåä½ç¶ææ¹ä¸ºç©ºé²ç¶æ |
| | | srcLocation.LocationStatus = (int)LocationStatusEnum.Free; |
| | | _locationInfoRepository.UpdateData(srcLocation); |
| | | } |
| | | // srcLocation.LocationStatus = (int)LocationStatusEnum.Free; |
| | | // _locationInfoRepository.UpdateData(srcLocation); |
| | | // } |
| | | |
| | | } |
| | | // } |
| | | |
| | | } |
| | | } |
| | | // } |
| | | //} |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"å°å åæºæ§è¡åºåºä»»å¡å¤±è´¥ï¼,ä»»å¡å·:ã{taskNum}ã,失败信æ¯:ã{ex.Message}ã"); |
| | | ServiceLogger.WriteDebug("StackCraneTaskCompleted", $"å°å åæºæ§è¡åºåºä»»å¡å¤±è´¥ï¼,ä»»å¡å·:ã{taskNum}ã,失败信æ¯:ã{ex.StackTrace}ã"); |
| | | content = WebResponseContent.Instance.Error($"å°å åæºæ§è¡åºåºä»»å¡å¤±è´¥ï¼,ä»»å¡å·:ã{taskNum}ã,失败信æ¯:ã{ex.Message}ã"); |
| | | } |
| | | |
| | |
| | | return content; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¢å¤æèµ·ä»»å¡ |
| | | /// </summary> |
| | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | WriteDebug("大å åæºè¿è¡æ¥å¿", "å¼å§æ¶é´" + DateTime.Now); |
| | | WriteDebug("大å åæºè¿è¡æ¥å¿", $"大å åæºä»»å¡æ§è¡ä¸..."); |
| | | //CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | CommonStackerCrane commonStackerCrane = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC01") as CommonStackerCrane; |
| | | try |
| | |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | | { |
| | | WriteDebug("大å åæºè¿è¡æ¥å¿", $"大å åæºä»»å¡å·{task.TaskNum}"); |
| | | StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task); |
| | | if (stackerCraneTaskCommand != null) |
| | | { |
| | |
| | | |
| | | |
| | | //æ¥è¯¢æåæº/ç»ç«æºä¿¡å· |
| | | Task.Run(delegate |
| | | { |
| | | //Task.Run(delegate |
| | | //{ |
| | | try |
| | | { |
| | | |
| | | if (commonStackerCrane != null) |
| | | { |
| | | |
| | | Dt_Task? task1001 = _taskService.QueryStackerCraneTaskByAGVRequest("SC01"); |
| | | if (task1001 != null) |
| | | { |
| | |
| | | int IsWriteTwo = 0; |
| | | if (task3001.SourceAddress == "SC01-002-000-001")//WMS 1001ç«ç¹ |
| | | { |
| | | //æåæºæ¯å¦å¤äºå°±ç»ªç¶æ |
| | | int IsReady= commonStackerCrane.Communicator.Read<short>("DB2.0.0"); |
| | | //åå
¥æåä¿¡æ¯ |
| | | IsWriteOne = commonStackerCrane.Communicator.Read<short>("DB1.0.0"); |
| | | if(IsWriteOne == 0) |
| | | if(IsWriteOne == 0&& IsReady == 1) |
| | | { |
| | | |
| | | var d= commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1); |
| | | commonStackerCrane.Communicator.Write<short>("DB1.0.0", 1); |
| | | } |
| | | //读åæåæºä¿¡å·ï¼ç¡®å®æ¯å¦æå宿 |
| | | |
| | |
| | | } |
| | | else if (task3001.SourceAddress == "SC01-002-000-002")//WMS 1002ç«ç¹ |
| | | { |
| | | //æåæºæ¯å¦å¤äºå°±ç»ªç¶æ |
| | | int IsReady = commonStackerCrane.Communicator.Read<short>("DB2.0.0"); |
| | | //åå
¥æåä¿¡æ¯ |
| | | IsWriteTwo = commonStackerCrane.Communicator.Read<short>("DB1.6.0"); |
| | | if (IsWriteTwo == 0) |
| | | if (IsWriteTwo == 0 && IsReady == 1) |
| | | { |
| | | commonStackerCrane.Communicator.Write<short>("DB1.6.0", 1); |
| | | } |
| | |
| | | { |
| | | WriteDebug(nameof(CommonStackerCraneJob), $"æåæºæå宿ï¼åä¼ WMS失败ï¼ä»»å¡å·{task3001.TaskNum}"); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | if (!string.IsNullOrEmpty(Levels[0]) && !string.IsNullOrEmpty(Levels[1])) |
| | | { |
| | | int level = Convert.ToInt16(Levels[0]) - Convert.ToInt16(Levels[1]); |
| | | |
| | | //å©ä½å±æ°åå
¥ |
| | | bool issuccess = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth + ".0", Convert.ToInt16(level)); |
| | | WriteDebug(nameof(CommonStackerCraneJob), $"å©ä½å±æ°ä¿¡å·åå
¥{level}-ä»»å¡å·{taskSmall.TaskNum}"); |
| | | |
| | | |
| | | //妿å½åæå屿°çäºæ»å±æ°ï¼å表示æè½¦ææç屿°åå® |
| | | if (level == 0) |
| | | { |
| | |
| | | { |
| | | //æ ¹æ®ç®æ å°åæ¥è¯¢ç»ç«æºç«ç¹ä¿¡æ¯ï¼è·ååå
¥æ´è½¦å®æçDBå Depth |
| | | Dt_LocationInfo location2 = _locationInfoRepository.QueryFirst(x => x.LocationCode == location.Remark); |
| | | //æ´è½¦å®æåå
¥ |
| | | bool issuccess2 = commonStackerCrane.Communicator.Write<short>("DB28." + location.Depth+".0", 1); |
| | | //æ´è½¦å®æåå
¥å±æ° |
| | | int sn = 0; |
| | | if(taskSmall.SourceAddress== "SC01-001-006-001"|| taskSmall.SourceAddress == "SC01-001-012-001"|| taskSmall.SourceAddress == "SC01-001-018-001" || taskSmall.SourceAddress == "SC01-001-022-001"|| taskSmall.SourceAddress == "SC01-001-026-001") |
| | | { |
| | | sn = 1; |
| | | } |
| | | else if(taskSmall.SourceAddress == "SC01-001-007-001" || taskSmall.SourceAddress == "SC01-001-013-001" || taskSmall.SourceAddress == "SC01-001-019-001" || taskSmall.SourceAddress == "SC01-001-023-001" || taskSmall.SourceAddress == "SC01-001-027-001") |
| | | { |
| | | sn = 2; |
| | | } |
| | | else |
| | | { |
| | | sn = 3; |
| | | } |
| | | bool issuccess2 = commonStackerCrane.Communicator.Write<short>("DB28." + location2.Depth+".0", Convert.ToInt16(sn)); |
| | | if (issuccess2&&issuccess) |
| | | { |
| | | _taskService.UpdateTaskStatus(taskSmall.TaskId, (int)TaskOutStatusEnum.OutFinish); |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(CommonStackerCraneJob), "æ¥è¯¢æåå
¥PLCç¶æå¤±è´¥ï¼", ex); |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | |
| | | |
| | | WriteDebug("大å åæºè¿è¡æ¥å¿", "ç»ææ¶é´" + DateTime.Now); |
| | | //}); |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | |
| | | using HslCommunication; |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | try |
| | | { |
| | | WriteDebug("å°å åæºè¿è¡æ¥å¿", "å¼å§æ¶é´" + DateTime.Now); |
| | | CommonStackerCrane? stackerCraneOne = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC02") as CommonStackerCrane; |
| | | CommonStackerCrane? stackerCraneTwo = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "SC03") as CommonStackerCrane; |
| | | WriteDebug(nameof(DoubleStackerCraneJob), $"å°å åæºä»»å¡æ§è¡ä¸..."); |
| | | |
| | | //Dt_DeviceInfo deviceSC02= _deviceInfoRepository.QueryFirst(x => x.DeviceCode == "SC02"); |
| | | //Dt_DeviceInfo deviceSC03 = _deviceInfoRepository.QueryFirst(x => x.DeviceCode == "SC03"); |
| | | //if(deviceSC02.DeviceStatus=="0") |
| | | //{ |
| | | // stackerCraneOne = null; |
| | | //} |
| | | //if(deviceSC03.DeviceStatus=="0") |
| | | //{ |
| | | // stackerCraneTwo = null; |
| | | //} |
| | | stackerCraneOne.CheckStackerCraneTaskCompleted(); |
| | | try |
| | | { |
| | | |
| | | Dt_Task? task = GetTask(); |
| | | |
| | | if (task != null) |
| | | { |
| | | WriteDebug("å°å åæºè¿è¡æ¥å¿", $"å°å åæºä»»å¡å·{task.TaskNum}"); |
| | | CommonStackerCrane? StackerCrane= GetStrackerCrane(task, stackerCraneOne, stackerCraneTwo); |
| | | if(StackerCrane != null) |
| | | { |
| | |
| | | else |
| | | { |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, "å åæºæ§è¡ä»»å¡å½ä»¤å¤±è´¥ï¼"); |
| | | WriteDebug(nameof(CommonStackerCraneJob), "å åæºæ§è¡ä»»å¡å½ä»¤å¤±è´¥ï¼"); |
| | | WriteDebug(nameof(DoubleStackerCraneJob), "å åæºæ§è¡ä»»å¡å½ä»¤å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | WriteDebug(nameof(CommonStackerCraneJob), "æªæ¥è¯¢å°å½åå¯ä»¥æ§è¡ä¸æä»»å¡çå°å åæºï¼"); |
| | | WriteDebug(nameof(DoubleStackerCraneJob), "æªæ¥è¯¢å°å½åå¯ä»¥æ§è¡ä¸æä»»å¡çå°å åæºï¼"); |
| | | } |
| | | |
| | | } |
| | |
| | | { |
| | | WriteError(nameof(CommonStackerCraneJob), "å°å åæºæ§è¡ä»»å¡å¼å¸¸ï¼", ex); |
| | | } |
| | | |
| | | //读åå åæºä»»å¡å·åä»»å¡å®æç¡®è®¤ç¶æ |
| | | //Task.Run(delegate |
| | | //{ |
| | | |
| | | try |
| | | { |
| | | if (stackerCraneOne != null) |
| | | { |
| | | byte IsFinish = stackerCraneOne.Communicator.Read<byte>("DB106.22"); |
| | | int tasknum = stackerCraneOne.Communicator.Read<int>("DB106.18"); |
| | | if (IsFinish == 6) |
| | | { |
| | | if (stackerCraneOne.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) |
| | | { |
| | | //ææ¶ å
å5:å®æç¡®è®¤ ä¿¡å· |
| | | _taskService.StackCraneTaskCompleted(tasknum); |
| | | stackerCraneOne.SetValue(StackerCraneDBName.WorkType, 5); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (stackerCraneTwo != null) |
| | | { |
| | | //读åå åæºä»»å¡å·åä»»å¡å®æç¡®è®¤ç¶æ |
| | | byte IsFinish = stackerCraneTwo.Communicator.Read<byte>("DB106.22"); |
| | | int tasknum = stackerCraneTwo.Communicator.Read<int>("DB106.18"); |
| | | if (IsFinish == 6) |
| | | { |
| | | if (stackerCraneTwo.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5) |
| | | { |
| | | _taskService.StackCraneTaskCompleted(tasknum); |
| | | stackerCraneTwo.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(DoubleStackerCraneJob), "æ¥è¯¢æåå
¥PLCç¶æå¤±è´¥ï¼", ex); |
| | | } |
| | | |
| | | |
| | | //}); |
| | | |
| | | WriteDebug("å°å åæºè¿è¡æ¥å¿", "ç»ææ¶é´" + DateTime.Now); |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | |
| | | { |
| | | if (stackerCraneOne != null) |
| | | { |
| | | if (!stackerCraneOne.IsEventSubscribed) |
| | | { |
| | | stackerCraneOne.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | |
| | | if (stackerCraneOne.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && stackerCraneOne.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | stackerCraneOne.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | if (stackerCraneOne.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | return stackerCraneOne; |
| | |
| | | |
| | | if (deviceSC02.DeviceStatus=="0"&& stackerCraneTwo != null) |
| | | { |
| | | if (!stackerCraneTwo.IsEventSubscribed) |
| | | { |
| | | stackerCraneTwo.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | //if (!stackerCraneTwo.IsEventSubscribed) |
| | | //{ |
| | | // stackerCraneTwo.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | //} |
| | | if (stackerCraneTwo.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && stackerCraneTwo.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | stackerCraneTwo.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | //stackerCraneTwo.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | if (stackerCraneTwo.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | //todo:ä»»å¡è¡¨ä¸çRoadWayåæ¢ä¸ºSC03 |
| | | |
| | | return stackerCraneTwo; |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if(stackerCraneTwo != null) |
| | | { |
| | | if (stackerCraneTwo.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && stackerCraneTwo.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | if (stackerCraneTwo.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | //todo:ä»»å¡è¡¨ä¸çRoadWayåæ¢ä¸ºSC03 |
| | | |
| | | return stackerCraneTwo; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | else if (task.Roadway=="SC03") |
| | | { |
| | | if (stackerCraneTwo != null) |
| | | { |
| | | if (!stackerCraneTwo.IsEventSubscribed) |
| | | { |
| | | stackerCraneTwo.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | // if (!stackerCraneTwo.IsEventSubscribed) |
| | | // { |
| | | // stackerCraneTwo.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | // } |
| | | if (stackerCraneTwo.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && stackerCraneOne.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | stackerCraneTwo.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | //stackerCraneTwo.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | if (stackerCraneTwo.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | return stackerCraneTwo; |
| | |
| | | Dt_DeviceInfo deviceSC03 = _deviceInfoRepository.QueryFirst(x => x.DeviceCode == "SC03"); |
| | | if (deviceSC03.DeviceStatus=="0"&&stackerCraneOne != null) |
| | | { |
| | | if (!stackerCraneOne.IsEventSubscribed) |
| | | { |
| | | stackerCraneOne.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | } |
| | | //if (!stackerCraneOne.IsEventSubscribed) |
| | | //{ |
| | | // stackerCraneOne.StackerCraneTaskCompletedEventHandler += CommonStackerCrane_StackerCraneTaskCompletedEventHandler;//订é
ä»»å¡å®æäºä»¶ |
| | | //} |
| | | if (stackerCraneOne.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && stackerCraneTwo.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | stackerCraneOne.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | //stackerCraneOne.CheckStackerCraneTaskCompleted();//鲿¢ä»»å¡å®æäºä»¶çæµè¶
æ¶ï¼åæå¨è§¦å䏿¬¡ |
| | | if (stackerCraneOne.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | //todoï¼ä»»å¡è¡¨ä¸çRoadWayåæ¢ä¸ºSC03 |
| | | return stackerCraneOne; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if(stackerCraneOne != null) |
| | | { |
| | | if (stackerCraneOne.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && stackerCraneOne.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | if (stackerCraneOne.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | return stackerCraneOne; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |