Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -79,7 +79,7 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
await _repository.AsSugarClient().Updateable<EqpMaintainRecordD>()
|
||||
.SetColumns(x=>x.result==item["result"])
|
||||
.SetColumns(x=>x.maintain_descrip==item["maintain_descrip"])
|
||||
.SetColumnsIF(item.ContainsKey("maintain_descrip"),x=>x.maintain_descrip==item["maintain_descrip"])
|
||||
.Where(x=>x.id==item["id"])
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
@@ -3,11 +3,17 @@ namespace Tnb.PerMgr.Entities.Dto
|
||||
public class ProcessChildDataInput
|
||||
{
|
||||
|
||||
public string id { get; set; }
|
||||
public string process_standards_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工艺参数id
|
||||
/// </summary>
|
||||
public string process_param_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工艺参数类型id
|
||||
/// </summary>
|
||||
public string process_param_type_id { get; set; }
|
||||
public decimal value { get; set; }
|
||||
public string daq_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,5 +14,7 @@ namespace Tnb.PerMgr.Entities.Dto
|
||||
public decimal? value { get; set; }
|
||||
public decimal upper_value { get; set; }
|
||||
public decimal lower_value { get; set; }
|
||||
|
||||
public string daq_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Tnb.PerMgr.Entities.Dto
|
||||
{
|
||||
public class ProcessParamTypeDaqListOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string label_name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.PerMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 工艺参数设定值修改记录
|
||||
/// </summary>
|
||||
[SugarTable("per_process_param_edit_record")]
|
||||
public partial class PerProcessParamEditRecord : BaseEntity<string>
|
||||
{
|
||||
public PerProcessParamEditRecord()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 工艺参数id
|
||||
/// </summary>
|
||||
public string process_param_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 修改前值
|
||||
/// </summary>
|
||||
public decimal old_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改后值
|
||||
/// </summary>
|
||||
public decimal new_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string modify_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime modify_time { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工艺参数名
|
||||
/// </summary>
|
||||
public string? process_param_name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备id
|
||||
/// </summary>
|
||||
public string equip_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 流程任务Id
|
||||
/// </summary>
|
||||
public string? f_flowtaskid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程引擎Id
|
||||
/// </summary>
|
||||
public string? f_flowid { get; set; }
|
||||
|
||||
}
|
||||
@@ -18,6 +18,11 @@ public partial class PerProcessStandardsD : BaseEntity<string>
|
||||
/// 工艺标准主表id
|
||||
/// </summary>
|
||||
public string process_standards_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 工艺参数类型id
|
||||
/// </summary>
|
||||
public string process_param_type_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 工艺参数id
|
||||
@@ -38,5 +43,10 @@ public partial class PerProcessStandardsD : BaseEntity<string>
|
||||
/// 下限
|
||||
/// </summary>
|
||||
public decimal? lower_value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据采集id
|
||||
/// </summary>
|
||||
public string? daq_id { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using JNPF.Common.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Tnb.PerMgr.Interfaces
|
||||
@@ -9,5 +10,12 @@ namespace Tnb.PerMgr.Interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<IActionResult> ExportTemplate();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导入
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<Dictionary<string,string>> Import(string id,ChunkModel input);
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,11 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
tab_id = x.id,
|
||||
tab_name = x.name,
|
||||
daq_list = SqlFunc.Subqueryable<EqpDaq>().Where(a=>a.equip_id==equipId).ToList<ProcessParamTypeDaqListOutput>(a=>new ProcessParamTypeDaqListOutput
|
||||
{
|
||||
id = a.id,
|
||||
label_name = a.label_name,
|
||||
}),
|
||||
children = SqlFunc.Subqueryable<PerProcessParam>()
|
||||
.LeftJoin<PerToleranceCategory>((y,z)=>y.tolerance_category_id==z.id)
|
||||
.Where(y=>y.process_param_type_id==x.id)
|
||||
@@ -71,19 +76,67 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
|
||||
List<PerProcessStandardsD> list = new List<PerProcessStandardsD>();
|
||||
List<string> insertIds = new List<string>();
|
||||
if (input != null && input.Count > 0)
|
||||
{
|
||||
foreach (var item in input)
|
||||
{
|
||||
list.Add(new PerProcessStandardsD()
|
||||
PerProcessStandardsD processStandardsD = await db.Queryable<PerProcessStandardsD>().Where(x =>
|
||||
x.process_param_id == item.process_param_id && x.process_standards_id == item.process_standards_id &&
|
||||
item.process_param_type_id == x.process_param_type_id).FirstAsync();
|
||||
|
||||
if (processStandardsD != null)
|
||||
{
|
||||
process_standards_id = item.process_standards_id,
|
||||
process_param_id = item.process_param_id,
|
||||
value = item.value
|
||||
});
|
||||
PerProcessStandardsH perProcessStandardsH = await db.Queryable<PerProcessStandardsH>().SingleAsync(x => x.id == processStandardsD.process_standards_id);
|
||||
PerProcessParam processParam = await db.Queryable<PerProcessParam>().SingleAsync(x => x.id == processStandardsD.process_param_id);
|
||||
|
||||
if (processStandardsD.value != item.value)
|
||||
{
|
||||
PerProcessParamEditRecord record = new PerProcessParamEditRecord
|
||||
{
|
||||
process_param_id = item.process_param_id,
|
||||
old_value = processStandardsD.value,
|
||||
new_value = item.value,
|
||||
modify_id = _userManager.UserId,
|
||||
modify_time = DateTime.Now,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
equip_id = perProcessStandardsH.equip_id,
|
||||
process_param_name = processParam.name
|
||||
};
|
||||
db.Insertable<PerProcessParamEditRecord>(record).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.id))
|
||||
{
|
||||
PerProcessStandardsD insertObj = new PerProcessStandardsD()
|
||||
{
|
||||
value = item.value,
|
||||
process_param_id = item.process_param_id,
|
||||
process_standards_id = item.process_standards_id,
|
||||
process_param_type_id = item.process_param_type_id,
|
||||
daq_id = item.daq_id,
|
||||
};
|
||||
|
||||
insertIds.Add(insertObj.id);
|
||||
await db.Insertable<PerProcessStandardsD>(insertObj).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await db.Updateable<PerProcessStandardsD>()
|
||||
.SetColumns(x=>x.value==item.value)
|
||||
.SetColumns(x=>x.daq_id==item.daq_id)
|
||||
.Where(x=>x.id==item.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await db.Insertable<PerProcessStandardsD>(list).ExecuteCommandAsync();
|
||||
List<string> notDeleteIds = input.Select(x => x.id).ToList();
|
||||
notDeleteIds.AddRange(insertIds);
|
||||
await db.Deleteable<PerProcessStandardsD>().Where(x => !notDeleteIds.Contains(x.id)).ExecuteCommandAsync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@@ -108,6 +161,11 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
tab_id = a.id,
|
||||
tab_name = a.name,
|
||||
daq_list = SqlFunc.Subqueryable<EqpDaq>().Where(e=>e.equip_id==perProcessStandardsH.equip_id).ToList<ProcessParamTypeDaqListOutput>(e=>new ProcessParamTypeDaqListOutput
|
||||
{
|
||||
id = e.id,
|
||||
label_name = e.label_name,
|
||||
}),
|
||||
children = SqlFunc.Subqueryable<PerProcessStandardsD>()
|
||||
.LeftJoin<PerProcessParam>((b,c)=>b.process_param_id==c.id)
|
||||
.LeftJoin<PerToleranceCategory>((b,c,d)=>c.tolerance_category_id==d.id)
|
||||
@@ -120,7 +178,8 @@ namespace Tnb.PerMgr
|
||||
name = c.name,
|
||||
value = b.value,
|
||||
upper_value = d.upper_value,
|
||||
lower_value = d.lower_value
|
||||
lower_value = d.lower_value,
|
||||
daq_id = b.daq_id
|
||||
}),
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
using System.Data;
|
||||
using JNPF;
|
||||
using JNPF.Common.Configuration;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Core.Manager.Files;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Helper;
|
||||
using JNPF.Common.Models;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Common;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.SS.Util;
|
||||
using NPOI.XSSF.UserModel;
|
||||
@@ -28,11 +34,18 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
private readonly ISqlSugarRepository<PerProcessStandardsH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly FileManager _fileManager;
|
||||
private readonly FileService _fileService;
|
||||
|
||||
public PerProcessStandardsService(ISqlSugarRepository<PerProcessStandardsH> repository, IUserManager userManager)
|
||||
public PerProcessStandardsService(ISqlSugarRepository<PerProcessStandardsH> repository,
|
||||
FileService fileService,
|
||||
FileManager fileManager,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_repository = repository;
|
||||
_fileManager = fileManager;
|
||||
_fileService = fileService;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
@@ -90,5 +103,182 @@ namespace Tnb.PerMgr
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<Dictionary<string,string>> Import([FromForm]string id, [FromForm]ChunkModel input)
|
||||
{
|
||||
int rowIndex = 1;
|
||||
bool flag = false;
|
||||
IWorkbook workbook = null;
|
||||
try
|
||||
{
|
||||
using (Stream stream = input.file.OpenReadStream())
|
||||
{
|
||||
|
||||
// 2007版本
|
||||
if (input.fileName.IndexOf(".xlsx") > 0)
|
||||
workbook = new XSSFWorkbook(stream);
|
||||
else if (input.fileName.IndexOf(".xls") > 0)
|
||||
workbook = new HSSFWorkbook(stream);
|
||||
|
||||
ISheet sheet = workbook.GetSheetAt(0);
|
||||
|
||||
if (sheet.LastRowNum <= 1)
|
||||
throw Oops.Bah("无导入数据");
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
List<PerProcessParamType> perProcessParamTypes = await db.Queryable<PerProcessParamType>().ToListAsync();
|
||||
List<PerProcessParam> perProcessParams = await db.Queryable<PerProcessParam>().ToListAsync();
|
||||
int errorColumnIndex = 5;
|
||||
|
||||
ICellStyle style = workbook.CreateCellStyle();
|
||||
IFont font = workbook.CreateFont();
|
||||
font.Color = IndexedColors.Red.Index; // 将字体颜色设置为红色
|
||||
style.SetFont(font);
|
||||
|
||||
List<PerProcessStandardsD> list = new List<PerProcessStandardsD>() { };
|
||||
for (rowIndex = 1; rowIndex <= sheet.LastRowNum; rowIndex++)
|
||||
{
|
||||
IRow row = sheet.GetRow(rowIndex);
|
||||
ICell cell0 = row.GetCell(0);
|
||||
ICell cell1 = row.GetCell(1);
|
||||
ICell cell2 = row.GetCell(2);
|
||||
|
||||
PerProcessStandardsD item = new PerProcessStandardsD();
|
||||
item.process_standards_id = id;
|
||||
PerProcessParamType perProcessParamType = perProcessParamTypes.FirstOrDefault(x => x.name == cell0.StringCellValue);
|
||||
if (perProcessParamType != null)
|
||||
{
|
||||
item.process_param_type_id = perProcessParamType.id;
|
||||
}
|
||||
else
|
||||
{
|
||||
ICell errorCell = row.GetCell(errorColumnIndex) ?? row.CreateCell(errorColumnIndex);
|
||||
errorCell.SetCellValue(",无该工艺参数类型");
|
||||
errorCell.CellStyle = style;
|
||||
flag = true;
|
||||
}
|
||||
|
||||
PerProcessParam perProcessParam = perProcessParams.FirstOrDefault(x => x.name == cell1.StringCellValue);
|
||||
if (perProcessParam != null)
|
||||
{
|
||||
item.process_param_id = perProcessParam.id;
|
||||
}
|
||||
else
|
||||
{
|
||||
ICell errorCell = row.GetCell(errorColumnIndex) ?? row.CreateCell(errorColumnIndex);
|
||||
errorCell.SetCellValue(errorCell.StringCellValue+",无该工艺参数");
|
||||
errorCell.CellStyle = style;
|
||||
flag = true;
|
||||
}
|
||||
if (!TrySetNumberCellValue(cell2, ref item))
|
||||
{
|
||||
ICell errorCell = row.GetCell(errorColumnIndex) ?? row.CreateCell(errorColumnIndex);
|
||||
errorCell.SetCellValue(errorCell.StringCellValue+",设定值不是数字");
|
||||
errorCell.CellStyle = style;
|
||||
flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
|
||||
if (row.GetCell(errorColumnIndex) != null)
|
||||
{
|
||||
row.GetCell(errorColumnIndex).SetCellValue(row.GetCell(errorColumnIndex).StringCellValue.Substring(1));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in list)
|
||||
{
|
||||
PerProcessStandardsD oldData = await _repository.AsSugarClient().Queryable<PerProcessStandardsD>()
|
||||
.FirstAsync(x =>
|
||||
x.process_param_id == item.process_param_id &&
|
||||
x.process_param_type_id == item.process_param_type_id && x.process_standards_id == id);
|
||||
if (oldData!=null)
|
||||
{
|
||||
if (oldData.value != item.value)
|
||||
{
|
||||
|
||||
PerProcessStandardsH perProcessStandardsH = await _repository.AsSugarClient().Queryable<PerProcessStandardsH>().SingleAsync(x => x.id == oldData.process_standards_id);
|
||||
PerProcessParam processParam = await _repository.AsSugarClient().Queryable<PerProcessParam>().SingleAsync(x => x.id == oldData.process_param_id);
|
||||
|
||||
await _repository.AsSugarClient().Updateable<PerProcessStandardsD>()
|
||||
.SetColumns(x=>x.value==item.value)
|
||||
.Where(x=>x.id==oldData.id).ExecuteCommandAsync();
|
||||
|
||||
PerProcessParamEditRecord record = new PerProcessParamEditRecord
|
||||
{
|
||||
process_param_id = item.process_param_id,
|
||||
old_value = oldData.value,
|
||||
new_value = item.value,
|
||||
modify_id = _userManager.UserId,
|
||||
modify_time = DateTime.Now,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
equip_id = perProcessStandardsH.equip_id,
|
||||
process_param_name = processParam.name
|
||||
};
|
||||
await _repository.AsSugarClient().Insertable<PerProcessParamEditRecord>(record).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await _repository.AsSugarClient().Insertable<PerProcessStandardsD>(item).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
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 = "导入报错说明.xlsx" };
|
||||
// return fileStreamResult;
|
||||
string fileName = $"工艺标准导入报错{DateTime.Now.Ticks}.xlsx";
|
||||
await _fileManager.UploadFileByType(ms2, FileVariable.TemporaryFilePath, fileName);
|
||||
return new Dictionary<string, string>()
|
||||
{
|
||||
["isSuccess"] = "false",
|
||||
["msg"] = "部分数据导入失败",
|
||||
["fileName"] = fileName,
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Dictionary<string, string>()
|
||||
{
|
||||
["isSuccess"] = "true",
|
||||
["msg"] = "导入成功",
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
JNPF.Logging.Log.Error("工艺标准导入失败", e);
|
||||
throw Oops.Bah("导入失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private bool TrySetNumberCellValue(ICell cell,ref PerProcessStandardsD item)
|
||||
{
|
||||
try
|
||||
{
|
||||
item.value = cell.CellType == CellType.Numeric ? (decimal)cell.NumericCellValue : cell.CellType == CellType.String ? Convert.ToDecimal(cell.StringCellValue) : 0;
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.Systems\Tnb.Systems.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||
<ProjectReference Include="..\Tnb.PerMgr.Interfaces\Tnb.PerMgr.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -8,18 +8,23 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
{
|
||||
public class CheckItemsInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string status { get; set; }
|
||||
public List<CheckType> checktypoes { get; set; }
|
||||
public List<CheckTypeInput> checktypes { get; set; }
|
||||
}
|
||||
public class CheckType
|
||||
public class CheckTypeInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public List<Item> items { get; set; }
|
||||
public List<ItemInput> items { get; set; }
|
||||
}
|
||||
public class Item
|
||||
public class ItemInput
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string itemdid { get; set; }
|
||||
|
||||
public string extype { get; set; }
|
||||
public string excontent { get; set; }
|
||||
public string check { get; set; }
|
||||
@@ -28,5 +33,56 @@ namespace Tnb.QcMgr.Entities.Dto
|
||||
public string remark { get; set; }
|
||||
public string attachment { get; set; }
|
||||
public string isexec { get; set; }
|
||||
public string customer { get; set; }
|
||||
}
|
||||
public class CheckItemsOut
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string status { get; set; }
|
||||
public List<CheckTypeOut> checktypes { get; set; }
|
||||
}
|
||||
public class CheckTypeOut
|
||||
{
|
||||
public string checktypeid { get; set; }
|
||||
public string checktypename { get; set; }
|
||||
public List<ItemOut> items { get; set; }
|
||||
}
|
||||
public class ItemOut
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string itemdid { get; set; }
|
||||
public Show setShow { get; set; }
|
||||
public Data setData { get; set; }
|
||||
|
||||
}
|
||||
public class Show {
|
||||
public bool extype { get; set; }
|
||||
public bool excontent { get; set; }
|
||||
public bool check { get; set; }
|
||||
public bool errorcause { get; set; }
|
||||
public bool errorlevel { get; set; }
|
||||
public bool remark { get; set; }
|
||||
public bool attachment { get; set; }
|
||||
public bool customer { get; set; }
|
||||
public bool isexec { get; set; }
|
||||
}
|
||||
public class Data {
|
||||
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 customer { get; set; }
|
||||
public Isexec isexec { get; set; }
|
||||
}
|
||||
public class Isexec
|
||||
{
|
||||
public bool remark { get; set; }
|
||||
public bool attachment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,31 +3,90 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.QcMgr.Entities.Dto;
|
||||
|
||||
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 mainid { get; set; }
|
||||
public string addid { get; set; }
|
||||
public string triggertype { get; set; }
|
||||
|
||||
public string content { get; set; }
|
||||
public List<CheckPlanTypeInput> checktypes { get; set; }
|
||||
}
|
||||
public class CheckPlanTypeInput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public List<PlanItemInput> items { get; set; }
|
||||
}
|
||||
public class PlanItemInput
|
||||
{
|
||||
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; }
|
||||
public string customer { get; set; }
|
||||
}
|
||||
|
||||
public class CheckPlansOut
|
||||
{
|
||||
public string id { get; set; }
|
||||
public bool hasadd { get; set; }
|
||||
public bool hasitem{ get; set; }
|
||||
public string addid { get; set; }
|
||||
public string triggertype { get; set; }
|
||||
public string content { get; set; }
|
||||
public List<CheckPlanTypeOut> checktypes { get; set; }
|
||||
}
|
||||
public class CheckPlanTypeOut
|
||||
{
|
||||
public string checktypeid { get; set; }
|
||||
public string checktypename { get; set; }
|
||||
public List<PlanItemOut> items { get; set; }
|
||||
}
|
||||
public class PlanItemOut
|
||||
{
|
||||
public string itemid { get; set; }
|
||||
public string code { get; set; }
|
||||
public string name { get; set; }
|
||||
public string itemdid { get; set; }
|
||||
public PlanItemShow setShow { get; set; }
|
||||
public PlanItemData setData { get; set; }
|
||||
|
||||
}
|
||||
public class PlanItemShow
|
||||
{
|
||||
public bool extype { get; set; }
|
||||
public bool excontent { get; set; }
|
||||
public bool check { get; set; }
|
||||
public bool errorcause { get; set; }
|
||||
public bool errorlevel { get; set; }
|
||||
public bool remark { get; set; }
|
||||
public bool attachment { get; set; }
|
||||
public bool customer { get; set; }
|
||||
public bool isexec { get; set; }
|
||||
}
|
||||
public class PlanItemData
|
||||
{
|
||||
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 customer { get; set; }
|
||||
public IsexecP isexec { get; set; }
|
||||
}
|
||||
public class IsexecP
|
||||
{
|
||||
public bool remark { get; set; }
|
||||
public bool attachment { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
20
QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs
Normal file
20
QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using NPOI.SS.Formula.PTG;
|
||||
|
||||
namespace Tnb.QcMgr.Entities.Dto
|
||||
{
|
||||
public class TriggerPlan
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string code { get; set; }
|
||||
public string type { get; set; }
|
||||
public string cycle { get; set; }
|
||||
public string[] trievent { get; set; }
|
||||
public string[] trieventid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,12 @@ namespace Tnb.QcMgr.Entities
|
||||
/// 执行时操作
|
||||
/// </summary>
|
||||
public string? isexec { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 客户
|
||||
/// </summary>
|
||||
public string? custom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
|
||||
38
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanAdd.cs
Normal file
38
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanAdd.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_add")]
|
||||
public partial class QcCheckPlanAdd : BaseEntity<string>
|
||||
{
|
||||
public QcCheckPlanAdd()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发类型
|
||||
/// </summary>
|
||||
public string? triggertype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发内容
|
||||
/// </summary>
|
||||
public string? content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表编号
|
||||
/// </summary>
|
||||
public string? mainid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,11 @@ using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.QcMgr.Entities
|
||||
namespace Tnb.QcMgr.Entities.Entity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 质检方案附加信息
|
||||
/// 质检方案子表
|
||||
/// </summary>
|
||||
[SugarTable("qc_check_plan_d")]
|
||||
public partial class QcCheckPlanD : BaseEntity<string>
|
||||
@@ -21,18 +22,84 @@ namespace Tnb.QcMgr.Entities
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 触发类型
|
||||
/// </summary>
|
||||
public string? triggertype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发内容
|
||||
/// </summary>
|
||||
public string? content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主表编号
|
||||
/// 质检方案主表编号
|
||||
/// </summary>
|
||||
public string? mainid { get; set; }
|
||||
|
||||
/// <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? custom { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 质检项分类编号
|
||||
/// </summary>
|
||||
public string? typeid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 质检项编号
|
||||
/// </summary>
|
||||
public string? itemid { 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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@ using SqlSugar;
|
||||
|
||||
namespace Tnb.QcMgr.Entities
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 质检方案主表
|
||||
/// 质检方案
|
||||
/// </summary>
|
||||
[SugarTable("qc_check_plan_h")]
|
||||
public partial class QcCheckPlanH : BaseEntity<string>
|
||||
@@ -19,6 +20,12 @@ namespace Tnb.QcMgr.Entities
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编号
|
||||
/// </summary>
|
||||
public string? code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
@@ -83,5 +90,8 @@ namespace Tnb.QcMgr.Entities
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
58
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanMaterial.cs
Normal file
58
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanMaterial.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
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_material")]
|
||||
public partial class QcCheckPlanMaterial : BaseEntity<string>
|
||||
{
|
||||
public QcCheckPlanMaterial()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 质检方案编号
|
||||
/// </summary>
|
||||
public string? planid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料方案编号
|
||||
/// </summary>
|
||||
public string? materialid { 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; }
|
||||
|
||||
}
|
||||
}
|
||||
59
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanProcess.cs
Normal file
59
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanProcess.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_plan_process")]
|
||||
public partial class QcCheckPlanProcess : BaseEntity<string>
|
||||
{
|
||||
public QcCheckPlanProcess()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 方案编号
|
||||
/// </summary>
|
||||
public string? planid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工序编号
|
||||
/// </summary>
|
||||
public string? processid { 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; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
58
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanWork.cs
Normal file
58
QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanWork.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
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.Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 质检方案工位关联表
|
||||
/// </summary>
|
||||
[SugarTable("qc_check_plan_work")]
|
||||
public partial class QcCheckPlanWork : BaseEntity<string>
|
||||
{
|
||||
public QcCheckPlanWork()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 质检方案编号
|
||||
/// </summary>
|
||||
public string? planid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工位编号
|
||||
/// </summary>
|
||||
public string? workid { 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; }
|
||||
|
||||
}
|
||||
}
|
||||
64
QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerEvent.cs
Normal file
64
QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerEvent.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
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_trigger_event")]
|
||||
public partial class QcTriggerEvent : BaseEntity<string>
|
||||
{
|
||||
public QcTriggerEvent()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编号
|
||||
/// </summary>
|
||||
public string? code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分类
|
||||
/// </summary>
|
||||
public string? type { 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; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
73
QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerPlan.cs
Normal file
73
QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerPlan.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
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_trigger_plan")]
|
||||
public partial class QcTriggerPlan : BaseEntity<string>
|
||||
{
|
||||
public QcTriggerPlan()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string? name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编号
|
||||
/// </summary>
|
||||
public string? code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发类型
|
||||
/// </summary>
|
||||
public string type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 触发周期
|
||||
/// </summary>
|
||||
public string? cycle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 触发事件
|
||||
/// </summary>
|
||||
public string? trievent { 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; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,5 +22,12 @@ namespace Tnb.QcMgr.Interfaces
|
||||
/// <param name="CheckItemInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task SaveData(CheckItemsInput CheckItemsInput);
|
||||
|
||||
/// <summary>
|
||||
/// 获取质检项清单
|
||||
/// </summary>
|
||||
/// <param name="CheckItemInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetCheckItems(CheckItemsInput CheckItemsInput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,32 @@ 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 IQcCheckPlanService
|
||||
{
|
||||
/// <summary>
|
||||
/// 保存质检方案
|
||||
/// 保存质检方案质检项和附加信息
|
||||
/// </summary>
|
||||
/// <param name="CheckPlanInput"></param>
|
||||
/// <returns></returns>
|
||||
public Task SaveData(CheckPlanInput CheckPlanInput);
|
||||
|
||||
/// <summary>
|
||||
/// 获取方案质检项附加信息
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetCheckItems(string id);
|
||||
|
||||
/// <summary>
|
||||
/// 获取触发计划清单
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetTriggerPlans();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using JNPF.Common.Enums;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
@@ -34,7 +35,7 @@ namespace Tnb.QcMgr
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class QcCheckItemService : IOverideVisualDevService, IQcCheckItemService, IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "26500755139349";
|
||||
private const string ModuleId = "26477150883109";
|
||||
private readonly ISqlSugarRepository<QcCheckItemsH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
@@ -50,7 +51,7 @@ namespace Tnb.QcMgr
|
||||
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() ;
|
||||
var QcCheckItemsDs = await db.Queryable<QcCheckItemsD>().Where(p => QcCheckItemsRs.Select(p => p.itemsdid).ToList().Contains(p.id)).ToListAsync();
|
||||
await db.Ado.BeginTranAsync();
|
||||
await db.Deleteable(QcCheckItemsH).ExecuteCommandAsync();
|
||||
await db.Deleteable(QcCheckItemsRs).ExecuteCommandAsync();
|
||||
@@ -83,21 +84,98 @@ namespace Tnb.QcMgr
|
||||
if (CheckItemOut.items == null)
|
||||
{
|
||||
CheckItemOut.items = new List<CheckItem>();
|
||||
CheckItemOut.items.Add(new CheckItem { itemid = data.id, name = data.name, code = data.code });
|
||||
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 });
|
||||
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>() });
|
||||
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 });
|
||||
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<dynamic> GetCheckItems(CheckItemsInput CheckItemsInput)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync();
|
||||
var QcCheckTypes = await db.Queryable<QcCheckType>().ToListAsync();
|
||||
var QcCheckItemsH = await db.Queryable<QcCheckItemsH>().Where(p => p.id == CheckItemsInput.id).FirstAsync();
|
||||
List<QcCheckItemsR> QcCheckItemsRs = null;
|
||||
List<QcCheckItemsD> QcCheckItemsDs = null;
|
||||
if (QcCheckItemsH != null)
|
||||
{
|
||||
QcCheckItemsRs = await db.Queryable<QcCheckItemsR>().Where(p => p.itemshid == QcCheckItemsH.id).ToListAsync();
|
||||
if (QcCheckItemsRs != null)
|
||||
QcCheckItemsDs = await db.Queryable<QcCheckItemsD>().Where(p => QcCheckItemsRs.Select(p => p.itemsdid).ToList().Contains(p.id)).ToListAsync();
|
||||
}
|
||||
else
|
||||
throw Oops.Oh(ErrorCode.COM1005);
|
||||
var CheckItemsOut = new CheckItemsOut();
|
||||
CheckItemsOut.id = QcCheckItemsH.id;
|
||||
CheckItemsOut.name = QcCheckItemsH.name!;
|
||||
CheckItemsOut.status = QcCheckItemsH.status!;
|
||||
CheckItemsOut.checktypes = new List<CheckTypeOut>();
|
||||
if (QcCheckItemsRs != null && QcCheckItemsDs != null)
|
||||
{
|
||||
foreach (var QcCheckItemsR in QcCheckItemsRs)
|
||||
{
|
||||
if (CheckItemsOut.checktypes.Where(p => p.checktypeid == QcCheckItemsR.typeid).ToList().Count == 0)
|
||||
{
|
||||
CheckTypeOut checkType = new CheckTypeOut();
|
||||
checkType.checktypeid = QcCheckItemsR.typeid!;
|
||||
checkType.checktypename = QcCheckTypes.Where(p => p.id == QcCheckItemsR.typeid).First().name!;
|
||||
checkType.items = new List<ItemOut>();
|
||||
CheckItemsOut.checktypes.Add(checkType);
|
||||
}
|
||||
var item = QcCheckItemsDs.Where(p => p.id == QcCheckItemsR.itemsdid).FirstOrDefault();
|
||||
if (item != null)
|
||||
{
|
||||
ItemOut Item = new ItemOut();
|
||||
Item.itemid = QcCheckItemsR.itemid!;
|
||||
Item.itemdid = item.id!;
|
||||
Item.code = QcCheckItems.Where(p => p.id == QcCheckItemsR.itemid).First().code!;
|
||||
Item.name = QcCheckItems.Where(p => p.id == QcCheckItemsR.itemid).First().name!;
|
||||
Item.setData = new Data();
|
||||
Item.setData.extype = item.extype!;
|
||||
Item.setData.excontent = item.excontent!;
|
||||
Item.setData.check = item.check!;
|
||||
if (!string.IsNullOrEmpty(item.errorcause))
|
||||
Item.setData.errorcause = item.errorcause!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||
Item.setData.errorlevel = item.errorlevel!;
|
||||
Item.setData.remark = item.remark!;
|
||||
Item.setData.attachment = item.attachment!;
|
||||
Item.setData.customer = item.custom!;
|
||||
if (!string.IsNullOrEmpty(item.isexec))
|
||||
Item.setData.isexec = JSON.Deserialize<Isexec>(item.isexec!);
|
||||
Item.setShow = new Show();
|
||||
Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype);
|
||||
Item.setShow.excontent = !string.IsNullOrEmpty(Item.setData.excontent);
|
||||
Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check);
|
||||
Item.setShow.errorcause = Item.setData.errorcause == null ? false : true;
|
||||
Item.setShow.errorlevel = !string.IsNullOrEmpty(Item.setData.errorlevel);
|
||||
Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark);
|
||||
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
||||
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
|
||||
CheckItemsOut.checktypes.Where(p => p.checktypeid == QcCheckItemsR.typeid).First().items.Add(Item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return CheckItemsOut;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检项清单
|
||||
/// </summary>
|
||||
@@ -109,7 +187,8 @@ namespace Tnb.QcMgr
|
||||
var db = _repository.AsSugarClient();
|
||||
try
|
||||
{
|
||||
|
||||
if (!string.IsNullOrEmpty(CheckItemsInput.id))
|
||||
await Delete(CheckItemsInput.id);
|
||||
QcCheckItemsH QcCheckItemsH = new QcCheckItemsH();
|
||||
QcCheckItemsH.name = CheckItemsInput.name;
|
||||
QcCheckItemsH.status = CheckItemsInput.status;
|
||||
@@ -117,8 +196,7 @@ namespace Tnb.QcMgr
|
||||
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 checktype in CheckItemsInput.checktypes)
|
||||
{
|
||||
foreach (var item in checktype.items)
|
||||
{
|
||||
@@ -127,11 +205,12 @@ namespace Tnb.QcMgr
|
||||
extype = item.extype,
|
||||
excontent = item.excontent,
|
||||
check = item.check,
|
||||
errorcause = item.errorcause,
|
||||
errorcause = item.errorcause.Replace("\"","").Trim(),
|
||||
errorlevel = item.errorlevel,
|
||||
remark = item.remark,
|
||||
attachment = item.attachment,
|
||||
isexec = item.isexec
|
||||
isexec = item.isexec,
|
||||
custom=item.customer
|
||||
};
|
||||
QcCheckItemsDs.Add(QcCheckItemsD);
|
||||
var QcCheckItemsR = new QcCheckItemsR()
|
||||
@@ -145,6 +224,12 @@ namespace Tnb.QcMgr
|
||||
QcCheckItemsRs.Add(QcCheckItemsR);
|
||||
}
|
||||
}
|
||||
QcCheckItemsDs.ForEach(p =>
|
||||
{
|
||||
p.create_id = _userManager.UserId;
|
||||
p.create_time = DateTime.Now;
|
||||
|
||||
});
|
||||
await db.Ado.BeginTranAsync();
|
||||
await db.Insertable(QcCheckItemsH).ExecuteCommandAsync();
|
||||
await db.Insertable(QcCheckItemsRs).ExecuteCommandAsync();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.ArrayExtensions;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -10,11 +11,13 @@ using JNPF.Common.Enums;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.VisualDev;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.QcMgr.Entities;
|
||||
using Tnb.QcMgr.Entities.Dto;
|
||||
using Tnb.QcMgr.Entities.Entity;
|
||||
using Tnb.QcMgr.Interfaces;
|
||||
|
||||
namespace Tnb.QcMgr
|
||||
@@ -33,38 +36,149 @@ namespace Tnb.QcMgr
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检方案
|
||||
/// 获取方案质检项附加信息
|
||||
/// </summary>
|
||||
/// <param name="CheckPlanInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetCheckItems(string id)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync();
|
||||
var QcCheckTypes = await db.Queryable<QcCheckType>().ToListAsync();
|
||||
var QcCheckPlanAdd = await db.Queryable<QcCheckPlanAdd>().Where(p => p.mainid == id).FirstAsync();
|
||||
var QcCheckPlanDs = await db.Queryable<QcCheckPlanD>().Where(p => p.mainid == id).ToListAsync();
|
||||
var CheckPlansOut = new CheckPlansOut();
|
||||
CheckPlansOut.id= id;
|
||||
CheckPlansOut.hasadd = false;
|
||||
CheckPlansOut.hasitem = false;
|
||||
if (QcCheckPlanAdd != null)
|
||||
{
|
||||
CheckPlansOut.hasadd = true;
|
||||
CheckPlansOut.addid = QcCheckPlanAdd.id;
|
||||
CheckPlansOut.triggertype = QcCheckPlanAdd.triggertype!;
|
||||
CheckPlansOut.content = QcCheckPlanAdd.content!;
|
||||
}
|
||||
if (QcCheckPlanDs != null&& QcCheckPlanDs.Count>0)
|
||||
{
|
||||
CheckPlansOut.hasitem = true;
|
||||
CheckPlansOut.checktypes = new List<CheckPlanTypeOut>();
|
||||
foreach (var QcCheckPlanD in QcCheckPlanDs)
|
||||
{
|
||||
if (CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).ToList().Count == 0)
|
||||
{
|
||||
CheckPlanTypeOut checkType = new CheckPlanTypeOut();
|
||||
checkType.checktypeid = QcCheckPlanD.typeid!;
|
||||
checkType.checktypename = QcCheckTypes.Where(p => p.id == QcCheckPlanD.typeid).First().name!;
|
||||
checkType.items = new List<PlanItemOut>();
|
||||
CheckPlansOut.checktypes.Add(checkType);
|
||||
}
|
||||
PlanItemOut Item = new PlanItemOut();
|
||||
Item.itemid = QcCheckPlanD.itemid!;
|
||||
Item.itemdid = QcCheckPlanD.id!;
|
||||
Item.code = QcCheckItems.Where(p => p.id == QcCheckPlanD.itemid).First().code!;
|
||||
Item.name = QcCheckItems.Where(p => p.id == QcCheckPlanD.itemid).First().name!;
|
||||
Item.setData = new PlanItemData();
|
||||
Item.setData.extype = QcCheckPlanD.extype!;
|
||||
Item.setData.excontent = QcCheckPlanD.excontent!;
|
||||
Item.setData.check = QcCheckPlanD.check!;
|
||||
if (!string.IsNullOrEmpty(QcCheckPlanD.errorcause))
|
||||
Item.setData.errorcause = QcCheckPlanD.errorcause!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||
Item.setData.errorlevel = QcCheckPlanD.errorlevel!;
|
||||
Item.setData.remark = QcCheckPlanD.remark!;
|
||||
Item.setData.attachment = QcCheckPlanD.attachment!;
|
||||
Item.setData.customer = QcCheckPlanD.custom!;
|
||||
if (!string.IsNullOrEmpty(QcCheckPlanD.isexec))
|
||||
Item.setData.isexec = JSON.Deserialize<IsexecP>(QcCheckPlanD.isexec!);
|
||||
Item.setShow = new PlanItemShow();
|
||||
Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype);
|
||||
Item.setShow.excontent = !string.IsNullOrEmpty(Item.setData.excontent);
|
||||
Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check);
|
||||
Item.setShow.errorcause = Item.setData.errorcause == null ? false : true;
|
||||
Item.setShow.errorlevel = !string.IsNullOrEmpty(Item.setData.errorlevel);
|
||||
Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark);
|
||||
Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment);
|
||||
Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer);
|
||||
Item.setShow.isexec = Item.setData.isexec == null ? false : true;
|
||||
CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).First().items.Add(Item);
|
||||
}
|
||||
}
|
||||
return CheckPlansOut;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取触发计划清单
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetTriggerPlans()
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var QcTriggerPlans = await db.Queryable<QcTriggerPlan>().ToListAsync();
|
||||
var QcTriggerEvents = await db.Queryable<QcTriggerEvent>().ToListAsync();
|
||||
List<TriggerPlan> TriggerPlans = new List<TriggerPlan>();
|
||||
foreach (var triggerPlan in QcTriggerPlans)
|
||||
{
|
||||
TriggerPlan TriggerPlan = new TriggerPlan();
|
||||
TriggerPlan.id = triggerPlan.id;
|
||||
TriggerPlan.name = triggerPlan.name!;
|
||||
TriggerPlan.code = triggerPlan.code!;
|
||||
TriggerPlan.type = triggerPlan.type!;
|
||||
TriggerPlan.cycle = triggerPlan.cycle!;
|
||||
TriggerPlan.trieventid = triggerPlan.trievent!.Replace("[", "").Replace("]", "").Replace("\r\n", "").Replace("\"", "").Replace(" ","").Split(',', StringSplitOptions.RemoveEmptyEntries);
|
||||
TriggerPlan.trievent = QcTriggerEvents.Where(p => TriggerPlan.trieventid.Contains(p.id)).Select(p => p.name!).ToArray();
|
||||
TriggerPlans.Add(TriggerPlan);
|
||||
}
|
||||
return TriggerPlans;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存质检方案质检项和附加信息
|
||||
/// </summary>
|
||||
/// <param name="CheckPlanInput"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
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;
|
||||
if (string.IsNullOrEmpty(CheckPlanInput.mainid))
|
||||
return;
|
||||
await db.Deleteable<QcCheckPlanD>(p => p.mainid == CheckPlanInput.mainid).ExecuteCommandAsync();
|
||||
await db.Deleteable<QcCheckPlanAdd>(p => p.mainid == CheckPlanInput.mainid).ExecuteCommandAsync();
|
||||
QcCheckPlanAdd QcCheckPlanAdd = new QcCheckPlanAdd();
|
||||
QcCheckPlanAdd.mainid = CheckPlanInput.mainid;
|
||||
QcCheckPlanAdd.triggertype = CheckPlanInput.triggertype;
|
||||
QcCheckPlanAdd.content = CheckPlanInput.content;
|
||||
List<QcCheckPlanD> QcCheckPlanDs = new List<QcCheckPlanD>();
|
||||
foreach (var checktype in CheckPlanInput.checktypes)
|
||||
{
|
||||
foreach (var item in checktype.items)
|
||||
{
|
||||
QcCheckPlanD QcCheckPlanD = new QcCheckPlanD();
|
||||
QcCheckPlanD.mainid = CheckPlanInput.mainid;
|
||||
QcCheckPlanD.typeid = checktype.id;
|
||||
QcCheckPlanD.itemid = item.itemid;
|
||||
QcCheckPlanD.extype = item.extype;
|
||||
QcCheckPlanD.excontent = item.excontent;
|
||||
QcCheckPlanD.check = item.check;
|
||||
QcCheckPlanD.errorcause = item.errorcause;
|
||||
QcCheckPlanD.errorlevel = item.errorlevel;
|
||||
QcCheckPlanD.remark = item.remark;
|
||||
QcCheckPlanD.attachment = item.attachment;
|
||||
QcCheckPlanD.isexec = item.isexec;
|
||||
QcCheckPlanD.custom = item.customer;
|
||||
QcCheckPlanDs.Add(QcCheckPlanD);
|
||||
}
|
||||
}
|
||||
await db.Ado.BeginTranAsync();
|
||||
await db.Insertable(QcCheckPlanH).ExecuteCommandAsync();
|
||||
await db.Insertable(QcCheckPlanD).ExecuteCommandAsync();
|
||||
await db.Insertable(QcCheckPlanDs).ExecuteCommandAsync();
|
||||
await db.Insertable(QcCheckPlanAdd).ExecuteCommandAsync();
|
||||
await db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user