| | |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_IWMSPart; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_Model.Models.System; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_SystemServices; |
| | | using WIDESEAWCS_TaskInfoService; |
| | | using WIDESEAWCS_Tasks.OHT; |
| | | using static System.Collections.Specialized.BitVector32; |
| | |
| | | private readonly IRepository<dt_outstockinfo> _outStockRepository; |
| | | private readonly IRepository<dt_batchInfo> _batchInfoRepository; |
| | | private readonly IRepository<Dt_StockInfo> _StockInfoRepository; |
| | | private readonly IRepository<dt_Thickness_hty> _dt_Thickness_hty; |
| | | private readonly IRepository<dt_Weight_hty> _dt_Weight_hty; |
| | | private readonly IRepository<Dt_LocationInfo> _LocationInfoRepository; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | |
| | |
| | | IRepository<dt_storagemode> storagemodeRepository, |
| | | IRepository<dt_batchInfo> batchInfoRepository, |
| | | IRepository<Dt_StockInfo> StockInfoRepository, |
| | | IRepository<dt_Thickness_hty> ThicknessHtyService, |
| | | IRepository<dt_Weight_hty> WeightHtyService, |
| | | IRepository<Dt_LocationInfo> LocationInfoRepository, |
| | | IUnitOfWorkManage unitOfWorkManage) |
| | | { |
| | |
| | | _StockInfoRepository = StockInfoRepository; |
| | | _LocationInfoRepository = LocationInfoRepository; |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _dt_Thickness_hty = ThicknessHtyService; |
| | | _dt_Weight_hty = WeightHtyService; |
| | | } |
| | | |
| | | //宿¶æ¸
空ä¸å¨çæ¶é´ |
| | | private static int shijian = 604800; |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | | Console.WriteLine("1"); |
| | | //return Task.CompletedTask; |
| | | //宿¶æ¸
空ééåå度åå²è®°å½ |
| | | Thread.Sleep(1000); |
| | | if(shijian > 0) |
| | | { |
| | | shijian--; |
| | | } |
| | | else |
| | | { |
| | | List<dt_Weight_hty> weights = _dt_Weight_hty.QueryData(); |
| | | _dt_Weight_hty.DeleteData(weights); |
| | | List<dt_Thickness_hty> Thickness = _dt_Thickness_hty.QueryData(); |
| | | _dt_Thickness_hty.DeleteData(Thickness); |
| | | shijian = 604800; |
| | | } |
| | | |
| | | bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value); |
| | | if (flag && value != null) |
| | | { |
| | |
| | | { |
| | | Dt_Task task = new Dt_Task(); |
| | | var storagemode = _storagemodeRepository.QueryFirst(v => v.Id == 1); |
| | | if (OHTJob.oHTReadData.R_RGVMode && OHTJob.oHTReadData.R_DK_isready)//RGVä¸ææ¨¡å¼ï¼ä¸è¥¿è·¨æ¶åæä¸æä¿¡å· |
| | | |
| | | if (OHTJob.oHTReadData.R_RGVMode && OHTJob.oHTReadData.R_XK_isready)//RGVä¸ææ¨¡å¼ï¼ä¸è¥¿è·¨æ¶åæä¸æä¿¡å· |
| | | { |
| | | var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "西跨æ¶å"); |
| | | task.SourceAddress = station.Row + "-" + station.Column + "-1"; |
| | | var oldhtytask = _dt_taskRepositiry.QueryFirst(v => v.SourceAddress == task.SourceAddress); |
| | | if (oldhtytask == null) |
| | | { |
| | | task.TargetAddress = _locationInfoService.GetInLocation(storagemode.storagemode).LocationCode; |
| | | if (OHTJob.oHTReadData.R_DK_isready) |
| | | { |
| | | task.Grade = 3; |
| | | } |
| | | else |
| | | { |
| | | task.Grade = 2; |
| | | } |
| | | task.Remark = (int)MateTypeEnum.ZiChan; |
| | | //æ¥æ¾ç¸é»çåºä½ |
| | | Dt_LocationInfo Towlocation = new Dt_LocationInfo(); |
| | | var Onelocation = _LocationInfoRepository.QueryFirst(v => v.LocationCode == task.TargetAddress); |
| | | if (Onelocation.Depth == 1) |
| | | { |
| | | Towlocation = _LocationInfoRepository.QueryFirst(v => v.Row == Onelocation.Row && v.Column == Onelocation.Column && v.Depth == 2); |
| | | } |
| | | else |
| | | { |
| | | Towlocation = _LocationInfoRepository.QueryFirst(v => v.Row == Onelocation.Row && v.Column == Onelocation.Column && v.Depth == 1); |
| | | } |
| | | task.NextAddress = Towlocation.LocationCode; |
| | | task.Roadway = "TC01"; |
| | | task.TaskType = (int)TaskInboundTypeEnum.Inbound; |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; |
| | | task.PalletCode = "text"; |
| | | task.CurrentAddress = "text"; |
| | | task.WMSId = 3; |
| | | _dt_taskRepositiry.AddData(task); |
| | | } |
| | | } |
| | | else if (OHTJob.oHTReadData.R_RGVMode && OHTJob.oHTReadData.R_DK_isready)//RGVä¸ææ¨¡å¼ï¼ä¸ä¸è·¨æ¶åæä¸æä¿¡å· |
| | | { |
| | | var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "ä¸è·¨æ¶å"); |
| | | task.SourceAddress = station.Row + "-" + station.Column + "-1"; |
| | |
| | | _dt_taskRepositiry.AddData(task); |
| | | } |
| | | } |
| | | if (OHTJob.oHTReadData.R_RGVMode && OHTJob.oHTReadData.R_XK_isready)//RGVä¸ææ¨¡å¼ï¼ä¸ä¸è·¨æ¶åæä¸æä¿¡å· |
| | | { |
| | | |
| | | |
| | | var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "西跨æ¶å"); |
| | | task.SourceAddress = station.Row + "-" + station.Column + "-1"; |
| | | var oldhtytask = _dt_taskRepositiry.QueryFirst(v => v.SourceAddress == task.SourceAddress); |
| | | if (oldhtytask == null) |
| | | { |
| | | task.TargetAddress = _locationInfoService.GetInLocation(storagemode.storagemode).LocationCode; |
| | | if (OHTJob.oHTReadData.R_DK_isready) |
| | | { |
| | | task.Grade = 2; |
| | | } |
| | | else |
| | | { |
| | | task.Grade = 1; |
| | | } |
| | | task.Remark = (int)MateTypeEnum.ZiChan; |
| | | //æ¥æ¾ç¸é»çåºä½ |
| | | Dt_LocationInfo Towlocation = new Dt_LocationInfo(); |
| | | var Onelocation = _LocationInfoRepository.QueryFirst(v => v.LocationCode == task.TargetAddress); |
| | | if (Onelocation.Depth == 1) |
| | | { |
| | | Towlocation = _LocationInfoRepository.QueryFirst(v => v.Row == Onelocation.Row && v.Column == Onelocation.Column && v.Depth == 2); |
| | | } |
| | | else |
| | | { |
| | | Towlocation = _LocationInfoRepository.QueryFirst(v => v.Row == Onelocation.Row && v.Column == Onelocation.Column && v.Depth == 1); |
| | | } |
| | | task.NextAddress = Towlocation.LocationCode; |
| | | task.Roadway = "TC01"; |
| | | task.TaskType = (int)TaskInboundTypeEnum.Inbound; |
| | | task.TaskState = (int)TaskInStatusEnum.InNew; |
| | | task.PalletCode = "text"; |
| | | task.CurrentAddress = "text"; |
| | | task.WMSId = 3; |
| | | _dt_taskRepositiry.AddData(task); |
| | | } |
| | | } |
| | | |
| | | if (OHTJob.oHTReadData.R_CCMode && OHTJob.oHTReadData.R_DK_isready) |
| | | { |
| | | var station = _dt_stationInfoRepository.QueryFirst(v => v.msg == "ä¸è·¨æ¶å"); |
| | |
| | | task.TargetAddress = _locationInfoService.GetInLocation(storagemode.storagemode).LocationCode; |
| | | if (OHTJob.oHTReadData.R_XK_isready) |
| | | { |
| | | task.Grade = 2; |
| | | task.Grade = 3; |
| | | } |
| | | else |
| | | { |
| | | task.Grade = 1; |
| | | task.Grade = 2; |
| | | } |
| | | task.Remark = (int)MateTypeEnum.WaiGou; |
| | | //æ¥æ¾ç¸é»çåºä½ |
| | |
| | | //æ¥è¯¢å½åéè¦åºåºçæ¹æ¬¡å·ï¼ä»¥ååºåºç©æç±»å |
| | | var batch = _batchInfoRepository.QueryFirst(v => v.Id == 1); |
| | | //æ¥è¯¢åºåç©æåºåä¿¡æ¯ |
| | | var stocks = _StockInfoRepository.QueryData(v => v.Remark == batch.materType && v.BatchNo == batch.OutBatch && v.StockStatus == 0) |
| | | .OrderBy(v => v.CreateDate).ToList(); |
| | | var stocks = _StockInfoRepository.QueryData(v => v.Remark == batch.materType && v.BatchNo == batch.OutBatch && v.StockStatus == 0).OrderBy(v => v.CreateDate).ToList(); |
| | | if (stocks.Count <= 0) |
| | | { |
| | | throw new Exception($"å½ååºå䏿²¡æã{batch.materType}ãï¼0èªäº§ 1å¤è´ï¼ä¸æ¹æ¬¡ä¸ºã{batch.OutBatch}ãçç©æ"); |