Browse Source

feat:物料标签打印功能

侯茂昌 1 year ago
parent
commit
523ce5ae27

+ 13 - 0
zkqy-admin/src/main/java/com/zkqy/web/controller/system/SysDictDataController.java

@@ -71,6 +71,19 @@ public class SysDictDataController extends BaseController
         return success(dictDataService.selectDictDataById(dictCode));
     }
 
+
+    /**
+     * 根据dict_label查询字典数据详细
+     * 根据编码查询--对应后的转码信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:dict:query')")
+    @GetMapping(value = "/getDictLabel/{dictLabel}")
+    public AjaxResult getInfoByDictLabel(@PathVariable String dictLabel)
+    {
+        return success(dictDataService.selectDictDataByDictLabel(dictLabel));
+    }
+
+
     /**
      * 根据字典类型查询字典数据信息
      */

+ 1 - 0
zkqy-business/src/main/java/com/zkqy/business/service/impl/DragTableServiceImpl.java

@@ -79,6 +79,7 @@ public class DragTableServiceImpl implements IDragTableService {
     public CommonEntity dragTableInfo(String tableKey) {
         //DragTable dragTable = dragTableMapper.selectDragTableBySqlKey(sqlKey);
         //根据tableKey查询动态表格结构数据
+        PageUtils.clearPage();
         DragTable dragTable = dragTableMapper.selectDragTableByTableKey(tableKey);
         //得到模板数据
         Map<String, Object> resultMap = new HashMap<>();

+ 6 - 1
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/CommonServiceImpl.java

@@ -85,7 +85,12 @@ public class CommonServiceImpl implements ICommonService {
         Map<String, Object> fields = JSONObject.parseObject(JSON.toJSONString(commonEntity.getCommMap()));
         Map<String, Object> endfields = new HashMap<>();
         fields.keySet().forEach(item -> {
-            endfields.put(toUnderScoreCase(item), fields.get(item));
+            if(fields.get(item).equals("A")){
+                endfields.put(toUnderScoreCase(item), SecurityUtils.getUsername());
+            }else {
+                endfields.put(toUnderScoreCase(item), fields.get(item));
+            }
+            //endfields.put(toUnderScoreCase(item), fields.get(item));
         });
         Map<String, Object> endConditions = new HashMap<>();
         conditions.keySet().forEach(item -> {

+ 7 - 0
zkqy-system/src/main/java/com/zkqy/system/mapper/SysDictDataMapper.java

@@ -115,4 +115,11 @@ public interface SysDictDataMapper
      * @return 结果
      */
     public int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);
+
+    /**
+     * 根据字典标签查询字典数据信息
+     * @param dictLabel
+     * @return
+     */
+    public String selectDictDataByDictLabel(String dictLabel);
 }

+ 7 - 0
zkqy-system/src/main/java/com/zkqy/system/service/ISysDictDataService.java

@@ -57,4 +57,11 @@ public interface ISysDictDataService
      * @return 结果
      */
     public int updateDictData(SysDictData dictData);
+
+    /**
+     * 根据dictLabel查询对应的字典信息
+     * @param dictLabel
+     * @return
+     */
+    String selectDictDataByDictLabel(String dictLabel);
 }

+ 5 - 0
zkqy-system/src/main/java/com/zkqy/system/service/impl/SysDictDataServiceImpl.java

@@ -108,4 +108,9 @@ public class SysDictDataServiceImpl implements ISysDictDataService
         }
         return row;
     }
+
+    @Override
+    public String selectDictDataByDictLabel(String dictLabel) {
+        return dictDataMapper.selectDictDataByDictLabel(dictLabel);
+    }
 }

+ 11 - 1
zkqy-system/src/main/resources/mapper/system/SysDictDataMapper.xml

@@ -28,6 +28,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
 		from   sys_dict_data
 	</sql>
+	<sql id="selectDictDataVoSan">
+		select dict_value
+		from  sys_dict_data
+	</sql>
 	<sql id="selectDictDataVoBpm">
 		select dict_code, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark
 		from {DBNAME}.sys_dict_data
@@ -103,7 +107,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<select id="countDictDataByType" resultType="Integer">
 	    select count(1) from {DBNAME}.sys_dict_data where dict_type=#{dictType}
 	</select>
-	
+
+	<select id="selectDictDataByDictLabel" parameterType="string" resultType="string">
+		select dict_value
+		from  {DBNAME}.sys_dict_data
+		where dict_label = #{dictLabel}
+	</select>
+
 	<delete id="deleteDictDataById" parameterType="Long">
  		delete from {DBNAME}.sys_dict_data where dict_code = #{dictCode}
  	</delete>

+ 31 - 22
zkqy-ui/src/utils/print/qrCodeList.js

@@ -11,33 +11,44 @@ function qrCodeList(data, domId) {
   // let goodsname = "名称:" + data.purchaseBuyName;
   // let specifications = "规格:" + data.purchaseSerialNumber;
   // let goodstime = "生产日期:" + data.purchaseCreateTime;
-  let printContent = `<div><table><tr><td >`;
+  let cellStyle = 'style="width:100%; padding: 0; margin: 0;"';
+  let printContent = `<div><table style="width: 100%; border-collapse: collapse;"><tbody><tr ${cellStyle}><td ${cellStyle}>`;
   for (var i = 0; i < data.length; i++) {
     let currentData = data[i]
-    printContent +=
-      `<div style="width: 840px; height:100px;background-color: skyblue;"><div id="HT` +
-      i +
-      `" style="float: left;margin-top: 15px; border-right: 10px white solid"></div>`;
-    printContent +=
-      `<div id="LJJ` +
-      i +
-      `" style="float: left;margin-top: 5px;">
-                <h1><strong>${currentData.showMsg[0].label +
-      ': ' + currentData.showMsg[0].value}</strong></h1>
-                <h1><strong>${currentData.showMsg[1].label +
-      ': ' + currentData.showMsg[1].value}</strong></h1>
-              </div></div>
-              <div style="clear: both"></div>`;
+    //printContent +=
+    //  `<div style="width: 500px; height:160px;background-color: skyblue;display: flex; justify-content: center; align-items: center;">
+    //   <div id="HT` +
+    //  i +
+    //  `"style="border-right: 10px white solid"></div>`;
+    //printContent +=
+    //  `<div id="LJJ` +
+    //  i +
+    //  `" style="margin-top: 5px;">
+    //            <h1><strong>${currentData.showMsg[0].label +
+    //  ': ' + currentData.showMsg[0].value}</strong></h1>
+    //            <h1><strong>${currentData.showMsg[1].label +
+    //  ': ' + currentData.showMsg[1].value}</strong></h1>
+    //                  <h1><strong>${currentData.showMsg[2].label +
+    //  ': ' + currentData.showMsg[2].value}</strong></h1>
+    //          </div></div>
+    //          <div style="clear: both"></div>`;
+    printContent += `
+      <div style="width: 100%; height: auto; background-color: skyblue; display: flex; flex-direction: column; justify-content: space-between; align-items: center;">
+            <div id="HT${i}" style="border: 1px solid red;width: 170px;height:170px;margin-top:22px"></div>
+            <div id="LJJ${i}" style="text-align:left;margin-top: 5px">
+                  <h3><strong>${currentData.showMsg[0].label}: </strong>${currentData.showMsg[0].value}<strong> &nbsp;${currentData.showMsg[1].label}: </strong> ${currentData.showMsg[1].value}</h3>
+                  <h3><strong>${currentData.showMsg[2].label}: </strong> ${currentData.showMsg[2].value}</h3>
+            </div>
+      </div>`;
   }
   printContent += `</td></tr></table></div>`;
   document.body.innerHTML = document.getElementById(domId).innerHTML = printContent;
   for (var i = 0; i < data.length; i++) {
     for (let j = 0; j < 1; j++) {
       new QRCode(document.getElementById("HT" + i), {
-        text:
-          sleep(1) + JSON.stringify(data[i].codeData),
-        width: 120,
-        height: 120,
+        text: sleep(1) + data[i].codeData,
+        width: 170,
+        height: 170,
         colorDark: "#000000",
         colorLight: "#ffffff",
         correctLevel: QRCode.CorrectLevel.H,
@@ -55,6 +66,4 @@ function sleep(ms) {
   while (new Date().getTime() < unixtime_ms + ms) { }
   return "";
 }
-
-
-export default qrCodeList
+export default qrCodeList

+ 24 - 66
zkqy-ui/src/views/orderMange/purchase/index.vue

@@ -1,55 +1,6 @@
 <template>
   <div class="app-container">
-    <el-dialog
-      :title="upload.title"
-      :visible.sync="upload.open"
-      width="400px"
-      append-to-body
-    >
-      <el-upload
-        ref="upload"
-        :limit="1"
-        accept=".xlsx, .xls"
-        :headers="upload.headers"
-        :action="
-          upload.url +
-          '?updateSupport=' +
-          upload.updateSupport +
-          '&tableName=' +
-          tableName +
-          '&sqlKey=' +
-          tableKey
-        "
-        v-loading="upload.isUploading"
-        :disabled="upload.isUploading"
-        :on-progress="handleFileUploadProgress"
-        :on-success="handleFileSuccess"
-        :auto-upload="false"
-        :onChange="handleChange"
-        drag
-      >
-        <i class="el-icon-upload"></i>
-        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
-        <div class="el-upload__tip text-center" slot="tip">
-          <!--          <div class="el-upload__tip" slot="tip">-->
-          <!--            <el-checkbox v-model="upload.updateSupport"/>-->
-          <!--            是否更新已经存在的用户数据-->
-          <!--          </div>-->
-          <span>仅允许导入xls、xlsx格式文件。</span>
-          <el-link
-            type="primary"
-            :underline="false"
-            style="font-size: 12px; vertical-align: baseline"
-            @click="importTemplate"
-            >下载模板
-          </el-link>
-        </div>
-      </el-upload>
-      <div slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitFileForm">确 定</el-button>
-        <el-button @click="upload.open = false">取 消</el-button>
-      </div>
-    </el-dialog>
+    <!--头部查询表单-->
     <Queryfrom
       :form-vals="templateInfo.where"
       :statisticList="statisticList"
@@ -58,6 +9,7 @@
       @getList="getList"
       ref="mychild"
     />
+    <!--头部新增按钮-->
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
@@ -117,6 +69,7 @@
         @queryTable="pageList"
       ></right-toolbar>
     </el-row>
+    <!--表格-->
     <el-table
       v-loading="loading"
       :data="tableList"
@@ -234,6 +187,7 @@
         </template>
       </el-table-column>
     </el-table>
+    <!--分页器-->
     <pagination
       v-show="total > 0"
       :total="total"
@@ -241,6 +195,7 @@
       :limit.sync="queryParams.pageSize"
       @pagination="pageList"
     />
+
     <!-- k-form-build 组件渲染弹窗-->
     <el-dialog :title="title" :visible.sync="kOpen" append-to-body>
       <k-form-build
@@ -258,6 +213,7 @@
         <el-button @click="kCancel">取 消</el-button>
       </div>
     </el-dialog>
+
     <!-- 添加或修改销售出库单:- 过磅记录生成数据对话框 -->
     <el-dialog title="打印" :visible.sync="open" append-to-body>
       <el-form
@@ -325,8 +281,9 @@
         <el-button type="primary" @click="btnComfirm">确 定</el-button>
       </span>
     </el-dialog>
+
     <!-- print -->
-    <div id="printDom"></div>
+    <div id="printDom" style="width: 160px;height:160px"></div>
   </div>
 </template>
 <script>
@@ -429,8 +386,6 @@ export default {
         //   remark: "", //备注
         // },
       ],
-      rules: {},
-
       // end
       // 绑定按钮dialog
       btnDialogVisible: false,
@@ -558,7 +513,7 @@ export default {
       let payLoad = {
         isEnablePaging: false,
         basicMap: {
-          tableName: "materiel_code",
+          tableName: "materiel",
         },
         queryMap: {
           materiel_code: purchaseMaterielId,
@@ -581,19 +536,21 @@ export default {
           let allPringtData = [];
           for (let i = 0; i < Number(this.printForm.num); i++) {
             allPringtData.push({
-              codeData: {
-                ...printData,
-                no: i + 1,
-              },
+              codeData: printData.serialNumber+"@"+ printData.materielId+"@"+printData.materielName+"@"+printData.units+"@"+printData.specificationModel+"@"+(i+1),
               showMsg: [
                 {
-                  label: "号",
-                  value: i + 1,
+                  label: "编号",
+                  value: printData.materielId,
                 },
                 {
-                  label: "母粒名称",
+                  label: "名称",
                   value: labelRes.msg,
                 },
+                {
+                  label: "序号",
+                  value: i + 1,
+                },
+
               ],
             });
           }
@@ -705,11 +662,12 @@ export default {
     },
     //审计新增
     async addHandler() {
-      this.isEdit = false;
-      await this.getDropDownData();
-      this.resetFormData();
-      this.title = "新增审计单";
-      this.open = true;
+      alert("新增采购单")
+      //this.isEdit = false;
+      //await this.getDropDownData();
+      //this.resetFormData();
+      //this.title = "新增审计单";
+      //this.open = true;
     },
     // 获取下拉框数据
     async getDropDownData() {