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
29ae6936
authored
Jun 14, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
批量修改内部编码
parent
73db0538
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
142 additions
and
5 deletions
app/Http/Controllers/Api/SkuApiController.php
app/Http/Controllers/SkuController.php
app/Http/Services/SkuService.php
resources/views/script/BatchUpdateEncodedScript.blade.php
resources/views/script/SkuListScript.blade.php
resources/views/web/BatchUpdateEncoded.blade.php
resources/views/web/SkuList.blade.php
app/Http/Controllers/Api/SkuApiController.php
View file @
29ae6936
...
...
@@ -87,6 +87,28 @@ class SkuApiController extends Controller
}
//批量修改内部编码
public
function
batchUpdateEncoded
(
$request
)
{
$canal
=
$request
->
get
(
'canal'
);
$encoded
=
$request
->
get
(
'encoded'
);
if
(
empty
(
$canal
))
{
$this
->
response
(
-
1
,
'请选择供应商'
);
}
if
(
empty
(
$encoded
))
{
$this
->
response
(
-
1
,
'请选择供内部编码(采购员)'
);
}
$data
=
[
'canal'
=>
$canal
,
"encoded"
=>
$encoded
,
];
//改成队列
(
new
SkuService
())
->
batchUpdateEncodedQueue
(
$data
);
$this
->
response
(
0
,
'批量修改内部编码任务已经发送,请等待任务完成,期间你可以刷新列表查看下架情况'
);
}
//批量上下架
public
function
batchUpdateSkuStatus
(
Request
$request
)
{
...
...
app/Http/Controllers/SkuController.php
View file @
29ae6936
...
...
@@ -73,6 +73,22 @@ class SkuController extends Controller
return
$this
->
view
(
'批量下架'
);
}
public
function
BatchUpdateEncoded
(
$request
)
{
//获取所有启用的供应商编码
$model
=
new
SupplierChannelModel
();
$suppliers
=
$model
->
where
(
'is_type'
,
0
)
->
where
(
'status'
,
2
)
->
select
([
'supplier_name'
,
'supplier_code'
])
->
get
();
$userCodes
=
(
new
IntracodeModel
())
->
getChannelUsersEncode
();
$supplierCodes
=
[];
foreach
(
$suppliers
as
$supplier
)
{
$supplier
=
$supplier
->
toArray
();
$supplierCodes
[
$supplier
[
'supplier_code'
]]
=
$supplier
[
'supplier_name'
]
.
'('
.
$supplier
[
'supplier_code'
]
.
')'
;
}
$this
->
data
[
'supplierCodes'
]
=
$supplierCodes
;
$this
->
data
[
'userCodes'
]
=
$userCodes
;
return
$this
->
view
(
'批量修改内部编码'
);
}
public
function
BatchUpdateSkuStatus
(
$request
)
{
return
$this
->
view
(
'批量上架'
);
...
...
app/Http/Services/SkuService.php
View file @
29ae6936
...
...
@@ -39,6 +39,9 @@ class SkuService
continue
;
}
$sku
=
json_decode
(
$redis
->
hget
(
'sku'
,
$goodsId
),
true
);
if
(
empty
(
$sku
))
{
continue
;
}
//赋值
$sku
[
'goods_id'
]
=
$goodsId
;
$sku
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
$sku
[
'update_time'
]);
...
...
@@ -165,6 +168,21 @@ class SkuService
$channel
->
basic_publish
(
$msg
,
''
,
'lie_footstone_batch_downsku_queue'
);
}
//批量修改内部编码
public
function
batchUpdateEncodedQueue
(
$data
)
{
$conn
=
new
AMQPStreamConnection
(
config
(
'database.connections.rabbitmq2.host'
),
config
(
'database.connections.rabbitmq2.port'
),
config
(
'database.connections.rabbitmq2.login'
),
config
(
'database.connections.rabbitmq2.password'
));
$channel
=
$conn
->
channel
();
$channel
->
queue_declare
(
'lie_footstone_update_sku_info_queue'
,
false
,
true
,
false
,
false
);
$msg
=
new
AMQPMessage
(
json_encode
(
$data
),
array
(
'content_type'
=>
'text/plain'
));
$channel
->
basic_publish
(
$msg
,
''
,
'lie_footstone_update_sku_info_queue'
);
}
//批量更新sku状态,走队列的
public
function
batchUpdateSkuStatus
(
$data
)
{
...
...
resources/views/script/BatchUpdateEncodedScript.blade.php
0 → 100644
View file @
29ae6936
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'table'
,
'layer'
,
'admin'
,
'xmSelect'
],
function
()
{
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
let
element
=
layui
.
element
;
let
xmSelect
=
layui
.
xmSelect
;
form
.
on
(
'submit(batchUpdateEncoded)'
,
function
(
data
)
{
let
url
=
'/api/sku/BatchUpdateEncoded'
;
let
res
=
ajax
(
url
,
data
.
field
);
if
(
!
res
)
{
layer
.
msg
(
'网络错误,请重试'
,
{
icon
:
6
});
}
else
{
if
(
res
.
err_code
===
0
)
{
admin
.
closeThisDialog
();
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
}
else
{
parent
.
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
}
return
false
;
});
form
.
on
(
'submit(cancel)'
,
function
(
data
)
{
admin
.
closeThisDialog
();
});
});
</script>
\ No newline at end of file
resources/views/script/SkuListScript.blade.php
View file @
29ae6936
...
...
@@ -242,6 +242,20 @@
});
});
//批量修改内部编码
$
(
"#batch_update_encoded"
).
click
(
function
()
{
layer
.
open
({
type
:
2
,
content
:
'/sku/BatchUpdateEncoded?view=iframe'
,
area
:
[
'800px'
,
'600px'
],
title
:
'批量修改内部编码'
,
end
:
function
()
{
table
.
reload
(
'skuList'
);
// supplierStatistics();
}
});
});
//批量上下架操作
function
batchUpdateGoodsStatus
(
skuIds
,
status
)
{
let
statusName
=
status
===
'offshelf'
?
'下架'
:
'上架'
;
...
...
resources/views/web/BatchUpdateEncoded.blade.php
0 → 100644
View file @
29ae6936
<style>
.layui-form-item
{
margin-bottom
:
5px
;
}
</style>
<div
class=
"layui-card"
>
<div
class=
"layui-card-body"
>
<form
class=
"layui-form"
action=
""
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
style=
"margin-left: -30px"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('canal','供应商选择 : ',null,
$supplierCodes,['required'=>true,'width'=>'400px']) !!}
</div>
</div>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
style=
"margin-left: -30px"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('encoded','内部编码 : ',null,
$userCodes,['required'=>true,'width'=>'400px']) !!}
</div>
</div>
<div
class=
"layui-form-item"
>
<div
align=
"center"
style=
"margin-top: 20px;text-align: right"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-info submit-loading"
lay-submit
lay-filter=
"batchUpdateEncoded"
>
确认
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-primary"
lay-submit
lay-filter=
"cancel"
>
取消
</button>
</div>
</div>
</form>
</div>
</div>
resources/views/web/SkuList.blade.php
View file @
29ae6936
...
...
@@ -4,11 +4,14 @@
@if(checkPerm('TempTemp'))
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
add_supplier
">新增</button>
@endif
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
batch_putaway
">上架</button>
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
batch_off_shelf
">下架</button>
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
remote_batch_off_shelf
">批量下架</button>
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
set_prefer
">设置精选</button>
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
cancel_set_prefer
">取消精选</button>
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
batch_putaway
">上架</button>
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
batch_off_shelf
">下架</button>
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
remote_batch_off_shelf
">批量下架</button>
@if (checkPerm('BatchUpdateEncoded'))
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
batch_update_encoded
">批量修改内部编码</button>
@endif
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
set_prefer
">设置精选</button>
<button type="
button
" class="
layui
-
btn
layui
-
btn
-
sm
" id="
cancel_set_prefer
">取消精选</button>
</div>
<table class="
layui
-
table
" id="
skuList
" lay-filter="
skuList
"></table>
...
...
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