📄 wholesale.cs
字号:
{
TBox_ClientID.Items.Clear();
GetCupp();
}
if(ScanSize==40)
{
TBox_ThName.Items.Clear();
Getparms();//获取事物交易信息
}
else if(ScanSize>40)
{
//MessageBox.Show("错误的条码");
MsgBox(rm.GetString("10010"),MsgTitle,3);
ScanData="";
ScanSize=0;
}
break;
case ScannerEventCodes.SCANNERINSERTED:
//MessageBOX.Text = " 初始化失败";
Cursor.Current = Cursors.WaitCursor;
this.BringToFront();
break;
case ScannerEventCodes.SCANNERINITIALIZED:
//MessageBOX.Text = " 初始化完毕";
if (gScanner.ScannerType == ScannerTypes.SCANNER_ISC)
{
((EngineSSISymbol) gScanner.Engine).DecodeUPCEANSupplimentals = Supplimentals.AutoDiscriminate;
}
else if ((gScanner.ScannerType == ScannerTypes.SCANNER_ISCIBASIC) ||
(gScanner.ScannerType == ScannerTypes.SCANNER_ISCIFULL))
{
EngineHHP eHHP = (EngineHHP) gScanner.Engine;
eHHP.ScanSendCommand("E13AD21.");
eHHP.ScanSendCommand("E13AD51.");
eHHP.ScanSendCommand("UPAAD21.");
eHHP.ScanSendCommand("UPAAD51.");
}
Cursor.Current = Cursors.Default;
break;
case ScannerEventCodes.SCANNERREMOVED:
//ScanTimer.Enabled = false;
break;
}
}
private void timer_Tick(object sender, System.EventArgs e)
{
if (!gScanner.ScannerInserted)
return;
gTimerCounter--;
this.Text = "Scan " + Convert.ToString(gTimerCounter);
if (gTimerCounter == 3)
this.Text = "Data Cleared - Rescanning";
else if (gTimerCounter == 0)
{
gTimerCounter = gDemoSecs;
gScanner.TriggerScanner();
}
}
//-------------------------ZJNET ADD 手动选择(2005.9.5)-----------------------------
private void Choose()
{
string SqlText;
if (MBID == "OK")
{
CEData lo;
lo=new CEData();
SqlCeConnection conn=lo.conn;
//读取客户历史交易信息
try
{
SqlText=null;
SqlCeDataReader myReader=null;
SqlText = "SELECT TAHAA,TAHAB FROM TAH";
SqlCeCommand cmd=new SqlCeCommand(SqlText,conn);
myReader=cmd.ExecuteReader();
while (myReader.Read())
{
TBox_ClientID.Items.Add(myReader.GetString(1).ToString());
//TBox_ClientID.SelectedIndex=0;
}
myReader.Close();
}
catch
{
//MessageBOX.Text=" 信息读取失败!";
conn.Dispose();
}
//读取历史交易事物信息
try
{
SqlText=null;
SqlCeDataReader myReader=null;
SqlText = "SELECT TAIAA,TAIAB FROM TAI";
SqlCeCommand cmd=new SqlCeCommand(SqlText,conn);
myReader=cmd.ExecuteReader();
while (myReader.Read())
{
TBox_ThName.Items.Add(myReader.GetString(1));
//TBox_ThName.SelectedIndex=0;
}
myReader.Close();
}
catch
{
//MessageBOX.Text=" 信息读取失败!";
conn.Dispose();
}
conn.Dispose();
}
}
private void TBox_ThName_SelectedValueChanged(object sender, System.EventArgs e)
{
string SqlText;
if (MBID == "OK")
{
CEData le;
le=new CEData();
SqlCeConnection conn=le.conn;
TBox_Pack.Items.Clear();
//读取事物产品ID
try
{
SqlText=null;
SqlCeDataReader myReader=null;
SqlText = "SELECT TAIAA,TAIAB FROM TAI WHERE TAIAB = '"+TBox_ThName.Text.ToString()+"'";
SqlCeCommand cmd=new SqlCeCommand(SqlText,conn);
myReader=cmd.ExecuteReader();
myReader.Read();
THID = myReader.GetString(0);
myReader.Close();
}
catch
{
//MessageBOX.Text=" 信息读取失败!";
conn.Dispose();
}
//读取事物包装信息
try
{
if (THID.ToString() != "")
{
SqlText=null;
SqlCeDataReader myReader=null;
SqlText = "SELECT * FROM TAE WHERE TAEAA = '"+THID.ToString()+"'";
SqlCeCommand cmd=new SqlCeCommand(SqlText,conn);
myReader=cmd.ExecuteReader();
TBox_Pack.Items.Clear();
while (myReader.Read())
{
TBox_Pack.Items.Add(myReader.GetString(2));
}
myReader.Close();
}
}
catch
{
//MessageBOX.Text=" 信息读取失败!";
conn.Dispose();
}
conn.Dispose();
}
}
private void TBox_Pack_SelectedValueChanged(object sender, System.EventArgs e)
{
string SqlText;
if (MBID == "OK")
{
CEData lr;
lr=new CEData();
SqlCeConnection conn=lr.conn;
//读取事物包装层次ID
try
{
SqlText=null;
SqlCeDataReader myReader=null;
SqlText = "SELECT TAEAD,TAEAF FROM TAE WHERE TAEAB = '"+TBox_Pack.Text.ToString()+"'AND TAEAA = '"+THID+"'";
SqlCeCommand cmd=new SqlCeCommand(SqlText,conn);
myReader=cmd.ExecuteReader();
myReader.Read();
PKID = myReader.GetString(0);//获取产品包装层次ID
LGSL = System.Convert.ToDouble(myReader.GetValue(1).ToString());//获取量纲数量
myReader.Close();
}
catch
{
//MessageBOX.Text=" 信息读取失败!";
conn.Dispose();
}
conn.Dispose();
}
}
//---------------------------------write by 廖满亮------------------------------------
private void Frm_Main_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if(!CloseThread)
e.Cancel=true;
CloseThread=true;
}
private void CloseMe(object o, EventArgs e)
{
this.Close();
}
private void Frm_Main_Closed(object sender, System.EventArgs e)
{
t.Enabled=false;
Noti.RemoveLast();
g_mi.UnregisterAllHardwareKeys();
SocketScanner.StopSocketScan();
gScanner.Dispose();
this.Dispose(true);
}
private void Btn_Exchange_Click(object sender, System.EventArgs e)
{
if(!IsExchange)
return;
IsExchange=false;
try
{
MessageBOX.Text="";
if(Edit()==true) //判断交易信息是否完整
return;
if (MBID =="OK")
{
Manual();//执行手动交易过程
MBID = null; //判断是手动交易还是扫描交易
THID = null; //手动输入时获取的产品ID
PKID = null; //手动输入时获取的产品包装层次ID
LGSL = 0.0; //手动输入信息时获取产品基类包装数量
TBox_ClientID.Items.Clear();
TBox_ThName.Items.Clear();
Clear(); //清屏
MBID = "OK";//判断是扫描还是手动交易方式
Choose();
Thread.Sleep(2000);
}
else if(MBID =="NO")
{
Scan();
TBox_ClientID.Items.Clear();
TBox_ThName.Items.Clear();
Clear();//清屏
MBID = "OK";//判断是扫描还是手动交易方式
Choose();
//Thread.Sleep(2000);
}
Thread.Sleep(2000);
}
finally
{
IsExchange=true;
}
}
private void Btn_Scan_Click(object sender, System.EventArgs e)
{
if(!IsScan)
return;
IsScan=false;
try
{
MessageBOX.Text = "";
if(ScanSize<40)
{
gScanner.TriggerScanner();
Thread.Sleep(2000);
}
if(ScanSize>40)
{
Singularity();//异常信息的处理
ScanData="";
ScanSize=0;
//return;
}
if(ScanSize==40)
{
ScanData="";
ScanSize=0;
gScanner.TriggerScanner();
}
}
finally
{
IsScan=true;
}
}
public class PictureButton : Control
{
Image backgroundImage, pressedImage;
bool pressed = false;
// Property for the background image to be drawn behind the button text.
public Image BackgroundImage
{
get
{
return this.backgroundImage;
}
set
{
this.backgroundImage = value;
}
}
// Property for the background image to be drawn behind the button text when
// the button is pressed.
/// </summary>
public Image PressedImage
{
get
{
return this.pressedImage;
}
set
{
this.pressedImage = value;
}
}
// When the mouse is pressed, set the "pressed" flag = true and invalidate
// to cause a repaint. The Compact Framework sets the mouse capture automatically.
protected override void OnMouseDown(MouseEventArgs e)
{
this.pressed = true;
this.Invalidate();
base.OnMouseDown (e);
}
// When the mouse is released, reset the "pressed" flag and invalidate to redraw the
// button in the un-pressed state.
protected override void OnMouseUp(MouseEventArgs e)
{
this.pressed = false;
this.Invalidate();
base.OnMouseUp (e);
}
// Override the OnPaint method so we can draw the background image and the text.
protected override void OnPaint(PaintEventArgs e)
{
if(this.pressed && this.pressedImage != null)
e.Graphics.DrawImage(this.pressedImage, 0, 0);
else
e.Graphics.DrawImage(this.backgroundImage, 0, 0);
// Draw the text if there is any.
if(this.Text.Length > 0)
{
SizeF size = e.Graphics.MeasureString(this.Text, this.Font);
// Center the text inside the client area of the PictureButton.
e.Graphics.DrawString(this.Text,
this.Font,
new SolidBrush(this.ForeColor),
(this.ClientSize.Width - size.Width) / 2,
(this.ClientSize.Height - size.Height) / 2);
}
// Draw a border around the outside of the control to look like regular
// PPC buttons..DrawRectangle(new Pen(Color.Black), 0, 0,
e.Graphics.DrawEllipse(new Pen(Color.Blue), 0, 0,
this.ClientSize.Width - 1, this.ClientSize.Height - 1);
base.OnPaint(e);
}
}
private void t_Tick(object sender, EventArgs e)
{
Noti.RemoveLast();
t.Enabled=false;
}
private void TBox_Amount_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
int iTemp=0;
try
{
iTemp=Int32.Parse(TBox_Amount.Text);
}
catch(Exception)
{
iTemp=0;
}
if(e.KeyCode==Keys.Up)
{
iTemp++;
/*
if(iTemp>20)
{
iTemp=1;
}
*/
TBox_Amount.Text=iTemp.ToString();
}
if(e.KeyCode==Keys.Down)
{
iTemp--;
if(iTemp<1)
{
iTemp=1;
}
TBox_Amount.Text=iTemp.ToString();
}
}
/// <summary>
/// 检验当前PDA是否处于通讯状态
/// </summary>
/// <returns>true:代表处于通讯中,false:代表处于离线中</returns>
private bool IsOnLine()
{
string sTemp="";
IPAddress[] addressList=null;
try
{
addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;
}
catch
{
return false;
}
for (int i = 0; i < addressList.Length; i ++)
{
sTemp += addressList[i].ToString();
}
if(sTemp.CompareTo("127.0.0.1")==0)
{
return false;
}
else
{
return true;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -