From fa4d9be965cb9748e90fd6bc1077b7b8247449e2 Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Fri, 5 May 2023 17:36:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E5=BC=80=E5=8F=91=EF=BC=8C?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8D=95=E8=B0=83=E6=95=B4=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8A=9F=E8=83=BD=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/PrdMoService.cs | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index 57d10080..d0fc4e9f 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -15,6 +15,7 @@ using Microsoft.AspNetCore.Mvc; using Senparc.Weixin.Work.AdvancedAPIs.MailList; using SqlSugar; using Tnb.BasicData; +using Tnb.BasicData.Entitys.Entity; using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; @@ -321,7 +322,6 @@ namespace Tnb.ProductionMgr //同组工单排产 if (entities.Count > 0) { - //var icmoEntities = entities.Adapt>(); icmoEntities = entities.Select(x => new PrdTask { id = SnowflakeIdHelper.NextId(), @@ -381,21 +381,11 @@ namespace Tnb.ProductionMgr } } - if (row > 0) { if (icmoEntities?.Count > 0 && combineMoCodes?.FirstOrDefault() is not null) { var moList = await db.Queryable().Where(it => combineMoCodes.Contains(it.combine_mo_code)).ToListAsync(); - //var icmoList = moList.Select(x => new PrdTask - //{ - // id = SnowflakeIdHelper.NextId(), - // item_id = x.item_id, - // item_code = x.item_code, - // mo_type = input.mo_type, - // plan_start_date = x.plan_start_date, - // plan_end_date = x.plan_end_date, - //}).ToList(); var combinePlanQty = icmoEntities?.Sum(x => x.plan_qty); //合并工单后的计划数量 var combineScheduledQty = icmoEntities?.Sum(x => x.scheduled_qty); //合并后的已排产数量 if (combineScheduledQty < combinePlanQty) @@ -446,8 +436,6 @@ namespace Tnb.ProductionMgr //修改工单状态为待排产,同事修改已排产数量 moStatus = DictConst.WaitProductId; icmoStatus = DictConst.ToBeScheduledEncode; - - } row = await db.Updateable().SetColumns(it => new PrdMo { @@ -547,9 +535,12 @@ namespace Tnb.ProductionMgr if (row > 0) { var prdMo = await db.Queryable().FirstAsync(it => it.id == prdTask.mo_id); - prdMo.input_qty += prdTask.scheduled_qty; - prdMo.icmo_status = DictConst.ToBeScheduledEncode; - row = await db.Updateable(prdMo).ExecuteCommandAsync(); + if (prdMo is not null) + { + prdMo.input_qty += prdTask.scheduled_qty; + prdMo.icmo_status = DictConst.ToBeScheduledEncode; + row = await db.Updateable(prdMo).ExecuteCommandAsync(); + } } return row > 0; });