This commit is contained in:
2023-06-28 15:31:02 +08:00
parent e478a4c2ca
commit 68b975c498
4 changed files with 18 additions and 6 deletions

View File

@@ -71,11 +71,11 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// <summary>
/// 预计开始时间
/// </summary>
public DateTime? estimated_start_date { get; set; }
public string? estimated_start_date { get; set; }
/// <summary>
/// 预计结束时间
/// </summary>
public DateTime? estimated_end_date { get; set; }
public string? estimated_end_date { get; set; }
/// <summary>
/// 工序名称

View File

@@ -222,5 +222,10 @@ public partial class PrdMo : BaseEntity<string>
/// 父工单id
/// </summary>
public string parent_id { get; set; }
/// <summary>
/// 物料单位
/// </summary>
public string? unit_id { get; set; }
}

View File

@@ -187,5 +187,10 @@ public partial class PrdMoTask : BaseEntity<string>
/// 最后一道工序完成数量
/// </summary>
public int? last_process_complete_qty { get; set; }
/// <summary>
/// 物料单位
/// </summary>
public string? unit_id { get; set; }
}

View File

@@ -379,8 +379,8 @@ namespace Tnb.ProductionMgr
// scheduled_qty = SqlFunc.Subqueryable<PrdMoTask>().Where(it => it.mo_id == a.mo_id).Sum(it => it.scheduled_qty),
scheduled_qty = a.scheduled_qty,
plan_qty = SqlFunc.Subqueryable<PrdMo>().Where(it => it.id == a.mo_id).Select(it => it.plan_qty),
estimated_start_date = a.estimated_start_date,
estimated_end_date = a.estimated_end_date,
estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm"),
estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm"),
bom_id = d.id,
bom_version = d.version
})
@@ -415,8 +415,8 @@ namespace Tnb.ProductionMgr
scheduled_qty = a.scheduled_qty,
plan_qty = d.plan_qty,
process_task_qty = a.process_task_qty,
estimated_start_date = a.estimated_start_date,
estimated_end_date = a.estimated_end_date,
estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm"),
estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm"),
process_name = e.process_name,
bom_version = SqlFunc.Subqueryable<BasMbom>().Where(it => it.material_id == a.material_id).Select(it => it.version)
})
@@ -658,6 +658,7 @@ namespace Tnb.ProductionMgr
var mo = await db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id);
var moCode = mo?.mo_code;
var taskCode = await db.Queryable<PrdMoTask>().Where(it => !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode)).OrderByDescending(it => it.mo_task_code).Select(it => it.mo_task_code).FirstAsync();
moTask.unit_id = mo.unit_id;
if (taskCode.IsNullOrEmpty())
{
moTask.mo_task_code = $"{moCode}-01";
@@ -770,6 +771,7 @@ namespace Tnb.ProductionMgr
moTask.estimated_end_date = input.estimated_end_date;
moTask.scheduled_qty = input.scheduled_qty;
var mo = await _db.Queryable<PrdMo>().FirstAsync(it => it.id == input.mo_id);
moTask.unit_id = mo.unit_id;
var moCode = mo?.mo_code;
// var taskCode = await _db.Queryable<PrdMoTask>().Where(it => string.IsNullOrEmpty(it.parent_id) && !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode))
// .OrderByDescending(it => it.mo_task_code)