From a8694490343355c816a54c4eb54a7e981ffc2066 Mon Sep 17 00:00:00 2001 From: zhougf Date: Thu, 25 Apr 2024 18:53:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E6=95=B0=E5=8A=9F=E8=83=BD=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E8=BE=93=E5=85=A5=E6=AD=A3=E6=95=B4=E6=95=B0=20?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=87=A0=E4=B8=AA=E9=A1=B5=E9=9D=A2=E6=89=AB?= =?UTF-8?q?=E7=A0=81=E5=87=BA=E9=94=99=E5=90=8E=EF=BC=8C=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E5=B7=B2=E6=89=AB=E6=8F=8F=E7=9A=84=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Areas/Configs/Views/Print/Index.cshtml | 3 +- .../Controllers/ReceiptHeaderController.cs | 4 ++ .../Receipt/Views/ReceiptHeader/Count.cshtml | 12 ++-- .../Receipt/Views/ReceiptShelfIn/Index.cshtml | 70 ++++++++++--------- .../Areas/Shipment/Views/ShipOut/Index.cshtml | 11 +-- 5 files changed, 57 insertions(+), 43 deletions(-) diff --git a/HHWMS.Web/Areas/Configs/Views/Print/Index.cshtml b/HHWMS.Web/Areas/Configs/Views/Print/Index.cshtml index 60ffa54..09318f8 100644 --- a/HHWMS.Web/Areas/Configs/Views/Print/Index.cshtml +++ b/HHWMS.Web/Areas/Configs/Views/Print/Index.cshtml @@ -23,7 +23,7 @@ v-model="gendCode"> *@ - public ActionResult CountCommit(string code, string uniqueCode, int qty) { + if (qty <= 0) + { + return JsonMore(null, 500, $"数量必须大于0!"); + } var receiptDetail = _unitwork.FindSingle(x => x.UniqueCode.Equals(uniqueCode)); if (receiptDetail != null) { diff --git a/HHWMS.Web/Areas/Receipt/Views/ReceiptHeader/Count.cshtml b/HHWMS.Web/Areas/Receipt/Views/ReceiptHeader/Count.cshtml index f86d691..0a42363 100644 --- a/HHWMS.Web/Areas/Receipt/Views/ReceiptHeader/Count.cshtml +++ b/HHWMS.Web/Areas/Receipt/Views/ReceiptHeader/Count.cshtml @@ -88,8 +88,12 @@ var app = new Vue({ onSubmit() { var _this = this; var qty = _this.form.qty; - if (qty == "") - qty = parseInt(_this.qtyPlaceholder); + + // 正则表达式 校验qty为正整数 + if (!/^[1-9]\d*$/.test(qty)) { + layer.alert("数量必须为正整数"); + return; + } // 提交已绑定数据 $.ajax({ type: "post", @@ -115,11 +119,11 @@ var app = new Vue({ }, }); }, - + // 扫描唯一码 scanUniqueCode(data) { var _this = this; - + //1. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量 var isExit = this.tableData.findIndex(function (value) { return value.UniqueCode == data; diff --git a/HHWMS.Web/Areas/Receipt/Views/ReceiptShelfIn/Index.cshtml b/HHWMS.Web/Areas/Receipt/Views/ReceiptShelfIn/Index.cshtml index 389fcae..cfff147 100644 --- a/HHWMS.Web/Areas/Receipt/Views/ReceiptShelfIn/Index.cshtml +++ b/HHWMS.Web/Areas/Receipt/Views/ReceiptShelfIn/Index.cshtml @@ -20,37 +20,40 @@ - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + 入库 @@ -88,7 +91,7 @@ // }); }, methods: { - + // 绑定 onSubmit() { var _this = this; @@ -130,7 +133,7 @@ // 扫描唯一码 scanUniqueCode(data) { var _this = this; - + //1. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量 var isExit = this.bindingData.findIndex(function (value) { return value.uniqueCode == data; @@ -155,6 +158,7 @@ type: "warning", duration: "10000", }); + _this.form.uniqueCode = ''; } else { // 3.已扫描增加 _this.bindingData.push({ @@ -183,7 +187,7 @@ deleteRow(index, rows) { rows.splice(index, 1); }, - + }, }); diff --git a/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml b/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml index 1230e73..19e7bf6 100644 --- a/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml +++ b/HHWMS.Web/Areas/Shipment/Views/ShipOut/Index.cshtml @@ -125,11 +125,12 @@ }); if (t == -1) { - _this.$message({ - message: "扫描失败 " + data + " 不存在!", - type: "error", - duration: "10000", - }); + _this.$message({ + message: "扫描失败 " + data + " 不存在!", + type: "error", + duration: "10000", + }); + _this.form.uniqueCode = ""; } else { var value = _this.invTable[t]; _this.form.uniqueCode = value.UniqueCode;