去除warn
This commit is contained in:
@@ -2,18 +2,18 @@ namespace Tnb.PerMgr.Entities.Dto
|
||||
{
|
||||
public class ProcessChildDataInput
|
||||
{
|
||||
|
||||
public string id { get; set; }
|
||||
public string process_standards_id { get; set; }
|
||||
|
||||
public string id { get; set; } = string.Empty;
|
||||
public string? process_standards_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工艺参数id
|
||||
/// </summary>
|
||||
public string process_param_id { get; set; }
|
||||
public string? process_param_id { get; set; }
|
||||
/// <summary>
|
||||
/// 工艺参数类型id
|
||||
/// </summary>
|
||||
public string process_param_type_id { get; set; }
|
||||
public string? process_param_type_id { get; set; }
|
||||
public decimal value { get; set; }
|
||||
public string daq_id { get; set; }
|
||||
public string? daq_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ namespace Tnb.PerMgr.Entities.Dto
|
||||
{
|
||||
public class ProcessParamOutput
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string? name { get; set; }
|
||||
|
||||
public decimal upper_value { get; set; }
|
||||
|
||||
|
||||
@@ -5,16 +5,16 @@ namespace Tnb.PerMgr.Entities.Dto
|
||||
/// <summary>
|
||||
/// 工艺标准子表id
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
public string? id { get; set; }
|
||||
/// <summary>
|
||||
/// 工艺参数id
|
||||
/// </summary>
|
||||
public string process_param_id { get; set; }
|
||||
public string name { get; set; }
|
||||
public string? process_param_id { get; set; }
|
||||
public string? name { get; set; }
|
||||
public decimal? value { get; set; }
|
||||
public decimal upper_value { get; set; }
|
||||
public decimal lower_value { get; set; }
|
||||
|
||||
public string daq_id { get; set; }
|
||||
public string? daq_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ namespace Tnb.PerMgr.Entities.Dto
|
||||
{
|
||||
public class ProcessParamTypeDaqListOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string label_name { get; set; }
|
||||
public string? id { get; set; }
|
||||
public string? label_name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace Tnb.PerMgr
|
||||
string equipId = dic["equip_id"];
|
||||
var db = _repository.AsSugarClient();
|
||||
var equipment = await db.Queryable<EqpEquipment>().Where(x => x.id == equipId).SingleAsync();
|
||||
string equipTypeId = equipment?.equip_type_id;
|
||||
string? equipTypeId = equipment?.equip_type_id;
|
||||
|
||||
//List<PerProcessParamType> perProcessParamTypes = await _repository.GetListAsync(x => x.equip_type_id == equipTypeId);
|
||||
var result = await db.Queryable<PerProcessParamType>()
|
||||
@@ -94,29 +94,29 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
PerProcessParamEditRecord record = new PerProcessParamEditRecord
|
||||
{
|
||||
process_param_id = item.process_param_id,
|
||||
process_param_id = item?.process_param_id ?? "",
|
||||
old_value = processStandardsD.value,
|
||||
new_value = item.value,
|
||||
new_value = item?.value ?? 0,
|
||||
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();
|
||||
await db.Insertable<PerProcessParamEditRecord>(record).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.id))
|
||||
if (item==null || 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,
|
||||
value = item?.value ?? 0,
|
||||
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);
|
||||
@@ -152,7 +152,7 @@ namespace Tnb.PerMgr
|
||||
var db = _repository.AsSugarClient();
|
||||
var perProcessStandardsH = await db.Queryable<PerProcessStandardsH>().SingleAsync(x => x.id == id);
|
||||
var equipment = await db.Queryable<EqpEquipment>().Where(x => x.id == perProcessStandardsH.equip_id).SingleAsync();
|
||||
string equipTypeId = equipment?.equip_type_id;
|
||||
string? equipTypeId = equipment?.equip_type_id;
|
||||
|
||||
var result = await db.Queryable<PerProcessParamType>()
|
||||
.Where(a => a.equip_type_id == equipTypeId)
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Tnb.PerMgr
|
||||
sheet.SetColumnWidth(i,15 * 256);
|
||||
}
|
||||
|
||||
int rowIndex = 1;
|
||||
// int rowIndex = 1;
|
||||
|
||||
// var column = sheet.GetColumn(0);
|
||||
// 设置下拉项
|
||||
@@ -109,7 +109,7 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
int rowIndex = 1;
|
||||
bool flag = false;
|
||||
IWorkbook workbook = null;
|
||||
IWorkbook? workbook = null;
|
||||
try
|
||||
{
|
||||
using (Stream stream = input.file.OpenReadStream())
|
||||
@@ -121,9 +121,12 @@ namespace Tnb.PerMgr
|
||||
else if (input.fileName.IndexOf(".xls") > 0)
|
||||
workbook = new HSSFWorkbook(stream);
|
||||
|
||||
ISheet sheet = workbook.GetSheetAt(0);
|
||||
ISheet? sheet = workbook?.GetSheetAt(0);
|
||||
|
||||
if(workbook==null || sheet==null)
|
||||
throw Oops.Bah("无导入数据");
|
||||
|
||||
if (sheet.LastRowNum <= 1)
|
||||
if (sheet?.LastRowNum <= 1)
|
||||
throw Oops.Bah("无导入数据");
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
@@ -132,12 +135,12 @@ namespace Tnb.PerMgr
|
||||
int errorColumnIndex = 5;
|
||||
|
||||
ICellStyle style = workbook.CreateCellStyle();
|
||||
IFont font = workbook.CreateFont();
|
||||
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++)
|
||||
for (rowIndex = 1; rowIndex <= sheet?.LastRowNum; rowIndex++)
|
||||
{
|
||||
IRow row = sheet.GetRow(rowIndex);
|
||||
ICell cell0 = row.GetCell(0);
|
||||
@@ -146,7 +149,7 @@ namespace Tnb.PerMgr
|
||||
|
||||
PerProcessStandardsD item = new PerProcessStandardsD();
|
||||
item.process_standards_id = id;
|
||||
PerProcessParamType perProcessParamType = perProcessParamTypes.FirstOrDefault(x => x.name == cell0.StringCellValue);
|
||||
PerProcessParamType? perProcessParamType = perProcessParamTypes.FirstOrDefault(x => x.name == cell0.StringCellValue);
|
||||
if (perProcessParamType != null)
|
||||
{
|
||||
item.process_param_type_id = perProcessParamType.id;
|
||||
@@ -159,7 +162,7 @@ namespace Tnb.PerMgr
|
||||
flag = true;
|
||||
}
|
||||
|
||||
PerProcessParam perProcessParam = perProcessParams.FirstOrDefault(x => x.name == cell1.StringCellValue);
|
||||
PerProcessParam? perProcessParam = perProcessParams.FirstOrDefault(x => x.name == cell1.StringCellValue);
|
||||
if (perProcessParam != null)
|
||||
{
|
||||
item.process_param_id = perProcessParam.id;
|
||||
@@ -232,7 +235,7 @@ namespace Tnb.PerMgr
|
||||
{
|
||||
MemoryStream ms = new MemoryStream();
|
||||
|
||||
workbook.Write(ms);
|
||||
workbook?.Write(ms);
|
||||
string fileName = $"工艺标准导入报错{DateTime.Now.Ticks}.xlsx";
|
||||
using (MemoryStream ms2 = new MemoryStream(ms.ToArray()))
|
||||
{
|
||||
@@ -278,6 +281,7 @@ namespace Tnb.PerMgr
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user