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
760f46da
authored
Aug 22, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
需求完成
parent
6705fe22
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
16 deletions
app/Http/Controllers/SupplierController.php
app/Http/Services/SupplierExaminationService.php
app/Model/IntracodeModel.php
config/field.php
public/data/import_examination_template.xlsx
resources/views/script/SupplierExaminationListScript.blade.php
resources/views/web/AddSupplier.blade.php
app/Http/Controllers/SupplierController.php
View file @
760f46da
...
...
@@ -152,7 +152,9 @@ class SupplierController extends Controller
'value'
=>
$userId
,
];
}
$defaultPurchaseUid
=
$intraCodeModel
->
getCodeIdByUserName
(
config
(
'field.DefaultPurchaseName'
));
$this
->
data
[
'operate'
]
=
'add'
;
$this
->
data
[
'default_purchase_uid'
]
=
$defaultPurchaseUid
;
//省市区数据放到script模板
$regionService
=
new
RegionService
();
$this
->
data
[
'region_data'
]
=
$regionService
->
getCityRegionData
();
...
...
app/Http/Services/SupplierExaminationService.php
View file @
760f46da
...
...
@@ -70,6 +70,7 @@ class SupplierExaminationService
$supplierNames
=
(
new
SupplierChannelModel
())
->
where
(
'is_type'
,
0
)
->
pluck
(
'supplier_name'
)
->
toArray
();
//拼装数据插入校验,校验完成插入数据库
$examineData
=
[];
$errMsg
=
[];
foreach
(
$data
as
$index
=>
$item
)
{
if
(
$this
->
checkArrAllNull
(
$item
))
{
continue
;
...
...
@@ -90,7 +91,7 @@ class SupplierExaminationService
$supplierName
=
$item
[
6
];
$skuName
=
$item
[
7
];
$brandName
=
$item
[
8
];
$amount
=
str_replace
(
','
,
''
,
$item
[
9
]);
$amount
=
str_replace
(
','
,
''
,
$item
[
9
]);
$batch
=
$item
[
10
];
$producingArea
=
$item
[
11
];
$stockInDate
=
$item
[
12
];
...
...
@@ -98,49 +99,49 @@ class SupplierExaminationService
$deliverySn
=
$item
[
14
];
$tallyRequest
=
$item
[
15
];
$examineRequest
=
$item
[
16
];
$unhealthyAmount
=
str_replace
(
','
,
''
,
$item
[
17
]);
$unhealthyAmount
=
str_replace
(
','
,
''
,
$item
[
17
]);
$abnormalLevel
=
$item
[
18
];
$unhealthyContent
=
$item
[
19
];
$examineResult
=
$item
[
20
];
$remark
=
$item
[
21
];
if
(
empty
(
$supplierName
))
{
throw
new
\Exception
(
"供应商名称不能为空! (第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"供应商名称不能为空! (第${lineNo}行)"
;
}
if
(
empty
(
$examineTime
))
{
throw
new
\Exception
(
"检货时间不能为空! (第${lineNo}行),请修改为 2000-01-01 这种格式后再次提交"
)
;
$errMsg
[]
=
"检货时间不能为空! (第${lineNo}行),请修改为 2000-01-01 这种格式后再次提交"
;
}
if
(
!
isDateTime
(
$examineTime
))
{
throw
new
\Exception
(
"检货时间格式不规范! (第${lineNo}行),请修改为 2022/10/10 这种格式后再次提交"
)
;
$errMsg
[]
=
"检货时间格式不规范! (第${lineNo}行),请修改为 2022/10/10 这种格式后再次提交"
;
}
if
(
!
empty
(
$stockInDate
)
&&
!
isDateTime
(
$stockInDate
))
{
throw
new
\Exception
(
"入库日期时间格式不规范! (第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"入库日期时间格式不规范! (第${lineNo}行)"
;
}
if
(
!
in_array
(
$supplierName
,
$supplierNames
))
{
throw
new
\Exception
(
"存在无效供应商(供应商系统不存在)的数据(第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"存在无效供应商(供应商系统不存在)的数据(第${lineNo}行)"
;
}
if
(
!
in_array
(
$channelUserName
,
$channelUserNames
))
{
throw
new
\Exception
(
"存在无效的采购员(第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"存在无效的采购员(第${lineNo}行)"
;
}
if
(
empty
(
$skuName
))
{
throw
new
\Exception
(
"型号不能为空! (第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"型号不能为空! (第${lineNo}行)"
;
}
if
(
empty
(
$brandName
))
{
throw
new
\Exception
(
"品牌不能为空! (第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"品牌不能为空! (第${lineNo}行)"
;
}
if
(
!
is_numeric
(
$amount
)
||
empty
(
$amount
))
{
throw
new
\Exception
(
"数量只能为纯数字且不能为空! (第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"数量只能为纯数字且不能为空! (第${lineNo}行)"
;
}
if
(
empty
(
$examineResult
)
||
!
in_array
(
$examineResult
,
array_values
(
config
(
'field.SupplierExamineResult'
))))
{
throw
new
\Exception
(
"检验结果只能(退货|特批入库|正常入库)其中一个且不能为空 (第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"检验结果只能(退货|特批入库|正常入库|待处理)其中一个且不能为空 (第${lineNo}行)"
;
}
if
(
!
empty
(
$abnormalLevel
)
&&
!
in_array
(
$abnormalLevel
,
[
1
,
2
,
3
]))
{
throw
new
\Exception
(
"存在不合理的异常等级,等级必须为纯数字1,2,3或者不填 (第${lineNo}行),请修改后再次提交"
)
;
$errMsg
[]
=
"存在不合理的异常等级,等级必须为纯数字1,2,3或者不填 (第${lineNo}行)"
;
}
$examineData
[]
=
[
...
...
@@ -173,6 +174,11 @@ class SupplierExaminationService
];
}
if
(
$errMsg
)
{
$errMsg
=
implode
(
'&'
,
$errMsg
);
throw
new
\Exception
(
$errMsg
);
}
$examineData
=
collect
(
$examineData
);
foreach
(
$examineData
->
chunk
(
50
)
as
$chunk
)
{
SupplierExaminationModel
::
insert
(
$chunk
->
toArray
());
...
...
app/Model/IntracodeModel.php
View file @
760f46da
...
...
@@ -116,6 +116,15 @@ class IntracodeModel extends Model
return
$result
;
}
public
function
getCodeIdByUserName
(
$userName
)
{
$codeId
=
$this
->
where
(
'admin_id'
,
'>'
,
0
)
->
join
(
'user_info'
,
'lie_intracode.admin_id'
,
'='
,
'user_info.userId'
)
->
where
(
'user_info.name'
,
$userName
)
->
value
(
'code_id'
);
return
$codeId
;
}
public
function
getEncodeByUserIds
(
$userIds
=
[],
$includeResign
=
true
)
{
$query
=
$this
->
where
(
'admin_id'
,
'>'
,
0
)
->
join
(
'user_info'
,
'lie_intracode.admin_id'
,
'='
,
'user_info.userId'
)
...
...
config/field.php
View file @
760f46da
...
...
@@ -203,5 +203,9 @@ return [
'退货'
=>
'退货'
,
'特批入库'
=>
'特批入库'
,
'正常入库'
=>
'正常入库'
,
]
'待处理'
=>
'待处理'
,
],
//新增供应商的时候默认的采购开发员
'DefaultPurchaseName'
=>
'欧中云'
];
\ No newline at end of file
public/data/import_examination_template.xlsx
View file @
760f46da
No preview for this file type
resources/views/script/SupplierExaminationListScript.blade.php
View file @
760f46da
...
...
@@ -219,7 +219,12 @@
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
table
.
reload
(
'supplierExaminationList'
);
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
let
errMsg
=
res
.
err_msg
;
let
msg
=
''
;
$
.
each
(
errMsg
.
split
(
'&'
),
function
(
index
,
value
)
{
msg
+=
"
<
span
>
" + value + "
<
/span><br>
"
});
layer
.
msg
(
msg
,
{
icon
:
5
,
time
:
5000
})
}
},
error
:
function
()
{
...
...
resources/views/web/AddSupplier.blade.php
View file @
760f46da
...
...
@@ -105,7 +105,7 @@
<div
class=
"layui-row"
>
<div
class=
"layui-col-md3"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('purchase_uid','渠道开发员 : ',
''
,$userCodes,['required'=>true,'width'=>'150px']) !!}
{!! $statusPresenter->render('purchase_uid','渠道开发员 : ',
$default_purchase_uid
,$userCodes,['required'=>true,'width'=>'150px']) !!}
</div>
<div
class=
"layui-col-md3"
>
<label
class=
"layui-form-label"
><span
class=
"require"
>
*
</span>
注册资金(万):
</label>
...
...
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