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.
158 lines
5.8 KiB
C#
158 lines
5.8 KiB
C#
using CentralControl.DBDAO;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
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
|
|
{
|
|
/// <summary>
|
|
/// orderzy.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class ordertj : Window
|
|
{
|
|
//需要转入的订单号
|
|
public static string orderCode_no = "";
|
|
//上件数量
|
|
public static string upNum_no = "";
|
|
public static string lineCode = "";
|
|
//计划数量
|
|
public static string upQuanity_no = "";
|
|
//传值订单号
|
|
public static string orderCode = "";
|
|
public static string upQuanity = "";
|
|
public static string upNum = "";
|
|
public static string lineCode_no = "";
|
|
public ordertj()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
//内筒号
|
|
public static string order_code = "";
|
|
int number_XB = 0;
|
|
int znumber = 0;
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
orderCode_no = orderCode;
|
|
upNum_no = upNum;
|
|
upQuanity_no = upQuanity;
|
|
lineCode_no = lineCode;
|
|
this.ydd.Text = order_code;
|
|
//根据订单的对应线体查询此订单在线边库的物料数量
|
|
DBService userXB = new DBService();
|
|
var number_xianbian = userXB.GetMaterielNoNumber_xb(lineCode_no, this.ydd.Text.Trim());
|
|
|
|
if (number_xianbian != null && number_xianbian.Rows.Count > 0 && number_xianbian.Rows[0]["materiel_num_add"].ToString() != "")
|
|
{
|
|
number_XB = Convert.ToInt32(number_xianbian.Rows[0]["materiel_num_add"].ToString());
|
|
}
|
|
else
|
|
{
|
|
number_XB = 0;
|
|
}
|
|
//获取库区内此物料总数量
|
|
DBService userKK = new DBService();
|
|
var item = userKK.GetMaterielNoNumber(this.ydd.Text.Trim());
|
|
//获取此物料订单上件数量
|
|
DBService userKB = new DBService();
|
|
var item1 = userKB.GetMaterielNoNumber_dingdan();
|
|
//存在订单的上件数量
|
|
int numb = 0;
|
|
//存在订单的出库数量
|
|
int numb_xj = 0;
|
|
if (item1 != null && item1.Rows.Count > 0)
|
|
{
|
|
foreach (DataRow i in item1.Rows)
|
|
{
|
|
if (this.ydd.Text.Trim().ToString().Equals(i["materiel_box_no"].ToString()))
|
|
{
|
|
numb += Convert.ToInt32(i["UpQuantity"].ToString());
|
|
numb_xj += Convert.ToInt32(i["OutWareHouseQuantity"].ToString());
|
|
}
|
|
}
|
|
}
|
|
if (item != null && item.Rows.Count > 0)
|
|
{
|
|
znumber = Convert.ToInt32(item.Rows[0]["materiel_num"].ToString());
|
|
int maybe_amount = Convert.ToInt32(item.Rows[0]["materiel_num"].ToString()) + number_XB - (numb - numb_xj);
|
|
if (maybe_amount < 0 || maybe_amount.ToString() == "" || maybe_amount.ToString() == null)
|
|
{
|
|
maybe_amount = 0;
|
|
}
|
|
this.ydd_ky.Text = maybe_amount.ToString().Trim();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("暂无可转入物料");
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
|
{
|
|
//查询
|
|
try
|
|
{
|
|
var reg = @"^[0-9]\d*$";
|
|
if (this.xdd.Text.Trim() == "")
|
|
{
|
|
MessageBox.Show("请填写转入数量");
|
|
}
|
|
else if (!Regex.IsMatch(this.xdd.Text.Trim(), reg))
|
|
{
|
|
MessageBox.Show("转入数量不可为非数字");
|
|
}
|
|
else if (Convert.ToInt32(this.xdd.Text.Trim()) < 0)
|
|
{
|
|
MessageBox.Show("转入数量不可为负数");
|
|
}
|
|
else if (Convert.ToInt32(this.xdd.Text.Trim()) <= Convert.ToInt32(this.ydd_ky.Text.Trim()))
|
|
{
|
|
if (Convert.ToInt32(this.xdd.Text.Trim()) + Convert.ToInt32(upNum_no) <= Convert.ToInt32(upQuanity_no))
|
|
{
|
|
DBService.SetUpdateOrderLineNum_zhuanru(orderCode_no, Convert.ToInt32(this.xdd.Text.Trim()));//修改上件数量
|
|
|
|
if (number_XB != 0 && znumber < Convert.ToInt32(this.xdd.Text.Trim()))//可转数量>大库区数量并且线边数量<>0
|
|
{
|
|
DBService.SetUpdateOrderLineNum_zhuanruCK(orderCode_no, Convert.ToInt32(this.xdd.Text.Trim()) - znumber);//修改出库数量
|
|
}
|
|
|
|
MessageBox.Show("转入成功!", "提示", MessageBoxButton.OK);
|
|
this.DialogResult = true;
|
|
this.Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("转入数量加上件数量大于计划数量");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("转入数量大于可转入数量,请重新输入");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("获取订单错误");
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|