Browse Source

Merge branch 'master' of http://192.168.1.222:3000/zhengbingbing/ZLJ_API_V6.0

zhengbingbing 5 years ago
parent
commit
a24a1cbd06

BIN
代码/.vs/TVShoppingCallCenter_ZLJ/DesignTimeBuild/.dtbcache.v2


BIN
代码/.vs/TVShoppingCallCenter_ZLJ/v16/.suo


+ 1 - 1
代码/System.Model/T_Bus_ProductClass.cs

@@ -30,7 +30,7 @@ namespace System.Model
30 30
 		/// <summary>
31 31
 		/// 上级分类 0顶级
32 32
 		/// </summary>
33
-		public int? F_parentId
33
+		public int? F_ParentId
34 34
 		{
35 35
 			set { _f_parentid = value; }
36 36
 			get { return _f_parentid; }

+ 38 - 45
代码/TVShoppingCallCenter_ZLJ/Controllers/Product/ProductController.cs

@@ -55,24 +55,25 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
55 55
             #region 验证 参数
56 56
 
57 57
 
58
-            if (string.IsNullOrEmpty(input.F_ClassName))
58
+            if (string.IsNullOrEmpty(input.ClassName))
59 59
                 return Error("请输入分类名称");
60
-            if (string.IsNullOrEmpty(input.F_ClassShortName))
60
+            if (string.IsNullOrEmpty(input.ClassShortName))
61 61
                 return Error("请输入分类简写");
62 62
 
63 63
             #endregion
64
-            Expression<Func<T_Bus_ProductClass, bool>> eq = a => a.F_ClassName == input.F_ClassName;
65
-            if (await _productClassRepository.GetCount(eq.Or(b => b.F_ClassShortName == input.F_ClassShortName)) > 0)
64
+            Expression<Func<T_Bus_ProductClass, bool>> eq = a => a.F_ClassName == input.ClassName;
65
+            if (await _productClassRepository.GetCount(eq.Or(b => b.F_ClassShortName == input.ClassShortName)) > 0)
66 66
             {
67 67
                 return Error("分类/简写名称重复");
68 68
             }
69 69
             T_Bus_ProductClass T_Bus_ProductClassModel = new T_Bus_ProductClass();
70
-            if (input.F_ClassId != 0)
71
-                T_Bus_ProductClassModel.F_ClassId = input.F_ClassId;
70
+            if (input.ClassId != 0)
71
+                T_Bus_ProductClassModel.F_ClassId = input.ClassId;
72 72
 
73
-            T_Bus_ProductClassModel.F_ClassShortName = input.F_ClassShortName;
74
-            T_Bus_ProductClassModel.F_parentId = input.F_parentId;
75
-            T_Bus_ProductClassModel.F_ClassName = input.F_ClassName;
73
+            T_Bus_ProductClassModel.F_ClassShortName = input.ClassShortName;
74
+            T_Bus_ProductClassModel.F_ParentId = input.ParentId;
75
+            T_Bus_ProductClassModel.F_Sort = 10000;
76
+            T_Bus_ProductClassModel.F_ClassName = input.ClassName;
76 77
             T_Bus_ProductClassModel.F_UserName = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name).Value;
77 78
             T_Bus_ProductClassModel.F_UserId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
78 79
 
@@ -100,18 +101,18 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
100 101
             #region 验证 参数
101 102
 
102 103
 
103
-            if (string.IsNullOrEmpty(input.F_ClassName))
104
+            if (string.IsNullOrEmpty(input.ClassName))
104 105
                 return Error("请输入分类名称");
105
-            if (string.IsNullOrEmpty(input.F_ClassShortName))
106
+            if (string.IsNullOrEmpty(input.ClassShortName))
106 107
                 return Error("请输入分类简写");
107
-            if (input.F_ClassId <= 0)
108
+            if (input.ClassId <= 0)
108 109
                 return Error("缺少参数");
109 110
             #endregion
110
-            T_Bus_ProductClass T_Bus_ProductClassModel = await _productClassRepository.GetSingle(a => a.F_ClassId == input.F_ClassId);
111
+            T_Bus_ProductClass T_Bus_ProductClassModel = await _productClassRepository.GetSingle(a => a.F_ClassId == input.ClassId);
112
+
113
+            T_Bus_ProductClassModel.F_ClassName = input.ClassName;
114
+            T_Bus_ProductClassModel.F_ClassShortName = input.ClassShortName;
111 115
 
112
-            T_Bus_ProductClassModel.F_ClassName = input.F_ClassName;
113
-            T_Bus_ProductClassModel.F_ClassShortName = input.F_ClassShortName;
114
-            T_Bus_ProductClassModel.F_parentId = input.F_parentId;
115 116
 
116 117
             T_Bus_ProductClassModel.F_UserName = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Name).Value;
117 118
             T_Bus_ProductClassModel.F_UserId = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.PrimarySid).Value, 0);
@@ -119,11 +120,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
119 120
 
120 121
             if (await _productClassRepository.Update(T_Bus_ProductClassModel))
121 122
             {
122
-                return Success("新增商品分类成功");
123
+                return Success("保存商品分类成功");
123 124
             }
124 125
             else
125 126
             {
126
-                return Error("新增分类失败,请重试!");
127
+                return Error("保存分类失败,请重试!");
127 128
             }
128 129
         }
129 130
 
@@ -162,33 +163,28 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
162 163
         public async Task<IActionResult> ProductClassList(ProductClassInput input)
163 164
         {
164 165
 
165
-            #region 验证 参数
166
-
167
-            if (input.F_ClassId <= 0)
168
-                return Error("缺少参数");
169
-            #endregion
170 166
 
171 167
 
172 168
             #region  拼接条件
173 169
 
174 170
             Expression<Func<T_Bus_ProductClass, bool>> eq = a => a.F_ClassId > 0;
175 171
 
176
-            if (input.F_ClassId > 0)
177
-                eq = eq.And(a => a.F_ClassId == input.F_ClassId);
178
-            if (!string.IsNullOrEmpty(input.F_ClassName))
172
+            if (input.ClassId > 0)
173
+                eq = eq.And(a => a.F_ClassId == input.ClassId);
174
+            if (!string.IsNullOrEmpty(input.ClassName))
179 175
             {
180
-                eq = eq.And(a => a.F_ClassName.Contains(input.F_ClassName));
181
-                // eq.Or(a => a.F_ClassShortName.Contains(input.F_ClassName));
176
+                eq = eq.And(a => a.F_ClassName.Contains(input.ClassName));
182 177
             }
183
-            if (input.F_parentId > 0)
178
+            if (!string.IsNullOrEmpty(input.ClassShortName))
184 179
             {
185
-                eq = eq.And(a => a.F_parentId == input.F_parentId);
180
+                eq = eq.And(a => a.F_ClassShortName.Contains(input.ClassShortName));
186 181
             }
187
-            if (input.F_parentId == -1)
182
+            if (input.ParentId >= 0)
188 183
             {
189
-                eq = eq.And(a => a.F_parentId == 0);
184
+                eq = eq.And(a => a.F_ParentId == input.ParentId);
190 185
             }
191 186
 
187
+
192 188
             #endregion
193 189
 
194 190
 
@@ -436,7 +432,10 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
436 432
         {
437 433
 
438 434
             #region  拼接条件
439
-
435
+            if (input.Limit <= 0)
436
+            {
437
+                input.Limit = 100000;
438
+            }
440 439
             Expression<Func<T_Bus_Product, bool>> eq = a => a.F_IsDelete == 1;
441 440
 
442 441
             if (input.ClassId > 0)
@@ -486,7 +485,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
486 485
             #endregion
487 486
 
488 487
             RefAsync<int> count = 0;
489
-            var list = await _productRepository.GetListByPage(eq, new MyPageModel() { PageIndex = 1, PageSize = 20, PageCount = count });
488
+            var list = await _productRepository.GetListByPage(eq, new MyPageModel() { PageIndex = 1, PageSize = input.Limit, PageCount = count });
490 489
 
491 490
             return Success("成功", list);
492 491
 
@@ -558,14 +557,8 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
558 557
             #endregion
559 558
             int recordCount =0;
560 559
             var list = await _productRepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount });
561
-            var obj = new
562
-            {
563
-                state = "success",
564
-                message = "成功",
565
-                rows = list,
566
-                total=  recordCount
567
-            };
568
-            return Content(obj.ToJson());
560
+
561
+             return Success("成功", list);
569 562
         }
570 563
 
571 564
 
@@ -591,8 +584,8 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
591 584
             foreach (ProductInput m in input)
592 585
             {
593 586
                 // return Success(m.F_ProductId.ToString() + ":" + m.F_Stock.ToString());
594
-                if (!string.IsNullOrEmpty(m.ProductName))
595
-                    return Error("参数缺失产品名称");
587
+                //if (!string.IsNullOrEmpty(m.ProductName))
588
+                //    return Error("参数缺失产品名称");
596 589
                 if (m.ProductId <= 0)
597 590
                     return Error("参数缺失产品id");
598 591
                 if (m.Stock < 0)
@@ -606,7 +599,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
606 599
             }
607 600
 
608 601
             #endregion
609
-            //此字段更新单独字段优先
602
+            //此字段更新单独字段
610 603
             if (await _productRepository.UpdateListToColumns(listmodel, it => new { it.F_Stock }))
611 604
                 return Success("更新库存成功");
612 605
             else

+ 9 - 9
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/ProductClassInput.cs

@@ -21,7 +21,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
21 21
 		/// <summary>
22 22
 		/// 产品分类编号
23 23
 		/// </summary>
24
-		public int F_ClassId
24
+		public int ClassId
25 25
 		{
26 26
 			set { _f_classid = value; }
27 27
 			get { return _f_classid; }
@@ -29,7 +29,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
29 29
 		/// <summary>
30 30
 		/// 上级分类 0顶级
31 31
 		/// </summary>
32
-		public int? F_parentId
32
+		public int? ParentId
33 33
 		{
34 34
 			set { _f_parentid = value; }
35 35
 			get { return _f_parentid; }
@@ -37,7 +37,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
37 37
 		/// <summary>
38 38
 		/// 产品分类名称
39 39
 		/// </summary>
40
-		public string F_ClassName
40
+		public string ClassName
41 41
 		{
42 42
 			set { _f_classname = value; }
43 43
 			get { return _f_classname; }
@@ -45,7 +45,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
45 45
 		/// <summary>
46 46
 		/// 产品分类简称/代码
47 47
 		/// </summary>
48
-		public string F_ClassShortName
48
+		public string ClassShortName
49 49
 		{
50 50
 			set { _f_classshortname = value; }
51 51
 			get { return _f_classshortname; }
@@ -53,7 +53,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
53 53
 		/// <summary>
54 54
 		/// 添加时间
55 55
 		/// </summary>
56
-		public DateTime? F_Addtime
56
+		public DateTime? Addtime
57 57
 		{
58 58
 			set { _f_addtime = value; }
59 59
 			get { return _f_addtime; }
@@ -61,7 +61,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
61 61
 		/// <summary>
62 62
 		/// 操作员
63 63
 		/// </summary>
64
-		public string F_UserName
64
+		public string UserName
65 65
 		{
66 66
 			set { _f_username = value; }
67 67
 			get { return _f_username; }
@@ -69,7 +69,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
69 69
 		/// <summary>
70 70
 		/// 最后更新时间
71 71
 		/// </summary>
72
-		public DateTime? F_UpdateTime
72
+		public DateTime? UpdateTime
73 73
 		{
74 74
 			set { _f_updatetime = value; }
75 75
 			get { return _f_updatetime; }
@@ -77,7 +77,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
77 77
 		/// <summary>
78 78
 		/// 操作员id
79 79
 		/// </summary>
80
-		public int? F_UserId
80
+		public int? UserId
81 81
 		{
82 82
 			set { _f_userid = value; }
83 83
 			get { return _f_userid; }
@@ -85,7 +85,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
85 85
 		/// <summary>
86 86
 		/// 排序
87 87
 		/// </summary>
88
-		public int? F_Sort
88
+		public int? Sort
89 89
 		{
90 90
 			set { _f_sort = value; }
91 91
 			get { return _f_sort; }

+ 6 - 3
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/ProductInput.cs

@@ -41,7 +41,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
41 41
         private int _f_sort;
42 42
         private DateTime? _f_laststockupdate;
43 43
         private int _f_stock = 0;
44
-
44
+        private int _limit = 0;
45 45
         /// <summary>
46 46
         /// 产品编号ID
47 47
         /// </summary>
@@ -50,8 +50,11 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
50 50
             set { _f_productid = value; }
51 51
             get { return _f_productid; }
52 52
         }
53
-        public int Top
54
-        { set; get; }
53
+        public int Limit
54
+        {
55
+            set { _limit = value; }
56
+            get { return _limit; }
57
+        }
55 58
         /// <summary>
56 59
         /// 产品条形码
57 60
         /// </summary>