1
This commit is contained in:
@@ -94,7 +94,7 @@ namespace Tnb.QcMgr
|
||||
CheckPlansOut.addid = QcCheckPlanAdd.id;
|
||||
CheckPlansOut.triggertype = QcCheckPlanAdd.triggertype!;
|
||||
CheckPlansOut.content = QcCheckPlanAdd.content!;
|
||||
CheckPlansOut.number= QcCheckPlanAdd.number;
|
||||
CheckPlansOut.number = QcCheckPlanAdd.number;
|
||||
}
|
||||
if (QcCheckPlanDs != null && QcCheckPlanDs.Count > 0)
|
||||
{
|
||||
@@ -137,7 +137,18 @@ namespace Tnb.QcMgr
|
||||
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;
|
||||
if (Item.setData.isexec == null)
|
||||
{
|
||||
Item.setShow.isexec = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!Item.setData.isexec.attachment&& !Item.setData.isexec.remark)
|
||||
Item.setShow.isexec = false;
|
||||
else
|
||||
Item.setShow.isexec = true;
|
||||
}
|
||||
|
||||
CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).First()?.items?.Add(Item);
|
||||
}
|
||||
}
|
||||
@@ -187,6 +198,7 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
if (string.IsNullOrEmpty(CheckPlanInput.mainid))
|
||||
return;
|
||||
await _timeTaskService.DeleteByName("生成质检任务" + CheckPlanInput.mainid);
|
||||
await db.Deleteable<QcCheckPlanD>(p => p.mainid == CheckPlanInput.mainid).ExecuteCommandAsync();
|
||||
await db.Deleteable<QcCheckPlanAdd>(p => p.mainid == CheckPlanInput.mainid).ExecuteCommandAsync();
|
||||
QcCheckPlanAdd QcCheckPlanAdd = new QcCheckPlanAdd();
|
||||
@@ -280,10 +292,47 @@ namespace Tnb.QcMgr
|
||||
JoinType.Left,a.id == e.planid,
|
||||
});
|
||||
GetQuery(Query, entity);
|
||||
var list = await Query
|
||||
.WhereIF(!string.IsNullOrEmpty(entity.materialid), (a, b, c, d, e) => c.materialid == entity.materialid)
|
||||
.WhereIF(!string.IsNullOrEmpty(entity.processid), (a, b, c, d, e) => d.processid == entity.processid)
|
||||
.WhereIF(!string.IsNullOrEmpty(entity.workid), (a, b, c, d, e) => e.workid == entity.workid).ToListAsync();
|
||||
var list = await Query.ToListAsync();
|
||||
List<string> removes = new List<string>();
|
||||
foreach (var data in list)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entity.materialid))
|
||||
{
|
||||
if (_repository.AsSugarClient().Queryable<QcCheckPlanMaterial>().Where(p => p.planid == data.id).Any())
|
||||
{
|
||||
if (!_repository.AsSugarClient().Queryable<QcCheckPlanMaterial>().Where(p => p.planid == data.id && p.materialid == entity.materialid).Any())
|
||||
{
|
||||
removes.Add(data.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(entity.processid))
|
||||
{
|
||||
if (_repository.AsSugarClient().Queryable<QcCheckPlanProcess>().Where(p => p.planid == data.id).Any())
|
||||
{
|
||||
if (!_repository.AsSugarClient().Queryable<QcCheckPlanProcess>().Where(p => p.planid == data.id && p.processid == entity.processid).Any())
|
||||
{
|
||||
removes.Add(data.id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(entity.workid))
|
||||
{
|
||||
if (_repository.AsSugarClient().Queryable<QcCheckPlanWork>().Where(p => p.planid == data.id).Any())
|
||||
{
|
||||
if (!_repository.AsSugarClient().Queryable<QcCheckPlanWork>().Where(p => p.planid == data.id && p.workid == entity.workid).Any())
|
||||
{
|
||||
removes.Add(data.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list = list.Where(p => !removes.Contains(p.id)).ToList();
|
||||
// .WhereIF(!string.IsNullOrEmpty(entity.materialid), (a, b, c, d, e) => c.materialid == entity.materialid)
|
||||
// .WhereIF(!string.IsNullOrEmpty(entity.processid), (a, b, c, d, e) => d.processid == entity.processid)
|
||||
// .WhereIF(!string.IsNullOrEmpty(entity.workid), (a, b, c, d, e) => e.workid == entity.workid).ToListAsync();
|
||||
Filter(list, entity);
|
||||
if (list.Count > 0)
|
||||
await SaveTask(list, entity);
|
||||
@@ -410,5 +459,6 @@ namespace Tnb.QcMgr
|
||||
await _repository.AsSugarClient().Insertable(ExecDs).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user