private void SaveBarCode(ComBarCodeLensInfo _BC)
        {
            MWare_Bill _Model = new MWare_Bill()
            {
                BCode   = "",
                BDate   = System.DateTime.Now,
                BType   = "KFBCIPD",
                CusCode = "",
                F_IO    = true,
                F_SD    = false,
                FBCode  = "",
                Maker   = USysInfo.UserCode,
                ID      = "",
                MName   = USysInfo.UserName,
                MType   = "L",
                Remark  = "",
                WhCode  = this._WhCodeInfo,
            };

            _Model.Sub_PD = new MWare_Bill_PD()
            {
                F_LR     = _BC.F_LR,
                ID       = "",
                LensCode = _BC.LensCode
            };
            MWare_Bill_PD_Detail _Sub = new MWare_Bill_PD_Detail()
            {
                ID    = "",
                SubID = 1,
                SPH   = _BC.SPH,
                CYL   = _BC.CYL,
                X_ADD = _BC.X_ADD,
                Price = 0,
                Qty   = 1
            };

            _Model.Sub_PD_Detail = new System.Collections.Generic.List <MWare_Bill_PD_Detail>();
            _Model.Sub_PD_Detail.Add(_Sub);

            DSWare_Bill _DS = new DSWare_Bill();

            _DS.Add(USysInfo.DBCode, USysInfo.LgIndex, _Model, geted =>
            {
                if (geted.HasError)
                {
                    MessageErp.ErrorMessage(geted.Error.Message.GetErrMsg());
                    geted.MarkErrorAsHandled();
                    return;
                }
            }, null);
        }
        private void AddBarCodePre()
        {
            MWare_Bill model = new MWare_Bill()
            {
                BarCodeL     = this.BillMain.BarCodeL,
                BarCodeR     = this.BillMain.BarCodeR,
                BarCodeSOPre = this.BillMain.BarCodeSOPre,
                BCode        = "",
                BDate        = DateTime.Now,
                BType        = "KFPSOSD",
                CusCode      = "",
                F_SD         = true,
                FBCode       = "",
                F_IO         = false,
                ID           = "",
                Maker        = USysInfo.UserCode,
                MName        = USysInfo.UserName,
                MType        = "L",
                Remark       = "",
                SpCode       = "",
                Sub_SD       = new List <MWare_Bill_SD>(),
                WhCode       = this.BillMain.WhCode,
            };

            MWare_Bill_SD model_R = new MWare_Bill_SD()
            {
                ID       = "",
                LensCode = this.BillMain.LensCodeR,
                SPH      = this.BillMain.SPHR.Value,
                CYL      = this.BillMain.CYLR.Value,
                X_ADD    = this.BillMain.X_ADDR.Value,
                F_LR     = "R",
                Qty      = this.BillMain.QtyR.Value,
                Price    = 0,
            };

            model.Sub_SD.Add(model_R);

            MWare_Bill_SD model_L = new MWare_Bill_SD()
            {
                ID       = "",
                LensCode = this.BillMain.LensCodeL,
                SPH      = this.BillMain.SPHL.Value,
                CYL      = this.BillMain.CYLL.Value,
                X_ADD    = this.BillMain.X_ADDL.Value,
                F_LR     = "L",
                Qty      = this.BillMain.QtyL.Value,
                Price    = 0,
            };

            model.Sub_SD.Add(model_L);

            model.Sub_Extend = new MWare_Bill_Extend()
            {
                ID        = "",
                LensCodeR = this.BillMain.LensCodeR,
                SPHR      = this.BillMain.SPHR.Value,
                CYLR      = this.BillMain.CYLR.Value,
                X_ADDR    = this.BillMain.X_ADDR.Value,
                LensCodeL = this.BillMain.LensCodeL,
                SPHL      = this.BillMain.SPHL.Value,
                CYLL      = this.BillMain.CYLL.Value,
                X_ADDL    = this.BillMain.X_ADDL.Value,
                SCode     = "",
                SumQty    = this.BillMain.QtyR.Value + this.BillMain.QtyL.Value
            };

            DSWare_Bill _DS = new DSWare_Bill();

            _DS.Add(USysInfo.DBCode, USysInfo.LgIndex, model, geted =>
            {
                if (geted.HasError)
                {
                    MessageErp.ErrorMessage(geted.Error.Message.GetErrMsg());
                    geted.MarkErrorAsHandled();
                    return;
                }

                this.ResetBillMain();
            }, null);
        }