新增生产工单排产功能接口
This commit is contained in:
17
Tnb.ProductionPlanMgr/Tnb.ProductionPlanMgr.csproj
Normal file
17
Tnb.ProductionPlanMgr/Tnb.ProductionPlanMgr.csproj
Normal file
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
|
||||
<ProjectReference Include="..\common\Tnb.Common\Tnb.Common.csproj" />
|
||||
<ProjectReference Include="..\Tnb.ProductionPlanMgr.Entitys\Tnb.ProductionPlanMgr.Entitys.csproj" />
|
||||
<ProjectReference Include="..\Tnb.ProductionPlanMgr.Interfaces\Tnb.ProductionPlanMgr.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
50
Tnb.ProductionPlanMgr/WorkOrderCreateService.cs
Normal file
50
Tnb.ProductionPlanMgr/WorkOrderCreateService.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.OpenXmlFormats.Shared;
|
||||
using SqlSugar;
|
||||
using Tnb.ProductionPlanMgr.Entitys.Dto.WorkOrder;
|
||||
using Tnb.ProductionPlanMgr.Entitys.Entity;
|
||||
using Tnb.ProductionPlanMgr.Interfaces;
|
||||
|
||||
namespace Tnb.ProductionPlanMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产计划管理
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "ProductPlanMgr", Name = "WorkOrderCreate", Order = 700)]
|
||||
[Route("api/production/[controller]")]
|
||||
public class WorkOrderCreateService :IWorkOrderCreateService,IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<PrdMoEntity> _repository;
|
||||
private readonly IDataBaseManager _dataBaseManager;
|
||||
public WorkOrderCreateService(ISqlSugarRepository<PrdMoEntity> repository, IDataBaseManager dataBaseManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_dataBaseManager = dataBaseManager;
|
||||
}
|
||||
/// <summary>
|
||||
/// 生产工单创建-生产工单下发
|
||||
/// </summary>
|
||||
/// <param name="input">生产工单下发输入参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("workorder-issue")]
|
||||
public async Task<dynamic> WorkOrderIssue(WorkOrderIssueCrInput input)
|
||||
{
|
||||
if (input is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
var link = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(x => x.FullName == "tnb_mes");
|
||||
var db = _dataBaseManager.ChangeDataBase(link);
|
||||
var row = await db.Updateable<PrdMoEntity>()
|
||||
.SetColumns(it => new PrdMoEntity { MoStatus = "25019232867093" })
|
||||
.Where(it => input.WorkOrderIds.Contains(it.Id))
|
||||
.ExecuteCommandAsync();
|
||||
return (row > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
23
Tnb.ProductionPlanMgr/WorkOrderSchedulingService.cs
Normal file
23
Tnb.ProductionPlanMgr/WorkOrderSchedulingService.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Tnb.ProductionPlanMgr
|
||||
{
|
||||
[ApiDescriptionSettings(Tag = "ProductPlanMgr", Name = "WorkOrderScheduling", Order = 700)]
|
||||
[Route("api/production/[controller]")]
|
||||
public class WorkOrderSchedulingService: IDynamicApiController, ITransient
|
||||
{
|
||||
|
||||
public WorkOrderSchedulingService()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Tnb.ProductionPlanMgr/internals/BaseService.cs
Normal file
27
Tnb.ProductionPlanMgr/internals/BaseService.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionPlanMgr.internals
|
||||
{
|
||||
public class BaseService : ITransient
|
||||
{
|
||||
private readonly Dictionary<string, ISqlSugarClient> _dbContextDic = new(StringComparer.OrdinalIgnoreCase);
|
||||
static BaseService()
|
||||
{
|
||||
var repo = App.GetService<ISqlSugarRepository<DbLinkEntity>>();
|
||||
var = await repo.GetListAsync();
|
||||
var dbMgr = App.GetService<IDataBaseManager>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user