ldj/wince/DeiNiuWmsWINCE/forms/RegBox.cs

185 lines
5.5 KiB
C#
Raw Normal View History

2023-05-23 16:13:17 +08:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections.Specialized;
using System.Data;
using System.Collections;
namespace DeiNiu.Wms.CE
{
public partial class RegBox : basicForm
{
#region
//public int page = 0;
string gooodsid = string.Empty;
int ye = 0;
int index = 0;
int skuId = 0;
DataTable dt = new DataTable();
Dictionary<string, string> partLst = new Dictionary<string, string>();
int partionId = 0;
public RegBox()
{
setTitle();
InitializeComponent();
focusOn(input_txt, " 分区号码");
clearResult();
clearPart();
}
private void BarCodeStorage_Load(object sender, EventArgs e)
{
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
try
{
DataTable dt = client.getLightPartions(LoginInfo.UserId, LoginInfo.Token );
foreach (DataRow dr in dt.Rows)
{
partLst[dr["flag"].ToString()] = dr["name"].ToString();
}
}
catch (Exception er)
{
Cursor.Current = System.Windows.Forms.Cursors.Default;
MessageBox.Show("发生错误:" + er.Message);
return;
}
Cursor.Current = System.Windows.Forms.Cursors.Default;
}
#endregion
/// <summary>
/// 扫描商品条码,获取数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
///
private void goodscode_txt_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.Enter)
{
return;
}
clearResult();
string barcode = input_txt.Text.Trim();
if (barcode.StartsWith("H")) //its box
{
if (partionId == 0)
{
MessageBox.Show("请扫描分区条码 " );
return;
}
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
try
{
// barcode = "H-1-1-1";
enumRegBoxResult result = (enumRegBoxResult)client.regPartBox(partionId, barcode, LoginInfo.UserId, LoginInfo.Token);
if (result == enumRegBoxResult.)
{
lbResult.Text = "注册成功";
}
else if (result == enumRegBoxResult.)
{
lbResult.Text = "当前无拣货订单";
}
}
catch (Exception er)
{
Cursor.Current = System.Windows.Forms.Cursors.Default;
MessageBox.Show("发生错误:" + er.Message);
return;
}
Cursor.Current = System.Windows.Forms.Cursors.Default;
focusOn(input_txt, " 分区号码");
return;
}
else //its part
{
if (partLst.ContainsKey(barcode))
{
clearPart();
lbPartion.Text = partLst[barcode];
try
{
partionId = Convert.ToInt16(barcode);
}
catch (Exception er)
{
focusOn(input_txt, " 分区号码");
MessageBox.Show("解析分区ID发生错误" + er.Message);
return;
}
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
try
{
DataTable dt = client.getPartionRequests(partionId, LoginInfo.UserId, LoginInfo.Token);
foreach(DataRow dr in dt.Rows)
{
lbColors.Text += (enumColors)Convert.ToInt16(dr["color"].ToString()) + "; ";
}
lbOrderCnt.Text = dt.Rows.Count+"";
}
catch (Exception er)
{
Cursor.Current = System.Windows.Forms.Cursors.Default;
MessageBox.Show("发生错误:" + er.Message);
focusOn(input_txt, " 分区号码");
return;
}
Cursor.Current = System.Windows.Forms.Cursors.Default;
//to get part pick requests
}
else
{
MessageBox.Show("请扫分区条码或箱子条码");
return;
}
input_txt.Text = "";
focusOn(input_txt, " 周转箱编号");
}
}
private void clearResult()
{
lbResult.Text = "";
}
private void clearPart()
{
lbPartion.Text = lbColors.Text = lbOrderCnt.Text = "";
partionId = 0;
}
}
}