提报质量bug
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
public string batch { get; set; }
|
||||
public int? qty { get; set; }
|
||||
public string bill_code { get; set; }
|
||||
public string equip_name { get; set; }
|
||||
|
||||
}
|
||||
public class CheckTaskOut
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -421,43 +422,67 @@ namespace Tnb.QcMgr
|
||||
JoinType.Left,a.id == e.planid,
|
||||
});
|
||||
GetQuery(Query, entity);
|
||||
// if (!string.IsNullOrEmpty(entity.materialid))
|
||||
// {
|
||||
// Query = Query.Where((a, b, c, d, e) => c.materialid==entity.materialid);
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(entity.processid))
|
||||
// {
|
||||
// Query = Query.Where((a, b, c, d, e) => d.processid==entity.processid);
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(entity.workid))
|
||||
// {
|
||||
// Query = Query.Where((a, b, c, d, e) => e.workid==entity.workid);
|
||||
// }
|
||||
Query = Query.Where((a, b, c, d, e)=>c.materialid==entity.materialid || d.processid==entity.processid || e.workid==entity.workid);
|
||||
List<QcCheckPlanH> list = await Query.ToListAsync();
|
||||
List<string> removes = new();
|
||||
foreach (QcCheckPlanH data in list)
|
||||
|
||||
if (list.IsEmpty())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
throw Oops.Bah("未找到质检方案");
|
||||
}
|
||||
|
||||
if (list.Count > 1)
|
||||
{
|
||||
throw Oops.Bah("找到多个质检方案");
|
||||
}
|
||||
|
||||
// List<string> removes = new();
|
||||
// foreach (QcCheckPlanH 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)
|
||||
|
||||
@@ -11,6 +11,8 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.QcMgr.Entities;
|
||||
|
||||
namespace Tnb.QcMgr
|
||||
@@ -113,11 +115,13 @@ namespace Tnb.QcMgr
|
||||
.LeftJoin<BasProcess>((a, b, c) => a.processid == c.id)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workid == d.Id)
|
||||
.LeftJoin<UserEntity>((a, b, c, d, e) => a.execuser == e.Id)
|
||||
.LeftJoin<PrdMoTask>((a,b,c,d,e,f)=>a.mo_task_code==f.mo_task_code)
|
||||
.LeftJoin<EqpEquipment>((a,b,c,d,e,f,g)=>f.eqp_id==g.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid)
|
||||
.WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype)
|
||||
.WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status)
|
||||
// .Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "已完成").First().Id)
|
||||
.Select((a, b, c, d, e) => new QcCheckExecHOut
|
||||
.Select((a, b, c, d, e,f,g) => new QcCheckExecHOut
|
||||
{
|
||||
id = a.id,
|
||||
bill_code = a.bill_code,
|
||||
@@ -132,6 +136,7 @@ namespace Tnb.QcMgr
|
||||
tasktime = a.tasktime ?? "",
|
||||
exectime = a.exectime ?? "",
|
||||
execuser = e.RealName ?? "",
|
||||
equip_name = g.name,
|
||||
}).OrderByDescending(expression).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
foreach (QcCheckExecHOut? item in result.list)
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace Tnb.QcMgr
|
||||
pqty = pqty,
|
||||
rqty = rqty,
|
||||
check_result = ((EnumCheckConclusion)dic[CheckTaskInput.result]).ToString(),
|
||||
},db);
|
||||
},prdReport,db);
|
||||
}
|
||||
}
|
||||
await db.Ado.CommitTranAsync();
|
||||
|
||||
Reference in New Issue
Block a user