工艺标准接口修改
This commit is contained in:
@@ -45,6 +45,11 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
tab_id = x.id,
|
||||
tab_name = x.name,
|
||||
daq_list = SqlFunc.Subqueryable<EqpDaq>().Where(a=>a.equip_id==equipId).ToList<ProcessParamTypeDaqListOutput>(a=>new ProcessParamTypeDaqListOutput
|
||||
{
|
||||
id = a.id,
|
||||
label_name = a.label_name,
|
||||
}),
|
||||
children = SqlFunc.Subqueryable<PerProcessParam>()
|
||||
.LeftJoin<PerToleranceCategory>((y,z)=>y.tolerance_category_id==z.id)
|
||||
.Where(y=>y.process_param_type_id==x.id)
|
||||
@@ -71,19 +76,67 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
|
||||
List<PerProcessStandardsD> list = new List<PerProcessStandardsD>();
|
||||
List<string> insertIds = new List<string>();
|
||||
if (input != null && input.Count > 0)
|
||||
{
|
||||
foreach (var item in input)
|
||||
{
|
||||
list.Add(new PerProcessStandardsD()
|
||||
PerProcessStandardsD processStandardsD = await db.Queryable<PerProcessStandardsD>().Where(x =>
|
||||
x.process_param_id == item.process_param_id && x.process_standards_id == item.process_standards_id &&
|
||||
item.process_param_type_id == x.process_param_type_id).FirstAsync();
|
||||
|
||||
if (processStandardsD != null)
|
||||
{
|
||||
process_standards_id = item.process_standards_id,
|
||||
process_param_id = item.process_param_id,
|
||||
value = item.value
|
||||
});
|
||||
PerProcessStandardsH perProcessStandardsH = await db.Queryable<PerProcessStandardsH>().SingleAsync(x => x.id == processStandardsD.process_standards_id);
|
||||
PerProcessParam processParam = await db.Queryable<PerProcessParam>().SingleAsync(x => x.id == processStandardsD.process_param_id);
|
||||
|
||||
if (processStandardsD.value != item.value)
|
||||
{
|
||||
PerProcessParamEditRecord record = new PerProcessParamEditRecord
|
||||
{
|
||||
process_param_id = item.process_param_id,
|
||||
old_value = processStandardsD.value,
|
||||
new_value = item.value,
|
||||
modify_id = _userManager.UserId,
|
||||
modify_time = DateTime.Now,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
equip_id = perProcessStandardsH.equip_id,
|
||||
process_param_name = processParam.name
|
||||
};
|
||||
db.Insertable<PerProcessParamEditRecord>(record).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.id))
|
||||
{
|
||||
PerProcessStandardsD insertObj = new PerProcessStandardsD()
|
||||
{
|
||||
value = item.value,
|
||||
process_param_id = item.process_param_id,
|
||||
process_standards_id = item.process_standards_id,
|
||||
process_param_type_id = item.process_param_type_id,
|
||||
daq_id = item.daq_id,
|
||||
};
|
||||
|
||||
insertIds.Add(insertObj.id);
|
||||
await db.Insertable<PerProcessStandardsD>(insertObj).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await db.Updateable<PerProcessStandardsD>()
|
||||
.SetColumns(x=>x.value==item.value)
|
||||
.SetColumns(x=>x.daq_id==item.daq_id)
|
||||
.Where(x=>x.id==item.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await db.Insertable<PerProcessStandardsD>(list).ExecuteCommandAsync();
|
||||
List<string> notDeleteIds = input.Select(x => x.id).ToList();
|
||||
notDeleteIds.AddRange(insertIds);
|
||||
await db.Deleteable<PerProcessStandardsD>().Where(x => !notDeleteIds.Contains(x.id)).ExecuteCommandAsync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -108,6 +161,11 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
tab_id = a.id,
|
||||
tab_name = a.name,
|
||||
daq_list = SqlFunc.Subqueryable<EqpDaq>().Where(e=>e.equip_id==perProcessStandardsH.equip_id).ToList<ProcessParamTypeDaqListOutput>(e=>new ProcessParamTypeDaqListOutput
|
||||
{
|
||||
id = e.id,
|
||||
label_name = e.label_name,
|
||||
}),
|
||||
children = SqlFunc.Subqueryable<PerProcessStandardsD>()
|
||||
.LeftJoin<PerProcessParam>((b,c)=>b.process_param_id==c.id)
|
||||
.LeftJoin<PerToleranceCategory>((b,c,d)=>c.tolerance_category_id==d.id)
|
||||
@@ -120,7 +178,8 @@ namespace Tnb.PerMgr
|
||||
name = c.name,
|
||||
value = b.value,
|
||||
upper_value = d.upper_value,
|
||||
lower_value = d.lower_value
|
||||
lower_value = d.lower_value,
|
||||
daq_id = b.daq_id
|
||||
}),
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user