diff --git a/mycomponents/scan/winScanItem.vue b/mycomponents/scan/winScanItem.vue index 11f26ce8..f406cdb5 100644 --- a/mycomponents/scan/winScanItem.vue +++ b/mycomponents/scan/winScanItem.vue @@ -32,7 +32,7 @@ components: { winComScan }, - emits: ["getScanCode"], + emits: ["getScanCode",'getScanResult'], props: { title: { type: String, diff --git a/pages/issue/coms/comIssueRequestPopup.vue b/pages/issue/coms/comIssueRequestPopup.vue index 7d6d3800..4f9c3693 100644 --- a/pages/issue/coms/comIssueRequestPopup.vue +++ b/pages/issue/coms/comIssueRequestPopup.vue @@ -37,14 +37,18 @@ - + 数量: - + + + + @@ -123,6 +127,7 @@ isModifiedPosition: true, positionList: [], stdQty: 0, //标包 + maxlength:10 } }, props: { @@ -132,6 +137,21 @@ }, }, methods: { + checkNum(e) { + let value = e.detail.value; + let dot = value.indexOf('.'); //包含小数点 + let reg = /^[0-9]+$/; //正整数 + if (dot > -1) { + this.maxlength = dot + 7; //长度是小数点后两位 + if (value.length > dot + 7) { + + } + } + if (reg.test(value)) { //如果是正整数不包含小数点 + this.maxlength = 10; + } + this.change(value) + }, openRequestPopup(editPosition) { if (this.positionList.length == 0) { getWorkShopLineStation().then(res => { diff --git a/pages/productPutaway/coms/comProductRecord.vue b/pages/productPutaway/coms/comProductRecord.vue deleted file mode 100644 index 463f779b..00000000 --- a/pages/productPutaway/coms/comProductRecord.vue +++ /dev/null @@ -1,198 +0,0 @@ - - - - - diff --git a/pages/unPlanned/coms/comReceiptRecord.vue b/pages/unPlanned/coms/comReceiptRecord.vue index fba51210..3b993ca8 100644 --- a/pages/unPlanned/coms/comReceiptRecord.vue +++ b/pages/unPlanned/coms/comReceiptRecord.vue @@ -164,7 +164,7 @@ }); }, confirm(qty) { - this.editItem.qty = qty; + this.editItem.label.qty = qty; this.$emit('updateData') } } diff --git a/pages/unPlanned/record/receiptRecord.vue b/pages/unPlanned/record/receiptRecord.vue index ee901736..1568020d 100644 --- a/pages/unPlanned/record/receiptRecord.vue +++ b/pages/unPlanned/record/receiptRecord.vue @@ -22,12 +22,12 @@ - + - @@ -37,7 +37,7 @@ - + @@ -55,7 +55,7 @@ import { unPlannedReceiptRecordbSubmit } from '@/api/request2.js'; - + import { getDirectoryItemArray, getUnPlannedReceiptReasonList @@ -64,17 +64,17 @@ import { getBusinessType, } from '@/common/record.js'; - + import { - calc - } from '@/common/calc.js'; + calc + } from '@/common/calc.js'; import { goHome, updateTitle, deepCopyData, getPackingNumberAndBatchByList } from '@/common/basic.js'; - + import { getPrecisionStrategyList } from '@/common/balance.js'; @@ -102,10 +102,10 @@ detailSource: [], //绑定在页面上的数据源 businessTypeCode: "UnplannedReceipt", reasonText: "", - reasonCode:"", + reasonCode: "", reasonList: [], - dataContent:{}, - managementList:[] + dataContent: {}, + managementList: [] } }, @@ -123,8 +123,7 @@ }); }, - onLoad(option) { - }, + onLoad(option) {}, methods: { openScanPopup() { @@ -188,7 +187,7 @@ // Object.assign(detail, label) detail.qty = Number(label.qty) detail.handleQty = 0, - detail.inventoryStatus = "OK" + detail.inventoryStatus = "OK" detail.stdPackQty = pack.stdPackQty; detail.stdPackUnit = pack.stdPackUnit; label.inventoryStatus = "OK"; @@ -203,7 +202,7 @@ item.qty = 0; for (let detail of item.subList) { if (detail != undefined) { - item.qty = calc.add(item.qty,detail.qty) + item.qty = calc.add(item.qty, detail.label.qty) } } } @@ -242,44 +241,44 @@ this.showErrorMessage("请选择入库原因") return; } - - + + if (this.detailSource.length > 0 && this.detailSource[0].subList.length > 0) { - //查询管理模式 - uni.showLoading({ - title: "提交中....", - mask: true - }); - this.managementList = []; - var precisionStrategParams = this.setPrecisionStrategParams() - getPrecisionStrategyList(precisionStrategParams, res => { - if (res.success) { - this.managementList = res.list; - var params = this.setParams() - console.log("提交" + JSON.stringify(params)) - unPlannedReceiptRecordbSubmit(params).then(res => { - uni.hideLoading() - if (res.data) { - this.showCommitSuccessMessage("提交成功
生成计划外入库记录
" + res.data) - } else { - this.showErrorMessage("提交失败[" + res.msg + "]") - } - }).catch(error => { - uni.hideLoading() - this.showErrorMessage(error) - }) - - } else { - uni.hideLoading(); - this.showErrorMessage(res.message); - } - - }) - }else { + //查询管理模式 + uni.showLoading({ + title: "提交中....", + mask: true + }); + this.managementList = []; + var precisionStrategParams = this.setPrecisionStrategParams() + getPrecisionStrategyList(precisionStrategParams, res => { + if (res.success) { + this.managementList = res.list; + var params = this.setParams() + console.log("提交" + JSON.stringify(params)) + unPlannedReceiptRecordbSubmit(params).then(res => { + uni.hideLoading() + if (res.data) { + this.showCommitSuccessMessage("提交成功
生成计划外入库记录
" + res.data) + } else { + this.showErrorMessage("提交失败[" + res.msg + "]") + } + }).catch(error => { + uni.hideLoading() + this.showErrorMessage(error) + }) + + } else { + uni.hideLoading(); + this.showErrorMessage(res.message); + } + + }) + } else { this.showErrorMessage("没有要提交的数据,请先扫描") } - - + + }, setPrecisionStrategParams() { var itemList = [] @@ -301,47 +300,48 @@ } itemList.push(result) } - + } }) }) return itemList; }, setParams() { - + var subList = [] var creator = this.$store.state.user.id this.detailSource.forEach(item => { item.subList.forEach(detail => { if (detail.scaned) { var submitItem = deepCopyData(detail) - var info = getPackingNumberAndBatchByList(this.managementList, detail.label.itemCode, + var info = getPackingNumberAndBatchByList(this.managementList, detail.label + .itemCode, detail.label.packingNumber, detail.toLocationCode, detail.label.batch); - + submitItem.itemCode = detail.package.itemCode; submitItem.itemName = detail.package.itemName; submitItem.itemDesc1 = detail.package.itemDesc1; submitItem.itemDesc2 = detail.package.itemDesc2; - + submitItem.inventoryStatus = detail.inventoryStatus; - + submitItem.fromPackingNumber = info.packingNumber; submitItem.toPackingNumber = info.packingNumber; - + // detail.fromContainerNumber = detail.containerNumber; // detail.toContainerNumber = detail.containerNumber - + submitItem.fromBatch = info.batch; submitItem.toBatch = info.batch; - + submitItem.fromLocationCode = ""; submitItem.toLocationCode = detail.toLocationCode; - + submitItem.reason = this.reasonCode; - - submitItem.qty = detail.handleQty!=0?detail.handleQty:detail.qty; - submitItem.package =""; - + + submitItem.qty = detail.label.qty; + submitItem.package = ""; + subList.push(submitItem) } }) @@ -364,16 +364,16 @@ this.clearData(); }) }, - clearData(){ + clearData() { this.reasonCode = "" this.reasonText = ""; this.detailSource = []; - this.managementList=[]; - this.dataContent ={} - this.toLocationCode ="" + this.managementList = []; + this.dataContent = {} + this.toLocationCode = "" } - - + + } } diff --git a/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue b/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue index 39bb86a9..6f8393a8 100644 --- a/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue +++ b/uni_modules/uni-number-box/components/uni-number-box/uni-number-box.vue @@ -1,13 +1,14 @@ @@ -27,7 +28,9 @@ * @event {Function} focus 输入框聚焦时触发的事件,参数为 event 对象 * @event {Function} blur 输入框失焦时触发的事件,参数为 event 对象 */ - + import { + Decimal + } from 'decimal.js'; //引入 export default { name: "UniNumberBox", emits: ['change', 'input', 'update:modelValue', 'blur', 'focus'], @@ -71,26 +74,55 @@ }, data() { return { - inputValue: 0 + inputValue: 0, + maxlength: 10 }; }, watch: { value(val) { - this.inputValue = +val; + this.inputValue = this.add(this.inputValue, val) }, modelValue(val) { - this.inputValue = +val; + this.inputValue = this.add(this.inputValue, val) } }, created() { if (this.value === 1) { - this.inputValue = +this.modelValue; + this.inputValue = this.add(this.inputValue, this.modelValue) } if (this.modelValue === 1) { - this.inputValue = +this.value; + this.inputValue = this.add(this.inputValue, this.value) } }, methods: { + add(num1, num2) { + return new Decimal(num1).add(new Decimal(num2)) + }, + + sub(num1, num2) { + return new Decimal(num1).sub(new Decimal(num2)) + }, + + mul(num1,num2) { + return new Decimal(num1).mul(new Decimal(num2)) + }, + div(num1,num2) { + return new Decimal(num1).div(new Decimal(num2)) + }, + checkNum(e) { + let value = e.detail.value; + let dot = value.indexOf('.'); //鍖呭惈灏忔暟鐐 + let reg = /^[0-9]+$/; //姝f暣鏁 + if (dot > -1) { + this.maxlength = dot + 7; //闀垮害鏄¯灏忔暟鐐瑰悗涓や綅 + if (value.length > dot + 7) { + + } + } + if (reg.test(value)) { //濡傛灉鏄¯姝f暣鏁颁笉鍖呭惈灏忔暟鐐 + this.maxlength = 10; + } + }, _calcValue(type) { if (this.disabled) { return; @@ -99,7 +131,7 @@ let value = this.inputValue * scale; let step = this.step * scale; if (type === "minus") { - value -= step; + value = this.sub(value - step) if (value < (this.min * scale)) { return; } @@ -109,53 +141,54 @@ } if (type === "plus") { - value += step; - if (value > (this.max * scale)) { - return; - } - if (value < (this.min * scale)) { - value = this.min * scale - } - } - - this.inputValue = (value / scale).toFixed(String(scale).length - 1); - this.$emit("change", +this.inputValue); - // TODO vue2 兼容 - this.$emit("input", +this.inputValue); - // TODO vue3 兼容 - this.$emit("update:modelValue", +this.inputValue); - }, - _getDecimalScale() { - - let scale = 1; - // 浮点型 - if (~~this.step !== this.step) { - scale = Math.pow(10, String(this.step).split(".")[1].length); - } - return scale; - }, - _onBlur(event) { - this.$emit('blur', event) - let value = event.detail.value; - if (!value) { - // this.inputValue = 0; + value = this.add(value, step) + + if (value > (this.max * scale)) { return; } - value = +value; - if (value > this.max) { - value = this.max; - } else if (value < this.min) { - value = this.min; + if (value < (this.min * scale)) { + value = this.min * scale } - const scale = this._getDecimalScale(); - this.inputValue = value.toFixed(String(scale).length - 1); - this.$emit("change", +this.inputValue); - this.$emit("input", +this.inputValue); - }, - _onFocus(event) { - this.$emit('focus', event) } + + this.inputValue = (value / scale).toFixed(String(scale).length - 1); + this.$emit("change", +this.inputValue); + // TODO vue2 兼容 + this.$emit("input", +this.inputValue); + // TODO vue3 兼容 + this.$emit("update:modelValue", +this.inputValue); + }, + _getDecimalScale() { + + let scale = 1; + // 浮点型 + if (~~this.step !== this.step) { + scale = Math.pow(10, String(this.step).split(".")[1].length); + } + return scale; + }, + _onBlur(event) { + this.$emit('blur', event) + let value = event.detail.value; + if (!value) { + // this.inputValue = 0; + return; + } + value = +value; + if (value > this.max) { + value = this.max; + } else if (value < this.min) { + value = this.min; + } + const scale = this._getDecimalScale(); + this.inputValue = value.toFixed(String(scale).length - 1); + this.$emit("change", +this.inputValue); + this.$emit("input", +this.inputValue); + }, + _onFocus(event) { + this.$emit('focus', event) } + } };