入库流程对接完毕

This commit is contained in:
zx
2026-04-03 08:38:34 +08:00
parent dde27ed688
commit ce6d5e5d6e
42 changed files with 3028 additions and 936 deletions

View File

@@ -0,0 +1,147 @@
<template>
<!-- 自定义导航栏 -->
<navigation :title="pathParams.billNo">
<template #right>
<view class="right-btn flex align-center justify-center ">
<uv-image @click="onPrinter" src="../../../../static/printer.png" width="20px" height="20px"
style="margin-top:10rpx" />
<uv-image @click="onEdit" src="../../../../static/edit.png" class="ml-24" width="20px" height="20px"
style="margin-top:10rpx" />
</view>
</template>
</Navigation>
<!-- 详情信息 -->
<detail-info type="stockIn" :detailInfo="detailInfo" />
<view v-if="detailInfo?.billType == '0'"
:class="getBillType(detailInfo?.billType, detailInfo?.status) != '物料部分入库' ? 'bottom' : 'bottom1'">
<uv-button type="error" v-if="getBillType(detailInfo?.billType, detailInfo?.status) != '物料部分入库'" text="作废"
@click="toObsolete"></uv-button>
<uv-button type="primary" text="入库单入库" @click="toPutAway"></uv-button>
</view>
</template>
<script setup>
import _ from 'lodash';
import { ref, computed } from 'vue';
import { onLoad } from "@dcloudio/uni-app";
import { objectToQuery, getBillType } from '../../../until';
import { stockInDetail, inboundBillVoid } from '../../../../api/stockIn';
import DetailInfo from '../../../components/DetailInfo.vue';
import Navigation from '../../../components/Navigation.vue';
// 数据:路径参数
const pathParams = ref('')
// 数据:详情
const detailInfo = ref('')
// 数据:类型 stockIn:入库 stockIn-putAway入库单入库 stockOut出库
const type = computed(() => pathParams.value.type)
// 方法:获取详情 - 将isDelete写入
const getDetailInfo = () => {
stockInDetail({ billNo: pathParams.value.billNo }).then((res) => {
detailInfo.value = res.data
})
}
// 打印
const onPrinter = () => {
}
const toObsolete = () => {
const params = {
billNo: pathParams.value?.billNo,
billType: '5'
}
inboundBillVoid(params).then((res) => {
// /pages/warehousing/stockIn/my
uni.navigateTo({
url: `/pages/warehousing/stockIn/my`
});
})
}
const setDetailInfoToStorage = (type) => {
uni.setStorageSync('app_warehousing', [{
deptName: detailInfo.value?.warehouseName,
deptCode: detailInfo.value?.warehouseCode,
}])
uni.setStorageSync('app_storageArea', [{
deptName: detailInfo.value?.areaName,
deptCode: detailInfo.value?.areaCode,
}])
if (type) {
const material = _.filter(detailInfo.value?.itemList, (i) => i?.uniqueCode && i.status == '0')
const materialSelectList = _.filter(detailInfo.value?.itemList, (i) => !i?.uniqueCode && i.status == '0')
uni.setStorageSync('app_material', material)
uni.setStorageSync('app_material_select_list', materialSelectList)
} else {
uni.setStorageSync('app_material', detailInfo.value?.itemList)
}
uni.setStorageSync('app_billRemark', detailInfo.value?.billRemark,)
}
// 按钮:入库单入库
const toPutAway = () => {
setDetailInfoToStorage('1')
uni.navigateTo({
url: `/pages/warehousing/stockIn/components/inbound?billNo=${pathParams.value.billNo}`
});
}
// 编辑
const onEdit = () => {
setDetailInfoToStorage()
const query = objectToQuery(pathParams.value)
let url = `/pages/warehousing/stockIn/create${query}`
uni.navigateTo({
url: url
});
}
// 接收路径参数billNo
onLoad((options) => {
if (!options.billNo) {
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
return
}
pathParams.value = options
getDetailInfo()
})
</script>
<style scoped lang="scss">
/* 底部按钮 */
// 底部按钮
.bottom {
position: fixed;
bottom: 0;
height: 60rpx;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
.uv-button-wrapper {
width: 50%;
border-radius: 0;
}
}
.bottom1 {
position: fixed;
bottom: 0;
height: 60rpx;
font-size: 14px;
display: flex;
align-items: center;
// justify-content: center;
width: 100%;
.uv-button-wrapper {
width: 100%;
border-radius: 0;
}
}
</style>

View File

@@ -0,0 +1,158 @@
<!--点击入库单入库后的入库页面 -->
<template>
<view class="page">
<!-- 仓库信息 - 仓库存储区 -->
<warehousing-info ref="warehousingInfoRef" :warehouseInfo="warehouseInfo" :pathParams="pathParams" />
<!-- 物料列表 - 添加物料 -->
<material-list ref="materialRef" :formData="formData" isEdit="5" backStr="stockIn" :pathParams="pathParams"
:extendData="{ selectMaterialList }" />
<!-- 底部操作栏 -->
<view class="bottom">
<uv-button type="primary" @click="submitForm">入库</uv-button>
</view>
</view>
</template>
<script setup>
import _ from 'lodash';
import { ref } from 'vue';
import { onLoad, onShow } from "@dcloudio/uni-app";
import { inboundFinish, stockInDetail,inboundBillVoid } from '@/api/stockIn';
import MaterialList from '../../../components/MaterialList.vue';
import WarehousingInfo from '../../../components/WarehousingInfo.vue';
import { onMounted } from 'vue';
// 数据:路径参数
const pathParams = ref('')
// 标志:是否为编辑
const isEdit = ref('')
// 标志:区分页面 进入页面的状态 null新建 stockIn:入库编辑 stockIn-putAway入库单入库编辑
const flag = ref('')
// ref物料绑定
const materialRef = ref([])
// ref仓库信息绑定
const warehousingInfoRef = ref([])
const selectMaterialList = ref([])
const detailInfo = ref('')
// 数据:物料列表
const formData = ref([{ remark: '', material: [] }])
// 数据:仓库信息
const warehouseInfo = ref({ warehousing: {}, storageArea: {}, remark: '' })
// 数据:获取缓存信息
const getMaterialList = () => {
// 获取仓库信息
const warehouse = uni.getStorageSync('app_warehousing');
warehouseInfo.value.warehousing = warehouse
// 获取存储区信息
const storageArea = uni.getStorageSync('app_storageArea');
warehouseInfo.value.storageArea = storageArea
// 获取物料信息 - 有uniqueCode
const material = uni.getStorageSync('app_material');
formData.value.material = material
// 获取物料信息 - 无uniqueCode
const selectMaterial = uni.getStorageSync('app_material_select_list');
selectMaterialList.value = selectMaterial
// 获取入库单备注
const billRemark = uni.getStorageSync('app_billRemark');
warehouseInfo.value.remark = billRemark
console.log('获取缓存', material, selectMaterial);
}
// 方法:获取详情 - 更新物料得值 获取唯一码后回来
const getDetailInfo = () => {
stockInDetail({ billNo: pathParams.value.billNo }).then((res) => {
setDetailInfoToStorage(res.data?.itemList)
})
}
// 方法:存入缓存 - 更新物料得值 获取唯一码后回来
const setDetailInfoToStorage = (val) => {
// 过滤出有uniqueCode得值
const material = _.filter(val, (i) => i?.uniqueCode && i.status == '0')
const materialSelectList = _.filter(val, (i) => !i?.uniqueCode && i.status == '0')
uni.setStorageSync('app_material', material)
uni.setStorageSync('app_material_select_list', materialSelectList)
getMaterialList()
}
// 入库:提交表单
const submitForm = () => {
const info = warehousingInfoRef.value.getWarehousingInfo()
const materialInfo = materialRef.value.getMaterialList()
// 过滤出已删除的物料
const _materialInfo = _.filter(materialInfo, { isDelete: '0' })
let params = {
billType: '1',//0入库申请 1入库成功 2出库申请 3出库成功 4入库单已作废 5出库单已作废
billNo: pathParams.value.billNo,
warehouseCode: info.warehousing?.[0].deptCode || info.warehousing?.[0].deptId,
warehouseName: info.warehousing?.[0].deptName,
areaCode: info.storageArea?.[0].deptCode || info.storageArea?.[0].deptId,
areaName: info.storageArea?.[0].deptName,
remark: info.remark,
billRemark: info.remark,
itemList: _.map(_materialInfo, (i) => ({ ...i.material }))
}
inboundFinish(params).then((res) => {
// stockIn
// /pages/warehousing/stockIn/components/detail
uni.navigateTo({
url: `/pages/warehousing/stockIn/components/detail?billNo=${pathParams.value.billNo}&type=stockIn`
});
console.log(res, '入库单入库');
})
}
// 数据:路径参数
onLoad((options) => {
console.log(options, 'options', _.includes(options?.type, 'stockIn'));
if (!options.billNo) {
uni.showToast({ title: '参数错误,无唯一码ID', icon: 'none' })
return
}
pathParams.value = options
getDetailInfo()
flag.value = options.type
isEdit.value = _.includes(options?.type, 'stockIn')
})
// 修改标题若有billNo传入 修改标题
onShow(() => {
if (pathParams.value.billNo) {
uni.setNavigationBarTitle({ title: pathParams.value.billNo })
}
})
onMounted(() => {
getMaterialList()
})
</script>
<style lang="scss" scoped>
.page {
background: #f5f5f5;
min-height: 100vh;
}
/* 底部按钮 */
::v-deep .bottom {
position: fixed;
bottom: 0;
height: 60rpx;
font-size: 14px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
.uv-button-wrapper {
width: 100%;
border-radius: 0;
}
}
</style>