bug
This commit is contained in:
@@ -13,6 +13,7 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
@@ -89,27 +90,28 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
}
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
SqlSugarPagedList<ReportRecordListOutput> result = await db.Queryable<PrdReportRecord>()
|
||||
.LeftJoin<DictionaryDataEntity>((a, b) => a.mo_task_type == b.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c) => a.status == c.EnCode)
|
||||
.LeftJoin<PrdMoTask>((a, b, c, d) => a.mo_task_id == d.id)
|
||||
SqlSugarPagedList<ReportRecordListOutput> result = await db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<PrdMo>((a,b)=>a.mo_id==b.id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b,c) => b.mo_type == c.Id)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c,d) => a.mo_task_status == d.EnCode && d.DictionaryTypeId==DictConst.PrdTaskStatusTypeId)
|
||||
.LeftJoin<BasMaterial>((a,b,c,d,e)=>a.material_id==e.id)
|
||||
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c) => a.mo_task_code.Contains(moTaskCode))
|
||||
.Select((a, b, c, d) => new ReportRecordListOutput
|
||||
.Select((a, b, c, d,e) => new ReportRecordListOutput
|
||||
{
|
||||
id = a.id,
|
||||
masterial_code = a.masterial_code,
|
||||
mo_code = a.mo_code,
|
||||
masterial_name = a.masterial_name,
|
||||
masterial_code = e.code,
|
||||
mo_code = b.mo_code,
|
||||
masterial_name = e.name,
|
||||
mo_task_code = a.mo_task_code,
|
||||
mo_task_id = a.mo_task_code,
|
||||
mo_task_id_id = a.mo_task_id,
|
||||
mo_task_type = b.FullName,
|
||||
plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-mm-dd"),
|
||||
plan_start_date = a.plan_start_date == null ? "" : a.plan_start_date.Value.ToString("yyyy-mm-dd"),
|
||||
plan_qty = d.scheduled_qty,
|
||||
mo_task_id_id = a.id,
|
||||
mo_task_type = c.FullName,
|
||||
plan_end_date = a.estimated_end_date == null ? "" : a.estimated_end_date.Value.ToString("yyyy-mm-dd"),
|
||||
plan_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-mm-dd"),
|
||||
plan_qty = a.scheduled_qty,
|
||||
reported_work_qty = a.reported_work_qty,
|
||||
completed_qty = SqlFunc.IsNull(d.reported_work_qty, 0) + SqlFunc.IsNull(d.scrap_qty, 0),
|
||||
status = c.FullName,
|
||||
completed_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0),
|
||||
status = d.FullName,
|
||||
tablefield107 = SqlFunc.Subqueryable<PrdReport>()
|
||||
.LeftJoin<UserEntity>((x, y) => x.create_id == y.Id)
|
||||
.Where(x => x.mo_task_code == a.mo_task_code).ToList((x, y) => new ReportRecordListChildrenOutput
|
||||
@@ -149,11 +151,11 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
_ = await db.Insertable<PrdReport>(prdReports).ExecuteCommandAsync();
|
||||
|
||||
int? sum = prdReports.Sum(x => x.reported_qty);
|
||||
_ = await db.Updateable<PrdReportRecord>()
|
||||
.SetColumns(x => x.completed_qty == x.completed_qty + sum)
|
||||
.SetColumns(x => x.reported_work_qty == x.reported_work_qty + sum)
|
||||
.Where(x => x.id == input.data["id"].ToString()).ExecuteCommandAsync();
|
||||
// int? sum = prdReports.Sum(x => x.reported_qty);
|
||||
// _ = await db.Updateable<PrdReportRecord>()
|
||||
// .SetColumns(x => x.completed_qty == x.completed_qty + sum)
|
||||
// .SetColumns(x => x.reported_work_qty == x.reported_work_qty + sum)
|
||||
// .Where(x => x.id == input.data["id"].ToString()).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user