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
5c6b89e5
authored
Jul 05, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
云芯统计
parent
96cdec3b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
24 deletions
.env
app/Http/Services/DataService.php
app/Http/routes.php
.env
View file @
5c6b89e5
...
...
@@ -121,6 +121,7 @@ RABBITMQ2_QUEUE=wms_service
#RABBITMQ_PASSWORD=jy2y2900
ES_SKU_URL=http://so.liexin.net/search/Es/searchSku
ES_URL=http://so.liexin.net
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
...
...
app/Http/Services/DataService.php
View file @
5c6b89e5
...
...
@@ -1277,27 +1277,69 @@ class DataService
// echo("<p>SKU 上架条数(不含API接口):" . $skuNum2 . '</p>');
}
//获取采购系统24号作废的深圳入库明细
public
function
getDeletedSZStockInItemList
()
public
function
statisticsSkuNumberFromSKu
()
{
$todayTime
=
Carbon
::
now
()
->
startOfDay
()
->
timestamp
;
//->where('item_status',-3)
$stockInItems
=
StockInItemModel
::
where
(
'create_time'
,
'>'
,
$todayTime
)
->
where
(
'item_status'
,
-
3
)
->
whereHas
(
'stock_in'
,
function
(
$q
)
{
$q
->
whereIn
(
'stock_in_type'
,
[
3
]);
})
->
get
()
->
toArray
();
dd
(
count
(
$stockInItems
));
foreach
(
$stockInItems
as
$stockInItem
)
{
$first
=
$stockInItem
[
'stock_in_item_id'
];
dd
(
$first
,
$stockInItem
[
'stock_in_id'
]);
StockInItemModel
::
where
(
'stock_in_item_id'
,
$first
)
->
update
([
'item_status'
=>
1
]);
StockInModel
::
where
(
'stock_in_id'
,
$stockInItem
[
'stock_in_id'
])
->
update
([
'erp_stock_in_sn'
=>
''
,
'status'
=>
1
]);
$excludeSupplierCodeList
=
[
'L0004938'
,
'L0007913'
,
'L0011546'
,
'L0001175'
,
'L0007243'
,
'L0015040'
,
];
$dataManagerSupplierCodeList
=
DataManageModel
::
where
(
'is_type'
,
0
)
->
where
(
'canal'
,
'!='
,
''
)
->
pluck
(
'canal'
)
->
toArray
();
$excludeSupplierCodeList
=
array_merge
(
$excludeSupplierCodeList
,
$dataManagerSupplierCodeList
);
//sku上架总数含api接口
$skuNum1
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'supplier_group'
,
'!='
,
4
)
->
whereNotIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
whereNotIn
(
'supplier_code'
,
$excludeSupplierCodeList
)
->
sum
(
'sku_num'
);
//sku上架总数,不含api接口
$skuNum2
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'supplier_group'
,
'!='
,
4
)
->
whereNotIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
whereNotIn
(
'supplier_code'
,
$excludeSupplierCodeList
)
->
sum
(
'sku_num'
);
//有上架sku的供应商
$supplierCount
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'supplier_group'
,
'!='
,
4
)
->
whereNotIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
whereNotIn
(
'supplier_code'
,
$excludeSupplierCodeList
)
->
where
(
'sku_num'
,
'>'
,
0
)
->
count
();
//云芯供应商编码
$yunxinSupplierCodes
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'stockup_type'
,
'like'
,
'%5%'
)
->
where
(
'sku_num'
,
'>'
,
0
)
->
pluck
(
'supplier_code'
)
->
toArray
();
//找出哪些是芯链上传的
// $yunxinUploadSupplierCodes = SkuUploadLogModel::whereIn('supplier_code', $yunxinSupplierCodes)->where('source', 2)->pluck('supplier_code')->unique()->toArray();
$yunxinUploadSupplierCount
=
0
;
$esUrl
=
env
(
'ES_URL'
,
''
);
$map
=
[
"source/eq"
=>
7
,
"supplier_id"
=>
17
,
"goods_status"
=>
1
,
];
$return
=
curl
(
$esUrl
,
$map
,
1
);
$return
=
json_decode
(
$return
,
true
);
$yunxinUploadSupplierCount
=
0
;
if
(
isset
(
$return
[
'error_code'
])
&
$return
[
'error_code'
]
==
0
)
{
$yunxinUploadSupplierCount
=
$return
[
'data'
][
'total'
];
}
dd
(
count
((
array_column
(
$stockInItems
,
'stock_in_item_id'
))));
// $skuNumYunxin = SupplierChannelModel::whereIn('supplier_code', $yunxinUploadSupplierCodes)->sum('sku_num');
//去搜索直接获取
$url
=
env
(
'ES_SKU_URL'
,
''
);
$map
=
[
"source/eq"
=>
"7"
,
"supplier_id"
=>
17
,
"p"
=>
"1"
,
"offset"
=>
"20"
,
"show_status"
=>
1
];
$return
=
curl
(
$url
,
$map
,
1
);
$return
=
json_decode
(
$return
,
true
);
$skuNumYunxin
=
0
;
if
(
isset
(
$return
[
'error_code'
])
&
$return
[
'error_code'
]
==
0
)
{
$skuNumYunxin
=
$return
[
'data'
][
'total'
];
}
echo
(
"<p>上架供应商数(全部):"
.
$supplierCount
.
'</p>'
);
echo
(
"<p>上架供应商数(仅芯链):"
.
count
(
$yunxinUploadSupplierCount
)
.
'</p>'
);
echo
(
"<p>SKU上架总条数(全部):"
.
$skuNum1
.
'</p>'
);
echo
(
"<p>SKU上架总条数(仅芯链):"
.
$skuNumYunxin
.
'</p>'
);
// echo("<p>SKU 上架条数(不含API接口):" . $skuNum2 . '</p>');
}
//统计有上传sku的供应商
...
...
@@ -1449,15 +1491,15 @@ class DataService
}
if
(
$supplier
[
'create_name'
])
{
$createName
=
$supplier
[
'create_name'
];
}
else
if
(
$supplier
[
'create_uid'
])
{
}
else
if
(
$supplier
[
'create_uid'
])
{
$createUser
=
(
new
AdminUserService
())
->
getAdminUserInfo
(
$supplier
[
'create_uid'
]);
$createName
=
array_get
(
$createUser
,
'name'
,
''
);
$createName
=
array_get
(
$createUser
,
'name'
,
''
);
}
if
(
$supplier
[
'channel_uid'
])
{
$purchaseCodeIdList
=
explode
(
','
,
$supplier
[
'channel_uid'
]);
$usersT
=
(
new
AdminUserService
())
->
getAdminUserListByCodeIds
(
$purchaseCodeIdList
);
$purchaseNames
=
array_column
(
$usersT
,
'name'
);
$purchaseNames
=
implode
(
','
,
$purchaseNames
);
$purchaseNames
=
array_column
(
$usersT
,
'name'
);
$purchaseNames
=
implode
(
','
,
$purchaseNames
);
$channelUids
=
IntracodeModel
::
whereIn
(
'code_id'
,
$purchaseCodeIdList
)
->
pluck
(
'admin_id'
)
->
toArray
();
//去采购系统找最多金额的用户id
$purchaseAmountMap
=
[];
...
...
@@ -1516,4 +1558,5 @@ class DataService
});
})
->
export
(
'csv'
);
}
}
\ No newline at end of file
app/Http/routes.php
View file @
5c6b89e5
...
...
@@ -77,7 +77,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
exportSupplierByPurchaseAmount
();
(
new
\App\Http\Services\DataService
())
->
statisticsSkuNumberFromSKu
();
// (new \App\Http\Services\DataService())->initialMainBrandsLimit();
// (new \App\Http\Services\DataService())->initialMainBrandsToSkuRuler();
...
...
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