sqlsugar的PostgreSQL数据库 时间格式化分钟mm改为mi

This commit is contained in:
2023-10-27 14:41:33 +08:00
parent 8e59b885c6
commit 85d2a68e98
13 changed files with 79 additions and 49 deletions

View File

@@ -122,5 +122,9 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// 预计结束时间
/// </summary>
public string? plan_end_date { get; set; }
/// <summary>
/// 实际完工日期
/// </summary>
public string? act_end_date { get; set; }
}
}

View File

@@ -167,8 +167,8 @@ namespace Tnb.ProductionMgr
{
eqp_code = it.eqp_code,
eqp_name = it.eqp_name,
closedown_start_time = it.closedown_start_time.HasValue ? it.closedown_start_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : null,
closedown_end_time = it.closedown_end_time.HasValue ? it.closedown_end_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : null,
closedown_start_time = it.closedown_start_time.HasValue ? it.closedown_start_time.Value.ToString(DbTimeFormat.SS) : null,
closedown_end_time = it.closedown_end_time.HasValue ? it.closedown_end_time.Value.ToString(DbTimeFormat.SS) : null,
closedown_time = it.closedown_time,
})
.ToListAsync();

View File

@@ -396,8 +396,8 @@ namespace Tnb.ProductionMgr
id = x.id,
mo_task_code = x.mo_task_code,
mo_task_status = y.FullName,
estimated_start_date = x.estimated_start_date==null ? "" : x.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_end_date = x.estimated_end_date==null ? "" : x.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_start_date = x.estimated_start_date==null ? "" : x.estimated_start_date.Value.ToString(DbTimeFormat.SS),
estimated_end_date = x.estimated_end_date==null ? "" : x.estimated_end_date.Value.ToString(DbTimeFormat.SS),
scheduled_qty = x.scheduled_qty,
reported_work_qty = x.reported_work_qty,
scrap_qty = x.scrap_qty,
@@ -456,8 +456,8 @@ namespace Tnb.ProductionMgr
material_code = b.code,
material_name = b.name,
material_standard = b.material_standard,
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss")
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS)
}).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<PrdMoFromOneListOutput>.SqlSugarPageResult(result);
}
@@ -500,8 +500,8 @@ namespace Tnb.ProductionMgr
material_code = b.code,
material_name = b.name,
material_standard = b.material_standard,
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS),
workshop_name = e.FullName,
station_name = d.FullName,
equip_code = f.code
@@ -525,8 +525,8 @@ namespace Tnb.ProductionMgr
material_code = b.code,
material_name = b.name,
material_standard = b.material_standard,
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS),
workline_name = c.FullName,
mbom_version = d.version
}).ToListAsync();
@@ -751,8 +751,8 @@ namespace Tnb.ProductionMgr
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"),
instock_time = c.instock_time.ToString(DbTimeFormat.SS),
feeding_time = e.create_time == null ? "" : e.create_time.Value.ToString(DbTimeFormat.SS),
}).ToListAsync();
}
@@ -984,7 +984,7 @@ namespace Tnb.ProductionMgr
feeding_detail_id = x.id,
feeding_time = y.create_time == null
? ""
: y.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
: y.create_time.Value.ToString(DbTimeFormat.SS),
num = x.num,
check_conclusion = mp.check_conclusion,
feeding_name = z.RealName,

View File

@@ -128,7 +128,7 @@ namespace Tnb.ProductionMgr
mo_task_status = d.FullName,
plan_qty = f.plan_qty,
scheduled_qty = a.scheduled_qty,
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
create_time = a.create_time==null ? "" :a.create_time.Value.ToString(DbTimeFormat.SS),
}).OrderByDescending(a=>a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<PrdMoTaskIssueListOutput>.SqlSugarPageResult(result);
}

View File

@@ -320,13 +320,13 @@ namespace Tnb.ProductionMgr
eqp_name = e.name,
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().Where(it => it.id == e.equip_type_id).Select(it => it.code),
mo_task_qty = SqlFunc.Subqueryable<PrdMoTask>().Where(a => a.mo_id == moId).Count(),
estimated_start_date = a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_end_date = a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_start_date = a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
estimated_end_date = a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
plan_qty = a.scheduled_qty,
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
process_code = SqlFunc.Subqueryable<BasProcess>().Where(it => it.id == a.process_id).Select(it => it.process_code),
process_name = SqlFunc.Subqueryable<BasProcess>().Where(it => it.id == a.process_id).Select(it => it.process_name),
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
})
.Mapper(it =>
{
@@ -353,11 +353,11 @@ namespace Tnb.ProductionMgr
process_code = e.process_code,
process_name = e.process_name,
mo_task_qty = SqlFunc.Subqueryable<PrdMoTask>().Where(a => a.mo_id == moId).Count(),
estimated_start_date = a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_end_date = a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_start_date = a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
estimated_end_date = a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
plan_qty = a.scheduled_qty,
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
})
.Mapper(it =>
{
@@ -399,8 +399,8 @@ namespace Tnb.ProductionMgr
scheduled_qty = a.scheduled_qty,
plan_qty = SqlFunc.Subqueryable<PrdMo>().Where(it => it.id == a.mo_id).Select(it => it.plan_qty),
complete_qty = a.last_process_complete_qty,
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"),
estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString(DbTimeFormat.MM),
estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.MM),
bom_id = d.id,
bom_version = d.version
})
@@ -436,8 +436,8 @@ namespace Tnb.ProductionMgr
plan_qty = d.plan_qty,
process_task_qty = a.process_task_qty,
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
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"),
estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString(DbTimeFormat.MM),
estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.MM),
process_name = e.process_name,
bom_version = SqlFunc.Subqueryable<BasMbom>().Where(it => it.material_id == a.material_id).Select(it => it.version)
})
@@ -1163,6 +1163,10 @@ namespace Tnb.ProductionMgr
{
prdTaskList.ForEach(x => x.act_start_date = DateTime.Now);
}
if (behavior == PrdTaskBehavior.Compled)
{
prdTaskList.ForEach(x => x.act_end_date = DateTime.Now);
}
row = await db.Updateable(prdTaskList).ExecuteCommandAsync();
foreach (var item in prdTaskList)
{
@@ -2080,7 +2084,7 @@ namespace Tnb.ProductionMgr
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
eqp_id_id = a.eqp_id,
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
create_time = a.create_time==null ? "" :a.create_time.Value.ToString(DbTimeFormat.SS)
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
}

View File

@@ -276,8 +276,8 @@ namespace Tnb.ProductionMgr
scrap_qty = a.scrap_qty,
scheduled_qty = a.scheduled_qty,
reported_work_qty = a.reported_work_qty,
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
parent_id = a.parent_id,
process_id = a.process_id,
process_name = c.process_name,
@@ -332,8 +332,8 @@ namespace Tnb.ProductionMgr
scrap_qty = a.scrap_qty,
scheduled_qty = a.scheduled_qty,
reported_work_qty = a.reported_work_qty,
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
parent_id = a.parent_id,
process_id = a.process_id,
process_name = c.process_name,
@@ -362,6 +362,8 @@ namespace Tnb.ProductionMgr
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
DateTime? start_time = queryJson.ContainsKey("start_time") ? (DateTime?)queryJson["start_time"] : null;
DateTime? end_time = queryJson.ContainsKey("end_time") ? (DateTime?)queryJson["end_time"] : null;
List<string> statusList = new List<string>();
if (!string.IsNullOrEmpty(status))
{
@@ -402,6 +404,8 @@ namespace Tnb.ProductionMgr
.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==mo_task_status)
.WhereIF(statusList.Count>0,a=>statusList.Contains(a.mo_task_status))
.WhereIF(status=="3" && start_time!=null,a=>a.act_end_date>=start_time)
.WhereIF(status=="3" && end_time!=null,a=>a.act_end_date<=end_time)
.Select((a, b, c, d, e,f,g,h,i,j) => new PADPackageTaskPageOutput
{
id = a.id,
@@ -419,8 +423,8 @@ namespace Tnb.ProductionMgr
scrap_qty = a.scrap_qty,
scheduled_qty = a.scheduled_qty,
reported_work_qty = a.reported_work_qty,
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
parent_id = a.parent_id,
process_id = a.process_id,
process_name = c.process_name,
@@ -436,8 +440,9 @@ namespace Tnb.ProductionMgr
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"),
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS),
plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString(DbTimeFormat.SS),
})
.MergeTable()
.OrderBy($"{input.sidx} {input.sort}")

View File

@@ -126,7 +126,7 @@ namespace Tnb.ProductionMgr
reported_qty = x.reported_qty,
create_id = y.RealName,
create_id_id = x.create_id,
create_time = x.create_time==null ? "" : x.create_time.Value.ToString("yyyy-MM-dd HH:mm"),
create_time = x.create_time==null ? "" : x.create_time.Value.ToString(DbTimeFormat.MM),
batch = x.barcode
})
}).ToPagedListAsync(input.currentPage, input.pageSize);