using CentralControl.DBDAO;
using System;
using System.Collections.Generic;
using System.Data;
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 XGL.Models;
namespace XGL.UControl
{
///
/// orderzy.xaml 的交互逻辑
///
public partial class orderzfzy : Window
{
public orderzfzy()
{
InitializeComponent();
}
public static string order_code = "";
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.ydd.Text = order_code;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
//查询
try
{
List model = new List();
DBService userDb = new DBService();
var Items = userDb.GetOrderZFZYList(this.ydd.Text.Trim());
if (Items != null && Items.Rows.Count > 0)
{
List model1 = new List();
DBService userDb1 = new DBService();
var Items1 = userDb1.GetOrderZYList(this.xdd.Text.Trim(), "");
if (Items1 != null && Items1.Rows.Count > 0)
{
if (Items.Rows[0]["materiel_box_no"].ToString()!= Items1.Rows[0]["materiel_box_no"].ToString())
{
MessageBox.Show("原订单与新订单的内筒编号不一致!", "提示", MessageBoxButton.OK);
return;
}
//if (Items.Rows[0]["line_code"].ToString() != Items1.Rows[0]["line_code"].ToString())
//{
// MessageBox.Show("原订单与新订单的线体不一致!", "提示", MessageBoxButton.OK);
// return;
//}
//修改订单数量
int num = Convert.ToInt32(Items.Rows[0]["UpQuantity"].ToString()) - Convert.ToInt32(Items.Rows[0]["outwarehousequantity"].ToString());//查询数量
DBService.SetUpdateOrderLineNum(Items.Rows[0]["order_code"].ToString(), -num);
DBService.SetUpdateOrderNum(Items1.Rows[0]["order_code"].ToString(), num);
MessageBox.Show("转移成功!", "提示", MessageBoxButton.OK);
this.DialogResult = true;
this.Close();
}
else
{
MessageBox.Show("未查到新订单信息!", "提示", MessageBoxButton.OK);
return;
}
}
else
{
MessageBox.Show("未查到原订单信息!", "提示", MessageBoxButton.OK);
return;
}
}
catch (Exception ex)
{
MessageBox.Show("获取订单错误");
}
}
}
}