From eb4a17e59209c684abc2c2dfd3058a01586f2a8e Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Fri, 12 May 2023 09:40:34 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=95=B0=E5=AD=97=E6=8E=A7=E4=BB=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=B2=BE=E5=BA=A6=E6=97=B6=E5=AD=98=E5=9C=A8=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs b/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs index b838c767..90b5c930 100644 --- a/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs +++ b/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs @@ -119,7 +119,8 @@ public class FormDataParsing : ITransient { var len = data.ToString().Split('.').Last().Length; if (fieldsModel.precision > len) fieldsModel.precision = len; - conversionData = data.ToString().Substring(0, data.ToString().IndexOf(".") + (int)fieldsModel.precision); + conversionData = data.ToString().Substring(0, data.ToString().IndexOf(".") + (int)fieldsModel.precision + 1);//modifyby zhoukeda 20230512 增加+1 + conversionData = data.ParseToDouble();//modifyby zhoukeda 20230512 } else conversionData = data; break; From 2978f083b697fb26d1f9a38c17358f50868fd8ec Mon Sep 17 00:00:00 2001 From: PhilPan Date: Fri, 12 May 2023 10:03:17 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=A4=96=E5=8C=85?= =?UTF-8?q?=E8=A3=85=E6=9D=A1=E7=A0=81=E6=89=93=E5=8D=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entity/PrdWorklineState.cs | 165 ++++++++++++++++++ .../IQrPrintService.cs | 12 ++ .../Tnb.ProductionMgr/QrPrintService.cs | 81 +++++++++ system/Tnb.Systems/Common/SampleService.cs | 2 +- 4 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdWorklineState.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdWorklineState.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdWorklineState.cs new file mode 100644 index 00000000..52e9c4e3 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdWorklineState.cs @@ -0,0 +1,165 @@ +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities; + +/// +///产线状态 +/// +[SugarTable("prd_workline_state")] +public partial class PrdWorklineState +{ + public PrdWorklineState() + { + + + } + /// + /// Desc:工序id + /// Default: + /// Nullable:False + /// + public string process_id { get; set; } + + /// + /// Desc:当前产品序列号 + /// Default: + /// Nullable:False + /// + public string lot_no { get; set; } + + /// + /// Desc:工单id + /// Default: + /// Nullable:True + /// + public string mo_id { get; set; } + + /// + /// Desc:更新时间 + /// Default: + /// Nullable:True + /// + public DateTime? update_time { get; set; } + + /// + /// Desc:需要的物料 + /// Default: + /// Nullable:False + /// + public string require_material_spec { get; set; } + + /// + /// Desc:扩展 + /// Default: + /// Nullable:True + /// + public string extras { get; set; } + + /// + /// Desc:当前产品 + /// Default: + /// Nullable:True + /// + public string product_code { get; set; } + + /// + /// Desc:当前产品 + /// Default: + /// Nullable:True + /// + public string product_name { get; set; } + + /// + /// Desc:当前产品 + /// Default: + /// Nullable:True + /// + public string product_spec { get; set; } + + /// + /// Desc:产线id + /// Default: + /// Nullable:False + /// + [SugarColumn(IsPrimaryKey = true)] + public string id { get; set; } + + /// + /// Desc:产线代码 + /// Default: + /// Nullable:True + /// + public string workline_code { get; set; } + + /// + /// Desc:工单代码 + /// Default: + /// Nullable:True + /// + public string mo_code { get; set; } + + /// + /// Desc:模具id + /// Default: + /// Nullable:True + /// + [SugarColumn(IsPrimaryKey = true)] + public string mold_id { get; set; } + + /// + /// Desc:工艺路线id + /// Default: + /// Nullable:True + /// + public string route_id { get; set; } + + /// + /// Desc:工艺路线代码 + /// Default: + /// Nullable:False + /// + public string route_code { get; set; } + + /// + /// Desc:工序代码 + /// Default: + /// Nullable:False + /// + public string process_code { get; set; } + + /// + /// Desc:工位id + /// Default: + /// Nullable:False + /// + public string station_id { get; set; } + + /// + /// Desc:工位代码 + /// Default: + /// Nullable:False + /// + public string station_code { get; set; } + + /// + /// Desc:需要的物料 + /// Default: + /// Nullable:False + /// + public string require_material_id { get; set; } + + /// + /// Desc:需要的物料 + /// Default: + /// Nullable:False + /// + public string require_material_code { get; set; } + + /// + /// Desc:需要的物料 + /// Default: + /// Nullable:True + /// + public string require_material_name { get; set; } + +} diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs new file mode 100644 index 00000000..5ef9e4a6 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs @@ -0,0 +1,12 @@ +using Tnb.ProductionMgr.Entities.Dto; + +namespace Tnb.ProductionMgr.Interfaces +{ + /// + /// 工单生成 + /// + public interface IQrPrintService + { + Task GetCartonQrcode(string workline); + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs b/ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs new file mode 100644 index 00000000..ce19eacd --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs @@ -0,0 +1,81 @@ +using System.Dynamic; +using System.Reflection.Emit; +using Aop.Api.Domain; +using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; +using JNPF.Common.Extension; +using JNPF.Common.Security; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.Extensitions.EventBus; +using JNPF.FriendlyException; +using JNPF.Logging; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using Mapster; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Senparc.Weixin.Work.AdvancedAPIs.MailList; +using SqlSugar; +using Tnb.BasicData; +using Tnb.BasicData.Entitys.Entity; +using Tnb.EquipMgr.Entities; +using Tnb.ProductionMgr.Entities; +using Tnb.ProductionMgr.Entities.Dto; +using Tnb.ProductionMgr.Entities.Enums; +using Tnb.ProductionMgr.Interfaces; + +namespace Tnb.ProductionMgr; + +/// +/// 外包装线条码打印接口 +/// +[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 704)] +[Route("api/produce")] +public class QrPrintService : IQrPrintService, IDynamicApiController, ITransient +{ + private readonly ISqlSugarRepository _repository; + private readonly IDataBaseManager _dataBaseManager; + private readonly IUserManager _userManager; + private readonly IDictionaryDataService _dictionaryDataService; + + public QrPrintService( + ISqlSugarRepository repository, + IDataBaseManager dataBaseManager, + IUserManager userManager, + IDictionaryDataService dictionaryDataService + ) + { + _repository = repository; + _dataBaseManager = dataBaseManager; + _userManager = userManager; + _dictionaryDataService = dictionaryDataService; + } + + + + #region Get + + /// + /// 获取产线当前生产的箱号条码 + /// + /// 所属产线 + /// + [HttpGet("get-carton-qrcode")] + [AllowAnonymous] + public async Task GetCartonQrcode(string workline) + { + var line = await _repository.GetFirstAsync(a => a.id == workline); + var productNo = line?.process_code ?? "16945155732431"; + var pd = DateTime.Now; + var exp = pd.AddYears(3); + var lotNo = pd.ToString("yyMMddHH"); + string tpl = "(01){0}\n(11){1}\n(17){2}\n(10){3}"; + string qrcode = string.Format(tpl, productNo, pd.ToString("yyMM00"), exp.ToString("yyMM00"), lotNo); + return new { qrcode }; + } + + #endregion +} + diff --git a/system/Tnb.Systems/Common/SampleService.cs b/system/Tnb.Systems/Common/SampleService.cs index d86e1db2..1a0a5523 100644 --- a/system/Tnb.Systems/Common/SampleService.cs +++ b/system/Tnb.Systems/Common/SampleService.cs @@ -24,7 +24,7 @@ namespace Tnb.BasicData /// /// 自定义开发服务示例 /// - [ApiDescriptionSettings(Tag = "ProductionMgr", Area = "production", Order = 503)] + [ApiDescriptionSettings(Tag = "ProductionManager", Area = "production", Order = 503)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModelId)] public partial class SampleService : IOverideVisualDevService, IDynamicApiController, ITransient From 2df010604798133cfaaa5ff2fab43961da035326 Mon Sep 17 00:00:00 2001 From: PhilPan Date: Fri, 12 May 2023 10:18:54 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A4=96=E5=8C=85=E8=A3=85=E6=9D=A1?= =?UTF-8?q?=E7=A0=81=E6=89=93=E5=8D=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...IQrPrintService.cs => IWorklineCommService.cs} | 2 +- .../{QrPrintService.cs => WorklineCommService.cs} | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) rename ProductionMgr/Tnb.ProductionMgr.Interfaces/{IQrPrintService.cs => IWorklineCommService.cs} (83%) rename ProductionMgr/Tnb.ProductionMgr/{QrPrintService.cs => WorklineCommService.cs} (84%) diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IWorklineCommService.cs similarity index 83% rename from ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs rename to ProductionMgr/Tnb.ProductionMgr.Interfaces/IWorklineCommService.cs index 5ef9e4a6..a32b2420 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IQrPrintService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IWorklineCommService.cs @@ -5,7 +5,7 @@ namespace Tnb.ProductionMgr.Interfaces /// /// 工单生成 /// - public interface IQrPrintService + public interface IWorklineCommService { Task GetCartonQrcode(string workline); } diff --git a/ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs b/ProductionMgr/Tnb.ProductionMgr/WorklineCommService.cs similarity index 84% rename from ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs rename to ProductionMgr/Tnb.ProductionMgr/WorklineCommService.cs index ce19eacd..ac7ba7c1 100644 --- a/ProductionMgr/Tnb.ProductionMgr/QrPrintService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/WorklineCommService.cs @@ -29,18 +29,18 @@ using Tnb.ProductionMgr.Interfaces; namespace Tnb.ProductionMgr; /// -/// 外包装线条码打印接口 +/// 产线自动化通信接口 /// [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 704)] [Route("api/produce")] -public class QrPrintService : IQrPrintService, IDynamicApiController, ITransient +public class WorklineCommService : IWorklineCommService, IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; private readonly IDataBaseManager _dataBaseManager; private readonly IUserManager _userManager; private readonly IDictionaryDataService _dictionaryDataService; - public QrPrintService( + public WorklineCommService( ISqlSugarRepository repository, IDataBaseManager dataBaseManager, IUserManager userManager, @@ -55,7 +55,7 @@ public class QrPrintService : IQrPrintService, IDynamicApiController, ITransient - #region Get + #region 外包装条码打印接口 /// /// 获取产线当前生产的箱号条码 @@ -67,7 +67,12 @@ public class QrPrintService : IQrPrintService, IDynamicApiController, ITransient public async Task GetCartonQrcode(string workline) { var line = await _repository.GetFirstAsync(a => a.id == workline); - var productNo = line?.process_code ?? "16945155732431"; + var productNo = line?.product_code; + //TODO 仅测试接口用 + if (string.IsNullOrEmpty(productNo)) + { + productNo = "16945" + Random.Shared.Next(0, 999999999).ToString(); //"16945155732431"; + } var pd = DateTime.Now; var exp = pd.AddYears(3); var lotNo = pd.ToString("yyMMddHH"); From 34926dd5e73208dc933c791dc6093942b20ce6e1 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Fri, 12 May 2023 17:25:34 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=8A=A0=E8=AE=BE=E5=A4=87=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=AE=9E=E4=BD=93=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/SpotInsRecordExecutionStatus.cs | 23 +++ .../Entity/EqpEquipType.cs | 100 ++++++++++ .../Entity/EqpSpotInsRecordD.cs | 134 +++++++++++++ .../Entity/EqpSpotInsRecordH.cs | 135 +++++++++++++ .../Entity/EqpSpotInsTemEquipH.cs | 177 ++++++++++++++++++ .../IEquSpotInsTemEquipService.cs | 19 ++ .../Tnb.EquipMgr/EquSpotInsTemEquipService.cs | 70 +++++++ 7 files changed, 658 insertions(+) create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipType.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordH.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemEquipH.cs create mode 100644 EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsTemEquipService.cs create mode 100644 EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs new file mode 100644 index 00000000..f847477a --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs @@ -0,0 +1,23 @@ +namespace Tnb.EquipMgr +{ + /// + /// 点巡检记录执行状态 + /// + public static class SpotInsRecordExecutionStatus + { + /// + /// 待执行 + /// + public const string TOBEEXECUTED = "1"; + + /// + /// 待复核 + /// + public const string TOBECHECK = "1"; + + /// + /// 已完成 + /// + public const string COMPLETED = "1"; + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipType.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipType.cs new file mode 100644 index 00000000..adc81cbb --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipType.cs @@ -0,0 +1,100 @@ +using SqlSugar; +using Tnb.Common.Contracts; + +namespace Tnb.EquipMgr.Entities +{ + /// + ///设备类型 + /// + [SugarTable("eqp_equip_type")] + public partial class EqpEquipType : BaseEntity + { + public EqpEquipType() + { + } + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time { get; set; } + + /// + /// Desc:名称 + /// Default: + /// Nullable:False + /// + public string name { get; set; } + + /// + /// Desc:编码 + /// Default: + /// Nullable:False + /// + public string code { get; set; } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + + /// + /// Desc:是否是特种设备0否1是 + /// Default: + /// Nullable:False + /// + public int is_special_equipment { get; set; } + + /// + /// Desc:排序 + /// Default: + /// Nullable:False + /// + public int ordinal { get; set; } + + /// + /// Desc:状态0 禁用 1 启用 + /// Default: + /// Nullable:False + /// + public int status { get; set; } + + /// + /// Desc:是否是实验设备0否1是 + /// Default: + /// Nullable:False + /// + public int is_lab { 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 remark { 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.Entities/Entity/EqpSpotInsRecordD.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs new file mode 100644 index 00000000..7ac2a892 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs @@ -0,0 +1,134 @@ +using SqlSugar; +using Tnb.Common.Contracts; + +namespace Tnb.EquipMgr.Entities; + +/// +///点巡检执行记录子表 +/// +[SugarTable("eqp_spot_ins_record_d")] +public partial class EqpSpotInsRecordD : BaseEntity +{ + public EqpSpotInsRecordD() + { + } + + /// + /// Desc:点巡检执行记录id + /// Default: + /// Nullable:False + /// + public string spot_ins_record_id { get; set; } + + /// + /// Desc:点巡检项id + /// Default: + /// Nullable:False + /// + public string spot_ins_item_id { get; set; } + + /// + /// Desc:判断类型 + /// Default: + /// Nullable:False + /// + public string judge_type { get; set; } + + /// + /// Desc:上限值 + /// Default: + /// Nullable:True + /// + public decimal? high_value { get; set; } + + /// + /// Desc:是否包含上限值 + /// Default: + /// Nullable:True + /// + public int? high_value_is_include { get; set; } + + /// + /// Desc:下限值 + /// Default: + /// Nullable:True + /// + public decimal? low_value { get; set; } + + /// + /// Desc:是否包含下限值 + /// Default: + /// Nullable:True + /// + public int? low_value_is_include { get; set; } + + /// + /// Desc:标准值 + /// Default: + /// Nullable:True + /// + public double? standard_value { get; set; } + + /// + /// Desc:单位id + /// Default: + /// Nullable:False + /// + public string unit_id { get; set; } + + /// + /// Desc:结果 1 通过 2 不通过 + /// Default: + /// Nullable:True + /// + public int? result { get; set; } + + /// + /// Desc:实际测量值 + /// Default: + /// Nullable:True + /// + public double? real_value { get; set; } + + /// + /// Desc:排序 + /// Default: + /// Nullable:False + /// + public long ordinal { 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:NULL::character varying + /// Nullable:True + /// + public string judge_content { get; set; } + + /// + /// Desc:点巡检方法 + /// Default:NULL::character varying + /// Nullable:True + /// + public string inspection_method { get; set; } + + /// + /// Desc:备注 + /// Default:NULL::character varying + /// Nullable:True + /// + public string remark { get; set; } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordH.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordH.cs new file mode 100644 index 00000000..94a35273 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordH.cs @@ -0,0 +1,135 @@ +using SqlSugar; +using Tnb.Common.Contracts; + +namespace Tnb.EquipMgr.Entities +{ + /// + ///点巡检执行记录表 + /// + [SugarTable("eqp_spot_ins_record_h")] + public partial class EqpSpotInsRecordH : BaseEntity + { + public EqpSpotInsRecordH() + { + } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time { get; set; } + + /// + /// Desc:设备id + /// Default: + /// Nullable:False + /// + public string equip_id { get; set; } + + /// + /// Desc:点巡检设备模板id + /// Default: + /// Nullable:False + /// + public string spot_ins_tem_equip_id { get; set; } + + /// + /// Desc:结果1 合格2不合格 + /// Default: + /// Nullable:True + /// + public int? result { get; set; } + + /// + /// Desc:执行时间 + /// Default: + /// Nullable:True + /// + public DateTime? spot_record_date_time { get; set; } + + /// + /// Desc:不合格推送 + /// Default: + /// Nullable:True + /// + public int? is_send { get; set; } + + /// + /// Desc:推送时间 + /// Default: + /// Nullable:True + /// + public DateTime? send_date_time { get; set; } + + /// + /// Desc:滞后推送时间 + /// Default: + /// Nullable:True + /// + public DateTime? after_send_date_time { get; set; } + + /// + /// Desc:是否滞后推送 + /// Default: + /// Nullable:True + /// + public int? is_after_send { 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 result_remark { get; set; } + + /// + /// Desc:状态 1待执行 2 待复核 3 已完成 + /// Default:NULL::character varying + /// Nullable:True + /// + public string status { get; set; } + + /// + /// Desc:执行人id + /// Default:NULL::character varying + /// Nullable:True + /// + public string spot_record_user_id { get; set; } + + /// + /// Desc:设备类型id + /// Default:NULL::character varying + /// Nullable:True + /// + public string equip_type_id { get; set; } + + /// + /// Desc:推送人id + /// Default:NULL::character varying + /// Nullable:True + /// + public string send_id { get; set; } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemEquipH.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemEquipH.cs new file mode 100644 index 00000000..e0d39d81 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsTemEquipH.cs @@ -0,0 +1,177 @@ +using SqlSugar; +using Tnb.Common.Contracts; + +namespace Tnb.EquipMgr.Entities +{ + /// + ///点巡检设备模板表 + /// + [SugarTable("eqp_spot_ins_tem_equip_h")] + public partial class EqpSpotInsTemEquipH : BaseEntity + { + public EqpSpotInsTemEquipH() + { + } + + /// + /// Desc:创建时间 + /// Default: + /// Nullable:True + /// + public DateTime? create_time { get; set; } + + /// + /// Desc:修改时间 + /// Default: + /// Nullable:True + /// + public DateTime? modify_time { get; set; } + + /// + /// Desc:编码 + /// Default: + /// Nullable:False + /// + public string code { get; set; } + + /// + /// Desc:名称 + /// Default: + /// Nullable:False + /// + 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; } + + /// + /// Desc:计划执行通知提前量 + /// Default: + /// Nullable:True + /// + public int? plan_run_notice { 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: + /// Nullable:True + /// + public int? plan_delay { get; set; } + + /// + /// Desc:启用时间 + /// Default: + /// Nullable:False + /// + public DateTime start_time { get; set; } + + /// + /// Desc:是否启用 + /// Default: + /// Nullable:False + /// + public string is_start { get; set; } + + /// + /// Desc:是否复核 + /// Default: + /// Nullable:False + /// + public string is_repeat { get; set; } + + /// + /// Desc:不合格推送 0 不推送 1 推送 + /// Default: + /// Nullable:True + /// + public int? is_send { get; set; } + + /// + /// Desc:点巡检模板id + /// Default:NULL::character varying + /// Nullable:True + /// + public string spot_ins_tem_id { get; set; } + + /// + /// Desc:TODO + /// Default:NULL::character varying + /// Nullable:True + /// + public string equip_id { get; set; } + + /// + /// Desc:TODO + /// Default:NULL::character varying + /// Nullable:True + /// + public string remark { get; set; } + + /// + /// Desc:计划执行通知提前量单位 1 小时 2 天 3 周 + /// Default:NULL::character varying + /// Nullable:True + /// + public string plan_run_notice_unit { get; set; } + + /// + /// Desc:执行滞后推送时间单位 1 小时 2 天 3 周 + /// Default:NULL::character varying + /// Nullable:True + /// + public string plan_delay_unit { 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:推送人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/IEquSpotInsTemEquipService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsTemEquipService.cs new file mode 100644 index 00000000..48b4b400 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsTemEquipService.cs @@ -0,0 +1,19 @@ +namespace Tnb.EquipMgr.Interfaces +{ + public interface IEquSpotInsTemEquipService + { + // /// + // /// 获取数 + // /// + // /// + // /// + // public Task GetTree(); + + /// + /// 停止计划 + /// + /// + /// + public Task Stop(Dictionary parameters); + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs new file mode 100644 index 00000000..f866e77c --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs @@ -0,0 +1,70 @@ +using JNPF.Common.Enums; +using JNPF.Common.Security; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.FriendlyException; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Tnb.EquipMgr.Interfaces; +using Tnb.EquipMgr.Entities; + +namespace Tnb.EquipMgr +{ + /// + /// 设备管理 + /// + [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + public class EquSpotInsTemEquipService : IEquSpotInsTemEquipService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + + public EquSpotInsTemEquipService(ISqlSugarRepository repository) + { + _repository = repository; + } + + // public async Task GetTree() + // { + // List eqpEquipments = + // var data = _repository.AsSugarClient().Queryable() + // .Where(x => x.status == 1) + // .Select((x) => new TreeModel + // { + // id = x.id, + // parentId = "-1", + // hasChildren = SqlFunc.Subqueryable().Where(y=>y.eqp_type_id==x.id).Any(), + // isLeaf = false, + // num = SqlFunc.Subqueryable().Where(y=>y.eqp_type_id==x.id).Count(), + // children = SqlFunc.Subqueryable().Where(y=>y.eqp_type_id==x.id).Select(y=>new TreeModel() + // { + // + // }).ToList(model => ), + // }); + // return new { list = 1 }; + // } + + public async Task Stop(Dictionary parameters) + { + string id = parameters["id"]; + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + { + await _repository.UpdateAsync(x => new EqpSpotInsTemEquipH() + { + is_start = "0" + }, x => x.id == id); + List ids = await _repository.AsSugarClient().Queryable() + .Where(x => x.spot_ins_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED) + .Select(x => x.id).ToListAsync(); + await _repository.AsSugarClient().Deleteable() + .Where(x => x.spot_ins_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync(); + + await _repository.AsSugarClient().Deleteable() + .Where(x => ids.Contains(x.spot_ins_record_id)).ExecuteCommandAsync(); + + }); + + if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + } + } +} \ No newline at end of file