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

@@ -8,14 +8,14 @@ namespace Tnb.QcMgr.Entities
{ {
public class CheckItemOut public class CheckItemOut
{ {
public string checktypeid { get; set; } public string? checktypeid { get; set; }
public string checktypename { get; set; } public string? checktypename { get; set; }
public List<CheckItem> items { get; set; } public List<CheckItem>? items { get; set; }
} }
public class CheckItem public class CheckItem
{ {
public string itemid { get; set; } public string? itemid { get; set; }
public string name { get; set; } public string? name { get; set; }
public string code { get; set; } public string? code { get; set; }
} }
} }

View File

@@ -8,54 +8,54 @@ namespace Tnb.QcMgr.Entities.Dto
{ {
public class CheckItemsInput public class CheckItemsInput
{ {
public string id { get; set; } public string? id { get; set; }
public string name { get; set; } public string? name { get; set; }
public string status { get; set; } public string? status { get; set; }
public List<CheckTypeInput> checktypes { get; set; } public List<CheckTypeInput>? checktypes { get; set; }
} }
public class CheckTypeInput public class CheckTypeInput
{ {
public string id { get; set; } public string? id { get; set; }
public List<ItemInput> items { get; set; } public List<ItemInput>? items { get; set; }
} }
public class ItemInput public class ItemInput
{ {
public string itemid { get; set; } public string? itemid { get; set; }
public string code { get; set; } public string? code { get; set; }
public string name { get; set; } public string? name { get; set; }
public string itemdid { get; set; } public string? itemdid { get; set; }
public string extype { get; set; } public string? extype { get; set; }
public string excontent { get; set; } public string? excontent { get; set; }
public string check { get; set; } public string? check { get; set; }
public string errorcause { get; set; } public string? errorcause { get; set; }
public string errorlevel { get; set; } public string? errorlevel { get; set; }
public string remark { get; set; } public string? remark { get; set; }
public string attachment { get; set; } public string? attachment { get; set; }
public string isexec { get; set; } public string? isexec { get; set; }
public string customer { get; set; } public string? customer { get; set; }
} }
public class CheckItemsOut public class CheckItemsOut
{ {
public string id { get; set; } public string? id { get; set; }
public string name { get; set; } public string? name { get; set; }
public string status { get; set; } public string? status { get; set; }
public List<CheckTypeOut> checktypes { get; set; } public List<CheckTypeOut>? checktypes { get; set; }
} }
public class CheckTypeOut public class CheckTypeOut
{ {
public string checktypeid { get; set; } public string? checktypeid { get; set; }
public string checktypename { get; set; } public string? checktypename { get; set; }
public List<ItemOut> items { get; set; } public List<ItemOut>? items { get; set; }
} }
public class ItemOut public class ItemOut
{ {
public string itemid { get; set; } public string? itemid { get; set; }
public string code { get; set; } public string? code { get; set; }
public string name { get; set; } public string? name { get; set; }
public string itemdid { get; set; } public string? itemdid { get; set; }
public Show setShow { get; set; } public Show? setShow { get; set; }
public Data setData { get; set; } public Data? setData { get; set; }
} }
public class Show { public class Show {
@@ -70,15 +70,15 @@ namespace Tnb.QcMgr.Entities.Dto
public bool isexec { get; set; } public bool isexec { get; set; }
} }
public class Data { public class Data {
public string extype { get; set; } public string? extype { get; set; }
public Excontent excontent { get; set; } public Excontent? excontent { get; set; }
public string check { get; set; } public string? check { get; set; }
public string[] errorcause { get; set; } public string[]? errorcause { get; set; }
public string[] errorlevel { get; set; } public string[]? errorlevel { get; set; }
public string remark { get; set; } public string? remark { get; set; }
public string attachment { get; set; } public string? attachment { get; set; }
public string customer { get; set; } public string? customer { get; set; }
public Isexec isexec { get; set; } public Isexec? isexec { get; set; }
} }
public class Isexec public class Isexec
{ {

View File

@@ -9,55 +9,55 @@ namespace Tnb.QcMgr.Entities
{ {
public class CheckPlanInput public class CheckPlanInput
{ {
public string mainid { get; set; } public string? mainid { get; set; }
public string addid { get; set; } public string? addid { get; set; }
public string triggertype { get; set; } public string? triggertype { get; set; }
public string content { get; set; } public string? content { get; set; }
public List<CheckPlanTypeInput> checktypes { get; set; } public List<CheckPlanTypeInput>? checktypes { get; set; }
} }
public class CheckPlanTypeInput public class CheckPlanTypeInput
{ {
public string id { get; set; } public string? id { get; set; }
public List<PlanItemInput> items { get; set; } public List<PlanItemInput>? items { get; set; }
} }
public class PlanItemInput public class PlanItemInput
{ {
public string itemid { get; set; } public string? itemid { get; set; }
public string extype { get; set; } public string? extype { get; set; }
public string excontent { get; set; } public string? excontent { get; set; }
public string check { get; set; } public string? check { get; set; }
public string errorcause { get; set; } public string? errorcause { get; set; }
public string errorlevel { get; set; } public string? errorlevel { get; set; }
public string remark { get; set; } public string? remark { get; set; }
public string attachment { get; set; } public string? attachment { get; set; }
public string isexec { get; set; } public string? isexec { get; set; }
public string customer { get; set; } public string? customer { get; set; }
} }
public class CheckPlansOut public class CheckPlansOut
{ {
public string id { get; set; } public string? id { get; set; }
public bool hasadd { get; set; } public bool hasadd { get; set; }
public bool hasitem{ get; set; } public bool hasitem{ get; set; }
public string addid { get; set; } public string? addid { get; set; }
public string triggertype { get; set; } public string? triggertype { get; set; }
public string content { get; set; } public string? content { get; set; }
public List<CheckPlanTypeOut> checktypes { get; set; } public List<CheckPlanTypeOut>? checktypes { get; set; }
} }
public class CheckPlanTypeOut public class CheckPlanTypeOut
{ {
public string checktypeid { get; set; } public string? checktypeid { get; set; }
public string checktypename { get; set; } public string? checktypename { get; set; }
public List<PlanItemOut> items { get; set; } public List<PlanItemOut>? items { get; set; }
} }
public class PlanItemOut public class PlanItemOut
{ {
public string itemid { get; set; } public string? itemid { get; set; }
public string code { get; set; } public string? code { get; set; }
public string name { get; set; } public string? name { get; set; }
public string itemdid { get; set; } public string? itemdid { get; set; }
public PlanItemShow setShow { get; set; } public PlanItemShow? setShow { get; set; }
public PlanItemData setData { get; set; } public PlanItemData? setData { get; set; }
} }
public class PlanItemShow public class PlanItemShow
@@ -74,15 +74,15 @@ namespace Tnb.QcMgr.Entities
} }
public class PlanItemData public class PlanItemData
{ {
public string extype { get; set; } public string? extype { get; set; }
public Excontent excontent { get; set; } public Excontent? excontent { get; set; }
public string check { get; set; } public string? check { get; set; }
public string[] errorcause { get; set; } public string[]? errorcause { get; set; }
public string[] errorlevel { get; set; } public string[]? errorlevel { get; set; }
public string remark { get; set; } public string? remark { get; set; }
public string attachment { get; set; } public string? attachment { get; set; }
public string customer { get; set; } public string? customer { get; set; }
public IsexecP isexec { get; set; } public IsexecP? isexec { get; set; }
} }
public class IsexecP public class IsexecP
{ {

View File

@@ -8,28 +8,42 @@ namespace Tnb.QcMgr.Entities.Dto
{ {
public class CheckTaskOut public class CheckTaskOut
{ {
public string mainid { get; set; } public string? mainid { get; set; }
public string workid { get; set; } public string? workid { get; set; }
public string workname { get; set; } public string? workname { get; set; }
public string wareid { get; set; } public string? wareid { get; set; }
public List<CheckExecTypeOut> checktypes { get; set; } public string? status { get; set; }
public List<CheckExecTypeOut>? checktypes { get; set; }
} }
public class CheckExecTypeOut public class CheckExecTypeOut
{ {
public string checktypeid { get; set; } public string? checktypeid { get; set; }
public string checktypename { get; set; } public string? checktypename { get; set; }
public List<ExecItemOut> items { get; set; } public List<ExecItemOut>? items { get; set; }
} }
public class ExecItemOut public class ExecItemOut
{ {
public string itemid { get; set; } public string? itemid { get; set; }
public string code { get; set; } public string? code { get; set; }
public string name { get; set; } public string? name { get; set; }
public string itemdid { get; set; } public string? itemdid { get; set; }
public ExecItemShow setShow { get; set; } public ExecItemShow? setShow { get; set; }
public ExecItemData setData { get; set; } public ExecItemData? setData { get; set; }
public PostItemForm? postItemForm { get; set; }
} }
public class PostItemForm
{
public string? attachment { get; set; }
public string[]? checkbox { get; set; }
public string? errorcause { get; set; }
public string? errorlevel { get; set; }
public int measuredValue { get; set; }
public string? radio { get; set; }
public string? remark { get; set; }
public string? text { get; set; }
public string? verdict { get; set; }
}
public class ExecItemShow public class ExecItemShow
{ {
public bool extype { get; set; } public bool extype { get; set; }
@@ -44,37 +58,37 @@ namespace Tnb.QcMgr.Entities.Dto
} }
public class ExecItemData public class ExecItemData
{ {
public string extype { get; set; } public string? extype { get; set; }
public Excontent excontent { get; set; } public Excontent? excontent { get; set; }
public string check { get; set; } public string? check { get; set; }
public List<Error> errorcause { get; set; } public List<Error>? errorcause { get; set; }
public List<Error> errorlevel { get; set; } public List<Error>? errorlevel { get; set; }
public string remark { get; set; } public string? remark { get; set; }
public string attachment { get; set; } public string? attachment { get; set; }
public string customer { get; set; } public string? customer { get; set; }
public IsexecE isexec { get; set; } public IsexecE? isexec { get; set; }
} }
public class Excontent public class Excontent
{ {
public string excontentType { get; set; } public string? excontentType { get; set; }
public string excontentNum { get; set; } public string? excontentNum { get; set; }
public string amongMaxNum { get; set; } public string? amongMaxNum { get; set; }
public string amongMinNum { get; set; } public string? amongMinNum { get; set; }
public string amongMinUnit { get; set; } public string? amongMinUnit { get; set; }
public string gapValue { get; set; } public string? gapValue { get; set; }
public string greaterThanValue { get; set; } public string? greaterThanValue { get; set; }
public string lessThanValue { get; set; } public string? lessThanValue { get; set; }
public string excontentText { get; set; } public string? excontentText { get; set; }
public List<ExcontentOption> excontentOptions { get; set; } public List<ExcontentOption>? excontentOptions { get; set; }
} }
public class ExcontentOption public class ExcontentOption
{ {
public string value { get; set; } public string? value { get; set; }
} }
public class Error public class Error
{ {
public string id { get; set; } public string? id { get; set; }
public string name { get; set; } public string? name { get; set; }
} }
public class IsexecE public class IsexecE
{ {
@@ -84,34 +98,34 @@ namespace Tnb.QcMgr.Entities.Dto
public class CheckTaskInput public class CheckTaskInput
{ {
public string mainid { get; set; } public string? mainid { get; set; }
public string checknum { get; set; } public string? checknum { get; set; }
public string status { get; set; } public string? status { get; set; }
public string result { get; set; } public string? result { get; set; }
public List<CheckExexTypeInput> checktypes { get; set; } public List<CheckExexTypeInput>? checktypes { get; set; }
} }
public class CheckExexTypeInput public class CheckExexTypeInput
{ {
public string id { get; set; } public string? id { get; set; }
public List<ExecItemInput> items { get; set; } public List<ExecItemInput>? items { get; set; }
} }
public class ExecItemInput public class ExecItemInput
{ {
public string itemdid { get; set; } public string? itemdid { get; set; }
public string itemid { get; set; } public string? itemid { get; set; }
public string extype { get; set; } public string? extype { get; set; }
public string excontent { get; set; } public string? excontent { get; set; }
public string check { get; set; } public string? check { get; set; }
public string errorcause { get; set; } public string? errorcause { get; set; }
public string errorlevel { get; set; } public string? errorlevel { get; set; }
public string remark { get; set; } public string? remark { get; set; }
public string attachment { get; set; } public string? attachment { get; set; }
public string isexec { get; set; } public string? isexec { get; set; }
public string customer { get; set; } public string? customer { get; set; }
public string result { get; set; } public string? result { get; set; }
public string postItemForm { get; set; } public string? postItemForm { get; set; }
} }
} }

View File

@@ -9,12 +9,12 @@ namespace Tnb.QcMgr.Entities.Dto
{ {
public class TriggerPlan public class TriggerPlan
{ {
public string id { get; set; } public string? id { get; set; }
public string name { get; set; } public string? name { get; set; }
public string code { get; set; } public string? code { get; set; }
public string type { get; set; } public string? type { get; set; }
public string cycle { get; set; } public string? cycle { get; set; }
public string[] trievent { get; set; } public string[]? trievent { get; set; }
public string[] trieventid { get; set; } public string[]? trieventid { get; set; }
} }
} }

View File

@@ -93,7 +93,7 @@ namespace Tnb.QcMgr
{ {
CheckItemOuts.Add(new CheckItemOut { checktypeid = data.type!, checktypename = data.typename!, items = new List<CheckItem>() }); CheckItemOuts.Add(new CheckItemOut { checktypeid = data.type!, checktypename = data.typename!, items = new List<CheckItem>() });
var CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First(); var CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First();
CheckItemOut.items.Add(new CheckItem() { itemid = data.id, name = data.name!, code = data.code! }); CheckItemOut.items?.Add(new CheckItem() { itemid = data.id, name = data.name!, code = data.code! });
} }
} }
return CheckItemOuts; return CheckItemOuts;
@@ -111,8 +111,8 @@ namespace Tnb.QcMgr
var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync(); var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync();
var QcCheckTypes = await db.Queryable<QcCheckType>().ToListAsync(); var QcCheckTypes = await db.Queryable<QcCheckType>().ToListAsync();
var QcCheckItemsH = await db.Queryable<QcCheckItemsH>().Where(p => p.id == CheckItemsInput.id).FirstAsync(); var QcCheckItemsH = await db.Queryable<QcCheckItemsH>().Where(p => p.id == CheckItemsInput.id).FirstAsync();
List<QcCheckItemsR> QcCheckItemsRs = null; List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
List<QcCheckItemsD> QcCheckItemsDs = null; List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>();
if (QcCheckItemsH != null) if (QcCheckItemsH != null)
{ {
QcCheckItemsRs = await db.Queryable<QcCheckItemsR>().Where(p => p.itemshid == QcCheckItemsH.id).ToListAsync(); QcCheckItemsRs = await db.Queryable<QcCheckItemsR>().Where(p => p.itemshid == QcCheckItemsH.id).ToListAsync();
@@ -169,7 +169,7 @@ namespace Tnb.QcMgr
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment); Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer); Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
Item.setShow.isexec = Item.setData.isexec == null ? false : true; Item.setShow.isexec = Item.setData.isexec == null ? false : true;
CheckItemsOut.checktypes.Where(p => p.checktypeid == QcCheckItemsR.typeid).First().items.Add(Item); CheckItemsOut.checktypes.Where(p => p.checktypeid == QcCheckItemsR.typeid).First().items?.Add(Item);
} }
} }
} }
@@ -189,7 +189,7 @@ namespace Tnb.QcMgr
try try
{ {
if (!string.IsNullOrEmpty(CheckItemsInput.id)) if (!string.IsNullOrEmpty(CheckItemsInput.id))
await Delete(CheckItemsInput.id); await Delete(CheckItemsInput.id);
QcCheckItemsH QcCheckItemsH = new QcCheckItemsH(); QcCheckItemsH QcCheckItemsH = new QcCheckItemsH();
QcCheckItemsH.name = CheckItemsInput.name; QcCheckItemsH.name = CheckItemsInput.name;
QcCheckItemsH.status = CheckItemsInput.status; QcCheckItemsH.status = CheckItemsInput.status;
@@ -197,32 +197,38 @@ namespace Tnb.QcMgr
QcCheckItemsH.create_id = _userManager.UserId; QcCheckItemsH.create_id = _userManager.UserId;
List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>(); List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>(); List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>();
foreach (var checktype in CheckItemsInput.checktypes) if (CheckItemsInput.checktypes != null)
{ {
foreach (var item in checktype.items) foreach (var checktype in CheckItemsInput.checktypes)
{ {
var QcCheckItemsD = new QcCheckItemsD() if (checktype.items != null)
{ {
extype = item.extype, foreach (var item in checktype.items)
excontent = item.excontent, {
check = item.check, var QcCheckItemsD = new QcCheckItemsD()
errorcause = item.errorcause.Replace("\"","").Trim(), {
errorlevel = item.errorlevel.Replace("\"", "").Trim(), extype = item.extype,
remark = item.remark, excontent = item.excontent,
attachment = item.attachment, check = item.check,
isexec = item.isexec, errorcause = item.errorcause?.Replace("\"", "").Trim(),
custom=item.customer errorlevel = item.errorlevel?.Replace("\"", "").Trim(),
}; remark = item.remark,
QcCheckItemsDs.Add(QcCheckItemsD); attachment = item.attachment,
var QcCheckItemsR = new QcCheckItemsR() isexec = item.isexec,
{ custom = item.customer
itemshid = QcCheckItemsH.id, };
typeid = checktype.id, QcCheckItemsDs.Add(QcCheckItemsD);
itemid = item.itemid, var QcCheckItemsR = new QcCheckItemsR()
itemsdid = QcCheckItemsD.id {
}; itemshid = QcCheckItemsH.id,
typeid = checktype.id,
itemid = item.itemid,
itemsdid = QcCheckItemsD.id
};
QcCheckItemsRs.Add(QcCheckItemsR); QcCheckItemsRs.Add(QcCheckItemsR);
}
}
} }
} }
QcCheckItemsDs.ForEach(p => QcCheckItemsDs.ForEach(p =>
@@ -237,7 +243,7 @@ namespace Tnb.QcMgr
await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync(); await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync();
await db.Ado.CommitTranAsync(); await db.Ado.CommitTranAsync();
} }
catch (Exception ex) catch (Exception)
{ {
await db.Ado.RollbackTranAsync(); await db.Ado.RollbackTranAsync();
throw Oops.Oh(ErrorCode.COM1000); throw Oops.Oh(ErrorCode.COM1000);

View File

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

View File

@@ -81,6 +81,7 @@ namespace Tnb.QcMgr
CheckTaskOut.mainid = id; CheckTaskOut.mainid = id;
CheckTaskOut.wareid = QcCheckExecH.wareid!; CheckTaskOut.wareid = QcCheckExecH.wareid!;
CheckTaskOut.workid = QcCheckExecH.workid!; CheckTaskOut.workid = QcCheckExecH.workid!;
CheckTaskOut.status = QcCheckExecH.status!;
if (!string.IsNullOrEmpty(CheckTaskOut.workid)) if (!string.IsNullOrEmpty(CheckTaskOut.workid))
CheckTaskOut.workname = db.Queryable<OrganizeEntity>().Where(p => p.Id == CheckTaskOut.workid).First().FullName; CheckTaskOut.workname = db.Queryable<OrganizeEntity>().Where(p => p.Id == CheckTaskOut.workid).First().FullName;
CheckTaskOut.checktypes = new List<CheckExecTypeOut>(); CheckTaskOut.checktypes = new List<CheckExecTypeOut>();
@@ -130,13 +131,15 @@ namespace Tnb.QcMgr
Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype); Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype);
Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent); Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent);
Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check); Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check);
Item.setShow.errorcause = Item.setData.errorcause.Count == 0 ? false : true; Item.setShow.errorcause = Item.setData.errorcause?.Count == 0 ? false : true;
Item.setShow.errorlevel = Item.setData.errorlevel.Count == 0 ? false : true; Item.setShow.errorlevel = Item.setData.errorlevel?.Count == 0 ? false : true;
Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark); Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark);
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment); Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer); Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
Item.setShow.isexec = Item.setData.isexec == null ? false : true; Item.setShow.isexec = Item.setData.isexec == null ? false : true;
CheckTaskOut.checktypes.Where(p => p.checktypeid == QcCheckExecD.typeid).First().items.Add(Item); if(!string.IsNullOrEmpty(QcCheckExecD.postdata))
Item.postItemForm= JSON.Deserialize<PostItemForm>(QcCheckExecD.postdata!);
CheckTaskOut.checktypes.Where(p => p.checktypeid == QcCheckExecD.typeid).First()?.items?.Add(Item);
} }
return CheckTaskOut; return CheckTaskOut;
} }
@@ -159,23 +162,29 @@ namespace Tnb.QcMgr
QcCheckExecH.execuser = _userManager.UserId; QcCheckExecH.execuser = _userManager.UserId;
QcCheckExecH.exectime = DateTime.Now.ToString(); QcCheckExecH.exectime = DateTime.Now.ToString();
var QcCheckExecDs = await db.Queryable<QcCheckExecD>().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync(); var QcCheckExecDs = await db.Queryable<QcCheckExecD>().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync();
foreach (var checktype in CheckTaskInput.checktypes) if (CheckTaskInput.checktypes != null)
{ {
foreach (var item in checktype.items) foreach (var checktype in CheckTaskInput.checktypes)
{ {
var QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault(); if (checktype.items != null)
if (QcCheckExecD == null) {
continue; foreach (var item in checktype.items)
QcCheckExecD.excontent = item.excontent; {
QcCheckExecD.check = item.check; var QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault();
QcCheckExecD.errorcause = item.errorcause; if (QcCheckExecD == null)
QcCheckExecD.errorlevel = item.errorlevel; continue;
QcCheckExecD.remark = item.remark; QcCheckExecD.excontent = item.excontent;
QcCheckExecD.attachment = item.attachment; QcCheckExecD.check = item.check;
QcCheckExecD.isexec = item.isexec; QcCheckExecD.errorcause = item.errorcause;
QcCheckExecD.custom = item.customer; QcCheckExecD.errorlevel = item.errorlevel;
QcCheckExecD.result = item.result; QcCheckExecD.remark = item.remark;
QcCheckExecD.postdata = item.postItemForm; QcCheckExecD.attachment = item.attachment;
QcCheckExecD.isexec = item.isexec;
QcCheckExecD.custom = item.customer;
QcCheckExecD.result = item.result;
QcCheckExecD.postdata = item.postItemForm;
}
}
} }
} }
await db.Ado.BeginTranAsync(); await db.Ado.BeginTranAsync();
@@ -183,7 +192,7 @@ namespace Tnb.QcMgr
await db.Updateable(QcCheckExecDs).ExecuteCommandAsync(); await db.Updateable(QcCheckExecDs).ExecuteCommandAsync();
await db.Ado.CommitTranAsync(); await db.Ado.CommitTranAsync();
} }
catch (Exception ex) catch (Exception)
{ {
throw Oops.Oh(ErrorCode.COM1000); throw Oops.Oh(ErrorCode.COM1000);