Exemple #1
0
        public static bool GetBill(string PLUID, out DBJhBill bill, out string msg)
        {
            SQLiteDataReader rd;

            if (!DBTool.Select("PluID=@PluID", new DBJhBill()
            {
                PluID = PLUID
            }, string.Empty, out rd, out msg))
            {
                bill = null;
                return(false);
            }
            ICollection <DBJhBill> list = ObjTool.BuildObject <DBJhBill>(rd);

            rd.Close();
            if (list.Count > 0)
            {
                bill = list.First();
                return(true);
            }
            else
            {
                msg  = "未查询到采购信息";
                bill = null;
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 读取参数
        /// </summary>
        /// <param Name="PosNo"></param>
        /// <param Name="config"></param>
        /// <param Name="msg"></param>
        /// <returns></returns>
        public static bool GetConfig(string posNo, out ICollection <MConfig> config, out string msg)
        {
            SqlDataReader rd = null;

            try
            {
                if (!DBTool.Select("", new MConfig()
                {
                    PosNo = posNo
                }, string.Empty, out rd, out msg))
                {
                    config = null;
                    return(false);
                }
                else
                {
                    config = ObjTool.BuildObject <MConfig>(rd);
                    rd.Close();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                msg    = "系统异常:" + ex.Message;
                config = null;
                if (rd != null && !rd.IsClosed)
                {
                    rd.Close();
                }
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// 读取商品
        /// </summary>
        /// <param Name="stype"></param>
        /// <param Name="goods"></param>
        /// <param Name="msg"></param>
        /// <returns></returns>
        public static bool GetGoodsByStype(string stype, out ICollection <MGoods> goods, out string msg)
        {
            SqlDataReader rd = null;

            try
            {
                if (!DBTool.Select("(  stype=@stype ) And Flag='1' ",
                                   new MGoods()
                {
                    Stype = stype
                }, string.Empty, out rd, out msg))
                {
                    goods = null;
                    return(false);
                }
                else
                {
                    goods = ObjTool.BuildObject <MGoods>(rd);
                    rd.Close();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                msg   = "系统异常:" + ex.Message;
                goods = null;
                if (rd != null && !rd.IsClosed)
                {
                    rd.Close();
                }
                return(false);
            }
        }
Exemple #4
0
        ///// <summary>
        ///// 获取指定采购单明细
        ///// </summary>
        ///// <param name="code"></param>
        ///// <param name="PackUnit"></param>
        ///// <param name="PackQty"></param>
        ///// <param name="bill"></param>
        ///// <param name="msg"></param>
        ///// <returns></returns>
        //public static bool GetBill(int  ToSerialNo, out DBJhBill bill, out string msg)
        //{
        //    SQLiteDataReader rd;
        //    if (!DBTool.Select(" ToSerialNo=@ToSerialNo ", new DBJhBill() { ToSerialNo = ToSerialNo }, string.Empty, out rd, out msg))
        //    {
        //        bill = null;
        //        return false;
        //    }
        //    if (rd.Read())
        //    {
        //        int i;
        //        if(!GetMaxSerialNo(out i,out msg))
        //        {
        //            //取SerialNo失败
        //            rd.Close();
        //            bill = null;
        //            return false;
        //        }
        //        bill = new DBJhBill();
        //        bill.ID = new Guid(Convert.ToString(rd["ID"]));
        //        bill.Barcode = Convert.ToString(rd["Barcode"]);
        //        bill.BillNo = Convert.ToString(rd["BillNo"]);
        //        bill.CgCount = Convert.ToDecimal(rd["CgCount"]);
        //        bill.Checked = Convert.ToString(rd["Checked"]);
        //        bill.LrDate = Convert.ToDateTime(rd["LrDate"]);
        //        bill.LrUser = Convert.ToString(rd["LrUser"]);
        //        bill.CgPackCount = Convert.ToDecimal(rd["CgPackCount"]);
        //        bill.SsPackCount = Convert.ToDecimal(rd["SsPackCount"]);
        //        bill.PackQty = Convert.ToDecimal(rd["PackQty"]);
        //        bill.PackUnit = Convert.ToString(rd["PackUnit"]);
        //        bill.PluCode = Convert.ToString(rd["PluCode"]);
        //        bill.PluID = Convert.ToString(rd["PluID"]);
        //        bill.PluName = Convert.ToString(rd["PluName"]);
        //        bill.SerialNo = i++;
        //        bill.ToSerialNo = Convert.ToInt16(rd["ToSerialNo"]);
        //        bill.CgSGLCount = Convert.ToDecimal(rd["CgSGLCount"]);
        //        bill.SsSGLCount = Convert.ToDecimal(rd["SsSGLCount"]);
        //        bill.Spec = Convert.ToString(rd["Spec"]);
        //        bill.SsCount = Convert.ToDecimal(rd["SsCount"]);
        //        bill.Unit = Convert.ToString(rd["Unit"]);
        //        return true;
        //    }
        //    else
        //    {
        //        msg = "未查询到采购信息";
        //        bill = null;
        //        return false;
        //    }

        //}

        /// <summary>
        /// 获取指定采购单明细
        /// </summary>
        /// <param name="packet"></param>
        /// <param name="bill"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool GetBill(string Code, TPacket packet, out DBJhBill bill, out string msg)
        {
            SQLiteDataReader rd;

            if (!DBTool.Select("PluCode=@PluCode And PackQty=@PackQty And PackUnit=@PackUnit", new DBJhBill()
            {
                PluCode = Code, PackQty = decimal.Parse(packet.PACKQTY), PackUnit = packet.PACKUNIT
            }, string.Empty, out rd, out msg))
            {
                bill = null;
                return(false);
            }
            ICollection <DBJhBill> list = ObjTool.BuildObject <DBJhBill>(rd);

            rd.Close();
            if (list.Count > 0)
            {
                bill = list.First();
                return(true);
            }
            else
            {
                msg  = "未查询到采购信息";
                bill = null;
                return(false);
            }
        }
Exemple #5
0
        /// <summary>
        /// 列表验收单
        /// </summary>
        /// <param name="jhBill"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool ListBill(out List <DBJhBill> jhBill, out string msg)
        {
            SQLiteDataReader rd;

            if (!DBTool.Select(string.Empty, new DBJhBill(), "Checked Desc", out rd, out msg))
            {
                jhBill = null;
                return(false);
            }
            jhBill = new List <DBJhBill>();
            jhBill.AddRange(ObjTool.BuildObject <DBJhBill>(rd));
            rd.Close();
            return(true);
        }
Exemple #6
0
        /// <summary>
        /// 读卡
        /// </summary>
        /// <param Name="inCardNo"></param>
        /// <param Name="card"></param>
        /// <param Name="msg"></param>
        /// <returns></returns>
        public static bool GetCzCard(string inCardNo, out MCzCard card, out string msg)
        {
            card          = new MCzCard();
            card.InCardno = inCardNo;
            SqlDataReader rd = null;

            try
            {
                if (!DBTool.Select("InCardNo=@InCardNo", card, string.Empty, out rd, out msg))
                {
                    card = null;
                    return(false);
                }
                else
                {
                    ICollection <MCzCard> list = ObjTool.BuildObject <MCzCard>(rd);
                    rd.Close();
                    if (list.Count == 0)
                    {
                        card = null;
                        msg  = "卡片" + inCardNo + "不存在";
                        return(false);
                    }
                    else
                    {
                        card = list.First();
                        if (card.State == "1")
                        {
                            return(GetCzkType(card.CardTypeCode, out card.CzkType, out msg));
                        }
                        else
                        {
                            msg = "该卡已禁用或已挂失!";
                            return(false);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                msg = "系统异常:" + ex.Message;
                if (rd != null && !rd.IsClosed)
                {
                    rd.Close();
                }
                card = null;
                return(false);
            }
        }
Exemple #7
0
        /// <summary>
        /// 列表采购明细
        /// </summary>
        /// <param name="rst"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool ListBill(out List <DBCgBill> rst, out string msg)
        {
            DataTable dt;

            if (!Select(string.Empty, new DBCgBill(), "SerialNo", out dt, out msg))
            {
                rst = null;
                return(false);
            }
            else
            {
                rst = ObjTool.BuildObject <DBCgBill>(dt).ToList();
                return(true);
            }
        }
Exemple #8
0
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param Name="userCode"></param>
        /// <param Name="password"></param>
        /// <param Name="msg"></param>
        /// <returns></returns>
        public static bool GetUser(string userCode, out MUser user, out string msg)
        {
            SqlDataReader rd = null;

            try
            {
                if (!DBTool.Select("UserCode=@UserCode", new MUser()
                {
                    UserCode = userCode
                }, string.Empty
                                   , out rd, out msg))
                {
                    user = null;
                    return(false);
                }
                else
                {
                    ICollection <MUser> list = ObjTool.BuildObject <MUser>(rd);
                    rd.Close();
                    if (list.Count == 0)
                    {
                        msg  = "登陆失败";
                        user = null;
                        return(false);
                    }
                    else
                    {
                        user = list.First();
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                msg = "系统异常:" + ex.Message;
                if (rd != null && !rd.IsClosed)
                {
                    rd.Close();
                }
                user = null;
                return(false);
            }
        }
Exemple #9
0
        /// <summary>
        /// 获取储值卡类型
        /// </summary>
        /// <param name="czkTypeCode"></param>
        /// <param name="czkType"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool GetCzkType(string czkTypeCode, out MCzkType czkType, out string msg)
        {
            SqlDataReader rd = null;

            try
            {
                if (!DBTool.Select("Code=@Code",
                                   new MCzkType()
                {
                    Code = czkTypeCode
                }, string.Empty, out rd, out msg))
                {
                    czkType = null;
                    return(false);
                }
                else
                {
                    ICollection <MCzkType> list = ObjTool.BuildObject <MCzkType>(rd);
                    rd.Close();
                    if (list.Count == 0)
                    {
                        msg     = "未找到储值卡类型" + czkTypeCode;
                        czkType = null;
                        return(false);
                    }
                    else
                    {
                        czkType = list.First();
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                if (rd != null && !rd.IsClosed)
                {
                    rd.Close();
                }
                msg     = "系统异常:" + ex.Message;
                czkType = null;
                return(false);
            }
        }
Exemple #10
0
        /// <summary>
        /// 读取部门信息
        /// </summary>
        /// <param Name="dept"></param>
        /// <param Name="msg"></param>
        /// <returns></returns>
        public static bool GetDept(string DeptCode, out MDept dept, out string msg)
        {
            SqlDataReader rd = null;

            try
            {
                if (!DBTool.Select("Code=@Code", new MDept()
                {
                    DeptCode = DeptCode
                }, string.Empty, out rd, out msg))
                {
                    dept = null;
                    return(false);
                }
                else
                {
                    ICollection <MDept> list = ObjTool.BuildObject <MDept>(rd);
                    rd.Close();
                    if (list.Count == 0)
                    {
                        msg  = "未找到该部门";
                        dept = null;
                        return(false);
                    }
                    else
                    {
                        dept = list.First();
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                msg  = "系统异常:" + ex.Message;
                dept = null;
                if (rd != null && !rd.IsClosed)
                {
                    rd.Close();
                }
                return(false);
            }
        }
Exemple #11
0
        /// <summary>
        /// 检测用户权限
        /// </summary>
        /// <param name="UserCode"></param>
        /// <param name="Password"></param>
        /// <param name="user"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool Check(string userCode, string password, out string msg)
        {
            SqlDataReader rd = null;

            try
            {
                if (!DBTool.Select("UserCode=@UserCode And mPassword=@mpassword And ValidFlag='Y'", new MUser()
                {
                    UserCode = userCode, Password = password
                }, string.Empty
                                   , out rd, out msg))
                {
                    return(false);
                }
                else
                {
                    ICollection <MUser> list = ObjTool.BuildObject <MUser>(rd);
                    rd.Close();
                    if (list.Count == 0)
                    {
                        msg = "用户验证失败";
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                msg = "系统异常:" + ex.Message;
                if (rd != null && !rd.IsClosed)
                {
                    rd.Close();
                }
                return(false);
            }
        }
Exemple #12
0
        /// <summary>
        /// 获取当前单据信息
        /// </summary>
        /// <param name="msg">返回的消息</param>
        /// <returns>返回是否成功</returns>
        public static bool GetJhBillInfo(out DBJhBillInfo billInfo, out string msg)
        {
            SQLiteDataReader rd;

            if (!DBTool.ExecSql("Select * From tJhBillInfo ", out rd, out msg))
            {
                billInfo = null;
                return(false);
            }
            ICollection <DBJhBillInfo> list = ObjTool.BuildObject <DBJhBillInfo>(rd);

            rd.Close();
            if (list.Count > 0)
            {
                billInfo = list.First();
                return(true);
            }
            else
            {
                msg      = "未找到验收单信息。";
                billInfo = null;
                return(false);
            }
        }
Exemple #13
0
 public internalObjTool(ObjTool ObjTool = default)
 {
     this.ObjTool = ObjTool;
 }
Exemple #14
0
 public Options(Writer Writer = default, FlagSet Flagset = default, Fetcher Fetch = default, Symbolizer Sym = default, ObjTool Obj = default, UI UI = default, Func <ptr <HTTPServerArgs>, error> HTTPServer = default, http.RoundTripper HTTPTransport = default)
 {
     this.Writer        = Writer;
     this.Flagset       = Flagset;
     this.Fetch         = Fetch;
     this.Sym           = Sym;
     this.Obj           = Obj;
     this.UI            = UI;
     this.HTTPServer    = HTTPServer;
     this.HTTPTransport = HTTPTransport;
 }