Ejemplo n.º 1
0
        /// <summary>
        /// 保存采购计划单
        /// </summary>
        /// <typeparam name="THead">采购计划头模板</typeparam>
        /// <typeparam name="TDetail">采购计划明细模板</typeparam>
        /// <param name="billHead">采购计划表头</param>
        /// <param name="billDetails">采购计划明细</param>
        public void SaveBill <THead, TDetail>(THead billHead, List <TDetail> billDetails)
        {
            MW_PlanHead          head    = billHead as MW_PlanHead;
            List <MW_PlanDetail> details = billDetails as List <MW_PlanDetail>;

            if (head.PlanHeadID == 0)
            {
                head.RegTime    = System.DateTime.Now;
                head.UpdateTime = System.DateTime.Now;
            }
            else
            {
                head.UpdateTime = System.DateTime.Now;
            }

            BindDb(head);
            head.save();
            if (head.PlanHeadID > 0)
            {
                foreach (MW_PlanDetail detail in details)
                {
                    detail.PlanHeadID = head.PlanHeadID;
                    BindDb(detail);
                    detail.save();
                }
            }
        }
Ejemplo n.º 2
0
        public void AuditBill(MW_PlanHead head)
        {
            head.AuditEmpID   = LoginUserInfo.EmpId;
            head.AuditEmpName = LoginUserInfo.EmpName;
            head.AuditFlag    = 1;
            head.AuditTime    = System.DateTime.Now;

            Action <ClientRequestData> requestAction = ((ClientRequestData request) =>
            {
                request.AddData(head);
            });

            ServiceResponseData retdata = InvokeWcfService("DrugProject.Service", "MaterialPurchaseController", "AuditBill", requestAction);
            bool result = retdata.GetData <bool>(0);

            if (result)
            {
                MessageBoxShowSimple("单据已经成功审核");
                //刷新采购计划单
                GetPlanHeadData();
            }
            else
            {
                string rtnMsg = retdata.GetData <string>(1);
                MessageBoxShowSimple("单据审核失败:" + rtnMsg);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 审核单据
        /// </summary>
        /// <param name="sender">控件</param>
        /// <param name="e">参数</param>
        private void btn_Check_Click(object sender, EventArgs e)
        {
            //校验
            if (dgHead.Rows.Count <= 0 || dgHead.CurrentRow == null)
            {
                MessageBox.Show("您没有选中一条采购计划单");
                return;
            }

            //判断是否是审核状态
            int auditStatus = Convert.ToInt32(dgHead.CurrentRow.Cells["AuditFlag"].Value);

            if (auditStatus == 1)
            {
                MessageBox.Show("您要审核的单据已经审核,不能再次审核");
                return;
            }

            if (MessageBox.Show(
                    "您确认要审核所选的单据吗?",
                    "提示",
                    MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Question,
                    MessageBoxDefaultButton.Button2) == DialogResult.OK)
            {
                int         rowIndex = dgHead.CurrentCell.RowIndex;
                DataTable   dt       = ((DataTable)(dgHead.DataSource));
                MW_PlanHead head     = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToObject <MW_PlanHead>(dt, rowIndex);
                InvokeController("AuditBill", head);
            }
        }
Ejemplo n.º 4
0
        public ServiceResponseData SaveBill()
        {
            string               busiType      = requestData.GetData <string>(0);
            IMwBill              iProcess      = NewObject <MwBillFactory>().GetBillProcess(busiType);
            MW_PlanHead          head          = requestData.GetData <MW_PlanHead>(1);
            List <MW_PlanDetail> details       = requestData.GetData <List <MW_PlanDetail> >(2);
            List <int>           deleteDetails = requestData.GetData <List <int> >(3);

            oleDb.BeginTransaction();
            try
            {
                foreach (int detailID in deleteDetails)
                {
                    NewObject <MW_PlanDetail>().delete(detailID);
                }

                iProcess.SaveBill(head, details);
                oleDb.CommitTransaction();
                responseData.AddData(true);
            }
            catch (Exception error)
            {
                oleDb.RollbackTransaction();
                responseData.AddData(false);
                responseData.AddData(error.Message);
            }

            return(responseData);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 取得采购计划头表信息
        /// </summary>
        /// <returns>采购计划表头实体</returns>
        public MW_PlanHead GetPlanHeadInfo()
        {
            int         currentIndex = dgHead.CurrentCell.RowIndex;
            DataTable   dt           = ((DataTable)(dgHead.DataSource));
            MW_PlanHead head         = EFWCoreLib.CoreFrame.Common.ConvertExtend.ToObject <MW_PlanHead>(dt, currentIndex);

            head.Remark = txtRemark.Text;
            return(head);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 删除采购计划
        /// </summary>
        /// <param name="billID">采购计划表头ID</param>
        public void DeleteBill(int billID)
        {
            MW_PlanHead head = (MW_PlanHead)NewObject <MW_PlanHead>().getmodel(billID);

            if (head.AuditFlag == 1)
            {
                throw new Exception("当前单据已经审核,无法删除");
            }
            else
            {
                //调用删除采购计划单方法
                bool rtn = NewDao <IMWDao>().DeleteMWPlanBill(billID);
                if (rtn == false)
                {
                    throw new Exception("删除采购计划单失败");
                }
            }
        }
Ejemplo n.º 7
0
        public ServiceResponseData AuditBill()
        {
            try
            {
                MW_PlanHead head = requestData.GetData <MW_PlanHead>(0);
                head.AuditTime = System.DateTime.Now;
                this.BindDb(head);
                head.save();
                responseData.AddData(true);
            }
            catch (Exception error)
            {
                responseData.AddData(false);
                responseData.AddData(error.Message);
            }

            return(responseData);
        }
Ejemplo n.º 8
0
        public void SaveBill()
        {
            Action <ClientRequestData> requestAction = null;
            ServiceResponseData        retdata       = null;
            MW_PlanHead currentHead = iFrmPurchase.GetPlanHeadInfo();

            currentHead.StockFee  = 0;
            currentHead.RetailFee = 0;
            DataTable            currentDetail = iFrmPurchase.GetPlanDetailInfo();
            List <MW_PlanDetail> lstDetails    = new List <MW_PlanDetail>();

            for (int index = 0; index < currentDetail.Rows.Count; index++)
            {
                MW_PlanDetail detail = ConvertExtend.ToObject <MW_PlanDetail>(currentDetail, index);
                currentHead.StockFee  += detail.StockFee;
                currentHead.RetailFee += detail.RetailFee;
                lstDetails.Add(detail);
            }

            requestAction = ((ClientRequestData request) =>
            {
                request.AddData(MWConstant.OP_MW_STOCKPLAN);
                request.AddData(currentHead);
                request.AddData <List <MW_PlanDetail> >(lstDetails);
                request.AddData <List <int> >(iFrmPurchase.GetDeleteDetails());
            });

            retdata = InvokeWcfService("DrugProject.Service", "MaterialPurchaseController", "SaveBill", requestAction);
            bool result = retdata.GetData <bool>(0);

            if (result)
            {
                MessageBoxShowSimple("采购计划单据保存成功,请及时审核...");
            }
            else
            {
                string rtnMsg = retdata.GetData <string>(1);
                MessageBoxShowSimple("单据保存失败:" + rtnMsg);
            }
        }
Ejemplo n.º 9
0
        public MW_PlanHead GetPlanHeadInfo()
        {
            MW_PlanHead editHead = iFrmPurchase.GetPlanHeadInfo();

            return(editHead);
        }