192 lines
6.4 KiB
C#
192 lines
6.4 KiB
C#
using System;
|
|
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace DeiNiu.Wms.CE
|
|
{
|
|
public partial class StockOut : basicForm
|
|
{
|
|
// WmsOutPickRequestClient client { get; set; }
|
|
|
|
string id = string.Empty;
|
|
string waveNo = string.Empty;
|
|
int state = -100;
|
|
string location = string.Empty;
|
|
string flowNo = "";
|
|
public StockOut()
|
|
{
|
|
InitializeComponent();
|
|
setTitle();
|
|
focusOn(txtFlow,"下架托盘码");
|
|
// client = new WmsOutPickRequestClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("WmsOutPickRequestService"));
|
|
}
|
|
//先扫出库码,再扫货位
|
|
private void goodscode_txt_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
if (state > 0)
|
|
{
|
|
clear();
|
|
focusOn(barcode_txt, "出库下架任务码");
|
|
return;
|
|
}
|
|
|
|
string barCode = barcode_txt.Text;
|
|
barcode_txt.Text = "";
|
|
|
|
flowNo = txtFlow.Text;
|
|
if (String.IsNullOrEmpty(flowNo))
|
|
{
|
|
focusOn(txtFlow, "下架托盘码");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(barCode))
|
|
return;
|
|
//判断货位号是否不为空
|
|
if (!string.IsNullOrEmpty(locationid_lab.Text))
|
|
{
|
|
//扫描货位时,比较是否相同
|
|
if (location.Equals(barCode + "x" ))
|
|
{
|
|
|
|
|
|
|
|
decimal pickCount = Convert.ToDecimal(Stocknum_lab.Text);
|
|
try
|
|
{
|
|
if (state >0 || client.finishPickItem(flowNo,waveNo, order_id_lab.Text, Convert.ToInt32(id), pickCount, LoginInfo.UserId, LoginInfo.Token))
|
|
{
|
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|
clear();
|
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
catch(Exception er)
|
|
{
|
|
MessageBox.Show("出库失败!" + er.Message);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("货位不符合");
|
|
}
|
|
|
|
}
|
|
else//为空,说明是扫描的出库码
|
|
{
|
|
//条件扫描的条码值 获取货位、商品信息
|
|
GetPickData(barCode);
|
|
}
|
|
barcode_txt.Focus();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
private void GetPickData(string portId)
|
|
{
|
|
|
|
try
|
|
{
|
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|
DataTable dt = client.getPickDetail(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();
|
|
custor_name_lab.Text = dt.Rows[0]["customerName"].ToString();
|
|
Stocknum_lab.Text = dt.Rows[0]["count"].ToString();
|
|
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]["pickOrderNo"].ToString();
|
|
id = dt.Rows[0]["id"].ToString();
|
|
state = Convert.ToInt16(dt.Rows[0]["state"].ToString());
|
|
label12.Text = state == 1 ? "已出库" : state == 0 ? "待出库" : "已复核";
|
|
|
|
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();
|
|
waveNo = dt.Rows[0]["waveOrder"].ToString();
|
|
focusOn(barcode_txt, "货位码");
|
|
}
|
|
|
|
else
|
|
{
|
|
clear();
|
|
//code = "";
|
|
//row_lab.Text = "";
|
|
barcode_txt.Focus();
|
|
}
|
|
|
|
|
|
}
|
|
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er);
|
|
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 清除界面数据
|
|
/// </summary>
|
|
private void clear()
|
|
{
|
|
name_lab.Text =
|
|
spec_lab.Text =
|
|
unit_lab.Text =
|
|
PCompany_lab.Text =
|
|
custor_name_lab.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 = -100;
|
|
label12.Text = "";
|
|
location = "";
|
|
}
|
|
|
|
private void txtFlowno_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
flowNo= txtFlow.Text.Trim();
|
|
|
|
focusOn(barcode_txt, "出库下架任务码");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
} |