Kaynağa Gözat

提交数据展示形式

zhangkun 5 yıl önce
ebeveyn
işleme
7c34342ecb

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


+ 110 - 16
代码/TVShoppingCallCenter_ZLJ/Controllers/Product/ProductController.cs

@@ -1,8 +1,8 @@
1
-//————————————
2
-//des:产品管理类
3
-//author:zhangkun
4
-//addtime:2020-06-10
5
-//————————————
1
+/* =============================================
2
+-- Author:		<Author,,zhangkun>
3
+-- Create date: <Create Date,,20200609>
4
+-- Description:	<Description,,产品 库存 产品类别相关操作)>
5
+-- ============================================*/
6 6
 using System;
7 7
 using System.Collections.Generic;
8 8
 using System.Common;
@@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Authorization;
16 16
 using Microsoft.AspNetCore.Http;
17 17
 using Microsoft.AspNetCore.Mvc;
18 18
 using SqlSugar;
19
+using TVShoppingCallCenter_ZLJ.Models.Dtos;
19 20
 using TVShoppingCallCenter_ZLJ.Models.Inputs;
20 21
 
21 22
 namespace TVShoppingCallCenter_ZLJ.Controllers.Product
@@ -314,7 +315,7 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
314 315
             if (input.SpecialPrice <= 0)
315 316
                 return Error("请输入正确特惠价");
316 317
             if (input.ProductId <= 0)
317
-                return Error("产品ID不能修改");
318
+                return Error("产品ID必须大于0");
318 319
             if (string.IsNullOrEmpty(input.PinyinShort))
319 320
                 return Error("请输入正确拼音简码");
320 321
             #endregion
@@ -324,6 +325,22 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
324 325
             if (T_Bus_ProductModel == null)
325 326
                 return Error("如需新添加,请点击新增按钮,此记录不存在");
326 327
 
328
+            //此处如果id可修改,则输入新ID 修改重复条件
329
+            Expression<Func<T_Bus_Product, bool>> eq = a => a.F_ProductName == input.ProductName;
330
+            eq = eq.Or(b => b.F_PinyinShort == input.PinyinShort);
331
+            eq = eq.Or(b => b.F_ProductId == input.ProductId);
332
+            eq = eq.Or(b => b.F_ProductShortName == input.ProductShortName);
333
+            List<T_Bus_Product> T_Bus_ProductModelSearch = await _productRepository.GetListALL(eq);
334
+            if (T_Bus_ProductModelSearch.Count > 1)
335
+            {
336
+                return Error("名称/条形码/简称 有重复");
337
+            }
338
+            if (T_Bus_ProductModelSearch.Count == 1)
339
+            { 
340
+                if(T_Bus_ProductModelSearch[0].F_ProductId!= input.ProductId)
341
+                    return Error("名称/条形码/简称 有重复");
342
+            }
343
+
327 344
             T_Bus_ProductModel.F_ProductName = input.ProductName;
328 345
             T_Bus_ProductModel.F_ProductShortName = input.ProductShortName;
329 346
             T_Bus_ProductModel.F_ProductNumber = input.ProductNumber;
@@ -487,6 +504,47 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
487 504
             RefAsync<int> count = 0;
488 505
             var list = await _productRepository.GetListByPage(eq, new MyPageModel() { PageIndex = 1, PageSize = input.Limit, PageCount = count });
489 506
 
507
+            //如果需要转换内容,则启用
508
+            //List<ProductDto> pageDtoList = new List<ProductDto>();
509
+            //if (list != null)
510
+            //{
511
+            //    foreach (T_Bus_Product a in list.Rows)
512
+            //    {
513
+            //        ProductDto modelDto = new ProductDto();
514
+            //        modelDto.F_Address = a.F_Address;
515
+            //        modelDto.F_ProductId = a.F_ProductId;
516
+            //        modelDto.F_ProductName = a.F_ProductName;
517
+            //        modelDto.F_ProductShortName = a.F_ProductShortName;
518
+            //        modelDto.F_ProductNumber = a.F_ProductNumber;
519
+            //        modelDto.F_PinyinShort = a.F_PinyinShort;
520
+
521
+            //        modelDto.F_ClassId = a.F_ClassId;
522
+            //        modelDto.F_ClassName = a.F_ClassName;
523
+
524
+
525
+            //        modelDto.F_MarketPrice = a.F_MarketPrice;
526
+            //        modelDto.F_MemberPrice = a.F_MemberPrice;
527
+            //        modelDto.F_SpecialPrice = a.F_SpecialPrice;
528
+            //        modelDto.F_Integral = a.F_Integral;
529
+
530
+            //        modelDto.F_Address = a.F_Address;
531
+            //        modelDto.F_Des = a.F_Des;
532
+            //        modelDto.F_Factory = a.F_Factory;
533
+            //        modelDto.F_Supplier = a.F_Supplier;
534
+            //        modelDto.F_IsDelete = a.F_IsDelete;
535
+            //        modelDto.F_Tag = a.F_Tag;
536
+            //        modelDto.F_Sort = a.F_Sort;
537
+            //        modelDto.F_Weight = a.F_Weight;
538
+            //        if (input.OnSaleBegin != null)
539
+            //        { modelDto.F_OnSaleBegin = a.F_OnSaleBegin; }
540
+            //        if (input.OnSaleEnd != null)
541
+            //        { modelDto.F_OnSaleEnd = a.F_OnSaleEnd; }
542
+            //        pageDtoList.Add(modelDto);
543
+            //    }
544
+            //}
545
+            //PageData<ProductDto> pageData = new PageData<ProductDto>();
546
+            //pageData.Totals = list.Totals;
547
+            //pageData.Rows = pageDtoList;
490 548
             return Success("成功", list);
491 549
 
492 550
         }
@@ -494,12 +552,12 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
494 552
         /// 分页获取产品列表
495 553
         /// </summary>
496 554
         /// <param name="input">筛选字段</param>
497
-        /// <param name="pagesize"></param>
498
-        /// <param name="pageindex"></param>
499 555
         /// <returns></returns>
500 556
         [HttpPost("getlistbypage")]
501
-        public async Task<IActionResult> GetListByPage([FromBody]ProductInput input, int pagesize, int pageindex)
557
+        public async Task<IActionResult> GetListByPage([FromBody]ProductInput input)
502 558
         {
559
+            int pageindex = input.pageindex;
560
+            int pagesize = input.pagesize;
503 561
             List<IConditionalModel> conModels = new List<IConditionalModel>();
504 562
             #region 条件筛选
505 563
 
@@ -516,11 +574,6 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
516 574
                 conModels.Add(new ConditionalModel() { FieldName = "F_ClassId", ConditionalType = ConditionalType.Equal, FieldValue = input.ClassId.ToString() });
517 575
             }
518 576
 
519
-            if (!string.IsNullOrEmpty(input.ClassName))
520
-            {
521
-                conModels.Add(new ConditionalModel() { FieldName = "F_ClassName", ConditionalType = ConditionalType.Like, FieldValue = input.ClassName });
522
-
523
-            }
524 577
             //产品名/标题
525 578
             if (!string.IsNullOrEmpty(input.ProductName))
526 579
             {
@@ -556,8 +609,49 @@ namespace TVShoppingCallCenter_ZLJ.Controllers.Product
556 609
 
557 610
             #endregion
558 611
             int recordCount =0;
559
-            var list = await _productRepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount });
560
-
612
+            var list = await _productRepository.GetListByPage(conModels, new MyPageModel() { PageIndex = pageindex, PageSize = pagesize, PageCount = recordCount }, " F_Sort ASC");
613
+
614
+            //如果需要转换内容,则启用
615
+            //List<ProductDto> pageDtoList = new List<ProductDto>();
616
+            //if (list != null)
617
+            //{
618
+            //    foreach (T_Bus_Product a in list.Rows)
619
+            //    {
620
+            //        ProductDto modelDto = new ProductDto();
621
+            //        modelDto.F_Address = a.F_Address;
622
+            //        modelDto.F_ProductId = a.F_ProductId;
623
+            //        modelDto.F_ProductName = a.F_ProductName;
624
+            //        modelDto.F_ProductShortName = a.F_ProductShortName;
625
+            //        modelDto.F_ProductNumber = a.F_ProductNumber;
626
+            //        modelDto.F_PinyinShort = a.F_PinyinShort;
627
+
628
+            //        modelDto.F_ClassId = a.F_ClassId;
629
+            //        modelDto.F_ClassName = a.F_ClassName;
630
+
631
+
632
+            //        modelDto.F_MarketPrice = a.F_MarketPrice;
633
+            //        modelDto.F_MemberPrice = a.F_MemberPrice;
634
+            //        modelDto.F_SpecialPrice = a.F_SpecialPrice;
635
+            //        modelDto.F_Integral = a.F_Integral;
636
+
637
+            //        modelDto.F_Address = a.F_Address;
638
+            //        modelDto.F_Des = a.F_Des;
639
+            //        modelDto.F_Factory = a.F_Factory;
640
+            //        modelDto.F_Supplier = a.F_Supplier;
641
+            //        modelDto.F_IsDelete = a.F_IsDelete;
642
+            //        modelDto.F_Tag = a.F_Tag;
643
+            //        modelDto.F_Sort = a.F_Sort;
644
+            //        modelDto.F_Weight = a.F_Weight;
645
+            //        if (input.OnSaleBegin != null)
646
+            //        { modelDto.F_OnSaleBegin = a.F_OnSaleBegin; }
647
+            //        if (input.OnSaleEnd != null)
648
+            //        { modelDto.F_OnSaleEnd = a.F_OnSaleEnd; }
649
+            //        pageDtoList.Add(modelDto);
650
+            //    }
651
+            //}
652
+            //PageData<ProductDto> pageData = new PageData<ProductDto>();
653
+            //pageData.Totals = list.Totals;
654
+            //pageData.Rows = pageDtoList;
561 655
              return Success("成功", list);
562 656
         }
563 657
 

+ 1 - 9
代码/TVShoppingCallCenter_ZLJ/Models/Dtos/ProductDto.cs

@@ -18,7 +18,6 @@ namespace TVShoppingCallCenter_ZLJ.Models.Dtos
18 18
 		private string _f_pinyinshort;
19 19
 		private DateTime? _f_onsalebegin;
20 20
 		private DateTime? _f_onsaleend;
21
-		private bool _f_issale;
22 21
 		private string _f_factory;
23 22
 		private string _f_address;
24 23
 		private string _f_supplier;
@@ -114,14 +113,7 @@ namespace TVShoppingCallCenter_ZLJ.Models.Dtos
114 113
 			set { _f_onsaleend = value; }
115 114
 			get { return _f_onsaleend; }
116 115
 		}
117
-		/// <summary>
118
-		/// 是否正在上架(可暂不启用)
119
-		/// </summary>
120
-		public bool F_IsSale
121
-		{
122
-			set { _f_issale = value; }
123
-			get { return _f_issale; }
124
-		}
116
+
125 117
 		/// <summary>
126 118
 		/// 生产厂家
127 119
 		/// </summary>

+ 13 - 0
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/BaseInput.cs

@@ -0,0 +1,13 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Threading.Tasks;
5
+
6
+namespace TVShoppingCallCenter_ZLJ.Models.Inputs
7
+{
8
+    public class BaseInput
9
+    {
10
+        public int pageindex { get; set; } = 1;
11
+        public int pagesize { get; set; } = 20;
12
+    }
13
+}

+ 10 - 10
代码/TVShoppingCallCenter_ZLJ/Models/Inputs/ProductInput.cs

@@ -5,7 +5,7 @@ using System.Threading.Tasks;
5 5
 
6 6
 namespace TVShoppingCallCenter_ZLJ.Models.Inputs
7 7
 {
8
-    public class ProductInput
8
+    public class ProductInput: BaseInput
9 9
     {
10 10
 
11 11
         #region Model
@@ -19,19 +19,19 @@ namespace TVShoppingCallCenter_ZLJ.Models.Inputs
19 19
         private DateTime? _f_onsalebegin;
20 20
         private DateTime? _f_onsaleend;
21 21
         private bool _f_issale;
22
-        private string _f_factory;
23
-        private string _f_address;
24
-        private string _f_supplier;
25
-        private int? _f_integral;
22
+        private string _f_factory="";
23
+        private string _f_address="";
24
+        private string _f_supplier="";
25
+        private int? _f_integral=0;
26 26
         private decimal? _f_marketprice;
27 27
         private decimal? _f_memberprice;
28 28
         private decimal? _f_specialprice;
29 29
         private int? _f_isdelete;
30
-        private string _f_des;
31
-        private string _f_attribute;
32
-        private decimal? _f_weight;
33
-        private string _f_tag;
34
-        private string _f_picture;
30
+        private string _f_des="";
31
+        private string _f_attribute="";
32
+        private decimal? _f_weight=0.00M;
33
+        private string _f_tag="";
34
+        private string _f_picture="";
35 35
         private string _f_video;
36 36
         private string _f_content;
37 37
         private int? _f_userid;

BIN
文档/开发文档/~$库设计说明书V1.0.0_郑兵兵 .doc


BIN
文档/开发文档/库存对接接口文档.doc


+ 74 - 0
文档/开发文档/库存接口对接说明.html

@@ -0,0 +1,74 @@
1
+<html>
2
+<head>
3
+    <title>接口对接说明</title>
4
+    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.0/showdown.min.js"></script>
5
+	<link rel="stylesheet" href="https://cdn.sspai.com/MWeb.css" type="text/css" data-for="result">
6
+</head>
7
+<body onload="compile()">
8
+<div>
9
+    <textarea id="content" style="height:400px;width:600px;display:none;" >    
10
+**首先系统中的库存不由系统进行更改:所有库存操作,均有仓管平台进行接口调用更新
11
+仓管平台需要登录,分配角色只可调用更新库存接口** 
12
+
13
+- 库存更新接口
14
+
15
+**请求URL:** 
16
+- ` /api/product/updatestock `
17
+  
18
+**请求方式:**
19
+- POST 
20
+
21
+**参数:以对象数组方式传递** 
22
+
23
+|参数名|必选|类型|说明|
24
+|:----    |:---|:----- |-----   |
25
+|ProductId |是  |string |产品Id   |
26
+|Stock |是  |int | 当前库存    |
27
+ **请求示例**
28
+
29
+``` 
30
+ [
31
+        {
32
+            "ProductId": 9900,
33
+            "Stock": 5
34
+        },
35
+        {
36
+            "ProductId": 9899,
37
+            "Stock": 4
38
+        }
39
+ ]
40
+```
41
+
42
+ **返回示例**
43
+
44
+
45
+``` 
46
+ {
47
+  "state": "success",
48
+  "message": "更新库存成功",
49
+  "data": null
50
+} 
51
+
52
+```
53
+
54
+
55
+
56
+ **返回参数说明** 
57
+
58
+|参数名|类型|说明|
59
+|:-----  |:-----|-----                           |
60
+|state |string   |更新状态 如果此状态没有成功,请过几分钟重新更新库存(最新库存),连续三次不成功,最好有地方反馈和查询,通知到相关人员做一个排查。例如有可能是一个网络原因   |</textarea>
61
+    <div id="result"></div>
62
+
63
+</div>
64
+<script type="text/javascript">
65
+function compile(){
66
+    var text = document.getElementById("content").value;
67
+    var converter = new showdown.Converter({tables: true});
68
+    var html = converter.makeHtml(text);
69
+    document.getElementById("result").innerHTML = html;
70
+}
71
+</script>
72
+</body>
73
+</html>
74
+