|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
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.Shapes;
|
|
|
|
|
|
using CentralControl.DBDAO;
|
|
|
|
|
|
using CentralControl.BaseData;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using XGL.Data;
|
|
|
|
|
|
|
|
|
|
|
|
namespace XGL.FormItem
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// FormLocator.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class FormShowSelect : Window
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public delegate void OptCarDelegate(string file1, string file2);
|
|
|
|
|
|
public event OptCarDelegate optItemEvent;
|
|
|
|
|
|
|
|
|
|
|
|
public delegate void OptLocatorDelegate(int locatorid,string file1);
|
|
|
|
|
|
public event OptLocatorDelegate optLocatorEvent;
|
|
|
|
|
|
|
|
|
|
|
|
private int SelectType { get; set; }
|
|
|
|
|
|
private int WeekDay { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
private int LocatorId { get; set; }
|
|
|
|
|
|
public FormShowSelect()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public FormShowSelect(int type)
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
this.SelectType = type;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public FormShowSelect(int type, int week,int locatorid)
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
this.SelectType = type;
|
|
|
|
|
|
this.WeekDay = week;
|
|
|
|
|
|
this.LocatorId = locatorid;
|
|
|
|
|
|
}
|
|
|
|
|
|
private void GridMaterial_LoadingRow(object sender, DataGridRowEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Row.Header = e.Row.GetIndex() + 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SelectType == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<LineCatchArea> dt = DBService.GetLineCatchAreaList("");
|
|
|
|
|
|
this.gridLocatorDataList.ItemsSource = dt.Where(t => t.AreaType == 4).ToList();
|
|
|
|
|
|
// this.gridLocatorDataList.Items.Refresh();
|
|
|
|
|
|
this.gridLocatorDataList.Visibility = Visibility.Visible;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (SelectType == 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<MaterialInfo> list = DBService.GetMaterialInfoList("");
|
|
|
|
|
|
this.gridMaterialList.ItemsSource = list;
|
|
|
|
|
|
// this.gridMaterialList.Items.Refresh();
|
|
|
|
|
|
this.gridMaterialList.Visibility = Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (SelectType == 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<MaterialInfo> list = new List<MaterialInfo>();
|
|
|
|
|
|
using (basedata_orderplanDb orderplanDb = new basedata_orderplanDb())
|
|
|
|
|
|
{
|
|
|
|
|
|
DataSet ds = orderplanDb.GetData(this.WeekDay.ToString());
|
|
|
|
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
MaterialInfo mater = new MaterialInfo();
|
|
|
|
|
|
mater.MaterialNo = dr["MaterialNo"].ToString();
|
|
|
|
|
|
mater.MaterialNm = dr["MaterialNm"].ToString();
|
|
|
|
|
|
list.Add(mater);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.gridMaterialList.ItemsSource = list;
|
|
|
|
|
|
// this.gridMaterialList.Items.Refresh();
|
|
|
|
|
|
this.gridMaterialList.Visibility = Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void BtnSaveSetting_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (optItemEvent != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this.gridLocatorDataList.Visibility != Visibility.Hidden)
|
|
|
|
|
|
{
|
|
|
|
|
|
LineCatchArea selectrow = (this.gridLocatorDataList.SelectedItem as LineCatchArea);
|
|
|
|
|
|
string val = selectrow.AreaNo.ToString();
|
|
|
|
|
|
optItemEvent(selectrow.Id.ToString(), val);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
MaterialInfo selectrow = (this.gridMaterialList.SelectedItem as MaterialInfo);
|
|
|
|
|
|
string val = selectrow.MaterialNo.ToString();
|
|
|
|
|
|
string val1 = selectrow.MaterialNm.ToString();
|
|
|
|
|
|
optItemEvent(val, val1);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(optLocatorEvent!=null)
|
|
|
|
|
|
{
|
|
|
|
|
|
MaterialInfo selectrow = (this.gridMaterialList.SelectedItem as MaterialInfo);
|
|
|
|
|
|
string val = selectrow.MaterialNo.ToString();
|
|
|
|
|
|
string val1 = selectrow.MaterialNm.ToString();
|
|
|
|
|
|
optLocatorEvent(this.LocatorId, val);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void BtnCancelSetting_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|