| | |
| | | int liftPosition = (int)para.LeftPosition;//左伸åºä½ç½® |
| | | int rigtpostition = (int)para.RightPosition;//å³ä¼¸åºä½ç½® |
| | | |
| | | try |
| | | { |
| | | var leftorigin = devices.Value.left.Communicator.Read<bool>("M115");//å·¦plcå°åç¹ä½ç½®ä¿¡å· |
| | | var rightorigin = devices.Value.right.Communicator.Read<bool>("M115");//å³plcå°è¾¾åç¹ä½ç½®ä¿¡å· |
| | | if (leftorigin == true || rightorigin == true) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "å·²å°åå§ç¹" }; |
| | | } |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | |
| | | } |
| | | try |
| | | { |
| | | var lefttarget = devices.Value.left.Communicator.Read<bool>("M116");//å·¦plcå°è¾¾ç®æ ä½ç½® |
| | | var righttarget = devices.Value.right.Communicator.Read<bool>("M116");//å³plcå°è¾¾ç®æ ä½ç½® |
| | | if (lefttarget == true || righttarget == true) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "已尿大å¼" }; |
| | | } |
| | | |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | if (extendedState == "伸åº") |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1001", ext);//å·¦PLCèªå¨ä¼¸åºç¼©åé度 |
| | | devices.Value.left.Communicator.Write<bool>("M102", true);//ä¼¸åºæé® |
| | | devices.Value.right.Communicator.Write<int>("D1002", liftPosition);//左伸åºä½ç½® |
| | | try |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1001", ext);//å·¦PLCèªå¨ä¼¸åºç¼©åé度 |
| | | devices.Value.left.Communicator.Write<bool>("M102", true);//ä¼¸åºæé® |
| | | devices.Value.left.Communicator.Write<int>("D1002", liftPosition);//左伸åºä½ç½® |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | devices.Value.right.Communicator.Write<int>("D1001", ret); //å³PLCèªå¨ä¼¸åºç¼©åé度 |
| | | devices.Value.right.Communicator.Write<bool>("M102", true); |
| | | devices.Value.right.Communicator.Write<int>("D1002", rigtpostition);//å³ä¼¸åºä½ç½® |
| | | try |
| | | { |
| | | devices.Value.right.Communicator.Write<int>("D1001", ret); //å³PLCèªå¨ä¼¸åºç¼©åé度 |
| | | devices.Value.right.Communicator.Write<bool>("M102", true); |
| | | devices.Value.right.Communicator.Write<int>("D1002", rigtpostition);//å³ä¼¸åºä½ç½® |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | |
| | | |
| | | Console.WriteLine($"DeptId={deptId} ï¼å·¦é度={ext}ï¼å³é度={ret}"); |
| | | } |
| | | else if (extendedState == "缩å") |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1001", ext);//缩åé度 |
| | | devices.Value.left.Communicator.Write<bool>("M103", true);//缩åæé® |
| | | try |
| | | { |
| | | devices.Value.left.Communicator.Write<int>("D1001", ext);//缩åé度 |
| | | devices.Value.left.Communicator.Write<bool>("M103", true);//缩åæé® |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | devices.Value.right.Communicator.Write<int>("D1001", ret); |
| | | devices.Value.right.Communicator.Write<bool>("M103", true); |
| | | throw; |
| | | } |
| | | |
| | | try |
| | | { |
| | | devices.Value.right.Communicator.Write<int>("D1001", ret); |
| | | devices.Value.right.Communicator.Write<bool>("M103", true); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | Console.WriteLine($"DeptId={deptId} 缩åæä½ï¼å·¦é度={ext}ï¼å³é度={ret}"); |
| | | } |
| | | else |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æå¨æ§å¶ï¼ä¼¸ç¼©æç缩åå伸åºé度 |
| | | /// </summary> |
| | | /// <param name="position">伸缩æçä½ç½®ï¼å·¦å³ï¼</param> |
| | | /// <param name="ExtendedState">伸/ç¼©ç¶æ</param> |
| | | /// <returns></returns> |
| | | /// |
| | | //public WebResponseContent ManualOperation(string position, string ExtendedState) |
| | | //{ |
| | | // try |
| | | // { |
| | | // //俩个plcå·¦å³åä¸ä¸ª |
| | | // OtherDevice liftotherDevice = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == "SSG001"); |
| | | // OtherDevice rightotherDevice = (OtherDevice)Storage.Devices.Find(x => x.DeviceCode == "SSG002"); |
| | | // //æ¾å°Dt_Parametersä¸çææ°ä¸æ¡æ°æ® |
| | | // var para = BaseDal.QueryData().OrderBy(x => x.CreateDate).FirstOrDefault(); |
| | | // int ext = (int)para.ManualExtend;//èªå¨ä¼¸åºé度 |
| | | // int ret = (int)para.ManualRetraction;//èªå¨ç¼©åé度 |
| | | // if (position == "å·¦" && ExtendedState == "伸åº") |
| | | // { |
| | | // var values = liftotherDevice.Communicator.Write<int>("D500", ext);//é度 |
| | | // var button = liftotherDevice.Communicator.Write<bool>("M100", true);//ä¼¸åºæé® |
| | | // Console.WriteLine($"{position}伸缩æä¼¸åº{ext}"); |
| | | // } |
| | | // if (position == "å·¦" && ExtendedState == "缩å") |
| | | // { |
| | | // var values = liftotherDevice.Communicator.Write<int>("D501", ret); |
| | | //var button = liftotherDevice.Communicator.Write<bool>("M101", true);//缩åæé® |
| | | //Console.WriteLine($"{position}伸缩æç¼©å{ret}"); |
| | | // } |
| | | // if (position == "å³" && ExtendedState == "伸åº") |
| | | // { |
| | | // var values = rightotherDevice.Communicator.Write<int>("D500", ext);//é度 |
| | | // var button = rightotherDevice.Communicator.Write<bool>("M100", true);//ä¼¸åºæé® |
| | | // Console.WriteLine($"{position}伸缩æä¼¸åº{ext}"); |
| | | // } |
| | | // if (position == "å³" && ExtendedState == "缩å") |
| | | // { |
| | | // var values = rightotherDevice.Communicator.Write<int>("D501", ret); |
| | | // var button = rightotherDevice.Communicator.Write<bool>("M101", true);//缩åæé® |
| | | // Console.WriteLine($"{position}伸缩æç¼©å{ret}"); |
| | | // } |
| | | // return new WebResponseContent { Status = true, Message = "æå" }; |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // return new WebResponseContent { Status = false, Message = ex.Message }; |
| | | |
| | | // } |
| | | //} |
| | | |
| | | |
| | | |
| | |
| | | |
| | | int ext = (int)para.ManualExtend;//å·¦PLCæå¨ä¼¸åºç¼©åé度 |
| | | int ret = (int)para.ManualRetraction;//å³PLCæå¨ä¼¸åºç¼©åé度 |
| | | try |
| | | { |
| | | var leftorigin = devices.Value.left.Communicator.Read<bool>("M115");//å·¦plcå°åç¹ä½ç½®ä¿¡å· |
| | | var rightorigin = devices.Value.right.Communicator.Read<bool>("M115");//å³plcå°è¾¾åç¹ä½ç½®ä¿¡å· |
| | | if (leftorigin == true || rightorigin == true) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "å·²å°åå§ç¹" }; |
| | | } |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | |
| | | } |
| | | try |
| | | { |
| | | var lefttarget = devices.Value.left.Communicator.Read<bool>("M116");//å·¦plcå°è¾¾ç®æ ä½ç½® |
| | | var righttarget = devices.Value.right.Communicator.Read<bool>("M116");//å³plcå°è¾¾ç®æ ä½ç½® |
| | | if (lefttarget == true || righttarget == true) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "已尿大å¼" }; |
| | | } |
| | | |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | if (position == "å·¦" && ExtendedState == "伸åº") |
| | | { |
| | |
| | | { |
| | | //æ ¹æ®int.TryParse(AppSettings.Get("DepartmentID")读åå°å½åæ¯è½¨éå ï¼ææäººé½åªè½æä½å½å |
| | | var devices = GetDevicesByDeptId(deptid); |
| | | devices.Value.left.Communicator.Write<bool>("M104", true); |
| | | devices.Value.right.Communicator.Write<bool>("M104", true); |
| | | try |
| | | { |
| | | devices.Value.left.Communicator.Write<bool>("M104", true); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | |
| | | try |
| | | { |
| | | devices.Value.right.Communicator.Write<bool>("M104", true); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | return new WebResponseContent { Status = true, Message = "æåæå", Data = devices }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Message = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 伸缩æå½åä½ç½®(è¿ä¸ªæ²¡æç¨) |
| | | /// <param name="deptid">轨éç«å·</param> |
| | | public WebResponseContent CurrentLocation(int deptid) |
| | | { |
| | | try |
| | | { |
| | | var devices = GetDevicesByDeptId(deptid); |
| | | if (devices == null) |
| | | return new WebResponseContent { Status = false, Message = "è®¾å¤æªæ¾å°" }; |
| | | var deviceslift = devices.Value.left.Communicator.Read<float>("D80"); |
| | | var devicesright = devices.Value.right.Communicator.Read<float>("D80"); |
| | | Console.WriteLine($"å½åå·¦å³ä¼¸ç¼©æè¿åé度åå«ä¸ºä¸º{deviceslift}"); |
| | | return new WebResponseContent |
| | | { |
| | | Status = true, |
| | | Data = new { lift = deviceslift, Right = devicesright } |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status=false,Message=ex.Message}; |
| | | } |
| | | } |
| | | |
| | |
| | | return (left, right); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |