|
@@ -5,6 +5,7 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.ruoyi.asset.domain.TbAssetInformation;
|
|
@@ -69,7 +70,6 @@ public class TbInventoryDetailController extends BaseController
|
|
|
public void export(HttpServletResponse response, TbInventoryDetail tbInventoryDetail)
|
|
|
{
|
|
|
List<TbInventoryDetail> list = tbInventoryDetailService.selectTbInventoryDetailList(tbInventoryDetail);
|
|
|
- List<AssetInventoryStatement> assetInventoryStatements = new ArrayList<>();
|
|
|
|
|
|
String orderNumber = tbInventoryDetail.getOrderNumber();
|
|
|
if (StrUtil.isBlank(orderNumber)) {
|
|
@@ -78,14 +78,25 @@ public class TbInventoryDetailController extends BaseController
|
|
|
|
|
|
TbAssetInventory tbAssetInventory = tbAssetInventoryMapper.selectTbAssetInventoryByNumber(orderNumber);
|
|
|
|
|
|
- for (TbInventoryDetail inventoryDetail : list) {
|
|
|
- AssetInventoryStatement assetInventoryStatement = new AssetInventoryStatement();
|
|
|
- // 设置计划编码
|
|
|
- assetInventoryStatement.setOrderNumber(inventoryDetail.getOrderNumber());
|
|
|
+ List<AssetInventoryStatement> assetInventoryStatements = getInventoryStatement(tbAssetInventory, list);
|
|
|
|
|
|
- // 设置盘点名称
|
|
|
- assetInventoryStatement.setInventoryName(tbAssetInventory.getName());
|
|
|
+ ExcelUtil<AssetInventoryStatement> util = new ExcelUtil<>(AssetInventoryStatement.class);
|
|
|
|
|
|
+ util.exportExcel(response, assetInventoryStatements, DateUtil.format(tbAssetInventory.getInventoryDate(), "yyyy年MM月dd日"), tbAssetInventory.getName());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取盘点报表
|
|
|
+ *
|
|
|
+ * @param tbAssetInventory 盘点计划信息
|
|
|
+ * @param list 盘点详细列表
|
|
|
+ * @return 盘点报表列表
|
|
|
+ */
|
|
|
+ private List<AssetInventoryStatement> getInventoryStatement(TbAssetInventory tbAssetInventory, List<TbInventoryDetail> list) {
|
|
|
+ List<AssetInventoryStatement> assetInventoryStatements = new ArrayList<>();
|
|
|
+
|
|
|
+ for (TbInventoryDetail inventoryDetail : list) {
|
|
|
+ AssetInventoryStatement assetInventoryStatement = new AssetInventoryStatement();
|
|
|
// 设置盘点部门
|
|
|
assetInventoryStatement.setInventoryDepartmentName(tbAssetInventory.getInventoryDepartmentName());
|
|
|
|
|
@@ -142,8 +153,7 @@ public class TbInventoryDetailController extends BaseController
|
|
|
assetInventoryStatements.add(assetInventoryStatement);
|
|
|
}
|
|
|
|
|
|
- ExcelUtil<AssetInventoryStatement> util = new ExcelUtil<>(AssetInventoryStatement.class);
|
|
|
- util.exportExcel(response, assetInventoryStatements, "资产盘点报表");
|
|
|
+ return assetInventoryStatements;
|
|
|
}
|
|
|
|
|
|
/**
|