Browse Source

修改按库位查询库存 2024/7/5 17:17:56src/pages/query/location.vue

hella_vue3
zhang_li 3 months ago
parent
commit
ad4adbc25a
  1. 16
      src/api/request2.js
  2. 3
      src/mycomponents/scan/winComScanBalance.vue
  3. 2
      src/pages.json
  4. 2
      src/pages/package/record/overPackageRecord.vue
  5. 43
      src/pages/query/coms/comLocationDetailCard.vue
  6. 99
      src/pages/query/location.vue

16
src/api/request2.js

@ -185,6 +185,22 @@ export function getBalanceByLocationcodeGroup(params) {
export function getBalanceByLocationcode(params) { export function getBalanceByLocationcode(params) {
return http.get("/wms/balance/page",{params}) return http.get("/wms/balance/page",{params})
} }
/**
* 按库位查询 预计入
* @param {*}
*/
export function getExpectInByLocationCode(params) {
return http.post("/wms/expectin/senior",params)
}
/**
* 按库位查询 预计出
* @param {*}
*/
export function getExpectOutByLocationCode(params) {
return http.post("/wms/expectout/senior",params)
}
/** /**
* 查询器具信息接口 * 查询器具信息接口
* @param {*} number 器具代码 * @param {*} number 器具代码

3
src/mycomponents/scan/winComScanBalance.vue

@ -106,7 +106,8 @@ export default {
batch: result.label.batch, batch: result.label.batch,
packingNumber: result.label.packingNumber, packingNumber: result.label.packingNumber,
inventoryStatus: this.fromInventoryStatuses, inventoryStatus: this.fromInventoryStatuses,
areaType: this.fromLocationAreaTypeList areaType: this.fromLocationAreaTypeList,
bussinessCode: this.bussinessCode
} }
getBalanceByParams(params) getBalanceByParams(params)
.then((res) => { .then((res) => {

2
src/pages.json

@ -75,7 +75,7 @@
"path": "pages/query/location", "path": "pages/query/location",
"style": { "style": {
"navigationBarTitleText": "按库位查询库存", "navigationBarTitleText": "按库位查询库存",
"enablePullDownRefresh": false, "enablePullDownRefresh": true,
"titleNView": { "titleNView": {
"autoBackButton": "true", "autoBackButton": "true",
"buttons": [{}] "buttons": [{}]

2
src/pages/package/record/overPackageRecord.vue

@ -52,7 +52,7 @@
</view> </view>
<win-scan-button @goScan="openScanPopup"></win-scan-button> <win-scan-button @goScan="openScanPopup"></win-scan-button>
</view> </view>
<winComScanBalance ref="scanPopup" @getBalance="getScanResult"> </winComScanBalance> <winComScanBalance ref="scanPopup" @getBalance="getScanResult" businesstypeCode="OverPackage"> </winComScanBalance>
<com-message ref="comMessageRef" /> <com-message ref="comMessageRef" />
</view> </view>
</template> </template>

43
src/pages/query/coms/comLocationDetailCard.vue

@ -1,28 +1,45 @@
<template> <template>
<view class="" style="background: white"> <view class="" style="width: 100%; background-color: #fff; border-radius: 10rpx">
<u-collapse ref="collapse1" @change=""> <view class="uni-flex uni-row" style="align-items: center">
<u-collapse-item :open="true"> <text style="font-size: 35rpx; padding-left: 10rpx">物料代码</text>
<view class="split_line"></view> <item :dataContent="dataContent" style="padding-top: 10rpx; margin-left: 10rpx"></item>
<template v-slot:title> </view>
<itemQty :dataContent="dataContent" :isShowBalance="true" style="width;100%; padding: 0px 20rpx"></itemQty>
</template>
<view v-for="(item, index) in dataContent.list"> <view class="uni-flex uni-row space-between" style="align-items: center">
<balance :dataContent="item" :isShowFromLocation="false" :isShowPack="isShowPack" :isShowStdPack="false"> </balance> <view>
<pack v-if="dataContent.parentNumber" title="父包装" :packingCode="dataContent.parentNumber"></pack>
<pack v-if="dataContent.packingNumber" :packingCode="dataContent.packingNumber"></pack>
<batch v-if="isShowBatch && dataContent.batch" :batch="dataContent.batch"></batch>
<view class="" v-if="dataContent.jobNumber" style="font-size: 30rpx; padding-left: 10rpx; padding-bottom: 10rpx">
<text style="color: coral">任务号</text>
{{ dataContent.jobNumber }}
</view>
<view class="" v-if="dataContent.businessType" style="font-size: 30rpx; padding-left: 10rpx; padding-bottom: 10rpx">
<text style="color: green">业务类型</text>
{{ dataContent.businessType }}
</view>
</view>
<view class="uni-flex" style="flex-direction: column">
<view class="uni-flex uni-row center">
<qty :dataContent="dataContent" :isShowStdPack="isShowStdPack" :isShowStatus="true"></qty>
</view>
</view>
</view> </view>
</u-collapse-item>
</u-collapse>
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import itemQty from '@/mycomponents/item/itemQty.vue' import itemQty from '@/mycomponents/item/itemQty.vue'
import balance from '@/mycomponents/balance/balance.vue' import item from '@/mycomponents/item/item.vue'
import pack from '@/mycomponents/balance/pack.vue'
import batch from '@/mycomponents/balance/batch.vue'
import qty from '@/mycomponents/qty/qty.vue'
import status from '@/mycomponents/status/status.vue'
const props = defineProps({ const props = defineProps({
dataContent: { dataContent: {
type: Object, type: Object,
default: {} default: null
}, },
isShowPack: { isShowPack: {
type: Boolean, type: Boolean,

99
src/pages/query/location.vue

@ -1,25 +1,21 @@
<template> <template>
<!-- <page-meta root-font-size="18px"></page-meta> --> <!-- <page-meta root-font-size="18px"></page-meta> -->
<view class=""> <view class="">
<view class="" style="width: 100%; position: fixed; top: 20rpx; right: 0">
<com-blank-view @goScan="openScanPopup" v-if="locationCode == ''"></com-blank-view> <com-blank-view @goScan="openScanPopup" v-if="locationCode == ''"></com-blank-view>
<my-paging v-show="locationCode != ''" ref="paging" v-model="dataList" @query="queryList">
<!-- 需要固定在顶部不滚动的view放在slot="top"的view中如果需要跟着滚动则不要设置slot="top" -->
<template #top>
<view v-if="locationCode != ''">
<location-info :locationDetail="locationDetail" v-if="locationCode"></location-info> <location-info :locationDetail="locationDetail" v-if="locationCode"></location-info>
<z-tabs :list="tabList" @change="tabChange" /> <z-tabs v-if="locationCode" :list="tabList" @change="tabChange" />
</view> </view>
</template> <view style="margin-top: 200rpx; width: 100%">
<view class="" style="padding-bottom: 50rpx"> <view v-if="totalCount > 0" style="margin: 10rpx; font-size: 35rpx; font-weight: bold">总数 : {{ totalCount }} </view>
<view v-if="tabIndex == 0" v-for="(item, index) in dataList"> <view v-for="(item, index) in dataList" style="width: 100%">
<comLocationDetailCard :isShowPack="false" :dataContent="item" style="margin: 20rpx"> </comLocationDetailCard> <view class="uni-flex uni-row" style="align-items: center; background-color: #fff; border-radius: 10rpx; margin: 10rpx">
<view class="" style="font-size: 35rpx"> ({{ index + 1 }}) </view>
<comLocationDetailCard :isShowPack="false" :dataContent="item" style="margin: 10rpx"> </comLocationDetailCard>
</view> </view>
<view v-if="tabIndex == 1" v-for="(item, index) in dataList">
<comLocationDetailCard :dataContent="item" style="margin: 20rpx"></comLocationDetailCard>
</view> </view>
<uni-load-more :status="loadingType" v-if="dataList.length > 0" />
</view> </view>
</my-paging>
<win-scan-button @goScan="openScanPopup" v-if="locationCode != ''"></win-scan-button> <win-scan-button @goScan="openScanPopup" v-if="locationCode != ''"></win-scan-button>
<winScanLocation ref="scanPopup" title="库位代码" @getLocation="getScanCode"></winScanLocation> <winScanLocation ref="scanPopup" title="库位代码" @getLocation="getScanCode"></winScanLocation>
@ -32,7 +28,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, getCurrentInstance, nextTick, onMounted, watch } from 'vue' import { ref, getCurrentInstance, nextTick, onMounted, watch } from 'vue'
import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app' import { onLoad, onShow, onNavigationBarButtonTap, onReady, onBackPress, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app'
import { getBalanceByLocationcode, getBalanceByLocationcodeGroup } from '@/api/request2.js' import { getBalanceByLocationcode, getBalanceByLocationcodeGroup, getExpectInByLocationCode, getExpectOutByLocationCode } from '@/api/request2.js'
import { maxPageSize, goHome } from '@/common/basic.js' import { maxPageSize, goHome } from '@/common/basic.js'
@ -51,14 +47,17 @@ const summarys = ref([])
const balances = ref([]) const balances = ref([])
const dataIn = ref([]) const dataIn = ref([])
const dataOut = ref([]) const dataOut = ref([])
const pageNo = ref(1)
// //
const pageSize = ref(1000) const pageSize = ref(10)
// //
const pageCurrent = ref(1) const pageCurrent = ref(1)
// //
const dataList = ref([]) const dataList = ref([])
const tabList = ref(['汇总', '明细']) const tabList = ref(['汇总', '明细', '预计入', '预计出'])
const tabIndex = ref(0) const tabIndex = ref(0)
const loadingType = ref('nomore')
const totalCount = ref(0)
const scanPopup = ref() const scanPopup = ref()
const modal = ref() const modal = ref()
const paging = ref() const paging = ref()
@ -74,6 +73,18 @@ onNavigationBarButtonTap((e) => {
onMounted(() => { onMounted(() => {
openScanPopup() openScanPopup()
}) })
onPullDownRefresh(() => {
getContentByTab(tabIndex.value, pageNo.value, pageSize.value, 'refresh')
})
onReachBottom(() => {
console.log('底部')
//
if (loadingType.value == 'loading' || loadingType.value == 'nomore') {
return
}
getContentByTab(tabIndex.value, pageNo.value, pageSize.value, 'more')
})
const openScanPopup = (val) => { const openScanPopup = (val) => {
scanPopup.value.openScanPopup() scanPopup.value.openScanPopup()
} }
@ -92,23 +103,35 @@ const getScanCode = (location, code) => {
// this.getContentByTab(this.tabIndex); // this.getContentByTab(this.tabIndex);
} }
const getSummary = (pageNo, pageSize) => { const getSummary = (pageNo, pageSize, type) => {
proxy.$modal.loading('加载中­....') proxy.$modal.loading('加载中­....')
loadingType.value = 'loading'
if (type === 'refresh') {
pageNo.value = 1
dataList.value = []
}
const params = { const params = {
itemCode: itemCode.value, locationCode: locationCode.value,
pageNo, pageNo: pageNo.value,
pageSize pageSize
} }
getBalanceByLocationcodeGroup(params) getBalanceByLocationcodeGroup(params)
.then((res) => { .then((res) => {
uni.hideLoading() uni.hideLoading()
if (res.data.list.length > 0) { if (type === 'refresh') {
summarysList.value = setShowList(res.data.list) uni.stopPullDownRefresh()
paging.value.complete(summarysList.value) }
} else { const { list } = res.data
paging.value.complete(false) totalCount.value = res.data.total
showMessage(`未查找到库位【${locationCode.value}`) loadingType.value = 'loadmore'
if (list == null || list.length == 0) {
loadingType.value = 'nomore'
return
} }
dataList.value = type === 'refresh' ? list : dataList.value.concat(list)
pageNo.value++
}) })
.catch((error) => { .catch((error) => {
paging.value.complete(false) paging.value.complete(false)
@ -117,24 +140,34 @@ const getSummary = (pageNo, pageSize) => {
}) })
} }
const getDetailList = (pageNo, pageSize) => { const getDetailList = (pageNo, pageSize, type) => {
proxy.$modal.loading('加载中­....') proxy.$modal.loading('加载中­....')
loadingType.value = 'loading'
if (type === 'refresh') {
pageNo.value = 1
dataList.value = []
}
const params = { const params = {
locationCode: locationCode.value, locationCode: locationCode.value,
pageNo, pageNo: pageNo.value,
pageSize pageSize
} }
getBalanceByLocationcode(params) getBalanceByLocationcode(params)
.then((res) => { .then((res) => {
uni.hideLoading() uni.hideLoading()
if (res.data.list.length > 0) { if (type === 'refresh') {
detailList.value = setShowList(res.data.list) uni.stopPullDownRefresh()
paging.value.complete(detailList.value) }
} else { const { list } = res.data
paging.value.complete(false) totalCount.value = res.data.total
showMessage(`未查找到库位w【${locationCode.value}`) loadingType.value = 'loadmore'
if (list == null || list.length == 0) {
loadingType.value = 'nomore'
return
} }
dataList.value = type === 'refresh' ? list : dataList.value.concat(list)
pageNo.value++
}) })
.catch((error) => { .catch((error) => {
paging.value.complete(false) paging.value.complete(false)

Loading…
Cancel
Save