去除引用common.props
This commit is contained in:
@@ -9,8 +9,8 @@ using JNPF.FriendlyException;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
@@ -19,11 +19,11 @@ namespace Tnb.BasicData
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 701)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class BasRouteService : IBasRouteService,IDynamicApiController, ITransient
|
||||
public class BasRouteService : IBasRouteService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<BasRouteH> _repository;
|
||||
|
||||
|
||||
|
||||
|
||||
public BasRouteService(
|
||||
UserManager userManager,
|
||||
ISqlSugarRepository<BasRouteH> repository)
|
||||
@@ -40,12 +40,12 @@ namespace Tnb.BasicData
|
||||
{
|
||||
string id = parameters["id"];
|
||||
|
||||
await _repository.UpdateAsync(x => new BasRouteH()
|
||||
_ = await _repository.UpdateAsync(x => new BasRouteH()
|
||||
{
|
||||
status = "1",
|
||||
}, x => x.id == id);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 复制工艺路线
|
||||
/// </summary>
|
||||
@@ -55,7 +55,7 @@ namespace Tnb.BasicData
|
||||
{
|
||||
string id = parameters["id"];
|
||||
BasRouteH basRouteH = await _repository.GetByIdAsync(id);
|
||||
|
||||
|
||||
List<BasRouteD> basRouteDs = await _repository.AsSugarClient().Queryable<BasRouteD>().Where(x => x.route_id == id).ToListAsync();
|
||||
|
||||
string newId = SnowflakeIdHelper.NextId();
|
||||
@@ -64,42 +64,41 @@ namespace Tnb.BasicData
|
||||
basRouteH.name += "_复制的请修改";
|
||||
basRouteH.status = "0";
|
||||
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(basRouteH);
|
||||
_ = await _repository.InsertAsync(basRouteH);
|
||||
foreach (BasRouteD basRouteD in basRouteDs)
|
||||
{
|
||||
basRouteD.id = SnowflakeIdHelper.NextId();
|
||||
basRouteD.route_id = newId;
|
||||
}
|
||||
|
||||
await _repository.AsSugarClient().Insertable<BasRouteD>(basRouteDs).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Insertable<BasRouteD>(basRouteDs).ExecuteCommandAsync();
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "复制成功" : result.ErrorMessage;
|
||||
return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "复制成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取有效的已发布的工艺路线
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetValidRouteList([FromBody]VisualDevDataFieldDataListInput pageInput)
|
||||
public async Task<dynamic> GetValidRouteList([FromBody] VisualDevDataFieldDataListInput pageInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Queryable<BasRouteH>()
|
||||
.Where(x => x.status == "1"
|
||||
&& ((x.start_time != null && x.start_time.Value <= DateTime.Now && x.end_time != null && x.end_time.Value>=DateTime.Now)
|
||||
|| (x.start_time==null && x.end_time>=DateTime.Now)
|
||||
|| (x.end_time==null && x.start_time<=DateTime.Now)
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
SqlSugarPagedList<VaildRouteOutput> result = await db.Queryable<BasRouteH>()
|
||||
.Where(x => x.status == "1"
|
||||
&& ((x.start_time != null && x.start_time.Value <= DateTime.Now && x.end_time != null && x.end_time.Value >= DateTime.Now)
|
||||
|| (x.start_time == null && x.end_time >= DateTime.Now)
|
||||
|| (x.end_time == null && x.start_time <= DateTime.Now)
|
||||
|| (x.start_time == null && x.end_time == null)
|
||||
)).Select(x=>new VaildRouteOutput()
|
||||
)).Select(x => new VaildRouteOutput()
|
||||
{
|
||||
id = x.id,
|
||||
code = x.code,
|
||||
name = x.name,
|
||||
start_time = x.start_time==null ? "" : x.start_time.Value.ToString("yyyy-MM-dd"),
|
||||
end_time = x.end_time==null ? "" : x.end_time.Value.ToString("yyyy-MM-dd"),
|
||||
start_time = x.start_time == null ? "" : x.start_time.Value.ToString("yyyy-MM-dd"),
|
||||
end_time = x.end_time == null ? "" : x.end_time.Value.ToString("yyyy-MM-dd"),
|
||||
}).ToPagedListAsync(pageInput.currentPage, pageInput.pageSize);
|
||||
return PageResult<VaildRouteOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user