username@email.com
2024-09-09 cc170291673472d3cda8d7ea77f6bd3a3b5dbb83
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
78
/***********************************************************************
 *            Project: baifenBinfa
 *        ProjectName: 百分兵法管理系统                               
 *                Web: http://chuanyin.com                     
 *             Author:                                        
 *              Email:                               
 *         CreateTime: 202403/02   
 *        Description: 暂无
 ***********************************************************************/
 
using System;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
 
namespace CoreCms.Net.Repository
{
    /// <summary>
    ///     提货单表 接口实现
    /// </summary>
    public class CoreCmsBillLadingRepository : BaseRepository<CoreCmsBillLading>, ICoreCmsBillLadingRepository
    {
        public CoreCmsBillLadingRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
        {
        }
 
 
        /// <summary>
        ///     添加提货单
        /// </summary>
        /// <returns></returns>
        public async Task<WebApiCallBack> AddData(string orderId, int storeId, string name, string mobile)
        {
            var jm = new WebApiCallBack();
 
            var model = new CoreCmsBillLading();
            model.id = GenerateId();
            model.orderId = orderId;
            model.storeId = storeId;
            model.name = name;
            model.mobile = mobile;
            model.clerkId = 0;
            model.status = false;
            model.createTime = DateTime.Now;
            model.isDel = false;
 
            //事物处理过程结束
            await DbClient.Insertable(model).ExecuteCommandAsync();
            jm.code = 0;
            jm.msg = "添加成功";
 
            return jm;
        }
 
 
        /// <summary>
        ///     生成唯一提货单号
        /// </summary>
        /// <returns></returns>
        private string GenerateId()
        {
            bool bl;
            string id;
            do
            {
                id = CommonHelper.GetSerialNumberType((int) GlobalEnumVars.SerialNumberType.提货单号);
                var id1 = id;
                bl = DbClient.Queryable<CoreCmsBillLading>().Any(p => p.id == id1);
            } while (bl);
 
            return id;
        }
    }
}