| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Xml.Linq; |
| | | using WIDESEA_Comm.LogInfo; |
| | | using WIDESEA_Core.BaseProvider; |
| | | using WIDESEA_Core.FreeDB; |
| | | using WIDESEA_Entity.DomainModels; |
| | |
| | | if (Gantry_client == null) throw new Exception("æ¡æ¶è°åº¦æå¡æªå¼å¯ï¼"); |
| | | if (!Gantry_client.IsConnected) throw new Exception("䏿¡æ¶è¿æ¥è¶
æ¶ï¼"); |
| | | var Gantryplc = FreeDB.Select<dt_plcinfohead>().Where(x => x.plcinfo_name == Gantry_client.PLCName).First(); |
| | | var Pipeline_client = PLCClient.Clients.FirstOrDefault(t => t.PLCName == "龿¡æº"); |
| | | if (Pipeline_client == null) throw new Exception("龿¡æºè°åº¦æå¡æªå¼å¯ï¼"); |
| | | if (!Pipeline_client.IsConnected) throw new Exception("ä¸é¾æ¡æºè¿æ¥è¶
æ¶ï¼"); |
| | | List<string> numbers = new List<string>() { "1åå
é²å", "2åå
é²å", "3åå
é²å", "䏿åºé²å" }; |
| | | var details = FreeDB.Select<dt_plcinfodetail>().Where(x => x.plcdetail_iotype == Gantryplc.plcinfo_iotyep && x.plcdetail_number == numbers[requestin.AreaNr - 1]).ToList(); |
| | | if (MethodName == "AGVRequestin")//请æ±è¿å
¥åºå |
| | |
| | | Gantry_client.WriteByOrder("W_AGV_Request_In", true, numbers[requestin.AreaNr - 1]);//ç³è¯·è¿å
¥åºå |
| | | var Release = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Release_In").First(), Gantry_client);//å
许è¿å
¥åºå |
| | | var Gantry_Out_of_Area = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Gantry_Out_of_Area").First(), Gantry_client);//æ¡æ¶ä¸å¨è¯¥åºå |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success("AGV请æ±è¿å
¥åºå", $"åå
¥æ¡æ¶ä¿¡æ¯ï¼\nåºåå·ï¼{requestin.AreaNr}\nç³è¯·è¿å
¥åºåï¼true" + |
| | | $"\n\nè¯»åæ¡æ¶ä¿¡æ¯ï¼\nå
许è¿å
¥åºåï¼{Release}\næ¡æ¶ä¸å¨è¯¥åºåï¼{Gantry_Out_of_Area}", "AGV"); |
| | | #endregion |
| | | if (!Release) throw new Exception("æ¡æ¶æªå
许è¿å
¥ï¼"); |
| | | if (!Gantry_Out_of_Area) throw new Exception("æ¡æ¶å¨åºåå
ï¼"); |
| | | } |
| | |
| | | Gantry_client.WriteByOrder("W_AreaNr", (Int16)requestin.AreaNr, numbers[requestin.AreaNr - 1]);//åºåå· |
| | | if (requestin.Type == 1) |
| | | { |
| | | Pipeline_client.WriteByOrder("W_AGV_Entering", (Int16)1, numbers[requestin.AreaNr - 1]);//å
æ
å±è½ |
| | | Gantry_client.WriteByOrder("W_AGV_Leaving", false, numbers[requestin.AreaNr - 1]);//æ£å¨ç¦»å¼ |
| | | Gantry_client.WriteByOrder("W_AGV_Entering", true, numbers[requestin.AreaNr - 1]);//æ£å¨è¿å
¥ |
| | | var Area_Occupied_by_AGV = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Area_Occupied_by_AGV").First(), Gantry_client);//æ¡æ¶åé¦AGVå ä½ä¿¡å· |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success("AGVæ£å¨è¿å
¥åºå", $"åå
¥æ¡æ¶ä¿¡æ¯ï¼\nåºåå·ï¼{requestin.AreaNr}\næ£å¨ç¦»å¼ï¼false\næ£å¨è¿å
¥ï¼true\nå
æ
å±è½ï¼1" + |
| | | $"\n\nè¯»åæ¡æ¶ä¿¡æ¯ï¼\nåé¦AGVå ä½ä¿¡å·ï¼{Area_Occupied_by_AGV}", "AGV"); |
| | | #endregion |
| | | if (!Area_Occupied_by_AGV) throw new Exception("æ¡æ¶æªåé¦AGVå ä½ä¿¡å·"); |
| | | } |
| | | else if (requestin.Type == 2) |
| | | { |
| | | Pipeline_client.WriteByOrder("W_AGV_Entering", (Int16)2, numbers[requestin.AreaNr - 1]);//å
æ
å¯ç¨ |
| | | Gantry_client.WriteByOrder("W_AGV_Entering", false, numbers[requestin.AreaNr - 1]);//æ£å¨è¿å
¥ |
| | | Gantry_client.WriteByOrder("W_AGV_Leaving", true, numbers[requestin.AreaNr - 1]);//æ£å¨ç¦»å¼ |
| | | var Area_Occupied_by_AGV = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Area_Occupied_by_AGV").First(), Gantry_client);//æ¡æ¶åé¦AGVå ä½ä¿¡å· |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success("AGVæ£å¨ç¦»å¼åºå", $"åå
¥æ¡æ¶ä¿¡æ¯ï¼\nåºåå·ï¼{requestin.AreaNr}\næ£å¨è¿å
¥ï¼false\næ£å¨ç¦»å¼ï¼true\nå
æ
å±è½ï¼2" + |
| | | $"\n\nè¯»åæ¡æ¶ä¿¡æ¯ï¼\nåé¦AGV离å¼ä¿¡å·ï¼{!Area_Occupied_by_AGV}", "AGV"); |
| | | #endregion |
| | | if (Area_Occupied_by_AGV) throw new Exception("æ¡æ¶æªåé¦AGV离å¼ä¿¡å·"); |
| | | } |
| | | } |
| | |
| | | { |
| | | Gantry_client.WriteByOrder("W_AreaNr", (Int16)requestin.AreaNr, numbers[requestin.AreaNr - 1]);//åºåå· |
| | | Gantry_client.WriteByOrder("W_AGV_OUT_OF_Area", requestin.OUTOFArea == 1 ? true : false, numbers[requestin.AreaNr - 1]);//AGVä¸å¨è¯¥åºå |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success("AGVä¸å¨åºåå
", $"åå
¥æ¡æ¶ä¿¡æ¯ï¼\nåºåå·ï¼{requestin.AreaNr}\nAGVä¸å¨è¯¥åºåï¼{(requestin.OUTOFArea == 1 ? true : false)}", "AGV"); |
| | | #endregion |
| | | } |
| | | else if (MethodName == "GantryOutofArea")//æ¡æ¶ä¸å¨åºåå
|
| | | { |
| | | var Gantry_Out_of_Area = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Gantry_Out_of_Area").First(), Gantry_client);//æ¡æ¶ä¸å¨è¯¥åºå |
| | | #region æ¥å¿è®°å½ |
| | | WriteDBLog.Success("æ¡æ¶ä¸å¨åºåå
", $"è¯»åæ¡æ¶ä¿¡æ¯ï¼\nåºåå·ï¼{requestin.AreaNr}\næ¡æ¶ä¸å¨è¯¥åºåï¼{Gantry_Out_of_Area}", "AGV"); |
| | | #endregion |
| | | if (!Gantry_Out_of_Area) throw new Exception("æ¡æ¶å¨åºåå
ï¼"); |
| | | } |
| | | respone.success = 1; |