zoukankan      html  css  js  c++  java
  • c#生成连续单号

    bill.BillCode = GetBillCode("JH");//生成单号
    if (bill.BillCode == "no")
    {
    bill.BillCode = GetBillCode("JH");//再次生成单号
    }

    /// <summary>
    /// 生成单号
    /// </summary>
    /// <returns></returns>
    public string GetBillCode(string head)
    {
    string res = "";
    try
    {
    string temp = DateTime.Now.ToString("yyyyMM");//六位年月
    int totalCount;//没用
    string flowid;
    var lastbill = CurrentDal.LoadPageEntities(a => a.BillCode.Substring(2, 6) == temp, a => a.BillCode, 1, 1, false, out totalCount).FirstOrDefault();
    if (lastbill == null)
    {
    flowid = "00001";
    }
    else
    {
    flowid = string.Format("{0:00000}", (Convert.ToInt32(lastbill.BillCode.Substring(8, 5)) + 1));
    }
    res = head + temp + flowid;
    }
    catch
    {
    res = "no";
    }
    return res;
    }

  • 相关阅读:
    Django 前后端数据传输、ajax、分页器
    项目分层
    The Jaisalmer Desert Festival 2017/2/9
    Slacklining 2017/2/7
    Slacklining 2017/2/6
    SnowKiting 2017/1/24
    ADO1
    SnowKiting
    CSS-学习笔记六
    D Vitamin
  • 原文地址:https://www.cnblogs.com/zhang-wenbin/p/7681325.html
Copyright © 2011-2022 走看看