Merge branch 'master' of http://115.159.85.185:8098/r/SuZhouGuanHong/TaiYuanTaiZhong
| | |
| | | /// <summary> |
| | | /// å¼å¸¸ |
| | | /// </summary> |
| | | Abnormal |
| | | Abnormal, |
| | | /// <summary> |
| | | /// æ¡æ¶ä¸æ |
| | | /// </summary> |
| | | Load |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Comm.TaskNo; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Core.Extensions; |
| | | using WIDESEA_Core.FreeDB; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WCS.IRepositories; |
| | |
| | | station.heatNumber = Mes_Work.heatID; |
| | | station.tray_status = "StrogeTray"; |
| | | } |
| | | |
| | | station.remark = ""; |
| | | var count = stationinfoRepository.Update(station, true); |
| | | if (count < 1) |
| | | throw new Exception($"䏿ä½ä¿¡æ¯æ´æ°å¤±è´¥ï¼ä¸æä½ç¼å·ï¼{station.stationCode}"); |
| | |
| | | var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client); |
| | | if (!Request) continue; |
| | | |
| | | //var Area = client.ReadByOrder<Int16>("W_AreaNr", name);//读åè´§ä½å·ä¿¡æ¯ |
| | | //if (Area != 0) continue; |
| | | |
| | | #region è¯»åæ¡æ¶ä¿¡æ¯ |
| | | var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//车轮类å |
| | |
| | | client.WriteByOrder("W_Enabl_Load", false, name);//ä¿¡å·ä¸ºfalseæ¡æ¶åæ¢è¿å
¥ |
| | | //WriteDBLog.Error(name, $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\n\næªæ¥è¯¢å°å·¥åä¿¡æ¯", "PCS"); |
| | | WriteLog.Write_Log(name + "ç³è¯·æ¾æå¼å¸¸", Wheel_id, "æ¥è¯¢æºå 工工å", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNå·ï¼{Wheel_id}æªæ¥è¯¢å°å·¥åä¿¡æ¯\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\næ¯å¦å
è®¸ä¸æï¼{false}"); |
| | | continue; |
| | | } |
| | | |
| | | |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | var wheel = Pipeline.QueryMateriel(Work.drawingNo); |
| | | var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo); |
| | | if (wheel == null && wheel1 == null) |
| | |
| | | #endregion |
| | | continue; |
| | | } |
| | | |
| | | #region æ¢å¾å·,䏿å£å
¶ä»å¾å·æçå
¨é¨å
¥åº |
| | | var stations = Stations.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).ToList(); |
| | | foreach (var station in stations) |
| | | { |
| | | if (station.stationCode == NGStation || name == "3åå
䏿åº") |
| | | agvtask(stationinfoRepository, station, Work, "TaskType_OutsourceInbound"); |
| | | else |
| | | agvtask(stationinfoRepository, station, Work, "TaskType_Inbound"); |
| | | } |
| | | #endregion |
| | | |
| | | var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok |
| | | |
| | |
| | | if (Stationinfo == null) |
| | | { |
| | | #region 触åNGä»»å¡ |
| | | var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault(); |
| | | var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.Number != Work.workOrder && x.quantity > 0).FirstOrDefault(); |
| | | if (NG != null) |
| | | { |
| | | if (NG.stationType != Work.drawingNo || NG.Number != Work.workOrder) |
| | | agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound"); |
| | | } |
| | | agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound"); |
| | | #endregion |
| | | |
| | | Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault(); |
| | |
| | | { |
| | | |
| | | #region æ¢ç±»åç´æ¥å
¥åº |
| | | var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault(); |
| | | if (stationinfo1 != null) |
| | | agvtask(stationinfoRepository, stationinfo1, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | //var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault(); |
| | | //if (stationinfo1 != null) |
| | | // agvtask(stationinfoRepository, stationinfo1, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | #endregion |
| | | |
| | | #region æç车轮å å第å个æ¶ä¸åå¦å¤ä¸ä¸ªçå·çå
¥åºä»»å¡ |
| | |
| | | client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | Stationinfo.remark = "æ¡æ¶ä¸æ"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | #region æ¥å¿è®°å½ |
| | | //WriteDBLog.Success(name + "å
è®¸æ¾æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\nè½®åIDï¼{Wheel_Type}\nè½¦è½®ç¶æï¼OK" +$"\n读åæçå
çµä¿¡å·ï¼{PalletSignal}" + |
| | | // $"\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\n䏿ä½å·ï¼{area}\n第å 个车轮ï¼{(Stationinfo.quantity + 1)}\næçç±»åï¼1\nW_Enabl_Loadï¼true", "PCS"); |
| | |
| | | #region 没æçå¯ç¨,触åå
¥åºä»»å¡ |
| | | if (!Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state != LocationStateEnum.Stroge.ToString()).Any()) |
| | | { |
| | | var station = Stations.Where(x => x.enable && x.stationCode != NGStation).OrderBy(x => x.lastUpdateTime).FirstOrDefault(); |
| | | var station = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString()).OrderBy(x => x.lastUpdateTime).FirstOrDefault(); |
| | | agvtask(stationinfoRepository, station, Work, name == "3åå
䏿åº" ? "TaskType_OutsourceInbound" : "TaskType_Inbound"); |
| | | } |
| | | #endregion |
| | |
| | | Stationinfo.tray_type = Stationinfo.tray_type == "SmallTray" ? "SmallTray/LargeTray" : "LargeTray/SmallTray"; |
| | | Stationinfo.remark = "æçç±»åä¸ä¸è´éæ´æ¢æç"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | continue; |
| | | } |
| | | #endregion |
| | | var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList(); |
| | |
| | | client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//æçä¸ç第å 个车轮 |
| | | client.WriteByOrder("W_Storage_Type", (Int16)1, name);//æçç±»å1-横æ¾;2-ç«æ¾(ææ¶åªææ¨ªæ¾æç) |
| | | client.WriteByOrder("W_Enabl_Load", true, name);//æ¯å¦å
许 |
| | | Stationinfo.remark = "æ¡æ¶ä¸æ"; |
| | | stationinfoRepository.Update(Stationinfo, true); |
| | | #region æ¥å¿è®°å½ |
| | | //WriteDBLog.Success(name + "å
è®¸æ¾æ", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\n车轮SNï¼{Wheel_id}\nè½®åIDï¼{Wheel_Type}\nè½¦è½®ç¶æï¼NG" +$"\n读åæçå
çµä¿¡å·ï¼{PalletSignal}" + |
| | | // $"\n\nåå
¥æ¡æ¶ä¿¡æ¯ï¼\n䏿ä½å·ï¼{area}\n第å 个车轮ï¼{(Stationinfo.quantity + 1)}\næçç±»åï¼1\nW_Enabl_Loadï¼true", "PCS"); |
| | |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context); |
| | | Work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.processCode == "17").FirstOrDefault(); |
| | | var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault(); |
| | | if (task != null) return; |
| | | if (!string.IsNullOrEmpty(Work.area)) |
| | |
| | | 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 |
| | | |
| | | #region å建å空æéåä»»å¡ |
| | | dt_agvtask agvtask = new dt_agvtask() |
| | | { |
| | | remark = "æ¥æ¾åºå
空æä½"; |
| | | EmptyStation = GetStation.EmptyPalletStation(area); |
| | | if (EmptyStation != null) |
| | | if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return; |
| | | } |
| | | 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.Queue.ToString(), |
| | | //agv_materielid = station.stationType, |
| | | agv_qty = 1, |
| | | StarQuantity = 0, |
| | | 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"); |
| | | #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) |
| | | { |
| | | #region åä¸ä¸ªç©ºæä½åªè½åæ¶çæä¸ä¸ªç©ºæä»»å¡ |
| | | //remark = "æ¥è¯¢ç©ºæä½æ¯å¦åå¨ä»»å¡"; |
| | | //if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) |
| | | // return; |
| | | #endregion |
| | | 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 = "Create", |
| | | //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"); |
| | | } |
| | | //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; |
| | |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context); |
| | | List<string> strings = new List<string>() { }; |
| | | var stations = stationinfoRepository.Find(x => x.stationCode.Contains("X") || x.stationCode.Contains("W01001004") || x.stationCode.Contains("W01001005")).ToList(); |
| | | stations = stations.Where(x => x.location_state == "Empty" && x.enable).ToList(); |
| | | stations = stations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable).ToList(); |
| | | foreach (var station in stations) |
| | | { |
| | | if (agvtaskRepository.Find(x => x.agv_toaddress == station.stationCode).Any()) |
| | | continue; |
| | | var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", station.stationCode);//读åæçä¿¡å·:1:æ,2æ |
| | | var MaterialSignal = Pipeline_client.ReadByOrder<Int16>("R_MaterialSignal", station.stationCode);//读åè´§ç©ä¿¡å·:1:æ,2æ |
| | | |
| | | if (PalletSignal == 2 && MaterialSignal == 2) |
| | | { |
| | | dt_agvtask taskPart = new dt_agvtask() |
| | | if (station.remark == TrayTypeEnum.SmallTray.ToString() || station.remark == TrayTypeEnum.LargeTray.ToString()) station.tray_type = station.remark; |
| | | |
| | | var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress) && x.agv_Traytype == station.tray_type).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault(); |
| | | if (agv_task != null) |
| | | { |
| | | agv_fromaddress = "", |
| | | agv_id = Guid.NewGuid(), |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = station.stationCode.Contains("W0100100") ? 3 : 2, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = "Queue", |
| | | agv_qty = 1, |
| | | agv_tasktype = "TaskType_EmptyPallet", |
| | | agv_toaddress = station.stationCode, |
| | | agv_userid = "ç³»ç»", |
| | | agv_TrayStatus = "EmptyTray",// station.tray_status, |
| | | agv_Traytype = station.tray_type |
| | | }; |
| | | station.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(station, true); |
| | | agvtaskRepository.Add(taskPart, true); |
| | | WriteDBLog.Success("å建补空æä»»å¡", $"ä»»å¡ç¼å·ï¼{taskPart.agv_tasknum}", "PCS"); |
| | | 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 = "", |
| | | agv_id = Guid.NewGuid(), |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = station.stationCode.Contains("W0100100") ? 3 : 2, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = AGVTaskStateEnum.Queue.ToString(), |
| | | agv_qty = 1, |
| | | agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(), |
| | | agv_toaddress = station.stationCode, |
| | | agv_userid = "ç³»ç»", |
| | | agv_TrayStatus = TrayStateEnum.EmptyTray.ToString(),// station.tray_status, |
| | | agv_Traytype = station.tray_type |
| | | }; |
| | | station.location_state = LocationStateEnum.Busy.ToString(); |
| | | stationinfoRepository.Update(station, true); |
| | | agvtaskRepository.Add(taskPart, true); |
| | | WriteDBLog.Success("å建补空æä»»å¡", $"ä»»å¡ç¼å·ï¼{taskPart.agv_tasknum}", "PCS"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | 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(); |
| | | if (station.area == "10" || station.area == "11") |
| | | { |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column < station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any(); |
| | | } |
| | | else |
| | | { |
| | | 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) |
| | | { |
| | |
| | | var area = task.agv_Traytype == "SmallTray" ? "11" : "10"; |
| | | |
| | | #region ä¼å
åº3åºåºå
空æç |
| | | //if (area == "11") |
| | | //{ |
| | | // EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); |
| | | // if (EmptyStation == null) |
| | | // EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002"/* && x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); |
| | | // if (EmptyStation != null) |
| | | // EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == EmptyStation.area && x.line == EmptyStation.line /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | // if (EmptyStation != null)//空æè´§ä½ä¸ä¸ºç©ºå¤ææ¯å¦åå¨å
¶ä»ä»»å¡ |
| | | // if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; |
| | | // //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; |
| | | //} |
| | | #endregion |
| | | |
| | | #region æ¥æ¾ABåºåºå¯åºåºç©ºæè´§ä½ |
| | | if (area == "11") |
| | | { |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); |
| | | if (EmptyStation == null) |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002"/* && x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault(); |
| | | if (EmptyStation != null) |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == EmptyStation.area && x.line == EmptyStation.line /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | if (EmptyStation != null)//空æè´§ä½ä¸ä¸ºç©ºå¤ææ¯å¦åå¨å
¶ä»ä»»å¡ |
| | | if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; |
| | | //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; |
| | | //EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.lastUpdateTime).FirstOrDefault(); |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderBy(x => x.area).ThenBy(x => x.line).ThenByDescending(x => x.column).FirstOrDefault(); |
| | | if (EmptyStation != null)//å¿
é¡»åºå®ABåºç©ºææè½åºç©ºæåº |
| | | if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) return;// EmptyStation = null; |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥æ¾ç©ºæåºåº |
| | | if (EmptyStation == null) |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault(); |
| | | #endregion |
| | | |
| | | #region 空æè´§ä½ä¸ä¸ºç©ºå¤ææ¯å¦åå¨å
¶ä»ä»»å¡ |
| | | if (EmptyStation != null) |
| | | if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; |
| | | //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null; |
| | | if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null; |
| | | #endregion |
| | | |
| | | #region æ´æ°è¡¥ç©ºæéåä»»å¡ |
| | | if (EmptyStation != null) |
| | | { |
| | | var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", task.agv_toaddress);//读åæçä¿¡å·:1:æ,2æ |
| | |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context); |
| | | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context); |
| | | |
| | | var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderBy(x => x.CreateTime).ToList(); |
| | | var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList(); |
| | | foreach (var Mes_Work in Mes_Works) |
| | | { |
| | | var inventory = inventoryRepository.Find(x => x.SN == Mes_Work.SN).FirstOrDefault(); |
| | |
| | | stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault(); |
| | | if (stationinfo != null) |
| | | { |
| | | if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any()) continue; |
| | | |
| | | if (stationinfoRepository.Find(x => x.line == stationinfo.line && x.area == stationinfo.area && x.column > stationinfo.column && !x.enable).Any()) |
| | | continue; |
| | | if (string.IsNullOrEmpty(stationinfo.bindSN)) |
| | |
| | | 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; |
| | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// åå»ºæ´æ¢æçä»»å¡ |
| | | /// åå»ºæ´æ¢æçä»»å¡,éä¿®æ¹ |
| | | /// </summary> |
| | | public static void ReplaceTrayTask() |
| | | { |
| | |
| | | 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() |
| | | { |
| | | 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_materielid = station.stationType, |
| | | agv_qty = 1, |
| | | StarQuantity = 0, |
| | | EndQuantity = EmptyStation.quantity, |
| | | agv_tasktype = "TaskType_EmptyPallet", |
| | | 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); |
| | | WriteDBLog.Success("åå»ºæ´æ¢ç©ºçä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray"); |
| | | //CreatePartQueue(agvtaskRepository, agvtask, types[1]); |
| | | } |
| | | agv_fromaddress = station.stationCode, |
| | | agv_id = Guid.NewGuid(), |
| | | agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"), |
| | | agv_grade = 1, |
| | | agv_createtime = DateTime.Now, |
| | | agv_taskstate = AGVTaskStateEnum.Queue.ToString(), |
| | | agv_qty = 1, |
| | | StarQuantity = 0, |
| | | EndQuantity = 0,//EmptyStation.quantity, |
| | | agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(), |
| | | 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); |
| | | WriteDBLog.Success("åå»ºæ´æ¢ç©ºçä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray"); |
| | | #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) |
| | |
| | | else |
| | | GetStation.EmptyPalletStation(agvtask); |
| | | } |
| | | WriteDBLog.Success("æ´æ°ç©ºæéåä»»å¡", $"ä»»å¡ç¼å·ï¼{agvtask.agv_tasknum}", "PCS"); |
| | | } |
| | | else if (agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString() || agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString())//å¤ååºå
¥åº/ABåºå
¥åº |
| | | { |
| | |
| | | { |
| | | 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; |
| | |
| | | dt_stationinfo TargetLocation = null; |
| | | |
| | | #region 寻æ¾å·²åé
åå¾å·å
¥åºä»»å¡åºä½ |
| | | TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3")).FirstOrDefault(); |
| | | TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.enable && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3") && x.enable).FirstOrDefault(); |
| | | if (TargetLocation != null) |
| | | { |
| | | TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault(); |
| | |
| | | |
| | | #region æªæ¾å°åºåæå½ååºåè¡å·²æ»¡,å¯»æ¾æ°çä¸è¡ |
| | | var area = GetArea(mesinfo.quantity, agvtask.agv_Traytype); |
| | | TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault(); |
| | | TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).FirstOrDefault(); |
| | | if (TargetLocation == null && area != "4") |
| | | { |
| | | area = area == "2" ? "3" : "2"; |
| | | TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault(); |
| | | TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).FirstOrDefault(); |
| | | } |
| | | |
| | | #region æ¥çå½å空货ä½åæ¯å¦å卿æ |
| | |
| | | "Connection": { |
| | | "DBType": "MsSql", //MySql/MsSql/PgSql //æ°æ®åºç±»åï¼å¦æä½¿ç¨çæ¯sqlserveræ¤å¤åºè®¾ç½®ä¸ºMsSql |
| | | //sqlserverè¿æ¥å符串P@ssw0rd |
| | | "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;", |
| | | //"DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;", |
| | | //"DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;", |
| | | "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;", |
| | | |
| | | //mysqlè¿æ¥å符串(å级EFCore3.1å°æ¶å·²å°mysqlè¿æ¥å符串修æ¹,2019-12-20) |
| | | // "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;", |
| | |
| | | let loadingInstance; |
| | | let loadingStatus = false; |
| | | if (process.env.NODE_ENV == 'development') { |
| | | axios.defaults.baseURL = 'http://127.0.0.1:8098/'; |
| | | axios.defaults.baseURL = 'http://192.168.12.101:8098/'; |
| | | } |
| | | else if (process.env.NODE_ENV == 'debug') { |
| | | axios.defaults.baseURL = 'http://192.168.12.101:8098/'; |
| | |
| | | export default defineComponent({ |
| | | setup() { |
| | | const table = ref({ |
| | | key: 'ID', |
| | | key: 'agv_id', |
| | | footer: "Foots", |
| | | cnName: 'AGVä»»å¡', |
| | | name: 'taskinfo/dt_agvtask', |
| | |
| | | sortName: "ID" |
| | | }); |
| | | const editFormFields = ref({"agv_fromaddress":"","agv_toaddress":"","agv_tasktype":"","agv_grades":"","agv_code":""}); |
| | | const editFormOptions = ref([[{ |
| | | title: "NG䏿ä½", |
| | | required: false, |
| | | field: "agv_fromaddress", |
| | | type: "select", |
| | | data: [ |
| | | { key: "X01001003", value: "1åå
NG䏿ä½" }, |
| | | { key: "X02001003", value: "2åå
NG䏿ä½" }, |
| | | { key: "X03001002", value: "3åå
NG䏿ä½" } |
| | | ] |
| | | }, |
| | | // {"title":"NG䏿ä½","field":"agv_fromaddress","type":"text","required":true} |
| | | ], |
| | | const editFormOptions = ref([ |
| | | // [{ |
| | | // title: "NG䏿ä½", |
| | | // required: false, |
| | | // field: "agv_fromaddress", |
| | | // type: "select", |
| | | // data: [ |
| | | // { key: "X01001003", value: "1åå
NG䏿ä½" }, |
| | | // { key: "X02001003", value: "2åå
NG䏿ä½" }, |
| | | // { key: "X03001002", value: "3åå
NG䏿ä½" } |
| | | // ] |
| | | // }, |
| | | // // {"title":"NG䏿ä½","field":"agv_fromaddress","type":"text","required":true} |
| | | // ], |
| | | |
| | | // [{"title":"ç»ç¹å°å","field":"agv_toaddress","type":"text","required":true}], |
| | | // [{"dataKey":"task_grade","data":[],"title":"ä»»å¡ç级","required":true,"field":"agv_grade","type":"select"}], |
| | | // [{"dataKey":"agv_tasktypes","data":[],"title":"ä»»å¡ç±»å","required":true,"field":"agv_tasktype","type":"select"}] |
| | | [{"dataKey":"task_grade","data":[],"title":"ä»»å¡ç级","required":true,"field":"agv_grade","type":"select"}], |
| | | [{"dataKey":"agv_tasktypes","data":[],"title":"ä»»å¡ç±»å","required":true,"field":"agv_tasktype","type":"select"}] |
| | | // [{"dataKey":"agv_code","data":[],"title":"AGVç¼å·","required":true,"field":"agv_code","type":"select"}] |
| | | ]); |
| | | const searchFormFields = ref({"agv_tasknum":"","agv_fromaddress":"","agv_toaddress":"","agv_tasktype":[],"agv_taskstate":[],"agv_materielid":"","agv_createtime":"","agv_barcode":"","agv_materbarcode":""}); |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box :lazy="true" v-model="detialBox" title="æå¨ç§»åº" :height="350" :width="400" :padding="15"> |
| | | <vol-box :lazy="true" v-model="detialBox" title="NGä»»å¡" :height="350" :width="400" :padding="15"> |
| | | <div> |
| | | <el-form :model="formdata" label-width="120px" :rules="rules" size="mini" ref="ruleFormRef"> |
| | | <!-- <el-form-item label="ç±»å"> |
| | |
| | | </el-radio-group> |
| | | </el-form-item> --> |
| | | |
| | | <el-form-item v-if="inType == 'handle'" label="èµ·å§å°å" prop="from_address"> |
| | | <el-select v-model="formdata.from_address" clearable filterable placeholder="è¯·éæ©èµ·å§å°å"> |
| | | <el-option v-for="item in formAddressList" :label="item.key" :value="item.key" /> |
| | | <el-form-item v-if="inType == 'handle'" label="NG䏿ä½" prop="from_address"> |
| | | <el-select v-model="formdata.from_address" clearable filterable placeholder="è¯·éæ©NG䏿ä½"> |
| | | <el-option v-for="item in formAddressList" :label="item.value" :value="item.key" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç®çå°å" prop="to_address"> |
| | | <!-- <el-form-item label="ç®çå°å" prop="to_address"> |
| | | <el-select v-model="formdata.to_address" clearable filterable placeholder="è¯·éæ©ç®çå°å"> |
| | | <el-option v-for="item in toAddressList" :label="item.key" :value="item.key" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form-item> --> |
| | | <el-form-item label=""> |
| | | <el-button type="primary" @click="onSubmit()" size="mini"> 确认移åº</el-button> |
| | | <el-button type="primary" @click="onSubmit()" size="mini"> 确认添å NGä»»å¡</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | |
| | | export default { |
| | | components: { "vol-box": VolBox1Vue }, |
| | | methods: {}, |
| | | created() { |
| | | this.http.post("/api/Sys_Dictionary/GetVueDictionary", ["route_began", "route_end"]).then(x => { |
| | | x.forEach(item => { |
| | | if (item.dicNo == 'route_end') { |
| | | this.toAddressList = item.data; |
| | | } else if (item.dicNo == 'route_began') { |
| | | this.formAddressList = item.data; |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | // created() { |
| | | // this.http.post("/api/Sys_Dictionary/GetVueDictionary", ["route_began", "route_end"]).then(x => { |
| | | // x.forEach(item => { |
| | | // if (item.dicNo == 'route_end') { |
| | | // this.toAddressList = item.data; |
| | | // } else if (item.dicNo == 'route_began') { |
| | | // this.formAddressList = item.data; |
| | | // } |
| | | // }) |
| | | // }) |
| | | // }, |
| | | data() { |
| | | return { |
| | | detialBox: false, |
| | |
| | | from_address: "", |
| | | to_address: "" |
| | | }, |
| | | formAddressList: [], |
| | | formAddressList: [ |
| | | { key: "X01001003", value: "1åå
NG䏿ä½" }, |
| | | { key: "X02001003", value: "2åå
NG䏿ä½" }, |
| | | { key: "X03001002", value: "3åå
NG䏿ä½" } |
| | | ], |
| | | toAddressList: [] |
| | | }; |
| | | }, |
| | |
| | | var _this = this; |
| | | this.$refs.ruleFormRef.validate((valid) => { |
| | | if (valid) { |
| | | _this.http.post("/api/ToMes/AddToFloat3", _this.formdata, "æ£å¨æ·»å ....").then(x => { |
| | | if (!x.status) return _this.$Message.error(x.message); |
| | | _this.$Message.success("æ·»å æå!"); |
| | | _this.refresh(); |
| | | _this.http.post("/api/dt_agvtask/addNgTask", _this.formdata, "æ£å¨æ·»å ....").then(x => { |
| | | if (!x.status){ |
| | | _this.detialBox=false; |
| | | _this.formdata.from_address=""; |
| | | _this.$Message.error(x.message); |
| | | }else{ |
| | | _this.detialBox=false; |
| | | _this.formdata.from_address=""; |
| | | _this.$Message.success("æ·»å æå!"); |
| | | window.location.reload(); |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | |
| | | **åå°æä½è§ï¼http://v2.volcore.xyz/document/netCoreDev |
| | | *****************************************************************************************/ |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import addTask from "@/views/dialog/addTask" |
| | | |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridHeader: addTask, |
| | | gridBody: '', |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | |
| | | tableAction: '', //æå®æå¼ 表çæé(è¿éå¡«å表å,é»è®¤ä¸ç¨å¡«å) |
| | | buttons: { view: [], box: [], detail: [] }, //æ©å±çæé® |
| | | methods: { |
| | | // onClick: function () { |
| | | // this.add(); |
| | | // } |
| | | add(){ |
| | | this.$refs.gridHeader.detialBox = true; |
| | | }, |
| | | //ä¸é¢è¿äºæ¹æ³å¯ä»¥ä¿çä¹å¯ä»¥å é¤ |
| | | onInit() { //æ¡æ¶åå§åé
ç½®åï¼ |
| | | //示ä¾ï¼å¨æé®çæå颿·»å ä¸ä¸ªæé® |
| | |
| | | this.buttons.forEach(x => { |
| | | if(x.value == 'Add') |
| | | { |
| | | x.name = 'NGä»»å¡' |
| | | x.name = 'NGä»»å¡'; |
| | | } |
| | | }); |
| | | //示ä¾ï¼è®¾ç½®ä¿®æ¹æ°å»ºãç¼è¾å¼¹åºæ¡å段æ ç¾çé¿åº¦ |
| | |
| | | // this.$refs.table.$refs.table.toggleRowSelection(row); //åå»è¡æ¶éä¸å½åè¡; |
| | | }, |
| | | modelOpenAfter(row) { |
| | | // if(this.currentAction=='Add'){ |
| | | // this.editFormFields.agv_fromaddress='xxx'; |
| | | // } |
| | | //ç¹å»ç¼è¾ãæ°å»ºæé®å¼¹åºæ¡åï¼å¯ä»¥å¨æ¤å¤åé»è¾ï¼å¦ï¼ä»åå°è·åæ°æ® |
| | | //(1)夿æ¯ç¼è¾è¿æ¯æ°å»ºæä½ï¼ this.currentAction=='Add'; |
| | | //(2)ç»å¼¹åºæ¡è®¾ç½®é»è®¤å¼ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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, |
| | | } |
| | | } |
| | |
| | | [MaxLength(50)] |
| | | [Column(TypeName = "nvarchar(50)")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings = false)] |
| | | //[Required(AllowEmptyStrings = false)] |
| | | public string agv_tasknum { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | [MaxLength(20)] |
| | | [Column(TypeName = "nvarchar(20)")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings = false)] |
| | | //[Required(AllowEmptyStrings = false)] |
| | | public string agv_taskstate { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | [Display(Name = "å建æ¶é´")] |
| | | [Column(TypeName = "datetime")] |
| | | [Editable(true)] |
| | | [Required(AllowEmptyStrings = false)] |
| | | //[Required(AllowEmptyStrings = false)] |
| | | public DateTime agv_createtime { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | ///ä»»å¡ç±»å |
| | | /// </summary> |
| | | [Display(Name = "ä»»å¡ç±»å")] |
| | | [MaxLength(20)] |
| | | [Column(TypeName = "nvarchar(20)")] |
| | | [MaxLength(50)] |
| | | [Column(TypeName = "nvarchar(50)")] |
| | | [Editable(true)] |
| | | //[Required(AllowEmptyStrings = false)] |
| | | public string agv_tasktype { get; set; } |
| | |
| | | #endregion |
| | | } |
| | | /// <summary> |
| | | /// èµ·ç¹ä»»å¡ä¸åä¿¡æ¯ |
| | | /// </summary> |
| | | public class RequestFromTask |
| | | { |
| | | /// <summary> |
| | | /// ä½ä¸ä»»å¡å· |
| | | /// </summary> |
| | | public string TASK_NO { get; set; } |
| | | /// <summary> |
| | | /// èµ·ç¹ |
| | | /// </summary> |
| | | public string FROM_POSITION { get; set; } |
| | | /// <summary> |
| | | /// ç»ç¹ |
| | | /// </summary> |
| | | //public string TO_POSITION { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç级 |
| | | /// </summary> |
| | | public int? Grade { get; set; } = 0; |
| | | /// <summary> |
| | | /// æ°é |
| | | /// </summary> |
| | | public int Quantity { get; set; } |
| | | |
| | | ///<summary> |
| | | /// è½¬è¿æçæ¶ï¼èµ·ç¹åºé¨å 个æçï¼å
¥å å å®å
¨é¨è½¬è¿å为0ï¼å¦æè½¬è¿äºå±ä¸çä¸ä¸ªå为4ï¼ä¸é¢æ°éå为1 |
| | | ///</summary> |
| | | public int StarQuantity { get; set; } |
| | | |
| | | ///<summary> |
| | | /// è½¬è¿æçæ¶ï¼ç»ç¹åºé¨å 个æçï¼å
¥å å å®å
¨é¨è½¬è¿å为0ï¼å¦æè½¬è¿äºå±ä¸çä¸ä¸ªå为4ï¼ä¸é¢æ°éå为1 |
| | | ///</summary> |
| | | public int EndQuantity { get; set; } |
| | | /// <summary> |
| | | /// æçç±»å 1å°æçï¼2大æç |
| | | /// </summary> |
| | | public int TrayType { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç±»å 1转è¿è½¦è½®ä»»å¡ï¼2转è¿ç©ºæçä»»å¡ |
| | | /// </summary> |
| | | public int TaskType { get; set; } |
| | | /// <summary> |
| | | /// ç©æä¿¡æ¯ |
| | | /// </summary> |
| | | public string Material { get; set; } |
| | | #region è½¦è½®æ°æ® |
| | | public float A { get; set; } |
| | | public float B { get; set; } |
| | | public float C { get; set; } |
| | | public float D { get; set; } |
| | | public float E { get; set; } |
| | | public float F { get; set; } |
| | | public float G { get; set; } |
| | | public float H { get; set; } |
| | | #endregion |
| | | } |
| | | /// <summary> |
| | | /// ç»ç¹ä»»å¡ä¸åä¿¡æ¯ |
| | | /// </summary> |
| | | public class RequestToaddTask |
| | | { |
| | | /// <summary> |
| | | /// ä½ä¸ä»»å¡å· |
| | | /// </summary> |
| | | public string TASK_NO { get; set; } |
| | | /// <summary> |
| | | /// èµ·ç¹ |
| | | /// </summary> |
| | | //public string FROM_POSITION { get; set; } |
| | | /// <summary> |
| | | /// ç»ç¹ |
| | | /// </summary> |
| | | public string TO_POSITION { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç级 |
| | | /// </summary> |
| | | public int? Grade { get; set; } = 0; |
| | | /// <summary> |
| | | /// æ°é |
| | | /// </summary> |
| | | public int Quantity { get; set; } |
| | | |
| | | ///<summary> |
| | | /// è½¬è¿æçæ¶ï¼èµ·ç¹åºé¨å 个æçï¼å
¥å å å®å
¨é¨è½¬è¿å为0ï¼å¦æè½¬è¿äºå±ä¸çä¸ä¸ªå为4ï¼ä¸é¢æ°éå为1 |
| | | ///</summary> |
| | | public int StarQuantity { get; set; } |
| | | |
| | | ///<summary> |
| | | /// è½¬è¿æçæ¶ï¼ç»ç¹åºé¨å 个æçï¼å
¥å å å®å
¨é¨è½¬è¿å为0ï¼å¦æè½¬è¿äºå±ä¸çä¸ä¸ªå为4ï¼ä¸é¢æ°éå为1 |
| | | ///</summary> |
| | | public int EndQuantity { get; set; } |
| | | /// <summary> |
| | | /// æçç±»å 1å°æçï¼2大æç |
| | | /// </summary> |
| | | public int TrayType { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡ç±»å 1转è¿è½¦è½®ä»»å¡ï¼2转è¿ç©ºæçä»»å¡ |
| | | /// </summary> |
| | | public int TaskType { get; set; } |
| | | /// <summary> |
| | | /// ç©æä¿¡æ¯ |
| | | /// </summary> |
| | | public string Material { get; set; } |
| | | #region è½¦è½®æ°æ® |
| | | public float A { get; set; } |
| | | public float B { get; set; } |
| | | public float C { get; set; } |
| | | public float D { get; set; } |
| | | public float E { get; set; } |
| | | public float F { get; set; } |
| | | public float G { get; set; } |
| | | public float H { get; set; } |
| | | #endregion |
| | | } |
| | | /// <summary> |
| | | /// AGVåé¦ä¿¡æ¯ |
| | | /// </summary> |
| | | public class Respone |
| | |
| | | /// </summary> |
| | | public static void SendAgvTask() |
| | | { |
| | | WriteLog.Write_Log("èªå¨ä¸åä»»å¡", "SendAgvTask",""); |
| | | WriteLog.Write_Log("èªå¨ä¸åä»»å¡", "SendAgvTask", ""); |
| | | Respone respone = new Respone(); |
| | | RequestTask requestTask = new RequestTask(); |
| | | string postJson = string.Empty; |
| | | string report = string.Empty; |
| | | try |
| | | |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade) |
| | | .ThenBy(x => x.agv_createtime).ToList(); |
| | | if (agv_tasks.Count < 1) |
| | | agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && !string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade) |
| | | .ThenBy(x => x.agv_createtime).ToList(); |
| | | if (agv_tasks.Count > 0) |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade) |
| | | .ThenBy(x => x.agv_createtime).ToList(); |
| | | if (agv_tasks.Count < 1) |
| | | agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && !string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade) |
| | | .ThenBy(x => x.agv_createtime).ToList(); |
| | | if (agv_tasks.Count > 0) |
| | | foreach (var agv_task in agv_tasks) |
| | | { |
| | | foreach (var agv_task in agv_tasks) |
| | | try |
| | | { |
| | | var Materiel = QueryData.QueryMateriel(agv_task.agv_materielid);//æ¥æ¾è½¦è½®æ°æ® |
| | | var Materiel1 = QueryData.QueryMateriel1(agv_task.agv_materielid);//æ¥æ¾è½¦è½®æ°æ® |
| | |
| | | requestTask.H = Materiel == null ? Materiel1.h : Materiel.h; |
| | | } |
| | | postJson = JsonConvert.SerializeObject(requestTask); |
| | | report = Request.RequestData(postJson, "http://192.168.12.204:5000/api/TaskCreat/CreatTask"); |
| | | respone = JsonConvert.DeserializeObject<Respone>(report); |
| | | if (respone.Success) |
| | | { |
| | | agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString(); |
| | | agv_task.agv_realesstime = DateTime.Now; |
| | | agvtaskRepository.Update(agv_task, true); |
| | | WriteWMSLog.LogAdd(requestTask.TASK_NO, "æå ", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | } |
| | | else |
| | | { |
| | | agv_task.agv_remark = respone.Msg; |
| | | var task = agvtaskRepository.Find(x => x.agv_tasknum == agv_task.agv_tasknum && x.agv_remark == agv_task.agv_remark).FirstOrDefault();//.Exists |
| | | if (task == null) |
| | | agvtaskRepository.Update(agv_task, true); |
| | | WriteWMSLog.LogAdd(requestTask.TASK_NO, "失败 ", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | } |
| | | //report = Request.RequestData(postJson, AGVAPIAddress.IPAddress_AGVTask);//"http://192.168.12.204:5000/api/TaskCreat/CreatTask" |
| | | RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVTask); |
| | | //respone = JsonConvert.DeserializeObject<Respone>(report); |
| | | //if (respone.Success) |
| | | //{ |
| | | // agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString(); |
| | | // agv_task.agv_realesstime = DateTime.Now; |
| | | // agvtaskRepository.Update(agv_task, true); |
| | | // WriteWMSLog.LogAdd(requestTask.TASK_NO, "æå ", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | //} |
| | | //else |
| | | //{ |
| | | // agv_task.agv_remark = respone.Msg; |
| | | // var task = agvtaskRepository.Find(x => x.agv_tasknum == agv_task.agv_tasknum && x.agv_remark == agv_task.agv_remark).FirstOrDefault();//.Exists |
| | | // if (task == null) |
| | | // agvtaskRepository.Update(agv_task, true); |
| | | // WriteWMSLog.LogAdd(requestTask.TASK_NO, "失败 ", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | //} |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | respone.Success = false; |
| | | respone.Msg = ex.Message; |
| | | WriteWMSLog.LogAdd(requestTask.TASK_NO, "失败", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | respone.Success = false; |
| | | respone.Msg = ex.Message; |
| | | WriteWMSLog.LogAdd(requestTask.TASK_NO, "失败", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | //EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0&&x.lastUpdateTime.).FirstOrDefault();//æ¶é´è¶
è¿6å°æ¶å
¥åº |
| | | #endregion |
| | | |
| | | var agv_tasks = 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).ToList(); |
| | | foreach (var agv_task in agv_tasks) |
| | | { |
| | | try |
| | | { |
| | | 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 |
| | | #region MyRegion |
| | | //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.EmptyPalletStation1(agv_task.agv_Traytype == "SmallTray" ? "11" : "10"); |
| | | //} |
| | | |
| | | #endregion |
| | | |
| | | var EmptyStation = EmptyTray.GetEmptyTrayStation(stationinfoRepository, agv_task); |
| | | 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}"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteLog.Write_Log("æ¥éæ¥å¿", "æ´æ°èªå¨å空æéåä»»å¡", "é误信æ¯ï¼", $"{tasknum}ï¼é误信æ¯ï¼{ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | VOLContext context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context); |
| | | var station1 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_fromaddress); |
| | | var station2 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_toaddress); |
| | | |
| | | if (task.agv_taskstate == AGVTaskStateEnum.Complete1.ToString()) |
| | | { |
| | | var station2 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_toaddress); |
| | | ////空æä»»å¡éä¿®æ¹é»è¾ |
| | | if (station2.stationCode.Contains("X")) |
| | | station2.quantity = 0;// task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 0 : task.agv_qty; //task.agv_qty; |
| | |
| | | } |
| | | else if (task.agv_taskstate == AGVTaskStateEnum.Complete.ToString()) |
| | | { |
| | | var station1 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_fromaddress); |
| | | #region MyRegion |
| | | //if (station1.stationCode.Contains("S")) |
| | | // station1.quantity = 0; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_Entity.ToAGV; |
| | | using WIDESEA_WMS.IRepositories; |
| | | |
| | | namespace WIDESEA_WMS.Common |
| | | { |
| | | public partial class AGVServer |
| | | { |
| | | /// <summary> |
| | | /// åAGVè¯·æ± |
| | | /// </summary> |
| | | public static Respone RequestAGV(Idt_agvtaskRepository agvtaskRepository, dt_agvtask agv_task, string postJson, string IP) |
| | | { |
| | | var report = Request.RequestData(postJson, IP); |
| | | var respone = JsonConvert.DeserializeObject<Respone>(report); |
| | | if (respone.Success) |
| | | { |
| | | if (agv_task.agv_taskstate != AGVTaskStateEnum.Complete.ToString()) |
| | | agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString(); |
| | | if (agv_task.agv_taskstate == AGVTaskStateEnum.Complete.ToString()) |
| | | agv_task.agv_completeBeginTime = DateTime.Now; |
| | | else |
| | | agv_task.agv_realesstime = DateTime.Now; |
| | | agvtaskRepository.Update(agv_task, true); |
| | | WriteWMSLog.LogAdd(agv_task.agv_tasknum, "æå ", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | } |
| | | else |
| | | { |
| | | if (agv_task.agv_remark != respone.Msg) |
| | | agv_task.agv_remark = respone.Msg; |
| | | agvtaskRepository.Update(agv_task, true); |
| | | WriteWMSLog.LogAdd(agv_task.agv_tasknum, "失败 ", "AGV", "WMS", postJson, report, "ä¸åAGVä»»å¡", "SendAGVTask", respone.Msg); |
| | | } |
| | | return respone; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Entity.ToAGV; |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_WMS.Repositories; |
| | | |
| | | namespace WIDESEA_WMS.Common |
| | | { |
| | | public partial class AGVServer |
| | | { |
| | | /// <summary> |
| | | /// ä¸åèµ·ç¹ä»»å¡ |
| | | /// </summary> |
| | | public static void SendFromaddress() |
| | | { |
| | | try |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | RequestFromTask requestFromTask = new RequestFromTask(); |
| | | var agv_tasks = 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).ToList(); |
| | | foreach (var agv_task in agv_tasks) |
| | | { |
| | | try |
| | | { |
| | | requestFromTask.TASK_NO = agv_task.agv_tasknum; |
| | | requestFromTask.FROM_POSITION = agv_task.agv_fromaddress; |
| | | requestFromTask.Material = agv_task.agv_materielid; |
| | | requestFromTask.Grade = agv_task.agv_grade; |
| | | requestFromTask.Quantity = agv_task.agv_qty; |
| | | requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2; |
| | | requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1; |
| | | #region ç»/æç©ºçä»»å¡éå¤ç |
| | | requestFromTask.StarQuantity = agv_task.StarQuantity; |
| | | requestFromTask.EndQuantity = agv_task.EndQuantity; |
| | | #endregion |
| | | var postJson = JsonConvert.SerializeObject(requestFromTask); |
| | | RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVFromaddTask); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using Newtonsoft.Json; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Comm; |
| | | using WIDESEA_Common; |
| | | using WIDESEA_Core.EFDbContext; |
| | | using WIDESEA_Entity.ToAGV; |
| | | using WIDESEA_WCS.JobsPart.Common; |
| | | using WIDESEA_WMS.IRepositories; |
| | | using WIDESEA_WMS.Repositories; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; |
| | | |
| | | namespace WIDESEA_WMS.Common |
| | | { |
| | | public partial class AGVServer |
| | | { |
| | | /// <summary> |
| | | /// ä¸åç»ç¹ä»»å¡ |
| | | /// </summary> |
| | | public static void SendToaddress() |
| | | { |
| | | VOLContext Context = new VOLContext(); |
| | | Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context); |
| | | RequestToaddTask requestFromTask = new RequestToaddTask(); |
| | | var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Complete.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList(); |
| | | foreach (var agv_task in agv_tasks) |
| | | { |
| | | try |
| | | { |
| | | #region æ¥æ¾æ»¡è¶³æ¡ä»¶ç补空æä»»å¡ |
| | | var task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && x.agv_Traytype == agv_task.agv_Traytype && string.IsNullOrEmpty(x.agv_fromaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault(); |
| | | if (task != null) |
| | | { |
| | | requestFromTask.TASK_NO = agv_task.agv_tasknum; |
| | | requestFromTask.TO_POSITION = task.agv_toaddress; |
| | | requestFromTask.Material = agv_task.agv_materielid; |
| | | requestFromTask.Grade = agv_task.agv_grade; |
| | | requestFromTask.Quantity = agv_task.agv_qty; |
| | | requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2; |
| | | requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1; |
| | | #region ç»/æç©ºçä»»å¡éå¤ç |
| | | requestFromTask.StarQuantity = agv_task.StarQuantity; |
| | | requestFromTask.EndQuantity = task.EndQuantity; |
| | | #endregion |
| | | var postJson = JsonConvert.SerializeObject(requestFromTask); |
| | | var respone = RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVToaddTask); |
| | | if (respone.Success) |
| | | { |
| | | agv_task.EndQuantity = task.EndQuantity; |
| | | agv_task.agv_toaddress = task.agv_toaddress; |
| | | agvtaskRepository.Update(agv_task, true); |
| | | agvtaskRepository.Delete(task, true); |
| | | } |
| | | else |
| | | throw new Exception(respone.Msg); |
| | | WriteDBLog.Success("æ´æ°èªå¨å空æéåä»»å¡", $"ä»»å¡ç¼å·ï¼{agv_task.agv_tasknum}", "WMS"); |
| | | } |
| | | #endregion |
| | | else |
| | | { |
| | | #region æ¥æ¾æ»¡è¶³ä»»å¡æ¡ä»¶çå°å |
| | | var EmptyStation = EmptyTray.GetEmptyTrayStation(stationinfoRepository, agv_task); |
| | | if (EmptyStation != null) |
| | | { |
| | | //agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString(); |
| | | //agvtaskRepository.Update(agv_task, true);//æ¥çAGV任塿°æ®æ¯å¦å¨å¦ä¸ä¸ªæ¹æ³å
è¿è¡äºæ°æ®æ´æ° |
| | | |
| | | requestFromTask.TASK_NO = agv_task.agv_tasknum; |
| | | requestFromTask.TO_POSITION = EmptyStation.stationCode; |
| | | requestFromTask.Material = agv_task.agv_materielid; |
| | | requestFromTask.Grade = agv_task.agv_grade; |
| | | requestFromTask.Quantity = agv_task.agv_qty; |
| | | requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2; |
| | | requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1; |
| | | #region ç»/æç©ºçä»»å¡éå¤ç |
| | | requestFromTask.StarQuantity = agv_task.StarQuantity; |
| | | requestFromTask.EndQuantity = EmptyStation.quantity; |
| | | #endregion |
| | | var postJson = JsonConvert.SerializeObject(requestFromTask); |
| | | var respone = RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVToaddTask); |
| | | if (respone.Success) |
| | | { |
| | | 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); |
| | | } |
| | | else |
| | | throw new Exception(respone.Msg); |
| | | WriteDBLog.Success("æ´æ°èªå¨å空æéåä»»å¡", $"ä»»å¡ç¼å·ï¼{agv_task.agv_tasknum}", "WMS"); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteDBLog.Error("æ´æ°èªå¨å空æéåä»»å¡", $"ä»»å¡ç¼å·ï¼{agv_task.agv_tasknum}ï¼é误信æ¯ï¼{ex.Message}", "WMS"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_WMS.Common |
| | | { |
| | | public class AGVAPIAddress |
| | | { |
| | | /// <summary> |
| | | /// 宿´AGVä»»å¡ä¸åå°å |
| | | /// </summary> |
| | | public const string IPAddress_AGVTask = "http://192.168.12.204:5000/api/TaskCreat/CreatTask"; |
| | | /// <summary> |
| | | /// AGVèµ·ç¹ä»»å¡ä¸åå°å |
| | | /// </summary> |
| | | public const string IPAddress_AGVFromaddTask = "http://192.168.12.204:5000/api/TaskCreat/CreatGetPalletTask"; |
| | | /// <summary> |
| | | /// AGVç»ç¹ä»»å¡ä¸åå°å |
| | | /// </summary> |
| | | public const string IPAddress_AGVToaddTask = "http://192.168.12.204:5000/api/TaskCreat/CreatPutPalletTask"; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | if (station.area == "10" || station.area == "11") |
| | | { |
| | | OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column < station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any(); |
| | | } |
| | | else |
| | | { |
| | | 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) |
| | | { |
| | | |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æ¥æ¾å½åè¡å¯å
¥åºç©ºè´§ä½ |
| | | /// </summary> |
| | | /// <param name="EmptyStation"></param> |
| | | /// <param name="stationinfoRepository"></param> |
| | | /// <returns></returns> |
| | | 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; |
| | | |
| | | 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(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | } |
| | | return stationinfo; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 空æå¯å
¥åºè´§ä½ |
| | | /// </summary> |
| | | /// <param name="area"></param> |
| | | /// <returns></returns> |
| | | public static dt_stationinfo EmptyPalletStation1(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 æ¥æ¾ABåºå¯å
¥ç©ºæç©ºè´§ä½ |
| | | if (area == "11" && stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any()) |
| | | { |
| | | #region MyRegion |
| | | var EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.area).ThenByDescending(x => x.line).ThenByDescending(x => x.column).FirstOrDefault(); |
| | | #endregion |
| | | |
| | | #region æ¥æ¾åºåº2ååºåº3ç空æè´§ä½ |
| | | //var EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") |
| | | // && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.lastUpdateTime).FirstOrDefault(); |
| | | |
| | | if (EmptyStation != null) |
| | | { |
| | | stationinfo = Station(EmptyStation, stationinfoRepository); |
| | | if (stationinfo != null) |
| | | if (!QueueStation(stationinfo.stationCode)) 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) return null; |
| | | } |
| | | #endregion |
| | | |
| | | #region æªæ¾å°ç©ºæè´§ä½æå½åè¡å·²æ»¡,å¯»æ¾æ°çä¸è¡ |
| | | stationinfo = stationinfoRepository.Find(x => x.column == 2 && x.area == "3" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.line).FirstOrDefault(); |
| | | if (stationinfo == null) |
| | | stationinfo = stationinfoRepository.Find(x => x.column == 1 && x.area == "2" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.line).FirstOrDefault(); |
| | | #endregion |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¥æ¾ç©ºæåºåº |
| | | 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 (!QueueStation(stationinfo.stationCode) && 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 (GetStation.QueueStation(stationinfo.stationCode)) stationinfo = null; |
| | | #endregion |
| | | |
| | | #region 夿å½åè´§ä½æ¯å¦åå¨ä»»å¡ |
| | | if (stationinfo != null) |
| | | if (agvtaskService.Find(x => x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null; |
| | | #endregion |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw; |
| | | } |
| | | 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.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> |
| | | public static dt_stationinfo GetEmptyTrayStation(Idt_stationinfoRepository stationinfoRepository,dt_agvtask agv_task) |
| | | { |
| | | 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) |
| | | { |
| | | var EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault(); |
| | | if (EmptyD != null) CreateEmptyTrayIn(stationinfoRepository, EmptyD); |
| | | } |
| | | } |
| | | #endregion |
| | | else |
| | | { |
| | | EmptyStation = GetStation.EmptyPalletStation1(agv_task.agv_Traytype == "SmallTray" ? "11" : "10"); |
| | | } |
| | | return EmptyStation; |
| | | } |
| | | /// <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.EmptyPalletStation1(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 WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_Core.Utilities; |
| | | using System.Linq.Expressions; |
| | | using WIDESEA_Entity.DomainModels.Mes; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | namespace WIDESEA_WMS.IServices |
| | | { |
| | | public partial interface Idt_agvtaskService |
| | | { |
| | | WebResponseContent addNgTask([FromBody] MesRequestTemp request); |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Comm.LogInfo; |
| | | 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(); |
| | | try |
| | | { |
| | | var fromaddress = requestTemp.from_address; |
| | | VOLContext context = new VOLContext(); |
| | | Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context); |
| | | IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context); |
| | | var station = stationinfoRepository.Find(x => x.stationCode == fromaddress).FirstOrDefault(); |
| | | if (_repository.Find(x => x.agv_fromaddress == fromaddress || x.agv_toaddress == fromaddress).Any()) |
| | | throw new Exception($"è´§ä½{fromaddress}å·²åå¨ä»»å¡ï¼"); |
| | | if (station == null) throw new Exception($"æªæ¾å°è´§ä½{fromaddress}ï¼"); |
| | | if (!station.enable) throw new Exception($"è´§ä½{fromaddress}æªå¯ç¨ï¼"); |
| | | if (station.quantity < 1) throw new Exception($"è´§ä½{fromaddress}æ 车轮ï¼"); |
| | | var Work = workinfoRepository.Find(x => x.workOrder == station.Number && x.processCode == "17").FirstOrDefault(); |
| | | if (Work == null) throw new Exception($"æªæ¾å°è´§ä½{fromaddress}çæºå 工工åä¿¡æ¯"); |
| | | 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 = "Queue", |
| | | agv_materielid = station.stationType, |
| | | agv_qty = station.quantity, |
| | | agv_tasktype = "TaskType_OutsourceInbound", |
| | | agv_toaddress = "", |
| | | agv_userid = UserContext.Current.UserName, |
| | | bindSN = station.bindSN, |
| | | agv_worktype = Convert.ToInt32(Work.processCode), |
| | | agv_materbarcode = Work.materialCode, |
| | | agv_Traytype = station.tray_type, |
| | | jobID = station.Number, |
| | | agv_TrayStatus = station.tray_status |
| | | }; |
| | | _repository.Add(agvtask, true); |
| | | station.location_state = LocationStateEnum.InBusy.ToString(); |
| | | stationinfoRepository.Update(station, true); |
| | | content.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Message = ex.Message; |
| | | } |
| | | return content; |
| | | } |
| | | public override WebResponseContent Update(SaveModel saveModel) |
| | | { |
| | | 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ä»»å¡ |
| | | public override WebResponseContent Add(SaveModel saveDataModel) |
| | | { |
| | |
| | | if (station2 == null) return content.Error("请è¾å
¥æ£ç¡®çèµ·ç¹å°åï¼"); |
| | | if (!station1.tray_type.Contains("Small") && station2.area != "4") |
| | | throw new Exception($"大æçåªè½åæ¾å¨åºåº4ï¼"); |
| | | if (station1.tray_type.Contains("Small") && station2.area != "3" && station2.area != "2") |
| | | throw new Exception($"å°æçåªè½åæ¾å¨åºåº2/åºåº3ï¼"); |
| | | if (agvtaskRepository.Find(x => x.agv_fromaddress.Contains(from_address) || x.agv_toaddress.Contains(from_address)).Any()) |
| | | throw new Exception($"èµ·ç¹{from_address}å·²åå¨ä»»å¡ï¼"); |
| | | if (agvtaskRepository.Find(x => x.agv_fromaddress.Contains(to_address) || x.agv_toaddress.Contains(to_address)).Any()) |
| | |
| | | throw new Exception($"ç»ç¹{to_address}䏿¯ç©ºè´§ä½ï¼"); |
| | | if (string.IsNullOrEmpty(station1.stationType)) |
| | | throw new Exception($"èµ·ç¹{from_address}æªç»å®ç©æç±»åï¼"); |
| | | |
| | | if (station2.area == "1") |
| | | { |
| | | if (stationinfoRepository.Find(x => x.area == station2.area && x.column == station2.column && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any()) |
| | | throw new Exception($"ç»ç¹{to_address}åååå¨ä¸èµ·ç¹ç©æç±»åä¸å¹é
ï¼"); |
| | | } |
| | | else |
| | | { |
| | | if (stationinfoRepository.Find(x => x.area == station2.area && x.line == station2.line && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any()) |
| | | throw new Exception($"ç»ç¹{to_address}åè¡åå¨ä¸èµ·ç¹ç©æç±»åä¸å¹é
ï¼"); |
| | | } |
| | | |
| | | if (stationinfoRepository.Find(x => x.area == station2.area && x.line == station2.line && x.enable && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any()) |
| | | throw new Exception($"ç»ç¹{to_address}åè¡åå¨ä¸èµ·ç¹ç©æç±»åä¸å¹é
ï¼"); |
| | | var inventory = inventoryRepository.Find(x => x.stationCode == station1.stationCode).FirstOrDefault(); |
| | | if (inventory == null) throw new Exception($"èµ·ç¹{from_address}æªæ¾å°åºåä¿¡æ¯ï¼"); |
| | | |
| | |
| | | station2.location_state = LocationStateEnum.InBusy.ToString(); |
| | | station2.heatNumber = station1.heatNumber; |
| | | station2.Number = station1.Number; |
| | | station2.billetID = station1.billetID; |
| | | station2.stationType = station1.stationType; |
| | | stationinfoRepository.Update(station2, true); |
| | | content.OK(); |
| | |
| | | [Invoke(Begin = "2024-01-01 00:00", Interval = 1000 * 5, /*IsEnabled = true,*/ SkipWhileExecuting = true)] |
| | | public void TaskTime() |
| | | { |
| | | AGVServer.UpdateEmptyPalletTask(); |
| | | AGVServer.SendAgvTask(); |
| | | AGVServer.SendFromaddress(); |
| | | AGVServer.SendToaddress(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using Microsoft.AspNetCore.Http; |
| | | using WIDESEA_Entity.DomainModels; |
| | | using WIDESEA_WMS.IServices; |
| | | using WIDESEA_Core.Utilities; |
| | | using WIDESEA_Entity.DomainModels.Mes; |
| | | |
| | | namespace WIDESEA_WMS.Controllers |
| | | { |
| | |
| | | _service = service; |
| | | _httpContextAccessor = httpContextAccessor; |
| | | } |
| | | /// <summary> |
| | | /// æ·»å NGä»»å¡ |
| | | /// </summary> |
| | | /// <param name="request"></param> |
| | | /// <returns></returns> |
| | | [HttpPost, Route("addNgTask")] |
| | | public WebResponseContent addNgTask([FromBody] MesRequestTemp request) |
| | | { |
| | | return _service.addNgTask(request); |
| | | } |
| | | } |
| | | } |
| | |
| | | "Connection": { |
| | | "DBType": "MsSql", //MySql/MsSql/PgSql //æ°æ®åºç±»åï¼å¦æä½¿ç¨çæ¯sqlserveræ¤å¤åºè®¾ç½®ä¸ºMsSql |
| | | //sqlserverè¿æ¥å符串 |
| | | "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;", |
| | | "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;", |
| | | //"DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;", |
| | | |
| | | //mysqlè¿æ¥å符串(å级EFCore3.1å°æ¶å·²å°mysqlè¿æ¥å符串修æ¹,2019-12-20) |
| | | // "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;", |