Exemplo n.º 1
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);
            queryFilter           = new ProductBatchQueryFilter();
            serviceFacade         = new ProductBatchQueryFacade(this);
            BatchStatusDataSource = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("A", "正常"),
                new KeyValuePair <string, string>("R", "临期"),
                new KeyValuePair <string, string>("I", "过期"),
            };

            string getParam = this.Request.Param;

            if (!string.IsNullOrEmpty(getParam))
            {
                string[] strPrams = getParam.Split(new char[] { '&' });

                if (strPrams.Length == 2)
                {
                    this.ProductSysNo = Convert.ToInt32(strPrams[0]);
                    this.StockSysNo   = Convert.ToInt32(strPrams[1]);
                }
            }
            //this.DataContext = BatchStatusDataSource;
            this.dgBatchDetailQueryResult.Bind();
            //SelectionChanged
        }
Exemplo n.º 2
0
        void UCProductBatch_Loaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= new RoutedEventHandler(UCProductBatch_Loaded);

            batchExp.Visibility = this.IsBatch ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;

            filterVM = new ProductBatchRequestVM();
            query    = new ProductBatchQueryFilter();
            batches  = new List <ProductBatchInfoVM>();
            facade   = new ProductBatchQueryFacade(CPApplication.Current.CurrentPage);

            filterVM.HasBatch     = false;
            filterVM.IsCreateMode = this.IsCreateMode;
            filterVM.IsNotReturn  = this.IsNotLend_Return;
            //this.txtReturn.Visibility = System.Windows.Visibility.Collapsed;
            //this.lblReturn.Visibility = System.Windows.Visibility.Collapsed;
            //this.txtLendNum.Visibility = System.Windows.Visibility.Visible;
            //this.lblLendNum.Visibility = System.Windows.Visibility.Visible;


            if (StockSysNo.HasValue)
            {
                filterVM.StockSysNo = StockSysNo.Value;
            }
            if (ReturnDate.HasValue)
            {
                filterVM.ReturnDate = ReturnDate.Value;
            }
            if (this.ConverterCost.HasValue)
            {
                filterVM.ConvertCost = this.ConverterCost;
            }
            filterVM.IsCreateMode = IsCreateMode;
            filterVM.PType        = this.PType;

            if (!this.IsNotLend_Return)
            {
                this.batchdg.Columns[10].Visibility = System.Windows.Visibility.Visible;
                this.batchdg.Columns[9].IsReadOnly  = true;
                //this.txtReturn.Visibility = System.Windows.Visibility.Visible;
                //this.lblReturn.Visibility = System.Windows.Visibility.Visible;

                //this.txtLendNum.Visibility = System.Windows.Visibility.Collapsed;
                //this.lblLendNum.Visibility = System.Windows.Visibility.Collapsed;
            }

            if (this.PType == PageType.Lend)
            {
                this.batchdg.Columns[9].Header = "借出数量";
            }
            else
            {
                this.batchdg.Columns[9].Header = "数量";
            }

            // 修改Model
            if (!IsCreateMode)
            {
                if (!this.IsBatch)
                {
                    switch (this.PType)
                    {
                    case PageType.Lend:
                        this.filterVM.LendNum = this.OperationQuantity.ToString();
                        break;

                    case PageType.Adjust:
                        this.filterVM.AdjustNum = this.OperationQuantity.ToString();
                        break;

                    case PageType.Convert:
                        this.filterVM.ConvertNum = this.OperationQuantity.ToString();
                        break;

                    default:
                        break;
                    }
                }
                else
                {
                    this.filterVM.HasBatch = true;
                }

                filterVM.ProductSysNo = this.ProductSysNo;
                filterVM.ProductID    = this.ProductID;
                this.batchdg.Bind();
            }

            // Convert
            if (this.PType == PageType.Convert)
            {
                if (this.ConvertType == ConvertProductType.Source)
                {
                    this.filterVM.ConvertType = "源商品";
                }
                else if (this.ConvertType == ConvertProductType.Target)
                {
                    this.filterVM.ConvertType = "目标商品";
                }
            }

            this.basicInfo.DataContext = filterVM;
        }