人员产量统计表 注塑质量不合格倒扣

This commit is contained in:
2024-09-30 09:51:52 +08:00
parent 7bbddae5cb
commit 884c23b753
6 changed files with 50 additions and 29 deletions

View File

@@ -9,6 +9,7 @@ namespace Tnb.ProductionMgr.Entities.Dto
public string eqp_id { get; set; }
public string mo_task_status { get; set; }
public decimal? plan_qty { get; set; }
public decimal? rqty { get; set; }
public decimal? scheduled_qty { get; set; }
public string create_time { get; set; }
public string workstation_id { get; set; }

View File

@@ -57,12 +57,12 @@ public partial class PrdMo : BaseEntity<string>
/// <summary>
/// 已报工数量
/// </summary>
public decimal? reported_work_qty { get; set; }
public decimal? reported_work_qty { get; set; } = 0;
/// <summary>
/// 报废数量
/// </summary>
public decimal? scrap_qty { get; set; }
public decimal? scrap_qty { get; set; } = 0;
/// <summary>
/// 计划开始时间

View File

@@ -82,12 +82,12 @@ public partial class PrdMoTask : BaseEntity<string>
/// <summary>
/// 已报工数量
/// </summary>
public decimal? reported_work_qty { get; set; }
public decimal? reported_work_qty { get; set; } = 0;
/// <summary>
/// 报废数量
/// </summary>
public decimal? scrap_qty { get; set; }
public decimal? scrap_qty { get; set; } = 0;
/// <summary>
/// 已排产数量

View File

@@ -130,6 +130,7 @@ namespace Tnb.ProductionMgr
dayshiftafter_worker_id = a.dayshiftafter_worker_id,
nightshift_worker_id = a.nightshift_worker_id,
nightshiftafter_worker_id = a.nightshiftafter_worker_id,
rqty = a.scrap_qty
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
List<string> userIdList = result.list.Select(x => x.dayshift_worker_id).Distinct().ToList();

View File

@@ -2462,9 +2462,26 @@ namespace Tnb.ProductionMgr
await db.Updateable<PrdReport>()
.SetColumns(x => x.check_result == input.check_result)
.SetColumns(x => x.pqty == input.pqty)
.SetColumns(x => x.rqty == input.rqty)
.Where(x => x.id == input.report_id)
.ExecuteCommandAsync();
if (prdMo.mo_type == DictConst.PrdMoTypeZS && input.rqty>0)
{
await _db.Updateable<PrdMoTask>()
.SetColumns(x => x.reported_work_qty == x.reported_work_qty - input.rqty)
.SetColumns(x => x.scrap_qty == x.scrap_qty + input.rqty)
.Where(x => x.id == prdMoTask.id)
.ExecuteCommandAsync();
await _db.Updateable<PrdMo>()
.SetColumns(x => x.reported_work_qty == x.reported_work_qty - input.rqty)
.SetColumns(x => x.scrap_qty == x.scrap_qty + input.rqty)
.Where(x => x.id == prdMoTask.mo_id)
.ExecuteCommandAsync();
}
BindCarryCodeInput bindCarryCodeInput = new BindCarryCodeInput();
bindCarryCodeInput.carry_id = wmsCarryH.id;
@@ -2486,12 +2503,6 @@ namespace Tnb.ProductionMgr
throw Oops.Bah(result1.msg);
}
await _db.Updateable<PrdReport>()
.SetColumns(x => x.pqty == input.pqty)
.SetColumns(x => x.rqty == input.rqty)
.Where(x => x.id == report.id)
.ExecuteCommandAsync();
WmsPrdInstockInput wmsPrdInstockInput = new WmsPrdInstockInput();
wmsPrdInstockInput.prd_bill_code = prdMo.mo_code;
wmsPrdInstockInput.material_id = prdMoTask.material_id;

View File

@@ -89,27 +89,35 @@ namespace Tnb.ProductionMgr
}
SqlSugarPagedList<PrdReportUserListOutput> result = await db.Queryable<PrdReport>()
.LeftJoin<PrdMoTask>((a,b)=>a.mo_task_id==b.id)
.LeftJoin<BasMaterial>((a, b,c) => a.material_id == c.id)
.LeftJoin<UserEntity>((a, b,c,d) => a.create_id == d.Id)
.LeftJoin<EqpEquipment>((a, b,c,d,e) => a.equip_id == e.id)
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => b.mo_task_code.Contains(moTaskCode))
.WhereIF(!string.IsNullOrEmpty(equipInfo), (a, b, c, d,e) => e.code.Contains(equipInfo) || e.name.Contains(equipInfo))
.WhereIF(!string.IsNullOrEmpty(materialInfo), (a, b, c, d,e) => c.code.Contains(materialInfo) || c.name.Contains(materialInfo))
.WhereIF(!string.IsNullOrEmpty(createInfo), (a, b, c, d,e) => d.Account.Contains(createInfo) || d.RealName.Contains(createInfo))
.WhereIF(createTime!=null && createTime.Length==2,a=>a.create_time>=sDate && a.create_time<=eDate)
.OrderByDescending(a => a.create_time)
.Select((a, b, c, d, e) => new PrdReportUserListOutput
.Select(a=>new
{
id = a.id,
mo_task_id = b.mo_task_code,
equip_id = e.name,
material_id = c.code+"/"+c.name,
a.create_id,
a.material_id,
a.batch,
create_time = a.create_time.Date,
a.reported_qty,
a.pqty,
a.rqty
})
.MergeTable()
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
.LeftJoin<UserEntity>((a, b,c) => a.create_id == c.Id)
.WhereIF(!string.IsNullOrEmpty(materialInfo), (a, b, c) => b.code.Contains(materialInfo) || b.name.Contains(materialInfo))
.WhereIF(!string.IsNullOrEmpty(createInfo), (a, b, c) => c.Account.Contains(createInfo) || c.RealName.Contains(createInfo))
.WhereIF(createTime!=null && createTime.Length==2,a=>a.create_time>=sDate && a.create_time<=eDate)
.GroupBy((a,b,c)=>new {a.create_id,a.material_id,b.code,b.name,a.batch,a.create_time,c.RealName})
.OrderByDescending(a => a.create_time)
.Select((a, b, c) => new PrdReportUserListOutput
{
// id = a.id,
// mo_task_id = b.mo_task_code,
// equip_id = e.name,
material_id = b.code+"/"+b.name,
batch = a.batch,
reported_qty = a.reported_qty,
rqty = a.rqty,
create_id = d.RealName,
create_time = a.create_time.ToString(DbTimeFormat.SS)
reported_qty = SqlFunc.AggregateSumNoNull(a.reported_qty),
rqty = SqlFunc.AggregateSumNoNull(a.rqty),
create_id = c.RealName,
create_time = a.create_time.ToString("yyyy-MM-dd")
}).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<PrdReportUserListOutput>.SqlSugarPageResult(result);
}