Exemple #1
0
        private void dgProductQueryResult_ExportAllDataSource(object sender, EventArgs e)
        {
            ProductQueryFacade facade = new ProductQueryFacade(this);
            var _vm = (ProductQueryExVM)this.DataContext;

            if (_vm != null && _vm.PMUserCondition <= 0)
            {
                setPMUserCondition(_vm);
            }
            ColumnSet columnSet = new ColumnSet(this.ucProductQueryResult.dgProductQueryResult);

            //SysNo GroupID ProductID ProductTitle
            columnSet.Insert(0, new ColumnData()
            {
                FieldName = "C3SysNo", Title = "三级类别"
            });
            columnSet.Insert(0, new ColumnData()
            {
                FieldName = "C2SysNo", Title = "二级类别"
            });
            columnSet.Insert(0, new ColumnData()
            {
                FieldName = "C1SysNo", Title = "一级类别"
            });
            if (columnSet["MerchantNameDisplay"] != null)
            {
                columnSet["MerchantNameDisplay"].FieldName = "MerchantName";
            }
            facade.ExportAllProductToExcel(_vm, new ColumnSet[] { columnSet });
        }
Exemple #2
0
        private void dgProductQueryResult_LoadingDataSource(object sender, LoadingDataEventArgs e)
        {
            ProductQueryFacade facade = new ProductQueryFacade(this);
            var _vm = (ProductQueryExVM)this.DataContext;

            if (_vm != null && _vm.PMUserCondition <= 0)
            {
                setPMUserCondition(_vm);
            }

            facade.QueryProductEx(_vm, e.PageSize, e.PageIndex, e.SortField, (obj, args) =>
            {
                var list = new List <dynamic>();
                foreach (var row in args.Result.Rows)
                {
                    list.Add(row);
                }
                this.ucProductQueryResult.dgProductQueryResult.ItemsSource = list;
                this.ucProductQueryResult.dgProductQueryResult.TotalCount  = args.Result.TotalCount;
            });
        }
Exemple #3
0
        /// <summary>
        /// 导出报关文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ExporterTariffApply_Click(object sender, RoutedEventArgs e)
        {
            if (!AuthMgr.HasFunctionPoint(AuthKeyConst.IM_ProductQuery_ExporterTariffApply))
            {
                CPApplication.Current.CurrentPage.Context.Window.Alert("你无此操作权限");
                return;
            }
            var viewList     = ucProductQueryResult.dgProductQueryResult.ItemsSource as List <dynamic>;
            var selectSource = viewList.Where(p => p.IsChecked).ToList();

            if (selectSource == null || selectSource.Count == 0)
            {
                Window.Alert(ResProductQuery.SelectMessageInfo, MessageType.Error);
                return;
            }
            var productSysnos = (from c in selectSource
                                 select
                                     (int) c.SysNo).ToList();
            ProductQueryFacade facade = new ProductQueryFacade(this);

            facade.ExportTariffApply(productSysnos);
        }
        protected void btnSave_Click(object sender, RoutedEventArgs e)
        {
            bool IsOk = true;

            if (null == this.CurrentWidnow)
            {
                return;
            }

            // UI Check
            if (!ValidationManager.Validate(this.basicInfo))
            {
                return;
            }

            // 已选择的批次
            this.selectedLst = new List <ProductBatchInfoVM>();
            if (this.IsNotLend_Return)
            {
                batches.ToList <ProductBatchInfoVM>().ForEach((p) =>
                {
                    if (p.Quantity != 0)
                    {
                        selectedLst.Add(p);
                    }
                });
            }
            else
            {
                batchVM.ToList <ProductBatchInfoVM>().ForEach((p) =>
                {
                    if (p.ReturnQuantity.HasValue && p.ReturnQuantity != 0)
                    {
                        selectedLst.Add(p);
                    }
                });
            }

            // 根据商品编号获取商品信息
            ProductQueryFacade facade = new ProductQueryFacade(CPApplication.Current.CurrentPage);
            PagingInfo         paging = new PagingInfo
            {
                PageIndex = 0,
                PageSize  = 1,
            };
            List <ProductVM> productLst = new List <ProductVM>();

            facade.QueryProduct(new ProductSimpleQueryVM {
                ProductSysNo = filterVM.ProductSysNo
            }, paging
                                , (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                productLst = DynamicConverter <ProductVM> .ConvertToVMList <List <ProductVM> >(args.Result.Rows);

                // 附加批次信息
                List <BatchInfoVM> batchList = EntityConverter <ProductBatchInfoVM, BatchInfoVM> .Convert(selectedLst);

                ProductVMAndBillInfo paramVM = new ProductVMAndBillInfo();
                paramVM.ProductVM            = productLst;

                if (paramVM.ProductVM.FirstOrDefault().IsHasBatch == 1)
                {
                    paramVM.ProductVM.FirstOrDefault().ProductBatchLst = batchList;
                    if (filterVM.ReturnDate.HasValue)
                    {
                        paramVM.ReturnDate = filterVM.ReturnDate;
                    }
                    // check batch info
                    IsOk = PreCheckHasBatch();
                }
                else if (paramVM.ProductVM.FirstOrDefault().IsHasBatch == 0)
                {
                    switch (this.PType)
                    {
                    case PageType.Lend:
                        paramVM.Quantity       = Convert.ToInt32(filterVM.LendNum);
                        paramVM.ReturnQuantity = Convert.ToInt32(filterVM.ReturnNum);
                        break;

                    case PageType.Adjust:
                        paramVM.Quantity = Convert.ToInt32(filterVM.AdjustNum);
                        break;

                    case PageType.Convert:
                        paramVM.Quantity = Convert.ToInt32(filterVM.ConvertNum);
                        break;
                    }
                    if (filterVM.ReturnDate.HasValue)
                    {
                        paramVM.ReturnDate = filterVM.ReturnDate;
                    }
                }

                if (!IsOk)
                {
                    return;
                }

                this.DialogHandler.ResultArgs.Data = paramVM;

                this.DialogHandler.ResultArgs.DialogResult = DialogResultType.OK;
                this.DialogHandler.Close();
            });
        }