已删除1个文件
已修改11个文件
已添加1个文件
已重命名4个文件
| | |
| | | public string AGVArea { get; set; } |
| | | |
| | | public int PalletType { get; set; } |
| | | /// <summary> |
| | | /// AGVä»»å¡å· |
| | | /// </summary> |
| | | public string AGVTaskNum { get; set; } |
| | | } |
| | | } |
| | |
| | | if (agvUpdateModel == null) throw new Exception("æªè·åå°è¯·æ±åæ°"); |
| | | agvResponseContent.ReqCode = agvUpdateModel.ReqCode; |
| | | var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum); |
| | | if (task == null) throw new Exception($"æªæ¾å°ä»»å¡,ä»»å¡å·ã{agvUpdateModel.TaskCode}ã"); |
| | | if (task == null && agvUpdateModel.Method!= "begin") throw new Exception($"æªæ¾å°ä»»å¡,ä»»å¡å·ã{agvUpdateModel.TaskCode}ã"); |
| | | switch (agvUpdateModel.Method) |
| | | { |
| | | case "begin": |
| | |
| | | } |
| | | else |
| | | { |
| | | task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | if (task.Roadway!="SC01_ZH") |
| | | { |
| | | task.AgvTaskNum = item.AGVArea + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | } |
| | | List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.StartPosi); |
| | | if (routers.FirstOrDefault() == null) |
| | | { |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç«å°é
置信æ¯"); |
| | | } |
| | | |
| | | task.NextAddress = stationManger?.AGVStationCode ?? ""; |
| | | task.DeviceCode = stationManger?.Remark ?? ""; |
| | | task.TaskState = TaskStatusEnum.AGV_Execute.ObjToInt(); |
| | | task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | } |
| | | } |
| | | |
| | |
| | | WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString()); |
| | | if (taskDTO != null) |
| | | { |
| | | taskDTO.AGVTaskNum = agvTaskCode; |
| | | content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | content.Error(responseContent.Message); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | |
| | | { |
| | | try |
| | | { |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.New.ObjToInt() || x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && nameof(AGV_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()) && nameof(AGV_PPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | foreach (var task in newTasks) |
| | | { |
| | | try |
| | |
| | | WriteError(nameof(AGV_FLJob), ex.Message, ex); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// ä¸åAGVç»§ç»æ§è¡ä»»å¡ |
| | | /// </summary> |
| | | public void SendAGVWaitToTask() |
| | | { |
| | | try |
| | | { |
| | | var WaitToTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt() && nameof(AGV_CSJJob).Contains(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | foreach (var WaitToTask in WaitToTasks) |
| | | { |
| | | if (WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | if (WaitToTasks.FirstOrDefault(x => x.TaskState == TaskStatusEnum.AGV_Puting.ObjToInt() || x.TaskState == TaskStatusEnum.Finish.ObjToInt()) != null) |
| | | { |
| | | continue; |
| | | } |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.NextAddress); |
| | | if (stationManger == null) |
| | | { |
| | | continue; |
| | | } |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | bool canPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode); |
| | | bool requestPut = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_PutRequest, stationManger.StationCode); |
| | | if (!requestPut) |
| | | { |
| | | otherDevice.SetValue(GroundStationDBName.W_PutRequest, true, stationManger.StationCode); |
| | | continue; |
| | | } |
| | | else if (!canPut) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == WaitToTask.CurrentAddress); |
| | | if (stationManger == null) |
| | | { |
| | | continue; |
| | | } |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | continue; |
| | | } |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | bool canTake = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); |
| | | bool requestTake = otherDevice.GetValue<GroundStationDBName, bool>(GroundStationDBName.W_TakeRequest, stationManger.StationCode); |
| | | if (!requestTake) |
| | | { |
| | | otherDevice.SetValue(GroundStationDBName.W_TakeRequest, true, stationManger.StationCode); |
| | | continue; |
| | | } |
| | | else if (!canTake) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | AgvSecureReplyDTO replyDTO = new AgvSecureReplyDTO() |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), //WaitToTask.TaskNum.ToString(), |
| | | taskCode = WaitToTask.AgvTaskNum, |
| | | }; |
| | | WebResponseContent content = _taskService.AgvSecureReply(replyDTO); |
| | | if (content.Status && WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | WaitToTask.TaskState = TaskStatusEnum.AGV_Puting.ObjToInt(); |
| | | _taskService.UpdateTask(WaitToTask, TaskStatusEnum.AGV_Puting); |
| | | break; |
| | | } |
| | | else if (content.Status && WaitToTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | WaitToTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | _taskService.UpdateTask(WaitToTask, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else |
| | | { |
| | | WaitToTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | WaitToTask.ExceptionMessage = content.Message; |
| | | _taskService.UpdateTask(WaitToTask, TaskStatusEnum.Exception); |
| | | } |
| | | } |
| | | _taskService.UpdateData(WaitToTasks); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(AGV_CSJJob) + ":" + ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | [Description("æå空æ¡ååº")] |
| | | EmptyProductBack = 630, |
| | | /// <summary> |
| | | /// é»çå
¥åº |
| | | /// é»çå
¥åºå°ä»¶ |
| | | /// </summary> |
| | | [Description("é»çå
¥åº")] |
| | | InZHProduct = 640, |
| | | [Description("é»çå
¥åºå°ä»¶")] |
| | | InZHProductSmall = 640, |
| | | /// <summary> |
| | | /// é»çå
¥åºå¤§ä»¶ |
| | | /// </summary> |
| | | [Description("é»çå
¥åºå¤§ä»¶")] |
| | | InZHProductLarge = 645, |
| | | /// <summary> |
| | | /// å··éå
ç§»åº |
| | | /// </summary> |
| | |
| | | /// |
| | | /// </summary> |
| | | public int PalletType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// AGVä»»å¡å· |
| | | /// </summary> |
| | | public string AGVTaskNum { get; set; } |
| | | } |
| | | } |
| | |
| | | /// <param name="tasks"></param> |
| | | /// <param name="agvDescription"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = ""); |
| | | WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "", string agvtaskNum = ""); |
| | | |
| | | /// <summary> |
| | | /// |
| | |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="agvDescription"></param> |
| | | /// <returns></returns> |
| | | WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = ""); |
| | | WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "", string agvtaskNum = ""); |
| | | |
| | | /// <summary> |
| | | /// ç³è¯·å
¥åºä»»å¡(PDA使ç¨ï¼ä»
æçç»å®å
¥åºç«å°ï¼ä¸åé
è´§ä½) |
| | |
| | | /// ä»»å¡ä¿¡æ¯æ¨éè³WCS |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "") |
| | | public WebResponseContent PushTasksToWCS(List<Dt_Task> tasks, string agvDescription = "",string agvtaskNum="") |
| | | { |
| | | try |
| | | { |
| | |
| | | taskDTOs.ForEach(x => |
| | | { |
| | | x.AGVArea = agvDescription; |
| | | x.AGVTaskNum = agvtaskNum; |
| | | }); |
| | | string url = AppSettings.Get("WCS"); |
| | | if (string.IsNullOrEmpty(url)) |
| | |
| | | /// ä»»å¡ä¿¡æ¯æ¨éè³WCS |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "") |
| | | public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "", string agvtaskNum = "") |
| | | { |
| | | try |
| | | { |
| | |
| | | taskDTOs.ForEach(x => |
| | | { |
| | | x.AGVArea = agvDescription; |
| | | x.AGVTaskNum = agvtaskNum; |
| | | }); |
| | | |
| | | string url = AppSettings.Get("WCS"); |
| | |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using System; |
| | | using System.Collections; |
| | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); |
| | | //è·ååºåè®°å½ |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId).Includes(x => x.Details).ToList(); |
| | | x.WarehouseId == warehouse.WarehouseId && x.PalletCode== palletCode).Includes(x => x.Details).ToList(); |
| | | if (stockInfos.Count > 0) |
| | | { |
| | | return content.Error($"è½½å
·æçå·²åå¨"); |
| | | } |
| | | Dt_StockInfo? stockInfoOld = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == materialLot)); |
| | | if (stockInfoOld != null) |
| | | { |
| | | return content.Error($"åºåä¿¡æ¯å·²åå¨"); |
| | | } |
| | | Dt_PalletTypeInfo palletTypeInfo = _palletTypeInfoRepository.QueryFirst(x=>x.CodeStartStr== palletType); |
| | | if (palletTypeInfo != null) |
| | | if (palletTypeInfo == null) |
| | | { |
| | | return content.Error($"æçç±»åä¿¡æ¯ä¸åå¨"); |
| | | } |
| | |
| | | WebResponseContent requestLotInfo = GetZHMesMaterialLot(materialLot); |
| | | if (!requestLotInfo.Status) |
| | | { |
| | | return content.Error($"{requestLotInfo.Message}"); |
| | | return content.Error($"请æ±é»çæ¹æ¬¡ä¿¡æ¯å¤±è´¥,{requestLotInfo.Message}"); |
| | | } |
| | | MesLotInfoModel mesLotInfo = JsonConvert.DeserializeObject<MesLotInfoModel>(requestLotInfo.Data.ToString()); |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | |
| | | Grade = 0, |
| | | PalletCode = palletCode, |
| | | NextAddress = "", |
| | | Roadway = "", |
| | | Roadway = "SC01_ZH", |
| | | SourceAddress = "AGV_ZH", |
| | | TargetAddress = "", |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = (int)TaskTypeEnum.InZHProduct, |
| | | TaskType = (int)TaskTypeEnum.InZHProductSmall, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = palletTypeInfo.PalletType, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(stockInfo).Include(x => x.Details).ExecuteCommand(); |
| | |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskIn }, "AGV_ZH"); ; |
| | | content.OK(); |
| | | content.OK(data: taskIn); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | return Service.AssignInboundTaskLocationByHeight(taskNum, roadwayNo, heightType); |
| | | } |
| | | [HttpPost, HttpGet, Route("RequestZHInboundTask"), AllowAnonymous] |
| | | public WebResponseContent RequestZHInboundTask(string agvTaskCode, string palletCode, string palletType, string materialLot) |
| | | { |
| | | return Service.RequestZHInboundTask(agvTaskCode,palletCode,palletType,materialLot); |
| | |
| | | /// <param name="agvDescription"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("PushTasksToWCSSingle"), AllowAnonymous] |
| | | public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "") |
| | | public WebResponseContent PushTasksToWCSSingle(int taskNum, string agvDescription = "", string agvtaskNum = "") |
| | | { |
| | | return Service.PushTasksToWCSSingle(taskNum, agvDescription); |
| | | return Service.PushTasksToWCSSingle(taskNum, agvDescription, agvtaskNum); |
| | | } |
| | | /// <summary> |
| | | /// éæ©åºåçæåºåºä»»å¡ |