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
6838642c
Commit
6838642c
authored
Jul 23, 2026
by
wusiyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 尝试修复打印机任务并发导致打印内容错乱问题 #1001679
parent
d44f0691
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
src/views/order/factoryOrderNew/index.vue
+12
-5
src/views/order/podUs/PodMakeOrder.vue
+10
-1
No files found.
src/views/order/factoryOrderNew/index.vue
View file @
6838642c
...
...
@@ -2896,12 +2896,19 @@ const handleSeedingWall = (type: 'print' | 'sort') => {
podOrderVisible
.
value
=
true
}
const
printOrder
=
async
(
/** LODOP 单例不可并发,打印串行 */
let
printOrderChain
:
Promise
<
void
>
=
Promise
.
resolve
()
const
printOrder
=
(
data
:
OrderData
,
callback
:
(
status
:
boolean
)
=>
void
,
)
=>
{
const
run
=
async
()
=>
{
const
lodop
=
getCLodop
(
null
,
null
)
if
(
!
lodop
)
return
if
(
!
lodop
)
{
callback
&&
callback
(
false
)
return
}
lodop
.
PRINT_INIT
(
'打印内容'
)
const
printerIndex
=
lodop
.
SET_PRINTER_INDEX
(
sheetPrinter
.
value
)
console
.
log
(
...
...
@@ -2956,11 +2963,9 @@ const printOrder = async (
console
.
log
(
'PRINT_STATUS_OK:'
,
jobCode
,
`ok: ${ok
}
`
)
if
(
ok
==
1
)
{
console
.
log
(
'打印成功'
)
// 打印状态:成功
callback
&&
callback
(
true
)
return
}
// 如果打印状态表示未成功或者返回了空,继续获取任务是否存在
const
exist
=
await
lodopCall
((
lodop
)
=>
lodop
.
GET_VALUE
(
'PRINT_STATUS_EXIST'
,
jobCode
),
)
...
...
@@ -2974,7 +2979,6 @@ const printOrder = async (
)
if
(
exist
==
0
)
{
console
.
log
(
'任务不存在了'
,
`exist:${exist
}
`
)
// 任务不存在了
callback
&&
callback
(
true
)
return
}
...
...
@@ -2991,6 +2995,9 @@ const printOrder = async (
lodop
.
PRINT
()
callback
&&
callback
(
false
)
}
}
printOrderChain
=
printOrderChain
.
then
(
run
,
run
)
}
let
_lodop
:
LODOPObject
|
null
=
null
let
_lodopCallback
:
{
[
key
:
string
]:
(
value
:
string
)
=>
void
}
=
{
}
...
...
src/views/order/podUs/PodMakeOrder.vue
View file @
6838642c
...
...
@@ -1445,15 +1445,24 @@ const handlePrinterChange = (value: string) => {
emit
(
'set-printer'
,
value
)
}
/** 已自动打印过的订单,避免 WS 回写清掉 printResult 后重复打印 */
const
autoPrintedIds
=
new
Set
<
number
>
()
const
print
=
(
data
:
OrderData
,
forcePrint
=
false
,
callback
?:
()
=>
void
)
=>
{
const
_boxIndex
=
boxIndex
.
value
const
orderId
=
data
.
id
if
(
!
forcePrint
&&
data
.
printResult
)
{
if
(
!
forcePrint
&&
(
data
.
printResult
||
(
orderId
!=
null
&&
autoPrintedIds
.
has
(
orderId
)))
)
{
callback
&&
callback
()
return
}
if
(
!
forcePrint
&&
orderId
!=
null
)
autoPrintedIds
.
add
(
orderId
)
props
.
printOrder
(
data
,
(
status
:
boolean
)
=>
{
if
(
!
status
&&
orderId
!=
null
)
autoPrintedIds
.
delete
(
orderId
)
callback
&&
callback
()
const
item
=
podBoxList
.
value
?.
find
((
item
)
=>
item
.
box
===
_boxIndex
)
if
(
item
&&
item
.
data
)
{
...
...
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