|
@@ -15,6 +15,8 @@ import com.ruoyi.inventory.domain.TbAssetInventory;
|
|
|
import com.ruoyi.inventory.domain.TbInventoryCompare;
|
|
|
import com.ruoyi.inventory.domain.TbInventoryCompareResult;
|
|
|
import com.ruoyi.inventory.domain.dto.AssetInventoryStatement;
|
|
|
+import com.ruoyi.inventory.domain.dto.AssetInventoryStatement2;
|
|
|
+import com.ruoyi.inventory.domain.dto.AssetInventoryStatementDetail;
|
|
|
import com.ruoyi.inventory.domain.dto.InventoryCompareDTO;
|
|
|
import com.ruoyi.inventory.domain.enums.InventoryPlanResult;
|
|
|
import com.ruoyi.inventory.domain.enums.InventoryResult;
|
|
@@ -153,17 +155,17 @@ public class TbInventoryDetailController extends BaseController
|
|
|
public void exportDetail(HttpServletResponse response, TbAssetInventory tbAssetInventory)
|
|
|
{
|
|
|
List<TbAssetInventory> tbAssetInventoryList = inventoryService.selectTbAssetInventoryList(tbAssetInventory);
|
|
|
- List<AssetInventoryStatement> assetInventoryStatements = new ArrayList<>();
|
|
|
+ List<AssetInventoryStatement2> 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);
|
|
|
+ AssetInventoryStatement2 assetInventoryStatement = getInventoryStatement2(assetInventory, tbInventoryDetails);
|
|
|
+ assetInventoryStatements.add(assetInventoryStatement);
|
|
|
}
|
|
|
|
|
|
- ExcelUtil<AssetInventoryStatement> util = new ExcelUtil<>(AssetInventoryStatement.class);
|
|
|
+ ExcelUtil<AssetInventoryStatement2> util = new ExcelUtil<>(AssetInventoryStatement2.class);
|
|
|
|
|
|
util.exportExcel(response, assetInventoryStatements, "资产盘点报表");
|
|
|
}
|
|
@@ -318,6 +320,93 @@ public class TbInventoryDetailController extends BaseController
|
|
|
return assetInventoryStatements;
|
|
|
}
|
|
|
|
|
|
+ private AssetInventoryStatement2 getInventoryStatement2(TbAssetInventory tbAssetInventory, List<TbInventoryDetail> list) {
|
|
|
+ AssetInventoryStatement2 assetInventoryStatement = new AssetInventoryStatement2();
|
|
|
+
|
|
|
+ // 设置盘点编码
|
|
|
+ assetInventoryStatement.setOrderNumber(tbAssetInventory.getOrderNumber());
|
|
|
+
|
|
|
+ // 设置计划名称
|
|
|
+ assetInventoryStatement.setOrderName(tbAssetInventory.getName());
|
|
|
+
|
|
|
+ // 设置盘点部门
|
|
|
+ assetInventoryStatement.setInventoryDepartmentName(tbAssetInventory.getInventoryDepartmentName());
|
|
|
+
|
|
|
+ // 设置盘点位置
|
|
|
+ assetInventoryStatement.setInventoryLocation(tbAssetInventory.getInventoryLocationName());
|
|
|
+
|
|
|
+ // 设置盘点时间
|
|
|
+ assetInventoryStatement.setInventoryDate(tbAssetInventory.getInventoryDate());
|
|
|
+
|
|
|
+ // 设置盘点计划结果
|
|
|
+ Integer inventoryPlanResult = tbAssetInventory.getInventoryResult();
|
|
|
+ String inventoryPlanResultName = InventoryPlanResult.getName(inventoryPlanResult);
|
|
|
+ assetInventoryStatement.setInventoryPlanResult(inventoryPlanResultName);
|
|
|
+
|
|
|
+ List<AssetInventoryStatementDetail> assetInventoryStatementDetailList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (TbInventoryDetail inventoryDetail : list) {
|
|
|
+ AssetInventoryStatementDetail assetInventoryStatementDetail = new AssetInventoryStatementDetail();
|
|
|
+
|
|
|
+ // 解析资产信息
|
|
|
+ TbAssetInformation assetInformation = JSONUtil.toBean(inventoryDetail.getInventoryMetadata(), TbAssetInformation.class);
|
|
|
+
|
|
|
+ // 设置资产编码
|
|
|
+ assetInventoryStatementDetail.setAssetNumber(assetInformation.getNumber());
|
|
|
+
|
|
|
+ // 设置资产名称
|
|
|
+ assetInventoryStatementDetail.setAssetName(assetInformation.getName());
|
|
|
+
|
|
|
+ // 设置所在位置
|
|
|
+// String ancestorLocationName = assetInformation.getAncestorLocationName();
|
|
|
+// if (StrUtil.isBlank(ancestorLocationName)) {
|
|
|
+// ancestorLocationName = "";
|
|
|
+// }
|
|
|
+// String parentLocationName = assetInformation.getParentLocationName();
|
|
|
+// if (StrUtil.isBlank(parentLocationName)) {
|
|
|
+// parentLocationName = "";
|
|
|
+// }
|
|
|
+ String locationName = assetInformation.getLocationName();
|
|
|
+// assetInventoryStatement.setAssetLocation(ancestorLocationName + parentLocationName + locationName);
|
|
|
+ assetInventoryStatementDetail.setAssetLocation(locationName);
|
|
|
+
|
|
|
+ // 设置资产分类
|
|
|
+ String categoryName = assetInformation.getCategoryName();
|
|
|
+ assetInventoryStatementDetail.setAssetCategory(categoryName);
|
|
|
+
|
|
|
+ // 设置盘点状态
|
|
|
+ Integer inventoryStatus = inventoryDetail.getInventoryStatus();
|
|
|
+ String inventoryStatusName = InventoryStatus.getName(inventoryStatus);
|
|
|
+ assetInventoryStatementDetail.setInventoryStatus(inventoryStatusName);
|
|
|
+
|
|
|
+ // 设置资产数量
|
|
|
+ assetInventoryStatementDetail.setQuantity(assetInformation.getQuantity());
|
|
|
+
|
|
|
+ // 设置盘点数量
|
|
|
+ assetInventoryStatementDetail.setInventoryQuantity(inventoryDetail.getInventoryQuantity());
|
|
|
+
|
|
|
+ // 设置计量单位
|
|
|
+ assetInventoryStatementDetail.setUnits(assetInformation.getUnits());
|
|
|
+
|
|
|
+ // 设置盘点结果
|
|
|
+ Integer inventoryResult = inventoryDetail.getInventoryResult();
|
|
|
+ String inventoryResultName = InventoryResult.getName(inventoryResult);
|
|
|
+ assetInventoryStatementDetail.setInventoryResult(inventoryResultName);
|
|
|
+
|
|
|
+ // 设置资产原值
|
|
|
+ assetInventoryStatementDetail.setOriginalValue(assetInformation.getOriginalValue());
|
|
|
+
|
|
|
+ // 设置备注
|
|
|
+ assetInventoryStatementDetail.setRemark(inventoryDetail.getRemark());
|
|
|
+
|
|
|
+ assetInventoryStatementDetailList.add(assetInventoryStatementDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ assetInventoryStatement.setAssetInventoryStatementDetailList(assetInventoryStatementDetailList);
|
|
|
+
|
|
|
+ return assetInventoryStatement;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取资产盘点明细详细信息
|
|
|
*/
|