From 5c6c67ff6a447f55ed82bf925fcbb6c1ed6ab542 Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期四, 26 六月 2025 08:34:08 +0800
Subject: [PATCH] 1.生产补料优化 2.条码拆分优化 3.入库前拆分界面
---
H5/Js/Scll.js | 241 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 234 insertions(+), 7 deletions(-)
diff --git a/H5/Js/Scll.js b/H5/Js/Scll.js
index b87acaf..94a8b49 100644
--- a/H5/Js/Scll.js
+++ b/H5/Js/Scll.js
@@ -9,6 +9,21 @@
},
modeInfo: { daa001: "", planNo: "" },
scanInfo: { barcodeNum: "", splitNum: "", barcode: "" },
+ ItemDetail: [],
+ ip: "",
+ port: "",
+ oldBarInfo: [],
+ cfBarInfo: [],
+ selectKey: "",//鏌ヨ鍏抽敭瀛�
+ actions: [],//鍒楄〃鐨勫��
+ show: false,//鍒楄〃灞曠ず
+ //isPrinterPopupVisible: false, // 鎺у埗寮圭獥鏄剧ず/闅愯棌
+ //selectedPrinter: '', // 褰撳墠閫夋嫨鐨勬墦鍗版満缂栧彿
+ //printerList: [
+ // { printerId: 'Printer1', ipAddress: '192.168.1.1' },
+ // { printerId: 'Printer2', ipAddress: '192.168.1.2' },
+ // { printerId: 'Printer3', ipAddress: '192.168.1.3' }
+ //], // 鎵撳嵃鏈哄垪琛�
}
},
mounted() {
@@ -29,11 +44,16 @@
.then(function (res) {
var json = res;
if (json.status == 0) {
- that.modeInfo = json.data.tbBillList;
+ that.ItemDetail = json.data.tbBillList;
+ that.modeInfo.planNo = json.data.tbBillList.planNo;
+ that.$refs.barcode.focus();
}
else {
that.$toast.fail(json.message);
that.$refs.daa001.focus();
+ that.modeInfo.daa001 = "";
+ that.modeInfo.planNo = "";
+ that.ItemDetail = [];
}
that.isLoading = false;
})
@@ -42,14 +62,25 @@
that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
console.log(error);
that.$refs.daa001.focus();
+ that.modeInfo.daa001 = "";
});
},
getScan() {
- var that = this;
- if (that.modeInfo.daa001.length <= 0) {
- that.$toast.fail("棰嗘枡鍗曞彿涓嶈兘涓虹┖锛�");
+
+ if (this.isLoading) {
return;
}
+
+ var that = this;
+ if (that.modeInfo.daa001.length <= 0) {
+ that.$toast.fail("宸ュ崟鍗曞彿涓嶈兘涓虹┖锛�");
+ return;
+ }
+ if (that.scanInfo.barcode.length * 1 <= 0) {
+ that.$toast.fail("鐗╂枡鏉$爜涓嶈兘涓虹┖锛�");
+ return;
+ }
+
that.isLoading = true;
that.AxiosHttp("post", 'Womdaa/ScanCode', {
daa001: that.modeInfo.daa001,
@@ -60,7 +91,11 @@
var json = res;
if (json.status == 0) {
// that.scanInfo = json.data.tbBillList;
+ that.$notify({ type: 'success', message: json.message });
+ that.$playSound('success');
that.getModel();
+ that.$refs.barcode.focus();
+ that.scanInfo.barcode = null;
}
else if (json.status == 2) {
that.$refs.splitNum.focus();
@@ -69,22 +104,29 @@
}
else {
that.$toast.fail(json.message);
+ that.$playSound('error');
that.$refs.barcode.focus();
}
- that.$notify({ type: 'success', message: json.message });
+
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
- console.log(error);
+ that.$playSound('error');
that.$refs.barcode.focus();
});
},
getChaiFen() {
+ //this.isPrinterPopupVisible = true; // 鏄剧ず寮圭獥
+
+ if (this.isLoading) {
+ return;
+ }
+
var that = this;
if (that.modeInfo.daa001.length <= 0) {
- that.$toast.fail("棰嗘枡鍗曞彿涓嶈兘涓虹┖锛�");
+ that.$toast.fail("宸ュ崟鍗曞彿涓嶈兘涓虹┖锛�");
return;
}
if (that.scanInfo.splitNum * 1 <= 0) {
@@ -95,6 +137,16 @@
that.$toast.fail("鐗╂枡鏉$爜涓嶈兘涓虹┖锛�");
return;
}
+ //that.ip = "";
+ //that.prot = "";
+ //that.getPrintInfo();
+
+ //if (that.ip.length <= 0 || that.prot.length <= 0) {
+ // alert(that.ip);
+ // alert(that.prot);
+ // return;
+ //}
+
that.isLoading = true;
that.AxiosHttp("post", 'Womdaa/ScanCodeCF', {
daa001: that.modeInfo.daa001,
@@ -110,19 +162,194 @@
that.scanInfo.barcodeNum = null;
that.scanInfo.barcode = null;
that.$notify({ type: 'success', message: json.message });
+ that.$playSound('success');
+
+ that.sendMessage(json.data.tbBillList);
+
that.$refs.barcode.focus();
that.getModel();
}
else {
that.$toast.fail(json.message);
+ that.$playSound('error');
}
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ that.$playSound('error');
+ });
+ },
+
+
+ sendMessage(tbBillList) {
+ const cfDetails = tbBillList.cfBarInfo.map(item => {
+ return "! 0 200 200 210 1\r\n" +
+ "PAGE - WIDTH 700 \r\n" +
+ "BOX 0 0 700 180 0 \r\n" +
+ `T 16 0 10 10 鐗╂枡缂栫爜锛歕r\n` +
+ `T 55 3 120 10 ${item.iteM_NO}\r\n` +
+ `T 16 0 310 10 ${item.item_name}\r\n` +
+ "T 55 2 10 42 鐗╂枡瑙勬牸锛歕r\n" +
+ `T 55 2 110 42 ${item.item_model}\r\n` +
+ "T 16 0 10 78 鏁伴噺锛歕r\n" +
+ `T 0 5 90 78 ${item.quantity}\r\n` +
+ `T 16 5 180 78 ${item.barType}\r\n` +
+ `BARCODE 128 1 25 35 350 130 ${item.iteM_BARCODE}\r\n` +
+ `T 0 1 350 130 ${item.iteM_BARCODE}\r\n` +
+ "T 55 0 10 125 鍒涘缓鏃堕棿锛歕r\n" +
+ `T 55 0 120 125 ${item.creatE_DATE}\r\n` +
+ "T 55 0 10 150 鎵撳嵃鏃堕棿锛歕r\n" +
+ `T 55 0 120 150 ${item.print_date}\r\n` +
+ "B QR 580 12 M 2 U 4\r\n" +
+ `MA,${item.iteM_BARCODE}\r\n` +
+ "ENDQR\r\nFORM\r\nPRINT\r\n";
+ });
+ //alert(cfDetails);
+ let sendData = {
+ Type: 'Bar',
+ Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE,
+ Detail: cfDetails,
+ Ip: tbBillList.printInfo[0].ip,
+ Port: tbBillList.printInfo[0].port,
+ }
+ console.log('sendMessage 寮�濮�1:')
+ console.log('sendMessage 寮�濮�2:' + JSON.stringify(sendData))
+ uni.webView.postMessage({
+ data: JSON.stringify(sendData)
+ })
+ },
+
+ //getPrintInfo() {
+ // var that = this;
+
+ // that.AxiosHttp("post", 'MesPrint/getPrintInfo', {
+ // userName: that.userInfo.loginAccount,
+ // }, false)
+ // .then(function (res) {
+ // var json = res;
+ // if (json.status == 0) {
+ // alert(json.data.tbBillList[0].port);
+ // alert(json.data.tbBillList[0].ip);
+ // that.port = json.data.tbBillList[0].port;
+ // that.ip = json.data.tbBillList[0].ip;
+ // }
+ // else {
+ // that.$toast.fail(json.message);
+ // that.$playSound('error');
+ // }
+ // that.isLoading = false;
+ // })
+ // .catch(function (error) {
+ // that.isLoading = false;
+ // that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ // });
+
+ //},
+ //printCfBar(cfBar) {
+ // var that = this;
+
+ // that.AxiosHttp("post", 'MesPrint/getCfInfo', {
+ // userName: that.userInfo.loginAccount,
+ // cfBar: cfBar,
+ // oldBar: that.scanInfo.barcode
+ // }, false)
+ // .then(function (res) {
+ // var json = res;
+ // if (json.status == 0) {
+ // that.$notify({ type: 'success', message: '鎵撳嵃璇锋眰宸插彂閫�' });
+ // that.$playSound('success');
+ // }
+ // else {
+ // that.$toast.fail(json.message);
+ // that.$playSound('error');
+ // }
+ // that.isLoading = false;
+ // })
+ // .catch(function (error) {
+ // that.isLoading = false;
+ // that.$toast.fail("鎵撳嵃鏈嶅姟寮傚父锛�" + error.message);
+ // that.$playSound('error');
+ // });
+ //},
+
+
+ //鎵撳嵃鏈烘敞閲�
+ //selectPrinter(printer) {
+ // this.selectedPrinter = printer.printerId; // 鏇存柊閫変腑鐨勬墦鍗版満缂栧彿
+ //},
+ //confirmSelection() {
+ // if (this.selectedPrinter) {
+ // alert(`鎮ㄩ�夋嫨浜嗘墦鍗版満锛�${this.selectedPrinter}`);
+ // // 鍦ㄨ繖閲屽鐞嗛�夋嫨缁撴灉锛屼緥濡傝皟鐢ㄦ帴鍙f垨鏇存柊鐘舵��
+ // this.isPrinterPopupVisible = false; // 鍏抽棴寮圭獥
+ // } else {
+ // alert('璇烽�夋嫨涓�涓墦鍗版満锛�');
+ // }
+ //},
+ //onPrinterSelected(value) {
+ // console.log('褰撳墠閫変腑鐨勬墦鍗版満缂栧彿:', value);
+ //},
+
+ //鑾峰彇宸ュ崟淇℃伅
+ getInfo() {
+ this.show = true;
+ var that = this;
+ that.actions = [];
+ that.isLoading = true;
+ that.AxiosHttp("post", 'Womdaa/GetXcslDaa', {
+ selectKey: that.selectKey,
+ }, false)
+ .then(function (res) {
+ var json = res;
+ if (json.status == 0) {
+
+ if (json.data.tbBillList.length <= 0) {
+ that.$toast.fail("娌℃湁鍙敤鐨勬暟鎹�");
+ that.$playSound('error');
+ } else {
+ that.itemInfo = json.data.tbBillList;
+ that.actions = json.data.tbBillList.map(item => {
+ return {
+ name: item.daaInfo // 鎷兼帴瀛楁
+
+ };
+ });
+ }
+ }
+ else {
+ that.$toast.fail(json.message);
+ that.$playSound('error');
+ }
+ that.isLoading = false;
+ })
+ .catch(function (error) {
+ that.isLoading = false;
+ that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ that.$playSound('error');
console.log(error);
});
},
+ onSelect(item) {
+ // 榛樿鎯呭喌涓嬬偣鍑婚�夐」鏃朵笉浼氳嚜鍔ㄦ敹璧�
+ // 鍙互閫氳繃 close-on-click-action 灞炴�у紑鍚嚜鍔ㄦ敹璧�
+ this.show = false;
+ console.log(item);
+ // 姝e垯鍖归厤绗竴涓柟鎷彿鍐呭
+ const regex = /\[([^\]]+)\]/;
+ const matchResult = item.name.match(regex);
+
+ if (matchResult && matchResult[1]) {
+ this.modeInfo.daa001 = matchResult[1]; // PPBOM00000088-1
+ console.log('鎻愬彇鐨凞AA001:', this.modeInfo.daa001);
+ } else {
+ this.$toast.fail('宸ュ崟鍙锋牸寮忓紓甯�');
+ this.modeInfo.daa001 = '';
+ }
+ this.getModel();
+ //this.$toast(item.name);
+
+ },
}
})
\ No newline at end of file
--
Gitblit v1.9.3