1.质检不合格,选择时间区间;2.生产入库记录增加工单类型及物料的查询条件;3.产成品入库同步BIP成功后,相关信息记录到生产入库记录

This commit is contained in:
2024-10-22 13:54:43 +08:00
parent 7c9a64e5eb
commit 48299687c2
7 changed files with 153 additions and 25 deletions

View File

@@ -51,6 +51,9 @@ namespace Tnb.ProductionMgr
Dictionary<string, object>? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
string mo_code = queryJson.ContainsKey("mo_id") ? queryJson["mo_id"].ToString() : "";
string mo_type = queryJson.ContainsKey("mo_type") ? queryJson["mo_type"].ToString() : "";//工单类型
string name = queryJson.ContainsKey("name") ? queryJson["name"].ToString() : "";//物料名称
// string workstation_id_str = queryJson.ContainsKey("workstation_id") ? queryJson["workstation_id"].ToString() : "";
// string workstation_id = "";
// if (!string.IsNullOrEmpty(workstation_id_str))
@@ -61,7 +64,7 @@ namespace Tnb.ProductionMgr
// workstation_id = workstation_arr[workstation_arr.Length - 1];
// }
// }
if (string.IsNullOrEmpty(input.sidx))
{
input.sidx = "a.create_time";
@@ -71,19 +74,21 @@ namespace Tnb.ProductionMgr
{
input.sidx = "a." + input.sidx;
}
var result = await db.Queryable<PrdMoTask>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.LeftJoin<OrganizeEntity>((a,b,c)=>a.workstation_id==c.Id)
.LeftJoin<PrdMo>((a,b,c,d)=>a.mo_id==d.id)
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>e.DictionaryTypeId==DictConst.PrdTaskStatusTypeId && a.mo_task_status==e.EnCode)
.LeftJoin<OrganizeEntity>((a,b,c,d,e,f)=>a.workline_id==f.Id)
.WhereIF(!string.IsNullOrEmpty(mo_task_code),a=>a.mo_task_code.Contains(mo_task_code))
.WhereIF(!string.IsNullOrEmpty(mo_code),(a,b,c,d,e)=>d.mo_code.Contains(mo_code))
.Where(a=>a.act_start_date!=null)
.LeftJoin<OrganizeEntity>((a, b, c) => a.workstation_id == c.Id)
.LeftJoin<PrdMo>((a, b, c, d) => a.mo_id == d.id)
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode)
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f) => a.workline_id == f.Id)
.WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code))
.WhereIF(!string.IsNullOrEmpty(mo_code), (a, b, c, d, e) => d.mo_code.Contains(mo_code))
.WhereIF(!string.IsNullOrEmpty(mo_type),(a,b,c,d,e)=>d.mo_type==mo_type)
.WhereIF(!string.IsNullOrEmpty(name),(a,b,c,d,e)=>b.name.Contains(name))
.Where(a => a.act_start_date != null)
.OrderBy($"{input.sidx} {input.sort}")
.Select((a, b, c, d,e,f) => new PrdInstockRecordUpListOutPut()
.Select((a, b, c, d, e, f) => new PrdInstockRecordUpListOutPut()
{
id = a.id,
mo_task_code = a.mo_task_code,
@@ -92,21 +97,21 @@ namespace Tnb.ProductionMgr
workstation_id = c.FullName,
mo_task_status = e.FullName,
workline_id = f.FullName,
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
create_time = a.create_time.HasValue ? a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
tablefield102 = SqlFunc.Subqueryable<PrdInstockH>()
.LeftJoin<UserEntity>((x,y)=>x.create_id==y.Id)
.LeftJoin<DictionaryDataEntity>((x,y,z)=>x.bill_type==z.Id)
.Where(x=>x.mo_task_id==a.id).ToList((x,y,z)=>new PrdInstockRecordUpListChildOutPut()
{
id = x.id,
code = x.code,
bill_type = z.FullName,
carry_code = x.carry_code,
location_code = x.location_code,
create_id = y.RealName,
bill_date = x.bill_date==null ? "" : x.bill_date.ToString(DbTimeFormat.SS),
}),
.LeftJoin<UserEntity>((x, y) => x.create_id == y.Id)
.LeftJoin<DictionaryDataEntity>((x, y, z) => x.bill_type == z.Id)
.Where(x => x.mo_task_id == a.id).ToList((x, y, z) => new PrdInstockRecordUpListChildOutPut()
{
id = x.id,
code = x.code,
bill_type = z.FullName,
carry_code = x.carry_code,
location_code = x.location_code,
create_id = y.RealName,
bill_date = x.bill_date == null ? "" : x.bill_date.ToString(DbTimeFormat.SS),
}),
}).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<PrdInstockRecordUpListOutPut>.SqlSugarPageResult(result);
}