fix:物料分批时自动生成批次号

This commit is contained in:
shijing 2025-05-30 10:51:34 +08:00
parent 5e108a568f
commit 23fdd0f466
1 changed files with 17 additions and 9 deletions

View File

@ -22,12 +22,11 @@
<el-form-item label="剩余可分配数量:" label-width="130">
{{saveCount}}
</el-form-item>
</el-row>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="10">
<el-form-item label="批次号">
<el-input v-model="listItem.batch"></el-input>
<el-input v-model="listItem.batch" disabled></el-input>
</el-form-item>
</el-col>
<el-col :span="7">
@ -46,7 +45,7 @@
</el-input-number>
</el-form-item>
</el-col>
<el-col :span="2" v-if="mode!=='show'">
<el-col :span="2" v-if="mode!=='show'&&$index!==0">
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col>
</el-row>
@ -92,7 +91,6 @@ export default {
process:{
type:String,
default:""
}
},
components: {
@ -134,6 +132,7 @@ export default {
batchOrign:{},
totalCount: 0,
materialOptions: [],
first_batch_num:0,
visible: false,
isSaveing: false,
setFiltersVisible: false,
@ -162,19 +161,31 @@ export default {
this.saveCount = 0;
this.form.handoverb.push(obj)
this.visible = true;
this.getbatchesTo();
return this;
},
getbatchesTo(){
let that = this;
let obj = {};
obj.batch= that.codeText;
that.$API.wpm.batchlog.batchesTo.req(obj).then((res) => {
console.log('res',res);
that.last_batch_num = res.last_batch_num;
let batch_num = that.first_batch_num = res.last_batch_num+1;
that.form.handoverb[0].batch = that.codeText+"-"+batch_num;
});
},
batchAdd(){
let that = this;
if(that.saveCount>0){
let indexs = that.form.handoverb.length+1;
let indexs = that.first_batch_num + that.form.handoverb.length;
let count = 0;
that.form.handoverb.forEach(item=>{
count+=item.count;
})
let obj = { };
obj.wm = that.batchOrign.id;
obj.batch = that.codeText+"-"+indexs;
obj.batch = that.codeText+"-"+indexs;
obj.count = that.batchOrign.count - count;
that.saveCount = 0;
that.form.handoverb.push(obj)
@ -205,9 +216,7 @@ export default {
that.saveCount = 0;
}else{
that.saveCount = that.batchOrign.count-totalCount;
}
}
},
//
@ -234,7 +243,6 @@ export default {
that.$message.success("操作成功");
});
}).catch((err) => {
//
that.isSaveing = false;
return err;
});