核磅录入创建核磅单的创建逻辑修改/重复扫码相同数据添加多条问题修复
| | |
| | | this.$u.toast("取消领料成功"); |
| | | }) |
| | | .catch((err) => { |
| | | this.$u.toast("取消领料失败"); |
| | | uni.showToast({ |
| | | title: res.msg || "网络错误,取消领料失败", |
| | | icon: "none", |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | |
| | | <text class="item-one">批次号:</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <text class="item-one item-two">{{ |
| | | detailedList.BN |
| | | }}</text> |
| | | <text class="item-one item-two">{{ detailedList.BN }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | |
| | | <text class="item-one">品牌:</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <text class="item-one item-two">{{ |
| | | detailedList.BR |
| | | }}</text> |
| | | <text class="item-one item-two">{{ detailedList.BR }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="packing-registration-param-item param-extra"> |
| | |
| | | <text class="item-one">净重:</text> |
| | | </view> |
| | | <view class="packing-registration-param-item-right"> |
| | | <text class="item-one item-two">{{ |
| | | detailedList.KW |
| | | }}</text> |
| | | <text class="item-one item-two">{{ detailedList.KW }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | whiteSpace: "nowrap", |
| | | }, |
| | | hasScanSnList: [], |
| | | showModal: false, // 控制弹窗显示隐藏的变量 |
| | | showModal: false, // 控制弹窗显示隐藏的变量 |
| | | detailedList: {}, |
| | | }; |
| | | }, |
| | |
| | | onShow() { |
| | | let that = this; |
| | | uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器 |
| | | uni.$on("scan", function (data) { |
| | | this.detailedList = {}, |
| | | console.log("onscan"); |
| | | uni.$on("scan", function (data) { |
| | | (this.detailedList = {}), console.log("onscan"); |
| | | //扫码成功后的回调,你可以写自己的逻辑代码在这里 |
| | | console.log("页面扫码结果:", data.code); |
| | | if (data.code) { |
| | |
| | | // 处理取消逻辑 |
| | | this.showModal = false; |
| | | }, |
| | | // 回显扫码的信息 |
| | | // 回显扫码的信息 |
| | | saveForm(val) { |
| | | this.detailedList = val; |
| | | this.showModal = true; |
| | | }, |
| | | confirm() { |
| | | this.detailedList = val; |
| | | this.showModal = true; |
| | | }, |
| | | confirm() { |
| | | // 处理确认逻辑 |
| | | this.$u.api.materialRequisition |
| | | .materialRequisition({ |
| | |
| | | this.$u.toast("领料成功"); |
| | | }) |
| | | .catch((err) => { |
| | | this.$u.toast("领料失败"); |
| | | uni.showToast({ |
| | | title: res.msg || "网络错误,领料失败", |
| | | icon: "none", |
| | | }); |
| | | }); |
| | | }, |
| | | }, |
| | |
| | | <u-radio name="DT02">导体2.6</u-radio> |
| | | </u-radio-group> |
| | | </u-form-item> |
| | | <u-form-item |
| | | <!-- <u-form-item |
| | | label="替换二维码:" |
| | | :border-bottom="false" |
| | | prop="replace" |
| | |
| | | <u-radio name="1">是</u-radio> |
| | | <u-radio name="0">否</u-radio> |
| | | </u-radio-group> |
| | | </u-form-item> |
| | | </u-form-item> --> |
| | | <u-form-item |
| | | label="车牌号:" |
| | | :border-bottom="false" |
| | |
| | | show: false, |
| | | num: 1, |
| | | form: { |
| | | replace: "0", |
| | | // replace: "0", |
| | | productType: "", |
| | | licensePlate: "", |
| | | customerName1: "", |
| | |
| | | trigger: ["change"], |
| | | }, |
| | | ], |
| | | replace: [ |
| | | { |
| | | required: true, |
| | | message: "请选择是否替换二维码", |
| | | trigger: ["change", "blur"], |
| | | }, |
| | | ], |
| | | // replace: [ |
| | | // { |
| | | // required: true, |
| | | // message: "请选择是否替换二维码", |
| | | // trigger: ["change", "blur"], |
| | | // }, |
| | | // ], |
| | | licensePlate: [ |
| | | { |
| | | required: true, |
| | |
| | | onShow() { |
| | | // 重置表单数据 |
| | | this.form = { |
| | | replace: "0", |
| | | // replace: "0", |
| | | productType: "", |
| | | licensePlate: "", |
| | | customerName1: "", |
| | |
| | | this.selClientIndex2 = selectedIndex; |
| | | this.form.customerName2 = selectedCustomer.label; |
| | | this.form.shippingNoticeNo2 = selectedCustomer.shippingNoticeNo; |
| | | this.form.customerNo2 = selectedCustomer.customerNo; |
| | | this.id2 = selectedCustomer.id; |
| | | } |
| | | if (code === "customerName1") { |
| | | this.selClientIndex1 = selectedIndex; |
| | | this.form.customerName1 = selectedCustomer.label; |
| | | this.form.shippingNoticeNo1 = selectedCustomer.shippingNoticeNo; |
| | | this.form.customerNo1 = selectedCustomer.customerNo; |
| | | this.id1 = selectedCustomer.id; |
| | | } |
| | | }, |
| | |
| | | try { |
| | | // 统一表单验证 |
| | | if (!(await this.validateForm())) return; |
| | | // 移除冗余的验证代码 |
| | | // 构建提交数据 |
| | | const submitData = this.buildSubmitData().customerList; |
| | | // const submitData = this.buildSubmitData().customerList; |
| | | const submitData = { |
| | | customerName1: this.form.customerName1, |
| | | shippingNoticeNo1: this.form.shippingNoticeNo1, |
| | | customerName2: this.form.customerName2, |
| | | shippingNoticeNo2: this.form.shippingNoticeNo2, |
| | | customerNo1: this.form.customerNo1, |
| | | customerNo2: this.form.customerNo2, |
| | | productType: this.form.productType, |
| | | licensePlate: this.form.licensePlate, |
| | | workshop: this.form.workshop, |
| | | weighingOperator: this.form.weighingOperator, |
| | | forkliftOperator: this.form.forkliftOperator, |
| | | } |
| | | console.log("提交的数据", submitData); |
| | | this.isSubmitting = true; |
| | | const res = await this.$u.api.NuclearScaleEntry.createMain(submitData); |
| | |
| | | return true; |
| | | }, |
| | | |
| | | // 构建提交数据 |
| | | buildSubmitData() { |
| | | // 创建客户数据的辅助函数 |
| | | const createCustomerItem = (customerIndex) => ({ |
| | | customerName: this.form[`customerName${customerIndex}`], |
| | | shippingNoticeNo: this.form[`shippingNoticeNo${customerIndex}`], |
| | | shippingNoticeId: this[`id${customerIndex}`], |
| | | replace: this.form.replace, |
| | | productType: this.form.productType, |
| | | licensePlate: this.form.licensePlate, |
| | | workshop: this.form.workshop, |
| | | weighingOperator: this.form.weighingOperator, |
| | | forkliftOperator: this.form.forkliftOperator, |
| | | }); |
| | | // // 构建提交数据 |
| | | // buildSubmitData() { |
| | | // // 创建客户数据的辅助函数 |
| | | // const createCustomerItem = (customerIndex) => ({ |
| | | // customerName: this.form[`customerName${customerIndex}`], |
| | | // shippingNoticeNo: this.form[`shippingNoticeNo${customerIndex}`], |
| | | // shippingNoticeId: this[`id${customerIndex}`], |
| | | // replace: this.form.replace, |
| | | // productType: this.form.productType, |
| | | // licensePlate: this.form.licensePlate, |
| | | // workshop: this.form.workshop, |
| | | // weighingOperator: this.form.weighingOperator, |
| | | // forkliftOperator: this.form.forkliftOperator, |
| | | // }); |
| | | |
| | | // 构建客户列表 |
| | | const customerList = [1, 2].map(createCustomerItem); |
| | | // // 构建客户列表 |
| | | // const customerList = [1, 2].map(createCustomerItem); |
| | | |
| | | return { |
| | | customerList, |
| | | }; |
| | | }, |
| | | // return { |
| | | // customerList, |
| | | // }; |
| | | // }, |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | <view class="_label-name">盘重:</view> |
| | | </view> |
| | | <view class="_content"> |
| | | {{ item.trayWeight }} |
| | | {{ item.tareWeight }} |
| | | </view> |
| | | </view> |
| | | <view class="row-list"> |
| | |
| | | console.log("页面扫码结果:", data.code); |
| | | if (data.code) { |
| | | let codeInfo = JSON.parse(data.code); |
| | | |
| | | |
| | | // 添加重复扫码检查 |
| | | const batchNo = codeInfo.BN; |
| | | const isDuplicate = that.ScanCodeRecord.some(item => item.outBatchNo === batchNo); |
| | | |
| | | const isDuplicate = that.ScanCodeRecord.some( |
| | | (item) => item.outBatchNo === batchNo |
| | | ); |
| | | |
| | | if (isDuplicate) { |
| | | uni.showToast({ |
| | | icon: "none", |
| | |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | |
| | | let ScanCodeRecordList = { |
| | | outBatchNo: codeInfo.BN, |
| | | netWeight: codeInfo.NW, |
| | |
| | | content: |
| | | "客户不一致:" + codeInfo.CN + "||" + that.form.customerName1, |
| | | showCancel: true, |
| | | success: function () { |
| | | if (that.form.productType == "TG01") { |
| | | that.$refs.saveForm.open(ScanCodeRecordList); |
| | | 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, |
| | | }); |
| | | } |
| | | }, |
| | | }); |