Merge remote-tracking branch 'origin/0.8.X' into 0.8.X

This commit is contained in:
JR
2025-08-16 10:09:07 +08:00
7 changed files with 101 additions and 71 deletions

View File

@@ -21,7 +21,8 @@
<el-table-column label="序号" type="index" width="50" align="center" /> <el-table-column label="序号" type="index" width="50" align="center" />
<el-table-column prop="voucherNo" label="摘要"> <el-table-column prop="voucherNo" label="摘要">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.voucherNo" placeholder="请输入摘要" @input="handleCreditInput(scope.row)" @change="handleRowChange(scope.row)" /> <el-input v-model="scope.row.voucherNo" placeholder="请输入摘要" @input="handleCreditInput(scope.row)"
@change="handleRowChange(scope.row)" />
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="voucherNo" label="单号"> <!-- <el-table-column prop="voucherNo" label="单号">
@@ -67,17 +68,20 @@
<!-- 合计部分 --> <!-- 合计部分 -->
<el-row> <el-row>
<el-descriptions> <el-row>
<el-descriptions-item label="大写金额"> <el-descriptions>
<span>{{ amountInWords }}</span> <el-descriptions-item label="大写金额">
</el-descriptions-item> <span>{{ amountInWords }}</span>
<el-descriptions-item label="借方合计"> </el-descriptions-item>
<span>{{ debitAmount.toFixed(2) }}</span> <el-descriptions-item label="借方合计">
</el-descriptions-item> <!-- 增加空值处理确保toFixed调用安全 -->
<el-descriptions-item label="贷方合计"> <span>{{ (debitAmount || 0).toFixed(2) }}</span>
<span>{{ creditAmount.toFixed(2) }}</span> </el-descriptions-item>
</el-descriptions-item> <el-descriptions-item label="贷方合计">
</el-descriptions> <span>{{ (creditAmount || 0).toFixed(2) }}</span>
</el-descriptions-item>
</el-descriptions>
</el-row>
</el-row> </el-row>
<el-row> <el-row>
@@ -115,27 +119,27 @@ export default {
} }
}, },
computed: { computed: {
// 借方总额和贷方总额(过滤空行 // 借方总额(修复后
debitAmount() { debitAmount() {
// 确保reduce的初始值为0且返回值为数字
return this.tableData.reduce((total, item) => { return this.tableData.reduce((total, item) => {
// 只计算有内容的行
if (this.isRowNotEmpty(item)) { if (this.isRowNotEmpty(item)) {
return total + (Number(item.debitAmount) || 0); return total + (Number(item.debitAmount) || 0);
} }
return total; return total;
}, 0); }, 0) || 0; // 最后确保即使结果为undefined也返回0
}, },
// 贷方总额(修复后)
creditAmount() { creditAmount() {
return this.tableData.reduce((total, item) => { return this.tableData.reduce((total, item) => {
if (this.isRowNotEmpty(item)) { if (this.isRowNotEmpty(item)) {
return total + (Number(item.creditAmount) || 0); return total + (Number(item.creditAmount) || 0);
} }
return total; return total;
}, 0); }, 0) || 0; // 同样增加默认值0
}, },
// 大写金额 // 大写金额(保持不变)
amountInWords() { amountInWords() {
// 如果借贷相等则正常显示,不相等则显示借贷不相等
if (Math.abs(this.debitAmount - this.creditAmount) < 0.01) { if (Math.abs(this.debitAmount - this.creditAmount) < 0.01) {
return this.numberToChinese(this.debitAmount); return this.numberToChinese(this.debitAmount);
} else { } else {
@@ -147,7 +151,16 @@ export default {
initData: { initData: {
type: Object, type: Object,
required: false, required: false,
default: () => ({}) default: () => ({
tableData: [{
voucherNo: '',
accountId: undefined,
debitAmount: 0,
creditAmount: 0,
remark: '',
voucherNo: ''
}]
})
} }
}, },
watch: { watch: {
@@ -155,7 +168,18 @@ export default {
handler(newVal) { handler(newVal) {
console.log(newVal, 'watchData'); console.log(newVal, 'watchData');
if (newVal) { if (newVal) {
this.tableData = newVal.detailList; if (newVal.detailList) {
this.tableData = newVal.detailList;
} else {
this.tableData = [{
voucherNo: '',
accountId: undefined,
debitAmount: 0,
creditAmount: 0,
remark: '',
voucherNo: ''
}]
}
this.form.docNo = newVal.docNo; this.form.docNo = newVal.docNo;
this.form.docDate = newVal.docDate; this.form.docDate = newVal.docDate;
this.form.relatedOrderId = newVal.relatedOrderId; this.form.relatedOrderId = newVal.relatedOrderId;

View File

@@ -4,14 +4,10 @@
<!-- 主表信息 --> <!-- 主表信息 -->
<el-descriptions :title="'单号:' + (stockIo.stockIoCode || '-')" :column="2" border> <el-descriptions :title="'单号:' + (stockIo.stockIoCode || '-')" :column="2" border>
<el-descriptions-item label="类型"> <el-descriptions-item label="类型">
<el-tag :type="getIoTypeTagType(stockIo.ioType)"> <dict-tag :options="dict.type.stock_io_type" :value="stockIo.ioType"></dict-tag>
{{ getIoTypeLabel(stockIo.ioType) }}
</el-tag>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="业务类型"> <el-descriptions-item label="业务类型">
<el-tag :type="getBizTypeTagType(stockIo.bizType)"> <dict-tag :options="dict.type.stock_biz_type" :value="stockIo.bizType"></dict-tag>
{{ getBizTypeLabel(stockIo.bizType) }}
</el-tag>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="状态"> <el-descriptions-item label="状态">
<el-tag :type="stockIo.status === 2 ? 'success' : (stockIo.status === 1 ? 'warning' : 'info')"> <el-tag :type="stockIo.status === 2 ? 'success' : (stockIo.status === 1 ? 'warning' : 'info')">
@@ -233,7 +229,7 @@ export default {
SemiSelect, SemiSelect,
MaterialSelect MaterialSelect
}, },
dicts: ['stock_item_type'], dicts: ['stock_item_type', 'stock_biz_type'],
props: { props: {
stockIo: { stockIo: {
type: Object, type: Object,

View File

@@ -48,16 +48,15 @@
<el-table-column label="出入库单号" align="center" prop="stockIoCode" /> <el-table-column label="出入库单号" align="center" prop="stockIoCode" />
<el-table-column label="类型" align="center" prop="ioType"> <el-table-column label="类型" align="center" prop="ioType">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getIoTypeTagType(scope.row.ioType)"> <dict-tag :options="dict.type.stock_io_type" :value="scope.row.ioType"></dict-tag>
{{ getIoTypeLabel(scope.row.ioType) }}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="业务类型" align="center" prop="bizType"> <el-table-column label="业务类型" align="center" prop="bizType">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag :type="getBizTypeTagType(scope.row.bizType)"> <!-- <el-tag :type="getBizTypeTagType(scope.row.bizType)">
{{ getBizTypeLabel(scope.row.bizType) }} {{ getBizTypeLabel(scope.row.bizType) }}
</el-tag> </el-tag> -->
<dict-tag :options="dict.type.stock_biz_type" :value="scope.row.bizType"></dict-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="单据状态" align="center" prop="status"> <el-table-column label="单据状态" align="center" prop="status">

View File

@@ -0,0 +1,4 @@
<template>
</template>

View File

@@ -2,39 +2,29 @@
<div class="app-container"> <div class="app-container">
<el-page-header @back="$router.back()" :content="'排产计划编号:' + (planInfo.planCode || '-')" /> <el-page-header @back="$router.back()" :content="'排产计划编号:' + (planInfo.planCode || '-')" />
<el-tabs> <el-tabs v-model="activeTab" @tab-click="handleTabClick">
<el-tab-pane label="排产计划详情"> <!-- <el-tab-pane label="排产计划详情" name="info">
<el-descriptions :column="1" border> <el-descriptions :column="1" border>
<el-descriptions-item label="计划ID">{{ planInfo.planId }}</el-descriptions-item> <el-descriptions-item label="计划ID">{{ planInfo.planId }}</el-descriptions-item>
<el-descriptions-item label="关联订单ID">{{ planInfo.orderId }}</el-descriptions-item> <el-descriptions-item label="关联订单ID">{{ planInfo.orderId }}</el-descriptions-item>
<el-descriptions-item label="状态">{{ planInfo.status }}</el-descriptions-item> <el-descriptions-item label="状态">{{ planInfo.status }}</el-descriptions-item>
<el-descriptions-item label="备注">{{ planInfo.remark }}</el-descriptions-item> <el-descriptions-item label="备注">{{ planInfo.remark }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-tab-pane>
<el-tab-pane label="生产目标">
<TargetPanel :list="orderDetailList" :planId="planId" />
</el-tab-pane>
<el-tab-pane label="批次管理">
<BatchPanel :planId="planId" />
</el-tab-pane>
<!-- <el-tab-pane label="工艺任务">
<CraftTaskPanel :list="orderDetailList" />
</el-tab-pane> --> </el-tab-pane> -->
<el-tab-pane label="计划明细"> <el-tab-pane label="生产目标" name="target">
<TargetPanel :list="orderDetailList" :planId="planId" v-if="activeTab === 'target'" />
</el-tab-pane>
<el-tab-pane label="生产任务管理" name="batch">
<BatchPanel :planId="planId" v-if="activeTab === 'batch'" />
</el-tab-pane>
<!-- <el-tab-pane label="计划明细" name="detail">
<el-button type="primary" size="mini" style="float:right" @click="openDetailDialog()">新增明细</el-button> <el-button type="primary" size="mini" style="float:right" @click="openDetailDialog()">新增明细</el-button>
<el-table :data="detailList" v-loading="loading" style="width: 100%"> <el-table :data="detailList" v-loading="loading" style="width: 100%" v-if="activeTab === 'detail'">
<el-table-column prop="detailId" label="明细ID" align="center" /> <el-table-column prop="detailId" label="明细ID" align="center" />
<el-table-column prop="lineName" label="产线名称" align="center" /> <el-table-column prop="lineName" label="产线名称" align="center" />
<!-- <el-table-column prop="productName" label="产品名称" align="center" /> -->
<!-- <el-table-column prop="productCode" label="产品信息" align="center">
<template slot-scope="scope">
<ProductInfo :productId="scope.row.productId" />
</template>
</el-table-column> -->
<el-table-column prop="batchNo" label="批次号" align="center" /> <el-table-column prop="batchNo" label="批次号" align="center" />
<el-table-column prop="quantity" label="排产数量" align="center" /> <el-table-column prop="quantity" label="排产数量" align="center" />
<el-table-column prop="startDate" label="开始日期" align="center" /> <el-table-column prop="startDate" label="开始日期" align="center" />
@@ -46,7 +36,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-tab-pane> </el-tab-pane> -->
</el-tabs> </el-tabs>
<el-dialog :title="detailDialogTitle" :visible.sync="detailDialogVisible" width="700px" <el-dialog :title="detailDialogTitle" :visible.sync="detailDialogVisible" width="700px"
@@ -114,6 +104,7 @@ export default {
components: { GanttChartEcharts, ProductInfo, TargetPanel, CraftTaskPanel, BatchPanel }, components: { GanttChartEcharts, ProductInfo, TargetPanel, CraftTaskPanel, BatchPanel },
data() { data() {
return { return {
activeTab: 'target',
planId: null, planId: null,
planInfo: {}, planInfo: {},
orderDetailList: [], orderDetailList: [],
@@ -157,6 +148,16 @@ export default {
} }
}, },
methods: { methods: {
// handleTabClick(tab, event) {
// if (this.activeTab === 'detail') {
// this.fetchDetailList();
// } else if (this.activeTab === 'batch') {
// this.fetchBatchList();
// } else if (this.activeTab === 'target') {
// this.fetchOrderDetailList();
// }
// },
fetchPlanInfo() { fetchPlanInfo() {
getSchedulePlan(this.planId).then(res => { getSchedulePlan(this.planId).then(res => {
this.planInfo = res.data || {}; this.planInfo = res.data || {};

View File

@@ -97,13 +97,13 @@
<el-tag type="info">新建</el-tag> <el-tag type="info">新建</el-tag>
</el-option> </el-option>
<el-option key="2" :value="1" label="已排产"> <el-option key="2" :value="1" label="已排产">
<el-tag type="warning">排产</el-tag> <el-tag type="warning">排产</el-tag>
</el-option> </el-option>
<el-option key="3" :value="2" label="生产中"> <el-option key="3" :value="2" label="生产中">
<el-tag type="primary">生产中</el-tag> <el-tag type="primary">生产中</el-tag>
</el-option> </el-option>
<el-option key="4" :value="3" label="已完成"> <el-option key="4" :value="3" label="已完成">
<el-tag type="success">完成</el-tag> <el-tag type="danger">废弃</el-tag>
</el-option> </el-option>
</el-select> </el-select>
<!-- <el-tag :type="statusTagType(scope.row.status)" disable-transitions> <!-- <el-tag :type="statusTagType(scope.row.status)" disable-transitions>
@@ -164,6 +164,12 @@
<el-option v-for="item in orderList" :key="item.orderId" :label="item.orderCode || item.orderId" :value="item.orderId" /> <el-option v-for="item in orderList" :key="item.orderId" :label="item.orderCode || item.orderId" :value="item.orderId" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="开始时间" prop="startDate">
<el-date-picker v-model="form.startDate" type="date" placeholder="请选择开始时间" style="width:100%" value-format="yyyy-MM-dd hh:mm:ss" />
</el-form-item>
<el-form-item label="结束时间" prop="endDate">
<el-date-picker v-model="form.endDate" type="date" placeholder="请选择结束时间" style="width:100%" value-format="yyyy-MM-dd hh:mm:ss" />
</el-form-item>
<el-form-item label="优先级" prop="priority"> <el-form-item label="优先级" prop="priority">
<el-select v-model="form.priority" placeholder="请选择优先级"> <el-select v-model="form.priority" placeholder="请选择优先级">
<el-option <el-option

View File

@@ -12,7 +12,7 @@
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleInitBatch">生成批次</el-button> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleInitBatch">生成生产任务</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
@@ -33,14 +33,14 @@
<el-table v-loading="loading" :data="batchList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="batchList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="批次ID" align="center" prop="batchId" v-if="true" /> <el-table-column label="生产任务ID" align="center" prop="batchId" v-if="true" />
<el-table-column label="批次编号" align="center" prop="batchNo" /> <el-table-column label="生产任务编号" align="center" prop="batchNo" />
<el-table-column label="关联工艺ID" align="center" prop="processId"> <el-table-column label="关联工艺ID" align="center" prop="processId">
<template slot-scope="scope"> <template slot-scope="scope">
<CraftInfo :craftId="scope.row.processId" /> <CraftInfo :craftId="scope.row.processId" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="批次总数量" align="center" prop="totalQuantity" /> <el-table-column label="生产任务总数量" align="center" prop="totalQuantity" />
<el-table-column label="合并来源" align="center" prop="mergeSource"> <el-table-column label="合并来源" align="center" prop="mergeSource">
<template slot-scope="scope"> <template slot-scope="scope">
<div v-for="item in scope.row.mergeSource.split(',')" style="display: flex; align-items: center; justify-content: center; gap: 10px;" :key="item"> <div v-for="item in scope.row.mergeSource.split(',')" style="display: flex; align-items: center; justify-content: center; gap: 10px;" :key="item">
@@ -59,7 +59,7 @@
<span>{{ parseTime(scope.row.estimatedEndTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.estimatedEndTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="批次状态" align="center" prop="batchStatus"> <el-table-column label="状态" align="center" prop="batchStatus">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.batch_status" :value="scope.row.batchStatus" /> <dict-tag :options="dict.type.batch_status" :value="scope.row.batchStatus" />
</template> </template>
@@ -76,8 +76,8 @@
<!-- 添加或修改批次合并相同工艺的任务对话框 --> <!-- 添加或修改批次合并相同工艺的任务对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="批次编号" prop="batchNo"> <el-form-item label="生产任务编号" prop="batchNo">
<el-input v-model="form.batchNo" placeholder="请输入批次编号" /> <el-input v-model="form.batchNo" placeholder="请输入生产任务编号" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="关联工艺ID" prop="processId"> <!-- <el-form-item label="关联工艺ID" prop="processId">
<el-input v-model="form.processId" placeholder="请输入关联工艺ID" /> <el-input v-model="form.processId" placeholder="请输入关联工艺ID" />
@@ -114,9 +114,9 @@
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="批次生成" width="800px" :visible.sync="batchGenerateDialogVisible"> <el-dialog title="生成生产任务" width="800px" :visible.sync="batchGenerateDialogVisible">
<el-table :data="generateBatchList" style="width: 100%;" border> <el-table :data="generateBatchList" style="width: 100%;" border>
<el-table-column label="批次编号" align="center" prop="batchNo"> <el-table-column label="生产任务编号" align="center" prop="batchNo">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.batchNo" /> <el-input v-model="scope.row.batchNo" />
</template> </template>
@@ -131,7 +131,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="批次总数量" align="center" prop="totalQuantity" /> <el-table-column label="生产任务总数量" align="center" prop="totalQuantity" />
<el-table-column label="预计开始时间" align="center" prop="estimatedStartTime"> <el-table-column label="预计开始时间" align="center" prop="estimatedStartTime">
<template slot-scope="scope"> <template slot-scope="scope">
<el-date-picker v-model="scope.row.estimatedStartTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" <el-date-picker v-model="scope.row.estimatedStartTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
@@ -146,7 +146,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleAddBatch(scope.row)">生成批次</el-button> <el-button type="primary" size="mini" @click="handleAddBatch(scope.row)">创建生产任务</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -343,7 +343,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加批次(合并相同工艺的任务)"; this.title = "添加生产任务(合并相同工艺的任务)";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@@ -354,7 +354,7 @@ export default {
this.loading = false; this.loading = false;
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改批次(合并相同工艺的任务)"; this.title = "修改生产任务(合并相同工艺的任务)";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
@@ -393,7 +393,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const batchIds = row.batchId || this.ids; const batchIds = row.batchId || this.ids;
this.$modal.confirm('是否确认删除批次(合并相同工艺的任务)编号为"' + batchIds + '"的数据项?').then(() => { this.$modal.confirm('是否确认删除生产任务(合并相同工艺的任务)编号为"' + batchIds + '"的数据项?').then(() => {
this.loading = true; this.loading = true;
return delBatch(batchIds); return delBatch(batchIds);
}).then(() => { }).then(() => {