From 7609c865e80fea169c5c393c55631628aef2f6ed Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 24 九月 2025 17:15:04 +0800
Subject: [PATCH] 核磅录入创建核磅单的创建逻辑修改/重复扫码相同数据添加多条问题修复
---
pages/wareHouse/nuclearScale/createwriteoffform.vue | 80 +++++++++++++++-----------
pages/storeManagement/CancelMaterialRequisition/index.vue | 5 +
pages/wareHouse/nuclearScale/index.vue | 31 +++++++---
pages/storeManagement/MaterialRequisition/index.vue | 34 +++++------
4 files changed, 88 insertions(+), 62 deletions(-)
diff --git a/pages/storeManagement/CancelMaterialRequisition/index.vue b/pages/storeManagement/CancelMaterialRequisition/index.vue
index 5e4e975..3a9717d 100644
--- a/pages/storeManagement/CancelMaterialRequisition/index.vue
+++ b/pages/storeManagement/CancelMaterialRequisition/index.vue
@@ -171,7 +171,10 @@
this.$u.toast("鍙栨秷棰嗘枡鎴愬姛");
})
.catch((err) => {
- this.$u.toast("鍙栨秷棰嗘枡澶辫触");
+ uni.showToast({
+ title: res.msg || "缃戠粶閿欒锛屽彇娑堥鏂欏け璐�",
+ icon: "none",
+ });
});
},
},
diff --git a/pages/storeManagement/MaterialRequisition/index.vue b/pages/storeManagement/MaterialRequisition/index.vue
index ca3d29b..3473d3e 100644
--- a/pages/storeManagement/MaterialRequisition/index.vue
+++ b/pages/storeManagement/MaterialRequisition/index.vue
@@ -74,9 +74,7 @@
<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">
@@ -84,9 +82,7 @@
<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">
@@ -94,9 +90,7 @@
<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>
@@ -127,7 +121,7 @@
whiteSpace: "nowrap",
},
hasScanSnList: [],
- showModal: false, // 鎺у埗寮圭獥鏄剧ず闅愯棌鐨勫彉閲�
+ showModal: false, // 鎺у埗寮圭獥鏄剧ず闅愯棌鐨勫彉閲�
detailedList: {},
};
},
@@ -135,9 +129,8 @@
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");
//鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲�
console.log("椤甸潰鎵爜缁撴灉锛�", data.code);
if (data.code) {
@@ -154,12 +147,12 @@
// 澶勭悊鍙栨秷閫昏緫
this.showModal = false;
},
- // 鍥炴樉鎵爜鐨勪俊鎭�
+ // 鍥炴樉鎵爜鐨勪俊鎭�
saveForm(val) {
- this.detailedList = val;
- this.showModal = true;
- },
- confirm() {
+ this.detailedList = val;
+ this.showModal = true;
+ },
+ confirm() {
// 澶勭悊纭閫昏緫
this.$u.api.materialRequisition
.materialRequisition({
@@ -171,7 +164,10 @@
this.$u.toast("棰嗘枡鎴愬姛");
})
.catch((err) => {
- this.$u.toast("棰嗘枡澶辫触");
+ uni.showToast({
+ title: res.msg || "缃戠粶閿欒锛岄鏂欏け璐�",
+ icon: "none",
+ });
});
},
},
diff --git a/pages/wareHouse/nuclearScale/createwriteoffform.vue b/pages/wareHouse/nuclearScale/createwriteoffform.vue
index 2a2b921..c76cee3 100644
--- a/pages/wareHouse/nuclearScale/createwriteoffform.vue
+++ b/pages/wareHouse/nuclearScale/createwriteoffform.vue
@@ -35,7 +35,7 @@
<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"
@@ -45,7 +45,7 @@
<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"
@@ -289,7 +289,7 @@
show: false,
num: 1,
form: {
- replace: "0",
+ // replace: "0",
productType: "",
licensePlate: "",
customerName1: "",
@@ -308,13 +308,13 @@
trigger: ["change"],
},
],
- replace: [
- {
- required: true,
- message: "璇烽�夋嫨鏄惁鏇挎崲浜岀淮鐮�",
- trigger: ["change", "blur"],
- },
- ],
+ // replace: [
+ // {
+ // required: true,
+ // message: "璇烽�夋嫨鏄惁鏇挎崲浜岀淮鐮�",
+ // trigger: ["change", "blur"],
+ // },
+ // ],
licensePlate: [
{
required: true,
@@ -381,7 +381,7 @@
onShow() {
// 閲嶇疆琛ㄥ崟鏁版嵁
this.form = {
- replace: "0",
+ // replace: "0",
productType: "",
licensePlate: "",
customerName1: "",
@@ -587,12 +587,14 @@
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;
}
},
@@ -661,9 +663,21 @@
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);
@@ -716,28 +730,28 @@
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>
diff --git a/pages/wareHouse/nuclearScale/index.vue b/pages/wareHouse/nuclearScale/index.vue
index b554bd7..61643e5 100644
--- a/pages/wareHouse/nuclearScale/index.vue
+++ b/pages/wareHouse/nuclearScale/index.vue
@@ -170,7 +170,7 @@
<view class="_label-name">鐩橀噸锛�</view>
</view>
<view class="_content">
- {{ item.trayWeight }}
+ {{ item.tareWeight }}
</view>
</view>
<view class="row-list">
@@ -302,11 +302,13 @@
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",
@@ -315,7 +317,7 @@
});
return;
}
-
+
let ScanCodeRecordList = {
outBatchNo: codeInfo.BN,
netWeight: codeInfo.NW,
@@ -335,11 +337,22 @@
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,
+ });
}
},
});
--
Gitblit v1.9.3