WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 
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);
 
        }
    }
}