Files
wcs/WCS.WebApi/Controllers/InOutRecordController.cs
2024-05-09 09:43:28 +08:00

67 lines
2.1 KiB
C#

using Microsoft.AspNetCore.Mvc;
using MiniExcelLibs;
using NPOI.SS.UserModel;
using SqlSugar;
using System.Xml.Linq;
using WCS.BLL.DbModels;
using WCS.BLL.Manager;
using WCS.BLL.Services.IService;
using WCS.BLL.Services.Service;
using WCS.DAL.Db;
using WCS.Model;
using WCS.Model.ApiModel;
using WCS.Model.ApiModel.InOutRecord;
using WCS.Model.ApiModel.MatInventoryDetail;
using WCS.WebApi.Helper;
namespace WCS.WebApi.Controllers
{
/// <summary>
/// 接口记录
/// </summary>
[ApiController]
[Route("[controller]")]
public class InOutRecordController : ControllerBase
{
public IInOutRecordService _inOutRecordService { get; set; }
public InOutRecordController(IInOutRecordService inOutRecordService)
{
_inOutRecordService = inOutRecordService;
}
[Route("getInOutRecord")]
[HttpPost(Name = "getInOutRecord")]
public async Task<ResponseBase> getInOutRecord(GetInOutRecordRequest request)
{
return await _inOutRecordService.getInOutRecord(request);
}
[HttpPost("exportInOutRecord")]
public async Task<IActionResult> exportInOutRecord([FromBody] GetInOutRecordRequest request)
{
var result = await _inOutRecordService.exportInOutRecord(request);
var data = result.Data?.Lists;
var columns = new[]
{
new ExportableColumn("序号","RowNumber"),
new ExportableColumn("物料编码","MatCode"),
new ExportableColumn("物料名称","MatName"),
new ExportableColumn("规格","MatSpec"),
new ExportableColumn("批次","MatBatch"),
new ExportableColumn("数量","MatQty"),
new ExportableColumn("库位","StoreCode"),
new ExportableColumn("入库时间","InstoreTime"),
new ExportableColumn("物料SN", "MatSN"),
};
if (data == null)
{
return NotFound();
}
else
return ExportExcelHelper.Export("导出数据", columns, data);
}
}
}