已修改4个文件
501 ■■■■ 文件已修改
common/http.api.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/wareHouse/nuclearScale/createwriteoffform.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/wareHouse/nuclearScale/index.vue 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/wareHouse/nuclearScale/nuclearscalerecord.vue 420 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
common/http.api.js
@@ -559,7 +559,8 @@
            getWeighingOrder: (params = {}) => vm.$u.get('/mes/weighingVerification/pageVerificationMain', params),
            // 核磅详情    
            createDetail: (params = {}) => vm.$u.post('/mes/weighingVerification/createDetail', params),
            // 核磅记录
            queryPacking: (params = {}) => vm.$u.get('/mes/weighingVerification/queryPacking', params),
        },
        // 取消领料
        cancelMaterialRequisition: {
pages/wareHouse/nuclearScale/createwriteoffform.vue
@@ -607,7 +607,7 @@
      const productType = this.form.productType;
      const selectedWorkshop = storage[e.target.value];
      console.log('选择的车间:', selectedWorkshop);
      // 检查产品类型是否为铜杆(值为TG01)
      if (productType === "TG01") {
        // 铜杆只能选择铜杆相关车间
@@ -632,7 +632,7 @@
      }
      this.workshopIndex = e.target.value;
      this.form.workshop = selectedWorkshop.label;
      this.form.workshop = selectedWorkshop.value;
    },
    // 司磅员
    weighmanChange(e, storage) {
pages/wareHouse/nuclearScale/index.vue
@@ -330,32 +330,40 @@
          waivDevRejNo: codeInfo.WDR ? codeInfo.WDR : "*", // wdr号
          productType: that.form.productType,
        };
        if (codeInfo.CN != that.form.customerName1) {
          // 扫描报工单二维码
          uni.showModal({
            title: "提示",
            content:
              "客户不一致:" + codeInfo.CN + "||" + that.form.customerName1,
            showCancel: true,
            success: function (res) {
              const isDuplicate = that.ScanCodeRecord.some(
                (item) => item.outBatchNo === codeInfo.BN
              );
              if (!isDuplicate) {
                if (that.form.productType == "TG01") {
                  that.$refs.saveForm.open(ScanCodeRecordList);
        if (codeInfo.CN != "") {
          if (codeInfo.CN != that.form.customerName1) {
            // 扫描报工单二维码
            uni.showModal({
              title: "提示",
              content:
                "客户不一致:" + codeInfo.CN + "||" + that.form.customerName1,
              showCancel: true,
              success: function (res) {
                const isDuplicate = that.ScanCodeRecord.some(
                  (item) => item.outBatchNo === codeInfo.BN
                );
                if (!isDuplicate) {
                  if (that.form.productType == "TG01") {
                    that.$refs.saveForm.open(ScanCodeRecordList);
                  } else {
                    that.ScanCodeRecord.push(ScanCodeRecordList);
                  }
                } else {
                  that.ScanCodeRecord.push(ScanCodeRecordList);
                  uni.showToast({
                    icon: "none",
                    title: "请勿重复扫码!",
                    duration: 2 * 1000,
                  });
                }
              } else {
                uni.showToast({
                  icon: "none",
                  title: "请勿重复扫码!",
                  duration: 2 * 1000,
                });
              }
            },
          });
              },
            });
          } else {
            if (that.form.productType == "TG01") {
              that.$refs.saveForm.open(ScanCodeRecordList);
            } else {
              that.ScanCodeRecord.push(ScanCodeRecordList);
            }
          }
        } else {
          if (that.form.productType == "TG01") {
            that.$refs.saveForm.open(ScanCodeRecordList);
@@ -438,11 +446,12 @@
        })
        .catch((err) => {
          uni.hideLoading();
          uni.showToast({
            title: err.message || "网络异常,请重试",
            icon: "none",
          uni.showModal({
            title: "提示",
            content: err.message || "网络异常,请重试",
            showCancel: true,
            success: function (res) {},
          });
          // this.$u.toast(err.message || "网络异常,请重试");
        });
    },
@@ -495,7 +504,7 @@
    },
    //核磅记录
    openNuclearScaleRecord() {
      if (this.form.verificationNo == "") {
      if (!this.form.verificationNo) {
        uni.showToast({
          icon: "none",
          title: "请先选择核磅单号!",
@@ -503,9 +512,10 @@
        });
        return;
      }
      uni.navigateTo({
        url: "/pages/wareHouse/nuclearScale/nuclearscalerecord",
      });
       uni.navigateTo({
         url: "/pages/wareHouse/nuclearScale/nuclearscalerecord?verificationNo=" +
                        encodeURIComponent(JSON.stringify(this.form.verificationNo)),
       });
    },
    // 存订单号
    setNo(val) {
pages/wareHouse/nuclearScale/nuclearscalerecord.vue
@@ -54,7 +54,7 @@
                  <view class="_label-name">批次号:</view>
                </view>
                <view class="_content">
                  {{ item.outBatchNo }}
                  {{ item.batchNo }}
                </view>
              </view>
              <view class="row-list">
@@ -63,7 +63,7 @@
                  <view class="_label-name">产品描述:</view>
                </view>
                <view class="_content">
                  {{ item.netWeight }}
                  {{ item.partDescription }}
                </view>
              </view>
              <view class="row-list">
@@ -81,7 +81,7 @@
                  <view class="_label-name">毛重:</view>
                </view>
                <view class="_content">
                  {{ item.grossWeight }}
                  {{ item.newGrossWeight }}
                </view>
              </view>
              <view class="row-list">
@@ -90,7 +90,7 @@
                  <view class="_label-name">盘重:</view>
                </view>
                <view class="_content">
                  {{ item.trayWeight }}
                  {{ item.newWeight }}
                </view>
              </view>
              <view class="row-list">
@@ -99,7 +99,7 @@
                  <view class="_label-name">净重:</view>
                </view>
                <view class="_content">
                  {{ item.value5 }}
                  {{ item.newNetWeight }}
                </view>
              </view>
              <view class="row-list">
@@ -108,7 +108,7 @@
                  <view class="_label-name">核磅重量:</view>
                </view>
                <view class="_content">
                  {{ item.netWeight }}
                  {{ item.verificationWeight }}
                </view>
              </view>
              <view class="row-list">
@@ -117,7 +117,7 @@
                  <view class="_label-name">叉车盘重:</view>
                </view>
                <view class="_content">
                  {{ item.value7 }}
                  {{ item.forkliftWeight }}
                </view>
              </view>
            </view>
@@ -224,23 +224,34 @@
      connectionStatus: "disconnected", // 连接状态: disconnected, connecting, connected
      printStatus: "idle", // 打印状态: idle, printing, error
      errorMessage: "", // 错误信息
      verificationNo: "",
      failedPrintJobs: [],
    };
  },
  onLoad() {
  onLoad(options) {
    this.verificationNo = JSON.parse(
      decodeURIComponent(options.verificationNo)
    );
    this.getlist();
    // 初始化SDK
    jcapi.initSDK();
    // 尝试恢复之前的蓝牙连接状态
    this.restoreBluetoothConnection();
    // 监听页码回调
    jcapi.didReadPrintCountInfo(function (r) {
      console.log(r);
      console.log("页码", r);
    });
    // 监听错误回调
    jcapi.didReadPrintErrorInfo((r) => {
      console.log(r);
      console.log("错误", r);
      if (r.code == 23) {
        // 打印机断开连接
        this.connectedDevice = null;
        // 清除本地存储的连接信息
        uni.removeStorageSync("bluetoothConnection");
        uni.showToast({
          icon: "none",
          title: "打印机连接已断开,请重新连接",
@@ -256,6 +267,40 @@
    });
  },
  methods: {
    restoreBluetoothConnection() {
      try {
        // 从本地存储获取之前保存的连接信息
        const savedConnection = uni.getStorageSync("bluetoothConnection");
        if (savedConnection && savedConnection.address) {
          console.log("尝试恢复蓝牙连接:", savedConnection);
          // 设置为连接中状态
          this.connectionStatus = "connecting";
          // 尝试重新连接
          jcapi.openPrinterByDevice(
            {
              address: savedConnection.address,
              name: savedConnection.name,
              deviceType: 0, // 设备类型:0-蓝牙,1-网络
            },
            (r) => {
              if (r.code == 0) {
                this.connectedDevice = savedConnection;
                this.connectionStatus = "connected";
                console.log("蓝牙连接已恢复");
              } else {
                this.connectionStatus = "disconnected";
                // 如果重连失败,清除保存的连接信息
                uni.removeStorageSync("bluetoothConnection");
                console.log("蓝牙重连失败:", r);
              }
            }
          );
        }
      } catch (e) {
        console.error("恢复蓝牙连接失败:", e);
      }
    },
    getmoreList() {
      if (this.pageSize >= this.total) {
        this.status = "nomore";
@@ -268,12 +313,29 @@
      }, 1000);
    },
    getlist() {
      this.$u.api.workReporting
        .getWorkshopOrder({
      this.$u.api.NuclearScaleEntry.queryPacking({
        current: this.pageNum,
        size: this.pageSize,
        verificationNo: this.verificationNo,
      }).then((res) => {
        this.list = res.data;
        this.total = res.data.length;
        if (this.pageSize >= this.total) {
          this.status = "nomore";
        } else {
          this.status = "loadmore";
        }
      });
    },
    search(value) {
      if (value) {
        this.list = [];
        this.pageSize = 10;
        this.$u.api.NuclearScaleEntry.queryPacking({
          current: this.pageNum,
          size: this.pageSize,
        })
        .then((res) => {
          moNo: value,
        }).then((res) => {
          this.list = res.data.records;
          this.total = res.data.total;
          if (this.pageSize >= this.total) {
@@ -282,26 +344,6 @@
            this.status = "loadmore";
          }
        });
    },
    search(value) {
      if (value) {
        this.list = [];
        this.pageSize = 10;
        this.$u.api.workReporting
          .getWorkshopOrder({
            current: this.pageNum,
            size: this.pageSize,
            moNo: value,
          })
          .then((res) => {
            this.list = res.data.records;
            this.total = res.data.total;
            if (this.pageSize >= this.total) {
              this.status = "nomore";
            } else {
              this.status = "loadmore";
            }
          });
      } else {
        this.getlist();
      }
@@ -435,14 +477,14 @@
    moveHandle() {},
    maskclose() {},
    //打印二维码
    async printQrCode(item) {
    printQrCode(item) {
      return new Promise(async (resolve, reject) => {
        const params = {
            rwMatlBindId: item.id
        };
        // const params = {
        //     rwMatlBindId: item.id
        // };
        try {
          let res = await this.$u.api.dailyPaper.zongjianLabelInfo(params)
          if (!res.data) {
          // let res = await this.$u.api.dailyPaper.zongjianLabelInfo(params)
          if (!item) {
            this.$refs.uToast.show({
              title: "未查询到该标签信息!",
              type: "warning ",
@@ -451,8 +493,14 @@
            return;
          }
          // 从API响应中提取所需数据
          const { ht, lj, ljms, fh, scdt, scph, fhdw, shdw } = res.data;
          const ht = item.contractNo;
          const lj = item.partNo;
          const ljms = item.ccontrProModel;
          const fh = item.newNetWeight;
          const scdt = item.outboundDate;
          const scph = item.batchNo;
          const shdw = item.customerName;
          const fhdw = "江东合金技术有限公司";
          // 初始化画板
          jcapi.initDrawingBoard({
@@ -462,7 +510,17 @@
          });
          // 绘制二维码
          const qrContent = `ht:${ht}\nlj:${lj}\nljms:${ljms}\nfh:${fh}\nscdt:${scdt}\nscph:${scph}\nfhdw:${fhdw}\nshdw:${shdw}`;
          const qrContent = {
            company: item.customerNo,
            line_no: item.lineNo,
            lot_batch_no: item.batchNo,
            order_no: item.contractNo,
            part_no: item.partNo,
            total_qty: item.newNetWeight,
            qty_arrived: item.newNetWeight,
            release_no: item.relNo,
          };
          jcapi.drawLabelQrCode({
            x: 43.5,
            y: 2,
@@ -491,26 +549,263 @@
          this.getDrawLabelLine(68, 1, 0.5, 46, 0, LineType.Solid); // 竖线3
          // 绘制文本
          this.getDrawLabelText(3,2.5,40,8,"中天科技装箱清单",2.5,0,LineModeType.AutoHeight,0,0,1,1,1);
          this.getDrawLabelText(2,7,25,8,"合同号:",2.5,0,LineModeType.AutoHeight,0,0,0,1,1);
          this.getDrawLabelText(2,12,25,8,"零件号:",2.5,0,LineModeType.AutoHeight,0,0,0,1,1);
          this.getDrawLabelText(2,17,25,8,"零件描述:",2.5,0,LineModeType.AutoHeight,0,0,0,1,1);
          this.getDrawLabelText(2,22.5,25,8,"发货/装箱数:",2.5,0,LineModeType.AutoHeight,0,0,0,1,1);
          this.getDrawLabelText(2,27.5,25,8,"生产日期:",2.5,0,LineModeType.AutoHeight,0,0,0,1,1);
          this.getDrawLabelText(2,32.5,25,8,"生产批号:",2.5,0,LineModeType.AutoHeight,0,0,0,1,1);
          this.getDrawLabelText(2,37.5,25,8,"发货单位:",2.5,0,LineModeType.AutoHeight,0,0,0,1,1);
          this.getDrawLabelText(2,42.5,25,8,"收货单位:",2.5,0,LineModeType.AutoHeight,0,0,0,1,1);
          this.getDrawLabelText(
            3,
            2.5,
            40,
            8,
            "中天科技装箱清单",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            1,
            1,
            1
          );
          this.getDrawLabelText(
            2,
            7,
            25,
            8,
            "合同号:",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            1,
            1
          );
          this.getDrawLabelText(
            2,
            12,
            25,
            8,
            "零件号:",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            1,
            1
          );
          this.getDrawLabelText(
            2,
            17,
            25,
            8,
            "零件描述:",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            1,
            1
          );
          this.getDrawLabelText(
            2,
            22.5,
            25,
            8,
            "发货/装箱数:",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            1,
            1
          );
          this.getDrawLabelText(
            2,
            27.5,
            25,
            8,
            "生产日期:",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            1,
            1
          );
          this.getDrawLabelText(
            2,
            32.5,
            25,
            8,
            "生产批号:",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            1,
            1
          );
          this.getDrawLabelText(
            2,
            37.5,
            25,
            8,
            "发货单位:",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            1,
            1
          );
          this.getDrawLabelText(
            2,
            42.5,
            25,
            8,
            "收货单位:",
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            1,
            1
          );
          // 填充参数值
          this.getDrawLabelText(11,7,30,8,ht,2.5,0,LineModeType.AutoHeight,0,0,0,0,1);
          this.getDrawLabelText(11,12,32,8,lj,2.5,0,LineModeType.AutoHeight,0,0,0,0,1);
          this.getDrawLabelText(14,17,30,8,ljms,2.5,0,LineModeType.AutoHeight,0,0,0,0,1);
          this.getDrawLabelText(17,22.5,27,8,fh,2.5,0,LineModeType.AutoHeight,0,0,0,0,1);
          this.getDrawLabelText(14,27.5,55,8,scdt,2.5,0,LineModeType.AutoHeight,0,0,0,0,1);
          this.getDrawLabelText(14,32.7,55,8,scph,2.5,0,LineModeType.AutoHeight,0,0,0,0,1);
          this.getDrawLabelText(14,37.5,55,8,fhdw,2.5,0,LineModeType.AutoHeight,0,0,0,0,1);
          this.getDrawLabelText(14,42.5,55,8,shdw,2.5,0,LineModeType.AutoHeight,0,0,0,0,1);
          this.getDrawLabelText(
            11,
            7,
            30,
            8,
            ht,
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            0,
            1
          );
          this.getDrawLabelText(
            11,
            12,
            32,
            8,
            lj,
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            0,
            1
          );
          this.getDrawLabelText(
            14,
            17,
            30,
            8,
            ljms,
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            0,
            1
          );
          this.getDrawLabelText(
            17,
            22.5,
            27,
            8,
            fh,
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            0,
            1
          );
          this.getDrawLabelText(
            14,
            27.5,
            55,
            8,
            scdt,
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            0,
            1
          );
          this.getDrawLabelText(
            14,
            32.7,
            55,
            8,
            scph,
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            0,
            1
          );
          this.getDrawLabelText(
            14,
            37.5,
            55,
            8,
            fhdw,
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            0,
            1
          );
          this.getDrawLabelText(
            14,
            42.5,
            55,
            8,
            shdw,
            2.5,
            0,
            LineModeType.AutoHeight,
            0,
            0,
            0,
            0,
            1
          );
          // 生成打印数据
          let imageJsonObj = jcapi.generateLabelJson();
@@ -587,9 +882,12 @@
          deviceType: 0, // 设备类型:0-蓝牙,1-网络
        },
        function (r) {
          // 在tapQuery方法中,连接成功时添加保存连接信息的代码
          if (r.code == 0) {
            _this.connectedDevice = item;
            _this.connectionStatus = "connected";
            // 保存连接信息到本地存储
            uni.setStorageSync("bluetoothConnection", item);
            uni.showToast({
              title: "连接成功",
              duration: 1500,