Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
628ae389
authored
Mar 23, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
02ecc79b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
7 deletions
app/Console/Commands/SyncAllSupplierToErp.php
app/Console/Commands/SyncAllSupplierToErp.php
View file @
628ae389
...
...
@@ -37,21 +37,35 @@ class SyncAllSupplierToErp extends Command
public
function
handle
()
{
ini_set
(
'memory_limit'
,
-
1
);
$supplierIds
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'group_code'
,
'!='
,
''
)
$supplierIds
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'group_code'
,
'!='
,
''
)
->
pluck
(
'supplier_id'
)
->
toArray
();
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq.host'
),
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq.host'
),
config
(
'database.connections.rabbitmq.port'
),
config
(
'database.connections.rabbitmq.login'
),
config
(
'database.connections.rabbitmq.password'
));
config
(
'database.connections.rabbitmq.password'
)
);
foreach
(
$supplierIds
as
$supplierId
)
{
$hasDataFollower
=
SupplierContactModel
::
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'channel_user_type'
,
SupplierContactModel
::
CHANNEL_USER_TYPE_INVENTORY
)
->
exists
();
$hasDataFollower
=
SupplierContactModel
::
where
(
'supplier_id'
,
$supplierId
)
->
where
(
'channel_user_type'
,
SupplierContactModel
::
CHANNEL_USER_TYPE_INVENTORY
)
->
exists
();
if
(
!
$hasDataFollower
)
{
continue
;
}
usleep
(
100000
);
//
usleep(100000);
dump
(
$supplierId
);
(
new
SyncSupplierService
())
->
syncSupplierToErp
(
$supplierId
,
$conn
);
//找出所有的联系人对应的采购id,更新主表
$canCheckUids
=
SupplierContactModel
::
where
(
'supplier_id'
,
$supplierId
)
->
pluck
(
'can_check_uids'
);
if
(
!
empty
(
$canCheckUids
))
{
$canCheckUids
=
array_unique
(
$canCheckUids
->
toArray
());
$canCheckUids
=
implode
(
','
,
$canCheckUids
);
}
else
{
$canCheckUids
=
''
;
}
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
update
([
'channel_uid'
=>
$canCheckUids
,
]);
// (new SyncSupplierService())->syncSupplierToErp($supplierId, $conn);
}
}
}
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