zhaoy 9 kuukautta sitten
vanhempi
commit
6d168347d1
15 muutettua tiedostoa jossa 90 lisäystä ja 62 poistoa
  1. +2
    -2
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsDto.cs
  2. +1
    -1
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsQueryDto.cs
  3. +2
    -1
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeDto.cs
  4. +1
    -1
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeQueryDto.cs
  5. +3
    -2
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeView.cs
  6. +61
    -39
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs
  7. +7
    -7
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
  8. +2
    -0
      BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductQueryInputDto.cs
  9. +1
    -1
      BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs
  10. +2
    -0
      BPA.SAAS.Manage.Application/Device/Services/ProductService.cs
  11. +1
    -1
      BPA.SAAS.Manage.Application/Org/Interface/IOrganizeService.cs
  12. +3
    -3
      BPA.SAAS.Manage.Application/Org/OrganizeServices.cs
  13. +2
    -2
      BPA.SAAS.Manage.Application/Org/Services/OrganizeService.cs
  14. +1
    -1
      BPA.SAAS.Manage.Core/DataBase/BPA_GoodsInfo.cs
  15. +1
    -1
      BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs

+ 2
- 2
BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsDto.cs Näytä tiedosto

@@ -17,10 +17,10 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
public int Sort { get; set; }
public decimal Price { get; set; }
public string GoodsUintId { get; set; }
public string IsWeigh { get; set; }
public bool IsWeigh { get; set; }
public string Design { get; set; }
public string DefaultMate { get; set; }
public string IsAttrubute { get; set; }
public bool IsAttrubute { get; set; }
public string GoodsTypeId { get; set; }
public string Status { get; set; }
}


+ 1
- 1
BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsQueryDto.cs Näytä tiedosto

@@ -14,7 +14,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.Goods
public string DeviceId { get; set; }
public string Code { get; set; }
public string Design { get; set; }
public string GoodsTypeId { get; set; }
public string GoodsTypeName { get; set; }
/// <summary>
/// 状态 【正常 停用】默认 正常
/// </summary>


+ 2
- 1
BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeDto.cs Näytä tiedosto

@@ -13,7 +13,8 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute
/// <summary>
/// 商品小类id
/// </summary>
public string[] GoodsTypeId { get; set; }
public string GoodsTypeId { get; set; }
public List<GoodsAttributeValueDto> GoodsAttributeValueList { get; set; }
public int Sort { get; set; }
}
}

+ 1
- 1
BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeQueryDto.cs Näytä tiedosto

@@ -10,6 +10,6 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute
public class GoodsAttributeQueryDto : PageInputBase
{
public string AttributeName { get; set; }
public string GoodsTypeName { get; set; }
public string GoodsTypeId { get; set; }
}
}

+ 3
- 2
BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeView.cs Näytä tiedosto

@@ -1,4 +1,5 @@
using System;
using BPA.SAAS.Manage.Core.DataBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -17,7 +18,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute
/// 商品小类id
/// </summary>
public string GoodsTypeId { get; set; }
public string GoodsTypeName { get; set; }
public List<BPA_GoodsAttributeValue> AttributeValueList { get; set; }
public int Sort { get; set; }
}
}

+ 61
- 39
BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs Näytä tiedosto

@@ -30,7 +30,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices
var res = _db.Queryable<BPA_GoodsAttribute>()
.Where(a=> a.IsDeleted == 0)
.WhereIF(!dto.AttributeName.IsNullOrWhiteSpace(),x=>x.AttributeName.Contains(dto.AttributeName))
.WhereIF(!dto.GoodsTypeName.IsNullOrWhiteSpace(), x => x.GoodsTypeId.Contains(dto.GoodsTypeName))
.WhereIF(!dto.GoodsTypeId.IsNullOrWhiteSpace(), x => x.GoodsTypeId.Contains(dto.GoodsTypeId))
.OrderBy(a => a.CreateAt, OrderByType.Desc)
.Select(a => new GoodsAttributeView
{
@@ -41,8 +41,8 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices
})
.Mapper(x =>
{
var tyname=_db.Queryable<BPA_GoodsType>().Where(p=> x.GoodsTypeId.Contains(p.Id)).Select(x=>x.Name).ToArray();
x.GoodsTypeName = string.Join(",", tyname);
var list=_db.Queryable<BPA_GoodsAttributeValue>().Where(p=> p.GoodsAttributeId==x.Id).ToList();
x.AttributeValueList = list;
})
.ToPageList(dto.Current, dto.PageSize, ref total);
PageUtil util = new PageUtil()
@@ -59,30 +59,66 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices
/// <returns></returns>
public async Task<bool> AddGoodsAttribute(GoodsAttributeDto dto)
{
if (!string.IsNullOrWhiteSpace(dto.Id))
try
{
var resEntity = _db.Queryable<BPA_GoodsAttribute>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id);
if (null == resEntity)
if (!string.IsNullOrWhiteSpace(dto.Id))
{
return false;
_db.Ado.BeginTran();
var resEntity = _db.Queryable<BPA_GoodsAttribute>().Where(it => it.IsDeleted == 0).First(it => it.Id == dto.Id);
if (null == resEntity)
{
return false;
}
resEntity.AttributeName = dto.AttributeName;
resEntity.GoodsTypeId = dto.GoodsTypeId;
resEntity.Sort = dto.Sort;
await _db.Updateable(resEntity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();

var dellist = _db.Queryable<BPA_GoodsAttributeValue>().Where(it => it.GoodsAttributeId == dto.Id).ToList();
await _db.Deleteable(dellist).ExecuteCommandAsync(); ;
List<BPA_GoodsAttributeValue> list = new();
for (int i = 0; i < dto.GoodsAttributeValueList.Count; i++)
{
BPA_GoodsAttributeValue GoodsAttributeValue = new();
GoodsAttributeValue.AttributeValue = dto.GoodsAttributeValueList[i].AttributeValue;
GoodsAttributeValue.GoodsAttributeId = dto.Id;
GoodsAttributeValue.Sort= dto.GoodsAttributeValueList[i].Sort;
list.Add(GoodsAttributeValue);
}
var res = await _db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
_db.Ado.CommitTran();
return res > 0;
}
else
{
_db.Ado.BeginTran();
var newGoodsAttribute = new BPA_GoodsAttribute
{
AttributeName = dto.AttributeName,
GoodsTypeId = dto.GoodsTypeId,
Sort = dto.Sort,
};
var GoodsAttribute = await _db.Insertable(newGoodsAttribute).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
List<BPA_GoodsAttributeValue> list = new();
for (int i = 0; i < dto.GoodsAttributeValueList.Count; i++)
{
BPA_GoodsAttributeValue GoodsAttributeValue = new();
GoodsAttributeValue.AttributeValue = dto.GoodsAttributeValueList[i].AttributeValue;
GoodsAttributeValue.GoodsAttributeId = GoodsAttribute.Id;
GoodsAttributeValue.Sort = dto.GoodsAttributeValueList[i].Sort;
list.Add(GoodsAttributeValue);
}
var res = await _db.Insertable(list).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
_db.Ado.CommitTran();
return res > 0;
}
resEntity.AttributeName = dto.AttributeName;
resEntity.GoodsTypeId = string.Join(',', dto.GoodsTypeId) ;
resEntity.Sort = dto.Sort;
var res =await _db.Updateable(resEntity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
return res > 0;
}
else
catch (Exception)
{
var newGoodsAttribute = new BPA_GoodsAttribute
{
AttributeName = dto.AttributeName,
GoodsTypeId = string.Join(',', dto.GoodsTypeId),
Sort = dto.Sort,
};
var res =await _db.Insertable(newGoodsAttribute).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
return res > 0;
_db.Ado.RollbackTran();
throw Oops.Oh("添加失败");
}

}
/// <summary>
@@ -92,25 +128,16 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices
/// <returns></returns>
public async Task<bool> DeleteGoodsAttribute(string[] Ids)
{
// 查询数据库中是否存在未删除的商品
var resEntitites = _db.Queryable<BPA_GoodsAttribute>().In(Ids).ToList();

resEntitites.ForEach(x =>
{
x.IsDeleted = 1;
});
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync();
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync();
if (res > 0)
{
var resEntititesattr = _db.Queryable<BPA_GoodsAttributeValue>().In("GoodsAttributeId", Ids).ToList();
if (resEntititesattr != null)
{
resEntititesattr.ForEach(x =>
{
x.IsDeleted = 1;
});
await _db.Updateable(resEntititesattr).ExecuteCommandAsync();
await _db.Deleteable(resEntititesattr).ExecuteCommandAsync();
}
}
return res > 0;
@@ -188,12 +215,7 @@ namespace BPA.Franchisee.Application.FranchiseeCenter.GoodsServices
// 查询数据库中是否存在未删除的商品
var resEntitites = _db.Queryable<BPA_GoodsAttributeValue>().In(id).ToList();

resEntitites.ForEach(x =>
{
x.IsDeleted = 1;
});
var res =await _db.Updateable(resEntitites).ExecuteCommandAsync();
var res =await _db.Deleteable(resEntitites).ExecuteCommandAsync();
if (res > 0)
{



+ 7
- 7
BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs Näytä tiedosto

@@ -57,9 +57,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
conModels.Add(new ConditionalModel() { FieldName = "a.Name", ConditionalType = ConditionalType.Like, FieldValue = dto.Name });
}
if (!string.IsNullOrEmpty(dto.GoodsTypeId))
if (!string.IsNullOrEmpty(dto.GoodsTypeName))
{
conModels.Add(new ConditionalModel() { FieldName = "a.GoodsTypeId", ConditionalType = ConditionalType.Equal, FieldValue = dto.GoodsTypeId });
conModels.Add(new ConditionalModel() { FieldName = "a.GoodsTypeId", ConditionalType = ConditionalType.Equal, FieldValue = dto.GoodsTypeName });
}
if (!string.IsNullOrEmpty(dto.Status))
@@ -88,7 +88,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
Status = a.Status,
GoodsTypeId = b.IsDeleted == 0 ? a.GoodsTypeId : "",
GoodsTypeName = b.IsDeleted == 0 ? b.Name : "",
Remark = a.Descritption,
Descritption = a.Descritption,
IsDeleted = a.IsDeleted,
// CreateAt = a.CreateAt,
@@ -135,9 +135,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
resEntity.Descritption = dto.Descritption;
resEntity.ImgUrl = dto.ImgUrl;
resEntity.Price = dto.Price;
resEntity.IsWeigh = dto.IsWeigh == "false" ? 0 : 1;
resEntity.IsWeigh = dto.IsWeigh;
resEntity.GoodsUintId = dto.GoodsUintId;
resEntity.IsAttrubute = Convert.ToBoolean(dto.IsAttrubute);
resEntity.IsAttrubute = dto.IsAttrubute;
resEntity.Code = GetNumber2(8);
var data = _db.Queryable<BPA_GoodsInfo>().Max(x => x.AutoKey);
//if (data == 0) data = 1000;
@@ -171,7 +171,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
resEntity.Descritption = dto.Descritption;
resEntity.ImgUrl = dto.ImgUrl;
resEntity.Price = dto.Price;
resEntity.IsWeigh = dto.IsWeigh=="false"?0:1;
resEntity.IsWeigh = dto.IsWeigh;
resEntity.GoodsUintId = dto.GoodsUintId;
resEntity.IsAttrubute = Convert.ToBoolean(dto.IsAttrubute);
if (!string.IsNullOrWhiteSpace(dto.Status))
@@ -651,7 +651,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
Price = 0,
IsAttrubute = false,
IsDeleted = 0,
IsWeigh = 0,
IsWeigh = false,
Key = null,
Status = 0,
});


+ 2
- 0
BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductQueryInputDto.cs Näytä tiedosto

@@ -11,5 +11,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.Device
{
public string Name { get; set; }
public string Key { get; set; }
public string Code { get; set; }
public string Remark { get; set; }
}
}

+ 1
- 1
BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs Näytä tiedosto

@@ -36,7 +36,7 @@ namespace BPA.SAAS.Manage.Application.Device.Dtos.ProductFunction
/// <summary>
/// 步长
/// </summary>
public int StepSize { get; set; }
public decimal StepSize { get; set; }
/// <summary>
/// 枚举值
/// </summary>


+ 2
- 0
BPA.SAAS.Manage.Application/Device/Services/ProductService.cs Näytä tiedosto

@@ -31,6 +31,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services
var data = await _db.Queryable<BPA_Product>().Where((x) => x.IsDeleted == 0)
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Name), x => x.Name.Contains(inputDto.Name))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Key), x => x.Key.Contains(inputDto.Key))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Code), x => x.Code.Contains(inputDto.Code))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Remark), x => x.Remark.Contains(inputDto.Remark))
.OrderBy(x => x.CreateAt, OrderByType.Desc)
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total);



+ 1
- 1
BPA.SAAS.Manage.Application/Org/Interface/IOrganizeService.cs Näytä tiedosto

@@ -13,7 +13,7 @@ namespace BPA.SAAS.Manage.Application.Org.Interface
Task<PageUtil> QueryOrgPageList(OrgPageInput input);
Task<List<OrgOutput>> GetOrgList(OrgListInput input);
Task<bool> AddOrg(OrgAddInput input);
Task<bool> DeleteOrg(DeleteOrgInput input);
Task<bool> DeleteOrg(string id);
Task<bool> UpdateOrg(UpdateOrgInput input);
Task<dynamic> GetOrgTree();
Task<Dictionary<string, object>> GetOrgList();


+ 3
- 3
BPA.SAAS.Manage.Application/Org/OrganizeServices.cs Näytä tiedosto

@@ -52,10 +52,10 @@ namespace BPA.SAAS.Manage.Application.Org
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("/api/organize/deleteorg")]
public async Task<bool> DeleteOrg(DeleteOrgInput input)
[HttpGet("/api/organize/deleteorg")]
public async Task<bool> DeleteOrg(string id)
{
return await _organizeService.DeleteOrg(input);
return await _organizeService.DeleteOrg(id);
}
/// <summary>
/// 修改


+ 2
- 2
BPA.SAAS.Manage.Application/Org/Services/OrganizeService.cs Näytä tiedosto

@@ -82,9 +82,9 @@ namespace BPA.SAAS.Manage.Application.Org.Services
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<bool> DeleteOrg(DeleteOrgInput input)
public async Task<bool> DeleteOrg(string id)
{
var sysOrg = await _db.Queryable<BPA_Organize>().FirstAsync(u => u.Id == input.Id);
var sysOrg = await _db.Queryable<BPA_Organize>().FirstAsync(u => u.Id == id);
// 级联删除子节点
var childIdList = await GetChildIdListWithSelfById(sysOrg.Id);
var orgs = await _db.Queryable<BPA_Organize>().Where(u => childIdList.Contains(u.Id)).ToListAsync();


+ 1
- 1
BPA.SAAS.Manage.Core/DataBase/BPA_GoodsInfo.cs Näytä tiedosto

@@ -22,7 +22,7 @@ namespace BPA.SAAS.Manage.Core.DataBase
public decimal Price { get; set; }
public long AutoKey { get; set; }
public string GoodsUintId { get; set; }
public int IsWeigh { get; set; }
public bool IsWeigh { get; set; }
public string ForeignKeyRe { get; set; }
public string Design { get; set; }
public string DefaultMate { get; set; }


+ 1
- 1
BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs Näytä tiedosto

@@ -54,7 +54,7 @@ namespace BPA.SAAS.Manage.Core.Product
/// <summary>
/// 步长
/// </summary>
public int StepSize { get; set; }
public decimal StepSize { get; set; }
/// <summary>
/// 枚举值
/// </summary>


Ladataan…
Peruuta
Tallenna