From a87c52ba861983052139295de5f78e00ae174051 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 12 一月 2026 16:51:22 +0800
Subject: [PATCH] 拉丝出库调整
---
src/pages/outbound/materialOutbound.vue | 144 +++++++++++++++++++++++++++++++++---------------
1 files changed, 99 insertions(+), 45 deletions(-)
diff --git a/src/pages/outbound/materialOutbound.vue b/src/pages/outbound/materialOutbound.vue
index 5404ec1..bee43d1 100644
--- a/src/pages/outbound/materialOutbound.vue
+++ b/src/pages/outbound/materialOutbound.vue
@@ -152,57 +152,110 @@
return;
}
- // 瑙f瀽鎵爜鏁版嵁锛岀幇鍦ㄤ簩缁寸爜鍙寘鍚玦d
- let scanData;
- try {
- scanData = JSON.parse(scanCode);
- } catch (e) {
- toast.error("浜岀淮鐮佹牸寮忛敊璇�");
- return;
+ // 鍘绘帀棣栧熬绌烘牸
+ const scanText = String(scanCode).trim();
+
+ // 鍒ゆ柇鏄惁涓� JSON 鏍煎紡锛堢粸绾跨瓑鍘熸湁浜岀淮鐮侊級
+ const isJsonCode = scanText.startsWith("{") || scanText.startsWith("[");
+
+ let tagData: any = null;
+ let outPutId: string | number | undefined;
+ let monofilamentNumber: string | undefined;
+ let needContractCheck = false; // 鏄惁闇�瑕佽繘琛屽悎鍚屽彿鏍¢獙锛堝彧瀵圭粸绾匡級
+
+ if (isJsonCode) {
+ // ===== 缁炵嚎绛夊師鏈変簩缁寸爜閫昏緫锛圝SON锛� =====
+ let scanData;
+ try {
+ scanData = JSON.parse(scanText);
+ } catch (e) {
+ toast.error("浜岀淮鐮佹牸寮忛敊璇�");
+ return;
+ }
+
+ outPutId = scanData.id;
+
+ if (!outPutId) {
+ toast.error("浜岀淮鐮佹牸寮忛敊璇紝缂哄皯id淇℃伅");
+ return;
+ }
+
+ // 妫�鏌ユ槸鍚﹀凡瀛樺湪锛堟牴鎹� id 鍒ゆ柇锛�
+ const exists = goodsList.value.some((item) => {
+ const itemId = item.id;
+ return itemId && itemId === outPutId && itemId !== "-";
+ });
+
+ if (exists) {
+ toast.error("璇ユ潯鐮佸凡瀛樺湪锛岃鍕块噸澶嶆壂鐮�");
+ return;
+ }
+
+ // 璋冪敤鎺ュ彛鑾峰彇缁炵嚎/鎷変笣璇︾粏淇℃伅锛堝惈鍑哄簱鐘舵�侊級
+ const { data } = await OutboundApi.getTagByIdAll({
+ outPutId: outPutId,
+ });
+
+ const list = data || [];
+ if (!list.length) {
+ toast.error("鏈煡璇㈠埌鏉$爜淇℃伅");
+ return;
+ }
+
+ tagData = list[0];
+ needContractCheck = true; // 鍙湁缁炵嚎闇�瑕佸仛鍚堝悓鍙锋牎楠�
+ } else {
+ // ===== 鍗曚笣鎷変笣浜岀淮鐮侀�昏緫锛堢函瀛楃涓诧級 =====
+ // 绀轰緥锛歓D7z30202616101201#[@]01,桅5.6,-,750826011001001,600.6
+ // 闇�瑕佹彁鍙栦互 75 寮�澶寸殑鍗曚笣鍙�
+ const parts = scanText.split(/[,\s]/).filter((p) => !!p);
+ monofilamentNumber = parts.find((p) => p.startsWith("75"));
+
+ if (!monofilamentNumber) {
+ toast.error("浜岀淮鐮佹牸寮忛敊璇紝鏈壘鍒板崟涓濆彿");
+ return;
+ }
+
+ // 妫�鏌ユ槸鍚﹀凡瀛樺湪锛堟牴鎹崟涓濆彿鍒ゆ柇锛�
+ const exists = goodsList.value.some((item) => {
+ const itemMono = item.monofilamentNumber;
+ return itemMono && itemMono === monofilamentNumber && itemMono !== "-";
+ });
+
+ if (exists) {
+ toast.error("璇ユ潯鐮佸凡瀛樺湪锛岃鍕块噸澶嶆壂鐮�");
+ return;
+ }
+
+ // 璋冪敤鎷変笣鎺ュ彛锛欸ET /mes/app/getTagByLsMonofilamentNumber?monofilamentNumber=xxxx
+ const { data } = await OutboundApi.getTagByLsMonofilamentNumber({
+ monofilamentNumber,
+ });
+
+ const list = Array.isArray(data) ? data : data ? [data] : [];
+ if (!list.length) {
+ toast.error("鏈煡璇㈠埌鏉$爜淇℃伅");
+ return;
+ }
+
+ tagData = list[0];
+ outPutId = tagData?.id || monofilamentNumber;
+ // 鎷変笣涓嶅仛鍚堝悓鍙锋牎楠�
}
- const outPutId = scanData.id;
-
- if (!outPutId) {
- toast.error("浜岀淮鐮佹牸寮忛敊璇紝缂哄皯id淇℃伅");
- return;
- }
-
- // 妫�鏌ユ槸鍚﹀凡瀛樺湪锛堟牴鎹甶d鍒ゆ柇锛�
- const exists = goodsList.value.some((item) => {
- const itemId = item.id;
- return itemId && itemId === outPutId && itemId !== "-";
- });
-
- if (exists) {
- toast.error("璇ユ潯鐮佸凡瀛樺湪锛岃鍕块噸澶嶆壂鐮�");
- return;
- }
-
- // 璋冪敤鎺ュ彛鑾峰彇缁炵嚎/鎷変笣璇︾粏淇℃伅锛堝惈鍑哄簱鐘舵�侊級
- const { data } = await OutboundApi.getTagByIdAll({
- outPutId: outPutId,
- });
-
- const list = data || [];
- if (!list.length) {
- toast.error("鏈煡璇㈠埌鏉$爜淇℃伅");
- return;
- }
-
- const tagData = list[0];
-
- // 宸插嚭搴撴牎楠�
+ // 宸插嚭搴撴牎楠岋紙缁炵嚎 / 鎷変笣 閫氱敤锛�
if (tagData?.state === "宸插嚭搴�") {
toast.error("璇ユ潯鐮佸凡鍑哄簱锛屾棤娉曢噸澶嶅嚭搴�");
return;
}
- // 鍚堝悓鍙锋牎楠岋細妫�鏌ユ壂鐮佺殑鍚堝悓鍙锋槸鍚︾瓑浜庡彂璐у崟鐨剉srccode
- const scannedContractNo = tagData?.contractno || "";
- if (scannedContractNo && vsrccode.value && scannedContractNo !== vsrccode.value) {
- toast.error(`鍚堝悓鍙�"${scannedContractNo}"涓庡綋鍓嶅彂璐у崟涓�"${vsrccode.value}"涓嶅尮閰峘);
- return;
+ // 鍚堝悓鍙锋牎楠岋細鍙缁炵嚎锛圝SON 鍦烘櫙锛夎繘琛屾牎楠�
+ if (needContractCheck) {
+ const scannedContractNo = tagData?.contractno || "";
+ if (scannedContractNo && vsrccode.value && scannedContractNo !== vsrccode.value) {
+ toast.error(`鍚堝悓鍙�"${scannedContractNo}"涓庡綋鍓嶅彂璐у崟涓�"${vsrccode.value}"涓嶅尮閰峘);
+ return;
+ }
}
// 鎻愬彇鏁版嵁瀛楁锛堟牴鎹帴鍙h繑鍥炵殑鏁版嵁缁撴瀯锛�
@@ -214,6 +267,7 @@
tagData?.monofilamentNumber ||
tagData?.systemno ||
tagData?.systemNo ||
+ monofilamentNumber ||
"-",
model: tagData?.model || "-",
weight: tagData?.actuallylength || tagData?.actuallyLength || tagData?.weight || "-",
@@ -227,7 +281,7 @@
productuser: tagData?.productuser || "",
// 淇濈暀鍘熷鏁版嵁
rawData: tagData,
- scanCode: scanCode,
+ scanCode: scanText,
};
// 娣诲姞鍒板垪琛�
--
Gitblit v1.9.3