EAS 最大单据号获取
BaseService
using System; using System.Collections.Generic; using System.Linq; using System.Text; using EAS.Data.Access; namespace Drug.BLL { public class ContextDataAccessor { public static EAS.Data.Access.IDataAccessor DataAccessor { get { return EAS.Context.ContextHelper.GetContext().Container.GetComponentInstance("DataAccessor") as EAS.Data.Access.IDataAccessor; } } public static string IndetitySQL { get { StringBuilder sql = new StringBuilder(); sql.Append(" update dbo.EAS_IDENTITYVALUES Set ITEMVALUE = ITEMVALUE + 1 where ITEMKEY = @ITEMKEY "); sql.Append(" select ITEMVALUE from dbo.EAS_IDENTITYVALUES where ITEMKEY = @ITEMKEY "); return sql.ToString(); } } } }
获取最大号接口
using System; namespace Drug.BLL { public interface IMaxID { int GetMaxID(string table); } }
获取最大号服务
using System; using System.Collections.Generic; using System.Linq; using System.Text; using EAS.Services; using EAS.Data.Access; using EAS.Transactions; namespace Drug.BLL { [ServiceBind(typeof(IMaxID))] public class MaxID : IMaxID { [Transaction(System.Transactions.IsolationLevel.Serializable)] public int GetMaxID(string itemKey) { ParameterCollection pc = new ParameterCollection(); pc.Add("ITEMKEY", itemKey); return (int)(ContextDataAccessor.DataAccessor.Query(ContextDataAccessor.IndetitySQL, pc)); } } }