zhaoy 8 月之前
父節點
當前提交
a8bd33595c
共有 3 個檔案被更改,包括 28 行新增7 行删除
  1. +15
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs
  2. +8
    -2
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs
  3. +5
    -5
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/WarehouseTemplateServices.cs

+ 15
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs 查看文件

@@ -114,5 +114,20 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Enum
/// </summary>
[ErrorCodeItemMetadata("名称或编码重复")]
Code10017,
/// <summary>
/// 模板名称不能重复
/// </summary>
[ErrorCodeItemMetadata("模板名称不能重复")]
Code10018,
/// <summary>
/// 设备id不能为空
/// </summary>
[ErrorCodeItemMetadata("设备id不能为空")]
Code10019,
/// <summary>
/// 模板名称不能为空
/// </summary>
[ErrorCodeItemMetadata("模板名称不能为空")]
Code10020,
}
}

+ 8
- 2
BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/Services/WarehouseTemplateService.cs 查看文件

@@ -1,4 +1,5 @@
using BPA.KitChen.GroupMeal.SqlSugar;
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;
@@ -80,8 +81,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat
try
{
SqlSugarDb.Db.Ado.BeginTran();
if(string.IsNullOrWhiteSpace(inputDto.DeviceId)) throw Oops.Oh(ErrorCodeEnum.Code10019);
if (string.IsNullOrWhiteSpace(inputDto.TemplateName)) throw Oops.Oh(ErrorCodeEnum.Code10020);
var check = SqlSugarDb.Db.Queryable<BPA_WarehouseTemplate>().Where(x => x.TemplateName == inputDto.TemplateName).Any();
if (check) throw Oops.Oh("模板名称不能重复");
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 res = await SqlSugarDb.Db.Insertable(new BPA_WarehouseTemplate
{
DeviceId = inputDto.DeviceId,
@@ -120,8 +125,9 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat
try
{
SqlSugarDb.Db.Ado.BeginTran();
var check = SqlSugarDb.Db.Queryable<BPA_WarehouseTemplate>().Where(x => x.TemplateName == inputDto.TemplateName && x.Id!= inputDto.Id).Any();
if (check) throw Oops.Oh(ErrorCodeEnum.Code10018);
var model = SqlSugarDb.Db.Queryable<BPA_WarehouseTemplate>().Where(x => x.Id == inputDto.Id).First();
model.DeviceId = inputDto.DeviceId;
model.TemplateName = inputDto.TemplateName;
var res = await SqlSugarDb.Db.Updateable(model).ExecuteCommandAsync();
var warehousePostion = SqlSugarDb.Db.Queryable<BPA_WarehousePostion>().Where(x => x.TemplateId == inputDto.Id).ToList();


+ 5
- 5
BPA.SAAS.Manage.Application/AExternalPlatform/Service/WarehouseTemplate/WarehouseTemplateServices.cs 查看文件

@@ -4,7 +4,7 @@ using BPA.SAAS.Manage.Core.Base;

namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplate
{
[ApiDescriptionSettings("开放平台", Tag = "设备仓位模板")]
[ApiDescriptionSettings("开放平台", Tag = "设备仓位模板"), AllowAnonymous]
public class WarehouseTemplateServices : IDynamicApiController, ITransient
{
IWarehouseTemplateService _warehouseTemplateService;
@@ -17,7 +17,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/WareHouseTemplate/GetWarehouseTemplatePage")]
[HttpPost("/api/ExternalPlatform/WareHouseTemplate/GetWarehouseTemplatePage")]
public async Task<PageUtil> GetWarehouseTemplatePage(WarehouseTemplateQueryDto inputDto)
{
return await _warehouseTemplateService.GetWarehouseTemplatePage(inputDto);
@@ -27,7 +27,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("/api/WareHouseTemplate/GetWarehouseTemplateList")]
[HttpPost("/api/ExternalPlatform/WareHouseTemplate/GetWarehouseTemplateList")]
public async Task<List<WarehouseTemplateView>> GetWarehouseTemplateList(WarehouseDevideId dto)
{
return await _warehouseTemplateService.GetWarehouseTemplateList(dto);
@@ -37,7 +37,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/WareHouseTemplate/AddWarehouseTemplate")]
[HttpPost("/api/ExternalPlatform/WareHouseTemplate/AddWarehouseTemplate")]
public async Task<bool> AddWarehouseTemplate(WarehouseTemplatInsertDto inputDto)
{
return await _warehouseTemplateService.AddWarehouseTemplate(inputDto);
@@ -47,7 +47,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WarehouseTemplat
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/WareHouseTemplate/UpdateWarehouseTemplate")]
[HttpPost("/api/ExternalPlatform/WareHouseTemplate/UpdateWarehouseTemplate")]
public async Task<bool> UpdateWarehouseTemplate(WarehouseTemplatInsertDto inputDto)
{
return await _warehouseTemplateService.UpdateWarehouseTemplate(inputDto);


Loading…
取消
儲存