Ejemplo n.º 1
0
        //点击出库按钮
        private void Save(bool isHang)
        {
            try
            {
                if (skinComboBoxShopID.DataSource == null || (skinComboBoxShopID.DataSource as List <Shop>).Count == 0)
                {
                    GlobalMessageBox.Show("没有店铺可以调拨");
                    return;
                }

                /*  if (this.guideComboBox1.SelectedIndex == 0 && IsPos)
                 * {
                 *    GlobalMessageBox.Show("操作人不能为空!");
                 *    return;
                 * }*/
                bool isSuperLen = false;
                foreach (BoundDetail detail in this.curDetailList)
                {
                    if ((detail.Price > 0 && detail.Price > Convert.ToDecimal(99999999.99)) || (detail.SalePrice > 0 && detail.SalePrice > Convert.ToDecimal(99999999.99)) ||
                        (detail.SumMoney > 0 && detail.SumMoney > Convert.ToDecimal(99999999.99)))
                    {
                        isSuperLen = true;
                        break;
                    }
                }
                if (isSuperLen)
                {
                    GlobalMessageBox.Show("列表中吊牌价、售价或每款总金额不能大于99999999.99");
                    return;
                }
                AllocateOutboundPara item = this.Build();
                if (item == null || item.OutboundOrder.TotalCount == 0)
                {
                    GlobalMessageBox.Show("调拨单为空,不能出库!");
                    return;
                }

                if (action == OperationEnum.Send)
                {
                    item.ReplenishOrderID = order.ID;
                }
                else
                {
                    item.ReplenishOrderID = null;
                }

                if (GlobalMessageBox.Show("是否确认操作?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    return;
                }
                //检查库存信息

                if (CommonGlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                InteractResult result = null;
                if (isHang)
                {
                    result = CommonGlobalCache.ServerProxy.HangUpAllocateOrder(item);
                }
                else
                {
                    result = CommonGlobalCache.ServerProxy.AllocateOutbound(item);
                }


                switch (result.ExeResult)
                {
                case ExeResult.Success:
                    if (isHang)
                    {
                        GlobalMessageBox.Show("挂单成功!");
                    }
                    else
                    {
                        GlobalMessageBox.Show("调拨成功!");
                        //增加打印功能,先给后台使用
                        if (this.skinCheckBoxPrint.Checked)
                        {
                            //   AllocateOrderPrinter.ExcelTemplatePrint(item, curDetailList);
                            //Column2.Visible = false;
                            //SumMoney.Visible = false;
                            //Column2.Tag = AllocateOrderPrintUtil.PrinterNoCount;
                            //SumMoney.Tag = AllocateOrderPrintUtil.PrinterNoCount;
                            DataGridView dgv = deepCopyDataGridView();
                            AllocateOrderPrintUtil.Print(item.AllocateOrder, dgv);
                            //SumMoney.Visible = true;
                            //Column2.Visible = true;
                        }

                        //if (CommonGlobalCache.GetParameter(ParameterConfigKey.AllocateInDirectly)?.ParaValue == "1")
                        //{
                        //    if (InboundConfirmCtrl.AutoInbound(item.AllocateOrder))
                        //    {

                        //    }
                        //}
                    }
                    ResetAll(true);

                    if (!IsShowOnePage)
                    {
                        TabPageClose(this.CurrentTabPage, this.SourceCtrlType);
                    }
                    break;

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

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                CommonGlobalUtil.ShowError(ex);
            }
            finally
            {
                CommonGlobalUtil.UnLockPage(this);
            }
        }
Ejemplo n.º 2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
            {
                return;
            }
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }
            try
            {
                DataGridViewCell cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                String           name = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name;
                if (name == inboundDetail.Name)
                {
                    this.ClickInboundDetail(this.curAllocateOrderListSource[e.RowIndex]);
                }
                else if (name == outboundDetail.Name)
                {
                    this.ClickOutboundDetail(this.curAllocateOrderListSource[e.RowIndex]);
                }
                else if (operationColumn.Index == e.ColumnIndex)
                {
                    this.Inbound(this.curAllocateOrderListSource[e.RowIndex]);
                }
                else if (ColumnCancel.Index == e.ColumnIndex)
                {
                    this.Cancel(this.curAllocateOrderListSource[e.RowIndex]);
                }
                else if (ColumnRedo.Index == e.ColumnIndex)
                {
                    this.ReAllocate(this.curAllocateOrderListSource[e.RowIndex]);
                }
                else if (ColumnPick.Index == e.ColumnIndex)
                {
                    this.Pick(this.curAllocateOrderListSource[e.RowIndex]);
                }
                else if (ColumnPrint.Index == e.ColumnIndex)
                {
                    AllocateOrder      order = this.curAllocateOrderListSource[e.RowIndex];
                    List <BoundDetail> list  = CommonGlobalCache.ServerProxy.GetOutboundDetail(order.OutboundOrderID);
                    BindingReplenishDetailSource(list);
                    // SumMoney.Visible = false;
                    //  SumMoney.Tag = WholesaleDeliveryPrinter.PrinterNoCount;
                    DataGridView dgv = deepCopyDataGridView(list);
                    AllocateOrderPrintUtil.Print(order, dgv);
                    //  SumMoney.Visible = true;
                }
                else if (ColumnExcept.Index == e.ColumnIndex)
                {
                    AllocateOrder order = this.curAllocateOrderListSource[e.RowIndex];


                    path = CJBasic.Helpers.FileHelper.GetPathToSave("保存文件", "调拨单" + order.ID + new Date(DateTime.Now).ToDateInteger() + ".xls", Environment.GetFolderPath(Environment.SpecialFolder.Personal));
                    if (String.IsNullOrEmpty(path))
                    {
                        return;
                    }
                    Export(order);
                }
            }
            catch (Exception ee)
            {
                CommonGlobalUtil.ShowError(ee);
            }
        }
Ejemplo n.º 3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (!DataGridViewUtil.CheckPerrmisson(this, sender, e))
            {
                return;
            }
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }
            try
            {
                String name = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].OwningColumn.Name;
                if (name == inboundDetail.Name)
                {
                    this.ClickInboundDetail(this.curAllocateOrderListSource[e.RowIndex]);
                }
                else if (name == outboundDetail.Name)
                {
                    this.ClickOutboundDetail(this.curAllocateOrderListSource[e.RowIndex]);
                }
                else if (column_operation.Index == e.ColumnIndex)
                {
                    DataGridViewCell cell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                    if (cell.Value != null && !String.IsNullOrEmpty(cell.Value.ToString()))
                    {
                        switch (cell.Value)
                        {
                        case "收货":
                            this.Inbound(this.curAllocateOrderListSource[e.RowIndex]);

                            break;

                        case "冲单":
                            this.Cancel(this.curAllocateOrderListSource[e.RowIndex]);
                            break;

                        case "重做":
                            this.ReAllocate(this.curAllocateOrderListSource[e.RowIndex]);
                            break;

                        case "提单":
                            this.Pick(this.curAllocateOrderListSource[e.RowIndex]);
                            break;

                        default:
                            break;
                        }
                    }
                }
                else if (ColumnPrint.Index == e.ColumnIndex)
                {
                    AllocateOrder      order = this.curAllocateOrderListSource[e.RowIndex];
                    List <BoundDetail> list  = CommonGlobalCache.ServerProxy.GetOutboundDetail(order.OutboundOrderID);
                    this.BindingReplenishDetailSource(list);
                    //Column2.Visible = false;
                    //SumMoney.Visible = false;
                    //Column2.Tag = AllocateOrderPrintUtil.PrinterNoCount;
                    //SumMoney.Tag = AllocateOrderPrintUtil.PrinterNoCount;
                    DataGridView dgv = deepCopyDataGridView();
                    AllocateOrderPrintUtil.Print(order, dgv);
                    //SumMoney.Visible = true;
                    //Column2.Visible = true;
                }
            }
            catch (Exception ee)
            {
                CommonGlobalUtil.ShowError(ee);
            }
        }