50 lines
2.0 KiB
C#
50 lines
2.0 KiB
C#
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);
|
|
}
|
|
}
|
|
} |