Files
FT501-WMS/ruoyi-ui/src/views/check/job/out/index.vue
2025-06-23 11:22:50 +08:00

597 lines
22 KiB
Vue

<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="$t('checkJobOut.jobId')" prop="jobId"> <!-- 任务ID -->
<el-input
v-model="queryParams.jobId"
:placeholder="$t('checkJobOut.inputJobId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('checkJobOut.status')" prop="status"> <!-- 任务状态 -->
<el-select v-model="queryParams.status" :placeholder="$t('checkJobOut.selectStatus')" clearable>
<el-option
v-for="dict in dict.type.mydo_job_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="上线类型" prop="onLineType">
<el-select v-model="queryParams.onLineType" placeholder="请选择上线类型" clearable>
<el-option
v-for="dict in dict.type.on_line_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>-->
<el-form-item :label="$t('checkJobOut.taskNo')" prop="taskNo"> <!-- 任务号 -->
<el-input
v-model="queryParams.taskNo"
:placeholder="$t('checkJobOut.inputTaskNo')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="供应商ID" prop="supplierId">
<el-input
v-model="queryParams.supplierId"
placeholder="请输入供应商ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="客户ID" prop="customerId">
<el-input
v-model="queryParams.customerId"
placeholder="请输入客户ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="部门ID" prop="departmentId">
<el-input
v-model="queryParams.departmentId"
placeholder="请输入部门ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('checkJobOut.trayCode')" prop="trayCode"> <!-- 托盘码 -->
<el-input
v-model="queryParams.trayCode"
:placeholder="$t('checkJobOut.inputTrayCode')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="巷道ID" prop="roadwayId">
<el-input
v-model="queryParams.roadwayId"
placeholder="请输入巷道ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="货位ID" prop="cargoSpaceId">
<el-input
v-model="queryParams.cargoSpaceId"
placeholder="请输入货位ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="目标巷道ID" prop="targetRoadwayId">
<el-input
v-model="queryParams.targetRoadwayId"
placeholder="请输入目标巷道ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('checkJobOut.targetCargoSpace')" prop="targetCargoSpaceId"> <!-- 目标货位 -->
<el-input
v-model="queryParams.targetCargoSpaceId"
:placeholder="$t('checkJobOut.inputTargetCargoSpace')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="产线ID" prop="lineId">
<el-input
v-model="queryParams.lineId"
placeholder="请输入产线ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="车间ID" prop="workshopId">
<el-input
v-model="queryParams.workshopId"
placeholder="请输入车间ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="优先级" prop="priority">
<el-input
v-model="queryParams.priority"
placeholder="请输入优先级"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('checkJobOut.executionPhase')" prop="executionPhase"> <!-- 执行阶段 -->
<el-select v-model="queryParams.executionPhase" :placeholder="$t('checkJobOut.selectExecutionPhase')" clearable>
<el-option
v-for="dict in dict.type.execution_phase_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('checkJobOut.jobType')" prop="inOrOut"> <!-- 任务类型 -->
<el-select v-model="queryParams.inOrOut" :placeholder="$t('checkJobOut.selectJobType')" clearable>
<el-option
v-for="dict in dict.type.check_out_job_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('checkJobOut.startTime')" prop="startTime"> <!-- 开始时间 -->
<el-date-picker clearable
v-model="queryParams.startTime"
type="date"
value-format="yyyy-MM-dd"
:placeholder="$t('checkJobOut.selectStartTime')">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('checkJobOut.finishTime')" prop="finishTime"> <!-- 结束时间 -->
<el-date-picker clearable
v-model="queryParams.finishTime"
type="date"
value-format="yyyy-MM-dd"
:placeholder="$t('checkJobOut.selectFinishTime')">
</el-date-picker>
</el-form-item>
<el-form-item :label="$t('checkJobOut.entranceId')" prop="entranceId"> <!-- 入口ID -->
<el-input
v-model="queryParams.entranceId"
:placeholder="$t('checkJobOut.inputEntranceId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item :label="$t('checkJobOut.exitId')" prop="exitId"> <!-- 出口ID -->
<el-input
v-model="queryParams.exitId"
:placeholder="$t('checkJobOut.inputExitId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="班组ID" prop="classId">
<el-input
v-model="queryParams.classId"
placeholder="请输入班组ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item :label="$t('checkJobOut.warehouse')" prop="warehouseId"> <!-- 仓库 -->
<el-input
v-model="queryParams.warehouseId"
:placeholder="$t('checkJobOut.inputWarehouseId')"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="重分标记" prop="faultFlag">
<el-input
v-model="queryParams.faultFlag"
placeholder="请输入重分标记"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{$t('checkJobOut.search')}}</el-button> <!-- 搜索 -->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('checkJobOut.reset')}}</el-button> <!-- 重置 -->
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-edit"
size="mini"
@click="handleCompletedManually({type: 'invalid'})"
v-hasPermi="['job:checkMydoJob:OuthandFinish']"
>{{$t('checkJobOut.manualInvalid')}}</el-button> <!-- 手动作废 -->
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
@click="handleCompletedManually({type: 'completed'})"
v-hasPermi="['job:job:checkMydoJob:OuthandInvalidation']"
>{{$t('checkJobOut.manualFinish')}}</el-button> <!-- 手动完成 -->
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['job:mydoJob:export']"
>导出</el-button>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="mydoJobList" @selection-change="handleSelectionChange" @row-click="handleRowClick">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('checkJobOut.jobId')" align="center" prop="jobId" /> <!-- 任务ID -->
<el-table-column :label="$t('checkJobOut.status')" align="center" prop="status"> <!-- 任务状态 -->
<template slot-scope="scope">
<dict-tag :options="dict.type.mydo_job_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column :label="$t('checkJobOut.onLineType')" align="center" prop="onLineType"> <!-- 上线类型 -->
<template slot-scope="scope">
<dict-tag :options="dict.type.on_line_type" :value="scope.row.onLineType"/>
</template>
</el-table-column>
<el-table-column :label="$t('checkJobOut.jobType')" align="center" prop="inOrOut"> <!-- 任务类型 -->
<template slot-scope="scope">
<dict-tag :options="dict.type.check_out_job_type" :value="scope.row.inOrOut"/>
</template>
</el-table-column>
<el-table-column :label="$t('checkJobOut.taskNo')" align="center" prop="taskNo" /> <!-- 任务号 -->
<el-table-column :label="$t('checkJobOut.departmentId')" align="center" prop="departmentId" /> <!-- 部门ID -->
<el-table-column :label="$t('checkJobOut.trayCode')" align="center" prop="trayCode" /> <!-- 托盘码 -->
<el-table-column :label="$t('checkJobOut.cargoSpaceId')" align="center" prop="cargoSpaceId" /> <!-- 货位ID -->
<el-table-column :label="$t('checkJobOut.priority')" align="center" prop="priority" /> <!-- 优先级 -->
<el-table-column :label="$t('checkJobOut.executionPhase')" align="center" prop="executionPhase"> <!-- 执行阶段 -->
<template slot-scope="scope">
<dict-tag :options="dict.type.execution_phase_type" :value="scope.row.executionPhase"/>
</template>
</el-table-column>
<el-table-column :label="$t('checkJobOut.startTime')" align="center" prop="startTime" width="180"> <!-- 开始时间 -->
<template slot-scope="scope">
<span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('checkJobOut.finishTime')" align="center" prop="finishTime" width="180"> <!-- 结束时间 -->
<template slot-scope="scope">
<span>{{ parseTime(scope.row.finishTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('checkJobOut.exitId')" align="center" prop="exitId" /> <!-- 出口ID -->
<el-table-column :label="$t('checkJobOut.warehouse')" align="center" prop="warehouseId" /> <!-- 仓库 -->
<el-table-column :label="$t('checkJobOut.operation')" align="center" class-name="small-padding fixed-width"> <!-- 操作 -->
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleManualFinish(scope.row)"
v-hasPermi="['job:checkMydoJob:OuthandFinish']"
>{{$t('checkJobOut.manualFinish')}}</el-button> <!-- 手动完成 -->
<el-button
size="mini"
type="text"
@click="handleManualInvalid(scope.row)"
v-hasPermi="['job:checkMydoJob:OuthandInvalidation']"
>{{$t('checkJobOut.manualInvalid')}}</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-table v-loading="loading" :data="mydoJobDetailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column :label="$t('checkJobOut.subJobId')" align="center" prop="jobDetailId" /> <!-- 子任务ID -->
<el-table-column :label="$t('checkJobOut.jobId')" align="center" prop="jobId" /> <!-- 任务ID -->
<el-table-column :label="$t('checkJobOut.stockId')" align="center" prop="stockId" /> <!-- 库存ID -->
<el-table-column :label="$t('checkJobOut.batchNo')" align="center" prop="lotNo" /> <!-- 批次号 -->
<!-- <el-table-column :label="$t('checkJobOut.inTime')" align="center" prop="inTime" width="180"> &lt;!&ndash; 入库时间 &ndash;&gt;-->
<!-- <template slot-scope="scope">-->
<!-- <span>{{ parseTime(scope.row.inTime, '{y}-{m}-{d}') }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column :label="$t('checkJobOut.billId')" align="center" prop="inOrOutId" /> <!-- 单据ID -->
<el-table-column :label="$t('checkJobOut.subBillId')" align="center" prop="productId" /> <!-- 子单据ID -->
<el-table-column :label="$t('checkJobOut.materialDesc')" align="center" prop="extraField.materialDesc" /> <!-- 物料编码 -->
<el-table-column :label="$t('checkJobOut.englishDesc')" align="center" prop="extraField.englishDesc" /> // 英文描述
<!-- <el-table-column :label="$t('checkJobOut.cartonNo')" align="center" prop="extraField.cartonNo" /> // 箱号-->
<!-- <el-table-column :label="$t('checkJobOut.packingMethod')" align="center" prop="extraField.packingMethod" /> // 包装方式-->
<el-table-column :label="$t('checkJobOut.netWeight')" align="center" prop="extraField.netWeight" /> // 净重
<!-- <el-table-column :label="$t('checkJobOut.totalNetWeight')" align="center" prop="extraField.totalNetWeight" /> // 总净重-->
<!-- <el-table-column :label="$t('checkJobOut.grossWeight')" align="center" prop="extraField.grossWeight" /> // 毛重-->
<el-table-column :label="$t('checkJobOut.outQuantity')" align="center" prop="outQuantity" /> // 出库数量
<el-table-column :label="$t('checkJobOut.pickQuantity')" align="center" prop="pickQuantity" /> // 拣选数量
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="queryDetailParams.pageNum"
:limit.sync="queryDetailParams.pageSize"
@pagination="getDetailList"
/>
</div>
</template>
<script>
import { listMydoJobOut } from "@/api/job/OutmydoJob"
import { listMydoJobDetail } from "@/api/job/mydoJobDetail"
export default {
name: "MydoJob",
dicts: ['execution_phase_type', 'check_out_job_type', 'on_line_type', 'mydo_job_status'],
data() {
return {
// 遮罩层
loading: true,
detailLoading:false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
detailTotal: 0,
// 任务表表格数据
mydoJobList: [],
// 子任务表表格数据
mydoJobDetailList:[],
// 当前选中行
currentRow:null,
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
jobId: null,
status: '1',
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null,
inOut: '4'
},
queryDetailParams:{
pageNum: 1,
pageSize: 10,
jobId: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
jobId: [
{ required: true, message: this.$t('checkJobOut.inputJobId'), trigger: 'blur' }
],
status: [
{ required: true, message: this.$t('checkJobOut.selectStatus'), trigger: 'change' }
],
taskNo: [
{ required: true, message: this.$t('checkJobOut.inputTaskNo'), trigger: 'blur' }
],
}
}
},
created() {
// 获取字典数据后,设置默认值
this.getList()
},
methods: {
/** 查询任务表列表 */
getList() {
this.loading = true
listMydoJobOut(this.queryParams).then(response => {
this.mydoJobList = response.rows
this.total = response.total
this.loading = false
// 如果有数据,自动选中第一行
if (this.mydoJobList.length > 0) {
this.handleRowClick(this.mydoJobList[0]);
}
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
jobId: null,
status: null,
onLineType: null,
taskNo: null,
supplierId: null,
customerId: null,
departmentId: null,
trayCode: null,
roadwayId: null,
cargoSpaceId: null,
targetRoadwayId: null,
targetCargoSpaceId: null,
lineId: null,
workshopId: null,
priority: null,
executionPhase: null,
inOrOut: null,
createTime: null,
startTime: null,
finishTime: null,
entranceId: null,
exitId: null,
classId: null,
warehouseId: null,
faultFlag: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
// 清空子表数据
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.currentRow = null;
this.queryDetailParams.jobId = null;
// 重新查询主表数据
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
// 只处理主表的多选
if (selection.length > 0 && selection[0].hasOwnProperty('jobDetailId')) {
return;
}
this.ids = selection.map(item => item.jobId);
this.single = selection.length!==1;
this.multiple = !selection.length;
},
// 手动完成/作废
handleCompletedManually(row) {
const jobIds = this.ids;
if (jobIds.length === 0) {
this.$modal.msgError(this.$t('checkJobOut.selectData')); // 请选择要操作的数据
return;
}
if (row.type === 'invalid'){
//手动作废
}else if (row.type === 'completed'){
//手动完成
}
},
/** 导出按钮操作 */
handleExport() {
this.download('job/mydoJob/export', {
...this.queryParams
}, `mydoJob_${new Date().getTime()}.xlsx`)
},
/** 行点击事件处理 */
handleRowClick(row) {
// 设置当前选中行
this.currentRow = row;
// 更新子表格查询参数
this.queryDetailParams.jobId = row.jobId;
this.queryDetailParams.status = row.status;
// 查询子表格数据
this.getDetailList();
},
/** 查询子任务表列表 */
getDetailList() {
// 如果没有选中的主任务,不加载子任务
if (!this.queryDetailParams.jobId) {
this.mydoJobDetailList = [];
this.detailTotal = 0;
this.detailLoading = false;
return;
}
this.detailLoading = true;
listMydoJobDetail(this.queryDetailParams).then(response => {
this.mydoJobDetailList = response.rows;
this.detailTotal = response.total;
this.detailLoading = false;
});
},
/** 手动完成按钮操作 */
handleManualFinish(row) {
const jobIds = row.jobId || this.ids;
if (jobIds.length === 0) {
this.$modal.msgError(this.$t('checkJobOut.selectData'));
return;
}
this.$modal.confirm(this.$t('checkJobOut.confirmFinish', { jobIds: jobIds })).then(function() {
return manualFinish(jobIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess(this.$t('checkJobOut.finishSuccess'));
}).catch(() => {});
},
/** 手动作废按钮操作 */
handleManualInvalid(row) {
const jobIds = row.jobId || this.ids;
if (jobIds.length === 0) {
this.$modal.msgError(this.$t('checkJobOut.selectData'));
return;
}
this.$modal.confirm(this.$t('checkJobOut.confirmInvalid', { jobIds: jobIds })).then(function() {
return manualInvalid(jobIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess(this.$t('checkJobOut.invalidSuccess'));
}).catch(() => {});
},
}
}
</script>
<style scoped>
.el-table >>> .current-row {
background-color: #f0f9eb;
}
</style>