Merge branch 'dev' of ssh://git.tuotong-tech.com:9105/tnb/tnb.server into dev
This commit is contained in:
@@ -13,11 +13,11 @@ namespace Tnb.EquipMgr
|
||||
/// <summary>
|
||||
/// 待复核
|
||||
/// </summary>
|
||||
public const string TOBECHECK = "1";
|
||||
public const string TOBECHECK = "2";
|
||||
|
||||
/// <summary>
|
||||
/// 已完成
|
||||
/// </summary>
|
||||
public const string COMPLETED = "1";
|
||||
public const string COMPLETED = "3";
|
||||
}
|
||||
}
|
||||
14
EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseMoldMaintainInput.cs
Normal file
14
EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseMoldMaintainInput.cs
Normal file
@@ -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 BaseMoldMaintainInput
|
||||
{
|
||||
public string item_group_id { get; set; }
|
||||
public List<string> ids { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 保养规则关联模具列表输出参数
|
||||
/// </summary>
|
||||
public class MaintainRuleMoldListOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 模具Id
|
||||
/// </summary>
|
||||
public string mold_id { get; set; }
|
||||
/// <summary>
|
||||
/// 模具编码
|
||||
/// </summary>
|
||||
public string mold_code { get; set; }
|
||||
/// <summary>
|
||||
/// 模具名称
|
||||
/// </summary>
|
||||
public string mold_name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,14 @@ using System.Threading.Tasks;
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 产品列表输出类
|
||||
/// 物料列表输出类
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
/// <summary>
|
||||
@@ -8,7 +8,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class RelevanceMoldListOutput
|
||||
{
|
||||
|
||||
public string mold_id { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:模具编号
|
||||
/// Default:NULL::character varying
|
||||
|
||||
19
EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs
Normal file
19
EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 模具保养删除参数
|
||||
/// </summary>
|
||||
public class MoldMaintainDelInput : BaseMoldMaintainInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除的表名
|
||||
/// </summary>
|
||||
public string table_name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,7 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
/// <summary>
|
||||
/// 关联保养组与模具输入参数
|
||||
/// </summary>
|
||||
public class MoldMaintainGroupItemRelationInput
|
||||
public class MoldMaintainGroupItemRelationInput :BaseMoldMaintainInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目组Id
|
||||
/// </summary>
|
||||
public string item_group_id { get; set; }
|
||||
/// <summary>
|
||||
/// 模具Id
|
||||
/// </summary>
|
||||
public string mold_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,8 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
/// <summary>
|
||||
/// 模具保养项输入参数
|
||||
/// </summary>
|
||||
public class MoldMaintainGroupItemInput
|
||||
public class MoldMaintainGroupItemInput : BaseMoldMaintainInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目组Id
|
||||
/// </summary>
|
||||
public string item_group_id { get; set; }
|
||||
/// <summary>
|
||||
/// 保养项Id
|
||||
/// </summary>
|
||||
public string item_id { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
/// </summary>
|
||||
public class MoldMaintainItemListOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 检查项Id
|
||||
/// </summary>
|
||||
public string item_id { get; set; }
|
||||
/// <summary>
|
||||
/// 项目名称
|
||||
/// </summary>
|
||||
|
||||
@@ -9,15 +9,11 @@ namespace Tnb.EquipMgr.Entities.Dto
|
||||
/// <summary>
|
||||
/// 模具规则定义,关键模具输入参数
|
||||
/// </summary>
|
||||
public class RelevanceMoldInput
|
||||
public class RelevanceMoldInput : BaseMoldMaintainInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 规则Id
|
||||
/// </summary>
|
||||
public string? rule_id { get; set; }
|
||||
/// <summary>
|
||||
/// 模具Id
|
||||
/// </summary>
|
||||
public string? mold_id { get; set;}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class SpotInsTemPublishInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
public string[] equipIds { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
352
EquipMgr/Tnb.EquipMgr.Entities/Entity/BasMaterial.cs
Normal file
352
EquipMgr/Tnb.EquipMgr.Entities/Entity/BasMaterial.cs
Normal file
@@ -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
|
||||
{
|
||||
///<summary>
|
||||
///物料信息
|
||||
///</summary>
|
||||
[SugarTable("bas_material")]
|
||||
public partial class BasMaterial : BaseEntity<string>
|
||||
{
|
||||
public BasMaterial()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Desc:是否包含入库数
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? is_contain_into_num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:批次管理
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? is_batch_enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:标签管理
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? is_label_enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:附件
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:先进先出 0否 1是
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? first_in_out { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:存储有效期(天)
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? storage_valid_day { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预警提前期(天)
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? early_warn_day { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:安全库存
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? safe_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:发料仓库id
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string send_warehouse_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:入厂单位id
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string into_factory_unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:安全库存包含状态
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string safe_stock_stauts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:投料单位
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string material_in_unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:产出单位
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string material_out_unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:请料方式 1按计划排程请料 2自行管控
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string material_request_method { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:物料代码
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:物料名称
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:物料分类ID
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string category_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:单位ID
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:单价
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? cost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:毛重
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? grossweight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:净重
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? netweight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:长
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? length { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:宽
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:高
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? high { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:体积
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? volumn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否免检
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? isexemption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:安全库存
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? safeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:保质期
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? qualityperiod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:最小包装
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public decimal? minpacking { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:先进先出间隔天数,批次间隔天数
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public int? fifo_interval_days { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:修改时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:扩展字段
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string extras { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:所属组织
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否过期允许出库
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string expireout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:是否先进先出管控
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string fifo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:物料规格型号
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string material_standard { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:海关编码
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string fhscode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:附属性
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string attribute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:管控类型: 批管控:Lot 单管控:KeyParts 非管控:NoControl
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string controltype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:备注
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:修改用户
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:状态
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string state { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:物料属性
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string material_property { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:标签
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:描述
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string descrip { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace Tnb.EquipMgr.Entities
|
||||
///<summary>
|
||||
///模具保养
|
||||
///</summary>
|
||||
[SugarTable("tool_mold_maintenance")]
|
||||
[SugarTable("tool_mold_maintain_item")]
|
||||
public partial class MoldMaintenance
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Contracts;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities
|
||||
{
|
||||
@@ -10,20 +11,8 @@ namespace Tnb.EquipMgr.Entities
|
||||
///模具保养规则与模具关联
|
||||
///</summary>
|
||||
[SugarTable("tool_mold_maintain_rule_relation")]
|
||||
public partial class ToolMoldMaintainRuleRelation
|
||||
public partial class ToolMoldMaintainRuleRelation:BaseEntity<string>
|
||||
{
|
||||
public ToolMoldMaintainRuleRelation(){
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Desc:主键
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey=true)]
|
||||
public string id {get;set;} = SnowflakeIdHelper.NextId();
|
||||
|
||||
/// <summary>
|
||||
/// Desc:保养规则id
|
||||
/// Default:
|
||||
|
||||
@@ -11,21 +11,15 @@ namespace Tnb.EquipMgr.Entities
|
||||
///<summary>
|
||||
///模具产品关联表
|
||||
///</summary>
|
||||
[SugarTable("tool_molds_product")]
|
||||
public partial class ToolMoldsProduct
|
||||
[SugarTable("tool_molds_material")]
|
||||
public partial class ToolMoldsMaterial:BaseEntity<string>
|
||||
{
|
||||
public ToolMoldsProduct(){
|
||||
public ToolMoldsMaterial(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:编号
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey=true)]
|
||||
public string id {get;set;} = SnowflakeIdHelper.NextId();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Desc:模具编号
|
||||
@@ -35,11 +29,11 @@ namespace Tnb.EquipMgr.Entities
|
||||
public string mold_id {get;set;} = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Desc:产品编号
|
||||
/// Desc:物料编号
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string product_id {get;set;} = string.Empty;
|
||||
public string material_id { get;set;} = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Desc:创建用户
|
||||
@@ -77,11 +71,11 @@ namespace Tnb.EquipMgr.Entities
|
||||
public int? real_cavity_qty {get;set;}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:产品同组标识
|
||||
/// Desc:物料同组标识
|
||||
/// Default:NULL::character varying
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string? product_group {get;set;}
|
||||
public string? material_group { get;set;}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,10 @@ namespace Tnb.EquipMgr.Entities.Mapper
|
||||
{
|
||||
public void Register(TypeAdapterConfig config)
|
||||
{
|
||||
config.ForType<MoldMaintenance, MoldMaintainItemListOutput>()
|
||||
.Map(dest => dest.item_id, src => src.id);
|
||||
config.ForType<ToolMolds, RelevanceMoldListOutput>()
|
||||
.Map(dest => dest.mold_id, src => src.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpotInsTemService.cs
Normal file
12
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpotInsTemService.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEqpSpotInsTemService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据模板id发布到设备
|
||||
/// </summary>
|
||||
/// <param name="dic"></param>
|
||||
public Task<string> Publish(SpotInsTemPublishInput input);
|
||||
}
|
||||
}
|
||||
14
EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs
Normal file
14
EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IEquSpotInsRecordService
|
||||
{
|
||||
/// <summary>
|
||||
/// 执行点巡检
|
||||
/// </summary>
|
||||
/// <param name="pageInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> ExecuteSpotIns(string id,VisualDevModelDataUpInput input);
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,14 @@ using Tnb.EquipMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.EquipMgr.Interfaces
|
||||
{
|
||||
public interface IToolMoldProductService
|
||||
public interface IToolMoldMaterialService
|
||||
{
|
||||
/// <summary>
|
||||
/// 根据模具id获取设备集合
|
||||
/// 根据模具id获取物料集合
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <returns></returns>
|
||||
public Task<List<ProductListOutput>> GetProductLists(ToolMoldInput ToolMoldInput);
|
||||
public Task<List<MaterialListOutput>> GetMaterialLists(ToolMoldInput ToolMoldInput);
|
||||
/// <summary>
|
||||
/// 增加模具产品绑定
|
||||
/// </summary>
|
||||
@@ -37,14 +37,14 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productids"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> SaveProductGroup(ToolMoldInput ToolMoldInput);
|
||||
public Task<dynamic> SaveMaterialGroup(ToolMoldInput ToolMoldInput);
|
||||
/// <summary>
|
||||
/// 取消产品同组
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productids"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> CancelProductGroup(ToolMoldInput ToolMoldInput);
|
||||
public Task<dynamic> CancelMaterialGroup(ToolMoldInput ToolMoldInput);
|
||||
|
||||
/// <summary>
|
||||
/// 根据产品id获取模具集合
|
||||
@@ -59,6 +59,6 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
/// <param name="productid"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public Task<dynamic> DetachProductData(ToolMoldInput ToolMoldInput);
|
||||
public Task<dynamic> DetachMaterialData(ToolMoldInput ToolMoldInput);
|
||||
}
|
||||
}
|
||||
88
EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs
Normal file
88
EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Contracts;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Utils;
|
||||
using Mapster;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
public class BaseMoldMaintainService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
public BaseMoldMaintainService(ISqlSugarClient db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
/// <summary>
|
||||
/// 关联
|
||||
/// </summary>
|
||||
/// <typeparam name="TSrc">输入参数类型</typeparam>
|
||||
/// <typeparam name="TDest">目标数据库表类型</typeparam>
|
||||
/// <param name="input">输入参数</param>
|
||||
/// <param name="mColumnName">主表属性名称</param>
|
||||
/// <param name="name">次表属性名称</param>
|
||||
/// <param name="deleleExp">删除条件</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
protected async Task Relevance<TSrc, TDest>(TSrc input, string mColumnName, string name, Expression<Func<TDest, bool>> deleleExp) where TDest : BaseEntity<string>, new()
|
||||
where TSrc : BaseMoldMaintainInput
|
||||
{
|
||||
await _db.Deleteable<TDest>().Where(deleleExp).ExecuteCommandAsync();
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var entities = new List<TDest>();
|
||||
if (input.ids?.Count > 0)
|
||||
{
|
||||
foreach (var id in input.ids)
|
||||
{
|
||||
var pk = id;
|
||||
TDest entity = new();
|
||||
entity.id = SnowflakeIdHelper.NextId();
|
||||
if (!PropertySet<TDest>.ValueFactories.TryGetValue(mColumnName, out Action<object, object>? setGroupIdAction))
|
||||
{
|
||||
setGroupIdAction = PropertySet<TDest>.CreateSetPropertyValueAction(mColumnName);
|
||||
PropertySet<TDest>.ValueFactories.Add(mColumnName, setGroupIdAction);
|
||||
}
|
||||
setGroupIdAction(entity, input.item_group_id);
|
||||
if (!PropertySet<TDest>.ValueFactories.TryGetValue(name, out Action<object, object>? setAction))
|
||||
{
|
||||
setAction = PropertySet<TDest>.CreateSetPropertyValueAction(name);
|
||||
PropertySet<TDest>.ValueFactories.Add(name, setAction);
|
||||
}
|
||||
setAction(entity, pk);
|
||||
entities.Add(entity);
|
||||
}
|
||||
}
|
||||
var row = await _db.Insertable(entities).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1000);
|
||||
}
|
||||
|
||||
|
||||
protected async Task<dynamic> GetListByMasterId<TRelaction, TDest, TOutput>(string masterId,
|
||||
Expression<Func<TRelaction, bool>> masterFilterExp,
|
||||
Expression<Func<TRelaction, string>> masterSelector,
|
||||
Expression<Func<TDest, bool>> relactionFilterExp)
|
||||
{
|
||||
var config = new TypeAdapterConfig();
|
||||
config.ForType<TDest, TOutput>();
|
||||
var list = new List<TOutput>();
|
||||
var itemIds = await _db.Queryable<TRelaction>().Where(masterFilterExp).Select(masterSelector).ToListAsync();
|
||||
if (itemIds?.Count > 0)
|
||||
{
|
||||
var items = await _db.Queryable<TDest>().Where(relactionFilterExp).ToListAsync();
|
||||
list = items.Adapt<List<TOutput>>();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
111
EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs
Normal file
111
EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 点巡检模板管理
|
||||
/// </summary>
|
||||
[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<EqpSpotInsTemH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EqpSpotInsTemService(ISqlSugarRepository<EqpSpotInsTemH> repository,
|
||||
IUserManager userManager,
|
||||
IVisualDevService visualDevService)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
}
|
||||
|
||||
public async Task<string> Publish(SpotInsTemPublishInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
EqpSpotInsTemH eqpSpotInsTemH = await _repository.GetSingleAsync(x => x.id == input.id);
|
||||
List<EqpSpotInsTemD> eqpSpotInsTemDs = await db.Queryable<EqpSpotInsTemD>().Where(x=>x.spot_ins_item_id==input.id).ToListAsync();
|
||||
|
||||
if (input.equipIds != null && input.equipIds.Length > 0)
|
||||
{
|
||||
List<EqpSpotInsTemEquipH> insertEqpSpotInsTemEquipHs = new List<EqpSpotInsTemEquipH>();
|
||||
List<EqpSpotInsTemEquipD> insertEqpSpotInsTemEquipDs = new List<EqpSpotInsTemEquipD>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
82
EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs
Normal file
82
EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 点巡检执行管理
|
||||
/// </summary>
|
||||
[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<EqpSpotInsRecordH> _repository;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public EquSpotInsRecordService(ISqlSugarRepository<EqpSpotInsRecordH> repository,
|
||||
IRunService runService,
|
||||
IUserManager userManager,
|
||||
IVisualDevService visualDevService)
|
||||
{
|
||||
_repository = repository;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
OverideFuncs.UpdateAsync = ExecuteSpotIns;
|
||||
}
|
||||
|
||||
public async Task<dynamic> ExecuteSpotIns(string id,[FromBody]VisualDevModelDataUpInput input)
|
||||
{
|
||||
DbResult<bool> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -24,15 +26,12 @@ namespace Tnb.EquipMgr
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
|
||||
public class ToolMoldMaintainGroupService : IToolMoldMaintainGroupService, IDynamicApiController, ITransient
|
||||
public class ToolMoldMaintainGroupService : BaseMoldMaintainService, IToolMoldMaintainGroupService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<ToolMoldMaintainGroup> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ISqlSugarClient _db;
|
||||
public ToolMoldMaintainGroupService(ISqlSugarRepository<ToolMoldMaintainGroup> repository, IUserManager userManager)
|
||||
public ToolMoldMaintainGroupService(ISqlSugarRepository<ToolMoldMaintainGroup> repository) : base(repository.AsSugarClient())
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_db = repository.AsSugarClient();
|
||||
}
|
||||
|
||||
@@ -82,7 +81,7 @@ namespace Tnb.EquipMgr
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task RelevanceMaintianGroupAndItem(MoldMaintainGroupItemInput input) =>
|
||||
await Relevance<MoldMaintainGroupItemInput, ToolMoldMaintainGroupItem>(input);
|
||||
await Relevance<MoldMaintainGroupItemInput, ToolMoldMaintainGroupItem>(input, nameof(ToolMoldMaintainGroupItem.item_group_id), nameof(ToolMoldMaintainGroupItem.item_id), it => it.item_group_id == input.item_group_id);
|
||||
|
||||
/// <summary>
|
||||
/// 关联项目组与模具
|
||||
@@ -91,20 +90,36 @@ namespace Tnb.EquipMgr
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task RelevanceMaintianGroupAndMold(MoldMaintainGroupItemRelationInput input) =>
|
||||
await Relevance<MoldMaintainGroupItemRelationInput, ToolMoldMaintainGroupRelation>(input);
|
||||
await Relevance<MoldMaintainGroupItemRelationInput, ToolMoldMaintainGroupRelation>(input, nameof(ToolMoldMaintainGroupRelation.item_group_id), nameof(ToolMoldMaintainGroupRelation.mold_id), it => it.item_group_id == input.item_group_id);
|
||||
/// <summary>
|
||||
/// 删除项目组与模具检查项信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task Delete(MoldMaintainDelInput input)
|
||||
{
|
||||
|
||||
if (input.table_name == "item")
|
||||
{
|
||||
await Delete<ToolMoldMaintainGroupItem>(it => it.item_group_id == input.item_group_id && input.ids.Contains(it.item_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
await Delete<ToolMoldMaintainGroupRelation>(it => it.item_group_id == input.item_group_id && input.ids.Contains(it.mold_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private async Task Relevance<TSrc, TDest>(TSrc input) where TDest : BaseEntity<string>, new()
|
||||
|
||||
private async Task Delete<T>(Expression<Func<T, bool>> deleteExp) where T : BaseEntity<string>, new()
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var entity = input.Adapt<TDest>();
|
||||
entity.id = SnowflakeIdHelper.NextId();
|
||||
var row = await _db.Insertable(entity).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1000);
|
||||
await _db.Deleteable<T>().Where(deleteExp).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,17 +23,32 @@ namespace Tnb.EquipMgr
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class ToolMoldMaintainRuleService : IToolMoldMaintainRuleService, IDynamicApiController, ITransient
|
||||
public class ToolMoldMaintainRuleService : BaseMoldMaintainService, IToolMoldMaintainRuleService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<ToolMoldMaintainRule> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ISqlSugarClient _db;
|
||||
public ToolMoldMaintainRuleService(ISqlSugarRepository<ToolMoldMaintainRule> repository, IUserManager userManager)
|
||||
public ToolMoldMaintainRuleService(ISqlSugarRepository<ToolMoldMaintainRule> repository) : base(repository.AsSugarClient())
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_db = repository.AsSugarClient();
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据规则Id获取匹配的模具列表
|
||||
/// </summary>
|
||||
/// <param name="ruleId">规则Id</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetListById([FromRoute] string ruleId)
|
||||
{
|
||||
var result = new List<MaintainRuleMoldListOutput>();
|
||||
var list = await _db.Queryable<ToolMoldMaintainRuleRelation>().Where(it => it.rule_id == ruleId).ToListAsync();
|
||||
if (list?.Count > 0)
|
||||
{
|
||||
var ids = list.Select(it => it.mold_id).ToList();
|
||||
result = await _db.Queryable<ToolMolds>().Where(it => ids.Contains(it.id))
|
||||
.Select(it => new MaintainRuleMoldListOutput { mold_id = it.id }, true).ToListAsync();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关联模具
|
||||
/// </summary>
|
||||
@@ -41,12 +56,18 @@ namespace Tnb.EquipMgr
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
[HttpPost]
|
||||
public async Task RelevanceMold(RelevanceMoldInput input)
|
||||
public async Task RelevanceMold(RelevanceMoldInput input) =>
|
||||
await Relevance<RelevanceMoldInput, ToolMoldMaintainRuleRelation>(input, nameof(ToolMoldMaintainRuleRelation.rule_id), nameof(ToolMoldMaintainRuleRelation.mold_id), it => it.rule_id == input.rule_id);
|
||||
/// <summary>
|
||||
/// 删除模具信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task DeleteMoldRelevance(RelevanceMoldInput input)
|
||||
{
|
||||
if (input is null) throw new ArgumentNullException(nameof(input));
|
||||
var entity = input.Adapt<ToolMoldMaintainRuleRelation>();
|
||||
var row = await _db.Insertable(entity).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1000);
|
||||
var row = await _db.Deleteable<ToolMoldMaintainRuleRelation>().Where(it => it.rule_id == input.rule_id && input.ids.Contains(it.mold_id)).ExecuteCommandAsync();
|
||||
if (row < 1) throw Oops.Oh(ErrorCode.COM1002);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ToolMolds> _repository;
|
||||
public ToolMoldProductService(IUserManager userManager, ISqlSugarRepository<ToolMolds> repository)
|
||||
public ToolMoldMaterialService(IUserManager userManager, ISqlSugarRepository<ToolMolds> repository)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_repository = repository;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据模具id获取产品集合
|
||||
/// 根据模具id获取物料集合
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<ProductListOutput>> GetProductLists(ToolMoldInput ToolMoldInput)
|
||||
public async Task<List<MaterialListOutput>> GetMaterialLists(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var list = await db.Queryable<BasProduct, ToolMoldsProduct>((a, b) => new object[]
|
||||
var list = await db.Queryable<BasMaterial, ToolMoldsMaterial>((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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 增加模具产品绑定
|
||||
/// 增加模具物料绑定
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productid"></param>
|
||||
@@ -67,21 +66,21 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var ToolMoldsProduct= await _repository.AsSugarClient().Queryable<ToolMoldsProduct>().Where(p=>p.mold_id== ToolMoldInput.mold&&p.product_id== ToolMoldInput.productid).FirstAsync();
|
||||
var ToolMoldsProduct= await _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().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<ToolMoldsProduct>(entity).ExecuteCommandAsync();
|
||||
await _repository.AsSugarClient().Insertable<ToolMoldsMaterial>(entity).ExecuteCommandAsync();
|
||||
}
|
||||
else {
|
||||
ToolMoldsProduct.real_cavity_qty= ToolMoldInput.real_cavity_qty;
|
||||
await _repository.AsSugarClient().Updateable<ToolMoldsProduct>(ToolMoldsProduct).ExecuteCommandAsync();
|
||||
await _repository.AsSugarClient().Updateable<ToolMoldsMaterial>(ToolMoldsProduct).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +91,7 @@ namespace Tnb.EquipMgr
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量删除模具产品绑定
|
||||
/// 批量删除模具物料绑定
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productids"></param>
|
||||
@@ -102,53 +101,53 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsProduct>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.productids.Contains(x.product_id)).ToList();
|
||||
await _repository.AsSugarClient().Deleteable<ToolMoldsProduct>(arr).ExecuteCommandAsync();
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList();
|
||||
await _repository.AsSugarClient().Deleteable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
}
|
||||
/// <summary>
|
||||
/// 产品同组
|
||||
/// 物料同组
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productids"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> SaveProductGroup(ToolMoldInput ToolMoldInput)
|
||||
public async Task<dynamic> SaveMaterialGroup(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsProduct>().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.productids.Contains(x.product_id)).ToList();
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().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<ToolMoldsProduct>(arr).ExecuteCommandAsync();
|
||||
arr.ForEach(p => { p.material_group = sign; });
|
||||
await _repository.AsSugarClient().Updateable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
}
|
||||
/// <summary>
|
||||
/// 取消产品同组
|
||||
/// 取消物料同组
|
||||
/// </summary>
|
||||
/// <param name="mold"></param>
|
||||
/// <param name="productids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> CancelProductGroup(ToolMoldInput ToolMoldInput)
|
||||
public async Task<dynamic> CancelMaterialGroup(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsProduct>().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<ToolMoldsProduct>(arr).ExecuteCommandAsync();
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().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<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据产品id获取模具集合
|
||||
/// 根据物料id获取模具集合
|
||||
/// </summary>
|
||||
/// <param name="productid"></param>
|
||||
/// <returns></returns>
|
||||
@@ -156,11 +155,11 @@ namespace Tnb.EquipMgr
|
||||
public async Task<List<MoldListOutput>> GetMoldLists(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var list = await db.Queryable<ToolMolds, ToolMoldsProduct>((a, b) => new object[]
|
||||
var list = await db.Queryable<ToolMolds, ToolMoldsMaterial>((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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量删除产品模具绑定
|
||||
/// 批量删除物料模具绑定
|
||||
/// </summary>
|
||||
/// <param name="molds"></param>
|
||||
/// <param name="productid"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> DetachProductData(ToolMoldInput ToolMoldInput)
|
||||
public async Task<dynamic> DetachMaterialData(ToolMoldInput ToolMoldInput)
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsProduct>().Where(x => ToolMoldInput.molds.Contains(x.mold_id) && x.product_id == ToolMoldInput.productid).ToList();
|
||||
await _repository.AsSugarClient().Deleteable<ToolMoldsProduct>(arr).ExecuteCommandAsync();
|
||||
var arr = _repository.AsSugarClient().Queryable<ToolMoldsMaterial>().Where(x => ToolMoldInput.molds.Contains(x.mold_id) && x.material_id == ToolMoldInput.materialid).ToList();
|
||||
await _repository.AsSugarClient().Deleteable<ToolMoldsMaterial>(arr).ExecuteCommandAsync();
|
||||
});
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
@@ -68,9 +68,12 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
var his= await _repository.AsSugarClient().Queryable<ToolMoldsEquipment>().ToListAsync();
|
||||
var list = new List<ToolMoldsEquipment>();
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 批量删除模具设备绑定
|
||||
|
||||
23
EquipMgr/Tnb.EquipMgr/Utils/PropertySet.cs
Normal file
23
EquipMgr/Tnb.EquipMgr/Utils/PropertySet.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Tnb.EquipMgr.Utils
|
||||
{
|
||||
public class PropertySet<T>
|
||||
{
|
||||
public static Dictionary<string, Action<object, object>> ValueFactories = new Dictionary<string, Action<object, object>>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public static Action<object, object> CreateSetPropertyValueAction(string propertyName)
|
||||
{
|
||||
var property = typeof(T).GetProperty(propertyName);
|
||||
var target = Expression.Parameter(typeof(object));
|
||||
var propertyValue = Expression.Parameter(typeof(object));
|
||||
var castTarget = Expression.Convert(target, typeof(T));
|
||||
var castPropertyValue = Expression.Convert(propertyValue, property!.PropertyType);
|
||||
var setPropertyValue = Expression.Call(castTarget, property.GetSetMethod()!, castPropertyValue);
|
||||
return Expression.Lambda<Action<object, object>>(setPropertyValue, target, propertyValue).Compile();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user