Commit 9afd8ff9 by 杨树贤

上传规则区分现货的期货

parent 86ed2947
......@@ -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);
}
}
}
......@@ -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
}
......@@ -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();
......
......@@ -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,
],
......
......@@ -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: 380px">
<div class="layui-input-inline" style="width: 420px">
@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')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment