首检完成
This commit is contained in:
@@ -42,6 +42,17 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
|
||||
[HttpGet("getWorkoderList_piliang")]
|
||||
public IActionResult GetWorkorderList_Piliang(int pageNum, int pageSize, int year = -1, int week = -1, int date = -1)
|
||||
{
|
||||
(List<ProWorkorder_v2>, int) data = proWorkorderService.GetWorkorderList_Piliang(pageNum, pageSize, year, week, date, 0);
|
||||
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生产工单模板下载
|
||||
/// </summary>
|
||||
@@ -71,6 +82,12 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
int year = 0;
|
||||
int week = 0;
|
||||
int date = 0;
|
||||
if (!Directory.Exists(target))
|
||||
{
|
||||
// 如果目录不存在就创建
|
||||
Directory.CreateDirectory(target);
|
||||
|
||||
}
|
||||
using (var stream = formFile.OpenReadStream())
|
||||
{
|
||||
FileStream targetFileStream = new FileStream(target, FileMode.Create, FileAccess.Write);
|
||||
@@ -82,17 +99,18 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
targetFileStream.Write(buffer, 0, bytesRead);
|
||||
}
|
||||
|
||||
//2.0 解析excel
|
||||
//读取第一行 解析 年和月
|
||||
var row = stream.Query().Skip(1).First();
|
||||
year = Convert.ToInt32(row.A);
|
||||
week = Convert.ToInt32(row.B);
|
||||
date = Convert.ToInt32(row.C);
|
||||
|
||||
|
||||
|
||||
//读取列表数据
|
||||
try
|
||||
{
|
||||
//2.0 解析excel
|
||||
//读取第一行 解析 年和月
|
||||
var row = stream.Query().Skip(1).First();
|
||||
year = Convert.ToInt32(row.A);
|
||||
week = Convert.ToInt32(row.B);
|
||||
date = Convert.ToInt32(row.C);
|
||||
var list = stream.Query<ProWorkorder_v2>(sheetName: "Sheet1", startCell: "A3").ToList(); ;
|
||||
|
||||
|
||||
@@ -106,12 +124,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
item.ProductDescription = "";
|
||||
if (item.Colour == null)
|
||||
item.Colour = "";
|
||||
if (item.FinishedPartNumber == null)
|
||||
item.FinishedPartNumber = "";
|
||||
if (item.ProductDescription == null)
|
||||
item.ProductDescription = "";
|
||||
if (item.Colour == null)
|
||||
item.Colour = "";
|
||||
|
||||
if (item.Specifications == null)
|
||||
item.Specifications = "";
|
||||
if (item.CylinderNumber == null)
|
||||
@@ -131,14 +144,16 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
item.Week = week;
|
||||
item.Date = date;
|
||||
}
|
||||
var final_list = list.Where(it => !it.BlankNumber.Contains("圈数")).ToList();
|
||||
var final_list = list.Where(it => !it.BlankNumber.Contains("圈数"))
|
||||
.Where(it => !(it.BlankNumber == "" && it.FinishedPartNumber == "" && it.ProductDescription == "" && it.Specifications == "" && it.CylinderNumber == "" && it.Remark1 == "" && it.Remark2== "" && it.Remark3 == "" && it.Remark4== ""&&it.ClientWorkorder==""))
|
||||
.ToList();
|
||||
|
||||
string result = proWorkorderService.ImportExceldata(final_list);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(ResultCode.GLOBAL_ERROR, "模板内容错误,请仔细检测格式,并联系管理员" + ex.Message);
|
||||
return ToResponse(ResultCode.GLOBAL_ERROR, "内容错误,请仔细检测格式,并联系管理员" + ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -305,7 +320,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
public IActionResult GenerateWorkorder(int? year, int? week, int? date)
|
||||
{
|
||||
int data = 0;
|
||||
data = proWorkorderService.GenerateWorkorder((int)year, (int)week,(int)date);
|
||||
data = proWorkorderService.GenerateWorkorder((int)year, (int)week, (int)date);
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
|
||||
@@ -169,6 +169,10 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
|
||||
string sFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + formFile.FileName;
|
||||
string target = Path.Combine(webHostEnvironment.WebRootPath, "workplan", sFileName);
|
||||
if (!Directory.Exists(target))
|
||||
{
|
||||
Directory.CreateDirectory(target);
|
||||
}
|
||||
int year = 0;
|
||||
int week = 0;
|
||||
using (var stream = formFile.OpenReadStream())
|
||||
@@ -182,17 +186,18 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
targetFileStream.Write(buffer, 0, bytesRead);
|
||||
}
|
||||
|
||||
//2.0 解析excel
|
||||
//读取第一行 解析 年和月
|
||||
var row = stream.Query().Take(1).First();
|
||||
year = Convert.ToInt32(row.A);
|
||||
|
||||
week = Convert.ToInt32(row.B);
|
||||
|
||||
|
||||
|
||||
//读取列表数据
|
||||
try
|
||||
{
|
||||
//2.0 解析excel
|
||||
//读取第一行 解析 年和月
|
||||
var row = stream.Query().Take(1).First();
|
||||
year = Convert.ToInt32(row.A);
|
||||
|
||||
week = Convert.ToInt32(row.B);
|
||||
var list = stream.Query<ProWorklplan_v2>(sheetName: "Sheet1", startCell: "B3")
|
||||
.Where(it => it.Partnumber != null)
|
||||
.Where(it => !it.Partnumber.Contains("合计"))
|
||||
@@ -203,6 +208,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
it.ToCreate(HttpContext);
|
||||
it.Year = year;
|
||||
it.Week = week;
|
||||
it.NoSchedule = it.RequireNum;
|
||||
|
||||
});
|
||||
string result = proWorkplanService.ImportExceldata(list);
|
||||
@@ -210,7 +216,7 @@ namespace ZR.Admin.WebApi.Controllers.mes.pro
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(ResultCode.GLOBAL_ERROR,"模板内容错误,请仔细检测格式,并联系管理员"+ex.Message);
|
||||
return ToResponse(ResultCode.GLOBAL_ERROR,"内容错误,请仔细检测格式,并联系管理员"+ex.Message);
|
||||
}
|
||||
}
|
||||
return SUCCESS(null);
|
||||
|
||||
Reference in New Issue
Block a user