fix:玻纤分批次
This commit is contained in:
parent
6117de9bc4
commit
abfd1b875b
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:title="titleMap[mtype]"
|
title="分批"
|
||||||
v-model="visible"
|
v-model="visible"
|
||||||
width="1000px"
|
width="1000px"
|
||||||
:size="1000"
|
:size="1000"
|
||||||
|
@ -15,39 +15,50 @@
|
||||||
>
|
>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
<span>交接物料:{{codeText}}</span>
|
<el-form-item label="物料批次:" label-width="100px">
|
||||||
<span style="margin: 0 20px;">物料总数:{{totalCount}} </span>
|
<b>{{batchOrign.batch}}</b>
|
||||||
<el-button type="primary" @click="batchAdd">分批</el-button>
|
<span style="width: 80px;margin-left:60px;">物料总数:</span>
|
||||||
</el-col>
|
<b>{{batchOrign.count}} </b>
|
||||||
<el-form-item label="剩余可分配数量:" label-width="130">
|
<el-button type="primary" @click="batchAdd" style="margin-left: 40px;">分批</el-button>
|
||||||
{{saveCount}}
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</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="true"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="7">
|
<el-col :span="14">
|
||||||
<el-form-item label="数量">
|
<span style="margin: 0 0 0 20px;">选择物料:</span>
|
||||||
<el-input-number
|
<el-input ref="codeInput"
|
||||||
v-model="listItem.count"
|
placeholder="扫描交接物料"
|
||||||
controls-position="right"
|
v-model="wm_in" clearable
|
||||||
:min="0"
|
style="width: 120px;margin: 0 10px;"
|
||||||
step="1"
|
@change="formWminChange($index,wm_in)"
|
||||||
:max="batchOrign.count"
|
></el-input>
|
||||||
:step-strictly="true"
|
<el-select
|
||||||
style="width: 100%"
|
v-model="listItem.wpr"
|
||||||
placeholder="交接数量"
|
placeholder="选择交接物料"
|
||||||
@change="countChange($index)"
|
@change="wm_inChange($index)"
|
||||||
|
style="width: 140px;">
|
||||||
|
<el-option
|
||||||
|
v-for="item in wprOptions"
|
||||||
|
:disabled="item.disabled"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.number"
|
||||||
|
:value="item.id"
|
||||||
>
|
>
|
||||||
</el-input-number>
|
</el-option>
|
||||||
</el-form-item>
|
</el-select>
|
||||||
|
<span style="margin: 0 20px;">数量:{{ listItem.count }}</span>
|
||||||
|
<el-button v-if="mode!=='show'" type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="2" v-if="mode!=='show'">
|
<el-col :span="24" style="padding-left: 80px;margin-bottom: 20px;margin-top: -5px;">
|
||||||
<el-button type="danger" icon="el-icon-delete" @click="delMaterial($index)"></el-button>
|
<div v-for="(item2,index2) in form.handoverb[$index].handoverbw" :key="item2.wpr" class="wprItem">
|
||||||
|
<span>{{ item2.number }}</span>
|
||||||
|
<el-icon class="circleCloseFilled" @click="deleteWpr($index,index2,item2.wpr)"><el-icon-circleClose-filled /></el-icon>
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
|
@ -100,15 +111,11 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectItems:[],
|
|
||||||
loading: false,
|
|
||||||
mode: "add",
|
mode: "add",
|
||||||
titleMap: {
|
wm_in:"",
|
||||||
20: "分批",
|
|
||||||
30: "合批",
|
|
||||||
},
|
|
||||||
mtype:20,
|
mtype:20,
|
||||||
saveCount:0,
|
lastBatchNum:1,
|
||||||
|
addBactchNum:1,
|
||||||
form: {
|
form: {
|
||||||
send_date: null,
|
send_date: null,
|
||||||
send_user: null,
|
send_user: null,
|
||||||
|
@ -132,8 +139,9 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
batchOrign:{},
|
batchOrign:{},
|
||||||
totalCount: 0,
|
wprOptions: [],
|
||||||
materialOptions: [],
|
materialOptions: [],
|
||||||
|
loading: false,
|
||||||
visible: false,
|
visible: false,
|
||||||
isSaveing: false,
|
isSaveing: false,
|
||||||
setFiltersVisible: false,
|
setFiltersVisible: false,
|
||||||
|
@ -148,67 +156,109 @@ export default {
|
||||||
that.form.send_user = that.form.recive_user= userInfo.id;
|
that.form.send_user = that.form.recive_user= userInfo.id;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getWpr(id){
|
||||||
|
let that = this;
|
||||||
|
that.$API.wpm.wpr.list.req({page:0,wm:id}).then((res) => {
|
||||||
|
that.wprOptions = res;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getNum(batch){
|
||||||
|
let that = this;
|
||||||
|
that.$API.wpm.batchlog.batchesTo.req({batch:batch}).then((res) => {
|
||||||
|
if(res.last_batch_num!==null){
|
||||||
|
that.lastBatchNum = res.last_batch_num;
|
||||||
|
that.addBactchNum = res.last_batch_num+1;
|
||||||
|
}else{
|
||||||
|
that.lastBatchNum = 0;
|
||||||
|
that.addBactchNum = 1;
|
||||||
|
}
|
||||||
|
let obj = { };
|
||||||
|
obj.wm = that.batchOrign.id;
|
||||||
|
obj.batch = that.batchOrign.batch+"-"+that.addBactchNum;
|
||||||
|
that.addBactchNum++;
|
||||||
|
obj.count = 0;
|
||||||
|
obj.handoverbw=[];
|
||||||
|
that.form.handoverb.push(obj);
|
||||||
|
})
|
||||||
|
},
|
||||||
//显示
|
//显示
|
||||||
open(mode = "add",data,mtype) {
|
open(mode = "add",data,mtype) {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.form.mtype = mtype;
|
this.form.mtype = mtype;
|
||||||
this.codeText = data.batch;
|
|
||||||
this.batchOrign = data;
|
this.batchOrign = data;
|
||||||
this.totalCount = data.count;
|
this.getWpr(data.id);
|
||||||
let obj = { };
|
this.getNum(data.batch);
|
||||||
obj.wm = data.id;
|
|
||||||
obj.batch = data.batch+"-1";
|
|
||||||
obj.count = data.count;
|
|
||||||
this.saveCount = 0;
|
|
||||||
this.form.handoverb.push(obj)
|
|
||||||
this.visible = true;
|
this.visible = true;
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
wm_inChange(index){
|
||||||
|
let that = this;
|
||||||
|
//放入对应的行中的handoverb中,并且在列表中disabled
|
||||||
|
that.wprOptions.forEach(item=>{
|
||||||
|
if(item.id == that.form.handoverb[index].wpr){
|
||||||
|
let obj = {};
|
||||||
|
obj.number = item.number;
|
||||||
|
obj.wpr = item.id;
|
||||||
|
item.disabled = true;
|
||||||
|
that.form.handoverb[index].handoverbw.push(obj);
|
||||||
|
that.form.handoverb[index].wpr = '';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
that.form.handoverb[index].count = that.form.handoverb[index].handoverbw.length;
|
||||||
|
},
|
||||||
|
formWminChange(index,number){
|
||||||
|
let that = this;
|
||||||
|
//放入对应的行中的handoverb中,并且在列表中disabled
|
||||||
|
that.wprOptions.forEach(item=>{
|
||||||
|
if(item.number== number){
|
||||||
|
if(item.disabled){
|
||||||
|
that.$message.error("该物料已被分配");
|
||||||
|
that.form.handoverb[index].wpr = '';
|
||||||
|
}else{
|
||||||
|
item.disabled = true;
|
||||||
|
let obj = {};
|
||||||
|
obj.number = item.number;
|
||||||
|
obj.wpr = item.id;
|
||||||
|
that.form.handoverb[index].handoverbw.push(obj);
|
||||||
|
that.form.handoverb[index].count = that.form.handoverb[index].handoverbw.length;
|
||||||
|
that.form.handoverb[index].wpr = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
deleteWpr(index1,index2,wpr){
|
||||||
|
let that = this;
|
||||||
|
that.wprOptions.forEach(item=>{
|
||||||
|
if(item.id == wpr){
|
||||||
|
item.disabled = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
that.form.handoverb[index1].handoverbw.splice(index2,1);
|
||||||
|
that.form.handoverb[index1].count = that.form.handoverb[index1].handoverbw.length;
|
||||||
|
},
|
||||||
batchAdd(){
|
batchAdd(){
|
||||||
let that = this;
|
let that = this;
|
||||||
if(that.saveCount>0){
|
|
||||||
let indexs = that.form.handoverb.length+1;
|
|
||||||
let count = 0;
|
|
||||||
that.form.handoverb.forEach(item=>{
|
|
||||||
count+=item.count;
|
|
||||||
})
|
|
||||||
let obj = { };
|
let obj = { };
|
||||||
obj.wm = that.batchOrign.id;
|
obj.wm = that.batchOrign.id;
|
||||||
obj.batch = that.codeText+"-"+indexs;
|
obj.batch = that.batchOrign.batch+"-"+that.addBactchNum;
|
||||||
obj.count = that.batchOrign.count - count;
|
that.addBactchNum++;
|
||||||
that.saveCount = 0;
|
obj.count =0;
|
||||||
|
obj.handoverbw=[];
|
||||||
that.form.handoverb.push(obj)
|
that.form.handoverb.push(obj)
|
||||||
}else{
|
|
||||||
that.$message.warning("已无可分配数量");
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
delMaterial(index){
|
delMaterial(index){
|
||||||
this.form.handoverb.splice(index,1);
|
|
||||||
this.countChange();
|
|
||||||
},
|
|
||||||
|
|
||||||
countChange(index){
|
|
||||||
let that = this;
|
let that = this;
|
||||||
let totalCount = 0;
|
//解除该记录的wpr的disabled
|
||||||
if(this.form.handoverb.length>0){
|
if(that.form.handoverb[index].handoverbw.length>0){
|
||||||
this.form.handoverb.forEach(item=>{
|
that.form.handoverb[index].handoverbw.forEach(item=>{
|
||||||
totalCount += item.count;
|
that.wprOptions.forEach(item2=>{
|
||||||
})
|
if(item2.id == item.wpr){
|
||||||
let saveCount = that.batchOrign.count-totalCount;
|
item2.disabled = false;
|
||||||
if(saveCount<0){//数量不能大于总数量
|
|
||||||
this.form.handoverb[index].count = 0;
|
|
||||||
let total = 0;
|
|
||||||
this.form.handoverb.forEach(item=>{
|
|
||||||
total += item.count;
|
|
||||||
})
|
|
||||||
this.form.handoverb[index].count = that.batchOrign.count-total;
|
|
||||||
that.saveCount = 0;
|
|
||||||
}else{
|
|
||||||
that.saveCount = that.batchOrign.count-totalCount;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
that.form.handoverb.splice(index,1);
|
||||||
},
|
},
|
||||||
//提交
|
//提交
|
||||||
submit() {
|
submit() {
|
||||||
|
@ -267,4 +317,21 @@ export default {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
line-height: 50px;
|
line-height: 50px;
|
||||||
}
|
}
|
||||||
|
.wprItem{
|
||||||
|
background: #eeeeee;
|
||||||
|
padding: 0 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
.circleCloseFilled{
|
||||||
|
position: absolute;
|
||||||
|
top: -7px;
|
||||||
|
right: -10px;
|
||||||
|
color: red;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -82,9 +82,9 @@
|
||||||
prop="batch"
|
prop="batch"
|
||||||
min-width="120"
|
min-width="120"
|
||||||
>
|
>
|
||||||
<!-- <template #default="scope">
|
<template #default="scope">
|
||||||
<el-link @click="rowClick(scope.row)" type="primary">{{scope.row.batch}}</el-link>
|
<el-link @click="rowClick(scope.row)" type="primary">{{scope.row.batch}}</el-link>
|
||||||
</template> -->
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="部门/工段"
|
label="部门/工段"
|
||||||
|
|
|
@ -83,9 +83,9 @@
|
||||||
prop="batch"
|
prop="batch"
|
||||||
min-width="120"
|
min-width="120"
|
||||||
>
|
>
|
||||||
<!-- <template #default="scope">
|
<template #default="scope">
|
||||||
<el-link @click="rowClick(scope.row)" type="primary">{{scope.row.batch}}</el-link>
|
<el-link @click="rowClick(scope.row)" type="primary">{{scope.row.batch}}</el-link>
|
||||||
</template> -->
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="部门/工段"
|
label="部门/工段"
|
||||||
|
|
Loading…
Reference in New Issue