From 781e2cad92083999619009baa120905547390094 Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Fri, 5 Jul 2024 17:20:48 +0800 Subject: [PATCH] bug --- ProductionMgr/Tnb.ProductionMgr/MesForErpService.cs | 10 ++++++++++ ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs | 8 ++++---- ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs | 4 ++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/MesForErpService.cs b/ProductionMgr/Tnb.ProductionMgr/MesForErpService.cs index 24b72972..74017417 100644 --- a/ProductionMgr/Tnb.ProductionMgr/MesForErpService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/MesForErpService.cs @@ -5,11 +5,13 @@ using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; +using JNPF.Logging; using JNPF.Message.Service; using JNPF.Systems.Interfaces.System; using JNPF.TaskScheduler; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using SqlSugar; using Tnb.BasicData; using Tnb.BasicData.Entities; @@ -50,6 +52,8 @@ namespace Tnb.ProductionMgr { if (input == null || input.IsEmpty()) throw Oops.Bah("参数不能为空"); + + Log.Information($"生产工单接收参数:{JsonConvert.SerializeObject(input)}"); List moList = new List(); List extendFieldList = new List(); @@ -82,6 +86,12 @@ namespace Tnb.ProductionMgr if(!units.Contains(item.unit_id)) throw Oops.Bah($"{basMaterial.name}不存在{item.unit_id}该单位"); + + if (!await _db.Queryable().AnyAsync(x => x.material_id == basMaterial.id && x.version == item.ebom_version)) + { + throw Oops.Bah($"系统中无法找到物料清单{item.ebom_version}版本"); + } + item.id = SnowflakeIdHelper.NextId(); item.mo_source = "1"; diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 0412945a..2a9af63b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -412,10 +412,10 @@ namespace Tnb.ProductionMgr { foreach (var item in input.details) { - if (!inputMaterials.Contains(item.material_id)) - { - throw new Exception("该物料不是生产bom投入物料,不能签收"); - } + // if (!inputMaterials.Contains(item.material_id)) + // { + // throw new Exception("该物料不是生产bom投入物料,不能签收"); + // } PrdMaterialReceiptD? detail = null; if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 526b86c6..ce318912 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -164,8 +164,8 @@ namespace Tnb.ProductionMgr eqp_type_code = SqlFunc.Subqueryable().Where(iit => iit.id == b.equip_type_id).Select(iit => iit.name), eqp_machine_num = b.eqp_machine_num, tonnage = b.tonnage, - task_list_qty = SqlFunc.Subqueryable().Where(x => x.eqp_id == b.id && (x.mo_task_status==DictConst.ToBeStartedEnCode || x.mo_task_status==DictConst.ToBeScheduledEncode)).Count(), - estimated_end_date = SqlFunc.Subqueryable().Where(x => x.eqp_id == b.id && (x.mo_task_status==DictConst.ToBeStartedEnCode || x.mo_task_status==DictConst.ToBeScheduledEncode)).Max(x=>x.create_time) + task_list_qty = SqlFunc.Subqueryable().Where(x => x.eqp_id == b.id && (x.mo_task_status==DictConst.ToBeStartedEnCode || x.mo_task_status==DictConst.ToBeScheduledEncode || x.mo_task_status==DictConst.InProgressEnCode || x.mo_task_status==DictConst.MoStatusPauseCode)).Count(), + estimated_end_date = SqlFunc.Subqueryable().Where(x => x.eqp_id == b.id && (x.mo_task_status==DictConst.ToBeStartedEnCode || x.mo_task_status==DictConst.ToBeScheduledEncode || x.mo_task_status==DictConst.InProgressEnCode || x.mo_task_status==DictConst.MoStatusPauseCode)).Max(x=>x.create_time) }).Mapper(x => { x.first_date = x.estimated_end_date.HasValue ? x.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";