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
1e394010
authored
Jun 15, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
暂存
parent
c9fc98bb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
9 deletions
app/Http/Services/DataService.php
app/Http/Validators/SupplierValidator.php
app/Http/routes.php
config/field.php
resources/views/web/supplier/SupplierBase.blade.php
app/Http/Services/DataService.php
View file @
1e394010
...
...
@@ -436,6 +436,31 @@ class DataService
}
}
}
//处理供应商类型的数据
public
function
dealSupplierTypeData
(
$isUpdate
=
false
)
{
//1.1 当前供应商系统中,没有品质保证协议的供应商,类型统一修正为临时供应商,注意:之前的代理商跟原厂性质的供应商类别保持不变。
$suppliers
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
whereNotIn
(
'supplier_group'
,
[
1
,
4
])
->
get
()
->
toArray
();
$skipSupplierNames
=
config
(
'field.SkipChangeSupplierTypeNames'
);
foreach
(
$suppliers
as
$supplier
)
{
if
(
in_array
(
$supplier
[
'supplier_name'
],
$skipSupplierNames
))
{
echo
"代购供应商 ${supplier['supplier_name']},不能修改为临时,跳过"
;
}
//判断是否有品质保证协议,没有的话修改为临时类型
$hasQualityAssuranceAgreement
=
SupplierAttachmentsModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
where
(
'field_name'
,
'quality_assurance_agreement'
)
->
exists
();
if
(
!
$hasQualityAssuranceAgreement
)
{
echo
"供应商 ${supplier['supplier_code']} 没有品质保证协议,转换类型为临时;"
.
PHP_EOL
;
if
(
$isUpdate
)
{
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'supplier_type'
=>
2
]);
}
}
}
}
}
app/Http/Validators/SupplierValidator.php
View file @
1e394010
...
...
@@ -20,7 +20,7 @@ class SupplierValidator
$validateData
=
$this
->
transformRequestData
(
$validateData
);
//这个supplierId是用来判断是新增还是修改的
$supplierId
=
array_get
(
$validateData
,
'supplier_id'
);
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称
是否存在
即可
//如果是修改直接提交,不是点申请审核的,只需要校验供应商名称
和采购员是否完整
即可
if
(
!
$isAudit
)
{
if
(
empty
(
$validateData
[
'supplier_name'
]))
{
return
'供应商名称 不能为空'
;
...
...
@@ -78,10 +78,18 @@ class SupplierValidator
$errorMessageList
=
[];
//判断供应商类型,如果类型为临时,而且名字属于不能修改为临时的代购供应商列表里面,就要报错
if
(
$validateData
[
'supplier_type'
]
==
2
&&
in_array
(
$validateData
[
'supplier_name'
],
config
(
'field.SkipChangeSupplierTypeNames'
)))
{
$errorMessageList
[]
=
'该供应商是代购供应商,不能修改为临时供应商'
;
}
/**
* --->>附件必填要求:
* 如果供应商类别为正式供应商,营业执照、开票资料必须上传(结算币种为人民币)
,供应商性质为现货商,则品质保证协议必须上传
;
* 如果供应商类别为正式供应商,营业执照、开票资料必须上传(结算币种为人民币);
* 如果供应商类别为临时供应商,营业执照、开票资料必须上传(结算币种为人民币),品质保证协议不需要上传
* 必须上传品质保证协议才能成为正式供应商,没有上传品质保证协议只能为临时供应商(代理商跟原厂类型的供应商不需要上传品质保证协议)。
* 供应商类型为代理商的,需要上传代理证才能成为正式供应商,没有上传代理证的只能为临时供应商。
**/
//只有在提交供应商是正式的时候,才会去校验附件
//校验附件这块,新增和修改判断的逻辑不一样
...
...
@@ -94,9 +102,9 @@ class SupplierValidator
if
(
!
$attachmentFields
)
{
$errorMessageList
[]
=
'请上传附件'
;
}
$attachmentFields
=
array_unique
(
$attachmentFields
);
//fixed.php FileNameMapping 可以知道所有对应关系
if
(
!
in_array
(
'business_license'
,
$attachmentFields
))
{
$errorMessageList
[]
=
'营业执照必须上传'
;
}
...
...
@@ -105,9 +113,15 @@ class SupplierValidator
$errorMessageList
[]
=
'如果选择币种为人民币,开票资料必须上传'
;
}
if
(
$validateData
[
'supplier_type'
]
==
1
&&
$validateData
[
'supplier_group'
]
==
2
)
{
if
(
$validateData
[
'supplier_type'
]
==
SupplierChannelModel
::
SUPPLIER_TYPE_OFFICIAL
)
{
if
(
!
in_array
(
'quality_assurance_agreement'
,
$attachmentFields
))
{
$errorMessageList
[]
=
'供应商为正式供应商,并且供应商类型是现货商,则品质保证协议必须上传'
;
$errorMessageList
[]
=
'供应商为正式供应商,品质保证协议必须上传 (代理商跟原厂类型除外) '
;
}
}
if
(
$validateData
[
'supplier_type'
]
==
SupplierChannelModel
::
SUPPLIER_TYPE_OFFICIAL
&&
$validateData
[
'supplier_group'
]
==
1
)
{
if
(
!
in_array
(
'proxy_certificate'
,
$attachmentFields
))
{
$errorMessageList
[]
=
'供应商为正式供应商,供应商性质为代理商,代理证必须上传'
;
}
}
...
...
app/Http/routes.php
View file @
1e394010
...
...
@@ -12,6 +12,7 @@
*/
use
App\Http\Services\DepartmentService
;
use
App\Http\Services\SkuService
;
Route
::
group
([
'middleware'
=>
[
'web'
,
'menu'
]],
function
()
{
...
...
@@ -53,5 +54,7 @@ Route::group(['middleware' => ['external'],'namespace' => 'Api'], function () {
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
fixHasProblemChannelUid
(
false
);
$departmentService
=
new
DepartmentService
();
$subordinateUserIds
=
$departmentService
->
getSubordinateUserIds
(
1368
);
dd
(
$subordinateUserIds
);
});
config/field.php
View file @
1e394010
...
...
@@ -109,7 +109,7 @@ return [
'SupplierIsType'
=>
[
0
=>
'正式'
,
1
=>
'
临时
'
,
1
=>
'
竞调
'
,
],
'SupplierType'
=>
[
1
=>
'正式'
,
...
...
@@ -131,5 +131,41 @@ return [
1
=>
'人工上传'
,
2
=>
'API对接'
,
3
=>
'云芯上传'
],
//以下供应商为代购供应商,不要更改为临时的,保持为正式供应商
'SkipChangeSupplierTypeNames'
=>
[
"Arrow Electronics Inc"
,
"Mouser Electronics Inc"
,
"Chip One Stop, Inc."
,
"驰万电子(深圳)有限公司"
,
"TI STORE"
,
"欧时电子元件(上海)有限公司"
,
"RS Components"
,
"Digi-key electronics asia pacific"
,
"易络盟电子(中国)有限公司"
,
"eluomeng limited"
,
"昴氏(上海)电子贸易有限公司"
,
"Rochester Electronics (Shanghai Branch)"
,
"Transfer Multisort Elektronik"
,
"Master electronics group limited"
,
"富昌电子(上海)有限公司"
,
"Future Electronics (HongKong)Ltd"
,
"Maxim Integrated Products International, Ltd."
,
"Waldom Electronics APAC"
,
"旺顿电子(上海)有限公司"
,
"ICGOO ELECTRONICS LIMITED"
,
"北京创新在线电子产品销售有限公司"
,
"深圳市立创电子商务有限公司"
,
"云汉芯城(上海)电子科技有限公司"
,
"AVNET INC"
,
"Avnet Technology Hong Kong Ltd"
,
"GALAXY ELECTRONICS (HONGKONG) LIMITED"
,
"深圳华秋电子有限公司"
,
"厦门唯样科技有限公司"
,
"香港唯样科技有限公司"
,
"深圳市九州电子之家有限公司"
,
"深圳前海硬之城信息技术有限公司"
,
"北京京北通宇电子元件有限公司济南分公司"
]
];
\ No newline at end of file
resources/views/web/supplier/SupplierBase.blade.php
View file @
1e394010
...
...
@@ -20,10 +20,12 @@
<?php
$supplierType
=
config
(
'field.SupplierType'
);
$option
=
[
'required'
=>
true
];
//
正式供应商不允许修改供应商类型了或者是竞调供应商is_type=1也不允许修改供应商
if
((
!
empty
(
$supplier
)
&&
$supplier
[
'
supplier_type'
]
==
\App\Model\SupplierChannelModel
::
SUPPLIER_TYPE_OFFICIAL
)
||
(
!
empty
(
$supplier
)
&&
$supplier
[
'
is_type'
]
==
1
))
{
//
竞调供应商is_type=1也不允许修改供应商类型
if
((
!
empty
(
$supplier
)
&&
$supplier
[
'is_type'
]
==
1
))
{
$option
[
'disable'
]
=
true
;
}
//临时类型的供应商,不显示待转正选项
if
(
$supplier
[
'supplier_type'
]
==
2
)
{
unset
(
$supplierType
[
3
]);
}
...
...
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