Commit ae3b07e1 by qinjianhui

fix:入库单添加入库数量

parent 44ae4dd5
......@@ -126,6 +126,7 @@ export interface InterskuList {
currencyCode?: string | null
buyStored?: number | null
totalPrice?: number | null
inventory?: number | null
}
export interface ILocation {
id?: number
......
......@@ -52,13 +52,13 @@
>
<ElTableColumn
type="selection"
width="70"
width="50"
header-align="center"
align="center"
></ElTableColumn>
<ElTableColumn
show-overflow-tooltip
width="60"
width="50"
align="center"
label="序号"
type="index"
......@@ -78,11 +78,13 @@
show-overflow-tooltip
align="center"
label="库存SKU"
width="160"
prop="warehouseSku"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
align="left"
header-align="center"
label="商品名称"
prop="skuName"
/>
......@@ -90,20 +92,35 @@
show-overflow-tooltip
align="center"
label="款号"
width="90"
prop="productNo"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
align="right"
width="110"
header-align="center"
label="可用库存数量"
prop="usableInventory"
/>
<ElTableColumn align="center" label="出库数量" prop="outCount">
<ElTableColumn
show-overflow-tooltip
align="right"
header-align="center"
label="库存数量"
prop="inventory"
/>
<ElTableColumn
header-align="center"
align="right"
label="出库数量"
prop="outCount"
width="100"
>
<template #default="{ row }">
<el-input
v-model.number="row.outCount"
placeholder="出库数量"
style="width: 120px"
clearable
size="small"
@input="setCostPrice(row)"
......@@ -117,14 +134,16 @@
prop="currencyName"
/>
<ElTableColumn
width="100"
align="center"
width="80"
align="right"
label="成本价"
header-align="center"
prop="costPrice"
/>
<ElTableColumn
align="center"
width="100"
align="right"
width="80"
header-align="center"
label="总成本"
prop="totalPrice"
/>
......@@ -153,12 +172,13 @@
show-overflow-tooltip
align="center"
label="所属客户"
width="100"
prop="userMark"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
width="240"
width="120"
label="备注"
prop="remark"
>
......@@ -338,7 +358,7 @@ const addOtherCurrency = async () => {
const params: InterWarehouseDetail = {
...editForm.value,
productList: otherPurchaseData.value,
outRecordType: 'picking_replenish'
outRecordType: 'picking_replenish',
}
try {
await addOutRecordApi(params)
......@@ -426,6 +446,7 @@ const open = async (params: OpenParams) => {
usableInventory: skuItem.usableInventory,
inventoryId: skuItem.id,
remark: skuItem.remark ?? null,
inventory: skuItem.inventory,
} as InterProductList
})
......
......@@ -30,7 +30,7 @@
<splitDiv size="50">
<template #top>
<div class="header-filter-form">
<ElForm :model="searchForm" inline ref="searchFormRef">
<ElForm ref="searchFormRef" :model="searchForm" inline>
<ElFormItem label="仓库">
<ElSelect
v-model="searchForm.warehouseId"
......@@ -96,7 +96,7 @@
/>
</ElFormItem>
<ElFormItem>
<ElButton type="primary" @click="search" ref="searchBtnRef"
<ElButton ref="searchBtnRef" type="primary" @click="search"
>查询</ElButton
>
</ElFormItem>
......@@ -511,13 +511,13 @@
>
<ElTableColumn
type="selection"
width="70"
width="50"
header-align="center"
align="center"
></ElTableColumn>
<ElTableColumn
show-overflow-tooltip
width="60"
width="50"
align="center"
label="序号"
type="index"
......@@ -537,12 +537,14 @@
show-overflow-tooltip
align="center"
label="库存SKU"
width="160"
prop="warehouseSku"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
align="left"
header-align="center"
label="商品名称"
prop="skuName"
/>
......@@ -550,20 +552,36 @@
show-overflow-tooltip
align="center"
label="款号"
width="90"
prop="productNo"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
align="right"
header-align="center"
label="库存数量"
width="90"
prop="inventory"
/>
<ElTableColumn
show-overflow-tooltip
align="right"
header-align="center"
label="可用库存数量"
prop="usableInventory"
width="110"
/>
<ElTableColumn align="center" label="出库数量" prop="outCount">
<ElTableColumn
align="right"
header-align="center"
label="出库数量"
width="90"
prop="outCount"
>
<template #default="{ row }">
<el-input
v-model.number="row.outCount"
placeholder="出库数量"
style="width: 120px"
clearable
size="small"
@input="setCostPrice(row)"
......@@ -577,18 +595,25 @@
prop="currencyName"
/>
<ElTableColumn
width="100"
align="center"
width="80"
align="right"
header-align="center"
label="成本价"
prop="costPrice"
/>
<ElTableColumn
align="center"
width="100"
align="right"
header-align="center"
width="80"
label="总成本"
prop="totalPrice"
/>
<ElTableColumn align="center" label="库位" prop="locationCode">
<ElTableColumn
width="90"
align="center"
label="库位"
prop="locationCode"
>
<template #default="{ row }">
<span v-if="row.locationCode">{{ row.locationCode }}</span>
<ElSelect
......@@ -596,7 +621,6 @@
v-model="row.locationId"
clearable
placeholder="请输入库位"
style="width: 120px"
filterable
@change="handleLocationChange(row.locationId, row)"
>
......@@ -611,14 +635,16 @@
</ElTableColumn>
<ElTableColumn
show-overflow-tooltip
header-align="center"
align="center"
width="100"
label="所属客户"
prop="userMark"
/>
<ElTableColumn
show-overflow-tooltip
align="center"
width="240"
width="120"
label="备注"
prop="remark"
>
......@@ -1304,6 +1330,7 @@ const handleLocalImport = async ({
usableInventory: skuItem.usableInventory,
inventoryId: skuItem.id,
remark: importedItem?.remark ?? skuItem.remark ?? null,
inventory: skuItem.inventory,
} as InterProductList
})
......@@ -1421,6 +1448,7 @@ const skudblclick = (val: InterskuList) => {
image = '',
locationId = null,
usableInventory = null,
inventory = null,
id = null,
currencyName = '',
currencyCode = '',
......@@ -1453,9 +1481,10 @@ const skudblclick = (val: InterskuList) => {
totalPrice: null,
usableInventory, //可用库存数量
inventoryId: id,
inventory: inventory,
currencyName,
currencyCode,
},
} as InterProductList,
]
// 使用filter代替forEach+splice,时间复杂度从O(n^2)降到O(n)
const skuSet = new Set(
......@@ -1532,11 +1561,25 @@ const getProduct = async (id: number | undefined) => {
const productList = res.data?.productList
const newProductList = (Array.isArray(productList) ? productList : []).map(
(item: InterProductList) => {
const { inventory, ...rest } = item
return {
...rest,
usableInventory: inventory?.usableInventory ?? null,
const inventoryData = item.inventory as
| { inventory?: number; usableInventory?: number }
| number
| null
| undefined
if (
inventoryData !== null &&
inventoryData !== undefined &&
typeof inventoryData === 'object'
) {
const { ...rest } = item
return {
...rest,
inventory: inventoryData.inventory ?? null,
usableInventory:
inventoryData.usableInventory ?? rest.usableInventory ?? null,
} as InterProductList
}
return item
},
)
if (res.data) {
......@@ -1795,6 +1838,7 @@ const submitPurchase = async () => {
outCount: null,
totalPrice: null,
usableInventory: skuItem.usableInventory,
inventory: skuItem.inventory,
inventoryId: skuItem.id,
remark: null,
} as InterProductList
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment