Ejemplo n.º 1
0
        /// <summary>
        /// 刷新控件
        /// </summary>
        void RefreshControl()
        {
            ClearControl();

            if (dataGridView1.CurrentRow != null)
            {
                View_S_OrdinaryInDepotGoodsBill goods = GetGoodsInfo(dataGridView1.CurrentRow);

                txtCode.Text            = goods.图号型号;
                txtName.Text            = goods.物品名称;
                txtSpec.Text            = goods.规格;
                txtProviderBatchNo.Text = goods.供方批次号;
                txtProviderBatchNo.Tag  = goods.批次号;

                numGoodsAmount.Value = (decimal)goods.数量;

                lnklbSingleBill.Text   = goods.检验单号;
                numUnitPrice.Value     = goods.暂估单价;
                numPrice.Value         = goods.暂估金额;
                numPlanUnitPrice.Value = (decimal)goods.计划单价;
                txtTotalPrice.Text     = goods.大写金额;

                cmbUnit.Text   = goods.单位;
                txtShelf.Text  = goods.货架;
                txtColumn.Text = goods.列;
                txtLayer.Text  = goods.层;

                txtRemark.Text = goods.备注;
            }
        }
Ejemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                MessageDialog.ShowPromptMessage("请选择要修改的记录后再进行此操作");
                return;
            }
            else if (dataGridView1.SelectedRows.Count > 1)
            {
                MessageDialog.ShowPromptMessage("只能选择要修改的一条记录后再进行此操作");
                return;
            }

            if (!CheckDataItem())
            {
                return;
            }

            View_F_GoodsPlanCost planCost = GetBasicGoodsInfo(txtCode.Text, txtName.Text, txtSpec.Text, numUnitPrice.Value);

            if (planCost == null)
            {
                return;
            }

            S_OrdinaryInDepotGoodsBill      goods     = new S_OrdinaryInDepotGoodsBill();
            View_S_OrdinaryInDepotGoodsBill viewGoods = GetGoodsInfo(dataGridView1.SelectedRows[0]);

            goods.ID              = viewGoods.序号;
            goods.GoodsID         = planCost.序号;
            goods.ProviderBatchNo = txtProviderBatchNo.Text;
            goods.BatchNo         = txtProviderBatchNo.Tag.ToString();
            goods.Amount          = numGoodsAmount.Value;
            goods.UnitPrice       = numUnitPrice.Value;
            goods.Price           = Math.Round(numUnitPrice.Value * numGoodsAmount.Value, 2);
            goods.AmountInWords   = CalculateClass.GetTotalPrice(goods.Price);
            goods.TestingSingle   = lnklbSingleBill.Text;

            if (m_operateMode == CE_BusinessOperateMode.仓库核实)
            {
                goods.ShelfArea    = txtShelf.Text;
                goods.ColumnNumber = txtColumn.Text;
                goods.LayerNumber  = txtLayer.Text;
            }

            goods.Remark = txtRemark.Text;

            if (!m_goodsServer.UpdateGoods(goods, out m_queryResult, out m_error))
            {
                MessageDialog.ShowErrorMessage(m_error);
                return;
            }

            int rowIndex = dataGridView1.SelectedRows[0].Index;

            RefreshDataGridView(m_queryResult);

            PositioningRecord(rowIndex);
        }
Ejemplo n.º 3
0
        private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
        {
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                View_S_OrdinaryInDepotGoodsBill curGoods = GetGoodsInfo(dataGridView1.Rows[i]);

                if (i != dataGridView1.Rows.Count - 1)
                {
                    View_S_OrdinaryInDepotGoodsBill nextGoods = GetGoodsInfo(dataGridView1.Rows[i + 1]);

                    if (curGoods.图号型号 == nextGoods.图号型号 && curGoods.物品名称 == nextGoods.物品名称)
                    {
                        dataGridView1.Rows[i].DefaultCellStyle.ForeColor     = Color.Blue;
                        dataGridView1.Rows[i + 1].DefaultCellStyle.ForeColor = Color.Blue;
                    }
                }
            }
        }