Files
wcs/货架标准上位机/Views/MXWindows/MXOutOrderView.xaml.cs
hehaibing-1996 00621bcd55 1.增加盟讯公司业务逻辑相关适配 前后端增加配置参数“ISMX”进行控制
2.前端websocket取消心跳机制(原有心跳和断线重连当服务端网线断开后需要等tcp保活期到期后才能发现重连),自己实现心跳和重连
3.前端关闭后任占用后台线程问题修复
2024-05-25 17:25:27 +08:00

157 lines
5.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using HandyControl.Controls;
using HandyControl.Data;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Media;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using TouchSocket.Core;
using WCS.Model.ApiModel.MatInventoryDetail;
using WCS.Model.ApiModel.MXBackgroundThread;
using .ViewModel;
namespace
{
public partial class MXOutOrderView : HandyControl.Controls.Window
{
public MXOutOrderViewModel viewModel = new MXOutOrderViewModel();
public MXOutOrderView()
{
InitializeComponent();
this.DataContext = viewModel;
}
private void closeClick(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
int index = 0;
private void DataGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
{
System.Windows.Controls.DataGrid datagrid = sender as System.Windows.Controls.DataGrid;
index = datagrid.SelectedIndex;
if (index >= 0)
{
if (viewModel.DataGridItemSource != null && viewModel.DataGridItemSource.Count() > index)
{
var data = viewModel.DataGridItemSource.ElementAt(index);
try
{
var current = viewModel.DataGridItemSource.Where(t => t.IsSelected).First();
current.IsSelected = false;
}
catch { }
data.IsSelected = true;
viewModel.DataGridItemSource = viewModel.DataGridItemSource.ToList();
}
}
//datagrid.UnselectAllCells();
}
private void txtMatQty1_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
if (!Regex.IsMatch(e.Text, "^[0-9]"))
{
e.Handled = true;
}
}
public PickOrder SelectedOrder { get; set; }
public List<MatInventoryDetailModel> inventoryDetails { get; set; }
private void comfirmClick(object sender, RoutedEventArgs e)
{
var isFirstSend = 0;
try
{
var button = sender as System.Windows.Controls.Button;
if (button != null)
{
if (button.Content.Equals("首盘发料"))
isFirstSend = 1;
else if (button.Content.Equals("全部发料"))
isFirstSend = 0;
else
isFirstSend = 2;
}
else
{
Logs.Write("button获取失败了");
}
}
catch (Exception ex)
{
}
if (viewModel.DataGridItemSource == null)
{
Growl.Warning("请搜索并选择领料单后进行确认!");
return;
}
SelectedOrder = viewModel.DataGridItemSource.Where(t => t.IsSelected).FirstOrDefault();
if (SelectedOrder == null)
{
Growl.Warning("请选择领料单后进行确认!");
return;
}
if (SelectedOrder.pickBillNumber.Contains("SCLL"))
{
if (string.IsNullOrEmpty(viewModel.WarehouseCode))
{
Growl.Warning("请输入仓库代码!");
txtWarehouseCode.Focus();
return;
}
}
else
{
if (!string.IsNullOrEmpty(viewModel.WarehouseCode))
{
Growl.Warning("非生产领料无需输入仓库代码!");
txtWarehouseCode.Focus();
return;
}
viewModel.WarehouseCode = string.Empty;
}
this.Hide();
var detailWindow = new MXOutOrderDetailView(SelectedOrder.pickBillNumber, viewModel.WarehouseCode
, SelectedOrder.orderProdNumbers, SelectedOrder.orderWorkNumbers, isFirstSend, reportSideCbx.Text
);
System.Windows.Interop.WindowInteropHelper mainUI = new System.Windows.Interop.WindowInteropHelper(detailWindow);
mainUI.Owner = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle;
detailWindow.ShowDialog();
if (detailWindow.DialogResult == true && detailWindow.DataGridItemSource != null && detailWindow.DataGridItemSource.Count > 0)
{
inventoryDetails = detailWindow.DataGridItemSource;
//LocalStatic.CurrentPickBillNumber = SelectedOrder.pickBillNumber;
this.Close();
}
else
this.ShowDialog();
}
}
}