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;