看板移动端任务单列表接口增加字段 任务单开始保存实际开始时间 提报后记录预计结束时间
This commit is contained in:
@@ -92,5 +92,30 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
public string mold_code { get; set; }
|
||||
public string mold_name { get; set; }
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成型周期
|
||||
/// </summary>
|
||||
public decimal? moulding_cycle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模穴数
|
||||
/// </summary>
|
||||
public int? mold_cavity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准工时
|
||||
/// </summary>
|
||||
public string? standard_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实际开工日期
|
||||
/// </summary>
|
||||
public string? act_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预计结束时间
|
||||
/// </summary>
|
||||
public string? plan_end_date { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -100,12 +100,12 @@ public partial class PrdMoTask : BaseEntity<string>
|
||||
public int? schedule_type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划开始时间
|
||||
/// 预计开始时间
|
||||
/// </summary>
|
||||
public DateTime? plan_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划结束时间
|
||||
/// 预计结束时间
|
||||
/// </summary>
|
||||
public DateTime? plan_end_date { get; set; }
|
||||
|
||||
@@ -150,12 +150,12 @@ public partial class PrdMoTask : BaseEntity<string>
|
||||
public int? prd_order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预计开始时间
|
||||
/// 计划开始时间
|
||||
/// </summary>
|
||||
public DateTime? estimated_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预计结束时间
|
||||
/// 计划结束时间
|
||||
/// </summary>
|
||||
public DateTime? estimated_end_date { get; set; }
|
||||
|
||||
|
||||
@@ -1085,6 +1085,8 @@ namespace Tnb.ProductionMgr
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
var taskReportLogs = new List<PrdMoTask>();
|
||||
var prdTaskList = await db.Queryable<PrdMoTask>().Where(it => input.TaskIds.Contains(it.id)).ToListAsync();
|
||||
if (prdTaskList?.Count > 0)
|
||||
@@ -1105,6 +1107,10 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
#endregion
|
||||
prdTaskList.ForEach(x => x.mo_task_status = status);
|
||||
if (behavior == PrdTaskBehavior.Start)
|
||||
{
|
||||
prdTaskList.ForEach(x => x.act_start_date = DateTime.Now);
|
||||
}
|
||||
row = await db.Updateable(prdTaskList).ExecuteCommandAsync();
|
||||
foreach (var item in prdTaskList)
|
||||
{
|
||||
@@ -1494,6 +1500,25 @@ namespace Tnb.ProductionMgr
|
||||
.SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty)
|
||||
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
PerProcessStandardsH processStandardsH = await db.Queryable<PerProcessStandardsH>()
|
||||
.Where(x => x.equip_id == prdMoTask.eqp_id && x.molds_id == prdMoTask.mold_id &&
|
||||
x.output_material_id == prdMoTask.material_id && x.enabled == 1)
|
||||
.OrderByDescending(x => x.create_time).FirstAsync();
|
||||
|
||||
ToolMolds toolMolds = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == prdMoTask.mold_id);
|
||||
if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null &&
|
||||
processStandardsH?.moulding_cycle > 0)
|
||||
{
|
||||
decimal? addTime = ((prdMoTask.scheduled_qty-input.reported_qty) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1;
|
||||
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
|
||||
{
|
||||
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
|
||||
await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.plan_end_date == cal_plan_end_date)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id))
|
||||
@@ -1541,6 +1566,20 @@ namespace Tnb.ProductionMgr
|
||||
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
var list = await db.Queryable<BasMbomProcess>()
|
||||
.LeftJoin<BasStandardTime>((a,b)=>a.process_id==b.process_id && b.enabled==1)
|
||||
.Where((a,b)=>a.process_id==prdMoTask.process_id).Select((a,b)=>b).ToListAsync();
|
||||
|
||||
decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x);
|
||||
decimal? addTime = (prdMoTask.scheduled_qty-input.reported_qty) * max;
|
||||
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
|
||||
{
|
||||
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
|
||||
await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.plan_end_date == cal_plan_end_date)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
var master = await db.Queryable<PrdReportRecord>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||
@@ -2018,7 +2057,7 @@ namespace Tnb.ProductionMgr
|
||||
else
|
||||
{
|
||||
var list = await db.Queryable<BasMbomProcess>()
|
||||
.LeftJoin<BasStandardTime>((a,b)=>a.process_id==b.process_id)
|
||||
.LeftJoin<BasStandardTime>((a,b)=>a.process_id==b.process_id && b.enabled==1)
|
||||
.Where((a,b)=>a.mbom_id==input.mbom_id).Select((a,b)=>b).ToListAsync();
|
||||
|
||||
decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x);
|
||||
@@ -2027,6 +2066,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取这个产线生产中的任务单
|
||||
|
||||
@@ -12,6 +12,7 @@ using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.PerMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
@@ -374,10 +375,12 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode)
|
||||
.LeftJoin<EqpEquipment>((a,b,c,d,e,f)=>a.eqp_id==f.id)
|
||||
.LeftJoin<ToolMolds>((a,b,c,d,e,f,g)=>a.mold_id==g.id)
|
||||
.LeftJoin<PerProcessStandardsH>((a,b,c,d,e,f,g,h)=>a.material_id==h.output_material_id && a.eqp_id==h.equip_id && a.mold_id==h.molds_id && h.enabled==1)
|
||||
.LeftJoin<BasStandardTime>((a,b,c,d,e,f,g,h,i)=>a.process_id==i.process_id && i.enabled==1)
|
||||
.Where((a, b) => a.workstation_id == input.stationId && (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode || a.mo_task_status == DictConst.InProgressEnCode) )
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_code),a=>a.mo_task_code.Contains(mo_task_code))
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status.Contains(mo_task_status))
|
||||
.Select((a, b, c, d, e,f,g) => new PADPackageTaskPageOutput
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status==mo_task_status)
|
||||
.Select((a, b, c, d, e,f,g,h,i) => new PADPackageTaskPageOutput
|
||||
{
|
||||
id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
@@ -407,10 +410,15 @@ namespace Tnb.ProductionMgr
|
||||
mold_code = g.mold_code,
|
||||
mold_name = g.mold_name,
|
||||
schedule_type = a.schedule_type,
|
||||
mold_cavity = g.mold_cavity,
|
||||
moulding_cycle = h.moulding_cycle,
|
||||
standard_time = i.standard_time,
|
||||
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.ToPagedListAsync(input.currentPage, int.MaxValue);
|
||||
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<PADPackageTaskPageOutput>.SqlSugarPageResult(result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user