コード例 #1
0
        private void TBHeight_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                float Size = 0;
                //台湾仓
                if (staff_region == "1")
                {
                    Size = float.Parse(TBLength.Text) * float.Parse(TBWidth.Text) * float.Parse(TBHeight.Text) / 6000;
                    if (TBweigh.Text != "")
                    {
                        Size = (Size + float.Parse(TBweigh.Text)) / 2;
                    }
                }

                //香港仓
                if (staff_region == "2")
                {
                    Size = float.Parse(TBLength.Text) * float.Parse(TBWidth.Text) * float.Parse(TBHeight.Text) / 6000;
                }

                TBSize.Text  = Size.ToString();
                TBNote.Text += " 【" + TBLength.Text + "*" + TBWidth.Text + "*" + TBHeight.Text + "=" + Size + "】 ";

                Weight_Size += Size;
                TBNote.Focus();

                //清空数据
                TBWidth.Clear();
                TBLength.Clear();
                TBHeight.Clear();
                TBSize.Clear();
            }
        }
コード例 #2
0
 private void TBShelf_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         TBNote.Focus();
     }
 }
コード例 #3
0
        /// <summary>
        /// 备注回车事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TBNote_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.Key == Key.Enter)
                {
                    inputDB();
                    getTableData();

                    if (IsOK == true)
                    {
                        if (CBEnterPrint.IsChecked == true)
                        {
                            string userid = "", tbname = "", conId = "", shelf = "";

                            if (TBName.Tag == null || TBName.Tag.ToString() == "")
                            {
                                //MessageBox.Show(TBName.Text + "  用户不存在请重新输入");
                                //TBName.Text = null;
                                //TBName.Focus();
                                //return;
                                userid = "";
                            }
                            else
                            {
                                userid = TBName.Tag.ToString();
                            }

                            tbname = TBName.Text;

                            if (TBShelf.Text != "")
                            {
                                shelf = TBShelf.Text;
                            }
                            else
                            {
                                shelf = "";
                            }

                            if (TBtranId.Text.Length >= 5)
                            {
                                conId = TBtranId.Text;
                            }
                            else
                            {
                                conId = "";
                            }

                            //调取打印机并打印
                            //PrintForm.PrintWeight pw = new PrintForm.PrintWeight(userid, tbname, conId, shelf);
                            ////pw.ContentSource = @"/Pages/Print/Test.xaml";
                            ////pw.ShowInTaskbar = false;
                            //pw.Show();
                            ////pw.Visibility = Visibility.Hidden;
                            ////Thread.Sleep(90);
                            //pw.Close();

                            PrintWeight(userid, tbname, conId, shelf);
                        }

                        //清空数据
                        TBNumber.Text = "1";
                        if (CBlastName.IsChecked == false)
                        {
                            TBName.Text = null;
                            TBName.Tag  = null;
                        }
                        TBNote.Clear();
                        TBNoteStaff.Clear();
                        TBShelf.Clear();
                        TBSize.Clear();
                        TBtranId.Clear();
                        TBweigh.Clear();
                        CBHelf.IsChecked = false;
                        CBLong.IsChecked = false;
                        TBtranId.Focus();
                        IsOK        = false;
                        Weight_Size = 0;
                    }
                }
            }catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
            }
        }