Browse Source

将epc由编码转化改为由Id转化;修复标签打印重复

LinWuTai 1 year ago
parent
commit
61483fc279

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

@@ -130,20 +130,20 @@ public class TbAssetInformationController extends BaseController
 
         List<PTXLabelInfo> ptxLabelInfos = new ArrayList<>();
         for (TbAssetInformation tbAssetInformation : tbAssetInformationList) {
-            // 然后再转回对象,便不会影响到原对象
-            PTXLabelInfo ptxLabelInfo = JSONUtil.toBean(ptxLabelInfoModel, PTXLabelInfo.class);
             List<AssetEpcInfo> childNumberInfo = tbAssetInformation.getChildNumberInfo();
             for (AssetEpcInfo assetEpcInfo : childNumberInfo) {
                 tbAssetInformation.setNumber(assetEpcInfo.getNumber());
                 tbAssetInformation.setEpc(assetEpcInfo.getEpc());
                 tbAssetInformation.setEpcReplenishLength(assetEpcInfo.getEpcReplenishLength());
+                // 然后再转回对象,便不会影响到原对象
+                PTXLabelInfo ptxLabelInfo = JSONUtil.toBean(ptxLabelInfoModel, PTXLabelInfo.class);
                 ptxLabelInfo = ptxService.filterInfo(ptxLabelInfo, tbAssetInformation);
                 ptxLabelInfos.add(ptxLabelInfo);
             }
         }
 
         for (PTXLabelInfo ptxLabelInfo : ptxLabelInfos) {
-            ptxService.printLabel(ptxLabelInfo);
+             ptxService.printLabel(ptxLabelInfo);
         }
 
         return AjaxResult.success(ptxLabelInfos);

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

@@ -33,51 +33,34 @@ public class TbAssetInformation extends BaseEntity
     /** 编号 */
     private Long id;
 
-    /** 资产条码 */
-    @Excel(name = "资产条码")
-    private String code;
-
-    /** 资产名称 */
-    @Excel(name = "资产名称")
-    private String name;
-
-    /** 资产编号 */
-    @Excel(name = "资产编号")
-    private String number;
-
-    /** epc */
-    @Excel(name = "epc")
-    private String epc;
-
-    /** epc补充长度 */
-    private Integer epcReplenishLength;
-
-    /** 图片路径 */
-//    @Excel(name = "图片路径")
-    private String imageUrl;
-
     /** 资产分类编号 */
     @Excel(name = "资产分类编号")
     private String categoryNumber;
 
-    /** 分类ID */
-    private Long categoryId;
-
     /** 分类名称 */
     @Excel(name = "资产分类名称(导出)")
     private String categoryName;
 
-    /** 规格型号 */
-    @Excel(name = "规格型号")
-    private String specificationsModel;
+    /** 资产编号 */
+    @Excel(name = "资产编号")
+    private String number;
 
-    /** ABC分类 */
-    @Excel(name = "ABC分类")
-    private String abcCategory;
+    /** 资产名称 */
+    @Excel(name = "资产名称")
+    private String name;
 
-    /** 管理状态,0:闲置 */
-    @Excel(name = "管理状态,0:正常,1:调整,2:调拨,3:借出,4:拆分,5:闲置,6:启用,7:报废,8:变卖")
-    private Long manageStatus;
+    /** 计量单位 */
+    @Excel(name = "计量单位")
+    private String units;
+
+    /** 数量 */
+    @Excel(name = "数量")
+    private Integer quantity;
+
+    /** 入账时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "入账时间", width = 40, dateFormat = "yyyy-MM-dd")
+    private Date paymentReceivingTime;
 
     /** 使用部门 */
     @Excel(name = "使用部门")
@@ -87,18 +70,6 @@ public class TbAssetInformation extends BaseEntity
     @Excel(name = "使用部门名称(导出)")
     private String userDepartmentName;
 
-    /** 管理部门 */
-    @Excel(name = "管理部门")
-    private String department;
-
-    /** 管理部门名称 */
-    @Excel(name = "管理部门名称(导出)")
-    private String departmentName;
-
-    /** 责任人 */
-    @Excel(name = "责任人")
-    private String responsiblePerson;
-
     /** 所在位置编号 */
     @Excel(name = "所在位置编号")
     private String locationNumber;
@@ -130,6 +101,47 @@ public class TbAssetInformation extends BaseEntity
     @Excel(name = "祖级位置标签(导出)")
     private String ancestorLocationLabel;
 
+    /** 资产条码 */
+    @Excel(name = "资产条码")
+    private String code;
+
+    /** epc */
+    @Excel(name = "epc")
+    private String epc;
+
+    /** epc补充长度 */
+    private Integer epcReplenishLength;
+
+    /** 图片路径 */
+//    @Excel(name = "图片路径")
+    private String imageUrl;
+
+    /** 分类ID */
+    private Long categoryId;
+
+    /** 规格型号 */
+    @Excel(name = "规格型号")
+    private String specificationsModel;
+
+    /** ABC分类 */
+    @Excel(name = "ABC分类")
+    private String abcCategory;
+
+    /** 管理状态,0:闲置 */
+    @Excel(name = "管理状态,0:正常,1:调整,2:调拨,3:借出,4:拆分,5:闲置,6:启用,7:报废,8:变卖")
+    private Long manageStatus;
+
+    /** 管理部门 */
+    @Excel(name = "管理部门")
+    private String department;
+
+    /** 管理部门名称 */
+    @Excel(name = "管理部门名称(导出)")
+    private String departmentName;
+
+    /** 责任人 */
+    @Excel(name = "责任人")
+    private String responsiblePerson;
 
     /** 资产性质 */
     @Excel(name = "资产性质")
@@ -223,19 +235,6 @@ public class TbAssetInformation extends BaseEntity
     @Excel(name = "是否白名单,Y:是,N:否", width = 30)
     private String isWhitelist;
 
-    /** 数量 */
-    @Excel(name = "数量")
-    private Integer quantity;
-
-    /** 计量单位 */
-    @Excel(name = "计量单位")
-    private String units;
-
-    /** 入账时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "入账时间", width = 40, dateFormat = "yyyy-MM-dd")
-    private Date paymentReceivingTime;
-
     /** 预计使用期限 */
     @Excel(name = "预计使用期限")
     private Integer lifeExpectancy;

+ 7 - 3
ruoyi-admin/src/main/java/com/ruoyi/asset/service/impl/TbAssetInformationServiceImpl.java

@@ -144,10 +144,14 @@ public class TbAssetInformationServiceImpl implements ITbAssetInformationService
         if (StrUtil.isBlank(locationNumber)) {
             tbAssetInformation.setLocationNumber(null);
         }
-        // 根据Id设置Epc
-        tbAssetInformation.setEpcInfo();
+        int result = tbAssetInformationMapper.insertTbAssetInformation(tbAssetInformation);
+        if (result > 0) {
+            // 根据Id设置Epc
+            tbAssetInformation.setEpcInfo();
+            tbAssetInformationMapper.updateTbAssetInformation(tbAssetInformation);
+        }
 
-        return tbAssetInformationMapper.insertTbAssetInformation(tbAssetInformation);
+        return result;
     }
 
     /**

+ 4 - 4
ruoyi-admin/src/main/java/com/ruoyi/asset/service/impl/TbLocationServiceImpl.java

@@ -214,17 +214,17 @@ public class TbLocationServiceImpl implements ITbLocationService
     }
 
     private String getSequence(Long parentId, Long locationId) {
-        HashSet<Long> set = new HashSet<>();
+        List<Long> set = new ArrayList<>();
         while (parentId != null && parentId > 0) {
             TbLocation location = selectTbLocationById(parentId);
             set.add(location.getId());
             parentId = location.getParentId();
         }
 
-        StringBuilder stringBuilder = new StringBuilder("");
+        StringBuilder stringBuilder = new StringBuilder();
         if (!set.isEmpty()) {
-            for (Long id : set) {
-                stringBuilder.append(id);
+            for (int i = set.size() - 1; i >= 0; i--) {
+                stringBuilder.append(set.get(i));
                 stringBuilder.append(",");
             }
         }

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

@@ -18,7 +18,7 @@
       <el-form-item label="所在位置" prop="locationNumber">
         <treeselect v-model="queryParams.locationNumber" :options="locationList" :normalizer="tenantIdnormalizer" placeholder="选择位置" />
       </el-form-item>
-      <el-form-item v-if="isExist('使用部门')" label="使用部门" prop="userDepartment">
+      <el-form-item label="使用部门" prop="userDepartment">
         <div style="display: inline-block; width: 183px">
           <treeselect v-model="queryParams.userDepartment" :options="deptOptions" :normalizer="normalizer" placeholder="选择使用部门" />
         </div>
@@ -214,32 +214,25 @@
     <el-table v-loading="loading" :data="informationList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <!-- <el-table-column label="编号" align="center" prop="id" /> -->
+      <el-table-column label="资产分类" align="center" prop="categoryName"/>
       <el-table-column label="资产编号" align="center" prop="number" />
-      <el-table-column label="照片" align="center" prop="imageUrl" width="100">
+      <el-table-column label="图片" v-if="isExist('图片')" align="center" prop="imageUrl" width="100">
         <template slot-scope="scope">
           <image-preview :src="scope.row.imageUrl" :width="50" :height="50" v-show="scope.row.imageUrl === '' || scope.row.imageUrl == null ? false : true" />
         </template>
       </el-table-column>
       <el-table-column label="资产名称" align="center" prop="name" />
-      <el-table-column label="数量" align="center" prop="quantity" />
       <el-table-column label="计量" align="center" prop="units" />
-      <el-table-column label="资产分类" align="center" prop="categoryName">
-        <!-- <template slot-scope="scope">
-          <span>{{ scope.row.categoryNumber != null ? categoryName(scope.row.categoryNumber) : '' }}</span>
-        </template> -->
-      </el-table-column>
+      <el-table-column label="数量" align="center" prop="quantity" />
+      <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">
           <span>{{ (scope.row.ancestorLocationName ? scope.row.ancestorLocationName + '-' : '') + (scope.row.parentLocationName ? scope.row.parentLocationName + '-' : '') + scope.row.locationName }}</span>
         </template>
       </el-table-column>
-      <el-table-column v-if="isExist('使用部门')" label="使用部门" align="center" prop="userDepartmentName">
-        <!-- <template slot-scope="scope">
-          <span>{{ scope.row.userDepartment != null ? companyName(scope.row.userDepartment) : '' }}</span>
-        </template> -->
-      </el-table-column>
       <el-table-column label="资产条码" v-if="isExist('资产条码')" align="center" prop="code" />
-      <el-table-column label="EPC" align="center" prop="epc" v-if="isExist('epc')" width="180">
+      <el-table-column v-if="isExist('epc')" label="EPC" align="center" prop="epc" width="180">
         <template slot-scope="scope">
           <div>{{ scope.row.epc }}<br />&lceil;补位:{{ scope.row.epcReplenishLength }}&rfloor;</div>
         </template>
@@ -249,12 +242,7 @@
           <span>{{ scope.row.departmentName }}</span>
         </template>
       </el-table-column>
-      <el-table-column v-if="isExist('所属公司')" label="所属公司" align="center" prop="corporationName">
-        <!-- <template slot-scope="scope">
-          <span>{{ scope.row.corporation != null ? companyName(scope.row.corporation) : '' }}</span>
-        </template> -->
-      </el-table-column>
-      <el-table-column v-if="isExist('入账时间')" label="入账时间" align="center" prop="paymentReceivingTime" />
+      <el-table-column v-if="isExist('所属公司')" label="所属公司" align="center" prop="corporationName"/>
       <el-table-column v-if="isExist('备注')" label="备注" align="center" prop="remark" />
       <el-table-column v-if="isExist('管理状态')" label="管理状态" align="center" prop="manageStatus">
         <template slot-scope="scope">
@@ -582,7 +570,7 @@
       <template>
         <div>
           <el-checkbox-group v-model="checkList" mini>
-            <el-checkbox label="epc" border></el-checkbox>
+            <el-checkbox label="图片" border></el-checkbox>
             <el-checkbox label="使用部门" border></el-checkbox>
             <el-checkbox label="资产条码" border></el-checkbox>
             <el-checkbox label="资产性质" border></el-checkbox>
@@ -611,9 +599,10 @@
             <el-checkbox label="预计使用期限单位" border></el-checkbox>
             <el-checkbox label="所属公司" border></el-checkbox>
             <el-checkbox label="管理部门" border></el-checkbox>
+            <el-checkbox label="管理状态" border></el-checkbox>
             <el-checkbox label="记录状态" border></el-checkbox>
             <el-checkbox label="是否白名单" border></el-checkbox>
-            <el-checkbox label="管理状态" border></el-checkbox>
+            <el-checkbox label="epc" border></el-checkbox>
             <el-checkbox label="备注" border></el-checkbox>
           </el-checkbox-group>
         </div>
@@ -1079,6 +1068,7 @@ export default {
     handleFileSuccess(response, file, fileList) {
       this.upload.open = false
       this.upload.isUploading = false
+      this.$modal.closeLoading()
       this.$refs.upload.clearFiles()
       this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + '</div>', '导入结果', { dangerouslyUseHTMLString: true })
       this.getList()
@@ -1086,6 +1076,7 @@ export default {
     // 提交上传文件
     submitFileForm() {
       this.$refs.upload.submit()
+      this.$modal.loading('资产导入中,请稍候...')
     },
     /** 删除按钮操作 */
     handleDelete(row) {