Browse Source

修改

storemanagement
zhaoy 9 months ago
parent
commit
e2dff4f765
18 changed files with 95 additions and 70 deletions
  1. +1
    -4
      BPA.SAAS.Manage.Application/Auth/AuthService.cs
  2. +2
    -2
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsDto.cs
  3. +1
    -1
      BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsQueryDto.cs
  4. +2
    -1
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeDto.cs
  5. +1
    -1
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeQueryDto.cs
  6. +3
    -2
      BPA.SAAS.Manage.Application/DataBase/Dtos/GoodsAttribute/GoodsAttributeView.cs
  7. +61
    -39
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsAttributeService.cs
  8. +7
    -7
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
  9. +2
    -0
      BPA.SAAS.Manage.Application/Device/Dtos/Device/ProductQueryInputDto.cs
  10. +1
    -1
      BPA.SAAS.Manage.Application/Device/Dtos/ProductFunction/ProductFunctionBaseDto.cs
  11. +2
    -0
      BPA.SAAS.Manage.Application/Device/Services/ProductService.cs
  12. +1
    -1
      BPA.SAAS.Manage.Application/Org/Interface/IOrganizeService.cs
  13. +3
    -3
      BPA.SAAS.Manage.Application/Org/OrganizeServices.cs
  14. +2
    -2
      BPA.SAAS.Manage.Application/Org/Services/OrganizeService.cs
  15. +3
    -3
      BPA.SAAS.Manage.Application/System/Services/MenuService.cs
  16. +1
    -1
      BPA.SAAS.Manage.Core/DataBase/BPA_GoodsInfo.cs
  17. +1
    -1
      BPA.SAAS.Manage.Core/Product/BPA_ProductFunction.cs
  18. +1
    -1
      BPA.SAAS.Manage.Web.Entry/appsettings.json

+ 1
- 4
BPA.SAAS.Manage.Application/Auth/AuthService.cs View File

@@ -46,10 +46,7 @@ namespace BPA.SAAS.Manage.Application.Auth
conModels.Add(new ConditionalModel() { FieldName = "Id", ConditionalType = ConditionalType.Equal, FieldValue = user.GroupId });
conModels.Add(new ConditionalModel() { FieldName = "Status", ConditionalType = ConditionalType.Equal, FieldValue = CommonStatus.ENABLE.ToString() });
conModels.Add(new ConditionalModel() { FieldName = "IsDeleted", ConditionalType = ConditionalType.Equal, FieldValue ="0" });
if (user.AdminType != 1)
{
conModels.Add(new ConditionalModel() { FieldName = "Type", ConditionalType = ConditionalType.Equal, FieldValue = input.Type.ToString() });
}
var company = _db.Queryable<BPA_Company>().Where(conModels).First();
string CLAINM_SUPERADMIN = "Customer";


+ 2
- 2
BPA.SAAS.Manage.Application/DataBase/Dtos/Goods/GoodsDto.cs View File

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

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

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

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

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

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

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

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

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

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

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

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

@@ -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();


+ 3
- 3
BPA.SAAS.Manage.Application/System/Services/MenuService.cs View File

@@ -57,7 +57,7 @@ namespace BPA.SAAS.Manage.Application.System.Services
Status = t.Status,
IsAdmin=t.IsAdmin,
Type= t.Type,
TypeName= GetTypeName(t.Type),
//TypeName= GetTypeName(t.Type),
Children = AllMenus.Where(x => x.Pid == t.Id).Select(x => new MenuTreeDtoOutput
{
Id = x.Id,
@@ -72,7 +72,7 @@ namespace BPA.SAAS.Manage.Application.System.Services
Status = x.Status,
IsAdmin=x.IsAdmin,
Type = x.Type,
TypeName = GetTypeName(x.Type),
//TypeName = GetTypeName(x.Type),
Children = AllMenus.Where(y => y.Pid == x.Id).Select(y => new MenuTreeDtoOutput
{
Id = y.Id.ToString(),
@@ -87,7 +87,7 @@ namespace BPA.SAAS.Manage.Application.System.Services
Status = y.Status,
IsAdmin=y.IsAdmin,
Type = y.Type,
TypeName = GetTypeName(y.Type),
// TypeName = GetTypeName(y.Type),
}).ToList()
}).ToList()
}).ToList();


+ 1
- 1
BPA.SAAS.Manage.Core/DataBase/BPA_GoodsInfo.cs View File

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

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


+ 1
- 1
BPA.SAAS.Manage.Web.Entry/appsettings.json View File

@@ -10,7 +10,7 @@
"AllowedHosts": "*",
"ConnectionConfigs": [
{
"ConnectionString": "server=10.2.1.21;Database=bpa_kitchen_manage;Uid=root;Pwd=cygadmin;Allow Zero Datetime=True;Convert Zero Datetime=True;",
"ConnectionString": "server=10.2.1.21;Database=bpa_kitchen_kitchenmanage;Uid=root;Pwd=cygadmin;Allow Zero Datetime=True;Convert Zero Datetime=True;",
"DbType": "Mysql",
"IsAutoCloseConnection": true
}


Loading…
Cancel
Save