组织管理,新增设备与工位绑定、解绑功能
This commit is contained in:
@@ -44,6 +44,10 @@ namespace Tnb.EquipMgr.Entities
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string eqp_type_code { get; set; }
|
||||
/// <summary>
|
||||
/// 设备机台号
|
||||
/// </summary>
|
||||
public string eqp_machine_num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:验收状态(合格:Qualified/不合格:Unqualified)
|
||||
|
||||
@@ -11,6 +11,22 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
/// </summary>
|
||||
public class EquipmentListOutput //: EqpEquipment 不能直接继承实体类
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备Id
|
||||
/// </summary>
|
||||
public string eqp_id { get; set; }
|
||||
/// <summary>
|
||||
/// 设备编码
|
||||
/// </summary>
|
||||
public string eqp_code { get; set; }
|
||||
/// <summary>
|
||||
/// 设备类型编码
|
||||
/// </summary>
|
||||
public string eqp_type_code { get; set; }
|
||||
/// <summary>
|
||||
/// 设备机台号
|
||||
/// </summary>
|
||||
public string eqp_machine_num { get; set; }
|
||||
/// <summary>
|
||||
/// 任务单数量
|
||||
/// </summary>
|
||||
@@ -22,7 +38,11 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
/// <summary>
|
||||
/// 最早开始时间
|
||||
/// </summary>
|
||||
public DateTime? first_date { get; set; }
|
||||
public string first_date { get; set; }
|
||||
/// <summary>
|
||||
/// 预计结束时间
|
||||
/// </summary>
|
||||
public DateTime? estimated_end_date { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
public class IcmoUpInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 类别 1、模具 2、设备
|
||||
/// 类别 1、设备 2、模具
|
||||
/// </summary>
|
||||
public int category { get; set; }
|
||||
/// <summary>
|
||||
|
||||
@@ -93,26 +93,24 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
var items = await _repository.AsSugarClient().Queryable<EqpEquipment>()
|
||||
.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<PrdTask>().Where(x => x.eqp_id == it.id).Count(),
|
||||
first_date = SqlFunc.Subqueryable<PrdTask>().Where(x => x.eqp_id == it.id).OrderByDesc(o => o.estimated_end_date).Select(x => x.estimated_end_date)
|
||||
estimated_end_date = SqlFunc.Subqueryable<PrdTask>().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<EqpEquipment>()
|
||||
// .InnerJoin<PrdTask>((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<PrdTask>().Where(it => it.eqp_id == a.id).Count(),
|
||||
// first_date = SqlFunc.Subqueryable<PrdTask>().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;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// 扩展属性.
|
||||
/// </summary>
|
||||
public string propertyJson { get; set; }
|
||||
public JObject propertyJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序码.
|
||||
|
||||
@@ -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<JArray>("roweqp"));
|
||||
var eqpIds = eqpList.Select(x => x.Value<string>("id")).ToList();
|
||||
|
||||
isOK = await _repository.AsSugarClient().Updateable<EqpEquipment>().SetColumns(it => new EqpEquipment { station_code = input.enCode }).Where(it => eqpIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
//工位与设备解绑操作
|
||||
var eqpEntities = await _repository.AsSugarClient().Queryable<EqpEquipment>().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<EqpEquipment>().SetColumns(it => new EqpEquipment { station_code = "" }).Where(it => unbindEqpIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
if (!(isOK > 0)) throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
}
|
||||
|
||||
#region 第三方同步
|
||||
try
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\common\Tnb.CollectiveOAuth\Tnb.CollectiveOAuth.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Interfaces\Tnb.EquipMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\message\Tnb.Message.Interfaces\Tnb.Message.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -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
|
||||
/// 高级查询.
|
||||
/// </summary>
|
||||
public virtual string superQueryJson { get; set; }
|
||||
/// <summary>
|
||||
/// 工位编码
|
||||
/// </summary>
|
||||
public string station_code { get; set; }
|
||||
/// <summary>
|
||||
/// 工序编码
|
||||
/// </summary>
|
||||
public string process_code { get; set; }
|
||||
}
|
||||
@@ -175,8 +175,15 @@ 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<MainBeltViceQueryModel>(), new List<IConditionalModel>(), tableFieldKeyValue);
|
||||
|
||||
|
||||
|
||||
// 显示列有子表字段
|
||||
if ((templateInfo.ColumnData.type != 4 || _userManager.UserOrigin.Equals("app")) && templateInfo.ColumnData.columnList.Any(x => templateInfo.ChildTableFields.ContainsKey(x.__vModel__)) && realList.list.Any())
|
||||
realList = await GetListChildTable(templateInfo, primaryKey, queryWhere, superQueryWhere, realList, pvalue);
|
||||
|
||||
Reference in New Issue
Block a user