组织管理代码调整
This commit is contained in:
@@ -4,20 +4,80 @@ 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
|
||||
{
|
||||
[ApiDescriptionSettings(Tag = "ProductPlanMgr", Name = "WorkOrderScheduling", Order = 700)]
|
||||
/// <summary>
|
||||
/// 生产排产
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "ProductMgr", Name = "WorkOrderScheduling", Order = 700)]
|
||||
[Route("api/production/[controller]")]
|
||||
public class WorkOrderSchedulingService: IDynamicApiController, ITransient
|
||||
public class WorkOrderSchedulingService : IDynamicApiController, ITransient
|
||||
{
|
||||
|
||||
public WorkOrderSchedulingService()
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user