包装入库

This commit is contained in:
2024-06-07 14:15:39 +08:00
parent 3b4289f914
commit 725e272b0c
5 changed files with 196 additions and 61 deletions

View File

@@ -6,7 +6,43 @@
<view class="filter_item">
<view class="filter_label">钢托盘1编码</view>
<view class="filter_input_wraper">
<search-box v-model="code1" />
<search-box v-model="code[0]" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num[0]">
</view>
</view>
<view class="filter_item">
<view class="filter_label">钢托盘2编码</view>
<view class="filter_input_wraper">
<search-box v-model="code[1]" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num[1]">
</view>
</view>
<view class="filter_item">
<view class="filter_label">钢托盘3编码</view>
<view class="filter_input_wraper">
<search-box v-model="code[2]" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num[2]">
</view>
</view>
<view class="filter_item">
<view class="filter_label">木托盘编码</view>
<view class="filter_input_wraper">
<search-box v-model="code[3]" />
</view>
</view>
<view class="filter_item">
@@ -15,42 +51,6 @@
<input type="number" class="filter_input" v-model="num1">
</view>
</view>
<view class="filter_item">
<view class="filter_label">钢托盘2编码</view>
<view class="filter_input_wraper">
<search-box v-model="code2" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num2">
</view>
</view>
<view class="filter_item">
<view class="filter_label">钢托盘3编码</view>
<view class="filter_input_wraper">
<search-box v-model="code3" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num3">
</view>
</view>
<view class="filter_item">
<view class="filter_label">木托盘编码</view>
<view class="filter_input_wraper">
<search-box v-model="code4" />
</view>
</view>
<view class="filter_item">
<view class="filter_label">物料数量</view>
<view class="filter_input_wraper">
<input type="number" class="filter_input" v-model="num4">
</view>
</view>
</view>
<view class="zd_wrapper grid-wraper">
<view class="slide_new">
@@ -78,8 +78,9 @@
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-11 submit-button" @tap="_manualSortingPackingTaskShow">刷新</button>
<button class="zd-col-11 submit-button" :class="{'btn-disabled': !(((code1 !== '' && num1 !== '') || (code2 !== '' && num2 !== '') || (code3 !== '' && num3 !== '')) && (code4 !== '' && num4 !== ''))}" :disabled="disabled" @tap="toSure">确认</button>
<button class="zd-col-7 submit-button" @tap="clearUp">清空</button>
<button class="zd-col-7 submit-button" @tap="_manualSortingPackingTaskShow">刷新</button>
<button class="zd-col-7 submit-button" :class="{'btn-disabled': !(((code[0] !== '' && num[0] !== '') || (code[1] !== '' && num[1] !== '') || (code[2] !== '' && num[2] !== '')) && (code[3] !== '' && num1 !== ''))}" :disabled="disabled" @tap="toSure">确认</button>
</view>
</view>
</template>
@@ -95,22 +96,40 @@
},
data() {
return {
code1: '',
num1: '',
code2: '',
num2: '',
code3: '',
num3: '',
code4: '',
num4: '',
code: this.$store.getters.codeArr || ['', '', '', ''],
num: this.$store.getters.numArr || ['', '', ''],
num1: this.$store.getters.num || '',
dataList: [],
disabled: false
};
},
watch: {
num () {
let num1 = this.num[0] !== '' ? parseFloat(this.num[0]) : ''
let num2 = this.num[1] !== '' ? parseFloat(this.num[1]) : ''
let num3 = this.num[2] !== '' ? parseFloat(this.num[2]) : ''
this.num1 = num1 + num2 + num3
}
},
created () {
this._manualSortingPackingTaskShow()
// this._manualSortingPackingTaskShow()
if (this.num1 === '') {
let num1 = this.num[0] !== '' ? parseFloat(this.num[0]) : ''
let num2 = this.num[1] !== '' ? parseFloat(this.num[1]) : ''
let num3 = this.num[2] !== '' ? parseFloat(this.num[2]) : ''
this.num1 = num1 + num2 + num3
}
},
beforeDestroy () {
this.$store.dispatch('setCodeArr', this.code)
this.$store.dispatch('setNumArr', this.num)
this.$store.dispatch('setNum', this.num1)
},
methods: {
clearUp () {
this.code = ['', '', '', '']
this.num = ['', '', '', '']
},
/** grid查询 */
async _manualSortingPackingTaskShow () {
let res = await manualSortingPackingTaskShow()
@@ -119,21 +138,13 @@
/** 确认 */
async toSure () {
this.disabled = true
if (!(((this.code1 !== '' && this.num1 !== '') || (this.code2 !== '' && this.num2 !== '') || (this.code3 !== '' && this.num3 !== '')) && (this.code4 !== '' && this.num4 !== ''))) {
if (!(((this.code[0] !== '' && this.num[0] !== '') || (this.code[1] !== '' && this.num[1] !== '') || (this.code[2] !== '' && this.num[2] !== '')) && (this.code[3] !== '' && this.num1 !== ''))) {
this.disabled = false
return
}
try {
let res = await manualSortingPackingTask(this.code1, this.num1, this.code2, this.num2, this.code3, this.num3, this.code4, this.num4)
let res = await manualSortingPackingTask(this.code[0], this.num[0], this.code[1], this.num[1], this.code[2], this.num[2], this.code[3], this.num1)
this.disabled = false
this.code1 = ''
this.num2 = ''
this.code2 = ''
this.num2 = ''
this.code3 = ''
this.num3 = ''
this.code4 = ''
this.num4 = ''
this._manualSortingPackingTaskShow()
uni.showToast({
title: res.message,

View File

@@ -36,4 +36,81 @@ export const dateFtt = date => {
}
return new Date(Date.parse(date))
}
/**
* 小数加法
*/
export const accAdd = (arg1, arg2) => {
var r1, r2, m, c
try {
r1 = arg1.toString().split('.')[1].length
} catch (e) {
r1 = 0
}
try {
r2 = arg2.toString().split('.')[1].length
} catch (e) {
r2 = 0
}
c = Math.abs(r1 - r2)
m = Math.pow(10, Math.max(r1, r2))
if (c > 0) {
var cm = Math.pow(10, c)
if (r1 > r2) {
arg1 = Number(arg1.toString().replace('.', ''))
arg2 = Number(arg2.toString().replace('.', '')) * cm
} else {
arg1 = Number(arg1.toString().replace('.', '')) * cm
arg2 = Number(arg2.toString().replace('.', ''))
}
} else {
arg1 = Number(arg1.toString().replace('.', ''))
arg2 = Number(arg2.toString().replace('.', ''))
}
return (arg1 + arg2) / m
}
/**
* 小数减法
*/
export const accSubtract = (arg1, arg2) => {
var r1, r2, m, c
try {
r1 = arg1.toString().split('.')[1].length
} catch (e) {
r1 = 0
}
try {
r2 = arg2.toString().split('.')[1].length
} catch (e) {
r2 = 0
}
c = Math.abs(r1 - r2)
m = Math.pow(10, Math.max(r1, r2))
if (c > 0) {
var cm = Math.pow(10, c)
if (r1 > r2) {
arg1 = Number(arg1.toString().replace('.', ''))
arg2 = Number(arg2.toString().replace('.', '')) * cm
} else {
arg1 = Number(arg1.toString().replace('.', '')) * cm
arg2 = Number(arg2.toString().replace('.', ''))
}
} else {
arg1 = Number(arg1.toString().replace('.', ''))
arg2 = Number(arg2.toString().replace('.', ''))
}
return (arg1 - arg2) / m
}
/**
* 小数乘法
*/
export const accMul = (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)
}

42
vuex/modules/data.js Normal file
View File

@@ -0,0 +1,42 @@
import * as types from '../types'
const state = {
codeArr: uni.getStorageSync('codeArr') || ['', '', '', ''],
numArr: uni.getStorageSync('numArr') || ['', '', '', ''],
num: uni.getStorageSync('num') || ''
}
const getters = {
codeArr: state => state.codeArr,
numArr: state => state.numArr,
num: state => state.num
}
const actions = {
setCodeArr ({commit}, res) {
uni.setStorageSync('codeArr', res)
commit(types.CODE_ARR, res)
},
setNumArr ({commit}, res) {
uni.setStorageSync('numArr', res)
commit(types.NUM_ARR, res)
},
setNum ({commit}, res) {
uni.setStorageSync('num', res)
commit(types.N_U_M, res)
}
}
const mutations = {
[types.CODE_ARR] (state, res) {
state.codeArr = res
},
[types.NUM_ARR] (state, res) {
state.numArr = res
},
[types.N_U_M] (state, res) {
state.num = res
}
}
export default {
state,
getters,
actions,
mutations
}

View File

@@ -2,11 +2,13 @@ import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import data from './modules/data'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
user
user,
data
}
})

View File

@@ -6,4 +6,7 @@ export const DEL_LOGIN_NAME = 'DEL_LOGIN_NAME'
export const COM_CONFIG = 'COM_CONFIG'
export const SAVE_USER_INFO = 'SAVE_USER_INFO'
export const DEL_USER_INFO = 'DEL_USER_INFO'
export const SAVE_TOKEN = 'SAVE_TOKEN'
export const SAVE_TOKEN = 'SAVE_TOKEN'
export const CODE_ARR = 'CODE_ARR'
export const NUM_ARR = 'NUM_ARR'
export const N_U_M = 'N_U_M'