300 lines
8.1 KiB
C#
300 lines
8.1 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 transpickbulks : basicForm
|
|||
|
{
|
|||
|
|
|||
|
string transOrder = "";
|
|||
|
DataTable dtTrans,dtBulks;
|
|||
|
public transpickbulks()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
//client = new WmsOutPickRequestClient(WcfHelp.getBasicBinding(), WcfHelp.getEndpoint("WmsOutPickRequestService"));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void transpickbulks_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
GetTransData();
|
|||
|
}
|
|||
|
|
|||
|
public void GetTransData()
|
|||
|
{
|
|||
|
bindBg1();
|
|||
|
textTransNo.Focus();
|
|||
|
|
|||
|
//tb1.SelectedIndex = 1;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void dg1_DoubleClick(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (dg1.DataSource == null || dg1.CurrentRowIndex < 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
transOrder = dg1[dg1.CurrentRowIndex, 0].ToString();
|
|||
|
|
|||
|
showTranBulks();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void showTranBulks()
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
|
|||
|
if (dg1.DataSource == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (dg1.CurrentRowIndex < 0)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
if (string.IsNullOrEmpty(transOrder))
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
dtBulks = client.getTransRequestsBulks(transOrder);
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|||
|
}
|
|||
|
catch (Exception er)
|
|||
|
{
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|||
|
MessageBox.Show("发生错误:" + er.Message);
|
|||
|
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
bindBg2(dtBulks);
|
|||
|
|
|||
|
tb1.SelectedIndex = 1;
|
|||
|
lbTransNo.Text = transOrder;
|
|||
|
textLocation.Focus();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private void tb1_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
if (tb1.SelectedIndex == 0)
|
|||
|
{
|
|||
|
bindBg1();
|
|||
|
textTransNo.Focus();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
textLocation.Focus();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void dg1_CurrentCellChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void bindBg1()
|
|||
|
{
|
|||
|
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
dtTrans = client.getTransRequestsWithBulks();
|
|||
|
dg1.DataSource = dtTrans;
|
|||
|
}
|
|||
|
catch (Exception er)
|
|||
|
{
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|||
|
showErrorMsg(er);
|
|||
|
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|||
|
|
|||
|
dg1.TableStyles.Clear();
|
|||
|
DataGridTableStyle ts = new DataGridTableStyle();
|
|||
|
ts.MappingName = dtTrans.TableName;
|
|||
|
dg1.TableStyles.Add(ts);
|
|||
|
// [运单] ,[拼箱] ,[拼袋] ,[线路] ,[类型] ,[车牌] ,[联系人] ,[电话] ,[司机] ,nvl([三方],'') as 三方
|
|||
|
ts.GridColumnStyles[0].Width = 100;
|
|||
|
ts.GridColumnStyles[1].Width = 35;
|
|||
|
ts.GridColumnStyles[2].Width = 35;
|
|||
|
ts.GridColumnStyles[5].Width = 80;//[车牌]
|
|||
|
ts.GridColumnStyles[7].Width = 60;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void bindBg2(DataTable dt)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
dg2.DataSource = dt;
|
|||
|
dg2.TableStyles.Clear();
|
|||
|
DataGridTableStyle dgts = new DataGridTableStyle();
|
|||
|
dgts.MappingName = dt.TableName; // 必须用 ds.TableName, dt.TableSpace 不行!!!!
|
|||
|
dg2.TableStyles.Add(dgts);
|
|||
|
//[id] ,[货位] ,[数量] ,[类型] ,[运单] ,[拣货单] ,[客户] ,[客户地址]
|
|||
|
dgts.GridColumnStyles[0].Width = 0;
|
|||
|
dgts.GridColumnStyles[1].Width = 85;
|
|||
|
dgts.GridColumnStyles[2].Width = 35;
|
|||
|
dgts.GridColumnStyles[3].Width = 35;
|
|||
|
dgts.GridColumnStyles[4].Width = 0;
|
|||
|
dgts.GridColumnStyles[5].Width = 100;
|
|||
|
dgts.GridColumnStyles[6].Width = 180;
|
|||
|
dgts.GridColumnStyles[7].Width = 180;
|
|||
|
// dg2.TableStyles[0].GridColumnStyles["pickOrderNo"].Width = 0;
|
|||
|
// dg2.TableStyles[0].GridColumnStyles["state"].Width = 0;
|
|||
|
// dg2.TableStyles[0].GridColumnStyles["状态"].Width = 70;
|
|||
|
|
|||
|
|
|||
|
textLocation.Focus();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void button1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
|
|||
|
bindBg1();
|
|||
|
}
|
|||
|
|
|||
|
private void textTransNo_KeyUp(object sender, KeyEventArgs e)
|
|||
|
{
|
|||
|
transOrder = textTransNo.Text;
|
|||
|
|
|||
|
|
|||
|
if (string.IsNullOrEmpty(transOrder))
|
|||
|
{
|
|||
|
textTransNo.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (e.KeyCode == Keys.Enter)
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
DataView dv = dtTrans.DefaultView;
|
|||
|
|
|||
|
|
|||
|
dv.RowFilter = string.Format("运单='{0}'", transOrder);
|
|||
|
|
|||
|
|
|||
|
|
|||
|
if (dv.Count == 1)
|
|||
|
{
|
|||
|
showTranBulks();
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
bindBg1();
|
|||
|
dv = dtTrans.DefaultView;
|
|||
|
dv.RowFilter = string.Format("运单='{0}'", transOrder);
|
|||
|
if (dv.Count == 1)
|
|||
|
{
|
|||
|
showTranBulks();
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
textTransNo.SelectAll();
|
|||
|
textTransNo.Focus();
|
|||
|
dv.RowFilter = "";
|
|||
|
return;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
dv.RowFilter = "";
|
|||
|
textTransNo.Text = "";
|
|||
|
textTransNo.Focus();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
private void textLocation_KeyUp(object sender, KeyEventArgs e)
|
|||
|
{
|
|||
|
string locationId = textLocation.Text;
|
|||
|
|
|||
|
if (dtBulks ==null)
|
|||
|
{
|
|||
|
MessageBox.Show("请扫描或选择运单");
|
|||
|
|
|||
|
tb1.SelectedIndex = 0;
|
|||
|
textTransNo.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if (string.IsNullOrEmpty(locationId))
|
|||
|
{
|
|||
|
MessageBox.Show("请扫描拣货单条码");
|
|||
|
textLocation.Focus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (e.KeyCode == Keys.Enter)
|
|||
|
{
|
|||
|
DataView dv = dtBulks.DefaultView;
|
|||
|
|
|||
|
dv.RowFilter = string.Format("货位='{0}'", locationId);
|
|||
|
|
|||
|
if (dv.Count == 1)
|
|||
|
{
|
|||
|
int id = Convert.ToInt32( dv[0][0].ToString());
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
|
|||
|
try{
|
|||
|
if (client.pickBulks(transOrder, id, LoginInfo.UserId, LoginInfo.Token))
|
|||
|
{
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|||
|
showTranBulks();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|||
|
MessageBox.Show("发生错误,取货失败");
|
|||
|
}
|
|||
|
}catch(Exception er){
|
|||
|
Cursor.Current = System.Windows.Forms.Cursors.Default;
|
|||
|
showErrorMsg(er);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
textLocation.SelectAll();
|
|||
|
textLocation.Focus();
|
|||
|
dv.RowFilter = "";
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
dv.RowFilter = "";
|
|||
|
textLocation.Text = "";
|
|||
|
textLocation.Focus();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|