北京安通林JIS系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
1.5 KiB

using Gm_WMS.DataAccess.DataService;
using Stone.Common;
using Stone.Entity;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace Stone.WinBiz.SystemData
{
public class F_BillNo
{
public static string GetBillNo(LocalDBService db, string type, int len)
{
string sql = $"exec p_GetBillNo '{type}'";
int ret = Convert.ToInt32(db.Exec_Object(sql));
return ret.ToString().PadLeft(len, '0');
}
public static void CancelBillNo(LocalDBService db, string type)
{
Entity_t_BillNo t_BillNo = new Entity_t_BillNo(db);
DataTable dtBillNo = t_BillNo.GetData($"[type]='{type}'").Tables[0];
if(dtBillNo.Rows.Count > 0)
{
dtBillNo.Rows[0]["value"] = Convert.ToInt32(dtBillNo.Rows[0]["value"]) - 1;
if(Convert.ToInt32(dtBillNo.Rows[0]["value"]) <= 0)
{
t_BillNo.Del(dtBillNo.Rows[0]);
}
else
{
t_BillNo.Edit(dtBillNo.Rows[0]);
}
}
}
public static int GetID(LocalDBService db)
{
string year = MyDateTime.GetServerDateTime().Year.ToString();
year = year.Substring(2, 2); //取两位年
return Convert.ToInt32(year + GetBillNo(db, year, 5));
}
}
}