|
|
<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="workorderCode">
|
|
|
<el-input
|
|
|
v-model="queryParams.workorderCode"
|
|
|
placeholder="请输入工单编码"
|
|
|
clearable
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="工单状态" prop="status">
|
|
|
<el-select
|
|
|
v-model="queryParams.status"
|
|
|
placeholder="工单状态"
|
|
|
clearable
|
|
|
style="width: 240px"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="dict in dict.type.workorder_type"
|
|
|
:key="dict.value"
|
|
|
:label="dict.label"
|
|
|
:value="dict.value"
|
|
|
/>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="订单编码" prop="orderCode">
|
|
|
<el-input
|
|
|
v-model="queryParams.orderCode"
|
|
|
placeholder="请输入订单编码"
|
|
|
clearable
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="产品名称" prop="productName">
|
|
|
<el-input
|
|
|
v-model="queryParams.productName"
|
|
|
placeholder="请输入产品名称"
|
|
|
clearable
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="工艺编码" prop="routeCode">
|
|
|
<el-input
|
|
|
v-model="queryParams.routeCode"
|
|
|
placeholder="请输入工艺编码"
|
|
|
clearable
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="产线编码" prop="prodLineCode">
|
|
|
<el-input
|
|
|
v-model="queryParams.prodLineCode"
|
|
|
placeholder="请输入产线编码"
|
|
|
clearable
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="生产日期" prop="productDateArray">
|
|
|
<el-date-picker
|
|
|
v-model="queryParams.productDateArray"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
type="daterange"
|
|
|
range-separator="至"
|
|
|
start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="班次" prop="shiftId">
|
|
|
<el-select v-model="queryParams.shiftId" placeholder="请选择班次" clearable>
|
|
|
<el-option v-for="item in workShift" :key="item.shiftId" :label="item.shiftDesc"
|
|
|
:value="item.shiftId"
|
|
|
></el-option>
|
|
|
</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="success"
|
|
|
plain
|
|
|
icon="el-icon-info"
|
|
|
size="mini"
|
|
|
:disabled="multiple"
|
|
|
@click="handleUpdateDown"
|
|
|
v-hasPermi="['mes:bppro:workorder:edit']"
|
|
|
>派发工单
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
|
type="warning"
|
|
|
plain
|
|
|
icon="el-icon-edit"
|
|
|
size="mini"
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
v-hasPermi="['mes:bppro:workorder: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="['mes:bppro:workorder: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="['mes:bppro:workorder:export']"
|
|
|
>导出
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
|
type="success"
|
|
|
plain
|
|
|
:disabled="single"
|
|
|
icon="el-icon-download"
|
|
|
size="mini"
|
|
|
@click="showPrint"
|
|
|
v-hasPermi="['mes:bppro:workorder:export']"
|
|
|
>打印预览
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
|
type="warning"
|
|
|
plain
|
|
|
icon="el-icon-edit"
|
|
|
size="mini"
|
|
|
:disabled="single"
|
|
|
@click="handleDetail"
|
|
|
>工单详情
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
|
type="warning"
|
|
|
plain
|
|
|
icon="el-icon-edit"
|
|
|
size="mini"
|
|
|
:disabled="single"
|
|
|
@click="editMachine"
|
|
|
v-hasPermi="['mes:bppro:workorder:edit']"
|
|
|
>设备修改
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
plain
|
|
|
icon="el-icon-delete"
|
|
|
size="mini"
|
|
|
:disabled="multiple"
|
|
|
@click="deleteWetMaterial"
|
|
|
v-hasPermi="['mes:bppro:workorder:edit']"
|
|
|
>湿料计划删除</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="primary" plain icon="el-icon-guide" size="mini"
|
|
|
@click="handleAutoSplit"
|
|
|
>辅助排产
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="primary" plain icon="el-icon-s-order" size="mini"
|
|
|
@click="handleBom"
|
|
|
:disabled="single">物料BOM
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button type="primary" plain icon="el-icon-guide" size="mini"
|
|
|
@click="handleSAPSync"
|
|
|
>SAP同步
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table v-loading="loading" :data="workorderList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" align="center">
|
|
|
|
|
|
</el-table-column>
|
|
|
<el-table-column label="工单ID" align="center" prop="workorderId" v-if="false"/>
|
|
|
<el-table-column width="160" label="子工单编号" align="center" prop="workorderCode"/>
|
|
|
<el-table-column label="订单id" align="center" prop="orderId" v-if="false"/>
|
|
|
<el-table-column width="150" label="子订单编码" align="center" prop="orderCode"/>
|
|
|
<el-table-column label="产品ID" align="center" prop="productId" v-if="false"/>
|
|
|
<el-table-column width="120" label="产品编码" align="center" prop="productCode"
|
|
|
:formatter="productCodeFormate"
|
|
|
/>
|
|
|
<el-table-column width="180" label="产品名称" align="center" prop="productName"/>
|
|
|
<el-table-column label="规格型号" align="center" prop="productSpc" v-if="false"/>
|
|
|
<el-table-column width="100" label="投料编码" align="center" prop="materialCode" v-if="false"/>
|
|
|
<el-table-column width="100" label="投料名称" align="center" prop="materialName"/>
|
|
|
<!--
|
|
|
<el-table-column label="子单批次信息" width="300" align="center" prop="batchInfo">
|
|
|
<template slot-scope="scope">
|
|
|
<div v-for="item in scope.row.batchInfo">{{ item }}</div>
|
|
|
</template>
|
|
|
</el-table-column>-->
|
|
|
<el-table-column width="90" label="派工数量" align="center" prop="quantitySplit"/>
|
|
|
<el-table-column width="50" label="单位" align="center" prop="unit"/>
|
|
|
<el-table-column width="90" label="工艺编码" align="center" prop="routeCode"/>
|
|
|
<el-table-column width="180" label="工艺名称" align="center" prop="routeName" />
|
|
|
<!-- show-overflow-tooltip -->
|
|
|
<el-table-column width="300" label="产线设备" align="center" >
|
|
|
<template slot-scope="scope">
|
|
|
<el-popover width="250" placement="top-start" trigger="hover" :content="scope.row.prodLineName">
|
|
|
<span slot="reference" class="btn">{{ scope.row.prodLineName }}</span>
|
|
|
</el-popover>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column width="130" label="产线设备编码" align="center" prop="prodLineCode" v-if="false"/>
|
|
|
<el-table-column width="100" label="工单生产日期" align="center" prop="productDate">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ parseTime(scope.row.productDate, '{y}-{m}-{d}') }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="班次" align="center" prop="shiftId" :formatter="shiftFormat">
|
|
|
</el-table-column>
|
|
|
|
|
|
<el-table-column label="工单状态" align="center" prop="status">
|
|
|
<template slot-scope="scope">
|
|
|
<dict-tag :options="dict.type.workorder_type" :value="scope.row.status"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column label="备注" align="center" prop="remark" />-->
|
|
|
<el-table-column label="产品类型" align="center" prop="prodType">
|
|
|
<template slot-scope="scope">
|
|
|
<dict-tag :options="dict.type.product_type" :value="scope.row.prodType"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<!-- 打印预览弹出层 -->
|
|
|
<el-dialog
|
|
|
title="工单信息"
|
|
|
:visible.sync="printDialogVisible"
|
|
|
width="1450px"
|
|
|
>
|
|
|
<div id="printFrom" class="my-print-box">
|
|
|
|
|
|
<el-form :ref="formRef" :model="form" :rules="validateRules">
|
|
|
|
|
|
<!-- 表头-工单信息 -->
|
|
|
<el-row class="my-print-head">
|
|
|
<el-col :offset="10" :span="4">生产工单</el-col>
|
|
|
</el-row>
|
|
|
<!-- 导航栏 -->
|
|
|
<el-row class="my-print-nav">
|
|
|
<el-col :span="4">工厂:{{ printData.factory }}</el-col>
|
|
|
<el-col :span="4">工作中心:{{ printData.workCenter }}</el-col>
|
|
|
<el-col :span="4">生产日期:{{ printData.productDate }}</el-col>
|
|
|
<el-col :span="4">打印日期:{{ printData.printDate }}</el-col>
|
|
|
<el-col :span="4">页次: 1/ 1</el-col>
|
|
|
</el-row>
|
|
|
<!-- 主数据 -->
|
|
|
<el-table
|
|
|
v-if="refreshNewWorkerTable"
|
|
|
v-loading="newWorkerLoading"
|
|
|
class="my-print-table"
|
|
|
:data="printData.workTable"
|
|
|
border
|
|
|
style="width: 100%">
|
|
|
<el-table-column
|
|
|
type="index"
|
|
|
label="序号"
|
|
|
width="50">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="workorderCode"
|
|
|
label="工单号"
|
|
|
width="180">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="productName"
|
|
|
label="物料名称"
|
|
|
width="180">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="unit"
|
|
|
label="单位">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="orderCode"
|
|
|
label="生产订单">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="quantityProduced"
|
|
|
label="已生产数量">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="quantitySplit"
|
|
|
label="拆分数量">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="routeCode"
|
|
|
label="工艺编码">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
prop="prodLineCode"
|
|
|
label="产线设备">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="班次" align="center" prop="shiftId" :formatter="shiftFormat">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="工单状态" align="center" prop="status">
|
|
|
<template slot-scope="scope">
|
|
|
<dict-tag :options="dict.type.workorder_type" :value="scope.row.status"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="产品类型" align="center" prop="prodType">
|
|
|
<template slot-scope="scope">
|
|
|
<dict-tag :options="dict.type.product_type" :value="scope.row.prodType"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<br/>
|
|
|
<!-- 底部 -->
|
|
|
<el-row class="my-print-foot">
|
|
|
<el-col :offset="1" :span="3">SAP-No:{{ printData.SAPNo }}</el-col>
|
|
|
<el-col :offset="1" :span="3">Z-PM-F-030-A.1</el-col>
|
|
|
</el-row>
|
|
|
<el-row class="my-print-foot">
|
|
|
<el-col :offset="1" :span="3">制单人:{{ printData.manufacture }}</el-col>
|
|
|
<el-col :offset="1" :span="3">审核人:{{ printData.auditor }}</el-col>
|
|
|
</el-row>
|
|
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="handlePrint(printData)">打 印</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
|
|
|
<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="1000px" append-to-body>
|
|
|
<!-- 拆分头pro -->
|
|
|
<el-table
|
|
|
border
|
|
|
v-if="refreshProTable"
|
|
|
v-loading="proLoading"
|
|
|
:data="productData"
|
|
|
row-key="orderCode"
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
>
|
|
|
<el-table-column width="60" align="center" label="序号" type="index"></el-table-column>
|
|
|
<el-table-column width="150" label="订单编号" prop="orderCode"/>
|
|
|
<el-table-column width="380" label="产品名称" align="center" prop="prodDesc"/>
|
|
|
<el-table-column width="60" label="单位" align="center" prop="unit"/>
|
|
|
<el-table-column width="130" label="产品数量" align="center" prop="quantity"/>
|
|
|
<el-table-column label="已拆分数量" align="center" prop="quantitySplit"/>
|
|
|
<el-table-column label="拆分数量" align="center" prop="atrr1"/>
|
|
|
</el-table>
|
|
|
<el-form class="my-margin" :model="splitForm" ref="dynamicForm" label-width="80px">
|
|
|
<!-- 编辑框 -->
|
|
|
<!-- 第一行 -->
|
|
|
<el-row>
|
|
|
<el-col :span="7">
|
|
|
<!-- 选择工艺 -->
|
|
|
<el-form-item size="small" label="选择工艺:" class="my-select my-first">
|
|
|
<el-select @change="routeChange" v-model="splitForm.routeCode" placeholder="请选择工艺">
|
|
|
<el-option v-for="item in routes" :key="item.routeCode" :label="item.routeName"
|
|
|
:value="item.routeCode"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :offset="1" :span="7">
|
|
|
<!-- 工单日期 -->
|
|
|
<el-form-item size="small" label="工单日期: ">
|
|
|
<el-date-picker @change="checkDate" v-model="splitForm.productDate" type="date" placeholder="选择日期"
|
|
|
></el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :offset="1" :span="7">
|
|
|
<!-- 选择班次 -->
|
|
|
<el-form-item size="small" label="选择班次:" class="my-select my-first">
|
|
|
<el-select @change="shiftChange" v-model="splitForm.shiftId" placeholder="请选择班次" clearable>
|
|
|
<el-option v-for="item in workShift" :key="item.shiftId" :label="item.shiftDesc"
|
|
|
:value="item.shiftId"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<!-- 第二行 -->
|
|
|
<el-row>
|
|
|
<div v-if="splitForm.prodType == 'white'">
|
|
|
<el-col :span="7">
|
|
|
<!-- 选择物料 -->
|
|
|
<el-form-item size="small" label="投料名称:">
|
|
|
<el-input @focus="selectBPMateriel" readonly v-model="splitForm.materialName" placeholder="点击选择物料"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item size="small" label="投料编码:">
|
|
|
<el-input readonly v-model="splitForm.materialCode" placeholder="点击选择物料" disabled/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :offset="1" :span="7">
|
|
|
<!-- 拆分数量 -->
|
|
|
<el-form-item size="small" label="拆分数量:">
|
|
|
<el-input required type="number" @input="splitNumChange" v-model="splitForm.splitNum"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<el-col :span="7">
|
|
|
<!-- 拆分数量 -->
|
|
|
<el-form-item size="small" label="拆分数量:">
|
|
|
<el-input required type="number" @input="splitNumChange" v-model="splitForm.splitNum"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</div>
|
|
|
<el-col :offset="1" :span="7">
|
|
|
<!-- 车数 -->
|
|
|
<el-form-item v-if="checkType" size="small" label="分配车数:">
|
|
|
<el-input disabled type="number" @input="changeCarNum" v-model="splitForm.carNum"></el-input>
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item v-else label="工单排序(插单<=0)" label-width="130px">
|
|
|
<el-input type="number" v-model="splitForm.sortNo" disabled></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="7">
|
|
|
<el-form-item label="选择设备:">
|
|
|
<div style="height: 130px;overflow-y: auto;">
|
|
|
<el-cascader
|
|
|
:options="eRouteOptions"
|
|
|
:props="eRouteProps"
|
|
|
v-model="splitForm.prodLineCodeArray"
|
|
|
clearable></el-cascader>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<!-- 第三行 -->
|
|
|
<el-row v-for="(item, index) in formFields" :key="index">
|
|
|
<!-- 批次编号 -->
|
|
|
<el-col :span="7">
|
|
|
<el-form-item size="small" label="批次编号">
|
|
|
<el-input @blur="batchCodeChange" v-model="item.batchCode"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<!-- 批次数量 -->
|
|
|
<el-col :offset="1" :span="7">
|
|
|
<el-form-item size="small" label="批次数量">
|
|
|
<el-input required @input="inBatch" type="number" v-model="item.batchQuantity"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<!-- 操作 -->
|
|
|
<el-col :offset="1" :span="4">
|
|
|
<el-button size="small" v-if="formFields.length > 1" @click="removeField(index)" type="danger">删除
|
|
|
</el-button>
|
|
|
<el-button size="small" v-if="index === formFields.length - 1" @click="addField" type="primary">添加
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<!-- 拆分尾 -->
|
|
|
<el-table
|
|
|
border
|
|
|
:data="splitData"
|
|
|
v-if="refreshWorkerTable"
|
|
|
v-loading="workerLoading"
|
|
|
row-key="workorderCode"
|
|
|
style="width: 100%"
|
|
|
max-height="240"
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
>
|
|
|
<el-table-column width="60" align="center" label="序号" type="index"></el-table-column>
|
|
|
<el-table-column width="200" align="center" prop="workorderCode" label="工单号"></el-table-column>
|
|
|
<el-table-column width="100" align="center" prop="productDate" label="工单日期"></el-table-column>
|
|
|
<el-table-column width="150" align="center" label="生产线体设备">
|
|
|
<template slot-scope="scope">
|
|
|
<el-popover width="250" placement="top-start" trigger="hover" :content="scope.row.prodLineCode">
|
|
|
<span slot="reference" class="btn">{{ scope.row.prodLineCode }}</span>
|
|
|
</el-popover>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column width="80" align="center" prop="quantitySplit" label="数量"></el-table-column>
|
|
|
<el-table-column width="60" label="单位" align="center" prop="unit"/>
|
|
|
<el-table-column width="90" label="工艺编码" align="center" prop="routeCode"/>
|
|
|
<el-table-column width="90" label="班次" align="center" prop="shiftDesc" :formatter="shiftFormat"/>
|
|
|
<el-table-column align="center" width="230" prop="batchCodeList" label="批次号"></el-table-column>
|
|
|
<el-table-column align="center" width="150" prop="batchNumList" label="批次数量"></el-table-column>
|
|
|
</el-table>
|
|
|
<!-- 测试 -->
|
|
|
<el-row style="margin-top: 20px">
|
|
|
<el-steps :active="3">
|
|
|
<el-step title="成型" :description="totalQuantity_cx"></el-step>
|
|
|
<el-step title="烘房" :description="totalQuantity_hf"></el-step>
|
|
|
<el-step title="收坯" :description="totalQuantity_hf"></el-step>
|
|
|
</el-steps>
|
|
|
</el-row>
|
|
|
|
|
|
<!-- 操作按钮 -->
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitForm" v-if="showDetail">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<!--组成白坯物料选择弹窗-->
|
|
|
<el-dialog
|
|
|
width="800px"
|
|
|
title="物料选择"
|
|
|
:visible.sync="innerBPVisible"
|
|
|
append-to-body>
|
|
|
|
|
|
<el-form :model="materielParams" ref="queryBPForm" size="small" :inline="true" v-show="showSearch"
|
|
|
label-width="68px">
|
|
|
<el-form-item label="物料编码" prop="productCode">
|
|
|
<el-input
|
|
|
v-model="materielParams.productCode"
|
|
|
placeholder="请输入物料编码"
|
|
|
clearable
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="物料名称" prop="productCode">
|
|
|
<el-input
|
|
|
v-model="materielParams.productDescZh"
|
|
|
placeholder="请输入物料名称"
|
|
|
clearable
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleMaterielQuery">搜索</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="materielList" @selection-change="selectionChange">
|
|
|
<el-table-column type="selection" width="55" align="center"/>
|
|
|
<el-table-column width="60" align="center" label="序号" type="index"></el-table-column>
|
|
|
<el-table-column label="物料编码" align="center" prop="productCode"/>
|
|
|
<el-table-column label="物料名称" align="center" prop="productDescZh"/>
|
|
|
</el-table>
|
|
|
|
|
|
<pagination
|
|
|
v-show="total>0"
|
|
|
:total="total"
|
|
|
:page.sync="materielParams.pageNum"
|
|
|
:limit.sync="materielParams.pageSize"
|
|
|
@pagination="getBPMaterielList"
|
|
|
/>
|
|
|
|
|
|
<el-button @click="subMaterielBP" class="my-materiel-btn" type="primary">确定</el-button>
|
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- 工单设备修改模块 -->
|
|
|
<el-dialog :title="titleM" :visible.sync="openM" width="1000px" append-to-body>
|
|
|
<el-table
|
|
|
border
|
|
|
v-if="refreshProTable"
|
|
|
v-loading="proLoading"
|
|
|
:data="productData"
|
|
|
row-key="orderCode"
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
>
|
|
|
<el-table-column width="60" align="center" label="序号" type="index"></el-table-column>
|
|
|
<el-table-column width="150" label="订单编号" prop="orderCode"/>
|
|
|
<el-table-column width="380" label="产品名称" align="center" prop="prodDesc"/>
|
|
|
<el-table-column width="60" label="单位" align="center" prop="unit"/>
|
|
|
<el-table-column width="130" label="产品数量" align="center" prop="quantity"/>
|
|
|
<el-table-column label="已拆分数量" align="center" prop="quantitySplit"/>
|
|
|
<el-table-column label="拆分数量" align="center" prop="atrr1"/>
|
|
|
</el-table>
|
|
|
<el-form class="my-margin" :model="splitFormM" ref="dynamicForm" label-width="80px">
|
|
|
<el-row>
|
|
|
<el-col :span="7">
|
|
|
<el-form-item label="选择设备:">
|
|
|
<div style="height: 130px;overflow-y: auto;">
|
|
|
<el-cascader
|
|
|
:options="eRouteOptionsM"
|
|
|
:props="eRouteProps"
|
|
|
v-model="splitFormM.prodLineCodeArray"
|
|
|
clearable></el-cascader>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<!-- 拆分尾 -->
|
|
|
<el-table
|
|
|
border
|
|
|
:data="splitData"
|
|
|
v-if="refreshWorkerTable"
|
|
|
v-loading="workerLoading"
|
|
|
row-key="workorderCode"
|
|
|
style="width: 100%"
|
|
|
max-height="240"
|
|
|
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
|
|
>
|
|
|
<el-table-column width="60" align="center" label="序号" type="index"></el-table-column>
|
|
|
<el-table-column width="200" align="center" prop="workorderCode" label="工单号"></el-table-column>
|
|
|
<el-table-column width="100" align="center" prop="productDate" label="工单日期"></el-table-column>
|
|
|
<el-table-column width="150" align="center" label="生产线体设备">
|
|
|
<template slot-scope="scope">
|
|
|
<el-popover width="250" placement="top-start" trigger="hover" :content="scope.row.prodLineCode">
|
|
|
<span slot="reference" class="btn">{{ scope.row.prodLineCode }}</span>
|
|
|
</el-popover>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column width="80" align="center" prop="quantitySplit" label="数量"></el-table-column>
|
|
|
<el-table-column width="60" label="单位" align="center" prop="unit"/>
|
|
|
<el-table-column width="90" label="工艺编码" align="center" prop="routeCode"/>
|
|
|
<el-table-column width="90" label="班次" align="center" prop="shiftDesc" :formatter="shiftFormat"/>
|
|
|
<el-table-column align="center" width="230" prop="batchCodeList" label="批次号"></el-table-column>
|
|
|
<el-table-column align="center" width="150" prop="batchNumList" label="批次数量"></el-table-column>
|
|
|
</el-table>
|
|
|
<!-- 测试 -->
|
|
|
<!-- 操作按钮 -->
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button type="primary" @click="submitFormM">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
<!--检验项目弹窗-->
|
|
|
<ItemBoms ref="itemSelectProject"></ItemBoms>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
getWorkOrders,
|
|
|
listWorkorder,
|
|
|
delWorkorder,
|
|
|
downWorkorder,
|
|
|
getOrderAndWork,getProSortNo,
|
|
|
getWorkBatchList,
|
|
|
subChangeWorkOrder,subChangeWorkOrderM,
|
|
|
checkWorkOrder,
|
|
|
deleteWetMaterial
|
|
|
} from '@/api/plan/bpworkorder'
|
|
|
import moment from 'moment';
|
|
|
import { getProEquipment, getProRoutes, getProShifts,selectMaterielList} from '@/api/plan/order'
|
|
|
import {prototype} from "clipboard";
|
|
|
import {getHourProductionList} from '@/api/plan/whiteOrder';
|
|
|
import ItemBoms from "./bpBome.vue";
|
|
|
export default {
|
|
|
name: "WorkorderBP",
|
|
|
components: { ItemBoms},
|
|
|
dicts: ['product_type', 'workorder_type'],
|
|
|
data() {
|
|
|
return {
|
|
|
// 拆分车数换算值
|
|
|
converCarNum: null,
|
|
|
// 变更校验车数书否显示
|
|
|
checkType: false,
|
|
|
// 暂存线体code
|
|
|
proLineCode: null,
|
|
|
titleM: '',
|
|
|
// 打印
|
|
|
formRef: 'form',
|
|
|
validateRules: [],
|
|
|
materielList:[],
|
|
|
printData: {
|
|
|
printable: 'printFrom',
|
|
|
ignore: ['no-print'],
|
|
|
workCenter: "暂无数据",
|
|
|
SAPNo: null,
|
|
|
manufacture: null,
|
|
|
auditor: null,
|
|
|
printDate: null,
|
|
|
factory: null,
|
|
|
productDate: null,
|
|
|
workTable: [],
|
|
|
},
|
|
|
printDialogVisible: false,
|
|
|
// 工单修改form
|
|
|
workForm: {},
|
|
|
// 首页-多选选中-用于工单变更
|
|
|
selectWork: null,
|
|
|
//工单遮罩层
|
|
|
workerLoading: false,
|
|
|
newWorkerLoading: false,
|
|
|
//工单重新渲染表格
|
|
|
refreshWorkerTable: true,
|
|
|
refreshNewWorkerTable: true,
|
|
|
// 拆分后工单list
|
|
|
splitData: [],
|
|
|
// 批次
|
|
|
formFields: [{
|
|
|
batchCode: '',
|
|
|
batchQuantity: ''
|
|
|
}],
|
|
|
// 工艺list
|
|
|
routes: [],
|
|
|
// 班次list
|
|
|
workShift: [],
|
|
|
// 成型机list
|
|
|
proline: [],
|
|
|
// 订单
|
|
|
productData: [],
|
|
|
// 订单遮罩层
|
|
|
proLoading: false,
|
|
|
// 订单重新渲染表格
|
|
|
refreshProTable: true,
|
|
|
// 拆分form
|
|
|
splitForm: {
|
|
|
prodLineCodeArray: [],
|
|
|
splitNum: null,
|
|
|
productDate: null,
|
|
|
shiftId: null,
|
|
|
routeCode: null,
|
|
|
carNum: 0,
|
|
|
prodType:null,
|
|
|
materialCode:null,
|
|
|
materialName:null
|
|
|
},
|
|
|
splitFormM: {
|
|
|
prodLineCodeArray: []
|
|
|
},
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
// 选中数组
|
|
|
ids: [],
|
|
|
cods: [],
|
|
|
// 非单个禁用
|
|
|
single: true,
|
|
|
// 非多个禁用
|
|
|
multiple: true,
|
|
|
// 下达禁用
|
|
|
statuses: [],
|
|
|
// 显示搜索条件
|
|
|
showSearch: true,
|
|
|
// 总条数
|
|
|
total: 0,
|
|
|
//成型产量
|
|
|
totalQuantity_cx: 0,
|
|
|
totalQuantity_hf: 0,
|
|
|
// 生产工单表格数据
|
|
|
workorderList: [],
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
openM:false,
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
productDateArray: [new Date(), new Date()],
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
workorderCode: null,
|
|
|
workorderName: null,
|
|
|
orderId: null,
|
|
|
orderCode: null,
|
|
|
productId: null,
|
|
|
productCode: null,
|
|
|
productName: null,
|
|
|
productSpc: null,
|
|
|
unit: null,
|
|
|
quantityProduced: null,
|
|
|
quantitySplit: null,
|
|
|
routeCode: null,
|
|
|
prodLineCode: null,
|
|
|
productDate: new Date(),
|
|
|
shiftId: null,
|
|
|
parentOrder: null,
|
|
|
ancestors: null,
|
|
|
status: 'w0',
|
|
|
attr1: null,
|
|
|
attr2: null,
|
|
|
attr3: null,
|
|
|
attr4: null,
|
|
|
prodType: null,
|
|
|
factoryCode: null,
|
|
|
endFlag: null
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
workorderCode: [
|
|
|
{required: true, message: "工单编码不能为空", trigger: "blur"}
|
|
|
],
|
|
|
workorderName: [
|
|
|
{required: true, message: "工单名称不能为空", trigger: "blur"}
|
|
|
],
|
|
|
orderId: [
|
|
|
{required: true, message: "订单id不能为空", trigger: "blur"}
|
|
|
],
|
|
|
productCode: [
|
|
|
{required: true, message: "产品编号不能为空", trigger: "blur"}
|
|
|
],
|
|
|
productName: [
|
|
|
{required: true, message: "产品名称不能为空", trigger: "blur"}
|
|
|
],
|
|
|
unit: [
|
|
|
{required: true, message: "单位不能为空", trigger: "blur"}
|
|
|
],
|
|
|
},
|
|
|
/**********************************/
|
|
|
eRouteProps: {multiple: true},
|
|
|
eRouteOptions: [],
|
|
|
eRouteOptionsM: [],
|
|
|
// 班次
|
|
|
workShift: [],
|
|
|
//组成白坯物料弹窗
|
|
|
innerBPVisible: false,
|
|
|
materielParams: {
|
|
|
mtart: 'material_type1',
|
|
|
productCode: null,
|
|
|
productDescZh: null,
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
},
|
|
|
materielBP: [],
|
|
|
showDetail:true
|
|
|
};
|
|
|
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
// 获取班次信息
|
|
|
getProShifts().then(response => {
|
|
|
this.workShift = response.data
|
|
|
})
|
|
|
},
|
|
|
methods: {
|
|
|
//产品编码格式化
|
|
|
productCodeFormate(row, column, cellValue){
|
|
|
if(cellValue.length>11){
|
|
|
return cellValue.slice(7,18); //返回值
|
|
|
}else{
|
|
|
return cellValue; //返回值
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
// 新增-物料搜索
|
|
|
handleMaterielQuery() {
|
|
|
this.materielQueryParams.pageNum = 1;
|
|
|
this.getMaterielList();
|
|
|
},
|
|
|
|
|
|
// 变更-车数数量校验
|
|
|
changeCarNum(num) {
|
|
|
|
|
|
|
|
|
// 请先输入订单数量
|
|
|
if (this.splitForm.splitNum == null) {
|
|
|
this.$message({
|
|
|
message: '请先输入拆分数量!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
this.splitForm.carNum = null;
|
|
|
return
|
|
|
}
|
|
|
// 车数不能超过拆分数量
|
|
|
if (Number(this.splitForm.splitNum) - Number(num) < 0) {
|
|
|
this.$message({
|
|
|
message: '车数不能超过拆分数量!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
num = this.splitForm.splitNum
|
|
|
this.splitForm.carNum = num;
|
|
|
}
|
|
|
// 不能为负数
|
|
|
if (num <= 0) {
|
|
|
this.$message({
|
|
|
message: '车数数量不能小于0!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
num = 1;
|
|
|
this.splitForm.carNum = num;
|
|
|
}
|
|
|
this.workForm.carNum = num;
|
|
|
},
|
|
|
// 派发-工单派发按钮操作
|
|
|
handleUpdateDown(row) {
|
|
|
var statusesArray = this.statuses;
|
|
|
/**
|
|
|
for (var i = 0; i < statusesArray.length; i++) {
|
|
|
if (statusesArray[i] == 'w1') {//已经下达的不允许操作
|
|
|
this.$modal.msgError("已经下达的订单不允许操作");
|
|
|
return
|
|
|
}
|
|
|
}**/
|
|
|
this.loading = true;
|
|
|
let _this = this;
|
|
|
const workorderIds = row.workorderCode || this.codes;
|
|
|
this.$modal.confirm('是否确认下发生产工单编号为"' + workorderIds + '"的数据项?').then(function () {
|
|
|
|
|
|
return downWorkorder(workorderIds);
|
|
|
}).then(() => {
|
|
|
this.loading = false;
|
|
|
this.getList();
|
|
|
}).catch(
|
|
|
function (e) {
|
|
|
if (e == 'cancel') {
|
|
|
_this.loading = false;
|
|
|
} else if(e == 'close') {
|
|
|
_this.loading = false;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
// 变更-工单变更按钮操作
|
|
|
handleUpdate(row) {
|
|
|
// 校验是否可以修改
|
|
|
checkWorkOrder(this.selectWork.workorderId).then(response => {
|
|
|
if (response.code == 500) {
|
|
|
this.$message({
|
|
|
message: '工单已生产,不可变更!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
// 数据初始化
|
|
|
this.reset();
|
|
|
this.splitData = [];
|
|
|
this.productData = [];
|
|
|
this.splitForm = {
|
|
|
prodLineCodeArray: [],
|
|
|
splitNum: null,
|
|
|
productDate: null,
|
|
|
shiftId: null,
|
|
|
routeCode: null,
|
|
|
carNum: null,
|
|
|
prodType:null,
|
|
|
materialCode:null,
|
|
|
materialName:null
|
|
|
}
|
|
|
this.formFields = []
|
|
|
this.converCarNum = null;
|
|
|
|
|
|
// 获取班次信息
|
|
|
getProShifts().then(response => {
|
|
|
this.workShift = response.data
|
|
|
})
|
|
|
// 获取工艺信息
|
|
|
getProRoutes(this.selectWork.productCode).then(response => {
|
|
|
this.routes = response.data
|
|
|
getProEquipment(this.selectWork.routeCode).then(response => {
|
|
|
this.proline = response.data
|
|
|
})
|
|
|
// 设置车数换算值
|
|
|
for (let i = 0; i < this.routes.length; i++) {
|
|
|
if (this.routes[i].routeCode == this.selectWork.routeCode) {
|
|
|
this.converCarNum = this.routes[i].carNumUnit;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
// 获取工艺设备信息
|
|
|
getProEquipment(this.selectWork.routeCode).then(response2 => {
|
|
|
this.eRouteOptions = response2.data
|
|
|
})
|
|
|
// 获取批次信息list
|
|
|
getWorkBatchList(this.selectWork).then(response => {
|
|
|
this.formFields = response.data
|
|
|
})
|
|
|
|
|
|
// 获取工单和订单信息
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
this.workerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
getOrderAndWork(this.selectWork).then(response => {
|
|
|
this.splitData.push(response.data.workOrder)
|
|
|
this.productData.push(response.data.order)
|
|
|
|
|
|
//订单产品类型
|
|
|
this.splitForm.prodType = this.splitData[0].prodType
|
|
|
|
|
|
if(this.productData[0].prodType == 'white') {
|
|
|
this.checkType = true
|
|
|
this.splitForm.materialName = this.splitData[0].materialName
|
|
|
this.splitForm.materialCode = this.splitData[0].materialCode
|
|
|
}else {
|
|
|
this.checkType = false
|
|
|
}
|
|
|
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
this.refreshWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
this.$nextTick(() => {
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
this.$nextTick(() => {
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
this.refreshWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.workerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
|
|
|
// 设置拆分数量
|
|
|
this.splitForm.splitNum = this.splitData[0].quantitySplit
|
|
|
// 设置选择机型
|
|
|
this.splitForm.prodLineCodeArray = response.data.workOrder.prodLineCodeArray
|
|
|
// 设置车数
|
|
|
this.splitForm.carNum = this.splitData[0].carNum
|
|
|
// 设置班次
|
|
|
this.splitForm.shiftId = this.splitData[0].shiftDesc
|
|
|
// 设置工艺
|
|
|
this.splitForm.routeCode = this.splitData[0].routeCode
|
|
|
|
|
|
//初始化日期为默认今天
|
|
|
if(this.splitData[0].productDate != null){
|
|
|
this.splitForm.productDate = this.splitData[0].productDate;
|
|
|
}else{
|
|
|
this.splitForm.productDate = new Date();
|
|
|
}
|
|
|
|
|
|
|
|
|
// 订单为白坯
|
|
|
if (this.productData[0].prodType == 'white'){
|
|
|
// 递归将拆分数量还原
|
|
|
function setAtrr1(order, work) {
|
|
|
order.quantitySplit = Number(order.quantitySplit) - Number(work.quantitySplit);
|
|
|
order.atrr1 = work.quantitySplit;
|
|
|
|
|
|
if (order.children !== undefined && work.children !== undefined) {
|
|
|
setAtrr1(order.children[0], work);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
setAtrr1(this.productData[0], this.splitData[0]);
|
|
|
}
|
|
|
// 订单为成品
|
|
|
if (this.productData[0],prototype != 'white'){
|
|
|
|
|
|
if(this.splitData[0].sortNo != null){
|
|
|
this.splitForm.sortNo = this.splitData[0].sortNo
|
|
|
}
|
|
|
|
|
|
// 递归将拆分数量还原
|
|
|
function setAtrr1(order, work) {
|
|
|
order.quantitySplit = Number(order.quantitySplit) - Number(work.quantitySplit);
|
|
|
order.atrr1 = work.quantitySplit;
|
|
|
|
|
|
if (order.children !== undefined && work.children !== undefined) {
|
|
|
setAtrr1(order.children[0], work.children[0]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
setAtrr1(this.productData[0], this.splitData[0]);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.open = true;
|
|
|
this.title = "修改生产工单";
|
|
|
}
|
|
|
})
|
|
|
|
|
|
},
|
|
|
// 变更-选择线体改变
|
|
|
changeEquipment() {
|
|
|
if (this.splitForm.routeCode == null) {
|
|
|
this.$message({
|
|
|
message: '请先选择工艺!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
},
|
|
|
// 变更-变更工艺
|
|
|
routeChange(routeCode) {
|
|
|
getProEquipment(routeCode).then(response => {
|
|
|
this.eRouteOptions = response.data
|
|
|
})
|
|
|
this.workForm.routeCode = routeCode
|
|
|
|
|
|
// 设置车数换算值
|
|
|
for (let i = 0; i < this.routes.length; i++) {
|
|
|
if (this.routes[i].routeCode == routeCode) {
|
|
|
this.converCarNum = this.routes[i].carNumUnit;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 重新设置车数
|
|
|
// 设置页面显示值
|
|
|
this.splitForm.carNum = Math.ceil(this.splitForm.splitNum / this.converCarNum);
|
|
|
// 设置后端传输值
|
|
|
this.workForm.carNum = Math.ceil(this.splitForm.splitNum / this.converCarNum);
|
|
|
},
|
|
|
// 变更-变更班次
|
|
|
shiftChange(e) {
|
|
|
this.workForm.shiftId = e
|
|
|
},
|
|
|
// 变更-拆分数量变更
|
|
|
splitNumChange(e) {
|
|
|
//不能为负数
|
|
|
if (e <= 0) {
|
|
|
e = 1
|
|
|
this.splitForm.splitNum = 1
|
|
|
}
|
|
|
// 订单为成品
|
|
|
if (this.productData[0].prodType != 'white') {
|
|
|
// 获取最大值,拆分数量不得超过最大值
|
|
|
let max = Number(this.productData[0].quantity) - Number(this.productData[0].quantitySplit)
|
|
|
// 超过最大值,给用户提醒
|
|
|
if (e > max) {
|
|
|
this.$message({
|
|
|
message: '最大值不能超过' + max + '!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
this.splitForm.splitNum = max
|
|
|
}
|
|
|
//前端数据同步
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
|
var num = this.productData[0].quantity;
|
|
|
|
|
|
// 递归操作动态显示拆分数量
|
|
|
function setAtrr1(data, splitNum) {
|
|
|
if (data.children !== undefined) {
|
|
|
for (let i = 0; i < data.children.length; i++) {
|
|
|
data.children[i].atrr1 = splitNum * (data.children[i].quantity / num)
|
|
|
setAtrr1(data.children[i], splitNum)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.productData[0].atrr1 = this.splitForm.splitNum
|
|
|
setAtrr1(this.productData[0], this.splitForm.splitNum)
|
|
|
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
this.$nextTick(() => {
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
|
|
|
this.workForm.splitNum = this.splitForm.splitNum
|
|
|
}
|
|
|
// 订单为白坯
|
|
|
if (this.productData[0].prodType == 'white') {
|
|
|
// 获取最大值,拆分数量不得超过最大值
|
|
|
let max = Number(this.productData[0].quantity) - Number(this.productData[0].quantitySplit)
|
|
|
// 超过最大值,给用户提醒
|
|
|
if (e > max) {
|
|
|
this.$message({
|
|
|
message: '最大值不能超过' + max + '!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
this.splitForm.splitNum = max
|
|
|
}
|
|
|
//前端数据同步
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
|
|
|
// 递归操作动态显示拆分数量
|
|
|
function setAtrr1(data, splitNum) {
|
|
|
if (data.children !== undefined) {
|
|
|
for (let i = 0; i < data.children.length; i++) {
|
|
|
data.children[i].atrr1 = splitNum
|
|
|
setAtrr1(data.children[i], splitNum)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this.productData[0].atrr1 = this.splitForm.splitNum
|
|
|
setAtrr1(this.productData[0], this.splitForm.splitNum)
|
|
|
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
this.$nextTick(() => {
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
|
|
|
this.workForm.splitNum = this.splitForm.splitNum
|
|
|
// 车数处理逻辑
|
|
|
if (this.converCarNum != null) {
|
|
|
this.splitForm.carNum = Math.ceil(this.splitForm.splitNum / this.converCarNum);
|
|
|
this.workForm.carNum = Math.ceil(this.splitForm.splitNum / this.converCarNum);
|
|
|
}else {
|
|
|
this.$message({
|
|
|
message: '获取车数换算值异常!',
|
|
|
type: 'error'
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
this.product = this.productData[0]
|
|
|
},
|
|
|
// 变更-工单日期变更
|
|
|
checkDate(e) {
|
|
|
this.workForm.productDate = e
|
|
|
},
|
|
|
// 变更-动态添加批次
|
|
|
addField() {
|
|
|
//如果批次数量大于等于拆分数量则不允许拆分
|
|
|
let sum = 0
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
sum += Number(this.formFields[i].batchQuantity)
|
|
|
}
|
|
|
|
|
|
if (sum >= this.productData[0].atrr1) {
|
|
|
this.$message({
|
|
|
message: '请填写完批次信息!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
this.formFields.push({batchCode: '', batchQuantity: ''})
|
|
|
//自动填充
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(sum)
|
|
|
},
|
|
|
// 变更-动态删除批次
|
|
|
removeField(index) {
|
|
|
this.formFields.splice(index, 1)
|
|
|
},
|
|
|
// 变更-填写批次数量
|
|
|
inBatch(e) {
|
|
|
//不能为负数
|
|
|
if (e <= 0) {
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = 1
|
|
|
}
|
|
|
//逻辑判断
|
|
|
let sum = 0
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
sum += Number(this.formFields[i].batchQuantity)
|
|
|
}
|
|
|
//如果超过拆分数量,提示并清空当前输入
|
|
|
if (sum > this.productData[0].atrr1) {
|
|
|
this.$message({
|
|
|
message: '你的批次数量总和不能超过拆分数量!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = Number(this.productData[0].atrr1) - Number(Number(sum) - Number(e))
|
|
|
if (this.formFields[this.formFields.length - 1].batchQuantity <= 0) {
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = 1
|
|
|
}
|
|
|
}
|
|
|
//如果拆分数量为空
|
|
|
if (this.productData[0].atrr1 == '' || this.productData[0].atrr1 == null) {
|
|
|
this.formFields[this.formFields.length - 1].batchQuantity = ''
|
|
|
}
|
|
|
},
|
|
|
// 变更-检验批次编码是否重复
|
|
|
batchCodeChange(e) {
|
|
|
if (this.formFields.length > 1) {
|
|
|
for (let i = 0; i < this.formFields.length - 1; i++) {
|
|
|
if (this.formFields[this.formFields.length - 1].batchCode == this.formFields[i].batchCode) {
|
|
|
this.$message({
|
|
|
message: '批次号不能重复!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
this.formFields = [{
|
|
|
batchCode: '',
|
|
|
batchQuantity: ''
|
|
|
}]
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
// 变更-变更提交按钮
|
|
|
submitForm() {
|
|
|
// 判断如果拆分数量不等于拆分批次数量之和
|
|
|
let sum = 0
|
|
|
for (let i = 0; i < this.formFields.length; i++) {
|
|
|
sum = Number(sum) + Number(this.formFields[i].batchQuantity)
|
|
|
if (this.formFields[i].batchQuantity == '' || this.formFields[i].batchQuantity == null || this.formFields[i].batchCode == null || this.formFields[i].batchCode == '') {
|
|
|
this.$message({
|
|
|
message: '批次数据不能为空',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
if (sum != this.productData[0].atrr1) {
|
|
|
this.$message({
|
|
|
message: '批次数量之和不等于拆分数量',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if (this.workForm.prodLineCode === undefined) {
|
|
|
this.workForm.prodLineCode = this.selectWork.prodLineName
|
|
|
}
|
|
|
|
|
|
//下面是请求处理
|
|
|
const data = {
|
|
|
formFields: this.formFields,
|
|
|
prodLineCodeArray: this.splitForm.prodLineCodeArray,
|
|
|
productDate: this.splitForm.productDate,
|
|
|
shiftId: this.workForm.shiftId,
|
|
|
splitNum: this.workForm.splitNum,
|
|
|
product: this.productData[0],
|
|
|
routeCode: this.workForm.routeCode,
|
|
|
proOrderWorkorder: this.selectWork,
|
|
|
carNum: this.workForm.carNum,
|
|
|
materialCode: this.splitForm.materialCode,
|
|
|
materialName: this.splitForm.materialName
|
|
|
}
|
|
|
|
|
|
subChangeWorkOrder(data).then(response => {
|
|
|
if (response.code == 500) {
|
|
|
this.$modal.msgError(response.msg)
|
|
|
return
|
|
|
}
|
|
|
this.getList()
|
|
|
this.$modal.msgSuccess('提交成功')
|
|
|
})
|
|
|
|
|
|
let id = this.productData[0].id
|
|
|
// 清除缓存
|
|
|
this.splitForm = {
|
|
|
id: null,
|
|
|
prodLineCodeArray: [],
|
|
|
splitNum: null,
|
|
|
productDate: null,
|
|
|
shiftId: null,
|
|
|
formFields: [],
|
|
|
carNum: null,
|
|
|
materialCode: null,
|
|
|
materialName: null
|
|
|
}
|
|
|
this.formFields = [{
|
|
|
batchCode: '',
|
|
|
batchQuantity: ''
|
|
|
}]
|
|
|
this.open = false
|
|
|
},
|
|
|
// 删除-工单删除按钮操作
|
|
|
handleDelete(row) {
|
|
|
|
|
|
var statusesArray = this.statuses;
|
|
|
/**
|
|
|
for (var i = 0; i < statusesArray.length; i++) {
|
|
|
if (statusesArray[i] == 'w2') {
|
|
|
this.$modal.msgError("已经活动的订单不允许操作");
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
**/
|
|
|
|
|
|
const workorderIds = row.workorderId || this.ids;
|
|
|
|
|
|
const workorderCodes = row.workorderCode || this.codes;
|
|
|
|
|
|
this.$modal.confirm('是否确认删除生产工单编号为"' + workorderCodes + '"的数据项?').then(function () {
|
|
|
return delWorkorder(workorderIds);
|
|
|
}).then(() => {
|
|
|
this.getList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
}).catch(() => {
|
|
|
});
|
|
|
},
|
|
|
// 导出-工单list导出按钮操作
|
|
|
handleExport() {
|
|
|
this.download('plan/pro/workorder/export', {
|
|
|
...this.queryParams
|
|
|
}, `workorder_${new Date().getTime()}.xlsx`)
|
|
|
},
|
|
|
// 打印预览-浏览器打印
|
|
|
handlePrint(params) {
|
|
|
printJS({
|
|
|
printable: params.printable, // 'printFrom', // 标签元素id
|
|
|
type: params.type || 'html',
|
|
|
maxWidth: 1500, // 最大宽度
|
|
|
font_size: "",// 设置字体大小
|
|
|
header: params.header, // '表单',
|
|
|
targetStyles: ['*'],
|
|
|
style: '@page {margin:0 10mm};', // 可选-打印时去掉眉页眉尾
|
|
|
ignoreElements: params.ignore || [], // ['no-print']
|
|
|
properties: params.properties || null
|
|
|
})
|
|
|
},
|
|
|
// 打印预览-点击打印预览按钮
|
|
|
showPrint() {
|
|
|
// 清楚缓存
|
|
|
this.printData.workCenter = "暂无数据";
|
|
|
this.printData.printDate = null;
|
|
|
this.printData.workTable = [];
|
|
|
this.printData.factory = null;
|
|
|
this.printData.productDate = null;
|
|
|
// 打开工单信息对话框
|
|
|
this.printDialogVisible = true;
|
|
|
this.printData.printDate = moment(new Date()).format('YYYY.MM.DD');
|
|
|
this.printData.manufacture = this.$store.state.user.name;
|
|
|
this.newWorkerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
this.refreshNewWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
getWorkOrders(this.selectWork.workorderCode).then(response => {
|
|
|
this.printData.workTable = response.data;
|
|
|
this.printData.factory = response.data[0].factoryCode;
|
|
|
this.printData.productDate = response.data[0].productDate;
|
|
|
this.refreshNewWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.newWorkerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
},
|
|
|
// 首-查询生产工单列表
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
this.queryParams.endFlag = '1';//只查子单
|
|
|
if (this.queryParams.productDateArray != null) {
|
|
|
this.queryParams.productDateStart = moment(this.queryParams.productDateArray[0]).format('YYYY-MM-DD');
|
|
|
this.queryParams.productDateEnd = moment(this.queryParams.productDateArray[1]).format('YYYY-MM-DD');
|
|
|
}
|
|
|
|
|
|
listWorkorder(this.queryParams).then(response => {
|
|
|
this.workorderList = response.rows;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
|
|
|
// 工单详情按钮操作
|
|
|
handleDetail(row) {
|
|
|
// 数据初始化
|
|
|
this.reset();
|
|
|
this.splitData = [];
|
|
|
this.productData = [];
|
|
|
this.splitForm = {
|
|
|
prodLineCodeArray: [],
|
|
|
splitNum: null,
|
|
|
productDate: null,
|
|
|
shiftId: null,
|
|
|
routeCode: null,
|
|
|
carNum: null,
|
|
|
prodType:null,
|
|
|
materialCode:null,
|
|
|
materialName:null
|
|
|
}
|
|
|
this.formFields = []
|
|
|
this.converCarNum = null;
|
|
|
|
|
|
// 获取班次信息
|
|
|
getProShifts().then(response => {
|
|
|
this.workShift = response.data
|
|
|
})
|
|
|
// 获取工艺信息
|
|
|
getProRoutes(this.selectWork.productCode).then(response => {
|
|
|
this.routes = response.data
|
|
|
getProEquipment(this.selectWork.routeCode).then(response => {
|
|
|
this.proline = response.data
|
|
|
})
|
|
|
// 设置车数换算值
|
|
|
for (let i = 0; i < this.routes.length; i++) {
|
|
|
if (this.routes[i].routeCode == this.selectWork.routeCode) {
|
|
|
this.converCarNum = this.routes[i].carNumUnit;
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
// 获取工艺设备信息
|
|
|
getProEquipment(this.selectWork.routeCode).then(response2 => {
|
|
|
this.eRouteOptions = response2.data
|
|
|
})
|
|
|
// 获取批次信息list
|
|
|
getWorkBatchList(this.selectWork).then(response => {
|
|
|
this.formFields = response.data
|
|
|
})
|
|
|
//获取产量信息
|
|
|
|
|
|
getHourProductionList({
|
|
|
workorderCode: this.selectWork.workorderCode,
|
|
|
}).then(response => {
|
|
|
let totalQuantity_cx = 0;
|
|
|
let totalQuantity_hf = 0;
|
|
|
|
|
|
// 遍历返回的结果,查找 equName 包含“成型”和“烘房”的项
|
|
|
response.forEach(item => {
|
|
|
// 确保 quantity 是数字类型
|
|
|
const quantity = Number(item.quantity) || 0;
|
|
|
|
|
|
if (item.equName.includes("成型")) {
|
|
|
totalQuantity_cx += quantity;
|
|
|
}
|
|
|
});
|
|
|
response.forEach(item => {
|
|
|
// 确保 quantity 是数字类型
|
|
|
const quantity = Number(item.quantity) || 0;
|
|
|
|
|
|
if (item.equName.includes("烘房")) {
|
|
|
totalQuantity_hf += quantity;
|
|
|
}
|
|
|
});
|
|
|
this.totalQuantity_cx = totalQuantity_cx;
|
|
|
this.totalQuantity_hf = totalQuantity_hf;
|
|
|
});
|
|
|
|
|
|
// 获取工单和订单信息
|
|
|
// 在获取到新的数据后执行以下代码
|
|
|
this.proLoading = true // 设置加载状态为true,表示正在加载
|
|
|
this.workerLoading = true // 设置加载状态为true,表示正在加载
|
|
|
getOrderAndWork(this.selectWork).then(response => {
|
|
|
this.splitData.push(response.data.workOrder)
|
|
|
this.productData.push(response.data.order)
|
|
|
|
|
|
//订单产品类型
|
|
|
this.splitForm.prodType = this.splitData[0].prodType
|
|
|
|
|
|
if(this.productData[0].prodType == 'white') {
|
|
|
this.checkType = true
|
|
|
this.splitForm.materialName = this.splitData[0].materialName
|
|
|
this.splitForm.materialCode = this.splitData[0].materialCode
|
|
|
}else {
|
|
|
this.checkType = false
|
|
|
}
|
|
|
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
this.refreshWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
this.$nextTick(() => {
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
this.$nextTick(() => {
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
this.refreshWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.workerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
|
|
|
// 设置拆分数量
|
|
|
this.splitForm.splitNum = this.splitData[0].quantitySplit
|
|
|
// 设置选择机型
|
|
|
this.splitForm.prodLineCodeArray = response.data.workOrder.prodLineCodeArray
|
|
|
// 设置车数
|
|
|
this.splitForm.carNum = this.splitData[0].carNum
|
|
|
// 设置班次
|
|
|
this.splitForm.shiftId = this.splitData[0].shiftDesc
|
|
|
// 设置工艺
|
|
|
this.splitForm.routeCode = this.splitData[0].routeCode
|
|
|
|
|
|
//初始化日期为默认今天
|
|
|
if(this.splitData[0].productDate != null){
|
|
|
this.splitForm.productDate = this.splitData[0].productDate;
|
|
|
}else{
|
|
|
this.splitForm.productDate = new Date();
|
|
|
}
|
|
|
|
|
|
|
|
|
// 订单为白坯
|
|
|
if (this.productData[0].prodType == 'white'){
|
|
|
// 递归将拆分数量还原
|
|
|
function setAtrr1(order, work) {
|
|
|
order.quantitySplit = Number(order.quantitySplit) - Number(work.quantitySplit);
|
|
|
order.atrr1 = work.quantitySplit;
|
|
|
|
|
|
if (order.children !== undefined && work.children !== undefined) {
|
|
|
setAtrr1(order.children[0], work);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
setAtrr1(this.productData[0], this.splitData[0]);
|
|
|
}
|
|
|
// 订单为成品
|
|
|
if (this.productData[0],prototype != 'white'){
|
|
|
|
|
|
if(this.splitData[0].sortNo != null){
|
|
|
this.splitForm.sortNo = this.splitData[0].sortNo
|
|
|
}
|
|
|
|
|
|
// 递归将拆分数量还原
|
|
|
function setAtrr1(order, work) {
|
|
|
order.quantitySplit = Number(order.quantitySplit) - Number(work.quantitySplit);
|
|
|
order.atrr1 = work.quantitySplit;
|
|
|
|
|
|
if (order.children !== undefined && work.children !== undefined) {
|
|
|
setAtrr1(order.children[0], work.children[0]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
setAtrr1(this.productData[0], this.splitData[0]);
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
this.open = true;
|
|
|
this.title = "生产工单详情";
|
|
|
this.showDetail = false;
|
|
|
},
|
|
|
//工单设备修改开始-----》》》
|
|
|
editMachine(row) {
|
|
|
// 数据初始化
|
|
|
this.reset();
|
|
|
this.splitData = [];
|
|
|
this.productData = [];
|
|
|
this.splitFormM = {
|
|
|
prodLineCodeArray: [],
|
|
|
}
|
|
|
|
|
|
// 获取工艺设备信息
|
|
|
getProEquipment(this.selectWork.routeCode).then(response2 => {
|
|
|
this.eRouteOptionsM = response2.data
|
|
|
})
|
|
|
|
|
|
getOrderAndWork(this.selectWork).then(response => {
|
|
|
// 设置选择机型
|
|
|
this.splitFormM.prodLineCodeArray = response.data.workOrder.prodLineCodeArray
|
|
|
this.splitData.push(response.data.workOrder)
|
|
|
this.productData.push(response.data.order)
|
|
|
this.refreshProTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
this.refreshWorkerTable = false // 先将refreshProTable设置为false,隐藏表格
|
|
|
this.$nextTick(() => {
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
this.refreshProTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.proLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
this.$nextTick(() => {
|
|
|
// 使用$nextTick来等待DOM更新完成
|
|
|
this.refreshWorkerTable = true // 立即将refreshProTable设置为true,显示表格
|
|
|
this.workerLoading = false // 设置加载状态为false,表示加载完成
|
|
|
})
|
|
|
})
|
|
|
|
|
|
this.openM = true;
|
|
|
this.titleM = "生产工单设备修改";
|
|
|
|
|
|
},
|
|
|
//工单设备修改结束-----《《《《《《
|
|
|
|
|
|
// 工单设备变更-变更提交按钮
|
|
|
submitFormM() {
|
|
|
//下面是请求处理
|
|
|
const data = {
|
|
|
proOrderWorkorder: this.selectWork,
|
|
|
prodLineCodeArray: this.splitFormM.prodLineCodeArray
|
|
|
}
|
|
|
subChangeWorkOrderM(data).then(response => {
|
|
|
if (response.code == 500) {
|
|
|
this.$modal.msgError(response.msg)
|
|
|
return
|
|
|
}
|
|
|
this.getList()
|
|
|
this.$modal.msgSuccess('提交成功')
|
|
|
})
|
|
|
// 清除缓存
|
|
|
this.splitFormM = {
|
|
|
prodLineCodeArray: []
|
|
|
}
|
|
|
this.openM = false
|
|
|
},
|
|
|
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
this.open = false;
|
|
|
this.openM = false;
|
|
|
this.showDetail = true;
|
|
|
this.reset();
|
|
|
},
|
|
|
// 首-表单重置
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
workorderId: null,
|
|
|
workorderCode: null,
|
|
|
workorderName: null,
|
|
|
orderId: null,
|
|
|
orderCode: null,
|
|
|
productId: null,
|
|
|
productCode: null,
|
|
|
productName: null,
|
|
|
productSpc: null,
|
|
|
unit: null,
|
|
|
quantityProduced: null,
|
|
|
quantitySplit: null,
|
|
|
routeCode: null,
|
|
|
prodLineCode: null,
|
|
|
prodLineCodeArray: [],
|
|
|
productDate: null,
|
|
|
shiftId: null,
|
|
|
parentOrder: null,
|
|
|
ancestors: null,
|
|
|
status: null,
|
|
|
remark: null,
|
|
|
attr1: null,
|
|
|
attr2: null,
|
|
|
attr3: null,
|
|
|
attr4: null,
|
|
|
createBy: null,
|
|
|
createTime: null,
|
|
|
updateBy: null,
|
|
|
updateTime: null,
|
|
|
prodType: null,
|
|
|
factoryCode: null,
|
|
|
endFlag: null
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
|
// 首-搜索按钮操作
|
|
|
handleQuery() {
|
|
|
this.queryParams.pageNum = 1;
|
|
|
this.getList();
|
|
|
},
|
|
|
// 首-重置按钮操作
|
|
|
resetQuery() {
|
|
|
this.resetForm("queryForm");
|
|
|
this.handleQuery();
|
|
|
},
|
|
|
// 首-多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
// 这里设置选中的工单信息--用于工单变更
|
|
|
this.selectWork = selection[0]
|
|
|
|
|
|
this.ids = selection.map(item => item.workorderId)
|
|
|
this.codes = selection.map(item => item.workorderCode)
|
|
|
this.single = selection.length !== 1
|
|
|
this.multiple = !selection.length
|
|
|
this.statuses = selection.map(item => item.status)
|
|
|
},
|
|
|
// 首-新增按钮操作
|
|
|
handleAdd() {
|
|
|
alert("待建设")
|
|
|
//this.reset();
|
|
|
//this.open = true;
|
|
|
//this.title = "添加生产工单";
|
|
|
},
|
|
|
shiftFormat(row,column){
|
|
|
let array = this.workShift;
|
|
|
let value = '其他';
|
|
|
array.forEach((item) => {
|
|
|
if (item.shiftId == row.shiftId) {
|
|
|
value = item.shiftDesc
|
|
|
}
|
|
|
})
|
|
|
return value;
|
|
|
},
|
|
|
//新增-打开组成白坯选择物料窗口
|
|
|
selectBPMateriel() {
|
|
|
// 清除搜索缓存
|
|
|
this.materielParams.productCode = null;
|
|
|
this.materielParams.productDescZh = null;
|
|
|
this.innerBPVisible = true;
|
|
|
this.getBPMaterielList();
|
|
|
},
|
|
|
//新增-打开组成白坯选择物料窗口
|
|
|
getBPMaterielList() {
|
|
|
this.loading = true;
|
|
|
selectMaterielList(this.materielParams).then(response => {
|
|
|
this.materielList = response.rows;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
// 新增-打开组成白坯选择物料窗口-选中物料信息
|
|
|
selectionChange(e) {
|
|
|
this.materielBP = e;
|
|
|
},
|
|
|
// 新增-打开组成白坯选择物料窗口-确认选择物料
|
|
|
subMaterielBP() {
|
|
|
if (this.materielBP.length == 0) {
|
|
|
this.$message({
|
|
|
message: '请选择物料!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
if (this.materielBP.length > 1) {
|
|
|
this.$message({
|
|
|
message: '物料只能选择一个!',
|
|
|
type: 'warning'
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
|
|
|
this.splitForm.materialCode = this.materielBP[0].productCode;
|
|
|
this.splitForm.materialName = this.materielBP[0].productDescZh;
|
|
|
|
|
|
this.innerBPVisible = false;
|
|
|
},
|
|
|
//删除湿料计划
|
|
|
deleteWetMaterial(row) {
|
|
|
const workorderIds = row.workorderId || this.ids;
|
|
|
const workorderCodes = row.workorderCode || this.codes;
|
|
|
|
|
|
this.$modal.confirm('是否确认删除生产工单编号为"' + workorderCodes + '"的湿料数据项?').then(function () {
|
|
|
return deleteWetMaterial(workorderIds);
|
|
|
}).then(() => {
|
|
|
this.getList();
|
|
|
this.$modal.msgSuccess("删除湿料计划成功");
|
|
|
}).catch(() => {
|
|
|
});
|
|
|
},
|
|
|
//辅助排产
|
|
|
handleAutoSplit(){
|
|
|
this.$modal.msgSuccess("辅助排产成功,请确认!");
|
|
|
},
|
|
|
handleSAPSync(){
|
|
|
this.$modal.msgSuccess("同步成功!");
|
|
|
},
|
|
|
//查看白坯bom
|
|
|
handleBom(row){
|
|
|
const workorderIds = row.workorderId || this.ids;
|
|
|
this.$refs.itemSelectProject.showFlag = true;
|
|
|
this.$refs.itemSelectProject.init(workorderIds[0]);
|
|
|
},
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
<style>
|
|
|
.el-row {
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
}
|
|
|
|
|
|
.el-col {
|
|
|
border-radius: 4px;
|
|
|
}
|
|
|
|
|
|
.bg-purple-dark {
|
|
|
background: #99a9bf;
|
|
|
}
|
|
|
|
|
|
.bg-purple {
|
|
|
background: #d3dce6;
|
|
|
}
|
|
|
|
|
|
.bg-purple-light {
|
|
|
background: #e5e9f2;
|
|
|
}
|
|
|
|
|
|
.grid-content {
|
|
|
border-radius: 4px;
|
|
|
min-height: 36px;
|
|
|
}
|
|
|
|
|
|
.row-bg {
|
|
|
padding: 10px 0;
|
|
|
background-color: #f9fafc;
|
|
|
}
|
|
|
|
|
|
.my-margin {
|
|
|
margin-top: 40px;
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
|
|
|
.my-print-head {
|
|
|
margin-top: 20px;
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
.my-print-nav {
|
|
|
margin-top: 15px;
|
|
|
margin-bottom: 15px;
|
|
|
}
|
|
|
|
|
|
.my-print-table {
|
|
|
|
|
|
}
|
|
|
|
|
|
.my-print-foot {
|
|
|
margin-top: 20px;
|
|
|
}
|
|
|
.btn {
|
|
|
overflow: hidden;
|
|
|
text-overflow: ellipsis;
|
|
|
white-space: nowrap;
|
|
|
}
|
|
|
</style>
|