From 21bdf0f6e844a1a747c616197f1427d6a7445afe Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期五, 16 五月 2025 08:23:17 +0800
Subject: [PATCH] 1.无线打印条码方法公共化 2.采购退货优化
---
Scripts/config.js | 44 ++++++++++++++
H5/BarCf.aspx | 6 +
H5/Js/PurchaseReturn.js | 86 ++++++++++++++++++++++++++++
H5/PurchaseReturn.aspx | 22 ++++++-
Mst.master | 2
H5/Js/BarCf.js | 13 ++++
6 files changed, 166 insertions(+), 7 deletions(-)
diff --git a/H5/BarCf.aspx b/H5/BarCf.aspx
index f85caa6..130c8d0 100644
--- a/H5/BarCf.aspx
+++ b/H5/BarCf.aspx
@@ -24,7 +24,8 @@
placeholder="璇锋壂鐮�"
:right-icon-size="19"
v-focus.noKeyboard
- @change="getScan"
+ @keyup.enter.native="getScan"
+<%-- @change="getScan"--%>
></van-field>
<van-field
v-model="formData.itemNo"
@@ -56,6 +57,7 @@
label="鎷嗗垎鏁伴噺"
clearable
placeholder="璇疯緭鍏ユ媶鍒嗘暟閲�"
+ @input="handleNumberInput3"
:right-icon-size="19"
v-focus.noKeyboard
></van-field>
@@ -71,5 +73,5 @@
<%--<comback ></comback>--%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" Runat="Server">
- <script src="Js/BarCf.js?<%=121 %>"></script>
+ <script src="Js/BarCf.js?<%=121111 %>"></script>
</asp:Content>
diff --git a/H5/Js/BarCf.js b/H5/Js/BarCf.js
index be38d8a..9f2065a 100644
--- a/H5/Js/BarCf.js
+++ b/H5/Js/BarCf.js
@@ -105,6 +105,10 @@
});
},
getChaiFen() {
+ if (this.isLoading) {
+ return;
+ }
+
var that = this;
if (that.formData.cfNum * 1 <= 0) {
@@ -125,6 +129,8 @@
var json = res;
if (json.status == 0) {
// that.modeInfo = json.data.tbBillList;
+ // 鎷嗗垎鍏ㄥ眬璋冪敤鏂规硶
+ that.sendPrintMessage(json.data.tbBillList);
that.$refs.barcode.focus();
that.formData.barcode = null;
that.formData.cfNum = null;
@@ -145,5 +151,12 @@
//cleraCode() {
// this.formData.sectionCode = null;
//},
+ handleNumberInput3(value) {
+ this.formData.cfNum = value.replace(/[^\d.]/g, '') // 1. 鍘婚櫎闈炴暟瀛楀拰灏忔暟鐐�
+ .replace(/(\..*)\./g, '$1') // 2. 绂佹澶氫釜灏忔暟鐐�
+ .replace(/^\./g, '');
+ },
+
+
}
})
\ No newline at end of file
diff --git a/H5/Js/PurchaseReturn.js b/H5/Js/PurchaseReturn.js
index c103af5..10c41d8 100644
--- a/H5/Js/PurchaseReturn.js
+++ b/H5/Js/PurchaseReturn.js
@@ -27,6 +27,12 @@
messageId: 0,
show: false,
+
+ scanInfo: { barcodeNum: "", splitNum: "", barcode: "" },
+ ip: "",
+ port: "",
+ oldBarInfo: [],
+ cfBarInfo: [],
}
},
mounted() {
@@ -55,12 +61,14 @@
that.show = true;
}
else {
+ that.$playSound('error');
that.$toast.fail(json.message);
}
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
+ that.$playSound('error');
that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
console.log(error);
});
@@ -78,12 +86,14 @@
that.itemOutNoList = json.data.tbBillList;
}
else {
+ that.$playSound('error');
that.$toast.fail(json.message);
}
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
+ that.$playSound('error');
that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
console.log(error);
});
@@ -125,6 +135,7 @@
that.$refs.barcode.focus();
}
else {
+ that.$playSound('error');
that.$toast.fail(json.message);
that.ItemDetail = [];
}
@@ -132,6 +143,7 @@
})
.catch(function (error) {
that.isLoading = false;
+ that.$playSound('error');
that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
that.ItemDetail = [];
});
@@ -164,19 +176,91 @@
that.scanFormData.barcode = null;
}
else {
+ that.$playSound('error');
that.$toast.fail(json.message);
that.$refs.barcode.focus();
that.scanFormData.barcode = null;
}
+ success
that.$notify({ type: 'success', message: json.message });
that.isLoading = false;
})
.catch(function (error) {
that.isLoading = false;
+ that.$playSound('error');
that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
console.log(error);
that.$refs.barcode.focus();
});
- }
+ },
+ getChaiFen() {
+ //this.isPrinterPopupVisible = true; // 鏄剧ず寮圭獥
+
+ if (this.isLoading) {
+ return;
+ }
+
+ var that = this;
+ if (that.scanFormData.itemOutNo.length <= 0) {
+ that.$playSound('error');
+ that.$toast.fail("鐢宠鍗曞彿涓嶈兘涓虹┖锛�");
+ return;
+ }
+ if (that.scanInfo.splitNum * 1 <= 0) {
+ that.$playSound('error');
+ that.$toast.fail("鎷嗗垎鏁伴噺涓嶈兘涓虹┖锛�");
+ return;
+ }
+ if (that.scanInfo.barcode.length * 1 <= 0) {
+ that.$playSound('error');
+ 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,
+ userName: that.userInfo.loginAccount,
+ barcode: that.scanInfo.barcode,
+ Num: that.scanInfo.splitNum,
+ }, false)
+ .then(function (res) {
+ var json = res;
+ if (json.status == 0) {
+ // that.modeInfo = json.data.tbBillList;
+ that.scanInfo.splitNum = null;
+ 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.$playSound('error');
+ that.$toast.fail(json.message);
+ that.$playSound('error');
+ }
+ that.isLoading = false;
+ })
+ .catch(function (error) {
+ that.isLoading = false;
+
+ that.$toast.fail("缃戠粶閿欒锛岃閲嶈瘯锛�");
+ that.$playSound('error');
+ });
+ },
}
})
\ No newline at end of file
diff --git a/H5/PurchaseReturn.aspx b/H5/PurchaseReturn.aspx
index 85a8002..eb7797e 100644
--- a/H5/PurchaseReturn.aspx
+++ b/H5/PurchaseReturn.aspx
@@ -19,9 +19,9 @@
<van-cell-group>
<van-field
value=""
- label="閫�璐у崟鍙�"
+ label="鐢宠鍗曞彿"
clearable
- placeholder="閫夋嫨閫�璐у崟鍙�"
+ placeholder="閫夋嫨鐢宠鍗曞彿"
:right-icon-size="19"
v-model="scanFormData.itemOutNo"
@keyup.enter.native="getItem"
@@ -52,6 +52,22 @@
placeholder="鏁伴噺"
disabled
></van-field>
+ <van-field
+ ref="splitNum"
+ v-model="scanInfo.splitNum"
+ center
+ clearable
+ label="鍙戞枡鏁伴噺"
+ placeholder="鍙戞枡鏁伴噺">
+ <van-button
+ slot="button"
+ type="info"
+ size="small"
+ plain
+ @click="getChaiFen">
+ 鏉$爜鎷嗗垎
+ </van-button>
+</van-field>
</van-cell-group>
</div>
<van-tabs color="#000" title-active-color="#0283EF">
@@ -107,5 +123,5 @@
<%--<comback ></comback>--%>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder4" Runat="Server">
- <script src="Js/PurchaseReturn.js?<%=12811 %>"></script>
+ <script src="Js/PurchaseReturn.js?<%=128111 %>"></script>
</asp:Content>
diff --git a/Mst.master b/Mst.master
index c6b001d..974d37a 100644
--- a/Mst.master
+++ b/Mst.master
@@ -11,7 +11,7 @@
<script src="/Scripts/vue.min.js"></script>
<script src="/Scripts/js.cookie.min.js"></script>
<script src="/scripts/axios0.25.0.js"></script>
- <script src="/scripts/config.js?<%=1236111 %>"></script>
+ <script src="/scripts/config.js?<%=123611117 %>"></script>
<link href="/scripts/vant/vant.css" rel="stylesheet" />
<script src="/scripts/vant/vant.js"></script>
<link href="/Images/Style.css?<%=16994 %>" rel="stylesheet" />
diff --git a/Scripts/config.js b/Scripts/config.js
index 8a3f5c1..2d68190 100644
--- a/Scripts/config.js
+++ b/Scripts/config.js
@@ -162,6 +162,47 @@
window.history.back();
}
+
+// 鏂板鍏ㄥ眬鎵撳嵃鏂规硶
+Vue.prototype.sendPrintMessage = function (tbBillList) {
+ const cfDetails = tbBillList.cfBarInfo.map(item => {
+ return "! 0 200 200 210 1\r\n" +
+ "PAGE - WIDTH 700 \r\n" +
+ "GAP-SENSE \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";
+ });
+
+ let sendData = {
+ Type: 'Bar',
+ Barcode: tbBillList.cfBarInfo[0].iteM_BARCODE,
+ Detail: cfDetails,
+ Ip: tbBillList.printInfo[0].ip,
+ Port: tbBillList.printInfo[0].port,
+ }
+
+ console.log('鎵撳嵃鏁版嵁锛�', sendData);
+ uni.webView.postMessage({
+ data: JSON.stringify(sendData)
+ })
+};
+
// 鏂板闊抽鎾斁鏂规硶
Vue.prototype.$playSound = function(type = 'success') {
try {
@@ -178,3 +219,6 @@
console.error('闊抽鍒濆鍖栭敊璇�:', e);
}
};
+
+
+
--
Gitblit v1.9.3