using CommonFunc.Tools;
using System;
using System.Collections.Generic;
using System.Data;
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 XGL.Data.DBService;
using XGL.Tools;
namespace XGL.Views
{
///
/// DryingRoomUC.xaml 的交互逻辑
///
public partial class DryingRoomUC : UserControl
{
DringRoomService dringRoomService = new DringRoomService();
public DryingRoomUC()
{
InitializeComponent();
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
InitComBoboxData();
GetDringRoomData();
}
private void GetDringRoomData()
{
DataTable dt = dringRoomService.GetDringRoomData(comboDryRoomInfo.Text);
if (dt == null)
return;
int index = 0;
foreach (DataRow item in dt.Rows)
{
int i = 0;
index = i++;
string rfid = item["rfid"].ToString();
string workorder_code = item["workorder_code"].ToString();
string materialCode = item["product_code"].ToString();
//string workorder_code = item["workorder_code"].ToString();
ModuleUC uc = new ModuleUC(index.ToString(), rfid, workorder_code, materialCode, "10");
DringRoomListBox.Items.Add(uc);
}
}
private void InitComBoboxData()
{
DataTable dt = dringRoomService.GetDringRoomInfo();
if (dt == null)
{
CustomMessageBox.Show("没有维护设备信息,请维护设备后重试!", CustomMessageBoxIcon.Warning);
return;
}
List listEquip = Utils.ToDataList(dt);
//comboDryRoomInfo.SelectedValuePath = "quipName";
comboDryRoomInfo.DisplayMemberPath = "quipCode";
comboDryRoomInfo.ItemsSource = listEquip;
comboDryRoomInfo.SelectedIndex = 0;
}
private void comboDryRoomInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string hfCode = comboDryRoomInfo.Text;
GetDringRoomData();
}
}
public class EquipmentMode
{
public int type { get; set; }
public string quipCode { get; set; }
public int quipName { get; set; }
}
}