mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
commit
0e2f238549
@ -62,5 +62,10 @@ class DeleteKttQuery extends Command
|
|||||||
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-3 day')))
|
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-3 day')))
|
||||||
->delete();
|
->delete();
|
||||||
$this->info('删除妙选更新库存: ' . $count);
|
$this->info('删除妙选更新库存: ' . $count);
|
||||||
|
|
||||||
|
$count = Log::query()->where('target_field', 'stock')
|
||||||
|
->where('created_at', '<', date('Y-m-d H:i:s', strtotime('-3 day')))
|
||||||
|
->delete();
|
||||||
|
$this->info('删除更新库存: ' . $count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,7 @@ class Kernel extends ConsoleKernel
|
|||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
// 服务器/etc/crontab添加cron入口
|
// 服务器/etc/crontab添加cron入口
|
||||||
// * * * * * cd /mnt/wwwroot/erp.chutang66.com && php artisan schedule:run >> /dev/null 2>&1
|
// * * * * * cd /home/wwwroot/erp.chutang66.com && php artisan schedule:run >> /dev/null 2>&1
|
||||||
$schedule->command(Inventory::class)->dailyAt('07:00');
|
$schedule->command(Inventory::class)->dailyAt('07:00');
|
||||||
$schedule->command(KttOrderQuery::class)->everyMinute();
|
$schedule->command(KttOrderQuery::class)->everyMinute();
|
||||||
$schedule->command(DeleteKttQuery::class)->daily();
|
$schedule->command(DeleteKttQuery::class)->daily();
|
||||||
|
|||||||
@ -8,14 +8,13 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\GoodsRequest;
|
use App\Http\Requests\GoodsRequest;
|
||||||
use App\Http\Requests\GoodsSkuRequest;
|
use App\Http\Requests\GoodsSkuRequest;
|
||||||
use App\Imports\InventoryImport;
|
use App\Imports\InventoryImport;
|
||||||
|
use App\Imports\NewSetImport;
|
||||||
use App\Models\BusinessOrderItem;
|
use App\Models\BusinessOrderItem;
|
||||||
use App\Models\Goods;
|
use App\Models\Goods;
|
||||||
use App\Models\GoodsType;
|
|
||||||
use App\Models\Log;
|
use App\Models\Log;
|
||||||
use App\Models\Log as LogModel;
|
use App\Models\Log as LogModel;
|
||||||
use App\Utils\ArrayUtils;
|
use App\Utils\ArrayUtils;
|
||||||
use App\Utils\DateTimeUtils;
|
use App\Utils\DateTimeUtils;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Models\GoodsSku;
|
use App\Models\GoodsSku;
|
||||||
use App\Http\Resources\GoodsSkuResource;
|
use App\Http\Resources\GoodsSkuResource;
|
||||||
@ -486,6 +485,27 @@ class GoodsSkusController extends Controller
|
|||||||
return Excel::download(new GoodsSkusExport($type), $type . '.xlsx');
|
return Excel::download(new GoodsSkusExport($type), $type . '.xlsx');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function newSetImport(Request $request)
|
||||||
|
{
|
||||||
|
if (!$request->hasFile('newSetFile')) {
|
||||||
|
$this->res = [
|
||||||
|
'httpCode' => 404,
|
||||||
|
'errorCode' => 404404,
|
||||||
|
'errorMessage' => 'not found new set file',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$import = new NewSetImport();
|
||||||
|
$path = $request->file('newSetFile');
|
||||||
|
Excel::import($import, $path);
|
||||||
|
$this->addLog(0, 'import', 'newSetFile');
|
||||||
|
} catch (ValidationException $exception) {
|
||||||
|
$this->setValidatorFailResponse($exception->validator->getMessageBag()->getMessages());
|
||||||
|
}
|
||||||
|
|
||||||
|
return response($this->res, $this->res['httpCode']);
|
||||||
|
}
|
||||||
|
|
||||||
public function inventoryImport(Request $request)
|
public function inventoryImport(Request $request)
|
||||||
{
|
{
|
||||||
if (!$request->hasFile('inventoryFile')) {
|
if (!$request->hasFile('inventoryFile')) {
|
||||||
|
|||||||
62
app/Imports/NewSetImport.php
Normal file
62
app/Imports/NewSetImport.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Imports;
|
||||||
|
|
||||||
|
use App\Models\DailyStockRecord;
|
||||||
|
use App\Models\GoodsSku;
|
||||||
|
use App\Models\TodayPrice;
|
||||||
|
use App\Utils\DateTimeUtils;
|
||||||
|
use Exception;
|
||||||
|
use Maatwebsite\Excel\Concerns\SkipsEmptyRows;
|
||||||
|
use Maatwebsite\Excel\Concerns\ToArray;
|
||||||
|
use App\Utils\ArrayUtils;
|
||||||
|
use App\Events\StockUpdateEvent;
|
||||||
|
|
||||||
|
class NewSetImport implements ToArray, SkipsEmptyRows
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function array(array $collection)
|
||||||
|
{
|
||||||
|
unset($collection[0]);
|
||||||
|
$externalSkuId = [];
|
||||||
|
foreach ($collection as &$row) {
|
||||||
|
$row = array_map(static function ($v) {
|
||||||
|
return trim($v);
|
||||||
|
}, $row);
|
||||||
|
$externalSkuId[] = $row[0];
|
||||||
|
}
|
||||||
|
unset($row);
|
||||||
|
$day = DateTimeUtils::getToday();
|
||||||
|
$updateIds = [];
|
||||||
|
$hasGoodsSkus = GoodsSku::query()
|
||||||
|
->whereIn('external_sku_id', $externalSkuId)
|
||||||
|
->get(['id', 'status', 'external_sku_id', 'stock'])
|
||||||
|
->toArray();
|
||||||
|
$hasGoodsSkus = ArrayUtils::index($hasGoodsSkus, 'external_sku_id');
|
||||||
|
foreach ($collection as $row) {
|
||||||
|
if (!isset($hasGoodsSkus[$row[0]])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$goodsSku = $hasGoodsSkus[$row[0]];
|
||||||
|
if ('下架' === $goodsSku['status']) {
|
||||||
|
GoodsSku::query()->where('id', $goodsSku['id'])->update([
|
||||||
|
'stock' => $row[2] + $goodsSku['stock'],
|
||||||
|
'status' => 1,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
GoodsSku::query()->where('id', $goodsSku['id'])->update([
|
||||||
|
'stock' => $row[2] + $goodsSku['stock'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
$updateIds[] = $goodsSku['id'];
|
||||||
|
// 今日到货
|
||||||
|
$record = DailyStockRecord::query()->where('sku_id', $goodsSku['id'])->where('day', $day)->first(['id', 'arrived_today_num']);
|
||||||
|
$record->arrived_today_num += $row[2];
|
||||||
|
$record->save();
|
||||||
|
}
|
||||||
|
sleep(2);
|
||||||
|
event(new StockUpdateEvent($updateIds, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
1
public/dist/css/chunk-003f4a7a.111dfff8.css
vendored
1
public/dist/css/chunk-003f4a7a.111dfff8.css
vendored
@ -1 +0,0 @@
|
|||||||
.table[data-v-03040447]{margin-top:20px;position:relative}.btn[data-v-03040447]{float:right}[data-v-03040447] .cell{display:flex;align-items:center}.commodityimg[data-v-03040447]{width:59px;height:59px;background:hsla(0,0%,89%,.39);opacity:1;display:block;margin-right:12px}.Img[data-v-03040447]{width:100%;height:100%}.confirmbtn[data-v-03040447]{width:114px;height:44px;border-radius:3px;margin-top:21px;margin-bottom:8px}.import-right[data-v-03040447]{margin-top:30px}.import-right a[data-v-03040447]{text-decoration:none;color:#000}[data-v-03040447] .btn11{padding:0;width:14px;height:14px}[data-v-03040447] .btn11 img{width:100%;height:100%}.page[data-v-03040447]{margin-top:20px}
|
|
||||||
1
public/dist/css/chunk-dc2d15ec.98bc0af6.css
vendored
Normal file
1
public/dist/css/chunk-dc2d15ec.98bc0af6.css
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.table[data-v-3af2603a]{margin-top:20px;position:relative}.btn[data-v-3af2603a]{float:right}[data-v-3af2603a] .cell{display:flex;align-items:center}.commodityimg[data-v-3af2603a]{width:59px;height:59px;background:hsla(0,0%,89%,.39);opacity:1;display:block;margin-right:12px}.Img[data-v-3af2603a]{width:100%;height:100%}.confirmbtn[data-v-3af2603a]{width:114px;height:44px;border-radius:3px;margin-top:21px;margin-bottom:8px}.import-right[data-v-3af2603a]{margin-top:30px}.import-right a[data-v-3af2603a]{text-decoration:none;color:#000}[data-v-3af2603a] .btn11{padding:0;width:14px;height:14px}[data-v-3af2603a] .btn11 img{width:100%;height:100%}.page[data-v-3af2603a]{margin-top:20px}
|
||||||
2
public/dist/index.html
vendored
2
public/dist/index.html
vendored
@ -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-003f4a7a.111dfff8.css" rel="prefetch"><link href="css/chunk-086a167d.daab9de2.css" rel="prefetch"><link href="css/chunk-088acbde.902ebb66.css" rel="prefetch"><link href="css/chunk-0cbcaa56.e05858e7.css" rel="prefetch"><link href="css/chunk-1103d586.ad94328f.css" rel="prefetch"><link href="css/chunk-2273ddc8.d350d067.css" rel="prefetch"><link href="css/chunk-26daa808.62429343.css" rel="prefetch"><link href="css/chunk-32da4b3e.d9ee7431.css" rel="prefetch"><link href="css/chunk-35db73ce.1f9c10ff.css" rel="prefetch"><link href="css/chunk-41cd4e14.4e6d7a5a.css" rel="prefetch"><link href="css/chunk-52fcdd7c.51e3ffbd.css" rel="prefetch"><link href="css/chunk-64d6ef70.826b5f9e.css" rel="prefetch"><link href="css/chunk-6ae0a0d3.84a02b23.css" rel="prefetch"><link href="css/chunk-743f0316.fb5066fb.css" rel="prefetch"><link href="css/chunk-75426f71.902ebb66.css" rel="prefetch"><link href="css/chunk-904e5abc.902ebb66.css" rel="prefetch"><link href="css/chunk-a3ddd952.902ebb66.css" rel="prefetch"><link href="css/chunk-ab4d3e40.d941d6ef.css" rel="prefetch"><link href="css/chunk-e35186f0.902ebb66.css" rel="prefetch"><link href="css/chunk-f35dfe36.ea52b615.css" rel="prefetch"><link href="js/chunk-003f4a7a.bf5f2a22.js" rel="prefetch"><link href="js/chunk-086a167d.0cb8b81f.js" rel="prefetch"><link href="js/chunk-088acbde.4e79f6d0.js" rel="prefetch"><link href="js/chunk-0cbcaa56.46e3dd42.js" rel="prefetch"><link href="js/chunk-1103d586.3eb50bc2.js" rel="prefetch"><link href="js/chunk-2273ddc8.48b0def5.js" rel="prefetch"><link href="js/chunk-26daa808.9e326ce2.js" rel="prefetch"><link href="js/chunk-32da4b3e.0151c647.js" rel="prefetch"><link href="js/chunk-35db73ce.ae2590c3.js" rel="prefetch"><link href="js/chunk-41cd4e14.a0cd0f1b.js" rel="prefetch"><link href="js/chunk-52fcdd7c.0070e388.js" rel="prefetch"><link href="js/chunk-63c1eac8.59f3df74.js" rel="prefetch"><link href="js/chunk-64d6ef70.42b3f332.js" rel="prefetch"><link href="js/chunk-6ae0a0d3.ee4aa3e0.js" rel="prefetch"><link href="js/chunk-743f0316.d043435c.js" rel="prefetch"><link href="js/chunk-75426f71.128f599c.js" rel="prefetch"><link href="js/chunk-904e5abc.e6a5edbe.js" rel="prefetch"><link href="js/chunk-a3ddd952.0482ce75.js" rel="prefetch"><link href="js/chunk-ab4d3e40.0c286099.js" rel="prefetch"><link href="js/chunk-e35186f0.a9d70f92.js" rel="prefetch"><link href="js/chunk-f35dfe36.e7038b09.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.ac132cd3.js" rel="preload" as="script"><link href="js/chunk-vendors.524d6b36.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.524d6b36.js"></script><script src="js/app.ac132cd3.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-086a167d.daab9de2.css" rel="prefetch"><link href="css/chunk-088acbde.902ebb66.css" rel="prefetch"><link href="css/chunk-0cbcaa56.e05858e7.css" rel="prefetch"><link href="css/chunk-1103d586.ad94328f.css" rel="prefetch"><link href="css/chunk-2273ddc8.d350d067.css" rel="prefetch"><link href="css/chunk-26daa808.62429343.css" rel="prefetch"><link href="css/chunk-32da4b3e.d9ee7431.css" rel="prefetch"><link href="css/chunk-35db73ce.1f9c10ff.css" rel="prefetch"><link href="css/chunk-41cd4e14.4e6d7a5a.css" rel="prefetch"><link href="css/chunk-52fcdd7c.51e3ffbd.css" rel="prefetch"><link href="css/chunk-64d6ef70.826b5f9e.css" rel="prefetch"><link href="css/chunk-6ae0a0d3.84a02b23.css" rel="prefetch"><link href="css/chunk-743f0316.fb5066fb.css" rel="prefetch"><link href="css/chunk-75426f71.902ebb66.css" rel="prefetch"><link href="css/chunk-904e5abc.902ebb66.css" rel="prefetch"><link href="css/chunk-a3ddd952.902ebb66.css" rel="prefetch"><link href="css/chunk-ab4d3e40.d941d6ef.css" rel="prefetch"><link href="css/chunk-dc2d15ec.98bc0af6.css" rel="prefetch"><link href="css/chunk-e35186f0.902ebb66.css" rel="prefetch"><link href="css/chunk-f35dfe36.ea52b615.css" rel="prefetch"><link href="js/chunk-086a167d.0cb8b81f.js" rel="prefetch"><link href="js/chunk-088acbde.4e79f6d0.js" rel="prefetch"><link href="js/chunk-0cbcaa56.46e3dd42.js" rel="prefetch"><link href="js/chunk-1103d586.3eb50bc2.js" rel="prefetch"><link href="js/chunk-2273ddc8.48b0def5.js" rel="prefetch"><link href="js/chunk-26daa808.9e326ce2.js" rel="prefetch"><link href="js/chunk-32da4b3e.0151c647.js" rel="prefetch"><link href="js/chunk-35db73ce.ae2590c3.js" rel="prefetch"><link href="js/chunk-41cd4e14.a0cd0f1b.js" rel="prefetch"><link href="js/chunk-52fcdd7c.0070e388.js" rel="prefetch"><link href="js/chunk-63c1eac8.59f3df74.js" rel="prefetch"><link href="js/chunk-64d6ef70.42b3f332.js" rel="prefetch"><link href="js/chunk-6ae0a0d3.ee4aa3e0.js" rel="prefetch"><link href="js/chunk-743f0316.d043435c.js" rel="prefetch"><link href="js/chunk-75426f71.128f599c.js" rel="prefetch"><link href="js/chunk-904e5abc.e6a5edbe.js" rel="prefetch"><link href="js/chunk-a3ddd952.0482ce75.js" rel="prefetch"><link href="js/chunk-ab4d3e40.0c286099.js" rel="prefetch"><link href="js/chunk-dc2d15ec.54e5125d.js" rel="prefetch"><link href="js/chunk-e35186f0.a9d70f92.js" rel="prefetch"><link href="js/chunk-f35dfe36.e7038b09.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.b558f5cd.js" rel="preload" as="script"><link href="js/chunk-vendors.524d6b36.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.524d6b36.js"></script><script src="js/app.b558f5cd.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
2
public/dist/js/chunk-003f4a7a.bf5f2a22.js
vendored
2
public/dist/js/chunk-003f4a7a.bf5f2a22.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
public/dist/js/chunk-dc2d15ec.54e5125d.js
vendored
Normal file
2
public/dist/js/chunk-dc2d15ec.54e5125d.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
public/dist/js/chunk-dc2d15ec.54e5125d.js.map
vendored
Normal file
1
public/dist/js/chunk-dc2d15ec.54e5125d.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -58,6 +58,11 @@
|
|||||||
<span> 其它合计: {{ other_num }}</span>
|
<span> 其它合计: {{ other_num }}</span>
|
||||||
<div class="btn">
|
<div class="btn">
|
||||||
<el-button type="primary" plain @click="update()">上新</el-button>
|
<el-button type="primary" plain @click="update()">上新</el-button>
|
||||||
|
<el-upload ref="newset" action="/api/new/set/goods_skus" :multiple="false" name="newSetFile"
|
||||||
|
:show-file-list="false" :on-success="inventorySuccess" :before-upload="beforeInventory"
|
||||||
|
:on-error="inventoryError" style="display:inline-block;margin: 0 10px 0 10px;">
|
||||||
|
<el-button type="primary" plain>上新导入</el-button>
|
||||||
|
</el-upload>
|
||||||
<el-upload ref="myUpload" action="/api/inventory/goods_skus" :multiple="false" name="inventoryFile"
|
<el-upload ref="myUpload" action="/api/inventory/goods_skus" :multiple="false" name="inventoryFile"
|
||||||
:show-file-list="false" :on-success="inventorySuccess" :before-upload="beforeInventory"
|
:show-file-list="false" :on-success="inventorySuccess" :before-upload="beforeInventory"
|
||||||
:on-error="inventoryError" style="display:inline-block;margin: 0 10px 0 10px;">
|
:on-error="inventoryError" style="display:inline-block;margin: 0 10px 0 10px;">
|
||||||
@ -912,7 +917,7 @@ export default {
|
|||||||
beforeInventory() {
|
beforeInventory() {
|
||||||
this.loadingModule = this.$loading({
|
this.loadingModule = this.$loading({
|
||||||
lock: true,
|
lock: true,
|
||||||
text: '盘点导入中...',
|
text: '导入中...',
|
||||||
spinner: 'el-icon-loading',
|
spinner: 'el-icon-loading',
|
||||||
background: 'rgba(0, 0, 0, 0.7)'
|
background: 'rgba(0, 0, 0, 0.7)'
|
||||||
});
|
});
|
||||||
|
|||||||
@ -64,6 +64,11 @@ return [
|
|||||||
'name' => '盘点导入',
|
'name' => '盘点导入',
|
||||||
'parent_id' => 2,
|
'parent_id' => 2,
|
||||||
],
|
],
|
||||||
|
'goods_sku.new_set' => [
|
||||||
|
'id' => 200,
|
||||||
|
'name' => '上新导入',
|
||||||
|
'parent_id' => 2,
|
||||||
|
],
|
||||||
'GOODS_TYPE' => [
|
'GOODS_TYPE' => [
|
||||||
'id' => 3,
|
'id' => 3,
|
||||||
'name' => '商品种类',
|
'name' => '商品种类',
|
||||||
|
|||||||
@ -85,6 +85,8 @@ Route::post('business', [ShopsController::class, 'business'])->name('shop.put.bu
|
|||||||
|
|
||||||
// 盘点导入
|
// 盘点导入
|
||||||
Route::post('inventory/goods_skus', [GoodsSkusController::class, 'inventoryImport'])->name('goods_sku.inventory');
|
Route::post('inventory/goods_skus', [GoodsSkusController::class, 'inventoryImport'])->name('goods_sku.inventory');
|
||||||
|
// 上新导入
|
||||||
|
Route::post('new/set/goods_skus', [GoodsSkusController::class, 'newSetImport'])->name('goods_sku.new_set');
|
||||||
// 商品货架导入
|
// 商品货架导入
|
||||||
Route::post('goods_sku_location', [GoodsSkuLocationController::class, 'import'])->name('goods_sku_location.import');
|
Route::post('goods_sku_location', [GoodsSkuLocationController::class, 'import'])->name('goods_sku_location.import');
|
||||||
// 组合商品导入
|
// 组合商品导入
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user