Commit ae3b07e1 by qinjianhui

fix:入库单添加入库数量

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