去除引用common.props
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
@@ -11,10 +12,8 @@ using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using NPOI.OpenXmlFormats.Dml;
|
||||
using JNPF.Common.Extension;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
@@ -56,10 +55,10 @@ namespace Tnb.BasicData
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = string.IsNullOrEmpty(input.queryJson) ? null : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string materialInfo = queryJson?["query_info"]?.ToString() ?? "";
|
||||
var list = await db.Queryable<BasMbom, BasMaterial, BasEbomH, BasRouteH>((a, b, c, d) => new object[]
|
||||
SqlSugarPagedList<MbomListOutput> list = await db.Queryable<BasMbom, BasMaterial, BasEbomH, BasRouteH>((a, b, c, d) => new object[]
|
||||
{
|
||||
JoinType.Left, a.material_id == b.id,
|
||||
JoinType.Left, a.ebom_id == c.id,
|
||||
@@ -75,8 +74,8 @@ namespace Tnb.BasicData
|
||||
ebom_id = c.version,
|
||||
route_id = d.name,
|
||||
route_id_id = c.id,
|
||||
start_time = a.start_time==null ? "" : a.start_time.Value.ToString("yyyy-MM-dd"),
|
||||
end_time = a.end_time==null ? "" : a.end_time.Value.ToString("yyyy-MM-dd"),
|
||||
start_time = a.start_time == null ? "" : a.start_time.Value.ToString("yyyy-MM-dd"),
|
||||
end_time = a.end_time == null ? "" : a.end_time.Value.ToString("yyyy-MM-dd"),
|
||||
is_first = SqlFunc.IIF(a.is_first == 0, "否", "是"),
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
@@ -90,13 +89,13 @@ namespace Tnb.BasicData
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> GetInfo(string id)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
BasMbom mbom = await _repository.GetSingleAsync(x => x.id == id);
|
||||
List<BasMbomProcess> processes = await db.Queryable<BasMbomProcess>().Where(x => x.mbom_id == id).OrderBy(x=>x.ordinal).ToListAsync();
|
||||
List<BasMbomProcess> processes = await db.Queryable<BasMbomProcess>().Where(x => x.mbom_id == id).OrderBy(x => x.ordinal).ToListAsync();
|
||||
List<BasMbomInput> inputs = await db.Queryable<BasMbomInput>().Where(x => x.mbom_id == id).ToListAsync();
|
||||
List<BasMbomOutput> outputs = await db.Queryable<BasMbomOutput>().Where(x => x.mbom_id == id).ToListAsync();
|
||||
MbomDataOutput mbomDataOutput = new MbomDataOutput();
|
||||
List<MbomProcessOutDto> mbomProcessOutDtos = new List<MbomProcessOutDto>();
|
||||
MbomDataOutput mbomDataOutput = new();
|
||||
List<MbomProcessOutDto> mbomProcessOutDtos = new();
|
||||
|
||||
mbomDataOutput.id = mbom.id;
|
||||
mbomDataOutput.ebom_id = mbom.ebom_id;
|
||||
@@ -158,9 +157,12 @@ namespace Tnb.BasicData
|
||||
public async Task<dynamic> GetSubMoListByBomId([FromRoute] string bomId)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(bomId)) throw new ArgumentException($"parameter {nameof(bomId)} not be null or empty");
|
||||
if (string.IsNullOrEmpty(bomId))
|
||||
{
|
||||
throw new ArgumentException($"parameter {nameof(bomId)} not be null or empty");
|
||||
}
|
||||
|
||||
var result = await _db.Queryable<BasMbom>()
|
||||
List<SubBomListOutput> result = await _db.Queryable<BasMbom>()
|
||||
.LeftJoin<BasMbomProcess>((a, b) => a.id == b.mbom_id)
|
||||
.LeftJoin<BasRouteH>((a, b, c) => a.route_id == c.id)
|
||||
// .LeftJoin<BasRouteD>((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id)
|
||||
@@ -182,7 +184,7 @@ namespace Tnb.BasicData
|
||||
})
|
||||
.Mapper(it => it.output_qty = it.num.ParseToInt())
|
||||
.ToListAsync();
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -194,7 +196,7 @@ namespace Tnb.BasicData
|
||||
.Where(x => x.mbom_process_id == id)
|
||||
.Select(x => new
|
||||
{
|
||||
material_id = x.material_id,
|
||||
x.material_id,
|
||||
}).ToListAsync();
|
||||
return result;
|
||||
|
||||
@@ -231,13 +233,13 @@ namespace Tnb.BasicData
|
||||
material_name = b.name,
|
||||
start_time = a.start_time.HasValue ? a.start_time.Value.ToString(DbTimeFormat.SS) : null,
|
||||
end_time = a.end_time.HasValue ? a.end_time.Value.ToString(DbTimeFormat.SS) : null,
|
||||
version = a.version,
|
||||
a.version,
|
||||
route_id = c.id,
|
||||
route_name = c.name,
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// 保存生产bom
|
||||
// /// </summary>
|
||||
@@ -512,7 +514,7 @@ namespace Tnb.BasicData
|
||||
// }
|
||||
// return result.IsSuccess ? "保存成功" : result.ErrorMessage;
|
||||
// }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存生产bom
|
||||
/// </summary>
|
||||
@@ -529,7 +531,7 @@ namespace Tnb.BasicData
|
||||
{
|
||||
string mbomId = SnowflakeIdHelper.NextId();
|
||||
string orgId = _userManager.GetUserInfo().Result.organizeId;
|
||||
BasMbom mbom = new BasMbom()
|
||||
BasMbom mbom = new()
|
||||
{
|
||||
id = mbomId,
|
||||
org_id = orgId,
|
||||
@@ -554,15 +556,15 @@ namespace Tnb.BasicData
|
||||
errorCode = ErrorCode.COM1004;
|
||||
throw Oops.Oh(ErrorCode.COM1004);
|
||||
}
|
||||
await _repository.InsertAsync(mbom);
|
||||
List<BasMbomProcess> processes = new List<BasMbomProcess>();
|
||||
List<BasMbomInput> inputs = new List<BasMbomInput>();
|
||||
List<BasMbomOutput> outputs = new List<BasMbomOutput>();
|
||||
_ = await _repository.InsertAsync(mbom);
|
||||
List<BasMbomProcess> processes = new();
|
||||
List<BasMbomInput> inputs = new();
|
||||
List<BasMbomOutput> outputs = new();
|
||||
|
||||
if (mbomSaveDataInput != null && mbomSaveDataInput.processes != null)
|
||||
{
|
||||
int index = 0;
|
||||
foreach (var process in mbomSaveDataInput.processes)
|
||||
int index = 0;
|
||||
foreach (MbomProcessDto? process in mbomSaveDataInput.processes)
|
||||
{
|
||||
string mbomProcessId = SnowflakeIdHelper.NextId();
|
||||
processes.Add(new BasMbomProcess()
|
||||
@@ -586,7 +588,7 @@ namespace Tnb.BasicData
|
||||
|
||||
if (process.inputs != null)
|
||||
{
|
||||
foreach (var input in process.inputs)
|
||||
foreach (BasMbomInput input in process.inputs)
|
||||
{
|
||||
string inputId = SnowflakeIdHelper.NextId();
|
||||
inputs.Add(new BasMbomInput()
|
||||
@@ -605,7 +607,7 @@ namespace Tnb.BasicData
|
||||
|
||||
if (process.outputs != null)
|
||||
{
|
||||
foreach (var output in process.outputs)
|
||||
foreach (BasMbomOutput output in process.outputs)
|
||||
{
|
||||
string outputId = SnowflakeIdHelper.NextId();
|
||||
outputs.Add(new BasMbomOutput()
|
||||
@@ -626,17 +628,17 @@ namespace Tnb.BasicData
|
||||
|
||||
if (processes.Count > 0)
|
||||
{
|
||||
await _repository.AsSugarClient().Insertable<BasMbomProcess>(processes).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Insertable<BasMbomProcess>(processes).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
if (inputs.Count > 0)
|
||||
{
|
||||
await _repository.AsSugarClient().Insertable<BasMbomInput>(inputs).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Insertable<BasMbomInput>(inputs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
if (outputs.Count > 0)
|
||||
{
|
||||
await _repository.AsSugarClient().Insertable<BasMbomOutput>(outputs).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Insertable<BasMbomOutput>(outputs).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
else//修改
|
||||
@@ -651,7 +653,7 @@ namespace Tnb.BasicData
|
||||
string orgId = _userManager.GetUserInfo().Result.organizeId;
|
||||
if (mbomSaveDataInput != null)
|
||||
{
|
||||
await _repository.UpdateAsync(x => new BasMbom()
|
||||
_ = await _repository.UpdateAsync(x => new BasMbom()
|
||||
{
|
||||
// org_id = orgId,
|
||||
material_id = mbomSaveDataInput.material_id,
|
||||
@@ -670,12 +672,12 @@ namespace Tnb.BasicData
|
||||
}, x => x.id == mbomSaveDataInput.id);
|
||||
}
|
||||
// List<BasMbomProcess> processes = new List<BasMbomProcess>();
|
||||
List<BasMbomInput> inputs = new List<BasMbomInput>();
|
||||
List<BasMbomOutput> outputs = new List<BasMbomOutput>();
|
||||
List<BasMbomInput> inputs = new();
|
||||
List<BasMbomOutput> outputs = new();
|
||||
|
||||
if (mbomSaveDataInput != null && mbomSaveDataInput.processes != null)
|
||||
{
|
||||
foreach (var process in mbomSaveDataInput.processes)
|
||||
foreach (MbomProcessDto? process in mbomSaveDataInput.processes)
|
||||
{
|
||||
string mbomProcessId = process.id;
|
||||
// string mbomProcessId = SnowflakeIdHelper.NextId();
|
||||
@@ -692,9 +694,9 @@ namespace Tnb.BasicData
|
||||
// route_detail_id = process.route_detail_id,
|
||||
//
|
||||
// });
|
||||
|
||||
|
||||
decimal preparation_time = process?.preparation_time ?? 0;
|
||||
await _repository.AsSugarClient().Updateable<BasMbomProcess>()
|
||||
_ = await _repository.AsSugarClient().Updateable<BasMbomProcess>()
|
||||
.SetColumns(x => x.preparation_time == preparation_time)
|
||||
.SetColumns(x => x.station == process!.station)
|
||||
.SetColumns(x => x.byproduct_status == process!.byproduct_status)
|
||||
@@ -703,7 +705,7 @@ namespace Tnb.BasicData
|
||||
|
||||
if (process!.inputs != null)
|
||||
{
|
||||
foreach (var input in process.inputs)
|
||||
foreach (BasMbomInput input in process.inputs)
|
||||
{
|
||||
string inputId = SnowflakeIdHelper.NextId();
|
||||
inputs.Add(new BasMbomInput()
|
||||
@@ -722,7 +724,7 @@ namespace Tnb.BasicData
|
||||
|
||||
if (process.outputs != null)
|
||||
{
|
||||
foreach (var output in process.outputs)
|
||||
foreach (BasMbomOutput output in process.outputs)
|
||||
{
|
||||
string outputId = SnowflakeIdHelper.NextId();
|
||||
outputs.Add(new BasMbomOutput()
|
||||
@@ -744,9 +746,9 @@ namespace Tnb.BasicData
|
||||
|
||||
if (mbomSaveDataInput != null && !string.IsNullOrEmpty(mbomSaveDataInput.id))
|
||||
{
|
||||
// await _repository.AsSugarClient().Deleteable<BasMbomProcess>().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
|
||||
await _repository.AsSugarClient().Deleteable<BasMbomInput>().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
|
||||
await _repository.AsSugarClient().Deleteable<BasMbomOutput>().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
|
||||
// await _repository.AsSugarClient().Deleteable<BasMbomProcess>().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Deleteable<BasMbomInput>().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Deleteable<BasMbomOutput>().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync();
|
||||
}
|
||||
// if (processes.Count > 0)
|
||||
// {
|
||||
@@ -755,12 +757,12 @@ namespace Tnb.BasicData
|
||||
|
||||
if (inputs.Count > 0)
|
||||
{
|
||||
await _repository.AsSugarClient().Insertable<BasMbomInput>(inputs).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Insertable<BasMbomInput>(inputs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
if (outputs.Count > 0)
|
||||
{
|
||||
await _repository.AsSugarClient().Insertable<BasMbomOutput>(outputs).ExecuteCommandAsync();
|
||||
_ = await _repository.AsSugarClient().Insertable<BasMbomOutput>(outputs).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user