注塑看板

This commit is contained in:
2024-08-22 16:59:00 +08:00
parent 21b789f1d3
commit 4cc1bf39dc
3 changed files with 52 additions and 37 deletions

View File

@@ -33,6 +33,8 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
public class EquipPieOutput public class EquipPieOutput
{ {
public string id { get; set; }
public string code { get; set; }
public string name { get; set; } public string name { get; set; }
public int value { get; set; } public int value { get; set; }

View File

@@ -14,6 +14,7 @@ using Tnb.BasicData.Entities;
using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities;
using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities;
using Tnb.ProductionMgr.Entities.Dto.PrdManage; using Tnb.ProductionMgr.Entities.Dto.PrdManage;
using Tnb.Common.Redis;
namespace Tnb.ProductionMgr namespace Tnb.ProductionMgr
{ {
@@ -23,12 +24,15 @@ namespace Tnb.ProductionMgr
{ {
private readonly ISqlSugarClient _db; private readonly ISqlSugarClient _db;
private readonly IUserManager _userManager; private readonly IUserManager _userManager;
private readonly RedisData2 _redisData;
public BiService(ISqlSugarRepository<Material> repository, public BiService(ISqlSugarRepository<Material> repository,
RedisData2 redisData,
IBillRullService billRuleService, IBillRullService billRuleService,
IUserManager userManager) IUserManager userManager)
{ {
_userManager = userManager; _userManager = userManager;
_redisData = redisData;
_db = repository.AsSugarClient(); _db = repository.AsSugarClient();
} }
@@ -115,20 +119,29 @@ namespace Tnb.ProductionMgr
output.equip_pie_list = await _db.Queryable<EqpEquipment>() output.equip_pie_list = await _db.Queryable<EqpEquipment>()
.GroupBy(x => x.status) .GroupBy(x => x.status)
.OrderBy(x=>x.code)
.Select(x => new EquipPieOutput .Select(x => new EquipPieOutput
{ {
name = x.status, name = x.status,
value = SqlFunc.AggregateCount(x.id) value = SqlFunc.AggregateCount(x.id)
}).ToListAsync(); })
.ToListAsync();
output.equip_info_list = await _db.Queryable<EqpEquipment>() output.equip_info_list = await _db.Queryable<EqpEquipment>()
.LeftJoin<EqpEquipType>((x,y)=>x.equip_type_id==y.id) .LeftJoin<EqpEquipType>((x,y)=>x.equip_type_id==y.id)
.Where((x,y)=>y.code=="ZSJ") .Where((x,y)=>y.code=="ZSJ")
.OrderBy(x=>x.code)
.Select(x => new EquipPieOutput .Select(x => new EquipPieOutput
{ {
code = x.code,
name = x.name, name = x.name,
status = x.status status = x.status
}).ToListAsync(); }).ToListAsync();
foreach (var item in output.equip_info_list)
{
item.status = _redisData.Get<string>($"{item.code}:ActstsMach");
}
return output; return output;
} }
} }

View File

@@ -423,42 +423,42 @@ namespace Tnb.QcMgr
GetQuery(Query, entity); GetQuery(Query, entity);
List<QcCheckPlanH> list = await Query.ToListAsync(); List<QcCheckPlanH> list = await Query.ToListAsync();
List<string> removes = new(); List<string> removes = new();
foreach (QcCheckPlanH data in list) // foreach (QcCheckPlanH data in list)
{ // {
if (!string.IsNullOrEmpty(entity.materialid)) // if (!string.IsNullOrEmpty(entity.materialid))
{ // {
if (_repository.AsSugarClient().Queryable<QcCheckPlanMaterial>().Where(p => p.planid == data.id).Any()) // if (_repository.AsSugarClient().Queryable<QcCheckPlanMaterial>().Where(p => p.planid == data.id).Any())
{ // {
if (!_repository.AsSugarClient().Queryable<QcCheckPlanMaterial>().Where(p => p.planid == data.id && p.materialid == entity.materialid).Any()) // if (!_repository.AsSugarClient().Queryable<QcCheckPlanMaterial>().Where(p => p.planid == data.id && p.materialid == entity.materialid).Any())
{ // {
removes.Add(data.id); // removes.Add(data.id);
} // }
} // }
} // }
if (!string.IsNullOrEmpty(entity.processid)) // if (!string.IsNullOrEmpty(entity.processid))
{ // {
if (_repository.AsSugarClient().Queryable<QcCheckPlanProcess>().Where(p => p.planid == data.id).Any()) // if (_repository.AsSugarClient().Queryable<QcCheckPlanProcess>().Where(p => p.planid == data.id).Any())
{ // {
if (!_repository.AsSugarClient().Queryable<QcCheckPlanProcess>().Where(p => p.planid == data.id && p.processid == entity.processid).Any()) // if (!_repository.AsSugarClient().Queryable<QcCheckPlanProcess>().Where(p => p.planid == data.id && p.processid == entity.processid).Any())
{ // {
removes.Add(data.id); // removes.Add(data.id);
} // }
//
// }
// }
// if (!string.IsNullOrEmpty(entity.workid))
// {
// if (_repository.AsSugarClient().Queryable<QcCheckPlanWork>().Where(p => p.planid == data.id).Any())
// {
// if (!_repository.AsSugarClient().Queryable<QcCheckPlanWork>().Where(p => p.planid == data.id && p.workid == entity.workid).Any())
// {
// removes.Add(data.id);
// }
// }
// }
// }
} // list = list.Where(p => !removes.Contains(p.id)).ToList();
}
if (!string.IsNullOrEmpty(entity.workid))
{
if (_repository.AsSugarClient().Queryable<QcCheckPlanWork>().Where(p => p.planid == data.id).Any())
{
if (!_repository.AsSugarClient().Queryable<QcCheckPlanWork>().Where(p => p.planid == data.id && p.workid == entity.workid).Any())
{
removes.Add(data.id);
}
}
}
}
list = list.Where(p => !removes.Contains(p.id)).ToList();
// .WhereIF(!string.IsNullOrEmpty(entity.materialid), (a, b, c, d, e) => c.materialid == entity.materialid) // .WhereIF(!string.IsNullOrEmpty(entity.materialid), (a, b, c, d, e) => c.materialid == entity.materialid)
// .WhereIF(!string.IsNullOrEmpty(entity.processid), (a, b, c, d, e) => d.processid == entity.processid) // .WhereIF(!string.IsNullOrEmpty(entity.processid), (a, b, c, d, e) => d.processid == entity.processid)
// .WhereIF(!string.IsNullOrEmpty(entity.workid), (a, b, c, d, e) => e.workid == entity.workid).ToListAsync(); // .WhereIF(!string.IsNullOrEmpty(entity.workid), (a, b, c, d, e) => e.workid == entity.workid).ToListAsync();
@@ -478,7 +478,7 @@ namespace Tnb.QcMgr
RemarkAttribute remark = RemarkAttribute.GetRemark(enumTriggerEvent); RemarkAttribute remark = RemarkAttribute.GetRemark(enumTriggerEvent);
string type = DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id; string type = DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id;
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == type && p.name == remark.CheckContent).First(); TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == type && p.name == remark.CheckContent).First();
Query = Query.Where((a, b, c, d, e) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id)); Query = Query.Where((a, b, c, d, e) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id) && c.materialid==entity.materialid);
} }
private void Filter(List<QcCheckPlanH> QcCheckPlanHs, TriggerPlanEntity entity) private void Filter(List<QcCheckPlanH> QcCheckPlanHs, TriggerPlanEntity entity)
{ {