diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/DtoValidator.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/DtoValidator.cs index 8e6cfe2..1dc0b37 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/DtoValidator.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/DtoValidator.cs @@ -108,6 +108,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; retstr = retstr + p.Name + "=" + JsonConvert.SerializeObject(p.GetValue(t, null), Formatting.None, jsonSetting) + "&"; + } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/BomServices.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/BomServices.cs index 87d51cc..c2bea71 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/BomServices.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/BomServices.cs @@ -50,9 +50,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom /// /// [HttpPost("/api/ExternalPlatform/Bom/DeleteBom")] - public async Task DeleteBom(string[] ids) + public async Task DeleteBom(DeleteBomDto dto) { - return await _bomService.DeleteBom(ids); + return await _bomService.DeleteBom(dto); } /// /// 根据配方id查询配方详情 @@ -60,7 +60,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom /// /// [HttpPost("/api/ExternalPlatform/Bom/GetBomEntry")] - public async Task GetBomEntry(BomIdDto dto) + public async Task> GetBomEntry(BomIdDto dto) { return await _bomService.GetBomEntry(dto); } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Dtos/DeleteBomDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Dtos/DeleteBomDto.cs new file mode 100644 index 0000000..5ec28b1 --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Dtos/DeleteBomDto.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Dtos +{ + public class DeleteBomDto + { + public List Ids { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/BomService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/BomService.cs index 4f26839..fbf4e8f 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/BomService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/BomService.cs @@ -2,10 +2,14 @@ using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto; using BPA.SAAS.Manage.Application.AExternalPlatform.Enum; using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Dtos; +using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos; +using BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Dtos; using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.DataBase; using BPA.SAAS.Manage.Core.Device; +using Microsoft.AspNetCore.Components.Forms; +using Newtonsoft.Json; using NPOI.XWPF.UserModel; using SixLabors.ImageSharp.PixelFormats; @@ -101,6 +105,38 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services await SqlSugarDb.Db.Insertable(BomTypelist).ExecuteCommandAsync(); await SqlSugarDb.Db.Insertable(BomTypeInfolist).ExecuteCommandAsync(); SqlSugarDb.Db.CommitTran(); + #region 下发数据到设备 + + //var data = new List(); + //foreach (var item in list) + //{ + // data.Add(new PushDataBatchingDto() + // { + // Aittribute = item.Aittribute, + // AutoKey = item.AutoKey, + // Code = item.Code, + // ForeignKeyRe = item.ForeignKeyRe, + // Id = item.Id, + // Name = item.Batching_Name, + // netrecovery = item.netrecovery, + // outstockUint = item.outstockUint, + // Price = item.Price, + // proportion = item.proportion, + // Specs = item.Specs, + // StockUint = item.StockUint, + // StockUintName = item.StockUint, + // TypeID = item.TypeID, + // }); + //} + + //if (inputDto.IsPush) + //{ + // await _thirdpartyPushService.AddPushRecordAndPushDevice(inputDto, 2, JsonConvert.SerializeObject(list.Select(x => x.Id).ToList()), + // JsonConvert.SerializeObject(data)); + //} + + + #endregion return true; } catch (Exception) @@ -138,11 +174,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services /// /// /// - public async Task DeleteBom(string[] ids) + public async Task DeleteBom(DeleteBomDto dto) { try { SqlSugarDb.Db.BeginTran(); + var ids= dto.Ids; var goods = SqlSugarDb.Db.Queryable().Where(x => ids.Contains(x.Id)).ToList(); if (goods == null) throw Oops.Oh(ErrorCodeEnum.Code10015); var goodsbom = SqlSugarDb.Db.Queryable().Where(x => ids.Contains(x.BomId)).ToList(); @@ -163,7 +200,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services /// /// /// - public async Task GetBomEntry(BomIdDto dto) + public async Task> GetBomEntry(BomIdDto dto) { try { @@ -178,7 +215,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services BatchingName=c.Batching_Name, BomId = a.BomId, BomName=b.Name - }).FirstAsync(); + }).ToListAsync(); return resEntity; } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/IBomService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/IBomService.cs index 6e3ef05..7374a49 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/IBomService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Bom/Services/IBomService.cs @@ -35,13 +35,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services /// /// /// - Task DeleteBom(string[] ids); + Task DeleteBom(DeleteBomDto dto); /// /// 根据配方id查询配方详情 /// /// /// - Task GetBomEntry(BomIdDto dto); + Task> GetBomEntry(BomIdDto dto); /// /// 添加配方详情 /// diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceInfoDelDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceInfoDelDto.cs index 2ba9808..e7b5cd7 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceInfoDelDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/DeviceInfoDelDto.cs @@ -8,6 +8,6 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos { public class DeviceInfoDelDto { - public string[] Ids { get; set; } + public List Ids { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/DeleteGoodsDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/DeleteGoodsDto.cs new file mode 100644 index 0000000..5b6bd8d --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/DeleteGoodsDto.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos +{ + public class DeleteGoodsDto + { + public List Ids { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsDto.cs index 4d738e1..8b5f567 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsDto.cs @@ -18,8 +18,16 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos public decimal Price { get; set; } public string GoodsUintId { get; set; } public string GoodsTypeId { get; set; } - public string GroupId { get; set; } public string GoodsTypeName { get; set; } public string GoodsUnitName { get; set; } + public List GoodsAttributePrice { get; set; } + } + public class GoodsAttributePrice + { + public string Id { get; set; } + public string GoodsId { get; set; } + public string GoodsattributeValueId { get; set; } + public string GoodsattributeValue { get; set; } + public Decimal Price { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionListViewDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionListViewDto.cs index 72391dc..6241539 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionListViewDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Dtos/GoodsTechnologyActionListViewDto.cs @@ -12,7 +12,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos public string DeviceId { get; set; } public string WarehousrTemplateId { get; set; } public string GoodsAttributeId { get; set; } - public string DeviceName { get; set; } + public string TechnologyName { get; set; } public List Data { get; set; } } public class GoodsTechnologyActionViewDto @@ -30,17 +30,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos /// 商品属性id集合 /// public string GoodsAttributeId { get; set; } - /// - /// 是否物料 - /// - public bool IsBatch { get; set; } + /// /// 动作value /// public string ChnologyId { get; set; } public DateTime CreateAt { get; set; } - public string GroupId { get; set; } - public int IsDeleted { get; set; } public int Sort { get; set; } public string GoodsId { get; set; } public string DeviceId { get; set; } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs index 72937eb..32fb34d 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/GoodsServices.cs @@ -58,9 +58,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods /// /// [HttpPost("/api/ExternalPlatform/Goods/DeleteGoods")] - public async Task DeleteGoods(string[] ids) + public async Task DeleteGoods(DeleteGoodsDto dto) { - return await _goodsService.DeleteGoods(ids); + return await _goodsService.DeleteGoods(dto); } /// ///添加商品属性 @@ -77,9 +77,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods /// /// [HttpPost("/api/ExternalPlatform/Goods/GetGoodsAttributeList")] - public async Task> GetGoodsAttributeList() + public async Task> GetGoodsAttributeList(GoodsIdDto dto) { - return await _goodsService.GetGoodsAttributeList(); + return await _goodsService.GetGoodsAttributeList(dto); } /// /// 查询商品工艺 diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs index 3791dde..eb31778 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/GoodsService.cs @@ -44,7 +44,14 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services GoodsTypeName=b.Name, GoodsUnitName=c.Name - }).ToPageList(inputDto.Current, inputDto.PageSize, ref total); + }) + .Mapper(x => + { + var GoodsAttributePriceList=SqlSugarDb.Db.Queryable().Where(y => y.GoodsId == x.Id).ToList(); + var list=GoodsAttributePriceList.Adapt>(); + x.GoodsAttributePrice = list; + }) + .ToPageList(inputDto.Current, inputDto.PageSize, ref total); return new PageUtil>() { @@ -207,15 +214,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services /// /// /// - public async Task DeleteGoods(string[] ids) + public async Task DeleteGoods(DeleteGoodsDto dto) { try { SqlSugarDb.Db.BeginTran(); - var goods = SqlSugarDb.Db.Queryable().Where(x => ids.Contains(x.Id)).ToList(); + var goods = SqlSugarDb.Db.Queryable().Where(x => dto.Ids.Contains(x.Id)).ToList(); if (goods == null) throw Oops.Oh(ErrorCodeEnum.Code1008); - var goodsbom = SqlSugarDb.Db.Queryable().Where(x => ids.Contains( x.Goods_Id)).ToList(); - var goodsTechnology = SqlSugarDb.Db.Queryable().Where(x => ids.Contains(x.GoodsId)).ToList(); + var goodsbom = SqlSugarDb.Db.Queryable().Where(x => dto.Ids.Contains( x.Goods_Id)).ToList(); + var goodsTechnology = SqlSugarDb.Db.Queryable().Where(x => dto.Ids.Contains(x.GoodsId)).ToList(); await SqlSugarDb.Db.Deleteable(goodsbom).ExecuteCommandAsync(); await SqlSugarDb.Db.Deleteable(goodsTechnology).ExecuteCommandAsync(); var res = await SqlSugarDb.Db.Deleteable(goods).ExecuteCommandAsync(); @@ -282,9 +289,16 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services /// 查询商品属性 /// /// - public async Task> GetGoodsAttributeList() + public async Task> GetGoodsAttributeList(GoodsIdDto dto) { + var goodstypeid = ""; + var goods=SqlSugarDb.Db.Queryable().WhereIF(!string.IsNullOrWhiteSpace(dto.GoodsId), x => x.Id == dto.GoodsId).First(); + if (goods != null) + { + goodstypeid = goods.GoodsTypeId; + } var res = await SqlSugarDb.Db.Queryable() + .WhereIF(!string.IsNullOrEmpty(goodstypeid),x=>x.GoodsTypeId== goodstypeid) .OrderBy(a => a.CreateAt, OrderByType.Desc) .Select(a => new GoodsAttributeVewDto { @@ -331,7 +345,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services DeviceId = s[t].Key, WarehousrTemplateId = sf1[t].Key, GoodsAttributeId = string.Join(',', sdw), - DeviceName = Devicelist?.FirstOrDefault(x => x.Id == s[t].Key).DeviceName + "【" + nane + "】", + TechnologyName = Devicelist?.FirstOrDefault(x => x.Id == s[t].Key).DeviceName + "【" + nane + "】", Data = s[t].AsQueryable().ToList(), }; goodsTechnologyActionListViews.Add(item); diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs index a22dc36..750789b 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Goods/Services/IGoodsService.cs @@ -34,7 +34,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services /// /// /// - Task DeleteGoods(string[] ids); + Task DeleteGoods(DeleteGoodsDto dto); /// ///添加商品属性 /// @@ -45,7 +45,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services /// 查询商品属性 /// /// - Task> GetGoodsAttributeList(); + Task> GetGoodsAttributeList(GoodsIdDto dto); /// /// 查询商品工艺 /// diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplatInsertDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplatInsertDto.cs index 261a24d..f7b2c6f 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplatInsertDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplatInsertDto.cs @@ -16,8 +16,8 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat } public class WarehousePostionInsert { - public string Id { get; set; } - public string TemplateId { get; set; } + //public string Id { get; set; } + //public string TemplateId { get; set; } public string Code { get; set; } public string BatchingId { get; set; } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplateView.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplateView.cs index 256d7dd..753de48 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplateView.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Dtos/WarehouseTemplateView.cs @@ -14,8 +14,16 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat public string DeviceName { get; set; } public string TemplateName { get; set; } public DateTime CreateAt { get; set; } - public int ProductNumber { get; set; } + public int Count { get; set; } public string ProductUrl { get; set; } - public List WarehousePostion { get; set; } + public List WarehousePostion { get; set; } + } + public class WarehousePostionVewDto + { + public string Id { get; set; } + public string TemplateId { get; set; } + public string Code { get; set; } + public string BatchingId { get; set; } + public string BatchingName { get; set; } } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs index c6358f2..fb5897d 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs @@ -3,6 +3,7 @@ using BPA.SAAS.Manage.Application.AExternalPlatform.Enum; using BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplate.Dtos; using BPA.SAAS.Manage.Application.Device.Interface; using BPA.SAAS.Manage.Core.Base; +using BPA.SAAS.Manage.Core.DataBase; using BPA.SAAS.Manage.Core.Device; using BPA.SAAS.Manage.Core.Product; using LogicExtensions; @@ -30,12 +31,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat DeviceName = b.DeviceName, TemplateName = a.TemplateName, CreateAt = a.CreateAt, - ProductNumber = c.ProductNumber, + Count = c.ProductNumber, ProductUrl = c.ProductUrl }) .Mapper(x => { - x.WarehousePostion = SqlSugarDb.Db.Queryable().Where(t => t.TemplateId == x.Id).ToList(); + x.WarehousePostion = SqlSugarDb.Db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left,a.BatchingId==b.Id)).Where((a, b) => a.TemplateId == x.Id).Select((a, b) => new WarehousePostionVewDto() { Id=a.Id.SelectAll(),BatchingName=b.Batching_Name}).ToList(); }) .OrderBy(a => a.CreateAt, OrderByType.Desc) .ToPageListAsync(inputDto.Current, inputDto.PageSize, total); @@ -59,12 +60,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat DeviceName = b.DeviceName, TemplateName = a.TemplateName, CreateAt = a.CreateAt, - ProductNumber = c.ProductNumber, + Count = c.ProductNumber, ProductUrl = c.ProductUrl }) .Mapper(x => { - x.WarehousePostion = SqlSugarDb.Db.Queryable().Where(t => t.TemplateId == x.Id).ToList(); + x.WarehousePostion = SqlSugarDb.Db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.BatchingId == b.Id)).Where((a, b) => a.TemplateId == x.Id).Select((a, b) => new WarehousePostionVewDto() { Id = a.Id.SelectAll(), BatchingName = b.Batching_Name }).ToList(); }) .OrderBy(a => a.CreateAt, OrderByType.Desc) .ToListAsync(); diff --git a/BPA.SAAS.Manage.Application/Auth/AuthService.cs b/BPA.SAAS.Manage.Application/Auth/AuthService.cs index 820dee4..0314d3f 100644 --- a/BPA.SAAS.Manage.Application/Auth/AuthService.cs +++ b/BPA.SAAS.Manage.Application/Auth/AuthService.cs @@ -32,7 +32,7 @@ namespace BPA.SAAS.Manage.Application.Auth /// [HttpPost("/api/auth/login")] [AllowAnonymous] - public async Task Login([FromHeader] string logintype, [Required] LoginInput input) + public async Task Login(LoginInput input) { // 获取加密后的密码 diff --git a/BPA.SAAS.Manage.Application/Auth/IAuthService.cs b/BPA.SAAS.Manage.Application/Auth/IAuthService.cs index 784417c..e1c59f0 100644 --- a/BPA.SAAS.Manage.Application/Auth/IAuthService.cs +++ b/BPA.SAAS.Manage.Application/Auth/IAuthService.cs @@ -10,7 +10,7 @@ namespace BPA.SAAS.Manage.Application.Auth { public interface IAuthService { - Task Login([FromHeader] string logintype, [Required] LoginInput input); + Task Login(LoginInput input); Task GetLoginUserAsync(); Task LogoutAsync(); diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceDto.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceDto.cs new file mode 100644 index 0000000..1d7e92b --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceDto.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice +{ + public class GoodsAttributePriceDto + { + public string Id { get; set; } + public string GoodsId { get; set; } + public string GoodsattributeValueId { get; set; } + public string GoodsattributeValue { get; set; } + public decimal Price { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceQueryDto.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceQueryDto.cs new file mode 100644 index 0000000..535cd22 --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceQueryDto.cs @@ -0,0 +1,14 @@ +using BPA.SAAS.Manage.Core.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice +{ + public class GoodsAttributePriceQueryDto: PageInputBase + { + public string GoodsId { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceView.cs b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceView.cs new file mode 100644 index 0000000..bd63f86 --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttributePrice/GoodsAttributePriceView.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice +{ + public class GoodsAttributePriceView + { + public string Id { get; set; } + public string GoodsId { get; set; } + public string GoodsattributeValueId { get; set; } + public string GoodsattributeValue { get; set; } + public decimal Price { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/GoodsAttributePriceServices.cs b/BPA.SAAS.Manage.Application/DataBase/GoodsAttributePriceServices.cs new file mode 100644 index 0000000..6186971 --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/GoodsAttributePriceServices.cs @@ -0,0 +1,71 @@ +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice; +using BPA.SAAS.Manage.Application.DataBase.Interface; +using BPA.SAAS.Manage.Core.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase +{ + [ApiDescriptionSettings("GoodsAttributePrice", Tag = "商品属性价格")] + public class GoodsAttributePriceServices: IDynamicApiController + { + IGoodsAttributePriceService _goodsAttributePriceService; + public GoodsAttributePriceServices(IGoodsAttributePriceService goodsAttributePriceService) + { + _goodsAttributePriceService=goodsAttributePriceService; + } + /// + /// 分页查询 + /// + /// + /// + [HttpPost("/api/goodsattributeprice/getpage")] + public async Task GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto) + { + return await _goodsAttributePriceService.GetGoodsAttributePricePage(dto); + } + /// + /// 查询商品属性价格列表 + /// + /// + /// + [HttpGet("/api/goodsattributeprice/getlist")] + public async Task> GetGoodsAttributePriceList(string goodsId) + { + return await _goodsAttributePriceService.GetGoodsAttributePriceList(goodsId); + } + /// + /// 添加 + /// + /// + /// + [HttpPost("/api/goodsattributeprice/add")] + public async Task AddGoodsAttributePrice(GoodsAttributePriceDto dto) + { + return await _goodsAttributePriceService.AddGoodsAttributePrice(dto); + } + /// + /// 更新 + /// + /// + /// + [HttpPost("/api/goodsattributeprice/update")] + public async Task UpdateGoodsAttributePrice(GoodsAttributePriceDto dto) + { + return await _goodsAttributePriceService.UpdateGoodsAttributePrice(dto); + } + /// + /// 删除 + /// + /// + /// + [HttpGet("/api/goodsattributeprice/delete")] + public async Task DelGoodsAttributePrice(string Id) + { + return await _goodsAttributePriceService.DelGoodsAttributePrice(Id); + } + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributePriceService.cs b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributePriceService.cs new file mode 100644 index 0000000..61e1874 --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Interface/IGoodsAttributePriceService.cs @@ -0,0 +1,39 @@ +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice; +using BPA.SAAS.Manage.Core.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase.Interface +{ + public interface IGoodsAttributePriceService + { + // + /// 分页查询 + /// + /// + /// + Task GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto); + Task> GetGoodsAttributePriceList(string goodsId); + /// + /// 添加 + /// + /// + /// + Task AddGoodsAttributePrice(GoodsAttributePriceDto dto); + /// + /// 更新 + /// + /// + /// + Task UpdateGoodsAttributePrice(GoodsAttributePriceDto dto); + /// + /// 删除 + /// + /// + /// + Task DelGoodsAttributePrice(string Id); + } +} diff --git a/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs new file mode 100644 index 0000000..543d01f --- /dev/null +++ b/BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributePriceService.cs @@ -0,0 +1,113 @@ +using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos; +using BPA.SAAS.Manage.Application.DataBase.Dtos.Bom; +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttributePrice; +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType; +using BPA.SAAS.Manage.Application.DataBase.Interface; +using BPA.SAAS.Manage.Comm.Const; +using BPA.SAAS.Manage.Comm.Enum; +using BPA.SAAS.Manage.Core.Base; +using BPA.SAAS.Manage.Core.DataBase; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.DataBase.Services +{ + public class GoodsAttributePriceService : IGoodsAttributePriceService, ITransient + { + private readonly ISqlSugarClient _db; + public GoodsAttributePriceService(ISqlSugarClient db) + { + _db = db; // 推荐操作 + } + /// + /// 分页查询 + /// + /// + /// + public async Task GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto) + { + RefAsync total =0; + var res = await _db.Queryable() + .WhereIF(!string.IsNullOrWhiteSpace(dto.GoodsId),x=>x.GoodsId== dto.GoodsId) + .OrderBy(a => a.CreateAt, OrderByType.Desc) + .Select(it => new GoodsAttributePriceView() { Id = it.Id, GoodsId = it.GoodsId, GoodsattributeValueId = it.GoodsattributeValueId,Price=it.Price,GoodsattributeValue=it.GoodsattributeValue }) + + .ToPageListAsync(dto.Current, dto.PageSize, total); + //.ToPageList(dto.Current, dto.PageSize, ref total); + + PageUtil util = new PageUtil() + { + Total = total, + Data = res + + }; + return util; + } + public async Task> GetGoodsAttributePriceList(string goodsId) + { + var res = await _db.Queryable() + .WhereIF(!string.IsNullOrWhiteSpace(goodsId), x => x.GoodsId == goodsId) + .OrderBy(a => a.CreateAt, OrderByType.Desc) + .Select(it => new GoodsAttributePriceView() { Id = it.Id, GoodsId = it.GoodsId, GoodsattributeValueId = it.GoodsattributeValueId, Price = it.Price, GoodsattributeValue = it.GoodsattributeValue }) + .ToListAsync(); + return res; + } + /// + /// 添加 + /// + /// + /// + public async Task AddGoodsAttributePrice(GoodsAttributePriceDto dto) + { + var check=_db.Queryable().Where(x=>x.GoodsattributeValueId== dto.GoodsattributeValueId).Any(); + if (check) throw Oops.Oh("当前属性的价格已存在"); + var model = new BPA_GoodsAttributePrice + { + + GoodsId = dto.GoodsId, + GoodsattributeValueId = dto.GoodsattributeValueId, + GoodsattributeValue= dto.GoodsattributeValue, + Price = dto.Price + }; + + var res = await _db.Insertable(model).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); + return res > 0; + } + /// + /// 更新 + /// + /// + /// + public async Task UpdateGoodsAttributePrice(GoodsAttributePriceDto dto) + { + // 查询数据库中是否存在未删除的商品类型 + var resEntity = _db.Queryable().First(it => it.Id == dto.Id); + if (null == resEntity) + { + return false; + } + + resEntity.GoodsId = dto.GoodsId; + resEntity.GoodsattributeValueId = dto.GoodsattributeValueId; + resEntity.GoodsattributeValue = dto.GoodsattributeValue; + resEntity.Price = dto.Price; + var res = await _db.Updateable(resEntity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + return res > 0; + } + /// + /// 删除 + /// + /// + /// + public async Task DelGoodsAttributePrice(string Id) + { + var resEntity = _db.Queryable().First(it => it.Id == Id); + if (resEntity == null) throw Oops.Oh("找不到相关记录"); + var res = await _db.Deleteable(resEntity).ExecuteCommandAsync(); + return res > 0; + } + } +} diff --git a/BPA.SAAS.Manage.Core/DataBase/BPA_GoodsAttributePrice.cs b/BPA.SAAS.Manage.Core/DataBase/BPA_GoodsAttributePrice.cs new file mode 100644 index 0000000..d23d6e8 --- /dev/null +++ b/BPA.SAAS.Manage.Core/DataBase/BPA_GoodsAttributePrice.cs @@ -0,0 +1,18 @@ +using BPA.SAAS.Manage.Core.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Core.DataBase +{ + public class BPA_GoodsAttributePrice : IBaseEntity, IGroupId + { + public string GoodsId { get; set; } + public string GoodsattributeValueId { get; set; } + public string GoodsattributeValue { get; set; } + public Decimal Price { get; set; } + public string GroupId { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs b/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs index 3a4fdde..27af602 100644 --- a/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs +++ b/BPA.SAAS.Manage.Web.Core/Handlers/RequestAuditFiltercs.cs @@ -63,14 +63,12 @@ namespace BPA.SAAS.Manage.Web.Core // 获取请求参数(写入日志,需序列化成字符串后存储) var parameters = context.ActionArguments; - //foreach (var parameter in parameters) //{ // var stingA = DtoValidator.GetSign(parameter.Value); - // var vvv = 00; + // var vvvv = stingA; //} - if (requestUrl.ToUpper().Contains("ExternalPlatform".ToUpper())) {