huang_an 2 лет назад
Родитель
Сommit
10e13feb94

+ 1 - 0
package.json

@@ -30,6 +30,7 @@
     "json-bigint": "^1.0.0",
     "mathjs": "11.11.0",
     "nprogress": "^0.2.0",
+    "qrcode": "^1.5.3",
     "tinymce": "^5.10.5",
     "vue": "^2.7.10",
     "vue-clipboard2": "^0.3.3",

+ 61 - 2
src/views/warehouseManagement/stockLedger/components/item-list.vue

@@ -15,9 +15,24 @@
       full-height="calc(100vh - 116px)"
       tool-class="ele-toolbar-form"
       cache-key="systemOrgUserTable"
+      @select="selectChange"
+      @select-all="changeSelectAll"
     >
       <!-- 表头工具栏 -->
-      <template v-slot:toolbar> </template>
+      <template
+        v-if="selectedDime == 3 || selectedDime == 4"
+        v-slot:toolbar="{ row }"
+      >
+        <el-button
+          size="small"
+          :disabled="checkRadioData.length == 0"
+          icon="el-icon-set-up"
+          class="ele-btn-icon"
+          @click="allPrinting()"
+        >
+          打印条码
+        </el-button>
+      </template>
       <!-- 批次号 -->
       <template v-slot:batchNo="{ row }">
         <el-popover placement="right-start" width="800" trigger="hover">
@@ -116,10 +131,16 @@
         </el-link>
       </template>
     </ele-pro-table>
+    <print ref="printRef" :dimension="selectedDime"></print>
+    <printSr ref="printSrRef" :dimension="selectedDime"></printSr>
+    <printTg ref="printTgRef" :dimension="selectedDime"></printTg>
   </div>
 </template>
 
 <script>
+  import print from './print.vue';
+  import printSr from './printSr.vue';
+  import printTg from './printTg.vue';
   import ItemSearch from './item-search.vue';
   // import {
   //   getUserPage,
@@ -136,7 +157,7 @@
   import { getBatchDetails } from '@/api/classifyManage/index';
 
   export default {
-    components: { ItemSearch },
+    components: { ItemSearch, print, printSr, printTg },
     props: {
       // 机构id
       organizationId: [Number, String],
@@ -149,6 +170,7 @@
     },
     data() {
       return {
+        checkRadioData: [],
         searchForm: {
           dimension: '1'
         },
@@ -408,6 +430,12 @@
           // 包装维度
           case '3':
             arr = [
+              {
+                width: 45,
+                type: 'selection',
+                columnKey: 'selection',
+                align: 'center'
+              },
               {
                 columnKey: 'index',
                 type: 'index',
@@ -568,6 +596,12 @@
           // 物料维度
           default:
             arr = [
+              {
+                width: 45,
+                type: 'selection',
+                columnKey: 'selection',
+                align: 'center'
+              },
               {
                 columnKey: 'index',
                 type: 'index',
@@ -717,6 +751,31 @@
       }
     },
     methods: {
+      // 全选
+      changeSelectAll(arr) {
+        console.log(arr);
+        if (arr.length != 0) {
+          this.checkRadioData = arr;
+        } else {
+          this.checkRadioData = [];
+        }
+      },
+      selectChange(selection, row) {
+        if (selection.length != 0) {
+          this.checkRadioData = selection;
+        } else {
+          this.checkRadioData = [];
+        }
+      },
+      allPrinting() {
+        if (this.clientEnvironmentId == 2) {
+          this.$refs.printSrRef.open(this.checkRadioData);
+        } else if (this.clientEnvironmentId == 3) {
+          this.$refs.printTgRef.open(this.checkRadioData);
+        } else {
+          this.$refs.printRef.open(this.checkRadioData);
+        }
+      },
       handledime(val) {
         this.selectedDime = val;
         this.reload();

+ 172 - 0
src/views/warehouseManagement/stockLedger/components/print.vue

@@ -0,0 +1,172 @@
+<template>
+  <ele-modal
+    title="二维码"
+    :visible.sync="QRvisible"
+    v-if="QRvisible"
+    width="800px"
+  >
+    <div id="printSection">
+      <div
+        v-for="(item, index) in codeList"
+        :key="index"
+        style="
+          display: flex;
+          padding-left: 20px;
+          align-items: center;
+          justify-content: center;
+          margin: auto;
+        "
+      >
+        <div style="width: 250px; height: 240px">
+          <img
+            :src="item.qrcode"
+            alt="QR Code"
+            style="width: 240px; height: 240px"
+          />
+        </div>
+        <div
+          style="
+            width: 440px;
+            height: 240px;
+            display: flex;
+            flex-direction: column;
+            flex-wrap: wrap;
+            justify-content: space-between;
+            align-items: flex-start;
+          "
+        >
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">编码:</span>
+            <span style="color: #000">{{
+              dimension == 3 ? item.packagingCode : item.no
+            }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">名称:</span>
+            <span style="color: #000">{{ item.name }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">型号:</span>
+            <span style="color: #000">{{ item.modelType }}</span>
+          </div>
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">规格:</span>
+            <span style="color: #000">{{ item.specification }}</span>
+          </div>
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">牌号:</span>
+            <span style="color: #000">{{ item.brandNum }}</span>
+          </div>
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">物料代号:</span>
+            <span style="color: #000">{{ item.materielCode }}</span>
+          </div>
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">客户代号:</span>
+            <span style="color: #000">{{ item.clientCode }}</span>
+          </div>
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">刻码:</span>
+            <span style="color: #000">{{ item.engrave }}</span>
+          </div>
+          <!-- <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block; width: 100px">工位名称:</span>
+            <span style="color: #000">{{
+              item.workstation ? item.workstation.name : ''
+            }}</span>
+          </div> -->
+        </div>
+      </div>
+    </div>
+
+    <div slot="footer">
+      <el-button @click="print">打印预览</el-button>
+      <el-button @click="close">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import QRCode from 'qrcode';
+  export default {
+    name: 'print',
+    data() {
+      return {
+        QRvisible: false,
+        codeList: []
+      };
+    },
+    props: ['dimension'],
+    methods: {
+      open(data) {
+        this.codeList = data;
+        this.QRvisible = true;
+        this.$nextTick(() => {
+          this.generateQRCodes();
+        });
+        // queryPrint({ ids }).then(res => {
+        //     this.codeList = res;
+        //     this.QRvisible = true
+        //     this.$nextTick(() => {
+        //         this.generateQRCodes()
+        //     })
+        // })
+      },
+
+      generateQRCodes() {
+        this.codeList.forEach((item) => {
+          let code = '';
+          if (this.dimension == 3) {
+            code = item.packagingCode;
+          } else {
+            code = item.no;
+          }
+          QRCode.toDataURL(code)
+            .then((url) => {
+              item.qrcode = url;
+              this.$forceUpdate();
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        });
+      },
+
+      close() {
+        this.QRvisible = false;
+      },
+
+      print() {
+        const printSection = document.getElementById('printSection');
+        // 创建打印任务
+        const printWindow = window.open('', '_blank');
+        printWindow.document.open();
+        printWindow.document.write('<html><head><title>打印预览</title>');
+        printWindow.document.write(
+          '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+        );
+        printWindow.document.write('</head><body>');
+        printWindow.document.write(printSection.innerHTML);
+        printWindow.document.write('</body></html>');
+        printWindow.document.close();
+        printWindow.onload = function () {
+          printWindow.print();
+        };
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  @media print {
+    #printSection {
+      font-size: 34px;
+
+      span {
+        font-size: 34px;
+      }
+    }
+  }
+</style>

+ 177 - 0
src/views/warehouseManagement/stockLedger/components/printSr.vue

@@ -0,0 +1,177 @@
+<template>
+  <ele-modal
+    title="二维码"
+    :visible.sync="QRvisible"
+    v-if="QRvisible"
+    width="800px"
+  >
+    <div id="printSection">
+      <div
+        v-for="(item, index) in codeList"
+        :key="index"
+        style="
+          width: 100%;
+          height: 100%;
+          display: flex;
+          align-items: center;
+          justify-content: center;
+        "
+      >
+        <div
+          style="
+            width: 160px;
+            height: 160px;
+            margin-right: 10px;
+            padding-left: 0px;
+          "
+        >
+          <img
+            :src="item.qrcode"
+            alt="QR Code"
+            style="width: 160px; height: 160px"
+          />
+        </div>
+        <div
+          style="
+            width: 640px;
+            display: flex;
+            flex-direction: column;
+            flex-wrap: wrap;
+            justify-content: space-between;
+            align-items: flex-start;
+          "
+        >
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">编码:</span>
+            <span style="color: #000">{{
+              dimension == 3 ? item.packagingCode : item.no
+            }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">名称:</span>
+            <span style="color: #000">{{ item.name }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">型号:</span>
+            <span style="color: #000">{{ item.modelType }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">规格:</span>
+            <span style="color: #000">{{ item.specification }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">牌号:</span>
+            <span style="color: #000">{{ item.brandNum }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">物料代号:</span>
+            <span style="color: #000">{{ item.materielCode }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">客户代号:</span>
+            <span style="color: #000">{{ item.clientCode }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">刻码:</span>
+            <span style="color: #000">{{ engrave }}</span>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div slot="footer">
+      <el-button @click="print">打印预览</el-button>
+      <el-button @click="close">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import QRCode from 'qrcode';
+  export default {
+    name: 'print',
+    data() {
+      return {
+        QRvisible: false,
+        codeList: []
+      };
+    },
+    props: ['dimension'],
+    methods: {
+      open(data) {
+        this.codeList = data;
+        this.QRvisible = true;
+        this.$nextTick(() => {
+          this.generateQRCodes();
+        });
+        // queryPrint({ ids }).then(res => {
+        //     this.codeList = res;
+        //     this.QRvisible = true
+        //     this.$nextTick(() => {
+        //         this.generateQRCodes()
+        //     })
+        // })
+      },
+
+      generateQRCodes() {
+        this.codeList.forEach((item) => {
+          let code = '';
+          if (this.dimension == 3) {
+            code = item.packagingCode;
+          } else {
+            code = item.no;
+          }
+          QRCode.toDataURL(code)
+            .then((url) => {
+              item.qrcode = url;
+              this.$forceUpdate();
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        });
+      },
+
+      close() {
+        this.QRvisible = false;
+      },
+
+      print() {
+        const printSection = document.getElementById('printSection');
+        // 创建打印任务
+        const printWindow = window.open('', '_blank');
+        printWindow.document.open();
+        printWindow.document.write('<html><head><title>打印预览</title>');
+        printWindow.document.write(
+          '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+        );
+        printWindow.document.write('</head><body>');
+        printWindow.document.write(printSection.innerHTML);
+        printWindow.document.write('</body></html>');
+        printWindow.document.close();
+        printWindow.onload = function () {
+          printWindow.print();
+        };
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  @media print {
+    #printSection {
+      font-size: 34px;
+
+      span {
+        font-size: 34px;
+      }
+    }
+  }
+</style>

+ 171 - 0
src/views/warehouseManagement/stockLedger/components/printTg.vue

@@ -0,0 +1,171 @@
+<template>
+  <ele-modal
+    title="二维码"
+    :visible.sync="QRvisible"
+    v-if="QRvisible"
+    width="800px"
+  >
+    <div id="printSection">
+      <div
+        v-for="(item, index) in codeList"
+        :key="index"
+        style="
+          display: flex;
+          width: 100%;
+          height: 100%;
+          align-items: center;
+          justify-content: center;
+          margin: auto;
+        "
+      >
+        <div style="width: 200px; height: 200px; margin-right: 18px">
+          <img
+            :src="item.qrcode"
+            alt="QR Code"
+            style="width: 200px; height: 200px"
+          />
+        </div>
+        <div
+          style="
+            width: 520px;
+            display: flex;
+            flex-direction: column;
+            flex-wrap: wrap;
+            justify-content: space-between;
+            align-items: flex-start;
+          "
+        >
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">编码:</span>
+            <span style="color: #000">{{
+              dimension == 3 ? item.packagingCode : item.no
+            }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">名称:</span>
+            <span style="color: #000">{{ item.name }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">型号:</span>
+            <span style="color: #000">{{ item.modelType }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">规格:</span>
+            <span style="color: #000">{{ item.specification }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">牌号:</span>
+            <span style="color: #000">{{ item.brandNum }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">物料代号:</span>
+            <span style="color: #000">{{ item.materielCode }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">客户代号:</span>
+            <span style="color: #000">{{ item.clientCode }}</span>
+          </div>
+
+          <div style="text-align: left; font-size: 20px">
+            <span style="display: inline-block">刻码:</span>
+            <span style="color: #000">{{ item.engrave }}</span>
+          </div>
+        </div>
+      </div>
+    </div>
+
+    <div slot="footer">
+      <el-button @click="print">打印预览</el-button>
+      <el-button @click="close">关闭</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  import QRCode from 'qrcode';
+  export default {
+    name: 'print',
+    data() {
+      return {
+        QRvisible: false,
+        codeList: []
+      };
+    },
+    props: ['dimension'],
+    methods: {
+      open(data) {
+        this.codeList = data;
+        this.QRvisible = true;
+        this.$nextTick(() => {
+          this.generateQRCodes();
+        });
+        // queryPrint({ ids }).then(res => {
+        //     this.codeList = res;
+        //     this.QRvisible = true
+        //     this.$nextTick(() => {
+        //         this.generateQRCodes()
+        //     })
+        // })
+      },
+
+      generateQRCodes() {
+        this.codeList.forEach((item) => {
+          let code = '';
+          if (this.dimension == 3) {
+            code = item.packagingCode;
+          } else {
+            code = item.no;
+          }
+          QRCode.toDataURL(code)
+            .then((url) => {
+              item.qrcode = url;
+              this.$forceUpdate();
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        });
+      },
+
+      close() {
+        this.QRvisible = false;
+      },
+
+      print() {
+        const printSection = document.getElementById('printSection');
+        // 创建打印任务
+        const printWindow = window.open('', '_blank');
+        printWindow.document.open();
+        printWindow.document.write('<html><head><title>打印预览</title>');
+        printWindow.document.write(
+          '<link rel="stylesheet" href="your-stylesheet-url.css" type="text/css" />'
+        );
+        printWindow.document.write('</head><body>');
+        printWindow.document.write(printSection.innerHTML);
+        printWindow.document.write('</body></html>');
+        printWindow.document.close();
+        printWindow.onload = function () {
+          printWindow.print();
+        };
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  @media print {
+    #printSection {
+      font-size: 34px;
+
+      span {
+        font-size: 34px;
+      }
+    }
+  }
+</style>

+ 8 - 13
src/views/warehouseManagement/stockManagement/add_export.vue

@@ -991,19 +991,7 @@
                   item.outInNum = filterArray[0]['数量'];
                 }
                 // 添加固定货位
-                item.houseList = [
-                  {
-                    areaId: '1746702944766128130',
-                    areaName: '备件1号库区',
-                    cargoSpaceCode: '01',
-                    cargoSpaceId: '1746702944837431297',
-                    num: 10,
-                    shelfCode: 'A',
-                    shelfId: '1746702944791293954',
-                    warehouseId: '1746702427377758210',
-                    warehouseName: '型材分公司-备品备件库1号仓'
-                  }
-                ];
+                item.houseList = [{}];
                 return { ...item };
               }
             );
@@ -2445,6 +2433,13 @@
       },
 
       handleSave() {
+        let boolen = this.warehousingMaterialList.every(
+          (item) => item.houseList.length > 0 && item.houseList[0].areaId
+        );
+        if (!boolen) {
+          this.$message.error('请选择产品仓库!');
+          return false;
+        }
         this.$refs.formName.validate(async (valid) => {
           if (valid) {
             if (!this.warehousingMaterialList?.length) {

+ 3 - 0
src/views/warehouseManagement/warehouseDefinition/add.vue

@@ -1602,6 +1602,9 @@
         }
 
         let obj = {};
+        console.log('-------------------------------------------------------');
+        console.log(this.areaForm.allocationReqList);
+        console.log(this.areaForm.areaGoodsshelvesList);
         for (const item of this.areaForm.allocationReqList) {
           const area = this.areaForm.areaGoodsshelvesList.find((itm) => {
             return itm.code === item.goodsShelvesCode;