using JiepeiWMS.IServices; using JiepeiWMS.Model.Models; using JiepeiWMS.Services.BASE; using JiepeiWMS.IRepository.Base; using JiepeiWMS.IRepository; using System.Collections.Generic; using System.Threading.Tasks; using System; namespace JiepeiWMS.Services { public class WMPurchaseInfoServices : BaseServices, IWMPurchaseInfoServices { readonly IBaseRepository _dal; readonly IWMPurchaseInfoRepository _dalpur; readonly IBaseRepository _daluser; readonly IBaseRepository _daldepartment; readonly IBaseRepository _WMWareHouseRepository; /// /// 将多个仓储接口注入 /// /// public WMPurchaseInfoServices(IBaseRepository dal, IWMPurchaseInfoRepository dalpur, IBaseRepository UserInfoRepository, IBaseRepository DepartmentRepository, IBaseRepository WMWareHouseRepository ) { this._dal = dal; this._dalpur = dalpur; this._daluser = UserInfoRepository; this._daldepartment = DepartmentRepository; this._WMWareHouseRepository = WMWareHouseRepository; base.BaseDal = dal; } /// /// 采购多表联查 /// /// public async Task> QueryMuchTablePurchaseInfo() { return await _dalpur.QueryMuchTablePurchaseInfo(); } /// /// 获取最大的id /// /// public async Task GetMaxId() { var sql = string.Format(@"SELECT isnull( MAX(Id),0) FROM dbo.WMPurchaseInfo"); var ds = await BaseDal.QueryTableSet(sql.ToString()); return Convert.ToInt32(ds.Tables[0].Rows[0][0]); } /// /// 添加日志 /// /// 1:会员日志 2是后台业务日志 /// /// /// /// public int AddLog(int type, int adminId, int orderId, string content) { var sql = string.Format(@"INSERT INTO dbo.WMPurchaseInfoLog (type,AdminId,OrderId,Content,CreateTime)VALUES({0},{1},{2},'{3}','{4}')", type, adminId, orderId, content, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); return BaseDal.ExecuteSqlCommand(sql); } } }