质检模块
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
namespace Tnb.QcMgr.Entities
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
21
QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs
Normal file
21
QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs
Normal file
@@ -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<CheckItem> items { get; set; }
|
||||
}
|
||||
public class CheckItem
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string name { get; set; }
|
||||
public string code { get; set; }
|
||||
}
|
||||
}
|
||||
32
QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs
Normal file
32
QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs
Normal file
@@ -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<CheckType> checktypoes { get; set; }
|
||||
}
|
||||
public class CheckType
|
||||
{
|
||||
public string id { get; set; }
|
||||
public List<Item> 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; }
|
||||
}
|
||||
}
|
||||
33
QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs
Normal file
33
QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs
Normal file
@@ -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; }
|
||||
}
|
||||
}
|
||||
30
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs
Normal file
30
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs
Normal file
@@ -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<string>
|
||||
{
|
||||
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; }
|
||||
}
|
||||
}
|
||||
84
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs
Normal file
84
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检项清单子表
|
||||
/// </summary>
|
||||
[SugarTable("qc_check_items_d")]
|
||||
public partial class QcCheckItemsD : BaseEntity<string>
|
||||
{
|
||||
public QcCheckItemsD()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行项格式
|
||||
/// </summary>
|
||||
public string? extype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行项内容
|
||||
/// </summary>
|
||||
public string? excontent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 抽检类型
|
||||
/// </summary>
|
||||
public string? check { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 不良原因
|
||||
/// </summary>
|
||||
|
||||
public string? errorcause { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 不良等级
|
||||
/// </summary>
|
||||
public string? errorlevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string? attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行时操作
|
||||
/// </summary>
|
||||
public string? isexec { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
}
|
||||
}
|
||||
59
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs
Normal file
59
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检项清单
|
||||
/// </summary>
|
||||
[SugarTable("qc_check_items_h")]
|
||||
public partial class QcCheckItemsH : BaseEntity<string>
|
||||
{
|
||||
public QcCheckItemsH()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public string? status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扩展
|
||||
/// </summary>
|
||||
public string? extras { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
43
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs
Normal file
43
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检项清单中间表
|
||||
/// </summary>
|
||||
[SugarTable("qc_check_items_r")]
|
||||
public partial class QcCheckItemsR : BaseEntity<string>
|
||||
{
|
||||
public QcCheckItemsR()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 质检项清单编号
|
||||
/// </summary>
|
||||
public string? itemshid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 质检项分类编号
|
||||
/// </summary>
|
||||
public string? typeid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 质检项编号
|
||||
/// </summary>
|
||||
public string? itemid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 质检项清单子表编号
|
||||
/// </summary>
|
||||
public string? itemsdid { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
38
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs
Normal file
38
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检方案附加信息
|
||||
/// </summary>
|
||||
[SugarTable("qc_check_plan_d")]
|
||||
public partial class QcCheckPlanD : BaseEntity<string>
|
||||
{
|
||||
public QcCheckPlanD()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发类型
|
||||
/// </summary>
|
||||
public string? triggertype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发内容
|
||||
/// </summary>
|
||||
public string? content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表编号
|
||||
/// </summary>
|
||||
public string? mainid { get; set; }
|
||||
}
|
||||
}
|
||||
87
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs
Normal file
87
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检方案主表
|
||||
/// </summary>
|
||||
[SugarTable("qc_check_plan_h")]
|
||||
public partial class QcCheckPlanH : BaseEntity<string>
|
||||
{
|
||||
public QcCheckPlanH()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public string? status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 质检类型
|
||||
/// </summary>
|
||||
public string? checktype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 报告填写数量类型
|
||||
/// </summary>
|
||||
public string? numtype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分页方式
|
||||
/// </summary>
|
||||
public string? pagetype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 质检项填写规则
|
||||
/// </summary>
|
||||
public string? writerule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 特别提醒
|
||||
/// </summary>
|
||||
public string? remind { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public string? attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可添加多种物料
|
||||
/// </summary>
|
||||
public string? isaddmul { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
}
|
||||
}
|
||||
28
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs
Normal file
28
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs
Normal file
@@ -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<string>
|
||||
{
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Tnb.QcMgr.Interfaces
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
26
QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs
Normal file
26
QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取质检项集合
|
||||
/// </summary>
|
||||
/// <param name="CheckItemInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetCheckItem();
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检项清单
|
||||
/// </summary>
|
||||
/// <param name="CheckItemInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task SaveData(CheckItemsInput CheckItemsInput);
|
||||
}
|
||||
}
|
||||
19
QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs
Normal file
19
QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存质检方案
|
||||
/// </summary>
|
||||
/// <param name="CheckPlanInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task SaveData(CheckPlanInput CheckPlanInput);
|
||||
}
|
||||
}
|
||||
15
QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs
Normal file
15
QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs
Normal file
@@ -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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Tnb.QcMgr
|
||||
{
|
||||
public class Class1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
161
QcMgr/Tnb.QcMgr/QcCheckItemService.cs
Normal file
161
QcMgr/Tnb.QcMgr/QcCheckItemService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检项清单模块
|
||||
/// </summary>
|
||||
[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<QcCheckItemsH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public QcCheckItemService(ISqlSugarRepository<QcCheckItemsH> 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<QcCheckItemsR>().Where(p => p.itemshid == id).ToListAsync() ;
|
||||
var QcCheckItemsDs=await db.Queryable<QcCheckItemsD>().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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取质检项集合
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetCheckItem()
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
List<CheckItemOut> CheckItemOuts = new List<CheckItemOut>();
|
||||
var datas = await db.Queryable<QcCheckItem>().InnerJoin<QcCheckType>((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<CheckItem>();
|
||||
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<CheckItem>() });
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检项清单
|
||||
/// </summary>
|
||||
/// <param name="CheckItemInput"></param>
|
||||
/// <returns></returns>
|
||||
[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<QcCheckItemsR> QcCheckItemsRs = new List<QcCheckItemsR>();
|
||||
List<QcCheckItemsD> QcCheckItemsDs = new List<QcCheckItemsD>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
77
QcMgr/Tnb.QcMgr/QcCheckPlanService.cs
Normal file
77
QcMgr/Tnb.QcMgr/QcCheckPlanService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检方案模块
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class QcCheckPlanService : IQcCheckPlanService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<QcCheckPlanH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public QcCheckPlanService(ISqlSugarRepository<QcCheckPlanH> repository, IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检方案
|
||||
/// </summary>
|
||||
/// <param name="CheckPlanInput"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
68
QcMgr/Tnb.QcMgr/QcCheckTypeService.cs
Normal file
68
QcMgr/Tnb.QcMgr/QcCheckTypeService.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检项分类模块
|
||||
/// </summary>
|
||||
[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<QcCheckType> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public QcCheckTypeService(
|
||||
ISqlSugarRepository<QcCheckType> repository,
|
||||
IUserManager userManager,
|
||||
IRunService runService,
|
||||
IVisualDevService visualDevService
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
private async Task<dynamic> 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<QcCheckItem>().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!;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user