using FreeSql;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.FreeDB;
namespace WIDESEA_Comm.TaskNo
{
public class IdenxManager
{
static FreeDB freeDB = new FreeDB();
private static object lock_obj = new object();
///
/// 获取任务编号
///
/// 标记头地址
/// 编号类型
///
public static string GetTaskNo(string first = "", string numType = "stacker")
{
lock (lock_obj)
{
var taskno = freeDB.DataBase.Ado.QuerySingle("select taskno from dt_task_num where numtype=@numtype", new { numType });
//堆垛机任务号处理
if (numType == "stacker")
{
//限制最小和最大值
if (taskno < 1000 || taskno >= 10000)
{
taskno = 1000;
}
else
{
taskno++;
}
}
freeDB.DataBase.Ado.ExecuteNonQuery("update dt_task_num set taskno=@taskno where numtype=@numtype", new { numType, taskno });
return first + taskno;
}
}
}
}