Beispiel #1
0
        /// <summary>
        /// 增加一条付款流水
        /// </summary>
        /// <param name="pay"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool AddSalSalePay(List <TSalSalePay> payList, out string msg)
        {
            SQLiteTransaction tran;
            int i;

            if (!DBTool.BeginTransaction(out tran, out msg))
            {
                return(false);
            }
            foreach (TSalSalePay pay in payList)
            {
                DBSalSalePay DBPay = new DBSalSalePay();
                DBPay.ID       = Guid.NewGuid();
                DBPay.LrDate   = DateTime.Now;
                DBPay.LrUser   = PubGlobal.User.UserCode;
                DBPay.OrgCode  = PubGlobal.OrgCode;
                DBPay.SaleNo   = pay.SALENO;
                DBPay.SerialNo = int.Parse(pay.SERIALNO);
                DBPay.SsTotal  = string.IsNullOrEmpty(pay.SSTOTAL) ? 0 : decimal.Parse(pay.SSTOTAL);
                DBPay.VipNo    = string.IsNullOrEmpty(pay.VIPNO) ? string.Empty : pay.VIPNO;
                DBPay.ZfCode   = pay.ZFCODE;
                DBPay.ZfNo     = string.IsNullOrEmpty(pay.ZFNO)?string.Empty:pay.ZFNO;
                DBPay.ZfTotal  = string.IsNullOrEmpty(pay.ZFTOTAL) ? 0 : decimal.Parse(pay.ZFTOTAL);
                if (!DBTool.Insert(DBPay, tran, out i, out msg))
                {
                    DBTool.RollbackTransaction(tran, out msg);//回滚
                    return(false);
                }
            }
            return(DBTool.CommitTransaction(tran, out msg));
        }
Beispiel #2
0
        /// <summary>
        /// 开启验收单,保存验收单信息
        /// </summary>
        /// <param name="billInfo"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool SaveJhBillInfo(DBJhBillInfo billInfo, out string msg)
        {
            int i;

            if (!DBTool.ExecSql(" Delete From tJhBillInfo ", out i, out msg))
            {
                return(false);
            }
            return(DBTool.Insert(billInfo, out i, out msg));
        }
Beispiel #3
0
        /// <summary>
        /// 插入验收单明细
        /// </summary>
        /// <param name="bill"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool InsertBill(DBJhBill bill, out string msg)
        {
            int i;

            if (!GetMaxSerialNo(out i, out msg))
            {
                return(false);
            }

            bill.SerialNo = ++i;
            bill.ID       = Guid.NewGuid();
            return(DBTool.Insert(bill, out i, out msg));
        }
Beispiel #4
0
        /// <summary>
        /// 保存当前流水号
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="no"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool SaveNextNo <T>(int no, out string msg)
        {
            string   ObjName = typeof(T).Name;
            DBNextNo nextNo  = new DBNextNo();

            nextNo.ObjName  = ObjName;
            nextNo.LastDate = DateTime.Today;
            nextNo.LastNo   = no;
            int i;

            DBTool.Delete(nextNo, out i, out msg);
            return(DBTool.Insert(nextNo, out i, out msg));
        }
Beispiel #5
0
        /// <summary>
        /// 插入采购单
        /// </summary>
        /// <param name="CgBill">采购单</param>
        /// <param name="msg">返回的消息</param>
        /// <returns>是否成功</returns>
        public static bool AddBill(List <TRFQueryCgBill> CgBill, out string msg)
        {
            int i;

            if (!RemoveJhBill(out msg))
            {
                msg = "移除验收单失败:" + msg;
                return(false);
            }
            SQLiteTransaction tran;

            if (!DBTool.BeginTransaction(out tran, out msg))
            {
                return(false);
            }
            foreach (TRFQueryCgBill bill in CgBill)
            {
                DBJhBill DBBill = new DBJhBill();
                DBBill.ID          = Guid.NewGuid();
                DBBill.Barcode     = bill.BARCODE;
                DBBill.BillNo      = string.Empty;
                DBBill.CgCount     = decimal.Parse(bill.CGCOUNT);
                DBBill.Checked     = "N";
                DBBill.LrDate      = DateTime.Now;
                DBBill.LrUser      = PubGlobal.User.UserCode;
                DBBill.CgPackCount = decimal.Parse(bill.PACKCOUNT);
                DBBill.PackQty     = decimal.Parse(bill.PACKQTY);
                DBBill.PackUnit    = bill.PACKUNIT;
                DBBill.PluCode     = bill.PLUCODE;
                DBBill.PluID       = bill.PLUID;
                DBBill.PluName     = bill.PLUNAME;
                DBBill.ToSerialNo  = int.Parse(bill.SERIALNO);
                DBBill.SerialNo    = 0;
                DBBill.CgSGLCount  = decimal.Parse(bill.SGLCOUNT);
                DBBill.Spec        = bill.SPEC;
                DBBill.SsCount     = 0;
                DBBill.Unit        = bill.UNIT;
                if (!DBTool.Insert(DBBill, tran, out i, out msg))
                {
                    DBTool.RollbackTransaction(tran, out msg);
                    msg = "存储采购单失败。";
                    return(false);
                }
            }
            return(DBTool.CommitTransaction(tran, out msg));
        }