Beispiel #1
0
        protected override void PrepareModelToSave()
        {
            var _DC = this.DContextMain as V_Sale_Order_SD;
            var _CM = this.CurrentModel as MSale_Order;

            if (null == _DC || null == _CM)
            {
                MessageErp.ErrorMessage(ErpUIText.ErrMsg); return;
            }
            base.PrepareModelToSave();
            //
            _CM.Ex_SD = new List <MSale_Order_SD>();
            MSale_Order_SD ex_sd = null;

            for (int i = 0; i <= 1; i++)
            {
                ex_sd = new MSale_Order_SD()
                {
                    ID          = _CM.ID,
                    Axis        = i == 0 ? _DC.AxisR.Value : _DC.AxisL.Value,
                    CT          = i == 0 ? _DC.CTR.Trim() : _DC.CTL.Trim(),
                    CYL         = i == 0 ? _DC.CYLR.Value : _DC.CYLL.Value,
                    Qty         = i == 0 ? _DC.QtyR.Value : _DC.QtyL.Value,
                    SPH         = i == 0 ? _DC.SPHR.Value : _DC.SPHL.Value,
                    DB          = i == 0 ? _DC.DBR : _DC.DBL,
                    D1          = i == 0 ? _DC.D1R.Trim() : _DC.D1L.Trim(),
                    D2          = i == 0 ? _DC.D2R.Trim() : _DC.D2L.Trim(),
                    D3          = i == 0 ? _DC.D3R.Trim() : _DC.D3L.Trim(),
                    D4          = i == 0 ? _DC.D4R.Trim() : _DC.D4L.Trim(),
                    Dia         = i == 0 ? _DC.DiaR.Value : _DC.DiaL.Value,
                    BASE        = i == 0 ? _DC.BASER.Trim() : _DC.BASEL.Trim(),
                    LensCode    = i == 0 ? _DC.LensCodeR.Trim() : _DC.LensCodeL.Trim(),
                    LensCodeR   = i == 0 ? _DC.LensCodeRR.Trim() : _DC.LensCodeRL.Trim(),
                    P1          = i == 0 ? _DC.P1R.Trim() : _DC.P1L.Trim(),
                    P2          = i == 0 ? _DC.P2R.Trim() : _DC.P2L.Trim(),
                    P3          = i == 0 ? _DC.P3R.Trim() : _DC.P3L.Trim(),
                    P4          = i == 0 ? _DC.P4R.Trim() : _DC.P4L.Trim(),
                    X_ADD       = i == 0 ? _DC.X_ADDR.Value : _DC.X_ADDL.Value,
                    Price       = 0,
                    F_LR        = i == 0 ? false : true,
                    IvoLensName = "",
                    QtyCs       = 0,
                    QtyRt       = 0
                };
                _CM.Ex_SD.Add(ex_sd);
            }

            _CM.Ex_SD_Sub = new MSale_Order_SD_Sub();
            ComCopyProperties.Copy(_CM.Ex_SD_Sub, this.DContextMain);
        }
Beispiel #2
0
        protected override void PrepareModelToSave()
        {
            var _CM = this.CurrentModel as MSale_Order;

            if (null == _DC || null == _CM)
            {
                MessageErp.ErrorMessage(ErpUIText.ErrMsg); return;
            }
            base.PrepareModelToSave();
            //
            _CM.MType = "L";
            _CM.F_FS  = false;
            _CM.F_SD  = true;
            //
            _CM.Sub_SD = new List <MSale_Order_SD>();
            MSale_Order_SD sub_SD = null;

            for (int i = 0; i <= 1; i++)
            {
                sub_SD = new MSale_Order_SD()
                {
                    ID            = _CM.ID,
                    Axis          = i == 0 ? _DC.AxisR.Value : _DC.AxisL.Value,
                    CT            = i == 0 ? _DC.CTR.Trim() : _DC.CTL.Trim(),
                    CYL           = i == 0 ? _DC.CYLR.Value : _DC.CYLL.Value,
                    Qty           = i == 0 ? _DC.QtyR.Value : _DC.QtyL.Value,
                    SPH           = i == 0 ? _DC.SPHR.Value : _DC.SPHL.Value,
                    DB            = i == 0 ? _DC.DBR : _DC.DBL,
                    D1            = i == 0 ? _DC.D1R.Trim() : _DC.D1L.Trim(),
                    D2            = i == 0 ? _DC.D2R.Trim() : _DC.D2L.Trim(),
                    D3            = i == 0 ? _DC.D3R.Trim() : _DC.D3L.Trim(),
                    D4            = i == 0 ? _DC.D4R.Trim() : _DC.D4L.Trim(),
                    Dia           = i == 0 ? _DC.DiaR.Value : _DC.DiaL.Value,
                    BASE          = i == 0 ? _DC.BASER.Trim() : _DC.BASEL.Trim(),
                    LensCode      = i == 0 ? _DC.LensCodeR.Trim() : _DC.LensCodeL.Trim(),
                    LensCodeR     = i == 0 ? _DC.LensCodeRR.Trim() : _DC.LensCodeRL.Trim(),
                    P1            = i == 0 ? _DC.P1R.Trim() : _DC.P1L.Trim(),
                    P2            = i == 0 ? _DC.P2R.Trim() : _DC.P2L.Trim(),
                    P3            = i == 0 ? _DC.P3R.Trim() : _DC.P3L.Trim(),
                    P4            = i == 0 ? _DC.P4R.Trim() : _DC.P4L.Trim(),
                    X_ADD         = i == 0 ? _DC.X_ADDR.Value : _DC.X_ADDL.Value,
                    Price         = 0,
                    ProCost       = 0,
                    ProCostReport = "",
                    ProReport     = "",
                    F_LR          = i == 0 ? "R" : "L",
                    InvTitle      = "",
                    QtySO         = 0,
                    QtyCs         = 0,
                    QtyRt         = 0,
                    QtyPur        = 0,
                    QtyRec        = 0
                };
                _CM.Sub_SD.Add(sub_SD);
            }

            _CM.Sub_SD_Process = new MSale_Order_SD_Process();
            ComCopyProperties.Copy(_CM.Sub_SD_Process, this.DContextMain);

            _CM.Sub_Extend = new MSale_Order_Extend()
            {
                ID         = _CM.ID,
                LensCodeR  = _DC.LensCodeR,
                LensCodeRR = _DC.LensCodeRR,
                LensCodeRL = _DC.LensCodeRL,
                LensCodeL  = _DC.LensCodeL,
                SPHR       = _DC.SPHR.Value,
                SPHL       = _DC.SPHL.Value,
                CYLR       = _DC.CYLR.Value,
                CYLL       = _DC.CYLL.Value,
                X_ADDR     = _DC.X_ADDR.Value,
                X_ADDL     = _DC.X_ADDL.Value,
                DN         = "",
                SumQty     = _DC.QtyR.Value + _DC.QtyL.Value,
                SumQtySO   = 0,
                SumQtyCs   = 0,
                SumQtyRt   = 0,
                SumQtyPur  = 0,
                SumQtyRec  = 0,
                Rt1        = "",
                Rt2        = "",
                Rt3        = "",
                Rt4        = "",
                Rt5        = "",
                PdCode     = "",
                PdName     = "",
                SumMoney   = 0
            };
        }