diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs
new file mode 100644
index 00000000..d385c1bc
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class RelevanceMoldListOutput
+ {
+
+ ///
+ /// Desc:模具编号
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string mold_code { get; set; }
+
+ ///
+ /// Desc:模具名称
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string mold_name { get; set; }
+
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs
new file mode 100644
index 00000000..98b11fef
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ ///
+ /// 关联保养组与模具输入参数
+ ///
+ public class MoldMaintainGroupItemRelationInput
+ {
+ ///
+ /// 项目组Id
+ ///
+ public string item_group_id { get; set; }
+ ///
+ /// 模具Id
+ ///
+ public string mold_id { get; set; }
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs
new file mode 100644
index 00000000..75205ae8
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ ///
+ /// 模具保养项输入参数
+ ///
+ public class MoldMaintainGroupItemInput
+ {
+ ///
+ /// 项目组Id
+ ///
+ public string item_group_id { get; set; }
+ ///
+ /// 保养项Id
+ ///
+ public string item_id { get; set; }
+
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs
new file mode 100644
index 00000000..93eefae1
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ ///
+ /// 模具保养项列表输出
+ ///
+ public class MoldMaintainItemListOutput
+ {
+ ///
+ /// 项目名称
+ ///
+ public string name { get; set; }
+ public string descrip { get; set; }
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/MoldMaintenance.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/MoldMaintenance.cs
new file mode 100644
index 00000000..c2a6290f
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/MoldMaintenance.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Linq;
+using System.Text;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities
+{
+ ///
+ ///模具保养
+ ///
+ [SugarTable("mold_maintenance")]
+ public partial class MoldMaintenance
+ {
+ public MoldMaintenance(){
+
+
+ }
+ ///
+ /// Desc:编号
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(IsPrimaryKey=true)]
+ public string id {get;set;}
+
+ ///
+ /// Desc:所属组织
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? org_id {get;set;}
+
+ ///
+ /// Desc:项目
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? name {get;set;}
+
+ ///
+ /// Desc:描述
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? descrip {get;set;}
+
+ ///
+ /// Desc:备注
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? remark {get;set;}
+
+ ///
+ /// Desc:查看照片
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? image {get;set;}
+
+ ///
+ /// Desc:扩展
+ /// Default:
+ /// Nullable:True
+ ///
+ public string? extras {get;set;}
+
+ ///
+ /// Desc:创建用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? create_id {get;set;}
+
+ ///
+ /// Desc:创建时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime? create_time {get;set;}
+
+ ///
+ /// Desc:修改用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? modify_id {get;set;}
+
+ ///
+ /// Desc:修改时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime? modify_time {get;set;}
+
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainGroupItem.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainGroupItem.cs
index ba9005e9..54a71d1d 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainGroupItem.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainGroupItem.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Text;
using JNPF.Common.Security;
using SqlSugar;
+using Tnb.Common.Contracts;
namespace Tnb.EquipMgr.Entities
{
@@ -16,11 +17,11 @@ namespace Tnb.EquipMgr.Entities
}
- ///
+ ///
/// Desc:主键
- /// Default:
- /// Nullable:False
- ///
+ /// Default:
+ /// Nullable:False
+ ///
[SugarColumn(IsPrimaryKey=true)]
public string id {get;set;} = SnowflakeIdHelper.NextId();
@@ -31,11 +32,11 @@ namespace Tnb.EquipMgr.Entities
///
public string? item_group_id {get;set;}
- ///
- /// Desc:保养项id
+ ///
+ /// Desc:保养项id
/// Default:NULL::character varying
- /// Nullable:True
- ///
+ /// Nullable:True
+ ///
public string? item_id {get;set;}
}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainGroupRelation.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainGroupRelation.cs
index 1c0430f4..b303a251 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainGroupRelation.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainGroupRelation.cs
@@ -3,6 +3,7 @@ using System.Linq;
using System.Text;
using JNPF.Common.Security;
using SqlSugar;
+using Tnb.Common.Contracts;
namespace Tnb.EquipMgr.Entities
{
@@ -14,7 +15,7 @@ namespace Tnb.EquipMgr.Entities
{
public ToolMoldMaintainGroupRelation(){
-
+
}
///
/// Desc:主键
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs b/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs
new file mode 100644
index 00000000..47984fa8
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs
@@ -0,0 +1,13 @@
+using Mapster;
+using Tnb.EquipMgr.Entities.Dto;
+using Tnb.EquipMgr.Entities;
+
+namespace Tnb.EquipMgr.Entities.Mapper
+{
+ public class Mapper : IRegister
+ {
+ public void Register(TypeAdapterConfig config)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainGroupService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainGroupService.cs
new file mode 100644
index 00000000..e3a9aa6d
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainGroupService.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Interfaces
+{
+ ///
+ /// 模具保养项目组接口
+ ///
+ public interface IToolMoldMaintainGroupService
+ {
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj b/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj
index 03958fba..b8cc1764 100644
--- a/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj
+++ b/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj
@@ -5,6 +5,7 @@
net6.0
enable
enable
+ True
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs
new file mode 100644
index 00000000..8a5e733c
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Aspose.Cells.Drawing;
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Enums;
+using JNPF.Common.Security;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.FriendlyException;
+using Mapster;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Tnb.Common.Contracts;
+using Tnb.EquipMgr.Entities;
+using Tnb.EquipMgr.Entities.Dto;
+using Tnb.EquipMgr.Entities.Entity;
+using Tnb.EquipMgr.Interfaces;
+
+namespace Tnb.EquipMgr
+{
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+
+ public class ToolMoldMaintainGroupService : IToolMoldMaintainGroupService, IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+ private readonly IUserManager _userManager;
+ private readonly ISqlSugarClient _db;
+ public ToolMoldMaintainGroupService(ISqlSugarRepository repository, IUserManager userManager)
+ {
+ _repository = repository;
+ _userManager = userManager;
+ _db = repository.AsSugarClient();
+ }
+
+ #region Get
+ ///
+ /// 根据项目组Id获取关联保养项信息
+ ///
+ ///
+ ///
+ [HttpGet("{itemGroupId}")]
+ public async Task GetMaintianItemListByGroupId(string itemGroupId)
+ {
+ var list = new List();
+ var itemIds = await _db.Queryable().Where(it => it.item_group_id == itemGroupId).Select(it => it.item_id).ToListAsync();
+ if (itemIds?.Count > 0)
+ {
+ var items = await _db.Queryable().Where(it => itemIds.Contains(it.id)).ToListAsync();
+ list = items.Adapt>();
+ }
+ return list;
+ }
+ ///
+ /// 根据项目组Id获取关联模具信息
+ ///
+ ///
+ ///
+ [HttpGet("{itemGroupId}")]
+ public async Task GetMoldListByGroupId(string itemGroupId)
+ {
+ var list = new List();
+ var moldIds = await _db.Queryable().Where(it => it.item_group_id == itemGroupId).Select(it => it.mold_id).ToListAsync();
+ if (moldIds?.Count > 0)
+ {
+ var items = await _db.Queryable().Where(it => moldIds.Contains(it.id)).ToListAsync();
+ list = items.Adapt>();
+ }
+ return list;
+ }
+ #endregion
+
+
+ #region Post
+ ///
+ /// 关联保养组与保养项
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task RelevanceMaintianGroupAndItem(MoldMaintainGroupItemInput input) =>
+ await Relevance(input);
+
+ ///
+ /// 关联项目组与模具
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task RelevanceMaintianGroupAndMold(MoldMaintainGroupItemRelationInput input) =>
+ await Relevance(input);
+
+
+
+ #endregion
+
+ private async Task Relevance(TSrc input) where TDest : BaseEntity, new()
+ {
+ if (input == null) throw new ArgumentNullException(nameof(input));
+ var entity = input.Adapt();
+ entity.id = SnowflakeIdHelper.NextId();
+ var row = await _db.Insertable(entity).ExecuteCommandAsync();
+ if (row < 1) throw Oops.Oh(ErrorCode.COM1000);
+ }
+ }
+}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 79d2f067..d2d17fbf 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -543,23 +543,23 @@ namespace Tnb.ProductionMgr
if (schedQty.HasValue && schedQty.Value >= mo.plan_qty)
{
mo.mo_status = DictConst.AlreadyId;
- row = await db.Updateable(mo).ExecuteCommandAsync();
}
else
{
if (schedQty.HasValue)
mo.scheduled_qty = schedQty.Value;
}
+ row = await db.Updateable(mo).ExecuteCommandAsync();
}
var material = await db.Queryable().FirstAsync(it => it.id == moTask.material_id);
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
- taskLog.mo_code = (await db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code;
- taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.eqp_id))?.code;
- taskLog.mold_code = (await db.Queryable().FirstAsync(it => it.id == input.mold_id))?.mold_code;
- taskLog.item_code = material?.code;
- taskLog.item_standard = material?.material_standard;
+ taskLog.mo_code = (await db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code!;
+ taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.eqp_id))?.code!;
+ taskLog.mold_code = (await db.Queryable().FirstAsync(it => it.id == input.mold_id))?.mold_code!;
+ taskLog.item_code = material?.code!;
+ taskLog.item_standard = material?.material_standard!;
taskLog.status = DictConst.ToBeScheduledEncode;
taskLog.operator_name = _userManager.RealName;
taskLog.create_id = _userManager.UserId;
@@ -571,10 +571,10 @@ namespace Tnb.ProductionMgr
//将生产任务插入到自检报废记录表
var sacipRecord = new PrdMoTaskDefectRecord();
sacipRecord.id = SnowflakeIdHelper.NextId();
- sacipRecord.material_code = material?.code;
- sacipRecord.material_name = material?.name;
- sacipRecord.eqp_code = (await db.Queryable().FirstAsync(it => it.id == moTask.eqp_id))?.code;
- sacipRecord.mold_name = (await db.Queryable().FirstAsync(it => it.id == moTask.mold_id))?.mold_name;
+ sacipRecord.material_code = material?.code!;
+ sacipRecord.material_name = material?.name!;
+ sacipRecord.eqp_code = (await db.Queryable().FirstAsync(it => it.id == moTask.eqp_id))?.code!;
+ sacipRecord.mold_name = (await db.Queryable().FirstAsync(it => it.id == moTask.mold_id))?.mold_name!;
sacipRecord.estimated_start_date = moTask.plan_start_date;
sacipRecord.estimated_end_date = moTask.plan_end_date;
sacipRecord.plan_qty = moTask.plan_qty;
@@ -719,11 +719,9 @@ namespace Tnb.ProductionMgr
//添加生产任务操作记录日志s
var taskLog = new PrdTaskLog();
taskLog.id = SnowflakeIdHelper.NextId();
- taskLog.mo_code = (await _db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code;
- //taskLog.eqp_code = (await _db.Queryable().FirstAsync(it => it.id == input.eqp_id))?.code;
- //taskLog.mold_code = (await _db.Queryable().FirstAsync(it => it.id == input.mold_id))?.mold_code;
- taskLog.item_code = material_h?.code;
- taskLog.item_standard = material_h?.material_standard;
+ taskLog.mo_code = (await _db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code!;
+ taskLog.item_code = material_h?.code!;
+ taskLog.item_standard = material_h?.material_standard!;
taskLog.status = DictConst.ToBeScheduledEncode;
taskLog.operator_name = _userManager.RealName;
taskLog.create_id = _userManager.UserId;
@@ -888,21 +886,21 @@ namespace Tnb.ProductionMgr
{
if (taskItem.mo_id.IsNotEmptyOrNull())
{
- taskLog.mo_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.mo_id))?.mo_code;
+ taskLog.mo_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.mo_id))?.mo_code!;
}
if (taskItem.eqp_id.IsNotEmptyOrNull())
{
- taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.eqp_id))?.code;
+ taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.eqp_id))?.code!;
}
if (taskItem.mold_id.IsNotEmptyOrNull())
{
- taskLog.mold_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.mold_id))?.mold_code;
+ taskLog.mold_code = (await db.Queryable().FirstAsync(it => it.id == taskItem.mold_id))?.mold_code!;
}
if (taskItem.material_id.IsNotEmptyOrNull())
{
var material = await db.Queryable().FirstAsync(it => it.id == taskItem.material_id);
- taskLog.item_code = material?.code;
- taskLog.item_standard = material?.material_standard;
+ taskLog.item_code = material?.code!;
+ taskLog.item_standard = material?.material_standard!;
}
taskLog.operator_name = _userManager.RealName;
taskLog.status = status;
@@ -952,7 +950,7 @@ namespace Tnb.ProductionMgr
{
var eqpItem = await db.Queryable().FirstAsync(it => it.id == icmoItem.eqp_id);
icmoItem.eqp_id = eqpItem.id;
- icmoItem.eqp_type_code = db.Queryable().First(it => it.id == eqpItem.equip_type_id)?.code;
+ icmoItem.eqp_type_code = db.Queryable().First(it => it.id == eqpItem.equip_type_id)?.code!;
//if (input.scheduled_qty > icmoItem.plan_qty)
//{
// throw new AppFriendlyException("任务单数量不能大于计划数量", 500);