You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.0 KiB
C#

using Aucma.Core.CodeBinding.ViewModels;
using Aucma.Core.CodeBinding.Common;
using Aucma.Core.CodeBinding.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Aucma.Core.HwPLc;
namespace Aucma.Core.CodeBinding.Views
{
/// <summary>
/// IndexPageView.xaml 的交互逻辑
/// </summary>
public partial class IndexPageView : UserControl
{
public IndexPageView()
{
InitializeComponent();
this.DataContext = new IndexPageViewModel();
}
private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void Button_Click(object sender, RoutedEventArgs e)
{
SendPlcPass();
}
/// <summary>
/// 下发plc放行信号
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
private bool SendPlcPass()
{
bool result = false;
try
{
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("条码绑定Plc"));
if (obj != null)
{
//log.Info("停止信号D7102写1");
// 停止信号复位
obj.plc.WriteInt16("D7102", "0");
// 报警信号复位
obj.plc.WriteInt16("D7101", "0");
result = true;
}
}
catch (Exception ex)
{
// log.Error("下发plc停止信号方法出现异常,ex:" + ex);
}
return result;
}
}
}