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
d75fe64a
authored
Jul 14, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
sku上传情况
parent
c60c9d82
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
206 additions
and
13 deletions
app/Http/Controllers/Api/SkuUploadLogApiController.php
app/Http/Controllers/SupplierController.php
app/Http/Services/SkuUploadLogService.php
app/Http/Services/SupplierExaminationService.php
app/Http/Transformers/SkuUploadLogTransformer.php
app/Http/Validators/SupplierExaminationValidator.php
app/Http/routes.php
app/Model/SkuUploadLogModel.php
config/field.php
public/data/import_supplier_examination_template - 副本.csv
resources/views/script/AddSupplierExaminationScript.blade.php
resources/views/script/SupplierExaminationListScript.blade.php
resources/views/script/UpdateSupplierExaminationScript.blade.php
resources/views/script/supplier/SkuUploadStatusScript.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/supplier/SkuRuler.blade.php
resources/views/web/supplier/SkuUploadStatus.blade.php
app/Http/Controllers/Api/SkuUploadLogApiController.php
0 → 100644
View file @
d75fe64a
<?php
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\SkuUploadLogService
;
use
App\Http\Transformers\LogTransformer
;
use
App\Model\LogModel
;
use
Illuminate\Http\Request
;
class
SkuUploadLogApiController
extends
Controller
{
public
function
Entrance
(
Request
$request
,
$id
)
{
$this
->
$id
(
$request
,
$id
);
}
//获取供应商信息变更记录
public
function
GetSkuUploadLogList
(
$request
)
{
$data
=
$request
->
only
([
'supplier_id'
,
'limit'
,
'page'
]);
$list
=
(
new
SkuUploadLogService
())
->
getSkuUploadLogList
(
$data
);
$this
->
response
(
0
,
'ok'
,
$list
[
'data'
],
$list
[
'total'
]);
}
}
app/Http/Controllers/SupplierController.php
View file @
d75fe64a
...
...
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use
App\Http\Services\LogService
;
use
App\Http\Services\RegionService
;
use
App\Http\Services\SkuUploadLogService
;
use
App\Http\Services\SupplierAttachmentService
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\SupplierShareApplyService
;
...
...
@@ -128,6 +129,7 @@ class SupplierController extends Controller
]);
$this
->
data
[
'province_city'
]
=
implode
(
' | '
,
$regionNames
);
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
$this
->
data
[
'sku_upload_log_count'
]
=
(
new
SkuUploadLogService
())
->
getSkuUploadLogCount
(
$supplierId
);
return
$this
->
view
(
'供应商详情'
);
}
...
...
@@ -212,6 +214,7 @@ class SupplierController extends Controller
$this
->
data
[
'address'
]
=
$supplierService
->
getAddress
(
$supplierId
);
$this
->
data
[
'ignore_supplier_type_change_tips'
]
=
in_array
(
$supplier
[
'supplier_name'
],
config
(
'field.SkipChangeSupplierTypeNames'
));
$this
->
data
[
'sku_upload_log_count'
]
=
(
new
SkuUploadLogService
())
->
getSkuUploadLogCount
(
$supplierId
);
return
$this
->
view
(
'编辑供应商'
);
}
...
...
app/Http/Services/SkuUploadLogService.php
0 → 100644
View file @
d75fe64a
<?php
namespace
App\Http\Services
;
use
App\Http\Controllers\Filter\LogFilter
;
use
App\Http\Transformers\LogTransformer
;
use
App\Http\Transformers\SkuUploadLogTransformer
;
use
App\Http\Transformers\SupplierTransformer
;
use
App\Model\LogModel
;
use
App\Model\SkuUploadLogModel
;
use
App\Model\SupplierChannelModel
;
class
SkuUploadLogService
{
public
function
getSkuUploadLogList
(
$params
)
{
$limit
=
array_get
(
$params
,
'limit'
,
10
);
$query
=
SkuUploadLogModel
::
withCount
(
'upload_items'
)
->
orderBy
(
'id'
,
'desc'
);
if
(
!
empty
(
$params
[
'supplier_id'
]))
{
$supplierCode
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$params
[
'supplier_id'
])
->
value
(
'supplier_code'
);
$query
->
where
(
'supplier_code'
,
$supplierCode
);
}
$list
=
$query
->
paginate
(
$limit
)
->
toArray
();
$list
[
'data'
]
=
(
new
SkuUploadLogTransformer
())
->
transformList
(
$list
[
'data'
]);
return
$list
;
}
//获取上传次数
public
function
getSkuUploadLogCount
(
$supplierId
)
{
$supplierCode
=
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplierId
)
->
value
(
'supplier_code'
);
return
SkuUploadLogModel
::
where
(
'supplier_code'
,
$supplierCode
)
->
count
();
}
}
\ No newline at end of file
app/Http/Services/SupplierExaminationService.php
View file @
d75fe64a
...
...
@@ -68,7 +68,11 @@ class SupplierExaminationService
//拼装数据插入校验,校验完成插入数据库
$examineData
=
[];
foreach
(
$data
as
$index
=>
$item
)
{
//检测模板头部
if
(
$index
==
0
)
{
if
(
!
$this
->
checkImportCsvHeader
(
$item
))
{
throw
new
\Exception
(
'文件不是标准上传模板'
);
}
continue
;
}
$item
=
array_map
(
function
(
$value
)
{
...
...
@@ -118,8 +122,31 @@ class SupplierExaminationService
},
$fileType
);
}
catch
(
\Exception
$exception
)
{
return
$exception
->
getMessage
();
}
finally
{
unlink
(
$filePath
);
}
return
true
;
}
private
function
checkImportCsvHeader
(
$header
)
{
$validHeader
=
[
'检货时间'
,
'采购员'
,
'供应商'
,
'型号'
,
'品牌'
,
'数量'
,
'检验数量'
,
'不良数'
,
'异常等级'
,
'不良现象'
,
'检验结果'
,
'处理方式'
,
'备注'
];
return
$validHeader
==
$header
;
}
}
\ No newline at end of file
app/Http/Transformers/SkuUploadLogTransformer.php
0 → 100644
View file @
d75fe64a
<?php
namespace
App\Http\Transformers
;
class
SkuUploadLogTransformer
{
public
function
transformList
(
$list
)
{
foreach
(
$list
as
&
$item
)
{
$item
[
'create_time'
]
=
!
empty
(
$item
[
'create_time'
])
?
date
(
'Y-m-d H:i:s'
,
$item
[
'create_time'
])
:
''
;
$item
[
'status'
]
=
array_get
(
config
(
'field.SkuUploadLogStatus'
),
$item
[
'status'
]);
}
unset
(
$item
);
return
$list
;
}
}
\ No newline at end of file
app/Http/Validators/SupplierExaminationValidator.php
View file @
d75fe64a
...
...
@@ -20,20 +20,19 @@ class SupplierExaminationValidator
"purchase_name"
=>
"required"
,
"sku_name"
=>
"required"
,
"brand_name"
=>
"required"
,
"amount"
=>
"required
|numeric
"
,
"amount"
=>
"required"
,
"examine_amount"
=>
"required"
,
"unhealthy_amount"
=>
"required"
,
"unhealthy_content"
=>
"required"
,
"examine_result"
=>
"required"
,
"abnormal_level"
=>
"required"
,
"handle_way"
=>
"required"
,
"remark"
=>
"required"
,
];
$messages
=
$this
->
messages
();
$validator
=
Validator
::
make
(
$params
,
$rules
,
$messages
,
$this
->
attributes
());
//判断联系方式的表单验证
if
(
$validator
->
fails
())
{
return
$validator
->
errors
()
->
first
(
);
return
implode
(
'|'
,
$validator
->
errors
()
->
all
()
);
}
return
null
;
...
...
app/Http/routes.php
View file @
d75fe64a
...
...
@@ -47,6 +47,7 @@ Route::group(['middleware' => ['web'], 'namespace' => 'Api'], function () {
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_tag/{key}'
,
'SupplierTagApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_share_apply/{key}'
,
'SupplierShareApplyApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/supplier_examination/{key}'
,
'SupplierExaminationApiController@Entrance'
);
Route
::
match
([
'get'
,
'post'
],
'/api/sku_upload_log/{key}'
,
'SkuUploadLogApiController@Entrance'
);
});
//提供给其它系统使用的接口
...
...
app/Model/SkuUploadLogModel.php
View file @
d75fe64a
...
...
@@ -12,4 +12,9 @@ class SkuUploadLogModel extends Model
public
$timestamps
=
false
;
const
STATUS_HANDLED
=
3
;
public
function
upload_items
()
{
return
$this
->
hasMany
(
SkuUploadItem
::
class
,
'log_id'
,
'id'
);
}
}
config/field.php
View file @
d75fe64a
...
...
@@ -184,4 +184,11 @@ return [
//专门给采购助理这个账号要做特殊逻辑,采购系统那边没有按照正常流程去判断,导致这个账号的部门分布完全不合理,所以供应商系统这边只能恶心自己去加特殊跳过了
'AssistantUserId'
=>
1635
,
'SkuUploadLogStatus'
=>
[
1
=>
'待处理'
,
2
=>
'处理中'
,
3
=>
'执行上传完成'
,
4
=>
'其他失败'
,
]
];
\ No newline at end of file
public/data/import_supplier_examination_template - 副本.csv
View file @
d75fe64a
检货时间,
采购员,供应商,型号,品牌,数量,检验数量,不良数,异常等级,不良现象,检验结果,处理方式,备注
检货时间,
采购员,供应商,型号,品牌,数量,检验数量,不良数,异常等级,不良现象,检验结果,处理方式,备注
...
...
@@ -3,7 +3,7 @@
2020/8/31,谭博利,Bentley Technologies,PM75CSA120,MITSUBISHI,2,2,,,使用过的擦磨旧货,,己跟采购说明,已出货。,
2020/8/31,马玉强,深圳市有芯电子有限公司,17-21/Y2C-AN1P2B/3T,亿光,3K,3K,,,标签不正常,,己跟采购说明,已出货。,
2020/9/1,邓小姣,深圳市铭盛微电子有限公司,MP6922DSE-LF-Z,MPS,2253,2253,标签不正常,,本体丝印格式错误且与标签信息不符,山寨货,退货,
2020/9/1,陈燕,深圳市长河世纪科技有限公司,LMDL301T1G,LRC,3K,3K,标签不正常,,本体丝印错误,山寨货,退货,
2020/9/1,陈燕,深圳市长河世纪科技有限公司,LMDL301T1G,LRC,3K,3K,标签不正常,,本体丝印错误,山寨货,退货
1
,
2020/9/1,段灵芝,Integrated Electronics Company,IXBA14N300HV,IXYS,525,525,无原标签,,本体丝印不统一且与标签D/C不相符,重编带货,让步采用,
2020/9/17,汤浩升,深圳市亿威盛创科技有限公司,TS3USB221RSER,TI,800,800,无盘无标签,,反面有明显划痕,1136重新编带货,,
2020/9/21,陈泽彬,深圳市满多鑫电子有限公司,MTFC4GMDEA-4M IT,MICRON,12,12,无盘无标签,,反面有污迹少数球珠有伤痕个别球珠有氧化现象,重编带货,,
...
...
resources/views/script/AddSupplierExaminationScript.blade.php
View file @
d75fe64a
...
...
@@ -16,7 +16,12 @@
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
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>
"
});
parent
.
layer
.
msg
(
msg
,
{
icon
:
5
})
}
}
return
false
;
...
...
resources/views/script/SupplierExaminationListScript.blade.php
View file @
d75fe64a
...
...
@@ -100,7 +100,7 @@
if
(
!
data
.
length
)
{
layer
.
msg
(
'请先选择要操作的检测数据'
,
{
icon
:
5
})
}
else
{
layer
.
confirm
(
'
确定要删除检测数据吗
?'
,
function
(
index
)
{
layer
.
confirm
(
'
是否对该条记录进行删除
?'
,
function
(
index
)
{
let
ids
=
[];
$
.
each
(
data
,
function
(
index
,
value
)
{
ids
.
push
(
value
.
id
);
...
...
resources/views/script/UpdateSupplierExaminationScript.blade.php
View file @
d75fe64a
...
...
@@ -6,7 +6,7 @@
let
xmSelect
=
layui
.
xmSelect
;
form
.
on
(
'submit(addSupplierExamination)'
,
function
(
data
)
{
layer
.
confirm
(
'是否确认修改IQC检测资料
s
?'
,
function
(
index
)
{
layer
.
confirm
(
'是否确认修改IQC检测资料?'
,
function
(
index
)
{
let
url
=
'/api/supplier_examination/UpdateSupplierExamination'
;
let
res
=
ajax
(
url
,
data
.
field
);
if
(
!
res
)
{
...
...
@@ -16,7 +16,12 @@
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
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>
"
});
parent
.
layer
.
msg
(
msg
,
{
icon
:
5
})
}
}
return
false
;
...
...
resources/views/script/supplier/SkuUploadStatusScript.blade.php
0 → 100644
View file @
d75fe64a
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'layer'
,
'admin'
],
function
()
{
let
table
=
layui
.
table
;
table
.
render
({
elem
:
'#skuUploadLogList'
,
url
:
'/api/sku_upload_log/GetSkuUploadLogList'
,
method
:
'get'
,
cellMinWidth
:
80
,
//全局定义常规单元格的最小宽度
where
:
{
supplier_id
:
getQueryVariable
(
"supplier_id"
)
},
size
:
'sm'
,
loading
:
true
,
first
:
true
,
//不显示首页
last
:
false
,
//不显示尾页
cols
:
[[
{
field
:
'create_time'
,
title
:
'上传时间'
,
align
:
'center'
,
width
:
150
},
{
field
:
'status'
,
title
:
'状态'
,
align
:
'center'
,
width
:
600
},
{
field
:
'upload_items_count'
,
title
:
'上传SKU数量'
,
align
:
'center'
,
width
:
500
},
]],
id
:
'skuUploadLogList'
,
page
:
{},
});
});
</script>
\ No newline at end of file
resources/views/web/SupplierDetail.blade.php
View file @
d75fe64a
...
...
@@ -89,9 +89,9 @@
</button>
@endif
@if($supplier['status']==\App\Model\SupplierChannelModel::STATUS_BLOCK
&&
checkPerm('CancelBlockSupplier'))
{{--
<button
type=
"button"
style=
"margin-bottom: 25px;margin-top: 5px"
id=
"cancel_block_supplier"
--
}}
{{
--
class=
"layui-btn layui-btn"
>
取消拉黑--}}
{{--
</button>
--}}
{{--
<button
type=
"button"
style=
"margin-bottom: 25px;margin-top: 5px"
id=
"cancel_block_supplier"
--
}}
{{
--
class=
"layui-btn layui-btn"
>
取消拉黑--}}
{{--
</button>
--}}
@endif
@endif
@if (checkPerm('PrintSupplier'))
...
...
@@ -134,7 +134,8 @@
供应商英文名称 :{{$supplier['supplier_name_en']}}
</div>
<div
class=
"layui-row"
>
<span
class=
"required_field"
>
*
</span>
注册资金 :{{$supplier['registered_capital']?$supplier['registered_capital']."(万)":'未设置'}}
<span
class=
"required_field"
>
*
</span>
注册资金
:{{$supplier['registered_capital']?$supplier['registered_capital']."(万)":'未设置'}}
</div>
<div
class=
"layui-row"
>
<span
class=
"is_business_abnormal"
>
*
</span>
是否历史经营异常
...
...
@@ -466,6 +467,7 @@
</div>
</div>
</div>
@include('web.supplier.SkuUploadStatus');
<hr>
</div>
</div>
...
...
resources/views/web/supplier/SkuRuler.blade.php
View file @
d75fe64a
...
...
@@ -76,6 +76,7 @@
@endif
</div>
</div>
@include('web.supplier.SkuUploadStatus');
</div>
@include('script.supplier.SkuRulerScript')
\ No newline at end of file
resources/views/web/supplier/SkuUploadStatus.blade.php
0 → 100644
View file @
d75fe64a
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
sku上传情况
</b>
</blockquote>
<div
class=
"layui-row"
style=
"padding-left: 20px"
>
<div
class=
"layui-col-md2"
>
SKU 上传次数 :
<b
style=
"color: red"
>
{{$sku_upload_log_count or 0}}
</b>
次
</div>
</div>
<div
class=
"layui-row"
style=
"padding-left: 20px"
>
<div
class=
"layui-col-md12"
>
SKU 历史上传情况 :
</div>
<table
class=
"layui-table"
lay-filter=
"skuUploadLogList"
id=
"skuUploadLogList"
></table>
</div>
@include('script.supplier.SkuUploadStatusScript')
\ No newline at end of file
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