/// <summary>
        /// 确定工作单号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonConfirm_Click(object sender, RoutedEventArgs e)
        {
            if (ListboxP.SelectedIndex != -1)
            {
                OutboundOrder order = Product_Observable.GetOutOrderFind(CheckoutInfo.CKD_CKBH);
                SetOutOrderWord(order);
            }
            Button _button = sender as Button;

            if (_button != null)
            {
                int sjcount = (int)double.Parse(CheckoutInfo.YFSL);
                int sfsl    = Convert.ToInt32(CheckoutInfo.SFSL);
                if (CheckoutInfo.KCSWZ_FJLDW == "")
                {
                    sjcount      = new PDAServer().GetERP_KcswzCount(CheckoutInfo.CKD_CKBH);
                    textnum.Text = CheckoutInfo.YFSL = sjcount.ToString();
                }

                if (textpici.Text != "")
                {
                    if (sfsl <= sjcount)
                    {
                        sjcount = sjcount - sfsl;
                    }
                    int count = Convert.ToInt32(textpici.Text);
                    if (count > sjcount)
                    {
                        MessageBox.Show("填写的发货数量不能大于等于发货单上的出库数量");
                        textpici.Text = "";
                        Tools.SFCount = 0;
                        return;
                    }
                    else
                    {
                        Tools.SFCount     = count;// Convert.ToInt32(textpici.Text);}
                        CheckoutInfo.PDSL = sjcount.ToString();
                    }
                }
                else
                {
                    Tools.SFCount     = 0;
                    CheckoutInfo.PDSL = (sjcount - sfsl).ToString();
                }

                ListboxP.SelectedItem     = null;
                ButtonConfirm.IsEnabled   = false;
                ReadButton.IsEnabled      = true;
                CodeText.IsEnabled        = true;
                ListboxP.IsEnabled        = false;
                TextBoxP.IsEnabled        = false;
                butviewFill.IsEnabled     = false;
                ButtonConfirmRE.IsEnabled = true;
                CodeText.Focus();
            }
        }
        /// <summary>
        /// 解散包装
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            TextBox textbox = sender as TextBox;
            string  code    = "";

            if (textbox != null)
            {
                code = textbox.Text.Trim();
            }
            else
            {
                code = Tools.ReplaceScanWord(deletetext.Text);
                if (code.Length != 12)
                {
                    deletetext.Focus();
                    BeepUP.Beep(1500, 500);
                    //BeepUP.player.PlaySync();
                    MessageBox.Show("该枚标签长度不是12位,请检查扫描的标签是否正确");
                    return;
                }
            }
            PackDataDelete packdata = new PDAServer().MarketReturn2(new PackDataDelete(code, App.UserReadonly.UserId));

            _PackDataDelete.Insert(0, packdata);
            deletetext.Text = "";

            Retextcount.Text = _PackDataDelete.GetSendStatusPackDataDelete("成功").ToString();

            if (packdata.STATUS.Contains("成功"))
            {
                Checkout_Simpl.RemoveCheckout(packdata.NUMBER);

                // Checkout_Simpl.GetSendStatusCheckout("成功");
                YSFCount       = Checkout_Simpl.GetSendStatusCheckout("成功");
                Codelable.Text = YSFCount.ToString();
            }

            //SendTaskstring = new Task<string>(() => SendDataDelete(code));
            //SendTaskstring.Start();
            //SendTaskstring.ContinueWith(TaskEndedDelete);
        }
        /// <summary>
        /// 按产品包装记录按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            string CodeString = "";

            if (sender is string)
            {
                CodeText.Text = CodeString = sender.ToString();
            }

            if (sender is TextBox)
            {
                CodeString = Tools.ReplaceScanWord(CodeText.Text);
            }
            if (sender is Button)
            {
                CodeString = Tools.ReplaceScanWord(CodeText.Text);
            }

            const int codeLength = 12;

            if (CodeString.Length == codeLength && CodeText.Text.Length == codeLength)
            {
                if (Tools.SFCount > 0)
                {
                    if (YSFCount >= Tools.SFCount)
                    {
                        CodeText.Text = "";
                        MessageBox.Show("该发货单已经发货完成");
                        return;
                    }
                }
                else if (YSFCount >= double.Parse(CheckoutInfo.PDSL))
                {
                    CodeText.Text = "";
                    MessageBox.Show("该发货单已经发货完成");
                    return;
                }
                Checkout checkout = new Checkout();
                checkout.BRACODE    = CodeString.Trim();         //扫描的序号
                checkout.CKD        = CheckoutInfo.CKD_CKBH;     //产品出单号
                checkout.AGEENID    = CheckoutInfo.AGEENID_KHID; //收货客户ID
                checkout.Timejzrq   = CheckoutInfo.PRODUCTID_JZRQ;
                checkout.AgentName  = CheckoutInfo.StockOut_KHMC;
                checkout.USERID     = App.UserReadonly.UserId;
                checkout.OutType    = CheckoutInfo.KCSWZ_SWLX1.Substring(0, 4);
                checkout.Outstock   = CheckoutInfo.KCSWZ_BRCK1;
                checkout.Outstockid = CheckoutInfo.KCSWZ_BRCKID;
                checkout.STATUS     = "待";//tools.OutType.Trim();
                checkout.Remarks    = CheckoutInfo.Remarks;

                Checkout _ReOut = new PDAServer().MarketOut2(checkout);
                Checkout_Simpl.Insert(0, _ReOut);

                if (_ReOut.STATUS.Contains("重复"))
                {
                    //BeepUP.player1.PlaySync();
                }
                // textSendCount.Text = Checkout_Simpl
                CodeText.Text      = "";
                YSFCount           = Checkout_Simpl.GetSendStatusCheckout("成功");
                Codelable.Text     = YSFCount.ToString();
                SOutnumText.Text   = (Convert.ToUInt32(CheckoutInfo.SFSL) + YSFCount).ToString();
                textpackError.Text = Checkout_Simpl.GetSendStatusCheckout("重复").ToString();
            }
            else
            {
                //BeepUP.player.PlaySync();
                //MessageBox.Show("该枚标签长度不是12位,请检查扫描的标签是否正确");
                Textinfo.Text = "请检查输入的标签是否正确";
            }
        }