Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
15e919c3
Commit
15e919c3
authored
Jun 06, 2025
by
wuqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
出库单
parent
fb2d8f76
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
155 additions
and
58 deletions
+155
-58
src/api/warehouse.ts
+6
-0
src/types/api/warehouse.ts
+4
-0
src/utils/hooks/commonUtil.ts
+0
-1
src/views/warehouse/issueDoc.vue
+0
-0
src/views/warehouse/receiptDoc.vue
+145
-57
No files found.
src/api/warehouse.ts
View file @
15e919c3
...
...
@@ -438,6 +438,12 @@ export function getInRecordLogApi(inRecordId?: number) {
)
}
// 出库单
export
function
warehouseOutRecordExport
(
data
:
ExportInWarehouseInfo
)
{
return
axios
.
post
<
never
,
BasePaginationData
<
never
>>
(
'factory/warehouseOutRecord/export'
,
data
,
)
}
export
function
getOutRecordStatusTree
()
{
return
axios
.
get
<
never
,
BaseRespData
<
InterWarehouseTree
[]
>>
(
'factory/warehouseOutRecord/status_tree'
,
...
...
src/types/api/warehouse.ts
View file @
15e919c3
...
...
@@ -14,6 +14,7 @@ export interface warehouseSearchForm {
export
interface
InterProductList
{
createTime
?:
string
id
?:
number
inventoryId
?:
number
|
null
inId
?:
number
productNo
?:
string
|
null
//custom的货号
buyStored
?:
number
|
null
//入库数量
...
...
@@ -87,6 +88,9 @@ export interface InterProductList {
warehouseSku
?:
string
locationId
?:
number
|
null
locationCode
?:
string
|
null
inventory
?:
{
usableInventory
?:
number
}
}
export
interface
InterskuList
{
id
?:
number
...
...
src/utils/hooks/commonUtil.ts
View file @
15e919c3
...
...
@@ -108,7 +108,6 @@ export function checkUpdateParams(
removeList
=
arr1
.
map
((
item
)
=>
item
[
'id'
]
as
IdType
)
}
if
(
isBackKeyName
)
{
console
.
log
(
isBackKeyName
)
// 将列表直接添加到 params 顶层
if
(
addList
.
length
>
0
)
params
[
'addList'
]
=
addList
||
undefined
if
(
updateList
.
length
>
0
)
...
...
src/views/warehouse/issueDoc.vue
View file @
15e919c3
This diff is collapsed.
Click to expand it.
src/views/warehouse/receiptDoc.vue
View file @
15e919c3
...
...
@@ -446,12 +446,6 @@
/>
<
/div
>
<
/div
>
<!--
<
template
#
footer
>
<
span
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"importDialogVisible = false"
>
取消
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"packedData"
>
确认
<
/el-button
>
<
/span
>
<
/template> --
>
<
/ElDialog
>
<
ElDialog
v
-
model
=
"newDialogVisible"
...
...
@@ -607,7 +601,7 @@
<
div
class
=
"product-dialog-footer"
>
<
div
>
<
el
-
input
v
-
model
=
"selectSku"
v
-
model
.
trim
=
"selectSku"
placeholder
=
"商品SKU"
style
=
"width: 200px; margin: 0 10px"
clearable
...
...
@@ -693,14 +687,14 @@
<
/el-button
>
<
/template
>
<
/el-popover
>
<
!--
<
el
-
button
<
el
-
button
style
=
"margin-left: 6px"
type
=
"success"
size
=
"small"
@
click
=
"addPurchase"
>
批量新增
<
/el-button>
--
>
<
/el-button
>
<
el
-
button
type
=
"danger"
style
=
"margin-left: 10px"
...
...
@@ -789,7 +783,7 @@
<
el
-
table
-
column
align
=
"center"
prop
=
"number"
label
=
"打印数量"
>
<
template
#
default
=
"{ row
}
"
>
<
el
-
input
v
-
model
=
"row.number"
v
-
model
.
number
=
"row.number"
oninput
=
"value=value.replace(/[^
\
-?
\
d.]/g,'')"
placeholder
=
"打印数量"
clearable
...
...
@@ -802,6 +796,33 @@
<
el
-
button
type
=
"primary"
@
click
=
"handlePrintProductTag"
>
打印
<
/el-button
>
<
/template
>
<
/el-dialog
>
<
ElDialog
v
-
model
=
"addPurchaseVisible"
title
=
"批量添加"
width
=
"500px"
:
close
-
on
-
click
-
modal
=
"false"
>
<
div
>
<
el
-
input
v
-
model
.
trim
=
"purchaseTextarea"
type
=
"textarea"
placeholder
=
"请输入库存 SKU"
:
rows
=
"5"
minlength
=
"1"
maxlength
=
"1000"
show
-
word
-
limit
/>
<
div
style
=
"margin-top: 12px; color: #777"
>
{{
'多个字段使用_##_,_##_隔开'
}}
<
/div
>
<
/div
>
<
template
#
footer
>
<
span
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"addPurchaseVisible = false"
>
取消
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"submitPurchase"
>
确认
<
/el-button
>
<
/span
>
<
/template
>
<
/ElDialog
>
<
/template
>
<
script
setup
lang
=
"ts"
>
...
...
@@ -1078,41 +1099,107 @@ async function handlePrintProductTag() {
showPrintDialog
.
value
=
false
window
.
open
(
filePath
+
res
.
message
,
'_blank'
)
}
const
batchAddCommodity
=
async
(
sku
:
string
):
Promise
<
InterskuList
[]
>
=>
{
if
(
!
editForm
.
value
.
warehouseId
)
{
ElMessage
.
error
(
'请选择仓库'
)
return
[]
}
try
{
const
res
=
await
getBySkuApi
(
editForm
.
value
.
warehouseId
,
sku
)
const
arr
:
InterskuList
[]
=
res
.
data
||
[]
const
ids
:
Record
<
string
,
boolean
>
=
{
}
// 过滤掉商品列表已经加了的
for
(
const
item
of
otherPurchaseData
.
value
)
{
if
(
item
.
warehouseSku
!==
undefined
)
{
ids
[
item
.
warehouseSku
]
=
true
}
}
// 使用 filter 方法过滤掉已经存在的 SKU
const
filteredArr
=
arr
.
filter
((
currentItem
:
InterskuList
)
=>
{
return
currentItem
.
sku
===
undefined
||
!
ids
[
currentItem
.
sku
]
}
)
return
filteredArr
}
catch
(
e
)
{
console
.
error
(
e
)
return
[]
}
}
interface
InterImportData
{
warehouseSku
:
string
remark
?:
string
|
null
[
key
:
string
]:
unknown
}
// 前端导入Excel
const
excelFieldMap
:
Record
<
string
,
keyof
InterProductList
>
=
{
SKU
图片
:
'skuImage'
,
//
SKU图片: 'skuImage',
商品
SKU
:
'warehouseSku'
,
SKU
名称
:
'skuName'
,
//
SKU名称: 'skuName',
入库数量
:
'buyStored'
,
'成本价(¥)'
:
'costPrice'
,
'总成本(¥)'
:
'totalPrice'
,
库位
:
'locationCode'
,
//
'成本价(¥)': 'costPrice',
//
'总成本(¥)': 'totalPrice',
//
库位: 'locationCode',
备注
:
'remark'
,
}
const
handleLocalImport
=
({
const
handleLocalImport
=
async
({
path
,
data
,
}
:
{
path
:
string
data
:
Inter
ProductList
[]
data
:
Inter
ImportData
[]
}
)
=>
{
const
result
:
InterProductList
[]
=
data
.
map
((
item
)
=>
{
const
obj
=
{
}
as
InterProductList
// 1. 将原始导入数据映射到 InterImportData[]
const
importedData
:
InterImportData
[]
=
data
.
map
((
item
)
=>
{
const
obj
:
InterImportData
=
{
warehouseSku
:
''
}
Object
.
keys
(
excelFieldMap
).
forEach
((
excelKey
)
=>
{
const
field
=
excelFieldMap
[
excelKey
]
as
keyof
InterProductList
const
field
=
excelFieldMap
[
excelKey
]
const
value
=
item
[
excelKey
]
// // 类型转换和默认值
// if (['buyStored', 'costPrice', 'totalPrice'].includes(field))
{
// value = value == null || value === '' ? 0 : Number(value)
//
}
else
{
// value = value == null ? '' : value
//
}
obj
[
field
]
=
value
as
InterProductList
[
typeof
field
]
obj
[
field
]
=
value
}
)
return
obj
}
)
otherPurchaseData
.
value
=
result
.
filter
((
item
)
=>
item
.
warehouseSku
)
// 过滤掉没有 SKU 的行
if
(
importedData
.
length
===
0
)
{
ElMessage
.
warning
(
'导入数据中没有有效的商品SKU'
)
importDialogVisible
.
value
=
false
return
}
// 2. 提取导入的 SKU 列表
const
importedSkus
=
importedData
.
map
((
item
)
=>
item
.
warehouseSku
).
join
(
','
)
// 3. 调用 batchAddCommodity 获取商品的完整信息并过滤掉已有的 SKU
const
filteredSkusList
=
await
batchAddCommodity
(
importedSkus
)
// 使用 await 等待结果
if
(
filteredSkusList
.
length
===
0
)
{
ElMessage
.
warning
(
'导入的商品SKU已存在或无效'
)
importedFileUrl
.
value
=
path
importDialogVisible
.
value
=
false
return
}
// 4. 将备注信息合并到获取到的商品列表中
const
mergedProductList
=
filteredSkusList
.
map
((
skuItem
)
=>
{
// 在导入数据中找到匹配的备注信息
const
importedItem
=
importedData
.
find
(
(
item
)
=>
item
.
warehouseSku
===
skuItem
.
sku
,
)
const
amount
=
new
BigNumber
(
importedItem
?.
buyStored
)
.
multipliedBy
(
skuItem
.
factoryPrice
)
.
toFixed
(
2
)
return
{
skuImage
:
skuItem
.
image
,
warehouseSku
:
skuItem
.
sku
,
skuName
:
skuItem
.
skuName
,
productNo
:
skuItem
.
productNo
,
locationCode
:
skuItem
.
locationCode
??
''
,
locationId
:
skuItem
.
locationId
??
null
,
costPrice
:
skuItem
.
factoryPrice
,
buyStored
:
importedItem
?.
buyStored
??
null
,
totalPrice
:
Number
(
amount
),
usableInventory
:
skuItem
.
usableInventory
,
remark
:
importedItem
?.
remark
??
null
,
}
as
InterProductList
// 明确类型
}
)
// 5. 更新 otherPurchaseData
otherPurchaseData
.
value
=
[...
otherPurchaseData
.
value
,
...
mergedProductList
]
importedFileUrl
.
value
=
path
importDialogVisible
.
value
=
false
}
...
...
@@ -1416,31 +1503,6 @@ const addOtherCurrency = async () => {
return
}
}
// 看新增后要不要打印标签
// try
{
// if (!editId.value)
{
// await addUserApi(
{
// ...editForm.value,
// supperMark: Number(editForm.value.supperMark),
// status: Number(editForm.value.status),
//
}
)
//
}
else
{
// await updateUserApi(
{
// ...editForm.value,
// supperMark: Number(editForm.value.supperMark),
// status: Number(editForm.value.status),
//
}
)
//
}
// ElMessage(
{
// message: '保存成功',
// type: 'success',
// offset: window.innerHeight / 2,
//
}
)
// newDialogVisible.value = false
// search()
//
}
catch
(
e
)
{
// return
//
}
if
(
!
formId
.
value
)
{
addSection
()
}
else
{
...
...
@@ -1508,9 +1570,35 @@ const upSection = async () => {
console
.
error
(
e
)
}
}
// const addPurchase = async () =>
{
// if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
//
}
const
addPurchaseVisible
=
ref
(
false
)
const
purchaseTextarea
=
ref
(
null
)
const
addPurchase
=
async
()
=>
{
addPurchaseVisible
.
value
=
true
}
const
submitPurchase
=
async
()
=>
{
if
(
!
purchaseTextarea
.
value
)
{
ElMessage
.
warning
(
'请输入库存 SKU'
)
return
}
const
filteredSkusList
=
await
batchAddCommodity
(
purchaseTextarea
.
value
)
const
mergedProductList
=
filteredSkusList
.
map
((
skuItem
)
=>
{
return
{
skuImage
:
skuItem
.
image
,
warehouseSku
:
skuItem
.
sku
,
skuName
:
skuItem
.
skuName
,
productNo
:
skuItem
.
productNo
,
locationCode
:
skuItem
.
locationCode
??
''
,
locationId
:
skuItem
.
locationId
??
null
,
costPrice
:
skuItem
.
factoryPrice
,
buyStored
:
null
,
totalPrice
:
null
,
usableInventory
:
skuItem
.
usableInventory
,
remark
:
null
,
}
as
InterProductList
}
)
otherPurchaseData
.
value
=
[...
otherPurchaseData
.
value
,
...
mergedProductList
]
addPurchaseVisible
.
value
=
false
}
const
deleteOtherWarehousing
=
()
=>
{
const
arr
=
otherWarehouseSelection
.
value
if
(
arr
.
length
===
0
)
return
...
...
@@ -1522,8 +1610,8 @@ const deleteOtherWarehousing = () => {
const
importDialogVisible
=
ref
(
false
)
const
importedFileUrl
=
ref
(
''
)
const
importData
=
async
()
=>
{
// if (!editForm.value.warehouseId) return ElMessage.error('请选择仓库')
importDialogVisible
.
value
=
true
importedFileUrl
.
value
=
''
}
const
handleBatchDelete
=
async
()
=>
{
if
(
!
selections
.
value
.
length
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment