private void simpleButton1_Click(object sender, EventArgs e)
        {
            StockEditorChooseForm f = new StockEditorChooseForm();

            if (f.ShowDialog() == DialogResult.OK)
            {
                this._stockEditor = f.SelectedItem as Model.StockEditor;


                this.lookUpEditDepot.EditValue   = this._stockEditor.DepotId;
                this.lookUpEditProCate.EditValue = this._stockEditor.ProductCategoryId;
                this._stockCheck.StockEditorId   = this._stockEditor.StockEditorId;
                foreach (Model.StockEditorDetal editDetail in new BL.StockEditorDetalManager().SelectByStockEditorId(this._stockEditor.StockEditorId))
                {
                    Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                    detail.StockCheckDetailId     = Guid.NewGuid().ToString();
                    detail.Product                = editDetail.Product;
                    detail.ProductId              = editDetail.ProductId;
                    detail.ProductUnitName        = editDetail.ProductUnitName;
                    detail.StockCheck             = this._stockCheck;
                    detail.StockCheckId           = this._stockCheck.StockCheckId;
                    detail.StockCheckQuantity     = editDetail.StockEditorQuantity;
                    detail.StockCheckBookQuantity = this.stockManager.GetStockByProductIdAndDepotPositionId(editDetail.ProductId, editDetail.DepotPositionId) == null ? 0 : this.stockManager.GetStockByProductIdAndDepotPositionId(editDetail.ProductId, editDetail.DepotPositionId).StockQuantity1;
                    detail.DepotPosition          = editDetail.DepotPosition;
                    detail.DepotPositionId        = editDetail.DepotPositionId;
                    detail.Directions             = editDetail.Directions;
                    this._stockCheck.Details.Add(detail);
                    this.gridControl1.RefreshDataSource();
                }
            }
        }
Exemple #2
0
        private void lookUpEditProductCategory_EditValueChanged(object sender, EventArgs e)
        {
            _stockCheck.Details.Clear();
            if (this.lookUpEditProductCategory.EditValue != null)
            {
                category = this._productCategoryManager.Get(this.lookUpEditProductCategory.EditValue.ToString());
            }
            if (category != null)
            {
                foreach (Model.Product product in this._productManager.Select(category))
                {
                    Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                    detail.StockCheckDetailId = Guid.NewGuid().ToString();
                    detail.StockCheckId       = _stockCheck.StockCheckId;

                    detail.Product            = product;
                    detail.ProductId          = product.ProductId;
                    detail.DepotPosition      = product.DepotPosition;
                    detail.DepotPositionId    = product.DepotPositionId;
                    detail.StockCheckQuantity = null;
                    detail.ProductUnitName    = product.DepotUnit.ToString();
                    _stockCheck.Details.Add(detail);
                    //this.bindingSourceEmployee.Position = this.bindingSourceEmployee.IndexOf(detail);
                }
                this.gridControl1.RefreshDataSource();
            }
        }
Exemple #3
0
        //protected override DevExpress.XtraReports.UI.XtraReport GetReport()
        //{
        //    return new StockCheckReport(_stockCheck);
        //}

        protected override void AddNew()
        {
            _stockCheck = new Model.StockCheck();
            _stockCheck.StockCheckId   = this.stockCheckManager.GetNewId();
            _stockCheck.StockCheckDate = DateTime.Now;
            if (BL.V.ActiveOperator.Employee != null)
            {
                _stockCheck.Employee   = BL.V.ActiveOperator.Employee;
                _stockCheck.EmployeeId = _stockCheck.Employee.EmployeeId;
            }
            _stockCheck.Details = new List <Model.StockCheckDetail>();
            _stockCheck.ProductPositionNums.Clear();

            foreach (Model.Product product in this._productManager.GetProduct())
            {
                Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                detail.StockCheckDetailId = Guid.NewGuid().ToString();
                detail.StockCheckId       = _stockCheck.StockCheckId;
                detail.Product            = product;
                detail.ProductId          = product.ProductId;
                detail.DepotPosition      = product.DepotPosition;
                detail.DepotPositionId    = product.DepotPositionId;
                detail.Directions         = product.ProductDescription;
                detail.StockCheckQuantity = null;
                detail.ProductUnitName    = product.DepotUnit.CnName;
                _stockCheck.Details.Add(detail);
                //this.bindingSourceEmployee.Position = this.bindingSourceEmployee.IndexOf(detail);
            }
            dic.Clear();
            _stockCheck.ProductPositionNums = new List <Model.StockCheckDetail>();
        }
Exemple #4
0
        private void DepotPositionAndNums_Load(object sender, EventArgs e)
        {
            IList <Model.DepotPosition> list = depotPositionManager.Select(this._stockCheckDetail.Depot);

            if (list.Count == 0)
            {
                return;
            }
            foreach (Model.DepotPosition item in list)
            {
                Model.StockCheckDetail checkdetail = new Book.Model.StockCheckDetail();
                checkdetail.StockCheckId       = this._stockCheckDetail.StockCheckId;
                checkdetail.StockCheckDetailId = Guid.NewGuid().ToString();
                checkdetail.Depot              = this._stockCheckDetail.Depot;
                checkdetail.DepotId            = this._stockCheckDetail.DepotId;
                checkdetail.Product            = this._stockCheckDetail.Product;
                checkdetail.ProductId          = this._stockCheckDetail.ProductId;
                checkdetail.DepotPosition      = item;
                checkdetail.DepotPositionId    = item.DepotPositionId;
                checkdetail.StockCheckQuantity = null;
                checkdetail.ProductUnitName    = this._stockCheckDetail.Product.DepotUnit.CnName;

                if (EditForm.dic.ContainsKey(checkdetail.ProductId + checkdetail.DepotPositionId))
                {
                    Model.StockCheckDetail d = EditForm.dic[checkdetail.ProductId + checkdetail.DepotPositionId];
                    checkdetail.StockCheckQuantity = d.StockCheckQuantity;
                }
                //else
                //{
                //    Model.Stock tempstock = this._stockManager.GetStockByProductIdAndDepotPositionId(checkdetail.ProductId, checkdetail.DepotPositionId);
                //    if (tempstock != null)
                //    {
                //        if (tempstock.StockQuantity1 != null)
                //        {
                //            checkdetail.StockCheckQuantity = tempstock.StockQuantity1.Value;
                //            if (!EditForm.dic.ContainsKey(checkdetail.ProductId + checkdetail.DepotPositionId))
                //                EditForm.dic.Add(checkdetail.ProductId + checkdetail.DepotPositionId, checkdetail);
                //        }
                //    }
                else
                {
                    checkdetail.StockCheckQuantity = null;
                }
                //}

                this.stockCheckDetailList.Add(checkdetail);
            }

            this.bindingSourceStockCheckDetail.DataSource = this.stockCheckDetailList;
            this.gridControl1.RefreshDataSource();
        }
Exemple #5
0
        private void simpleButtonAppend_Click(object sender, EventArgs e)
        {
            ChooseProductForm f = new ChooseProductForm();

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();

                detail.StockCheckDetailId = Guid.NewGuid().ToString();
                detail.StockCheckId       = _stockCheck.StockCheckId;
                detail.StockCheck         = _stockCheck;
                detail.Product            = f.SelectedItem as Model.Product;
                detail.ProductId          = (f.SelectedItem as Model.Product).ProductId;
                detail.StockCheckQuantity = 1;
                detail.ProductUnitName    = (f.SelectedItem as Model.Product).DepotUnit == null ? null : (f.SelectedItem as Model.Product).DepotUnit.CnName;
                _stockCheck.Details.Add(detail);
                this.bindingSourceStockCheckDetail.Position = this.bindingSourceStockCheckDetail.IndexOf(detail);
                this.gridControl1.RefreshDataSource();
            }
        }
Exemple #6
0
        public override void Refresh()
        {
            if (_stockCheck == null)
            {
                _stockCheck = new Model.StockCheck();
                _stockCheck.StockCheckId   = this.stockCheckManager.GetNewId();
                _stockCheck.StockCheckDate = DateTime.Now;
                _stockCheck.Details        = new List <Model.StockCheckDetail>();
                _stockCheck.ProductPositionNums.Clear();

                foreach (Model.Product product in this._productManager.GetProduct())
                {
                    Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                    detail.StockCheckDetailId = Guid.NewGuid().ToString();
                    detail.StockCheckId       = _stockCheck.StockCheckId;
                    detail.Product            = product;
                    detail.ProductId          = product.ProductId;
                    detail.DepotPosition      = product.DepotPosition;
                    detail.DepotPositionId    = product.DepotPositionId;
                    detail.Directions         = product.ProductDescription;
                    detail.ProductUnitName    = product.DepotUnit.CnName;
                    _stockCheck.Details.Add(detail);
                    //this.bindingSourceEmployee.Position = this.bindingSourceEmployee.IndexOf(detail);
                }
                this.action = "insert";
            }
            else
            {
                if (this.lookUpEditProductCategory.EditValue != null)
                {
                    category = this._productCategoryManager.Get(this.lookUpEditProductCategory.EditValue.ToString());
                    _stockCheck.Details.Clear();
                    foreach (Model.Product product in this._productManager.Select(category))
                    {
                        Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                        detail.StockCheckDetailId = Guid.NewGuid().ToString();
                        detail.StockCheckId       = _stockCheck.StockCheckId;
                        detail.Product            = product;
                        detail.Product.Id         = product.Id;
                        detail.ProductId          = product.ProductId;
                        detail.DepotPosition      = product.DepotPosition;

                        detail.DepotPositionId = product.DepotPositionId;
                        detail.Directions      = product.ProductDescription;
                        object nums = this.stockCheckDetailManager.GetNumsByProductIdAndDepositionId(detail.DepotPositionId, product.ProductId);
                        if (nums != null)
                        {
                            detail.StockCheckQuantity = Convert.ToDouble(nums);
                        }
                        else
                        {
                            detail.StockCheckQuantity = null;
                        }
                        detail.DepotPositionId = product.DepotPositionId;
                        detail.ProductUnitName = product.DepotUnit.CnName;
                        _stockCheck.Details.Add(detail);
                        this.bindingSourceEmployee.Position = this.bindingSourceEmployee.IndexOf(detail);
                    }
                }
                else
                {
                    _stockCheck.Details.Clear();
                    foreach (Model.Product product in this._productManager.GetProduct())
                    {
                        Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                        detail.StockCheckDetailId = Guid.NewGuid().ToString();
                        detail.StockCheckId       = _stockCheck.StockCheckId;
                        detail.Product            = product;
                        detail.Product.Id         = product.Id;
                        detail.ProductId          = product.ProductId;
                        detail.DepotPosition      = product.DepotPosition;
                        detail.DepotPositionId    = product.DepotPositionId;
                        detail.Directions         = product.ProductDescription;
                        object nums = this.stockCheckDetailManager.GetNumsByProductIdAndDepositionId(detail.DepotPositionId, product.ProductId);
                        if (nums != null)
                        {
                            detail.StockCheckQuantity = Convert.ToDouble(nums);
                        }
                        else
                        {
                            detail.StockCheckQuantity = null;
                        }
                        detail.ProductUnitName = product.DepotUnit.CnName;
                        _stockCheck.Details.Add(detail);
                        this.bindingSourceEmployee.Position = this.bindingSourceEmployee.IndexOf(detail);
                    }
                }
            }
            this.textEditStockCheckId.Text                = _stockCheck.StockCheckId;
            this.textEditStockCheckId.EditValue           = _stockCheck.StockCheckId;
            this.dateEditStockCheckDate.EditValue         = _stockCheck.StockCheckDate;
            this.newChooseEmployee.EditValue              = _stockCheck.Employee;
            this.lookUpEditDepot.EditValue                = _stockCheck.Depot;
            this.textEditNote.EditValue                   = _stockCheck.Directions;
            this.bindingSourceStockCheckDetail.DataSource = _stockCheck.Details;

            this.newChooseContorlAuditEmp.EditValue = _stockCheck.AuditEmp;
            this.txt_AuditState.EditValue           = this.GetAuditName(_stockCheck.AuditState);

            base.Refresh();

            switch (this.action)
            {
            case "insert":
            case "update":
                this.gridControl1.Enabled = true;
                break;

            case "view":
                this.gridControl1.Enabled = false;
                break;
            }
        }