Browse Source

商品和设备修改

storemanagement
zhaoy 9 months ago
parent
commit
51a2ac3533
8 changed files with 28 additions and 26 deletions
  1. +6
    -6
      BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs
  2. +2
    -2
      BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs
  3. +2
    -2
      BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs
  4. +3
    -2
      BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs
  5. +11
    -11
      BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs
  6. +1
    -1
      BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs
  7. +1
    -0
      BPA.SAAS.Manage.Comm/Model/ListSelectQuery.cs
  8. +2
    -2
      BPA.SAAS.Manage.Core/Device/BPA_ProductVesion.cs

+ 6
- 6
BPA.SAAS.Manage.Application/DataBase/Services/GoodsService.cs View File

@@ -138,9 +138,9 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
resEntity.IsAttrubute = Convert.ToBoolean(dto.IsAttrubute);
resEntity.Code = GetNumber2(8);
var data = _db.Queryable<BPA_GoodsInfo>().Max(x => x.AutoKey);
if (data == 0) data = 1000;
else data = data + 1;
resEntity.AutoKey = data;
//if (data == 0) data = 1000;
//else data = data + 1;
// resEntity.AutoKey = data;
var res = await _db.Insertable(resEntity).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
return res > 0;
}
@@ -940,7 +940,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
var device = await _db.Queryable<BPA_DeviceInfo>().FirstAsync(x => x.Id == deviceId);

//设备类型
var dictData = await _db.Queryable<BPA_DeviceVesion>().FirstAsync(x => x.Id == device.ProductVersionId);
var dictData = await _db.Queryable<BPA_ProductVesion>().FirstAsync(x => x.Id == device.ProductVersionId);

return dictData?.TemplatePath ?? "";
}
@@ -959,7 +959,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
{
var path = await _SystemConfigService.GetCosImgesURL(file);

await _db.Updateable<BPA_DeviceVesion>()
await _db.Updateable<BPA_ProductVesion>()
.SetColumns(it => it.TemplatePath == path)
.Where(it => it.Id == inputDto.Id)
.ExecuteCommandAsync();
@@ -969,7 +969,7 @@ namespace BPA.SAAS.Manage.Application.DataBase.Services
var source = file.OpenReadStream();
var mapper = new Mapper(source);
var deviceVersion = await _db.Queryable<BPA_DeviceVesion>().FirstAsync(x => x.ProductId == inputDto.DeviceClientType && x.Vesion == inputDto.Version);
var deviceVersion = await _db.Queryable<BPA_ProductVesion>().FirstAsync(x => x.ProductId == inputDto.DeviceClientType && x.Vesion == inputDto.Version);
//添加 设备_烹饪工序模型
#region 添加 设备_烹饪工序模型
ReadExcel<GoodstechnologyModel> readGoodstechnologyExcel = new();


+ 2
- 2
BPA.SAAS.Manage.Application/Device/DeviceVesionServices.cs View File

@@ -74,7 +74,7 @@ namespace BPA.SAAS.Manage.Application.Device
/// <param name="Code"></param>
/// <returns></returns>
[HttpGet("/api/devicevesion/getdevicevesion")]
public async Task<List<BPA_DeviceVesion>> GetDeviceVesion(string productId)
public async Task<List<BPA_ProductVesion>> GetDeviceVesion(string productId)
{
return await _deviceVesionService.GetDeviceVesion(productId);
}
@@ -83,7 +83,7 @@ namespace BPA.SAAS.Manage.Application.Device
/// </summary>
/// <returns></returns>
[HttpGet("/api/devicevesion/getdevicevesionlist")]
public async Task<List<BPA_DeviceVesion>> GetDeviceVesionList()
public async Task<List<BPA_ProductVesion>> GetDeviceVesionList()
{
return await _deviceVesionService.GetDeviceVesionList();
}


+ 2
- 2
BPA.SAAS.Manage.Application/Device/Interface/IDeviceVesionService.cs View File

@@ -16,7 +16,7 @@ namespace BPA.SAAS.Manage.Application.Device.Interface
Task<bool> DelDeviceVesionAsync(List<string> inputList);
Task<bool> UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto);
Task<bool> UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto);
Task<List<BPA_DeviceVesion>> GetDeviceVesion(string ProductId);
Task<List<BPA_DeviceVesion>> GetDeviceVesionList();
Task<List<BPA_ProductVesion>> GetDeviceVesion(string ProductId);
Task<List<BPA_ProductVesion>> GetDeviceVesionList();
}
}

+ 3
- 2
BPA.SAAS.Manage.Application/Device/Services/DeviceService.cs View File

@@ -48,7 +48,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
})
.Mapper(x =>
{
var Vesion = _db.Queryable<BPA_DeviceVesion>().Where(c => c.Id == x.ProductVersionId).First();
var Vesion = _db.Queryable<BPA_ProductVesion>().Where(c => c.Id == x.ProductVersionId).First();
x.ProductVersionName = Vesion?.Vesion;
})
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total);
@@ -69,7 +69,8 @@ namespace BPA.SAAS.Manage.Application.Device.Services
.Select(a=> new ListSelectQuery
{
Id = a.Id,
Name = a.DeviceName
Name = a.DeviceName,
AutoKey=a.AutoKey.ToString()
}) .ToListAsync();
return data;
}


+ 11
- 11
BPA.SAAS.Manage.Application/Device/Services/DeviceVesionService.cs View File

@@ -28,7 +28,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<PageUtil> GetDeviceVesionPageAsync(DeviceVesionQueryInputDto inputDto)
{
var total = new RefAsync<int>();
var data = await _db.Queryable<BPA_DeviceVesion,BPA_Product>((a, b) => new JoinQueryInfos(JoinType.Left, b.Id == a.ProductId))
var data = await _db.Queryable<BPA_ProductVesion,BPA_Product>((a, b) => new JoinQueryInfos(JoinType.Left, b.Id == a.ProductId))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.ProductId), x => x.ProductId.Contains(inputDto.ProductId))
.OrderBy(a => a.CreateAt, OrderByType.Desc)
.Select((a,b)=>new DeviceVesionModel()
@@ -54,7 +54,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<bool> AddDeviceVesionAsync(DeviceVesionBaseDto inputDto)
{
var res = await _db.Insertable(new BPA_DeviceVesion
var res = await _db.Insertable(new BPA_ProductVesion
{
Vesion = inputDto.Vesion,
ProductId = inputDto.ProductId,
@@ -75,7 +75,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
{
throw Oops.Oh("当前设备类型已使用,无法删除");
}
var datas = await _db.Queryable<BPA_DeviceVesion>()
var datas = await _db.Queryable<BPA_ProductVesion>()
.Where(x => inputList.Contains(x.Id))
.ToListAsync();
_db.Deleteable(datas).ExecuteCommand();
@@ -87,11 +87,11 @@ namespace BPA.SAAS.Manage.Application.Device.Services
/// <returns></returns>
public async Task<bool> UpdateDeviceVesionAsync(DeviceVesionBaseDto inputDto)
{
var data = await _db.Queryable<BPA_DeviceVesion>().Where(x => x.Id == inputDto.Id).FirstAsync();
var data = await _db.Queryable<BPA_ProductVesion>().Where(x => x.Id == inputDto.Id).FirstAsync();

if (data != null)
{
var res = _db.Updateable<BPA_DeviceVesion>().SetColumns(t => t.Vesion == inputDto.Vesion)
var res = _db.Updateable<BPA_ProductVesion>().SetColumns(t => t.Vesion == inputDto.Vesion)
.SetColumns(t => t.TemplatePath == inputDto.TemplatePath)
.SetColumns(t => t.ProductId == inputDto.ProductId)
.SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id)
@@ -109,11 +109,11 @@ namespace BPA.SAAS.Manage.Application.Device.Services
/// <returns></returns>
public async Task<bool> UpdateDeviceVesionSatatus(DeviceVesionSatatusDto inputDto)
{
var data = await _db.Queryable<BPA_DeviceVesion>().Where(x => x.Id == inputDto.Id).FirstAsync();
var data = await _db.Queryable<BPA_ProductVesion>().Where(x => x.Id == inputDto.Id).FirstAsync();

if (data != null)
{
var res = _db.Updateable<BPA_DeviceVesion>()
var res = _db.Updateable<BPA_ProductVesion>()
.SetColumns(t => t.Status == (CommonStatus)inputDto.Status).Where(t => t.Id == inputDto.Id)
.ExecuteCommandHasChange();

@@ -127,18 +127,18 @@ namespace BPA.SAAS.Manage.Application.Device.Services
/// </summary>
/// <param name="Code"></param>
/// <returns></returns>
public async Task<List<BPA_DeviceVesion>> GetDeviceVesion(string ProductId)
public async Task<List<BPA_ProductVesion>> GetDeviceVesion(string ProductId)
{
var resEntity =await _db.Queryable<BPA_DeviceVesion>().Where(a => a.ProductId == ProductId && a.Status==0).Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync();
var resEntity =await _db.Queryable<BPA_ProductVesion>().Where(a => a.ProductId == ProductId && a.Status==0).Select(a => new BPA_ProductVesion() { Id = a.Id.SelectAll() }).ToListAsync();
return resEntity;
}
/// <summary>
/// 查询版本列表
/// </summary>
/// <returns></returns>
public async Task<List<BPA_DeviceVesion>> GetDeviceVesionList()
public async Task<List<BPA_ProductVesion>> GetDeviceVesionList()
{
var resEntity =await _db.Queryable<BPA_DeviceVesion>().Select(a => new BPA_DeviceVesion() { Id = a.Id.SelectAll() }).ToListAsync();
var resEntity =await _db.Queryable<BPA_ProductVesion>().Select(a => new BPA_ProductVesion() { Id = a.Id.SelectAll() }).ToListAsync();
return resEntity;
}
}


+ 1
- 1
BPA.SAAS.Manage.Application/Device/Services/ProductFunctionService.cs View File

@@ -32,7 +32,7 @@ namespace BPA.SAAS.Manage.Application.Device.Services
public async Task<PageUtil> GetProductFunctionPage(ProductFunctionPageBase inputDto)
{
RefAsync<int> total = 0;
var res = await _db.Queryable<BPA_ProductFunction, BPA_DeviceVesion>((x, b) => new JoinQueryInfos(JoinType.Left, b.Id == x.DeviceVersionKey))
var res = await _db.Queryable<BPA_ProductFunction, BPA_ProductVesion>((x, b) => new JoinQueryInfos(JoinType.Left, b.Id == x.DeviceVersionKey))
.Where((x,b)=>b.ProductId == inputDto.DeviceTypeKey)
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Name), (x, b) => x.Name.Contains(inputDto.Name))
.WhereIF(!string.IsNullOrWhiteSpace(inputDto.Type), (x, b) => x.Type==Convert.ToInt32(inputDto.Type))


+ 1
- 0
BPA.SAAS.Manage.Comm/Model/ListSelectQuery.cs View File

@@ -10,5 +10,6 @@ namespace BPA.SAAS.Manage.Comm.Model
{
public string Id { get; set; }
public string Name { get; set; }
public string AutoKey { get; set; }
}
}

BPA.SAAS.Manage.Core/Device/BPA_DeviceVesion.cs → BPA.SAAS.Manage.Core/Device/BPA_ProductVesion.cs View File

@@ -9,8 +9,8 @@ using System.Threading.Tasks;

namespace BPA.SAAS.Manage.Core.Device
{
[SugarTable("bpa_devicevesion")]
public class BPA_DeviceVesion : IBaseEntity, IGroupId
[SugarTable("bpa_productvesion")]
public class BPA_ProductVesion : IBaseEntity
{
public string Vesion { get; set; }
/// <summary>

Loading…
Cancel
Save