@@ -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) + "&"; | |||
} | |||
} | |||
@@ -50,9 +50,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/Bom/DeleteBom")] | |||
public async Task<bool> DeleteBom(string[] ids) | |||
public async Task<bool> DeleteBom(DeleteBomDto dto) | |||
{ | |||
return await _bomService.DeleteBom(ids); | |||
return await _bomService.DeleteBom(dto); | |||
} | |||
/// <summary> | |||
/// 根据配方id查询配方详情 | |||
@@ -60,7 +60,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom | |||
/// <param name="bomId"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/Bom/GetBomEntry")] | |||
public async Task<BomEntryDto> GetBomEntry(BomIdDto dto) | |||
public async Task<List<BomEntryDto>> GetBomEntry(BomIdDto dto) | |||
{ | |||
return await _bomService.GetBomEntry(dto); | |||
} | |||
@@ -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<string> Ids { get; set; } | |||
} | |||
} |
@@ -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<PushDataBatchingDto>(); | |||
//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<MaterialCreateDto>(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 | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteBom(string[] ids) | |||
public async Task<bool> DeleteBom(DeleteBomDto dto) | |||
{ | |||
try | |||
{ | |||
SqlSugarDb.Db.BeginTran(); | |||
var ids= dto.Ids; | |||
var goods = SqlSugarDb.Db.Queryable<BPA_Bom>().Where(x => ids.Contains(x.Id)).ToList(); | |||
if (goods == null) throw Oops.Oh(ErrorCodeEnum.Code10015); | |||
var goodsbom = SqlSugarDb.Db.Queryable<BPA_BomEntry>().Where(x => ids.Contains(x.BomId)).ToList(); | |||
@@ -163,7 +200,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services | |||
/// </summary> | |||
/// <param name="bomId"></param> | |||
/// <returns></returns> | |||
public async Task<BomEntryDto> GetBomEntry(BomIdDto dto) | |||
public async Task<List<BomEntryDto>> 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; | |||
} | |||
@@ -35,13 +35,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
Task<bool> DeleteBom(string[] ids); | |||
Task<bool> DeleteBom(DeleteBomDto dto); | |||
/// <summary> | |||
/// 根据配方id查询配方详情 | |||
/// </summary> | |||
/// <param name="bomId"></param> | |||
/// <returns></returns> | |||
Task<BomEntryDto> GetBomEntry(BomIdDto dto); | |||
Task<List<BomEntryDto>> GetBomEntry(BomIdDto dto); | |||
/// <summary> | |||
/// 添加配方详情 | |||
/// </summary> | |||
@@ -8,6 +8,6 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos | |||
{ | |||
public class DeviceInfoDelDto | |||
{ | |||
public string[] Ids { get; set; } | |||
public List<string> Ids { get; set; } | |||
} | |||
} |
@@ -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<string> Ids { get; set; } | |||
} | |||
} |
@@ -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> 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; } | |||
} | |||
} |
@@ -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<GoodsTechnologyActionViewDto> Data { get; set; } | |||
} | |||
public class GoodsTechnologyActionViewDto | |||
@@ -30,17 +30,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||
/// 商品属性id集合 | |||
/// </summary> | |||
public string GoodsAttributeId { get; set; } | |||
/// <summary> | |||
/// 是否物料 | |||
/// </summary> | |||
public bool IsBatch { get; set; } | |||
/// <summary> | |||
/// 动作value | |||
/// </summary> | |||
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; } | |||
@@ -58,9 +58,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/Goods/DeleteGoods")] | |||
public async Task<bool> DeleteGoods(string[] ids) | |||
public async Task<bool> DeleteGoods(DeleteGoodsDto dto) | |||
{ | |||
return await _goodsService.DeleteGoods(ids); | |||
return await _goodsService.DeleteGoods(dto); | |||
} | |||
/// <summary> | |||
///添加商品属性 | |||
@@ -77,9 +77,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/Goods/GetGoodsAttributeList")] | |||
public async Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList() | |||
public async Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList(GoodsIdDto dto) | |||
{ | |||
return await _goodsService.GetGoodsAttributeList(); | |||
return await _goodsService.GetGoodsAttributeList(dto); | |||
} | |||
/// <summary> | |||
/// 查询商品工艺 | |||
@@ -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<BPA_GoodsAttributePrice>().Where(y => y.GoodsId == x.Id).ToList(); | |||
var list=GoodsAttributePriceList.Adapt<List<GoodsAttributePrice>>(); | |||
x.GoodsAttributePrice = list; | |||
}) | |||
.ToPageList(inputDto.Current, inputDto.PageSize, ref total); | |||
return new PageUtil<List<GoodsDto>>() | |||
{ | |||
@@ -206,15 +213,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DeleteGoods(string[] ids) | |||
public async Task<bool> DeleteGoods(DeleteGoodsDto dto) | |||
{ | |||
try | |||
{ | |||
SqlSugarDb.Db.BeginTran(); | |||
var goods = SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().Where(x => ids.Contains(x.Id)).ToList(); | |||
var goods = SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().Where(x => dto.Ids.Contains(x.Id)).ToList(); | |||
if (goods == null) throw Oops.Oh(ErrorCodeEnum.Code1008); | |||
var goodsbom = SqlSugarDb.Db.Queryable<BPA_GoodsBom>().Where(x => ids.Contains( x.Goods_Id)).ToList(); | |||
var goodsTechnology = SqlSugarDb.Db.Queryable<BPA_GoodsTechnologyAction>().Where(x => ids.Contains(x.GoodsId)).ToList(); | |||
var goodsbom = SqlSugarDb.Db.Queryable<BPA_GoodsBom>().Where(x => dto.Ids.Contains( x.Goods_Id)).ToList(); | |||
var goodsTechnology = SqlSugarDb.Db.Queryable<BPA_GoodsTechnologyAction>().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(); | |||
@@ -281,9 +288,16 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||
/// 查询商品属性 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList() | |||
public async Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList(GoodsIdDto dto) | |||
{ | |||
var goodstypeid = ""; | |||
var goods=SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().WhereIF(!string.IsNullOrWhiteSpace(dto.GoodsId), x => x.Id == dto.GoodsId).First(); | |||
if (goods != null) | |||
{ | |||
goodstypeid = goods.GoodsTypeId; | |||
} | |||
var res = await SqlSugarDb.Db.Queryable<BPA_GoodsAttribute>() | |||
.WhereIF(!string.IsNullOrEmpty(goodstypeid),x=>x.GoodsTypeId== goodstypeid) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.Select(a => new GoodsAttributeVewDto | |||
{ | |||
@@ -330,7 +344,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); | |||
@@ -34,7 +34,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||
/// </summary> | |||
/// <param name="ids"></param> | |||
/// <returns></returns> | |||
Task<bool> DeleteGoods(string[] ids); | |||
Task<bool> DeleteGoods(DeleteGoodsDto dto); | |||
/// <summary> | |||
///添加商品属性 | |||
/// </summary> | |||
@@ -45,7 +45,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||
/// 查询商品属性 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList(); | |||
Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList(GoodsIdDto dto); | |||
/// <summary> | |||
/// 查询商品工艺 | |||
/// </summary> | |||
@@ -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; } | |||
} | |||
@@ -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<BPA_WarehousePostion> WarehousePostion { get; set; } | |||
public List<WarehousePostionVewDto> 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; } | |||
} | |||
} |
@@ -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<BPA_WarehousePostion>().Where(t => t.TemplateId == x.Id).ToList(); | |||
x.WarehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion,BPA_Batching>((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<BPA_WarehousePostion>().Where(t => t.TemplateId == x.Id).ToList(); | |||
x.WarehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion, BPA_Batching>((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(); | |||
@@ -32,7 +32,7 @@ namespace BPA.SAAS.Manage.Application.Auth | |||
/// <returns></returns> | |||
[HttpPost("/api/auth/login")] | |||
[AllowAnonymous] | |||
public async Task<LoginOutInfo> Login([FromHeader] string logintype, [Required] LoginInput input) | |||
public async Task<LoginOutInfo> Login(LoginInput input) | |||
{ | |||
// 获取加密后的密码 | |||
@@ -10,7 +10,7 @@ namespace BPA.SAAS.Manage.Application.Auth | |||
{ | |||
public interface IAuthService | |||
{ | |||
Task<LoginOutInfo> Login([FromHeader] string logintype, [Required] LoginInput input); | |||
Task<LoginOutInfo> Login(LoginInput input); | |||
Task<LoginOutput> GetLoginUserAsync(); | |||
Task LogoutAsync(); | |||
@@ -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; } | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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; | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodsattributeprice/getpage")] | |||
public async Task<PageUtil> GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto) | |||
{ | |||
return await _goodsAttributePriceService.GetGoodsAttributePricePage(dto); | |||
} | |||
/// <summary> | |||
/// 查询商品属性价格列表 | |||
/// </summary> | |||
/// <param name="goodsId"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/goodsattributeprice/getlist")] | |||
public async Task<List<GoodsAttributePriceView>> GetGoodsAttributePriceList(string goodsId) | |||
{ | |||
return await _goodsAttributePriceService.GetGoodsAttributePriceList(goodsId); | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodsattributeprice/add")] | |||
public async Task<bool> AddGoodsAttributePrice(GoodsAttributePriceDto dto) | |||
{ | |||
return await _goodsAttributePriceService.AddGoodsAttributePrice(dto); | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/goodsattributeprice/update")] | |||
public async Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto) | |||
{ | |||
return await _goodsAttributePriceService.UpdateGoodsAttributePrice(dto); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="Id"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/goodsattributeprice/delete")] | |||
public async Task<bool> DelGoodsAttributePrice(string Id) | |||
{ | |||
return await _goodsAttributePriceService.DelGoodsAttributePrice(Id); | |||
} | |||
} | |||
} |
@@ -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 | |||
{ | |||
// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<PageUtil> GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto); | |||
Task<List<GoodsAttributePriceView>> GetGoodsAttributePriceList(string goodsId); | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddGoodsAttributePrice(GoodsAttributePriceDto dto); | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto); | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="Id"></param> | |||
/// <returns></returns> | |||
Task<bool> DelGoodsAttributePrice(string Id); | |||
} | |||
} |
@@ -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; // 推荐操作 | |||
} | |||
/// <summary> | |||
/// 分页查询 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<PageUtil> GetGoodsAttributePricePage(GoodsAttributePriceQueryDto dto) | |||
{ | |||
RefAsync<int> total =0; | |||
var res = await _db.Queryable<BPA_GoodsAttributePrice>() | |||
.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<List<GoodsAttributePriceView>> GetGoodsAttributePriceList(string goodsId) | |||
{ | |||
var res = await _db.Queryable<BPA_GoodsAttributePrice>() | |||
.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; | |||
} | |||
/// <summary> | |||
/// 添加 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddGoodsAttributePrice(GoodsAttributePriceDto dto) | |||
{ | |||
var check=_db.Queryable<BPA_GoodsAttributePrice>().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; | |||
} | |||
/// <summary> | |||
/// 更新 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateGoodsAttributePrice(GoodsAttributePriceDto dto) | |||
{ | |||
// 查询数据库中是否存在未删除的商品类型 | |||
var resEntity = _db.Queryable<BPA_GoodsAttributePrice>().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; | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="Id"></param> | |||
/// <returns></returns> | |||
public async Task<bool> DelGoodsAttributePrice(string Id) | |||
{ | |||
var resEntity = _db.Queryable<BPA_GoodsAttributePrice>().First(it => it.Id == Id); | |||
if (resEntity == null) throw Oops.Oh("找不到相关记录"); | |||
var res = await _db.Deleteable(resEntity).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
} | |||
} |
@@ -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; } | |||
} | |||
} |
@@ -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())) | |||
{ | |||