feat: 基础完成

This commit is contained in:
赵世界 2024-03-15 16:58:25 +08:00
parent 1b02f90047
commit feddef6278
7 changed files with 294 additions and 124 deletions

View File

@ -170,6 +170,7 @@ class DailySalesReport extends Command
$s => $sVal,
$sRate => $sRateVal,
'already_cancel_number' => $datum['total_already_cancel_number'],
'goal_rate' => $goodsSkus[$externalSkuId]['goal_rate'],
]);
}
}

View File

@ -2,6 +2,7 @@
namespace App\Console;
use App\Console\Commands\DailySalesReport;
use App\Console\Commands\GoodsSkuDailyReport;
use App\Console\Commands\Inventory;
use Illuminate\Console\Scheduling\Schedule;
@ -30,9 +31,19 @@ class Kernel extends ConsoleKernel
{
// 服务器/etc/crontab添加cron入口
// * * * * * cd /home/wwwroot/erp.chutang66.com && php artisan schedule:run >> /dev/null 2>&1
$schedule->command(KttOrderQuery::class)->everyMinute();
$schedule->command(GoodsSkuDailyReport::class)->dailyAt('06:00');
$schedule->command(Inventory::class)->dailyAt('07:00');
$schedule->command(KttOrderQuery::class)->everyMinute();
$schedule->command(DailySalesReport::class, ['S1'])->dailyAt('12:00');
$schedule->command(DailySalesReport::class, ['S2'])->dailyAt('13:30');
$schedule->command(DailySalesReport::class, ['S3'])->dailyAt('15:00');
$schedule->command(DailySalesReport::class, ['S4'])->dailyAt('16:00');
$schedule->command(DailySalesReport::class, ['S5'])->dailyAt('17:30');
$schedule->command(DailySalesReport::class, ['S6'])->dailyAt('20:00');
$schedule->command(DailySalesReport::class, ['S7'])->dailyAt('09:30');
$schedule->command(DeleteKttQuery::class)->daily();
}

View File

@ -121,6 +121,7 @@ class GoodsSkusController extends Controller
$sku['order_detail'] = [];
$sku['order_goods_num'] = 0;
}
$sku['order_goods_num'] -= $sku['daily']['reissue_num'];
$sku['inventory_time'] = $lastInventoryTime;
if ('销售' === $rolesName[0]) {
$sku['cost'] = 0;
@ -436,7 +437,7 @@ class GoodsSkusController extends Controller
$rules = [
'updateField' => [
'required',
Rule::in(['reference_price', 'reserve', 'loss_num', 'status'])
Rule::in(['reference_price', 'reserve', 'loss_num', 'status', 'goal_rate'])
],
'reference_price' => [
'sometimes',
@ -460,7 +461,13 @@ class GoodsSkusController extends Controller
'sometimes',
'required',
'integer',
Rule::in([0, 1, 2])],
Rule::in([0, 1, 2])
],
'goal_rate' => [
'sometimes',
'numeric',
'gt:0'
],
];
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
@ -477,6 +484,9 @@ class GoodsSkusController extends Controller
$this->log->message = $request->get('reason');
$this->setBeforeUpdateForLog($record->loss_num);
$record->loss_num += $request->loss_num;
if ('补发' === $request->get('reason')) {
$record->reissue_num += $request->loss_num;
}
$record->save();
$this->setAfterUpdateForLog($record->loss_num);
$sku->stock -= $request->loss_num;

View File

@ -41,6 +41,11 @@ class GoodsSkuRequest extends FormRequest
'sometimes',
'integer',
],
'goal_rate' => [
'sometimes',
'numeric',
'gt:0'
],
'loss_num' => [
'sometimes',
'integer',

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddGoalRateToGoodsSkusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasColumn('goods_skus', 'goal_rate')) {
return;
}
Schema::table('goods_skus', function (Blueprint $table) {
$table->decimal('goal_rate', 8, 4)->default(0)->comment('目标去化率');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('goods_skus', function (Blueprint $table) {
$table->dropColumn('goal_rate');
});
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddReissueNumToDailyStockRecordsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasColumn('daily_stock_records', 'reissue_num')) {
return;
}
Schema::table('daily_stock_records', function (Blueprint $table) {
$table->unsignedInteger('reissue_num')->default(0)->comment('补发数量');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('daily_stock_records', function (Blueprint $table) {
$table->dropColumn('reissue_num');
});
}
}

View File

@ -22,28 +22,30 @@
</el-select>
</el-form-item>
<el-form-item label="商品编码:">
<el-input v-model="form.external_sku_id" placeholder="商品编码" style="width: 100px">
<el-input v-model="form.external_sku_id" placeholder="商品编码" style="width: 125px">
</el-input>
</el-form-item>
<el-form-item label="商品状态:">
<el-select v-model="form.status" placeholder="商品状态" style="width: 115px">
<el-select v-model="form.status" placeholder="商品状态" style="width: 125px">
<el-option v-for="item in options" :key="item.id" :label="item.label" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-select v-model="form.keyword_type" style="width: 80px; margin-right: 5px; margin-left: 10px">
<el-option v-for="item in options3" :key="item.value" :label="item.label" :value="item.value">
<el-select v-model="form.keyword_type"
style="width: 80px; margin-right: 5px; margin-left: 10px">
<el-option v-for="item in options3" :key="item.value" :label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-date-picker v-model="value1" type="datetimerange" range-separator="-" start-placeholder="开始时间"
end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss" @change="getSTime"
style="width: 300px">
<el-date-picker v-model="datePicker" type="datetimerange" range-separator="-"
start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd HH:mm:ss"
@change="getSTime" style="width: 300px">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleChoose(1)">筛选</el-button>
<el-button plain @click="handleReChoose()">重置筛选</el-button>
<el-button plain @click="handleReChoose">重置筛选</el-button>
</el-form-item>
</el-form>
</div>
@ -57,22 +59,23 @@
<span>&nbsp;玫瑰合计: {{ rose_num }}</span>
<span>&nbsp;其它合计: {{ other_num }}</span>
<div class="btn">
<el-button type="primary" plain @click="resetOrderCount()">订单重置</el-button>
<el-button type="primary" plain @click="update()">上新</el-button>
<el-button type="primary" plain @click="resetOrderCount">订单重置</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"
:show-file-list="false" :on-success="inventorySuccess" :before-upload="beforeInventory"
:on-error="inventoryError" style="display:inline-block;margin: 0 10px 0 10px;">
<el-upload ref="myUpload" action="/api/inventory/goods_skus" :multiple="false"
name="inventoryFile" :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-button type="primary" plain @click="addNewgoods">新增商品</el-button>
<el-button type="primary" plain @click="handleImport()">导入商品</el-button>
<el-button type="primary" plain @click="handleExport()">表格导出</el-button>
<el-button type="primary" plain @click="onCount()">库存盘点</el-button>
<el-button type="primary" plain @click="handleImport">导入商品</el-button>
<el-button type="primary" plain @click="handleExport">表格导出</el-button>
<el-button type="primary" plain @click="onCount">库存盘点</el-button>
</div>
</div>
@ -88,34 +91,25 @@
</div>
<div>
<p>{{ scope.row.name }}</p>
<p>
{{ scope.row.goods.goods_code + "_" + scope.row.sku_code }}
</p>
<p>
{{ scope.row.goods.updated_at }}
</p>
<p>{{ scope.row.external_sku_id }}</p>
<p>{{ scope.row.goods.updated_at }}</p>
</div>
</template>
</el-table-column>
<el-table-column label="品类">
<template slot-scope="scope">
<div>
{{ scope.row.goods.type ? scope.row.goods.type.name : "" }}
</div>
<div>{{ scope.row.goods.type ? scope.row.goods.type.name : "" }}</div>
</template>
</el-table-column>
<el-table-column label="规格" prop="title"></el-table-column>
<el-table-column label="品牌">
<template slot-scope="scope">
<div>
{{ scope.row.goods.brand ? scope.row.goods.brand.name : "" }}
</div>
<div>{{ scope.row.goods.brand ? scope.row.goods.brand.name : "" }}</div>
</template>
</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>
<el-table-column prop="yesterday_num" sortable label="1T"></el-table-column>
<el-table-column sortable label="0T">
<template slot-scope="scope">
@ -139,101 +133,109 @@
</template>
</el-table-column>
<el-table-column prop="reference_price" sortable label="售价">
<!-- <el-table-column prop="reference_price" sortable label="售价">
<template slot-scope="scope">
<div v-if="scope.row.id === id">
<el-input v-model="scope.row.reference_price" @blur="reference_priceBlur(scope.row)">
<div v-if="scope.row.id === editPriceId">
<el-input v-model="scope.row.reference_price" @blur="referencePriceBlur(scope.row)">
</el-input>
</div>
<div v-else>
{{ scope.row.reference_price }}
<el-button slot="reference" class="btn11" @click="reference_priceClick(scope.row.id)">
<el-button slot="reference" class="btn11" @click="referencePriceClick(scope.row.id)">
<img src="../../css/img/编辑.png" />
</el-button>
</div>
</template>
</el-table-column>
</el-table-column> -->
<!-- <el-table-column prop="num" sortable label="总量">
</el-table-column> -->
<el-table-column prop="goal_rate" sortable label="目标去化率">
<template slot-scope="scope">
<div v-if="scope.row.id === editGoalId">
<el-input v-model="scope.row.goal_rate" autofocus @blur="blurGoal"
@change="changeGoal(scope.row)"></el-input>
</div>
<div v-else>
{{ scope.row.goal_rate }}
</div>
<i class="el-icon-edit" @click="onGoal(scope.row)" style="padding-left: 5px;"></i>
</template>
</el-table-column>
<el-table-column prop="reserve" sortable label="预留">
<template slot-scope="scope">
<div v-if="scope.row.id === id1">
<el-input v-model="scope.row.reserve" @blur="reservebBlur(scope.row)"></el-input>
<div v-if="scope.row.id === editReserveId">
<el-input v-model="scope.row.reserve" autofocus @blur="cancelReserve"
@change="reservebBlur(scope.row)"></el-input>
</div>
<div v-else>
{{ scope.row.reserve }}
</div>
<el-button slot="reference" class="btn11" @click="onreserve(scope.row.id)"><img
src="../../css/img/编辑.png" alt="" /></el-button>
<i class="el-icon-edit" @click="onreserve(scope.row)" style="padding-left: 5px;"></i>
</template>
</el-table-column>
<el-table-column sortable label="销量">
<template slot-scope="scope">
<div>
<span>{{ scope.row.order_goods_num }}</span>
</div>
<el-popover placement="right-start" trigger="hover" v-if="scope.row.order_detail.length !== 0">
<div>{{ scope.row.order_goods_num }}</div>
<el-popover placement="right-start" trigger="hover"
v-if="scope.row.order_detail.length !== 0">
<div>
<span v-for="(j, index) in scope.row.order_detail" :key="index">
<div>{{ j.shop.name }}:{{ j.number }}</div>
</span>
</div>
<el-button class="btn11" type="text" slot="reference"><img src="../../css/img/眼睛.png"
alt="" />
</el-button>
<i class="el-icon-view" slot="reference" style="padding-left: 5px;"></i>
</el-popover>
</template>
</el-table-column>
<el-table-column sortable label="损耗">
<template slot-scope="scope">
<div v-if="scope.row.id === id2">
<div v-if="scope.row.id === editLossId">
<el-input v-model="scope.row.daily.loss_num"></el-input>
</div>
<div v-else>
{{ scope.row.daily.loss_num }}
</div>
<el-popover placement="right-start" trigger="click" @hide="noBubbles" width="264">
<div>
<span>损耗数量: </span>
<el-input v-model="scope.row.daily.loss_num" style="width: 200px;"></el-input>
</div>
<div style="margin-top: 10px;">
<span>原因: </span>
<el-radio-group v-model="radio" style="width: 220px;">
<el-radio label="48h以上">48h以上</el-radio>
<el-radio label="到货错误">到货错误</el-radio>
<el-radio label="灰霉">灰霉</el-radio>
<el-radio label="长度">长度</el-radio>
<el-radio label="花朵">花朵</el-radio>
<el-radio label="其他">其他</el-radio>
</el-radio-group>
</div>
<div style="margin-top: 10px;">
<el-button type="primary" @click="onLoss(scope.row)" size="mini">保存</el-button>
<!-- <el-button size="mini" type="primary" plain @click="closeLossPopover()">取消
</el-button> -->
</div>
<el-button slot="reference" class="btn11" @click="loss(scope.row.id)">
<img src="../../css/img/编辑.png" alt="" />
</el-button>
<el-popover placement="right-start" trigger="click" @hide="noBubbles">
<el-form ref="lossForm" size="mini" label-width="80px">
<el-form-item label="损耗数量">
<el-input v-model="scope.row.daily.loss_num"></el-input>
</el-form-item>
<el-form-item label="原因">
<el-radio-group v-model="radio">
<el-radio label="48h以上">48h以上</el-radio>
<el-radio label="到货错误">到货错误</el-radio>
<el-radio label="灰霉">灰霉</el-radio>
<el-radio label="长度">长度</el-radio>
<el-radio label="花朵">花朵</el-radio>
<el-radio label="其他">其他</el-radio>
<el-radio label="补发">补发</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onLoss(scope.row.id)">保存</el-button>
</el-form-item>
</el-form>
<i class="el-icon-edit" @click="loss(scope.row)" slot="reference"
style="padding-left: 5px;"></i>
</el-popover>
</template>
</el-table-column>
<el-table-column prop="stock" sortable label="库存">
</el-table-column>
<el-table-column prop="stock" sortable label="库存"></el-table-column>
<el-table-column prop="address" sortable label="盘点">
<template slot-scope="scope">
<div v-if="stock">
<el-input v-model="scope.row.daily.inventory"></el-input>
</div>
<el-popover placement="right-start" trigger="hover" :content="scope.row.daily.inventory_time
? scope.row.daily.inventory_time
: ''
">
<el-popover placement="right-start" trigger="hover"
:content="scope.row.daily.inventory_time ?? ''">
<div v-if="!stock" slot="reference">
{{ scope.row.daily.inventory }}
</div>
@ -309,27 +311,36 @@
</el-dialog>
<!-- 参考售价弹出确认框 -->
<el-dialog :visible.sync="dialogVisible3" width="20%" :close-on-click-modal="false">
<span>确定要修改吗?</span>
<el-dialog title="提示" :visible.sync="dialogVisible3" width="20%" :close-on-click-modal="false">
<span>确定要修改售价?</span>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible3 = false"> </el-button>
<el-button type="primary" @click="reference_priceRequest()"> </el-button>
<el-button type="primary" @click="referencePriceRequest()"> </el-button>
</span>
</el-dialog>
<!-- 预留量弹出框 -->
<el-dialog :visible.sync="dialogVisible4" width="20%" :close-on-click-modal="false">
<span>确定要修改吗?</span>
<el-dialog title="提示" :visible.sync="dialogVisible4" width="20%" :close-on-click-modal="false">
<span>确定要修改预留量?</span>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible4 = false"> </el-button>
<el-button @click="reserveCancel"> </el-button>
<el-button type="primary" @click="reserveRequest()"> </el-button>
</span>
</el-dialog>
<!-- 目标去化率弹出框 -->
<el-dialog title="提示" :visible.sync="dialogVisible5" width="20%" :close-on-click-modal="false">
<span>确定要修改目标去化率吗?</span>
<span slot="footer" class="dialog-footer">
<el-button @click="cancelGoal"> </el-button>
<el-button type="primary" @click="confirmGoal()"> </el-button>
</span>
</el-dialog>
<!-- 点击表格导出弹出框 -->
<el-dialog title="表格导出" :visible.sync="Tableexport" width="30%" :close-on-click-modal="false">
<div>
选择:
<span>选择:</span>
<template>
<el-select v-model="value" placeholder="盘点表/成本表/周数据">
<el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value">
@ -346,7 +357,7 @@
<!-- 点击商品文件导入弹出框 -->
<el-dialog title="导入商品" :visible.sync="docImportDrawer" direction="rtl" custom-class="demo-drawer" ref="drawer"
size="20%" width="30%" @close="importForm.imFileList = []" :close-on-click-modal="false">
width="30%" @close="importForm.imFileList = []" :close-on-click-modal="false">
<div class="demo-drawer__content">
<el-form :model="importForm" :rules="improtRules" ref="importForm">
<el-form-item label="上传文件" label-width="100px" prop="fileList">
@ -379,9 +390,10 @@ import { orderRest } from "../../api/shop";
export default {
data() {
return {
id: "", //id
id1: "", //id
id2: "", //id
editPriceId: "", //id
editGoalId: "",
editReserveId: "", //id
editLossId: "", //id
total: 0, //
rose_num: 0, //
other_num: 0, //
@ -487,18 +499,19 @@ export default {
excelTemplatePath: "", // Excel -
visible: false,
updateField: "", //reference_price-, reserve-, loss_num-, status-
reference_priceShow: false,
reserveShow: false, //-input
value1: "", //
datePicker: "", //
ommodityInventory: [], //
dialogVisible: false, //
dialogVisible2: false, //
dialogVisible3: false, //
dialogVisible4: false, //
publicId: "", // id
reference_price: "", //
reserve: "", //
loadingModule: ""
dialogVisible5: false,
publicId: "",
lastVal: 0,
nowVal: 0,
loadingModule: "",
noRow: {},
};
},
methods: {
@ -591,7 +604,7 @@ export default {
sku_title: "", //
status: "", //
};
this.value1 = "";
this.datePicker = "";
},
//
@ -826,29 +839,29 @@ export default {
},
//
reference_priceClick(id) {
referencePriceClick(id) {
this.updateField = "reference_price";
this.reference_priceShow = true;
this.id = id;
this.id1 = "";
this.editPriceId = id;
this.editReserveId = id;
this.editLossId = "";
},
// input
reference_priceBlur(row) {
referencePriceBlur(row) {
this.dialogVisible3 = true;
this.publicId = row.id;
this.reference_price = row.reference_price;
},
//
reference_priceRequest() {
this.dialogVisible3 = false;
referencePriceRequest() {
let reference_priceData = {
updateField: this.updateField,
reference_price: this.reference_price,
};
singleUpdate(this.publicId, reference_priceData).then((res) => {
this.id = "";
this.editPriceId = "";
this.dialogVisible3 = false;
this.$message({
message: "参考售价修改成功!",
type: "success",
@ -856,27 +869,86 @@ export default {
});
},
onreserve(id) {
onGoal(row) {
this.updateField = "goal_rate";
this.editGoalId = row.id;
this.lastVal = row.goal_rate;
this.editReserveId = "";
this.editLossId = "";
this.editPriceId = "";
},
blurGoal() {
this.updateField = "";
this.editGoalId = "";
},
changeGoal(row) {
this.noRow = row;
this.dialogVisible5 = true;
this.publicId = row.id;
this.nowVal = row.goal_rate;
},
cancelGoal() {
this.dialogVisible5 = false;
this.updateField = "goal_rate";
this.editGoalId = this.publicId;
this.noRow.goal_rate = this.lastVal;
},
confirmGoal() {
let data = {
updateField: 'goal_rate',
goal_rate: this.nowVal,
};
singleUpdate(this.publicId, data).then((res) => {
this.editGoalId = "";
this.dialogVisible5 = false;
this.$message({
message: "目标去化率修改成功!",
type: "success",
});
});
},
onreserve(row) {
this.updateField = "reserve";
this.id1 = id;
this.id = "";
this.editReserveId = row.id;
this.lastVal = row.reserve;
this.editLossId = "";
this.editPriceId = "";
this.editGoalId = "";
},
cancelReserve() {
this.updateField = "";
this.editReserveId = "";
},
//
reservebBlur(row) {
this.reserve = row.reserve;
this.noRow = row;
this.dialogVisible4 = true;
this.publicId = row.id;
this.nowVal = row.reserve;
},
reserveCancel() {
this.dialogVisible4 = false;
this.updateField = "reserve";
this.editReserveId = this.publicId;
this.noRow.reserve = this.lastVal;
},
//
reserveRequest() {
let reservebData = {
updateField: this.updateField,
reserve: this.reserve,
updateField: 'reserve',
reserve: this.nowVal,
};
singleUpdate(this.publicId, reservebData).then((res) => {
this.id1 = "";
this.editReserveId = "";
this.dialogVisible4 = false;
this.$message({
message: "预留量修改成功!",
@ -887,34 +959,35 @@ export default {
loss(id) {
this.updateField = "loss_num";
this.id2 = id;
this.id = "";
this.id1 = "";
this.editLossId = id;
this.editPriceId = "";
this.editReserveId = "";
this.editGoalId = "";
},
//
onLoss(row) {
let id = row.id;
let lossData = {
updateField: this.updateField,
updateField: 'loss_num',
reason: this.radio,
loss_num: row.daily.loss_num,
};
singleUpdate(id, lossData).then((res) => {
this.getList();
this.id2 = "";
this.editLossId = "";
this.$message({
message: "损耗添加成功!",
type: "success",
});
this.getList();
});
},
//
noBubbles() {
this.handleChoose(this.current_page);
this.updateField = "";
this.id2 = "";
this.editLossId = "";
},
//
@ -971,9 +1044,9 @@ export default {
this.getStockInfo();
this.getgoodsType();
this.getbrandType();
this.id = "";
this.id1 = "";
this.id2 = "";
this.editPriceId = "";
this.editReserveId = "";
this.editLossId = "";
},
};
</script>