Browse Source

优化位置字段查询

LinWuTai 1 year ago
parent
commit
8624fc0009

+ 13 - 13
ruoyi-admin/src/main/java/com/ruoyi/asset/domain/TbAssetInformation.java

@@ -85,21 +85,21 @@ public class TbAssetInformation extends BaseEntity
 
     /** 位置ID */
     private Long parentLocationId;
-    /** 位置名称 */
-    @Excel(name = "父级位置名称(导出)")
-    private String parentLocationName;
-    /** 位置标签 */
-    @Excel(name = "父级位置标签(导出)")
-    private String parentLocationLabel;
-
+//    /** 位置名称 */
+//    @Excel(name = "父级位置名称(导出)")
+//    private String parentLocationName;
+//    /** 位置标签 */
+//    @Excel(name = "父级位置标签(导出)")
+//    private String parentLocationLabel;
+//
     /** 位置ID */
     private Long ancestorLocationId;
-    /** 位置名称 */
-    @Excel(name = "祖级位置名称(导出)")
-    private String ancestorLocationName;
-    /** 位置标签 */
-    @Excel(name = "祖级位置标签(导出)")
-    private String ancestorLocationLabel;
+//    /** 位置名称 */
+//    @Excel(name = "祖级位置名称(导出)")
+//    private String ancestorLocationName;
+//    /** 位置标签 */
+//    @Excel(name = "祖级位置标签(导出)")
+//    private String ancestorLocationLabel;
 
     /** 资产条码 */
     @Excel(name = "资产条码")

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

@@ -260,16 +260,17 @@ public class TbInventoryDetailController extends BaseController
             assetInventoryStatement.setAssetName(assetInformation.getName());
 
             // 设置所在位置
-            String ancestorLocationName = assetInformation.getAncestorLocationName();
-            if (StrUtil.isBlank(ancestorLocationName)) {
-                ancestorLocationName = "";
-            }
-            String parentLocationName = assetInformation.getParentLocationName();
-            if (StrUtil.isBlank(parentLocationName)) {
-                parentLocationName = "";
-            }
+//            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);
+//            assetInventoryStatement.setAssetLocation(ancestorLocationName + parentLocationName + locationName);
+            assetInventoryStatement.setAssetLocation(locationName);
 
             // 设置资产分类
             String categoryName = assetInformation.getCategoryName();

+ 4 - 2
ruoyi-admin/src/main/java/com/ruoyi/inventory/service/impl/TbAssetInventoryServiceImpl.java

@@ -518,7 +518,8 @@ public class TbAssetInventoryServiceImpl implements ITbAssetInventoryService
                                  Map<String, Integer> invQuantity_map){
         for (TbAssetInformation asset : assetInfos) {
             //资产位置
-            String loc = asset.getAncestorLocationName()+asset.getParentLocationName()+asset.getLocationName();
+            // String loc = asset.getAncestorLocationName()+asset.getParentLocationName()+asset.getLocationName();
+            String loc = asset.getLocationName();
 
             if (!assetMap.containsKey(asset.getName()+"-"+loc)){
 
@@ -659,7 +660,8 @@ public class TbAssetInventoryServiceImpl implements ITbAssetInventoryService
             TbAssetInformation info = JSONUtil.toBean(asset.getAssetData(), TbAssetInformation.class);
             assetInfos.add(info);
             //位置
-            String loc = info.getAncestorLocationName()+info.getParentLocationName()+info.getLocationName();
+            // String loc = info.getAncestorLocationName()+info.getParentLocationName()+info.getLocationName();
+            String loc = info.getLocationName();
 
             if (!invQuantity_map.containsKey(info.getName()+"-"+loc)) {
                 invQuantity_map.put(info.getName() + "-" + loc, asset.getInventoryQuantity());

+ 6 - 5
ruoyi-admin/src/main/resources/mapper/asset/TbAssetInformationMapper.xml

@@ -105,14 +105,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             a.life_units lifeUnits,
             a.start_date startDate,
             b.id locationId,
-            b.name locationName,
+            concat_ws('-',IFNULL(NULL,h.name),IFNULL(NULL,g.name),b.name) locationName,
+--             b.name locationName,
             b.label locationLabel,
             g.id parentLocationId,
-            g.name parentLocationName,
-            g.label parentLocationLabel,
+--             g.name parentLocationName,
+--             g.label parentLocationLabel,
             h.id ancestorLocationId,
-            h.name ancestorLocationName,
-            h.label ancestorLocationLabel,
+--             h.name ancestorLocationName,
+--             h.label ancestorLocationLabel,
             c.id categoryId,
             c.name categoryName,
             d.dept_name userDepartmentName,

+ 2 - 1
ruoyi-ui/src/components/asset/assetCard.vue

@@ -14,7 +14,8 @@
       <el-descriptions-item label="分类名称" v-if="assetInfo.categoryName">{{assetInfo.categoryName}}</el-descriptions-item>
       <el-descriptions-item label="所在位置ID" v-if="assetInfo.locationId">{{assetInfo.locationId}}</el-descriptions-item>
       <el-descriptions-item label="所在位置编号" v-if="assetInfo.locationNumber">{{assetInfo.locationNumber}}</el-descriptions-item>
-      <el-descriptions-item label="所在位置名称" v-if="assetInfo.locationName">{{(assetInfo.ancestorLocationName ? assetInfo.ancestorLocationName + "-" : "") +  (assetInfo.parentLocationName ?  assetInfo.parentLocationName + "-" : "") + assetInfo.locationName}}</el-descriptions-item>
+      <!-- <el-descriptions-item label="所在位置名称" v-if="assetInfo.locationName">{{(assetInfo.ancestorLocationName ? assetInfo.ancestorLocationName + "-" : "") +  (assetInfo.parentLocationName ?  assetInfo.parentLocationName + "-" : "") + assetInfo.locationName}}</el-descriptions-item> -->
+      <el-descriptions-item label="所在位置名称" v-if="assetInfo.locationName">{{assetInfo.locationName}}</el-descriptions-item>
       <el-descriptions-item label="所在位置标签" v-if="assetInfo.locationLabel">{{assetInfo.locationLabel}}</el-descriptions-item>
       <el-descriptions-item label="规格型号" v-if="assetInfo.specificationsModel">{{assetInfo.specificationsModel}}</el-descriptions-item>
       <el-descriptions-item label="ABC分类" v-if="assetInfo.abcCategory">{{assetInfo.abcCategory}}</el-descriptions-item>

+ 2 - 2
ruoyi-ui/src/views/asset/information/index.vue

@@ -227,9 +227,9 @@
       <el-table-column v-if="isExist('入账时间')" label="入账时间" align="center" prop="paymentReceivingTime" />
       <el-table-column label="使用部门" align="center" prop="userDepartmentName"/>
       <el-table-column label="所在位置" align="center" prop="locationName" width="120">
-        <template slot-scope="scope">
+        <!-- <template slot-scope="scope">
           <span>{{ (scope.row.ancestorLocationName ? scope.row.ancestorLocationName + '-' : '') + (scope.row.parentLocationName ? scope.row.parentLocationName + '-' : '') + scope.row.locationName }}</span>
-        </template>
+        </template> -->
       </el-table-column>
       <el-table-column label="资产条码" v-if="isExist('资产条码')" align="center" prop="code" />
       <el-table-column v-if="isExist('epc')" label="EPC" align="center" prop="epc" width="180">

+ 3 - 3
ruoyi-ui/src/views/inventory/detail/index.vue

@@ -86,10 +86,10 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="编号" align="center" prop="id" />
       <el-table-column label="资产名称" align="center" prop="assetInfo.name" />
-      <el-table-column label="资产位置" align="center" width="140">
-        <template slot-scope="props">
+      <el-table-column label="资产位置" align="center" prop="assetInfo.locationName" width="140">
+        <!-- <template slot-scope="props">
           <span>{{(props.row.assetInfo.ancestorLocationName ? props.row.assetInfo.ancestorLocationName + "-" : "") +  (props.row.assetInfo.parentLocationName ?  props.row.assetInfo.parentLocationName + "-" : "") + props.row.assetInfo.locationName}}</span>
-        </template>
+        </template> -->
       </el-table-column>
       <el-table-column label="资产编号" align="center" prop="assetInfo.number"  v-if="columns[0].visible" />
       <el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[1].visible" />