This commit is contained in:
qianjiawei
2023-06-21 13:35:51 +08:00
parent 8808b48e78
commit 4c02911d55
8 changed files with 250 additions and 215 deletions

View File

@@ -104,7 +104,7 @@ namespace Tnb.QcMgr
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).First().items.Add(Item);
CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).First()?.items?.Add(Item);
}
}
return CheckPlansOut;
@@ -160,24 +160,30 @@ namespace Tnb.QcMgr
QcCheckPlanAdd.triggertype = CheckPlanInput.triggertype;
QcCheckPlanAdd.content = CheckPlanInput.content;
List<QcCheckPlanD> QcCheckPlanDs = new List<QcCheckPlanD>();
foreach (var checktype in CheckPlanInput.checktypes)
if (CheckPlanInput.checktypes != null)
{
foreach (var item in checktype.items)
foreach (var checktype in CheckPlanInput.checktypes)
{
QcCheckPlanD QcCheckPlanD = new QcCheckPlanD();
QcCheckPlanD.mainid = CheckPlanInput.mainid;
QcCheckPlanD.typeid = checktype.id;
QcCheckPlanD.itemid = item.itemid;
QcCheckPlanD.extype = item.extype;
QcCheckPlanD.excontent = item.excontent;
QcCheckPlanD.check = item.check;
QcCheckPlanD.errorcause = item.errorcause.Replace("\"", "").Trim();
QcCheckPlanD.errorlevel = item.errorlevel.Replace("\"", "").Trim();
QcCheckPlanD.remark = item.remark;
QcCheckPlanD.attachment = item.attachment;
QcCheckPlanD.isexec = item.isexec;
QcCheckPlanD.custom = item.customer;
QcCheckPlanDs.Add(QcCheckPlanD);
if (checktype.items != null)
{
foreach (var item in checktype.items)
{
QcCheckPlanD QcCheckPlanD = new QcCheckPlanD();
QcCheckPlanD.mainid = CheckPlanInput.mainid;
QcCheckPlanD.typeid = checktype.id;
QcCheckPlanD.itemid = item.itemid;
QcCheckPlanD.extype = item.extype;
QcCheckPlanD.excontent = item.excontent;
QcCheckPlanD.check = item.check;
QcCheckPlanD.errorcause = item.errorcause?.Replace("\"", "").Trim();
QcCheckPlanD.errorlevel = item.errorlevel?.Replace("\"", "").Trim();
QcCheckPlanD.remark = item.remark;
QcCheckPlanD.attachment = item.attachment;
QcCheckPlanD.isexec = item.isexec;
QcCheckPlanD.custom = item.customer;
QcCheckPlanDs.Add(QcCheckPlanD);
}
}
}
}
await db.Ado.BeginTranAsync();
@@ -185,7 +191,7 @@ namespace Tnb.QcMgr
await db.Insertable(QcCheckPlanAdd).ExecuteCommandAsync();
await db.Ado.CommitTranAsync();
}
catch (Exception ex)
catch (Exception)
{
await db.Ado.RollbackTranAsync();
throw Oops.Oh(ErrorCode.COM1000);