Commit f1a09304 by 杨树贤

修复冲突

parents 8ff6b3d5 917ab2cd
......@@ -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
......@@ -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(),
......
<?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');
}
}
<?php
namespace App\Model\Purchase;
use Illuminate\Database\Eloquent\Model;
class StockInModel extends Model
{
protected $connection='purchase';
protected $table='stock_in';
public $timestamps = false;
}
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