Forráskód Böngészése

优化资产盘点报表

LinWuTai 1 éve
szülő
commit
27df1a0fd5

+ 5 - 11
ruoyi-admin/src/main/java/com/ruoyi/asset/controller/TbAssetInformationController.java

@@ -132,17 +132,11 @@ public class TbAssetInformationController extends BaseController
         for (TbAssetInformation tbAssetInformation : tbAssetInformationList) {
             // 然后再转回对象,便不会影响到原对象
             PTXLabelInfo ptxLabelInfo = JSONUtil.toBean(ptxLabelInfoModel, PTXLabelInfo.class);
-            Integer quantity = tbAssetInformation.getQuantity();
-            if (quantity != null && quantity > 1) {
-                List<AssetEpcInfo> childNumberInfo = tbAssetInformation.getChildNumberInfo();
-                for (AssetEpcInfo assetEpcInfo : childNumberInfo) {
-                    tbAssetInformation.setNumber(assetEpcInfo.getNumber());
-                    tbAssetInformation.setEpc(assetEpcInfo.getEpc());
-                    tbAssetInformation.setEpcReplenishLength(assetEpcInfo.getEpcReplenishLength());
-                    ptxLabelInfo = ptxService.filterInfo(ptxLabelInfo, tbAssetInformation);
-                    ptxLabelInfos.add(ptxLabelInfo);
-                }
-            } else {
+            List<AssetEpcInfo> childNumberInfo = tbAssetInformation.getChildNumberInfo();
+            for (AssetEpcInfo assetEpcInfo : childNumberInfo) {
+                tbAssetInformation.setNumber(assetEpcInfo.getNumber());
+                tbAssetInformation.setEpc(assetEpcInfo.getEpc());
+                tbAssetInformation.setEpcReplenishLength(assetEpcInfo.getEpcReplenishLength());
                 ptxLabelInfo = ptxService.filterInfo(ptxLabelInfo, tbAssetInformation);
                 ptxLabelInfos.add(ptxLabelInfo);
             }

+ 10 - 3
ruoyi-admin/src/main/java/com/ruoyi/inventory/controller/TbInventoryDetailController.java

@@ -13,9 +13,11 @@ import cn.hutool.json.JSONUtil;
 import com.ruoyi.asset.domain.TbAssetInformation;
 import com.ruoyi.inventory.domain.TbAssetInventory;
 import com.ruoyi.inventory.domain.dto.AssetInventoryStatement;
+import com.ruoyi.inventory.domain.enums.InventoryPlanResult;
 import com.ruoyi.inventory.domain.enums.InventoryResult;
 import com.ruoyi.inventory.domain.enums.InventoryStatus;
 import com.ruoyi.inventory.mapper.TbAssetInventoryMapper;
+import com.ruoyi.inventory.service.ITbAssetInventoryService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -61,7 +63,7 @@ public class TbInventoryDetailController extends BaseController
     }
 
     @Autowired
-    private TbAssetInventoryMapper tbAssetInventoryMapper;
+    private ITbAssetInventoryService inventoryService;
 
     /**
      * 导出资产盘点明细列表
@@ -78,7 +80,7 @@ public class TbInventoryDetailController extends BaseController
             throw new RuntimeException("盘点计划编码不能为空");
         }
 
-        TbAssetInventory tbAssetInventory = tbAssetInventoryMapper.selectTbAssetInventoryByNumber(orderNumber);
+        TbAssetInventory tbAssetInventory = inventoryService.selectTbAssetInventoryByNumber(orderNumber);
 
         List<AssetInventoryStatement> assetInventoryStatements = getInventoryStatement(tbAssetInventory, list);
 
@@ -95,7 +97,7 @@ public class TbInventoryDetailController extends BaseController
     @PostMapping("/export/detail")
     public void exportDetail(HttpServletResponse response, TbAssetInventory tbAssetInventory)
     {
-        List<TbAssetInventory> tbAssetInventoryList = tbAssetInventoryMapper.selectTbAssetInventoryList(tbAssetInventory);
+        List<TbAssetInventory> tbAssetInventoryList = inventoryService.selectTbAssetInventoryList(tbAssetInventory);
         List<AssetInventoryStatement> assetInventoryStatements = new ArrayList<>();
 
         for (TbAssetInventory assetInventory : tbAssetInventoryList) {
@@ -182,6 +184,11 @@ public class TbInventoryDetailController extends BaseController
             // 设置盘点时间
             assetInventoryStatement.setInventoryDate(tbAssetInventory.getInventoryDate());
 
+            // 设置盘点计划结果
+            Integer inventoryPlanResult = tbAssetInventory.getInventoryResult();
+            String inventoryPlanResultName = InventoryPlanResult.getName(inventoryPlanResult);
+            assetInventoryStatement.setInventoryPlanResult(inventoryPlanResultName);
+
             // 设置备注
             assetInventoryStatement.setRemark(inventoryDetail.getRemark());
 

+ 4 - 0
ruoyi-admin/src/main/java/com/ruoyi/inventory/domain/dto/AssetInventoryStatement.java

@@ -69,6 +69,10 @@ public class AssetInventoryStatement {
     @Excel(name = "盘点部门")
     private String inventoryDepartmentName;
 
+    /** 盘点部门 */
+    @Excel(name = "盘点计划结果")
+    private String inventoryPlanResult;
+
     /** 备注 */
     @Excel(name = "备注")
     private String remark;

+ 1 - 1
ruoyi-admin/src/main/resources/mapper/inventory/TbAssetInventoryMapper.xml

@@ -54,7 +54,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             )</if>
             <if test="inventoryBy != null  and inventoryBy != ''"> and a.inventory_by = #{inventoryBy}</if>
             <if test="inventoryDate != null "> and a.inventory_date = #{inventoryDate}</if>
-            <if test="inventoryLocation != null  and inventoryLocation != ''"> and a.inventory_location = #{inventoryLocation} or c.sequence like concat('%', #{inventoryLocation}, '%')</if>
+            <if test="inventoryLocation != null  and inventoryLocation != ''"> and a.inventory_location like concat('%', #{inventoryLocation}, '%')</if>
             <if test="inventoryStatus != null "> and a.inventory_status = #{inventoryStatus}</if>
             <if test="inventoryResult != null "> and a.inventory_result = #{inventoryResult}</if>
             <if test="recordStatus != null "> and a.record_status = #{recordStatus}</if>

+ 34 - 31
ruoyi-ui/src/views/inventory/inventory/index.vue

@@ -132,9 +132,9 @@
           size="mini"
           @click="onOpenExportDetail"
           v-hasPermi="['inventory:inventory:export']"
-        >导出报表</el-button>
+        >盘点报表</el-button>
       </el-col>
-      <el-col :span="1.5">
+      <el-col :span="1.5" v-if="false">
         <el-button
           type="primary"
           plain
@@ -288,7 +288,7 @@
       <UserSearch @submit="onSelectUser" @cancel="() => {openUserSearch = false}" v-if="openUserSearch"></UserSearch>
     </el-dialog>
 
-    <el-dialog :visible.sync="openLoss" title="资产报表查看">
+    <el-dialog :visible.sync="openLoss" title="资产报表查看" width="1000px">
       <el-row>
         <el-form>
           <el-form-item label="盘点部门" prop="inventoryDepartment">
@@ -312,22 +312,39 @@
       </el-row>
       <el-row>
         <el-table :data="lossData">
+          <el-table-column type="expand">
+            <template v-slot="slot">
+              <el-table  :data="slot.row.assetResultList" ref="table" :header-cell-style="{ background: '#dcdfe6' }" >
+                <el-table-column
+                  prop="assetName"
+                  label="资产名称">
+                </el-table-column>
+                <el-table-column
+                  prop="category"
+                  label="类别">
+                </el-table-column>
+                <el-table-column
+                  prop="nowQuantity"
+                  label="现存数量">
+                </el-table-column>
+                <el-table-column
+                  prop="lossQuantity"
+                  label="损耗数量">
+                </el-table-column>
+                <el-table-column
+                  prop="lossVal"
+                  label="损耗值">
+                </el-table-column>
+              </el-table>
+            </template>
+          </el-table-column>
           <el-table-column
             prop="totalLossVal"
-            label="损耗总额"
-            width="100">
+            label="损耗总额">
           </el-table-column>
           <el-table-column
             prop="date"
-            label="盘点时间"
-            width="100">
-          </el-table-column>
-          <el-table-column label="资产盘点结果集">
-            <el-table-column
-              prop="date"
-              label="盘点时间"
-              width="100">
-            </el-table-column>
+            label="盘点时间">
           </el-table-column>
         </el-table>
       </el-row>
@@ -428,21 +445,7 @@ export default {
       },
       openLoss: false,
       deptId: null,
-      lossData: [
-        {
-          totalLossVal: null,
-          date: null,
-          assetResultList: [
-            {
-              assetName: null,
-              category: null,
-              nowQuantity: null,
-              lossQuantity: null,
-              lossVal: null
-            }
-          ]
-        }
-      ],
+      lossData: [],
       pickerOptions: {
         disabledDate(time) {
           return time.getTime() < Date.now() - 8.64e7;
@@ -470,7 +473,7 @@ export default {
         inventoryLocation: [
           { required: true, message: "盘点位置不能为空", trigger: "change" }
         ],
-      }
+      },
     };
   },
   created() {
@@ -671,7 +674,7 @@ export default {
     handleExport() {
       this.download('inventory/inventory/export', {
         ...this.queryParams
-      }, `inventory_${new Date().getTime()}.xlsx`)
+      }, `盘点计划报表_${new Date().getTime()}.xlsx`)
     }
   }
 };