Exemple #1
0
        private void Stockout(OrderLib.ShippingOrigins shippingOrigin)
        {
            if (string.IsNullOrEmpty(txtShipmentNumber.Text))
            {
                MessageBox.Show(this, this.Text, "请输入运单号.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            ProductInfo     pi  = ProductInfo.GetProductByDangdangCode(_dangdangOrder.UniqueProductCode);
            SoldProductInfo spi = new SoldProductInfo(pi);

            spi.Count = _dangdangOrder.ActualCount;
            List <SoldProductInfo> soldProductInfos = new List <SoldProductInfo>();

            soldProductInfos.Add(spi);

            string result = StockActionAdvForm.StockAction(
                true, soldProductInfos,
                string.Format("dd\\{0},{1}", txtRecipientName.Text, txtPhone.Text),
                string.Format("{0}{1}", txtShipmentCompany.Text.ToLower(), txtShipmentNumber.Text), shippingOrigin);

            MessageBox.Show(
                this,
                "Result from server: \n" + result,
                this.Text,
                MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        private void btnGo_Click(object sender, EventArgs e)
        {
            // 出库登记.
            try
            {
                if (0 == GetProductTotalCount())
                {
                    MessageBox.Show(this, "没有任何产品, 无需执行出库操作!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                Application.DoEvents();
                Cursor.Current = Cursors.WaitCursor;

                List <SoldProductInfo> soldProductInfos = new List <SoldProductInfo>();
                foreach (Control c in pnlProductList.Controls)
                {
                    if (!(c is SoldProductInfoControl))
                    {
                        continue;
                    }
                    SoldProductInfoControl spic = c as SoldProductInfoControl;
                    if (spic.Count == 0)
                    {
                        continue;
                    }
                    if (spic.SelectedProductInfo.Id.Equals("0"))
                    {
                        continue;
                    }
                    SoldProductInfo spi = new SoldProductInfo(spic.SelectedProductInfo);
                    spi.Count = spic.Count;
                    soldProductInfos.Add(spi);
                }

                string result = StockActionAdvForm.StockAction(
                    true,
                    soldProductInfos,
                    string.Format("德国e购\\{0} [{1},{2}]", txtTaobaoId.Text, txtRecipientName.Text, txtMobile.Text),
                    (rdoSf.Checked ? "sf" : "yto") + txtBillNumber.Text,
                    OrderLib.ShippingOrigins.Shanghai);

                MessageBox.Show(
                    this,
                    "Result from server: \n" + result,
                    this.Text,
                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                if (result.StartsWith("Succeeded"))
                {
                    btnClose.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }