去除warn
This commit is contained in:
@@ -48,8 +48,8 @@ namespace Tnb.BasicData
|
||||
public async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? null : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string materialInfo = queryJson?["query_info"]?.ToString();
|
||||
Dictionary<string, object>? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? null : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string materialInfo = queryJson?["query_info"]?.ToString() ?? "";
|
||||
var list = await db.Queryable<BasEbomH, BasMaterial, BasRouteH>((a, b, c) => new object[]
|
||||
{
|
||||
JoinType.Left, a.material_id == b.id,
|
||||
@@ -67,7 +67,7 @@ namespace Tnb.BasicData
|
||||
route_id = c.name,
|
||||
route_id_id = c.id,
|
||||
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
}).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EbomListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
@@ -75,7 +75,6 @@ namespace Tnb.BasicData
|
||||
/// <summary>
|
||||
/// 获取物料清单树.
|
||||
/// </summary>
|
||||
/// <param name="input">获取物料清单树.</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetTree(EbomTreeQueryInput queryInput)
|
||||
@@ -115,7 +114,7 @@ namespace Tnb.BasicData
|
||||
hasChildren = SqlFunc.Subqueryable<BasEbomH>().Where(x=>x.material_id==a.material_id).Any(),
|
||||
}).Mapper(it =>
|
||||
{
|
||||
it.material_id_unit_id = dic[it.material_id_unit_id].ToString();
|
||||
it.material_id_unit_id = !string.IsNullOrEmpty(it.material_id_unit_id) ? dic[it.material_id_unit_id].ToString() : "";
|
||||
}).ToListAsync();
|
||||
return data;
|
||||
}
|
||||
@@ -145,7 +144,7 @@ namespace Tnb.BasicData
|
||||
hasChildren = SqlFunc.Subqueryable<BasEbomH>().Where(x=>x.material_id==a.material_id).Any(),
|
||||
}).Mapper(it =>
|
||||
{
|
||||
it.material_id_unit_id = dic[it.material_id_unit_id].ToString();
|
||||
it.material_id_unit_id = !string.IsNullOrEmpty(it.material_id_unit_id) ? dic[it.material_id_unit_id].ToString() : "";
|
||||
}).ToListAsync();
|
||||
return data;
|
||||
}
|
||||
@@ -182,9 +181,9 @@ namespace Tnb.BasicData
|
||||
}).FirstAsync();
|
||||
return new Dictionary<string,string>()
|
||||
{
|
||||
["version"] = ebom?.version,
|
||||
["routeName"] = ebom?.name,
|
||||
["routeId"] = ebom?.id
|
||||
["version"] = ebom?.version ?? "",
|
||||
["routeName"] = ebom?.name ?? "",
|
||||
["routeId"] = ebom?.id ?? ""
|
||||
,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -88,7 +88,8 @@ namespace Tnb.BasicData
|
||||
{
|
||||
List<string> ids = await GetAllChildrenMaterialId(queryInput.ebom_id,0);
|
||||
BasEbomH ebom = await db.Queryable<BasEbomH>().Where(x => x.id == queryInput.ebom_id).SingleAsync();
|
||||
ids.Add(ebom.material_id);
|
||||
if(ebom!=null && !string.IsNullOrEmpty(ebom.material_id))
|
||||
ids.Add(ebom.material_id);
|
||||
var result = await db.Queryable<BasMaterial>()
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b) => b.EnCode == DictConst.MeasurementUnit && b.DeleteMark == null)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c) => c.DictionaryTypeId == b.Id && a.unit_id == c.EnCode)
|
||||
@@ -144,7 +145,7 @@ namespace Tnb.BasicData
|
||||
{
|
||||
//获取最新创建的物料清单
|
||||
var ebom = await _repository.AsSugarClient().Queryable<BasEbomH>().Where(x=>x.material_id==id).OrderByDescending(x=>x.create_time).FirstAsync();
|
||||
ids.AddRange(await GetAllChildrenMaterialId(ebom?.id,index));
|
||||
ids.AddRange(await GetAllChildrenMaterialId(ebom?.id ?? "",index));
|
||||
}
|
||||
ids.AddRange(list);
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace Tnb.BasicData
|
||||
public async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? null : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string materialInfo = queryJson?["query_info"]?.ToString();
|
||||
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[]
|
||||
{
|
||||
JoinType.Left, a.material_id == b.id,
|
||||
@@ -75,8 +75,8 @@ namespace Tnb.BasicData
|
||||
ebom_id = c.version,
|
||||
route_id = d.name,
|
||||
route_id_id = c.id,
|
||||
start_time = a.start_time.Value.ToString("yyyy-MM-dd"),
|
||||
end_time = a.start_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);
|
||||
|
||||
@@ -278,55 +278,58 @@ namespace Tnb.BasicData
|
||||
List<BasMbomInput> inputs = new List<BasMbomInput>();
|
||||
List<BasMbomOutput> outputs = new List<BasMbomOutput>();
|
||||
|
||||
foreach (var process in mbomSaveDataInput.processes)
|
||||
if (mbomSaveDataInput != null && mbomSaveDataInput.processes != null)
|
||||
{
|
||||
string mbomProcessId = SnowflakeIdHelper.NextId();
|
||||
processes.Add(new BasMbomProcess()
|
||||
foreach (var process in mbomSaveDataInput.processes)
|
||||
{
|
||||
id = mbomProcessId,
|
||||
org_id = orgId,
|
||||
mbom_id = mbomId,
|
||||
process_id = process.process_id,
|
||||
preparation_time = process.preparation_time,
|
||||
station = process.station,
|
||||
byproduct_status = process.byproduct_status,
|
||||
production_method = process.production_method,
|
||||
|
||||
});
|
||||
|
||||
if (process.inputs != null)
|
||||
{
|
||||
foreach (var input in process.inputs)
|
||||
string mbomProcessId = SnowflakeIdHelper.NextId();
|
||||
processes.Add(new BasMbomProcess()
|
||||
{
|
||||
string inputId = SnowflakeIdHelper.NextId();
|
||||
inputs.Add(new BasMbomInput()
|
||||
id = mbomProcessId,
|
||||
org_id = orgId,
|
||||
mbom_id = mbomId,
|
||||
process_id = process?.process_id ?? "",
|
||||
preparation_time = process?.preparation_time ?? 0,
|
||||
station = process?.station ?? "",
|
||||
byproduct_status = process.byproduct_status,
|
||||
production_method = process.production_method,
|
||||
|
||||
});
|
||||
|
||||
if (process.inputs != null)
|
||||
{
|
||||
foreach (var input in process.inputs)
|
||||
{
|
||||
id = inputId,
|
||||
mbom_id = mbomId,
|
||||
mbom_process_id = mbomProcessId,
|
||||
process_id = process.process_id,
|
||||
material_id = input.material_id,
|
||||
num = input.num,
|
||||
org_id = orgId,
|
||||
});
|
||||
string inputId = SnowflakeIdHelper.NextId();
|
||||
inputs.Add(new BasMbomInput()
|
||||
{
|
||||
id = inputId,
|
||||
mbom_id = mbomId,
|
||||
mbom_process_id = mbomProcessId,
|
||||
process_id = process?.process_id ?? "",
|
||||
material_id = input.material_id,
|
||||
num = input.num,
|
||||
org_id = orgId,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (process.outputs != null)
|
||||
{
|
||||
foreach (var output in process.outputs)
|
||||
if (process.outputs != null)
|
||||
{
|
||||
string outputId = SnowflakeIdHelper.NextId();
|
||||
outputs.Add(new BasMbomOutput()
|
||||
foreach (var output in process.outputs)
|
||||
{
|
||||
id = outputId,
|
||||
mbom_id = mbomId,
|
||||
mbom_process_id = mbomProcessId,
|
||||
process_id = process.process_id,
|
||||
material_id = output.material_id,
|
||||
num = output.num,
|
||||
org_id = orgId,
|
||||
});
|
||||
string outputId = SnowflakeIdHelper.NextId();
|
||||
outputs.Add(new BasMbomOutput()
|
||||
{
|
||||
id = outputId,
|
||||
mbom_id = mbomId,
|
||||
mbom_process_id = mbomProcessId,
|
||||
process_id = process?.process_id ?? "",
|
||||
material_id = output.material_id,
|
||||
num = output.num,
|
||||
org_id = orgId,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -356,84 +359,93 @@ namespace Tnb.BasicData
|
||||
}
|
||||
|
||||
string orgId = _userManager.GetUserInfo().Result.organizeId;
|
||||
await _repository.UpdateAsync(x => new BasMbom()
|
||||
if (mbomSaveDataInput != null)
|
||||
{
|
||||
// org_id = orgId,
|
||||
material_id = mbomSaveDataInput.material_id,
|
||||
num = mbomSaveDataInput.num,
|
||||
unit_id = mbomSaveDataInput.unit_id,
|
||||
version = mbomSaveDataInput.version,
|
||||
start_time = mbomSaveDataInput.start_time,
|
||||
end_time = mbomSaveDataInput.end_time,
|
||||
ebom_id = mbomSaveDataInput.ebom_id,
|
||||
route_id = mbomSaveDataInput.route_id,
|
||||
is_first = mbomSaveDataInput.is_first,
|
||||
remark = mbomSaveDataInput.remark,
|
||||
modify_id = _userManager.UserId,
|
||||
modify_time = DateTime.Now,
|
||||
await _repository.UpdateAsync(x => new BasMbom()
|
||||
{
|
||||
// org_id = orgId,
|
||||
material_id = mbomSaveDataInput.material_id,
|
||||
num = mbomSaveDataInput.num,
|
||||
unit_id = mbomSaveDataInput.unit_id,
|
||||
version = mbomSaveDataInput.version,
|
||||
start_time = mbomSaveDataInput.start_time,
|
||||
end_time = mbomSaveDataInput.end_time,
|
||||
ebom_id = mbomSaveDataInput.ebom_id,
|
||||
route_id = mbomSaveDataInput.route_id,
|
||||
is_first = mbomSaveDataInput.is_first,
|
||||
remark = mbomSaveDataInput.remark,
|
||||
modify_id = _userManager.UserId,
|
||||
modify_time = DateTime.Now,
|
||||
|
||||
}, x => x.id == mbomSaveDataInput.id);
|
||||
}, x => x.id == mbomSaveDataInput.id);
|
||||
}
|
||||
List<BasMbomProcess> processes = new List<BasMbomProcess>();
|
||||
List<BasMbomInput> inputs = new List<BasMbomInput>();
|
||||
List<BasMbomOutput> outputs = new List<BasMbomOutput>();
|
||||
|
||||
foreach (var process in mbomSaveDataInput.processes)
|
||||
if (mbomSaveDataInput != null && mbomSaveDataInput.processes != null)
|
||||
{
|
||||
string mbomProcessId = SnowflakeIdHelper.NextId();
|
||||
processes.Add(new BasMbomProcess()
|
||||
foreach (var process in mbomSaveDataInput.processes)
|
||||
{
|
||||
id = mbomProcessId,
|
||||
org_id = orgId,
|
||||
mbom_id = mbomSaveDataInput.id,
|
||||
process_id = process.process_id,
|
||||
preparation_time = process.preparation_time,
|
||||
station = process.station,
|
||||
byproduct_status = process.byproduct_status,
|
||||
production_method = process.production_method,
|
||||
|
||||
});
|
||||
|
||||
if (process.inputs != null)
|
||||
{
|
||||
foreach (var input in process.inputs)
|
||||
string mbomProcessId = SnowflakeIdHelper.NextId();
|
||||
processes.Add(new BasMbomProcess()
|
||||
{
|
||||
string inputId = SnowflakeIdHelper.NextId();
|
||||
inputs.Add(new BasMbomInput()
|
||||
{
|
||||
id = inputId,
|
||||
mbom_id = mbomSaveDataInput.id,
|
||||
mbom_process_id = mbomProcessId,
|
||||
process_id = process.process_id,
|
||||
material_id = input.material_id,
|
||||
num = input.num,
|
||||
org_id = orgId,
|
||||
});
|
||||
}
|
||||
}
|
||||
id = mbomProcessId,
|
||||
org_id = orgId ?? "",
|
||||
mbom_id = mbomSaveDataInput?.id ?? "",
|
||||
process_id = process?.process_id ?? "",
|
||||
preparation_time = process?.preparation_time ?? 0,
|
||||
station = process.station,
|
||||
byproduct_status = process.byproduct_status,
|
||||
production_method = process.production_method,
|
||||
|
||||
if (process.outputs != null)
|
||||
{
|
||||
foreach (var output in process.outputs)
|
||||
});
|
||||
|
||||
if (process.inputs != null)
|
||||
{
|
||||
string outputId = SnowflakeIdHelper.NextId();
|
||||
outputs.Add(new BasMbomOutput()
|
||||
foreach (var input in process.inputs)
|
||||
{
|
||||
id = outputId,
|
||||
mbom_id = mbomSaveDataInput.id,
|
||||
mbom_process_id = mbomProcessId,
|
||||
process_id = process.process_id,
|
||||
material_id = output.material_id,
|
||||
num = output.num,
|
||||
org_id = orgId,
|
||||
});
|
||||
string inputId = SnowflakeIdHelper.NextId();
|
||||
inputs.Add(new BasMbomInput()
|
||||
{
|
||||
id = inputId,
|
||||
mbom_id = mbomSaveDataInput?.id ?? "",
|
||||
mbom_process_id = mbomProcessId,
|
||||
process_id = process?.process_id ?? "",
|
||||
material_id = input.material_id,
|
||||
num = input.num,
|
||||
org_id = orgId,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (process.outputs != null)
|
||||
{
|
||||
foreach (var output in process.outputs)
|
||||
{
|
||||
string outputId = SnowflakeIdHelper.NextId();
|
||||
outputs.Add(new BasMbomOutput()
|
||||
{
|
||||
id = outputId,
|
||||
mbom_id = mbomSaveDataInput?.id ?? "",
|
||||
mbom_process_id = mbomProcessId,
|
||||
process_id = process?.process_id ?? "",
|
||||
material_id = output.material_id,
|
||||
num = output.num,
|
||||
org_id = orgId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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 (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();
|
||||
}
|
||||
if (processes.Count > 0)
|
||||
{
|
||||
await _repository.AsSugarClient().Insertable<BasMbomProcess>(processes).ExecuteCommandAsync();
|
||||
|
||||
@@ -108,8 +108,6 @@ namespace Tnb.BasicData
|
||||
/// <summary>
|
||||
/// 保存工序工位关联表
|
||||
/// </summary>
|
||||
/// <param name="processStationInput">process_id 工序id</param>
|
||||
/// <param name="processStationInput">stationIds 工位id集合</param>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> Create(VisualDevModelDataCrInput visualDevModelDataCrInput)
|
||||
{
|
||||
@@ -118,7 +116,7 @@ namespace Tnb.BasicData
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModelId, true);
|
||||
await _runService.Create(templateEntity, visualDevModelDataCrInput);
|
||||
|
||||
string processId = visualDevModelDataCrInput.data["ReturnIdentity"].ToString();
|
||||
string processId = visualDevModelDataCrInput.data["ReturnIdentity"].ToString() ?? "";
|
||||
|
||||
List<BasProcessStation> list = new List<BasProcessStation>();
|
||||
foreach (var item in (JArray)visualDevModelDataCrInput.data["station"])
|
||||
|
||||
@@ -83,7 +83,6 @@ namespace Tnb.BasicData
|
||||
/// <summary>
|
||||
/// 获取有效的已发布的工艺路线
|
||||
/// </summary>
|
||||
/// <param name="parameters"></param>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetValidRouteList([FromBody]VisualDevDataFieldDataListInput pageInput)
|
||||
{
|
||||
@@ -99,8 +98,8 @@ namespace Tnb.BasicData
|
||||
id = x.id,
|
||||
code = x.code,
|
||||
name = x.name,
|
||||
start_time = x.start_time.Value.ToString("yyyy-MM-dd"),
|
||||
end_time = 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