AGV任务删除功能,取空托任务逻辑优化,检测上料任务下发逻辑优化(AGV备料两个)
| | |
| | | using WIDESEA_Comm.TaskNo; |
| | | using WIDESEA_WCS.JobsPart.Common; |
| | | using System.Xml.Linq; |
| | | using WIDESEA_Common; |
| | | |
| | | namespace WIDESEA_WCS |
| | | { |
| | |
| | | { |
| | | |
| | | #region 夿åºåå·æ¯å¦ä¸è´ |
| | | var area = Gantry_client.ReadByOrder<Int16>("place_prog", number);//æ¾æå®æçåºåå· |
| | | //var area = Gantry_client.ReadByOrder<Int16>("place_prog", number);//æ¾æå®æçåºåå· |
| | | |
| | | WriteLog.Write_Log(number + "åæå®æåºé", bindSNS[bindSNS.Length - 1], "夿åºåå·æ¯å¦ä¸è´", $"PCSåºåå·ï¼{AreaNr}ï¼\næ¡æ¶åºåå·ï¼{area}\né误信æ¯ï¼PCSåºåå·ä¸æ¡æ¶åºåå·ä¸ä¸è´ï¼"); |
| | | //WriteLog.Write_Log(number + "åæå®æåºé", bindSNS[bindSNS.Length - 1], "夿åºåå·æ¯å¦ä¸è´", $"PCSåºåå·ï¼{AreaNr}ï¼\næ¡æ¶åºåå·ï¼{area}\né误信æ¯ï¼PCSåºåå·ä¸æ¡æ¶åºåå·ä¸ä¸è´ï¼"); |
| | | //if (AreaNr != area) |
| | | //{ |
| | | // client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//æ¥è¦ |
| | |
| | | #endregion |
| | | |
| | | #region å¤æè½¦è½®æ°éæ¯å¦ä¸è´ |
| | | var quantity = Gantry_client.ReadByOrder<Int16>("pos_prog", number);//æ¡æ¶è®°å½ç车轮æ°é |
| | | //var quantity = Gantry_client.ReadByOrder<Int16>("pos_prog", number);//æ¡æ¶è®°å½ç车轮æ°é |
| | | |
| | | WriteLog.Write_Log(number + "åæå®æåºé", bindSNS[bindSNS.Length - 1], "å¤æè½¦è½®æ°éæ¯å¦ä¸è´", $"åºåå·ï¼{AreaNr}ï¼\næ¡æ¶è½¦è½®æ°ï¼{quantity}\nPCS车轮æ°ï¼{station.quantity}\né误信æ¯ï¼PCSåºåå·ä¸æ¡æ¶åºåå·ä¸ä¸è´ï¼"); |
| | | //WriteLog.Write_Log(number + "åæå®æåºé", bindSNS[bindSNS.Length - 1], "å¤æè½¦è½®æ°éæ¯å¦ä¸è´", $"åºåå·ï¼{AreaNr}ï¼\næ¡æ¶è½¦è½®æ°ï¼{quantity}\nPCS车轮æ°ï¼{station.quantity}\né误信æ¯ï¼PCSåºåå·ä¸æ¡æ¶åºåå·ä¸ä¸è´ï¼"); |
| | | //if (quantity != station.quantity) |
| | | //{ |
| | | // client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//æ¥è¦ |
| | |
| | | } |
| | | |
| | | #region æ´æ°ä¸ä¸ªæ£æµä¸æä»»å¡ |
| | | Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context); |
| | | if (!agvtaskService.Find(x => x.agv_toaddress == Station.stationCode).Any()) |
| | | { |
| | | var task = agvtaskService.Find(x => x.agv_taskstate == "Queue" && (x.agv_tasktype == "TaskType_OutsourceOutbound" || x.agv_tasktype == "TaskType_Outbound") && x.agv_toaddress == "").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault(); |
| | | if (task != null) |
| | | { |
| | | task.agv_taskstate = "Create"; |
| | | task.agv_toaddress = Station.stationCode; |
| | | agvtaskService.Update(task, true); |
| | | WriteDBLog.Success("æ´æ°ä¸ä¸ªæ£æµä¸æä»»å¡", $"ä»»å¡ç¼å·ï¼{task.agv_tasknum}", "PCS"); |
| | | } |
| | | } |
| | | //Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context); |
| | | //if (!agvtaskService.Find(x => x.agv_toaddress == Station.stationCode).Any()) |
| | | //{ |
| | | // var task = agvtaskService.Find(x => x.agv_taskstate == "Queue" && (x.agv_tasktype == "TaskType_OutsourceOutbound" || x.agv_tasktype == "TaskType_Outbound") && x.agv_toaddress == "").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault(); |
| | | // if (task != null) |
| | | // { |
| | | // task.agv_taskstate = "Create"; |
| | | // task.agv_toaddress = Station.stationCode; |
| | | // agvtaskService.Update(task, true); |
| | | // WriteDBLog.Success("æ´æ°ä¸ä¸ªæ£æµä¸æä»»å¡", $"ä»»å¡ç¼å·ï¼{task.agv_tasknum}", "PCS"); |
| | | // } |
| | | //} |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | agvtaskService.Update(task, true); |
| | | station.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(station, true); |
| | | WriteDBLog.Success("æ´æ°ç©ºæéåä»»å¡", $"ä»»å¡ç¼å·ï¼{task.agv_tasknum}ï¼æçä¿¡å·:{PalletSignal},è´§ç©ä¿¡å·:{MaterialSignal}", "PCS"); |
| | | WriteDBLog.Success("æ´æ°è¡¥ç©ºæéåä»»å¡", $"ä»»å¡ç¼å·ï¼{task.agv_tasknum}ï¼æçä¿¡å·:{PalletSignal},è´§ç©ä¿¡å·:{MaterialSignal}", "PCS"); |
| | | continue; |
| | | } |
| | | remark = "æ¥è¯¢ç©ºæå çä½"; |
| | | #region 空æå ç |
| | | if (stationCode.Contains("S")) |
| | | { |
| | | var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList(); |
| | | EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault(); |
| | | if (EmptyStation == null) |
| | | EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0 && x.enable).FirstOrDefault(); |
| | | if (EmptyStation == null) |
| | | { |
| | | EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.enable).OrderByDescending(x => x.quantity).FirstOrDefault(); |
| | | if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation); |
| | | } |
| | | } |
| | | #region æ£æµä¸æç空æå ç |
| | | //remark = "æ¥è¯¢ç©ºæå çä½"; |
| | | //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.enable).ToList(); |
| | | //if (stationCode.Contains("S")) |
| | | //{ |
| | | // //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList(); |
| | | // EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault(); |
| | | // if (EmptyStation == null) |
| | | // EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault(); |
| | | // if (EmptyStation == null) |
| | | // { |
| | | // EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault(); |
| | | // if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation); |
| | | // } |
| | | //} |
| | | //EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5).FirstOrDefault(); |
| | | //if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation); |
| | | #endregion |
| | | else |
| | | { |
| | | remark = "æ¥æ¾åºå
空æä½"; |
| | | EmptyStation = GetStation.EmptyPalletStation(area); |
| | | if (EmptyStation != null) |
| | | if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return; |
| | | } |
| | | |
| | | |
| | | if (EmptyStation != null) |
| | | { |
| | | #region åä¸ä¸ªç©ºæä½åªè½åæ¶çæä¸ä¸ªç©ºæä»»å¡ |
| | | //remark = "æ¥è¯¢ç©ºæä½æ¯å¦åå¨ä»»å¡"; |
| | | //if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) |
| | | // return; |
| | | #endregion |
| | | #region å建å空æéåä»»å¡ |
| | | dt_agvtask agvtask = new dt_agvtask() |
| | | { |
| | | agv_fromaddress = station.stationCode, |
| | |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = "Create", |
| | | agv_taskstate = AGVTaskStateEnum.Queue.ToString(), |
| | | //agv_materielid = station.stationType, |
| | | agv_qty = 1, |
| | | StarQuantity = 0, |
| | | EndQuantity = EmptyStation.quantity, |
| | | agv_tasktype = "TaskType_EmptyPallet", |
| | | agv_toaddress = EmptyStation.stationCode, |
| | | EndQuantity = 0,//EmptyStation.quantity, |
| | | agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(), |
| | | agv_toaddress = "",//EmptyStation.stationCode, |
| | | agv_userid = "ç³»ç»", |
| | | agv_TrayStatus = "EmptyTray",//station.tray_status, |
| | | agv_Traytype = station.tray_type, |
| | |
| | | agvtaskService.Add(agvtask, true); |
| | | station.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(station, true); |
| | | EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(EmptyStation, true); |
| | | WriteDBLog.Success("å建èªå¨å空æä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}ï¼æçä¿¡å·:{PalletSignal},è´§ç©ä¿¡å·:{MaterialSignal}", "PCS"); |
| | | } |
| | | //EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | //stationinfoRepository.Update(EmptyStation, true); |
| | | WriteDBLog.Success("å建èªå¨å空æéåä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}ï¼æçä¿¡å·:{PalletSignal},è´§ç©ä¿¡å·:{MaterialSignal}", "PCS"); |
| | | #endregion |
| | | |
| | | #region å建åç©ºææ°å»ºä»»å¡ |
| | | //else |
| | | //{ |
| | | // remark = "æ¥æ¾åºå
空æä½"; |
| | | // EmptyStation = GetStation.EmptyPalletStation(area); |
| | | // if (EmptyStation != null) |
| | | // if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return; |
| | | //} |
| | | |
| | | |
| | | //if (EmptyStation != null) |
| | | //{ |
| | | // dt_agvtask agvtask = new dt_agvtask() |
| | | // { |
| | | // agv_fromaddress = station.stationCode, |
| | | // agv_id = Guid.NewGuid(), |
| | | // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | // agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1, |
| | | // agv_createtime = DateTime.Now, |
| | | // agv_taskstate = AGVTaskStateEnum.Create.ToString(), |
| | | // //agv_materielid = station.stationType, |
| | | // agv_qty = 1, |
| | | // StarQuantity = 0, |
| | | // EndQuantity = EmptyStation.quantity, |
| | | // agv_tasktype = "TaskType_EmptyPallet", |
| | | // agv_toaddress = EmptyStation.stationCode, |
| | | // agv_userid = "ç³»ç»", |
| | | // agv_TrayStatus = "EmptyTray",//station.tray_status, |
| | | // agv_Traytype = station.tray_type, |
| | | // }; |
| | | // agvtaskService.Add(agvtask, true); |
| | | // station.location_state = LocationStateEnum.Busy.ToString(); |
| | | // stationinfoRepository.Update(station, true); |
| | | // EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | // stationinfoRepository.Update(EmptyStation, true); |
| | | // WriteDBLog.Success("å建èªå¨å空æä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}ï¼æçä¿¡å·:{PalletSignal},è´§ç©ä¿¡å·:{MaterialSignal}", "PCS"); |
| | | //} |
| | | #endregion |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //WriteDBLog.Error("å建èªå¨å空æä»»å¡", $"{stationCode}ï¼{remark}é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | WriteLog.Write_Log("æ¥éæ¥å¿", "å建èªå¨å空æä»»å¡", "é误信æ¯ï¼", $"{stationCode}ï¼{remark}é误信æ¯ï¼{ex.Message}"); |
| | | WriteLog.Write_Log("æ¥éæ¥å¿", "å建èªå¨å空æéåä»»å¡", "é误信æ¯ï¼", $"{stationCode}ï¼{remark}é误信æ¯ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //WriteDBLog.Error("å建èªå¨å空æä»»å¡", $"é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | WriteLog.Write_Log("æ¥éæ¥å¿", "å建èªå¨å空æä»»å¡", "é误信æ¯ï¼", $"é误信æ¯ï¼{ex.Message}"); |
| | | WriteLog.Write_Log("æ¥éæ¥å¿", "å建èªå¨å空æéåä»»å¡", "é误信æ¯ï¼", $"é误信æ¯ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | private void DoAction(IJobExecutionContext context) |
| | | { |
| | | EmptyTray.EmptyTrayIn();//空æå çå
¥åº |
| | | //EmptyTray.EmptyTrayIn();//空æå çå
¥åº |
| | | StationTask.CreateTask();//å
¥åº |
| | | OutboundTask.CreateOutboundTask();//åºåº |
| | | ReplaceTray.ReplaceTrayTask();//æ´æ¢æç |
| | |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Comm.TaskNo; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WCS.IRepositories; |
| | |
| | | var MaterialSignal = Pipeline_client.ReadByOrder<Int16>("R_MaterialSignal", station.stationCode);//读åè´§ç©ä¿¡å·:1:æ,2æ |
| | | if (PalletSignal == 2 && MaterialSignal == 2) |
| | | { |
| | | var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault(); |
| | | if (agv_task != null) |
| | | { |
| | | agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString(); |
| | | //agv_task.EndQuantity = EmptyStation.quantity; |
| | | agv_task.agv_toaddress = station.stationCode; |
| | | agvtaskRepository.Update(agv_task, true); |
| | | station.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(station, true); |
| | | WriteDBLog.Success("æ´æ°è¡¥ç©ºæä»»å¡", $"ä»»å¡ç¼å·ï¼{agv_task.agv_tasknum}", "PCS"); |
| | | } |
| | | else |
| | | { |
| | | dt_agvtask taskPart = new dt_agvtask() |
| | | { |
| | | agv_fromaddress = "", |
| | |
| | | agvtaskRepository.Add(taskPart, true); |
| | | WriteDBLog.Success("å建补空æä»»å¡", $"ä»»å¡ç¼å·ï¼{taskPart.agv_tasknum}", "PCS"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Comm.TaskNo; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WCS.IRepositories; |
| | |
| | | foreach (var station in stations) |
| | | { |
| | | if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode || x.agv_toaddress == station.stationCode).Any()) continue; |
| | | #region MyRegion |
| | | var types = station.tray_type.Split('/'); |
| | | var area = types[0] == "SmallTray" ? "11" : "10"; |
| | | //æ¾1åºåºç空æä½ |
| | | var EmptyStation = GetStation.EmptyPalletStation(area); |
| | | //var EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") /*&& x.location_state == "Empty"*/ && x.enable) |
| | | // .OrderBy(x => x.column).OrderBy(x => x.line).FirstOrDefault(); |
| | | //if (EmptyStation == null) |
| | | // EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") /*&& x.location_state == "Empty"*/ && x.enable) |
| | | // .OrderBy(x => x.line).OrderBy(x => x.column).FirstOrDefault(); |
| | | if (EmptyStation != null) |
| | | { |
| | | dt_agvtask agvtask = new dt_agvtask() |
| | | { |
| | | agv_fromaddress = station.stationCode, |
| | | agv_id = Guid.NewGuid(), |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = 2, |
| | | agv_grade = 1, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = "Create", |
| | | //agv_materielid = station.stationType, |
| | | agv_taskstate = AGVTaskStateEnum.Queue.ToString(), |
| | | agv_qty = 1, |
| | | StarQuantity = 0, |
| | | EndQuantity = EmptyStation.quantity, |
| | | agv_tasktype = "TaskType_EmptyPallet", |
| | | agv_toaddress = EmptyStation.stationCode, |
| | | EndQuantity = 0,//EmptyStation.quantity, |
| | | agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(), |
| | | agv_toaddress = "",//EmptyStation.stationCode, |
| | | agv_userid = "ç³»ç»", |
| | | agv_TrayStatus = station.tray_status, |
| | | //bindSN = station.bindSN, |
| | | //agv_worktype = Convert.ToInt32(mesinfo.processCode), |
| | | //agv_materbarcode = mesinfo.materialCode, |
| | | agv_Traytype = types[0] |
| | | }; |
| | | agvtaskRepository.Add(agvtask, true); |
| | | station.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(EmptyStation, true); |
| | | EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(EmptyStation, true); |
| | | stationinfoRepository.Update(station, true); |
| | | WriteDBLog.Success("åå»ºæ´æ¢ç©ºçä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray"); |
| | | //CreatePartQueue(agvtaskRepository, agvtask, types[1]); |
| | | } |
| | | #endregion |
| | | |
| | | #region MyRegion |
| | | //var types = station.tray_type.Split('/'); |
| | | //var area = types[0] == "SmallTray" ? "11" : "10"; |
| | | ////æ¾1åºåºç空æä½ |
| | | //var EmptyStation = GetStation.EmptyPalletStation(area); |
| | | //if (EmptyStation != null) |
| | | //{ |
| | | // dt_agvtask agvtask = new dt_agvtask() |
| | | // { |
| | | // agv_fromaddress = station.stationCode, |
| | | // agv_id = Guid.NewGuid(), |
| | | // agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | // agv_grade = 2, |
| | | // agv_createtime = DateTime.Now, |
| | | // agv_taskstate = "Create", |
| | | // agv_qty = 1, |
| | | // StarQuantity = 0, |
| | | // EndQuantity = EmptyStation.quantity, |
| | | // agv_tasktype = "TaskType_EmptyPallet", |
| | | // agv_toaddress = EmptyStation.stationCode, |
| | | // agv_userid = "ç³»ç»", |
| | | // agv_TrayStatus = station.tray_status, |
| | | // agv_Traytype = types[0] |
| | | // }; |
| | | // agvtaskRepository.Add(agvtask, true); |
| | | // station.location_state = LocationStateEnum.Busy.ToString(); |
| | | // stationinfoRepository.Update(station, true); |
| | | // EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | // stationinfoRepository.Update(EmptyStation, true); |
| | | // WriteDBLog.Success("åå»ºæ´æ¢ç©ºçä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | // CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray"); |
| | | //} |
| | | #endregion |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | if (agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString()) |
| | | if (GetStation.QueueStation(agvtask.agv_fromaddress)) return;//éå¶ä¸è¡ä¸æ¬¡åªè½åºä¸ä¸ªä»»å¡ |
| | | var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && (x.tray_status == TrayStateEnum.EmptyTray.ToString() || x.location_state == LocationStateEnum.Empty.ToString()) && x.enable).ToList(); |
| | | //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && (x.tray_status == TrayStateEnum.EmptyTray.ToString() || x.location_state == LocationStateEnum.Empty.ToString()) && x.enable).ToList(); |
| | | var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.enable).ToList(); |
| | | foreach (var EmptyStation in EmptyStations) |
| | | { |
| | | if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue; |
| | | agvtask.agv_taskstate = AGVTaskStateEnum.Create.ToString(); |
| | | agvtask.agv_toaddress = EmptyStation.stationCode; |
| | | EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(EmptyStation, true); |
| | | //EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | //stationinfoRepository.Update(EmptyStation, true); |
| | | agvtaskService.Update(agvtask, true); |
| | | WriteDBLog.Success("æ´æ°åºåºéåä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | return; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_Comm |
| | | { |
| | | /// <summary> |
| | | /// æçç¶æ |
| | | /// </summary> |
| | | public enum TrayStateEnum |
| | | { |
| | | /// <summary> |
| | | /// 空æç |
| | | /// </summary> |
| | | EmptyTray, |
| | | /// <summary> |
| | | /// 满æç |
| | | /// </summary> |
| | | StrogeTray |
| | | |
| | | } |
| | | /// <summary> |
| | | /// æçç±»å |
| | | /// </summary> |
| | | public enum TrayTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// å°æç |
| | | /// </summary> |
| | | SmallTray, |
| | | /// <summary> |
| | | /// 大æç |
| | | /// </summary> |
| | | LargeTray, |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WCS.JobsPart.Common; |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_WMS.Repositories; |
| | | using static System.Collections.Specialized.BitVector32; |
| | | |
| | | namespace WIDESEA_WMS.Common |
| | | { |
| | | public partial class AGVServer |
| | | { |
| | | /// <summary> |
| | | /// æ´æ°å空æéåä»»å¡ |
| | | /// </summary> |
| | | public static void UpdateEmptyPalletTask() |
| | | { |
| | | string tasknum = ""; |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | |
| | | #region å çåºæ»¡5个å
¥åº |
| | | var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.enable).ToList(); |
| | | var EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5).FirstOrDefault(); |
| | | if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD); |
| | | #endregion |
| | | var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault(); |
| | | if (agv_task != null) |
| | | { |
| | | tasknum = agv_task.agv_tasknum; |
| | | #region MyRegion |
| | | //var task = agvtaskRepository.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && x.agv_Traytype == agv_task.agv_Traytype).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault(); |
| | | //if (task != null) |
| | | //{ |
| | | // task.agv_fromaddress = station.stationCode; |
| | | // task.StarQuantity = 0; |
| | | // task.agv_taskstate = "Create"; |
| | | // if (station.stationCode.Contains("S0100100")) |
| | | // task.agv_grade = 3; |
| | | // agvtaskService.Update(task, true); |
| | | // station.location_state = LocationStateEnum.Busy.ToString(); |
| | | // stationinfoRepository.Update(station, true); |
| | | // WriteDBLog.Success("æ´æ°è¡¥ç©ºæéåä»»å¡", $"ä»»å¡ç¼å·ï¼{task.agv_tasknum}ï¼æçä¿¡å·:{PalletSignal},è´§ç©ä¿¡å·:{MaterialSignal}", "WMS"); |
| | | // return; |
| | | //} |
| | | #endregion |
| | | dt_stationinfo EmptyStation = null; |
| | | #region æ£æµä¸æç空æå ç |
| | | if (agv_task.agv_fromaddress.Contains("S")) |
| | | { |
| | | //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList(); |
| | | EmptyStation = EmptyStations.Where(x => x.tray_type == agv_task.agv_Traytype && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault(); |
| | | if (EmptyStation == null) |
| | | EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault(); |
| | | if (EmptyStation == null) |
| | | { |
| | | EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault(); |
| | | if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD); |
| | | } |
| | | } |
| | | #endregion |
| | | else |
| | | { |
| | | EmptyStation = GetStation.EmptyPalletStation(agv_task.agv_Traytype == "SmallTray" ? "11" : "10"); |
| | | } |
| | | |
| | | if (EmptyStation != null) |
| | | { |
| | | agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString(); |
| | | agv_task.EndQuantity = EmptyStation.quantity; |
| | | agv_task.agv_toaddress = EmptyStation.stationCode; |
| | | agvtaskRepository.Update(agv_task, true); |
| | | EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(EmptyStation, true); |
| | | WriteDBLog.Success("æ´æ°èªå¨å空æéåä»»å¡", $"ä»»å¡ç¼å·ï¼{agv_task.agv_tasknum}", "WMS"); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteLog.Write_Log("æ¥éæ¥å¿", "æ´æ°èªå¨å空æéåä»»å¡", "é误信æ¯ï¼", $"{tasknum}ï¼é误信æ¯ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_WMS.Repositories; |
| | | using static System.Collections.Specialized.BitVector32; |
| | | |
| | | namespace WIDESEA_WCS.JobsPart.Common |
| | | { |
| | | public class GetStation |
| | | { |
| | | /// <summary> |
| | | /// å½ååºä½åä¸è¡æ¯å¦åå¨å
¥åºå ç¨ |
| | | /// trueï¼æ¯ falseï¼å¦ |
| | | /// </summary> |
| | | /// <param name="StationCode"></param> |
| | | /// <returns></returns> |
| | | public static bool InBusyStation(string StationCode) |
| | | { |
| | | bool OK = false; |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault(); |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.location_state == LocationStateEnum.InBusy.ToString()).Any(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return OK; |
| | | } |
| | | /// <summary> |
| | | /// å½ååºä½åä¸è¡æ¯å¦åå¨åºåºå ç¨ |
| | | /// trueï¼æ¯ falseï¼å¦ |
| | | /// </summary> |
| | | /// <param name="StationCode"></param> |
| | | /// <returns></returns> |
| | | public static bool OutBusyStation(string StationCode) |
| | | { |
| | | bool OK = false; |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault(); |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.location_state == LocationStateEnum.OutBusy.ToString()).Any(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return OK; |
| | | } |
| | | /// <summary> |
| | | /// å½ååºä½å¤è¾¹çè´§ä½æ¯å¦é½ä¸ºç©º |
| | | /// trueï¼å¦ falseï¼æ¯ |
| | | /// </summary> |
| | | /// <param name="StationCode"></param> |
| | | /// <returns></returns> |
| | | public static bool QueueStation(string StationCode) |
| | | { |
| | | bool OK = false; |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault(); |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return OK; |
| | | } |
| | | /// <summary> |
| | | /// æ¾å¯å
¥åºç©ºæä½ |
| | | /// </summary> |
| | | public static void EmptyStation() |
| | | { |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context); |
| | | var Stations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity == 5 && x.enable).ToList(); |
| | | foreach (var Station in Stations) |
| | | { |
| | | var area = Station.tray_type == "SmallTray" ? "11" : "10"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | |
| | | public static dt_stationinfo Station(dt_stationinfo EmptyStation, Idt_stationinfoRepository stationinfoRepository) |
| | | { |
| | | dt_stationinfo stationinfo = null; |
| | | try |
| | | { |
| | | if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state.Contains("Busy")).Any()) return stationinfo; |
| | | |
| | | |
| | | stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.quantity > 0 && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | if (stationinfo != null) |
| | | { |
| | | if (stationinfo.quantity < 5) return stationinfo; |
| | | else |
| | | stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | } |
| | | else |
| | | { |
| | | stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | } |
| | | //if (stationinfo == null) |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return stationinfo; |
| | | } |
| | | /// <summary> |
| | | /// 空æå¯å
¥åºè´§ä½ |
| | | /// </summary> |
| | | /// <param name="area"></param> |
| | | /// <returns></returns> |
| | | public static dt_stationinfo EmptyPalletStation(string area) |
| | | { |
| | | dt_stationinfo stationinfo = null; |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | |
| | | #region æ¥æ¾ç©ºæçåºåº |
| | | //if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any() && area != "10") |
| | | if (stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any()) |
| | | { |
| | | var EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01005002" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault(); |
| | | if (EmptyStation != null) |
| | | { |
| | | if (!stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any()) |
| | | return EmptyStation; |
| | | } |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002" && x.location_state == "Stroge" && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); |
| | | |
| | | |
| | | if (EmptyStation != null) stationinfo = Station(EmptyStation, stationinfoRepository); |
| | | if (stationinfo != null) return stationinfo; |
| | | |
| | | EmptyStation = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | |
| | | if (EmptyStation.quantity == 5) |
| | | { |
| | | EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01004002" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault(); |
| | | if (EmptyStation != null) |
| | | { |
| | | if (!stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any()) |
| | | return EmptyStation; |
| | | } |
| | | |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" && x.location_state == "Stroge" && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); |
| | | if (EmptyStation != null) stationinfo = Station(EmptyStation, stationinfoRepository); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any()) return stationinfo; |
| | | stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | if (stationinfo != null) |
| | | if (stationinfo.quantity < 5) return stationinfo; |
| | | stationinfo = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 夿å½åè´§ä½æ¯å¦åå¨ä»»å¡ |
| | | if (stationinfo != null) |
| | | if (agvtaskService.Find(x => /*x.agv_fromaddress == stationinfo.stationCode ||*/ x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null; |
| | | #endregion |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw; |
| | | } |
| | | return stationinfo; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Comm.TaskNo; |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_WMS.Repositories; |
| | | |
| | | namespace WIDESEA_WCS.JobsPart.Common |
| | | { |
| | | public class EmptyTray |
| | | { |
| | | /// <summary> |
| | | /// 空æå çå
¥åº |
| | | /// </summary> |
| | | public static void EmptyTrayIn() |
| | | { |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5 && x.enable).ToList(); |
| | | foreach (var EmptyStation in EmptyStations) |
| | | { |
| | | CreateEmptyTrayIn(stationinfoRepository, EmptyStation); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteDBLog.Success("å建å çä½ç©ºæå
¥åºä»»å¡", $"é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// å建空æå çå
¥åºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="stationinfoRepository"></param> |
| | | /// <param name="EmptyStation"></param> |
| | | public static void CreateEmptyTrayIn(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo EmptyStation) |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | try |
| | | { |
| | | if (agvtaskRepository.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return; |
| | | var area = EmptyStation.tray_type == "SmallTray" ? "11" : "10"; |
| | | var toEmptyStation = GetStation.EmptyPalletStation(area); |
| | | if (toEmptyStation != null) |
| | | { |
| | | #region åä¸ä¸ªç©ºæä½åªè½åæ¶çæä¸ä¸ªç©ºæä»»å¡ |
| | | if (agvtaskRepository.Find(x => x.agv_fromaddress == toEmptyStation.stationCode || x.agv_toaddress == toEmptyStation.stationCode).Any()) return; |
| | | #endregion |
| | | |
| | | dt_agvtask agvtask = new dt_agvtask() |
| | | { |
| | | agv_fromaddress = EmptyStation.stationCode, |
| | | agv_id = Guid.NewGuid(), |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = 3, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = "Create", |
| | | //agv_materielid = station.stationType, |
| | | agv_qty = EmptyStation.quantity - toEmptyStation.quantity, |
| | | StarQuantity = toEmptyStation.quantity, |
| | | EndQuantity = toEmptyStation.quantity, |
| | | agv_tasktype = "TaskType_EmptyPallet", |
| | | agv_toaddress = toEmptyStation.stationCode, |
| | | agv_userid = "ç³»ç»", |
| | | agv_TrayStatus = "EmptyTray",//station.tray_status, |
| | | agv_Traytype = EmptyStation.tray_type, |
| | | }; |
| | | agvtaskRepository.Add(agvtask, true); |
| | | EmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(EmptyStation, true); |
| | | toEmptyStation.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(toEmptyStation, true); |
| | | WriteDBLog.Success("å建å çä½ç©ºæå
¥åºä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteDBLog.Error("å建å çä½ç©ºæå
¥åºä»»å¡", $"é误信æ¯ï¼{ex.Message}", "PCS"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | using StackExchange.Redis; |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Entity.DomainModels.Mes; |
| | | using WIDESEA_WMS.Common; |
| | | using System.Reflection.Emit; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_WMS.Services |
| | | { |
| | |
| | | //å¤ç§æ·ä¼ç¨å°è¿init代ç ï¼å
¶ä»æ
åµå¯ä»¥ä¸ç¨ |
| | | //base.Init(dbRepository); |
| | | } |
| | | |
| | | public override WebResponseContent Del(object[] keys, bool delList = true) |
| | | { |
| | | #region æ¹éä¿®æ¹è´§ä½ç¶æ |
| | | //VOLContext context = new VOLContext(); |
| | | //Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context); |
| | | //var fromaddress = repository.Find(x => keys.Contains(x.agv_id)).Select(x => x.agv_fromaddress).ToList(); |
| | | //var stations = stationinfoRepository.Find(x => fromaddress.Contains(x.stationCode)).ToList(); |
| | | //foreach (var station in stations) |
| | | //{ |
| | | // station.location_state = LocationStateEnum.Stroge.ToString(); |
| | | // //station.tray_type= TrayTypeEnum.SmallTray.ToString(); |
| | | // //station.tray_status= TrayStateEnum.StrogeTray.ToString(); |
| | | //} |
| | | //stationinfoRepository.UpdateRange(stations, x => new { x.location_state }, true); |
| | | #endregion |
| | | VOLContext volContext = new VOLContext(); |
| | | Idt_agvtask_htyRepository agvtask_HtyRepository=new dt_agvtask_htyRepository(volContext); |
| | | var agvtasks = repository.Find(x => keys.Contains(x.agv_id)).ToList(); |
| | | List<dt_agvtask_hty> dt_Agvtask_Hties = new List<dt_agvtask_hty>(); |
| | | foreach (var task in agvtasks) |
| | | { |
| | | dt_agvtask_hty agvtask_Hty = new dt_agvtask_hty() |
| | | { |
| | | hty_pkid = Guid.NewGuid(), |
| | | agv_id = task.agv_id, |
| | | agv_tasknum = task.agv_tasknum, |
| | | agv_materielid = task.agv_materielid, |
| | | agv_qty = task.agv_qty, |
| | | agv_createtime = task.agv_createtime, |
| | | agv_realesstime = task.agv_realesstime, |
| | | agv_executingBeginTime = task.agv_executingBeginTime, |
| | | agv_executingEndTime = task.agv_executingEndTime, |
| | | agv_completeBeginTime = task.agv_completeBeginTime, |
| | | agv_finishedtime = task.agv_finishedtime, |
| | | agv_taskstate = task.agv_taskstate, |
| | | agv_tasktype = task.agv_tasktype, |
| | | agv_fromaddress = task.agv_fromaddress, |
| | | agv_toaddress = task.agv_toaddress, |
| | | agv_operatetype = "Del", |
| | | agv_compeletor = UserContext.Current.UserName, |
| | | agv_completedate = DateTime.Now, |
| | | agv_grade = task.agv_grade, |
| | | agv_userid = task.agv_userid, |
| | | agv_Traytype = task.agv_Traytype, |
| | | agv_TrayStatus = task.agv_TrayStatus, |
| | | agv_worktype = task.agv_worktype, |
| | | agv_remark = task.agv_remark, |
| | | bindSN = task.bindSN, |
| | | jobID = task.jobID, |
| | | agv_materbarcode = task.agv_materbarcode, |
| | | }; |
| | | dt_Agvtask_Hties.Add(agvtask_Hty); |
| | | } |
| | | agvtask_HtyRepository.AddRange(dt_Agvtask_Hties,true); |
| | | return base.Del(keys, delList); |
| | | } |
| | | public WebResponseContent addNgTask(MesRequestTemp requestTemp) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | var agv_id = saveModel.MainData["agv_id"].ToString(); |
| | | var task = _repository.Find(x => x.agv_id.ToString() == agv_id).FirstOrDefault(); |
| | | if (task.agv_taskstate != AGVTaskStateEnum.Queue.ToString()) return content.Error("å½åä»»å¡ä¸å¯æ´æ¹ï¼"); |
| | | WriteDBLog.Success($"æå¨ä¿®æ¹ä»»å¡", new { æ°æ® = saveModel }, "WMS", UserContext.Current.UserName); |
| | | return base.Update(saveModel); |
| | | } |
| | | #region æ·»å NGä»»å¡ |
| | |
| | | [Invoke(Begin = "2024-01-01 00:00", Interval = 1000 * 5, /*IsEnabled = true,*/ SkipWhileExecuting = true)] |
| | | public void TaskTime() |
| | | { |
| | | AGVServer.UpdateEmptyPalletTask(); |
| | | AGVServer.SendAgvTask(); |
| | | } |
| | | } |