diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs new file mode 100644 index 00000000..2f30d374 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs @@ -0,0 +1,16 @@ +namespace Tnb.EquipMgr.Entities.Dto +{ + public class EquipDaqQueryOutput + { + public string id { get; set; } + public string data_source { get; set; } + public string create_id { get; set; } + public string create_time { get; set; } + public string data_type { get; set; } + public string enabled { get; set; } + public string equip_id { get; set; } + public string label_name { get; set; } + public string label_point { get; set; } + public string remark { get; set; } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpDaq.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpDaq.cs new file mode 100644 index 00000000..d387f251 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpDaq.cs @@ -0,0 +1,87 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.EquipMgr.Entities; + +/// +/// 数据采集项目 +/// +[SugarTable("eqp_daq")] +public partial class EqpDaq : BaseEntity +{ + public EqpDaq() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 数据源 + /// + public string data_source { get; set; } = string.Empty; + + /// + /// 标签名称 + /// + public string? label_name { get; set; } + + /// + /// 标签点位 + /// + public string? label_point { get; set; } + + /// + /// 数据类型 + /// + public string? data_type { get; set; } + + /// + /// 是否启用 + /// + public int? enabled { get; set; } + + /// + /// 备注 + /// + public string? remark { get; set; } + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + + /// + /// 设备id + /// + public string equip_id { get; set; } = string.Empty; + + /// + /// 流程任务Id + /// + public string? f_flowtaskid { get; set; } + + /// + /// 流程引擎Id + /// + public string? f_flowid { get; set; } + +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpDaqService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpDaqService.cs new file mode 100644 index 00000000..9000f256 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpDaqService.cs @@ -0,0 +1,12 @@ +using Tnb.EquipMgr.Entities.Dto; +namespace Tnb.EquipMgr.Interfaces +{ + public interface IEqpDaqService + { + /// + /// 根据设备id获取数采项目 + /// + /// + public Task GetEquipDaqList(EquipQueryInput input); + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs b/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs new file mode 100644 index 00000000..044bec62 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs @@ -0,0 +1,63 @@ +using JNPF.Common.Core.Manager; +using JNPF.Common.Filter; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.Systems.Entitys.Permission; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using SqlSugar; +using Tnb.EquipMgr.Entities; +using Tnb.EquipMgr.Entities.Dto; +using Tnb.EquipMgr.Interfaces; + +namespace Tnb.EquipMgr +{ + /// + /// 设备数采项目 + /// + [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + public class EqpDaqService : IEqpDaqService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + + public EqpDaqService(ISqlSugarRepository repository, IUserManager userManager) + { + _userManager = userManager; + _repository = repository; + } + + [HttpPost] + public async Task GetEquipDaqList(EquipQueryInput input) + { + var db = _repository.AsSugarClient(); + Dictionary queryJson = new Dictionary(); + if (!string.IsNullOrEmpty(input.queryJson)) + { + queryJson = JsonConvert.DeserializeObject>(input.queryJson); + } + var result = await db.Queryable() + .LeftJoin((a,b)=>a.create_id==b.Id) + .Where(a=>a.equip_id==input.equip_id) + .WhereIF(queryJson.ContainsKey("data_source"),a=>a.data_source==queryJson["data_source"]) + .WhereIF(queryJson.ContainsKey("label_name"),a=>a.label_name.Contains(queryJson["label_name"])) + .WhereIF(queryJson.ContainsKey("label_point"),a=>a.label_point.Contains(queryJson["label_point"])) + .Select((a,b) => new EquipDaqQueryOutput + { + id = a.id, + data_source = a.data_source, + create_id = b.RealName, + create_time = a.create_time.Value.ToString("yyyy-MM-dd HH:mm"), + data_type = a.data_type, + enabled = a.enabled==1 ? "是" : "否", + equip_id = a.equip_id, + label_name = a.label_name, + label_point = a.label_point, + remark = a.remark + }).ToPagedListAsync(input.currentPage, input.pageSize); + + return PageResult.SqlSugarPageResult(result); + } + } +} \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs index 0959a242..6df470f2 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs @@ -1,6 +1,7 @@ using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; +using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; @@ -41,6 +42,7 @@ namespace Tnb.EquipMgr var db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { + eqpEquipScrap.id = SnowflakeIdHelper.NextId(); eqpEquipScrap.create_id = _userManager.UserId; eqpEquipScrap.create_time = DateTime.Now; diff --git a/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs b/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs index b36da391..d392a776 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs @@ -11,7 +11,8 @@ using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr { - /// 设备备品备件 + /// + /// 设备技术参数 /// [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] diff --git a/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessParamType.cs b/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessParamType.cs new file mode 100644 index 00000000..5c7410c0 --- /dev/null +++ b/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessParamType.cs @@ -0,0 +1,67 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.PerMgr.Entities; + +/// +/// 工艺参数类型 +/// +[SugarTable("per_process_param_type")] +public partial class PerProcessParamType : BaseEntity +{ + public PerProcessParamType() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 名称 + /// + public string name { get; set; } = string.Empty; + + /// + /// 设备类型id + /// + public string equip_type_id { get; set; } = string.Empty; + + /// + /// 排序 + /// + public long ordinal { get; set; } + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 流程任务Id + /// + public string? f_flowtaskid { get; set; } + + /// + /// 流程引擎Id + /// + public string? f_flowid { get; set; } + +} \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsH.cs b/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsH.cs new file mode 100644 index 00000000..feee5438 --- /dev/null +++ b/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsH.cs @@ -0,0 +1,107 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.PerMgr.Entities; + +/// +/// 工艺标准 +/// +[SugarTable("per_process_standards_h")] +public partial class PerProcessStandardsH : BaseEntity +{ + public PerProcessStandardsH() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 工艺类型 + /// + public string process_type { get; set; } = string.Empty; + + /// + /// 编号 + /// + public string code { get; set; } = string.Empty; + + /// + /// 工艺文件名 + /// + public string? file_name { get; set; } + + /// + /// 是否启用 + /// + public int? enabled { get; set; } + + /// + /// 产出物料id + /// + public string? output_material_id { get; set; } + + /// + /// 设备id + /// + public string equip_id { get; set; } = string.Empty; + + /// + /// 模具id + /// + public string? molds_id { get; set; } + + /// + /// 工序id + /// + public string? process_id { get; set; } + + /// + /// 投入物料id + /// + public string? input_material_id { get; set; } + + /// + /// 版本号 + /// + public string version { get; set; } = string.Empty; + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + + /// + /// 所属组织 + /// + public string? org_id { get; set; } + + /// + /// 备注 + /// + public string? remark { get; set; } + + /// + /// 流程任务Id + /// + public string? f_flowtaskid { get; set; } + + /// + /// 流程引擎Id + /// + public string? f_flowid { get; set; } + +} diff --git a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamService.cs b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamService.cs index d7cff95c..a4d98d0b 100644 --- a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamService.cs +++ b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamService.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Mvc; using Tnb.PerMgr.Entities.Dto; namespace Tnb.PerMgr.Interfaces @@ -10,5 +11,6 @@ namespace Tnb.PerMgr.Interfaces /// /// public Task GetProcessParamInfo(Dictionary dic); + } } \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessStandardsService.cs b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessStandardsService.cs new file mode 100644 index 00000000..6014b32c --- /dev/null +++ b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessStandardsService.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Tnb.PerMgr.Interfaces +{ + public interface IPerProcessStandardsService + { + /// + /// 导出模板 + /// + /// + public Task ExportTemplate(); + } +} \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr/PerProcessParamService.cs b/PerMgr/Tnb.PerMgr/PerProcessParamService.cs index e73bd08e..c0959d67 100644 --- a/PerMgr/Tnb.PerMgr/PerProcessParamService.cs +++ b/PerMgr/Tnb.PerMgr/PerProcessParamService.cs @@ -1,7 +1,12 @@ using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; +using JNPF.FriendlyException; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using NPOI.SS.UserModel; +using NPOI.SS.Util; +using NPOI.XSSF.UserModel; using SqlSugar; using Tnb.PerMgr.Entities; using Tnb.PerMgr.Entities.Dto; @@ -41,5 +46,6 @@ namespace Tnb.PerMgr }).SingleAsync(); return result; } + } } \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs b/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs new file mode 100644 index 00000000..72ea3b0d --- /dev/null +++ b/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs @@ -0,0 +1,94 @@ +using JNPF; +using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; +using JNPF.Common.Helper; +using JNPF.Common.Security; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.FriendlyException; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using NPOI.SS.UserModel; +using NPOI.SS.Util; +using NPOI.XSSF.UserModel; +using SqlSugar; +using Tnb.PerMgr.Entities; +using Tnb.PerMgr.Entities.Dto; +using Tnb.PerMgr.Interfaces; + +namespace Tnb.PerMgr +{ + /// + /// 工艺标准 + /// + [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + public class PerProcessStandardsService : IPerProcessStandardsService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + + public PerProcessStandardsService(ISqlSugarRepository repository, IUserManager userManager) + { + _userManager = userManager; + _repository = repository; + } + + [AllowAnonymous] + [HttpGet] + public async Task ExportTemplate() + { + try + { + var db = _repository.AsSugarClient(); + string[] perProcessParamTypes = await db.Queryable().OrderBy(x => x.ordinal).Select(x=>x.name).ToArrayAsync(); + string[] perProcessParams = await db.Queryable().OrderBy(x => x.ordinal).Select(x=>x.name).ToArrayAsync(); + + + XSSFWorkbook workbook = new XSSFWorkbook(); + NPOI.SS.UserModel.ISheet sheet = workbook.CreateSheet("BOM详情"); + + IRow row1 = sheet.CreateRow(0); + string[] titles = new[] { "工艺参数类型", "工艺参数", "设定值" }; + + for (int i = 0; i < titles.Length; i++) + { + ICell cell1 = row1.CreateCell(i); + cell1.SetCellValue(titles[i]); + sheet.SetColumnWidth(i,15 * 256); + } + + int rowIndex = 1; + + // var column = sheet.GetColumn(0); + // 设置下拉项 + var validationHelper = sheet.GetDataValidationHelper(); + var constraint = validationHelper.CreateExplicitListConstraint(perProcessParamTypes); + var region = new CellRangeAddressList(1, 1000, 0, 0); + var validation = validationHelper.CreateValidation(constraint, region); + sheet.AddValidationData(validation); + + var constraint2 = validationHelper.CreateExplicitListConstraint(perProcessParams); + var region2 = new CellRangeAddressList(1, 1000, 1, 1); + var validation2 = validationHelper.CreateValidation(constraint2, region2); + sheet.AddValidationData(validation2); + + + MemoryStream ms = new MemoryStream(); + + workbook.Write(ms); + MemoryStream ms2 = new MemoryStream(ms.ToArray()); + ms2.Position = 0; + FileStreamResult fileStreamResult = new FileStreamResult(ms2, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") { FileDownloadName = "template.xlsx" }; + return fileStreamResult; + } + catch (Exception e) + { + Console.WriteLine(e); + throw Oops.Bah("导出失败"); + } + + } + } +} \ No newline at end of file diff --git a/QcMgr/Tnb.QcMgr.Entities/Class1.cs b/QcMgr/Tnb.QcMgr.Entities/Class1.cs deleted file mode 100644 index 95ad6ecf..00000000 --- a/QcMgr/Tnb.QcMgr.Entities/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Tnb.QcMgr.Entities -{ - public class Class1 - { - - } -} \ No newline at end of file diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs new file mode 100644 index 00000000..cab28a3f --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.QcMgr.Entities +{ + public class CheckItemOut + { + public string checktypeid { get; set; } + public string checktypename { get; set; } + public List items { get; set; } + } + public class CheckItem + { + public string itemid { get; set; } + public string name { get; set; } + public string code { get; set; } + } +} diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs new file mode 100644 index 00000000..a2a55c08 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.QcMgr.Entities.Dto +{ + public class CheckItemsInput + { + public string name { get; set; } + public string status { get; set; } + public List checktypoes { get; set; } + } + public class CheckType + { + public string id { get; set; } + public List items { get; set; } + } + public class Item + { + public string itemid { get; set; } + public string extype { get; set; } + public string excontent { get; set; } + public string check { get; set; } + public string errorcause { get; set; } + public string errorlevel { get; set; } + public string remark { get; set; } + public string attachment { get; set; } + public string isexec { get; set; } + } +} diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs new file mode 100644 index 00000000..38feac7b --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.QcMgr.Entities +{ + public class CheckPlanInput + { + public string name { get; set; } + + public string status { get; set; } + + public string checktype { get; set; } + + public string numtype { get; set; } + + public string pagetype { get; set; } + + public string writerule { get; set; } + + public string remind { get; set; } + + public string attachment { get; set; } + + public string isaddmul { get; set; } + + public string triggertype { get; set; } + + public string content { get; set; } + } +} diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs new file mode 100644 index 00000000..2d5aa266 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.QcMgr.Entities +{ + [SugarTable("qc_check_item")] + public class QcCheckItem : BaseEntity + { + public QcCheckItem() + { + id = SnowflakeIdHelper.NextId(); + } + public string? code { get; set; } + public string? name { get; set; } + public string? type { get; set; } + public string? attachment { get; set; } + public string? create_id { get; set; } + public DateTime? create_time { get; set; } + public string? modify_id { get; set; } + public DateTime? modify_time { get; set; } + public string? extras { get; set; } + public string? remark { get; set; } + } +} diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs new file mode 100644 index 00000000..9e122b8e --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.QcMgr.Entities +{ + /// + /// 质检项清单子表 + /// + [SugarTable("qc_check_items_d")] + public partial class QcCheckItemsD : BaseEntity + { + public QcCheckItemsD() + { + id = SnowflakeIdHelper.NextId(); + } + + /// + /// 执行项格式 + /// + public string? extype { get; set; } + + /// + /// 执行项内容 + /// + public string? excontent { get; set; } + + /// + /// 抽检类型 + /// + public string? check { get; set; } + + /// + /// 不良原因 + /// + + public string? errorcause { get; set; } + + /// + /// 不良等级 + /// + public string? errorlevel { get; set; } + + /// + /// 备注 + /// + public string? remark { get; set; } + + /// + /// 附件 + /// + public string? attachment { get; set; } + + /// + /// 执行时操作 + /// + public string? isexec { get; set; } + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + } +} diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs new file mode 100644 index 00000000..b6472209 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.QcMgr.Entities +{ + /// + /// 质检项清单 + /// + [SugarTable("qc_check_items_h")] + public partial class QcCheckItemsH : BaseEntity + { + public QcCheckItemsH() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 名称 + /// + public string? name { get; set; } + + /// + /// 状态 + /// + public string? status { get; set; } + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + + /// + /// 扩展 + /// + public string? extras { get; set; } + + } + +} diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs new file mode 100644 index 00000000..0266db63 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.QcMgr.Entities +{ + /// + /// 质检项清单中间表 + /// + [SugarTable("qc_check_items_r")] + public partial class QcCheckItemsR : BaseEntity + { + public QcCheckItemsR() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 质检项清单编号 + /// + public string? itemshid { get; set; } + + /// + /// 质检项分类编号 + /// + public string? typeid { get; set; } + + /// + /// 质检项编号 + /// + public string? itemid { get; set; } + + /// + /// 质检项清单子表编号 + /// + public string? itemsdid { get; set; } + + } +} \ No newline at end of file diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs new file mode 100644 index 00000000..9fede172 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.QcMgr.Entities +{ + /// + /// 质检方案附加信息 + /// + [SugarTable("qc_check_plan_d")] + public partial class QcCheckPlanD : BaseEntity + { + public QcCheckPlanD() + { + id = SnowflakeIdHelper.NextId(); + } + + /// + /// 触发类型 + /// + public string? triggertype { get; set; } + + /// + /// 触发内容 + /// + public string? content { get; set; } + + /// + /// 主表编号 + /// + public string? mainid { get; set; } + } +} diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs new file mode 100644 index 00000000..c1c8a1d1 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.QcMgr.Entities +{ + /// + /// 质检方案主表 + /// + [SugarTable("qc_check_plan_h")] + public partial class QcCheckPlanH : BaseEntity + { + public QcCheckPlanH() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 名称 + /// + public string? name { get; set; } + + /// + /// 状态 + /// + public string? status { get; set; } + + /// + /// 质检类型 + /// + public string? checktype { get; set; } + + /// + /// 报告填写数量类型 + /// + public string? numtype { get; set; } + + /// + /// 分页方式 + /// + public string? pagetype { get; set; } + + /// + /// 质检项填写规则 + /// + public string? writerule { get; set; } + + /// + /// 特别提醒 + /// + public string? remind { get; set; } + + /// + /// 附件 + /// + public string? attachment { get; set; } + + /// + /// 可添加多种物料 + /// + public string? isaddmul { get; set; } + + /// + /// 创建用户 + /// + public string? create_id { get; set; } + + /// + /// 创建时间 + /// + public DateTime? create_time { get; set; } + + /// + /// 修改用户 + /// + public string? modify_id { get; set; } + + /// + /// 修改时间 + /// + public DateTime? modify_time { get; set; } + } +} diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs new file mode 100644 index 00000000..49266496 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.QcMgr.Entities +{ + [SugarTable("qc_check_type")] + public class QcCheckType : BaseEntity + { + public QcCheckType() + { + id = SnowflakeIdHelper.NextId(); + } + public string? name { get; set; } + public string? inspection_items { get; set; } + public string? remark { get; set; } + public string? create_id { get; set; } + public DateTime? create_time { get; set; } + public string? modify_id { get; set; } + public DateTime? modify_time { get; set; } + public string? extras { get; set; } + } +} diff --git a/QcMgr/Tnb.QcMgr.Interfaces/Class1.cs b/QcMgr/Tnb.QcMgr.Interfaces/Class1.cs deleted file mode 100644 index 6e6cc75b..00000000 --- a/QcMgr/Tnb.QcMgr.Interfaces/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Tnb.QcMgr.Interfaces -{ - public class Class1 - { - - } -} \ No newline at end of file diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs new file mode 100644 index 00000000..0744b461 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.QcMgr.Entities.Dto; + +namespace Tnb.QcMgr.Interfaces +{ + public interface IQcCheckItemService + { + /// + /// 获取质检项集合 + /// + /// + /// + public Task GetCheckItem(); + + /// + /// 保存质检项清单 + /// + /// + /// + public Task SaveData(CheckItemsInput CheckItemsInput); + } +} diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs new file mode 100644 index 00000000..d30b3b0b --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.QcMgr.Entities; + +namespace Tnb.QcMgr.Interfaces +{ + public interface IQcCheckPlanService + { + /// + /// 保存质检方案 + /// + /// + /// + public Task SaveData(CheckPlanInput CheckPlanInput); + } +} diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs new file mode 100644 index 00000000..1c373810 --- /dev/null +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities.Dto; + +namespace Tnb.QcMgr.Interfaces +{ + public interface IQcCheckTypeService + { + + } +} diff --git a/QcMgr/Tnb.QcMgr/Class1.cs b/QcMgr/Tnb.QcMgr/Class1.cs deleted file mode 100644 index 2e72d42d..00000000 --- a/QcMgr/Tnb.QcMgr/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Tnb.QcMgr -{ - public class Class1 - { - - } -} \ No newline at end of file diff --git a/QcMgr/Tnb.QcMgr/QcCheckItemService.cs b/QcMgr/Tnb.QcMgr/QcCheckItemService.cs new file mode 100644 index 00000000..92342c9b --- /dev/null +++ b/QcMgr/Tnb.QcMgr/QcCheckItemService.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Aspose.Cells.Drawing; +using COSXML.Model.Tag; +using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.FriendlyException; +using JNPF.VisualDev; +using JNPF.VisualDev.Interfaces; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.CodeAnalysis; +using NPOI.SS.Formula.Eval; +using NPOI.Util; +using SqlSugar; +using Tnb.Common; +using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities.Dto; +using Tnb.QcMgr.Interfaces; + +namespace Tnb.QcMgr +{ + /// + /// 质检项清单模块 + /// + [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)] + [Route("api/[area]/[controller]/[action]")] + [OverideVisualDev(ModuleId)] + public class QcCheckItemService : IOverideVisualDevService, IQcCheckItemService, IDynamicApiController, ITransient + { + private const string ModuleId = "26500755139349"; + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + public QcCheckItemService(ISqlSugarRepository repository, IUserManager userManager) + { + _repository = repository; + _userManager = userManager; + OverideFuncs.DeleteAsync = Delete; + } + + private async Task Delete(string id) + { + var db = _repository.AsSugarClient(); + var QcCheckItemsH=await db.Queryable< QcCheckItemsH >().Where(p=>p.id==id).FirstAsync(); + var QcCheckItemsRs = await db.Queryable().Where(p => p.itemshid == id).ToListAsync() ; + var QcCheckItemsDs=await db.Queryable().Where(p=> QcCheckItemsRs.Select(p=>p.id).ToList().Contains( p.id)).ToListAsync() ; + await db.Ado.BeginTranAsync(); + await db.Deleteable(QcCheckItemsH).ExecuteCommandAsync(); + await db.Deleteable(QcCheckItemsRs).ExecuteCommandAsync(); + await db.Deleteable(QcCheckItemsDs).ExecuteCommandAsync(); + await db.Ado.CommitTranAsync(); + } + + /// + /// 获取质检项集合 + /// + /// + [HttpGet] + public async Task GetCheckItem() + { + var db = _repository.AsSugarClient(); + List CheckItemOuts = new List(); + var datas = await db.Queryable().InnerJoin((a, b) => a.type == b.id).Select((a, b) => new + { + id = a.id, + name = a.name, + code = a.code, + type = a.type, + typename = b.name + }).ToListAsync(); + foreach (var data in datas) + { + if (CheckItemOuts.Where(p => p.checktypeid == data.type).Any()) + { + var CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First(); + if (CheckItemOut.items == null) + { + CheckItemOut.items = new List(); + CheckItemOut.items.Add(new CheckItem { itemid = data.id, name = data.name, code = data.code }); + } + else + CheckItemOut.items.Add(new CheckItem { itemid = data.id, name = data.name, code = data.code }); + } + else + { + CheckItemOuts.Add(new CheckItemOut { checktypeid = data.type, checktypename = data.typename, items = new List() }); + var CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First(); + CheckItemOut.items.Add(new CheckItem() { itemid = data.id, name = data.name, code = data.code }); + } + } + return CheckItemOuts; + } + + /// + /// 保存质检项清单 + /// + /// + /// + [HttpPost] + public async Task SaveData(CheckItemsInput CheckItemsInput) + { + var db = _repository.AsSugarClient(); + try + { + + QcCheckItemsH QcCheckItemsH = new QcCheckItemsH(); + QcCheckItemsH.name = CheckItemsInput.name; + QcCheckItemsH.status = CheckItemsInput.status; + QcCheckItemsH.create_time = DateTime.Now; + QcCheckItemsH.create_id = _userManager.UserId; + List QcCheckItemsRs = new List(); + List QcCheckItemsDs = new List(); + + foreach (var checktype in CheckItemsInput.checktypoes) + { + foreach (var item in checktype.items) + { + var QcCheckItemsD = new QcCheckItemsD() + { + extype = item.extype, + excontent = item.excontent, + check = item.check, + errorcause = item.errorcause, + errorlevel = item.errorlevel, + remark = item.remark, + attachment = item.attachment, + isexec = item.isexec + }; + QcCheckItemsDs.Add(QcCheckItemsD); + var QcCheckItemsR = new QcCheckItemsR() + { + itemshid = QcCheckItemsH.id, + typeid = checktype.id, + itemid = item.itemid, + itemsdid = QcCheckItemsD.id + }; + + QcCheckItemsRs.Add(QcCheckItemsR); + } + } + await db.Ado.BeginTranAsync(); + await db.Insertable(QcCheckItemsH).ExecuteCommandAsync(); + await db.Insertable(QcCheckItemsRs).ExecuteCommandAsync(); + await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync(); + await db.Ado.CommitTranAsync(); + } + catch (Exception ex) + { + await db.Ado.RollbackTranAsync(); + throw Oops.Oh(ErrorCode.COM1000); + } + } + } +} diff --git a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs new file mode 100644 index 00000000..fafd9639 --- /dev/null +++ b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Aspose.Cells.Drawing; +using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.FriendlyException; +using JNPF.VisualDev; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities.Dto; +using Tnb.QcMgr.Interfaces; + +namespace Tnb.QcMgr +{ + /// + /// 质检方案模块 + /// + [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)] + [Route("api/[area]/[controller]/[action]")] + public class QcCheckPlanService : IQcCheckPlanService, IDynamicApiController, ITransient + { + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + + public QcCheckPlanService(ISqlSugarRepository repository, IUserManager userManager) + { + _repository = repository; + _userManager = userManager; + + } + + /// + /// 保存质检方案 + /// + /// + /// + public async Task SaveData(CheckPlanInput CheckPlanInput) + { + var db = _repository.AsSugarClient(); + try + { + QcCheckPlanH QcCheckPlanH = new QcCheckPlanH(); + QcCheckPlanH.name = CheckPlanInput.name; + QcCheckPlanH.status = CheckPlanInput.status; + QcCheckPlanH.checktype = CheckPlanInput.checktype; + QcCheckPlanH.numtype = CheckPlanInput.numtype; + QcCheckPlanH.pagetype = CheckPlanInput.pagetype; + QcCheckPlanH.writerule = CheckPlanInput.writerule; + QcCheckPlanH.remind = CheckPlanInput.remind; + QcCheckPlanH.attachment = CheckPlanInput.attachment; + QcCheckPlanH.isaddmul = CheckPlanInput.isaddmul; + QcCheckPlanH.create_time = DateTime.Now; + QcCheckPlanH.create_id = _userManager.UserId; + QcCheckPlanD QcCheckPlanD = new QcCheckPlanD(); + QcCheckPlanD.mainid = QcCheckPlanH.id; + QcCheckPlanD.triggertype = CheckPlanInput.triggertype; + QcCheckPlanD.content = CheckPlanInput.content; + await db.Ado.BeginTranAsync(); + await db.Insertable(QcCheckPlanH).ExecuteCommandAsync(); + await db.Insertable(QcCheckPlanD).ExecuteCommandAsync(); + await db.Ado.CommitTranAsync(); + } + catch (Exception ex) + { + await db.Ado.RollbackTranAsync(); + throw Oops.Oh(ErrorCode.COM1000); + } + } + } +} diff --git a/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs b/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs new file mode 100644 index 00000000..ac18a64f --- /dev/null +++ b/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using JNPF.Common.Core.Manager; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Entitys; +using JNPF.VisualDev.Interfaces; +using Microsoft.AspNetCore.Mvc; +using NPOI.Util; +using SqlSugar; +using Tnb.QcMgr.Interfaces; +using Tnb.QcMgr.Entities; +using Microsoft.AspNetCore.Identity; +using JNPF.Systems.Entitys.Permission; + +namespace Tnb.QcMgr +{ + /// + /// 质检项分类模块 + /// + [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)] + [Route("api/[area]/[controller]/[action]")] + [OverideVisualDev(ModuleId)] + public class QcCheckTypeService : IOverideVisualDevService, IQcCheckTypeService, IDynamicApiController, ITransient + { + private const string ModuleId = "26436503234597"; + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + private readonly IVisualDevService _visualDevService; + private readonly IRunService _runService; + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + public QcCheckTypeService( + ISqlSugarRepository repository, + IUserManager userManager, + IRunService runService, + IVisualDevService visualDevService + ) + { + _repository = repository; + _userManager = userManager; + _visualDevService = visualDevService; + _runService = runService; + OverideFuncs.GetListAsync = GetList; + } + private async Task GetList(VisualDevModelListQueryInput input) + { + var db = _repository.AsSugarClient(); + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); + var data = await _runService.GetListResult(templateEntity, input); + if (data?.list?.Count > 0) + { + var items = await db.Queryable().ToListAsync(); + foreach (var row in data.list) + { + row["inspection_items"] = string.Join(",", items.Where(p => p.type == row["id"].ToString()).Select(p => p.name).ToList()); + } + } + return data!; + } + } +} diff --git a/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs b/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs index 9b5d4270..5dd420a1 100644 --- a/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs +++ b/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs @@ -116,11 +116,13 @@ public class FormDataParsing : ITransient if (fieldsModel.precision > dataList.Last().Length) fieldsModel.precision = dataList.Last().Length; conversionData = dataList.First() + "." + dataList.Last().Substring(0, (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 + conversionData = conversionData.ParseToDouble();//modifyby zhoukeda 20230605 } - else if (fieldsModel.precision > 0) conversionData = data.ToString() + ".".PadRight((int)fieldsModel.precision + 1, '0'); - else conversionData = data; + else if (fieldsModel.precision > 0) + { + conversionData = data.ToString() + ".".PadRight((int)fieldsModel.precision + 1, '0'); + conversionData = conversionData.ParseToDouble();//modifyby zhoukeda 20230605 + }else conversionData = data; break; case JnpfKeyConst.JNPFAMOUNT: conversionData = data.ParseToDecimal(); // 金额输入