예제 #1
0
        public void stockCreateView_SearchStockInDetailEvent(object sender, StockCreateEventArgs e)
        {
            // Search StockInDetail
            var subCriteria = new SubObjectCriteria("StockIn");
            subCriteria.AddGreaterOrEqualsCriteria("StockInDate", DateUtility.ZeroTime(e.ImportDateFrom));
            subCriteria.AddLesserOrEqualsCriteria("StockInDate", DateUtility.MaxTime(e.ImportDateTo));
            subCriteria.AddEqCriteria("DelFlg", (long)0);

            var criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", (long)0);
            criteria.AddEqCriteria("StockInType", (Int64)e.StockInStatus);
            criteria.AddSubCriteria("StockIn", subCriteria);
            IList stockInDetailList = StockInDetailLogic.FindAll(criteria);
            e.StockInDetailList = stockInDetailList;

            // Search Stock
            if (stockInDetailList.Count > 0)
            {
                // build the Product id list
                IList productIdList = new ArrayList();
                foreach (StockInDetail stockInDetail in stockInDetailList)
                {
                    productIdList.Add(stockInDetail.Product.ProductId);
                }
                criteria = new ObjectCriteria();
                criteria.AddSearchInCriteria("Product.ProductId", productIdList);
                e.StockList = StockLogic.FindAll(criteria);

                criteria = new ObjectCriteria();
                criteria.AddSearchInCriteria("ProductId", productIdList);
                e.ReturnProductList = ReturnProductLogic.FindAll(criteria);
            }
        }
 public void _departmentStockOutView_LoadProductSizeEvent(object sender, DepartmentStockOutEventArgs e)
 {
     if (e.SelectedDepartmentStockOutDetail != null && e.SelectedDepartmentStockOutDetail.Product != null && !string.IsNullOrEmpty(e.SelectedDepartmentStockOutDetail.Product.ProductMaster.ProductName))
     {
         var subCriteria = new SubObjectCriteria("ProductMasters");
         subCriteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
         subCriteria.AddEqCriteria("ProductType", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.ProductType);
         subCriteria.AddEqCriteria("ProductName", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.ProductName);
         subCriteria.AddEqCriteria("ProductColor", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.ProductColor);
         subCriteria.AddEqCriteria("Country", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.Country);
         subCriteria.AddEqCriteria("Manufacturer", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.Manufacturer);
         subCriteria.AddEqCriteria("Distributor", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.Distributor);
         subCriteria.AddEqCriteria("Packager", e.SelectedDepartmentStockOutDetail.Product.ProductMaster.Packager);
         var criteria = new ObjectCriteria();
         criteria.AddSubCriteria("ProductMasters", subCriteria);
         IList productSizes = ProductSizeLogic.FindAll(criteria);
         e.ProductSizeList = productSizes;
     }
 }
예제 #3
0
        private void stockSearchView_BarcodeSearchStockEvent(object sender, StockSearchEventArgs e)
        {
            var subCriteria = new SubObjectCriteria("ProductMaster");
            subCriteria.AddLikeCriteria("ProductName", "%" + e.ProductMasterName + "%");
            subCriteria.AddEqCriteria("ProductType", e.ProductType);
            subCriteria.AddEqCriteria("ProductSize", e.ProductSize);
            subCriteria.AddEqCriteria("ProductColor", e.ProductColor);
            subCriteria.AddEqCriteria("Country", e.Country);
            subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer);
            subCriteria.AddEqCriteria("Packager", e.Packager);
            subCriteria.AddEqCriteria("Distributor", e.Distributor);

            var criteria = new ObjectCriteria(true);
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddLikeCriteria("Product.ProductId", e.ProductMasterId + "%");
            criteria.AddSubCriteria("ProductMaster", subCriteria);
            criteria.AddGreaterOrEqualsCriteria("CreateDate", DateUtility.ZeroTime(e.FromDate));
            criteria.AddLesserOrEqualsCriteria("CreateDate", DateUtility.MaxTime(e.ToDate));
            IList list = StockLogic.FindAll(criteria);
            e.StockList = list;
        }
        void departmentStockCheckingView_LoadProductNamesInTypeEvent(object sender, DepartmentStockCheckingEventArgs e)
        {
            SubObjectCriteria prdTypeCrit = new SubObjectCriteria("ProductType");
            prdTypeCrit.AddEqCriteria("TypeName",e.ScannedType.TypeName);

            ObjectCriteria criteria = new ObjectCriteria();
            criteria.AddSubCriteria("ProductType",prdTypeCrit);

            IList prdMasterList = ProductMasterLogic.FindAll(criteria);
            foreach (ProductMaster master in prdMasterList)
            {
                string productName = master.ProductName + "_" + master.ProductColor.ColorName + "_" +
                                     master.ProductSize.SizeName;
                if (!HasInList(e.ScannedType.UnscanProducts, productName))
                {
                    e.ScannedType.UnscanProducts.Add(productName);
                }
            }
        }
        public void departmentStockDetailView_SearchDepartmentPriceEvent(object sender, DepartmentPriceUpdateEventArgs e)
        {
            var subCriteria = new SubObjectCriteria("ProductMaster");
            subCriteria.AddLikeCriteria("ProductMasterId", e.ProductMasterId + "%");
            subCriteria.AddLikeCriteria("ProductName", e.ProductMasterName + "%");
            subCriteria.AddEqCriteria("ProductType", e.ProductType);
            subCriteria.AddEqCriteria("ProductSize",  e.ProductSize);
            subCriteria.AddEqCriteria("ProductColor", e.ProductColor);
            subCriteria.AddEqCriteria("Country", e.Country);
            subCriteria.AddEqCriteria("Packager", e.Packager);
            subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer);
            subCriteria.AddEqCriteria("Distributor", e.Distributor);

            var criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddSubCriteria("ProductMaster", subCriteria);
            criteria.AddEqCriteria("DepartmentPricePK.DepartmentId", CurrentDepartment.Get().DepartmentId);

            e.DepartmentPriceList = DepartmentPriceLogic.FindAll(criteria);
        }
예제 #6
0
        public void mainStockInView_FindByBarcodeEvent(object sender, MainStockInEventArgs e)
        {
            var subCriteria = new SubObjectCriteria("StockOut");
            subCriteria.AddEqCriteria("DefectStatus.DefectStatusId", (long)4); // tạm xuất là 4
            var objectCriteria = new ObjectCriteria();
            objectCriteria.AddEqCriteria("Product.ProductId", e.ProductId);
            objectCriteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            objectCriteria.AddEqCriteria("DefectStatus.DefectStatusId", (long) 4);
            //objectCriteria.AddSubCriteria("StockOut", subCriteria);
            IList list = StockOutDetailLogic.FindAll(objectCriteria);
            if (list!=null && list.Count > 0)
            {
                var detail = new StockInDetail { Product = ((StockOutDetail)list[0]).Product };
                foreach (StockOutDetail soDetail in list)
                {
                    detail.StockOutQuantity += soDetail.Quantity;
                }
                e.StockInDetail = detail;
            }

            IList reStockInList = StockInLogic.FindReStockIn(e.ProductId);
            if(reStockInList!=null)
            {
                foreach (StockInDetail inDetail in reStockInList)
                {
                    e.StockInDetail.ReStockQuantity += inDetail.Quantity;
                }
            }

            e.EventResult = "Success";
        }
        void _productMasterSearchOrCreateView_SearchRelevantProductsEvent(object sender, ProductMasterSearchOrCreateEventArgs e)
        {
            var subCriteria = new SubObjectCriteria("ProductMaster");
            subCriteria.AddEqCriteria("ProductName", e.ProductMasterName);

            var criteria = new ObjectCriteria(true);
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddSubCriteria("ProductMaster", subCriteria);
            IList list = ProductLogic.FindAll(criteria);
            e.ProductList = list;
        }
        public void departmentStockDetailView_SearchDepartmentPriceEvent(object sender, DepartmentPriceUpdateEventArgs e)
        {
            var subCriteria = new SubObjectCriteria("ProductMaster");
            subCriteria.AddLikeCriteria("ProductMasterId", "%" + e.ProductMasterId + "%");
            if(e.AbsoluteFinding)
            {
                subCriteria.AddEqCriteria("ProductName", e.ProductMasterName);
            }
            else
            {
                subCriteria.AddLikeCriteria("ProductName", "%" + e.ProductMasterName + "%");
            }
            if(e.ProductType!=null)
            {
                subCriteria.AddEqCriteria("ProductType", e.ProductType);
            }

            if (e.ProductSize != null)
            {
                subCriteria.AddEqCriteria("ProductSize", e.ProductSize);
            }

            if (e.ProductColor != null)
            {
                subCriteria.AddEqCriteria("ProductColor", e.ProductColor);
            }

            if (e.Country != null)
            {
                subCriteria.AddEqCriteria("Country", e.Country);
            }

            if (e.Packager != null)
            {
                subCriteria.AddEqCriteria("Packager", e.Packager);
            }

            if (e.Manufacturer != null)
            {
                subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer);
            }

            if (e.Distributor != null)
            {
                subCriteria.AddEqCriteria("Distributor", e.Distributor);
            }

            subCriteria.AddOrder("ProductName",false);
            subCriteria.AddOrder("ProductColor", false);
            subCriteria.AddOrder("ProductSize", false);
            var criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            if(e.ZeroPrice)
            {
                criteria.AddEqCriteria("Price", (long) 0);
            }
            if(e.ZeroWholeSalePrice)
            {
                criteria.AddEqCriteria("WholeSalePrice", (long) 0);
            }
            criteria.AddSubCriteria("ProductMaster", subCriteria);
            /*criteria.AddEqCriteria("DepartmentPricePK.DepartmentId", 0);*/

            e.DepartmentPriceList = DepartmentPriceLogic.FindAll(criteria);
        }
예제 #9
0
        private void stockSearchView_BarcodeSearchStockEvent(object sender, StockSearchEventArgs e)
        {
            var subCriteria = new SubObjectCriteria("ProductMaster");
            if(!string.IsNullOrEmpty(e.ProductMasterId))
            {
                subCriteria.AddLikeCriteria("ProductMasterId", "%" + e.ProductMasterId + "%");
            }
            if(!string.IsNullOrEmpty(e.ProductMasterName))
            {
                subCriteria.AddLikeCriteria("ProductName", "%" + e.ProductMasterName + "%");
            }
            if (e.ProductType != null)
            {
                subCriteria.AddEqCriteria("ProductType", e.ProductType);
            }
            if (e.ProductSize != null)
            {
                subCriteria.AddEqCriteria("ProductSize", e.ProductSize);
            }
            if (e.ProductColor != null)
            {
                subCriteria.AddEqCriteria("ProductColor", e.ProductColor);
            }
            if (e.Country != null)
            {
                subCriteria.AddEqCriteria("Country", e.Country);
            }
            if(e.Manufacturer!=null)
            {
                subCriteria.AddEqCriteria("Manufacturer", e.Manufacturer);
            }
            if(e.Packager!=null)
            {
                subCriteria.AddEqCriteria("Packager", e.Packager);
            }
            if (e.Distributor != null)
            {
                subCriteria.AddEqCriteria("Distributor", e.Distributor);
            }
            if (!string.IsNullOrEmpty(e.Description))
            {
                subCriteria.AddLikeCriteria("Description", "%" + e.Description + "%");
            }

            var criteria = new ObjectCriteria(true);
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            bool searchByProductId = !string.IsNullOrEmpty(e.ProductId);
            if(searchByProductId)
            {
                criteria.AddLikeCriteria("Product.ProductId", "%" + e.ProductId + "%");
            }

            criteria.AddSubCriteria("ProductMaster", subCriteria);
            criteria.AddOrder("ProductMaster.ProductName", true);
            criteria.AddOrder("Product.ProductId",true);
            IList list = StockLogic.FindAll(criteria);
            if(searchByProductId && e.RelevantProductFinding)
            {
                if(list!=null && list.Count > 0)
                {
                    IList extraList = new ArrayList();
                    foreach (Stock stock in list)
                    {
                        Product product = stock.Product;
                        subCriteria = new SubObjectCriteria("ProductMaster");
                        subCriteria.AddEqCriteria("ProductName", product.ProductMaster.ProductName);
                        criteria = new ObjectCriteria(true);
                        criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
                        criteria.AddSubCriteria("ProductMaster", subCriteria);
                        criteria.AddOrder("Product.ProductId", true);
                        IList subList = StockLogic.FindAll(criteria);
                        if(subList!=null && subList.Count > 0 )
                        {
                            foreach (Stock stock1 in subList)
                            {
                                AddStockToList(extraList, stock1);
                            }
                        }
                    }
                    // add to original list
                    foreach (Stock stock in extraList)
                    {
                        AddStockToList(list,stock);
                    }
                }
            }
            e.StockList = list;
        }
        public void stockSearchView_SearchStockEvent(object sender, DepartmentStockSearchEventArgs e)
        {
            var criteria = new SubObjectCriteria("ProductMaster");
            if (!string.IsNullOrEmpty(e.ProductMasterId))
            {
                criteria.AddLikeCriteria("ProductMasterId", "%" + e.ProductMasterId + "%");
            }
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            criteria.AddLikeCriteria("ProductName", "%" +e.ProductMasterName + "%");
            if (e.ProductType != null && e.ProductType.TypeId > 0)
            {
                criteria.AddEqCriteria("ProductType.TypeId", e.ProductType.TypeId);
            }
            if (e.ProductSize != null && e.ProductSize.SizeId > 0)
            {
                criteria.AddEqCriteria("ProductSize.SizeId", e.ProductSize.SizeId);
            }
            if (e.ProductColor != null && e.ProductColor.ColorId > 0)
            {
                criteria.AddEqCriteria("ProductColor.ColorId", e.ProductColor.ColorId);
            }
            if (e.Country != null && e.Country.CountryId > 0)
            {
                criteria.AddEqCriteria("Country.CountryId", e.Country.CountryId);
            }
            if (!string.IsNullOrEmpty(e.Description))
            {
                criteria.AddLikeCriteria("Description", "%" + e.Description +"%");
            }
            criteria.AddOrder("ProductName",true);

            var objectCriteria = new ObjectCriteria(true);
            objectCriteria.AddEqCriteria("DelFlg", (long)0);
            if (!string.IsNullOrEmpty(e.ProductId))
            {
                objectCriteria.AddLikeCriteria("DepartmentStockPK.ProductId", "%" + e.ProductMasterId + "%");
            }
            objectCriteria.AddEqCriteria("DepartmentStockPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
            objectCriteria.AddSubCriteria("ProductMaster",criteria);

            IList departmentStocks = DepartmentStockLogic.FindAll(objectCriteria);
            IList stockViewList = new ArrayList();
            // create stock view
            if (departmentStocks != null && departmentStocks.Count > 0)
            {
                DepartmentStockView stockView = null;
                foreach (DepartmentStock departmentStock in departmentStocks)
                {
                    if (stockView!=null)
                    {
                       if(!stockView.ProductMaster.ProductName.Equals(
                           departmentStock.Product.ProductMaster.ProductName))
                       {
                           stockViewList.Add(stockView);
                           stockView = null;
                       }
                    }
                    if(stockView == null)
                    {
                        stockView = new DepartmentStockView();
                        stockView.ProductMaster = departmentStock.Product.ProductMaster;
                        stockView.DepartmentStocks = new ArrayList();
                    }

                    stockView.DepartmentStocks.Add(departmentStock);
                    stockView.Quantity += departmentStock.Quantity;
                    stockView.GoodQuantity += departmentStock.GoodQuantity;

                }
                // add last item
                if(stockView!=null)
                {
                    stockViewList.Add(stockView);
                    stockView = null;
                }
                e.DepartmentStockList = stockViewList;
            }
        }