半成品盘点

This commit is contained in:
2023-07-03 14:11:31 +08:00
parent 8f43c079b9
commit 6e5fb6b057
14 changed files with 221 additions and 26 deletions

View File

@@ -152,10 +152,16 @@ export const accMul = (arg1, arg2) => {
* 小数除法
*/
export const accDiv = (arg1, arg2) => {
var m = 0
var s1 = arg1.toString()
var s2 = arg2.toString()
try { m += s1.split('.')[1].length } catch (e) {}
try { m += s2.split('.')[1].length } catch (e) {}
return Number(s1.replace('.', '')) / Number(s2.replace('.', '')) / Math.pow(10, m)
var t1 = 0
var t2 = 0
var r1, r2
try {
t1 = arg1.toString().split('.')[1].length
} catch (e) {}
try {
t2 = arg2.toString().split('.')[1].length
} catch (e) {}
r1 = Number(arg1.toString().replace('.', ''))
r2 = Number(arg2.toString().replace('.', ''))
return (r1 / r2) * Math.pow(10, t2 - t1)
}

View File

@@ -152,7 +152,7 @@ export default {
let res = await handLogin(this.loginname, encrypt(this.password))
this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user))
this.$store.dispatch('saveToken', res.token)
this.$router.push('/workorderassignment')
this.$router.push('/home')
this.disabled = false
} catch (e) {
this.disabled = false

View File

@@ -36,8 +36,10 @@ export default {
},
created () {
this.$store.dispatch('setMaterObj', '')
this.$store.dispatch('setMaterArr', [])
this.$store.dispatch('setKeepAlive', [])
localStorage.removeItem('materObj')
localStorage.removeItem('materArr')
localStorage.removeItem('keepAlive')
this._authority()
},
@@ -55,7 +57,7 @@ export default {
toPage2 (e) {
let url = e.path
let name = url.substr(1)
if (name === 'semifinishedinstore' || name === 'semifinishedoutstore') {
if (name === 'semifinishedinstore' || name === 'semifinishedoutstore' || name === 'semifinishedcheck') {
this.$store.dispatch('setKeepAlive', [name])
}
this.$router.push(url)

View File

@@ -26,7 +26,7 @@ export default {
},
computed: {
title () {
let res = ['半成品入库', '半成品入库查询', '半成品出库', '半成品出库查询', '半成品盘点', '半成品盘点查询', '半成品拼盘查询', '物料查询', '物料查询'][Number(this.$route.meta.guidePath) - 1]
let res = ['半成品入库', '半成品入库查询', '半成品出库', '半成品出库查询', '半成品盘点', '半成品盘点查询', '半成品拼盘查询', '物料查询', '物料查询', '货位物料查询'][Number(this.$route.meta.guidePath) - 1]
return res
},
...mapGetters(['keepAlive'])

View File

@@ -48,7 +48,7 @@
</div>
</div>
<div class="search-item_2 flexend">
<button class="button button--primary">添加盘点物料</button>
<button class="button button--primary" @click="searchMater">添加盘点物料</button>
<button class="button button--primary">删除一行</button>
<button class="button button--primary">生产盘点单</button>
<button class="button button--primary">盘点作业</button>
@@ -71,16 +71,16 @@
</tr>
</thead>
<tbody>
<tr v-for="(e, i) in [1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7]" :key="i">
<td>序号</td>
<td>序号</td>
<td>序号</td>
<td>序号</td>
<td>序号</td>
<td>序号</td>
<td>序号</td>
<td>序号</td>
<td>序号</td>
<tr v-for="(e, i) in dataList" :key="e.struct_name" :class="{'selected_icon': pkId === e.struct_name}" @click="toRadio(e)">
<td>{{ i + 1 }}</td>
<td>{{ e.sect_name }}</td>
<td>{{e.struct_name}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.canuse_qty | numeric(3)}}</td>
<td>{{ e.unit_weight | numeric(3) }}</td>
<td>{{ e.base_qty | numeric(3) }}</td>
<td>{{ e.storagevehicle_code }}</td>
</tr>
</tbody>
</table>
@@ -89,8 +89,10 @@
</template>
<script>
import {accMul, accDiv} from '@config/utils.js'
import {checkGetBcpStor} from '@config/getData2.js'
export default {
name: 'semifinishedcheck',
data () {
return {
options1: [],
@@ -101,11 +103,31 @@ export default {
value3: ''
}
},
beforeRouteLeave (to, from, next) {
if (to.path === '/home' || to.path === '/login') {
this.$store.dispatch('setKeepAlive', [])
}
next()
},
activated () {
if (this.$store.getters.materArr.length > 0) {
this.dataList = [...this.dataList, ...this.$store.getters.materArr]
this.dataList.map(el => {
let res = accMul(el.canuse_qty, el.unit_weight)
res = accDiv(res, 1000)
this.$set(el, 'base_qty', res)
})
}
},
methods: {
// 仓库下拉框
async _checkGetBcpStor () {
let res = await checkGetBcpStor()
this.options1 = [...res.data]
},
searchMater () {
this.$store.dispatch('setMaterObj', '')
this.$router.push('/structmatersearch')
}
}
}

View File

@@ -113,6 +113,9 @@ export default {
this.pkObj = this.pkId === e.material_code ? e : {}
},
toSure () {
if (!this.pkId) {
return
}
this.$store.dispatch('setMaterObj', JSON.stringify(this.pkObj))
this.colseUp()
},

View File

@@ -43,13 +43,13 @@
<div class="search-item">
<div class="search-label">物料</div>
<div class="filter_input_wraper">
<input type="text" class="filter-input">
<input type="text" class="filter-input" v-model="material_code">
</div>
</div>
<div class="search-item">
<div class="search-label">载具号</div>
<div class="filter_input_wraper">
<input type="text" class="filter-input">
<input type="text" class="filter-input" v-model="storagevehicle_code">
</div>
</div>
<div class="search-item flexend" style="width: 100%">

View File

@@ -31,7 +31,7 @@
<div class="search-item">
<div class="search-label">物料</div>
<div class="filter_input_wraper pointer" @click="searchMater">
<input type="text" class="filter-input" v-model="material_code">
<input type="text" class="filter-input" v-model="material_code" disabled>
</div>
</div>
<div class="search-item">

View File

@@ -34,6 +34,7 @@
<th>货位</th>
<th>物料编号</th>
<th>物料名称</th>
<th>物料规格</th>
<th>数量</th>
<th>单重(g)</th>
<th>载具号</th>
@@ -45,6 +46,7 @@
<td>{{e.struct_name}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{ e.material_spec }}</td>
<td>{{e.canuse_qty | numeric(3)}}</td>
<td>{{ e.unit_weight | numeric(3) }}</td>
<td>{{ e.storagevehicle_code }}</td>
@@ -113,6 +115,9 @@ export default {
this.pkObj = this.pkId === e.struct_name ? e : {}
},
toSure () {
if (!this.pkId) {
return
}
this.$store.dispatch('setMaterObj', JSON.stringify(this.pkObj))
this.colseUp()
},

View File

@@ -31,7 +31,7 @@
<div class="search-item">
<div class="search-label">物料</div>
<div class="filter_input_wraper pointer" @click="searchMater">
<input type="text" class="filter-input" v-model="material_code">
<input type="text" class="filter-input" v-model="material_code" disabled>
</div>
</div>
<div class="search-item">
@@ -73,7 +73,7 @@
<div class="search-item">
<div class="search-label">出库点</div>
<div class="filter_input_wraper">
<el-select v-model="value3" filterable clearable placeholder="请选择" disabled>
<el-select v-model="value3" filterable clearable placeholder="请选择">
<el-option
v-for="item in options3"
:key="item.point_code"
@@ -145,7 +145,7 @@ export default {
this.material_id = JSON.parse(this.$store.getters.materObj).material_id
this.material_code = JSON.parse(this.$store.getters.materObj).material_code
this.material_spec = JSON.parse(this.$store.getters.materObj).material_spec
this.unit_weight = Number(JSON.parse(this.$store.getters.materObj).net_weight).toFixed(3)
this.unit_weight = Number(JSON.parse(this.$store.getters.materObj).unit_weight).toFixed(3)
this.qty = Number(JSON.parse(this.$store.getters.materObj).canuse_qty).toFixed(3)
this.struct_code = JSON.parse(this.$store.getters.materObj).struct_name
this.storagevehicle_code = JSON.parse(this.$store.getters.materObj).storagevehicle_code

View File

@@ -0,0 +1,142 @@
<template>
<div class="order-wraper">
<div class="search-confirm-wrap">
<div class="search-wrap">
<div class="search-item">
<div class="search-label">货位</div>
<div class="filter_input_wraper">
<input type="text" class="filter-input" v-model="val1">
</div>
</div>
<div class="search-item">
<div class="search-label">物料</div>
<div class="filter_input_wraper">
<input type="text" class="filter-input" v-model="val2">
</div>
</div>
<div class="search-item flexend">
<button class="button button--primary" @click="_checkGetMaterialIvt">查询</button>
<button class="button button--primary" :class="{'button--defalut': checkArr.length === 0}" @click="toSure">确定</button>
<button class="button button--primary" @click="clearUp">清除</button>
<button class="button button--primary" @click="colseUp">关闭</button>
</div>
</div>
</div>
<div class="grid_wraper" v-infinite-scroll="loadMore" infinite-scroll-disabled="busy" infinite-scroll-distance="0" infinite-scroll-immediate-check="false">
<table class="filter-table">
<thead>
<tr>
<th>选择</th>
<th>库区</th>
<th>货位</th>
<th>物料编号</th>
<th>物料名称</th>
<th>数量</th>
<th>单重(g)</th>
<th>载具号</th>
</tr>
</thead>
<tbody>
<tr v-for="e in dataList" :key="e.struct_name" @click="toRadio(e)">
<td>
<button class="iconfont select_icon select_square_icon" :class="e.checked ? 'selected_icon' : 'unselect_icon'"></button>
</td>
<td>{{ e.sect_name }}</td>
<td>{{e.struct_name}}</td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
<td>{{e.canuse_qty | numeric(3)}}</td>
<td>{{ e.unit_weight | numeric(3) }}</td>
<td>{{ e.storagevehicle_code }}</td>
</tr>
</tbody>
</table>
<div class="loading-tips">{{desc}}</div>
</div>
</div>
</template>
<script>
import {checkGetMaterialIvt} from '@config/getData2.js'
export default {
data () {
return {
val1: '',
val2: '',
dataList: [],
checkArr: [],
page: 1,
size: '30',
busy: false,
desc: ''
}
},
created () {
this._checkGetMaterialIvt()
},
methods: {
// grid
async _checkGetMaterialIvt () {
this.page = 1
this.busy = false
this.desc = ''
let res = await checkGetMaterialIvt(this.val2, this.val1, this.page + '', this.size)
this.dataList = []
res.data.map(el => {
this.$set(el, 'checked', false)
})
this.dataList = [...res.data]
if (res.data.length < 30) {
this.busy = true
this.desc = '已加载全部数据'
}
},
async loadMore () {
this.busy = true
this.page++
let res = await checkGetMaterialIvt(this.val2, this.val1, this.page + '', this.size)
res.data.map(el => {
this.$set(el, 'checked', false)
})
this.dataList = [...this.dataList, ...res.data]
if (res.data.length < 30) {
this.busy = true
this.desc = '已加载全部数据'
} else {
this.busy = false
}
},
colseUp () {
this.$router.push('/semifinishedcheck')
},
toSure () {
if (this.checkArr.length === 0) {
return
}
this.$store.dispatch('setMaterArr', this.checkArr)
this.colseUp()
},
clearUp () {
this.checkArr = []
},
toRadio (e) {
e.checked = !e.checked
this.checkArr = this.dataList.filter(i => { return i.checked === true })
}
}
}
</script>
<style lang="stylus" scoped>
@import '~@style/mixin.styl'
.search-item
width 27%
&:nth-child(3)
width 42%
.filter_radius
_fj()
margin-right 15px
.filter_radius_label
margin-left 5px
_font(12px, 30px, #fff,,)
</style>

View File

@@ -21,6 +21,7 @@ const semiFinishedCheckSearch = r => require.ensure([], () => r(require('@page/m
const semiFinishedComposeSearch = r => require.ensure([], () => r(require('@page/modules/semifinished/semi-finished-compose-search')), 'semifinished')
const semiFinishedInmaterSearch = r => require.ensure([], () => r(require('@page/modules/semifinished/semi-finished-in-mater-search')), 'semifinished')
const semiFinishedOutMaterSearch = r => require.ensure([], () => r(require('@page/modules/semifinished/semi-finished-out-mater-search')), 'semifinished')
const structMaterSearch = r => require.ensure([], () => r(require('@page/modules/semifinished/struct-mater-search')), 'semifinished')
const Homeset = r => require.ensure([], () => r(require('@page/homeset/index')), 'Homeset')
const Home = r => require.ensure([], () => r(require('@page/homeset/HomePage')), 'HomePage')
@@ -116,6 +117,10 @@ export default new Router({
path: '/semifinishedoutmatersearch',
component: semiFinishedOutMaterSearch,
meta: {guidePath: '9'}
}, {
path: '/structmatersearch',
component: structMaterSearch,
meta: {guidePath: '10'}
}]
},
{

View File

@@ -4,6 +4,7 @@ import { getStore, setStore } from '@config/utils.js'
const state = {
keepAlive: JSON.parse(getStore('keepAlive')) || [], // 缓存页面
materObj: getStore('materObj') || '', // 存储对象
materArr: JSON.parse(getStore('materArr')) || [], // 存储数组
deviceUuid: getStore('deviceUuid') || '',
deviceCode: getStore('deviceCode') || '',
isProductonplan: getStore('isProductonplan') || ''
@@ -12,6 +13,7 @@ const state = {
const getters = {
keepAlive: state => state.keepAlive,
materObj: state => state.materObj,
materArr: state => state.materArr,
deviceUuid: state => state.deviceUuid,
deviceCode: state => state.deviceCode,
isProductonplan: state => state.isProductonplan
@@ -26,6 +28,10 @@ const actions = {
setStore('materObj', res)
commit(types.SET_MATER_OBJ, res)
},
setMaterArr ({commit}, res) {
setStore('materArr', res)
commit(types.SET_MATER_ARR, res)
},
setDevice ({commit}, res) {
setStore('deviceUuid', res.deviceUuid)
setStore('deviceCode', res.deviceCode)
@@ -44,6 +50,9 @@ const mutations = {
[types.SET_MATER_OBJ] (state, res) {
state.materObj = res
},
[types.SET_MATER_ARR] (state, res) {
state.materArr = res
},
[types.DATA_DEVICE] (state, res) {
state.deviceUuid = res.deviceUuid
state.deviceCode = res.deviceCode

View File

@@ -15,6 +15,7 @@ export const SAVE_TOKEN = 'SAVE_TOKEN'
// 缓存页面
export const SET_KEEP_ALIVE = 'SET_KEEP_ALIVE'
export const SET_MATER_ARR = 'SET_MATER_ARR'
// 数据
export const SET_MATER_OBJ = 'SET_MATER_OBJ'