1.出库单据、生成出库单据、计算物料时增加货架类型用于区分信息化货架和智能货架的物料 实现分开出
This commit is contained in:
83
WCS.WebApi/Controllers/FileDownLoadController.cs
Normal file
83
WCS.WebApi/Controllers/FileDownLoadController.cs
Normal file
@ -0,0 +1,83 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.HPSF;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel;
|
||||
using WCS.Model.ApiModel.User;
|
||||
using WCS.Model.WebSocketModel;
|
||||
|
||||
namespace WCS.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件下载
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class FileDownLoadController : ControllerBase
|
||||
{
|
||||
|
||||
public FileDownLoadController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[HttpGet("downloadApp")]
|
||||
public IActionResult downloadApp(string fileName)
|
||||
{
|
||||
// 这里是文件的物理路径,你需要根据实际情况提供
|
||||
var filePath = Path.Combine(Directory.GetCurrentDirectory(), $"Files/{fileName}");
|
||||
|
||||
// 检查文件是否存在
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// 获取文件流
|
||||
var stream = System.IO.File.OpenRead(filePath);
|
||||
// 设置HTTP响应头,使浏览器知道这是一个附件,应该下载而不是打开
|
||||
Response.Headers.Add("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
// 返回文件流作为FileResult
|
||||
return File(stream, "application/octet-stream", fileName);
|
||||
}
|
||||
|
||||
[HttpGet("getLatestAppName")]
|
||||
public ResponseCommon<string> getLatestAppName()
|
||||
{
|
||||
string directoryPath = Path.Combine(Directory.GetCurrentDirectory(), $"Files");
|
||||
|
||||
// 获取目录下的所有文件信息
|
||||
FileInfo[] files = Directory.GetFiles(directoryPath, "*.app")
|
||||
.Select(file => new FileInfo(file))
|
||||
.ToArray();
|
||||
|
||||
if (files == null || files.Length == 0)
|
||||
{
|
||||
return new ResponseCommon<string>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "服务器不存在App安装包"
|
||||
};
|
||||
}
|
||||
//获取最后修改的一个
|
||||
FileInfo lastModifiedFile = files.OrderByDescending(f => f.LastWriteTime).First();
|
||||
if (lastModifiedFile != null)
|
||||
{
|
||||
return new ResponseCommon<string>()
|
||||
{
|
||||
Code = 200,
|
||||
Data = lastModifiedFile.Name
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ResponseCommon<string>()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "服务器不存在App安装包"
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MiniExcelLibs;
|
||||
using WCS.BLL.HardWare;
|
||||
using WCS.BLL.Manager;
|
||||
using WCS.BLL.Services.IService;
|
||||
using WCS.BLL.Services.Service;
|
||||
using WCS.Model;
|
||||
using WCS.Model.ApiModel.MatBaseInfo;
|
||||
using WCS.Model.ApiModel.OutStore;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
@ -15,12 +17,54 @@ namespace WebApi.Controllers
|
||||
private readonly IOutstoreService _outstoreService;
|
||||
private readonly IGenerateService _generateService;
|
||||
|
||||
public OutstoreController(IOutstoreService outstoreService,IGenerateService generateService)
|
||||
public OutstoreController(IOutstoreService outstoreService, IGenerateService generateService)
|
||||
{
|
||||
_outstoreService = outstoreService;
|
||||
_generateService = generateService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>ͱȶ<CDB1>
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[Route("importMat")]
|
||||
[HttpPost(Name = "importMat")]
|
||||
public async Task<ResponseBase> importMat([FromForm] IFormFile excelFile, [FromForm] string userName, [FromForm] string deviceType)
|
||||
{
|
||||
try
|
||||
{
|
||||
//<2F>ļ<EFBFBD>У<EFBFBD><D0A3>
|
||||
if (excelFile == null || excelFile.Length == 0)
|
||||
{
|
||||
return new ResponseCommon()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "<22><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>:<3A>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݣ<EFBFBD>"
|
||||
};
|
||||
}
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
await excelFile.CopyToAsync(stream);
|
||||
stream.Position = 0;
|
||||
var list = MiniExcelLibs.MiniExcel.Query<OutImportMatModel>(stream, "<22><><EFBFBD><EFBFBD><E2B5BC>ģ<EFBFBD><C4A3>", ExcelType.XLSX).ToList();
|
||||
return await _outstoreService.importMat(list);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new ResponseBase()
|
||||
{
|
||||
Code = 201,
|
||||
Message = "<22><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>" + ex.Message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
@ -33,7 +77,7 @@ namespace WebApi.Controllers
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(request.OrderNumber))
|
||||
{
|
||||
{
|
||||
request.OrderNumber = await _generateService.generateOutOrderNumber();
|
||||
}
|
||||
return await _outstoreService.SysOutOrderByMatCode(request);
|
||||
|
@ -7,9 +7,6 @@ using WCS.Model.WebSocketModel;
|
||||
|
||||
namespace WCS.WebApi.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 权限/用户界面的接口
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WarningController : ControllerBase
|
||||
|
Reference in New Issue
Block a user