正向追溯相关接口
This commit is contained in:
@@ -59,6 +59,6 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
/// </summary>
|
||||
public string? mbom_process_id { get; set; }
|
||||
|
||||
public List<Dictionary<string,string>>? details { get; set; }
|
||||
public List<Dictionary<string,object>>? details { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,35 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯二级列表输出类
|
||||
/// 工单追溯三级列表输出类
|
||||
/// </summary>
|
||||
public class PrdMoFromThreeListOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务单id
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
|
||||
public string mo_task_code { get; set; }
|
||||
|
||||
public string material_id { get; set; }
|
||||
|
||||
public string material_code { get; set; }
|
||||
|
||||
public string material_name { get; set; }
|
||||
|
||||
public string? workline_id { get; set; }
|
||||
|
||||
public string? batch { get; set; }
|
||||
|
||||
public string process_id { get; set; }
|
||||
public string process_name { get; set; }
|
||||
|
||||
public string station_name { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯人输出类
|
||||
/// </summary>
|
||||
public class PrdMoFromManListOutput
|
||||
{
|
||||
@@ -81,5 +109,31 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
public DateTime? end_time { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯机输出类
|
||||
/// </summary>
|
||||
public class PrdMoFromEquipListOutput
|
||||
{
|
||||
public string equip_code { get; set; }
|
||||
public string mold_code { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯料输出类
|
||||
/// </summary>
|
||||
public class PrdMoFromMaterialListOutput
|
||||
{
|
||||
public string material_code { get; set; }
|
||||
public string material_name { get; set; }
|
||||
public string batch { get; set; }
|
||||
public string supplier_name { get; set; }
|
||||
public string instock_time { get; set; }
|
||||
public string feeding_time { get; set; }
|
||||
public string check_conclusion { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -64,5 +64,21 @@ public partial class PrdMaterialReceiptD : BaseEntity<string>
|
||||
/// 已投料数量
|
||||
/// </summary>
|
||||
public decimal feeding_num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string supplier_id { get; set; }
|
||||
/// <summary>
|
||||
/// 入库时间
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public DateTime instock_time { get; set; }
|
||||
/// <summary>
|
||||
/// 检验结论
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string check_conclusion { get; set; }
|
||||
|
||||
}
|
||||
@@ -101,10 +101,10 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
feeding_id = prdFeedingH.id,
|
||||
material_receipt_detail_id = detail?.id,
|
||||
material_id = item["material_id"],
|
||||
material_id = item["material_id"]?.ToString(),
|
||||
num = num,
|
||||
batch = item["batch"],
|
||||
unit_id = item["unit_id"],
|
||||
batch = item["batch"]?.ToString(),
|
||||
unit_id = item["unit_id"]?.ToString(),
|
||||
carry_id = input.carry_id,
|
||||
status = "0",
|
||||
use_num = 0,
|
||||
|
||||
@@ -176,15 +176,18 @@ namespace Tnb.ProductionMgr
|
||||
list.Add(new PrdMaterialReceiptD
|
||||
{
|
||||
material_receipt_id = prdMaterialReceiptH.id,
|
||||
material_id = item["material_id"],
|
||||
material_id = item["material_id"]?.ToString(),
|
||||
num = Convert.ToDecimal(item["num"]),
|
||||
batch = item["batch"],
|
||||
unit_id = item["unit_id"],
|
||||
batch = item["batch"]?.ToString(),
|
||||
unit_id = item["unit_id"]?.ToString(),
|
||||
carry_id = input.carry_id,
|
||||
is_all_feeding = 0,
|
||||
member_carry_id = item["member_carry_id"],
|
||||
member_carry_code = item["member_carry_code"],
|
||||
member_carry_id = item["member_carry_id"]?.ToString(),
|
||||
member_carry_code = item["member_carry_code"]?.ToString(),
|
||||
feeding_num = 0,
|
||||
supplier_id = item["supplier_id"]?.ToString(),
|
||||
instock_time = (DateTime)item["instock_time"],
|
||||
check_conclusion = item["check_conclusion"]?.ToString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<OrganizeEntity>((a, b, c) => a.workline_id == c.Id)
|
||||
.LeftJoin<BasMbom>((a, b, c, d) => a.bom_id == d.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_id),(a,b,c,d)=>a.mo_id==mo_id)
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_code),(a,b,c,d)=>a.mo_task_code==mo_task_code)
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_code),(a,b,c,d)=>a.mo_task_code.Contains(mo_task_code))
|
||||
.WhereIF(ids!=null && ids.Count>0,(a,b,c,d)=>ids.Contains(a.id))
|
||||
.Select((a, b, c, d) =>
|
||||
new PrdMoFromTwoListOutput
|
||||
@@ -481,6 +481,56 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯三级级列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PrdMoFromThreeList(Dictionary<string,string> dic)
|
||||
{
|
||||
string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : "";
|
||||
string mo_task_code = dic.ContainsKey("mo_task_code") ? dic["mo_task_code"] : "";
|
||||
string batch = dic.ContainsKey("batch") ? dic["batch"] : "";
|
||||
List<string> ids = new List<string>();
|
||||
if (!string.IsNullOrEmpty(batch))
|
||||
{
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.batch.Contains(batch)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
}
|
||||
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == mo_task_id);
|
||||
List<BasProcessStation> processStations = await _db.Queryable<BasProcessStation>().Where(x=>x.process_id==prdMoTask.process_id).ToListAsync();
|
||||
List<string> orgIds = processStations.Select(x => x.id).ToList();
|
||||
List<OrganizeEntity> orgs = await _db.Queryable<OrganizeEntity>().Where(x=>x.Category==DictConst.RegionCategoryStationCode && x.DeleteMark==null).ToListAsync();
|
||||
return await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<BasProcess>((a,b,c)=>a.process_id==c.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_id),(a,b,c)=>a.id==mo_task_id)
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_code),(a,b,c)=>a.mo_task_code.Contains(mo_task_code))
|
||||
.WhereIF(ids!=null && ids.Count>0,(a,b,c)=>ids.Contains(a.id))
|
||||
.Select((a, b, c) =>
|
||||
new PrdMoFromThreeListOutput
|
||||
{
|
||||
id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
material_id = a.material_id,
|
||||
material_code = b.code,
|
||||
workline_id = a.workline_id,
|
||||
material_name = b.name,
|
||||
process_id = a.process_id,
|
||||
process_name = c.process_name,
|
||||
}).Mapper(x =>
|
||||
{
|
||||
List<string> orgId1 = orgs.Where(y => y.OrganizeIdTree.Contains(x.workline_id)).Select(y=>y.Id).ToList();
|
||||
string station_id = orgIds.Intersect(orgId1)?.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(station_id))
|
||||
{
|
||||
x.station_name = orgs.FirstOrDefault(y => y.Id == station_id)?.FullName;
|
||||
}
|
||||
}).ToListAsync();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯人列表
|
||||
/// </summary>
|
||||
@@ -514,6 +564,69 @@ namespace Tnb.ProductionMgr
|
||||
})
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯机列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PrdMoFromEquipList(Dictionary<string,string> dic)
|
||||
{
|
||||
string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : "";
|
||||
string batch = dic.ContainsKey("batch") ? dic["batch"] : "";
|
||||
List<string> ids = new List<string>();
|
||||
if (!string.IsNullOrEmpty(batch))
|
||||
{
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.batch.Contains(batch)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
}
|
||||
|
||||
return await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<EqpEquipment>((a, b) => a.eqp_id == b.id)
|
||||
.LeftJoin<ToolMolds>((a,b,c)=>a.mold_id==c.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_id), (a, b) => a.id == mo_task_id)
|
||||
.WhereIF(ids!=null && ids.Count>0,(a,b)=>ids.Contains(a.id))
|
||||
.Select((a, b,c) => new PrdMoFromEquipListOutput()
|
||||
{
|
||||
equip_code = b.code,
|
||||
mold_code = b.code,
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 工单追溯料列表
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> PrdMoFromMaterialList(Dictionary<string,string> dic)
|
||||
{
|
||||
string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : "";
|
||||
string batch = dic.ContainsKey("batch") ? dic["batch"] : "";
|
||||
List<string> ids = new List<string>();
|
||||
if (!string.IsNullOrEmpty(batch))
|
||||
{
|
||||
ids = await _db.Queryable<PrdReport>().Where(x => x.batch.Contains(batch)).Select(x=>x.mo_task_id).ToListAsync();
|
||||
}
|
||||
|
||||
return await _db.Queryable<PrdFeedingD>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<PrdMaterialReceiptD>((a,b,c)=>a.material_receipt_detail_id==c.id)
|
||||
.LeftJoin<BasSupplier>((a,b,c,d)=>c.supplier_id==d.id)
|
||||
.LeftJoin<PrdFeedingH>((a,b,c,d,e)=>a.feeding_id==e.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_id), (a, b,c,d,e) => e.mo_task_id == mo_task_id)
|
||||
.WhereIF(ids!=null && ids.Count>0,(a,b,c,d,e)=>ids.Contains(a.id))
|
||||
.Select((a,b,c,d,e)=>new PrdMoFromMaterialListOutput()
|
||||
{
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
batch = a.batch,
|
||||
supplier_name = d.supplier_name,
|
||||
check_conclusion = c.check_conclusion,
|
||||
instock_time = c.instock_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
feeding_time = e.create_time==null ? "" : e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user