<template>
|
<div style="padding:0px 14px;height: 100%;overflow: auto;">
|
<div class="tabDivClass">
|
<div style="height:28px;line-height:28px;">
|
<el-divider class="pane-divider" direction="vertical"></el-divider
|
><span style="font-size:14px;font-weight:bold">报告列表</span>
|
</div>
|
</div>
|
<div style="text-align: left;display:flex;justify-content:space-between;">
|
<div style="width: 500px;">
|
<tselect
|
v-model="currProductMainId"
|
:columns="productMainColumn"
|
:data="productMainList"
|
:formatter="labelFormatter"
|
@selectChange="changeProductMain()"
|
></tselect>
|
</div>
|
<!--<el-select
|
v-model="currProductMainId"
|
placeholder="请选择"
|
style="width: 450px;"
|
@change="changeProductMain()"
|
clearable
|
>
|
<el-option
|
v-for="item in productMainList"
|
:key="item.id"
|
:label="item.productNo"
|
:value="item.id"
|
>
|
<div style="display: table;width: 450px;">
|
<div style="display: table-row;">
|
<div style="display: table-cell;width:21%;text-align: center;">
|
{{ item.productNo }}
|
</div>
|
<div style="display: table-cell;width:21%;text-align: center;">
|
{{ item.createUser }}
|
</div>
|
<div style="display: table-cell;width:42%;text-align: center;">
|
{{ item.createTime }}
|
</div>
|
<div style="display: table-cell;text-align: center;">
|
{{ item.state == '02submitted' ? '已提交' : '草稿' }}
|
</div>
|
</div>
|
</div>
|
</el-option>
|
</el-select>-->
|
<div style="" class="tracking-change-state-div">
|
<el-button
|
v-if="
|
currProductMainId &&
|
currProductMainState == '01draft' &&
|
!currentDutyRecord.isConfirm
|
"
|
type="info"
|
class="cancel-btn"
|
icon="tracking-btn-cancel"
|
@click="cancelProductMain"
|
>删除报告</el-button
|
>
|
<el-button
|
v-if="
|
currProductMainId &&
|
currProductMainState == '01draft' &&
|
!currentDutyRecord.isConfirm
|
"
|
type="success"
|
class="submit-btn"
|
icon="tracking-btn-submit"
|
:disabled="changeStateDisabled"
|
@click="changeState('提交报告', 'SUBMIT')"
|
>提交报告</el-button
|
>
|
<el-button
|
v-if="
|
currProductMainId &&
|
currProductMainState == '02submitted' &&
|
permissions.product_main_revoke &&
|
!currentDutyRecord.isConfirm
|
"
|
type="danger"
|
class="revoke-btn"
|
icon="tracking-btn-revoke"
|
:disabled="changeStateDisabled"
|
@click="changeState('撤销报告', 'REVOKE')"
|
>撤销</el-button
|
>
|
</div>
|
</div>
|
<el-divider class="tracking-divider"></el-divider>
|
<div class="product-out-header">
|
<div class="product-out-header-left">
|
<el-divider class="pane-divider" direction="vertical"></el-divider
|
><span style="font-size:14px;font-weight:bold">产出</span>
|
<div style="margin-left: 50px">
|
<el-radio-group v-model="groupStatus">
|
<el-radio :label="false">按组报工</el-radio>
|
<el-radio :label="true">按人员报工</el-radio>
|
</el-radio-group>
|
</div>
|
</div>
|
<div>
|
<el-button
|
class="out-btn"
|
type="primary"
|
icon="tracking-btn-out"
|
:disabled="currProductMainDisable || currentDutyRecord.isConfirm"
|
@click="addProductOut()"
|
>新增产出</el-button
|
>
|
<el-button
|
class="batch-out-btn"
|
type="primary"
|
icon="tracking-btn-out"
|
:disabled="currProductMainDisable || currentDutyRecord.isConfirm"
|
@click="addBatchProductOut()"
|
>批量产出</el-button
|
>
|
<el-button
|
class="submit-out-btn"
|
type="primary"
|
icon="el-icon-finished"
|
v-if="
|
currProductMainId &&
|
currProductMainState == '01draft' &&
|
!currentDutyRecord.isConfirm
|
"
|
@click="changeProductOutPutState('提交产出', '0')"
|
>提交产出</el-button
|
>
|
<el-button
|
class="change-shift-out-btn"
|
type="primary"
|
icon="el-icon-sort"
|
v-if="
|
productOutputList.length > 0 &&
|
currProductMainState == '01draft' &&
|
!currentDutyRecord.isConfirm
|
"
|
@click="changeProductOutPutState('产出交班', '1')"
|
>产出交班</el-button
|
>
|
<el-button
|
class="tracking-out-revoke-btn"
|
type="primary"
|
icon="el-icon-back"
|
v-if="
|
currProductMainId &&
|
currProductMainState == '01draft' &&
|
!currentDutyRecord.isConfirm
|
"
|
@click="changeProductOutPutState('产出撤回', '2')"
|
>产出撤回</el-button
|
>
|
<el-button
|
class="batch-out-del-btn"
|
type="primary"
|
icon="el-icon-delete"
|
v-if="
|
productOutputList.length > 0 &&
|
currProductMainState == '01draft' &&
|
!currentDutyRecord.isConfirm
|
"
|
@click="batchDelProductOut()"
|
>批量删除</el-button
|
>
|
</div>
|
</div>
|
<el-table
|
ref="productOutTable"
|
:data="productOutputList"
|
height="320px"
|
:header-cell-style="productOutTableHeaderCellStyle"
|
:row-class-name="productOutTableRowClassName"
|
class="tracking-table"
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column type="selection" width="55"> </el-table-column>
|
|
<el-table-column label="序号" width="50px">
|
<template slot-scope="scope">
|
{{ scope.$index + 1 }}
|
</template>
|
</el-table-column>
|
|
<el-table-column label="报工单号" prop="productNo" align="center">
|
</el-table-column>
|
<el-table-column
|
label="零件编号"
|
prop="partNo"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="零件名称"
|
prop="partName"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="SN号"
|
prop="outBatchNo"
|
align="center"
|
width="120"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="载具编号"
|
prop="reelNumber"
|
align="center"
|
width="120"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="IFS批次号"
|
prop="ifsBatchNo"
|
align="center"
|
width="120"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="起始米标"
|
prop="startMeterMark"
|
align="center"
|
width="100"
|
>
|
</el-table-column>
|
<el-table-column
|
label="截止米标"
|
prop="endMeterMark"
|
align="center"
|
width="100"
|
>
|
</el-table-column>
|
<el-table-column
|
label="生产数量"
|
prop="productQty"
|
align="center"
|
width="100"
|
>
|
</el-table-column>
|
<el-table-column label="系统号" prop="systemNo" align="center">
|
</el-table-column>
|
<el-table-column label="工序名称" prop="operationName" align="center">
|
</el-table-column>
|
<el-table-column
|
label="状态"
|
prop="state"
|
align="center"
|
:formatter="formatState"
|
>
|
</el-table-column>
|
<el-table-column label="单位" prop="unit" align="center">
|
</el-table-column>
|
<el-table-column
|
label="生产数量2"
|
prop="sproductQty"
|
align="center"
|
width="100"
|
>
|
</el-table-column>
|
<el-table-column label="单位2" prop="sunit" align="center">
|
</el-table-column>
|
<el-table-column label="分段描述" prop="segmentDesc" align="center">
|
</el-table-column>
|
<el-table-column label="报废数量" prop="scrapQty" align="center">
|
</el-table-column>
|
<el-table-column label="备注" prop="remark" align="center">
|
</el-table-column>
|
<el-table-column label="操作" align="center" width="150px" fixed="right">
|
<template slot-scope="scope">
|
<el-tooltip effect="dark" content="编辑" placement="top-start">
|
<el-button
|
type="text"
|
size="small"
|
class="blue-but"
|
@click="editProductOut(scope.$index, scope.row)"
|
:disabled="
|
scope.row.state !== '01draft' ||
|
currProductMainDisable ||
|
currentDutyRecord.isConfirm
|
"
|
>编辑</el-button
|
>
|
</el-tooltip>
|
<el-tooltip effect="dark" content="删除" placement="top-start">
|
<el-button
|
type="text"
|
size="small"
|
class="red-but"
|
@click="delProductOut(scope.$index, scope.row)"
|
:disabled="
|
scope.row.state !== '01draft' ||
|
currProductMainDisable ||
|
currentDutyRecord.isConfirm
|
"
|
>删除</el-button
|
>
|
</el-tooltip>
|
<el-tooltip effect="dark" content="标签" placement="top-start">
|
<el-button
|
type="text"
|
size="small"
|
class="blue-but"
|
@click="printLabel(scope.row)"
|
>标签</el-button
|
>
|
</el-tooltip>
|
</template>
|
</el-table-column>
|
</el-table>
|
<div class="product-in-header">
|
<div>
|
<el-divider class="pane-divider" direction="vertical"></el-divider
|
><span style="font-size:14px;font-weight:bold">投入</span>
|
</div>
|
<div>
|
<el-button
|
class="in-btn"
|
type="primary"
|
icon="tracking-btn-in"
|
:disabled="currProductMainDisable || currentDutyRecord.isConfirm"
|
@click="openProductInDialog()"
|
>投入</el-button
|
>
|
</div>
|
</div>
|
<el-table
|
ref="productInTable"
|
:data="productInputList"
|
height="320px"
|
:header-cell-style="productInTableHeaderCellStyle"
|
:row-class-name="productInTableRowClassName"
|
class="tracking-table"
|
>
|
<el-table-column label="报工单号" prop="productNo" align="center">
|
</el-table-column>
|
<el-table-column
|
label="SN号"
|
prop="partBatchNo"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="IFS批次号"
|
prop="ifsBatchNo"
|
align="center"
|
width="120"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="零件编号"
|
prop="partNo"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="零件名称"
|
prop="partName"
|
align="center"
|
:show-overflow-tooltip="true"
|
>
|
</el-table-column>
|
<el-table-column
|
label="投入数量"
|
prop="inputQuantity"
|
align="center"
|
width="100"
|
>
|
<template scope="scope">
|
<el-input
|
size="small"
|
v-model="scope.row.inputQuantity"
|
placeholder="投入数量"
|
:disabled="currProductMainDisable || currentDutyRecord.isConfirm"
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column
|
label="可用数量"
|
prop="availableStockQuantity"
|
align="center"
|
>
|
</el-table-column>
|
<el-table-column label="单位" prop="unit" align="center">
|
</el-table-column>
|
<el-table-column align="center" width="120px" fixed="right">
|
<template slot-scope="scope">
|
<el-tooltip effect="dark" content="全投" placement="top-start">
|
<el-button
|
type="text"
|
size="small"
|
@click="allIn(scope.$index, scope.row)"
|
>全投</el-button
|
>
|
</el-tooltip>
|
<el-tooltip effect="dark" content="保存" placement="top-start">
|
<el-button
|
type="text"
|
size="small"
|
@click="addOrUpdateProductIn(scope.row)"
|
:disabled="currProductMainDisable || currentDutyRecord.isConfirm"
|
>保存</el-button
|
>
|
</el-tooltip>
|
<el-tooltip effect="dark" content="删除" placement="top-start">
|
<el-button
|
type="text"
|
size="small"
|
class="red-but"
|
@click="delProductIn(scope.$index, scope.row)"
|
:disabled="currProductMainDisable || currentDutyRecord.isConfirm"
|
>删除</el-button
|
>
|
</el-tooltip>
|
</template>
|
</el-table-column>
|
</el-table>
|
<productInDialog
|
:currshowlist.sync="showProductInDialog"
|
:workstationId="workstationId"
|
@handleSelectionChange="selectWorkstationFeed"
|
/>
|
<productOutFormDialog
|
:currshowlist.sync="showProductForm"
|
:productList="productList"
|
:parentInfo="parentInfo"
|
:currentDutyRecord="currentDutyRecord"
|
:personBoardList="personBoardList"
|
@refreshProductOutputList="refreshProductOutputList"
|
/>
|
<batchProductOutFormDialog
|
:currshowlist.sync="showBatchProductForm"
|
:productList="productList"
|
:parentInfo="parentInfo"
|
:currentDutyRecord="currentDutyRecord"
|
:personBoardList="personBoardList"
|
@refreshProductOutputList="refreshProductOutputList"
|
/>
|
</div>
|
</template>
|
<style lang="scss" scoped>
|
.cancel-btn {
|
background-image: -webkit-linear-gradient(
|
90deg,
|
rgba(254, 100, 84, 0.8) 0%,
|
rgba(252, 84, 75, 0.8) 50%,
|
rgba(250, 69, 65, 0.8) 100%
|
);
|
background-image: -moz-linear-gradient(
|
90deg,
|
rgba(254, 100, 84, 0.8) 0%,
|
rgba(252, 84, 75, 0.8) 50%,
|
rgba(250, 69, 65, 0.8) 100%
|
);
|
background-image: linear-gradient(
|
90deg,
|
rgba(254, 100, 84, 0.8) 0%,
|
rgba(252, 84, 75, 0.8) 50%,
|
rgba(250, 69, 65, 0.8) 100%
|
);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 10px;
|
padding: 6px 15px;
|
height: 32px;
|
}
|
.cancel-btn >>> span {
|
margin-left: 3px;
|
}
|
.tracking-change-state-div >>> .tracking-btn-cancel {
|
background: url('/img/workbench/icon_cancel.png') center center no-repeat;
|
background-size: cover;
|
}
|
.tracking-change-state-div >>> .tracking-btn-cancel:before {
|
content: '消';
|
font-size: 14px;
|
visibility: hidden;
|
}
|
.submit-btn {
|
background-image: -webkit-linear-gradient(
|
90deg,
|
rgba(80, 213, 118, 0.8) 0%,
|
rgba(73, 209, 87, 0.8) 50%,
|
rgba(65, 205, 58, 0.8) 100%
|
);
|
background-image: -moz-linear-gradient(
|
90deg,
|
rgba(80, 213, 118, 0.8) 0%,
|
rgba(73, 209, 87, 0.8) 50%,
|
rgba(65, 205, 58, 0.8) 100%
|
);
|
background-image: linear-gradient(
|
90deg,
|
rgba(80, 213, 118, 0.8) 0%,
|
rgba(73, 209, 87, 0.8) 50%,
|
rgba(65, 205, 58, 0.8) 100%
|
);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 10px;
|
padding: 6px 15px;
|
height: 32px;
|
}
|
.submit-btn >>> span {
|
margin-left: 3px;
|
}
|
.tracking-change-state-div >>> .tracking-btn-submit {
|
background: url('/img/workbench/icon_tracking_submit.png') center center
|
no-repeat;
|
background-size: cover;
|
}
|
.tracking-change-state-div >>> .tracking-btn-submit:before {
|
content: '交';
|
font-size: 14px;
|
visibility: hidden;
|
}
|
.revoke-btn {
|
background-image: -webkit-linear-gradient(
|
90deg,
|
rgba(254, 91, 53, 0.8) 0%,
|
rgba(245, 68, 50, 0.8) 100%
|
);
|
background-image: -moz-linear-gradient(
|
90deg,
|
rgba(254, 91, 53, 0.8) 0%,
|
rgba(245, 68, 50, 0.8) 100%
|
);
|
background-image: linear-gradient(
|
90deg,
|
rgba(254, 91, 53, 0.8) 0%,
|
rgba(245, 68, 50, 0.8) 100%
|
);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 10px;
|
padding: 6px 15px;
|
height: 32px;
|
}
|
.revoke-btn >>> span {
|
margin-left: 3px;
|
}
|
.tracking-change-state-div >>> .tracking-btn-revoke {
|
background: url('/img/workbench/icon_back.png') center center no-repeat;
|
background-size: cover;
|
}
|
.tracking-change-state-div >>> .tracking-btn-revoke:before {
|
content: '撤';
|
font-size: 14px;
|
visibility: hidden;
|
}
|
.tracking-divider.el-divider {
|
margin: 12px 0px 18px;
|
}
|
.product-out-header {
|
margin-top: 10px;
|
margin-bottom: 14px;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
.product-out-header-left {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
.product-out-header >>> .tracking-btn-out {
|
background: url('/img/workbench/icon_bgcc.png') center center no-repeat;
|
background-size: cover;
|
font-size: 14px;
|
}
|
|
.product-out-header >>> .tracking-btn-out:before {
|
content: '产';
|
font-size: 14px;
|
visibility: hidden;
|
}
|
|
.pane-divider {
|
width: 4px;
|
background-color: #4283ee;
|
}
|
.out-btn {
|
background-image: -webkit-linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
background-image: -moz-linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
background-image: linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
}
|
.out-btn >>> span {
|
margin-left: 3px;
|
}
|
.batch-out-btn {
|
background-image: -webkit-linear-gradient(139deg, #ff8c00 0%, #ffa500 100%);
|
background-image: -moz-linear-gradient(139deg, #ff8c00 0%, #ffa500 100%);
|
background-image: linear-gradient(139deg, #ff8c00 0%, #ffa500 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
}
|
.batch-out-btn >>> span {
|
margin-left: 3px;
|
}
|
.submit-out-btn {
|
background-image: -webkit-linear-gradient(139deg, #54d167 0%, #49cb3b 100%);
|
background-image: -moz-linear-gradient(139deg, #54d167 0%, #49cb3b 100%);
|
background-image: linear-gradient(139deg, #54d167 0%, #49cb3b 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
font-size: 14px;
|
}
|
.submit-out-btn >>> span {
|
margin-left: 3px;
|
font-size: 12px;
|
}
|
.change-shift-out-btn {
|
background-image: -webkit-linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
background-image: -moz-linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
background-image: linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
font-size: 14px;
|
}
|
.change-shift-out-btn >>> span {
|
margin-left: 3px;
|
font-size: 12px;
|
}
|
.tracking-out-revoke-btn {
|
background-image: -webkit-linear-gradient(139deg, #fc5e40 0%, #f54c3d 100%);
|
background-image: -moz-linear-gradient(139deg, #fc5e40 0%, #f54c3d 100%);
|
background-image: linear-gradient(139deg, #fc5e40 0%, #f54c3d 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
font-size: 14px;
|
}
|
.tracking-out-revoke-btn >>> span {
|
margin-left: 3px;
|
font-size: 12px;
|
}
|
.batch-out-del-btn {
|
background-image: -webkit-linear-gradient(139deg, #e86d61 0%, #e45552 100%);
|
background-image: -moz-linear-gradient(139deg, #e86d61 0%, #e45552 100%);
|
background-image: linear-gradient(139deg, #e86d61 0%, #e45552 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
font-size: 14px;
|
}
|
.batch-out-del-btn >>> span {
|
margin-left: 3px;
|
font-size: 12px;
|
}
|
.tracking-table >>> .stripe-row {
|
background: #f6f9fe;
|
}
|
.tracking-table >>> td {
|
padding: 3px 0px;
|
}
|
.tracking-table >>> .el-button {
|
padding: 5px 0px;
|
}
|
.tracking-table >>> .el-input .el-input__inner {
|
height: 24px;
|
line-height: 24px;
|
}
|
.product-in-header {
|
margin-top: 10px;
|
margin-bottom: 14px;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
.product-in-header-left {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
.product-in-header >>> .tracking-btn-in {
|
background: url('/img/workbench/icon_bgtr.png') center center no-repeat;
|
background-size: cover;
|
font-size: 14px;
|
}
|
|
.product-in-header >>> .tracking-btn-in:before {
|
content: '投';
|
font-size: 14px;
|
visibility: hidden;
|
}
|
.in-btn {
|
background-image: -webkit-linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
background-image: -moz-linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
background-image: linear-gradient(139deg, #5f6eef 0%, #2783ff 100%);
|
color: #fff;
|
border-color: #fbecec;
|
border-radius: 15px;
|
padding: 6px 15px;
|
}
|
.in-btn >>> span {
|
margin-left: 3px;
|
}
|
.tabDivClass {
|
margin-top: 20px;
|
margin-bottom: 14px;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
|
.red-but.is-disabled {
|
color: #fab6b6;
|
}
|
|
.red-but {
|
color: red;
|
}
|
|
.blue-but.is-disabled {
|
color: #aacfff;
|
}
|
|
.blue-but {
|
color: #006eff;
|
}
|
.white-but {
|
color: white;
|
font-weight: bolder;
|
}
|
</style>
|
<script>
|
import {
|
queryProductMain,
|
queryProductMainDetail,
|
delProductMain,
|
productMainChangeState,
|
updateProductInput,
|
saveProductInput,
|
deleteProductInputById,
|
getProductOutInfoById,
|
deleteProductOutputById,
|
getPrintUrl
|
} from '@/api/product/personboard'
|
import productInDialog from './productInDialog.vue'
|
import productOutFormDialog from './productout-form.vue'
|
import batchProductOutFormDialog from './batchproductout-form.vue'
|
import tselect from '@/views/common/ztt-select.vue'
|
import { mapGetters } from 'vuex'
|
import {
|
changeProductOutPutState,
|
deleteProductOutputByIds,
|
changeProductOutShiftStatus,
|
getShiftProductOutByOpIdAndWsId
|
} from '../../../api/product/personboard'
|
import { changeState } from '../../../api/plan/manufacturingorder'
|
import { value2label } from '../../../util/formatUtil'
|
export default {
|
components: {
|
productInDialog,
|
productOutFormDialog,
|
batchProductOutFormDialog,
|
tselect
|
},
|
props: {
|
workstationId: {
|
type: Number
|
},
|
currOperateTask: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
currentDutyRecord: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
personBoardList: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
}
|
},
|
data() {
|
return {
|
stateTagArr: [
|
{ value: '01draft', label: '草稿' },
|
{ value: '02submitted', label: '已提交' },
|
{ value: '03changeshift', label: '交班' }
|
],
|
tableData: [],
|
multipleSelection: [],
|
productMainColumn: [
|
{
|
prop: 'productNo',
|
label: '报工单号'
|
},
|
{ prop: 'createUser', label: '创建人' },
|
{ prop: 'createTime', label: '创建时间' },
|
{
|
prop: 'state',
|
label: '状态',
|
formatter: (colValue) => {
|
var formatVal
|
if (colValue === '01draft') {
|
formatVal = '草稿'
|
} else if (colValue === '02submitted') {
|
formatVal = '已提交'
|
}
|
return formatVal
|
}
|
}
|
],
|
productMainList: [],
|
productOutputList: [],
|
productInputList: [],
|
currProductMainId: null,
|
currProductMainNo: null,
|
currProductMainState: null,
|
currProductMainDisable: false,
|
showProductInDialog: false,
|
secondTableHeight: null,
|
groupStatus: false,
|
productList: [],
|
parentInfo: {
|
workstationId: null,
|
operationTaskId: null,
|
currProductMainId: null,
|
productOutId: null,
|
currProductMainNo: null,
|
partId: null,
|
partNo: null,
|
partName: null,
|
unit: null,
|
sunit: null
|
},
|
showProductForm: false,
|
showBatchProductForm: false,
|
changeStateDisabled: false,
|
clickChangeStateArr: []
|
}
|
},
|
created() {},
|
computed: {
|
...mapGetters(['permissions'])
|
},
|
methods: {
|
labelFormatter(ele) {
|
let productMainLabel
|
const productMain = this.productMainList.find(
|
(item) => ele.id === item.id
|
)
|
if (productMain !== undefined) {
|
productMainLabel =
|
'报工单号:' +
|
productMain.productNo +
|
' ' +
|
'创建人:' +
|
productMain.createUser +
|
' ' +
|
'状态:' +
|
(productMain.state === '02submitted' ? '已提交' : '草稿')
|
}
|
return productMainLabel
|
},
|
formatState(row, column, cellValue) {
|
return value2label(cellValue, this.stateTagArr)
|
},
|
productOutTableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
|
let headerStyle = 'background:#599ef4;color:#fff;'
|
if (columnIndex === 0) {
|
headerStyle += 'border-radius: 6px 0px 0px 0px;'
|
} else if (columnIndex === 20) {
|
headerStyle += 'border-radius: 0px 6px 0px 0px;'
|
}
|
return headerStyle
|
},
|
productOutTableRowClassName({ row, rowIndex }) {
|
if (rowIndex % 2 === 1) {
|
return 'stripe-row'
|
} else {
|
return ''
|
}
|
},
|
productInTableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
|
let headerStyle = 'background:#599ef4;color:#fff;'
|
if (columnIndex === 0) {
|
headerStyle += 'border-radius: 6px 0px 0px 0px;'
|
} else if (columnIndex === 8) {
|
headerStyle += 'border-radius: 0px 6px 0px 0px;'
|
}
|
return headerStyle
|
},
|
productInTableRowClassName({ row, rowIndex }) {
|
if (rowIndex % 2 === 1) {
|
return 'stripe-row'
|
} else {
|
return ''
|
}
|
},
|
// 根据工作站和工单,获取报告列表
|
queryProductMain(operationTaskId) {
|
return new Promise((resolve, reject) => {
|
this.productMainList = []
|
if (this.workstationId && this.workstationId != null) {
|
var query = {
|
workstationId: this.workstationId,
|
operationTaskId: operationTaskId
|
}
|
queryProductMain(query)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.productMainList = data.data
|
resolve()
|
} else {
|
this.$message.error('获取报告列表失败')
|
reject()
|
}
|
})
|
.catch((error) => {
|
reject()
|
})
|
}
|
})
|
},
|
handleSelectionChange(val) {
|
this.multipleSelection = val
|
console.info(this.multipleSelection)
|
},
|
// 选中报告
|
changeProductMain() {
|
if (this.currProductMainId) {
|
var currProductMain = this.productMainList.find(
|
(item) => item.id === this.currProductMainId
|
)
|
if (currProductMain != null) {
|
this.currProductMainNo = currProductMain.productNo
|
this.currProductMainState = currProductMain.state
|
// 若报告状态为已提交,则不可修改报告信息
|
if (this.currProductMainState == '02submitted') {
|
this.currProductMainDisable = true
|
} else {
|
this.currProductMainDisable = false
|
}
|
this.queryProductMainDetail(this.currProductMainId)
|
} else {
|
this.currProductMainNo = null
|
this.currProductMainState = null
|
this.currProductMainDisable = false
|
// 清空投入、产出明细
|
this.productOutputList = []
|
this.productInputList = []
|
}
|
} else {
|
// 清除当前报工记录时
|
this.currProductMainNo = null
|
this.currProductMainState = null
|
this.currProductMainDisable = false
|
// 清空投入、产出明细
|
this.productOutputList = []
|
this.productInputList = []
|
// 获取最新的报告列表
|
this.queryProductMain(this.currOperateTask.id)
|
}
|
this.$emit('spreadParam', this.currProductMainId)
|
},
|
// 根据报工主表id获取投入、产出明细
|
queryProductMainDetail(id) {
|
return new Promise((resolve, reject) => {
|
this.productOutputList = []
|
this.productInputList = []
|
queryProductMainDetail(id)
|
.then((response) => {
|
var code = response.data.code
|
if (code == 0) {
|
var productMainInfo = response.data.data
|
this.productOutputList = productMainInfo.productOutputList
|
const productInputs = productMainInfo.productInputList
|
if (productInputs != null && productInputs.length > 0) {
|
productInputs.forEach((item) => {
|
if (item.availableStockQuantity == null) {
|
item.availableStockQuantity = 0
|
}
|
})
|
}
|
this.productInputList = productInputs
|
resolve()
|
} else {
|
this.$message.error('获取投入产出明细失败')
|
reject()
|
}
|
})
|
.catch((error) => {
|
reject()
|
})
|
})
|
},
|
// 删除报告
|
cancelProductMain() {
|
if (this.productOutputList.length <= 0) {
|
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
delProductMain(this.currProductMainId)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.$message.success('删除报告成功')
|
// 刷新工单报工记录列表、清空页面投入和产出、将当前报工设置为null
|
this.queryProductMain(this.currOperateTask.id)
|
this.productOutputList = []
|
this.productInputList = []
|
this.currProductMainId = null
|
this.currProductMainNo = null
|
this.currProductMainState = null
|
this.currProductMainDisable = false
|
// 刷新人工信息
|
this.$emit('refreshArtificial')
|
// 刷新产出记录
|
this.$emit('refreshProductOutput')
|
// 刷新投料信息
|
this.$emit('refreshFeedsForDel')
|
} else {
|
this.$message.error('删除报告失败')
|
}
|
})
|
.catch((error) => {})
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
})
|
})
|
} else {
|
this.$message.error('请先删除报告下的产出,再进行【删除报告】操作')
|
}
|
},
|
// 变更报工记录状态
|
changeState(desc, event) {
|
let canClickFlag = true
|
this.clickChangeStateArr.push(new Date().getTime())
|
if (this.clickChangeStateArr.length > 1) {
|
if (
|
this.clickChangeStateArr[this.clickChangeStateArr.length - 1] -
|
this.clickChangeStateArr[this.clickChangeStateArr.length - 2] <
|
2000
|
) {
|
// 小于2秒则认为重复提交
|
canClickFlag = false
|
}
|
}
|
if (canClickFlag) {
|
// 若是提交报告,则校验当前报工下所有草稿状态的产出的生产数量是否为0,若为0,则需要限制
|
let zeroProductFlag = true
|
if (event === 'SUBMIT') {
|
const zeroProductOutput = this.productOutputList.find((item) => {
|
return item.state === '01draft' && Number(item.productQty) === 0
|
})
|
|
if (zeroProductOutput) {
|
zeroProductFlag = false
|
// 存在为0的产出,此时进行限制提醒
|
this.$message.error(
|
'SN号:' +
|
zeroProductOutput.outBatchNo +
|
',生产数量为0,不可进行提交!'
|
)
|
}
|
}
|
if (zeroProductFlag) {
|
this.changeStateDisabled = true
|
productMainChangeState(this.currProductMainId, event)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
// 刷新工单报工记录列表、选中当前报工记录、刷新工单列表、刷新当前工单信息
|
Promise.all([
|
// 刷新工单报工记录列表
|
this.queryProductMain(this.currOperateTask.id)
|
]).then((res) => {
|
// 选中当前报工记录
|
this.changeProductMain()
|
// 刷新工单列表
|
this.$emit('refreshOperateTasks')
|
// 刷新产出记录
|
this.$emit('refreshProductOutput')
|
})
|
this.$message.success(desc + '成功')
|
} else {
|
this.$message.error(desc + '失败')
|
}
|
this.changeStateDisabled = false
|
})
|
.catch((error) => {
|
this.changeStateDisabled = false
|
})
|
}
|
}
|
},
|
// 弹出投料列表,供报工投入使用
|
openProductInDialog() {
|
if (this.currProductMainId != null && this.currProductMainId != '') {
|
this.showProductInDialog = true
|
} else {
|
this.$message.warning('请先选择报告或者先填写产出!')
|
}
|
},
|
// 变更产出状态并且进库,
|
changeProductOutPutState(desc, type) {
|
//
|
if (this.multipleSelection.length > 0) {
|
// 找出multipleSelection中,生产数量为0的产出,若存在则提醒
|
const multipleSelect = this.multipleSelection.find((item) => {
|
return Number(item.productQty) === 0
|
})
|
if (multipleSelect) {
|
// 存在为0的产出,此时进行限制提醒
|
this.$message.error(
|
'SN号:' +
|
multipleSelect.outBatchNo +
|
',生产数量为0,不可进行提交!'
|
)
|
} else {
|
let outIds
|
let event
|
let returnFlag = true
|
let changeShiftFlag = true
|
let changeShiftNotEmptyFlag = true
|
if (type === '0') {
|
// 提交产出
|
event = 'SUBMIT'
|
outIds = this.multipleSelection
|
.filter((item) => {
|
return item.state === '01draft'
|
})
|
.map((ele) => {
|
return ele.id
|
})
|
} else if (type === '1') {
|
// 产出交班
|
event = 'DRAFTTOCHANGESHIFT'
|
outIds = this.multipleSelection
|
.filter((item) => {
|
return item.state === '01draft'
|
})
|
.map((ele) => {
|
return ele.id
|
})
|
if (outIds.length > 1) {
|
changeShiftFlag = false
|
}
|
if (outIds.length === 0) {
|
changeShiftNotEmptyFlag = false
|
}
|
} else {
|
// 产出撤回,产出撤回分2种,一种是交班的撤回、一种是已提交的撤回
|
|
const subOutIds = this.multipleSelection
|
.filter((item) => {
|
return item.state === '02submitted'
|
})
|
.map((ele) => {
|
return ele.id
|
})
|
const changeOutIds = this.multipleSelection
|
.filter((item) => {
|
return item.state === '03changeshift'
|
})
|
.map((ele) => {
|
return ele.id
|
})
|
if (subOutIds.length > 0 && changeOutIds.length <= 0) {
|
// 已提交的撤回
|
outIds = subOutIds
|
event = 'REVOKE'
|
} else if (subOutIds.length <= 0 && changeOutIds.length > 0) {
|
// 交班的撤回
|
outIds = changeOutIds
|
event = 'CHANGESHIFTTODRAFT'
|
} else {
|
returnFlag = false
|
}
|
}
|
if (changeShiftNotEmptyFlag) {
|
if (changeShiftFlag) {
|
if (returnFlag) {
|
changeProductOutPutState(outIds, event)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.queryProductMainDetail(this.currProductMainId)
|
this.$message.success(desc + '成功')
|
} else {
|
this.$message.error(desc + '失败')
|
}
|
})
|
.catch((error) => {})
|
} else {
|
this.$message.error(
|
'只有交班、已提交的产出可进行【产出撤回】,且交班和已提交的产出不能同时进行撤回!'
|
)
|
}
|
} else {
|
this.$message.error('只能对一条产出,进行交班!')
|
}
|
} else {
|
this.$message.error('只有草稿状态的产出,才能进行交班操作!')
|
}
|
}
|
} else {
|
this.$message.error('请选择' + desc + '的对象')
|
}
|
},
|
|
// 选中需要的投料
|
selectWorkstationFeed(val) {
|
if (val != null && val.length > 0) {
|
for (var i = 0; i < val.length; i++) {
|
this.addProductIn(val[i])
|
}
|
}
|
this.showProductInDialog = false
|
},
|
// 页面新增投入
|
addProductIn(inPartInfo) {
|
var productInput = {}
|
productInput.id = null
|
productInput.stockId = inPartInfo.id
|
productInput.inputQuantity = null
|
productInput.productMainId = this.currProductMainId
|
productInput.productNo = this.currProductMainNo
|
productInput.partNo = inPartInfo.partNo
|
productInput.partName = inPartInfo.partName
|
productInput.partDescription = null
|
productInput.unit = inPartInfo.unit
|
productInput.partBatchNo = inPartInfo.partBatchNo
|
productInput.availableStockQuantity = inPartInfo.availableStockQuantity
|
this.productInputList.push(productInput)
|
},
|
// 新增或更新投入信息,若存在id则更新、不存在则新增
|
addOrUpdateProductIn(currRow) {
|
if (currRow.inputQuantity != null && currRow.inputQuantity.trim != '') {
|
if (currRow.id != null) {
|
// 修改
|
const productIn = {}
|
productIn.id = currRow.id
|
productIn.inputQuantity = currRow.inputQuantity
|
updateProductInput(productIn)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.$message.success('更新投入成功')
|
// 刷新投料信息
|
this.$emit('refreshFeedsForDel')
|
} else {
|
this.$message.error('更新投入失败')
|
}
|
})
|
.catch((error) => {})
|
} else {
|
// 新增
|
const productIn = {}
|
productIn.stockId = currRow.stockId
|
productIn.productMainId = currRow.productMainId
|
productIn.inputQuantity = currRow.inputQuantity
|
saveProductInput(productIn)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.$message.success('添加投入成功')
|
currRow.id = data.data
|
// 刷新投料信息
|
this.$emit('refreshFeedsForDel')
|
} else {
|
this.$message.error('添加投入失败')
|
}
|
})
|
.catch((error) => {})
|
}
|
} else {
|
this.$message.error('投入不能为空')
|
}
|
},
|
// 删除投入信息,若存在投入id,则需调用后台删除并删除前端投入,若不存在,则只需删除前端投入
|
delProductIn(index, currRow) {
|
if (currRow.id != null) {
|
// 则需调用后台删除并删除前端投入
|
deleteProductInputById(currRow.id)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.productInputList.splice(index, 1)
|
this.$message.success('删除投入成功')
|
// 刷新投料信息
|
this.$emit('refreshFeedsForDel')
|
} else {
|
this.$message.error('删除投入失败')
|
}
|
})
|
.catch((error) => {})
|
} else {
|
// 删除前端投入
|
this.productInputList.splice(index, 1)
|
this.$message.success('删除投入成功')
|
}
|
},
|
// 添加产出
|
addProductOut() {
|
var productStaffs = []
|
var productStaffIds = []
|
if (this.currOperateTask.id != null) {
|
if (
|
this.currentDutyRecord != null &&
|
this.currentDutyRecord.id != null
|
) {
|
if (this.personBoardList != null && this.personBoardList.length > 0) {
|
this.parentInfo.workstationId = this.workstationId
|
this.parentInfo.operationTaskId = this.currOperateTask.id
|
this.parentInfo.currProductMainId = this.currProductMainId
|
this.parentInfo.currProductMainNo = this.currProductMainNo
|
this.parentInfo.partId = this.currOperateTask.partId
|
this.parentInfo.partNo = this.currOperateTask.partNo
|
this.parentInfo.partName = this.currOperateTask.partName
|
this.parentInfo.unit = this.currOperateTask.unit
|
this.parentInfo.sunit = this.currOperateTask.sunit
|
this.parentInfo.productOutId = null
|
// 给弹出框产量列表productList赋值
|
this.productList = []
|
var product
|
if (this.groupStatus) {
|
// 按人员报工,多条或一条记录
|
for (var i = 0; i < this.personBoardList.length; i++) {
|
product = {}
|
// cxf 0807 不清空会导致n次方的数据
|
productStaffs = []
|
productStaffIds = []
|
productStaffIds.push(this.personBoardList[i].staffId)
|
productStaffs.push(this.personBoardList[i].staffNo)
|
product.staffName = this.personBoardList[i].staffName
|
product.staffNo = this.personBoardList[i].staffNo
|
product.productNo = this.currProductMainNo
|
product.partId = this.currOperateTask.partId
|
product.partNo = this.currOperateTask.partNo
|
product.partName = this.currOperateTask.partName
|
// product.outBatchNo = this.getDayStr()
|
product.outBatchNo = null
|
product.reelNumber = null
|
product.startMeterMark = 0
|
product.endMeterMark = 0
|
product.productQty = 0
|
product.ifsBatchNo = null
|
product.unit = this.currOperateTask.unit
|
product.productStaffs = JSON.parse(
|
JSON.stringify(productStaffs)
|
)
|
product.productStaffIds = JSON.parse(
|
JSON.stringify(productStaffIds)
|
)
|
product.status = this.groupStatus
|
product.systemNo = null
|
product.date = null
|
product.dutyRecordId = this.currentDutyRecord.id
|
|
product.scrapQty = null
|
product.segmentDesc = null
|
product.remark = null
|
|
product.sproductQty = 0
|
product.sunit = this.currOperateTask.sunit
|
|
this.productList.push(product)
|
}
|
} else {
|
// 按班组报工,一条记录
|
var staffName = ''
|
var staffNo = ''
|
var staffId = ''
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffName += this.personBoardList[i].staffName + ','
|
}
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffNo += this.personBoardList[i].staffNo + ','
|
productStaffs.push(this.personBoardList[i].staffNo)
|
}
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffId += this.personBoardList[i].staffId + ','
|
productStaffIds.push(this.personBoardList[i].staffId)
|
}
|
staffName = staffName.substring(0, staffName.length - 1)
|
staffNo = staffNo.substring(0, staffNo.length - 1)
|
|
product = {}
|
product.staffName = staffName
|
product.staffNo = staffNo
|
product.productNo = this.currProductMainNo
|
product.partId = this.currOperateTask.partId
|
product.partNo = this.currOperateTask.partNo
|
product.partName = this.currOperateTask.partName
|
// product.outBatchNo = this.getDayStr()
|
product.outBatchNo = null
|
product.reelNumber = null
|
product.startMeterMark = 0
|
product.endMeterMark = 0
|
product.productQty = 0
|
product.ifsBatchNo = null
|
product.unit = this.currOperateTask.unit
|
product.productStaffs = productStaffs
|
product.productStaffIds = productStaffIds
|
product.status = this.groupStatus
|
product.systemNo = null
|
product.date = null
|
product.dutyRecordId = this.currentDutyRecord.id
|
|
product.scrapQty = null
|
product.segmentDesc = null
|
product.remark = null
|
|
product.sproductQty = 0
|
product.sunit = this.currOperateTask.sunit
|
|
this.productList.push(product)
|
}
|
// 弹出产量填写的dialog
|
this.showProductForm = true
|
} else {
|
this.$message.warning('当前没有人员,不可进行报工!')
|
}
|
} else {
|
this.$message.warning('当前没有上班记录,不可进行报工!')
|
}
|
} else {
|
this.$message.warning('请先选择工单')
|
}
|
},
|
// 添加批量产出
|
addBatchProductOut() {
|
if (!this.currOperateTask.id) {
|
this.$message.error('请选择工单!')
|
return
|
}
|
// 先判断,是否存在需要交接的产出
|
getShiftProductOutByOpIdAndWsId(
|
this.workstationId,
|
this.currOperateTask.id
|
).then((response) => {
|
var data = response.data
|
if (data.code === 0) {
|
if (data.data != null) {
|
// 是交班的新增
|
const lastShiftProductOut = data.data
|
if (
|
this.currentDutyRecord.id !== lastShiftProductOut.dutyRecordId
|
) {
|
this.$message.warning(
|
'工单下存在交班的产出,不可进行【批量产出】'
|
)
|
} else {
|
let productStaffs = []
|
let productStaffIds = []
|
if (this.currOperateTask.id != null) {
|
if (
|
this.currentDutyRecord != null &&
|
this.currentDutyRecord.id != null
|
) {
|
if (
|
this.personBoardList != null &&
|
this.personBoardList.length > 0
|
) {
|
this.parentInfo.workstationId = this.workstationId
|
this.parentInfo.operationTaskId = this.currOperateTask.id
|
this.parentInfo.currProductMainId = this.currProductMainId
|
this.parentInfo.currProductMainNo = this.currProductMainNo
|
this.parentInfo.partId = this.currOperateTask.partId
|
this.parentInfo.partNo = this.currOperateTask.partNo
|
this.parentInfo.partName = this.currOperateTask.partName
|
this.parentInfo.unit = this.currOperateTask.unit
|
this.parentInfo.sunit = this.currOperateTask.sunit
|
this.parentInfo.productOutId = null
|
// 给弹出框产量列表productList赋值
|
this.productList = []
|
let product
|
if (this.groupStatus) {
|
// 按人员报工,多条或一条记录
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
product = {}
|
// cxf 0807 不清空会导致n次方的数据
|
productStaffs = []
|
productStaffIds = []
|
productStaffIds.push(this.personBoardList[i].staffId)
|
productStaffs.push(this.personBoardList[i].staffNo)
|
product.staffName = this.personBoardList[i].staffName
|
product.staffNo = this.personBoardList[i].staffNo
|
product.productNo = this.currProductMainNo
|
product.partId = this.currOperateTask.partId
|
product.partNo = this.currOperateTask.partNo
|
product.partName = this.currOperateTask.partName
|
// product.outBatchNo = this.getDayStr()
|
product.outBatchNo = null
|
product.disNumber = null
|
product.productQty = 0
|
product.ifsBatchNo = null
|
product.unit = this.currOperateTask.unit
|
product.productStaffs = JSON.parse(
|
JSON.stringify(productStaffs)
|
)
|
product.productStaffIds = JSON.parse(
|
JSON.stringify(productStaffIds)
|
)
|
product.status = this.groupStatus
|
product.systemNo = null
|
product.date = null
|
product.dutyRecordId = this.currentDutyRecord.id
|
|
product.scrapQty = null
|
product.segmentDesc = null
|
product.remark = null
|
product.outBatchNo = null
|
product.reelNumber = null
|
|
product.sproductQty = 0
|
product.sunit = this.currOperateTask.sunit
|
|
this.productList.push(product)
|
}
|
} else {
|
// 按班组报工,一条记录
|
let staffName = ''
|
let staffNo = ''
|
let staffId = ''
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffName += this.personBoardList[i].staffName + ','
|
}
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffNo += this.personBoardList[i].staffNo + ','
|
productStaffs.push(this.personBoardList[i].staffNo)
|
}
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffId += this.personBoardList[i].staffId + ','
|
productStaffIds.push(this.personBoardList[i].staffId)
|
}
|
staffName = staffName.substring(0, staffName.length - 1)
|
staffNo = staffNo.substring(0, staffNo.length - 1)
|
|
product = {}
|
product.staffName = staffName
|
product.staffNo = staffNo
|
product.productNo = this.currProductMainNo
|
product.partId = this.currOperateTask.partId
|
product.partNo = this.currOperateTask.partNo
|
product.partName = this.currOperateTask.partName
|
// product.outBatchNo = this.getDayStr()
|
product.outBatchNo = null
|
product.disNumber = null
|
product.productQty = 0
|
product.ifsBatchNo = null
|
product.unit = this.currOperateTask.unit
|
product.productStaffs = productStaffs
|
product.productStaffIds = productStaffIds
|
product.status = this.groupStatus
|
product.systemNo = null
|
product.date = null
|
product.dutyRecordId = this.currentDutyRecord.id
|
|
product.scrapQty = null
|
product.segmentDesc = null
|
product.remark = null
|
product.outBatchNo = null
|
product.reelNumber = null
|
|
product.sproductQty = 0
|
product.sunit = this.currOperateTask.sunit
|
|
this.productList.push(product)
|
}
|
// 弹出产量填写的dialog
|
this.showBatchProductForm = true
|
} else {
|
this.$message.warning('当前没有人员,不可进行报工!')
|
}
|
} else {
|
this.$message.warning('当前没有上班记录,不可进行报工!')
|
}
|
} else {
|
this.$message.warning('请先选择工单')
|
}
|
}
|
} else {
|
let productStaffs = []
|
let productStaffIds = []
|
if (this.currOperateTask.id != null) {
|
if (
|
this.currentDutyRecord != null &&
|
this.currentDutyRecord.id != null
|
) {
|
if (
|
this.personBoardList != null &&
|
this.personBoardList.length > 0
|
) {
|
this.parentInfo.workstationId = this.workstationId
|
this.parentInfo.operationTaskId = this.currOperateTask.id
|
this.parentInfo.currProductMainId = this.currProductMainId
|
this.parentInfo.currProductMainNo = this.currProductMainNo
|
this.parentInfo.partId = this.currOperateTask.partId
|
this.parentInfo.partNo = this.currOperateTask.partNo
|
this.parentInfo.partName = this.currOperateTask.partName
|
this.parentInfo.unit = this.currOperateTask.unit
|
this.parentInfo.sunit = this.currOperateTask.sunit
|
this.parentInfo.productOutId = null
|
// 给弹出框产量列表productList赋值
|
this.productList = []
|
let product
|
if (this.groupStatus) {
|
// 按人员报工,多条或一条记录
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
product = {}
|
// cxf 0807 不清空会导致n次方的数据
|
productStaffs = []
|
productStaffIds = []
|
productStaffIds.push(this.personBoardList[i].staffId)
|
productStaffs.push(this.personBoardList[i].staffNo)
|
product.staffName = this.personBoardList[i].staffName
|
product.staffNo = this.personBoardList[i].staffNo
|
product.productNo = this.currProductMainNo
|
product.partId = this.currOperateTask.partId
|
product.partNo = this.currOperateTask.partNo
|
product.partName = this.currOperateTask.partName
|
// product.outBatchNo = this.getDayStr()
|
product.outBatchNo = null
|
product.disNumber = null
|
product.productQty = 0
|
product.ifsBatchNo = null
|
product.unit = this.currOperateTask.unit
|
product.productStaffs = JSON.parse(
|
JSON.stringify(productStaffs)
|
)
|
product.productStaffIds = JSON.parse(
|
JSON.stringify(productStaffIds)
|
)
|
product.status = this.groupStatus
|
product.systemNo = null
|
product.date = null
|
product.dutyRecordId = this.currentDutyRecord.id
|
|
product.scrapQty = null
|
product.segmentDesc = null
|
product.remark = null
|
product.outBatchNo = null
|
product.reelNumber = null
|
|
product.sproductQty = 0
|
product.sunit = this.currOperateTask.sunit
|
|
this.productList.push(product)
|
}
|
} else {
|
// 按班组报工,一条记录
|
let staffName = ''
|
let staffNo = ''
|
let staffId = ''
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffName += this.personBoardList[i].staffName + ','
|
}
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffNo += this.personBoardList[i].staffNo + ','
|
productStaffs.push(this.personBoardList[i].staffNo)
|
}
|
for (let i = 0; i < this.personBoardList.length; i++) {
|
staffId += this.personBoardList[i].staffId + ','
|
productStaffIds.push(this.personBoardList[i].staffId)
|
}
|
staffName = staffName.substring(0, staffName.length - 1)
|
staffNo = staffNo.substring(0, staffNo.length - 1)
|
|
product = {}
|
product.staffName = staffName
|
product.staffNo = staffNo
|
product.productNo = this.currProductMainNo
|
product.partId = this.currOperateTask.partId
|
product.partNo = this.currOperateTask.partNo
|
product.partName = this.currOperateTask.partName
|
// product.outBatchNo = this.getDayStr()
|
product.outBatchNo = null
|
product.disNumber = null
|
product.productQty = 0
|
product.ifsBatchNo = null
|
product.unit = this.currOperateTask.unit
|
product.productStaffs = productStaffs
|
product.productStaffIds = productStaffIds
|
product.status = this.groupStatus
|
product.systemNo = null
|
product.date = null
|
product.dutyRecordId = this.currentDutyRecord.id
|
|
product.scrapQty = null
|
product.segmentDesc = null
|
product.remark = null
|
product.outBatchNo = null
|
product.reelNumber = null
|
|
product.sproductQty = 0
|
product.sunit = this.currOperateTask.sunit
|
|
this.productList.push(product)
|
}
|
// 弹出产量填写的dialog
|
this.showBatchProductForm = true
|
} else {
|
this.$message.warning('当前没有人员,不可进行报工!')
|
}
|
} else {
|
this.$message.warning('当前没有上班记录,不可进行报工!')
|
}
|
} else {
|
this.$message.warning('请先选择工单')
|
}
|
}
|
}
|
})
|
},
|
// 产出保存之后,刷新页面
|
refreshProductOutputList(val) {
|
var productMainId = val
|
if (productMainId) {
|
Promise.all([
|
// 刷新报告列表、投入零件列表、产出零件列表
|
this.queryProductMain(this.currOperateTask.id),
|
this.queryProductMainDetail(productMainId)
|
]).then((res) => {
|
// 选中报告列表值
|
if (this.productMainList.length > 0) {
|
this.currProductMainId = productMainId
|
var currProductMain = this.productMainList.find(
|
(item) => item.id === this.currProductMainId
|
)
|
if (currProductMain != null) {
|
this.currProductMainNo = currProductMain.productNo
|
this.currProductMainState = currProductMain.state
|
if (this.currProductMainState == '02submitted') {
|
this.currProductMainDisable = true
|
} else {
|
this.currProductMainDisable = false
|
}
|
} else {
|
this.currProductMainNo = null
|
}
|
}
|
// 刷新投料信息
|
this.$emit('refreshFeeds')
|
// 刷新人工信息
|
this.$emit('refreshArtificial')
|
// 刷新产出记录
|
this.$emit('refreshProductOutput')
|
// 刷新当前工单状态
|
this.$emit('refreshCurrOpTask')
|
})
|
}
|
},
|
// 编辑修改产出
|
editProductOut(index, currRow) {
|
// 查询当前产出信息的详情
|
getProductOutInfoById(currRow.id)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
var productOutInfos = data.data
|
if (productOutInfos != null && productOutInfos.length > 0) {
|
this.parentInfo.workstationId = this.workstationId
|
this.parentInfo.operationTaskId = this.currOperateTask.id
|
this.parentInfo.currProductMainId = this.currProductMainId
|
this.parentInfo.currProductMainNo = this.currProductMainNo
|
this.parentInfo.partId = this.currOperateTask.partId
|
this.parentInfo.partNo = this.currOperateTask.partNo
|
this.parentInfo.partName = this.currOperateTask.partName
|
this.parentInfo.unit = this.currOperateTask.unit
|
this.parentInfo.sunit = this.currOperateTask.sunit
|
this.parentInfo.productOutId = currRow.id
|
this.productList = []
|
var product
|
for (var i = 0; i < productOutInfos.length; i++) {
|
product = {}
|
product.staffName = productOutInfos[i].staffName
|
product.staffNo = productOutInfos[i].staffNo
|
product.staffId = productOutInfos[i].staffId
|
product.productNo = this.currProductMainNo
|
product.partId = productOutInfos[i].partId
|
product.partNo = productOutInfos[i].partNo
|
product.partName = productOutInfos[i].partName
|
product.outBatchNo = productOutInfos[i].outBatchNo
|
product.reelNumber = productOutInfos[i].reelNumber
|
product.startMeterMark = productOutInfos[i].startMeterMark
|
product.endMeterMark = productOutInfos[i].endMeterMark
|
product.productQty = productOutInfos[i].quantity
|
product.unit = productOutInfos[i].unit
|
product.systemNo = productOutInfos[i].systemNo
|
product.status = productOutInfos[i].status
|
product.date = productOutInfos[i].date
|
product.dutyRecordId = productOutInfos[i].dutyRecordId
|
product.productStaffs = productOutInfos[i].staffNo.split(',')
|
product.productStaffIds = productOutInfos[i].staffId.split(',')
|
product.ifsBatchNo = productOutInfos[i].ifsBatchNo
|
|
product.scrapQty = productOutInfos[i].scrapQty
|
product.segmentDesc = productOutInfos[i].segmentDesc
|
product.remark = productOutInfos[i].remark
|
product.sproductQty = productOutInfos[i].sproductQty
|
product.sunit = this.currOperateTask.sunit
|
|
this.productList.push(product)
|
}
|
// 弹出产量填写的dialog
|
this.showProductForm = true
|
} else {
|
this.$message.error('未找到产出详情!')
|
}
|
} else {
|
this.$message.error('未找到产出详情!')
|
}
|
})
|
.catch((error) => {
|
console.log('产出信息详情查询异常')
|
})
|
},
|
// 删除产出,若存在产出id,则需调用后台删除并刷新列表,若不存在,则只需删除前端产出
|
delProductOut(index, currRow) {
|
if (currRow.id != null) {
|
// 则需调用后台删除并刷新列表deleteProductOutputById
|
this.$confirm('此操作将永久删除该产出, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(() => {
|
deleteProductOutputById(currRow.id)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.$message.success('删除产出成功')
|
this.queryProductMainDetail(currRow.productMainId)
|
// 刷新投料信息
|
this.$emit('refreshFeedsForDel')
|
// 刷新人工信息
|
this.$emit('refreshArtificial')
|
// 刷新产出记录
|
this.$emit('refreshProductOutput')
|
} else {
|
this.$message.error('删除产出失败')
|
}
|
})
|
.catch((error) => {})
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
})
|
})
|
} else {
|
// 删除前端产出
|
this.productOutputList.splice(index, 1)
|
this.$message.success('删除产出成功')
|
}
|
},
|
// 批量删除产出,只有草稿状态的才能删除01draft state
|
batchDelProductOut() {
|
if (this.multipleSelection.length > 0) {
|
const outIds = this.multipleSelection
|
.filter((item) => {
|
return item.state === '01draft'
|
})
|
.map((ele) => {
|
return ele.id
|
})
|
if (outIds.length > 0) {
|
deleteProductOutputByIds(outIds)
|
.then((response) => {
|
var data = response.data
|
if (data.code == 0) {
|
this.queryProductMainDetail(this.currProductMainId)
|
this.$message.success('批量删除成功')
|
// 刷新投料信息
|
this.$emit('refreshFeedsForDel')
|
// 刷新人工信息
|
this.$emit('refreshArtificial')
|
// 刷新产出记录
|
this.$emit('refreshProductOutput')
|
} else {
|
this.$message.error('批量删除失败')
|
}
|
})
|
.catch((error) => {})
|
} else {
|
this.$message.error('只有草稿状态的产出,才能进行删除操作')
|
}
|
} else {
|
this.$message.error('请选择批量删除的对象')
|
}
|
},
|
// 获取年月日字符串
|
getDayStr() {
|
var date = new Date()
|
var fullYear = date.getFullYear()
|
var month = date.getMonth()
|
var day = date.getDate()
|
month = month + 1
|
var monthStr
|
var dayStr
|
if (month <= 9) {
|
monthStr = '0' + month
|
} else {
|
monthStr = '' + month
|
}
|
if (day <= 9) {
|
dayStr = '0' + day
|
} else {
|
dayStr = '' + day
|
}
|
return fullYear + monthStr + dayStr
|
},
|
// 初始化页面变量
|
initTracking() {
|
this.productMainList = []
|
this.productOutputList = []
|
this.productInputList = []
|
this.currProductMainId = null
|
this.currProductMainNo = null
|
this.currProductMainState = null
|
this.currProductMainDisable = null
|
this.showProductInDialog = false
|
this.secondTableHeight = null
|
this.groupStatus = false
|
this.productList = []
|
this.parentInfo = {
|
workstationId: null,
|
operationTaskId: null,
|
currProductMainId: null,
|
productOutId: null,
|
currProductMainNo: null,
|
partId: null,
|
partNo: null,
|
partName: null,
|
unit: null,
|
sunit: null
|
}
|
this.showProductForm = false
|
this.showBatchProductForm = false
|
},
|
printLabel(row) {
|
const queryParam = {
|
type: 1,
|
id: row.id
|
}
|
getPrintUrl(queryParam).then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
const url = resData.data
|
window.open(url)
|
} else {
|
this.$message.error('获取积木报表url失败')
|
}
|
})
|
},
|
// 全投
|
allIn(index, currRow) {
|
if (currRow.inputQuantity != null && currRow.inputQuantity != '') {
|
currRow.inputQuantity =
|
currRow.inputQuantity + currRow.availableStockQuantity
|
currRow.inputQuantity = Number(currRow.inputQuantity.toFixed(6))
|
currRow.availableStockQuantity = 0
|
} else {
|
currRow.inputQuantity = currRow.availableStockQuantity
|
currRow.availableStockQuantity = 0
|
}
|
}
|
},
|
watch: {
|
currOperateTask: {
|
handler(newValue, oldValue) {
|
if (newValue.id) {
|
// 查询工单下所有报工productMainList
|
this.queryProductMain(newValue.id)
|
} else {
|
// 清空productMainList
|
this.productMainList = []
|
}
|
// 置空明细、置空当前报工
|
this.productOutputList = []
|
this.productInputList = []
|
this.currProductMainId = null
|
this.currProductMainNo = null
|
this.currProductMainState = null
|
this.currProductMainDisable = false
|
},
|
deep: true
|
},
|
workstationId() {
|
this.initTracking()
|
}
|
}
|
}
|
</script>
|