diff --git a/EquipMgr/Tnb.EquipMgr.Entities/EqpEquipment.cs b/EquipMgr/Tnb.EquipMgr.Entities/EqpEquipment.cs index fd477e7f..6a33cb63 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/EqpEquipment.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/EqpEquipment.cs @@ -44,6 +44,10 @@ namespace Tnb.EquipMgr.Entities /// Nullable:False /// public string eqp_type_code { get; set; } + /// + /// 设备机台号 + /// + public string eqp_machine_num { get; set; } /// /// Desc:验收状态(合格:Qualified/不合格:Unqualified) diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/EquipmentListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/EquipmentListOutput.cs index 09c051ae..7b7f6228 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/EquipmentListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/EquipmentListOutput.cs @@ -11,6 +11,22 @@ namespace Tnb.ProductionMgr.Entities.Dto /// public class EquipmentListOutput //: EqpEquipment 不能直接继承实体类 { + /// + /// 设备Id + /// + public string eqp_id { get; set; } + /// + /// 设备编码 + /// + public string eqp_code { get; set; } + /// + /// 设备类型编码 + /// + public string eqp_type_code { get; set; } + /// + /// 设备机台号 + /// + public string eqp_machine_num { get; set; } /// /// 任务单数量 /// @@ -22,7 +38,11 @@ namespace Tnb.ProductionMgr.Entities.Dto /// /// 最早开始时间 /// - public DateTime? first_date { get; set; } + public string first_date { get; set; } + /// + /// 预计结束时间 + /// + public DateTime? estimated_end_date { get; set; } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/IcmoUpInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/IcmoUpInput.cs index e943d5b2..e02720a3 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/IcmoUpInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entitys/Dto/PrdManage/IcmoUpInput.cs @@ -12,7 +12,7 @@ namespace Tnb.ProductionMgr.Entities.Dto public class IcmoUpInput { /// - /// 类别 1、模具 2、设备 + /// 类别 1、设备 2、模具 /// public int category { get; set; } /// diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index d8b4255f..4da1bcf1 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -93,26 +93,24 @@ namespace Tnb.ProductionMgr { var items = await _repository.AsSugarClient().Queryable() .Where(it => it.mold_id == moldId) - .Select(it => new + .Select(it => new EquipmentListOutput { + eqp_id = it.id, eqp_code = it.eqp_code, eqp_type_code = it.eqp_type_code, + eqp_machine_num = it.eqp_machine_num, tonnage = it.tonnage, task_list_qty = SqlFunc.Subqueryable().Where(x => x.eqp_id == it.id).Count(), - first_date = SqlFunc.Subqueryable().Where(x => x.eqp_id == it.id).OrderByDesc(o => o.estimated_end_date).Select(x => x.estimated_end_date) + estimated_end_date = SqlFunc.Subqueryable().Where(x => x.eqp_id == it.id).OrderByDesc(o => o.estimated_end_date).Select(x => x.estimated_end_date) + }) + .Mapper(x => + { + x.first_date = x.estimated_end_date.HasValue ? x.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; }) .ToListAsync(); - //var items = await _repository.AsSugarClient().Queryable() - // .InnerJoin((a, b) => a.id == b.eqp_id) - // .Where((a, b) => a.mold_id == moldId) - // .Select((a, b) => new - // { - // eqp_code = a.eqp_code, - // eqp_type_code = a.eqp_type_code, - // tonnage = b.tonnage, - // task_list_qty = SqlFunc.Subqueryable().Where(it => it.eqp_id == a.id).Count(), - // first_date = SqlFunc.Subqueryable().Where(it => it.eqp_id == a.id).OrderByDesc(o => o.estimated_end_date).Select(it => it.estimated_end_date) - // }).ToListAsync(); + + + return items; } @@ -154,7 +152,8 @@ namespace Tnb.ProductionMgr comple_qty = x.comple_qty, item_name = x.item_name, mold_code = x.mold_code, - }).ToList(); + }) + .ToList(); return data; } /// @@ -483,7 +482,7 @@ namespace Tnb.ProductionMgr icmoItem.mold_cavity_qty = moldItem.cavity_qty; break; } - row = await db.Updateable(icmoItem).WhereColumns(it => new { input.icmo_id }).ExecuteCommandAsync(); + row = await db.Updateable(icmoItem).ExecuteCommandAsync(); return (row > 0); } diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs index d84b8dff..f1d38fef 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs @@ -1,5 +1,6 @@ using JNPF.DependencyInjection; using JNPF.Systems.Entitys.Model.Organize; +using Newtonsoft.Json.Linq; namespace JNPF.Systems.Entitys.Dto.Department; @@ -42,7 +43,7 @@ public class DepartmentCrInput /// /// 扩展属性. /// - public string propertyJson { get; set; } + public JObject propertyJson { get; set; } /// /// 排序码. diff --git a/system/Tnb.Systems/Permission/DepartmentService.cs b/system/Tnb.Systems/Permission/DepartmentService.cs index fb217eff..0a9c36d2 100644 --- a/system/Tnb.Systems/Permission/DepartmentService.cs +++ b/system/Tnb.Systems/Permission/DepartmentService.cs @@ -14,7 +14,10 @@ using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using SqlSugar; +using Tnb.EquipMgr.Entities; namespace JNPF.Systems; @@ -438,6 +441,27 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra int isOK = await _repository.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync(); if (!(isOK > 0)) throw Oops.Oh(ErrorCode.D2018); + //modified by ly on 20230426 处理工位信息,将工位插入到设备表 + if (input.category == "workstation") + { + var eqpObj = input.propertyJson; + var eqpList = (eqpObj.Value("roweqp")); + var eqpIds = eqpList.Select(x => x.Value("id")).ToList(); + + isOK = await _repository.AsSugarClient().Updateable().SetColumns(it => new EqpEquipment { station_code = input.enCode }).Where(it => eqpIds.Contains(it.id)).ExecuteCommandAsync(); + //工位与设备解绑操作 + var eqpEntities = await _repository.AsSugarClient().Queryable().Where(it => it.station_code == input.enCode).ToListAsync(); + if (eqpEntities?.Count > 0) + { + var unbindEqpIds = eqpEntities.Select(x => x.id).Except(eqpIds).ToList(); + if (unbindEqpIds?.Count > 0) + { + isOK = await _repository.AsSugarClient().Updateable().SetColumns(it => new EqpEquipment { station_code = "" }).Where(it => unbindEqpIds.Contains(it.id)).ExecuteCommandAsync(); + } + } + if (!(isOK > 0)) throw Oops.Oh(ErrorCode.COM1001); + + } #region 第三方同步 try diff --git a/system/Tnb.Systems/Tnb.Systems.csproj b/system/Tnb.Systems/Tnb.Systems.csproj index 3ffa817c..4c07eac7 100644 --- a/system/Tnb.Systems/Tnb.Systems.csproj +++ b/system/Tnb.Systems/Tnb.Systems.csproj @@ -10,6 +10,7 @@ + diff --git a/visualdev/Tnb.VisualDev.Entitys/Dto/VisualDevModelData/VisualDevModelListQueryInput.cs b/visualdev/Tnb.VisualDev.Entitys/Dto/VisualDevModelData/VisualDevModelListQueryInput.cs index b7dcda8e..f05956df 100644 --- a/visualdev/Tnb.VisualDev.Entitys/Dto/VisualDevModelData/VisualDevModelListQueryInput.cs +++ b/visualdev/Tnb.VisualDev.Entitys/Dto/VisualDevModelData/VisualDevModelListQueryInput.cs @@ -1,4 +1,5 @@ -using JNPF.Common.Filter; +using System.DirectoryServices.Protocols; +using JNPF.Common.Filter; namespace JNPF.VisualDev.Entitys.Dto.VisualDevModelData; @@ -26,4 +27,12 @@ public class VisualDevModelListQueryInput : PageInputBase /// 高级查询. /// public virtual string superQueryJson { get; set; } + /// + /// 工位编码 + /// + public string station_code { get; set; } + /// + /// 工序编码 + /// + public string process_code { get; set; } } \ No newline at end of file diff --git a/visualdev/Tnb.VisualDev/RunService.cs b/visualdev/Tnb.VisualDev/RunService.cs index 26bfe6de..45a4b0a5 100644 --- a/visualdev/Tnb.VisualDev/RunService.cs +++ b/visualdev/Tnb.VisualDev/RunService.cs @@ -175,7 +175,14 @@ public class RunService : IRunService, ITransient input.queryJson = GetQueryJson(input.queryJson, _userManager.UserOrigin == "pc" ? templateInfo.ColumnData : templateInfo.AppColumnData).ToJsonString(); input.superQueryJson = GetSuperQueryJson(input.superQueryJson).ToJsonString(); + //modified by ly on 20230426 + if (!input.station_code.IsNullOrWhiteSpace()) + { + sql += $" where station_code='{input.station_code}' or station_code=''"; + } realList = _databaseService.GetInterFaceData(link, sql, input, templateInfo.ColumnData.Adapt(), new List(), tableFieldKeyValue); + + // 显示列有子表字段 if ((templateInfo.ColumnData.type != 4 || _userManager.UserOrigin.Equals("app")) && templateInfo.ColumnData.columnList.Any(x => templateInfo.ChildTableFields.ContainsKey(x.__vModel__)) && realList.list.Any())