Esempio n. 1
0
        public static string GetSerialNo(SerialNoType type)
        {
            var cmd = CommandHelper.CreateProcedure(FetchType.Scalar, "sp_GetSerialNo");

            cmd.Params.Add(CommandHelper.CreateParam("@id", type.ToString()));
            return(DbContext.GetInstance().Execute(cmd).Tag as string);
        }
Esempio n. 2
0
        /// <summary>
        /// 创建下一单序列号(序列号固定5位数):
        /// 订单类型+前缀+当前时间戳+(序列号+1)
        /// </summary>
        /// <param name="type">订单类型</param>
        /// <param name="infix">前缀</param>
        /// <param name="num">序列号</param>
        /// <param name="format">时间戳格式</param>
        /// <returns></returns>
        public static string CreateNextSeriesNum(SerialNoType type, string infix, int num = 0, string format = "yyMMdd")
        {
            var key    = type.ToDescription();
            var date   = DateTime.Now.Date.ToString(format);
            var prefix = key + infix + date;

            return(prefix + (num + 1).ToString("00000"));
        }
Esempio n. 3
0
        public string GenerateSerialNo(SerialNoType type, Guid actedBy)
        {
            var item = GetItemByType((int)type);

            item.Count++;
            Save(item, actedBy);

            return(item.GetNo());
        }
Esempio n. 4
0
        /// <summary>
        /// 生成顺序号
        /// </summary>
        /// <param name="serialNoType"></param>
        /// <returns></returns>
        public string GetSerialNo(SerialNoType serialNoType)
        {
            try
            {
                SqlParameter[] parameters =
                {
                    new SqlParameter("@type", SqlDbType.Char, 2)
                };
                parameters[0].Value = Convert.ToInt32(serialNoType).ToString();

                ProcResultModel ret = SQLServerHelper.RunProcedureOutParamRetValue("uspWip_GetSerialNoProduce", parameters);
                if (ret.execResult > 0)
                {
                    return(ret.execResult.ToString());
                }
                throw new Exception("生成顺序号错误");
            }
            catch
            {
                throw;
            }
        }
Esempio n. 5
0
        public static string CreateWithInfix(SerialNoType type, string format = "yyMMddHHmmssffff", string infix = "")
        {
            var key = type.ToDescription();

            return(key + infix + TimeStampFactory.Create(key, format));
        }
Esempio n. 6
0
        public static string CreateIncrease(SerialNoType type, int max, int minLenth = 2)
        {
            var result = (max + 1).ToString();

            return(type.ToDescription() + result.PadLeft(minLenth, '0'));
        }
Esempio n. 7
0
        public static string CreateWithoutPrefix(SerialNoType type, string format = "yyMMddHHmmssffff")
        {
            var key = type.ToDescription();

            return(SLBId + TimeStampFactory.Create(key, format));
        }
Esempio n. 8
0
        public static string Create(SerialNoType type, string format = "yyMMddHHmmssffff", string suffix = "")
        {
            var key = type.ToDescription();

            return(key + SLBId + TimeStampFactory.Create(key, format) + suffix);
        }