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"> <el-form-item label="剩余可分配数量:" label-width="130">
{{saveCount}} {{saveCount}}
</el-form-item> </el-form-item>
</el-row> </el-row>
<el-row v-for="(listItem,$index) in form.handoverb" :key="listItem"> <el-row v-for="(listItem,$index) in form.handoverb" :key="listItem">
<el-col :span="10"> <el-col :span="10">
<el-form-item label="批次号"> <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-form-item>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
@ -46,7 +45,7 @@
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
</el-col> </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-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
</el-col> </el-col>
</el-row> </el-row>
@ -92,7 +91,6 @@ export default {
process:{ process:{
type:String, type:String,
default:"" default:""
} }
}, },
components: { components: {
@ -134,6 +132,7 @@ export default {
batchOrign:{}, batchOrign:{},
totalCount: 0, totalCount: 0,
materialOptions: [], materialOptions: [],
first_batch_num:0,
visible: false, visible: false,
isSaveing: false, isSaveing: false,
setFiltersVisible: false, setFiltersVisible: false,
@ -162,12 +161,24 @@ export default {
this.saveCount = 0; this.saveCount = 0;
this.form.handoverb.push(obj) this.form.handoverb.push(obj)
this.visible = true; this.visible = true;
this.getbatchesTo();
return this; 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(){ batchAdd(){
let that = this; let that = this;
if(that.saveCount>0){ if(that.saveCount>0){
let indexs = that.form.handoverb.length+1; let indexs = that.first_batch_num + that.form.handoverb.length;
let count = 0; let count = 0;
that.form.handoverb.forEach(item=>{ that.form.handoverb.forEach(item=>{
count+=item.count; count+=item.count;
@ -205,9 +216,7 @@ export default {
that.saveCount = 0; that.saveCount = 0;
}else{ }else{
that.saveCount = that.batchOrign.count-totalCount; that.saveCount = that.batchOrign.count-totalCount;
} }
} }
}, },
// //
@ -234,7 +243,6 @@ export default {
that.$message.success("操作成功"); that.$message.success("操作成功");
}); });
}).catch((err) => { }).catch((err) => {
//
that.isSaveing = false; that.isSaveing = false;
return err; return err;
}); });