修改命名空间

This commit is contained in:
2023-04-26 16:25:40 +08:00
parent 631bb0c0e8
commit a2eb375553
21 changed files with 805 additions and 198 deletions

View File

@@ -1,12 +1,10 @@
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.Entities;
namespace Tnb.BasicData
{
@@ -29,60 +27,62 @@ namespace Tnb.BasicData
_dictionaryDataService = dictionaryDataService;
}
[HttpPost]
public async Task<Dictionary<string,string>> GetEbomVersionAndRouteName(string materialId)
{
var db = _repository.AsSugarClient();
var dic = await _dictionaryDataService.GetDicByKey(DictConst.MeasurementUnit);
// var momDbLink = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(x => x.FullName == DbName.TNBMON);
// if (momDbLink != null)
// {
// db = _dbManager.ChangeDataBase(momDbLink);
// }
var ebom = await db.Queryable<BasEbomH>()
.LeftJoin<BasRoute>((a,b)=>a.route_id==b.id)
.Where((a,b) => a.material_id == materialId)
.Select((a,b)=>new
{
a.id,
a.version,
b.Name,
}).SingleAsync();
return new Dictionary<string,string>()
{
["version"] = ebom?.version,
["routeName"] = ebom?.Name,
["routeId"] = ebom?.id
};
}
// [HttpPost]
// public async Task<Dictionary<string,string>> GetEbomVersionAndRouteName(Dictionary<string,string> parameters)
// {
// string materialId = parameters["materialId"];
// var db = _repository.AsSugarClient();
// var dic = await _dictionaryDataService.GetDicByKey(DicTypeKey.MeasurementUnit);
// // var momDbLink = await _repository.AsSugarClient().Queryable<DbLinkEntity>().FirstAsync(x => x.FullName == DbName.TNBMON);
// // if (momDbLink != null)
// // {
// // db = _dbManager.ChangeDataBase(momDbLink);
// // }
//
// var ebom = await db.Queryable<BasEbomH>()
// .LeftJoin<BasRouteH>((a,b)=>a.route_id==b.id)
// .Where((a,b) => a.material_id == materialId)
// .Select((a,b)=>new
// {
// a.id,
// a.version,
// b.name,
// }).SingleAsync();
// return new Dictionary<string,string>()
// {
// ["version"] = ebom?.version,
// ["routeName"] = ebom?.name,
// ["routeId"] = ebom?.id
// };
// }
[HttpPost]
public async Task<List<ElementSelectDto>> GetMaterialUnits(string materialId)
{
var db = _repository.AsSugarClient();
var type = await db.Queryable<DictionaryTypeEntity>().Where(x => x.EnCode == DictConst.MeasurementUnit)
.SingleAsync();
string typeId = type?.Id;
var queryable1 = db.Queryable<BasMaterial>()
.LeftJoin<DictionaryDataEntity>((a,b)=>a.unit_id==b.EnCode && b.DictionaryTypeId==typeId)
.Where((a,b) => a.id == materialId)
.Select((a,b)=> new ElementSelectDto
{
value = b.EnCode,
label = b.FullName,
});
var queryable2 = db.Queryable<BasMaterial>()
.LeftJoin<DictionaryDataEntity>((a,b)=>a.pickunit_id==b.EnCode && b.DictionaryTypeId==typeId)
.Where((a,b) => a.id == materialId)
.Select((a,b)=> new ElementSelectDto
{
value = b.EnCode,
label = b.FullName,
});
List<ElementSelectDto> data = await db.Union(queryable1, queryable2).ToListAsync();
return data;
}
// [HttpPost]
// public async Task<List<ElementSelectDto>> GetMaterialUnits(Dictionary<string,string> parameters)
// {
// string materialId = parameters["materialId"];
// var db = _repository.AsSugarClient();
//
// var type = await db.Queryable<DictionaryTypeEntity>().Where(x => x.EnCode == DictConst.MeasurementUnit)
// .SingleAsync();
// string typeId = type?.Id;
// var queryable1 = db.Queryable<BasMaterial>()
// .LeftJoin<DictionaryDataEntity>((a,b)=>a.unit_id==b.EnCode && b.DictionaryTypeId==typeId)
// .Where((a,b) => a.Id == materialId)
// .Select((a,b)=> new ElementSelectDto
// {
// value = b.EnCode,
// label = b.FullName,
// });
// var queryable2 = db.Queryable<BasMaterial>()
// .LeftJoin<DictionaryDataEntity>((a,b)=>a.pickunit_id==b.EnCode && b.DictionaryTypeId==typeId)
// .Where((a,b) => a.Id == materialId)
// .Select((a,b)=> new ElementSelectDto
// {
// value = b.EnCode,
// label = b.FullName,
// });
// List<ElementSelectDto> data = await db.Union(queryable1, queryable2).ToListAsync();
// return data;
// }
}
}