375 lines
12 KiB
C#
375 lines
12 KiB
C#
using System;
|
|
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DeiNiu.Wms.CE.Util;
|
|
|
|
namespace DeiNiu.Wms.CE
|
|
{
|
|
public partial class StockInBk : basicForm
|
|
{
|
|
// WmsOutPickRequestClient client { get; set; }
|
|
|
|
string id = string.Empty;
|
|
int state = 1;
|
|
string location = string.Empty;
|
|
decimal count = 0m;
|
|
public StockInBk()
|
|
{
|
|
InitializeComponent();
|
|
initialComBoxes();
|
|
setTitle();
|
|
barcode_txt.Focus();
|
|
// client = new WmsOutPickRequestClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("WmsOutPickRequestService"));
|
|
}
|
|
//先扫出库码,再扫货位
|
|
private void goodscode_txt_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
// if (state == 1) //已出库的自动清空数据,继续扫下一个出库码
|
|
//{
|
|
// clear();
|
|
// }
|
|
string barCode = barcode_txt.Text;
|
|
|
|
if (string.IsNullOrEmpty(barCode))
|
|
return;
|
|
//判断货位号是否不为空
|
|
if (state == 1 && !string.IsNullOrEmpty(locationid_lab.Text))
|
|
{
|
|
//扫描货位时,比较是否相同
|
|
if (location.Equals(barCode + "x" ))
|
|
{
|
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|
enumRepResult result ;
|
|
try
|
|
{
|
|
|
|
result = (enumRepResult)client.finishUpShelfItem(order_id_lab.Text, Convert.ToInt32(id), count,
|
|
barCode, "", LoginInfo.UserId, LoginInfo.Token);
|
|
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
|
|
if (result != enumRepResult.成功)
|
|
{
|
|
|
|
MessageBox.Show("入库失败:" + result);
|
|
barcode_txt.Text = "";
|
|
return ;
|
|
}else
|
|
|
|
{
|
|
barcode_txt.Text = "";
|
|
//MessageBox.Show("!");
|
|
clear();
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
catch(Exception er)
|
|
{
|
|
|
|
showErrorMsg(er, "上架失败!");
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
barcode_txt.Text = "";
|
|
MessageBox.Show("货位不符合");
|
|
}
|
|
|
|
}
|
|
else//为空,说明是扫描的出库码
|
|
{
|
|
barcode_txt.Text = "";
|
|
//条件扫描的条码值 获取货位、商品信息
|
|
GetGoodsData(barCode);
|
|
}
|
|
barcode_txt.Focus();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GetGoodsData(string portId)
|
|
{
|
|
try
|
|
{
|
|
Convert.ToInt32(portId);
|
|
}
|
|
catch
|
|
{
|
|
MessageBox.Show("请先扫描输入上架流水号");
|
|
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|
DataTable dt = client.getStockInDetail(Convert.ToInt32(portId));
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
|
|
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
name_lab.Text = dt.Rows[0]["goodsName"].ToString();
|
|
spec_lab.Text = dt.Rows[0]["spec"].ToString();
|
|
unit_lab.Text = dt.Rows[0]["unit"].ToString();
|
|
PCompany_lab.Text = dt.Rows[0]["manufacturer"].ToString();
|
|
owner.Text = dt.Rows[0]["owner"].ToString();
|
|
Stocknum_lab.Text = dt.Rows[0]["count"].ToString();
|
|
count = Convert.ToDecimal(Stocknum_lab.Text);
|
|
locationid_lab.Text = dt.Rows[0]["locationId"].ToString();
|
|
location = locationid_lab.Text + "x";
|
|
batch_lab.Text = dt.Rows[0]["batch"].ToString();
|
|
product_date_lab.Text = dt.Rows[0]["productdate"].ToString();
|
|
save_date_lab.Text = dt.Rows[0]["validDate"].ToString();
|
|
order_id_lab.Text = dt.Rows[0]["orderNo"].ToString();
|
|
lbVender.Text = dt.Rows[0]["vender"].ToString();
|
|
id = dt.Rows[0]["id"].ToString();
|
|
state = Convert.ToInt16(dt.Rows[0]["state"].ToString());
|
|
label12.Text = state == 1 ? "待上架" : state == 5 ? "已上架" : "其它";
|
|
|
|
bigcount_lab.Text = dt.Rows[0]["bigcount"].ToString();
|
|
// double intnum = Convert.ToDouble(Convert.ToDouble(dt.Rows[0]["count"].ToString()) / Convert.ToDouble(dt.Rows[0]["bigcount"].ToString()));
|
|
// int_lab.Text = intnum.ToString();
|
|
int_lab.Text = dt.Rows[0]["box"].ToString();
|
|
|
|
}
|
|
|
|
else
|
|
{
|
|
clear();
|
|
//code = "";
|
|
//row_lab.Text = "";
|
|
barcode_txt.Focus();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
catch (Exception er)
|
|
{
|
|
MessageBox.Show("获取数据失败!" + er.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 清除界面数据
|
|
/// </summary>
|
|
private void clear()
|
|
{
|
|
name_lab.Text =
|
|
spec_lab.Text =
|
|
unit_lab.Text =
|
|
PCompany_lab.Text =
|
|
owner.Text =
|
|
Stocknum_lab.Text =
|
|
locationid_lab.Text =
|
|
batch_lab.Text =
|
|
product_date_lab.Text =
|
|
save_date_lab.Text =
|
|
int_lab.Text =
|
|
order_id_lab.Text =
|
|
bigcount_lab.Text =
|
|
id = "";
|
|
state = 1;
|
|
label12.Text = "";
|
|
location = "";
|
|
this.comboBox1.SelectedIndex = 0;
|
|
txt_loc.Text = "";
|
|
txtCount.Text = "";
|
|
lbVender.Text = "";
|
|
|
|
}
|
|
|
|
private void initialComBoxes()
|
|
{
|
|
Utils.buildCombox(5003, this.comboBox1);
|
|
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|
|
string locID = this.txt_loc.Text.ToString();
|
|
decimal count = 0m;
|
|
try
|
|
{
|
|
count = Convert.ToDecimal(txtCount.Text.ToString());
|
|
}
|
|
catch
|
|
{
|
|
MessageBox.Show("请输入数量!");
|
|
txtCount.Focus();
|
|
return;
|
|
}
|
|
|
|
|
|
if (this.comboBox1.SelectedIndex == 0)
|
|
{
|
|
MessageBox.Show("请选择原因!");
|
|
comboBox1.Focus();
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|
enumRepResult result ;
|
|
try
|
|
{
|
|
|
|
result = (enumRepResult)client.finishUpShelfItem(order_id_lab.Text, Convert.ToInt32(id), count, locID, this.comboBox1.Text, LoginInfo.UserId, LoginInfo.Token);
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
|
|
if (result != enumRepResult.成功)
|
|
{
|
|
|
|
MessageBox.Show("上架失败:" + result);
|
|
|
|
return ;
|
|
}else
|
|
|
|
|
|
{
|
|
clear();
|
|
return;
|
|
}
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
MessageBox.Show("上架失败!" + er.Message);
|
|
}
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
MessageBox.Show("出错了:" + er.Message);
|
|
|
|
}
|
|
}
|
|
|
|
private void dg1_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void dg1_CurrentCellChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void txtShelfId_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
|
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
|
|
string barCode = this.txtShelfId .Text;
|
|
int shelfId = 0;
|
|
if (string.IsNullOrEmpty(barCode))
|
|
{
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
shelfId = Convert.ToInt32(barCode);
|
|
|
|
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
MessageBox.Show("请输入正确的上架流水号");
|
|
txtShelfId.SelectAll();
|
|
txtShelfId.Focus();
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
//判断货位号是否不为空
|
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|
|
|
try
|
|
{
|
|
|
|
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
|
|
DataTable dt;
|
|
try
|
|
{
|
|
dt = client.getPreValidResult("", shelfId);
|
|
dgResult.DataSource = dt;
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
|
|
showErrorMsg(er, "发生错误");
|
|
return;
|
|
}
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
|
|
dgResult.TableStyles.Clear();
|
|
DataGridTableStyle ts = new DataGridTableStyle();
|
|
ts.MappingName = dt.TableName;
|
|
dgResult.TableStyles.Add(ts);
|
|
// [商品名称] [上架数量] ,[预到数量] ,[验收数量] ,[温度],[车牌] ,[运单] ,[电话]
|
|
ts.GridColumnStyles[0].Width = 65;
|
|
ts.GridColumnStyles[1].Width = 0;
|
|
ts.GridColumnStyles[2].Width = 35;
|
|
ts.GridColumnStyles[3].Width = 75;
|
|
ts.GridColumnStyles[4].Width = 35;
|
|
ts.GridColumnStyles[5].Width = 35;
|
|
ts.GridColumnStyles[6].Width = 0;
|
|
|
|
clear();
|
|
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er);
|
|
}
|
|
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
} |