出库对接

This commit is contained in:
zx
2026-04-14 08:46:29 +08:00
parent b16dd22d70
commit 6f1db0f92e
30 changed files with 1366 additions and 458 deletions

View File

@@ -1,12 +1,12 @@
<template>
<!-- 物料列表 - 添加物料 -->
<view class="materialList">
<view class="remarkLine">
<text>物料列表</text>
<uv-button type="primary" v-if="isAddMaterial" :plain="true"
size="small" text="添加物料" @click="toMaterial"></uv-button>
<view v-if="isEdit == 5" class="flex align-center justify-between">
<uv-button type="primary" v-if="isAddMaterial" :plain="true" size="small" text="添加物料"
@click="toMaterial"></uv-button>
<view v-if="isShowRqCode" class="flex align-center justify-between">
<span class="f-12 mr-16 grey" style="font-size: 12px;" v-if="num > 0">
剩余<span style="color: red;">
{{ num }}
@@ -15,7 +15,7 @@
<uv-button type="primary" :plain="true" size="small" text="快速生成唯一码"
@click="toGenerateUniqueCodeQuickly"></uv-button>
</view>
<!-- <p class="btn-link" v-if="isEdit == 2" @click="toEdit">修改</p> -->
</view>
<!-- 物料列表-->
@@ -52,7 +52,7 @@
</view>
</view>
<!-- 库存状态 -->
<view class="flex justify-between mb-2 " v-if="isEdit == 3">
<view class="flex justify-between mb-2 " v-if="isEdit == 3 && isStockIn">
<p style="font-size: 13px;">
已入库
<span style="color:green">{{ getStockQuantity(item, 'complete') }}</span>
@@ -62,6 +62,16 @@
<span style="color:red">{{ getStockQuantity(item, 'remaining') }}</span>
</p>
</view>
<view class="flex justify-between mb-2 " v-if="isEdit == 3 && !isStockIn">
<p style="font-size: 13px;">
已出库
<span style="color:green">{{ getStockQuantity(item, 'complete') }}</span>
</p>
<p style="font-size: 13px;">
剩余
<span style="color:red">{{ getStockQuantity(item, 'remaining') }}</span>
</p>
</view>
<!-- 备注 -->
<view class="remark-row">
<uni-forms-item :name="`material[${idx}].remark`" label="备注:">
@@ -98,29 +108,39 @@
</template>
<script setup>
import { computed, onMounted, ref, toRefs } from 'vue';
import { assign, findIndex ,includes} from 'lodash';
import { computed, ref, toRefs } from 'vue';
import { assign, findIndex, includes } from 'lodash';
import { getStockQuantity, objectToQuery } from '../until';
import { getTypeParentNames } from '../warehousing/uniqueCode/until';
import { onLoad, onShow } from "@dcloudio/uni-app";
const OPERATE_CONFIG = {
// 唯一码创建 /唯一码编辑 /唯一码详情 /入库单开单
issueUniqueCode: {
toMaterialUrl: '/pages/warehousing/uniqueCode/issueUniqueCode/materialSelection',
title: '入库单开单'
},
// 入库单入库
stockIn: {
toMaterialUrl: '/pages/warehousing/uniqueCode/issueUniqueCode/index',
title: '入库单开单'
},
}
const props = defineProps({
formData: { type: Object, default: () => ({ material: [], remark: '' }), required: true },//物料信息
isEdit: { type: Boolean, default: true, required: true }, //编辑1 / 物料只读2 / 入库单只读3 /入库生成唯一码编辑4 /5数量不可编辑 备注可编辑
backStr: { type: String, default: '' }, //选择物料返回页面的标识
pathParams: { type: Object, default: {} }, //只读时传入对应的code、id
extendData: { type: Object, default: {} }, //其他额外参数
})
const { formData, isEdit, backStr, pathParams, extendData } = toRefs(props)
const { formData, isEdit, pathParams, extendData } = toRefs(props)
const keyType = computed(() => pathParams.value.type)
//是否为编辑状态
const edit = computed(() => {
if (`${isEdit.value}` === '1') return '1';
else if (`${isEdit.value}` === '4') return '4';
else return false;
})
const edit = computed(() => includes(['1', '4', '5'], `${isEdit.value}`))
// 显示添加物料按钮 isEdit编辑、
const isAddMaterial = computed(() => isEdit == 1 && pathParams.back != 'issueUniqueCode_inbound' && !includes(backStr.value,'stockOut'))
const isAddMaterial = computed(() => `${isEdit.value}` === '1' && keyType != 'issueUniqueCode_inbound' && !includes(keyType.value, 'stockOut'))
// 显示快速生成唯一码 isShowRqCode
const isShowRqCode = computed(() => `${isEdit.value}` === '5' && !includes(keyType.value, 'stockOut'))
const isStockIn = computed(() => includes(keyType.value, 'stockIn'))
// 删除:数据
const delItem = ref(null)
// 删除:开关
@@ -134,16 +154,15 @@ const modalRef = ref()
// 按钮:添加物料
const toMaterial = () => {
if (backStr.value == 'stockIn') { // 入库单开单 - 添加物料可选择手输入/无线液位计
if (keyType.value == 'stockIn') { // 入库单开单 - 添加物料可选择手输入/无线液位计
modalRef.value.open()
} else {
const path = objectToQuery({ ...pathParams.value, back: backStr?.value })
const path = objectToQuery(pathParams.value)
// 唯一码 - 编辑/新增
let url = '/pages/warehousing/uniqueCode/issueUniqueCode/materialSelection';
const value = uni.getStorageSync('app_material');
uni.setStorageSync('app_material', [{ ...value[0], uniqueCodeRemark: formData.value?.remark }]); // 将最新的唯一码备注写入缓存
uni.navigateTo({
url: `${url}${path}`
url: `${OPERATE_CONFIG.issueUniqueCode.toMaterialUrl}${path}`
})
}
}
@@ -151,9 +170,9 @@ const toMaterial = () => {
const toMaterialSelection = (type) => {
// 0无线液 1手动输入
let url = ''
const path = objectToQuery({ ...pathParams.value, back: backStr.value })
const path = objectToQuery(pathParams.value)
if (type === '1') {
url = '/pages/warehousing/uniqueCode/issueUniqueCode/materialSelection'
url = `${OPERATE_CONFIG.issueUniqueCode.toMaterialUrl}`
}
uni.navigateTo({
url: `${url}${path}`
@@ -161,9 +180,11 @@ const toMaterialSelection = (type) => {
}
// 快速生成唯一码 -
const toGenerateUniqueCodeQuickly = () => {
const path = objectToQuery({ ...pathParams.value, back: 'inbound' })
const path = objectToQuery(pathParams.value)
console.log(path, 'path==>');
uni.navigateTo({
url: `/pages/warehousing/uniqueCode/issueUniqueCode/index${path}`
url: `${OPERATE_CONFIG.stockIn.toMaterialUrl}${path}`
})
}
@@ -188,7 +209,8 @@ const dialogConfirm = () => {
const getMaterialList = () => {
const params = formData.value?.material?.map((i) => ({
const material = formData.value?.material || []
const params = material?.map((i) => ({
...i,
material: {
//? 这里的判断是为了区分 =详情带出的物料以及新增的物料 详情带出的物料有id以及materialId 新增物料id为物料id materialId无值