diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs index 6955a4d0..57dd7d94 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs @@ -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; } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs index 1520f9cb..24737c64 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs @@ -57,12 +57,12 @@ public partial class PrdMo : BaseEntity /// /// 已报工数量 /// - public decimal? reported_work_qty { get; set; } + public decimal? reported_work_qty { get; set; } = 0; /// /// 报废数量 /// - public decimal? scrap_qty { get; set; } + public decimal? scrap_qty { get; set; } = 0; /// /// 计划开始时间 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs index 873b11d3..8e7b533a 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs @@ -82,12 +82,12 @@ public partial class PrdMoTask : BaseEntity /// /// 已报工数量 /// - public decimal? reported_work_qty { get; set; } + public decimal? reported_work_qty { get; set; } = 0; /// /// 报废数量 /// - public decimal? scrap_qty { get; set; } + public decimal? scrap_qty { get; set; } = 0; /// /// 已排产数量 diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs index 5a6e4dda..5489899e 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs @@ -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 userIdList = result.list.Select(x => x.dayshift_worker_id).Distinct().ToList(); diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 21235658..1a60c653 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2462,9 +2462,26 @@ namespace Tnb.ProductionMgr await db.Updateable() .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() + .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() + .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() - .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; diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdReportUserListService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdReportUserListService.cs index a18cfed3..d1572867 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdReportUserListService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdReportUserListService.cs @@ -89,27 +89,35 @@ namespace Tnb.ProductionMgr } SqlSugarPagedList result = await db.Queryable() - .LeftJoin((a,b)=>a.mo_task_id==b.id) - .LeftJoin((a, b,c) => a.material_id == c.id) - .LeftJoin((a, b,c,d) => a.create_id == d.Id) - .LeftJoin((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((a, b) => a.material_id == b.id) + .LeftJoin((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.SqlSugarPageResult(result); }