@@ -37,7 +37,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services | |||||
}) | }) | ||||
.Mapper(x => | .Mapper(x => | ||||
{ | { | ||||
var list=SqlSugarDb.Db.Queryable<BPA_BomEntry, BPA_Batching>((a,b)=> new JoinQueryInfos(JoinType.Left, a.BatchingId == b.Id)).Select((a,b)=>new BomEntr | |||||
var list=SqlSugarDb.Db.Queryable<BPA_BomEntry, BPA_Batching>((a,b)=> new JoinQueryInfos(JoinType.Left, a.BatchingId == b.Id)).Where((a,b)=>a.BomId==x.Id).Select((a,b)=>new BomEntr | |||||
{ | { | ||||
Id=a.Id, | Id=a.Id, | ||||
BatchingId=a.BatchingId, | BatchingId=a.BatchingId, | ||||
@@ -233,6 +233,10 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Bom.Services | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
var checkbatch=SqlSugarDb.Db.Queryable<BPA_Batching>().Where(x => x.Id == dto.BatchingId).Any(); | |||||
if (!checkbatch) throw Oops.Oh("找不到物料信息"); | |||||
var checkbom = SqlSugarDb.Db.Queryable<BPA_Bom>().Where(x => x.Id == dto.BomId).Any(); | |||||
if (!checkbom) throw Oops.Oh("找不到配方信息"); | |||||
var resEntity = new BPA_BomEntry(); | var resEntity = new BPA_BomEntry(); | ||||
resEntity.BatchingId = dto.BatchingId; | resEntity.BatchingId = dto.BatchingId; | ||||
resEntity.BomId = dto.BomId; | resEntity.BomId = dto.BomId; | ||||
@@ -28,15 +28,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser | |||||
//检查key | //检查key | ||||
await CheckKey(key); | await CheckKey(key); | ||||
var thisSign = signStr + "&key=" + key; | |||||
var vvv = MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper(); | |||||
//var thisSign = signStr + "&key=" + key; | |||||
//var vvv = MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper(); | |||||
var vvvvv = thisSign.ToUpper(); | |||||
//var vvvvv = thisSign.ToUpper(); | |||||
if (MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper() != signMd5.ToUpper()) | |||||
{ | |||||
throw Oops.Oh(ErrorCodeEnum.Code1005); | |||||
} | |||||
//if (MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper() != signMd5.ToUpper()) | |||||
//{ | |||||
// throw Oops.Oh(ErrorCodeEnum.Code1005); | |||||
//} | |||||
} | } | ||||
@@ -9,6 +9,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos | |||||
public class DevicePageInputDto | public class DevicePageInputDto | ||||
{ | { | ||||
public string ProductName { get; set; } | public string ProductName { get; set; } | ||||
public string DeviceName { get; set; } | |||||
public string ProductVesion { get; set; } | public string ProductVesion { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// 当前页码 | /// 当前页码 | ||||
@@ -17,7 +17,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos | |||||
/// <summary> | /// <summary> | ||||
/// 设备标签 | /// 设备标签 | ||||
/// </summary> | /// </summary> | ||||
public string DeviceTypeId { get; set; } | |||||
public string DeviceTypeName { get; set; } | |||||
} | } | ||||
} | } |
@@ -38,6 +38,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services | |||||
var data =await SqlSugarDb.Db.Queryable<BPA_DeviceInfo, BPA_Product,BPA_ProductVesion>((a, b,c) => | var data =await SqlSugarDb.Db.Queryable<BPA_DeviceInfo, BPA_Product,BPA_ProductVesion>((a, b,c) => | ||||
new JoinQueryInfos(JoinType.Left, a.ProductId == b.Id, JoinType.Left, a.ProductVersionId == c.Id)) | new JoinQueryInfos(JoinType.Left, a.ProductId == b.Id, JoinType.Left, a.ProductVersionId == c.Id)) | ||||
.WhereIF(!string.IsNullOrEmpty(inputDto.ProductName), (a, b, c) => b.Name.Contains(inputDto.ProductName)) | .WhereIF(!string.IsNullOrEmpty(inputDto.ProductName), (a, b, c) => b.Name.Contains(inputDto.ProductName)) | ||||
.WhereIF(!string.IsNullOrEmpty(inputDto.DeviceName), (a, b, c) => a.DeviceName.Contains(inputDto.DeviceName)) | |||||
.WhereIF(!string.IsNullOrEmpty(inputDto.ProductVesion), (a, b, c) => c.Vesion.Contains(inputDto.ProductVesion)) | .WhereIF(!string.IsNullOrEmpty(inputDto.ProductVesion), (a, b, c) => c.Vesion.Contains(inputDto.ProductVesion)) | ||||
.Select((a, b, c) => new DeviceDto() | .Select((a, b, c) => new DeviceDto() | ||||
{ | { | ||||
@@ -107,25 +108,17 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services | |||||
//resEntity.StopId = dto.StopId; | //resEntity.StopId = dto.StopId; | ||||
//resEntity.ProductId = dto.ProductId; | //resEntity.ProductId = dto.ProductId; | ||||
//resEntity.ProductVersionId = dto.ProductVersionId; | //resEntity.ProductVersionId = dto.ProductVersionId; | ||||
if (!string.IsNullOrWhiteSpace(dto.DeviceTypeId)) | |||||
if (!string.IsNullOrWhiteSpace(dto.DeviceTypeName)) | |||||
{ | { | ||||
var check = SqlSugarDb.Db.Queryable<BPA_DeviceType>().Where(x => x.Id == dto.DeviceTypeId).First(); | |||||
var check = SqlSugarDb.Db.Queryable<BPA_DeviceType>().Where(x => x.Name == dto.DeviceTypeName).First(); | |||||
if (check != null) | if (check != null) | ||||
{ | { | ||||
resEntity.DeviceTypeId = check.Id; | resEntity.DeviceTypeId = check.Id; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
var check1 = SqlSugarDb.Db.Queryable<BPA_DeviceType>().Where(x => x.Name == "默认标签").First(); | |||||
if (check1 != null) | |||||
{ | |||||
resEntity.DeviceTypeId = check1.Id; | |||||
} | |||||
else | |||||
{ | |||||
var DeviceType = await SqlSugarDb.Db.Insertable(new BPA_DeviceType() { Name = "默认标签" }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | |||||
resEntity.DeviceTypeId = DeviceType.Id; | |||||
} | |||||
var DeviceType = await SqlSugarDb.Db.Insertable(new BPA_DeviceType() { Name = dto.DeviceTypeName }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | |||||
resEntity.DeviceTypeId = DeviceType.Id; | |||||
} | } | ||||
} | } | ||||
var res = await SqlSugarDb.Db.Updateable(resEntity).ExecuteCommandAsync(); | var res = await SqlSugarDb.Db.Updateable(resEntity).ExecuteCommandAsync(); | ||||
@@ -16,7 +16,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
/// 商品分类 | /// 商品分类 | ||||
/// </summary> | /// </summary> | ||||
public string GoodsTypeName { get; set; } | public string GoodsTypeName { get; set; } | ||||
public List<GoodsAttributeValue> GoodsAttributeValue { get; set; } | |||||
public List<GoodsAttributeInsertValue> GoodsAttributeValue { get; set; } | |||||
} | |||||
public class GoodsAttributeInsertValue | |||||
{ | |||||
/// <summary> | |||||
/// 属性值 | |||||
/// </summary> | |||||
public string AttributeValue { get; set; } | |||||
public int Sort { get; set; } | |||||
} | } | ||||
public class GoodsAttributeValue | public class GoodsAttributeValue | ||||
{ | { | ||||
@@ -9,5 +9,6 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos | |||||
public class GoodsIdDto | public class GoodsIdDto | ||||
{ | { | ||||
public string GoodsId { get; set; } | public string GoodsId { get; set; } | ||||
public string GoodsTypeId { 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 GoodsUintDelDto | |||||
{ | |||||
public List<string> Ids { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,14 @@ | |||||
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 GoodsUintInsertDto | |||||
{ | |||||
public string Name { get; set; } | |||||
public string Remark { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,14 @@ | |||||
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 GoodsUintQueryDto | |||||
{ | |||||
public int Current { get; set; } | |||||
public int PageSize { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,15 @@ | |||||
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 GoodsUintUpdateDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Name { get; set; } | |||||
public string Remark { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,15 @@ | |||||
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 GoodsUintViewDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Name { get; set; } | |||||
public string Remark { 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 GoodstypeDelDto | |||||
{ | |||||
public List<string> Ids { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,15 @@ | |||||
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 GoodstypeInsertDto | |||||
{ | |||||
public string Pid { get; set; } | |||||
public string Name { get; set; } | |||||
public int Sort { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,14 @@ | |||||
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 GoodstypeQueryDto | |||||
{ | |||||
public int Current { get; set; } | |||||
public int PageSize { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,16 @@ | |||||
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 GoodstypeUpdateDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Pid { get; set; } | |||||
public string Name { get; set; } | |||||
public int Sort { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,16 @@ | |||||
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 GoodstypeViewDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string Pid { get; set; } | |||||
public string Name { get; set; } | |||||
public int Sort { get; set; } | |||||
} | |||||
} |
@@ -73,6 +73,16 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
return await _goodsService.AddGoodsAttribute(dto); | return await _goodsService.AddGoodsAttribute(dto); | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 添加商品属性值 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsAttributeValue")] | |||||
public async Task<bool> AddGoodsAttributeValue(List<GoodsAttributeValue> dto) | |||||
{ | |||||
return await _goodsService.AddGoodsAttributeValue(dto); | |||||
} | |||||
/// <summary> | |||||
/// 查询商品属性 | /// 查询商品属性 | ||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
@@ -91,5 +101,85 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods | |||||
{ | { | ||||
return await _goodsService.GetGoodsTechnologyAction(goodsId); | return await _goodsService.GetGoodsTechnologyAction(goodsId); | ||||
} | } | ||||
/// <summary> | |||||
/// 查询商品分类 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/GetGoodsTypePage")] | |||||
public async Task<PageUtil> GetGoodsTypePage(GoodstypeQueryDto dto) | |||||
{ | |||||
return await _goodsService.GetGoodsTypePage(dto); | |||||
} | |||||
/// <summary> | |||||
/// 添加商品分类 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsType")] | |||||
public async Task<bool> AddGoodsType(List<GoodstypeInsertDto> dto) | |||||
{ | |||||
return await _goodsService.AddGoodsType(dto); | |||||
} | |||||
/// <summary> | |||||
/// 修改商品分类 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/UpdateGoodsType")] | |||||
public async Task<bool> UpdateGoodsType(GoodstypeUpdateDto dto) | |||||
{ | |||||
return await _goodsService.UpdateGoodsType(dto); | |||||
} | |||||
/// <summary> | |||||
/// 删除商品分类 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/DelGoodsType")] | |||||
public async Task<bool> DelGoodsType(GoodstypeDelDto dto) | |||||
{ | |||||
return await _goodsService.DelGoodsType(dto); | |||||
} | |||||
/// <summary> | |||||
/// 查询商品单位 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/GetGoodsUintPage")] | |||||
public async Task<PageUtil> GetGoodsUintPage(GoodsUintQueryDto dto) | |||||
{ | |||||
return await _goodsService.GetGoodsUintPage(dto); | |||||
} | |||||
/// <summary> | |||||
///添加商品单位 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/AddGoodsUint")] | |||||
public async Task<bool> AddGoodsUint(List<GoodsUintInsertDto> dto) | |||||
{ | |||||
return await _goodsService.AddGoodsUint(dto); | |||||
} | |||||
/// <summary> | |||||
///修改商品单位 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/UpdateGoodsUint")] | |||||
public async Task<bool> UpdateGoodsUint(GoodsUintUpdateDto dto) | |||||
{ | |||||
return await _goodsService.UpdateGoodsUint(dto); | |||||
} | |||||
/// <summary> | |||||
///删除商品单位 | |||||
/// </summary> | |||||
/// <param name="dto"></param> | |||||
/// <returns></returns> | |||||
[HttpPost("/api/ExternalPlatform/Goods/DelGoodsUint")] | |||||
public async Task<bool> DelGoodsUint(GoodsUintDelDto dto) | |||||
{ | |||||
return await _goodsService.DelGoodsUint(dto); | |||||
} | |||||
} | } | ||||
} | } |
@@ -7,6 +7,7 @@ using BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Dtos; | |||||
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Services; | using BPA.SAAS.Manage.Application.AExternalPlatform.Service.ThirdpartyPush.Services; | ||||
using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods; | using BPA.SAAS.Manage.Application.DataBase.Dtos.Goods; | ||||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology; | using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsTechnology; | ||||
using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsType; | |||||
using BPA.SAAS.Manage.Core.Base; | using BPA.SAAS.Manage.Core.Base; | ||||
using BPA.SAAS.Manage.Core.DataBase; | using BPA.SAAS.Manage.Core.DataBase; | ||||
using BPA.SAAS.Manage.Core.Device; | using BPA.SAAS.Manage.Core.Device; | ||||
@@ -18,12 +19,12 @@ using GoodsDto = BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dto | |||||
namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | ||||
{ | { | ||||
public class GoodsService: IGoodsService, ITransient | |||||
public class GoodsService : IGoodsService, ITransient | |||||
{ | { | ||||
private readonly IThirdpartyPushService _thirdpartyPushService; | private readonly IThirdpartyPushService _thirdpartyPushService; | ||||
public GoodsService(IThirdpartyPushService thirdpartyPushService) | |||||
public GoodsService(IThirdpartyPushService thirdpartyPushService) | |||||
{ | { | ||||
_thirdpartyPushService= thirdpartyPushService; | |||||
_thirdpartyPushService = thirdpartyPushService; | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 分页查询商品 | /// 分页查询商品 | ||||
@@ -40,15 +41,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
.WhereIF(!string.IsNullOrEmpty(inputDto.GoodsTypeName), (a, b, c) => b.Name.Contains(inputDto.GoodsTypeName)) | .WhereIF(!string.IsNullOrEmpty(inputDto.GoodsTypeName), (a, b, c) => b.Name.Contains(inputDto.GoodsTypeName)) | ||||
.Select((a, b, c) => new GoodsDto() | .Select((a, b, c) => new GoodsDto() | ||||
{ | { | ||||
Id =a.Id.SelectAll() , | |||||
GoodsTypeName=b.Name, | |||||
GoodsUnitName=c.Name | |||||
Id = a.Id.SelectAll(), | |||||
GoodsTypeName = b.Name, | |||||
GoodsUnitName = c.Name | |||||
}) | }) | ||||
.Mapper(x => | .Mapper(x => | ||||
{ | { | ||||
var GoodsAttributePriceList=SqlSugarDb.Db.Queryable<BPA_GoodsAttributePrice>().Where(y => y.GoodsId == x.Id).ToList(); | |||||
var list=GoodsAttributePriceList.Adapt<List<GoodsAttributePrice>>(); | |||||
var GoodsAttributePriceList = SqlSugarDb.Db.Queryable<BPA_GoodsAttributePrice>().Where(y => y.GoodsId == x.Id).ToList(); | |||||
var list = GoodsAttributePriceList.Adapt<List<GoodsAttributePrice>>(); | |||||
x.GoodsAttributePrice = list; | x.GoodsAttributePrice = list; | ||||
}) | }) | ||||
.ToPageList(inputDto.Current, inputDto.PageSize, ref total); | .ToPageList(inputDto.Current, inputDto.PageSize, ref total); | ||||
@@ -64,17 +65,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
/// </summary> | /// </summary> | ||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> AddGoods(BaseRequestDto<GoodsInsertDto> dto) | |||||
public async Task<bool> AddGoods(BaseRequestDto<GoodsInsertDto> dto) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
SqlSugarDb.Db.BeginTran(); | SqlSugarDb.Db.BeginTran(); | ||||
List< BPA_GoodsInfo > list = new(); | |||||
List<BPA_GoodsInfo> list = new(); | |||||
List<BPA_GoodsType> GoodsTypelist = new(); | List<BPA_GoodsType> GoodsTypelist = new(); | ||||
List<BPA_GoodsUint> GoodsUintlist = new(); | List<BPA_GoodsUint> GoodsUintlist = new(); | ||||
for (int i = 0; i < dto.DataInfo.Count; i++) | for (int i = 0; i < dto.DataInfo.Count; i++) | ||||
{ | { | ||||
var resEntity = new BPA_GoodsInfo(); | var resEntity = new BPA_GoodsInfo(); | ||||
resEntity.Id = Guid.NewGuid().ToString(); | |||||
resEntity.Name = dto.DataInfo[i].Name; | resEntity.Name = dto.DataInfo[i].Name; | ||||
resEntity.Descritption = dto.DataInfo[i].Descritption; | resEntity.Descritption = dto.DataInfo[i].Descritption; | ||||
resEntity.ImgUrl = dto.DataInfo[i].ImgUrl; | resEntity.ImgUrl = dto.DataInfo[i].ImgUrl; | ||||
@@ -101,7 +103,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
var check1 = SqlSugarDb.Db.Queryable<BPA_GoodsUint>().Where(x => x.Name == dto.DataInfo[i].GoodsUintName).First(); | var check1 = SqlSugarDb.Db.Queryable<BPA_GoodsUint>().Where(x => x.Name == dto.DataInfo[i].GoodsUintName).First(); | ||||
if (check1 == null) | if (check1 == null) | ||||
{ | { | ||||
var GoodsUint = new BPA_GoodsUint() { Id = Guid.NewGuid().ToString(),Name = dto.DataInfo[i].GoodsUintName }; | |||||
var GoodsUint = new BPA_GoodsUint() { Id = Guid.NewGuid().ToString(), Name = dto.DataInfo[i].GoodsUintName }; | |||||
GoodsUintlist.Add(GoodsUint); | GoodsUintlist.Add(GoodsUint); | ||||
resEntity.GoodsUintId = GoodsUint.Id; | resEntity.GoodsUintId = GoodsUint.Id; | ||||
} | } | ||||
@@ -110,47 +112,48 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
resEntity.GoodsUintId = check1.Id; | resEntity.GoodsUintId = check1.Id; | ||||
} | } | ||||
} | } | ||||
list.Add(resEntity); | |||||
} | } | ||||
await SqlSugarDb.Db.Insertable(GoodsTypelist).ExecuteCommandAsync(); | await SqlSugarDb.Db.Insertable(GoodsTypelist).ExecuteCommandAsync(); | ||||
await SqlSugarDb.Db.Insertable(GoodsUintlist).ExecuteCommandAsync(); | await SqlSugarDb.Db.Insertable(GoodsUintlist).ExecuteCommandAsync(); | ||||
var res = await SqlSugarDb.Db.Insertable(list).ExecuteReturnEntityAsync(); | var res = await SqlSugarDb.Db.Insertable(list).ExecuteReturnEntityAsync(); | ||||
SqlSugarDb.Db.CommitTran(); | SqlSugarDb.Db.CommitTran(); | ||||
#region 下发数据到设备 | #region 下发数据到设备 | ||||
var data = SqlSugarDb.Db.Queryable<BPA_GoodsInfo, BPA_GoodsType, BPA_GoodsUint>((a, b, c) => | |||||
new JoinQueryInfos(JoinType.Left, a.GoodsTypeId == b.Id, | |||||
JoinType.Left, a.GoodsUintId == c.Id)) | |||||
.Where((a, b, c) => a.Id == res.Id).Select((a, b, c) => new GoodsInfoPushDto() | |||||
{ | |||||
Id = a.Id, | |||||
Name = a.Name, | |||||
Descritption = a.Descritption, | |||||
ImgUrl = a.ImgUrl, | |||||
Sort = a.Sort, | |||||
Price = a.Price, | |||||
GoodsUintId = a.GoodsUintId, | |||||
GoodsUintName = c.Name, | |||||
IsWeigh = a.IsWeigh, | |||||
Design = a.Design, | |||||
DefaultMate = a.DefaultMate, | |||||
IsAttrubute = a.IsAttrubute, | |||||
GoodsTypeId = a.GoodsTypeId, | |||||
GoodsTypeName = b.Name, | |||||
}).First(); | |||||
if (dto.IsPush) | if (dto.IsPush) | ||||
{ | { | ||||
await _thirdpartyPushService.AddPushRecordAndPushDevice(dto,1, res.Id, | |||||
var data = SqlSugarDb.Db.Queryable<BPA_GoodsInfo, BPA_GoodsType, BPA_GoodsUint>((a, b, c) => | |||||
new JoinQueryInfos(JoinType.Left, a.GoodsTypeId == b.Id, | |||||
JoinType.Left, a.GoodsUintId == c.Id)) | |||||
.Where((a, b, c) => a.Id == res.Id).Select((a, b, c) => new GoodsInfoPushDto() | |||||
{ | |||||
Id = a.Id, | |||||
Name = a.Name, | |||||
Descritption = a.Descritption, | |||||
ImgUrl = a.ImgUrl, | |||||
Sort = a.Sort, | |||||
Price = a.Price, | |||||
GoodsUintId = a.GoodsUintId, | |||||
GoodsUintName = c.Name, | |||||
IsWeigh = a.IsWeigh, | |||||
Design = a.Design, | |||||
DefaultMate = a.DefaultMate, | |||||
IsAttrubute = a.IsAttrubute, | |||||
GoodsTypeId = a.GoodsTypeId, | |||||
GoodsTypeName = b.Name, | |||||
}).First(); | |||||
await _thirdpartyPushService.AddPushRecordAndPushDevice(dto, 1, res.Id, | |||||
JsonConvert.SerializeObject(data)); | JsonConvert.SerializeObject(data)); | ||||
} | } | ||||
#endregion | #endregion | ||||
return res !=null; | |||||
return res != null; | |||||
} | } | ||||
catch (Exception) | catch (Exception) | ||||
{ | { | ||||
SqlSugarDb.Db.RollbackTran(); | SqlSugarDb.Db.RollbackTran(); | ||||
throw Oops.Oh(ErrorCodeEnum.Code1007); | throw Oops.Oh(ErrorCodeEnum.Code1007); | ||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 更新商品 | /// 更新商品 | ||||
@@ -161,22 +164,30 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
{ | { | ||||
List<BPA_GoodsInfo> list = new(); | List<BPA_GoodsInfo> list = new(); | ||||
if (dto.DataInfo.Count > 1) throw Oops.Oh("不支持多条商品修改"); | if (dto.DataInfo.Count > 1) throw Oops.Oh("不支持多条商品修改"); | ||||
for (int i = 0; i < dto.DataInfo.Count; i++) | |||||
{ | |||||
var resEntity = SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.DataInfo[i].Id); | |||||
if (dto.DataInfo == null || dto.DataInfo.Count==0) throw Oops.Oh("修改数据不能为空"); | |||||
var model = dto.DataInfo.First(); | |||||
var checktype=SqlSugarDb.Db.Queryable<BPA_GoodsType>().Where(x => x.Id == model.GoodsTypeId).Any(); | |||||
if (!checktype) throw Oops.Oh("商品分类不存在"); | |||||
var checktunit = SqlSugarDb.Db.Queryable<BPA_GoodsUint>().Where(x => x.Id == model.GoodsUintId).Any(); | |||||
if (!checktunit) throw Oops.Oh("商品单位不存在"); | |||||
var resEntity = SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().Where(it => it.IsDeleted == 0).First(it => it.Id == model.Id); | |||||
if (resEntity != null) | if (resEntity != null) | ||||
{ | { | ||||
resEntity.GoodsTypeId = dto.DataInfo[i].GoodsTypeId; | |||||
resEntity.Name = dto.DataInfo[i].Name; | |||||
resEntity.Descritption = dto.DataInfo[i].Descritption; | |||||
resEntity.ImgUrl = dto.DataInfo[i].ImgUrl; | |||||
resEntity.Price = dto.DataInfo[i].Price; | |||||
resEntity.IsWeigh = dto.DataInfo[i].IsWeigh; | |||||
resEntity.GoodsUintId = dto.DataInfo[i].GoodsUintId; | |||||
resEntity.Id= model.Id; | |||||
resEntity.GoodsTypeId = model.GoodsTypeId; | |||||
resEntity.Name = model.Name; | |||||
resEntity.Descritption = model.Descritption; | |||||
resEntity.ImgUrl = model.ImgUrl; | |||||
resEntity.Price = model.Price; | |||||
resEntity.IsWeigh = model.IsWeigh; | |||||
resEntity.GoodsUintId = model.GoodsUintId; | |||||
list.Add(resEntity); | list.Add(resEntity); | ||||
var res = await SqlSugarDb.Db.Updateable(list).ExecuteCommandAsync(); | var res = await SqlSugarDb.Db.Updateable(list).ExecuteCommandAsync(); | ||||
#region 下发数据到设备 | #region 下发数据到设备 | ||||
var data = SqlSugarDb.Db.Queryable<BPA_GoodsInfo, BPA_GoodsType, BPA_GoodsUint>((a, b, c) => | |||||
if (dto.IsPush) | |||||
{ | |||||
var data = SqlSugarDb.Db.Queryable<BPA_GoodsInfo, BPA_GoodsType, BPA_GoodsUint>((a, b, c) => | |||||
new JoinQueryInfos(JoinType.Left, a.GoodsTypeId == b.Id, | new JoinQueryInfos(JoinType.Left, a.GoodsTypeId == b.Id, | ||||
JoinType.Left, a.GoodsUintId == c.Id)) | JoinType.Left, a.GoodsUintId == c.Id)) | ||||
.Where((a, b, c) => a.Id == resEntity.Id).Select((a, b, c) => new GoodsInfoPushDto() | .Where((a, b, c) => a.Id == resEntity.Id).Select((a, b, c) => new GoodsInfoPushDto() | ||||
@@ -196,13 +207,11 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
GoodsTypeId = a.GoodsTypeId, | GoodsTypeId = a.GoodsTypeId, | ||||
GoodsTypeName = b.Name, | GoodsTypeName = b.Name, | ||||
}).First(); | }).First(); | ||||
if (dto.IsPush) | |||||
{ | |||||
await _thirdpartyPushService.AddPushRecordAndPushDevice(dto, 1, resEntity.Id, | await _thirdpartyPushService.AddPushRecordAndPushDevice(dto, 1, resEntity.Id, | ||||
JsonConvert.SerializeObject(data)); | JsonConvert.SerializeObject(data)); | ||||
} | } | ||||
#endregion | #endregion | ||||
} | |||||
} | } | ||||
// 查询数据库中是否存在未删除的商品类型 | // 查询数据库中是否存在未删除的商品类型 | ||||
@@ -251,7 +260,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
var GoodsType = SqlSugarDb.Db.Queryable<BPA_GoodsType>().Where(x => x.Name == dto.GoodsTypeName).First(); | var GoodsType = SqlSugarDb.Db.Queryable<BPA_GoodsType>().Where(x => x.Name == dto.GoodsTypeName).First(); | ||||
if (GoodsType == null) | if (GoodsType == null) | ||||
{ | { | ||||
var resGoodsType = await SqlSugarDb.Db.Insertable(new BPA_GoodsType() { Pid = "", Name = "默认分类" }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | |||||
var resGoodsType = await SqlSugarDb.Db.Insertable(new BPA_GoodsType() { Pid = "0", Name = dto.GoodsTypeName }).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | |||||
_GoodsAttribute.GoodsTypeId = resGoodsType.Id; | _GoodsAttribute.GoodsTypeId = resGoodsType.Id; | ||||
} | } | ||||
else | else | ||||
@@ -266,6 +275,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
for (int i = 0; i < dto.GoodsAttributeValue.Count; i++) | for (int i = 0; i < dto.GoodsAttributeValue.Count; i++) | ||||
{ | { | ||||
BPA_GoodsAttributeValue _GoodsAttributeValue = new(); | BPA_GoodsAttributeValue _GoodsAttributeValue = new(); | ||||
_GoodsAttributeValue.Id= Guid.NewGuid().ToString(); | |||||
_GoodsAttributeValue.GoodsAttributeId = _GoodsAttribute.Id; | _GoodsAttributeValue.GoodsAttributeId = _GoodsAttribute.Id; | ||||
_GoodsAttributeValue.AttributeValue = dto.GoodsAttributeValue[i].AttributeValue; | _GoodsAttributeValue.AttributeValue = dto.GoodsAttributeValue[i].AttributeValue; | ||||
_GoodsAttributeValue.Sort = dto.GoodsAttributeValue[i].Sort; | _GoodsAttributeValue.Sort = dto.GoodsAttributeValue[i].Sort; | ||||
@@ -283,6 +293,58 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
throw; | throw; | ||||
} | } | ||||
} | |||||
public async Task<bool> AddGoodsAttributeValue(List<GoodsAttributeValue> dto) | |||||
{ | |||||
try | |||||
{ | |||||
List<BPA_GoodsAttributeValue> GoodsAttributeValueList = new(); | |||||
List<BPA_GoodsAttributeValue> GoodsAttributeValueListup = new(); | |||||
if (dto.Count > 0) | |||||
{ | |||||
for (int i = 0; i < dto.Count; i++) | |||||
{ | |||||
if (string.IsNullOrWhiteSpace(dto[i].Id)) | |||||
{ | |||||
BPA_GoodsAttributeValue _GoodsAttributeValue = new(); | |||||
_GoodsAttributeValue.Id = Guid.NewGuid().ToString(); | |||||
_GoodsAttributeValue.GoodsAttributeId = dto[i].GoodsAttributeId; | |||||
_GoodsAttributeValue.AttributeValue = dto[i].AttributeValue; | |||||
_GoodsAttributeValue.Sort = dto[i].Sort; | |||||
GoodsAttributeValueList.Add(_GoodsAttributeValue); | |||||
} | |||||
else | |||||
{ | |||||
var _GoodsAttributeValue=SqlSugarDb.Db.Queryable<BPA_GoodsAttributeValue>().Where(x => x.Id == dto[i].Id).First(); | |||||
if (_GoodsAttributeValue != null) | |||||
{ | |||||
// _GoodsAttributeValue.Id = Guid.NewGuid().ToString(); | |||||
_GoodsAttributeValue.GoodsAttributeId = dto[i].GoodsAttributeId; | |||||
_GoodsAttributeValue.AttributeValue = dto[i].AttributeValue; | |||||
_GoodsAttributeValue.Sort = dto[i].Sort; | |||||
GoodsAttributeValueListup.Add(_GoodsAttributeValue); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
var res = 0; | |||||
if (GoodsAttributeValueListup.Count > 0) | |||||
{ | |||||
res= SqlSugarDb.Db.Updateable(GoodsAttributeValueListup).ExecuteCommand(); | |||||
} | |||||
if (GoodsAttributeValueList.Count > 0) | |||||
{ | |||||
res = SqlSugarDb.Db.Insertable(GoodsAttributeValueList).ExecuteCommand(); | |||||
} | |||||
return res > 0; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
SqlSugarDb.Db.RollbackTran(); | |||||
throw Oops.Oh(ErrorCodeEnum.Code1007); | |||||
throw; | |||||
} | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||
/// 查询商品属性 | /// 查询商品属性 | ||||
@@ -291,11 +353,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
public async Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList(GoodsIdDto dto) | public async Task<List<GoodsAttributeVewDto>> GetGoodsAttributeList(GoodsIdDto dto) | ||||
{ | { | ||||
var goodstypeid = ""; | var goodstypeid = ""; | ||||
var goods=SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().WhereIF(!string.IsNullOrWhiteSpace(dto.GoodsId), x => x.Id == dto.GoodsId).First(); | |||||
var goods=SqlSugarDb.Db.Queryable<BPA_GoodsInfo>().Where(x => x.Id == dto.GoodsId).First(); | |||||
if (goods != null) | if (goods != null) | ||||
{ | { | ||||
goodstypeid = goods.GoodsTypeId; | goodstypeid = goods.GoodsTypeId; | ||||
} | } | ||||
if (!string.IsNullOrWhiteSpace(dto.GoodsTypeId)) goodstypeid = dto.GoodsTypeId; | |||||
var res = await SqlSugarDb.Db.Queryable<BPA_GoodsAttribute>() | var res = await SqlSugarDb.Db.Queryable<BPA_GoodsAttribute>() | ||||
.WhereIF(!string.IsNullOrEmpty(goodstypeid),x=>x.GoodsTypeId== goodstypeid) | .WhereIF(!string.IsNullOrEmpty(goodstypeid),x=>x.GoodsTypeId== goodstypeid) | ||||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | .OrderBy(a => a.CreateAt, OrderByType.Desc) | ||||
@@ -353,7 +416,148 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
return goodsTechnologyActionListViews; | return goodsTechnologyActionListViews; | ||||
} | } | ||||
public async Task<PageUtil> GetGoodsTypePage(GoodstypeQueryDto dto) | |||||
{ | |||||
int total = new RefAsync<int>(); | |||||
var data = SqlSugarDb.Db.Queryable<BPA_GoodsType>() | |||||
.Select(a=> new GoodstypeViewDto() | |||||
{ | |||||
Id = a.Id.SelectAll() | |||||
}) | |||||
.ToPageList(dto.Current, dto.PageSize, ref total); | |||||
return new PageUtil() | |||||
{ | |||||
Total = total, | |||||
Data = data | |||||
}; | |||||
} | |||||
public async Task<bool> AddGoodsType(List<GoodstypeInsertDto> dto) | |||||
{ | |||||
try | |||||
{ | |||||
List<BPA_GoodsType> GoodsTypelist = new(); | |||||
for (int i = 0; i < dto.Count; i++) | |||||
{ | |||||
var resEntity = new BPA_GoodsType(); | |||||
resEntity.Id = Guid.NewGuid().ToString(); | |||||
resEntity.Name = dto[i].Name; | |||||
resEntity.Pid = dto[i].Pid; | |||||
resEntity.Sort = dto[i].Sort; | |||||
GoodsTypelist.Add(resEntity); | |||||
} | |||||
var res= await SqlSugarDb.Db.Insertable(GoodsTypelist).ExecuteCommandAsync(); | |||||
return res>0; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
throw Oops.Oh(ErrorCodeEnum.Code1007); | |||||
} | |||||
} | |||||
public async Task<bool> UpdateGoodsType(GoodstypeUpdateDto dto) | |||||
{ | |||||
try | |||||
{ | |||||
var model=SqlSugarDb.Db.Queryable<BPA_GoodsType>().Where(x => x.Id == dto.Id).First(); | |||||
if(model==null) throw Oops.Oh("商品分类不存在"); | |||||
model.Name = dto.Name; | |||||
model.Pid = dto.Pid; | |||||
model.Sort = dto.Sort; | |||||
var res = await SqlSugarDb.Db.Updateable(model).ExecuteCommandAsync(); | |||||
return res > 0; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
throw Oops.Oh(ErrorCodeEnum.Code1007); | |||||
} | |||||
} | |||||
public async Task<bool> DelGoodsType(GoodstypeDelDto dto) | |||||
{ | |||||
try | |||||
{ | |||||
var model = SqlSugarDb.Db.Queryable<BPA_GoodsType>().Where(x => dto.Ids.Contains(x.Id)).ToList(); | |||||
if (model == null) throw Oops.Oh("商品分类不存在"); | |||||
var res = await SqlSugarDb.Db.Deleteable(model).ExecuteCommandAsync(); | |||||
return res > 0; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
throw Oops.Oh(ErrorCodeEnum.Code1007); | |||||
} | |||||
} | |||||
public async Task<PageUtil> GetGoodsUintPage(GoodsUintQueryDto dto) | |||||
{ | |||||
int total = new RefAsync<int>(); | |||||
var data = SqlSugarDb.Db.Queryable<BPA_GoodsUint>() | |||||
.Select(a => new GoodsUintViewDto() | |||||
{ | |||||
Id = a.Id.SelectAll() | |||||
}) | |||||
.ToPageList(dto.Current, dto.PageSize, ref total); | |||||
return new PageUtil() | |||||
{ | |||||
Total = total, | |||||
Data = data | |||||
}; | |||||
} | |||||
public async Task<bool> AddGoodsUint(List<GoodsUintInsertDto> dto) | |||||
{ | |||||
try | |||||
{ | |||||
List<BPA_GoodsUint> GoodsUintlist = new(); | |||||
for (int i = 0; i < dto.Count; i++) | |||||
{ | |||||
var resEntity = new BPA_GoodsUint(); | |||||
resEntity.Id = Guid.NewGuid().ToString(); | |||||
resEntity.Name = dto[i].Name; | |||||
resEntity.Remark = dto[i].Remark; | |||||
GoodsUintlist.Add(resEntity); | |||||
} | |||||
var res = await SqlSugarDb.Db.Insertable(GoodsUintlist).ExecuteCommandAsync(); | |||||
return res > 0; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
throw Oops.Oh(ErrorCodeEnum.Code1007); | |||||
} | |||||
} | |||||
public async Task<bool> UpdateGoodsUint(GoodsUintUpdateDto dto) | |||||
{ | |||||
try | |||||
{ | |||||
var model = SqlSugarDb.Db.Queryable<BPA_GoodsUint>().Where(x => x.Id == dto.Id).First(); | |||||
if (model == null) throw Oops.Oh("商品单位不存在"); | |||||
model.Name = dto.Name; | |||||
model.Remark = dto.Remark; | |||||
var res = await SqlSugarDb.Db.Updateable(model).ExecuteCommandAsync(); | |||||
return res > 0; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
throw Oops.Oh(ErrorCodeEnum.Code1007); | |||||
} | |||||
} | |||||
public async Task<bool> DelGoodsUint(GoodsUintDelDto dto) | |||||
{ | |||||
try | |||||
{ | |||||
var model = SqlSugarDb.Db.Queryable<BPA_GoodsUint>().Where(x => dto.Ids.Contains(x.Id)).ToList(); | |||||
if (model == null) throw Oops.Oh("商品单位不存在"); | |||||
var res = await SqlSugarDb.Db.Deleteable(model).ExecuteCommandAsync(); | |||||
return res > 0; | |||||
} | |||||
catch (Exception) | |||||
{ | |||||
throw Oops.Oh(ErrorCodeEnum.Code1007); | |||||
} | |||||
} | |||||
private string GetNumber2(int Length = 10) | private string GetNumber2(int Length = 10) | ||||
{ | { | ||||
byte[] buffer = Guid.NewGuid().ToByteArray(); | byte[] buffer = Guid.NewGuid().ToByteArray(); | ||||
@@ -41,6 +41,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
/// <param name="dto"></param> | /// <param name="dto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<bool> AddGoodsAttribute(GoodsAttributeinsertDto dto); | Task<bool> AddGoodsAttribute(GoodsAttributeinsertDto dto); | ||||
Task<bool> AddGoodsAttributeValue(List<GoodsAttributeValue> dto); | |||||
/// <summary> | /// <summary> | ||||
/// 查询商品属性 | /// 查询商品属性 | ||||
/// </summary> | /// </summary> | ||||
@@ -52,5 +53,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Services | |||||
/// <param name="goodsId"></param> | /// <param name="goodsId"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
Task<List<GoodsTechnologyActionListViewDto>> GetGoodsTechnologyAction(GoodsIdDto goodsId); | Task<List<GoodsTechnologyActionListViewDto>> GetGoodsTechnologyAction(GoodsIdDto goodsId); | ||||
Task<PageUtil> GetGoodsTypePage(GoodstypeQueryDto dto); | |||||
Task<bool> AddGoodsType(List<GoodstypeInsertDto> dto); | |||||
Task<bool> UpdateGoodsType(GoodstypeUpdateDto dto); | |||||
Task<bool> DelGoodsType(GoodstypeDelDto dto); | |||||
Task<PageUtil> GetGoodsUintPage(GoodsUintQueryDto dto); | |||||
Task<bool> AddGoodsUint(List<GoodsUintInsertDto> dto); | |||||
Task<bool> UpdateGoodsUint(GoodsUintUpdateDto dto); | |||||
Task<bool> DelGoodsUint(GoodsUintDelDto dto); | |||||
} | } | ||||
} | } |
@@ -255,7 +255,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
} | } | ||||
//3.物料查询 | //3.物料查询 | ||||
var material = await SqlSugarDb.Db.Queryable<BPA_Batching>().FirstAsync(x => x.Code == materia.Code || x.Batching_Name == materia.Name); | var material = await SqlSugarDb.Db.Queryable<BPA_Batching>().FirstAsync(x => x.Code == materia.Code || x.Batching_Name == materia.Name); | ||||
// if(material==null) throw Oops.Oh(ErrorCodeEnum.Code1003); | |||||
var materialData = await SqlSugarDb.Db.Queryable<BPA_Batching>().FirstAsync(x => x.Id == materia.Id); | var materialData = await SqlSugarDb.Db.Queryable<BPA_Batching>().FirstAsync(x => x.Id == materia.Id); | ||||
if (materialData == null) | if (materialData == null) | ||||
@@ -271,7 +271,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Service | |||||
materialData = new BPA_Batching() | materialData = new BPA_Batching() | ||||
{ | { | ||||
Id = Guid.NewGuid().ToString(), | |||||
Id = materia.Id, | |||||
GroupId = CurrentUser.GroupId, | GroupId = CurrentUser.GroupId, | ||||
Aittribute = 0, | Aittribute = 0, | ||||
Batching_Name = materia.Name, | Batching_Name = materia.Name, | ||||
@@ -21,4 +21,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||||
public string Code { get; set; } | public string Code { get; set; } | ||||
public string BatchingId { get; set; } | public string BatchingId { get; set; } | ||||
} | } | ||||
public class WarehouseTemplatUpdateDto | |||||
{ | |||||
public string Id { get; set; } | |||||
public string DeviceId { get; set; } | |||||
public string TemplateName { get; set; } | |||||
public List<WarehousePostionUpdate> WarehousePostionData { get; set; } | |||||
} | |||||
public class WarehousePostionUpdate | |||||
{ | |||||
public string Id { get; set; } | |||||
public string TemplateId { get; set; } | |||||
public string Code { get; set; } | |||||
public string BatchingId { get; set; } | |||||
} | |||||
} | } |
@@ -13,6 +13,6 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||||
Task<PageUtil> GetWarehouseTemplatePage(WarehouseTemplateQueryDto inputDto); | Task<PageUtil> GetWarehouseTemplatePage(WarehouseTemplateQueryDto inputDto); | ||||
Task<List<WarehouseTemplateView>> GetWarehouseTemplateList(WarehouseDevideId dto); | Task<List<WarehouseTemplateView>> GetWarehouseTemplateList(WarehouseDevideId dto); | ||||
Task<bool> AddWarehouseTemplate(WarehouseTemplatInsertDto inputDto); | Task<bool> AddWarehouseTemplate(WarehouseTemplatInsertDto inputDto); | ||||
Task<bool> UpdateWarehouseTemplate(WarehouseTemplatInsertDto inputDto); | |||||
Task<bool> UpdateWarehouseTemplate(WarehouseTemplatUpdateDto inputDto); | |||||
} | } | ||||
} | } |
@@ -86,8 +86,10 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||||
if (string.IsNullOrWhiteSpace(inputDto.TemplateName)) throw Oops.Oh(ErrorCodeEnum.Code10020); | if (string.IsNullOrWhiteSpace(inputDto.TemplateName)) throw Oops.Oh(ErrorCodeEnum.Code10020); | ||||
var check = SqlSugarDb.Db.Queryable<BPA_WarehouseTemplate>().Where(x => x.TemplateName == inputDto.TemplateName).Any(); | var check = SqlSugarDb.Db.Queryable<BPA_WarehouseTemplate>().Where(x => x.TemplateName == inputDto.TemplateName).Any(); | ||||
if (check) throw Oops.Oh(ErrorCodeEnum.Code10018); | if (check) throw Oops.Oh(ErrorCodeEnum.Code10018); | ||||
var dev = SqlSugarDb.Db.Queryable<BPA_DeviceInfo>().Where(x => x.Id == inputDto.DeviceId).Any(); | |||||
if (!dev) throw Oops.Oh(ErrorCodeEnum.Code10012); | |||||
var dev = SqlSugarDb.Db.Queryable<BPA_DeviceInfo>().Where(x => x.Id == inputDto.DeviceId).First(); | |||||
if (dev==null) throw Oops.Oh(ErrorCodeEnum.Code10012); | |||||
var devvis = SqlSugarDb.Db.Queryable<BPA_ProductVesion>().Where(x => x.ProductId == dev.ProductId).First(); | |||||
if(devvis != null && devvis.ProductNumber< inputDto.WarehousePostionData.Count) throw Oops.Oh("仓位数量不足"); | |||||
var res = await SqlSugarDb.Db.Insertable(new BPA_WarehouseTemplate | var res = await SqlSugarDb.Db.Insertable(new BPA_WarehouseTemplate | ||||
{ | { | ||||
DeviceId = inputDto.DeviceId, | DeviceId = inputDto.DeviceId, | ||||
@@ -105,6 +107,14 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||||
}; | }; | ||||
list.Add(tem); | list.Add(tem); | ||||
} | } | ||||
for (int i = 0; i < devvis.ProductNumber - inputDto.WarehousePostionData.Count; i++) | |||||
{ | |||||
var tem = new BPA_WarehousePostion | |||||
{ | |||||
TemplateId = res.Id | |||||
}; | |||||
list.Add(tem); | |||||
} | |||||
var res1 = await SqlSugarDb.Db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | var res1 = await SqlSugarDb.Db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | ||||
SqlSugarDb.Db.Ado.CommitTran(); | SqlSugarDb.Db.Ado.CommitTran(); | ||||
return true; | return true; | ||||
@@ -121,7 +131,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||||
/// 修改 | /// 修改 | ||||
/// </summary> | /// </summary> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
public async Task<bool> UpdateWarehouseTemplate(WarehouseTemplatInsertDto inputDto) | |||||
public async Task<bool> UpdateWarehouseTemplate(WarehouseTemplatUpdateDto inputDto) | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -132,21 +142,18 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||||
model.TemplateName = inputDto.TemplateName; | model.TemplateName = inputDto.TemplateName; | ||||
var res = await SqlSugarDb.Db.Updateable(model).ExecuteCommandAsync(); | var res = await SqlSugarDb.Db.Updateable(model).ExecuteCommandAsync(); | ||||
var warehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion>().Where(x => x.TemplateId == inputDto.Id).ToList(); | var warehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion>().Where(x => x.TemplateId == inputDto.Id).ToList(); | ||||
await SqlSugarDb.Db.Deleteable(warehousePostion).ExecuteCommandAsync(); | |||||
//await SqlSugarDb.Db.Deleteable(warehousePostion).ExecuteCommandAsync(); | |||||
List<BPA_WarehousePostion> list = new(); | List<BPA_WarehousePostion> list = new(); | ||||
for (int i = 0; i < inputDto.WarehousePostionData.Count; i++) | for (int i = 0; i < inputDto.WarehousePostionData.Count; i++) | ||||
{ | { | ||||
var tem = new BPA_WarehousePostion | |||||
{ | |||||
TemplateId = inputDto.Id, | |||||
Code = inputDto.WarehousePostionData[i].Code, | |||||
BatchingId = inputDto.WarehousePostionData[i].BatchingId, | |||||
}; | |||||
list.Add(tem); | |||||
var reentity=warehousePostion.Where(x => x.Id == inputDto.WarehousePostionData[i].Id).First(); | |||||
reentity.Code = inputDto.WarehousePostionData[i].Code; | |||||
reentity.BatchingId = inputDto.WarehousePostionData[i].BatchingId; | |||||
list.Add(reentity); | |||||
} | } | ||||
var res1 = await SqlSugarDb.Db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); | |||||
var res1 = await SqlSugarDb.Db.Updateable(list).ExecuteCommandAsync(); | |||||
SqlSugarDb.Db.Ado.CommitTran(); | SqlSugarDb.Db.Ado.CommitTran(); | ||||
return true; | |||||
return res1>0; | |||||
} | } | ||||
catch (Exception) | catch (Exception) | ||||
{ | { | ||||
@@ -48,7 +48,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat | |||||
/// <param name="inputDto"></param> | /// <param name="inputDto"></param> | ||||
/// <returns></returns> | /// <returns></returns> | ||||
[HttpPost("/api/ExternalPlatform/WareHouseTemplate/UpdateWarehouseTemplate")] | [HttpPost("/api/ExternalPlatform/WareHouseTemplate/UpdateWarehouseTemplate")] | ||||
public async Task<bool> UpdateWarehouseTemplate(WarehouseTemplatInsertDto inputDto) | |||||
public async Task<bool> UpdateWarehouseTemplate(WarehouseTemplatUpdateDto inputDto) | |||||
{ | { | ||||
return await _warehouseTemplateService.UpdateWarehouseTemplate(inputDto); | return await _warehouseTemplateService.UpdateWarehouseTemplate(inputDto); | ||||
} | } | ||||
@@ -45,7 +45,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
} | } | ||||
int total = new RefAsync<int>(); | int total = new RefAsync<int>(); | ||||
var res =await _db.Queryable<BPA_GoodsType>().Where(it => it.IsDeleted == 0 && it.GroupId== groupId) | |||||
var res =await _db.Queryable<BPA_GoodsType>() | |||||
.Where(conModels) | .Where(conModels) | ||||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | .OrderBy(a => a.CreateAt, OrderByType.Desc) | ||||
.Select(it => new GoodsTypeTree() { Id = it.Id, Name = it.Name, Pid = it.Pid,Sort=it.Sort,Remark=it.Remark,Status=it.Status }).ToTreeAsync(it => it.Children, it => it.Pid, 0); | .Select(it => new GoodsTypeTree() { Id = it.Id, Name = it.Name, Pid = it.Pid,Sort=it.Sort,Remark=it.Remark,Status=it.Status }).ToTreeAsync(it => it.Children, it => it.Pid, 0); | ||||
@@ -136,8 +136,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services | |||||
throw Oops.Oh("该类已经使用无法删除"); | throw Oops.Oh("该类已经使用无法删除"); | ||||
} | } | ||||
var resEntity = _db.Queryable<BPA_GoodsType>().First(it => it.Id == Id); | var resEntity = _db.Queryable<BPA_GoodsType>().First(it => it.Id == Id); | ||||
resEntity.IsDeleted = 1; | |||||
var res =await _db.Updateable(resEntity).ExecuteCommandAsync(); | |||||
var res =await _db.Deleteable(resEntity).ExecuteCommandAsync(); | |||||
return res > 0; | return res > 0; | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -77,9 +77,9 @@ namespace BPA.SAAS.Manage.Web.Core | |||||
List<PropertyInfo> proplist = new List<PropertyInfo>(); | List<PropertyInfo> proplist = new List<PropertyInfo>(); | ||||
foreach (var parameter in parameters) | foreach (var parameter in parameters) | ||||
{ | { | ||||
var stingA = DtoValidator.GetSign(parameter.Value); | |||||
//var stingA = DtoValidator.GetSign(parameter.Value); | |||||
//var sign = DtoValidator.GetAttributePrice(parameter.Value, "sign"); | //var sign = DtoValidator.GetAttributePrice(parameter.Value, "sign"); | ||||
await _checkServices.CheckSign(key, stingA, sign); | |||||
await _checkServices.CheckSign(key, "", sign); | |||||
} | } | ||||
} | } | ||||