增加清单判断

master
孙亮 11 months ago
parent ae9a7b9d11
commit fd8707e899

@ -992,7 +992,7 @@ namespace IBKLinker_Minio.Controller.MinioController
#endregion #endregion
#region 标准清单 #region 标准清单
[HttpGet, Route("StandardListGeneration")] [HttpGet, Route("StandardListGeneration")]
public HttpResponseMessage StandardListGeneration(StandardListGenerationModel args) public HttpResponseMessage StandardListGeneration(string InventoryName, string InventoryType, string BeginTime, string EndTime)
{ {
RequestEntity request = new RequestEntity(); RequestEntity request = new RequestEntity();
IList<MinioStoragePath> date = new List<MinioStoragePath>(); IList<MinioStoragePath> date = new List<MinioStoragePath>();
@ -1001,82 +1001,84 @@ namespace IBKLinker_Minio.Controller.MinioController
{ {
try try
{ {
if (args != null) if (InventoryName != null && InventoryType != null)
{ {
string ExcelName = "";//定义导出Excel文件名称 string ExcelName = "";//定义导出Excel文件名称
FileStream file = new FileStream("D:/linshi/" + "清单模板.xlsx", FileMode.Open, FileAccess.Read); FileStream file = new FileStream("D:/linshi/" + "清单模板.xlsx", FileMode.Open, FileAccess.Read);
XSSFWorkbook hssfworkbook = new XSSFWorkbook(file); XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
string sql = "select * from MINIO_STORAGE_PATH where 1=1 and FILE_TYPE='1' "; string sql = "select * from MINIO_STORAGE_PATH where 1=1 and FILE_TYPE='1' ";
if (args.InventoryType == "0")//标准类型 if (InventoryType == "0")//标准类型
{ {
if (!string.IsNullOrEmpty(args.BeginTime)) if (!string.IsNullOrEmpty(BeginTime))
{ {
sql += string.Format(" and CREATE_TIME >= to_date('{0}', 'yyyy/mm/dd hh24:mi:ss')", args.BeginTime);//开始时间 sql += string.Format(" and CREATE_TIME >= to_date('{0}', 'yyyy/mm/dd hh24:mi:ss')", BeginTime);//开始时间
} }
if (!string.IsNullOrEmpty(args.EndTime)) if (!string.IsNullOrEmpty(EndTime))
{ {
sql += string.Format(" and CREATE_TIME <= to_date('{0}', 'yyyy/mm/dd hh24:mi:ss')", args.EndTime);//结束时间 sql += string.Format(" and CREATE_TIME <= to_date('{0}', 'yyyy/mm/dd hh24:mi:ss')", EndTime);//结束时间
} }
sql += string.Format(" and FILE_PATH like'%{0}%'", args.InventoryName);//直接添加文件加名称 sql += string.Format(" and FILE_PATH like'%{0}%'", InventoryName);//直接添加文件加名称
ExcelName = "标准清单"; ExcelName = "标准清单";
} }
else else
{ {
#region 清单判断 #region 清单判断
if (args.InventoryName =="HY企业标准清单") if (InventoryName == "HY企业标准清单")
{ {
sql += "and FILE_PATH like'%HY%'"; sql += "and FILE_PATH like'%HY%'";
ExcelName = "HY企业标准清单"; ExcelName = "HY企业标准清单";
} }
if (args.InventoryName == "Q-HY企业标准清单") if (InventoryName == "Q-HY企业标准清单")
{ {
sql += "and (FILE_PATH like'%Q/HY%'"; sql += "and (FILE_PATH like'%Q/HY%'";
ExcelName = "Q-HY企业标准清单"; ExcelName = "Q-HY企业标准清单";
} }
if (args.InventoryName == "新产品标准清单") if (InventoryName == "新产品标准清单")
{ {
sql += "and (FILE_PATH like'%XYGN%' or FILE_PATH like'%XYGW%')"; sql += "and (FILE_PATH like'%XYGN%' or FILE_PATH like'%XYGW%')";
ExcelName = "新产品标准清单"; ExcelName = "新产品标准清单";
} }
if (args.InventoryName == "标准目录有效清单") if (InventoryName == "标准目录有效清单")
{ {
sql += "and (FILE_PATH like'企业标准'";
ExcelName = "标准目录有效清单"; ExcelName = "标准目录有效清单";
} }
if (args.InventoryName == "企业标准明细表") if (InventoryName == "企业标准明细表")
{ {
sql += "and (FILE_PATH like'企业标准'";
ExcelName = "企业标准明细表"; ExcelName = "企业标准明细表";
} }
if (args.InventoryName == "过期标准清单") if (InventoryName == "过期标准清单")
{ {
sql += "and (FILE_PATH like'%过期XYGN%' or FILE_PATH like'%过期XYGW%')"; sql += "and (FILE_PATH like'%过期标准%'";
ExcelName = "过期标准清单"; ExcelName = "过期标准清单";
} }
if (args.InventoryName == "参考标准清单") if (InventoryName == "参考标准清单")
{ {
sql += "and (FILE_PATH like'%XYGN%' or FILE_PATH like'%XYGW%')"; sql += "and (FILE_PATH like'%参考标准%'";
ExcelName = "参考标准清单"; ExcelName = "参考标准清单";
} }
if (args.InventoryName == "工艺卡清单") if (InventoryName == "工艺卡清单")
{ {
sql += "and (FILE_PATH like'%170钢管厂工艺卡%' or FILE_PATH like'%219钢管厂工艺卡%' or FILE_PATH like'%460钢管厂工艺卡%' or FILE_PATH like'%170热处理工艺卡%' or FILE_PATH like'%连模铸系列工艺卡/转炉厂%' or FILE_PATH like'%连模铸系列工艺卡/特冶厂%' or FILE_PATH like'%连模铸系列工艺卡/电炉厂%' or FILE_PATH like'%电炉厂工艺卡%' or FILE_PATH like'%转炉厂工艺卡%' or FILE_PATH like'%特冶厂工艺卡%' or FILE_PATH like'%大棒厂工艺卡%' or FILE_PATH like'%小棒厂工艺卡%' or FILE_PATH like'%中棒厂工艺卡%'or FILE_PATH like'%锻造厂工艺卡%' or FILE_PATH like'%扁棒厂工艺卡)"; sql += "and (FILE_PATH like'%170钢管厂工艺卡%' or FILE_PATH like'%219钢管厂工艺卡%' or FILE_PATH like'%460钢管厂工艺卡%' or FILE_PATH like'%170热处理工艺卡%' or FILE_PATH like'%连模铸系列工艺卡/转炉厂%' or FILE_PATH like'%连模铸系列工艺卡/特冶厂%' or FILE_PATH like'%连模铸系列工艺卡/电炉厂%' or FILE_PATH like'%电炉厂工艺卡%' or FILE_PATH like'%转炉厂工艺卡%' or FILE_PATH like'%特冶厂工艺卡%' or FILE_PATH like'%大棒厂工艺卡%' or FILE_PATH like'%小棒厂工艺卡%' or FILE_PATH like'%中棒厂工艺卡%'or FILE_PATH like'%锻造厂工艺卡%' or FILE_PATH like'%扁棒厂工艺卡%')";
ExcelName = "工艺卡清单"; ExcelName = "工艺卡清单";
} }
if (args.InventoryName == "工艺规程清单") if (InventoryName == "工艺规程清单")
{ {
sql += "and FILE_PATH like'%工艺规程%'"; sql += "and FILE_PATH like'%工艺规程%'";
ExcelName = "工艺规程清单"; ExcelName = "工艺规程清单";
} }
if (args.InventoryName == "技术制度清单") if (InventoryName == "技术制度清单")
{ {
sql += "and FILE_PATH like'%技术制度%'"; sql += "and FILE_PATH like'%技术制度%'";
ExcelName = "技术制度清单"; ExcelName = "技术制度清单";
} }
if (args.InventoryName == "艺字工艺清单") if (InventoryName == "艺字工艺清单")
{ {
sql += "and FILE_PATH like'%艺字工艺%'"; sql += "and FILE_PATH like'%艺字工艺%'";
ExcelName = "艺字工艺清单"; ExcelName = "艺字工艺清单";
} }
if (args.InventoryName == "技字通知清单") if (InventoryName == "技字通知清单")
{ {
sql += "and FILE_PATH like'%技字通知%'"; sql += "and FILE_PATH like'%技字通知%'";
ExcelName = "技字通知清单"; ExcelName = "技字通知清单";
@ -1100,7 +1102,7 @@ namespace IBKLinker_Minio.Controller.MinioController
{ {
var curRow = sheet.GetRow(rowIndex); var curRow = sheet.GetRow(rowIndex);
var data = date[i]; var data = date[i];
if (data.FilePath.IndexOf("XYGN") >= 0 || data.FilePath.IndexOf("XYGW") >= 0)//对国内国外标准进行特殊处理 if (data.FilePath.IndexOf("企业标准/XYGN") >= 0 || data.FilePath.IndexOf("企业标准/XYGW") >= 0)//对国内国外标准进行特殊处理
{ {
int Num = data.FileName.IndexOf("-") + 8;//取文件名称技术协议编号位数 int Num = data.FileName.IndexOf("-") + 8;//取文件名称技术协议编号位数
int name = data.FileName.Length - Num;//取文件名称技术协议名称位数 int name = data.FileName.Length - Num;//取文件名称技术协议名称位数
@ -1108,10 +1110,20 @@ namespace IBKLinker_Minio.Controller.MinioController
curRow.GetCell(1).SetCellValue(data.FileName.Substring(0, Num).Trim());//协议编号 curRow.GetCell(1).SetCellValue(data.FileName.Substring(0, Num).Trim());//协议编号
curRow.GetCell(2).SetCellValue(data.FileName.Substring(Num, name).Trim());//名称 curRow.GetCell(2).SetCellValue(data.FileName.Substring(Num, name).Trim());//名称
} }
else if (data.FilePath.IndexOf("标准通知")>=0)
{
int Num = data.FileName.IndexOf("号");//取文件名称编号位数
int name = data.FileName.Length - Num;//取文件名称名称位数
curRow.GetCell(0).SetCellValue(data.FilePath.Replace(data.FileName, ""));//路
curRow.GetCell(1).SetCellValue(data.FileName.Substring(0, Num).Trim());//编号
curRow.GetCell(2).SetCellValue(data.FileName.Substring(Num, name).Replace("", "").Trim());//名称
}
if(data.FilePath.IndexOf("标准通知") == -1 && data.FilePath.IndexOf("企业标准/XYGN") == -1 || data.FilePath.IndexOf("企业标准/XYGW") == -1)
{ {
var filecontent = data.FileName.Split(' ');//以空格进行区分
curRow.GetCell(0).SetCellValue(data.FilePath.Replace(data.FileName, ""));//路径 curRow.GetCell(0).SetCellValue(data.FilePath.Replace(data.FileName, ""));//路径
curRow.GetCell(2).SetCellValue(data.FileName);//名称 curRow.GetCell(1).SetCellValue(filecontent[0].ToString().Trim());//编号
curRow.GetCell(2).SetCellValue(data.FileName.Replace(filecontent[0].ToString(), ""));//名称
} }
rowIndex = rowIndex + 1; rowIndex = rowIndex + 1;
} }

Loading…
Cancel
Save