1
This commit is contained in:
@@ -93,7 +93,7 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
CheckItemOuts.Add(new CheckItemOut { checktypeid = data.type!, checktypename = data.typename!, items = new List<CheckItem>() });
|
||||
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;
|
||||
@@ -111,8 +111,8 @@ namespace Tnb.QcMgr
|
||||
var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync();
|
||||
var QcCheckTypes = await db.Queryable<QcCheckType>().ToListAsync();
|
||||
var QcCheckItemsH = await db.Queryable<QcCheckItemsH>().Where(p => p.id == CheckItemsInput.id).FirstAsync();
|
||||
List<QcCheckItemsR> QcCheckItemsRs = null;
|
||||
List<QcCheckItemsD> QcCheckItemsDs = null;
|
||||
List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
|
||||
List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>();
|
||||
if (QcCheckItemsH != null)
|
||||
{
|
||||
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.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||
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
|
||||
{
|
||||
if (!string.IsNullOrEmpty(CheckItemsInput.id))
|
||||
await Delete(CheckItemsInput.id);
|
||||
await Delete(CheckItemsInput.id);
|
||||
QcCheckItemsH QcCheckItemsH = new QcCheckItemsH();
|
||||
QcCheckItemsH.name = CheckItemsInput.name;
|
||||
QcCheckItemsH.status = CheckItemsInput.status;
|
||||
@@ -197,32 +197,38 @@ namespace Tnb.QcMgr
|
||||
QcCheckItemsH.create_id = _userManager.UserId;
|
||||
List<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
|
||||
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,
|
||||
excontent = item.excontent,
|
||||
check = item.check,
|
||||
errorcause = item.errorcause.Replace("\"","").Trim(),
|
||||
errorlevel = item.errorlevel.Replace("\"", "").Trim(),
|
||||
remark = item.remark,
|
||||
attachment = item.attachment,
|
||||
isexec = item.isexec,
|
||||
custom=item.customer
|
||||
};
|
||||
QcCheckItemsDs.Add(QcCheckItemsD);
|
||||
var QcCheckItemsR = new QcCheckItemsR()
|
||||
{
|
||||
itemshid = QcCheckItemsH.id,
|
||||
typeid = checktype.id,
|
||||
itemid = item.itemid,
|
||||
itemsdid = QcCheckItemsD.id
|
||||
};
|
||||
foreach (var item in checktype.items)
|
||||
{
|
||||
var QcCheckItemsD = new QcCheckItemsD()
|
||||
{
|
||||
extype = item.extype,
|
||||
excontent = item.excontent,
|
||||
check = item.check,
|
||||
errorcause = item.errorcause?.Replace("\"", "").Trim(),
|
||||
errorlevel = item.errorlevel?.Replace("\"", "").Trim(),
|
||||
remark = item.remark,
|
||||
attachment = item.attachment,
|
||||
isexec = item.isexec,
|
||||
custom = item.customer
|
||||
};
|
||||
QcCheckItemsDs.Add(QcCheckItemsD);
|
||||
var QcCheckItemsR = new QcCheckItemsR()
|
||||
{
|
||||
itemshid = QcCheckItemsH.id,
|
||||
typeid = checktype.id,
|
||||
itemid = item.itemid,
|
||||
itemsdid = QcCheckItemsD.id
|
||||
};
|
||||
|
||||
QcCheckItemsRs.Add(QcCheckItemsR);
|
||||
QcCheckItemsRs.Add(QcCheckItemsR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QcCheckItemsDs.ForEach(p =>
|
||||
@@ -237,7 +243,7 @@ namespace Tnb.QcMgr
|
||||
await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync();
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
await db.Ado.RollbackTranAsync();
|
||||
throw Oops.Oh(ErrorCode.COM1000);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -81,6 +81,7 @@ namespace Tnb.QcMgr
|
||||
CheckTaskOut.mainid = id;
|
||||
CheckTaskOut.wareid = QcCheckExecH.wareid!;
|
||||
CheckTaskOut.workid = QcCheckExecH.workid!;
|
||||
CheckTaskOut.status = QcCheckExecH.status!;
|
||||
if (!string.IsNullOrEmpty(CheckTaskOut.workid))
|
||||
CheckTaskOut.workname = db.Queryable<OrganizeEntity>().Where(p => p.Id == CheckTaskOut.workid).First().FullName;
|
||||
CheckTaskOut.checktypes = new List<CheckExecTypeOut>();
|
||||
@@ -130,13 +131,15 @@ namespace Tnb.QcMgr
|
||||
Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype);
|
||||
Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent);
|
||||
Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check);
|
||||
Item.setShow.errorcause = Item.setData.errorcause.Count == 0 ? false : true;
|
||||
Item.setShow.errorlevel = Item.setData.errorlevel.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.remark = !string.IsNullOrEmpty(Item.setData.remark);
|
||||
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;
|
||||
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;
|
||||
}
|
||||
@@ -159,23 +162,29 @@ namespace Tnb.QcMgr
|
||||
QcCheckExecH.execuser = _userManager.UserId;
|
||||
QcCheckExecH.exectime = DateTime.Now.ToString();
|
||||
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 (QcCheckExecD == null)
|
||||
continue;
|
||||
QcCheckExecD.excontent = item.excontent;
|
||||
QcCheckExecD.check = item.check;
|
||||
QcCheckExecD.errorcause = item.errorcause;
|
||||
QcCheckExecD.errorlevel = item.errorlevel;
|
||||
QcCheckExecD.remark = item.remark;
|
||||
QcCheckExecD.attachment = item.attachment;
|
||||
QcCheckExecD.isexec = item.isexec;
|
||||
QcCheckExecD.custom = item.customer;
|
||||
QcCheckExecD.result = item.result;
|
||||
QcCheckExecD.postdata = item.postItemForm;
|
||||
if (checktype.items != null)
|
||||
{
|
||||
foreach (var item in checktype.items)
|
||||
{
|
||||
var QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault();
|
||||
if (QcCheckExecD == null)
|
||||
continue;
|
||||
QcCheckExecD.excontent = item.excontent;
|
||||
QcCheckExecD.check = item.check;
|
||||
QcCheckExecD.errorcause = item.errorcause;
|
||||
QcCheckExecD.errorlevel = item.errorlevel;
|
||||
QcCheckExecD.remark = item.remark;
|
||||
QcCheckExecD.attachment = item.attachment;
|
||||
QcCheckExecD.isexec = item.isexec;
|
||||
QcCheckExecD.custom = item.customer;
|
||||
QcCheckExecD.result = item.result;
|
||||
QcCheckExecD.postdata = item.postItemForm;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
await db.Ado.BeginTranAsync();
|
||||
@@ -183,7 +192,7 @@ namespace Tnb.QcMgr
|
||||
await db.Updateable(QcCheckExecDs).ExecuteCommandAsync();
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
throw Oops.Oh(ErrorCode.COM1000);
|
||||
|
||||
Reference in New Issue
Block a user