Exemplo n.º 1
0
        //查看配送记录
        private void queryDeliveryOrder()
        {
            if (this.dgvMain.SelectedRows.Count <= 0)
            {
                return;
            }
            Business.Models.DeliveryModel dm = this.dgvMain.SelectedRows[0].DataBoundItem as Business.Models.DeliveryModel;
            Delivery         d        = this.PharmacyDatabaseService.GetDelivery(out msg, dm.ID);
            FormDeliveryEdit editForm = new FormDeliveryEdit(d, d.DeliveryStatusValue, false);

            editForm.ShowDialog(this);
        }
Exemplo n.º 2
0
        void dgvDelivery_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex < 0 || e.ColumnIndex < 0)
                {
                    return;
                }

                var currentData = this.dgvDelivery.Rows[e.RowIndex].DataBoundItem as Business.Models.DeliveryTrasactionModel;

                //打开出库单
                if (this.dgvDelivery.Columns[e.ColumnIndex].Name == this.Column1.Name)
                {
                    if (currentData.Status == 0)
                    {
                        FormOutInventory frm = new FormOutInventory(currentData.SalesOrderId, currentData.OutInvetoryId, true);
                        frm.ShowDialog();
                    }
                    if (currentData.Status == 1)
                    {
                        PurchaseCommonEntity pce = this.PharmacyDatabaseService.GetPurchaseOrderReturnsByPurchaseOrderId(out msg, currentData.SalesOrderId).FirstOrDefault();
                        if (pce == null)
                        {
                            return;
                        }
                        PurchaseBusiness.FormReturnOrder frm = new PurchaseBusiness.FormReturnOrder(pce, true);
                        frm.ShowDialog();
                    }
                }

                #region 打开销售客户或者供货商信息
                if (this.dgvDelivery.Columns[e.ColumnIndex].Name == this.Column2.Name)
                {
                    if (currentData.Status == 1)//打开采购退货商基础信息
                    {
                        SupplyUnit su = this.PharmacyDatabaseService.GetSupplyUnit(out msg, currentData.ReceivingCompasnyID);
                        UserControls.ucSupplyUnit us = new UserControls.ucSupplyUnit(su, false);
                        Form f = new Form();
                        f.Text         = su.Name;
                        f.AutoSize     = true;
                        f.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        Panel p = new Panel();
                        p.AutoSize = true;
                        p.Controls.Add(us);
                        f.Controls.Add(p);
                        f.ShowDialog();
                    }
                    if (currentData.Status == 0)//打开销售客户基础信息
                    {
                        PurchaseUnit pu = this.PharmacyDatabaseService.GetPurchaseUnit(out msg, currentData.ReceivingCompasnyID);
                        if (pu == null)
                        {
                            return;
                        }
                        UserControls.ucPurchaseUnit us = new UserControls.ucPurchaseUnit(pu, false);
                        Form f = new Form();
                        f.Text          = pu.Name;
                        f.AutoSize      = true;
                        f.AutoSizeMode  = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        f.StartPosition = FormStartPosition.CenterScreen;
                        Panel p = new Panel();
                        p.AutoSize = true;
                        p.Controls.Add(us);
                        f.Controls.Add(p);
                        f.ShowDialog();
                    }
                }
                #endregion

                //打开发货处理画面
                if (this.dgvDelivery.Columns[e.ColumnIndex].Name == this.发货处理.Name)
                {
                    Delivery         Item     = this.PharmacyDatabaseService.GetDelivery(out msg, currentData.Id);
                    FormDeliveryEdit editForm = new FormDeliveryEdit(Item, (int)this.deliveryStatus, false);
                    editForm.ShowDialog();
                    //刷新画面
                    if (editForm.DialogResult == System.Windows.Forms.DialogResult.OK)
                    {
                        pager_DataPaging();
                    }
                }
                //打开订单
                if (this.dgvDelivery.Columns[e.ColumnIndex].Name == this.订单号.Name)
                {
                    string message = string.Empty;
                    if (currentData.Status == 0)
                    {
                        var order = this.PharmacyDatabaseService.GetSalesOrder(out message, currentData.SalesOrderId);
                        FormSalesOrderEdit editForm = new FormSalesOrderEdit(order, false);
                        editForm.ShowDialog();
                    }
                    if (currentData.Status == 1)
                    {
                        PurchaseCommonEntity pce = this.PharmacyDatabaseService.GetPurchaseOrderReturnsByPurchaseOrderId(out msg, currentData.SalesOrderId).FirstOrDefault();
                        if (pce == null)
                        {
                            return;
                        }
                        Forms.PurchaseBusiness.FormReturnOrder frm = new Forms.PurchaseBusiness.FormReturnOrder(pce, false);
                        frm.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }