Example #1
0
        private void AddToolsPanel(HLayoutPanel toobar)
        {
            toobar.Add(new SimpleLabel("选择存货"));
            var goodsSelect = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货)
            {
                Width                = Unit.Pixel(120),
                AutoPostBack         = true,
                EnableMultiSelection = true,
                EnableInputArgument  = true
            };

            toobar.Add(goodsSelect);
            goodsSelect.SelectedValueChanged += (sender, e) => {
                _detailGrid.GetFromUI();
                foreach (var sGoodsID in goodsSelect.GetValues())
                {
                    var goods  = GoodsBL.Instance.Load(Convert.ToInt64(sGoodsID));
                    var detail = new PackingRecipients_Detail();
                    detail.Goods_ID = goods.ID;
                    DmoUtil.RefreshDependency(detail, "Goods_ID");
                    Dmo.Details.Add(detail);
                }
                goodsSelect.DisplayValue = string.Empty;
                _detailGrid.DataBind();
            };

//      var quickSelctButton = new DialogButton { Url = "~/B3UnitedInfos/Dialogs/QucicklySelectGoodsDetailsDialog.aspx", Text = "快速选择" };
//      quickSelctButton.Click += delegate {
//        ReceiveSelectedGoodsDetailDialog();
//      };
//      toobar.Add(quickSelctButton);
        }
Example #2
0
        private void AddToolsPanel(HLayoutPanel toobar)
        {
            toobar.Add(new SimpleLabel("选择存货"));
            var goodsSelect = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货)
            {
                Width                = Unit.Pixel(120),
                AutoPostBack         = true,
                EnableMultiSelection = true,
                EnableInputArgument  = true
            };

            toobar.Add(goodsSelect);
            goodsSelect.SelectedValueChanged += (sender, e) =>
            {
                _detailGrid.GetFromUI();
                foreach (var sGoodsID in goodsSelect.GetValues())
                {
                    var goodsid = Convert.ToInt64(sGoodsID);
                    if (Dmo.Details.Any(x => x.Goods_ID == goodsid))
                    {
                        continue;
                    }
                    var detail = new PackingBagType_Detail();
                    detail.Goods_ID = goodsid;
                    DmoUtil.RefreshDependency(detail, "Goods_ID");
                    Dmo.Details.Add(detail);
                }
                goodsSelect.DisplayValue = string.Empty;
                _detailGrid.DataBind();
            };
        }
Example #3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     this.Focus();
     ChoiceBox.Focus();
     AutoVsFullItem.Focus();
     ChoiceBox.SelectedIndex = 0;
 }
Example #4
0
        private void AddUpdatePanel(VLayoutPanel vPanel)
        {
            var hPanel = vPanel.Add(new HLayoutPanel());

            hPanel.Add(new SimpleLabel("会计单位"));
            _accountingUnit = hPanel.Add(new ChoiceBox(B3FrameworksConsts.DataSources.授权会计单位)
            {
                Width = Unit.Pixel(130), EnableInputArgument = true
            });
            hPanel.Add(new SimpleLabel("仓库"));
            _store = hPanel.Add(new ChoiceBox(B3FrameworksConsts.DataSources.授权仓库)
            {
                Width = Unit.Pixel(130), EnableInputArgument = true
            });
            hPanel.Add(new TSButton("指定存货仓库", delegate { UpdateOrInsert(); }));
        }
Example #5
0
 protected override void AddQueryControls(VLayoutPanel vPanel)
 {
     vPanel.Add(CreateDefaultBillQueryControls((panel, config) =>
     {
         panel.Add("ProductPlan_ID", new SimpleLabel("生产计划号"), planNumberBox = new ChoiceBox(B3ButcheryDataSource.计划号)
         {
             EnableMultiSelection = true, EnableInputArgument = true, Width = Unit.Pixel(160), EnableTopItem = true
         });
         config.AddAfter("AccountingUnit_ID", "ID");
         config.AddAfter("Department_ID", "AccountingUnit_ID");
         config.AddAfter("Employee_ID", "Department_ID");
         config.AddAfter("Store_ID", "Employee_ID");
         config.AddAfter("InStoreType_ID", "Store_ID");
         config.AddAfter("InStoreDate", "InStoreType_ID");
         config.AddAfter("CheckEmployee_ID", "InStoreDate");
         config.AddAfter("CheckDate", "CheckEmployee_ID");
         config.AddAfter("ProductPlan_ID", "CheckDate");
         AddQuery(config);
     }));
 }
Example #6
0
        public static ChoiceResult ShowChoiceDialog(
            string keyTitle, string keyText,
            string keyTextBtnLeft = null, string keyTextBtnRight = null)
        {
            ChoiceResult result = ChoiceResult.BtnCancel;

            App.Current.Dispatcher.Invoke(() =>
            {
                result = new ChoiceBox()
                {
                    Owner = App.Current.MainWindow.IsActive ? App.Current.MainWindow : null,
                    Data  = new ChoiceBoxData()
                    {
                        KeyTitle    = keyTitle,
                        KeyText     = keyText,
                        KeyBtnLeft  = keyTextBtnLeft,
                        KeyBtnRight = keyTextBtnRight,
                    }
                }.ShowDialog();
            });
            return(result);
        }
Example #7
0
    void OpenSelfChoices(List <Choice> choiceList)
    {
        base.Open();
        choices.SetActive(true);
        foreach (Choice choice in choiceList)
        {
            ChoiceBox box = Instantiate(
                choiceTemplate,
                Vector3.zero,
                Quaternion.identity,
                choices.transform
                ).GetComponent <ChoiceBox>();

            box.Populate(choice);
        }
        // select first choice
        Button b = choices.transform.GetChild(0).GetComponent <Button>();

        b.Select();
        // then highlight it (??????)
        b.OnSelect(null);
    }
    // Start is called before the first frame update
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        choicesList   = new List <TextMeshProUGUI>();
        functionsList = new List <Func <string, int> >();

        AddItem("If you see this", null);
        AddItem("There is an error", null);

        if (choicesList.Count > 0)
        {
            SetHovered(choicesList[indexHovered]);
        }

        gameObject.SetActive(false);
    }
        //-------------------------------------------------------------------------
        public override void start(Stage primaryStage)
        {
            LocalDate today = LocalDate.now(ZoneId.systemDefault());

            // setup GUI elements
            Label      startLbl = new Label("Start date:");
            DatePicker startInp = new DatePicker(today);

            startLbl.LabelFor        = startInp;
            startInp.ShowWeekNumbers = false;

            Label      endLbl = new Label("End date:");
            DatePicker endInp = new DatePicker(today.plusYears(1));

            endLbl.LabelFor        = endInp;
            endInp.ShowWeekNumbers = false;

            Label freqLbl = new Label("Frequency:");
            ChoiceBox <Frequency> freqInp = new ChoiceBox <Frequency>(FXCollections.observableArrayList(Frequency.P1M, Frequency.P2M, Frequency.P3M, Frequency.P4M, Frequency.P6M, Frequency.P12M));

            freqLbl.LabelFor = freqInp;
            freqInp.Value    = Frequency.P3M;

            Label stubLbl = new Label("Stub:");
            ObservableList <StubConvention> stubOptions = FXCollections.observableArrayList(StubConvention.values());

            stubOptions.add(0, null);
            ChoiceBox <StubConvention> stubInp = new ChoiceBox <StubConvention>(stubOptions);

            stubLbl.LabelFor = stubInp;
            stubInp.Value    = StubConvention.SMART_INITIAL;

            Label rollLbl = new Label("Roll:");
            ChoiceBox <RollConvention> rollInp = new ChoiceBox <RollConvention>(FXCollections.observableArrayList(null, RollConventions.NONE, RollConventions.EOM, RollConventions.IMM, RollConventions.IMMAUD, RollConventions.IMMNZD, RollConventions.SFE));

            rollLbl.LabelFor = rollInp;
            rollInp.Value    = RollConventions.NONE;

            Label bdcLbl = new Label("Adjust:");
            ChoiceBox <BusinessDayConvention> bdcInp = new ChoiceBox <BusinessDayConvention>(FXCollections.observableArrayList(BusinessDayConventions.NO_ADJUST, BusinessDayConventions.FOLLOWING, BusinessDayConventions.MODIFIED_FOLLOWING, BusinessDayConventions.PRECEDING, BusinessDayConventions.MODIFIED_PRECEDING, BusinessDayConventions.MODIFIED_FOLLOWING_BI_MONTHLY, BusinessDayConventions.NEAREST));

            bdcLbl.LabelFor = bdcInp;
            bdcInp.Value    = BusinessDayConventions.MODIFIED_FOLLOWING;

            Label holidayLbl = new Label("Holidays:");
            ChoiceBox <HolidayCalendarId> holidayInp = new ChoiceBox <HolidayCalendarId>(FXCollections.observableArrayList(HolidayCalendarIds.CHZU, HolidayCalendarIds.GBLO, HolidayCalendarIds.EUTA, HolidayCalendarIds.FRPA, HolidayCalendarIds.JPTO, HolidayCalendarIds.NYFD, HolidayCalendarIds.NYSE, HolidayCalendarIds.USNY, HolidayCalendarIds.USGS, HolidayCalendarIds.NO_HOLIDAYS, HolidayCalendarIds.SAT_SUN));

            holidayLbl.LabelFor = holidayInp;
            holidayInp.Value    = HolidayCalendarIds.GBLO;

            TableView <SchedulePeriod> resultGrid = new TableView <SchedulePeriod>();
            TableColumn <SchedulePeriod, LocalDate> unadjustedCol = new TableColumn <SchedulePeriod, LocalDate>("Unadjusted dates");
            TableColumn <SchedulePeriod, LocalDate> adjustedCol   = new TableColumn <SchedulePeriod, LocalDate>("Adjusted dates");

            TableColumn <SchedulePeriod, LocalDate> resultUnadjStartCol = new TableColumn <SchedulePeriod, LocalDate>("Start");

            resultUnadjStartCol.CellValueFactory = new TableCallback <>(SchedulePeriod.meta().unadjustedStartDate());
            TableColumn <SchedulePeriod, LocalDate> resultUnadjEndCol = new TableColumn <SchedulePeriod, LocalDate>("End");

            resultUnadjEndCol.CellValueFactory = new TableCallback <>(SchedulePeriod.meta().unadjustedEndDate());
            TableColumn <SchedulePeriod, Period> resultUnadjLenCol = new TableColumn <SchedulePeriod, Period>("Length");

            resultUnadjLenCol.CellValueFactory = ReadOnlyCallback.of(sch => Period.between(sch.UnadjustedStartDate, sch.UnadjustedEndDate));

            TableColumn <SchedulePeriod, LocalDate> resultStartCol = new TableColumn <SchedulePeriod, LocalDate>("Start");

            resultStartCol.CellValueFactory = new TableCallback <>(SchedulePeriod.meta().startDate());
            TableColumn <SchedulePeriod, LocalDate> resultEndCol = new TableColumn <SchedulePeriod, LocalDate>("End");

            resultEndCol.CellValueFactory = new TableCallback <>(SchedulePeriod.meta().endDate());
            TableColumn <SchedulePeriod, Period> resultLenCol = new TableColumn <SchedulePeriod, Period>("Length");

            resultLenCol.CellValueFactory = ReadOnlyCallback.of(sch => sch.length());

            unadjustedCol.Columns.add(resultUnadjStartCol);
            unadjustedCol.Columns.add(resultUnadjEndCol);
            unadjustedCol.Columns.add(resultUnadjLenCol);
            adjustedCol.Columns.add(resultStartCol);
            adjustedCol.Columns.add(resultEndCol);
            adjustedCol.Columns.add(resultLenCol);
            resultGrid.Columns.add(unadjustedCol);
            resultGrid.Columns.add(adjustedCol);
            resultGrid.Placeholder = new Label("Schedule not yet generated");

            unadjustedCol.prefWidthProperty().bind(resultGrid.widthProperty().divide(2));
            adjustedCol.prefWidthProperty().bind(resultGrid.widthProperty().divide(2));
            resultUnadjStartCol.prefWidthProperty().bind(unadjustedCol.widthProperty().divide(3));
            resultUnadjEndCol.prefWidthProperty().bind(unadjustedCol.widthProperty().divide(3));
            resultUnadjLenCol.prefWidthProperty().bind(unadjustedCol.widthProperty().divide(3));
            resultStartCol.prefWidthProperty().bind(adjustedCol.widthProperty().divide(3));
            resultEndCol.prefWidthProperty().bind(adjustedCol.widthProperty().divide(3));
            resultLenCol.prefWidthProperty().bind(adjustedCol.widthProperty().divide(3));

            // setup generation button
            // this uses the GUI thread which is not the best idea
            Button btn = new Button();

            btn.Text     = "Generate";
            btn.OnAction = @event =>
            {
                LocalDate             start  = startInp.Value;
                LocalDate             end    = endInp.Value;
                Frequency             freq   = freqInp.Value;
                StubConvention        stub   = stubInp.Value;
                RollConvention        roll   = rollInp.Value;
                HolidayCalendarId     holCal = holidayInp.Value;
                BusinessDayConvention bdc    = bdcInp.Value;
                BusinessDayAdjustment bda    = BusinessDayAdjustment.of(bdc, holCal);
                PeriodicSchedule      defn   = PeriodicSchedule.builder().startDate(start).endDate(end).frequency(freq).businessDayAdjustment(bda).stubConvention(stub).rollConvention(roll).build();
                try
                {
                    Schedule schedule = defn.createSchedule(REF_DATA);
                    Console.WriteLine(schedule);
                    resultGrid.Items = FXCollections.observableArrayList(schedule.Periods);
                }
                catch (ScheduleException ex)
                {
                    resultGrid.Items       = FXCollections.emptyObservableList();
                    resultGrid.Placeholder = new Label(ex.Message);
                    Console.WriteLine(ex.Message);
                }
            };

            // layout the components
            GridPane gp = new GridPane();

            gp.Hgap    = 10;
            gp.Vgap    = 10;
            gp.Padding = new Insets(0, 10, 0, 10);
            gp.add(startLbl, 1, 1);
            gp.add(startInp, 2, 1);
            gp.add(endLbl, 1, 2);
            gp.add(endInp, 2, 2);
            gp.add(freqLbl, 1, 3);
            gp.add(freqInp, 2, 3);
            gp.add(bdcLbl, 3, 1);
            gp.add(bdcInp, 4, 1);
            gp.add(holidayLbl, 3, 2);
            gp.add(holidayInp, 4, 2);
            gp.add(stubLbl, 3, 3);
            gp.add(stubInp, 4, 3);
            gp.add(rollLbl, 3, 4);
            gp.add(rollInp, 4, 4);
            gp.add(btn, 3, 5, 2, 1);
            gp.add(resultGrid, 1, 7, 4, 1);

            BorderPane bp    = new BorderPane(gp);
            Scene      scene = new Scene(bp, 600, 600);

            // launch
            primaryStage.Title = "Periodic schedule generator";
            primaryStage.Scene = scene;
            primaryStage.show();
        }
Example #10
0
        private void AddDetail(TitlePanel titlePanel)
        {
            var vPanel = titlePanel.EAdd(new VLayoutPanel());

            if (CanSave)
            {
                var hPanel = new HLayoutPanel();
                vPanel.Add(hPanel, new VLayoutOption(HorizontalAlign.Left));
                hPanel.Add(new SimpleLabel("选择存货"));
                var selectGoods = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货)
                {
                    Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true, EnableTopItem = true, EnableMultiSelection = true
                };
                selectGoods.SelectedValueChanged += delegate
                {
                    detailGrid.GetFromUI();
                    if (!selectGoods.IsEmpty)
                    {
                        var gids = selectGoods.GetValues().Distinct();
                        foreach (var g in gids)
                        {
                            if (Dmo.Details.Any(x => x.Goods_ID == long.Parse(g)))
                            {
                                continue;
                            }
                            var d = new Picking_Detail()
                            {
                                Goods_ID = long.Parse(g)
                            };
                            DmoUtil.RefreshDependency(d, "Goods_ID");
                            Dmo.Details.Add(d);
                        }
                    }
                    selectGoods.Clear();
                    detailGrid.DataBind();
                };
                hPanel.Add(selectGoods);
            }

            var editor = new DFCollectionEditor <Picking_Detail>(() => Dmo.Details);

            editor.AllowDeletionFunc = () => CanSave;
            editor.IsEditableFunc    = (field, detail) => CanSave;
            editor.CanDeleteFunc     = detail => CanSave;

            detailGrid = new DFEditGrid(editor)
            {
                Width = Unit.Percentage(100)
            };
            detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code"));
            detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name"));
            detailGrid.Columns.EAdd(new DFEditGridColumn <DFValueLabel>("Goods_Spec"));
            detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("Number"));
            detailGrid.Columns.EAdd(new DFEditGridColumn <DFValueLabel>("Goods_MainUnit"));
            detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("SecondNumber"));
            detailGrid.Columns.EAdd(new DFEditGridColumn <DFValueLabel>("Goods_SecondUnit"));
            detailGrid.Columns.EAdd(new DFEditGridColumn <DFTextBox>("Remark"));

            detailGrid.ValueColumns.Add("Goods_ID");
            detailGrid.ValueColumns.Add("Goods_UnitConvertDirection");
            detailGrid.ValueColumns.Add("Goods_MainUnitRatio");
            detailGrid.ValueColumns.Add("Goods_SecondUnitRatio");
            mDFContainer.AddNonDFControl(detailGrid, "$detailGrid");

            var section = mPageLayoutManager.AddSection("DetaiColumns", "明细列");

            section.SetRequired("Number", "SecondNumber");
            section.ApplyLayout(detailGrid, mPageLayoutManager, DFInfo.Get(typeof(Picking_Detail)));
            new NumberSecondNumberConvertRowMangerWithMoneyChanged(detailGrid);
            vPanel.Add(detailGrid);
        }
Example #11
0
        private void AddPayDetails(TitlePanel titlePanel)
        {
            var vPanel = titlePanel.EAdd(new VLayoutPanel());

            if (CanSave)
            {
                var hPanel = vPanel.Add(new HLayoutPanel(), new VLayoutOption(HorizontalAlign.Left));
                hPanel.Add(new SimpleLabel("选择存货"));
                var selectGoods = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货)
                {
                    Width = Unit.Pixel(130), EnableInputArgument = true, AutoPostBack = true, EnableTopItem = true, EnableMultiSelection = true
                };
                selectGoods.SelectedValueChanged += delegate
                {
                    _detailGrid.GetFromUI();
                    if (!selectGoods.IsEmpty)
                    {
                        var gids = selectGoods.GetValues().Distinct();
                        foreach (var g in gids)
                        {
                            var d = new ClientGoodsSet_Detail()
                            {
                                Goods_ID = long.Parse(g)
                            };
                            DmoUtil.RefreshDependency(d, "Goods_ID");
                            Dmo.Details.Add(d);
                        }
                    }
                    selectGoods.Clear();
                    _detailGrid.DataBind();
                };


                hPanel.Add(selectGoods);
                var addGoods = hPanel.Add(new DialogButton
                {
                    Text = "选择存货",
                });
                addGoods.Url    = "SelectGoodsDialogs.aspx";
                addGoods.Click += delegate
                {
                    _detailGrid.GetFromUI();
                    foreach (var goodsID in DialogUtil.GetCachedObj <long>(this))
                    {
                        if (Dmo.Details.Any(x => x.Goods_ID == goodsID))
                        {
                            continue;
                        }
                        var detail = new ClientGoodsSet_Detail()
                        {
                            Goods_ID = goodsID
                        };
                        DmoUtil.RefreshDependency(detail, "Goods_ID");
                        Dmo.Details.Add(detail);
                    }
                    _detailGrid.DataBind();
                };
            }
            ;


            var editor = new DFCollectionEditor <ClientGoodsSet_Detail>(() => Dmo.Details);

            editor.AllowDeletionFunc = () => CanSave;
            editor.CanDeleteFunc     = detail => CanSave;
            editor.IsEditableFunc    = (field, detail) => CanSave;
            _detailGrid = new DFEditGrid(editor);
            _detailGrid.DFGridSetEnabled = false;
            _detailGrid.Width            = Unit.Percentage(100);

            _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("GoodsProperty_Name"));
            _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Code"));
            _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Name"));
            _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_Spec"));
            _detailGrid.Columns.Add(new DFEditGridColumn <DFValueLabel>("Goods_StandardSecondNumber"));


            _detailGrid.ValueColumns.Add("Goods_ID");


            var section = mPageLayoutManager.AddSection("GoodsDetaiColumns", "存货明细");

            titlePanel.SetPageLayoutSetting(mPageLayoutManager, section.Name);

            section.ApplyLayout(_detailGrid, mPageLayoutManager, DFInfo.Get(typeof(ClientGoodsSet_Detail)));

            vPanel.Add(_detailGrid);
        }
Example #12
0
 public MainWindow()
 {
     InitializeComponent();
     ConsoleBox.TextChanged += delegate { ConsoleBox.ScrollToEnd(); };
     ChoiceBox.TextChanged  += delegate { ChoiceBox.ScrollToEnd(); };
 }
Example #13
0
        protected virtual void AddToolsPanel(HLayoutPanel toobar)
        {
            toobar.Add(new SimpleLabel("选择存货"));
            var goodsSelect = new ChoiceBox(B3UnitedInfosConsts.DataSources.存货)
            {
                Width                = Unit.Pixel(120),
                AutoPostBack         = true,
                EnableMultiSelection = true,
                EnableInputArgument  = true
            };

            mDFContainer.AddNonDFControl(goodsSelect, "$SelectGoods");
            toobar.Add(goodsSelect);
            goodsSelect.SelectedValueChanged += (sender, e) => {
                _detailGrid.GetFromUI();
                last = Dmo.Details.LastOrDefault();
                foreach (var sGoodsID in goodsSelect.GetValues())
                {
                    var goods  = GoodsBL.Instance.Load(Convert.ToInt64(sGoodsID));
                    var detail = new ProductNotice_Detail();
                    detail.Goods_ID = goods.ID;
                    DmoUtil.RefreshDependency(detail, "Goods_ID");
                    AddBrandItem(detail);
                    Dmo.Details.Add(detail);
                }
                goodsSelect.DisplayValue = string.Empty;
                _detailGrid.DataBind();
                var script = B3ButcheryWebUtil.SetCursorPositionScript(butcheryConfig.ProductNoticeCursorField, "$detailGrid", Dmo.Details.Count, _detailGrid.PageSize);
                if (!string.IsNullOrEmpty(script))
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "Startup", script, true);
                }
            };

            var quickSelctButton = new DialogButton {
                Url = "~/B3UnitedInfos/Dialogs/QucicklySelectGoodsDetailsDialog.aspx", Text = "快速选择"
            };

            quickSelctButton.Click += delegate {
                ReceiveSelectedGoodsDetailDialog();
            };
            toobar.Add(quickSelctButton);


            var dialogButton = new DialogButton {
                Url = "~/B3UnitedInfos/Dialogs/SelectGoodsDetailDialog.aspx", Text = "查询存货"
            };

            toobar.Add(dialogButton);

            dialogButton.Click += delegate {
                ReceiveSelectedGoodsDetailDialog();
            };
            toobar.Add(new TSButton("载入预报")).Click += delegate
            {
                GetFromUI();
                Dmo.Details.Clear();
                mBL.LoadPredictDetail(Dmo);
                _detailGrid.DataBind();
                //AspUtil.Alert(this, "载入预报成功");
            };
        }