半成品入库

This commit is contained in:
2023-06-30 14:48:20 +08:00
parent 59caf057ae
commit 418fff67b6
8 changed files with 146 additions and 26 deletions

View File

@@ -123,9 +123,15 @@ export const getBcpStor = () => post('api/pda/bcp/in/getBcpStor', {})
// 1.2单据类型下拉框
export const getBillType = () => post('api/pda/bcp/in/getBillType', {})
// 1.3物料选择页面
export const getMaterial = (code) => post('api/pda/bcp/in/getMaterial', {
material_code: code
})
// export const getMaterial = (code) => post('api/pda/bcp/in/getMaterial', {
// material_code: code
// })
export const getMaterial = (code) => {
let res = {
data: [{material_code: '1', material_name: 'a', material_spec: '001', class_code: '1', net_weight: '100', unit_name: 'g'}]
}
return res
}
// 1.4入库点下拉框
export const getPoint = () => post('api/pda/bcp/in/getPoint', {})
// 1.5呼叫空载具(按钮)

View File

@@ -147,3 +147,15 @@ export const accMul = (arg1, arg2) => {
try { m += s2.split('.')[1].length } catch (e) {}
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m)
}
/**
* 小数除法
*/
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)
}

View File

@@ -35,6 +35,7 @@ export default {
}
},
created () {
this.$store.dispatch('setMaterObj', '')
this._authority()
},
methods: {

View File

@@ -23,8 +23,8 @@
</div>
<div class="search-item_2 flexend">
<button class="button button--primary" @click="_getMaterial">快速查询</button>
<button class="button button--primary">确定</button>
<button class="button button--primary">清除</button>
<button class="button button--primary" :class="{'button--defalut': pkId === ''}" @click="toSure">确定</button>
<button class="button button--primary" @click="clearUp">清除</button>
<button class="button button--primary" @click="colseUp">关闭</button>
</div>
</div>
@@ -62,7 +62,7 @@ export default {
options1: [],
value1: '',
val1: '',
dataList: [{material_code: '1'}],
dataList: [],
pkId: '',
pkObj: {}
}
@@ -71,10 +71,10 @@ export default {
this._getMaterial()
},
methods: {
// 仓库下拉框
// grid
async _getMaterial () {
let res = await getMaterial(this.val1)
this.options1 = [...res.data]
this.dataList = [...res.data]
},
colseUp () {
this.$router.push('/semifinishedinstore')
@@ -82,6 +82,14 @@ export default {
toRadio (e) {
this.pkId = this.pkId === e.material_code ? '' : e.material_code
this.pkObj = this.pkId === e.material_code ? e : {}
},
toSure () {
this.$store.dispatch('setMaterObj', JSON.stringify(this.pkObj))
this.colseUp()
},
clearUp () {
this.pkId = ''
this.pkObj = {}
}
}
}

View File

@@ -31,31 +31,31 @@
<div class="search-item">
<div class="search-label">物料</div>
<div class="filter_input_wraper pointer" @click="searchMater">
<input type="text" class="filter-input" disabled v-model="val1">
<input type="text" class="filter-input" disabled 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" v-model="val2">
<input type="text" class="filter-input" v-model="material_spec" disabled>
</div>
</div>
<div class="search-item">
<div class="search-label">重量(kg)</div>
<div class="filter_input_wraper">
<input type="number" class="filter-input">
<input type="number" class="filter-input" v-model="total_qty">
</div>
</div>
<div class="search-item">
<div class="search-label">单重(g)</div>
<div class="filter_input_wraper">
<input type="number" class="filter-input">
<input type="number" class="filter-input" v-model="unit_weight">
</div>
</div>
<div class="search-item">
<div class="search-label">数量</div>
<div class="filter_input_wraper">
<input type="number" class="filter-input">
<input type="number" class="filter-input" v-model="qty" disabled>
</div>
</div>
<div class="search-item">
@@ -64,9 +64,9 @@
<el-select v-model="value3" filterable clearable placeholder="请选择">
<el-option
v-for="item in options3"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code">
:key="item.point_code"
:label="item.point_name"
:value="item.point_code">
</el-option>
</el-select>
</div>
@@ -74,21 +74,21 @@
<div class="search-item">
<div class="search-label">载具号</div>
<div class="filter_input_wraper filter_input_wraper_1">
<input type="text" class="filter-input">
<input type="text" class="filter-input" v-model="storagevehicle_code">
</div>
<div class="filter_button">
<button class="button button--primary">呼叫空载具</button>
<button class="button button--primary" :disabled="disabled1" @click="_callVehicle">呼叫空载具</button>
</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="remark">
</div>
</div>
<div class="search-item_2">
<button class="button button--primary">作业查询</button>
<button class="button button--primary">确认入库</button>
<button class="button button--primary" :disabled="disabled2" :class="{'button--defalut': value1 === '' || value2 === '' || value3 === '' || material_code === '' || total_qty === '' || unit_weight === '' || storagevehicle_code === ''}" @click="toSure">确认入库</button>
<button class="button button--primary" @click="toJumpSearch">作业查询</button>
</div>
</div>
</div>
@@ -96,7 +96,8 @@
</template>
<script>
import {getBcpStor, getBillType} from '@config/getData2.js'
import {getBcpStor, getBillType, getPoint, callVehicle, createIn} from '@config/getData2.js'
import {accMul, accDiv} from '@config/utils.js'
export default {
name: 'semifinishedinstore',
data () {
@@ -107,8 +108,23 @@ export default {
value2: '',
options3: [],
value3: '',
val1: '',
val2: ''
material_id: '',
material_code: '',
material_spec: '',
total_qty: '',
unit_weight: '',
storagevehicle_code: '',
remark: '',
disabled1: false,
disabled2: false
}
},
computed: {
qty () {
let res = ''
let res1 = accMul(this.total_qty, 1000)
res = accDiv(res1, this.unit_weight)
return res
}
},
beforeRouteLeave (to, from, next) {
@@ -118,7 +134,12 @@ export default {
next()
},
activated () {
// this.val2 = this.$store.getters.materObj.material_name
if (this.$store.getters.materObj !== '') {
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 = JSON.parse(this.$store.getters.materObj).net_weight
}
},
created () {
this._getBcpStor()
@@ -133,10 +154,69 @@ export default {
// 单据类型下拉框
async _getBillType () {
let res = await getBillType()
this.options3 = [...res.data]
},
// 入库点下拉框
async _getPoint () {
let res = await getPoint()
this.options2 = [...res.data]
},
// 呼叫空载具
async _callVehicle () {
this.disabled1 = true
try {
let res = await callVehicle()
this.toast(res.message)
this.disabled1 = false
} catch (e) {
this.disabled1 = false
}
},
// 确认入库
async toSure () {
this.disabled2 = true
if (this.value1 === '' || this.value2 === '' || this.value3 === '' || this.material_code === '' || this.total_qty === '' || this.unit_weight === '' || this.storagevehicle_code === '') {
this.disabled2 = false
return
}
try {
let from = {
stor_id: this.value1,
bill_type: this.value2,
material_id: this.material_id,
material_code: this.material_code,
material_spec: this.material_spec,
total_qty: this.total_qty,
unit_weight: this.unit_weight,
qty: this.qty,
point_code: this.value3,
storagevehicle_code: this.storagevehicle_code,
remark: this.remark
}
let res = await createIn(from)
this.toast(res.message)
this.value1 = ''
this.value2 = ''
this.value3 = ''
this.material_id = ''
this.material_code = ''
this.material_spec = ''
this.total_qty = ''
this.unit_weight = ''
this.storagevehicle_code = ''
this.remark = ''
this.disabled2 = false
this.$store.dispatch('setMaterObj', '')
} catch (e) {
this.disabled2 = false
}
},
searchMater () {
this.$store.dispatch('setMaterObj', '')
this.$router.push('/matersearch')
},
toJumpSearch () {
this.$router.push('/semifinishedinstoresearch')
}
}
}

View File

@@ -216,6 +216,8 @@ header
padding 0 10px
border-radius 4px
background-color #fff
&:disabled
background-color #c9c9c9
.grid_wraper
_wh(100%, calc(100% - 55px))
border-radius 5px

View File

@@ -2,7 +2,8 @@ import * as types from '../types'
import { getStore, setStore } from '@config/utils.js'
const state = {
keepAlive: [], // 缓存页面
keepAlive: JSON.parse(getStore('keepAlive')) || [], // 缓存页面
materObj: getStore('materObj') || '', // 存储对象
deviceUuid: getStore('deviceUuid') || '',
deviceCode: getStore('deviceCode') || '',
isProductonplan: getStore('isProductonplan') || ''
@@ -10,6 +11,7 @@ const state = {
const getters = {
keepAlive: state => state.keepAlive,
materObj: state => state.materObj,
deviceUuid: state => state.deviceUuid,
deviceCode: state => state.deviceCode,
isProductonplan: state => state.isProductonplan
@@ -17,8 +19,13 @@ const getters = {
const actions = {
setKeepAlive ({commit}, res) {
setStore('keepAlive', res)
commit(types.SET_KEEP_ALIVE, res)
},
setMaterObj ({commit}, res) {
setStore('materObj', res)
commit(types.SET_MATER_OBJ, res)
},
setDevice ({commit}, res) {
setStore('deviceUuid', res.deviceUuid)
setStore('deviceCode', res.deviceCode)
@@ -34,6 +41,9 @@ const mutations = {
[types.SET_KEEP_ALIVE] (state, res) {
state.keepAlive = res
},
[types.SET_MATER_OBJ] (state, res) {
state.materObj = res
},
[types.DATA_DEVICE] (state, res) {
state.deviceUuid = res.deviceUuid
state.deviceCode = res.deviceCode

View File

@@ -17,5 +17,6 @@ export const SAVE_TOKEN = 'SAVE_TOKEN'
export const SET_KEEP_ALIVE = 'SET_KEEP_ALIVE'
// 数据
export const SET_MATER_OBJ = 'SET_MATER_OBJ'
export const DATA_DEVICE = 'DATA_DEVICE'
export const DATA_IS_PROPLAN = 'DATA_IS_PROPLAN'