Merge remote-tracking branch 'origin/dev_1.0.2' into dev_1.0.1
# Conflicts: # ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/InventoryDeliveryServiceImpl.javadev_1.0.1
commit
6776fe3f0d
|
|
@ -0,0 +1,50 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询报价单列表
|
||||||
|
export function listQuotation(query) {
|
||||||
|
return request({
|
||||||
|
url: '/quotation/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询报价单详细
|
||||||
|
export function getQuotation(id) {
|
||||||
|
return request({
|
||||||
|
url: '/quotation/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增报价单
|
||||||
|
export function addQuotation(data) {
|
||||||
|
return request({
|
||||||
|
url: '/quotation/insert',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改报价单
|
||||||
|
export function updateQuotation(data) {
|
||||||
|
return request({
|
||||||
|
url: '/quotation/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除报价单
|
||||||
|
export function delQuotation(id) {
|
||||||
|
return request({
|
||||||
|
url: '/quotation/remove/batch/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function exportSingleQuotation(id) {
|
||||||
|
return request({
|
||||||
|
url: '/quotation/export/single/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
title="报价单详情"
|
||||||
|
:visible.sync="visible"
|
||||||
|
direction="rtl"
|
||||||
|
size="80%"
|
||||||
|
:before-close="handleClose"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<div class="detail-container" v-loading="loading">
|
||||||
|
<!-- Basic Info -->
|
||||||
|
<el-divider content-position="left">基本信息</el-divider>
|
||||||
|
<el-descriptions :column="2" border size="medium">
|
||||||
|
<el-descriptions-item label="报价单号">{{ form.quotationCode }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="报价单名称">{{ form.quotationName }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="币种">
|
||||||
|
<dict-tag :options="dict.type.currency_type" :value="form.amountType"/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="代表处">{{ agentName }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="客户名称">{{ form.customerName }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="状态">{{ form.quotationStatus }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="创建时间">{{ parseTime(form.createTime) }}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注" :span="2">{{ form.remark }}</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
|
||||||
|
<div v-if="form.quotationCode || catalogueTotalPrice > 0 || discountedTotalPrice > 0" style="margin-top: 20px;">
|
||||||
|
<el-row type="flex" justify="space-between" style="margin-bottom: 20px; font-size: 14px;">
|
||||||
|
<el-col :span="24" style="text-align: right;">
|
||||||
|
<span v-if="catalogueTotalPrice > 0" style="margin-right: 20px;">
|
||||||
|
<span style="font-weight: bold;">目录总价:</span>{{ formatAmount(catalogueTotalPrice) }}
|
||||||
|
</span>
|
||||||
|
<span v-if="discountedTotalPrice > 0">
|
||||||
|
<span style="font-weight: bold;">折后总价:</span>{{ formatAmount(discountedTotalPrice) }}
|
||||||
|
</span>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Config Info -->
|
||||||
|
<product-config :value="form" readonly />
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getQuotation } from "@/api/base/quotation";
|
||||||
|
import ProductConfig from "@/views/project/info/ProductConfig";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "QuotationDetail",
|
||||||
|
components: { ProductConfig },
|
||||||
|
dicts: ['currency_type'],
|
||||||
|
props: {
|
||||||
|
agentOptions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
form: {
|
||||||
|
softwareProjectProductInfoList: [],
|
||||||
|
hardwareProjectProductInfoList: [],
|
||||||
|
maintenanceProjectProductInfoList: []
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
agentName() {
|
||||||
|
if (!this.form.agentCode || !this.agentOptions) return this.form.agentCode;
|
||||||
|
const agent = this.agentOptions.find(item => item.agentCode === this.form.agentCode);
|
||||||
|
return agent ? agent.agentName : this.form.agentCode;
|
||||||
|
},
|
||||||
|
catalogueTotalPrice() {
|
||||||
|
let total = 0;
|
||||||
|
const lists = [
|
||||||
|
this.form.softwareProjectProductInfoList,
|
||||||
|
this.form.hardwareProjectProductInfoList,
|
||||||
|
this.form.maintenanceProjectProductInfoList
|
||||||
|
];
|
||||||
|
lists.forEach(list => {
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
list.forEach(item => {
|
||||||
|
total += Number(item.catalogueAllPrice) || 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return total;
|
||||||
|
},
|
||||||
|
discountedTotalPrice() {
|
||||||
|
let total = 0;
|
||||||
|
const lists = [
|
||||||
|
this.form.softwareProjectProductInfoList,
|
||||||
|
this.form.hardwareProjectProductInfoList,
|
||||||
|
this.form.maintenanceProjectProductInfoList
|
||||||
|
];
|
||||||
|
lists.forEach(list => {
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
list.forEach(item => {
|
||||||
|
total += Number(item.allPrice) || 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(id) {
|
||||||
|
this.visible = true;
|
||||||
|
this.getDetail(id);
|
||||||
|
},
|
||||||
|
getDetail(id) {
|
||||||
|
this.loading = true;
|
||||||
|
getQuotation(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
// Ensure lists are arrays
|
||||||
|
this.form.softwareProjectProductInfoList = this.form.softwareProjectProductInfoList || [];
|
||||||
|
this.form.hardwareProjectProductInfoList = this.form.hardwareProjectProductInfoList || [];
|
||||||
|
this.form.maintenanceProjectProductInfoList = this.form.maintenanceProjectProductInfoList || [];
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleClose(done) {
|
||||||
|
this.visible = false;
|
||||||
|
if (done) done();
|
||||||
|
},
|
||||||
|
formatAmount(value) {
|
||||||
|
if (value === null || value === undefined) return '';
|
||||||
|
return Number(value).toLocaleString('en-US', {
|
||||||
|
minimumFractionDigits: 2,
|
||||||
|
maximumFractionDigits: 2
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
.detail-container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,573 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="报价单号" prop="quotationCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.quotationCode"
|
||||||
|
placeholder="请输入报价单号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="报价单" prop="quotationName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.quotationName"
|
||||||
|
placeholder="请输入报价单名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="quotationStatus">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.quotationStatus"
|
||||||
|
placeholder="请输入状态"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="dateRange"
|
||||||
|
style="width: 240px"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
type="datetimerange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['sip:quotation:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['sip:quotation:update']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['sip:quotation:delete']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="quotationList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="报价单号" align="center" prop="quotationCode" />
|
||||||
|
<el-table-column label="报价单" align="center" prop="quotationName" />
|
||||||
|
<el-table-column label="项目编号" align="center" prop="projectCode" />
|
||||||
|
<!-- <el-table-column label="报价金额" align="center" prop="quotationAmount" />-->
|
||||||
|
<el-table-column label="报价金额(¥)" align="center" prop="discountAmount" />
|
||||||
|
<el-table-column label="状态" align="center" prop="quotationStatus" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.quotation_status" :value="scope.row.quotationStatus"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-view"
|
||||||
|
@click="handleDetail(scope.row)"
|
||||||
|
>详情</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['sip:quotation:update']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-document-copy"
|
||||||
|
@click="handleCopy(scope.row)"
|
||||||
|
v-hasPermi="['sip:quotation:add']"
|
||||||
|
>复制创建</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['sip:quotation:delete']"
|
||||||
|
>删除</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-download"
|
||||||
|
@click="handleExport(scope.row)"
|
||||||
|
v-hasPermi="['sip:quotation:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改报价单对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" @close="cancel">
|
||||||
|
<el-steps :active="activeStep" simple finish-status="success" style="margin-bottom: 20px; cursor: pointer;">
|
||||||
|
<el-step title="报价单列表" @click.native="handleStepClick(0)"></el-step>
|
||||||
|
<el-step title="设置基本信息" @click.native="handleStepClick(1)"></el-step>
|
||||||
|
<el-step title="配置信息" @click.native="handleStepClick(2)"></el-step>
|
||||||
|
</el-steps>
|
||||||
|
|
||||||
|
<div v-if="form.quotationCode || catalogueTotalPrice > 0 || discountedTotalPrice > 0">
|
||||||
|
<el-divider></el-divider>
|
||||||
|
<el-row type="flex" justify="space-between" style="margin-bottom: 20px; font-size: 14px;">
|
||||||
|
<el-col :span="8">
|
||||||
|
<span v-if="form.quotationCode">
|
||||||
|
<span style="font-weight: bold;">报价单号:</span>{{ form.quotationCode }}
|
||||||
|
</span>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="16" style="text-align: right;">
|
||||||
|
<span v-if="catalogueTotalPrice > 0" style="margin-right: 20px;">
|
||||||
|
<span style="font-weight: bold;">目录总价:</span>{{ formatAmount(catalogueTotalPrice) }}
|
||||||
|
</span>
|
||||||
|
<span v-if="discountedTotalPrice > 0">
|
||||||
|
<span style="font-weight: bold;">折后总价:</span>{{ formatAmount(discountedTotalPrice) }}
|
||||||
|
</span>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-divider></el-divider>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px" style="max-height: 50vh;overflow-y: auto;padding: 10px">
|
||||||
|
<!-- Step 1 Content: Basic Info -->
|
||||||
|
<div v-show="activeStep === 1">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="报价单名称" prop="quotationName">
|
||||||
|
<el-input v-model="form.quotationName" placeholder="请输入报价单名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="币种" prop="amountType">
|
||||||
|
<el-select v-model="form.amountType" placeholder="请选择币种" style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.currency_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="代表处" prop="agentCode">
|
||||||
|
<el-select v-model="form.agentCode" placeholder="请选择代表处" style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="item in agentOptions"
|
||||||
|
:key="item.agentCode"
|
||||||
|
:label="item.agentName"
|
||||||
|
:value="item.agentCode"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="客户名称" prop="customerName">
|
||||||
|
<el-input v-model="form.customerName" placeholder="请输入客户名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item label="报价单备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Step 2 Content: Config Info -->
|
||||||
|
<div v-show="activeStep === 2">
|
||||||
|
<product-config :value="form" @input="updateProductConfig" />
|
||||||
|
</div>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<div v-if="activeStep === 1">
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="nextStep">下一步</el-button>
|
||||||
|
</div>
|
||||||
|
<div v-if="activeStep === 2">
|
||||||
|
<el-button @click="prevStep">上一步</el-button>
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<quotation-detail ref="detail" :agent-options="agentOptions" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listQuotation, getQuotation, delQuotation, addQuotation, updateQuotation,exportSingleQuotation } from "@/api/base/quotation";
|
||||||
|
import { listAgent } from "@/api/system/agent";
|
||||||
|
import ProductConfig from "@/views/project/info/ProductConfig";
|
||||||
|
import QuotationDetail from "./detail";
|
||||||
|
import {isEmpty} from "@/utils/validate";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Quotation",
|
||||||
|
components: {
|
||||||
|
ProductConfig,
|
||||||
|
QuotationDetail
|
||||||
|
},
|
||||||
|
dicts: ['currency_type','quotation_status'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 当前激活步骤
|
||||||
|
activeStep: 1,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 报价单表格数据
|
||||||
|
quotationList: [],
|
||||||
|
// 日期范围
|
||||||
|
dateRange: [],
|
||||||
|
// 代表处选项
|
||||||
|
agentOptions: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
quotationCode: null,
|
||||||
|
quotationName: null,
|
||||||
|
projectCode: null,
|
||||||
|
quotationStatus: null,
|
||||||
|
createTimeStart: null,
|
||||||
|
createTimeEnd: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {
|
||||||
|
softwareProjectProductInfoList: [],
|
||||||
|
hardwareProjectProductInfoList: [],
|
||||||
|
maintenanceProjectProductInfoList: []
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
quotationName: [
|
||||||
|
{ required: true, message: "报价单名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
amountType: [
|
||||||
|
{ required: true, message: "币种不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
agentCode: [
|
||||||
|
{ required: true, message: "代表处不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
customerName: [
|
||||||
|
{ required: true, message: "客户名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
catalogueTotalPrice() {
|
||||||
|
let total = 0;
|
||||||
|
const lists = [
|
||||||
|
this.form.softwareProjectProductInfoList,
|
||||||
|
this.form.hardwareProjectProductInfoList,
|
||||||
|
this.form.maintenanceProjectProductInfoList
|
||||||
|
];
|
||||||
|
lists.forEach(list => {
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
list.forEach(item => {
|
||||||
|
total += Number(item.catalogueAllPrice) || 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return total;
|
||||||
|
},
|
||||||
|
discountedTotalPrice() {
|
||||||
|
let total = 0;
|
||||||
|
const lists = [
|
||||||
|
this.form.softwareProjectProductInfoList,
|
||||||
|
this.form.hardwareProjectProductInfoList,
|
||||||
|
this.form.maintenanceProjectProductInfoList
|
||||||
|
];
|
||||||
|
lists.forEach(list => {
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
list.forEach(item => {
|
||||||
|
total += Number(item.allPrice) || 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getAgentList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询报价单列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
if (null != this.dateRange && '' != this.dateRange) {
|
||||||
|
this.queryParams.createTimeStart = this.dateRange[0];
|
||||||
|
this.queryParams.createTimeEnd = this.dateRange[1];
|
||||||
|
}
|
||||||
|
listQuotation(this.queryParams).then(response => {
|
||||||
|
this.quotationList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDetail(row) {
|
||||||
|
this.$refs.detail.open(row.id);
|
||||||
|
},
|
||||||
|
handleExport(row){
|
||||||
|
this.$modal.confirm('是否确认导出已审批的采购数据项?').then(() => {
|
||||||
|
return exportSingleQuotation(row.id);
|
||||||
|
}).then(response => {
|
||||||
|
this.$download.download( response.msg)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 查询代表处列表 */
|
||||||
|
getAgentList() {
|
||||||
|
listAgent().then(response => {
|
||||||
|
this.agentOptions = response.rows;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
this.activeStep = 1;
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
quotationCode: null,
|
||||||
|
quotationName: null,
|
||||||
|
projectCode: null,
|
||||||
|
quotationAmount: null,
|
||||||
|
discountAmount: null,
|
||||||
|
quotationStatus: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
remark: null,
|
||||||
|
agentCode: null,
|
||||||
|
amountType: null,
|
||||||
|
customerName: null,
|
||||||
|
softwareProjectProductInfoList: [],
|
||||||
|
hardwareProjectProductInfoList: [],
|
||||||
|
maintenanceProjectProductInfoList: []
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dateRange = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.queryParams.createTimeStart = null;
|
||||||
|
this.queryParams.createTimeEnd = null;
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.activeStep = 1;
|
||||||
|
this.title = "添加报价单";
|
||||||
|
},
|
||||||
|
/** 复制创建 */
|
||||||
|
handleCopy(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getQuotation(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
// Reset ID and Code for new creation
|
||||||
|
this.form.id = null;
|
||||||
|
this.form.quotationCode = null;
|
||||||
|
this.form.quotationStatus = null;
|
||||||
|
this.form.createTime = null;
|
||||||
|
this.form.updateTime = null;
|
||||||
|
this.form.createBy = null;
|
||||||
|
this.form.updateBy = null;
|
||||||
|
|
||||||
|
// Ensure product lists are initialized if null
|
||||||
|
this.form.softwareProjectProductInfoList = this.form.softwareProjectProductInfoList || [];
|
||||||
|
this.form.hardwareProjectProductInfoList = this.form.hardwareProjectProductInfoList || [];
|
||||||
|
this.form.maintenanceProjectProductInfoList = this.form.maintenanceProjectProductInfoList || [];
|
||||||
|
|
||||||
|
// Clear IDs in configuration lists to ensure they are created as new records
|
||||||
|
const clearIds = (list) => {
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
list.forEach(item => {
|
||||||
|
item.id = null;
|
||||||
|
item.quotationId = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
clearIds(this.form.softwareProjectProductInfoList);
|
||||||
|
clearIds(this.form.hardwareProjectProductInfoList);
|
||||||
|
clearIds(this.form.maintenanceProjectProductInfoList);
|
||||||
|
|
||||||
|
this.open = true;
|
||||||
|
this.activeStep = 1;
|
||||||
|
this.title = "复制创建报价单";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getQuotation(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
// Ensure product lists are initialized if null
|
||||||
|
this.form.softwareProjectProductInfoList = this.form.softwareProjectProductInfoList || [];
|
||||||
|
this.form.hardwareProjectProductInfoList = this.form.hardwareProjectProductInfoList || [];
|
||||||
|
this.form.maintenanceProjectProductInfoList = this.form.maintenanceProjectProductInfoList || [];
|
||||||
|
this.open = true;
|
||||||
|
this.activeStep = 1;
|
||||||
|
this.title = "修改报价单";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 处理步骤点击 */
|
||||||
|
handleStepClick(stepIndex) {
|
||||||
|
if (stepIndex === 0) {
|
||||||
|
this.cancel();
|
||||||
|
} else if (stepIndex === 1) {
|
||||||
|
this.activeStep = 1;
|
||||||
|
} else if (stepIndex === 2) {
|
||||||
|
// Validate step 1 before going to step 2
|
||||||
|
this.$refs["form"].validateField(['quotationName', 'amountType', 'agentCode', 'customerName'], (errorMessage) => {
|
||||||
|
if (!errorMessage) {
|
||||||
|
this.activeStep = 2;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/** 下一步 */
|
||||||
|
nextStep() {
|
||||||
|
// 校验Step 1的字段
|
||||||
|
this.$refs["form"].validateField(['quotationName', 'amountType', 'agentCode', 'customerName'], (errorMessage) => {
|
||||||
|
if (!errorMessage) {
|
||||||
|
this.activeStep = 2;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 上一步 */
|
||||||
|
prevStep() {
|
||||||
|
this.activeStep = 1;
|
||||||
|
},
|
||||||
|
updateProductConfig(data) {
|
||||||
|
this.form.softwareProjectProductInfoList = data.softwareProjectProductInfoList;
|
||||||
|
this.form.hardwareProjectProductInfoList = data.hardwareProjectProductInfoList;
|
||||||
|
this.form.maintenanceProjectProductInfoList = data.maintenanceProjectProductInfoList;
|
||||||
|
},
|
||||||
|
formatAmount(value) {
|
||||||
|
if (value === null || value === undefined) return '';
|
||||||
|
return Number(value).toLocaleString('en-US', {
|
||||||
|
minimumFractionDigits: 2,
|
||||||
|
maximumFractionDigits: 2
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
const checkProduct=(list)=>isEmpty(list) ||( !isEmpty(list) && list.every(item => item.productBomCode!==''))
|
||||||
|
if (!checkProduct(this.form.softwareProjectProductInfoList) || !checkProduct(this.form.hardwareProjectProductInfoList) || !checkProduct(this.form.maintenanceProjectProductInfoList)) {
|
||||||
|
this.$modal.msgError("请完善产品信息");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.form.quotationAmount = this.catalogueTotalPrice;
|
||||||
|
this.form.discountAmount = this.discountedTotalPrice;
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateQuotation(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addQuotation(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除报价单?').then(function() {
|
||||||
|
return delQuotation(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
<template>
|
||||||
|
<el-dialog title="选择报价单" :visible.sync="visible" :close-on-click-modal="false" width="900px" append-to-body @close="handleClose">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" @submit.native.prevent>
|
||||||
|
<el-form-item label="报价单号" prop="quotationCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.quotationCode"
|
||||||
|
placeholder="请输入报价单号"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="报价单名称" prop="quotationName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.quotationName"
|
||||||
|
placeholder="请输入报价单名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="quotationList" @row-click="handleRowClick" highlight-current-row>
|
||||||
|
<el-table-column label="报价单号" align="center" prop="quotationCode" />
|
||||||
|
<el-table-column label="报价单名称" align="center" prop="quotationName" />
|
||||||
|
<el-table-column label="项目编号" align="center" prop="projectCode" />
|
||||||
|
<el-table-column label="报价金额" align="center" prop="discountAmount" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="handleClose">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listQuotation } from "@/api/base/quotation";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "SelectQuotation",
|
||||||
|
props: {
|
||||||
|
visible: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
createBy: {
|
||||||
|
type: String,
|
||||||
|
default: "-1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 报价单表格数据
|
||||||
|
quotationList: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
createBy: this.createBy,
|
||||||
|
quotationCode: null,
|
||||||
|
quotationName: null,
|
||||||
|
orderByColumn: 'createTime',
|
||||||
|
isAsc: 'desc'
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
visible(val) {
|
||||||
|
if (val) {
|
||||||
|
this.queryParams.createBy = this.createBy||"-1";
|
||||||
|
this.getList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询报价单列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listQuotation(this.queryParams).then(response => {
|
||||||
|
this.quotationList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 行点击事件 */
|
||||||
|
handleRowClick(row) {
|
||||||
|
this.$emit("quotation-selected", row);
|
||||||
|
this.handleClose();
|
||||||
|
},
|
||||||
|
/** 关闭按钮 */
|
||||||
|
handleClose() {
|
||||||
|
this.$emit("update:visible", false);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -289,6 +289,7 @@
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="配置信息" name="productConfig">
|
<el-tab-pane label="配置信息" name="productConfig">
|
||||||
<div style="max-height: 60vh; overflow-y: auto; padding: 15px;">
|
<div style="max-height: 60vh; overflow-y: auto; padding: 15px;">
|
||||||
|
<el-button type="primary" plain icon="el-icon-download" size="mini" @click="openSelectQuotation" class="mb8" :disabled="isFormDisabled">报价单导入</el-button>
|
||||||
<!-- 产品配置信息 -->
|
<!-- 产品配置信息 -->
|
||||||
<product-config v-model="form.productConfig" ref="productConfig" :disabled="isFormDisabled" />
|
<product-config v-model="form.productConfig" ref="productConfig" :disabled="isFormDisabled" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -432,6 +433,7 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<select-agent :visible.sync="selectAgentVisible" @agent-selected="handleAgentSelected" />
|
<select-agent :visible.sync="selectAgentVisible" @agent-selected="handleAgentSelected" />
|
||||||
|
<select-quotation :visible.sync="selectQuotationVisible" :create-by="form.partnerSystemUserId" @quotation-selected="handleQuotationSelected" />
|
||||||
<select-customer :visible.sync="selectCustomerVisible" @customer-selected="handleCustomerSelected" />
|
<select-customer :visible.sync="selectCustomerVisible" @customer-selected="handleCustomerSelected" />
|
||||||
<select-partner :visible.sync="selectPartnerVisible" @partner-selected="handlePartnerSelected" />
|
<select-partner :visible.sync="selectPartnerVisible" @partner-selected="handlePartnerSelected" />
|
||||||
<select-user :visible.sync="selectUserVisible" @user-selected="handleUserSelected" />
|
<select-user :visible.sync="selectUserVisible" @user-selected="handleUserSelected" />
|
||||||
|
|
@ -440,8 +442,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getProject, addProject, updateProject } from "@/api/project/info";
|
import { getProject, addProject, updateProject } from "@/api/project/info";
|
||||||
|
import { getQuotation } from "@/api/base/quotation";
|
||||||
import { listAreas } from "@/api/system/area";
|
import { listAreas } from "@/api/system/area";
|
||||||
import SelectAgent from "../../system/agent/selectAgent.vue";
|
import SelectAgent from "../../system/agent/selectAgent.vue";
|
||||||
|
import SelectQuotation from "../../base/quotation/selectQuotation.vue";
|
||||||
import SelectCustomer from "../../system/customer/selectCustomer.vue";
|
import SelectCustomer from "../../system/customer/selectCustomer.vue";
|
||||||
import SelectPartner from "../../system/partner/selectPartner.vue";
|
import SelectPartner from "../../system/partner/selectPartner.vue";
|
||||||
import SelectUser from "@/views/system/user/selectUser";
|
import SelectUser from "@/views/system/user/selectUser";
|
||||||
|
|
@ -454,6 +458,7 @@ export default {
|
||||||
name: "ProjectForm",
|
name: "ProjectForm",
|
||||||
components: {
|
components: {
|
||||||
SelectAgent,
|
SelectAgent,
|
||||||
|
SelectQuotation,
|
||||||
SelectCustomer,
|
SelectCustomer,
|
||||||
SelectPartner,
|
SelectPartner,
|
||||||
SelectUser,
|
SelectUser,
|
||||||
|
|
@ -492,6 +497,7 @@ export default {
|
||||||
cityOptions: [],
|
cityOptions: [],
|
||||||
industryOptions: [],
|
industryOptions: [],
|
||||||
selectAgentVisible: false,
|
selectAgentVisible: false,
|
||||||
|
selectQuotationVisible: false,
|
||||||
selectCustomerVisible: false,
|
selectCustomerVisible: false,
|
||||||
selectPartnerVisible: false,
|
selectPartnerVisible: false,
|
||||||
selectUserVisible: false,
|
selectUserVisible: false,
|
||||||
|
|
@ -677,6 +683,7 @@ export default {
|
||||||
partnerName: null,
|
partnerName: null,
|
||||||
partnerCode: null,
|
partnerCode: null,
|
||||||
partnerUserName: null,
|
partnerUserName: null,
|
||||||
|
partnerSystemUserId: null,
|
||||||
contactWay: null,
|
contactWay: null,
|
||||||
estimatedAmount: null,
|
estimatedAmount: null,
|
||||||
estimatedOrderTime: null,
|
estimatedOrderTime: null,
|
||||||
|
|
@ -828,6 +835,7 @@ export default {
|
||||||
if (value === 'h3c') {
|
if (value === 'h3c') {
|
||||||
this.form.partnerName = '新华三';
|
this.form.partnerName = '新华三';
|
||||||
this.form.partnerCode = null;
|
this.form.partnerCode = null;
|
||||||
|
this.form.partnerSystemUserId = null;
|
||||||
}
|
}
|
||||||
if (this.$refs.form) {
|
if (this.$refs.form) {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
@ -836,6 +844,61 @@ export default {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
openSelectQuotation() {
|
||||||
|
this.selectQuotationVisible = true;
|
||||||
|
},
|
||||||
|
handleQuotationSelected(quotation) {
|
||||||
|
if (!quotation) return;
|
||||||
|
const confirmImport = () => {
|
||||||
|
getQuotation(quotation.id).then(response => {
|
||||||
|
const data = response.data;
|
||||||
|
// Clear IDs
|
||||||
|
const clearIds = (list) => {
|
||||||
|
if (list && list.length > 0) {
|
||||||
|
list.forEach(item => {
|
||||||
|
item.id = null;
|
||||||
|
item.quotationId = null;
|
||||||
|
item.projectId = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const softwareList = data.softwareProjectProductInfoList || [];
|
||||||
|
const hardwareList = data.hardwareProjectProductInfoList || [];
|
||||||
|
const maintenanceList = data.maintenanceProjectProductInfoList || [];
|
||||||
|
|
||||||
|
clearIds(softwareList);
|
||||||
|
clearIds(hardwareList);
|
||||||
|
clearIds(maintenanceList);
|
||||||
|
|
||||||
|
this.$set(this.form.productConfig, 'softwareProjectProductInfoList', softwareList);
|
||||||
|
this.$set(this.form.productConfig, 'hardwareProjectProductInfoList', hardwareList);
|
||||||
|
this.$set(this.form.productConfig, 'maintenanceProjectProductInfoList', maintenanceList);
|
||||||
|
this.$set(this.form, 'quotationId', quotation.id);
|
||||||
|
|
||||||
|
this.$modal.msgSuccess("导入成功");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check if config exists
|
||||||
|
const hasConfig = (
|
||||||
|
(this.form.productConfig.softwareProjectProductInfoList && this.form.productConfig.softwareProjectProductInfoList.length > 0) ||
|
||||||
|
(this.form.productConfig.hardwareProjectProductInfoList && this.form.productConfig.hardwareProjectProductInfoList.length > 0) ||
|
||||||
|
(this.form.productConfig.maintenanceProjectProductInfoList && this.form.productConfig.maintenanceProjectProductInfoList.length > 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (hasConfig) {
|
||||||
|
this.$confirm('当前项目已有配置信息,导入将覆盖现有配置,是否确认导入?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
confirmImport();
|
||||||
|
}).catch(() => {});
|
||||||
|
} else {
|
||||||
|
confirmImport();
|
||||||
|
}
|
||||||
|
},
|
||||||
openSelectAgent() {
|
openSelectAgent() {
|
||||||
this.selectAgentVisible = true;
|
this.selectAgentVisible = true;
|
||||||
},
|
},
|
||||||
|
|
@ -862,6 +925,8 @@ export default {
|
||||||
this.form.partnerCode = partner.partnerCode;
|
this.form.partnerCode = partner.partnerCode;
|
||||||
this.form.partnerUserName = partner.contactPerson;
|
this.form.partnerUserName = partner.contactPerson;
|
||||||
this.form.contactWay = partner.contactPhone;
|
this.form.contactWay = partner.contactPhone;
|
||||||
|
this.$set(this.form,'partnerSystemUserId', partner.systemUserId);
|
||||||
|
|
||||||
this.selectPartnerVisible = false;
|
this.selectPartnerVisible = false;
|
||||||
},
|
},
|
||||||
openSelectPeople() {
|
openSelectPeople() {
|
||||||
|
|
|
||||||
|
|
@ -68,4 +68,4 @@ unis:
|
||||||
# 执行单截止时间
|
# 执行单截止时间
|
||||||
endHour: 96
|
endHour: 96
|
||||||
mail:
|
mail:
|
||||||
enabled: true
|
enabled: false
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.ruoyi.sip.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.sip.domain.Quotation;
|
||||||
|
import com.ruoyi.sip.service.IQuotationService;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* @Author makejava
|
||||||
|
* @Desc 报价单
|
||||||
|
* (Quotation)表控制层
|
||||||
|
* @Date 2026-01-26 14:58:02
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/quotation")
|
||||||
|
|
||||||
|
public class QuotationController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IQuotationService quotationService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@RequiresPermissions("sip:quotation:list")
|
||||||
|
public TableDataInfo list(Quotation quotation) {
|
||||||
|
startPage();
|
||||||
|
List<Quotation> list = quotationService.queryAll(quotation);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Integer id) {
|
||||||
|
return AjaxResult.success(quotationService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/insert")
|
||||||
|
@RequiresPermissions("sip:quotation:add")
|
||||||
|
public AjaxResult add(@RequestBody Quotation quotation) {
|
||||||
|
return toAjax(quotationService.insert(quotation));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@RequiresPermissions("sip:quotation:update")
|
||||||
|
public AjaxResult edit(@RequestBody Quotation quotation) {
|
||||||
|
return toAjax(quotationService.update(quotation));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@RequiresPermissions("sip:quotation:delete")
|
||||||
|
public AjaxResult remove(@PathVariable("id") Integer id) {
|
||||||
|
return toAjax(quotationService.deleteById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键批量删除报价单
|
||||||
|
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/remove/batch/{ids}")
|
||||||
|
@RequiresPermissions("sip:quotation:delete")
|
||||||
|
public AjaxResult batchRemove(@PathVariable("ids") Integer[] ids) {
|
||||||
|
return AjaxResult.success(quotationService.batchRemove(ids));
|
||||||
|
}
|
||||||
|
@GetMapping("/export/single/{id}")
|
||||||
|
@RequiresPermissions("sip:quotation:export")
|
||||||
|
public AjaxResult exportSingle(@PathVariable("id") Integer id) {
|
||||||
|
return AjaxResult.success(quotationService.exportSingle(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -81,6 +81,7 @@ public class CodeGenTable {
|
||||||
@Getter
|
@Getter
|
||||||
public enum TableNameEnum{
|
public enum TableNameEnum{
|
||||||
ORDER_DELIVERY("order_delivery", "发货记录"),
|
ORDER_DELIVERY("order_delivery", "发货记录"),
|
||||||
|
OMS_QUOTATION("oms_quotation", "报价单"),
|
||||||
;
|
;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,9 @@ public class ProjectInfo extends BaseEntity
|
||||||
|
|
||||||
private List<OmsFileLog> projectFileList;
|
private List<OmsFileLog> projectFileList;
|
||||||
private String fileId;
|
private String fileId;
|
||||||
|
private String partnerSystemUserId;
|
||||||
|
private Integer quotationId;
|
||||||
|
private List<Integer> quotationIdList;
|
||||||
|
|
||||||
|
|
||||||
private Boolean availableForOrder;
|
private Boolean availableForOrder;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
package com.ruoyi.sip.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报价单
|
||||||
|
* (Quotation)实体类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2026-01-27 15:11:57
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Quotation extends BaseEntity {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 报价单号
|
||||||
|
*/
|
||||||
|
private String quotationCode;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String quotationName;
|
||||||
|
/**
|
||||||
|
* 项目编号
|
||||||
|
*/
|
||||||
|
private String projectCode;
|
||||||
|
private String projectName;
|
||||||
|
/**
|
||||||
|
* 报价金额
|
||||||
|
*/
|
||||||
|
private Double quotationAmount;
|
||||||
|
/**
|
||||||
|
* 折后金额
|
||||||
|
*/
|
||||||
|
private Double discountAmount;
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private String quotationStatus;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 项目id 多个
|
||||||
|
*/
|
||||||
|
private String projectId;
|
||||||
|
/**
|
||||||
|
* 代表处
|
||||||
|
*/
|
||||||
|
private String agentCode;
|
||||||
|
/**
|
||||||
|
* 币种
|
||||||
|
*/
|
||||||
|
private String amountType;
|
||||||
|
private Date createTimeStart;
|
||||||
|
private Date createTimeEnd;
|
||||||
|
/**
|
||||||
|
* 客户名称
|
||||||
|
*/
|
||||||
|
private String customerName;
|
||||||
|
// @Excel(name = "软件")
|
||||||
|
private List<QuotationProductInfo> softwareProjectProductInfoList;
|
||||||
|
// @Excel(name = "终端")
|
||||||
|
private List<QuotationProductInfo> hardwareProjectProductInfoList;
|
||||||
|
// @Excel(name = "服务")
|
||||||
|
private List<QuotationProductInfo> maintenanceProjectProductInfoList;
|
||||||
|
//省代
|
||||||
|
private List<QuotationProductInfo> provinceProductInfoList;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum QuotationStatusEnum {
|
||||||
|
NOT_BIND("0", "未绑定"),
|
||||||
|
BIND("1", "已绑定"),
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
QuotationStatusEnum(String code, String value) {
|
||||||
|
this.code = code;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.ruoyi.sip.domain;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目产品信息(QuotationProductInfo)实体类
|
||||||
|
*
|
||||||
|
* @author makejava
|
||||||
|
* @since 2026-01-27 14:45:17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class QuotationProductInfo extends BaseEntity {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 产品编码
|
||||||
|
*/
|
||||||
|
private String productBomCode;
|
||||||
|
/**
|
||||||
|
* 产品型号
|
||||||
|
*/
|
||||||
|
private String model;
|
||||||
|
/**
|
||||||
|
* 产品代码
|
||||||
|
*/
|
||||||
|
private String productCode;
|
||||||
|
/**
|
||||||
|
* 产品描述
|
||||||
|
*/
|
||||||
|
private String productDesc;
|
||||||
|
/**
|
||||||
|
* 产品数量
|
||||||
|
*/
|
||||||
|
private Double quantity;
|
||||||
|
/**
|
||||||
|
* 目录单价
|
||||||
|
*/
|
||||||
|
private Double cataloguePrice;
|
||||||
|
/**
|
||||||
|
* 目录总价
|
||||||
|
*/
|
||||||
|
private Double catalogueAllPrice;
|
||||||
|
/**
|
||||||
|
* 单价
|
||||||
|
*/
|
||||||
|
private Double price;
|
||||||
|
/**
|
||||||
|
* 总价
|
||||||
|
*/
|
||||||
|
private Double allPrice;
|
||||||
|
/**
|
||||||
|
* 指导折扣
|
||||||
|
*/
|
||||||
|
private Double guidanceDiscount;
|
||||||
|
/**
|
||||||
|
* 折扣
|
||||||
|
*/
|
||||||
|
private Double discount;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 税率
|
||||||
|
*/
|
||||||
|
private Double taxRate;
|
||||||
|
/**
|
||||||
|
* 配置器id
|
||||||
|
*/
|
||||||
|
private Integer quotationId;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.ruoyi.sip.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.sip.domain.Quotation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author makejava
|
||||||
|
* @Desc 报价单
|
||||||
|
* (Quotation)表数据库访问层
|
||||||
|
* @Date 2026-01-26 14:58:02
|
||||||
|
*/
|
||||||
|
public interface QuotationMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过实体作为筛选条件查询
|
||||||
|
*
|
||||||
|
* @param quotation 实例对象
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
List<Quotation> queryAll(Quotation quotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查详情
|
||||||
|
*/
|
||||||
|
Quotation queryById(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*/
|
||||||
|
int insert(Quotation quotation);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*/
|
||||||
|
int update(Quotation quotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*/
|
||||||
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id批量删除报价单
|
||||||
|
*/
|
||||||
|
int batchRemove(Integer[] ids);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.ruoyi.sip.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.sip.domain.QuotationProductInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author makejava
|
||||||
|
* @Desc 项目产品信息(QuotationProductInfo)表数据库访问层
|
||||||
|
* @Date 2026-01-27 14:45:17
|
||||||
|
*/
|
||||||
|
public interface QuotationProductInfoMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过实体作为筛选条件查询
|
||||||
|
*
|
||||||
|
* @param quotationProductInfo 实例对象
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
List<QuotationProductInfo> queryAll(QuotationProductInfo quotationProductInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查详情
|
||||||
|
*/
|
||||||
|
QuotationProductInfo queryById(Integer id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*/
|
||||||
|
int insert(QuotationProductInfo quotationProductInfo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*/
|
||||||
|
int update(QuotationProductInfo quotationProductInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*/
|
||||||
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id批量删除项目产品信息
|
||||||
|
*/
|
||||||
|
int batchRemove(Integer[] ids);
|
||||||
|
|
||||||
|
void insertBatch(List<QuotationProductInfo> addList);
|
||||||
|
|
||||||
|
void updateBatch(List<QuotationProductInfo> addList);
|
||||||
|
|
||||||
|
List<QuotationProductInfo> listByQuotationId(List<Integer> integers);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.ruoyi.sip.service;
|
||||||
|
|
||||||
|
import com.ruoyi.sip.domain.QuotationProductInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author makejava
|
||||||
|
* @Desc 项目产品信息(QuotationProductInfo)表服务接口
|
||||||
|
* @Date 2026-01-27 14:45:18
|
||||||
|
*/
|
||||||
|
public interface IQuotationProductInfoService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过实体作为筛选条件查询
|
||||||
|
*/
|
||||||
|
List<QuotationProductInfo> queryAll(QuotationProductInfo quotationProductInfo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查详情
|
||||||
|
*/
|
||||||
|
QuotationProductInfo queryById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*/
|
||||||
|
int insert(QuotationProductInfo quotationProductInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*/
|
||||||
|
int update(QuotationProductInfo quotationProductInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*/
|
||||||
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id批量删除项目产品信息
|
||||||
|
*/
|
||||||
|
int batchRemove(Integer[] ids);
|
||||||
|
|
||||||
|
void saveBatch(List<QuotationProductInfo> productList);
|
||||||
|
|
||||||
|
List<QuotationProductInfo> listByQuotationId(List<Integer> integers);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.ruoyi.sip.service;
|
||||||
|
|
||||||
|
import com.ruoyi.sip.domain.Quotation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author makejava
|
||||||
|
* @Desc 报价单
|
||||||
|
* (Quotation)表服务接口
|
||||||
|
* @Date 2026-01-26 14:58:02
|
||||||
|
*/
|
||||||
|
public interface IQuotationService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过实体作为筛选条件查询
|
||||||
|
*/
|
||||||
|
List<Quotation> queryAll(Quotation quotation);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID查详情
|
||||||
|
*/
|
||||||
|
Quotation queryById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增数据
|
||||||
|
*/
|
||||||
|
int insert(Quotation quotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改数据
|
||||||
|
*/
|
||||||
|
int update(Quotation quotation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主键删除数据
|
||||||
|
*/
|
||||||
|
int deleteById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id批量删除报价单
|
||||||
|
*/
|
||||||
|
int batchRemove(Integer[] ids);
|
||||||
|
|
||||||
|
String exportSingle(Integer id);
|
||||||
|
|
||||||
|
void bind(Integer quotationId);
|
||||||
|
|
||||||
|
void unBind(Integer quotationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -86,7 +86,7 @@ public class CodeGenTableServiceImpl implements ICodeGenTableService {
|
||||||
updateDto.setVersion(codeGeneratorConfig.getVersion());
|
updateDto.setVersion(codeGeneratorConfig.getVersion());
|
||||||
|
|
||||||
if (!DateUtils.isSameDay(codeGeneratorConfig.getGenDate(), DateUtils.getNowDate())) {
|
if (!DateUtils.isSameDay(codeGeneratorConfig.getGenDate(), DateUtils.getNowDate())) {
|
||||||
updateDto.setNumber(0);
|
updateDto.setNumber(1);
|
||||||
updateDto.setGenDate(DateUtils.getNowDate());
|
updateDto.setGenDate(DateUtils.getNowDate());
|
||||||
} else {
|
} else {
|
||||||
updateDto.setNumber(codeGeneratorConfig.getNumber());
|
updateDto.setNumber(codeGeneratorConfig.getNumber());
|
||||||
|
|
@ -96,8 +96,13 @@ public class CodeGenTableServiceImpl implements ICodeGenTableService {
|
||||||
int currentSequence = updateDto.getNumber();
|
int currentSequence = updateDto.getNumber();
|
||||||
String sequenceStr = String.format("%0" + numberLength + "d", currentSequence);
|
String sequenceStr = String.format("%0" + numberLength + "d", currentSequence);
|
||||||
|
|
||||||
|
String generatedCode;
|
||||||
// 构造唯一 code
|
// 构造唯一 code
|
||||||
String generatedCode = prefix + DELIMIT + datePart + DELIMIT + sequenceStr;
|
if (StringUtils.isEmpty( prefix)){
|
||||||
|
generatedCode = datePart + DELIMIT + sequenceStr;
|
||||||
|
}else {
|
||||||
|
generatedCode = prefix + DELIMIT + datePart + DELIMIT + sequenceStr;
|
||||||
|
}
|
||||||
|
|
||||||
// 更新数据库中的 number 字段,确保并发安全性
|
// 更新数据库中的 number 字段,确保并发安全性
|
||||||
int updatedRows = codeGenTableMapper.updateNumber(updateDto);
|
int updatedRows = codeGenTableMapper.updateNumber(updateDto);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
|
|
@ -85,7 +84,6 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
* @return 产品库存
|
* @return 产品库存
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@DataScope(deptAlias = "t8", userAlias = "t8")
|
|
||||||
public List<InventoryDelivery> selectInventoryDeliveryList(InventoryDelivery inventoryDelivery) {
|
public List<InventoryDelivery> selectInventoryDeliveryList(InventoryDelivery inventoryDelivery) {
|
||||||
return inventoryDeliveryMapper.selectInventoryDeliveryList(inventoryDelivery);
|
return inventoryDeliveryMapper.selectInventoryDeliveryList(inventoryDelivery);
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +114,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
//修改数据的时候同步修改出库价
|
//修改数据的时候同步修改出库价
|
||||||
BigDecimal bigDecimal = inventoryOuterMapper.selectOutPriceByCode(inventoryDelivery.getOuterCode());
|
BigDecimal bigDecimal = inventoryOuterMapper.selectOutPriceByCode(inventoryDelivery.getOuterCode());
|
||||||
|
|
||||||
List<OmsInventoryDeliveryDetail> detailList = new ArrayList<>();
|
List<OmsInventoryDeliveryDetail> detailList=new ArrayList<>();
|
||||||
if (CollUtil.isEmpty(productSnDataList)) {
|
if (CollUtil.isEmpty(productSnDataList)) {
|
||||||
List<InventoryInfo> inventoryInfoList = productSnList.stream().map(item -> {
|
List<InventoryInfo> inventoryInfoList = productSnList.stream().map(item -> {
|
||||||
InventoryInfo info = new InventoryInfo();
|
InventoryInfo info = new InventoryInfo();
|
||||||
|
|
@ -133,7 +131,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
return info;
|
return info;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
inventoryInfoService.saveBatch(inventoryInfoList);
|
inventoryInfoService.saveBatch(inventoryInfoList);
|
||||||
} else {
|
}else{
|
||||||
for (InventoryInfo inventoryInfo : productSnDataList) {
|
for (InventoryInfo inventoryInfo : productSnDataList) {
|
||||||
inventoryInfo.setInventoryStatus(InventoryInfo.InventoryStatusEnum.OUTER.getCode());
|
inventoryInfo.setInventoryStatus(InventoryInfo.InventoryStatusEnum.OUTER.getCode());
|
||||||
inventoryInfo.setOuterCode(inventoryDelivery.getOuterCode());
|
inventoryInfo.setOuterCode(inventoryDelivery.getOuterCode());
|
||||||
|
|
@ -144,7 +142,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
detail.setProductSn(inventoryInfo.getProductSn());
|
detail.setProductSn(inventoryInfo.getProductSn());
|
||||||
detailList.add(detail);
|
detailList.add(detail);
|
||||||
}
|
}
|
||||||
omsInventoryInnerService.importByOuter(productSnDataList, inventoryDelivery.getProductCode(), inventoryDelivery.getPurchaseNo(), inventoryDelivery.getItemId());
|
omsInventoryInnerService.importByOuter(productSnDataList,inventoryDelivery.getProductCode(),inventoryDelivery.getPurchaseNo(),inventoryDelivery.getItemId());
|
||||||
}
|
}
|
||||||
InventoryOuterDetail inventoryOuterDetail = new InventoryOuterDetail();
|
InventoryOuterDetail inventoryOuterDetail = new InventoryOuterDetail();
|
||||||
inventoryOuterDetail.setId(inventoryDelivery.getDetailId());
|
inventoryOuterDetail.setId(inventoryDelivery.getDetailId());
|
||||||
|
|
@ -153,7 +151,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
|
|
||||||
//todo 限制只能发一次货 防止重复发货
|
//todo 限制只能发一次货 防止重复发货
|
||||||
int i = inventoryDeliveryMapper.insertInventoryDelivery(inventoryDelivery);
|
int i = inventoryDeliveryMapper.insertInventoryDelivery(inventoryDelivery);
|
||||||
if (CollUtil.isNotEmpty(detailList)) {
|
if (CollUtil.isNotEmpty(detailList)){
|
||||||
for (OmsInventoryDeliveryDetail detail : detailList) {
|
for (OmsInventoryDeliveryDetail detail : detailList) {
|
||||||
detail.setDeliveryId(inventoryDelivery.getId());
|
detail.setDeliveryId(inventoryDelivery.getId());
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +231,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
updateOrder.setDeliveryStatus(sum == allSum ? ProjectOrderInfo.DeliveryStatusEnum.ALL_DELIVERY.getCode() : ProjectOrderInfo.DeliveryStatusEnum.PART_DELIVERY.getCode());
|
updateOrder.setDeliveryStatus(sum == allSum ? ProjectOrderInfo.DeliveryStatusEnum.ALL_DELIVERY.getCode() : ProjectOrderInfo.DeliveryStatusEnum.PART_DELIVERY.getCode());
|
||||||
projectOrderInfoService.updateProjectOrderInfoByCode(updateOrder);
|
projectOrderInfoService.updateProjectOrderInfoByCode(updateOrder);
|
||||||
//新增计收数据
|
//新增计收数据
|
||||||
if (sum == allSum) {
|
if (sum==allSum){
|
||||||
//新增计收数据
|
//新增计收数据
|
||||||
OmsFinanceCharge omsFinanceCharge = new OmsFinanceCharge();
|
OmsFinanceCharge omsFinanceCharge = new OmsFinanceCharge();
|
||||||
omsFinanceCharge.setOrderCode(inventoryDelivery.getOrderCode());
|
omsFinanceCharge.setOrderCode(inventoryDelivery.getOrderCode());
|
||||||
|
|
@ -300,7 +298,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
InventoryDelivery inventoryDelivery1 = selectInventoryDeliveryById(inventoryDelivery.getId());
|
InventoryDelivery inventoryDelivery1 = selectInventoryDeliveryById(inventoryDelivery.getId());
|
||||||
BigDecimal allPrice = price.multiply(new BigDecimal(inventoryDelivery1.getQuantity().toString()));
|
BigDecimal allPrice = price.multiply(new BigDecimal(inventoryDelivery1.getQuantity().toString()));
|
||||||
receivableBill.setTotalPriceWithTax(allPrice);
|
receivableBill.setTotalPriceWithTax(allPrice);
|
||||||
BigDecimal defaultTaxRate = projectProductInfo.getTaxRate() == null ? new BigDecimal(defaultTax) : projectProductInfo.getTaxRate().divide(new BigDecimal("100"));
|
BigDecimal defaultTaxRate = projectProductInfo.getTaxRate()==null?new BigDecimal(defaultTax):projectProductInfo.getTaxRate().divide(new BigDecimal("100"));
|
||||||
BigDecimal allPriceWithOutTax = allPrice.divide(BigDecimal.ONE.add(defaultTaxRate), 2, RoundingMode.HALF_UP);
|
BigDecimal allPriceWithOutTax = allPrice.divide(BigDecimal.ONE.add(defaultTaxRate), 2, RoundingMode.HALF_UP);
|
||||||
receivableBill.setTaxRate(defaultTaxRate);
|
receivableBill.setTaxRate(defaultTaxRate);
|
||||||
receivableBill.setTotalPriceWithoutTax(allPriceWithOutTax);
|
receivableBill.setTotalPriceWithoutTax(allPriceWithOutTax);
|
||||||
|
|
@ -332,7 +330,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
public List<DeliveryInfoVo> getNumberInfo(ApiDataQueryDto dto) {
|
public List<DeliveryInfoVo> getNumberInfo(ApiDataQueryDto dto) {
|
||||||
List<DeliveryInfoVo> resultList = inventoryDeliveryMapper.listSn(dto);
|
List<DeliveryInfoVo> resultList = inventoryDeliveryMapper.listSn(dto);
|
||||||
List<String> orderCodeList = resultList.stream().map(DeliveryInfoVo::getOrderCode).collect(Collectors.toList());
|
List<String> orderCodeList = resultList.stream().map(DeliveryInfoVo::getOrderCode).collect(Collectors.toList());
|
||||||
if (CollUtil.isEmpty(orderCodeList)) {
|
if (CollUtil.isEmpty(orderCodeList)){
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
// 根据订单ID查询合同信息
|
// 根据订单ID查询合同信息
|
||||||
|
|
@ -360,6 +358,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
//todo 判断应付或应收状态 不允许退
|
//todo 判断应付或应收状态 不允许退
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
InventoryDelivery inventoryDelivery = inventoryDeliveryMapper.selectInventoryDeliveryById(id);
|
InventoryDelivery inventoryDelivery = inventoryDeliveryMapper.selectInventoryDeliveryById(id);
|
||||||
deleteInventoryOuterById(id);
|
deleteInventoryOuterById(id);
|
||||||
List<ProjectProductInfo> projectProductInfos = projectProductInfoService.listDeliveryProductByOrderCode(Collections.singletonList(inventoryDelivery.getOrderCode()));
|
List<ProjectProductInfo> projectProductInfos = projectProductInfoService.listDeliveryProductByOrderCode(Collections.singletonList(inventoryDelivery.getOrderCode()));
|
||||||
|
|
@ -401,14 +400,14 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
InventoryDelivery dbData = inventoryDeliveryMapper.selectInventoryDeliveryById(inventoryDelivery.getId());
|
InventoryDelivery dbData = inventoryDeliveryMapper.selectInventoryDeliveryById(inventoryDelivery.getId());
|
||||||
List<OmsInventoryDeliveryDetail> omsInventoryDeliveryDetails = deliveryDetailService.selectOmsInventoryDeliveryDetailByDeliveryId(dbData.getId());
|
List<OmsInventoryDeliveryDetail> omsInventoryDeliveryDetails = deliveryDetailService.selectOmsInventoryDeliveryDetailByDeliveryId(dbData.getId());
|
||||||
InventoryInfo queryParams = new InventoryInfo();
|
InventoryInfo queryParams = new InventoryInfo();
|
||||||
if (CollUtil.isNotEmpty(omsInventoryDeliveryDetails)) {
|
if (CollUtil.isNotEmpty(omsInventoryDeliveryDetails)){
|
||||||
queryParams.setProductSnList(omsInventoryDeliveryDetails.stream()
|
queryParams.setProductSnList(omsInventoryDeliveryDetails.stream()
|
||||||
.map(OmsInventoryDeliveryDetail::getProductSn).collect(Collectors.toList()));
|
.map(OmsInventoryDeliveryDetail::getProductSn).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
queryParams.setOuterCode(dbData.getOuterCode());
|
queryParams.setOuterCode(dbData.getOuterCode());
|
||||||
queryParams.setWarehouseId(dbData.getWarehouseId());
|
queryParams.setWarehouseId(dbData.getWarehouseId());
|
||||||
List<InventoryInfo> inventoryInfos = inventoryInfoService.selectInventoryInfoList(queryParams);
|
List<InventoryInfo> inventoryInfos = inventoryInfoService.selectInventoryInfoList(queryParams);
|
||||||
return inventoryInfos.stream().map(item -> {
|
return inventoryInfos.stream().map(item->{
|
||||||
InventoryDeliveryDetailExcelDto detailExcelDto = new InventoryDeliveryDetailExcelDto();
|
InventoryDeliveryDetailExcelDto detailExcelDto = new InventoryDeliveryDetailExcelDto();
|
||||||
detailExcelDto.setProductSn(item.getProductSn());
|
detailExcelDto.setProductSn(item.getProductSn());
|
||||||
detailExcelDto.setProductCode(item.getProductCode());
|
detailExcelDto.setProductCode(item.getProductCode());
|
||||||
|
|
@ -469,7 +468,7 @@ public class InventoryDeliveryServiceImpl implements IInventoryDeliveryService {
|
||||||
|
|
||||||
private Date updateStartTimeAndAddList(DeliveryInfoVo deliveryInfoVo, ProjectProductInfo productInfo, Date startTime, List<DeliveryInfoVo.ServiceInfo> serviceInfoList) {
|
private Date updateStartTimeAndAddList(DeliveryInfoVo deliveryInfoVo, ProjectProductInfo productInfo, Date startTime, List<DeliveryInfoVo.ServiceInfo> serviceInfoList) {
|
||||||
int year = productInfo.getValue() == null ? 0 : Integer.parseInt(productInfo.getValue());
|
int year = productInfo.getValue() == null ? 0 : Integer.parseInt(productInfo.getValue());
|
||||||
year = Math.toIntExact(year * (productInfo.getQuantity() == null ? 1 : productInfo.getQuantity()));
|
year= Math.toIntExact(year * (productInfo.getQuantity()==null? 1:productInfo.getQuantity()));
|
||||||
DeliveryInfoVo.ServiceInfo serviceInfo = deliveryInfoVo.new ServiceInfo();
|
DeliveryInfoVo.ServiceInfo serviceInfo = deliveryInfoVo.new ServiceInfo();
|
||||||
serviceInfo.setServiceLevel(productInfo.getProductBomCode());
|
serviceInfo.setServiceLevel(productInfo.getProductBomCode());
|
||||||
serviceInfo.setServiceDescribe(productInfo.getProductDesc());
|
serviceInfo.setServiceDescribe(productInfo.getProductDesc());
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
import com.ruoyi.sip.dto.StatisticsDto;
|
import com.ruoyi.sip.dto.StatisticsDto;
|
||||||
import com.ruoyi.sip.mapper.ProjectInfoMapper;
|
import com.ruoyi.sip.mapper.ProjectInfoMapper;
|
||||||
import com.ruoyi.sip.service.*;
|
import com.ruoyi.sip.service.*;
|
||||||
|
import liquibase.hub.model.Project;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
|
|
@ -87,6 +88,8 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
private static final String PROJECT_CODE_PREFIX = "V";
|
private static final String PROJECT_CODE_PREFIX = "V";
|
||||||
private static final Integer PROJECT_CODE_LENGTH = 6;
|
private static final Integer PROJECT_CODE_LENGTH = 6;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IQuotationService quotationService;
|
||||||
|
|
||||||
public static final String INDUSTRY_TYPE_YYS_DICT_TYPE = "bg_yys";
|
public static final String INDUSTRY_TYPE_YYS_DICT_TYPE = "bg_yys";
|
||||||
public static final String INDUSTRY_TYPE_DICT_TYPE = "bg_hysy";
|
public static final String INDUSTRY_TYPE_DICT_TYPE = "bg_hysy";
|
||||||
|
|
@ -210,6 +213,7 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
}
|
}
|
||||||
int i = projectInfoMapper.insertProjectInfo(projectInfo);
|
int i = projectInfoMapper.insertProjectInfo(projectInfo);
|
||||||
saveOtherInfo(projectInfo);
|
saveOtherInfo(projectInfo);
|
||||||
|
quotationService.bind(projectInfo.getQuotationId());
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,6 +300,13 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
update.setProjectId(projectOrderInfo.getProjectId());
|
update.setProjectId(projectOrderInfo.getProjectId());
|
||||||
orderInfoService.updateProjectOrderInfo(update);
|
orderInfoService.updateProjectOrderInfo(update);
|
||||||
}
|
}
|
||||||
|
quotationService.bind(projectInfo.getQuotationId());
|
||||||
|
ProjectInfo queryQuotationProject = new ProjectInfo();
|
||||||
|
queryQuotationProject.setQuotationId(oldProjectInfo.getQuotationId());
|
||||||
|
List<ProjectInfo> projectInfos = projectInfoMapper.selectProjectInfoList(queryQuotationProject);
|
||||||
|
if(CollUtil.isEmpty(projectInfos)){
|
||||||
|
quotationService.unBind(oldProjectInfo.getQuotationId());
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.ruoyi.sip.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.ruoyi.sip.domain.QuotationProductInfo;
|
||||||
|
import com.ruoyi.sip.mapper.QuotationProductInfoMapper;
|
||||||
|
import com.ruoyi.sip.service.IQuotationProductInfoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author makejava
|
||||||
|
* @Desc 项目产品信息(QuotationProductInfo)表服务实现类
|
||||||
|
* @Date 2026-01-27 14:45:18
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class QuotationProductInfoServiceImpl implements IQuotationProductInfoService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private QuotationProductInfoMapper quotationProductInfoMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表数据
|
||||||
|
*
|
||||||
|
* @param quotationProductInfo 实例对象
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<QuotationProductInfo> queryAll(QuotationProductInfo quotationProductInfo) {
|
||||||
|
List<QuotationProductInfo> dataList = quotationProductInfoMapper.queryAll(quotationProductInfo);
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QuotationProductInfo queryById(Integer id) {
|
||||||
|
return quotationProductInfoMapper.queryById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insert(QuotationProductInfo quotationProductInfo) {
|
||||||
|
return quotationProductInfoMapper.insert(quotationProductInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(QuotationProductInfo quotationProductInfo) {
|
||||||
|
return quotationProductInfoMapper.update(quotationProductInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteById(Integer id) {
|
||||||
|
return quotationProductInfoMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id批量删除项目产品信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int batchRemove(Integer[] ids) {
|
||||||
|
return quotationProductInfoMapper.batchRemove(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveBatch(List<QuotationProductInfo> productList) {
|
||||||
|
if (CollUtil.isEmpty(productList)) {
|
||||||
|
//保存详情
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<QuotationProductInfo> addList = productList.stream().filter(quotationProductInfo -> quotationProductInfo.getId() == null).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(addList)){
|
||||||
|
//保存详情
|
||||||
|
quotationProductInfoMapper.insertBatch(addList);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
List<QuotationProductInfo> updateList = productList.stream().filter(quotationProductInfo -> quotationProductInfo.getId() != null).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(updateList)){
|
||||||
|
//保存详情
|
||||||
|
quotationProductInfoMapper.updateBatch(updateList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<QuotationProductInfo> listByQuotationId(List<Integer> integers) {
|
||||||
|
return quotationProductInfoMapper.listByQuotationId(integers);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,556 @@
|
||||||
|
package com.ruoyi.sip.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
import com.alibaba.excel.metadata.CellData;
|
||||||
|
import com.alibaba.excel.metadata.Head;
|
||||||
|
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
|
||||||
|
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
|
||||||
|
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||||
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||||
|
import com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy;
|
||||||
|
import com.ruoyi.common.annotation.DataScope;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.PageUtils;
|
||||||
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
|
import com.ruoyi.sip.domain.*;
|
||||||
|
import com.ruoyi.sip.mapper.QuotationMapper;
|
||||||
|
import com.ruoyi.sip.service.ICodeGenTableService;
|
||||||
|
import com.ruoyi.sip.service.IProjectInfoService;
|
||||||
|
import com.ruoyi.sip.service.IQuotationProductInfoService;
|
||||||
|
import com.ruoyi.sip.service.IQuotationService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author makejava
|
||||||
|
* @Desc 报价单
|
||||||
|
* (Quotation)表服务实现类
|
||||||
|
* @Date 2026-01-26 14:58:02
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Slf4j
|
||||||
|
public class QuotationServiceImpl implements IQuotationService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private QuotationMapper quotationMapper;
|
||||||
|
@Autowired
|
||||||
|
private ICodeGenTableService codeGenTableService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IQuotationProductInfoService quotationProductInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private IProjectInfoService projectInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表数据
|
||||||
|
*
|
||||||
|
* @param quotation 实例对象
|
||||||
|
* @return 对象列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@DataScope(deptAlias = "u", userAlias = "u")
|
||||||
|
public List<Quotation> queryAll(Quotation quotation) {
|
||||||
|
List<Quotation> dataList = quotationMapper.queryAll(quotation);
|
||||||
|
PageUtils.clearPage();
|
||||||
|
if (CollUtil.isNotEmpty(dataList)) {
|
||||||
|
ProjectInfo projectInfo = new ProjectInfo();
|
||||||
|
List<Integer> collect = dataList.stream().map(Quotation::getId).collect(Collectors.toList());
|
||||||
|
projectInfo.setQuotationIdList(collect);
|
||||||
|
List<ProjectInfo> projectInfos = projectInfoService.selectProjectInfoList(projectInfo);
|
||||||
|
Map<Integer, String> projectCodeMap = projectInfos.stream().collect(Collectors.groupingBy(ProjectInfo::getQuotationId, Collectors.mapping(ProjectInfo::getProjectCode, Collectors.joining(","))));
|
||||||
|
dataList.forEach(item -> item.setProjectCode(projectCodeMap.get(item.getId())));
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Quotation queryById(Integer id) {
|
||||||
|
Quotation quotation = quotationMapper.queryById(id);
|
||||||
|
if (quotation != null) {
|
||||||
|
List<QuotationProductInfo> productInfoList = quotationProductInfoService.listByQuotationId(Collections.singletonList(quotation.getId()));
|
||||||
|
Map<String, List<QuotationProductInfo>> productListMap = productInfoList.stream().collect(Collectors.groupingBy(QuotationProductInfo::getType));
|
||||||
|
quotation.setSoftwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.SOFTWARE.getType()));
|
||||||
|
quotation.setHardwareProjectProductInfoList(productListMap.get(ProductInfo.ProductTypeEnum.HARDWARE.getType()));
|
||||||
|
List<QuotationProductInfo> maintenanceProjectProductInfoList = productListMap.getOrDefault(ProductInfo.ProductTypeEnum.HARDWARE_MAINTENANCE.getType(), new ArrayList<>());
|
||||||
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.SOFTWARE_MAINTENANCE.getType(), new ArrayList<>()));
|
||||||
|
maintenanceProjectProductInfoList.addAll(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.OTHER.getType(), new ArrayList<>()));
|
||||||
|
quotation.setMaintenanceProjectProductInfoList(maintenanceProjectProductInfoList);
|
||||||
|
quotation.setProvinceProductInfoList(productListMap.getOrDefault(ProductInfo.ProductTypeEnum.PROVINCE_SERVICE.getType(),new ArrayList<>()));
|
||||||
|
ProjectInfo projectInfo = new ProjectInfo();
|
||||||
|
projectInfo.setQuotationId(quotation.getId());
|
||||||
|
List<ProjectInfo> projectInfos = projectInfoService.selectProjectInfoList(projectInfo);
|
||||||
|
quotation.setProjectCode(projectInfos.stream().map(ProjectInfo::getProjectCode).collect(Collectors.joining(",")));
|
||||||
|
quotation.setProjectName(projectInfos.stream().map(ProjectInfo::getProjectName).collect(Collectors.joining(",")));
|
||||||
|
}
|
||||||
|
|
||||||
|
return quotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insert(Quotation quotation) {
|
||||||
|
String s = codeGenTableService.generateCode(CodeGenTable.TableNameEnum.OMS_QUOTATION.getName());
|
||||||
|
quotation.setQuotationCode(s);
|
||||||
|
quotation.setQuotationStatus(Quotation.QuotationStatusEnum.NOT_BIND.getCode());
|
||||||
|
quotation.setCreateBy(ShiroUtils.getUserId().toString());
|
||||||
|
int insert = quotationMapper.insert(quotation);
|
||||||
|
List<QuotationProductInfo> productList = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(quotation.getSoftwareProjectProductInfoList())) {
|
||||||
|
productList.addAll(quotation.getSoftwareProjectProductInfoList());
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(quotation.getHardwareProjectProductInfoList())) {
|
||||||
|
productList.addAll(quotation.getHardwareProjectProductInfoList());
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(quotation.getMaintenanceProjectProductInfoList())) {
|
||||||
|
productList.addAll(quotation.getMaintenanceProjectProductInfoList());
|
||||||
|
}
|
||||||
|
for (QuotationProductInfo quotationProductInfo : productList) {
|
||||||
|
quotationProductInfo.setQuotationId(quotation.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
quotationProductInfoService.saveBatch(productList);
|
||||||
|
return insert;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(Quotation quotation) {
|
||||||
|
List<QuotationProductInfo> productList = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(quotation.getSoftwareProjectProductInfoList())) {
|
||||||
|
productList.addAll(quotation.getSoftwareProjectProductInfoList());
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(quotation.getHardwareProjectProductInfoList())) {
|
||||||
|
productList.addAll(quotation.getHardwareProjectProductInfoList());
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(quotation.getMaintenanceProjectProductInfoList())) {
|
||||||
|
productList.addAll(quotation.getMaintenanceProjectProductInfoList());
|
||||||
|
}
|
||||||
|
for (QuotationProductInfo quotationProductInfo : productList) {
|
||||||
|
quotationProductInfo.setQuotationId(quotation.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
quotationProductInfoService.saveBatch(productList);
|
||||||
|
return quotationMapper.update(quotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteById(Integer id) {
|
||||||
|
return quotationMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过id批量删除报价单
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int batchRemove(Integer[] ids) {
|
||||||
|
return quotationMapper.batchRemove(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String exportSingle(Integer id) {
|
||||||
|
try {
|
||||||
|
Quotation quotation = this.queryById(id);
|
||||||
|
|
||||||
|
List<List<Object>> rows = new ArrayList<>();
|
||||||
|
|
||||||
|
// 加载Logo
|
||||||
|
byte[] logoBytes = null;
|
||||||
|
try (InputStream is = SpringUtils.getResource("classpath:static/img/companyLogo.png").getInputStream()) {
|
||||||
|
logoBytes = IoUtil.readBytes(is);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("读取公司Logo失败", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 第一部分:标题信息
|
||||||
|
// Row 1: Title
|
||||||
|
List<Object> row1 = new ArrayList<>();
|
||||||
|
row1.add("云桌面产品价格明细清单");
|
||||||
|
for (int i = 1; i < 11; i++) row1.add("");
|
||||||
|
if (logoBytes != null) {
|
||||||
|
row1.add(logoBytes);
|
||||||
|
} else {
|
||||||
|
row1.add("");
|
||||||
|
}
|
||||||
|
rows.add(row1);
|
||||||
|
rows.add(Collections.emptyList());
|
||||||
|
|
||||||
|
// Calculate Date
|
||||||
|
String validDate = LocalDate.now().plusDays(7).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
|
||||||
|
// Helper to create padded row
|
||||||
|
List<Object> row2 = new ArrayList<>();
|
||||||
|
row2.add("");
|
||||||
|
row2.add("*项目名称:");
|
||||||
|
row2.add(quotation.getProjectName());
|
||||||
|
row2.add("");
|
||||||
|
row2.add("");
|
||||||
|
row2.add("");
|
||||||
|
row2.add("*本报价单有效期至:"+validDate);
|
||||||
|
rows.add(row2);
|
||||||
|
|
||||||
|
List<Object> row3 = new ArrayList<>();
|
||||||
|
row3.add("");
|
||||||
|
row3.add("*项目ID:");
|
||||||
|
row3.add(quotation.getProjectCode());
|
||||||
|
row3.add("(项目名称和ID在商务申请时必填)");
|
||||||
|
row3.add("");
|
||||||
|
row3.add("");
|
||||||
|
row3.add("*云桌面完整报价单必须包含部署服务、现场维保、省代集成服务,此三项由省代进行补充报价,不能缺项");
|
||||||
|
rows.add(row3);
|
||||||
|
|
||||||
|
List<Object> row4 = new ArrayList<>();
|
||||||
|
row4.add("");
|
||||||
|
row4.add("国家/地区 :");
|
||||||
|
row4.add("中国大陆");
|
||||||
|
row4.add("");
|
||||||
|
row4.add("");
|
||||||
|
row4.add("");
|
||||||
|
row4.add("*因上游CPU、内存、存储波动较大,封标前3天与汇智区域接口人邮件确定商务折扣和供货周期,否则报价单无效");
|
||||||
|
rows.add(row4);
|
||||||
|
|
||||||
|
|
||||||
|
rows.add(Collections.emptyList());
|
||||||
|
|
||||||
|
// 2. 第二部分:列标题
|
||||||
|
List<String> headers = Arrays.asList(
|
||||||
|
"序号", "产品编码", "产品型号", "产品代码描述", "数量",
|
||||||
|
"目录单价(RMB)", "推荐折扣", "折扣单价(RMB)", "总价(RMB)",
|
||||||
|
"目录总价(RMB)", "CID信息", "备注"
|
||||||
|
);
|
||||||
|
// 记录列标题行索引
|
||||||
|
int headerRowIndex = rows.size();
|
||||||
|
Set<Integer> coloredRowIndices = new HashSet<>();
|
||||||
|
// 标题列填充灰色
|
||||||
|
coloredRowIndices.add(headerRowIndex);
|
||||||
|
rows.add(new ArrayList<>(headers));
|
||||||
|
|
||||||
|
// 3. 第三部分:数据分组
|
||||||
|
Set<Integer> aquaRowIndices = new HashSet<>();
|
||||||
|
AtomicInteger sectionCounter = new AtomicInteger(1);
|
||||||
|
|
||||||
|
// 添加默认分组:云桌面服务器
|
||||||
|
QuotationProductInfo defaultItem = new QuotationProductInfo();
|
||||||
|
|
||||||
|
addSection(rows, "云桌面服务器","VOI/VDI服务器", Collections.singletonList(defaultItem), coloredRowIndices, aquaRowIndices, sectionCounter);
|
||||||
|
|
||||||
|
addSection(rows, "云桌面软件", "Workspace/learningspace/NEX",quotation.getSoftwareProjectProductInfoList(), coloredRowIndices, aquaRowIndices, sectionCounter);
|
||||||
|
addSection(rows, "云终端", "VOI/VDI终端",quotation.getHardwareProjectProductInfoList(), coloredRowIndices, aquaRowIndices, sectionCounter);
|
||||||
|
addSection(rows, "省代服务(若从省代出货需计算)","省代服务", quotation.getProvinceProductInfoList(), coloredRowIndices, aquaRowIndices, sectionCounter);
|
||||||
|
|
||||||
|
ExcelUtil<Object> util = new ExcelUtil<>(Object.class);
|
||||||
|
String fileName = util.encodingFilename("报价单_" + quotation.getQuotationCode());
|
||||||
|
String filePath = util.getAbsoluteFile(fileName);
|
||||||
|
|
||||||
|
// 自动换行样式
|
||||||
|
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||||
|
contentWriteCellStyle.setWrapped(true);
|
||||||
|
contentWriteCellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
||||||
|
contentWriteCellStyle.setHorizontalAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.LEFT);
|
||||||
|
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(null, contentWriteCellStyle);
|
||||||
|
|
||||||
|
EasyExcel.write(filePath)
|
||||||
|
.registerWriteHandler(horizontalCellStyleStrategy)
|
||||||
|
.registerWriteHandler(new CustomColumnWidthStrategy(headerRowIndex))
|
||||||
|
.registerWriteHandler(new com.alibaba.excel.write.handler.CellWriteHandler() {
|
||||||
|
private org.apache.poi.ss.usermodel.CellStyle coloredStyle;
|
||||||
|
private org.apache.poi.ss.usermodel.CellStyle coloredLeftStyle;
|
||||||
|
private org.apache.poi.ss.usermodel.CellStyle aquaStyle;
|
||||||
|
private org.apache.poi.ss.usermodel.CellStyle centerStyle;
|
||||||
|
private org.apache.poi.ss.usermodel.CellStyle infoStyle;
|
||||||
|
private org.apache.poi.ss.usermodel.CellStyle redInfoStyle;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeCellCreate(com.alibaba.excel.write.metadata.holder.WriteSheetHolder writeSheetHolder, com.alibaba.excel.write.metadata.holder.WriteTableHolder writeTableHolder, org.apache.poi.ss.usermodel.Row row, com.alibaba.excel.metadata.Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCellCreate(com.alibaba.excel.write.metadata.holder.WriteSheetHolder writeSheetHolder, com.alibaba.excel.write.metadata.holder.WriteTableHolder writeTableHolder, org.apache.poi.ss.usermodel.Cell cell, com.alibaba.excel.metadata.Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCellDataConverted(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, CellData cellData, Cell cell, Head head, Integer integer, Boolean aBoolean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCellDispose(com.alibaba.excel.write.metadata.holder.WriteSheetHolder writeSheetHolder, com.alibaba.excel.write.metadata.holder.WriteTableHolder writeTableHolder, List<com.alibaba.excel.metadata.CellData> cellDataList, org.apache.poi.ss.usermodel.Cell cell, com.alibaba.excel.metadata.Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||||
|
// Title Centering (Row 0)
|
||||||
|
if (cell.getRowIndex() == 0 && cell.getColumnIndex() == 0) {
|
||||||
|
if (centerStyle == null) {
|
||||||
|
org.apache.poi.ss.usermodel.Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
|
||||||
|
centerStyle = workbook.createCellStyle();
|
||||||
|
centerStyle.setAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.CENTER);
|
||||||
|
centerStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
||||||
|
centerStyle.setFillForegroundColor(org.apache.poi.ss.usermodel.IndexedColors.WHITE.getIndex());
|
||||||
|
centerStyle.setFillPattern(org.apache.poi.ss.usermodel.FillPatternType.SOLID_FOREGROUND);
|
||||||
|
org.apache.poi.ss.usermodel.Font font = workbook.createFont();
|
||||||
|
font.setBold(true);
|
||||||
|
font.setFontHeightInPoints((short) 16);
|
||||||
|
centerStyle.setFont(font);
|
||||||
|
}
|
||||||
|
cell.setCellStyle(centerStyle);
|
||||||
|
// Merge cells for title (0-10, Logo is at 11 usually, but let's merge fewer if needed, or 0-10)
|
||||||
|
writeSheetHolder.getSheet().addMergedRegionUnsafe(new org.apache.poi.ss.util.CellRangeAddress(0, 0, 0, 10));
|
||||||
|
} else if (cell.getRowIndex() < headerRowIndex) {
|
||||||
|
// Info rows (0 to headerRowIndex-1) - Excluding 0 handled above?
|
||||||
|
// Actually handle 0 separately or here. 0 is handled above.
|
||||||
|
if (cell.getRowIndex() == 0) return;
|
||||||
|
|
||||||
|
// Check for Red Font Conditions
|
||||||
|
boolean isRed = false;
|
||||||
|
if (cell.getRowIndex() == 2 && (cell.getColumnIndex() == 3 || cell.getColumnIndex() == 6)) {
|
||||||
|
isRed = true;
|
||||||
|
} else if (cell.getRowIndex() == 3 && (cell.getColumnIndex() == 6 || cell.getColumnIndex() == 3)) {
|
||||||
|
isRed = true;
|
||||||
|
} else if (cell.getRowIndex() == 4 && cell.getColumnIndex() == 6) {
|
||||||
|
isRed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isRed) {
|
||||||
|
if (redInfoStyle == null) {
|
||||||
|
org.apache.poi.ss.usermodel.Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
|
||||||
|
redInfoStyle = workbook.createCellStyle();
|
||||||
|
redInfoStyle.setFillForegroundColor(org.apache.poi.ss.usermodel.IndexedColors.WHITE.getIndex());
|
||||||
|
redInfoStyle.setFillPattern(org.apache.poi.ss.usermodel.FillPatternType.SOLID_FOREGROUND);
|
||||||
|
redInfoStyle.setWrapText(false);
|
||||||
|
redInfoStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
||||||
|
org.apache.poi.ss.usermodel.Font font = workbook.createFont();
|
||||||
|
font.setColor(org.apache.poi.ss.usermodel.IndexedColors.RED.getIndex());
|
||||||
|
redInfoStyle.setFont(font);
|
||||||
|
}
|
||||||
|
cell.setCellStyle(redInfoStyle);
|
||||||
|
} else {
|
||||||
|
if (infoStyle == null) {
|
||||||
|
org.apache.poi.ss.usermodel.Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
|
||||||
|
infoStyle = workbook.createCellStyle();
|
||||||
|
infoStyle.setFillForegroundColor(org.apache.poi.ss.usermodel.IndexedColors.WHITE.getIndex());
|
||||||
|
infoStyle.setFillPattern(org.apache.poi.ss.usermodel.FillPatternType.SOLID_FOREGROUND);
|
||||||
|
infoStyle.setWrapText(false);
|
||||||
|
infoStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
||||||
|
}
|
||||||
|
cell.setCellStyle(infoStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (coloredRowIndices.contains(cell.getRowIndex())) {
|
||||||
|
if (cell.getRowIndex() > headerRowIndex) {
|
||||||
|
if (coloredLeftStyle == null) {
|
||||||
|
org.apache.poi.ss.usermodel.Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
|
||||||
|
coloredLeftStyle = workbook.createCellStyle();
|
||||||
|
coloredLeftStyle.setFillForegroundColor(org.apache.poi.ss.usermodel.IndexedColors.GREY_25_PERCENT.getIndex());
|
||||||
|
coloredLeftStyle.setFillPattern(org.apache.poi.ss.usermodel.FillPatternType.SOLID_FOREGROUND);
|
||||||
|
coloredLeftStyle.setWrapText(true);
|
||||||
|
coloredLeftStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
||||||
|
coloredLeftStyle.setAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.LEFT);
|
||||||
|
org.apache.poi.ss.usermodel.Font font = workbook.createFont();
|
||||||
|
font.setBold(true);
|
||||||
|
coloredLeftStyle.setFont(font);
|
||||||
|
}
|
||||||
|
cell.setCellStyle(coloredLeftStyle);
|
||||||
|
} else {
|
||||||
|
if (coloredStyle == null) {
|
||||||
|
org.apache.poi.ss.usermodel.Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
|
||||||
|
coloredStyle = workbook.createCellStyle();
|
||||||
|
coloredStyle.setFillForegroundColor(org.apache.poi.ss.usermodel.IndexedColors.GREY_25_PERCENT.getIndex());
|
||||||
|
coloredStyle.setFillPattern(org.apache.poi.ss.usermodel.FillPatternType.SOLID_FOREGROUND);
|
||||||
|
coloredStyle.setWrapText(true);
|
||||||
|
coloredStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
||||||
|
org.apache.poi.ss.usermodel.Font font = workbook.createFont();
|
||||||
|
font.setBold(true);
|
||||||
|
coloredStyle.setFont(font);
|
||||||
|
}
|
||||||
|
cell.setCellStyle(coloredStyle);
|
||||||
|
}
|
||||||
|
} else if (aquaRowIndices.contains(cell.getRowIndex())) {
|
||||||
|
if (aquaStyle == null) {
|
||||||
|
org.apache.poi.ss.usermodel.Workbook workbook = writeSheetHolder.getSheet().getWorkbook();
|
||||||
|
aquaStyle = workbook.createCellStyle();
|
||||||
|
aquaStyle.setFillForegroundColor(org.apache.poi.ss.usermodel.IndexedColors.AQUA.getIndex());
|
||||||
|
aquaStyle.setFillPattern(org.apache.poi.ss.usermodel.FillPatternType.SOLID_FOREGROUND);
|
||||||
|
aquaStyle.setWrapText(true);
|
||||||
|
aquaStyle.setAlignment(org.apache.poi.ss.usermodel.HorizontalAlignment.LEFT);
|
||||||
|
}
|
||||||
|
cell.setCellStyle(aquaStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.sheet("报价单")
|
||||||
|
.doWrite(rows);
|
||||||
|
|
||||||
|
return fileName;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("导出报价单失败", e);
|
||||||
|
throw new ServiceException("导出报价单失败,请稍后重试");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bind(Integer quotationId) {
|
||||||
|
Quotation quotation = new Quotation();
|
||||||
|
quotation.setId(quotationId);
|
||||||
|
quotation.setQuotationStatus(Quotation.QuotationStatusEnum.BIND.getCode());
|
||||||
|
quotationMapper.update(quotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void unBind(Integer quotationId) {
|
||||||
|
Quotation quotation = new Quotation();
|
||||||
|
quotation.setId(quotationId);
|
||||||
|
quotation.setQuotationStatus(Quotation.QuotationStatusEnum.NOT_BIND.getCode());
|
||||||
|
quotationMapper.update(quotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addSection(List<List<Object>> rows, String title, String subTitle,List<QuotationProductInfo> list, Set<Integer> coloredRowIndices, Set<Integer> aquaRowIndices, AtomicInteger sectionCounter) {
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 记录标题行索引 (Aqua)
|
||||||
|
aquaRowIndices.add(rows.size());
|
||||||
|
int currentSection = sectionCounter.getAndIncrement();
|
||||||
|
|
||||||
|
// 添加标题行 (补齐12列)
|
||||||
|
List<Object> titleRow = new ArrayList<>();
|
||||||
|
titleRow.add(currentSection);
|
||||||
|
titleRow.add(title);
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
titleRow.add("");
|
||||||
|
}
|
||||||
|
rows.add(titleRow);
|
||||||
|
|
||||||
|
// 添加标题行 (补齐12列)
|
||||||
|
List<Object> subTitleRow = new ArrayList<>();
|
||||||
|
subTitleRow.add(currentSection+"_"+currentSection);
|
||||||
|
subTitleRow.add(subTitle);
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
subTitleRow.add("");
|
||||||
|
}
|
||||||
|
rows.add(subTitleRow);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
double sumAllPrice = 0.0;
|
||||||
|
double sumCatalogueAllPrice = 0.0;
|
||||||
|
|
||||||
|
// 添加数据行
|
||||||
|
int index = 1;
|
||||||
|
for (QuotationProductInfo item : list) {
|
||||||
|
List<Object> row = new ArrayList<>();
|
||||||
|
row.add("");
|
||||||
|
row.add(item.getProductBomCode());
|
||||||
|
row.add(item.getModel());
|
||||||
|
row.add(item.getProductDesc());
|
||||||
|
row.add(item.getQuantity());
|
||||||
|
row.add(item.getCataloguePrice());
|
||||||
|
row.add(item.getGuidanceDiscount());
|
||||||
|
row.add(item.getPrice());
|
||||||
|
row.add(item.getAllPrice());
|
||||||
|
row.add(item.getCatalogueAllPrice());
|
||||||
|
row.add(""); // CID信息
|
||||||
|
row.add(item.getRemark());
|
||||||
|
rows.add(row);
|
||||||
|
|
||||||
|
if (item.getAllPrice() != null) {
|
||||||
|
sumAllPrice += item.getAllPrice();
|
||||||
|
}
|
||||||
|
if (item.getCatalogueAllPrice() != null) {
|
||||||
|
sumCatalogueAllPrice += item.getCatalogueAllPrice();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加合计行1
|
||||||
|
coloredRowIndices.add(rows.size());
|
||||||
|
List<Object> subTotalRow1 = new ArrayList<>();
|
||||||
|
subTotalRow1.add("");
|
||||||
|
subTotalRow1.add(subTitle);
|
||||||
|
subTotalRow1.add("");
|
||||||
|
subTotalRow1.add("");
|
||||||
|
subTotalRow1.add("");
|
||||||
|
subTotalRow1.add("");
|
||||||
|
subTotalRow1.add("");
|
||||||
|
subTotalRow1.add("");
|
||||||
|
subTotalRow1.add(sumAllPrice);
|
||||||
|
subTotalRow1.add(sumCatalogueAllPrice);
|
||||||
|
subTotalRow1.add("");
|
||||||
|
subTotalRow1.add("");
|
||||||
|
rows.add(subTotalRow1);
|
||||||
|
|
||||||
|
// 添加合计行2
|
||||||
|
coloredRowIndices.add(rows.size());
|
||||||
|
List<Object> subTotalRow2 = new ArrayList<>();
|
||||||
|
subTotalRow2.add("");
|
||||||
|
subTotalRow2.add("配置组小计");
|
||||||
|
subTotalRow2.add("");
|
||||||
|
subTotalRow2.add("");
|
||||||
|
subTotalRow2.add("");
|
||||||
|
subTotalRow2.add("");
|
||||||
|
subTotalRow2.add("");
|
||||||
|
subTotalRow2.add("");
|
||||||
|
subTotalRow2.add(sumAllPrice);
|
||||||
|
subTotalRow2.add(sumCatalogueAllPrice);
|
||||||
|
subTotalRow2.add("");
|
||||||
|
subTotalRow2.add("");
|
||||||
|
rows.add(subTotalRow2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 自定义列宽策略:自适应但有最大宽度
|
||||||
|
public static class CustomColumnWidthStrategy extends AbstractColumnWidthStyleStrategy {
|
||||||
|
private static final int MAX_COLUMN_WIDTH = 50;
|
||||||
|
private final int headerRowIndex;
|
||||||
|
|
||||||
|
public CustomColumnWidthStrategy(int headerRowIndex) {
|
||||||
|
this.headerRowIndex = headerRowIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<CellData> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
||||||
|
// 1-6行不参与列宽计算 (小于标题行的行)
|
||||||
|
if (cell.getRowIndex() < headerRowIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isHead != null && isHead) {
|
||||||
|
// 如果是表头,不需特别处理,EasyExcel会自动处理,或者这里也可以计算
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cellDataList != null && !cellDataList.isEmpty()) {
|
||||||
|
CellData cellData = cellDataList.get(0);
|
||||||
|
if (cellData.getType() == com.alibaba.excel.enums.CellDataTypeEnum.STRING) {
|
||||||
|
String stringValue = cellData.getStringValue();
|
||||||
|
if (StrUtil.isNotEmpty(stringValue)) {
|
||||||
|
int length = stringValue.getBytes().length;
|
||||||
|
int width = Math.min(length + 2, MAX_COLUMN_WIDTH);
|
||||||
|
// 当前列宽
|
||||||
|
int currentColumnWidth = writeSheetHolder.getSheet().getColumnWidth(cell.getColumnIndex()) / 256;
|
||||||
|
if (width > currentColumnWidth) {
|
||||||
|
writeSheetHolder.getSheet().setColumnWidth(cell.getColumnIndex(), width * 256);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,284 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.sip.mapper.QuotationMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.sip.domain.Quotation" id="QuotationMap">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="quotationCode" column="quotation_code"/>
|
||||||
|
<result property="quotationName" column="quotation_name"/>
|
||||||
|
<result property="quotationAmount" column="quotation_amount"/>
|
||||||
|
<result property="discountAmount" column="discount_amount"/>
|
||||||
|
<result property="quotationStatus" column="quotation_status"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="agentCode" column="agent_code"/>
|
||||||
|
<result property="amountType" column="amount_type"/>
|
||||||
|
<result property="customerName" column="customer_name"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 基本字段 -->
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id
|
||||||
|
, quotation_code, quotation_name, quotation_amount, discount_amount, quotation_status, create_time, create_by, update_by, update_time, remark, agent_code, amount_type, customer_name
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!--通过实体作为筛选条件查询-->
|
||||||
|
<select id="queryAll" resultMap="QuotationMap">
|
||||||
|
select
|
||||||
|
t1.id, t1.quotation_code, t1.quotation_name, t1.quotation_amount, t1.discount_amount,
|
||||||
|
t1.quotation_status, t1.create_time, t1.create_by, t1.update_by, t1.update_time, t1.remark,
|
||||||
|
t1.agent_code, t1.amount_type, t1.customer_name
|
||||||
|
from oms_quotation t1
|
||||||
|
LEFT join sys_user u on t1.create_by = u.user_id
|
||||||
|
<where>
|
||||||
|
<if test="id != null">
|
||||||
|
and t1.id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="quotationCode != null and quotationCode != ''">
|
||||||
|
and t1.quotation_code = #{quotationCode}
|
||||||
|
</if>
|
||||||
|
<if test="quotationName != null and quotationName != ''">
|
||||||
|
and t1.quotation_name = #{quotationName}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="quotationAmount != null">
|
||||||
|
and t1.quotation_amount = #{quotationAmount}
|
||||||
|
</if>
|
||||||
|
<if test="discountAmount != null">
|
||||||
|
and t1.discount_amount = #{discountAmount}
|
||||||
|
</if>
|
||||||
|
<if test="quotationStatus != null and quotationStatus != ''">
|
||||||
|
and t1.quotation_status = #{quotationStatus}
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
and t1.create_time = #{createTime}
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
and t1.create_by = #{createBy}
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
and t1.update_by = #{updateBy}
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
and t1.update_time = #{updateTime}
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
and t1.remark = #{remark}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="agentCode != null and agentCode != ''">
|
||||||
|
and t1.agent_code = #{agentCode}
|
||||||
|
</if>
|
||||||
|
<if test="amountType != null and amountType != ''">
|
||||||
|
and t1.amount_type = #{amountType}
|
||||||
|
</if>
|
||||||
|
<if test="customerName != null and customerName != ''">
|
||||||
|
and t1.customer_name = #{customerName}
|
||||||
|
</if>
|
||||||
|
<if test="customerName != null and customerName != ''">
|
||||||
|
and t1.customer_name = #{customerName}
|
||||||
|
</if>
|
||||||
|
<if test="createTimeStart != null or createTimeEnd != null">
|
||||||
|
<choose>
|
||||||
|
<when test="createTimeStart != null and createTimeEnd != null">
|
||||||
|
and t1.create_time between date_format(#{createTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{createTimeEnd}, '%Y-%m-%d 23:59:59')
|
||||||
|
</when>
|
||||||
|
<when test="createTimeStart != null">
|
||||||
|
and t1.create_time <![CDATA[ >= ]]> date_format(#{createTimeStart}, '%Y-%m-%d 00:00:00')
|
||||||
|
</when>
|
||||||
|
<when test="createTimeEnd != null">
|
||||||
|
and t1.create_time <![CDATA[ <= ]]> date_format(#{createTimeEnd}, '%Y-%m-%d 23:59:59')
|
||||||
|
</when>
|
||||||
|
|
||||||
|
</choose>
|
||||||
|
</if>
|
||||||
|
${params.dataScope}
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!--根据ID查详情-->
|
||||||
|
<select id="queryById" parameterType="Integer" resultMap="QuotationMap">
|
||||||
|
SELECT id,
|
||||||
|
quotation_code,
|
||||||
|
quotation_name,
|
||||||
|
|
||||||
|
quotation_amount,
|
||||||
|
discount_amount,
|
||||||
|
quotation_status,
|
||||||
|
create_time,
|
||||||
|
create_by,
|
||||||
|
update_by,
|
||||||
|
update_time,
|
||||||
|
remark,
|
||||||
|
|
||||||
|
agent_code,
|
||||||
|
amount_type,
|
||||||
|
customer_name
|
||||||
|
FROM oms_quotation
|
||||||
|
WHERE id = #{id} LIMIT 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!--新增所有列-->
|
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
INSERT INTO oms_quotation
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="quotationCode != null and quotationCode != ''">
|
||||||
|
quotation_code,
|
||||||
|
</if>
|
||||||
|
<if test="quotationName != null and quotationName != ''">
|
||||||
|
quotation_name,
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="quotationAmount != null">
|
||||||
|
quotation_amount,
|
||||||
|
</if>
|
||||||
|
<if test="discountAmount != null">
|
||||||
|
discount_amount,
|
||||||
|
</if>
|
||||||
|
<if test="quotationStatus != null and quotationStatus != ''">
|
||||||
|
quotation_status,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
create_by,
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
update_by,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
remark,
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="agentCode != null and agentCode != ''">
|
||||||
|
agent_code,
|
||||||
|
</if>
|
||||||
|
<if test="amountType != null and amountType != ''">
|
||||||
|
amount_type,
|
||||||
|
</if>
|
||||||
|
<if test="customerName != null and customerName != ''">
|
||||||
|
customer_name,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="quotationCode != null and quotationCode != ''">
|
||||||
|
#{quotationCode},
|
||||||
|
</if>
|
||||||
|
<if test="quotationName != null and quotationName != ''">
|
||||||
|
#{quotationName},
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="quotationAmount != null">
|
||||||
|
#{quotationAmount},
|
||||||
|
</if>
|
||||||
|
<if test="discountAmount != null">
|
||||||
|
#{discountAmount},
|
||||||
|
</if>
|
||||||
|
<if test="quotationStatus != null and quotationStatus != ''">
|
||||||
|
#{quotationStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
#{updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
#{remark},
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="agentCode != null and agentCode != ''">
|
||||||
|
#{agentCode},
|
||||||
|
</if>
|
||||||
|
<if test="amountType != null and amountType != ''">
|
||||||
|
#{amountType},
|
||||||
|
</if>
|
||||||
|
<if test="customerName != null and customerName != ''">
|
||||||
|
#{customerName},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
UPDATE oms_quotation
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="quotationCode != null and quotationCode != ''">
|
||||||
|
quotation_code = #{quotationCode},
|
||||||
|
</if>
|
||||||
|
<if test="quotationName != null and quotationName != ''">
|
||||||
|
quotation_name = #{quotationName},
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="quotationAmount != null">
|
||||||
|
quotation_amount = #{quotationAmount},
|
||||||
|
</if>
|
||||||
|
<if test="discountAmount != null">
|
||||||
|
discount_amount = #{discountAmount},
|
||||||
|
</if>
|
||||||
|
<if test="quotationStatus != null and quotationStatus != ''">
|
||||||
|
quotation_status = #{quotationStatus},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
create_by = #{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
update_by = #{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time = #{updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
remark = #{remark},
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="agentCode != null and agentCode != ''">
|
||||||
|
agent_code = #{agentCode},
|
||||||
|
</if>
|
||||||
|
<if test="amountType != null and amountType != ''">
|
||||||
|
amount_type = #{amountType},
|
||||||
|
</if>
|
||||||
|
<if test="customerName != null and customerName != ''">
|
||||||
|
customer_name = #{customerName},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
DELETE
|
||||||
|
FROM oms_quotation
|
||||||
|
WHERE id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!--通过id批量删除-->
|
||||||
|
<delete id="batchRemove">
|
||||||
|
delete from oms_quotation where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,339 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.sip.mapper.QuotationProductInfoMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.sip.domain.QuotationProductInfo" id="QuotationProductInfoMap">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="productBomCode" column="product_bom_code"/>
|
||||||
|
<result property="model" column="model"/>
|
||||||
|
<result property="productCode" column="product_code"/>
|
||||||
|
<result property="productDesc" column="product_desc"/>
|
||||||
|
<result property="quantity" column="quantity"/>
|
||||||
|
<result property="cataloguePrice" column="catalogue_price"/>
|
||||||
|
<result property="catalogueAllPrice" column="catalogue_all_price"/>
|
||||||
|
<result property="price" column="price"/>
|
||||||
|
<result property="allPrice" column="all_price"/>
|
||||||
|
<result property="guidanceDiscount" column="guidance_discount"/>
|
||||||
|
<result property="discount" column="discount"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="taxRate" column="tax_rate"/>
|
||||||
|
<result property="quotationId" column="quotation_id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 基本字段 -->
|
||||||
|
<sql id="base_query">
|
||||||
|
SELECT t1.id,
|
||||||
|
t1.product_bom_code,
|
||||||
|
t1.model,
|
||||||
|
t1.product_code,
|
||||||
|
t1.product_desc,
|
||||||
|
t1.quantity,
|
||||||
|
t1.catalogue_price,
|
||||||
|
t1.catalogue_all_price,
|
||||||
|
t1.price,
|
||||||
|
t1.all_price,
|
||||||
|
t1.guidance_discount,
|
||||||
|
t1.discount,
|
||||||
|
t1.remark,
|
||||||
|
t1.tax_rate,
|
||||||
|
t1.quotation_id,
|
||||||
|
t2.type
|
||||||
|
FROM oms_quotation_product_info t1
|
||||||
|
left join product_info t2 on t1.product_bom_code=t2.product_code
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<!--通过实体作为筛选条件查询-->
|
||||||
|
<select id="queryAll" resultMap="QuotationProductInfoMap">
|
||||||
|
<include refid="base_query"/>
|
||||||
|
<where>
|
||||||
|
<if test="id != null">
|
||||||
|
and t1.id = #{id}
|
||||||
|
</if>
|
||||||
|
<if test="productBomCode != null and productBomCode != ''">
|
||||||
|
and t1.product_bom_code = #{productBomCode}
|
||||||
|
</if>
|
||||||
|
<if test="model != null and model != ''">
|
||||||
|
and t1.model = #{model}
|
||||||
|
</if>
|
||||||
|
<if test="productCode != null and productCode != ''">
|
||||||
|
and t1.product_code = #{productCode}
|
||||||
|
</if>
|
||||||
|
<if test="productDesc != null and productDesc != ''">
|
||||||
|
and t1.product_desc = #{productDesc}
|
||||||
|
</if>
|
||||||
|
<if test="quantity != null">
|
||||||
|
and t1.quantity = #{quantity}
|
||||||
|
</if>
|
||||||
|
<if test="cataloguePrice != null">
|
||||||
|
and t1.catalogue_price = #{cataloguePrice}
|
||||||
|
</if>
|
||||||
|
<if test="catalogueAllPrice != null">
|
||||||
|
and t1.catalogue_all_price = #{catalogueAllPrice}
|
||||||
|
</if>
|
||||||
|
<if test="price != null">
|
||||||
|
and t1.price = #{price}
|
||||||
|
</if>
|
||||||
|
<if test="allPrice != null">
|
||||||
|
and t1.all_price = #{allPrice}
|
||||||
|
</if>
|
||||||
|
<if test="guidanceDiscount != null">
|
||||||
|
and t1.guidance_discount = #{guidanceDiscount}
|
||||||
|
</if>
|
||||||
|
<if test="discount != null">
|
||||||
|
and t1.discount = #{discount}
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
and t1.remark = #{remark}
|
||||||
|
</if>
|
||||||
|
<if test="taxRate != null">
|
||||||
|
and t1.tax_rate = #{taxRate}
|
||||||
|
</if>
|
||||||
|
<if test="quotationId != null">
|
||||||
|
and t1.quotation_id = #{quotationId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!--根据ID查详情-->
|
||||||
|
<select id="queryById" parameterType="Integer" resultMap="QuotationProductInfoMap">
|
||||||
|
<include refid="base_query"/>
|
||||||
|
WHERE t1.id = #{id} LIMIT 1
|
||||||
|
</select>
|
||||||
|
<select id="listByQuotationId" resultType="com.ruoyi.sip.domain.QuotationProductInfo">
|
||||||
|
<include refid="base_query"/>
|
||||||
|
WHERE t1.quotation_id in
|
||||||
|
<foreach item="item" index="index" open="(" close=")" collection="list" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<!--新增所有列-->
|
||||||
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||||
|
INSERT INTO oms_quotation_product_info
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="productBomCode != null and productBomCode != ''">
|
||||||
|
product_bom_code,
|
||||||
|
</if>
|
||||||
|
<if test="model != null and model != ''">
|
||||||
|
model,
|
||||||
|
</if>
|
||||||
|
<if test="productCode != null and productCode != ''">
|
||||||
|
product_code,
|
||||||
|
</if>
|
||||||
|
<if test="productDesc != null and productDesc != ''">
|
||||||
|
product_desc,
|
||||||
|
</if>
|
||||||
|
<if test="quantity != null">
|
||||||
|
quantity,
|
||||||
|
</if>
|
||||||
|
<if test="cataloguePrice != null">
|
||||||
|
catalogue_price,
|
||||||
|
</if>
|
||||||
|
<if test="catalogueAllPrice != null">
|
||||||
|
catalogue_all_price,
|
||||||
|
</if>
|
||||||
|
<if test="price != null">
|
||||||
|
price,
|
||||||
|
</if>
|
||||||
|
<if test="allPrice != null">
|
||||||
|
all_price,
|
||||||
|
</if>
|
||||||
|
<if test="guidanceDiscount != null">
|
||||||
|
guidance_discount,
|
||||||
|
</if>
|
||||||
|
<if test="discount != null">
|
||||||
|
discount,
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
remark,
|
||||||
|
</if>
|
||||||
|
<if test="taxRate != null">
|
||||||
|
tax_rate,
|
||||||
|
</if>
|
||||||
|
<if test="quotationId != null">
|
||||||
|
quotation_id,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="productBomCode != null and productBomCode != ''">
|
||||||
|
#{productBomCode},
|
||||||
|
</if>
|
||||||
|
<if test="model != null and model != ''">
|
||||||
|
#{model},
|
||||||
|
</if>
|
||||||
|
<if test="productCode != null and productCode != ''">
|
||||||
|
#{productCode},
|
||||||
|
</if>
|
||||||
|
<if test="productDesc != null and productDesc != ''">
|
||||||
|
#{productDesc},
|
||||||
|
</if>
|
||||||
|
<if test="quantity != null">
|
||||||
|
#{quantity},
|
||||||
|
</if>
|
||||||
|
<if test="cataloguePrice != null">
|
||||||
|
#{cataloguePrice},
|
||||||
|
</if>
|
||||||
|
<if test="catalogueAllPrice != null">
|
||||||
|
#{catalogueAllPrice},
|
||||||
|
</if>
|
||||||
|
<if test="price != null">
|
||||||
|
#{price},
|
||||||
|
</if>
|
||||||
|
<if test="allPrice != null">
|
||||||
|
#{allPrice},
|
||||||
|
</if>
|
||||||
|
<if test="guidanceDiscount != null">
|
||||||
|
#{guidanceDiscount},
|
||||||
|
</if>
|
||||||
|
<if test="discount != null">
|
||||||
|
#{discount},
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
#{remark},
|
||||||
|
</if>
|
||||||
|
<if test="taxRate != null">
|
||||||
|
#{taxRate},
|
||||||
|
</if>
|
||||||
|
<if test="quotationId != null">
|
||||||
|
#{quotationId},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<insert id="insertBatch">
|
||||||
|
INSERT INTO oms_quotation_product_info(product_bom_code, model, product_code, product_desc,
|
||||||
|
quantity, catalogue_price, catalogue_all_price, price,
|
||||||
|
all_price, guidance_discount, discount, remark, tax_rate, quotation_id)
|
||||||
|
|
||||||
|
VALUES
|
||||||
|
<foreach item="item" index="index" collection="list" separator=",">
|
||||||
|
(
|
||||||
|
#{item.productBomCode}, #{item.model}, #{item.productCode},#{item.productDesc},
|
||||||
|
#{item.quantity},#{item.cataloguePrice},#{item.catalogueAllPrice},#{item.price},
|
||||||
|
#{item.allPrice},#{item.guidanceDiscount},#{item.discount},#{item.remark},#{item.taxRate},#{item.quotationId}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<!--通过主键修改数据-->
|
||||||
|
<update id="update">
|
||||||
|
UPDATE oms_quotation_product_info
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="productBomCode != null and productBomCode != ''">
|
||||||
|
product_bom_code = #{productBomCode},
|
||||||
|
</if>
|
||||||
|
<if test="model != null and model != ''">
|
||||||
|
model = #{model},
|
||||||
|
</if>
|
||||||
|
<if test="productCode != null and productCode != ''">
|
||||||
|
product_code = #{productCode},
|
||||||
|
</if>
|
||||||
|
<if test="productDesc != null and productDesc != ''">
|
||||||
|
product_desc = #{productDesc},
|
||||||
|
</if>
|
||||||
|
<if test="quantity != null">
|
||||||
|
quantity = #{quantity},
|
||||||
|
</if>
|
||||||
|
<if test="cataloguePrice != null">
|
||||||
|
catalogue_price = #{cataloguePrice},
|
||||||
|
</if>
|
||||||
|
<if test="catalogueAllPrice != null">
|
||||||
|
catalogue_all_price = #{catalogueAllPrice},
|
||||||
|
</if>
|
||||||
|
<if test="price != null">
|
||||||
|
price = #{price},
|
||||||
|
</if>
|
||||||
|
<if test="allPrice != null">
|
||||||
|
all_price = #{allPrice},
|
||||||
|
</if>
|
||||||
|
<if test="guidanceDiscount != null">
|
||||||
|
guidance_discount = #{guidanceDiscount},
|
||||||
|
</if>
|
||||||
|
<if test="discount != null">
|
||||||
|
discount = #{discount},
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
remark = #{remark},
|
||||||
|
</if>
|
||||||
|
<if test="taxRate != null">
|
||||||
|
tax_rate = #{taxRate},
|
||||||
|
</if>
|
||||||
|
<if test="quotationId != null">
|
||||||
|
quotation_id = #{quotationId},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
<update id="updateBatch">
|
||||||
|
<foreach collection="list" item="item" separator=";">
|
||||||
|
UPDATE oms_quotation_product_info
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="item.productBomCode != null and item.productBomCode != ''">
|
||||||
|
product_bom_code = #{item.productBomCode},
|
||||||
|
</if>
|
||||||
|
<if test="item.model != null and item.model != ''">
|
||||||
|
model = #{item.model},
|
||||||
|
</if>
|
||||||
|
<if test="item.productCode != null and item.productCode != ''">
|
||||||
|
product_code = #{item.productCode},
|
||||||
|
</if>
|
||||||
|
<if test="item.productDesc != null and item.productDesc != ''">
|
||||||
|
product_desc = #{item.productDesc},
|
||||||
|
</if>
|
||||||
|
<if test="item.quantity != null">
|
||||||
|
quantity = #{item.quantity},
|
||||||
|
</if>
|
||||||
|
<if test="item.cataloguePrice != null">
|
||||||
|
catalogue_price = #{item.cataloguePrice},
|
||||||
|
</if>
|
||||||
|
<if test="item.catalogueAllPrice != null">
|
||||||
|
catalogue_all_price = #{item.catalogueAllPrice},
|
||||||
|
</if>
|
||||||
|
<if test="item.price != null">
|
||||||
|
price = #{item.price},
|
||||||
|
</if>
|
||||||
|
<if test="item.allPrice != null">
|
||||||
|
all_price = #{item.allPrice},
|
||||||
|
</if>
|
||||||
|
<if test="item.guidanceDiscount != null">
|
||||||
|
guidance_discount = #{item.guidanceDiscount},
|
||||||
|
</if>
|
||||||
|
<if test="item.discount != null">
|
||||||
|
discount = #{item.discount},
|
||||||
|
</if>
|
||||||
|
<if test="item.remark != null and item.remark != ''">
|
||||||
|
remark = #{item.remark},
|
||||||
|
</if>
|
||||||
|
<if test="item.taxRate != null">
|
||||||
|
tax_rate = #{item.taxRate},
|
||||||
|
</if>
|
||||||
|
<if test="item.quotationId != null">
|
||||||
|
quotation_id = #{item.quotationId},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
WHERE id = #{item.id}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!--通过主键删除-->
|
||||||
|
<delete id="deleteById">
|
||||||
|
DELETE
|
||||||
|
FROM oms_quotation_product_info
|
||||||
|
WHERE id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!--通过id批量删除-->
|
||||||
|
<delete id="batchRemove">
|
||||||
|
delete from oms_quotation_product_info where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -45,7 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<sql id="selectProjectInfoVo">
|
<sql id="selectProjectInfoVo">
|
||||||
select id, project_code, project_name,bg_property, customer_code, customer_name, industry_type, agent_code, project_stage, project_grasp_degree, hz_support_user, operate_institution
|
select id, project_code, project_name,bg_property, customer_code, customer_name, industry_type, agent_code, project_stage, project_grasp_degree, hz_support_user, operate_institution
|
||||||
, partner_code, partner_name, contact_way, estimated_amount, currency_type, estimated_order_time, estimated_deliver_time, competitor, country_product, server_configuration,file_id
|
, partner_code, partner_name, contact_way, estimated_amount, currency_type, estimated_order_time, estimated_deliver_time, competitor, country_product, server_configuration,file_id
|
||||||
, key_problem, project_desc, create_by, create_time, update_by, update_time,customer_user_name,customer_phone,partner_email,partner_user_name,h3c_person,h3c_phone,poc,joint_trial,software_info,hardware_info,terminal_peripheral,management_version,desktop_vm_os_version,vm_spec_quantity,joint_trial_result from project_info t1
|
, key_problem, project_desc, create_by, create_time, update_by, update_time,customer_user_name,customer_phone,partner_email,partner_user_name,h3c_person,h3c_phone,poc,joint_trial,software_info,hardware_info,terminal_peripheral,management_version,desktop_vm_os_version,vm_spec_quantity,joint_trial_result,quotation_id from project_info t1
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="selectRelationProjectInfoVo">
|
<sql id="selectRelationProjectInfoVo">
|
||||||
select t1.id,
|
select t1.id,
|
||||||
|
|
@ -85,11 +85,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
t1.vm_spec_quantity,
|
t1.vm_spec_quantity,
|
||||||
t1.joint_trial_result,
|
t1.joint_trial_result,
|
||||||
t1.file_id,
|
t1.file_id,
|
||||||
|
t1.quotation_id,
|
||||||
t1.customer_user_name,t1.customer_phone,t1.partner_user_name,t1.h3c_person,t1.poc,t1.h3c_phone,
|
t1.customer_user_name,t1.customer_phone,t1.partner_user_name,t1.h3c_person,t1.poc,t1.h3c_phone,
|
||||||
t2.agent_name,t2.contact_email,t2.contact_phone,t2.contact_person,
|
t2.agent_name,t2.contact_email,t2.contact_phone,t2.contact_person,
|
||||||
t3.user_name as hz_support_user_name,
|
t3.user_name as hz_support_user_name,
|
||||||
t5.level,
|
t5.level,
|
||||||
t5.contact_email as partner_email,
|
t5.contact_email as partner_email,
|
||||||
|
t6.system_user_id as partner_system_user_id,
|
||||||
t1.update_time ,
|
t1.update_time ,
|
||||||
ifnull(t4.work_time,t1.update_time) as last_work_update_time
|
ifnull(t4.work_time,t1.update_time) as last_work_update_time
|
||||||
from project_info t1
|
from project_info t1
|
||||||
|
|
@ -97,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join sys_user t3 on t1.hz_support_user=t3.user_id
|
left join sys_user t3 on t1.hz_support_user=t3.user_id
|
||||||
left join partner_info t5 on t1.partner_code=t5.partner_code
|
left join partner_info t5 on t1.partner_code=t5.partner_code
|
||||||
left join (select max(work_time) work_time,project_id from project_work_progress group by project_id) t4 ON t1.id=t4.project_id
|
left join (select max(work_time) work_time,project_id from project_work_progress group by project_id) t4 ON t1.id=t4.project_id
|
||||||
|
left join partner_info t6 on t1.partner_code=t6.partner_code
|
||||||
|
|
||||||
|
|
||||||
</sql>
|
</sql>
|
||||||
|
|
@ -113,6 +116,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="agentName != null and agentName != ''"> and t2.agent_name like concat('%', #{agentName}, '%')</if>
|
<if test="agentName != null and agentName != ''"> and t2.agent_name like concat('%', #{agentName}, '%')</if>
|
||||||
<if test="customerName != null and customerName != ''"> and t1.customer_name like concat('%', #{customerName}, '%')</if>
|
<if test="customerName != null and customerName != ''"> and t1.customer_name like concat('%', #{customerName}, '%')</if>
|
||||||
<if test="industryType != null and industryType != ''"> and t1.industry_type = #{industryType}</if>
|
<if test="industryType != null and industryType != ''"> and t1.industry_type = #{industryType}</if>
|
||||||
|
<if test="quotationId != null and quotationId != ''"> and t1.quotation_id = #{quotationId}</if>
|
||||||
|
<if test="quotationIdList != null and quotationIdList.size>0">
|
||||||
|
and t1.quotation_id in
|
||||||
|
<foreach collection="quotationIdList" item="item" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach></if>
|
||||||
<if test="industryTypeList != null and industryTypeList.size>0"> and t1.industry_type in
|
<if test="industryTypeList != null and industryTypeList.size>0"> and t1.industry_type in
|
||||||
<foreach collection="industryTypeList" item="item" separator="," open="(" close=")">
|
<foreach collection="industryTypeList" item="item" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
|
|
@ -286,6 +295,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="desktopVmOsVersion != null">desktop_vm_os_version,</if>
|
<if test="desktopVmOsVersion != null">desktop_vm_os_version,</if>
|
||||||
<if test="vmSpecQuantity != null">vm_spec_quantity,</if>
|
<if test="vmSpecQuantity != null">vm_spec_quantity,</if>
|
||||||
<if test="jointTrialResult != null">joint_trial_result,</if>
|
<if test="jointTrialResult != null">joint_trial_result,</if>
|
||||||
|
<if test="quotationId != null">quotation_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="projectCode != null">#{projectCode},</if>
|
<if test="projectCode != null">#{projectCode},</if>
|
||||||
|
|
@ -330,6 +340,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="desktopVmOsVersion != null">#{desktopVmOsVersion},</if>
|
<if test="desktopVmOsVersion != null">#{desktopVmOsVersion},</if>
|
||||||
<if test="vmSpecQuantity != null">#{vmSpecQuantity},</if>
|
<if test="vmSpecQuantity != null">#{vmSpecQuantity},</if>
|
||||||
<if test="jointTrialResult != null">#{jointTrialResult},</if>
|
<if test="jointTrialResult != null">#{jointTrialResult},</if>
|
||||||
|
<if test="quotationId != null">#{quotationId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<update id="updateCustomerCodeByCode">
|
<update id="updateCustomerCodeByCode">
|
||||||
|
|
@ -380,6 +391,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="desktopVmOsVersion != null">desktop_vm_os_version = #{desktopVmOsVersion},</if>
|
<if test="desktopVmOsVersion != null">desktop_vm_os_version = #{desktopVmOsVersion},</if>
|
||||||
<if test="vmSpecQuantity != null">vm_spec_quantity = #{vmSpecQuantity},</if>
|
<if test="vmSpecQuantity != null">vm_spec_quantity = #{vmSpecQuantity},</if>
|
||||||
<if test="jointTrialResult != null">joint_trial_result = #{jointTrialResult},</if>
|
<if test="jointTrialResult != null">joint_trial_result = #{jointTrialResult},</if>
|
||||||
|
<if test="quotationId != null">quotation_id=#{quotationId},</if>
|
||||||
partner_code = #{partnerCode},
|
partner_code = #{partnerCode},
|
||||||
file_id = #{fileId},
|
file_id = #{fileId},
|
||||||
update_by = now()
|
update_by = now()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue