|
|
@@ -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
|
|