Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Security.Principal;
|
using System.Security.Principal;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||||
{
|
{
|
||||||
@@ -86,7 +87,45 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
public string process_name { get; set;}
|
public string process_name { get; set;}
|
||||||
|
|
||||||
public string create_time { get; set; }
|
public string create_time { get; set; }
|
||||||
|
}
|
||||||
|
public class PrdMoTaskTreeOutput : TreeModel
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 生产任务单号
|
||||||
|
/// </summary>
|
||||||
|
public string? mo_task_code { get; set; }
|
||||||
|
public string? material_id { get; set; }
|
||||||
|
public string? mold_id { get; set; }
|
||||||
|
public string? eqp_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料
|
||||||
|
/// </summary>
|
||||||
|
public string? material_id_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 模具
|
||||||
|
/// </summary>
|
||||||
|
public string? mold_id_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备
|
||||||
|
/// </summary>
|
||||||
|
public string? eqp_id_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 预计开始时间
|
||||||
|
/// </summary>
|
||||||
|
public string? estimated_start_date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 预计结束时间
|
||||||
|
/// </summary>
|
||||||
|
public string? estimated_end_date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public string? create_time { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ using Tnb.ProductionMgr.Interfaces;
|
|||||||
using Tnb.WarehouseMgr;
|
using Tnb.WarehouseMgr;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.BasicData;
|
using Tnb.BasicData;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
|
||||||
namespace Tnb.ProductionMgr
|
namespace Tnb.ProductionMgr
|
||||||
{
|
{
|
||||||
@@ -29,11 +35,13 @@ namespace Tnb.ProductionMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
[Route("api/[area]/[controller]/[action]")]
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient
|
[OverideVisualDev(ModuleId)]
|
||||||
|
public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient, IOverideVisualDevService
|
||||||
{
|
{
|
||||||
private readonly ISqlSugarRepository<PrdInstockH> _repository;
|
private readonly ISqlSugarRepository<PrdInstockH> _repository;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
|
private const string ModuleId = "25572529329173";
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
|
||||||
public PrdInstockService(
|
public PrdInstockService(
|
||||||
ISqlSugarRepository<PrdInstockH> repository,
|
ISqlSugarRepository<PrdInstockH> repository,
|
||||||
@@ -42,6 +50,46 @@ namespace Tnb.ProductionMgr
|
|||||||
{
|
{
|
||||||
_repository = repository;
|
_repository = repository;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
OverideFuncs.GetListAsync = GetList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
||||||
|
string moCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
|
||||||
|
var list = await _repository.AsSugarClient().Queryable<PrdMoTask>()
|
||||||
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||||
|
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||||
|
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d) => a.mo_task_code!.Contains(moCode))
|
||||||
|
.Select((a, b, c, d) => new PrdMoTaskTreeOutput()
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
parentId = string.IsNullOrEmpty(a.parent_id) ? "0" : a.parent_id,
|
||||||
|
mo_task_code = a.mo_task_code,
|
||||||
|
material_id = b.name,
|
||||||
|
material_id_id = b.id,
|
||||||
|
mold_id = c.mold_name,
|
||||||
|
mold_id_id = c.id,
|
||||||
|
eqp_id = d.name,
|
||||||
|
eqp_id_id = d.id,
|
||||||
|
estimated_start_date = a.estimated_start_date!.ToString(),
|
||||||
|
estimated_end_date = a.estimated_end_date.ToString(),
|
||||||
|
create_time = a.create_time.ToString()
|
||||||
|
}).ToListAsync();
|
||||||
|
var treeList = list.ToTree();
|
||||||
|
treeList= treeList.Skip((input.currentPage-1)* input.pageSize).Take(input.pageSize).ToList();
|
||||||
|
SqlSugarPagedList<PrdMoTaskTreeOutput> pagedList = new()
|
||||||
|
{
|
||||||
|
list = treeList,
|
||||||
|
pagination = new Pagination
|
||||||
|
{
|
||||||
|
CurrentPage = input.currentPage,
|
||||||
|
PageSize = input.pageSize,
|
||||||
|
Total = treeList.Count
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return PageResult<PrdMoTaskTreeOutput>.SqlSugarPageResult(pagedList);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class TimedTaskBackgroundService : BackgroundService
|
public class TimedTaskBackgroundService : BackgroundService
|
||||||
{
|
{
|
||||||
private IEventPublisher _eventPublisher;
|
private IEventPublisher _eventPublisher = default!;
|
||||||
|
|
||||||
protected override Task ExecuteAsync(CancellationToken stoppingToken) => Task.Run(() =>
|
protected override Task ExecuteAsync(CancellationToken stoppingToken) => Task.Run(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -536,6 +536,20 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
|
|||||||
isOK = await _repository.AsSugarClient().Updateable<EqpEquipment>().SetColumns(it => new EqpEquipment { station_code = "" }).Where(it => unbindEqpIds.Contains(it.id)).ExecuteCommandAsync();
|
isOK = await _repository.AsSugarClient().Updateable<EqpEquipment>().SetColumns(it => new EqpEquipment { station_code = "" }).Where(it => unbindEqpIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await _repository.AsSugarClient().Deleteable<OrganizeRelationEntity>(p => p.OrganizeId == id && p.ObjectType == "Eqp").ExecuteCommandAsync();
|
||||||
|
var OrganizeRelationEntitys = new List<OrganizeRelationEntity>();
|
||||||
|
foreach (var item in eqpIds)
|
||||||
|
{
|
||||||
|
OrganizeRelationEntity organizeRelationEntity = new OrganizeRelationEntity();
|
||||||
|
organizeRelationEntity.Id = SnowflakeIdHelper.NextId();
|
||||||
|
organizeRelationEntity.OrganizeId = id;
|
||||||
|
organizeRelationEntity.ObjectType = "Eqp";
|
||||||
|
organizeRelationEntity.ObjectId = item;
|
||||||
|
organizeRelationEntity.CreatorTime = DateTime.Now;
|
||||||
|
organizeRelationEntity.CreatorUserId = _userManager.UserId;
|
||||||
|
OrganizeRelationEntitys.Add(organizeRelationEntity);
|
||||||
|
}
|
||||||
|
await _repository.AsSugarClient().Insertable(OrganizeRelationEntitys).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
var processVal = jsonObj.GetValue("rowprocess");
|
var processVal = jsonObj.GetValue("rowprocess");
|
||||||
if (processVal is not null)
|
if (processVal is not null)
|
||||||
@@ -570,6 +584,25 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
|
|||||||
isOK = await _repository.AsSugarClient().Updateable<BasProcessStation>(it => new BasProcessStation { station_id = "", station_code = "" }).Where(it => curProcIds.Contains(it.process_id)).ExecuteCommandAsync();
|
isOK = await _repository.AsSugarClient().Updateable<BasProcessStation>(it => new BasProcessStation { station_id = "", station_code = "" }).Where(it => curProcIds.Contains(it.process_id)).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var correlation= jsonObj.GetValue("correlation");
|
||||||
|
if (correlation is not null)
|
||||||
|
{
|
||||||
|
await _repository.AsSugarClient().Deleteable<OrganizeRelationEntity>(p => p.OrganizeId == id && p.ObjectType == "User").ExecuteCommandAsync();
|
||||||
|
var OrganizeRelationEntitys=new List<OrganizeRelationEntity>();
|
||||||
|
for (int i = 0; i < correlation.Count(); i++)
|
||||||
|
{
|
||||||
|
OrganizeRelationEntity organizeRelationEntity = new OrganizeRelationEntity();
|
||||||
|
organizeRelationEntity.Id = SnowflakeIdHelper.NextId();
|
||||||
|
organizeRelationEntity.OrganizeId = id;
|
||||||
|
organizeRelationEntity.ObjectType = "User";
|
||||||
|
organizeRelationEntity.ObjectId = correlation[i].ToString();
|
||||||
|
organizeRelationEntity.CreatorTime = DateTime.Now;
|
||||||
|
organizeRelationEntity.CreatorUserId = _userManager.UserId;
|
||||||
|
OrganizeRelationEntitys.Add(organizeRelationEntity);
|
||||||
|
}
|
||||||
|
await _repository.AsSugarClient().Insertable(OrganizeRelationEntitys).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
|
||||||
if (!(isOK > 0)) throw Oops.Oh(ErrorCode.COM1001);
|
if (!(isOK > 0)) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user