public void InitialRptForm(Guid Id)
        {
            #region 获取数据
            BLL.ApplyOrderManager manager = new BLL.ApplyOrderManager();
            System.Data.DataTable dt      = manager.GetTableOneById(Id);
            this.DataSource = dt;
            #endregion

            #region 订单信息
            labApplyday.Text       = dt.Rows[0]["Applyday"].ToString();
            labApplyDeparment.Text = dt.Rows[0]["ApplyDepartmentName"].ToString();
            labApplyNo.Text        = dt.Rows[0]["ApplyNo"].ToString();
            labApplyUser.Text      = dt.Rows[0]["ApplyUserName"].ToString();
            labDescription.Text    = dt.Rows[0]["ApplyDescription"].ToString();
            labOperator.Text       = dt.Rows[0]["OperatorName"].ToString();
            labPrintTime.Text      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            #endregion

            #region 订单明细
            txtBarcode.DataBindings.Add("Text", null, "Barcode");
            txtbuyday.DataBindings.Add("Text", null, "Buyday");
            txtCategory.DataBindings.Add("Text", null, "CategoryName");
            txtModel.DataBindings.Add("Text", null, "Model");
            txtName.DataBindings.Add("Text", null, "Name");
            txtPrice.DataBindings.Add("Text", null, "Price");
            txtStock.DataBindings.Add("Text", null, "StockName");

            #endregion
        }
        public void AddLyOrder()
        {
            Models.ys_ApplyOrder  lyModel           = new Models.ys_ApplyOrder();
            BLL.ApplyOrderManager applyOrderManager = new BLL.ApplyOrderManager();
            if (cbtlDepartment.EditValue != null || cbtlDepartment.EditValue != null)
            {
                lyModel.ApplyNo  = applyOrderManager.GetNewApplyNo();//生成订单号
                lyModel.Id       = Guid.NewGuid();
                lyModel.Location = cblocation.Text;

                lyModel.ApplyUserId   = Utils.cls.clsPublic.GetObjGUID(cbUser.EditValue);
                lyModel.ApplyUserName = cbUser.Text;

                if (cbtlDepartment.EditValue == null)
                {
                    lyModel.ApplyDepartmentId = Utils.cls.clsPublic.GetObjGUID(cbUser.Properties.View.GetFocusedRowCellValue("DepartmentId"));
                }
                else
                {
                    lyModel.ApplyDepartmentId = Utils.cls.clsPublic.GetObjGUID(cbtlDepartment.EditValue);
                }

                lyModel.OperatorId   = clsSession._UserId;
                lyModel.OperatorName = clsSession._FullName;
                lyModel.Description  = "登记时生成";
                lyModel.Applyday     = DateTime.Now;

                List <Models.ys_ApplyOrderDetail> details = new List <Models.ys_ApplyOrderDetail>();

                Models.ys_ApplyOrderDetail d = new Models.ys_ApplyOrderDetail();
                model         = assetsManager.GetOneById(model.Id);
                d.AssetsId    = model.Id;
                d.ApplyId     = lyModel.Id;
                d.OldStatusId = model.StatusId;
                details.Add(d);

                lyModel.Detail = details;
                //生成新的领用单
                if (applyOrderManager.AddNew(lyModel))
                {
                    clsPublic.ShowMessage("领用单生成成功!", Text);
                }
                else
                {
                    clsPublic.ShowMessage("领用单生成失败!", Text);
                }
            }
        }