|
@@ -3,6 +3,8 @@ package com.ruoyi.inventory.controller;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
@@ -86,6 +88,30 @@ public class TbInventoryDetailController extends BaseController
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 导出资产盘点记录列表
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('inventory:inventory:export')")
|
|
|
+ @Log(title = "资产盘点报表", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/export/detail")
|
|
|
+ public void exportDetail(HttpServletResponse response, TbAssetInventory tbAssetInventory)
|
|
|
+ {
|
|
|
+ List<TbAssetInventory> tbAssetInventoryList = tbAssetInventoryMapper.selectTbAssetInventoryList(tbAssetInventory);
|
|
|
+ List<AssetInventoryStatement> assetInventoryStatements = new ArrayList<>();
|
|
|
+
|
|
|
+ for (TbAssetInventory assetInventory : tbAssetInventoryList) {
|
|
|
+ String orderNumber = assetInventory.getOrderNumber();
|
|
|
+
|
|
|
+ List<TbInventoryDetail> tbInventoryDetails = tbInventoryDetailService.selectTbInventoryDetailByOrderNumber(orderNumber);
|
|
|
+ List<AssetInventoryStatement> assetInventoryStatementList = getInventoryStatement(assetInventory, tbInventoryDetails);
|
|
|
+ assetInventoryStatements.addAll(assetInventoryStatementList);
|
|
|
+ }
|
|
|
+
|
|
|
+ ExcelUtil<AssetInventoryStatement> util = new ExcelUtil<>(AssetInventoryStatement.class);
|
|
|
+
|
|
|
+ util.exportExcel(response, assetInventoryStatements, "资产盘点报表");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 获取盘点报表
|
|
|
*
|
|
|
* @param tbAssetInventory 盘点计划信息
|
|
@@ -97,6 +123,12 @@ public class TbInventoryDetailController extends BaseController
|
|
|
|
|
|
for (TbInventoryDetail inventoryDetail : list) {
|
|
|
AssetInventoryStatement assetInventoryStatement = new AssetInventoryStatement();
|
|
|
+ // 设置盘点编码
|
|
|
+ assetInventoryStatement.setOrderNumber(tbAssetInventory.getOrderNumber());
|
|
|
+
|
|
|
+ // 设置计划名称
|
|
|
+ assetInventoryStatement.setOrderName(tbAssetInventory.getName());
|
|
|
+
|
|
|
// 设置盘点部门
|
|
|
assetInventoryStatement.setInventoryDepartmentName(tbAssetInventory.getInventoryDepartmentName());
|
|
|
|
|
@@ -144,6 +176,9 @@ public class TbInventoryDetailController extends BaseController
|
|
|
String inventoryResultName = InventoryResult.getName(inventoryResult);
|
|
|
assetInventoryStatement.setInventoryResult(inventoryResultName);
|
|
|
|
|
|
+ // 设置盘点位置
|
|
|
+ assetInventoryStatement.setInventoryLocation(tbAssetInventory.getInventoryLocationName());
|
|
|
+
|
|
|
// 设置盘点时间
|
|
|
assetInventoryStatement.setInventoryDate(tbAssetInventory.getInventoryDate());
|
|
|
|