zhangkun лет назад: 5
Родитель
Сommit
81270340df

+ 33 - 32
代码/TVShoppingCallCenter_ZLJ/Controllers/Product/ProductController.cs

@@ -1,7 +1,7 @@
1 1
 /* =============================================
2 2
 -- Author:		<Author,,zhangkun>
3 3
 -- Create date: <Create Date,,20200609>
4
+-- Description:	<Description,,商品 库存 商品类别相关操作)>
4 5
 -- ============================================*/
5 6
 using System;
6 7
 using System.Collections.Generic;
@@ -52,7 +52,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
52 52
                 Message = "访问信息"
53 53
             });
54 54
         }
55
-        #region 品分类
55
+        #region 品分类
56 56
 
57 57
         /// <summary>
58 58
         /// 新增商品分类
@@ -158,7 +158,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
158 158
             if (ids.Replace(",", "") == "")
159 159
                 return Error("请输入删除id");
160 160
 
161
-            //删除的时候  分类下有商品怎么处理  暂未处理  后续根据需求处理  可以指定规则,分类下没有品才可以删除
161
+            //删除的时候  分类下有商品怎么处理  暂未处理  后续根据需求处理  可以指定规则,分类下没有品才可以删除
162 162
             if (await _productClassRepository.Delete(a => ids.Contains("," + a.F_ClassId.ToString() + ",")))
163 163
             {
164 164
                 return Success("删除商品分类成功");
@@ -211,13 +211,13 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
211 211
                 treeModel.code = item.F_ClassShortName;
212 212
                 treeList.Add(treeModel);
213 213
             }
214
-            return Success("获取品分类树成功", treeList.TreeRecursion(0));
214
+            return Success("获取品分类树成功", treeList.TreeRecursion(0));
215 215
         }
216 216
 
217 217
 
218 218
         #endregion
219 219
 
220
-        #region 品操作
220
+        #region 品操作
221 221
 
222 222
         /// <summary>
223 223
         /// 导入商品
@@ -265,7 +265,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
265 265
                         }
266 266
                         if (Products[i].ProductShortName == Products[j].ProductShortName)
267 267
                         {
268
-                            return Error(Products[i].ProductId + "标题 有重复:" + Products[j].ProductId);
268
+                            return Error(Products[i].ProductId + "商品副标题 有重复:" + Products[j].ProductId);
269 269
                         }
270 270
                     }
271 271
 
@@ -279,17 +279,17 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
279 279
 
280 280
                     if (await _productRepository.GetCount(eq) > 0)
281 281
                     {
282
-                        return Error("品名称有重复:" + input.ProductId);
282
+                        return Error("品名称有重复:" + input.ProductId);
283 283
                     }
284 284
                     eq = b => b.F_ProductId == input.ProductId;
285 285
                     if (await _productRepository.GetCount(eq) > 0)
286 286
                     {
287
-                        return Error("品ID有重复:" + input.ProductId);
287
+                        return Error("品ID有重复:" + input.ProductId);
288 288
                     }
289 289
                     eq = b => b.F_ProductShortName == input.ProductShortName;
290 290
                     if (await _productRepository.GetCount(eq) > 0)
291 291
                     {
292
-                        return Error("标题有重复:" + input.ProductId);
292
+                        return Error("商品副标题有重复:" + input.ProductId);
293 293
                     }
294 294
                     input.IsDelete = 0;
295 295
                     if(!string.IsNullOrEmpty(input.ProductId))
@@ -310,7 +310,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
310 310
 
311 311
 
312 312
         /// <summary>
313
-        /// 新增商品 库存只通过两种方式变动 1 (我们下订单后,对方库存发别的地儿)对方库存变动回调我们,我们更新相关品库存  2  我们定时去拿库存统一更新
313
+        /// 新增商品 库存只通过两种方式变动 1 (我们下订单后,对方库存发别的地儿)对方库存变动回调我们,我们更新相关品库存  2  我们定时去拿库存统一更新
314 314
         /// </summary>
315 315
         /// <param name="input"></param>
316 316
         /// <returns></returns>
@@ -323,11 +323,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
323 323
             if (input.ClassId == 0)
324 324
                 return Error("请选择分类名称");
325 325
             if (string.IsNullOrEmpty(input.ProductName))
326
-                return Error("请输入品名称");
326
+                return Error("请输入品名称");
327 327
             if (string.IsNullOrEmpty(input.ProductShortName))
328
-                return Error("请输入品简写");
328
+                return Error("请输入品简写");
329 329
             if (string.IsNullOrEmpty(input.ProductNumber))
330
-                return Error("请输入品款号");
330
+                return Error("请输入品款号");
331 331
             if (string.IsNullOrEmpty(input.ClassName))
332 332
                 return Error("请选择分类名称");
333 333
             if (input.MarketPrice <= 0)
@@ -337,21 +337,21 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
337 337
             if (input.SpecialPrice <= 0)
338 338
                 return Error("请输入正确特惠价");
339 339
             if (string.IsNullOrEmpty(input.ProductId))
340
-                return Error("请输入正确品编码");
340
+                return Error("请输入正确品编码");
341 341
 
342 342
             #endregion
343 343
 
344 344
             if (await _productRepository.GetCount(a => a.F_ProductName == input.ProductName) > 0)
345 345
             {
346
-                return Error("品名称 有重复");
346
+                return Error("品名称 有重复");
347 347
             }
348 348
             if (await _productRepository.GetCount(b => b.F_ProductId == input.ProductId) > 0)
349 349
             {
350
-                return Error("品ID 有重复");
350
+                return Error("品ID 有重复");
351 351
             }
352 352
             if (await _productRepository.GetCount(b => b.F_ProductShortName == input.ProductShortName) > 0)
353 353
             {
354
-                return Error("品副标题 有重复");
354
+                return Error("品副标题 有重复");
355 355
             }
356 356
             if (!string.IsNullOrEmpty(input.Tag))
357 357
             {
@@ -430,7 +430,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
430 430
         }
431 431
 
432 432
         /// <summary>
433
-        /// 修改商品 库存只通过两种方式变动 1 (我们下订单后,对方库存发别的地儿)对方库存变动回调我们,我们更新相关品库存  2  我们定时去拿库存统一更新
433
+        /// 修改商品 库存只通过两种方式变动 1 (我们下订单后,对方库存发别的地儿)对方库存变动回调我们,我们更新相关品库存  2  我们定时去拿库存统一更新
434 434
         /// </summary>
435 435
         /// <param name="input"></param>
436 436
         /// <returns></returns>
@@ -443,11 +443,11 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
443 443
             if (input.ClassId == 0)
444 444
                 return Error("请选择分类名称");
445 445
             if (string.IsNullOrEmpty(input.ProductName))
446
-                return Error("请输入品名称");
446
+                return Error("请输入品名称");
447 447
             if (string.IsNullOrEmpty(input.ProductShortName))
448
-                return Error("请输入品简写");
448
+                return Error("请输入品简写");
449 449
             if (string.IsNullOrEmpty(input.ProductNumber))
450
-                return Error("请输入品条形码");
450
+                return Error("请输入品条形码");
451 451
             if (string.IsNullOrEmpty(input.ClassName))
452 452
                 return Error("请选择分类名称");
453 453
             if (input.MarketPrice <= 0)
@@ -457,7 +457,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
457 457
             if (input.SpecialPrice <= 0)
458 458
                 return Error("请输入正确特惠价");
459 459
             if (string.IsNullOrEmpty(input.ProductId))
460
-                return Error("品ID不能为空");
460
+                return Error("品ID不能为空");
461 461
             if (string.IsNullOrEmpty(input.PinyinShort))
462 462
                 return Error("请输入正确拼音简码");
463 463
             #endregion
@@ -478,15 +478,15 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
478 478
                 List<T_Bus_Product> T_Bus_ProductModelSearch = await _productRepository.GetListALL(eq);
479 479
                 if (T_Bus_ProductModelSearch.Count > 1)
480 480
                 {
481
-                    if (n == 1) { return Error("品名称 有重复"); }
482
-                    else if (n == 2) { return Error("品ID 有重复"); }
483
-                    else if (n == 3) { return Error("副标题/标题 有重复"); }
481
+                    if (n == 1) { return Error("品名称 有重复"); }
482
+                    else if (n == 2) { return Error("品ID 有重复"); }
483
+                    else if (n == 3) { return Error("副标题/商品副标题 有重复"); }
484 484
                 }
485 485
                 if (T_Bus_ProductModelSearch.Count == 1 && T_Bus_ProductModelSearch[0].F_ProductId != input.ProductId)
486 486
                 {
487
-                    if (n == 1) { return Error("品名称 有重复"); }
488
-                    else if (n == 2) { return Error("品ID 有重复"); }
489
-                    else if (n == 3) { return Error("副标题/标题 有重复"); }
487
+                    if (n == 1) { return Error("品名称 有重复"); }
488
+                    else if (n == 2) { return Error("品ID 有重复"); }
489
+                    else if (n == 3) { return Error("副标题/商品副标题 有重复"); }
490 490
                 }
491 491
                 n++;
492 492
             }
@@ -609,7 +609,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
609 609
                 eq = eq.And(a => a.F_ClassName.Contains(input.ClassName));
610 610
                 // eq.Or(a => a.F_ClassShortName.Contains(input.F_ClassName));
611 611
             }
612
-            //品名/标题
612
+            //品名/标题
613 613
             if (!string.IsNullOrEmpty(input.ProductName))
614 614
             {
615 615
                 eq = eq.And(a => a.F_ProductName.Contains(input.ProductName));
@@ -699,7 +699,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
699 699
 
700 700
         }
701 701
         /// <summary>
702
-        /// 分页获取品列表
702
+        /// 分页获取品列表
703 703
         /// </summary>
704 704
         /// <param name="input">筛选字段</param>
705 705
         /// <returns></returns>
@@ -727,7 +727,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
727 727
                 conModels.Add(new ConditionalModel() { FieldName = "F_ClassId", ConditionalType = ConditionalType.Equal, FieldValue = input.ClassId.ToString() });
728 728
             }
729 729
 
730
-            //品名/标题
730
+            //品名/标题
731 731
             if (!string.IsNullOrEmpty(input.ProductName))
732 732
             {
733 733
                 conModels.Add(new ConditionalModel() { FieldName = "F_ProductName", ConditionalType = ConditionalType.Like, FieldValue = input.ProductName });
@@ -821,7 +821,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
821 821
         /// <summary>
822 822
         /// 更新库存(对方库存变化  入库 出库 时做更新)  订单发货时,对面库存 出库要对应订单,以便跟踪
823 823
         /// </summary>
824
-        /// <param name="input">目前暂定Id唯一标识更新如果不方便可以以F_ProductName,如果那边更好操作,顺序上这边先有品的话可以以id操作,或者以条形码操作</param>
824
+        /// <param name="input">目前暂定Id唯一标识更新如果不方便可以以F_ProductName,如果那边更好操作,顺序上这边先有品的话可以以id操作,或者以条形码操作</param>
825 825
         /// 基类BaseController继承的不是[ApiController],也没有加[ApiController]头标  所以用到json序列化传值 和测试工具raw传值必须加[FromBody]
826 826
         /// <returns></returns>
827 827
         [HttpPost("updatestock")]
@@ -836,7 +836,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
836 836
             foreach (ProductInput m in input)
837 837
             {
838 838
                 if (string.IsNullOrEmpty(m.ProductId))
839
-                    return Error("参数缺失品id");
839
+                    return Error("参数缺失品id");
840 840
 
841 841
                 T_Bus_Product model = await _productRepository.GetSingle(a => a.F_ProductId == m.ProductId);
842 842