bug
This commit is contained in:
@@ -774,22 +774,41 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
//根据工单号获取当前工单包含的已排产数
|
||||
var schedQty = _db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
|
||||
// if (mo != null)
|
||||
// {//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
|
||||
// if (schedQty.HasValue && schedQty.Value >= mo.plan_qty)
|
||||
// {
|
||||
// mo.mo_status = DictConst.AlreadyId;
|
||||
// await _db.Updateable(mo).ExecuteCommandAsync();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (schedQty.HasValue)
|
||||
// {
|
||||
// mo.scheduled_qty += schedQty.Value;
|
||||
// await _db.Updateable(mo).ExecuteCommandAsync();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (mo != null)
|
||||
{//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产
|
||||
if (schedQty.HasValue && schedQty.Value >= mo.plan_qty)
|
||||
{
|
||||
if (mo.scheduled_qty == null)
|
||||
{
|
||||
mo.mo_status = DictConst.AlreadyId;
|
||||
await _db.Updateable(mo).ExecuteCommandAsync();
|
||||
await _db.Updateable<PrdMo>()
|
||||
.SetColumns(x => x.mo_status == DictConst.AlreadyId)
|
||||
.SetColumns(x => x.scheduled_qty == input.scheduled_qty)
|
||||
.Where(x=>x.id==mo.id)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (schedQty.HasValue)
|
||||
{
|
||||
mo.scheduled_qty += schedQty.Value;
|
||||
await _db.Updateable(mo).ExecuteCommandAsync();
|
||||
}
|
||||
await _db.Updateable<PrdMo>().SetColumns(x => x.scheduled_qty == x.scheduled_qty + input.scheduled_qty)
|
||||
.Where(x=>x.id==mo.id)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
var subTaskList = await _db.Queryable<BasMbom>()
|
||||
.LeftJoin<BasMbomProcess>((a, b) => a.id == b.mbom_id)
|
||||
.LeftJoin<BasRouteH>((a, b, c) => a.route_id == c.id)
|
||||
|
||||
Reference in New Issue
Block a user