Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 删除合同信息
        /// </summary>
        /// <param name="bargainNumber">合同编号</param>
        /// <param name="returnBargainInfo">返回查询到的合同信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool DeleteBargainInfo(string bargainNumber, out IQueryResult returnBargainInfo, out string error)
        {
            error             = null;
            returnBargainInfo = null;

            try
            {
                DepotManagementDataContext       dataContxt  = CommentParameter.DepotDataContext;
                IBargainGoodsServer              goodsServer = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();
                IQueryable <View_B_BargainGoods> returnBargainGoods;

                if (!goodsServer.GetBargainGoods(bargainNumber, out returnBargainGoods, out error))
                {
                    return(false);
                }

                #region 检查此合同的订单信息

                IOrderFormInfoServer orderFormServer = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();

                if (orderFormServer.GetOrderFormCollection(bargainNumber).Count() > 0)
                {
                    error = string.Format("合同 [{0}] 还包含有订单信息无法进行删除,请将所有此合同包含的订单信息全部删除后才能进行此操作!",
                                          bargainNumber);
                    return(false);
                }

                #endregion

                if (returnBargainGoods != null && returnBargainGoods.Count() > 0)
                {
                    error = string.Format("合同 [{0}] 还包含有零件信息无法进行删除,请将所有此合同包含的零件信息全部删除后才能进行此操作!",
                                          bargainNumber);
                    return(false);
                }

                Table <B_BargainInfo> table = dataContxt.GetTable <B_BargainInfo>();

                var delRow = from c in table
                             where c.BargainNumber == bargainNumber
                             select c;

                table.DeleteAllOnSubmit(delRow);
                dataContxt.SubmitChanges();

                return(GetAllBargainInfo(out returnBargainInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        private void btnFindOrderForm_Click(object sender, EventArgs e)
        {
            if (lblBillStatus.Text != OrdinaryInDepotBillStatus.新建单据.ToString())
            {
                return;
            }

            FormQueryInfo form = QueryInfoDialog.GetOrderFormInfoDialog(CE_BillTypeEnum.普通入库单);

            if (DialogResult.OK == form.ShowDialog())
            {
                txtOrderFormNumber.Text = form.GetDataItem("订单号").ToString();
                txtProvider.Text        = form.GetDataItem("供货单位").ToString();

                IOrderFormInfoServer orderFormServer = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();
                IBargainInfoServer   bargainServer   = ServerModuleFactory.GetServerModule <IBargainInfoServer>();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取订单信息对话框
        /// </summary>
        /// <param name="billType">单据类型</param>
        /// <returns>成功则返回获取到的对话框,失败返回null</returns>
        static public FormQueryInfo GetOrderFormInfoDialog(CE_BillTypeEnum billType)
        {
            DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

            IOrderFormInfoServer orderFormInfoServer = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();
            IQueryable <View_B_OrderFormInfo> queryResult;

            if (!orderFormInfoServer.GetAllOrderFormInfo(BasicInfo.ListRoles, BasicInfo.LoginID, billType, out queryResult, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return(null);
            }

            System.Data.DataTable dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_B_OrderFormInfo>(queryResult);
            FormQueryInfo         form      = new FormQueryInfo(dataTable);

            form.HideColumns = new string[] { "供应商联系人", "供应商联系电话", "供应商传真号", "供应商电子邮件", "权限控制用登录名", "录入人员" };
            return(form);
        }
        private void btnBenchCreate_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbBillType.Text.Trim().Length > 0)
                {
                    switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_InPutBusinessType>(cmbBillType.Text))
                    {
                    case CE_InPutBusinessType.生产采购:
                    case CE_InPutBusinessType.普通采购:
                    case CE_InPutBusinessType.委外采购:
                    case CE_InPutBusinessType.样品采购:

                        IQueryable <View_B_OrderFormInfo> findOrderFormInfo;
                        IOrderFormInfoServer orderFormServer = ServerModule.ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();

                        if (!orderFormServer.GetAllOrderFormInfo(BasicInfo.ListRoles, BasicInfo.LoginID, out findOrderFormInfo, out m_strError))
                        {
                            MessageDialog.ShowErrorMessage(m_strError);
                            return;
                        }

                        DataTable          dataSource = GlobalObject.GeneralFunction.ConvertToDataTable <View_B_OrderFormInfo>(findOrderFormInfo);
                        FormDataTableCheck frm        = new FormDataTableCheck(dataSource);

                        frm._BlDateTimeControlShow = false;

                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            List <string> listTemp = DataSetHelper.ColumnsToList_Distinct(frm._DtResult, "订单号");

                            m_listViewDetail = m_serviceRequistion.GetListViewDetail_OrderForm(txtBillNo.Text, listTemp);
                            RefreshDataGridView(m_listViewDetail);
                        }

                        foreach (DataGridViewRow dgvr in customDataGridView1.Rows)
                        {
                            ((DataGridViewTextBoxShowCell)dgvr.Cells["图号型号"]).m_EndSql =
                                " and 序号 in ( select GoodsID from B_OrderFormGoods where OrderFormNumber = '"
                                + dgvr.Cells["关联业务"].Value.ToString() + "')";
                            ((DataGridViewTextBoxShowCell)dgvr.Cells["批次号"]).ReadOnly = true;
                            ((DataGridViewTextBoxShowCell)dgvr.Cells["供应商"]).ReadOnly = true;
                        }

                        break;

                    default:
                        break;
                    }

                    cmbBillType.Enabled = customDataGridView1.Rows.Count > 0 ? false : true;
                }
                else
                {
                    MessageDialog.ShowPromptMessage("请选择【业务类型】");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 修改合同信息
        /// </summary>
        /// <param name="oldBargainNumber">旧合同号</param>
        /// <param name="bargainInfo">合同信息</param>
        /// <param name="returnBargainInfo">返回查询到的合同信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool UpdateBargainInfo(string oldBargainNumber, B_BargainInfo bargainInfo,
                                      out IQueryResult returnBargainInfo, out string error)
        {
            returnBargainInfo = null;
            error             = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.B_BargainInfo
                             where r.BargainNumber == oldBargainNumber
                             select r;

                if (result.Count() == 0)
                {
                    error = string.Format("找不到合同号为 [{0}] 的信息!", oldBargainNumber);
                    return(false);
                }

                B_BargainInfo       record      = result.Single();
                IBargainGoodsServer goodsServer = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();

                if (oldBargainNumber != bargainInfo.BargainNumber)
                {
                    IQueryable <View_B_BargainGoods> returnBargainGoods;

                    if (!goodsServer.GetBargainGoods(oldBargainNumber, out returnBargainGoods, out error))
                    {
                        return(false);
                    }

                    goodsServer.AutoSubmitToDatabase = false;

                    foreach (var item in returnBargainGoods)
                    {
                        if (!goodsServer.UpdateBargainNumber(dataContxt, item.序号, bargainInfo.BargainNumber, out error))
                        {
                            return(false);
                        }
                    }

                    #region 更新订单信息表中的合同编号

                    IOrderFormInfoServer orderFormServer = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();
                    orderFormServer.UpdateBargainNumber(dataContxt, oldBargainNumber, bargainInfo.BargainNumber);

                    #endregion

                    dataContxt.B_BargainInfo.DeleteOnSubmit(record);
                    record = new B_BargainInfo();
                }

                record.BargainNumber   = bargainInfo.BargainNumber;
                record.Provider        = bargainInfo.Provider;
                record.Buyer           = bargainInfo.Buyer;
                record.Cess            = bargainInfo.Cess;
                record.Date            = bargainInfo.Date;
                record.InputPerson     = bargainInfo.InputPerson;
                record.LaisonMode      = bargainInfo.LaisonMode;
                record.ProviderLinkman = bargainInfo.ProviderLinkman;
                record.IsOverseas      = bargainInfo.IsOverseas;
                record.IsConsignOut    = bargainInfo.IsConsignOut;
                record.Remark          = bargainInfo.Remark;
                record.AuditDate       = bargainInfo.AuditDate;

                if (oldBargainNumber != bargainInfo.BargainNumber)
                {
                    dataContxt.B_BargainInfo.InsertOnSubmit(record);
                }

                dataContxt.SubmitChanges();

                goodsServer.AutoSubmitToDatabase = true;

                return(GetAllBargainInfo(out returnBargainInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Ejemplo n.º 7
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);
        }