コード例 #1
0
ファイル: DWare.cs プロジェクト: peter-ay/sl
        public void UpdateWare_Bill(int lgIndex, SqlCommand cmd, MWare_Bill model)
        {
            StringBuilder strSql = new StringBuilder();

            SqlParameter[] parameters;
            /////////////////修改,撤销预扣//////////////////////////////
            //strSql.Append("SP_Ware_Bill_EditVerify");
            //parameters = new SqlParameter[] {
            //        new SqlParameter("@LgIndex", SqlDbType.Int),
            //        new SqlParameter("@PKCode", SqlDbType.VarChar,25)};
            //parameters[0].Value = lgIndex;
            //parameters[1].Value = model.ID;
            //cmd.ExecuteMySPQuery(strSql.ToString(), parameters);
            /////////////////////////////////////////////////////////////////
            strSql.Clear();
            strSql.Append("update Ware_Bill set ");
            strSql.Append("CusCode=@CusCode,");
            strSql.Append("SpCode=@SpCode,");
            strSql.Append("WhCode=@WhCode,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ID=@ID ");
            parameters = new SqlParameter[] {
                new SqlParameter("@CusCode", SqlDbType.VarChar, 10),
                new SqlParameter("@SpCode", SqlDbType.VarChar, 10),
                new SqlParameter("@WhCode", SqlDbType.VarChar, 10),
                new SqlParameter("@Remark", SqlDbType.NVarChar, 200),
                new SqlParameter("@ID", SqlDbType.VarChar, 25)
            };
            parameters[0].Value = model.CusCode ?? "";
            parameters[1].Value = model.SpCode ?? "";
            parameters[2].Value = model.WhCode;
            parameters[3].Value = model.Remark;
            parameters[4].Value = model.ID;
            cmd.ExecuteMyQuery(strSql.ToString(), parameters);
        }
コード例 #2
0
        private void PrepareExtend(MWare_Bill model)
        {
            model.Sub_Extend = new MWare_Bill_Extend()
            {
                ID        = model.ID,
                SPHL      = 0,
                SPHR      = 0,
                CYLL      = 0,
                CYLR      = 0,
                X_ADDL    = 0,
                X_ADDR    = 0,
                LensCodeL = "",
                LensCodeR = "",
                SCode     = "",
                QtyR      = 0,
                QtyL      = 0,
                SumQty    = 0,
                SumMoney  = 0,
                PriceL    = 0,
                PriceR    = 0,
                ProCostL  = 0,
                ProCostR  = 0
            };

            switch (model.MType)
            {
            case "L":
                if (model.F_SD)
                {
                    model.Sub_Extend.SPHR      = model.Sub_SD[0].SPH;
                    model.Sub_Extend.SPHL      = model.Sub_SD[1].SPH;
                    model.Sub_Extend.CYLR      = model.Sub_SD[0].CYL;
                    model.Sub_Extend.CYLL      = model.Sub_SD[1].CYL;
                    model.Sub_Extend.X_ADDR    = model.Sub_SD[0].X_ADD;
                    model.Sub_Extend.X_ADDL    = model.Sub_SD[1].X_ADD;
                    model.Sub_Extend.LensCodeR = model.Sub_SD[0].LensCode;
                    model.Sub_Extend.LensCodeL = model.Sub_SD[1].LensCode;
                    model.Sub_Extend.QtyR      = model.Sub_SD[0].Qty;
                    model.Sub_Extend.QtyL      = model.Sub_SD[1].Qty;
                    model.Sub_Extend.SumQty    = model.Sub_SD[0].Qty + model.Sub_SD[1].Qty;
                    model.Sub_Extend.SumMoney  = model.Sub_SD[0].Qty * model.Sub_SD[0].Price + model.Sub_SD[1].Qty * model.Sub_SD[1].Price;
                    model.Sub_Extend.PriceR    = model.Sub_SD[0].Price;
                    model.Sub_Extend.PriceL    = model.Sub_SD[1].Price;
                    model.Sub_Extend.ProCostR  = model.Sub_SD[0].ProCost;
                    model.Sub_Extend.ProCostL  = model.Sub_SD[1].ProCost;
                }
                else
                {
                    model.Sub_Extend.LensCodeR = model.Sub_PD.LensCode;
                    model.Sub_Extend.LensCodeL = model.Sub_PD.LensCode;
                    model.Sub_Extend.SumQty    = model.Sub_PD_Detail.Sum(it => it.Qty);
                    model.Sub_Extend.SumMoney  = model.Sub_PD_Detail.Sum(it => it.Qty * it.Price);
                }
                break;

            default:

                break;
            }
        }
コード例 #3
0
        private void PrepareAddPD(int lgIndex, SqlCommand cmd, MWare_Bill model)
        {
            model.Sub_PD.ID = model.ID;
            _DW.AddWare_Bill_PD(lgIndex, cmd, model.Sub_PD);

            model.Sub_PD_Detail.ForEach(it => it.ID = model.ID);
            _DW.AddWare_Bill_PD_Detail(lgIndex, cmd, model.Sub_PD_Detail);
        }
コード例 #4
0
        private void UpdatePD(int lgIndex, SqlCommand cmd, MWare_Bill model)
        {
            var _modelPD = model.Sub_PD;

            _DW.UpdateWare_Bill_PD(lgIndex, cmd, _modelPD);

            var _modelPD_Detail = model.Sub_PD_Detail;

            _DW.UpdateWare_Bill_PD_Detail(lgIndex, cmd, _modelPD_Detail);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: DWare.cs プロジェクト: peter-ay/sl
        public void UpdateEditWare_Bill(int lgIndex, SqlCommand cmd, MWare_Bill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Ware_Bill set ");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ID=@ID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Remark", SqlDbType.NVarChar, 200),
                new SqlParameter("@ID",     SqlDbType.VarChar, 25)
            };
            parameters[0].Value = model.Remark;
            parameters[1].Value = model.ID;
            cmd.ExecuteMyQuery(strSql.ToString(), parameters);
        }
コード例 #7
0
        protected override void PrepareAddSub(int lgIndex, SqlCommand cmd, object t)
        {
            MWare_Bill _model = t as MWare_Bill;

            switch (_model.MType)
            {
            case "L":
                if (_model.F_SD)
                {
                    this.PrepareAddSD(lgIndex, cmd, _model);
                }
                else
                {
                    this.PrepareAddPD(lgIndex, cmd, _model);
                }
                break;

            default:
                break;
            }
            this.PrepareAddExtend(lgIndex, cmd, _model);
        }
コード例 #8
0
 public void UpdateEdit(string dbCode, int lgIndex, MWare_Bill t)
 {
     bllUpdateEdit.UpdateEdit(dbCode, lgIndex, t);
 }
コード例 #9
0
 public void Update(string dbCode, int lgIndex, MWare_Bill t)
 {
     bll.Update(dbCode, lgIndex, t);
 }
コード例 #10
0
 public string Add(string dbCode, int lgIndex, MWare_Bill t)
 {
     return(bll.Add(dbCode, lgIndex, t));
 }
コード例 #11
0
 private void PrepareAddSD(int lgIndex, SqlCommand cmd, MWare_Bill model)
 {
     model.Sub_SD.ForEach(it => it.ID = model.ID);
     _DW.AddWare_Bill_SD(lgIndex, cmd, model.Sub_SD);
 }
コード例 #12
0
        protected override void PrepareAddMain(int lgIndex, SqlCommand cmd, object t)
        {
            MWare_Bill _model = t as MWare_Bill;

            _DW.AddWare_Bill(lgIndex, cmd, _model);
        }
コード例 #13
0
 private void UpdateSD(int lgIndex, SqlCommand cmd, MWare_Bill model)
 {
     _DW.UpdateWare_Bill_SD(lgIndex, cmd, model.Sub_SD);
 }
コード例 #14
0
 private void UpdateExtend(int lgIndex, SqlCommand cmd, MWare_Bill model)
 {
     this.PrepareExtend(model);
     _DW.UpdateWare_Bill_Extend(lgIndex, cmd, model.Sub_Extend);
 }
コード例 #15
0
ファイル: DWare.cs プロジェクト: peter-ay/sl
        public void AddWare_Bill(int lgIndex, SqlCommand cmd, MWare_Bill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Ware_Bill(");
            strSql.Append("ID,BCode,BDate,BType,FBCode,F_IO,MType,F_SD,WhCode,CusCode,SpCode,Remark,Maker,MName,BarCodeSOPre,BarCodeR,BarCodeL)");
            strSql.Append(" values (");
            strSql.Append("@ID,@BCode,@BDate,@BType,@FBCode,@F_IO,@MType,@F_SD,@WhCode,@CusCode,@SpCode,@Remark,@Maker,@MName,@BarCodeSOPre,@BarCodeR,@BarCodeL)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",           SqlDbType.VarChar,   25),
                new SqlParameter("@BCode",        SqlDbType.VarChar,   30),
                new SqlParameter("@BDate",        SqlDbType.Date,       3),
                new SqlParameter("@BType",        SqlDbType.VarChar,   10),
                new SqlParameter("@FBCode",       SqlDbType.VarChar,   50),
                new SqlParameter("@F_IO",         SqlDbType.Bit,        1),
                new SqlParameter("@MType",        SqlDbType.VarChar,   10),
                new SqlParameter("@F_SD",         SqlDbType.Bit,        1),
                new SqlParameter("@WhCode",       SqlDbType.VarChar,   10),
                new SqlParameter("@CusCode",      SqlDbType.VarChar,   10),
                new SqlParameter("@SpCode",       SqlDbType.VarChar,   10),
                new SqlParameter("@Remark",       SqlDbType.NVarChar, 200),
                new SqlParameter("@Maker",        SqlDbType.VarChar,   10),
                new SqlParameter("@MName",        SqlDbType.NVarChar,  30),
                new SqlParameter("@BarCodeSOPre", SqlDbType.VarChar,   25),
                new SqlParameter("@BarCodeR",     SqlDbType.VarChar,   25),
                new SqlParameter("@BarCodeL",     SqlDbType.VarChar, 25)
            };
            parameters[0].Value  = model.ID;
            parameters[1].Value  = model.BCode;
            parameters[2].Value  = model.BDate;
            parameters[3].Value  = model.BType;
            parameters[4].Value  = model.FBCode;
            parameters[5].Value  = model.F_IO;
            parameters[6].Value  = model.MType;
            parameters[7].Value  = model.F_SD;
            parameters[8].Value  = model.WhCode;
            parameters[9].Value  = model.CusCode ?? "";
            parameters[10].Value = model.SpCode ?? "";
            parameters[11].Value = model.Remark;
            parameters[12].Value = model.Maker;
            parameters[13].Value = model.MName;
            parameters[14].Value = model.BarCodeSOPre ?? "";
            parameters[15].Value = model.BarCodeR ?? "";
            parameters[16].Value = model.BarCodeL ?? "";
            cmd.ExecuteMyQuery(strSql.ToString(), parameters);
            //
            strSql.Clear();
            strSql.Append("insert into Ware_Bill_ADD(");
            strSql.Append("ID,StCode,MDate,Checker,ChName,ChDate,Deler,DelName,DelDate)");
            strSql.Append(" values (");
            strSql.Append("@ID,@StCode,@MDate,@Checker,@ChName,@ChDate,@Deler,@DelName,@DelDate)");
            parameters = new SqlParameter[] {
                new SqlParameter("@ID", SqlDbType.VarChar, 25),
                new SqlParameter("@StCode", SqlDbType.VarChar, 10),
                new SqlParameter("@MDate", SqlDbType.DateTime),
                new SqlParameter("@Checker", SqlDbType.VarChar, 10),
                new SqlParameter("@ChName", SqlDbType.NVarChar, 30),
                new SqlParameter("@ChDate", SqlDbType.DateTime),
                new SqlParameter("@Deler", SqlDbType.VarChar, 10),
                new SqlParameter("@DelName", SqlDbType.NVarChar, 30),
                new SqlParameter("@DelDate", SqlDbType.DateTime)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = "DSH";               // model.StCode;
            parameters[2].Value = System.DateTime.Now; // model.MDate;
            parameters[3].Value = "";                  // model.Checker;
            parameters[4].Value = "";                  // model.ChName;
            parameters[5].Value = System.DBNull.Value; // model.ChDate;
            parameters[6].Value = "";                  // model.Deler;
            parameters[7].Value = "";                  //model.DelName;
            parameters[8].Value = System.DBNull.Value; //model.DelDate;
            cmd.ExecuteMyQuery(strSql.ToString(), parameters);
        }
コード例 #16
0
        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);
        }