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.

99 lines
2.9 KiB
C#

using CommonFunc;
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.Dats.DBServiceFinishProd;
namespace XGLFinishPro.Views
{
/// <summary>
/// QitaoLvUC.xaml 的交互逻辑
/// </summary>
public partial class QitaoLvUC : UserControl
{
FinishProdDBService userDbWareHouse = new FinishProdDBService();
string _workOrderCode = "";
2 weeks ago
public QitaoLvUC()
{
InitializeComponent();
}
public QitaoLvUC(string workOrderCode)
{
InitializeComponent();
_workOrderCode = workOrderCode;
}
private void dgMaterialInfo_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.Header = (e.Row.GetIndex() + 1).ToString();
}
2 weeks ago
public string InputQuantity { get; set; }
private void dgMaterialInfo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (dgMaterialInfo.SelectedItem is DataRowView row)
{
string code = row["material_code"].ToString();
string name = row["material_name"].ToString();
// 弹出自定义输入数量窗口
var inputDialog = new InputNumberDialog();
if (inputDialog.ShowDialog() == true)
{
InputQuantity = inputDialog.InputValue;
CustomMessageBox.Show($"物料编码:{code}\n物料名称{name}\n数量{InputQuantity}", CustomMessageBoxButton.OK, CustomMessageBoxIcon.Success);
}
else
{
InputQuantity = null;
}
}
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
try
{
DataTable dt = userDbWareHouse.GetQitaolvInfo(_workOrderCode);
if (dt == null)
{
this.dgMaterialInfo.ItemsSource = null;
}
else
{
this.dgMaterialInfo.ItemsSource = dt.DefaultView;
}
}
catch (Exception ex)
{
CustomMessageBox.Show(ex.Message, CustomMessageBoxButton.OK, CustomMessageBoxIcon.Error);
LogHelper.instance.log.Error("获取工单齐套信息时发生异常:" + ex.Message);
}
}
2 weeks ago
public DataRowView SelectedMaterialRow
{
get
{
return this.dgMaterialInfo?.SelectedItem as DataRowView;
}
}
}
}