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
9afd8ff9
authored
Aug 23, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
上传规则区分现货的期货
parent
86ed2947
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
37 deletions
app/Http/Services/DataService.php
app/Http/Services/SupplierSkuUploadRulerService.php
app/Http/routes.php
config/fixed.php
resources/views/web/supplier/SkuRuler.blade.php
app/Http/Services/DataService.php
View file @
9afd8ff9
...
...
@@ -1597,4 +1597,23 @@ class DataService
}
}
}
\ No newline at end of file
//初始化sku的规则
public
function
initFuturesSkuUploadRuler
()
{
$suppliers
=
SupplierChannelModel
::
where
(
'sku_upload_ruler'
,
'!='
,
''
)
->
get
()
->
toArray
();
foreach
(
$suppliers
as
$supplier
)
{
$uploadRuler
=
$supplier
[
'sku_upload_ruler'
];
$uploadRuler
=
json_decode
(
$uploadRuler
,
true
);
$uploadRuler
[
'futures_allow_stock_lte_0'
]
=
0
;
$uploadRuler
[
'futures_allow_moq_lte_0'
]
=
0
;
$uploadRuler
[
'futures_allow_price_null'
]
=
0
;
$uploadRuler
=
json_encode
(
$uploadRuler
);
SupplierChannelModel
::
where
(
'supplier_id'
,
$supplier
[
'supplier_id'
])
->
update
([
'sku_upload_ruler'
=>
$uploadRuler
,
]);
(
new
SupplierService
())
->
saveSkuUploadRulerToRedis
(
$supplier
[
'supplier_id'
],
$uploadRuler
);
}
}
}
app/Http/Services/SupplierSkuUploadRulerService.php
View file @
9afd8ff9
...
...
@@ -13,15 +13,21 @@ class SupplierSkuUploadRulerService
public
function
getSkuUploadRulerDesc
(
$ruler
)
{
if
(
empty
(
$ruler
))
{
return
'允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否'
;
return
'
现货 : 允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否 | 期货 :
允许库存为空:否 允许起订量为空:否 允许阶梯价为空:否'
;
}
$ruler
=
json_decode
(
$ruler
,
true
);
$desc
=
''
;
$desc
=
'现货 : '
;
$futuresDesc
=
'期货 : '
;
foreach
(
$ruler
as
$name
=>
$value
)
{
$name
=
array_get
(
config
(
'fixed.SkuUploadRuler'
),
$name
);
$desc
.=
$name
.
":"
.
(
$value
?
"是"
:
"否"
)
.
' '
;
if
(
strpos
(
$name
,
'futures'
)
!==
false
)
{
$name
=
array_get
(
config
(
'fixed.SkuUploadRuler'
),
$name
);
$futuresDesc
.=
$name
.
":"
.
(
$value
?
"是"
:
"否"
)
.
' '
;
}
else
{
$name
=
array_get
(
config
(
'fixed.SkuUploadRuler'
),
$name
);
$desc
.=
$name
.
":"
.
(
$value
?
"是"
:
"否"
)
.
' '
;
}
}
return
$desc
;
return
$desc
.
' | '
.
$futuresDesc
;
}
//给默认的sku上传规则
...
...
@@ -29,7 +35,7 @@ class SupplierSkuUploadRulerService
{
if
(
empty
(
$ruler
))
{
return
config
(
'fixed.SkuUploadDefaultRuler'
);
}
else
{
}
else
{
return
json_decode
(
$ruler
,
true
);
}
...
...
@@ -53,4 +59,4 @@ class SupplierSkuUploadRulerService
return
json_encode
(
$rulers
);
}
}
}
\ No newline at end of file
}
app/Http/routes.php
View file @
9afd8ff9
...
...
@@ -80,14 +80,15 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
$data
=
[
'supplier_code'
=>
'L0015420'
,
'brand_id'
=>
0
,
'log_id'
=>
8379
,
"down_type"
=>
1
,
];
//改成队列
(
new
SkuService
())
->
batchOffShelfSkuQueue
(
$data
);
(
new
\App\Http\Services\DataService
())
->
initFuturesSkuUploadRuler
();
// $data = [
// 'supplier_code' => 'L0015420',
// 'brand_id' => 0,
// 'log_id' => 8379,
// "down_type" => 1,
// ];
// //改成队列
// (new SkuService())->batchOffShelfSkuQueue($data);
// (new \App\Http\Services\SupplierService())->initialCpTimeDays(15307, 5);
// (new \App\Http\Services\DataService())->initFuturesCpTime();
...
...
config/fixed.php
View file @
9afd8ff9
...
...
@@ -157,10 +157,16 @@ return [
//{"allow_stock_lte_0":0,"allow_moq_lte_0":1,"allow_stock_lt_moq":0,"allow_price_null":1}
'SkuUploadRuler'
=>
[
//现货
'allow_stock_lte_0'
=>
'允许库存为空'
,
'allow_moq_lte_0'
=>
'允许起订量为空'
,
// 'allow_stock_lt_moq' => '允许起订量大于库存',
'allow_price_null'
=>
'允许阶梯价为空'
,
//期货
'futures_allow_stock_lte_0'
=>
'允许库存为空'
,
'futures_allow_moq_lte_0'
=>
'允许起订量为空'
,
// 'futures_allow_stock_lt_moq' => '允许起订量大于库存',
'futures_allow_price_null'
=>
'允许阶梯价为空'
,
],
'SkuUploadDefaultRuler'
=>
[
...
...
@@ -168,6 +174,10 @@ return [
'allow_moq_lte_0'
=>
0
,
'allow_stock_lt_moq'
=>
0
,
'allow_price_null'
=>
0
,
'futures_allow_stock_lte_0'
=>
0
,
'futures_allow_moq_lte_0'
=>
0
,
'futures_allow_stock_lt_moq'
=>
0
,
'futures_allow_price_null'
=>
0
,
],
...
...
resources/views/web/supplier/SkuRuler.blade.php
View file @
9afd8ff9
...
...
@@ -19,24 +19,67 @@
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
style=
"width: 100%"
>
<label
class=
"layui-form-label"
>
数据新增规则 :
</label>
<div
class=
"layui-input-inline"
style=
"width:
38
0px"
>
<div
class=
"layui-input-inline"
style=
"width:
42
0px"
>
@if(!empty($supplier['sku_upload_ruler']))
@foreach($supplier['sku_upload_ruler'] as $key=>$flag)
@if(!empty(array_get(config('fixed.SkuUploadRuler'),$key)))
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuUploadRuler'),$key)}}"
>
@endif
@endforeach
<div
class=
"layui-row"
>
现货 :
@foreach($supplier['sku_upload_ruler'] as $key=>$flag)
@php
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler)
&&
strpos($key,'futures')===false)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuUploadRuler'),$key)}}"
>
@endif
@endforeach
</div>
<div
class=
"layui-row"
>
期货 :
@foreach($supplier['sku_upload_ruler'] as $key=>$flag)
@php
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler)
&&
strpos($key,'futures')!==false)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuUploadRuler'),$key)}}"
>
@endif
@endforeach
</div>
@else
@foreach(config('fixed.SkuUploadRuler') as $key=>$flag)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
title=
"{{$flag}}"
>
@endforeach
<div
class=
"layui-row"
>
现货 :
@foreach(config('fixed.SkuUploadRuler') as $key=>$flag)
@php
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler)
&&
strpos($key,'futures')===false)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
title=
"{{$flag}}"
>
@endif
@endforeach
</div>
<div
class=
"layui-row"
>
期货 :
@foreach(config('fixed.SkuUploadRuler') as $key=>$flag)
@php
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler)
&&
strpos($key,'futures')!==false)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
title=
"{{$flag}}"
>
@endif
@endforeach
</div>
@endif
</div>
<div
class=
"layui-form-mid layui-word-aux"
>
...
...
@@ -62,7 +105,7 @@
lay-skin=
"primary"
class=
"audit_ruler_item"
@
if
($
flag
)
checked
checked
@
endif
title=
"{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}"
>
@endif
...
...
@@ -79,4 +122,4 @@
@include('web.supplier.SkuUploadStatus');
</div>
@include('script.supplier.SkuRulerScript')
\ No newline at end of file
@include('script.supplier.SkuRulerScript')
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