清洗上料下料

This commit is contained in:
2023-07-13 17:02:17 +08:00
parent 668b470586
commit 30a4bcf9bf
4 changed files with 291 additions and 164 deletions

View File

@@ -8,9 +8,9 @@
<el-select v-model="value1" filterable clearable placeholder="请选择">
<el-option
v-for="item in options1"
:key="item.stor_id"
:label="item.stor_name"
:value="item.stor_id">
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
@@ -18,13 +18,20 @@
<div class="search-item">
<div class="search-label">规格</div>
<div class="filter_input_wraper">
<input type="text" class="filter-input">
<el-select v-model="value2" filterable clearable placeholder="请选择">
<el-option
v-for="item in options2"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
</div>
<div class="search-item flexend">
<button class="button button--primary" @click="searchMater">查询</button>
<button class="button button--primary" :class="{'button--defalut': pkId === ''}" @click="delRow">确认上料</button>
<button class="button button--primary" :disabled="disabled1" :class="{'button--defalut': value1 === '' || dataList.length === 0}" @click="_checkCreate">人工倒料</button>
<button class="button button--primary" @click="_washQuery">查询</button>
<button class="button button--primary" :disabled="disabled1" :class="{'button--defalut': checkArr.length === 0}" @click="_washSubmitWash">确认上料</button>
<button class="button button--primary" @click="toJump">人工倒料</button>
</div>
</div>
</div>
@@ -42,14 +49,16 @@
</tr>
</thead>
<tbody>
<tr v-for="e in dataList" :key="e.struct_name" :class="{'selected_icon': pkId === e.struct_name}" @click="toRadio(e)">
<td>{{ e.sect_name }}</td>
<td>{{e.struct_name}}</td>
<tr v-for="(e, i) in dataList" :key="i" @click="toRadio(e)">
<td>
<button class="iconfont select_icon select_square_icon" :class="e.checked ? 'selected_icon' : 'unselect_icon'"></button>
</td>
<td>{{ e.device_code }}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_spec}}</td>
<td>{{e.canuse_qty | numeric(3)}}</td>
<td>{{ e.qty | numeric(3) }}</td>
<td>{{ e.storagevehicle_code }}</td>
<td>{{e.deviceinstor_qty | numeric(3)}}</td>
<td>{{ e.deviceinstor_weight | numeric(3) }}</td>
<td>{{ e.task_code }}</td>
</tr>
</tbody>
</table>
@@ -58,103 +67,78 @@
</template>
<script>
import {accMul} from '@config/utils.js'
import {checkGetBcpStor, checkCreate} from '@config/getData2.js'
import {dictAll, washSpecList, washQuery, washSubmitWash} from '@config/getData2.js'
export default {
name: 'semifinishedcheck',
data () {
return {
options1: [],
value1: '',
options2: [{device_code: '32', device_name: '临时盘点'}],
value2: '32',
remark: '',
options2: [],
value2: '',
dataList: [],
pkId: '',
pkObj: {},
checkArr: [],
disabled1: false
}
},
beforeRouteLeave (to, from, next) {
if (to.path === '/home' || to.path === '/login') {
this.$store.dispatch('setKeepAlive', [])
}
next()
},
activated () {
if (this.$store.getters.materArr.length > 0) {
let arr = this.$store.getters.materArr
this.removeRepeat(this.dataList, arr)
this.dataList = [...this.dataList, ...arr]
this.dataList.map(el => {
let res = accMul(el.canuse_qty, el.unit_weight)
this.$set(el, 'base_qty', res)
})
}
},
created () {
this._checkGetBcpStor()
this._dictAll()
this._washSpecList()
},
methods: {
// 数组去重
removeRepeat (arr1, arr2) {
for (let i = 0; i < arr1.length; i++) {
for (let j = 0; j < arr2.length; j++) {
if (arr1[i].struct_name === arr2[j].struct_name) {
arr2.splice(j, 1)
j--
}
}
// 车间下拉框
async _dictAll () {
let res = await dictAll()
if (res.code === 200) {
this.options1 = [...res.content]
}
},
// 仓库下拉框
async _checkGetBcpStor () {
let res = await checkGetBcpStor()
this.options1 = [...res.data]
// 规格下拉框
async _washSpecList () {
let res = await washSpecList()
if (res.code === 200) {
this.options2 = [...res.content]
}
},
// 生产盘点单
async _checkCreate () {
// grid
async _washQuery () {
let res = await washQuery(this.value1, this.value2)
if (res.code === 200) {
res.content.map(el => {
this.$set(el, 'checked', false)
})
this.dataList = [...res.content]
}
},
// 确认上料
async _washSubmitWash () {
this.disabled1 = true
if (this.value1 === '' || this.dataList.length === 0) {
if (this.checkArr.length === 0) {
this.disabled1 = false
return
}
try {
let from = {
stor_id: this.value1,
check_type: '32',
remark: this.remark,
rows: this.dataList
let arr = []
this.checkArr.map(el => {
arr.push(el.device_code)
})
let res = await washSubmitWash(arr)
if (res.code === 200) {
this.toast(res.msg)
this.value1 = ''
this.value2 = ''
this._washQuery()
}
let res = await checkCreate(from)
this.toast(res.message)
this.valu1 = ''
this.remark = ''
this.$store.dispatch('setMaterArr', [])
this.dataList = []
this.disabled1 = false
} catch (e) {
this.disabled1 = false
}
},
searchMater () {
this.$store.dispatch('setMaterArr', [])
this.$router.push('/structmatersearch')
},
toJumpSearch () {
toJump () {
this.$router.push('/semifinishedchecksearch')
},
toRadio (e) {
this.pkId = this.pkId === e.struct_name ? '' : e.struct_name
this.pkObj = this.pkId === e.struct_name ? e : {}
},
delRow () {
if (!this.pkId) {
return
}
this.dataList = this.dataList.filter(el => el.struct_name !== this.pkId)
this.$store.dispatch('setMaterArr', this.dataList)
e.checked = !e.checked
this.checkArr = this.dataList.filter(i => { return i.checked === true })
}
}
}