|
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<WMPurchaseInfo>, IWMPurchaseInfoServices
|
{
|
readonly IBaseRepository<WMPurchaseInfo> _dal;
|
readonly IWMPurchaseInfoRepository _dalpur;
|
readonly IBaseRepository<sysUserInfo> _daluser;
|
readonly IBaseRepository<Department> _daldepartment;
|
readonly IBaseRepository<WMWareHouse> _WMWareHouseRepository;
|
/// <summary>
|
/// 将多个仓储接口注入
|
/// </summary>
|
/// <param name="dal"></param>
|
public WMPurchaseInfoServices(IBaseRepository<WMPurchaseInfo> dal,
|
IWMPurchaseInfoRepository dalpur,
|
IBaseRepository<sysUserInfo> UserInfoRepository,
|
IBaseRepository<Department> DepartmentRepository,
|
IBaseRepository<WMWareHouse> WMWareHouseRepository
|
)
|
{
|
this._dal = dal;
|
this._dalpur = dalpur;
|
this._daluser = UserInfoRepository;
|
this._daldepartment = DepartmentRepository;
|
this._WMWareHouseRepository = WMWareHouseRepository;
|
base.BaseDal = dal;
|
}
|
/// <summary>
|
/// 采购多表联查
|
/// </summary>
|
/// <returns></returns>
|
public async Task<List<WMPurchaseInfo>> QueryMuchTablePurchaseInfo()
|
{
|
return await _dalpur.QueryMuchTablePurchaseInfo();
|
}
|
|
/// <summary>
|
/// 获取最大的id
|
/// </summary>
|
/// <returns></returns>
|
public async Task<int> 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]);
|
}
|
|
/// <summary>
|
/// 添加日志
|
/// </summary>
|
/// <param name="type">1:会员日志 2是后台业务日志 </param>
|
/// <param name="adminId"></param>
|
/// <param name="orderId"></param>
|
/// <param name="content"></param>
|
/// <returns></returns>
|
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);
|
|
}
|
}
|
}
|