diff --git a/src/views/inm/mioitem_form.vue b/src/views/inm/mioitem_form.vue index 9feeb779..e37747cb 100644 --- a/src/views/inm/mioitem_form.vue +++ b/src/views/inm/mioitem_form.vue @@ -571,8 +571,10 @@ export default { } }, getBatchOptions() { - // 车间批次 - this.getWBatchs(); + // 仓库批次直选模式不使用车间库存批次,避免额外请求 wmaterial + if (!this.isBatchPick) { + this.getWBatchs(); + } this.$API.inm.warehouse.batch .req({ page: 0, material: this.form.material }) .then((res) => { @@ -775,13 +777,36 @@ export default { if(that.type=='other_in'||that.type=='do_out'){ let mioitemSelecObj =JSON.parse(sessionStorage.getItem("mioitemSelecObj")); if(mioitemSelecObj!==null){ - that.selectObj = mioitemSelecObj; - that.form.material = that.selectObj.id; - that.form.unit = that.selectObj.unit; - that.form.unit_price = that.selectObj.unit_price; - that.form.batch = that.cate=='helpso'?that.selectObj.bin_number_main:''; - that.mTracking = that.selectObj.tracking; - that.getBatchOptions(); + if (that.isBatchPick) { + // 仓库批次模式缓存的是 MaterialBatch;旧版缓存的 Material 不可复用 + if ( + mioitemSelecObj.material && + mioitemSelecObj.warehouse && + mioitemSelecObj.batch + ) { + that.selectObj = mioitemSelecObj; + that.form.material = mioitemSelecObj.material; + that.form.unit = mioitemSelecObj.material_ ? mioitemSelecObj.material_.unit : undefined; + that.form.unit_price = mioitemSelecObj.material_ ? mioitemSelecObj.material_.unit_price : 0; + that.form.batch = mioitemSelecObj.batch; + that.form.mb = mioitemSelecObj.id; + that.form.warehouse = mioitemSelecObj.warehouse; + that.batchcount = Number(mioitemSelecObj.count_canmio); + that.form.count = Number(mioitemSelecObj.count_canmio); + that.mTracking = mioitemSelecObj.material_ ? mioitemSelecObj.material_.tracking : 10; + that.inputBatchDisable = true; + } else { + sessionStorage.removeItem("mioitemSelecObj"); + } + } else { + that.selectObj = mioitemSelecObj; + that.form.material = that.selectObj.id; + that.form.unit = that.selectObj.unit; + that.form.unit_price = that.selectObj.unit_price; + that.form.batch = that.cate=='helpso'?that.selectObj.bin_number_main:''; + that.mTracking = that.selectObj.tracking; + that.getBatchOptions(); + } } } return this;