| | |
| | | private readonly MesInvItemStocksManager m = new(); |
| | | |
| | | /// <summary> |
| | | /// 获取可退货物料库存 |
| | | /// 获取可退货物料库存(旧版本,保留兼容) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpPost("GetReturnableStocks")] |
| | |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取可退货物料库存(带分页和搜索) |
| | | /// </summary> |
| | | /// <param name="searchDto">搜索请求参数</param> |
| | | /// <returns></returns> |
| | | [HttpPost("GetReturnableStocksWithPaging")] |
| | | public ResponseResult GetReturnableStocksWithPaging([FromBody] ReturnableStockSearchDto searchDto) |
| | | { |
| | | try |
| | | { |
| | | var result = m.GetReturnableStocks(searchDto); |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "查询成功", |
| | | data = result |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 导出可退货物料库存为Excel |
| | | /// </summary> |
| | | /// <param name="searchDto">搜索请求参数</param> |
| | | /// <returns>Excel文件</returns> |
| | | [HttpPost("ExportReturnableStocks")] |
| | | public IActionResult ExportReturnableStocks([FromBody] ReturnableStockSearchDto searchDto) |
| | | { |
| | | try |
| | | { |
| | | var fileBytes = m.ExportReturnableStocksToExcel(searchDto); |
| | | var fileName = $"可退货物料库存_{DateTime.Now:yyyyMMddHHmmss}.xlsx"; |
| | | |
| | | return File(fileBytes, |
| | | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", |
| | | fileName); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return BadRequest(new ResponseResult |
| | | { |
| | | status = 1, |
| | | message = $"导出失败: {ex.Message}", |
| | | data = null |
| | | }); |
| | | } |
| | | } |
| | | } |