private void UpdatePayType(int selectType, PfInfo item)
        {
            switch (selectType)
            {
            case 0:
                //记录一条欠条
                GlobalCache.ServerProxy.PfDelivery(item);
                break;

            case 1:
                //减去余额
                pfCustomer.Balance -= item.PfOrder.TotalPfPrice;
                InteractResult interactResult = PfCustomerCache.PfCustomer_OnUpdate(pfCustomer);
                switch (interactResult.ExeResult)
                {
                case ExeResult.Success:
                    break;

                case ExeResult.Error:
                    GlobalMessageBox.Show(interactResult.Msg);
                    break;

                default:
                    break;
                }
                break;

            case 2:
                break;

            default:
                break;
            }
        }
Beispiel #2
0
        private int ShowPayTypeForm(PfInfo item)
        {
            int selectType = -1;
            WholesaleDeliveryReturnForm form = new WholesaleDeliveryReturnForm(pfCustomer, item.PfOrder.TotalPfPrice);

            if (form.ShowDialog() == DialogResult.OK)
            {
                selectType = form.Result;
            }
            return(selectType);
        }
        //点击出库按钮
        private void Save(bool isHang)
        {
            try
            {
                bool pfPriceEmpty    = false;
                bool pfPriceSuperLen = false;
                bool pfMoneySuperLen = false;
                foreach (var detail in curInboundDetailList)
                {
                    if (detail.PfPrice == 0)
                    {
                        pfPriceEmpty = true;
                        break;
                    }
                    if (detail.PfPrice > 0 && detail.PfPrice > Convert.ToDecimal(99999999.99))
                    {
                        // SumPfMoney
                        pfPriceSuperLen = true;
                        break;
                    }
                    if (detail.SumPfMoney > 0 && detail.SumPfMoney > Convert.ToDecimal(99999999.99))
                    {
                        // SumPfMoney
                        pfMoneySuperLen = true;
                        break;
                    }
                }

                if (pfPriceSuperLen)
                {
                    GlobalMessageBox.Show("批发价不能大于99999999.99!");
                    return;
                }
                if (pfMoneySuperLen)
                {
                    GlobalMessageBox.Show("列表中批发每款商品总额不能大于99999999.99!");
                    return;
                }

                /*  if (pfPriceEmpty) {
                 *    GlobalMessageBox.Show("批发价不能为0,请重新输入!");
                 *    return;
                 * }*/

                PfInfo item = this.Build();
                if (item == null || item.PfOrder.TotalCount == 0 || item.PfOrderDetails.Count == 0)
                {
                    GlobalMessageBox.Show("发货单为空,不能发货!");
                    return;
                }
                //if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                //{
                //    return;
                //}

                //弹窗录入付款方式
                //int payType= ShowPayTypeForm(item);
                //if (payType == -1)
                //{
                //    return;
                //}

                item.PfOrder.PayMoney = numericTextBoxMoney.Value;
                item.PfOrder.PayType  = (byte)GetPayType();
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                InteractResult result;
                if (isHang)
                {
                    result = GlobalCache.ServerProxy.HangUpPfDelivery(item);
                }
                else
                {
                    result = GlobalCache.ServerProxy.PfDelivery(item);
                }
                switch (result.ExeResult)
                {
                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                default:
                    if (isHang)
                    {
                        GlobalMessageBox.Show("挂单成功!");
                    }
                    else
                    {
                        GlobalMessageBox.Show("发货成功!");

                        if (skinCheckBoxPrint.Checked)
                        {
                            //Column3.Visible = false;
                            //Column3.Tag = WholesaleDeliveryPrinter.PrinterNoCount;
                            //Column2.Visible = false;
                            //Column2.Tag = WholesaleDeliveryPrinter.PrinterNoCount;
                            //priceDataGridViewTextBoxColumn.Visible = false;
                            //priceDataGridViewTextBoxColumn.Tag = WholesaleDeliveryPrinter.PrinterNoCount;
                            //BoundDetailBrandIDDataGridViewTextBoxColumn.Visible = false;
                            //BoundDetailBrandIDDataGridViewTextBoxColumn.Tag = WholesaleDeliveryPrinter.PrinterNoCount;
                            DataGridView             dgv      = deepCopyDataGridView();
                            InteractResult <PfOrder> pfResult = GlobalCache.ServerProxy.GetOnePfOrder(item.PfOrder.ID);
                            decimal BalanceAllOld             = 0;
                            decimal BalanceAll = 0;
                            decimal totalPrice = 0;
                            if (pfResult.Data != null)
                            {
                                BalanceAllOld = pfResult.Data.PaymentBalanceOld;
                                BalanceAll    = pfResult.Data.PaymentBalance;
                                totalPrice    = pfResult.Data.TotalPfPrice;
                            }
                            item.PfOrder.PaymentBalanceOld = BalanceAllOld;
                            item.PfOrder.PaymentBalance    = BalanceAll;
                            item.PfOrder.TotalPfPrice      = totalPrice;
                            WholesaleDeliveryPrinter.Print(item.PfOrder, dgv, 2);
                            //Column3.Visible = true;
                            //Column2.Visible = true;
                            //priceDataGridViewTextBoxColumn.Visible = true;
                            //BoundDetailBrandIDDataGridViewTextBoxColumn.Visible = true;
                        }
                    }
                    //  UpdatePayType(payType,item);


                    ResetAll(true);
                    if (!IsShowOnePage)
                    {
                        TabPage_Close?.Invoke(this.CurrentTabPage, this.SourceCtrlType);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                GlobalUtil.ShowError(ex);
                GlobalMessageBox.Show("发货失败!");
            }
            finally
            {
                GlobalUtil.UnLockPage(this);
            }
        }