生产管理
This commit is contained in:
@@ -46,4 +46,9 @@ public class DepartmentCrInput
|
||||
/// 组织类型
|
||||
/// </summary>
|
||||
public string category { get; set; }
|
||||
/// <summary>
|
||||
/// 组织类型名称
|
||||
/// added by ly on 20230421
|
||||
/// </summary>
|
||||
public string typeName { get; set; }
|
||||
}
|
||||
@@ -57,4 +57,8 @@ public class DepartmentInfoOutput
|
||||
/// added by ly on 20230420
|
||||
/// </summary>
|
||||
public string category { get; set; }
|
||||
/// <summary>
|
||||
/// 组织类型名称
|
||||
/// </summary>
|
||||
public string categoryName { get; set; }
|
||||
}
|
||||
@@ -73,4 +73,9 @@ public class OrganizeListOutput : TreeModel
|
||||
/// 集团名 (组织树最后一个).
|
||||
/// </summary>
|
||||
public string lastFullName { get; set; }
|
||||
/// <summary>
|
||||
/// 组织类型名称
|
||||
/// added by ly on 20230421
|
||||
/// </summary>
|
||||
public string categoryName { get; set; }
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using JNPF.Systems.Entitys.Dto.Department;
|
||||
using JNPF.Systems.Entitys.Dto.Organize;
|
||||
using JNPF.Systems.Entitys.Dto.SysConfig;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
@@ -212,6 +213,9 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
|
||||
var res = entity.Adapt<DepartmentInfoOutput>();
|
||||
if (entity.ParentId.Equals("-1")) res.organizeIdTree = new List<string>() { res.id };
|
||||
else res.organizeIdTree = (await _repository.GetSingleAsync(p => p.Id == entity.ParentId)).OrganizeIdTree.Split(",").ToList();
|
||||
//modified by ly on 20230421
|
||||
var dic = await _repository.AsSugarClient().Queryable<DictionaryDataEntity>().Where(it => it.DictionaryTypeId == "24754619407381").ToDictionaryAsync(x => x.EnCode, x => x.FullName);
|
||||
res.categoryName = dic.ContainsKey(res.category) ? dic[res.category].ToString() : "";
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -578,7 +582,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
|
||||
/// <returns></returns>
|
||||
public async Task<List<OrganizeEntity>> GetCompanyAllDep(string id)
|
||||
{
|
||||
return await _repository.GetListAsync(x => x.OrganizeIdTree.Contains(id) && x.Category == "department" && x.EnabledMark == 1 && x.DeleteMark == null);
|
||||
return await _repository.GetListAsync(x => x.OrganizeIdTree.Contains(id) && x.Category == "department" && x.EnabledMark == 1 && x.DeleteMark == null);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -12,6 +12,7 @@ using JNPF.LinqBuilder;
|
||||
using JNPF.Systems.Entitys.Dto.Organize;
|
||||
using JNPF.Systems.Entitys.Dto.SysConfig;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
@@ -88,6 +89,8 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
|
||||
// 获取分级管理组织
|
||||
var dataScope = _userManager.DataScope.Where(x => x.Select).Select(x => x.organizeId).Distinct().ToList();
|
||||
//modified by ly on 20230421 查询区域类型数据字典
|
||||
var dic = await _repository.AsSugarClient().Queryable<DictionaryDataEntity>().Where(it => it.DictionaryTypeId == "24754619407381").ToDictionaryAsync(x => x.EnCode, x => x.FullName);
|
||||
|
||||
List<OrganizeListOutput>? data = await _repository.AsQueryable().Where(t => t.DeleteMark == null)
|
||||
.WhereIF(!_userManager.IsAdministrator, a => dataScope.Contains(a.Id))
|
||||
@@ -105,7 +108,9 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
sortCode = x.SortCode,
|
||||
icon = SqlFunc.IIF(x.Category.Equals("company"), "icon-ym icon-ym-tree-organization3", "icon-ym icon-ym-tree-department1"),
|
||||
type = x.Category
|
||||
}).ToListAsync();
|
||||
})
|
||||
.Mapper(x => x.categoryName = dic.ContainsKey(x.category) ? dic[x.category].ToString() : "")
|
||||
.ToListAsync();
|
||||
|
||||
if (!string.IsNullOrEmpty(input.keyword))
|
||||
data = data.TreeWhere(t => t.fullName.Contains(input.keyword) || t.enCode.Contains(input.keyword), t => t.id, t => t.parentId);
|
||||
@@ -290,19 +295,19 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
queryWhere = queryWhere.And(x => x.DeleteMark == null);
|
||||
List<OrganizeListOutput>? data = await _repository.AsQueryable().Where(queryWhere)
|
||||
.WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.FullName.Contains(input.keyword) || a.EnCode.Contains(input.keyword)).Select(a => new OrganizeListOutput
|
||||
{
|
||||
id = a.Id,
|
||||
organizeIdTree = a.OrganizeIdTree,
|
||||
type = a.Category,
|
||||
parentId = a.ParentId,
|
||||
lastFullName = a.FullName,
|
||||
fullName = a.FullName,
|
||||
enabledMark = a.EnabledMark,
|
||||
creatorTime = a.CreatorTime,
|
||||
icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1",
|
||||
sortCode = a.SortCode,
|
||||
isLeaf = true
|
||||
}).ToListAsync();
|
||||
{
|
||||
id = a.Id,
|
||||
organizeIdTree = a.OrganizeIdTree,
|
||||
type = a.Category,
|
||||
parentId = a.ParentId,
|
||||
lastFullName = a.FullName,
|
||||
fullName = a.FullName,
|
||||
enabledMark = a.EnabledMark,
|
||||
creatorTime = a.CreatorTime,
|
||||
icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1",
|
||||
sortCode = a.SortCode,
|
||||
isLeaf = true
|
||||
}).ToListAsync();
|
||||
|
||||
// 获取所有组织
|
||||
List<OrganizeEntity>? allOrgList = GetOrgListTreeName();
|
||||
@@ -393,7 +398,7 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
});
|
||||
});
|
||||
|
||||
if(adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
if (adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
#endregion
|
||||
|
||||
#region 第三方同步
|
||||
@@ -629,7 +634,7 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie
|
||||
[NonAction]
|
||||
public async Task<List<OrganizeEntity>> GetListAsync(Expression<Func<OrganizeEntity, bool>> expression = null)
|
||||
{
|
||||
var query = _repository.AsQueryable().Where(t => t.EnabledMark == 1 && t.DeleteMark == null).WhereIF(expression!=null, expression);
|
||||
var query = _repository.AsQueryable().Where(t => t.EnabledMark == 1 && t.DeleteMark == null).WhereIF(expression != null, expression);
|
||||
return await query.OrderBy(o => o.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc).ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -417,8 +417,8 @@ public class DataBaseService : IDynamicApiController, ITransient
|
||||
sugarClient.MappingTables.Add(entityName, item.Name);
|
||||
foreach (var col in sugarClient.DbMaintenance.GetColumnInfosByTableName(item.Name))
|
||||
{
|
||||
var colName = CustomFormatName(col.DbColumnName);
|
||||
sugarClient.MappingColumns.Add(colName /*类的属性首字母大写*/, col.DbColumnName, entityName);
|
||||
//var colName = CustomFormatName(col.DbColumnName);
|
||||
sugarClient.MappingColumns.Add(col.DbColumnName /*类的属性首字母大写*/, col.DbColumnName, entityName);
|
||||
}
|
||||
}
|
||||
sugarClient.DbFirst.Where(input.TableName)
|
||||
|
||||
Reference in New Issue
Block a user