重新组织目录
This commit is contained in:
77
ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
Normal file
77
ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.OpenXmlFormats.Shared;
|
||||
using SqlSugar;
|
||||
using Tnb.ProductionMgr.Entitys.Dto.WorkOrder;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
using Tnb.ProductionPlanMgr.Entitys.Dto.WorkOrder;
|
||||
using Tnb.ProductionPlanMgr.Interfaces;
|
||||
|
||||
namespace Tnb.ProductionPlanMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产计划管理
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "ProductionMgr", Name = "WorkOrderCreate", Order = 700)]
|
||||
[Route("api/production/[controller]")]
|
||||
public class PrdMoService : IPrdMoService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<PrdMoEntity> _repository;
|
||||
private readonly IDataBaseManager _dataBaseManager;
|
||||
public PrdMoService(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 db = await GetDbContext();
|
||||
var row = await db.Updateable<PrdMoEntity>()
|
||||
.SetColumns(it => new PrdMoEntity { MoStatus = "25019232867093" })
|
||||
.Where(it => input.WorkOrderIds.Contains(it.Id))
|
||||
.ExecuteCommandAsync();
|
||||
return (row > 0);
|
||||
}
|
||||
/// <summary>
|
||||
/// 生产工单-生产排产
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("scheduling")]
|
||||
public async Task<dynamic> ProductionScheduling(ProductionSchedulingCrInput input)
|
||||
{
|
||||
var entity = input.Adapt<PrdTask>();
|
||||
entity.Id = input.Id ?? SnowflakeIdHelper.NextId();
|
||||
var db = await GetDbContext();
|
||||
var row = await db.Storageable(entity).ExecuteCommandAsync();
|
||||
return (row > 0);
|
||||
}
|
||||
|
||||
private async Task<ISqlSugarClient> GetDbContext()
|
||||
{
|
||||
var link = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(x => x.FullName == "tnb_mes");
|
||||
var db = _dataBaseManager.ChangeDataBase(link);
|
||||
return db;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
16
ProductionMgr/Tnb.ProductionMgr/Tnb.ProductionMgr.csproj
Normal file
16
ProductionMgr/Tnb.ProductionMgr/Tnb.ProductionMgr.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||
<ProjectReference Include="..\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aspose.Cells;
|
||||
using DingTalk.Api.Request;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.SS.UserModel;
|
||||
using SqlSugar;
|
||||
using Tnb.ProductionMgr.Entitys.Entity;
|
||||
|
||||
namespace Tnb.ProductionPlanMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 生产排产
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "ProductMgr", Name = "WorkOrderScheduling", Order = 700)]
|
||||
[Route("api/production/[controller]")]
|
||||
public class WorkOrderSchedulingService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IDataBaseManager _dataBaseManager;
|
||||
private readonly ISqlSugarRepository<DbLinkEntity> _repository;
|
||||
public WorkOrderSchedulingService(IDataBaseManager dataBaseManager, ISqlSugarRepository<DbLinkEntity> repository)
|
||||
{
|
||||
_dataBaseManager = dataBaseManager;
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试数据导入
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("data")]
|
||||
[AllowAnonymous]
|
||||
public async Task ImportMoldsData()
|
||||
{
|
||||
List<(string pId, string eqpId)> multi = new()
|
||||
{
|
||||
("25546268026149","25530823999765"),
|
||||
("25546256076325","25530834099477"),
|
||||
};
|
||||
List<MoldsEntity> list = new();
|
||||
var index = 1;
|
||||
foreach (var item in multi)
|
||||
{
|
||||
MoldsEntity entity = new();
|
||||
entity.Id = SnowflakeIdHelper.NextId();
|
||||
entity.MoldCode = $"m00{index}";
|
||||
entity.MoldName = "磨具" + index;
|
||||
entity.ItemId = item.pId;
|
||||
entity.EqpId = item.eqpId;
|
||||
list.Add(entity);
|
||||
index++;
|
||||
}
|
||||
var link = await _repository.GetFirstAsync(x => x.FullName == "tnb_eqp");
|
||||
var db = _dataBaseManager.ChangeDataBase(link);
|
||||
var row = await db.Insertable(list).ExecuteCommandAsync();
|
||||
if (row > 0)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var dic = new Dictionary<string, object>
|
||||
{
|
||||
{"id",item.EqpId },
|
||||
{ "mold_id", item.Id}
|
||||
};
|
||||
var row2 = await db.Updateable(dic).AS("eqp_equipment")
|
||||
.WhereColumns("id").
|
||||
ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
23
ProductionMgr/Tnb.ProductionMgr/internals/BaseService.cs
Normal file
23
ProductionMgr/Tnb.ProductionMgr/internals/BaseService.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
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
|
||||
{
|
||||
public class BaseService : ITransient
|
||||
{
|
||||
private readonly Dictionary<string, ISqlSugarClient> _dbContextDic = new(StringComparer.OrdinalIgnoreCase);
|
||||
static BaseService()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user