From 65e595c85e7ff31252c651f05949b711209f45ec Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期一, 22 十二月 2025 09:49:31 +0800
Subject: [PATCH] 称重逻辑调整
---
H5/Js/Cpbdsj.js | 251 ++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 221 insertions(+), 30 deletions(-)
diff --git a/H5/Js/Cpbdsj.js b/H5/Js/Cpbdsj.js
index 7763b71..12758c9 100644
--- a/H5/Js/Cpbdsj.js
+++ b/H5/Js/Cpbdsj.js
@@ -28,6 +28,7 @@
//}
],
DAA001: [],
+ DAA015: "",
show: false,//鍒楄〃灞曠ず
actions: [],//鍒楄〃鐨勫��
xtName: "",//绾夸綋鍚嶇О
@@ -48,6 +49,10 @@
methods: {
handleAgvPositions(positionStr) {
if (!positionStr) return [];
+
+ // 妫�鏌ユ槸鍚﹀瓨鍦ㄩ�楀彿锛屽鏋滀笉瀛樺湪鍒欒繑鍥炵┖鏁扮粍
+ if (!positionStr.includes(',')) return [];
+
// 灏嗗瓧绗︿覆鎸夐�楀彿鍒嗗壊骞惰浆鎹负閫夐」鏁扮粍
return positionStr.split(',').map(pos => ({
name: pos.trim() // 鍘婚櫎鍙兘鐨勭┖鏍�
@@ -67,17 +72,38 @@
console.log(json.data.tbBillList.kbBarInfo[0].agvPostion);
that.KbBarInfo = json.data.tbBillList.kbBarInfo[0];
that.DAA001 = that.KbBarInfo.daA001;
+ that.DAA015 = that.KbBarInfo.daA015;
+ console.log(that.KbBarInfo)
that.KbBarMxInfo = json.data.tbBillList.kbBarMxInfo;
that.$refs.XBar.focus();
that.XbarInfo = [];
that.XBar = "";
- that.AgvDw = json.data.tbBillList.kbBarInfo[0].agvPostion.split(',')[0];
-
- that.actionsAgvDw = that.handleAgvPositions(json.data.tbBillList.kbBarInfo[0].agvPostion);
+
+ // 妫�鏌ユ槸鍚﹀瓨鍦ㄩ�楀彿
+ //const agvPosition = json.data.tbBillList.kbBarInfo[0].agvPostion;
+ //that.AgvDw = agvPosition.includes(',') ? agvPosition.split(',')[0] : '';
+ const agvPostion = json.data && json.data.tbBillList && json.data.tbBillList.kbBarInfo &&
+ json.data.tbBillList.kbBarInfo[0] && json.data.tbBillList.kbBarInfo[0].agvPostion;
+
+ if (agvPostion != null) {
+ const agvPostionStr = String(agvPostion);
+ that.AgvDw = agvPostionStr.split(',')[0];
+ that.actionsAgvDw = that.handleAgvPositions(agvPostionStr);
+ } else {
+ that.AgvDw = null;
+ that.actionsAgvDw = null;
+ }
+
}
else {
that.$playSound('error');
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$refs.KbBar.focus();
that.KbBar = "";
}
@@ -86,7 +112,13 @@
.catch(function (error) {
that.isLoading = false;
that.$playSound('error');
- that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ //that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "缃戠粶閿欒锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$refs.KbBar.focus();
that.KbBar = "";
});
@@ -112,7 +144,13 @@
// 妫�鏌ユ槸鍚﹁秴杩囪绠辨暟
if (that.XbarInfo.length >= that.Xvalue) {
that.$playSound('error');
- that.$toast.fail(`宸茶揪鍒拌绠辨暟闄愬埗(${that.Xvalue})`);
+ //that.$toast.fail(`宸茶揪鍒拌绠辨暟闄愬埗(${that.Xvalue})`);
+ that.$dialog.alert({
+ message: `宸茶揪鍒拌绠辨暟闄愬埗(${that.Xvalue})`,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.XBar = "";
return;
}
@@ -122,7 +160,13 @@
// 妫�鏌ユ槸鍚﹁秴杩囪绠辨暟
if (that.Xvalue > Dvalue) {
that.$playSound('error');
- that.$toast.fail(`瑁呯鏁�(${that.Xvalue}) 涓嶈兘澶т簬 鍗℃澘寰呰鏁�(${Dvalue})`);
+ //that.$toast.fail(`瑁呯鏁�(${that.Xvalue}) 涓嶈兘澶т簬 鍗℃澘寰呰鏁�(${Dvalue})`);
+ that.$dialog.alert({
+ message: `瑁呯鏁�(${that.Xvalue}) 涓嶈兘澶т簬 鍗℃澘寰呰鏁�(${Dvalue})`,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.XBar = "";
return;
}
@@ -131,7 +175,13 @@
const isExist = that.XbarInfo.some(item => item.iteM_BARCODE === that.XBar);
if (isExist) {
that.$playSound('error');
- that.$toast.fail("璇ョ鏉$爜宸插瓨鍦紝璇峰嬁閲嶅鎵弿");
+ //that.$toast.fail("璇ョ鏉$爜宸插瓨鍦紝璇峰嬁閲嶅鎵弿");
+ that.$dialog.alert({
+ message: "璇ョ鏉$爜宸插瓨鍦紝璇峰嬁閲嶅鎵弿",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.XBar = "";
return;
}
@@ -155,12 +205,17 @@
if (that.XbarInfo.length >= that.Xvalue) {
that.$refs.LsBar.focus();
}
-
}
else {
that.$playSound('error');
that.XBar = "";
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
}
that.isLoading = false;
})
@@ -168,7 +223,13 @@
that.isLoading = false;
that.XBar = "";
that.$playSound('error');
- that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ //that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "缃戠粶閿欒锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
});
},
productBinding() {
@@ -207,7 +268,13 @@
}
else {
that.$playSound('error');
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$refs.ZsBar.focus();
that.ZsBar = null;
that.ZsBar = null;
@@ -218,7 +285,13 @@
.catch(function (error) {
that.isLoading = false;
that.$playSound('error');
- that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ //that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "缃戠粶閿欒锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$refs.ZsBar.focus();
that.ZsBar = null;
that.ZsBar = null;
@@ -242,6 +315,21 @@
if (matchedItem.is_hedui === "1") {
that.$toast("宸叉牳瀵�");
} else {
+ console.log(that.DAA015);
+ if ((that.DAA015) === "462") {
+ that.$set(matchedItem, 'is_hedui', "1");
+ // 鍙牴鎹渶瑕佽缃� weight锛岃繖閲屼繚鎸佷负绌�/涓嶅彉
+ that.$playSound('success');
+ that.$notify({ type: 'success', message: "鏍稿鎴愬姛" });
+ that.LsBar = "";
+ // 妫�鏌ユ槸鍚︽墍鏈夎閮藉凡鏍稿
+ const allChecked = that.XbarInfo.every(item => item.is_hedui === "1");
+ if (allChecked && that.XbarInfo.length > 0 && that.XbarInfo.length === that.Xvalue) {
+ that.submitAllChecked();
+ }
+ // 鐩存帴杩斿洖锛屼笉璋冪敤 GetWeightByXt
+ return;
+ }
that.AxiosHttp("post", 'Womdaa/GetWeightByXt', {
LsBar: that.LsBar,
@@ -264,19 +352,37 @@
}
else {
that.$playSound('error');
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
}
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
that.$playSound('error');
- that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ //that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "缃戠粶閿欒锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
});
}
} else {
that.$playSound('error');
- that.$toast.fail("鏈壘鍒板尮閰嶇殑绠辨潯鐮�");
+ //that.$toast.fail("鏈壘鍒板尮閰嶇殑绠辨潯鐮�");
+ that.$dialog.alert({
+ message: "鏈壘鍒板尮閰嶇殑绠辨潯鐮�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
}
that.LsBar = ""; // 娓呯┖杈撳叆妗�
@@ -314,7 +420,13 @@
that.getKbBarInfo();
} else {
that.$playSound('error');
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.XbarInfo = [];
that.XBar = "";
that.LsBar = "";
@@ -325,7 +437,13 @@
.catch(function (error) {
that.isLoading = false;
that.$playSound('error');
- that.$toast.fail("缁戝畾澶辫触锛岃閲嶈瘯锛�");
+ //that.$toast.fail("缁戝畾澶辫触锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "缃戠粶閿欒锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
});
},
handleSubmit() {
@@ -347,7 +465,13 @@
if (oldqty !== ySum) {
that.$playSound('error');
- that.$toast.fail(`瑁呮澘鏈畬鎴愶紝寰呰鏁帮細${oldqty - ySum}`);
+ //that.$toast.fail(`瑁呮澘鏈畬鎴愶紝寰呰鏁帮細${oldqty - ySum}`);
+ that.$dialog.alert({
+ message: `瑁呮澘鏈畬鎴愶紝寰呰鏁帮細${oldqty - ySum}`,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
return;
}
@@ -368,14 +492,26 @@
that.$refs.KbBar.focus();
} else {
that.$playSound('error');
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
}
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
that.$playSound('error');
- that.$toast.fail("鎻愪氦澶辫触锛岃閲嶈瘯锛�");
+ //that.$toast.fail("鎻愪氦澶辫触锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "缃戠粶閿欒锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$refs.KbBar.focus();
});
},
@@ -384,6 +520,11 @@
this.xtNum = action.lineNo; // 缁戝畾line_no鍒皒tNum瀛楁
console.log("閫夋嫨鐨勭嚎浣撶紪鍙凤細", this.xtNum);
this.xtName = action.name; // 缁戝畾name鍒皒tName瀛楁
+ if (action.agvPostion != null) {
+ const agvPostionStr = String(action.agvPostion);
+ this.AgvDw = agvPostionStr.split(',')[0];
+ this.actionsAgvDw = this.handleAgvPositions(agvPostionStr);
+ }
this.show = false;
},
@@ -417,20 +558,33 @@
that.actions = json.data.tbBillList.map(item => {
return {
name: item.name,
- lineNo: item.line_no // 鏂板
+ lineNo: item.line_no, // 鏂板
+ agvPostion: item.agvPostion
};
});
}
}
else {
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$playSound('error');
}
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
- that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ //that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "缃戠粶閿欒锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$playSound('error');
console.log(error);
});
@@ -460,6 +614,12 @@
that.$toast.fail("璇峰厛鎵弿鍗℃澘鏉$爜");
return;
}
+
+ if (!that.AgvDw) {
+ that.$playSound('error');
+ that.$toast.fail("璇峰厛閫夋嫨AGV鐐逛綅");
+ return;
+ }
// 璁$畻鍙鏁板拰宸茶鏁�
const oldqty = +(that.KbBarInfo.quantity || 0);
@@ -467,7 +627,13 @@
if (oldqty !== ySum) {
that.$playSound('error');
- that.$toast.fail(`瑁呮澘鏈畬鎴愶紝寰呰鏁帮細${oldqty - ySum}`);
+ //that.$toast.fail(`瑁呮澘鏈畬鎴愶紝寰呰鏁帮細${oldqty - ySum}`);
+ that.$dialog.alert({
+ message: `瑁呮澘鏈畬鎴愶紝寰呰鏁帮細${oldqty - ySum}`,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
return;
}
@@ -484,14 +650,26 @@
that.$notify({ type: 'success', message: json.message });
} else {
that.$playSound('error');
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
}
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
that.$playSound('error');
- that.$toast.fail("AGV閫佹澶辫触锛岃閲嶈瘯锛�");
+ //that.$toast.fail("AGV閫佹澶辫触锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "AGV閫佹澶辫触锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$refs.KbBar.focus();
});
},
@@ -515,7 +693,8 @@
that.isLoading = true;
that.AxiosHttp("post", 'Womdaa/handleAGVCall', {
XtNum: that.xtNum,
- userAccount: that.userInfo.loginAccount
+ userAccount: that.userInfo.loginAccount,
+ AgvDw: that.AgvDw
}, false)
.then(function (res) {
var json = res;
@@ -524,14 +703,26 @@
that.$notify({ type: 'success', message: json.message });
} else {
that.$playSound('error');
- that.$toast.fail(json.message);
+ //that.$toast.fail(json.message);
+ that.$dialog.alert({
+ message: json.message,
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
}
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
that.$playSound('error');
- that.$toast.fail("AGV鍛煎彨澶辫触锛岃閲嶈瘯锛�");
+ //that.$toast.fail("AGV鍛煎彨澶辫触锛岃閲嶈瘯锛�");
+ that.$dialog.alert({
+ message: "AGV鍛煎彨澶辫触锛岃閲嶈瘯锛�",
+ theme: 'round-button',
+ }).then(() => {
+ // on close
+ });
that.$refs.KbBar.focus();
});
}
--
Gitblit v1.9.3