排产至工位 pc端注塑挤出任务管理 组装包装任务管理添加工位过滤
This commit is contained in:
84
BasicData/Tnb.BasicData/BasQrcodeService.cs
Normal file
84
BasicData/Tnb.BasicData/BasQrcodeService.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.BasicData.Entitys.Dto.BasProcess;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
/// <summary>
|
||||
/// 二维码
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class BasQrcodeService : IBasQrcodeService,IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<BasMaterial> _repository;
|
||||
private readonly DataBaseManager _dbManager;
|
||||
private readonly IDictionaryDataService _dictionaryDataService;
|
||||
|
||||
public BasQrcodeService(
|
||||
ISqlSugarRepository<BasMaterial> repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
|
||||
{
|
||||
_repository = repository;
|
||||
_dbManager = dbManager;
|
||||
_dictionaryDataService = dictionaryDataService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetQrcodeByCode(Dictionary<string, string> dic)
|
||||
{
|
||||
string code = dic.ContainsKey("code") ? dic["code"] : "";
|
||||
if (string.IsNullOrEmpty(code)) return null;
|
||||
var result = await _repository.AsSugarClient().Queryable<BasQrcode>()
|
||||
.LeftJoin<OrganizeEntity>((a, b) => a.source_id == b.Id)
|
||||
.LeftJoin<EqpEquipment>((a, b, c) => a.source_id == c.id)
|
||||
.LeftJoin<ToolLocation>((a, b, c, d) => a.source_id == d.id)
|
||||
.Where((a, b, c, d) => a.code == code)
|
||||
.Select((a, b, c, d) => new
|
||||
{
|
||||
id = a.id,
|
||||
source_id = a.source_id,
|
||||
source_name = a.source_name,
|
||||
org_code = b.EnCode,
|
||||
org_name = b.FullName,
|
||||
equip_code = a.code,
|
||||
equip_name = c.name,
|
||||
tool_location_code = d.location_code,
|
||||
}).FirstAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetWorkStationByCode(Dictionary<string, string> dic)
|
||||
{
|
||||
string code = dic.ContainsKey("code") ? dic["code"] : "";
|
||||
if (string.IsNullOrEmpty(code)) return null;
|
||||
var result = await _repository.AsSugarClient().Queryable<BasQrcode>()
|
||||
.LeftJoin<OrganizeEntity>((a, b) => a.source_id == b.Id)
|
||||
.LeftJoin<OrganizeRelationEntity>((a,b,c)=>a.source_id==c.ObjectId && c.ObjectType=="Eqp")
|
||||
.LeftJoin<OrganizeEntity>((a,b,c,d)=>c.OrganizeId==d.Id)
|
||||
.Where((a, b, c) => a.code == code)
|
||||
.Select((a, b, c,d) => new
|
||||
{
|
||||
id = a.id,
|
||||
source_id = a.source_id,
|
||||
source_name = a.source_name,
|
||||
org_id = b.Id,
|
||||
org_code = b.EnCode,
|
||||
org_name = b.FullName,
|
||||
org_id2 = d.Id,
|
||||
org_code2 = d.EnCode,
|
||||
org_name2 = d.FullName,
|
||||
}).FirstAsync();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user