This commit is contained in:
2024-07-05 17:20:48 +08:00
parent 080409c749
commit 781e2cad92
3 changed files with 16 additions and 6 deletions

View File

@@ -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<PrdMo> moList = new List<PrdMo>();
List<ErpExtendField> extendFieldList = new List<ErpExtendField>();
@@ -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<BasEbomH>().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";

View File

@@ -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)

View File

@@ -164,8 +164,8 @@ namespace Tnb.ProductionMgr
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().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<PrdMoTask>().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<PrdMoTask>().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<PrdMoTask>().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<PrdMoTask>().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") : "";