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
f1a09304
authored
May 25, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Plain Diff
修复冲突
parents
8ff6b3d5
917ab2cd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
1 deletions
app/Http/Services/DataService.php
app/Http/routes.php
app/Model/Purchase/StockInItemModel.php
app/Model/Purchase/StockInModel.php
app/Http/Services/DataService.php
View file @
f1a09304
...
...
@@ -10,6 +10,8 @@ use App\Model\DepartmentModel;
use
App\Model\IntracodeModel
;
use
App\Model\LogModel
;
use
App\Model\Purchase\PurchaseOrderModel
;
use
App\Model\Purchase\StockInItemModel
;
use
App\Model\Purchase\StockInModel
;
use
App\Model\RedisModel
;
use
App\Model\SkuUploadLogModel
;
use
App\Model\StandardBrandModel
;
...
...
@@ -1232,4 +1234,41 @@ class DataService
]);
}
}
public
function
statisticsSkuNumber
()
{
$dataManagerSupplierCodeList
=
DataManageModel
::
where
(
'is_type'
,
0
)
->
where
(
'canal'
,
'!='
,
''
)
->
pluck
(
'canal'
)
->
toArray
();
//sku上架总数含api接口
$skuNum1
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'supplier_group'
,
'!='
,
4
)
->
whereNotIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
sum
(
'sku_num'
);
//sku上架总数,不含api接口
$skuNum2
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'supplier_group'
,
'!='
,
4
)
->
whereNotIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
whereNotIn
(
'supplier_code'
,
$dataManagerSupplierCodeList
)
->
sum
(
'sku_num'
);
//有上架sku的供应商
$supplierCount
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'supplier_group'
,
'!='
,
4
)
->
whereNotIn
(
'supplier_name'
,
config
(
'field.SkipChangeSupplierTypeNames'
))
->
where
(
'sku_num'
,
'>'
,
0
)
->
count
();
dump
(
"上架供应商数(不含代购,原厂):"
.
$supplierCount
);
dump
(
"SKU 上架总条数(含API接口):"
.
$skuNum1
);
dump
(
"SKU 上架条数(不含API接口):"
.
$skuNum2
);
}
//获取采购系统24号作废的深圳入库明细
public
function
getDeletedSZStockInItemList
()
{
$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
]);
}
dd
(
count
((
array_column
(
$stockInItems
,
'stock_in_item_id'
))));
}
}
\ No newline at end of file
app/Http/routes.php
View file @
f1a09304
...
...
@@ -67,7 +67,7 @@ Route::group(['middleware' => ['external'], 'namespace' => 'Sync'], function ()
});
Route
::
match
([
'get'
,
'post'
],
'/test'
,
function
()
{
(
new
\App\Http\Services\DataService
())
->
initialMainBrandsLimit
();
//
(new \App\Http\Services\DataService())->initialMainBrandsLimit();
// \App\Model\SupplierChannelModel::where('supplier_name', '深圳市金开盛电子有限公司')->update([
// 'status' => 2,
// 'update_time' => time(),
...
...
app/Model/Purchase/StockInItemModel.php
0 → 100644
View file @
f1a09304
<?php
namespace
App\Model\Purchase
;
use
Illuminate\Database\Eloquent\Model
;
class
StockInItemModel
extends
Model
{
protected
$connection
=
'purchase'
;
protected
$table
=
'stock_in_items'
;
public
$timestamps
=
false
;
//关联关系,关联到主表
public
function
stock_in
()
{
return
$this
->
belongsTo
(
StockInModel
::
class
,
'stock_in_id'
,
'stock_in_id'
);
}
}
app/Model/Purchase/StockInModel.php
0 → 100644
View file @
f1a09304
<?php
namespace
App\Model\Purchase
;
use
Illuminate\Database\Eloquent\Model
;
class
StockInModel
extends
Model
{
protected
$connection
=
'purchase'
;
protected
$table
=
'stock_in'
;
public
$timestamps
=
false
;
}
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