Merge pull request !250 from 杨建炊/fix-release-1.0.0/yjc-migrate
This commit is contained in:
杨建炊 2024-11-12 06:44:39 +00:00 committed by Gitee
commit b68f0f7ed0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
17 changed files with 91 additions and 31 deletions

View File

@ -38,7 +38,8 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
$headTitle = [ $headTitle = [
'商品编码', '商品编码',
'商品名称', '商品名称',
'可售库存', '在售库存',
"剩余库存",
'创建时间', '创建时间',
]; ];
$map = [ $map = [
@ -91,17 +92,18 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
foreach ($data as $item) { foreach ($data as $item) {
$arr[0] = $item['external_sku_id']; $arr[0] = $item['external_sku_id'];
$arr[1] = $item['name']; $arr[1] = $item['name'];
$arr[2] = $item['sale_stock'] ?? 0; $arr[2] = $item['sale_stock'] ?? '0';
$arr[3] = $item['created_at']; $arr[3] = $item['stock'] ?? '0';
$arr[4] = $item['created_at'];
if ('cost' === $this->type) { if ('cost' === $this->type) {
$arr[4] = (string)$item['cost']; $arr[5] = (string)$item['cost'];
$arr[5] = (string)$update[$item['id']]['before_update']; $arr[6] = (string)$update[$item['id']]['before_update'];
$arr[6] = (string)$update[$item['id']]['after_update']; $arr[7] = (string)$update[$item['id']]['after_update'];
} }
if ('inventory' === $this->type) { if ('inventory' === $this->type) {
$arr[4] = (string)$item['stock']; $arr[5] = (string)$item['stock'];
$arr[5] = (string)$update[$item['id']]['inventory']; $arr[6] = (string)$update[$item['id']]['inventory'];
$arr[6] = (string)$update[$item['id']]['arrived_today_num']; $arr[7] = (string)$update[$item['id']]['arrived_today_num'];
} }
$bodyData[] = $arr; $bodyData[] = $arr;
} }

View File

@ -42,4 +42,34 @@ class GoodsSkuFilter extends Filters
$end = Carbon::parse($value)->endOfDay()->toDateTimeString(); $end = Carbon::parse($value)->endOfDay()->toDateTimeString();
return $this->builder->where('created_at', "<=", $end); return $this->builder->where('created_at', "<=", $end);
} }
protected function minStock($value)
{
return $this->builder->where('stock',">=", $value);
}
protected function maxStock($value)
{
return $this->builder->where('stock',"<=", $value);
}
protected function minSaleStock($value)
{
return $this->builder->where('sale_stock',">=", $value);
}
protected function maxSaleStock($value)
{
return $this->builder->where('sale_stock',"<=", $value);
}
protected function neqSaleStock($value)
{
return $this->builder->where('sale_stock',"!=", $value);
}
protected function neqStock($value)
{
return $this->builder->where('stock',"!=", $value);
}
} }

View File

@ -34,8 +34,11 @@ class GoodsCombinationController extends Controller
$orderRestTime = DeveloperConfig::query() $orderRestTime = DeveloperConfig::query()
->where('key', DeveloperConfig::$ORDER_RESET_TIME) ->where('key', DeveloperConfig::$ORDER_RESET_TIME)
->value('value'); ->value('value');
$time = date('Y-m-d 07:00:00');
if (is_null($orderRestTime)) { if (is_null($orderRestTime)) {
$orderRestTime = date('Y-m-d 07:00:00'); $orderRestTime = $time;
} else {
$orderRestTime = Carbon::parse($orderRestTime)->lt(Carbon::parse($time)) ? $time : $orderRestTime;
} }
$businessOrderItems = BusinessOrderItem::query() $businessOrderItems = BusinessOrderItem::query()

View File

@ -59,8 +59,11 @@ class GoodsSkusController extends Controller
$orderRestTime = DeveloperConfig::query() $orderRestTime = DeveloperConfig::query()
->where('key', DeveloperConfig::$ORDER_RESET_TIME) ->where('key', DeveloperConfig::$ORDER_RESET_TIME)
->value('value'); ->value('value');
$time = date('Y-m-d 07:00:00');
if (is_null($orderRestTime)) { if (is_null($orderRestTime)) {
$orderRestTime = date('Y-m-d 07:00:00'); $orderRestTime = $time;
} else {
$orderRestTime = Carbon::parse($orderRestTime)->lt(Carbon::parse($time)) ? $time : $orderRestTime;
} }
$businessOrderItems = BusinessOrderItem::query() $businessOrderItems = BusinessOrderItem::query()
->select(DB::raw($fields)) ->select(DB::raw($fields))

View File

@ -74,6 +74,7 @@ class CombinationGoodsStockUpdateListener implements ShouldQueue
$goodsSku->stock = $stock; $goodsSku->stock = $stock;
$goodsSku->sale_stock = $saleStock; $goodsSku->sale_stock = $saleStock;
$goodsSku->save(); $goodsSku->save();
Log::info("sku 业务订单库存更:{$goodsSku->id},num:{$num}", [$stock, $saleStock]);
$mainGoodsSku = GoodsSku::query()->find($item['goods_sku_id']); $mainGoodsSku = GoodsSku::query()->find($item['goods_sku_id']);
$mainGoodsSku->stock = min($mainGoodsSku->stock, (int)($stock / $item['item_num'])); $mainGoodsSku->stock = min($mainGoodsSku->stock, (int)($stock / $item['item_num']));
$mainGoodsSku->sale_stock = min($mainGoodsSku->sale_stock, (int)($saleStock / $item['item_num'])); $mainGoodsSku->sale_stock = min($mainGoodsSku->sale_stock, (int)($saleStock / $item['item_num']));

View File

@ -16,7 +16,13 @@ class GoodsSku extends Model
'external_sku_id', 'external_sku_id',
'is_combination', 'is_combination',
"create_time_start", "create_time_start",
"create_time_end" "create_time_end",
'min_stock',
'max_stock',
'min_sale_stock',
'max_sale_stock',
"neq_stock",
"neq_sale_stock",
]; ];
protected $fillable = [ protected $fillable = [

View File

@ -28,8 +28,7 @@ class EventServiceProvider extends ServiceProvider
protected $listen = [ protected $listen = [
BusinessOrdersUpdate::class => [ BusinessOrdersUpdate::class => [
UpdateBusinessGoodsStock::class, UpdateBusinessGoodsStock::class,
CombinationGoodsStockUpdateListener::class, CombinationGoodsStockUpdateListener::class
BusinessOrderUpdateListener::class
], ],
BatchStockUpdateEvent::class => [ BatchStockUpdateEvent::class => [
BatchStockUpdateListener::class, BatchStockUpdateListener::class,

View File

@ -1 +0,0 @@
.skuBox[data-v-4de310da]{border:1px solid #e5e5e5;border-radius:5px;padding:15px 0;margin-bottom:15px;background-color:#f3f3f3}.skuBox .tit[data-v-4de310da]{padding-left:40px;font-weight:600;font-size:15px;margin-bottom:15px}.skuBox[data-v-3dbf163e]{border:1px solid #e5e5e5;border-radius:5px;padding:15px 0;margin-bottom:15px;background-color:#f3f3f3}.skuBox .tit[data-v-3dbf163e]{padding-left:40px;font-weight:600;font-size:15px;margin-bottom:15px}.table[data-v-3e0ef0c7]{margin-top:20px;position:relative}.btn[data-v-3e0ef0c7]{float:right}.flex[data-v-3e0ef0c7]{display:flex;align-items:center}.goodBox .Img[data-v-3e0ef0c7]{width:50px;height:50px;margin-right:12px;border-radius:4px}.goodBox .tit[data-v-3e0ef0c7]{color:#000;font-size:13px}.confirmbtn[data-v-3e0ef0c7]{width:114px;height:44px;border-radius:3px;margin-top:21px;margin-bottom:8px}.import-right[data-v-3e0ef0c7]{margin-top:30px}.import-right a[data-v-3e0ef0c7]{color:#409eff}[data-v-3e0ef0c7] .btn11{padding:0;width:14px;height:14px}[data-v-3e0ef0c7] .btn11 img{width:100%;height:100%}.page[data-v-3e0ef0c7]{margin-top:20px}.searchBox[data-v-3e0ef0c7]{display:flex;align-items:center;flex-wrap:wrap;white-space:nowrap}.searchBox .row[data-v-3e0ef0c7]{font-size:14px;margin-bottom:20px;margin-right:15px;display:flex;align-items:center}.titBox[data-v-3e0ef0c7]{display:flex;align-items:center}.red[data-v-3e0ef0c7]{color:red}

1
public/dist/css/683.df205b2b.css vendored Normal file
View File

@ -0,0 +1 @@
.skuBox[data-v-4de310da]{border:1px solid #e5e5e5;border-radius:5px;padding:15px 0;margin-bottom:15px;background-color:#f3f3f3}.skuBox .tit[data-v-4de310da]{padding-left:40px;font-weight:600;font-size:15px;margin-bottom:15px}.skuBox[data-v-3dbf163e]{border:1px solid #e5e5e5;border-radius:5px;padding:15px 0;margin-bottom:15px;background-color:#f3f3f3}.skuBox .tit[data-v-3dbf163e]{padding-left:40px;font-weight:600;font-size:15px;margin-bottom:15px}.table[data-v-5670c00d]{margin-top:20px;position:relative}.btn[data-v-5670c00d]{float:right}.flex[data-v-5670c00d]{display:flex;align-items:center}.goodBox .Img[data-v-5670c00d]{width:50px;height:50px;margin-right:12px;border-radius:4px}.goodBox .tit[data-v-5670c00d]{color:#000;font-size:13px}.confirmbtn[data-v-5670c00d]{width:114px;height:44px;border-radius:3px;margin-top:21px;margin-bottom:8px}.import-right[data-v-5670c00d]{margin-top:30px}.import-right a[data-v-5670c00d]{color:#409eff}[data-v-5670c00d] .btn11{padding:0;width:14px;height:14px}[data-v-5670c00d] .btn11 img{width:100%;height:100%}.page[data-v-5670c00d]{margin-top:20px}.searchBox[data-v-5670c00d]{display:flex;align-items:center;flex-wrap:wrap;white-space:nowrap}.searchBox .row[data-v-5670c00d]{font-size:14px;margin-bottom:20px;margin-right:15px;display:flex;align-items:center}.titBox[data-v-5670c00d]{display:flex;align-items:center}.red[data-v-5670c00d]{color:red}

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><script defer="defer" src="js/chunk-vendors.04652b46.js"></script><script defer="defer" src="js/app.a4f4a4ff.js"></script><link href="css/chunk-vendors.77489a8d.css" rel="stylesheet"><link href="css/app.7e37f273.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></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><script defer="defer" src="js/chunk-vendors.04652b46.js"></script><script defer="defer" src="js/app.eb0ff1e5.js"></script><link href="css/chunk-vendors.77489a8d.css" rel="stylesheet"><link href="css/app.7e37f273.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></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/683.0997409c.js vendored Normal file

File diff suppressed because one or more lines are too long

1
public/dist/js/683.0997409c.js.map vendored Normal file

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

@ -46,6 +46,14 @@
@change="handleChoose()"> @change="handleChoose()">
</el-date-picker> </el-date-picker>
</div> </div>
<div class="row">
<span>剩余库存</span>
<el-input v-model="form.neq_stock" @keyup.enter.native="handleChoose" placeholder="剩余库存" clearable></el-input>
</div>
<div class="row">
<span>在售库存</span>
<el-input v-model="form.neq_sale_stock" @keyup.enter.native="handleChoose" placeholder="在售库存" clearable></el-input>
</div>
<div class="row"> <div class="row">
<el-button type="primary" @click="handleChoose()" icon="el-icon-search">筛选</el-button> <el-button type="primary" @click="handleChoose()" icon="el-icon-search">筛选</el-button>
<el-button plain @click="handleReChoose" icon="el-icon-refresh">重置筛选</el-button> <el-button plain @click="handleReChoose" icon="el-icon-refresh">重置筛选</el-button>
@ -59,6 +67,7 @@
<div> <div>
<span>全部商品({{ total }})</span> <span>全部商品({{ total }})</span>
<div class="btn"> <div class="btn">
<el-button @click="resetOrderCount" icon="el-icon-refresh">订单重置</el-button>
<el-button type="primary" @click="petchEditStock" icon="el-icon-edit" :disabled="!chooseList.length">批量更新在售库存</el-button> <el-button type="primary" @click="petchEditStock" icon="el-icon-edit" :disabled="!chooseList.length">批量更新在售库存</el-button>
<el-button type="primary" v-if="is_admin" @click="addNewgoods" icon="el-icon-plus">新增商品</el-button> <el-button type="primary" v-if="is_admin" @click="addNewgoods" icon="el-icon-plus">新增商品</el-button>
<el-button type="primary" plain v-if="is_admin" @click="handleImport" icon="el-icon-upload2">在售库存导入</el-button> <el-button type="primary" plain v-if="is_admin" @click="handleImport" icon="el-icon-upload2">在售库存导入</el-button>
@ -290,8 +299,8 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
import { goods_types, Brand_goods_types } from '@/api/rankingData.js' import { goods_types } from '@/api/rankingData.js'
import { goods, update, singleUpdate, getStockNum, updateSaleStock, goodsSkuExport } from '@/api/goods' import { goods, update, singleUpdate, getStockNum, updateSaleStock } from '@/api/goods'
import { orderRest } from "@/api/shop" import { orderRest } from "@/api/shop"
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
@ -333,6 +342,8 @@
], ],
form: { form: {
external_sku_id: '', external_sku_id: '',
neq_stock: '',
neq_sale_stock: '',
goods_title: '', // goods_title: '', //
type_id: null, // id type_id: null, // id
brand_id: '', // id brand_id: '', // id
@ -465,7 +476,9 @@
type_id: null, type_id: null,
brand_id: '', brand_id: '',
sku_title: '', sku_title: '',
status: '' status: '',
neq_stock: '',
neq_sale_stock: ''
} }
this.filterTime = [] this.filterTime = []
}, },
@ -490,13 +503,14 @@
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
orderRest().then((res) => { orderRest().then((res) => {
console.log(res)
this.$message({ this.$message({
type: 'success', type: 'success',
message: res.data.message message: res.data.message
}) })
this.getList() this.getList()
}) })
}).catch(() => {
}) })
}, },
// //
@ -539,6 +553,8 @@
exportType: 'goods_sku', exportType: 'goods_sku',
external_sku_id: this.form.external_sku_id, external_sku_id: this.form.external_sku_id,
goods_title: this.form.goods_title, goods_title: this.form.goods_title,
neq_stock: this.form.neq_stock,
neq_sale_stock: this.form.neq_sale_stock,
type_id: this.form.type_id || '', type_id: this.form.type_id || '',
status: this.form.status, status: this.form.status,
keyword_type: 'stock', keyword_type: 'stock',