This commit is contained in:
tzy 2025-09-26 14:57:47 +08:00
parent 90f8bfe677
commit c9468784b0
3 changed files with 809 additions and 291 deletions

117
public/mrp2.html Normal file
View File

@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MRP运算结果管理</title>
<style>
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background: #f5f5f5;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
border-radius: 8px;
margin-bottom: 20px;
text-align: center;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.header h1 {
margin: 0;
font-size: 24px;
}
.header p {
margin: 8px 0 0 0;
opacity: 0.9;
}
.content {
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.1);
}
.info-box {
background: #f0f9ff;
border: 1px solid #b3d8ff;
border-radius: 6px;
padding: 16px;
margin-bottom: 20px;
}
.info-box h3 {
margin: 0 0 12px 0;
color: #409eff;
}
.info-box p {
margin: 8px 0;
color: #606266;
}
.button-group {
display: flex;
gap: 12px;
margin-top: 20px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
display: inline-block;
font-size: 14px;
transition: all 0.3s;
}
.btn-primary {
background: #409eff;
color: white;
}
.btn-primary:hover {
background: #66b1ff;
}
.btn-info {
background: #909399;
color: white;
}
.btn-info:hover {
background: #a6a9ad;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>📊 MRP运算结果核算</h1>
<p>物料需求计划运算结果查询与分析</p>
</div>
<div class="content">
<div class="info-box">
<h3>🚀 快速访问</h3>
<p><strong>独立访问地址:</strong> <code>/MRP</code></p>
<p><strong>功能说明:</strong> 无需登录即可访问MRP运算结果管理页面</p>
<p><strong>主要功能:</strong></p>
<ul>
<li>生产令号选择与搜索</li>
<li>MRP运算执行</li>
<li>运算结果查看与分析</li>
<li>数据导出功能</li>
<li>统计信息展示</li>
</ul>
</div>
<div class="button-group">
<a href="/MRP" class="btn btn-primary">🎯 进入MRP页面</a>
<a href="/" class="btn btn-info">🏠 返回首页</a>
</div>
</div>
</div>
</body>
</html>

View File

@ -3,34 +3,34 @@
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="生产令号" prop="productionOrderNo">
<el-input
v-model="queryParams.productionOrderNo"
placeholder="请输入生产令号"
clearable
@keyup.enter.native="handleQuery"
v-model="queryParams.productionOrderNo"
placeholder="请输入生产令号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="项目名称" prop="productionName">
<el-input
v-model="queryParams.productionName"
placeholder="请输入项目名称"
clearable
@keyup.enter.native="handleQuery"
v-model="queryParams.productionName"
placeholder="请输入项目名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="图号" prop="drawingNo">
<el-input
v-model="queryParams.drawingNo"
placeholder="请输入图号"
clearable
@keyup.enter.native="handleQuery"
v-model="queryParams.drawingNo"
placeholder="请输入图号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="名称" prop="drawingName">
<el-input
v-model="queryParams.drawingName"
placeholder="请输入名称"
clearable
@keyup.enter.native="handleQuery"
v-model="queryParams.drawingName"
placeholder="请输入名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="创建人" prop="createdBy">
@ -49,21 +49,15 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
<el-form-item label="计划结束时间" prop="planEndTime">
<el-date-picker clearable
v-model="queryParams.planEndTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划结束时间">
</el-date-picker>
</el-form-item>
<el-form-item label="计划开始时间" prop="planStartTime">
<el-date-picker clearable
v-model="queryParams.planStartTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择计划开始时间">
</el-date-picker>
<el-form-item label="项目类型" prop="isEnterpriseStandard">
<el-select
v-model="queryParams.isEnterpriseStandard"
placeholder="请选择"
clearable>
<el-option label="非标单" :value="0"/>
<el-option label="企标单" :value="1"/>
<el-option label="变更单" :value="2"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@ -74,47 +68,47 @@
<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="['system:orderPro:add']"
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:orderPro: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="['system:orderPro:edit']"
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:orderPro:edit']"
>修改
</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="['system:orderPro:remove']"
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:orderPro:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:orderPro:export']"
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:orderPro:export']"
>导出
</el-button>
</el-col>
@ -135,41 +129,60 @@
<el-table-column label="执行单图" align="center" min-width="100">
<template slot-scope="scope">
<el-image
v-if="scope.row.drawingPath"
:src="getFullImageUrl(scope.row.drawingPath)"
style="width:80px; height:80px; object-fit:cover; border-radius:4px;"
:preview-src-list="[getFullImageUrl(scope.row.drawingPath)]"
fit="cover"
v-if="scope.row.drawingPath"
:src="getFullImageUrl(scope.row.drawingPath)"
style="width:80px; height:80px; object-fit:cover; border-radius:4px;"
:preview-src-list="[getFullImageUrl(scope.row.drawingPath)]"
fit="cover"
/>
<span v-else style="color: #909399; font-size: 12px;">暂无执行单图</span>
</template>
</el-table-column>
<el-table-column label="图纸类型" align="center" prop="drawingType">
<!-- <el-table-column label="项目类型" align="center" prop="drawingType">
<template slot-scope="scope">
<span v-if="scope.row.drawingType">
{{ getDrawingTypeLabel(scope.row.drawingType) }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="计量单位" align="center" prop="unit"/>
<!-- <el-table-column label="产品数量" align="center" prop="quantity"/>-->
<el-table-column label="是否企标" align="center" prop="isEnterpriseStandard">
</el-table-column>-->
<el-table-column label="项目状态" align="center" prop="imCategory">
<template slot-scope="scope">
<span>{{ scope.row.isEnterpriseStandard === 1 ? '是' : '否' }}</span>
<dict-tag :options="dict.type.process_status" :value="scope.row.bomStatus"/>
</template>
</el-table-column>
<el-table-column label="计量单位" align="center" prop="unit"/>
<!-- <el-table-column label="产品数量" align="center" prop="quantity"/>-->
<el-table-column label="项目类型" align="center" prop="isEnterpriseStandard">
<template v-slot="scope">
<span>
{{
scope.row.isEnterpriseStandard === 0
? '非标单'
: scope.row.isEnterpriseStandard === 1
? '企标单'
: scope.row.isEnterpriseStandard === 2
? '变更单'
: ''
}}
</span>
</template>
</el-table-column>
<el-table-column label="项目完成时间" align="center" prop="projectEndTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.projectEndTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="生产开始时间" align="center" prop="planStartTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.planStartTime, '{y}年{m}月{d}日') }}</span>
@ -180,7 +193,7 @@
<span>{{ parseTime(scope.row.planEndTime, '{y}年{m}月{d}日') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-dropdown :split-button="true" size="small" type="primary" @click="handleBOM(scope.row.productionOrderNo)"
@ -196,24 +209,23 @@
</el-dropdown>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-drawer
:title="getDrawerTitle()"
:visible.sync="drawer"
:direction="direction"
:before-close="handleClose"
:size="1500"
:title="getDrawerTitle()"
:visible.sync="drawer"
:direction="direction"
:before-close="handleClose"
:size="1500"
>
<el-divider content-position="center">
<span style="color: #67C23A; font-weight: 600; font-size: 14px;">
@ -225,13 +237,13 @@
<!-- 第一部分销齿链型号表格管理 -->
<el-button type="primary" @click="openAddChainDialog" size="mini" style="margin-bottom:10px;">新增</el-button>
<el-table
:data="chainTable"
border
stripe
size="small"
style="width: 100%; margin-bottom: 10px;"
highlight-current-row
:header-cell-style="{ fontWeight: 'bold', background: '#f5f7fa' }"
:data="chainTable"
border
stripe
size="small"
style="width: 100%; margin-bottom: 10px;"
highlight-current-row
:header-cell-style="{ fontWeight: 'bold', background: '#f5f7fa' }"
>
<el-table-column prop="figureNumber" label="产品型号" min-width="100"/>
@ -244,25 +256,25 @@
<template slot-scope="scope">
<div style="display: flex; align-items: center; gap: 8px;">
<el-upload
:action="dwgUploadUrl"
:headers="uploadHeaders"
:data="{ id: scope.row.id }"
:show-file-list="false"
:before-upload="(file) => beforeDwgUpload(file, scope.row)"
:on-success="(response, file) => handleDwgUploadSuccess(response, file, scope.row)"
:on-error="(error, file) => handleDwgUploadError(error, file, scope.row)"
accept=".dwg"
:disabled="form.isEnterpriseStandard === 1"
:action="dwgUploadUrl"
:headers="uploadHeaders"
:data="{ id: scope.row.id }"
:show-file-list="false"
:before-upload="(file) => beforeDwgUpload(file, scope.row)"
:on-success="(response, file) => handleDwgUploadSuccess(response, file, scope.row)"
:on-error="(error, file) => handleDwgUploadError(error, file, scope.row)"
accept=".dwg"
:disabled="form.isEnterpriseStandard === 1"
>
<el-button size="mini" type="primary" :disabled="form.isEnterpriseStandard === 1">
<i class="el-icon-upload2"></i> 上传
</el-button>
</el-upload>
<el-button type="text" size="mini" @click="editChain(scope.$index, scope.row)">
<i class="el-icon-edit"></i> 修改
</el-button>
<el-button type="text" size="mini" @click="removeChain(scope.$index)">
<i class="el-icon-delete"></i> 删除
</el-button>
@ -284,7 +296,8 @@
<el-button type="primary" @click="downloadPDF" style="margin-bottom: 10px; margin-left: 10px;">
下载PDF
</el-button>
<el-button type="warning" @click="downloadRoute" style="margin-bottom: 10px; margin-left: 10px;" v-hasPermi="['system:route:exportRoute']">
<el-button type="warning" @click="downloadRoute" style="margin-bottom: 10px; margin-left: 10px;"
v-hasPermi="['system:route:exportRoute']">
下载生产工艺计划表
</el-button>
<el-progress :text-inside="true" :stroke-width="26" :percentage="percentage"></el-progress>
@ -319,40 +332,40 @@
<!-- 运算结果按钮 -->
<el-button
type="primary"
size="medium"
:loading="loadingMRP"
:disabled="loadingMRP"
@click="getMRPResults()"
class="mrp-calculate-btn"
type="primary"
size="medium"
:loading="loadingMRP"
:disabled="loadingMRP"
@click="getMRPResults()"
class="mrp-calculate-btn"
>
{{ loadingMRP ? '核算中...' : '开始核算' }}
</el-button>
<!-- 搜索输入框 -->
<el-input
v-model="mrpSearchKeyword"
placeholder="搜索物料名称或编码"
style="width: 220px;"
size="small"
clearable
@input="handleMrpSearch"
@clear="clearMrpSearch"
class="mrp-search-input"
v-model="mrpSearchKeyword"
placeholder="搜索物料名称或编码"
style="width: 220px;"
size="small"
clearable
@input="handleMrpSearch"
@clear="clearMrpSearch"
class="mrp-search-input"
>
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<!-- 导出按钮 -->
<el-button
type="success"
size="small"
icon="el-icon-download"
@click="handleExportMrp"
:loading="exportLoading"
:disabled="!productionObj || !productionObj.id"
class="mrp-export-btn"
:title="productionObj && productionObj.id ? `导出${productionObj.productionOrderNo}的MRP数据` : '请先选择生产令号'"
type="success"
size="small"
icon="el-icon-download"
@click="handleExportMrp"
:loading="exportLoading"
:disabled="!productionObj || !productionObj.id"
class="mrp-export-btn"
:title="productionObj && productionObj.id ? `导出${productionObj.productionOrderNo}的MRP数据` : '请先选择生产令号'"
>
导出Excel
</el-button>
@ -364,7 +377,7 @@
</div>
<!-- 统计信息 -->
<div
style="margin-bottom: 15px; padding: 15px; background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border-radius: 8px; border-left: 4px solid #409EFF;">
style="margin-bottom: 15px; padding: 15px; background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border-radius: 8px; border-left: 4px solid #409EFF;">
<el-row :gutter="20">
<el-col :span="6">
<div style="text-align: center;">
@ -393,24 +406,24 @@
</el-row>
</div>
<el-table
:data="mrpResultData"
style="width: 100%"
:header-cell-style="{ background: '#f5f7fa', color: '#606266' }"
:row-class-name="getMrpRowClass"
border
stripe
size="small"
v-loading="mrpLoading"
:data="mrpResultData"
style="width: 100%"
:header-cell-style="{ background: '#f5f7fa', color: '#606266' }"
:row-class-name="getMrpRowClass"
border
stripe
size="small"
v-loading="mrpLoading"
>
<el-table-column prop="materialCode" label="物料编码" min-width="120" show-overflow-tooltip/>
<el-table-column prop="materialName" label="物料名称" min-width="100" show-overflow-tooltip/>
<el-table-column label="项目本批数" width="130" align="right">
<template slot-scope="scope">
<template slot-scope="scope">
<span style="color: #e6a23c">
{{ formatFraction(scope.row.purchaseNotInStock) }}
</span>
</template>
</el-table-column>
</template>
</el-table-column>
<el-table-column prop="availableStock" label="本项目可用库存" width="120" align="right">
<template slot-scope="scope">
@ -436,7 +449,7 @@
<span style="color: #409eff">{{ scope.row.purchaseRequestQty.toFixed(3) }}</span>
</template>
</el-table-column>
<el-table-column prop="childNotPickedQty" label="子项未领料数量" width="130" align="right">
<template slot-scope="scope">
<span style="color: #f56c6c">{{ scope.row.childNotPickedQty.toFixed(3) }}</span>
@ -456,26 +469,26 @@
<!-- 分页 -->
<el-pagination
@size-change="handleMrpSizeChange"
@current-change="handleMrpCurrentChange"
:current-page="mrpQueryParams.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="mrpQueryParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="mrpTotal"
style="margin-top: 20px; text-align: right;"
@size-change="handleMrpSizeChange"
@current-change="handleMrpCurrentChange"
:current-page="mrpQueryParams.pageNum"
:page-sizes="[10, 20, 50, 100]"
:page-size="mrpQueryParams.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="mrpTotal"
style="margin-top: 20px; text-align: right;"
/>
</el-card>
<!-- 新增/编辑弹窗 -->
<el-dialog
:title="isEditChain ? '编辑销齿链型号' : '新增销齿链型号'"
:visible.sync="chainDialogVisible"
width="420px"
append-to-body
:title="isEditChain ? '编辑销齿链型号' : '新增销齿链型号'"
:visible.sync="chainDialogVisible"
width="420px"
append-to-body
>
<el-form :model="chainForm" label-width="100px">
<div
style="margin-bottom: 16px; padding: 12px; background-color: #f0f9ff; border: 1px solid #b3d8ff; border-radius: 4px; color: #409eff; font-size: 13px;">
style="margin-bottom: 16px; padding: 12px; background-color: #f0f9ff; border: 1px solid #b3d8ff; border-radius: 4px; color: #409eff; font-size: 13px;">
<i class="el-icon-info" style="margin-right: 6px;"></i>
<strong>操作说明</strong>可以先搜索选择已有型号自动填充或直接手动填写所有必填字段*
</div>
@ -484,23 +497,23 @@
可选择已有型号或手动填写所有信息
</div>
<el-select
v-model="chainForm.id"
filterable
remote
reserve-keyword
placeholder="请输入行程/类型/名称/产品名(可选)"
:remote-method="searchRigidChain"
:loading="chainLoading"
@change="onRigidChainSelect"
popper-class="chain-autocomplete-dropdown"
:default-first-option="false"
clearable
v-model="chainForm.id"
filterable
remote
reserve-keyword
placeholder="请输入行程/类型/名称/产品名(可选)"
:remote-method="searchRigidChain"
:loading="chainLoading"
@change="onRigidChainSelect"
popper-class="chain-autocomplete-dropdown"
:default-first-option="false"
clearable
>
<el-option
v-for="item in rigidChainOptions"
:key="item.id"
:label="item.productName"
:value="item.id"
v-for="item in rigidChainOptions"
:key="item.id"
:label="item.productName"
:value="item.id"
>
<div class="chain-suggestion-item">
<div class="chain-name">{{ item.figureNumber }}</div>
@ -533,17 +546,17 @@
<el-form-item label="文件路径">
<div>
<el-select
v-model="chainForm.selectedFileType"
placeholder="请选择文件类型"
@change="onConfigIniSelect"
filterable
clearable
v-model="chainForm.selectedFileType"
placeholder="请选择文件类型"
@change="onConfigIniSelect"
filterable
clearable
>
<el-option
v-for="item in configIniOptions"
:key="item.fileType"
:label="item.fileType"
:value="item.fileType"
v-for="item in configIniOptions"
:key="item.fileType"
:label="item.fileType"
:value="item.fileType"
/>
</el-select>
</div>
@ -565,14 +578,14 @@
<el-drawer
title="BOM明细 " :visible.sync="bomDrawer" direction="rtl" :size="1500">
title="BOM明细 " :visible.sync="bomDrawer" direction="rtl" :size="1500">
<div style="padding: 20px;">
<bomInfo v-if="bomDrawer" :params="bomParams"/>
</div>
</el-drawer>
<el-drawer
title="工艺路线 " :visible.sync="processDrawer" direction="rtl" :size="1500">
title="工艺路线 " :visible.sync="processDrawer" direction="rtl" :size="1500">
<div style="padding: 20px;">
<processInfo v-if="processDrawer" :params="processParams"/>
</div>
@ -604,15 +617,16 @@
</el-form-item>
<el-form-item label="是否企标" prop="isEnterpriseStandard">
<el-select v-model="form.isEnterpriseStandard" placeholder="请选择是否企标" clearable>
<el-option label="否" :value="0"/>
<el-option label="是" :value="1"/>
<el-option label="非标单" :value="0"/>
<el-option label="变更单" :value="2"/>
<el-option label="企标单" :value="1"/>
</el-select>
</el-form-item>
<!-- &lt;!&ndash; 文件路径输入框非企标时只读 &ndash;&gt;
<el-form-item label="文件路径" prop="drawingPath">
<el-input v-model="form.drawingPath" :readonly="form.isEnterpriseStandard !== 1"
placeholder="企标可填写非企标请在子表单上传DWG文件"/>
</el-form-item>-->
<!-- &lt;!&ndash; 文件路径输入框非企标时只读 &ndash;&gt;
<el-form-item label="文件路径" prop="drawingPath">
<el-input v-model="form.drawingPath" :readonly="form.isEnterpriseStandard !== 1"
placeholder="企标可填写非企标请在子表单上传DWG文件"/>
</el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
@ -665,6 +679,7 @@ import dayjs from "dayjs";
export default {
name: "OrderPro",
dicts: ['process_status'],
components: {
ImageUpload,
bomInfo,
@ -789,18 +804,18 @@ export default {
isEnterpriseStandard: [
{required: true, message: "是否企标 (0-否, 1-是)不能为空", trigger: "blur"}
],
/* drawingPath: [
{
validator: (rule, value, callback) => {
if (!value) {
callback(new Error('图纸路径不能为空'));
}
//
callback();
},
trigger: "blur"
}
]*/
/* drawingPath: [
{
validator: (rule, value, callback) => {
if (!value) {
callback(new Error('图纸路径不能为空'));
}
//
callback();
},
trigger: "blur"
}
]*/
},
productionObj: null,
id: '',
@ -858,18 +873,18 @@ export default {
}
},
methods: {
formatFraction(value) {
formatFraction(value) {
//
if (typeof value === 'string' && value.includes('/')) {
return value;
}
//
if (!isNaN(value)) {
return parseFloat(value).toFixed(3);
return parseFloat(value).toFixed(3);
}
return value; //
},
//
formatFractionValue(value) {
//
@ -1036,36 +1051,36 @@ export default {
// MRP
async getMrpData() {
this.mrpLoading = true;
try {
this.mrpQueryParams.orderProId = this.productionObj.id;
const response = await listMrp(this.mrpQueryParams);
this.mrpLoading = true;
try {
this.mrpQueryParams.orderProId = this.productionObj.id;
const response = await listMrp(this.mrpQueryParams);
if (response && response.rows) {
// Number toFixed
const processedRows = response.rows.map(item => ({
...item,
availableStock: Number(item.availableStock) || 0,
realTimeStock: Number(item.realTimeStock) || 0,
prodNotInStock: Number(item.prodNotInStock) || 0,
purchaseRequestQty: Number(item.purchaseRequestQty) || 0,
purchaseNotInStock: this.formatFractionValue(item.purchaseNotInStock),
childNotPickedQty: Number(item.childNotPickedQty) || 0,
createTime: item.createTime ? dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') : '',
updateTime: item.updateTime ? dayjs(item.updateTime).format('YYYY-MM-DD HH:mm:ss') : ''
}));
this.mrpResultData = processedRows;
this.mrpTotal = response.total || processedRows.length;
//
this.calculateMrpStats(processedRows);
}
} catch (error) {
console.error('获取MRP数据失败:', error);
this.$message.error('获取MRP数据失败');
} finally {
this.mrpLoading = false;
if (response && response.rows) {
// Number toFixed
const processedRows = response.rows.map(item => ({
...item,
availableStock: Number(item.availableStock) || 0,
realTimeStock: Number(item.realTimeStock) || 0,
prodNotInStock: Number(item.prodNotInStock) || 0,
purchaseRequestQty: Number(item.purchaseRequestQty) || 0,
purchaseNotInStock: this.formatFractionValue(item.purchaseNotInStock),
childNotPickedQty: Number(item.childNotPickedQty) || 0,
createTime: item.createTime ? dayjs(item.createTime).format('YYYY-MM-DD HH:mm:ss') : '',
updateTime: item.updateTime ? dayjs(item.updateTime).format('YYYY-MM-DD HH:mm:ss') : ''
}));
this.mrpResultData = processedRows;
this.mrpTotal = response.total || processedRows.length;
//
this.calculateMrpStats(processedRows);
}
},
} catch (error) {
console.error('获取MRP数据失败:', error);
this.$message.error('获取MRP数据失败');
} finally {
this.mrpLoading = false;
}
},
// MRP
@ -1122,8 +1137,8 @@ export default {
const keyword = this.mrpSearchKeyword.toLowerCase();
return data.filter(item =>
item.materialName.toLowerCase().includes(keyword) ||
item.materialCode.toLowerCase().includes(keyword)
item.materialName.toLowerCase().includes(keyword) ||
item.materialCode.toLowerCase().includes(keyword)
);
},
@ -1142,15 +1157,15 @@ export default {
};
},
//
//
getDrawerTitle() {
if (!this.productionObj) {
return '项目详情';
}
const orderNo = this.productionObj.productionOrderNo || '';
const projectName = this.productionObj.productionName || '';
if (orderNo && projectName) {
return `项目详情 - ${orderNo} | ${projectName}`;
} else if (orderNo) {
@ -1161,11 +1176,11 @@ export default {
return '项目详情';
}
},
// MRP
handleRefreshMrpData() {
this.mrpQueryParams.pageNum = 1;
this.getMrpData();
this.mrpQueryParams.pageNum = 1;
this.getMrpData();
},
// MRP
@ -1538,20 +1553,20 @@ export default {
this.$message.error('仅支持dwg格式文件上传');
return false;
}
//
if (!row || !row.id) {
this.$message.error('行数据无效,无法上传');
return false;
}
// 50MB
const maxSize = 50 * 1024 * 1024; // 50MB
if (file.size > maxSize) {
this.$message.error('文件大小不能超过50MB');
return false;
}
return true;
},
handleDwgUploadSuccess(response, file, row) {
@ -1559,7 +1574,7 @@ export default {
//
this.loadChainTableData();
this.$message.success(`图纸上传成功:${file.name}`);
// drawPath
if (response.data && response.data.filePath) {
row.drawPath = response.data.filePath;
@ -1583,40 +1598,40 @@ export default {
// API
uploadPDF(this.productionObj.id)
.then(response => {
console.log('API响应:', response);
console.log('响应类型:', typeof response);
console.log('是否为Blob:', response instanceof Blob);
.then(response => {
console.log('API响应:', response);
console.log('响应类型:', typeof response);
console.log('是否为Blob:', response instanceof Blob);
// blob
if (!(response instanceof Blob)) {
console.error('响应不是文件流:', response);
this.$message.error('服务器返回的不是文件流');
return;
}
// blob
if (!(response instanceof Blob)) {
console.error('响应不是文件流:', response);
this.$message.error('服务器返回的不是文件流');
return;
}
//
console.log('文件大小:', response.size);
if (response.size === 0) {
this.$message.error('文件为空或下载失败');
return;
}
//
console.log('文件大小:', response.size);
if (response.size === 0) {
this.$message.error('文件为空或下载失败');
return;
}
// blob
let blob = new Blob([response], {type: 'application/zip'});
let url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `${this.productionObj.productionOrderNo}_PDF.zip`;
link.click();
window.URL.revokeObjectURL(url);
// blob
let blob = new Blob([response], {type: 'application/zip'});
let url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `${this.productionObj.productionOrderNo}_PDF.zip`;
link.click();
window.URL.revokeObjectURL(url);
this.$message.success('PDF文件下载成功');
})
.catch(error => {
this.$message.error('PDF文件下载失败: ' + (error.message || error));
});
this.$message.success('PDF文件下载成功');
})
.catch(error => {
this.$message.error('PDF文件下载失败: ' + (error.message || error));
});
},
downloadRoute() {
if (!this.productionObj || !this.productionObj.id) {
@ -1629,29 +1644,29 @@ export default {
// API
exportRoute(this.productionObj.id)
.then(response => {
//
if (response.size === 0) {
this.$message.error('文件为空或下载失败');
return;
}
.then(response => {
//
if (response.size === 0) {
this.$message.error('文件为空或下载失败');
return;
}
// blob
let blob = new Blob([response], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
let url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `${this.productionObj.productionOrderNo}_生产工艺计划表.xlsx`;
link.click();
window.URL.revokeObjectURL(url);
// blob
let blob = new Blob([response], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
let url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `${this.productionObj.productionOrderNo}_生产工艺计划表.xlsx`;
link.click();
window.URL.revokeObjectURL(url);
this.$message.success('生产工艺计划表下载成功');
})
.catch(error => {
console.error('下载失败:', error);
//
this.$message.error('下载失败: ' + (error.message || '项目未出图'));
});
this.$message.success('生产工艺计划表下载成功');
})
.catch(error => {
console.error('下载失败:', error);
//
this.$message.error('下载失败: ' + (error.message || '项目未出图'));
});
},
},
beforeMount() {

View File

@ -0,0 +1,386 @@
<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="projectCode">
<el-input
v-model="queryParams.projectCode"
placeholder="请输入方案编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="设计人" prop="designer">
<el-select v-model="queryParams.designer" placeholder="请选择设计人" clearable>
<el-option
v-for="dict in dict.type.plan_proer"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="预计开始时间" prop="startDate">
<el-date-picker clearable
v-model="queryParams.startDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择预计开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="预计完成时间" prop="endDate">
<el-date-picker clearable
v-model="queryParams.endDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择预计完成时间">
</el-date-picker>
</el-form-item>
<el-form-item label="方案状态" prop="processStatus">
<el-select v-model="queryParams.processStatus" placeholder="请选择方案状态" clearable>
<el-option label="未开始" value="0" />
<el-option label="已完成" value="1" />
</el-select>
</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="['system:proPlan: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="['system:proPlan:edit']"
>修改</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="['system:proPlan:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:proPlan:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="proPlanList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="方案编码" align="center" prop="projectCode" />
<el-table-column label="设计人" align="center" prop="designer">
<template slot-scope="scope">
<dict-tag :options="dict.type.plan_proer" :value="scope.row.designer"/>
</template>
</el-table-column>
<el-table-column label="方案备注" align="center" prop="remark" />
<el-table-column label="预计开始时间" align="center" prop="startDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="预计完成时间" align="center" prop="endDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="方案状态" align="center" prop="processStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.pro_status" :value="scope.row.processStatus"/>
</template>
</el-table-column>
<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-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:proPlan:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:proPlan:remove']"
>删除</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="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="方案编码" prop="projectCode">
<el-input v-model="form.projectCode" placeholder="请输入方案编码" />
</el-form-item>
<el-form-item label="设计人" prop="designer">
<el-select v-model="form.designer" placeholder="请选择设计人">
<el-option
v-for="dict in dict.type.plan_proer"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="方案备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="预计开始时间" prop="startDate">
<el-date-picker clearable
v-model="form.startDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择预计开始时间">
</el-date-picker>
</el-form-item>
<el-form-item label="预计完成时间" prop="endDate">
<el-date-picker clearable
v-model="form.endDate"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择预计完成时间">
</el-date-picker>
</el-form-item>
<el-form-item label="方案/设计状态" prop="processStatus">
<el-select v-model="form.processStatus" placeholder="请选择方案状态">
<el-option label="未开始" value="0" />
<el-option label="已完成" value="1" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listProPlan, getProPlan, delProPlan, addProPlan, updateProPlan } from "@/api/system/proPlan";
export default {
name: "ProPlan",
dicts: ['plan_proer','pro_status'],
data() {
return {
// loading
buttonLoading: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
proPlanList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
projectCode: undefined,
designer: undefined,
overdueDays: undefined,
startDate: undefined,
endDate: undefined,
processStatus: undefined
},
//
form: {},
//
rules: {
projectCode: [
{ required: true, message: "方案编码不能为空", trigger: "blur" }
],
designer: [
{ required: true, message: "设计人不能为空", trigger: "change" }
],
remark: [
{ required: true, message: "方案备注不能为空", trigger: "blur" }
],
startDate: [
{ required: true, message: "预计开始时间不能为空", trigger: "blur" }
],
endDate: [
{ required: true, message: "预计完成时间不能为空", trigger: "blur" }
],
processStatus: [
{ required: true, message: "方案状态不能为空", trigger: "change" }
]
}
};
},
created() {
this.getList();
},
methods: {
/** 查询方案管理列表 */
getList() {
this.loading = true;
listProPlan(this.queryParams).then(response => {
this.proPlanList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: undefined,
projectCode: undefined,
designer: undefined,
overdueDays: undefined,
remark: undefined,
startDate: undefined,
endDate: undefined,
createTime: undefined,
updateTime: undefined,
createBy: undefined,
updateBy: undefined,
processStatus: undefined
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
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.title = "添加方案";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const id = row.id || this.ids
getProPlan(id).then(response => {
this.loading = false;
this.form = response.data;
this.open = true;
this.title = "修改方案管理";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.buttonLoading = true;
if (this.form.id != null) {
updateProPlan(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
} else {
addProPlan(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
}).finally(() => {
this.buttonLoading = false;
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除方案管理编号为"' + ids + '"的数据项?').then(() => {
this.loading = true;
return delProPlan(ids);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/proPlan/export', {
...this.queryParams
}, `proPlan_${new Date().getTime()}.xlsx`)
}
}
};
</script>