You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
272 lines
11 KiB
272 lines
11 KiB
using System;
|
|
using System.Collections.Generic;
|
|
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 System.Data;
|
|
|
|
namespace SiaSun.LMS.WPFClient.MANAGE
|
|
{
|
|
public partial class MANAGE_IN_LOCAL_XIAOLIAO : AvalonDock.DocumentContent
|
|
{
|
|
public MANAGE_IN_LOCAL_XIAOLIAO()
|
|
{
|
|
InitializeComponent();
|
|
this.cbXianBie.DisplayMemberPath = "ITEM_LIST_NAME";
|
|
this.cbXianBie.SelectedValuePath = "ITEM_LIST_CODE";
|
|
try
|
|
{
|
|
string strSQL = string.Format(@"SELECT ITEM_LIST_CODE,ITEM_LIST_NAME FROM V_SYS_ITEM
|
|
WHERE ITEM_CODE='XIAN_BIE' ORDER BY ITEM_LIST_ORDER");
|
|
DataTable dt = MainApp._I_BaseService.GetList(strSQL);
|
|
DataRow dr = dt.NewRow();
|
|
this.cbXianBie.ItemsSource = dt.DefaultView;
|
|
|
|
//if (this.cbXianBie.Items.Count > 0)
|
|
//{
|
|
// this.cbXianBie.SelectedIndex = 0;
|
|
//}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MainApp._MessageDialog.ShowException(ex);
|
|
}
|
|
}
|
|
|
|
private void BtnSave_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
bool bResult = true;
|
|
string sResult = string.Empty;
|
|
if (string.IsNullOrEmpty(this.tbStock_barcode.Text))
|
|
{
|
|
MessageBox.Show("托盘条码为空");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(this.tbGoods_code.Text))
|
|
{
|
|
MessageBox.Show("物料条码1为空");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(this.tbGoods_code2.Text))
|
|
{
|
|
MessageBox.Show("物料条码2为空");
|
|
return;
|
|
}
|
|
if (this.cbXianBie.SelectedIndex < 0)
|
|
{
|
|
MessageBox.Show("请选择线别");
|
|
return;
|
|
}
|
|
|
|
if (!Common.RegexValid.GetCodeCheck(this.tbStock_barcode.Text, "StockCodeCheck"))
|
|
{
|
|
MessageBox.Show("托盘条码规则不正确");
|
|
return;
|
|
}
|
|
int iZupanCellID = 0;
|
|
DataTable dtZupan = MainApp._I_BaseService.GetList("select CELL_ID from WH_CELL where CELL_CODE='99999'");
|
|
if (dtZupan.Rows.Count == 0)
|
|
{
|
|
MessageBox.Show("未找到组盘区");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
iZupanCellID = Convert.ToInt32(dtZupan.Rows[0]["CELL_ID"]);
|
|
}
|
|
DataTable gOODS_MAIN = MainApp._I_BaseService.GetList(@"select goods_id from goods_main where goods_code = 'XIAOLIAO'");
|
|
if (gOODS_MAIN == null || gOODS_MAIN.Rows.Count < 1)
|
|
{
|
|
MessageBox.Show("小料物料信息不存在");
|
|
return;
|
|
}
|
|
string sGoodsBarcode = this.tbGoods_code.Text.Trim();
|
|
string[] strArr = sGoodsBarcode.Split('-');
|
|
if (strArr.Length != 7)
|
|
{
|
|
MessageBox.Show("物料条码1规则不正确");
|
|
return;
|
|
}
|
|
string sGoodsBarcode2 = this.tbGoods_code2.Text.Trim();
|
|
string[] strArr2 = sGoodsBarcode2.Split('-');
|
|
if (strArr2.Length != 7)
|
|
{
|
|
MessageBox.Show("物料条码2规则不正确");
|
|
return;
|
|
}
|
|
if (!((strArr[1] == "10110037" && strArr2[1] == "10110066") ||
|
|
(strArr2[1] == "10110037" && strArr[1] == "10110066")))
|
|
{
|
|
MessageBox.Show("物料必须为PEG和钛白粉");
|
|
return;
|
|
}
|
|
|
|
Model.MANAGE_MAIN mANAGE_MAIN = new Model.MANAGE_MAIN();
|
|
List<SiaSun.LMS.Model.MANAGE_LIST> lsMANAGE_LIST = new List<Model.MANAGE_LIST>();
|
|
mANAGE_MAIN.STOCK_BARCODE = this.tbStock_barcode.Text;
|
|
mANAGE_MAIN.MANAGE_TYPE_CODE = "ManageIn";
|
|
mANAGE_MAIN.MANAGE_OPERATOR = MainApp._USER.USER_NAME;
|
|
mANAGE_MAIN.MANAGE_BEGIN_TIME = Common.StringUtil.GetDateTime();
|
|
mANAGE_MAIN.MANAGE_STATUS = "Waiting";
|
|
mANAGE_MAIN.START_CELL_ID = iZupanCellID;
|
|
mANAGE_MAIN.END_CELL_ID = 0;
|
|
Model.MANAGE_LIST mANAGE_LIST = new Model.MANAGE_LIST();
|
|
mANAGE_LIST.GOODS_ID = Convert.ToInt32(gOODS_MAIN.Rows[0]["GOODS_ID"].ToString());
|
|
mANAGE_LIST.MANAGE_ID = 0;
|
|
mANAGE_LIST.MANAGE_LIST_QUANTITY = Convert.ToDecimal(strArr[5]);
|
|
mANAGE_LIST.PLAN_LIST_ID = 0;
|
|
mANAGE_LIST.GOODS_PROPERTY1 = sGoodsBarcode;
|
|
mANAGE_LIST.GOODS_PROPERTY2 = strArr[0] + "-" + strArr[1] + "-" + strArr[2] + "-" + strArr[4];
|
|
mANAGE_LIST.GOODS_PROPERTY3 = strArr[2];
|
|
mANAGE_LIST.GOODS_PROPERTY4 = this.cbXianBie.SelectedValue.ToString();
|
|
//mANAGE_LIST.GOODS_PROPERTY8 = "0";
|
|
mANAGE_LIST.GOODS_PROPERTY9 = "1";
|
|
mANAGE_LIST.STORAGE_LIST_ID = 0;
|
|
lsMANAGE_LIST.Add(mANAGE_LIST);
|
|
Model.MANAGE_LIST mANAGE_LIST2 = new Model.MANAGE_LIST();
|
|
mANAGE_LIST2.GOODS_ID = Convert.ToInt32(gOODS_MAIN.Rows[0]["GOODS_ID"].ToString());
|
|
mANAGE_LIST2.MANAGE_ID = 0;
|
|
mANAGE_LIST2.MANAGE_LIST_QUANTITY = Convert.ToDecimal(strArr[5]);
|
|
mANAGE_LIST2.PLAN_LIST_ID = 0;
|
|
mANAGE_LIST2.GOODS_PROPERTY1 = sGoodsBarcode2;
|
|
mANAGE_LIST2.GOODS_PROPERTY2 = strArr2[0] + "-" + strArr2[1] + "-" + strArr2[2] + "-" + strArr2[4];
|
|
mANAGE_LIST2.GOODS_PROPERTY3 = strArr2[2];
|
|
mANAGE_LIST2.GOODS_PROPERTY4 = this.cbXianBie.SelectedValue.ToString();
|
|
//mANAGE_LIST2.GOODS_PROPERTY8 = "0";
|
|
mANAGE_LIST2.GOODS_PROPERTY9 = "1";
|
|
mANAGE_LIST2.STORAGE_LIST_ID = 0;
|
|
lsMANAGE_LIST.Add(mANAGE_LIST2);
|
|
bResult = MainApp._I_BaseService.Invoke("ManageIn", "ManageCreate",
|
|
new object[] {
|
|
mANAGE_MAIN,
|
|
lsMANAGE_LIST,
|
|
true,//事务
|
|
true,//检查库存
|
|
true,//是否完成
|
|
false//是否下达任务
|
|
},out sResult);
|
|
if (bResult)
|
|
{
|
|
MessageBox.Show("组盘成功");
|
|
BtnClear_Click(null, null);
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(sResult);
|
|
return;
|
|
}
|
|
}
|
|
|
|
private void BtnClear_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.tbStock_barcode.Text = string.Empty;
|
|
this.tbGoods_code.Text = string.Empty;
|
|
this.tbGoods_code2.Text = string.Empty;
|
|
this.lbErrorGoods_code.Content = string.Empty;
|
|
this.lbErrorGoods_code2.Content = string.Empty;
|
|
this.tbStock_barcode.Focus();
|
|
}
|
|
|
|
private void tbStock_barcode_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key == Key.Enter)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(this.tbStock_barcode.Text))
|
|
{
|
|
return;
|
|
}
|
|
this.tbStock_barcode.Text = this.tbStock_barcode.Text.ToUpper();
|
|
if (string.IsNullOrWhiteSpace(this.tbGoods_code.Text))
|
|
{
|
|
this.tbGoods_code.Focus();
|
|
}
|
|
else if (string.IsNullOrWhiteSpace(this.tbGoods_code2.Text))
|
|
{
|
|
this.tbGoods_code2.Focus();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void tbGoods_code_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key == Key.Enter)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(this.tbGoods_code.Text))
|
|
{
|
|
return;
|
|
}
|
|
this.tbGoods_code.Text = this.tbGoods_code.Text.ToUpper();
|
|
if (string.IsNullOrWhiteSpace(this.tbGoods_code2.Text))
|
|
{
|
|
this.tbGoods_code2.Focus();
|
|
}
|
|
string sGoodsBarcode = this.tbGoods_code.Text.Trim();
|
|
string[] strArr = sGoodsBarcode.Split('-');
|
|
if (strArr.Length != 7)
|
|
{
|
|
lbErrorGoods_code.Content = "条码格式错误";
|
|
lbErrorGoods_code.Foreground = Brushes.Red;
|
|
return;
|
|
}
|
|
if (strArr[1] == "10110037")
|
|
{
|
|
lbErrorGoods_code.Content = "( PEG )";
|
|
lbErrorGoods_code.Foreground = Brushes.Black;
|
|
}
|
|
else if (strArr[1] == "10110066")
|
|
{
|
|
lbErrorGoods_code.Content = "( 钛白粉 )";
|
|
lbErrorGoods_code.Foreground = Brushes.Black;
|
|
}
|
|
else
|
|
{
|
|
lbErrorGoods_code.Content = "条码错误";
|
|
lbErrorGoods_code.Foreground = Brushes.Red;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void tbGoods_code2_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key == Key.Enter)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(this.tbGoods_code2.Text))
|
|
{
|
|
return;
|
|
}
|
|
this.tbGoods_code2.Text = this.tbGoods_code2.Text.ToUpper();
|
|
string sGoodsBarcode2 = this.tbGoods_code2.Text.Trim();
|
|
string[] strArr2 = sGoodsBarcode2.Split('-');
|
|
if (strArr2.Length != 7)
|
|
{
|
|
lbErrorGoods_code2.Content = "条码格式错误";
|
|
lbErrorGoods_code2.Foreground = Brushes.Red;
|
|
return;
|
|
}
|
|
if (strArr2[1] == "10110037")
|
|
{
|
|
lbErrorGoods_code2.Content = "( PEG )";
|
|
lbErrorGoods_code2.Foreground = Brushes.Black;
|
|
}
|
|
else if (strArr2[1] == "10110066")
|
|
{
|
|
lbErrorGoods_code2.Content = "( 钛白粉 )";
|
|
lbErrorGoods_code2.Foreground = Brushes.Black;
|
|
}
|
|
else
|
|
{
|
|
lbErrorGoods_code2.Content = "条码错误";
|
|
lbErrorGoods_code2.Foreground = Brushes.Red;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|