根据工位id获取当前进行中的任务单 生产投料新接口

This commit is contained in:
2023-11-06 15:30:31 +08:00
parent 8c8284a72d
commit a055ac33ef
3 changed files with 154 additions and 2 deletions

View File

@@ -1447,6 +1447,7 @@ namespace Tnb.ProductionMgr
var row = -1;
var report = await db.Queryable<PrdReport>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
var prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.mo_task_id);
var equip = await db.Queryable<EqpEquipment>().SingleAsync(x=>x.id==prdMoTask.eqp_id);
var prdMo = await db.Queryable<PrdMo>().SingleAsync(x => x.id == prdMoTask.mo_id);
var mbomProcess = await db.Queryable<BasMbomProcess>().SingleAsync(x => x.id == prdMoTask.mbom_process_id);
@@ -1724,6 +1725,11 @@ namespace Tnb.ProductionMgr
// }
// }
if (equip.tube == "1")
{
}
});
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
@@ -2627,6 +2633,7 @@ namespace Tnb.ProductionMgr
rate_num = SqlFunc.Subqueryable<BasMbom>().Where(o => o.id == a.bom_id)
.OrderByDesc(o => o.create_time).Select(o => o.num),
parent_id = b.parent_id,
workstation_id = b.workstation_id,
material_id = b.material_id,
material_code = c.code,
children = SqlFunc.Subqueryable<BasMbomInput>()
@@ -2643,7 +2650,7 @@ namespace Tnb.ProductionMgr
var prdMoTaskList = await _db.Queryable<PrdMoTask>()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.Where(a => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id) && a.estimated_start_date.Value.ToString("yyyy-MM-dd") == now)
.Where(a => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id) && a.estimated_start_date.Value.ToString("yyyy-MM-dd") == now && (a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ToBeScheduledEncode || a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode))
.Select((a,b)=>new MaterialPreparationPlanOutput()
{
mo_task_id = a.id,
@@ -2672,6 +2679,18 @@ namespace Tnb.ProductionMgr
return prdMoTaskList;
}
/// <summary>
/// 根据工位获取进行中的任务单信息
/// </summary>
/// <param name="dic"></param>
/// <returns></returns>
public async Task<PrdMoTask> GetPrdMoTaskInfoByStationId(Dictionary<string, string> dic)
{
string station_id = dic.ContainsKey("station_id") ? dic["station_id"] : "";
if (string.IsNullOrEmpty(station_id)) throw Oops.Bah("工位错误");
return await _db.Queryable<PrdMoTask>().Where(x => x.workstation_id == station_id && x.parent_id!=null && x.mo_task_status==DictConst.InProgressEnCode).FirstAsync();
}
}