Merge pull request !103 from develop
This commit is contained in:
赵世界 2022-09-16 03:16:27 +00:00 committed by Gitee
commit 21e89df806
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
22 changed files with 36 additions and 72 deletions

View File

@ -52,8 +52,8 @@ class DeleteGoodsSku extends Command
$goods = Goods::query()->where('goods_code', $goodsCode)->first();
$countSkus = GoodsSku::query()->where('goods_id', $goods->id)->count();
$sku = GoodsSku::query()->where('goods_id', $goods->id)->where('sku_code', $skuCode)->first();
DailyStockRecord::where('sku_id', $sku->id)->delete();
Log::where('module', 'goods')->where('target_type', 'goods_sku')->where('target_id', $sku->id)->delete();
DailyStockRecord::query()->where('sku_id', $sku->id)->delete();
Log::query()->where('module', 'goods')->where('target_type', 'goods_sku')->where('target_id', $sku->id)->delete();
$sku->delete();
if (1 === $countSkus) {
$goods->delete();

View File

@ -38,27 +38,27 @@ class DeleteKttQuery extends Command
*/
public function handle()
{
$count = Log::where('target_field', 'pdd.ktt.goods.query.list')
$count = Log::query()->where('target_field', 'pdd.ktt.goods.query.list')
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-1 day')))
->delete();
$this->info('删除商品列表查询: ' . $count);
$count = Log::where('target_field', 'pdd.ktt.order.list')
$count = Log::query()->where('target_field', 'pdd.ktt.order.list')
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
->delete();
$this->info('删除根据成交时间拉取订单列表: ' . $count);
$count = Log::where('target_field', 'pdd.ktt.increment.order.query')
$count = Log::query()->where('target_field', 'pdd.ktt.increment.order.query')
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
->delete();
$this->info('删除增量查订单: ' . $count);
$count = Log::where('target_field', 'pdd.ktt.goods.incr.quantity')
$count = Log::query()->where('target_field', 'pdd.ktt.goods.incr.quantity')
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
->delete();
$this->info('删除快团团更新库存: ' . $count);
$count = Log::where('target_field', '更新库存')
$count = Log::query()->where('target_field', '更新库存')
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-2 day')))
->delete();
$this->info('删除妙选更新库存: ' . $count);

View File

@ -59,7 +59,7 @@ class Inventory extends Command
'sku_id' => $sku->id,
'day' => $date,
];
GoodsSku::where('id', $sku->id)->update([
GoodsSku::query()->where('id', $sku->id)->update([
'yesterday_num' => $sku->stock,
'two_days_ago_num' => $sku->two_days_ago_num + $sku->yesterday_num,
]);

View File

@ -44,7 +44,7 @@ class Test extends Command
public function handle()
{
// 下架商品
// GoodsSku::where('status', '<>', 0)->update(['status' => 0]);
// GoodsSku::query()->where('status', '<>', 0)->update(['status' => 0]);
// $this->info('全部下架');
// exit();
// 1-7 11

View File

@ -69,7 +69,7 @@ class RegisterController extends Controller
{
$faker = new Faker();
return User::create([
return User::query()->create([
'name' => $data['name'],
'email' => $data['email'] ?? $faker->unique()->safeEmail,
'password' => Hash::make($data['password']),

View File

@ -35,7 +35,7 @@ class BusinessGoodsSkusController extends Controller
return BusinessGoodsSkuResource::collection($businessGoodsSkus);
}
public function update(Request $request, $id)
public function update($id, Request $request)
{
$validator = Validator::make($request->all(), [
'is_sync' => ['required', Rule::in([0, 1])]
@ -45,7 +45,7 @@ class BusinessGoodsSkusController extends Controller
return response($this->res, $this->res['httpCode']);
}
$sku = BusinessGoodsSku::find($id);
$sku = BusinessGoodsSku::query()->find($id);
$this->setBeforeUpdate($sku->is_sync);
$sku->is_sync = $request->input('is_sync');
$sku->save();
@ -55,13 +55,13 @@ class BusinessGoodsSkusController extends Controller
return response($this->res, $this->res['httpCode']);
}
public function destroy(Request $request, $id)
public function destroy($id, Request $request)
{
DB::beginTransaction();
try {
$sku = BusinessGoodsSku::find($id);
$sku = BusinessGoodsSku::query()->find($id);
$this->setBeforeUpdate($sku->toArray());
BusinessOrderItem::where('goods_id', $sku->goods_id)->where('sku_id', $sku->sku_id)->delete();
BusinessOrderItem::query()->where('goods_id', $sku->goods_id)->where('sku_id', $sku->sku_id)->delete();
$sku->delete();
$this->setAfterUpdate('');
$this->addLog($id, '');
@ -75,9 +75,9 @@ class BusinessGoodsSkusController extends Controller
return response($this->res, $this->res['httpCode']);
}
public function syncStock(Request $request, $id)
public function syncStock($id, Request $request)
{
$businessGoodsSku = BusinessGoodsSku::find($id);
$businessGoodsSku = BusinessGoodsSku::query()->find($id);
[$goodsCode, $skuCode] = explode('_', $businessGoodsSku->external_sku_id);
$sku = GoodsSku::query()->where('sku_code', $skuCode)
->whereHas('goods', function ($query) use ($goodsCode) {

View File

@ -2,7 +2,6 @@
namespace App\Imports;
use App\Events\StockUpdateEvent;
use App\Models\DailyStockRecord;
use App\Models\Goods;
use App\Models\GoodsSku;
@ -46,7 +45,7 @@ class InventoryImport implements ToCollection, SkipsEmptyRows
$goodsSku = GoodsSku::query()
->where('goods_id', $hasGoods[$row[0]]['id'])
->where('sku_code', $row[4])
->first(['id']);
->first();
if (empty($goodsSku)) {
Log::warning(json_encode($row, 256) . '=====库存导入未找到');
continue;
@ -54,7 +53,7 @@ class InventoryImport implements ToCollection, SkipsEmptyRows
$goodsSku->stock = $row[6] + $row[7];
$goodsSku->save();
$updateIds[] = $goodsSku->id;
DailyStockRecord::where('sku_id', $goodsSku->id)->where('day', $day)->update([
DailyStockRecord::query()->where('sku_id', $goodsSku->id)->where('day', $day)->update([
'arrived_today_num' => $row[7],
'inventory' => $row[6],
'inventory_time' => $dateTime

View File

@ -41,10 +41,10 @@ class StockWarning implements ShouldQueue
}
}
if ($warningIds) {
GoodsSku::whereIn('id', $warningIds)->update(['status' => 2]);
GoodsSku::query()->whereIn('id', $warningIds)->update(['status' => 2]);
}
if ($normalIds) {
GoodsSku::whereIn('id', $normalIds)->update(['status' => 1]);
GoodsSku::query()->whereIn('id', $normalIds)->update(['status' => 1]);
}
}
}

View File

@ -15,21 +15,6 @@ class BusinessGoodsSku extends Model
'shop_id',
];
/**
* @var mixed
*/
public $goods_id;
/**
* @var mixed
*/
public $sku_id;
/**
* @var mixed
*/
public $external_sku_id;
protected $hidden = [
'self_sku_id',
'activity_no',

View File

@ -4,14 +4,6 @@ namespace App\Models;
class BusinessOrderItem extends Model
{
/**
* @var mixed
*/
public $shop_id;
/**
* @var mixed
*/
public $external_sku_id;
/**
* 不可批量赋值的属性。为空则所有熟悉都可以批量赋值
*

View File

@ -41,6 +41,8 @@ class Goods
if (!empty($businessGoodSku->external_sku_id)) {
event(new BusinessOrdersUpdate($businessGoodSku, 0));
}
} else {
$businessGoodSku->update($data);
}
}
}

View File

@ -5,8 +5,6 @@ namespace App\Services\Business\KuaiTuanTuan;
use App\Models\BusinessGoodsSku;
use App\Models\GoodsSku;
use App\Services\Business\BusinessClient;
use App\Models\Log;
use App\Utils\DateTimeUtils;
class KuaiTuanTuan extends BusinessClient
{
@ -42,18 +40,6 @@ class KuaiTuanTuan extends BusinessClient
public function downloadGoodsListAndBind($page = 1)
{
[$type, $appendParams] = Goods::downloadGoods($this->shop->owner_id, $page);
$log = Log::query()
->where('target_field', 'pdd.ktt.goods.query.list')
->where('target_id', $this->shop->id)
->orderBy('id', 'desc')
->first();
if ($log) {
$lastGetTime = DateTimeUtils::getMicroTime($log->created_at);
// 毫秒时间戳,往前算3分钟
$startTime = $lastGetTime - 30000;
$appendParams['update_time_start'] = $startTime;
$appendParams['update_time_end'] = DateTimeUtils::getMicroTime();
}
$res = $this->doRequest($type, $appendParams);
$goods = $res['ktt_goods_query_list_response']['goods_list'];
$this->bindGoods($goods);
@ -136,7 +122,7 @@ class KuaiTuanTuan extends BusinessClient
if (isset($res['error_response'])) {
// ToDo 重构异常处理
if ('业务服务错误' === $res['error_response']['error_msg'] && '该店铺下不存在该商品' === $res['error_response']['sub_msg']) {
BusinessGoodsSku::where('goods_id', $appendParams['goods_id'])->where('sku_id', $appendParams['sku_id'])->delete();
BusinessGoodsSku::query()->where('goods_id', $appendParams['goods_id'])->where('sku_id', $appendParams['sku_id'])->delete();
} else {
// throw new \RuntimeException($res['error_response']['error_msg'] . ':' . $res['error_response']['error_msg']);
}

View File

@ -0,0 +1 @@
.table[data-v-43fbedb0]{margin-top:20px;position:relative}.btn[data-v-43fbedb0]{float:right}[data-v-43fbedb0] .cell{display:flex;align-items:center}.commodityimg[data-v-43fbedb0]{width:59px;height:59px;background:hsla(0,0%,89%,.39);opacity:1;display:block;margin-right:12px}.Img[data-v-43fbedb0]{width:100%;height:100%}.confirmbtn[data-v-43fbedb0]{width:114px;height:44px;border-radius:3px;margin-top:21px;margin-bottom:8px}.import-right[data-v-43fbedb0]{margin-top:30px}.import-right a[data-v-43fbedb0]{text-decoration:none;color:#000}[data-v-43fbedb0] .btn11{padding:0;width:14px;height:14px}[data-v-43fbedb0] .btn11 img{width:100%;height:100%}.page[data-v-43fbedb0]{margin-top:20px}

View File

@ -1 +0,0 @@
.table[data-v-1c7595f6]{margin-top:20px;position:relative}.btn[data-v-1c7595f6]{float:right}[data-v-1c7595f6] .cell{display:flex;align-items:center}.commodityimg[data-v-1c7595f6]{width:59px;height:59px;background:hsla(0,0%,89%,.39);opacity:1;display:block;margin-right:12px}.Img[data-v-1c7595f6]{width:100%;height:100%}.confirmbtn[data-v-1c7595f6]{width:114px;height:44px;border-radius:3px;margin-top:21px;margin-bottom:8px}.import-right[data-v-1c7595f6]{margin-top:30px}.import-right a[data-v-1c7595f6]{text-decoration:none;color:#000}[data-v-1c7595f6] .btn11{padding:0;width:14px;height:14px}[data-v-1c7595f6] .btn11 img{width:100%;height:100%}.page[data-v-1c7595f6]{margin-top:20px}

View File

@ -1 +1 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>erp</title><link href="css/chunk-0050b7a0.29a99b3a.css" rel="prefetch"><link href="css/chunk-0cbcaa56.e05858e7.css" rel="prefetch"><link href="css/chunk-288420ae.363cf34f.css" rel="prefetch"><link href="css/chunk-2d9c0b4e.0d54de90.css" rel="prefetch"><link href="css/chunk-35db73ce.1f9c10ff.css" rel="prefetch"><link href="css/chunk-4cc75dcf.05c81c5f.css" rel="prefetch"><link href="css/chunk-4f15b41a.2cf53495.css" rel="prefetch"><link href="css/chunk-5e4a5e4e.7dcbe287.css" rel="prefetch"><link href="css/chunk-5fe65568.884dd222.css" rel="prefetch"><link href="css/chunk-698f0f68.96d82e53.css" rel="prefetch"><link href="css/chunk-75426f71.902ebb66.css" rel="prefetch"><link href="css/chunk-a3ddd952.902ebb66.css" rel="prefetch"><link href="css/chunk-dfcdd772.d7b6548a.css" rel="prefetch"><link href="js/chunk-0050b7a0.55e2f736.js" rel="prefetch"><link href="js/chunk-0cbcaa56.114d39a7.js" rel="prefetch"><link href="js/chunk-288420ae.01dbede2.js" rel="prefetch"><link href="js/chunk-2d9c0b4e.5cf6d39b.js" rel="prefetch"><link href="js/chunk-35db73ce.a3585c34.js" rel="prefetch"><link href="js/chunk-4cc75dcf.4b8c2114.js" rel="prefetch"><link href="js/chunk-4f15b41a.059677d1.js" rel="prefetch"><link href="js/chunk-5e4a5e4e.dc83d342.js" rel="prefetch"><link href="js/chunk-5fe65568.fd880c4a.js" rel="prefetch"><link href="js/chunk-63c1eac8.59f3df74.js" rel="prefetch"><link href="js/chunk-698f0f68.a0f8050b.js" rel="prefetch"><link href="js/chunk-75426f71.aa7e65a8.js" rel="prefetch"><link href="js/chunk-a3ddd952.ad97c910.js" rel="prefetch"><link href="js/chunk-dfcdd772.a3dbdd95.js" rel="prefetch"><link href="css/app.6c30acd7.css" rel="preload" as="style"><link href="css/chunk-vendors.9181e156.css" rel="preload" as="style"><link href="js/app.e2565684.js" rel="preload" as="script"><link href="js/chunk-vendors.13743003.js" rel="preload" as="script"><link href="css/chunk-vendors.9181e156.css" rel="stylesheet"><link href="css/app.6c30acd7.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but erp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.13743003.js"></script><script src="js/app.e2565684.js"></script></body></html>
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title>erp</title><link href="css/chunk-0050b7a0.29a99b3a.css" rel="prefetch"><link href="css/chunk-084d7b1a.2052625b.css" rel="prefetch"><link href="css/chunk-0cbcaa56.e05858e7.css" rel="prefetch"><link href="css/chunk-288420ae.363cf34f.css" rel="prefetch"><link href="css/chunk-35db73ce.1f9c10ff.css" rel="prefetch"><link href="css/chunk-4cc75dcf.05c81c5f.css" rel="prefetch"><link href="css/chunk-4f15b41a.2cf53495.css" rel="prefetch"><link href="css/chunk-5e4a5e4e.7dcbe287.css" rel="prefetch"><link href="css/chunk-5fe65568.884dd222.css" rel="prefetch"><link href="css/chunk-698f0f68.96d82e53.css" rel="prefetch"><link href="css/chunk-75426f71.902ebb66.css" rel="prefetch"><link href="css/chunk-a3ddd952.902ebb66.css" rel="prefetch"><link href="css/chunk-dfcdd772.d7b6548a.css" rel="prefetch"><link href="js/chunk-0050b7a0.55e2f736.js" rel="prefetch"><link href="js/chunk-084d7b1a.d9b2a5e0.js" rel="prefetch"><link href="js/chunk-0cbcaa56.114d39a7.js" rel="prefetch"><link href="js/chunk-288420ae.01dbede2.js" rel="prefetch"><link href="js/chunk-35db73ce.a3585c34.js" rel="prefetch"><link href="js/chunk-4cc75dcf.4b8c2114.js" rel="prefetch"><link href="js/chunk-4f15b41a.059677d1.js" rel="prefetch"><link href="js/chunk-5e4a5e4e.dc83d342.js" rel="prefetch"><link href="js/chunk-5fe65568.fd880c4a.js" rel="prefetch"><link href="js/chunk-63c1eac8.59f3df74.js" rel="prefetch"><link href="js/chunk-698f0f68.a0f8050b.js" rel="prefetch"><link href="js/chunk-75426f71.aa7e65a8.js" rel="prefetch"><link href="js/chunk-a3ddd952.ad97c910.js" rel="prefetch"><link href="js/chunk-dfcdd772.a3dbdd95.js" rel="prefetch"><link href="css/app.6c30acd7.css" rel="preload" as="style"><link href="css/chunk-vendors.9181e156.css" rel="preload" as="style"><link href="js/app.c70349b8.js" rel="preload" as="script"><link href="js/chunk-vendors.13743003.js" rel="preload" as="script"><link href="css/chunk-vendors.9181e156.css" rel="stylesheet"><link href="css/app.6c30acd7.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but erp doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/chunk-vendors.13743003.js"></script><script src="js/app.c70349b8.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -110,8 +110,8 @@
</div>
</template>
</el-table-column>
<el-table-column prop="two_days_ago_num" sortable label="2T">
</el-table-column>
<!-- <el-table-column prop="two_days_ago_num" sortable label="2T">
</el-table-column> -->
<el-table-column prop="yesterday_num" sortable label="1T">
</el-table-column>
@ -151,8 +151,8 @@
</div>
</template>
</el-table-column>
<el-table-column prop="num" sortable label="总量">
</el-table-column>
<!-- <el-table-column prop="num" sortable label="总量">
</el-table-column> -->
<el-table-column prop="reserve" sortable label="预留">
<template slot-scope="scope">
<div v-if="scope.row.id === id1">