出入库

This commit is contained in:
2023-04-12 20:07:02 +08:00
parent a22f301eff
commit ccd0c28b84
8 changed files with 243 additions and 184 deletions

View File

@@ -11,7 +11,7 @@
</view>
<view class="search-item search-item-btns">
<button class="confirm-button" @tap="toSearch">查询</button>
<button class="confirm-button" :class="{'confirm-button_disabled': !pkId || !index2 || !val1}" :disabled="disabled" @tap="toSure">确认</button>
<button class="confirm-button" :class="{'confirm-button_disabled': checkArr.length === 0}" :disabled="disabled" @tap="toSure">确认</button>
</view>
</view>
</view>
@@ -29,27 +29,28 @@
</tr>
</thead>
<tbody>
<tr v-for="e in dataList" :key="e.position_code" @click="toRadio(e)">
<tr v-for="e in dataList" :key="e.sale_code" :class="{'checked': e.checked}">
<td>
<view class="iconfont icon-check" :class="{'icon-checked': pkId === e.position_code}"></view>
<view class="iconfont icon_unchecked" :class="{'icon_checked': e.checked}" @tap="toCheck(e)">&#xe608;</view>
</td>
<td>{{e.cacheline_code}}</td>
<td>{{e.position_code}}</td>
<td>{{e.vehicle_code}}</td>
<td></td>
<td></td>
<td></td>
<td>{{e.order_line_code}}</td>
<td>{{e.material_spec}}</td>
<td>{{e.sale_qty}}</td>
<td><input type="number" class="search-input-l" :class="{'bgr': e.bgr === true}" v-model="e.in_qty"></td>
<td>{{e.material_code}}</td>
<td>{{e.material_name}}</td>
</tr>
</tbody>
</table>
</view>
<uni-load-more color="#007AFF" iconType="circle" :status="status" :icon-size="14" :content-text="contentText" v-if="dataList.length > 0"/>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import {getCacheLine, inOutExceptionInstQuery, inOutExceptionInstConfirm} from '@/utils/getData2.js'
import {orderSearch} from '@/utils/getData2.js'
export default {
components: {
NavBar,
@@ -60,71 +61,79 @@
val1: '',
dataList: [],
pkId: '',
disabled: false
disabled: false,
reload: false,
status: 'more',
contentText: {
contentdown: '查看更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
totalCount: 0,
pageNum: 1,
pageSize: 10,
checkArr: []
};
},
methods: {
toSearch () {
this.dataList = []
this.pkId = ''
this._inOutExceptionInstQuery()
this.pageNum = 1
this._orderSearch()
},
async _getCacheLine (id) {
let res = await getCacheLine(id)
this.options2 = [...res]
/** 初始化查询 */
async _orderSearch () {
let res = await orderSearch(this.val1, this.pageNum + '', this.pageSize + '')
this.totalCount = res.totalElements
if (res.totalElements > 0) {
res.content.map(el => {
this.$set(el, 'checked', false)
this.$set(el, 'bgr', false)
this.$set(el, 'in_qty', '0.000')
})
const dataMap = res.content
this.dataList = this.reload ? dataMap : this.dataList.concat(dataMap)
this.reload = false
} else {
this.dataList = []
}
if (this.totalCount == this.dataList.length) {
this.reload = false
this.status = 'noMore'
}
},
async _inOutExceptionInstQuery () {
let res = await inOutExceptionInstQuery(this.index2)
this.dataList = [...res]
onReachBottom () {
if (this.totalCount > this.dataList.length) {
this.status = 'loading'
setTimeout(() => {
this.pageNum++
this._orderSearch()
}, 1000)
} else { //停止加载
this.status = 'noMore'
}
},
async toSure () {
this.disabled = true
if (!this.pkId) {
uni.showToast({
title: '请选择',
icon: 'none'
let flag = false
this.dataList.map(el => {
if (el.checked && (Number(el.in_qty) < 0 || el.in_qty === '')) {
this.$set(el, 'bgr', true)
flag = true
}
})
this.disabled = false
return
}
if (!this.index2) {
uni.showToast({
title: '请选择缓存线',
icon: 'none'
})
this.disabled = false
return
}
if (!this.index3) {
uni.showToast({
title: '请选择位置类型',
icon: 'none'
})
this.disabled = false
return
}
if (!this.val1) {
uni.showToast({
title: '请扫满箱码',
icon: 'none'
})
this.disabled = false
return
}
try {
let res = await inOutExceptionInstConfirm(this.index2, this.val1, this.pkId, this.index3)
this.disabled = false
this.toSearch()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
if (flag) {
return
}
if (this.checkArr.length) {
this.$store.dispatch('setPublicArr', this.checkArr)
uni.redirectTo({
url: '/pages/management/FinishedInStore'
})
}
},
toRadio (e) {
this.pkId = this.pkId === e.position_code ? '' : e.position_code
toCheck (e) {
e.checked = !e.checked
this.checkArr = this.dataList.filter(i => { return i.checked === true })
},
goIn () {
uni.redirectTo({