Exemplo n.º 1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int n = dataGridView1.SelectedRows.Count;

            if (n == 0)
            {
                MessageDialog.ShowPromptMessage("请选择需要删除的数据行!");
                return;
            }

            if (BasicInfo.LoginName != dataGridView1.CurrentRow.Cells["录入人员"].Value.ToString())
            {
                MessageDialog.ShowPromptMessage("只有此单据编制人才可执行删除操作!");
            }

            string orderFormNumber    = dataGridView1.SelectedRows[0].Cells["订单号"].Value.ToString();
            View_B_OrderFormInfo info = m_orderFormServer.GetOrderFormInfo(orderFormNumber);

            if (BasicInfo.LoginName != info.录入人员)
            {
                MessageDialog.ShowPromptMessage(string.Format("您无法删除由 {0} 录入的信息!", info.录入人员));
                return;
            }

            if (MessageBox.Show("您是否确定要删除订单号为:" + txtOrderFormNumber.Text + "的信息?", "消息",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }

            if (m_orderFormServer.FindInDepotOrderGoodsCount(txtOrderFormNumber.Text.Trim()))
            {
                MessageDialog.ShowPromptMessage("请先删除该订单关联的入库单再做此操作!");
                return;
            }

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

            if (!m_orderFormServer.DeleteOrderFormInfo(BasicInfo.ListRoles, BasicInfo.LoginID,
                                                       txtOrderFormNumber.Text, out m_findOrderFormInfo, out m_err))
            {
                MessageDialog.ShowPromptMessage(m_err);
            }
            else
            {
                ClearControl();
                RefreshOrderFormDataGridView();
                PositioningRecord("订单信息", rowIndex);
                RefreshOrderFormControl();
            }

            txtOrderFormNumber.ReadOnly = true;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查找物品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFindCode_Click(object sender, EventArgs e)
        {
            try
            {
                ClearControl();

                FormQueryInfo        form             = QueryInfoDialog.GetOrderFormGoodsDialog(m_billInfo.OrderBill_ID, true);
                IOrderFormInfoServer serviceOrderForm = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();
                View_B_OrderFormInfo orderInfo        = serviceOrderForm.GetOrderFormInfo(m_billInfo.OrderBill_ID);
                if (form != null && form.ShowDialog() == DialogResult.OK)
                {
                    txtCode.Text = (string)form.GetDataItem("图号型号");
                    txtName.Text = (string)form.GetDataItem("物品名称");
                    txtSpec.Text = (string)form.GetDataItem("规格");

                    IBargainGoodsServer serviceGoodsInfo = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();
                    numUnitPrice.Value = serviceGoodsInfo.GetGoodsUnitPrice(m_billInfo.OrderBill_ID, Convert.ToInt32(form.GetDataItem("物品ID")), orderInfo.供货单位);

                    numGoodsAmount.Value = (decimal)form.GetDataItem("订货数量");

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

                    if (planCost != null)
                    {
                        cmbUnit.Text           = planCost.单位;
                        numPlanUnitPrice.Value = planCost.单价;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return;
            }
        }
        private void btnFindOrderForm_Click(object sender, EventArgs e)
        {
            FormQueryInfo form = QueryInfoDialog.GetOrderFormInfoDialog(CE_BillTypeEnum.样品确认申请单);

            if (DialogResult.OK == form.ShowDialog())
            {
                txtCode.Text      = "";
                txtName.Text      = "";
                txtSpec.Text      = "";
                txtVersion.Text   = "";
                txtOrderForm.Text = form.GetDataItem("订单号").ToString();
                txtProvider.Text  = form.GetDataItem("供货单位").ToString();

                View_B_OrderFormInfo lnqOrderForm = m_serverOrderFormInfo.GetOrderFormInfo(txtOrderForm.Text);

                View_B_BargainInfo lnqBargain = m_serverBargainInfo.GetBargainInfo(lnqOrderForm.合同号);

                chkIsOutsourcing.Checked = lnqBargain.是否委外合同;
            }
        }
Exemplo n.º 4
0
        private void btnAutoGenerate_Click(object sender, EventArgs e)
        {
            if (dataGridView1.Rows.Count > 0)
            {
                MessageDialog.ShowPromptMessage("请删除此清单中的所有物品后再进行此操作!");
                return;
            }

            IOrderFormGoodsServer orderFormGoodsServer    = ServerModuleFactory.GetServerModule <IOrderFormGoodsServer>();
            IQueryable <View_B_OrderFormGoods> goodsGroup = null;

            if (!orderFormGoodsServer.GetOrderFormGoods(
                    BasicInfo.ListRoles, BasicInfo.LoginID, m_billInfo.OrderBill_ID, out goodsGroup, out m_error))
            {
                MessageDialog.ShowErrorMessage(m_error);
                return;
            }

            S_OrdinaryInDepotBill lnqBill          = m_serverBill.GetBill(m_billNo);
            IOrderFormInfoServer  serviceOrderForm = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();
            View_B_OrderFormInfo  orderInfo        = serviceOrderForm.GetOrderFormInfo(m_billInfo.OrderBill_ID);

            foreach (var item in goodsGroup)
            {
                if (item.订货数量 == 0)
                {
                    continue;
                }

                S_OrdinaryInDepotGoodsBill goods    = new S_OrdinaryInDepotGoodsBill();
                View_F_GoodsPlanCost       planCost = GetBasicGoodsInfo(item.图号型号, item.物品名称, item.规格, 0);

                if (planCost == null)
                {
                    return;
                }

                goods.GoodsID         = planCost.序号;
                goods.Bill_ID         = m_billNo;
                goods.ProviderBatchNo = "";

                if (m_serverGoodsShelfLife.IsShelfLife(planCost.序号))
                {
                    goods.BatchNo = m_goodsServer.GetNewBatchNo();
                }
                else
                {
                    goods.BatchNo = "";
                }

                goods.Amount = item.订货数量;

                IBargainGoodsServer serviceBargainGoods = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();

                goods.UnitPrice     = serviceBargainGoods.GetGoodsUnitPrice(orderInfo.订单号, goods.GoodsID, orderInfo.供货单位);
                goods.Price         = decimal.Round(goods.UnitPrice * item.订货数量, (int)2);
                goods.AmountInWords = CalculateClass.GetTotalPrice(goods.Price);
                goods.Remark        = txtRemark.Text;

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

            btnRefresh_Click(sender, e);
        }