diff --git a/Tnb.BasicData.Entitys/DbName.cs b/Tnb.BasicData.Entitys/DbName.cs
new file mode 100644
index 00000000..69d41c44
--- /dev/null
+++ b/Tnb.BasicData.Entitys/DbName.cs
@@ -0,0 +1,8 @@
+namespace Tnb.BasicData.Entitys
+{
+ public static class DbName
+ {
+ public const string TIANYIMON = "tianyi_mom";
+ public const string TNBMON = "tnb_mom";
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData.Entitys/DicTypeKey.cs b/Tnb.BasicData.Entitys/DicTypeKey.cs
new file mode 100644
index 00000000..8eb3d411
--- /dev/null
+++ b/Tnb.BasicData.Entitys/DicTypeKey.cs
@@ -0,0 +1,10 @@
+namespace Tnb.BasicData.Entitys
+{
+ public static class DicTypeKey
+ {
+ ///
+ /// 计量单位
+ ///
+ public const string MeasurementUnit = "MeasurementUnit";
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs b/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs
new file mode 100644
index 00000000..dc5dbd4d
--- /dev/null
+++ b/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeOutput.cs
@@ -0,0 +1,37 @@
+namespace Tnb.BasicData.Entitys.Dto
+{
+ public class ParentMaterialTreeOutput
+ {
+ ///
+ /// 物料名称
+ ///
+ public string material_id { get; set; }
+ ///
+ /// 规格描述
+ ///
+ public string material_id_extras { get; set; }
+ ///
+ /// 物料id
+ ///
+ public string material_id_id { get; set; }
+ ///
+ /// 最小包装
+ ///
+ public decimal? material_id_minpacking { get; set; }
+ ///
+ /// 备注
+ ///
+ public string material_id_remark { get; set; }
+ ///
+ /// 单位
+ ///
+ public string material_id_unitid { get; set; }
+ ///
+ /// 是否有下级
+ ///
+ public bool hasChildren { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs b/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs
new file mode 100644
index 00000000..ca9d6a46
--- /dev/null
+++ b/Tnb.BasicData.Entitys/Dto/ParentMaterial/ParentMaterialTreeQueryInput.cs
@@ -0,0 +1,17 @@
+namespace Tnb.BasicData.Entitys.Dto
+{
+ public class ParentMaterialTreeQueryInput
+ {
+ ///
+ /// 物料清单id
+ ///
+ public string parentMaterialId { get; set; }
+ ///
+ /// 物料id
+ ///
+ public string materialId { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData.Entitys/Entity/BasMaterial.cs b/Tnb.BasicData.Entitys/Entity/BasMaterial.cs
new file mode 100644
index 00000000..3477b854
--- /dev/null
+++ b/Tnb.BasicData.Entitys/Entity/BasMaterial.cs
@@ -0,0 +1,263 @@
+using SqlSugar;
+using Tnb.Common.Contracts;
+namespace Tnb.BasicData.Entitys.Entity
+{
+ ///
+ ///物料信息
+ ///
+ [SugarTable("bas_material")]
+ public class BasMaterial : BaseEntity
+ {
+ public BasMaterial(){
+
+
+ }
+ ///
+ /// Desc:主键
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(IsPrimaryKey=true,ColumnName="id")]
+ public string Id {get;set;}
+
+ ///
+ /// Desc:物料代码
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="material_code")]
+ public string MaterialCode {get;set;}
+
+ ///
+ /// Desc:物料名称
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="material_name")]
+ public string MaterialName {get;set;}
+
+ ///
+ /// Desc:物料分类ID
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="categoryid")]
+ public string Categoryid {get;set;}
+
+ ///
+ /// Desc:单位ID,BAS_UNIT.ID
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="unitid")]
+ public string Unitid {get;set;}
+
+ ///
+ /// Desc:选择单位ID,BAS_UNIT.ID
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="pickunitid")]
+ public string Pickunitid {get;set;}
+
+ ///
+ /// Desc:单价
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="cost")]
+ public decimal? Cost {get;set;}
+
+ ///
+ /// Desc:毛重
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="grossweight")]
+ public decimal? Grossweight {get;set;}
+
+ ///
+ /// Desc:净重
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="netweight")]
+ public decimal? Netweight {get;set;}
+
+ ///
+ /// Desc:长
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="length")]
+ public decimal? Length {get;set;}
+
+ ///
+ /// Desc:宽
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="width")]
+ public decimal? Width {get;set;}
+
+ ///
+ /// Desc:高
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="high")]
+ public decimal? High {get;set;}
+
+ ///
+ /// Desc:体积
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="volumn")]
+ public decimal? Volumn {get;set;}
+
+ ///
+ /// Desc:是否免检
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="isexemption")]
+ public int? Isexemption {get;set;}
+
+ ///
+ /// Desc:安全库存
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="safeqty")]
+ public decimal? Safeqty {get;set;}
+
+ ///
+ /// Desc:保质期
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="qualityperiod")]
+ public int? Qualityperiod {get;set;}
+
+ ///
+ /// Desc:最小包装
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="minpacking")]
+ public decimal? Minpacking {get;set;}
+
+ ///
+ /// Desc:是否先进先出管控
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="fifo")]
+ public int? Fifo {get;set;}
+
+ ///
+ /// Desc:先进先出间隔天数,批次间隔天数
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="fifo_interval_days")]
+ public int? FifoIntervalDays {get;set;}
+
+ ///
+ /// Desc:所属组织ID
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="org_id")]
+ public string OrgId {get;set;}
+
+ ///
+ /// Desc:是否过期允许出库
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="expireout")]
+ public string Expireout {get;set;}
+
+ ///
+ /// Desc:物料规格型号
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="material_standard")]
+ public string MaterialStandard {get;set;}
+
+ ///
+ /// Desc:创建时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="create_time")]
+ public DateTime? CreateTime {get;set;}
+
+ ///
+ /// Desc:最后修改时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="modify_time")]
+ public DateTime? ModifyTime {get;set;}
+
+ ///
+ /// Desc:扩展字段
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="extras")]
+ public string Extras {get;set;}
+
+ ///
+ /// Desc:海关编码
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="fhscode")]
+ public string Fhscode {get;set;}
+
+ ///
+ /// Desc:附属性
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="attribute")]
+ public string Attribute {get;set;}
+
+ ///
+ /// Desc:管控类型: 批管控:Lot 单管控:KeyParts 非管控:NoControl
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="controltype")]
+ public string Controltype {get;set;}
+
+ ///
+ /// Desc:备注
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="remark")]
+ public string Remark {get;set;}
+
+ ///
+ /// Desc:创建人员ID
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="create_id")]
+ public string CreateId {get;set;}
+
+ ///
+ /// Desc:最后修改人员ID
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="modify_id")]
+ public string ModifyId {get;set;}
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData.Entitys/Entity/BasMaterialUnit.cs b/Tnb.BasicData.Entitys/Entity/BasMaterialUnit.cs
new file mode 100644
index 00000000..aa548646
--- /dev/null
+++ b/Tnb.BasicData.Entitys/Entity/BasMaterialUnit.cs
@@ -0,0 +1,113 @@
+using SqlSugar;
+using Tnb.Common.Contracts;
+
+namespace Tnb.BasicData.Entitys.Entity
+{
+ ///
+ ///物料单位
+ ///
+ [SugarTable("bas_material_unit")]
+ public class BasMaterialUnit : BaseEntity
+ {
+ public BasMaterialUnit(){
+
+
+ }
+ ///
+ /// Desc:主键
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(IsPrimaryKey=true,ColumnName="id")]
+ public string Id {get;set;}
+
+ ///
+ /// Desc:物料ID,BAS_MATERIAL.ID
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="material_id")]
+ public string MaterialId {get;set;}
+
+ ///
+ /// Desc:单位ID,BAS_UNIT.ID
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="unit_id")]
+ public string UnitId {get;set;}
+
+ ///
+ /// Desc:比例
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="relation_qty")]
+ public decimal RelationQty {get;set;}
+
+ ///
+ /// Desc:创建时间
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(ColumnName="create_time")]
+ public DateTime CreateTime {get;set;}
+
+ ///
+ /// Desc:修改时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="modify_time")]
+ public DateTime? ModifyTime {get;set;}
+
+ ///
+ /// Desc:扩展字段
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="extras")]
+ public string Extras {get;set;}
+
+ ///
+ /// Desc:所属组织ID
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="org_id")]
+ public string OrgId {get;set;}
+
+ ///
+ /// Desc:条码
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="bar_code")]
+ public string BarCode {get;set;}
+
+ ///
+ /// Desc:时间戳(用于并发控制)
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="timestamp")]
+ public string Timestamp {get;set;}
+
+ ///
+ /// Desc:创建用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="create_id")]
+ public string CreateId {get;set;}
+
+ ///
+ /// Desc:修改用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="modify_id")]
+ public string ModifyId {get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs b/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs
new file mode 100644
index 00000000..d62c9140
--- /dev/null
+++ b/Tnb.BasicData.Entitys/Entity/BasParentMaterial.cs
@@ -0,0 +1,129 @@
+using SqlSugar;
+using Tnb.Common.Contracts;
+
+namespace Tnb.BasicData.Entitys.Entity
+{
+ ///
+ ///物料清单父表
+ ///
+ [SugarTable("bas_parent_material")]
+ public class BasParentMaterial : BaseEntity
+ {
+ public BasParentMaterial(){
+
+
+ }
+ ///
+ /// Desc:主键
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(IsPrimaryKey=true,ColumnName="id")]
+ public string Id {get;set;}
+
+ ///
+ /// Desc:创建时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="create_time")]
+ public DateTime? CreateTime {get;set;}
+
+ ///
+ /// Desc:修改时间
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="modify_time")]
+ public DateTime? ModifyTime {get;set;}
+
+ ///
+ /// Desc:扩展字段
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="extras")]
+ public string Extras {get;set;}
+
+ ///
+ /// Desc:所属组织
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="org_id")]
+ public string OrgId {get;set;}
+
+ ///
+ /// Desc:成品物料编号/名称
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="material_id")]
+ public string MaterialId {get;set;}
+
+ ///
+ /// Desc:规格描述
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="descrip")]
+ public string Descrip {get;set;}
+
+ ///
+ /// Desc:数量
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="quantity")]
+ public string Quantity {get;set;}
+
+ ///
+ /// Desc:单位
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="unit")]
+ public string Unit {get;set;}
+
+ ///
+ /// Desc:状态
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="status")]
+ public string Status {get;set;}
+
+ ///
+ /// Desc:版本号
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="version")]
+ public string Version {get;set;}
+
+ ///
+ /// Desc:工艺路线
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="routing")]
+ public string Routing {get;set;}
+
+ ///
+ /// Desc:创建用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="create_id")]
+ public string CreateId {get;set;}
+
+ ///
+ /// Desc:修改用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="modify_id")]
+ public string ModifyId {get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs b/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs
new file mode 100644
index 00000000..d3d7cc48
--- /dev/null
+++ b/Tnb.BasicData.Entitys/Entity/BasParentMaterialItems.cs
@@ -0,0 +1,121 @@
+using SqlSugar;
+using Tnb.Common.Contracts;
+
+namespace Tnb.BasicData.Entitys.Entity
+{
+ ///
+ ///物料清单子表
+ ///
+ [SugarTable("bas_parent_material_items")]
+ public class BasParentMaterialItems : BaseEntity
+ {
+ public BasParentMaterialItems(){
+
+
+ }
+ ///
+ /// Desc:主键
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(IsPrimaryKey=true,ColumnName="id")]
+ public string Id {get;set;}
+
+ ///
+ /// Desc:扩展字段
+ /// Default:
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="extras")]
+ public string Extras {get;set;}
+
+ ///
+ /// Desc:父件物料ID
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="parent_material_id")]
+ public string ParentMaterialId {get;set;}
+
+ ///
+ /// Desc:物料编号/名称
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="material_id")]
+ public string MaterialId {get;set;}
+
+ ///
+ /// Desc:规格描述
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="descrip")]
+ public string Descrip {get;set;}
+
+ ///
+ /// Desc:单位
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="unit")]
+ public string Unit {get;set;}
+
+ ///
+ /// Desc:数量
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="quantity")]
+ public string Quantity {get;set;}
+
+ ///
+ /// Desc:损耗率
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="loss_rate")]
+ public string LossRate {get;set;}
+
+ ///
+ /// Desc:替代物料
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="substitute_material")]
+ public string SubstituteMaterial {get;set;}
+
+ ///
+ /// Desc:投料管控
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="feeding_control")]
+ public string FeedingControl {get;set;}
+
+ ///
+ /// Desc:需要称量
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="require_weight")]
+ public string RequireWeight {get;set;}
+
+ ///
+ /// Desc:版本号
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="version")]
+ public string Version {get;set;}
+
+ ///
+ /// Desc:工艺路线
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ [SugarColumn(ColumnName="routing")]
+ public string Routing {get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/Tnb.BasicData/ParentMaterialService.cs b/Tnb.BasicData/ParentMaterialService.cs
new file mode 100644
index 00000000..9bc16c38
--- /dev/null
+++ b/Tnb.BasicData/ParentMaterialService.cs
@@ -0,0 +1,96 @@
+using JNPF.Common.Core.Manager;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.Systems.Entitys.System;
+using JNPF.Systems.Interfaces.System;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Tnb.BasicData.Entitys;
+using Tnb.BasicData.Entitys.Entity;
+using Tnb.BasicData.Entitys.Dto;
+
+namespace Tnb.BasicData
+{
+ ///
+ /// 物料清单
+ ///
+ [ApiDescriptionSettings(Tag = "BasicData", Name = "ParentMaterial", Order = 701)]
+ [Route("api/basic/[controller]")]
+ public class ParentMaterialService : IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+ private readonly DataBaseManager _dbManager;
+ private readonly IDictionaryDataService _dictionaryDataService;
+
+ public ParentMaterialService(
+ ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
+ {
+ _repository = repository;
+ _dbManager = dbManager;
+ _dictionaryDataService = dictionaryDataService;
+ }
+
+ ///
+ /// 获取物料清单树.
+ ///
+ /// 获取物料清单树.
+ ///
+ [HttpPost("[action]")]
+ public async Task GetTree(ParentMaterialTreeQueryInput queryInput)
+ {
+ var db = _repository.AsSugarClient();
+ var dic = await _dictionaryDataService.GetDicByKey(DicTypeKey.MeasurementUnit);
+
+ var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == DbName.TNBMON);
+ if (momDbLink != null)
+ {
+ db = _dbManager.ChangeDataBase(momDbLink);
+ }
+
+ if (string.IsNullOrEmpty(queryInput.materialId))
+ {
+ var data = await db.Queryable()
+ .LeftJoin((a,b)=>a.ParentMaterialId==b.Id)
+ .LeftJoin((a,b,c)=>a.MaterialId==c.Id)
+ .Where((a,b,c)=>a.ParentMaterialId==queryInput.parentMaterialId)
+ .Select((a,b,c)=>new ParentMaterialTreeOutput
+ {
+ material_id = c.MaterialName,
+ material_id_extras = c.Extras,
+ material_id_id=c.Id,
+ material_id_minpacking = c.Minpacking,
+ material_id_remark = c.Remark,
+ material_id_unitid = c.Unitid,
+ hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(),
+ }).Mapper(it =>
+ {
+ it.material_id_unitid = dic[it.material_id_unitid].ToString();
+ }).ToListAsync();
+ return data;
+ }
+ else
+ {
+ var data = await db.Queryable()
+ .LeftJoin((a,b)=>a.ParentMaterialId==b.Id)
+ .LeftJoin((a,b,c)=>a.MaterialId==c.Id)
+ .Where((a,b,c)=>b.MaterialId==queryInput.materialId && a.ParentMaterialId==b.Id)
+ .Select((a,b,c)=>new ParentMaterialTreeOutput
+ {
+ material_id = c.MaterialName,
+ material_id_extras = c.Extras,
+ material_id_id=c.Id,
+ material_id_minpacking = c.Minpacking,
+ material_id_remark = c.Remark,
+ material_id_unitid = c.Unitid,
+ hasChildren = SqlFunc.Subqueryable().Where(x=>x.MaterialId==a.MaterialId).Any(),
+ }).Mapper(it =>
+ {
+ it.material_id_unitid = dic[it.material_id_unitid].ToString();
+ }).ToListAsync();
+ return data;
+ }
+
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs b/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs
index 6f853916..3a0a4abb 100644
--- a/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs
+++ b/system/Tnb.Systems.Interfaces/System/IDictionaryDataService.cs
@@ -24,4 +24,11 @@ public interface IDictionaryDataService
/// 主键id.
///
Task GetInfo(string id);
+
+ ///
+ /// 根据key获取字典
+ ///
+ ///
+ ///
+ Task> GetDicByKey(string key);
}
\ No newline at end of file
diff --git a/system/Tnb.Systems/System/DictionaryDataService.cs b/system/Tnb.Systems/System/DictionaryDataService.cs
index efec0a69..b82487da 100644
--- a/system/Tnb.Systems/System/DictionaryDataService.cs
+++ b/system/Tnb.Systems/System/DictionaryDataService.cs
@@ -327,6 +327,15 @@ public class DictionaryDataService : IDictionaryDataService, IDynamicApiControll
{
return await _repository.GetFirstAsync(x => x.Id == id && x.DeleteMark == null);
}
+
+ public async Task> GetDicByKey(string key)
+ {
+ return await _repository.AsSugarClient().Queryable()
+ .LeftJoin((a, b) => a.DictionaryTypeId == b.Id)
+ .Where((a, b) => b.EnCode == key && b.DeleteMark == null)
+ .ToDictionaryAsync((it)=>it.EnCode,it=>it.FullName);
+ }
+
#endregion
#region PrivateMethod