111
This commit is contained in:
@@ -202,5 +202,8 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
|
||||
return (sFileName, fullPath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Model.MES.wms;
|
||||
@@ -116,6 +117,68 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
return SUCCESS(nowProduction);
|
||||
}
|
||||
|
||||
[HttpGet("download_template")]
|
||||
[Log(Title = "下载物料清单模版", BusinessType = BusinessType.EXPORT, IsSaveRequestData = true, IsSaveResponseData = false)]
|
||||
[AllowAnonymous] //不需要授权 就可以访问
|
||||
public IActionResult DownloadTemplate()
|
||||
{
|
||||
(string, string) result = DownloadImportTemplate("物料清单模版");//返回文件名和路径
|
||||
return ExportExcel(result.Item2, result.Item1);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("importData")]
|
||||
[Log(Title = "物料清单批量导入", BusinessType = BusinessType.IMPORT, IsSaveRequestData = false, IsSaveResponseData = true)]
|
||||
[AllowAnonymous] //不需要授权 就可以访问
|
||||
public IActionResult ImportData([FromForm(Name = "file")] IFormFile formFile, bool updateSupport)
|
||||
{
|
||||
|
||||
//1.0 读取excel 文件 保存在指定位置
|
||||
IWebHostEnvironment webHostEnvironment = (IWebHostEnvironment)App.ServiceProvider.GetService(typeof(IWebHostEnvironment));
|
||||
string sFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + formFile.FileName;
|
||||
string target = Path.Combine(webHostEnvironment.WebRootPath, "wmmaterial", sFileName);
|
||||
if (!Directory.Exists(Path.Combine(webHostEnvironment.WebRootPath, "wmmaterial")))
|
||||
{
|
||||
// 如果目录不存在就创建
|
||||
Directory.CreateDirectory(Path.Combine(webHostEnvironment.WebRootPath, "wmmaterial"));
|
||||
|
||||
}
|
||||
//2.0 解析 excel
|
||||
|
||||
|
||||
using (var stream = formFile.OpenReadStream())
|
||||
{
|
||||
FileStream targetFileStream = new FileStream(target, FileMode.Create, FileAccess.Write);
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
targetFileStream.Write(buffer, 0, bytesRead);
|
||||
}
|
||||
|
||||
|
||||
//IWorkbook workbook = new XSSFWorkbook(stream);
|
||||
//ISheet sheet = workbook.GetSheetAt(0); // 读取第一个工作表
|
||||
|
||||
//for (int i = 0; i <= sheet.LastRowNum; i++)
|
||||
//{
|
||||
// IRow row = sheet.GetRow(i);
|
||||
// if (row != null)
|
||||
// {
|
||||
// for (int j = 0; j < row.LastCellNum; j++)
|
||||
// {
|
||||
// Console.Write(row.GetCell(j) + "\t");
|
||||
// }
|
||||
// Console.WriteLine();
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
return SUCCESS(null);
|
||||
}
|
||||
|
||||
(int, int) data = _WmOutOrderService.DoMaterialOut(doMaterialOut, HttpContext.GetName());
|
||||
(int, int) data = _WmOutOrderService.DoMaterialOut(doMaterialOut, "HttpContext.GetName()");
|
||||
|
||||
return SUCCESS(data);
|
||||
}
|
||||
@@ -233,13 +233,13 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// <param name="shipment_num">出库单号</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("checkProductionOut")]
|
||||
public IActionResult CheckProductionOut( string parnumber,string production_packcode = "", string shipment_num = "")
|
||||
public IActionResult CheckProductionOut( string partnumber,string production_packcode = "", string shipment_num = "")
|
||||
{
|
||||
if(string.IsNullOrEmpty(parnumber)) {
|
||||
if(string.IsNullOrEmpty(partnumber)) {
|
||||
return ToResponse(new ApiResult(200, "请选择物料号", false));
|
||||
}
|
||||
string msg = "";
|
||||
msg = _WmOutOrderService.CheckProductionOut(parnumber,production_packcode, shipment_num);
|
||||
msg = _WmOutOrderService.CheckProductionOut(partnumber, production_packcode, shipment_num);
|
||||
if(msg !="ok")
|
||||
{
|
||||
return ToResponse(new ApiResult(200, msg, false));
|
||||
@@ -247,9 +247,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
else
|
||||
{
|
||||
return ToResponse(new ApiResult(200, msg, true));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BIN
ZR.Admin.WebApi/wwwroot/ImportTemplate/物料清单模版.xls
Normal file
BIN
ZR.Admin.WebApi/wwwroot/ImportTemplate/物料清单模版.xls
Normal file
Binary file not shown.
BIN
ZR.Admin.WebApi/wwwroot/ImportTemplate/物料清单模版.xlsx
Normal file
BIN
ZR.Admin.WebApi/wwwroot/ImportTemplate/物料清单模版.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user