From 3978cc9e3a990d9ef46071a8dbcc5015bf348c56 Mon Sep 17 00:00:00 2001
From: qianjiawei <1184704771@qq.com>
Date: Wed, 17 May 2023 16:52:55 +0800
Subject: [PATCH 1/6] =?UTF-8?q?=E6=A8=A1=E5=85=B7=E7=89=A9=E6=96=99?=
=?UTF-8?q?=E5=85=B3=E8=81=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...cttListOutput.cs => MaterialListOutput.cs} | 11 +-
.../Dto/ToolMoldInput.cs | 4 +-
.../Entity/BasMaterial.cs | 352 ++++++++++++++++++
...olMoldsProduct.cs => ToolMoldsMaterial.cs} | 22 +-
...Service.cs => IToolMoldMaterialService.cs} | 12 +-
...tService.cs => ToolMoldMaterialService.cs} | 73 ++--
EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs | 5 +-
7 files changed, 412 insertions(+), 67 deletions(-)
rename EquipMgr/Tnb.EquipMgr.Entities/Dto/{ProducttListOutput.cs => MaterialListOutput.cs} (70%)
create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/BasMaterial.cs
rename EquipMgr/Tnb.EquipMgr.Entities/Entity/{ToolMoldsProduct.cs => ToolMoldsMaterial.cs} (75%)
rename EquipMgr/Tnb.EquipMgr.Interfaces/{IToolMoldProductService.cs => IToolMoldMaterialService.cs} (82%)
rename EquipMgr/Tnb.EquipMgr/{ToolMoldProductService.cs => ToolMoldMaterialService.cs} (70%)
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ProducttListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaterialListOutput.cs
similarity index 70%
rename from EquipMgr/Tnb.EquipMgr.Entities/Dto/ProducttListOutput.cs
rename to EquipMgr/Tnb.EquipMgr.Entities/Dto/MaterialListOutput.cs
index f4561ecb..bf1d1328 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ProducttListOutput.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaterialListOutput.cs
@@ -7,15 +7,14 @@ using System.Threading.Tasks;
namespace Tnb.EquipMgr.Entities.Dto
{
///
- /// 产品列表输出类
+ /// 物料列表输出类
///
- public class ProductListOutput
+ public class MaterialListOutput
{
public string id { get; set; }
- public string product_code { get; set; }
- public string product_name { get; set; }
- public string product_standard { get; set; }
- public string product_group { get; set; }
+ public string code { get; set; }
+ public string name { get; set; }
+ public string material_group { get; set; }
public int real_cavity_qty { get; set; }
}
///
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolMoldInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolMoldInput.cs
index 5b7ea819..64a6e2f7 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolMoldInput.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolMoldInput.cs
@@ -10,9 +10,9 @@ namespace Tnb.EquipMgr.Entities.Dto
{
public string mold { get; set; }
public string[] equipid { get; set; }
- public string productid { get; set; }
+ public string materialid { get; set; }
public int real_cavity_qty { get; set; }
- public string[] productids { get; set; }
+ public string[] materialids { get; set; }
public string[] molds { get; set; }
}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/BasMaterial.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/BasMaterial.cs
new file mode 100644
index 00000000..5e2a0e26
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/BasMaterial.cs
@@ -0,0 +1,352 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SqlSugar;
+using Tnb.Common.Contracts;
+
+namespace Tnb.EquipMgr.Entities.Entity
+{
+ ///
+ ///物料信息
+ ///
+ [SugarTable("bas_material")]
+ public partial class BasMaterial : BaseEntity
+ {
+ public BasMaterial()
+ {
+
+
+ }
+ ///
+ /// Desc:是否包含入库数
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? is_contain_into_num { get; set; }
+
+ ///
+ /// Desc:批次管理
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? is_batch_enabled { get; set; }
+
+ ///
+ /// Desc:标签管理
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? is_label_enabled { get; set; }
+
+ ///
+ /// Desc:附件
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string attachment { get; set; }
+
+ ///
+ /// Desc:先进先出 0否 1是
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? first_in_out { get; set; }
+
+ ///
+ /// Desc:存储有效期(天)
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? storage_valid_day { get; set; }
+
+ ///
+ /// Desc:预警提前期(天)
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? early_warn_day { get; set; }
+
+ ///
+ /// Desc:安全库存
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? safe_stock { get; set; }
+
+ ///
+ /// Desc:发料仓库id
+ /// Default:
+ /// Nullable:True
+ ///
+ public string send_warehouse_id { get; set; }
+
+ ///
+ /// Desc:入厂单位id
+ /// Default:
+ /// Nullable:True
+ ///
+ public string into_factory_unit_id { get; set; }
+
+ ///
+ /// Desc:安全库存包含状态
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string safe_stock_stauts { get; set; }
+
+ ///
+ /// Desc:投料单位
+ /// Default:
+ /// Nullable:True
+ ///
+ public string material_in_unit_id { get; set; }
+
+ ///
+ /// Desc:产出单位
+ /// Default:
+ /// Nullable:True
+ ///
+ public string material_out_unit_id { get; set; }
+
+ ///
+ /// Desc:请料方式 1按计划排程请料 2自行管控
+ /// Default:
+ /// Nullable:True
+ ///
+ public string material_request_method { get; set; }
+
+ ///
+ /// Desc:物料代码
+ /// Default:
+ /// Nullable:False
+ ///
+ public string code { get; set; }
+
+ ///
+ /// Desc:物料名称
+ /// Default:
+ /// Nullable:False
+ ///
+ public string name { get; set; }
+
+ ///
+ /// Desc:物料分类ID
+ /// Default:
+ /// Nullable:False
+ ///
+ public string category_id { get; set; }
+
+ ///
+ /// Desc:单位ID
+ /// Default:
+ /// Nullable:False
+ ///
+ public string unit_id { get; set; }
+
+ ///
+ /// Desc:单价
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? cost { get; set; }
+
+ ///
+ /// Desc:毛重
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? grossweight { get; set; }
+
+ ///
+ /// Desc:净重
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? netweight { get; set; }
+
+ ///
+ /// Desc:长
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? length { get; set; }
+
+ ///
+ /// Desc:宽
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? width { get; set; }
+
+ ///
+ /// Desc:高
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? high { get; set; }
+
+ ///
+ /// Desc:体积
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? volumn { get; set; }
+
+ ///
+ /// Desc:是否免检
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? isexemption { get; set; }
+
+ ///
+ /// Desc:安全库存
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? safeqty { get; set; }
+
+ ///
+ /// Desc:保质期
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? qualityperiod { get; set; }
+
+ ///
+ /// Desc:最小包装
+ /// Default:
+ /// Nullable:True
+ ///
+ public decimal? minpacking { get; set; }
+
+ ///
+ /// Desc:先进先出间隔天数,批次间隔天数
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? fifo_interval_days { get; set; }
+
+ ///
+ /// Desc:创建时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// Desc:修改时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// Desc:扩展字段
+ /// Default:
+ /// Nullable:True
+ ///
+ public string extras { get; set; }
+
+ ///
+ /// Desc:所属组织
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string org_id { get; set; }
+
+ ///
+ /// Desc:是否过期允许出库
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string expireout { get; set; }
+
+ ///
+ /// Desc:是否先进先出管控
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string fifo { get; set; }
+
+ ///
+ /// Desc:物料规格型号
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string material_standard { get; set; }
+
+ ///
+ /// Desc:海关编码
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string fhscode { get; set; }
+
+ ///
+ /// Desc:附属性
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string attribute { get; set; }
+
+ ///
+ /// Desc:管控类型: 批管控:Lot 单管控:KeyParts 非管控:NoControl
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string controltype { get; set; }
+
+ ///
+ /// Desc:备注
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string remark { get; set; }
+
+ ///
+ /// Desc:创建用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string create_id { get; set; }
+
+ ///
+ /// Desc:修改用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string modify_id { get; set; }
+
+ ///
+ /// Desc:状态
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string state { get; set; }
+
+ ///
+ /// Desc:物料属性
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string material_property { get; set; }
+
+ ///
+ /// Desc:标签
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string label { get; set; }
+
+ ///
+ /// Desc:描述
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string descrip { get; set; }
+
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldsProduct.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldsMaterial.cs
similarity index 75%
rename from EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldsProduct.cs
rename to EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldsMaterial.cs
index 0144e379..78bdc13d 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldsProduct.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldsMaterial.cs
@@ -11,21 +11,15 @@ namespace Tnb.EquipMgr.Entities
///
///模具产品关联表
///
- [SugarTable("tool_molds_product")]
- public partial class ToolMoldsProduct
+ [SugarTable("tool_molds_material")]
+ public partial class ToolMoldsMaterial:BaseEntity
{
- public ToolMoldsProduct(){
+ public ToolMoldsMaterial(){
}
- ///
- /// Desc:编号
- /// Default:
- /// Nullable:False
- ///
- [SugarColumn(IsPrimaryKey=true)]
- public string id {get;set;} = SnowflakeIdHelper.NextId();
+
///
/// Desc:模具编号
@@ -35,11 +29,11 @@ namespace Tnb.EquipMgr.Entities
public string mold_id {get;set;} = string.Empty;
///
- /// Desc:产品编号
+ /// Desc:物料编号
/// Default:
/// Nullable:False
///
- public string product_id {get;set;} = string.Empty;
+ public string material_id { get;set;} = string.Empty;
///
/// Desc:创建用户
@@ -77,11 +71,11 @@ namespace Tnb.EquipMgr.Entities
public int? real_cavity_qty {get;set;}
///
- /// Desc:产品同组标识
+ /// Desc:物料同组标识
/// Default:NULL::character varying
/// Nullable:True
///
- public string? product_group {get;set;}
+ public string? material_group { get;set;}
}
}
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldProductService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaterialService.cs
similarity index 82%
rename from EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldProductService.cs
rename to EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaterialService.cs
index b7768fe7..be6af180 100644
--- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldProductService.cs
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaterialService.cs
@@ -8,14 +8,14 @@ using Tnb.EquipMgr.Entities.Dto;
namespace Tnb.EquipMgr.Interfaces
{
- public interface IToolMoldProductService
+ public interface IToolMoldMaterialService
{
///
- /// 根据模具id获取设备集合
+ /// 根据模具id获取物料集合
///
///
///
- public Task> GetProductLists(ToolMoldInput ToolMoldInput);
+ public Task> GetMaterialLists(ToolMoldInput ToolMoldInput);
///
/// 增加模具产品绑定
///
@@ -37,14 +37,14 @@ namespace Tnb.EquipMgr.Interfaces
///
///
///
- public Task SaveProductGroup(ToolMoldInput ToolMoldInput);
+ public Task SaveMaterialGroup(ToolMoldInput ToolMoldInput);
///
/// 取消产品同组
///
///
///
///
- public Task CancelProductGroup(ToolMoldInput ToolMoldInput);
+ public Task CancelMaterialGroup(ToolMoldInput ToolMoldInput);
///
/// 根据产品id获取模具集合
@@ -59,6 +59,6 @@ namespace Tnb.EquipMgr.Interfaces
///
///
- public Task DetachProductData(ToolMoldInput ToolMoldInput);
+ public Task DetachMaterialData(ToolMoldInput ToolMoldInput);
}
}
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldProductService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs
similarity index 70%
rename from EquipMgr/Tnb.EquipMgr/ToolMoldProductService.cs
rename to EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs
index aa357dcd..a77b34d3 100644
--- a/EquipMgr/Tnb.EquipMgr/ToolMoldProductService.cs
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs
@@ -21,42 +21,41 @@ namespace Tnb.EquipMgr
{
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
[Route("api/[area]/[controller]/[action]")]
- public class ToolMoldProductService : IToolMoldProductService, IDynamicApiController, ITransient
+ public class ToolMoldMaterialService : IToolMoldMaterialService, IDynamicApiController, ITransient
{
private readonly IUserManager _userManager;
private readonly ISqlSugarRepository _repository;
- public ToolMoldProductService(IUserManager userManager, ISqlSugarRepository repository)
+ public ToolMoldMaterialService(IUserManager userManager, ISqlSugarRepository repository)
{
_userManager = userManager;
_repository = repository;
}
///
- /// 根据模具id获取产品集合
+ /// 根据模具id获取物料集合
///
///
///
[HttpPost]
- public async Task> GetProductLists(ToolMoldInput ToolMoldInput)
+ public async Task> GetMaterialLists(ToolMoldInput ToolMoldInput)
{
var db = _repository.AsSugarClient();
- var list = await db.Queryable((a, b) => new object[]
+ var list = await db.Queryable((a, b) => new object[]
{
- JoinType.Inner, a.id == b.product_id,
+ JoinType.Inner, a.id == b.material_id,
})
.Where((a, b) => b.mold_id == ToolMoldInput.mold)
- .Select((a, b) => new ProductListOutput
+ .Select((a, b) => new MaterialListOutput
{
id = a.id,
- product_code = a.product_code,
- product_name = a.product_name,
- product_standard = a.product_standard,
- product_group=b.product_group,
+ code = a.code,
+ name = a.name,
+ material_group=b.material_group,
real_cavity_qty = b.real_cavity_qty.HasValue ? b.real_cavity_qty.Value : 0
}).ToListAsync();
return list;
}
///
- /// 增加模具产品绑定
+ /// 增加模具物料绑定
///
///
///
@@ -67,21 +66,21 @@ namespace Tnb.EquipMgr
{
DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
{
- var ToolMoldsProduct= await _repository.AsSugarClient().Queryable().Where(p=>p.mold_id== ToolMoldInput.mold&&p.product_id== ToolMoldInput.productid).FirstAsync();
+ var ToolMoldsProduct= await _repository.AsSugarClient().Queryable().Where(p=>p.mold_id== ToolMoldInput.mold&&p.material_id== ToolMoldInput.materialid).FirstAsync();
if (ToolMoldsProduct == null)
{
- var entity = new ToolMoldsProduct();
+ var entity = new ToolMoldsMaterial();
entity.id = SnowflakeIdHelper.NextId();
entity.mold_id = ToolMoldInput.mold;
- entity.product_id = ToolMoldInput.productid;
+ entity.material_id = ToolMoldInput.materialid;
entity.real_cavity_qty = ToolMoldInput.real_cavity_qty;
entity.create_time = DateTime.Now;
entity.create_id = _userManager.UserId;
- await _repository.AsSugarClient().Insertable(entity).ExecuteCommandAsync();
+ await _repository.AsSugarClient().Insertable(entity).ExecuteCommandAsync();
}
else {
ToolMoldsProduct.real_cavity_qty= ToolMoldInput.real_cavity_qty;
- await _repository.AsSugarClient().Updateable(ToolMoldsProduct).ExecuteCommandAsync();
+ await _repository.AsSugarClient().Updateable(ToolMoldsProduct).ExecuteCommandAsync();
}
@@ -92,7 +91,7 @@ namespace Tnb.EquipMgr
}
///
- /// 批量删除模具产品绑定
+ /// 批量删除模具物料绑定
///
///
///
@@ -102,53 +101,53 @@ namespace Tnb.EquipMgr
{
DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
{
- var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.productids.Contains(x.product_id)).ToList();
- await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync();
+ var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
+ await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync();
});
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
}
///
- /// 产品同组
+ /// 物料同组
///
///
///
///
[HttpPost]
- public async Task SaveProductGroup(ToolMoldInput ToolMoldInput)
+ public async Task SaveMaterialGroup(ToolMoldInput ToolMoldInput)
{
DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
{
- var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.productids.Contains(x.product_id)).ToList();
+ var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
var sign = SnowflakeIdHelper.NextId();
- arr.ForEach(p => { p.product_group = sign; });
- await _repository.AsSugarClient().Updateable(arr).ExecuteCommandAsync();
+ arr.ForEach(p => { p.material_group = sign; });
+ await _repository.AsSugarClient().Updateable(arr).ExecuteCommandAsync();
});
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
}
///
- /// 取消产品同组
+ /// 取消物料同组
///
///
///
///
- public async Task CancelProductGroup(ToolMoldInput ToolMoldInput)
+ public async Task CancelMaterialGroup(ToolMoldInput ToolMoldInput)
{
DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
{
- var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.productids.Contains(x.product_id)).ToList();
- arr.ForEach(p => { p.product_group = string.Empty; });
- await _repository.AsSugarClient().Updateable(arr).ExecuteCommandAsync();
+ var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
+ arr.ForEach(p => { p.material_group = string.Empty; });
+ await _repository.AsSugarClient().Updateable(arr).ExecuteCommandAsync();
});
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
}
///
- /// 根据产品id获取模具集合
+ /// 根据物料id获取模具集合
///
///
///
@@ -156,11 +155,11 @@ namespace Tnb.EquipMgr
public async Task> GetMoldLists(ToolMoldInput ToolMoldInput)
{
var db = _repository.AsSugarClient();
- var list = await db.Queryable((a, b) => new object[]
+ var list = await db.Queryable((a, b) => new object[]
{
JoinType.Inner, a.id == b.mold_id,
})
- .Where((a, b) => b.product_id == ToolMoldInput.productid)
+ .Where((a, b) => b.material_id == ToolMoldInput.materialid)
.Select((a, b) => new MoldListOutput
{
id = a.id,
@@ -172,18 +171,18 @@ namespace Tnb.EquipMgr
return list;
}
///
- /// 批量删除产品模具绑定
+ /// 批量删除物料模具绑定
///
///
///
///
[HttpPost]
- public async Task DetachProductData(ToolMoldInput ToolMoldInput)
+ public async Task DetachMaterialData(ToolMoldInput ToolMoldInput)
{
DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
{
- var arr = _repository.AsSugarClient().Queryable().Where(x => ToolMoldInput.molds.Contains(x.mold_id) && x.product_id == ToolMoldInput.productid).ToList();
- await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync();
+ var arr = _repository.AsSugarClient().Queryable().Where(x => ToolMoldInput.molds.Contains(x.mold_id) && x.material_id == ToolMoldInput.materialid).ToList();
+ await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync();
});
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs
index 0c5c02e5..43535cf9 100644
--- a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs
@@ -68,9 +68,12 @@ namespace Tnb.EquipMgr
{
DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
{
+ var his= await _repository.AsSugarClient().Queryable().ToListAsync();
var list = new List();
foreach (var equip in ToolMoldInput.equipid)
{
+ if (his.Where(p => p.mold_id == ToolMoldInput.mold && p.equipment_id == equip).ToList().Count > 0)
+ continue;
var entity = new ToolMoldsEquipment();
entity.id = SnowflakeIdHelper.NextId();
entity.mold_id = ToolMoldInput.mold;
@@ -83,8 +86,6 @@ namespace Tnb.EquipMgr
});
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
return result.IsSuccess ? "保存成功" : result.ErrorMessage;
-
-
}
///
/// 批量删除模具设备绑定
From a0e93db063ce0ba7572e3f1e4fc7a544bdef4665 Mon Sep 17 00:00:00 2001
From: zhoukeda <1315948824@qq.com>
Date: Wed, 17 May 2023 17:33:19 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E7=82=B9=E5=B7=A1=E6=A3=80=E6=89=A7?=
=?UTF-8?q?=E8=A1=8C=20=E6=A8=A1=E6=9D=BF=E5=8F=91=E5=B8=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Consts/SpotInsRecordExecutionStatus.cs | 4 +-
.../Dto/SpotInsTemPublishInput.cs | 9 +
.../Entity/EqpSpotInsRecordD.cs | 2 +-
.../Entity/EqpSpotInsTemD.cs | 42 ++++
.../Entity/EqpSpotInsTemH.cs | 181 ++++++++++++++++++
.../IEqpSpotInsTemService.cs | 12 ++
.../IEquSpotInsRecordService.cs | 14 ++
EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs | 111 +++++++++++
.../Tnb.EquipMgr/EquSpotInsRecordService.cs | 82 ++++++++
.../GenerateSpotInspectionPlanTimeWorker.cs | 3 +-
10 files changed, 456 insertions(+), 4 deletions(-)
create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsTemPublishInput.cs
create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemD.cs
create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemH.cs
create mode 100644 EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpotInsTemService.cs
create mode 100644 EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs
create mode 100644 EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs
create mode 100644 EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs
index f847477a..d774afae 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs
@@ -13,11 +13,11 @@ namespace Tnb.EquipMgr
///
/// 待复核
///
- public const string TOBECHECK = "1";
+ public const string TOBECHECK = "2";
///
/// 已完成
///
- public const string COMPLETED = "1";
+ public const string COMPLETED = "3";
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsTemPublishInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsTemPublishInput.cs
new file mode 100644
index 00000000..bc1bfaec
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsTemPublishInput.cs
@@ -0,0 +1,9 @@
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class SpotInsTemPublishInput
+ {
+ public string id { get; set; }
+
+ public string[] equipIds { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs
index 3e7c12bc..431d5350 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs
@@ -81,7 +81,7 @@ public partial class EqpSpotInsRecordD : BaseEntity
/// Default:
/// Nullable:True
///
- public int? result { get; set; }
+ public string? result { get; set; }
///
/// Desc:实际测量值
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemD.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemD.cs
new file mode 100644
index 00000000..3c2a82e5
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemD.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Linq;
+using System.Text;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities
+{
+ ///
+ ///点巡检模板子表
+ ///
+ [SugarTable("eqp_spot_ins_tem_d")]
+ public partial class EqpSpotInsTemD
+ {
+ public EqpSpotInsTemD(){
+
+
+ }
+ ///
+ /// Desc:编号
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(IsPrimaryKey=true)]
+ public string id {get;set;} = SnowflakeIdHelper.NextId();
+
+ ///
+ /// Desc:模板id
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? spot_ins_tem_id {get;set;}
+
+ ///
+ /// Desc:点巡检项id
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? spot_ins_item_id {get;set;}
+
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemH.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemH.cs
new file mode 100644
index 00000000..2970fa60
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemH.cs
@@ -0,0 +1,181 @@
+using System;
+using System.Linq;
+using System.Text;
+using JNPF.Common.Security;
+using SqlSugar;
+
+namespace Tnb.EquipMgr.Entities
+{
+ ///
+ ///点巡检模板
+ ///
+ [SugarTable("eqp_spot_ins_tem_h")]
+ public partial class EqpSpotInsTemH
+ {
+ public EqpSpotInsTemH()
+ {
+ }
+
+ ///
+ /// Desc:创建时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime? create_time { get; set; }
+
+ ///
+ /// Desc:创建用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? create_id { get; set; }
+
+ ///
+ /// Desc:修改时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public DateTime? modify_time { get; set; }
+
+ ///
+ /// Desc:修改用户
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? modify_id { get; set; }
+
+ ///
+ /// Desc:主键
+ /// Default:
+ /// Nullable:False
+ ///
+ [SugarColumn(IsPrimaryKey = true)]
+ public string id { get; set; } = SnowflakeIdHelper.NextId();
+
+ ///
+ /// Desc:设备类型id
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? equip_type_id { get; set; }
+
+ ///
+ /// Desc:编码
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? code { get; set; }
+
+ ///
+ /// Desc:名称
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? name { get; set; }
+
+ ///
+ /// Desc:周期
+ /// Default:
+ /// Nullable:False
+ ///
+ public decimal plan_cycle { get; set; }
+
+ ///
+ /// Desc:周期方式 1 单次 2 循环
+ /// Default:
+ /// Nullable:False
+ ///
+ public string plan_cycle_unit { get; set; } = string.Empty;
+
+ ///
+ /// Desc:计划执行通知提前量
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? plan_run_notice { get; set; }
+
+ ///
+ /// Desc:计划执行通知提前量单位 1 小时 2 天 3 周
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? plan_run_notice_unit { get; set; }
+
+ ///
+ /// Desc:执行滞后推送时间
+ /// Default:
+ /// Nullable:True
+ ///
+ public int? plan_delay { get; set; }
+
+ ///
+ /// Desc:执行滞后推送时间单位 1 小时 2 天 3 周
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? plan_delay_unit { get; set; }
+
+ ///
+ /// Desc:启用时间
+ /// Default:
+ /// Nullable:False
+ ///
+ public DateTime start_time { get; set; }
+
+ ///
+ /// Desc:是否启用
+ /// Default:
+ /// Nullable:False
+ ///
+ public int is_start { get; set; }
+
+ ///
+ /// Desc:是否复核
+ /// Default:
+ /// Nullable:False
+ ///
+ public int is_repeat { get; set; }
+
+ ///
+ /// Desc:复核岗位id
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? repeat_post_info_user_id { get; set; }
+
+ ///
+ /// Desc:责任岗位id
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? send_post_info_user_id { get; set; }
+
+ ///
+ /// Desc:不合格推送 0 不推送 1 推送
+ /// Default:
+ /// Nullable:False
+ ///
+ public int is_send { get; set; }
+
+ ///
+ /// Desc:备注
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? remark { get; set; }
+
+ ///
+ /// Desc:推送人id
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? send_post_id { get; set; }
+
+ ///
+ /// Desc:所属组织
+ /// Default:NULL::character varying
+ /// Nullable:True
+ ///
+ public string? org_id { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpotInsTemService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpotInsTemService.cs
new file mode 100644
index 00000000..12bdb6e4
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpotInsTemService.cs
@@ -0,0 +1,12 @@
+using Tnb.EquipMgr.Entities.Dto;
+namespace Tnb.EquipMgr.Interfaces
+{
+ public interface IEqpSpotInsTemService
+ {
+ ///
+ /// 根据模板id发布到设备
+ ///
+ ///
+ public Task Publish(SpotInsTemPublishInput input);
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs
new file mode 100644
index 00000000..887c7a87
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs
@@ -0,0 +1,14 @@
+using JNPF.Common.Dtos.VisualDev;
+
+namespace Tnb.EquipMgr.Interfaces
+{
+ public interface IEquSpotInsRecordService
+ {
+ ///
+ /// 执行点巡检
+ ///
+ ///
+ ///
+ public Task ExecuteSpotIns(string id,VisualDevModelDataUpInput input);
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs b/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs
new file mode 100644
index 00000000..67d0f81c
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs
@@ -0,0 +1,111 @@
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Enums;
+using JNPF.Common.Security;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.FriendlyException;
+using JNPF.VisualDev.Interfaces;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Tnb.EquipMgr.Entities;
+using Tnb.EquipMgr.Interfaces;
+using Tnb.EquipMgr.Entities.Dto;
+
+namespace Tnb.EquipMgr
+{
+ ///
+ /// 点巡检模板管理
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ public class EqpSpotInsTemService : IEqpSpotInsTemService, IDynamicApiController, ITransient
+ {
+ private const string ModuleId = "26123080740885";
+ private readonly ISqlSugarRepository _repository;
+ private readonly IUserManager _userManager;
+
+ public EqpSpotInsTemService(ISqlSugarRepository repository,
+ IUserManager userManager,
+ IVisualDevService visualDevService)
+ {
+ _repository = repository;
+ _userManager = userManager;
+ }
+
+ public async Task Publish(SpotInsTemPublishInput input)
+ {
+ var db = _repository.AsSugarClient();
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ EqpSpotInsTemH eqpSpotInsTemH = await _repository.GetSingleAsync(x => x.id == input.id);
+ List eqpSpotInsTemDs = await db.Queryable().Where(x=>x.spot_ins_item_id==input.id).ToListAsync();
+
+ if (input.equipIds != null && input.equipIds.Length > 0)
+ {
+ List insertEqpSpotInsTemEquipHs = new List();
+ List insertEqpSpotInsTemEquipDs = new List();
+ foreach (var equipId in input.equipIds)
+ {
+ string id = SnowflakeIdHelper.NextId();
+ string code = $"{DateTime.Now.ToString("yyyy-MM-dd") + equipId}";
+ EqpSpotInsTemEquipH eqpSpotInsTemEquipH = new EqpSpotInsTemEquipH()
+ {
+ id = id,
+ code = code,
+ name = eqpSpotInsTemH.name+equipId,
+ plan_cycle = eqpSpotInsTemH.plan_cycle,
+ plan_cycle_unit = eqpSpotInsTemH.plan_cycle_unit,
+ plan_run_notice = eqpSpotInsTemH.plan_run_notice,
+ plan_delay = eqpSpotInsTemH.plan_delay,
+ start_time = eqpSpotInsTemH.start_time,
+ is_start = eqpSpotInsTemH.is_start.ToString(),
+ is_repeat = eqpSpotInsTemH.is_repeat.ToString(),
+ is_send = eqpSpotInsTemH.is_send,
+ spot_ins_tem_id = input.id,
+ equip_id = equipId,
+ remark = eqpSpotInsTemH.remark,
+ plan_run_notice_unit = eqpSpotInsTemH.plan_run_notice_unit,
+ plan_delay_unit = eqpSpotInsTemH.plan_delay_unit,
+ repeat_post_info_user_id = eqpSpotInsTemH.repeat_post_info_user_id,
+ send_post_info_user_id = eqpSpotInsTemH.send_post_info_user_id,
+ send_post_id = eqpSpotInsTemH.send_post_id,
+ org_id = eqpSpotInsTemH.org_id,
+ create_id = _userManager.UserId,
+ create_time = DateTime.Now,
+ };
+ insertEqpSpotInsTemEquipHs.Add(eqpSpotInsTemEquipH);
+
+ if (eqpSpotInsTemDs != null && eqpSpotInsTemDs.Count > 0)
+ {
+ foreach (var eqpSpotInsTem in eqpSpotInsTemDs)
+ {
+ EqpSpotInsTemEquipD eqpSpotInsTemEquipD = new EqpSpotInsTemEquipD()
+ {
+ id = SnowflakeIdHelper.NextId(),
+ spot_ins_item_id = eqpSpotInsTem.id,
+ spot_ins_tem_equip_id = id,
+ };
+ insertEqpSpotInsTemEquipDs.Add(eqpSpotInsTemEquipD);
+ }
+ }
+ }
+
+ if (insertEqpSpotInsTemEquipHs != null && insertEqpSpotInsTemEquipHs.Count > 0)
+ {
+ await db.Insertable(insertEqpSpotInsTemEquipHs).ExecuteCommandAsync();
+ }
+
+ if (insertEqpSpotInsTemEquipDs != null && insertEqpSpotInsTemEquipDs.Count > 0)
+ {
+ await db.Insertable(insertEqpSpotInsTemEquipDs).ExecuteCommandAsync();
+ }
+
+ }
+
+ });
+
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+ return result.IsSuccess ? "发布成功" : result.ErrorMessage;
+ }
+ }
+}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs
new file mode 100644
index 00000000..6b752382
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs
@@ -0,0 +1,82 @@
+using JNPF.Common.Core.Manager;
+using JNPF.Common.Dtos.VisualDev;
+using JNPF.Common.Enums;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.FriendlyException;
+using JNPF.VisualDev;
+using JNPF.VisualDev.Entitys;
+using JNPF.VisualDev.Interfaces;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using SqlSugar;
+using Tnb.EquipMgr.Entities;
+using Tnb.EquipMgr.Interfaces;
+
+namespace Tnb.EquipMgr
+{
+ ///
+ /// 点巡检执行管理
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
+ [Route("api/[area]/[controller]/[action]")]
+ [OverideVisualDev(ModuleId)]
+ public class EquSpotInsRecordService : IOverideVisualDevService, IEquSpotInsRecordService, IDynamicApiController, ITransient
+ {
+ public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
+ private const string ModuleId = "26123080740885";
+ private readonly ISqlSugarRepository _repository;
+ private readonly IVisualDevService _visualDevService;
+ private readonly IRunService _runService;
+ private readonly IUserManager _userManager;
+
+ public EquSpotInsRecordService(ISqlSugarRepository repository,
+ IRunService runService,
+ IUserManager userManager,
+ IVisualDevService visualDevService)
+ {
+ _repository = repository;
+ _visualDevService = visualDevService;
+ _runService = runService;
+ _userManager = userManager;
+ OverideFuncs.UpdateAsync = ExecuteSpotIns;
+ }
+
+ public async Task ExecuteSpotIns(string id,[FromBody]VisualDevModelDataUpInput input)
+ {
+ DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
+ {
+ //string attachment = JsonConvert.SerializeObject(input.data["attachment"]);
+ // _repository.UpdateAsync(x => new EqpSpotInsRecordH()
+ // {
+ // result = (int)input.data["result"],
+ // attachment = attachment,
+ // result_remark = input.data["result_remark"].ToString(),
+ // }, x => x.id == input.data["id"]);
+ VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
+ await _runService.Update(id,templateEntity, input);
+
+ EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x=>x.id==input.data["id"].ToString());
+ string status = "";
+ if (eqpSpotInsRecordH.is_repeat == "1")
+ {
+ status = SpotInsRecordExecutionStatus.TOBECHECK;
+ }
+ else
+ {
+ status = SpotInsRecordExecutionStatus.COMPLETED;
+ }
+ _repository.UpdateAsync(x => new EqpSpotInsRecordH()
+ {
+ status = status,
+ spot_record_date_time = DateTime.Now,
+ spot_record_user_id = _userManager.UserId
+ }, x => x.id == input.data["id"]);
+
+ });
+
+ if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
+ return result.IsSuccess ? "执行成功" : result.ErrorMessage;
+ }
+ }
+}
\ No newline at end of file
diff --git a/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpotInspectionPlanTimeWorker.cs b/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpotInspectionPlanTimeWorker.cs
index e4da44d1..fbce46ad 100644
--- a/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpotInspectionPlanTimeWorker.cs
+++ b/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpotInspectionPlanTimeWorker.cs
@@ -17,7 +17,7 @@ namespace JNPF.TaskScheduler.Listener
// _repository = repository;
// }
- [SpareTime("0 0 0 * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
+ [SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)]
public void GenerateSpotInspectionPlan(SpareTimer timer, long count)
{
Log.Information("----------------------开始生成点巡检计划----------------------");
@@ -100,6 +100,7 @@ namespace JNPF.TaskScheduler.Listener
repeat_post_info_user_id = item.repeat_post_info_user_id,
is_send = item.is_send,
create_time = DateTime.Now,
+ status = Tnb.EquipMgr.SpotInsRecordExecutionStatus.TOBEEXECUTED
});
}
}
From 32ab2c3411db35c5493e833af1007df46ddcf047 Mon Sep 17 00:00:00 2001
From: "DEVICE8\\12494"
Date: Wed, 17 May 2023 17:56:21 +0800
Subject: [PATCH 3/6] 1
---
.../Tnb.EquipMgr.Entities/Dto/BaseInput.cs | 14 +++++
.../Dto/MoldListOutput.cs | 2 +-
.../Dto/MoldMaintainGroupItemRelationInput.cs | 10 +--
.../Dto/MoldMaintainItemInput.cs | 12 +---
.../Dto/MoldMaintainItemListOutput.cs | 4 ++
.../Tnb.EquipMgr.Entities/Mapper/Mapper.cs | 4 ++
.../ToolMoldMaintainGroupService.cs | 61 +++++++++++++++++--
7 files changed, 81 insertions(+), 26 deletions(-)
create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseInput.cs
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseInput.cs
new file mode 100644
index 00000000..b826fe23
--- /dev/null
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseInput.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tnb.EquipMgr.Entities.Dto
+{
+ public class BaseInput
+ {
+ public string item_group_id { get; set; }
+ public List ids { get; set; }
+ }
+}
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs
index d385c1bc..72a9bc91 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs
@@ -8,7 +8,7 @@ namespace Tnb.EquipMgr.Entities.Dto
{
public class RelevanceMoldListOutput
{
-
+ public string mold_id { get; set; }
///
/// Desc:模具编号
/// Default:NULL::character varying
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs
index 98b11fef..4e796a9e 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs
@@ -9,15 +9,7 @@ namespace Tnb.EquipMgr.Entities.Dto
///
/// 关联保养组与模具输入参数
///
- public class MoldMaintainGroupItemRelationInput
+ public class MoldMaintainGroupItemRelationInput :BaseInput
{
- ///
- /// 项目组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
index 75205ae8..7802dba7 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs
@@ -9,16 +9,8 @@ namespace Tnb.EquipMgr.Entities.Dto
///
/// 模具保养项输入参数
///
- public class MoldMaintainGroupItemInput
+ public class MoldMaintainGroupItemInput : BaseInput
{
- ///
- /// 项目组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
index 93eefae1..c45b8ad4 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs
@@ -11,6 +11,10 @@ namespace Tnb.EquipMgr.Entities.Dto
///
public class MoldMaintainItemListOutput
{
+ ///
+ /// 检查项Id
+ ///
+ public string item_id { get; set; }
///
/// 项目名称
///
diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs b/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs
index 47984fa8..3b575108 100644
--- a/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs
+++ b/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs
@@ -8,6 +8,10 @@ namespace Tnb.EquipMgr.Entities.Mapper
{
public void Register(TypeAdapterConfig config)
{
+ config.ForType()
+ .Map(dest => dest.item_id, src => src.id);
+ config.ForType()
+ .Map(dest => dest.mold_id, src => src.id);
}
}
}
\ No newline at end of file
diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs
index 6c481337..52c7d969 100644
--- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs
+++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Aspose.Cells.Drawing;
@@ -12,6 +14,9 @@ using JNPF.DynamicApiController;
using JNPF.FriendlyException;
using Mapster;
using Microsoft.AspNetCore.Mvc;
+using NPOI.SS.Formula.Functions;
+using Qiniu.Util;
+using Spire.Pdf.Widget;
using SqlSugar;
using Tnb.Common.Contracts;
using Tnb.EquipMgr.Entities;
@@ -82,7 +87,7 @@ namespace Tnb.EquipMgr
///
[HttpPost]
public async Task RelevanceMaintianGroupAndItem(MoldMaintainGroupItemInput input) =>
- await Relevance(input);
+ await Relevance(input, nameof(ToolMoldMaintainGroupItem.item_id), it => it.item_group_id == input.item_group_id);
///
/// 关联项目组与模具
@@ -91,20 +96,64 @@ namespace Tnb.EquipMgr
///
[HttpPost]
public async Task RelevanceMaintianGroupAndMold(MoldMaintainGroupItemRelationInput input) =>
- await Relevance(input);
+ await Relevance(input, nameof(ToolMoldMaintainGroupRelation.mold_id), it => it.item_group_id == input.item_group_id);
#endregion
- private async Task Relevance(TSrc input) where TDest : BaseEntity, new()
+ private async Task Relevance(TSrc input, string name, Expression> deleleExp) where TDest : BaseEntity, new()
+ where TSrc : BaseInput
{
+
+ await _db.Deleteable().Where(deleleExp).ExecuteCommandAsync();
+ var itemGroupId = nameof(ToolMoldMaintainGroupRelation.item_group_id);
if (input == null) throw new ArgumentNullException(nameof(input));
- var entity = input.Adapt();
- entity.id = SnowflakeIdHelper.NextId();
- var row = await _db.Insertable(entity).ExecuteCommandAsync();
+ var entities = new List();
+ if (input.ids?.Count > 0)
+ {
+ foreach (var id in input.ids)
+ {
+ var pk = id;
+ TDest entity = new();
+ entity.id = SnowflakeIdHelper.NextId();
+ if (!PropertySet.ValueFactories.TryGetValue(itemGroupId, out Action