工单完成情况汇总
This commit is contained in:
@@ -670,6 +670,9 @@ namespace Tnb.ProductionMgr
|
||||
if (input.schedule_type.Value == 1) //注塑、基础排产
|
||||
{
|
||||
var mo = await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id);
|
||||
BasMbomProcess basMbomProcess = null;
|
||||
if(!string.IsNullOrEmpty(input.bom_id))
|
||||
basMbomProcess = await db.Queryable<BasMbomProcess>().FirstAsync(x => x.mbom_id == input.bom_id);
|
||||
var moTask = input.Adapt<PrdMoTask>();
|
||||
moTask.id = SnowflakeIdHelper.NextId();
|
||||
moTask.create_id = _userManager.UserId;
|
||||
@@ -677,6 +680,7 @@ namespace Tnb.ProductionMgr
|
||||
moTask.mo_task_status = DictConst.ToBeScheduledEncode;
|
||||
moTask.scheduled_qty = input.scheduled_qty;
|
||||
moTask.unit_id = mo.unit_id;
|
||||
moTask.mbom_process_id = basMbomProcess?.id ?? "";
|
||||
|
||||
if (!string.IsNullOrEmpty(input.eqp_id))
|
||||
{
|
||||
@@ -2335,6 +2339,26 @@ namespace Tnb.ProductionMgr
|
||||
return result.IsSuccess ? "排产成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取工单各个状态数量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetMoTaskStatusNum()
|
||||
{
|
||||
return await _db.Queryable<DictionaryTypeEntity>().
|
||||
LeftJoin<DictionaryDataEntity>((a,b)=>a.Id==b.DictionaryTypeId)
|
||||
.LeftJoin<PrdMo>((a,b,c)=>b.Id==c.mo_status)
|
||||
.Where((a,b,c)=>a.EnCode==DictConst.MoTaskStatusCode)
|
||||
.GroupBy((a,b,c)=>new { mo_status_code = b.EnCode,mo_status_name = b.FullName})
|
||||
.Select((a,b,c) => new
|
||||
{
|
||||
mo_status_code = b.EnCode,
|
||||
mo_status_name = b.FullName,
|
||||
count = SqlFunc.AggregateCount(c.mo_status)
|
||||
}).ToListAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user