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
752d7518
authored
Mar 30, 2026
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
加入混合分销商逻辑
parent
61d8eab4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
5 deletions
app/Http/Services/DataService.php
app/Http/Services/SupplierService.php
app/Http/routes.php
app/Http/Services/DataService.php
View file @
752d7518
...
@@ -1884,4 +1884,22 @@ class DataService
...
@@ -1884,4 +1884,22 @@ class DataService
]
]
];
];
}
}
public
static
function
handleMixTypeSupplier
()
{
$supplierList
=
SupplierChannelModel
::
where
(
'supplier_group'
,
SupplierChannelModel
::
SUPPLIER_GROUP_MIX
)
->
get
()
->
toArray
();
foreach
(
$supplierList
as
$supplier
)
{
$supplierId
=
$supplier
[
'supplier_id'
];
$channelUid
=
$supplier
[
'yunxin_channel_uid'
];
$supplierService
=
new
SupplierService
();
if
(
!
$channelUid
)
{
dump
(
"供应商:
{
$supplierId
}
- 不存在对应的线上采购员"
);
continue
;
}
$supplierService
->
autoAssignPurchaseUser
(
$supplierId
,
$channelUid
);
}
return
[
'code'
=>
0
,
'msg'
=>
'分配成功'
,
];
}
}
}
app/Http/Services/SupplierService.php
View file @
752d7518
...
@@ -1059,7 +1059,7 @@ class SupplierService
...
@@ -1059,7 +1059,7 @@ class SupplierService
* 自动分配猎芯采购和数据跟单员
* 自动分配猎芯采购和数据跟单员
* 规则:
* 规则:
* 1. 当设置的sku采购员所属子部门为主动兼国产供应链部/被动兼国产供应链部/商品供应链部:
* 1. 当设置的sku采购员所属子部门为主动兼国产供应链部/被动兼国产供应链部/商品供应链部:
* - 如供应商性质是现货商:则默认猎芯采购/数据跟单员为商品供应链部数据跟单采购组的4个人(共8个联系人:猎芯采购4人+数据跟单员4人)
* - 如供应商性质是现货商
/混合分销商
:则默认猎芯采购/数据跟单员为商品供应链部数据跟单采购组的4个人(共8个联系人:猎芯采购4人+数据跟单员4人)
* - 如供应商是代理商/原厂:则猎芯采购/数据跟单员随机选商品供应链部数据跟单采购组的其中1人(共2个联系人:猎芯采购1人+数据跟单员1人)
* - 如供应商是代理商/原厂:则猎芯采购/数据跟单员随机选商品供应链部数据跟单采购组的其中1人(共2个联系人:猎芯采购1人+数据跟单员1人)
* 2. 当设置的sku采购员所属子部门为新质供应链部的,猎芯采购/数据跟单员默认欧阳海梅(共2个联系人)
* 2. 当设置的sku采购员所属子部门为新质供应链部的,猎芯采购/数据跟单员默认欧阳海梅(共2个联系人)
*
*
...
@@ -1135,15 +1135,15 @@ class SupplierService
...
@@ -1135,15 +1135,15 @@ class SupplierService
return
$result
;
return
$result
;
}
}
if
(
$supplierGroup
==
SupplierChannelModel
::
SUPPLIER_GROUP_SPOT
)
{
if
(
$supplierGroup
==
SupplierChannelModel
::
SUPPLIER_GROUP_SPOT
||
$supplierGroup
==
SupplierChannelModel
::
SUPPLIER_GROUP_MIX
)
{
// 现货商:分配商品供应链部数据跟单采购组的4个人
// 现货商
/混合分销商
:分配商品供应链部数据跟单采购组的4个人
foreach
(
$dataFollowerGroup
as
$followerName
)
{
foreach
(
$dataFollowerGroup
as
$followerName
)
{
$codeId
=
$adminUserService
->
getCodeIdByUserName
(
$followerName
,
true
);
$codeId
=
$adminUserService
->
getCodeIdByUserName
(
$followerName
,
true
);
if
(
$codeId
)
{
if
(
$codeId
)
{
$assignCodeIds
[]
=
$codeId
;
$assignCodeIds
[]
=
$codeId
;
}
}
}
}
$result
[
'debug_info'
][
'assign_type'
]
=
'现货商
-分配4人'
;
$result
[
'debug_info'
][
'assign_type'
]
=
(
$supplierGroup
==
SupplierChannelModel
::
SUPPLIER_GROUP_MIX
?
'混合分销商'
:
'现货商'
)
.
'
-分配4人'
;
}
else
if
(
$supplierGroup
==
SupplierChannelModel
::
SUPPLIER_GROUP_ORIGINAL
||
$supplierGroup
==
SupplierChannelModel
::
SUPPLIER_GROUP_PROXY
)
{
}
else
if
(
$supplierGroup
==
SupplierChannelModel
::
SUPPLIER_GROUP_ORIGINAL
||
$supplierGroup
==
SupplierChannelModel
::
SUPPLIER_GROUP_PROXY
)
{
// 代理商/原厂:只分配1人
// 代理商/原厂:只分配1人
// 先检查是否已有数据跟单员
// 先检查是否已有数据跟单员
...
@@ -1332,6 +1332,8 @@ class SupplierService
...
@@ -1332,6 +1332,8 @@ class SupplierService
$adminUserService
=
new
AdminUserService
();
$adminUserService
=
new
AdminUserService
();
$logService
=
new
LogService
();
// 判断是否为生产模式
// 判断是否为生产模式
$isProdMode
=
(
$mode
===
'prod'
);
$isProdMode
=
(
$mode
===
'prod'
);
...
@@ -1395,6 +1397,15 @@ class SupplierService
...
@@ -1395,6 +1397,15 @@ class SupplierService
$assignNames
=
array_map
(
function
(
$codeId
)
use
(
$adminUserService
)
{
$assignNames
=
array_map
(
function
(
$codeId
)
use
(
$adminUserService
)
{
return
$adminUserService
->
getAdminUserNameByCodeId
(
$codeId
);
return
$adminUserService
->
getAdminUserNameByCodeId
(
$codeId
);
},
$assignCodeIds
);
},
$assignCodeIds
);
// 记录日志
if
(
$isProdMode
)
{
$skuPurchaseUserName
=
isset
(
$assignResult
[
'debug_info'
][
'sku_purchase_name'
])
?
$assignResult
[
'debug_info'
][
'sku_purchase_name'
]
:
''
;
$assignType
=
isset
(
$assignResult
[
'debug_info'
][
'assign_type'
])
?
$assignResult
[
'debug_info'
][
'assign_type'
]
:
''
;
$content
=
"批量刷新历史数据自动分配采购员:SKU采购员[
{
$skuPurchaseUserName
}
],分配类型[
{
$assignType
}
],分配人员["
.
implode
(
','
,
$assignNames
)
.
"]"
;
$logService
->
AddAdminLog
(
$supplierId
,
LogModel
::
UPDATE_OPERATE
,
'批量刷新历史数据'
,
$content
);
}
echo
"成功 采购员:"
.
implode
(
','
,
$assignNames
)
.
"
\n
"
;
echo
"成功 采购员:"
.
implode
(
','
,
$assignNames
)
.
"
\n
"
;
}
}
}
else
{
}
else
{
...
...
app/Http/routes.php
View file @
752d7518
...
@@ -97,5 +97,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
...
@@ -97,5 +97,5 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
DataService
::
refreshDataFollower
(
30
,
true
);
DataService
::
handleMixTypeSupplier
(
);
});
});
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