Commit 97d0d917 authored by 528360026@qq.com's avatar 528360026@qq.com

编排单增加生成任务单

parent d6810e06
...@@ -51,30 +51,43 @@ ...@@ -51,30 +51,43 @@
>新增 >新增
</el-button> </el-button>
</el-col> </el-col>
<!-- <el-col :span="1.5">--> <el-col :span="1.5">
<!-- <el-button--> <el-button
<!-- type="success"--> type="warning"
<!-- plain--> plain
<!-- icon="el-icon-edit"--> icon="el-icon-plus"
<!-- size="mini"--> size="mini"
<!-- :disabled="single"--> :disabled="multiple"
<!-- @click="handleUpdate"--> @click="handleDofinish"
<!-- v-hasPermi="['pro:arrange:edit']"--> v-hasPermi="['mes:pro:workorder:dofinish']"
<!-- >修改--> >生成任务单
<!-- </el-button>--> </el-button
<!-- </el-col>--> >
<!-- <el-col :span="1.5">--> </el-col>
<!-- <el-button--> <!-- <el-col :span="1.5">-->
<!-- type="danger"--> <!-- <el-button-->
<!-- plain--> <!-- type="success"-->
<!-- icon="el-icon-delete"--> <!-- plain-->
<!-- size="mini"--> <!-- icon="el-icon-edit"-->
<!-- :disabled="multiple"--> <!-- size="mini"-->
<!-- @click="handleDelete"--> <!-- :disabled="single"-->
<!-- v-hasPermi="['pro:arrange:remove']"--> <!-- @click="handleUpdate"-->
<!-- >删除--> <!-- v-hasPermi="['pro:arrange:edit']"-->
<!-- </el-button>--> <!-- >修改-->
<!-- </el-col>--> <!-- </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="['pro:arrange:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
<!-- </el-col>-->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="warning" type="warning"
...@@ -91,7 +104,7 @@ ...@@ -91,7 +104,7 @@
<el-table v-loading="loading" :data="arrangeList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="arrangeList" @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="编号" align="center" prop="arrangeId"/>--> <!-- <el-table-column label="编号" align="center" prop="arrangeId"/>-->
<el-table-column label="编排单号" align="center" prop="arrangeCode"> <el-table-column label="编排单号" align="center" prop="arrangeCode">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -108,26 +121,26 @@ ...@@ -108,26 +121,26 @@
<!-- <el-table-column label="序号" align="center" prop="arrangeSort"/>--> <!-- <el-table-column label="序号" align="center" prop="arrangeSort"/>-->
<!-- <el-table-column label="生产工单号" align="center" prop="workorderId"/>--> <!-- <el-table-column label="生产工单号" align="center" prop="workorderId"/>-->
<!-- <el-table-column label="生产工单编号" align="center" prop="workorderCode"/>--> <!-- <el-table-column label="生产工单编号" align="center" prop="workorderCode"/>-->
<!-- <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--> <!-- <el-button-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- type="text"--> <!-- type="text"-->
<!-- icon="el-icon-edit"--> <!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"--> <!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['pro:arrange:edit']"--> <!-- v-hasPermi="['pro:arrange:edit']"-->
<!-- >修改--> <!-- >修改-->
<!-- </el-button>--> <!-- </el-button>-->
<!-- <el-button--> <!-- <el-button-->
<!-- size="mini"--> <!-- size="mini"-->
<!-- type="text"--> <!-- type="text"-->
<!-- icon="el-icon-delete"--> <!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"--> <!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['pro:arrange:remove']"--> <!-- v-hasPermi="['pro:arrange:remove']"-->
<!-- >删除--> <!-- >删除-->
<!-- </el-button>--> <!-- </el-button>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
</el-table> </el-table>
<pagination <pagination
...@@ -169,6 +182,7 @@ ...@@ -169,6 +182,7 @@
<script> <script>
import {listArrange, getArrange, delArrange, addArrange, updateArrange, listGroupArrange} from "@/api/mes/pro/arrange"; import {listArrange, getArrange, delArrange, addArrange, updateArrange, listGroupArrange} from "@/api/mes/pro/arrange";
import ArrangeInfo from "@/views/mes/pro/arrange/info.vue"; import ArrangeInfo from "@/views/mes/pro/arrange/info.vue";
import {addProtaskList} from "@/api/mes/pro/protask";
export default { export default {
name: "Arrange", name: "Arrange",
...@@ -195,6 +209,7 @@ export default { ...@@ -195,6 +209,7 @@ export default {
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
selectedRows: [],
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
...@@ -220,6 +235,23 @@ export default { ...@@ -220,6 +235,23 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
handleDofinish() {
this.$modal
.confirm("是否生成选中的任务单?")
.then(() => {
const workorderIds = this.selectedRows.flatMap(row => {
return row.workorderIds.split(',').map(id => parseInt(id, 10));
});
return addProtaskList(workorderIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("生成成功");
})
.catch(() => {
// 用户取消或出现错误时的处理
});
},
handleView(row) { handleView(row) {
this.arrangeOpen = true; this.arrangeOpen = true;
...@@ -260,6 +292,7 @@ export default { ...@@ -260,6 +292,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.arrangeId) this.ids = selection.map(item => item.arrangeId)
this.selectedRows = selection;
this.single = selection.length !== 1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
......
...@@ -186,9 +186,9 @@ ...@@ -186,9 +186,9 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDofinish" @click="handleArrange"
v-hasPermi="['mes:pro:workorder:dofinish']" v-hasPermi="['mes:pro:workorder:dofinish']"
>生成任务 >生成编排
</el-button </el-button
> >
</el-col> </el-col>
...@@ -199,9 +199,9 @@ ...@@ -199,9 +199,9 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleArrange" @click="handleDofinish"
v-hasPermi="['mes:pro:workorder:dofinish']" v-hasPermi="['mes:pro:workorder:dofinish']"
>生成编排 >生成任务
</el-button </el-button
> >
</el-col> </el-col>
...@@ -763,6 +763,12 @@ ...@@ -763,6 +763,12 @@
@close="getList"> @close="getList">
<CombinationInfos :combinationCodes="combinationCodes"></CombinationInfos> <CombinationInfos :combinationCodes="combinationCodes"></CombinationInfos>
</el-dialog> </el-dialog>
<el-dialog title="编排单明细" v-if="arrangeOpen" :visible.sync="arrangeOpen" width="800px" append-to-body
@close="getList">
<ArrangeInfo :arrange-code="arrangeCode"></ArrangeInfo>
</el-dialog>
</div> </div>
</template> </template>
...@@ -789,6 +795,7 @@ import {getToken} from "@/utils/auth"; ...@@ -789,6 +795,7 @@ import {getToken} from "@/utils/auth";
import {addCombination, batchAddCombination} from "@/api/mes/pro/combination"; import {addCombination, batchAddCombination} from "@/api/mes/pro/combination";
import CombinationInfos from "@/views/mes/pro/combination/infos.vue"; import CombinationInfos from "@/views/mes/pro/combination/infos.vue";
import {batchAddArrange} from "@/api/mes/pro/arrange"; import {batchAddArrange} from "@/api/mes/pro/arrange";
import ArrangeInfo from "@/views/mes/pro/arrange/info.vue";
export default { export default {
name: "Workorder", name: "Workorder",
...@@ -798,6 +805,7 @@ export default { ...@@ -798,6 +805,7 @@ export default {
"mes_workorder_type", "mes_workorder_type",
], ],
components: { components: {
ArrangeInfo,
CombinationInfos, CombinationInfos,
Treeselect, Treeselect,
ItemSelect, ItemSelect,
...@@ -813,6 +821,8 @@ export default { ...@@ -813,6 +821,8 @@ export default {
optType: undefined, optType: undefined,
combOpen: false, combOpen: false,
combinationCodes: [], combinationCodes: [],
arrangeOpen: false,
arrangeCode: [],
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 显示搜索条件 // 显示搜索条件
...@@ -933,6 +943,8 @@ export default { ...@@ -933,6 +943,8 @@ export default {
}); });
batchAddArrange(params).then(response => { batchAddArrange(params).then(response => {
this.arrangeOpen = true;
this.arrangeCode = response;
this.$modal.msgSuccess("新增编排单成功"); this.$modal.msgSuccess("新增编排单成功");
this.getList(); this.getList();
}); });
...@@ -1209,17 +1221,33 @@ export default { ...@@ -1209,17 +1221,33 @@ export default {
this.$modal this.$modal
.confirm("是否生成选中的任务单?") .confirm("是否生成选中的任务单?")
.then(() => { .then(() => {
const ids = this.selectedRows.map((v) => v.workorderId); let allCodesNotEmpty = true;
console.log("00000", ids);
return addProtaskList(ids); this.selectedRows.every(row => {
if (row.arrangeCode == '' || row.arrangeCode == null) {
allCodesNotEmpty = false;
return false; // 结束every循环
}
return true; // 继续检查下一个元素
});
if (allCodesNotEmpty) {
const ids = this.selectedRows.map((v) => v.workorderId);
console.log("00000", ids);
return addProtaskList(ids);
} else {
this.$modal.msgWarning("存在未设置编码单的任务单,请确认后再试!");
return Promise.reject(); // 或者返回一个已解决的Promise以停止链式调用
}
}) })
.then(() => { .then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("生成成功"); this.$modal.msgSuccess("生成成功");
}) })
.catch(() => { .catch(() => {
// 用户取消或出现错误时的处理
}); });
}, },
handleToolNumCheck() { handleToolNumCheck() {
this.$modal this.$modal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment