using Microsoft.Extensions.DependencyInjection;
using SlnMesnac.Model.domain;
using SlnMesnac.WPF.ViewModel;
using SqlSugar;
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 static Dm.net.buffer.ByteArrayBuffer;
using static MaterialDesignThemes.Wpf.Theme;
namespace SlnMesnac.WPF.Page
{
///
/// TonerBoxingControl.xaml 的交互逻辑
///
public partial class TonerBoxingControl : UserControl
{
private ISqlSugarClient? sqlSugarClient;
public TonerBoxingControl()
{
sqlSugarClient = App.ServiceProvider.GetService();
InitializeComponent();
this.DataContext = new TonerBoxingViewModel();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.InputBoxCodeTxt.Focus();
}
private void ClearTonerButton_Click(object sender, RoutedEventArgs e)
{
try
{
List wmsPalletInfo = sqlSugarClient.Queryable().InnerJoin((x,y)=> x.TonerFlag == 1 && !y.ContainerCode.Contains(x.PalletInfoCode)).ToList();
if (wmsPalletInfo != null)
{
foreach (var item in wmsPalletInfo)
{
item.TonerFlag = 0;
}
int result = sqlSugarClient.Updateable(wmsPalletInfo).ExecuteCommand();
if (result > 0)
{
MessageBox.Show("操作成功!");
}
else
{
MessageBox.Show("操作失败!");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message+ex.StackTrace);
}
}
}
}