<!--
|
* @Descripttion:
|
* @version:
|
* @Author: zt_lc
|
* @Date: 2022-06-08 15:49:37
|
* @LastEditors: zt_lc
|
* @LastEditTime: 2022-08-18 14:07:40
|
-->
|
<template>
|
<el-dialog
|
width="95%"
|
title="批量产出"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
:close-on-click-modal="false"
|
class="product-out-by-batch-form"
|
>
|
<div
|
style="float: left;width: 15%;box-sizing: border-box;padding-right: 34px;position: relative"
|
>
|
<el-table
|
stripe
|
ref="productOutPersonList"
|
:data="personBoardList"
|
@selection-change="productOutPersonSelectionChange"
|
:row-style="{ height: '26px' }"
|
:cell-style="{ padding: '0' }"
|
>
|
<el-table-column type="selection" />
|
<el-table-column
|
label="人员名称"
|
prop="staffName"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
<el-table-column
|
label="人员编号"
|
prop="staffNo"
|
align="center"
|
min-width="75px"
|
:show-overflow-tooltip="true"
|
/>
|
</el-table>
|
<div
|
style="position: absolute;top:0px;right: 0px;height: 100%;width: 34px;border-left: 1px solid #f4f2ea;border-right: 1px solid #f4f2ea;"
|
></div>
|
</div>
|
<div style="float: left;width: 85%">
|
<el-row style="">
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>序号</span></el-col
|
><el-col :span="2" class="product-out-by-batch-form-header-col"
|
><span>零件编号</span></el-col
|
><el-col :span="2" class="product-out-by-batch-form-header-col"
|
><span>零件名称</span></el-col
|
>
|
<el-col :span="4" class="product-out-by-batch-form-header-col"
|
><span>SN号</span></el-col
|
>
|
<el-col :span="2" class="product-out-by-batch-form-header-col"
|
><span>载具编号</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>盘数</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>每盘产量</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>起始米标</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>截止米标</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>单位</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>分段描述</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>报废数量</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>盘具重量</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>毛重</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>IFS批次号</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>生产人员</span></el-col
|
><el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>备注</span></el-col
|
>
|
<el-col :span="1" class="product-out-by-batch-form-header-col"
|
><span>操作</span></el-col
|
>
|
</el-row>
|
<div class="product-out-by-batch-form-body-div">
|
<el-row v-for="(item, index) in products" :key="item.id">
|
<el-col :span="1" class="product-out-by-batch-form-body-col">
|
<span>{{ index + 1 }}</span>
|
</el-col>
|
<el-col :span="2" class="product-out-by-batch-form-body-col">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
:content="item.partNo"
|
placement="top"
|
>
|
<span class="inline-el-hidden">{{ item.partNo }}</span>
|
</el-tooltip>
|
</el-col>
|
<el-col :span="2" class="product-out-by-batch-form-body-col">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
:content="item.partName"
|
placement="top"
|
>
|
<span class="inline-el-hidden">{{ item.partName }}</span>
|
</el-tooltip>
|
</el-col>
|
<el-col :span="4" class="product-out-by-batch-form-body-col">
|
<span>{{ item.outBatchNo }}</span>
|
</el-col>
|
<el-col :span="2" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.reelNumber"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<span>{{ item.disNumber }}</span>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<span>{{ item.productQty }}</span>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.startMeterMark"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.endMeterMark"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col">
|
<span>{{ item.unit }}</span>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.segmentDesc"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.scrapQty"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.reelWeight"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.grossWeight"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.ifsBatchNo"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col">
|
<el-tooltip
|
class="item"
|
effect="dark"
|
:content="item.staffName"
|
placement="top"
|
>
|
<span class="inline-el-hidden">{{ item.staffName }}</span>
|
</el-tooltip>
|
</el-col>
|
<!--<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.remark"></el-input>
|
</el-col>-->
|
<el-col :span="1" class="product-out-by-batch-form-body-col l-mes">
|
<el-input v-model="item.mainRemark"></el-input>
|
</el-col>
|
<el-col :span="1" class="product-out-by-batch-form-body-col">
|
<span
|
v-if="item.status && item.dutyRecordId == currentDutyRecord.id"
|
style="cursor: pointer;color: red;"
|
@click="delStaff(index)"
|
>删除</span
|
>
|
</el-col>
|
</el-row>
|
</div>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<div style="display: inline-block;width: 25%;float: left">
|
<el-button
|
style="margin-right: 34px"
|
type="primary"
|
@click="addProductOutForPerson"
|
>添加</el-button
|
>
|
</div>
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button
|
type="primary"
|
:disabled="saveDisabled"
|
@click="saveProductOuts"
|
>确 定</el-button
|
>
|
</div>
|
<TaskSecretForm
|
:currshowlist.sync="showTaskSecretForm"
|
@confirmSecret="confirmSecret"
|
:tackingList="confirmList"
|
:tipeInfo="tipeInfo"
|
/>
|
</el-dialog>
|
</template>
|
<style>
|
.product-out-by-batch-form .el-dialog__body {
|
padding-bottom: 0px;
|
}
|
|
.product-out-by-batch-form .el-dialog__body:after {
|
content: '';
|
clear: both;
|
overflow: hidden;
|
display: block;
|
visibility: hidden;
|
}
|
|
.product-out-by-batch-form .el-dialog__body .el-table__header th {
|
padding-top: 0px;
|
}
|
|
.product-out-by-batch-form .el-dialog__body .el-table__body-wrapper {
|
height: 260px;
|
overflow-y: auto;
|
}
|
|
.product-out-by-batch-form .el-dialog__body .el-table::before {
|
height: 0px;
|
}
|
.product-out-by-batch-form .el-dialog__body .add-button span {
|
}
|
|
.product-out-by-batch-form-header-col {
|
text-align: center;
|
color: rgb(144, 147, 153);
|
font-weight: 700;
|
line-height: 23px;
|
font-size: 12px;
|
}
|
|
.product-out-by-batch-form-body-col {
|
text-align: center;
|
color: rgb(96, 98, 102);
|
font-size: 12px;
|
margin-bottom: 1px;
|
}
|
|
.product-out-by-batch-form-body-col .el-input {
|
width: 80%;
|
}
|
|
.product-out-by-batch-form-body-col .el-input input {
|
text-align: center;
|
}
|
|
.product-out-by-batch-form-body-col span {
|
line-height: 32px;
|
}
|
|
.product-out-by-batch-form-body-div {
|
height: 260px;
|
overflow-y: auto;
|
}
|
|
.item {
|
margin: 4px;
|
}
|
/*
|
字符串过长时,隐藏显示省略号
|
*/
|
.inline-el-hidden {
|
display: block;
|
width: 93%;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
margin: 0 auto;
|
}
|
</style>
|
<script>
|
import {
|
batchSaveProductMain,
|
validateOverProduction,
|
validateOverFeed
|
} from '@/api/product/personboard'
|
import ElButton from '../../../../node_modules/element-ui/packages/button/src/button.vue'
|
import TaskSecretForm from './task-secret-form.vue'
|
export default {
|
components: { ElButton, TaskSecretForm },
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
productList: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
},
|
parentInfo: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
currentDutyRecord: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
personBoardList: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
},
|
groupStatus: {
|
type: Boolean,
|
default: false // true是按人员报工,false是按组报工
|
},
|
orderSnGenerateIdList: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
},
|
discToolMeasurementVal: {
|
type: String,
|
default: ''
|
}
|
},
|
data() {
|
return {
|
innerVisible: false,
|
personSelection: [],
|
saveDisabled: false,
|
currDutyInitproducts: [], // 用于缓存页面中原有的staff产出记录,并且是属于当前班次下的,用于勾选人员时作为原数据参照
|
products: [],
|
clickDateArr: [],
|
isChangeShift: false,
|
showOutPutBatch: false,
|
currOutPut: null,
|
showTaskSecretForm: false,
|
confirmList: [],
|
tipeInfo: null,
|
messageMap: {}
|
}
|
},
|
methods: {
|
isNumber(value) {
|
var reg = /^[0-9]+(.[0-9]{1,4})?$/
|
if (
|
value == undefined ||
|
value == null ||
|
value === '' ||
|
value.trim === ''
|
) {
|
return false
|
} else {
|
if (!reg.test(value)) {
|
return false
|
} else {
|
return true
|
}
|
}
|
},
|
isPositiveIntegerNumber(value) {
|
var reg = /^[1-9]\d*$/
|
if (
|
value == undefined ||
|
value == null ||
|
value === '' ||
|
value.trim === ''
|
) {
|
return false
|
} else {
|
if (!reg.test(value)) {
|
return false
|
} else {
|
return true
|
}
|
}
|
},
|
setOutBatchNo(val) {
|
this.products.forEach(function(el) {
|
el.outBatchNo = val
|
})
|
},
|
// 选中人员,人员变动时,去更新products
|
productOutPersonSelectionChange(val) {
|
// 已选中人员集合val为准,去currDutyInitproducts寻找相同人员(且同班次、按人员,已进行过滤)的信息,若currDutyInitproducts中不存在,则自行组装信息。选中人员信息组合完毕后,
|
// 再去与products(此为页面的实时数据,用户有改动即更新)对比,将其中存在的相同人员的生产数量和生产批次同步过来,若products中生产数量或生产批次不存在值,则不进行同步,沿用原来的。
|
// 最后,将组装好的选中人员信息,更新到products(按照班次进行),注意更新之后选中人员信息在products位置顺序
|
this.personSelection = val
|
},
|
// 根据选中的人员,生成人员产出信息,并且放在右边列表的最前面
|
addProductOutForPerson() {
|
if (this.personSelection != null && this.personSelection.length > 0) {
|
// 理论上来说,products的长度肯定大于0
|
var productCopyList = this.products
|
this.products = []
|
// 获取第一条的生产批次,用于继承
|
var oriOutBatchNo = ''
|
if (productCopyList != null && productCopyList.length > 0) {
|
oriOutBatchNo = productCopyList[0].outBatchNo
|
}
|
var newProduct
|
for (let i = 0; i < this.personSelection.length; i++) {
|
newProduct = {}
|
var productStaffs = []
|
var productStaffIds = []
|
productStaffIds.push(this.personSelection[i].staffId)
|
productStaffs.push(this.personSelection[i].staffNo)
|
newProduct.staffName = this.personSelection[i].staffName
|
newProduct.staffNo = this.personSelection[i].staffNo
|
newProduct.productNo = this.parentInfo.currProductMainNo
|
newProduct.partId = this.parentInfo.partId
|
newProduct.partNo = this.parentInfo.partNo
|
newProduct.partName = this.parentInfo.partName
|
newProduct.outBatchNo = oriOutBatchNo
|
newProduct.productQty = 0
|
newProduct.unit = this.parentInfo.unit
|
newProduct.productStaffs = productStaffs
|
newProduct.productStaffIds = productStaffIds
|
newProduct.status = true
|
newProduct.systemNo = null
|
newProduct.date = null
|
newProduct.dutyRecordId = this.currentDutyRecord.id
|
newProduct.startMeterMark = 0
|
newProduct.endMeterMark = 0
|
newProduct.reelNumber = null
|
newProduct.ifsBatchNo = null
|
newProduct.scrapQty = null
|
newProduct.reelWeight = null
|
newProduct.grossWeight = null
|
newProduct.segmentDesc = null
|
newProduct.remark = null
|
newProduct.sproductQty = 0
|
newProduct.batchNoEdit = false
|
newProduct.mainRemark = null
|
this.products.push(newProduct)
|
}
|
if (productCopyList != null && productCopyList.length > 0) {
|
for (let i = 0; i < productCopyList.length; i++) {
|
this.products.push(productCopyList[i])
|
}
|
}
|
} else {
|
this.$message.warning('若想添加产出,请先选中人员!')
|
}
|
},
|
delStaff(index) {
|
this.products.splice(index, 1)
|
this.$message.success('删除成功')
|
},
|
cleanOutBatchNo(row) {
|
row.outBatchNo = null
|
},
|
setOutBatchNoMode(row) {
|
if (Number(row.disNumber) == 1) {
|
row.batchNoEdit = false
|
} else {
|
row.batchNoEdit = false
|
// row.outBatchNo = null
|
}
|
},
|
saveProductOuts() {
|
var canClickFlag = true
|
this.clickDateArr.push(new Date().getTime())
|
if (this.clickDateArr.length > 1) {
|
if (
|
this.clickDateArr[this.clickDateArr.length - 1] -
|
this.clickDateArr[this.clickDateArr.length - 2] <
|
2000
|
) {
|
// 小于2秒则认为重复提交
|
canClickFlag = false
|
}
|
}
|
|
if (canClickFlag) {
|
this.saveDisabled = true
|
if (this.products != null && this.products.length > 0) {
|
// 校验生产批次、生产数量
|
var validateMsg = ''
|
var validateFlag = true
|
|
let s_list = [] // 需要保存的数据
|
const p_list = JSON.parse(JSON.stringify(this.products))
|
|
/**
|
* 按人员新增产出时,只对盘数大于等于1的产出新增报工单。过滤掉未填写的行即可
|
* 按组报工保持不变
|
**/
|
if (this.groupStatus) {
|
// 按人员报工,过滤填写盘数的
|
p_list.forEach((el) => {
|
if (el.disNumber) {
|
s_list.push(el)
|
}
|
})
|
} else {
|
// 按组报工
|
s_list = JSON.parse(JSON.stringify(p_list))
|
}
|
|
if (s_list.length <= 0) {
|
this.$message.error('报工,请填写盘数!')
|
this.saveDisabled = false
|
return
|
}
|
let totalDisNumber = 0
|
for (let i = 0; i < s_list.length; i++) {
|
// 盘数校验
|
if (!this.isPositiveIntegerNumber(s_list[i].disNumber)) {
|
validateFlag = false
|
if (this.groupStatus) {
|
validateMsg =
|
'人员:' +
|
s_list[i].staffName +
|
',所在行,【盘数】请输入正整数!'
|
} else {
|
validateMsg = '第' + (i + 1) + '行,【盘数】请输入正整数!'
|
}
|
break
|
}
|
totalDisNumber += s_list[i].disNumber - 0
|
// 起始米标校验
|
if (!this.isNumber(s_list[i].startMeterMark)) {
|
validateFlag = false
|
validateMsg =
|
'第' + (i + 1) + '行,【起始米标】请输入非负数,小数位最多4位!'
|
break
|
}
|
// 截止米标校验
|
if (!this.isNumber(s_list[i].endMeterMark)) {
|
validateFlag = false
|
validateMsg =
|
'第' + (i + 1) + '行,【截止米标】请输入非负数,小数位最多4位!'
|
break
|
}
|
// 截止米标需大于开始米标
|
if (
|
Number(s_list[i].endMeterMark) < Number(s_list[i].startMeterMark)
|
) {
|
validateFlag = false
|
validateMsg =
|
'第' + (i + 1) + '行,【截止米标】需大于【起始米标】'
|
break
|
}
|
}
|
const maxDisNumber = 2000 // 最大盘数
|
if (totalDisNumber > maxDisNumber) {
|
validateMsg = '总盘数不能大于' + maxDisNumber + '!'
|
validateFlag = false
|
}
|
if (validateFlag) {
|
if (this.parentInfo.productOutId == null) {
|
// 当前是产出的新增
|
const list = []
|
for (let i = 0; i < s_list.length; i++) {
|
var productVo = {}
|
productVo.isChangeShift = this.isChangeShift
|
productVo.id = this.parentInfo.currProductMainId
|
productVo.workstationId = this.parentInfo.workstationId
|
productVo.operationTaskId = this.parentInfo.operationTaskId
|
productVo.discsNumber = s_list[i].disNumber
|
productVo.mainRemark = s_list[i].mainRemark
|
var productOuts = []
|
var productOut = {}
|
productOut.workstationId = this.parentInfo.workstationId
|
productOut.operationTaskId = this.parentInfo.operationTaskId
|
productOut.partId = s_list[i].partId
|
productOut.disNumber = s_list[i].disNumber
|
productOut.productQty = s_list[i].productQty
|
productOut.productStaffs = s_list[i].productStaffs
|
productOut.productStaffIds = s_list[i].productStaffIds
|
productOut.outBatchNo = s_list[i].outBatchNo
|
productOut.status = s_list[i].status
|
productOut.dutyRecordId = s_list[i].dutyRecordId
|
productOut.startMeterMark = s_list[i].startMeterMark
|
productOut.endMeterMark = s_list[i].endMeterMark
|
|
productOut.outBatchNo = s_list[i].outBatchNo
|
productOut.reelNumber = s_list[i].reelNumber
|
productOut.ifsBatchNo = s_list[i].ifsBatchNo
|
productOut.scrapQty = s_list[i].scrapQty
|
productOut.reelWeight = s_list[i].reelWeight
|
productOut.grossWeight = s_list[i].grossWeight
|
productOut.segmentDesc = s_list[i].segmentDesc
|
productOut.remark = s_list[i].remark
|
productOut.sproductQty = s_list[i].sproductQty
|
productOut.mainRemark = s_list[i].mainRemark
|
productOut.discToolMeasurement = this.discToolMeasurementVal
|
|
productOuts.push(productOut)
|
productVo.productOutputList = productOuts
|
list.push(productVo)
|
}
|
// 先去校验当前工单是否已生产超量,若超量则弹出密码输入框,若不超量,继续报工
|
// 分量提交-每次100条
|
const listDisNumber = [] // 原始盘数
|
for (let i = 0; i < list.length; i++) {
|
listDisNumber.push(list[i].discsNumber)
|
}
|
this.messageMap = {}
|
|
validateOverProduction(list)
|
.then((response) => {
|
const resData = response.data
|
if (resData.code === 0) {
|
if (resData.data.success) {
|
// 校验投料是否充足
|
validateOverFeed(list)
|
.then((resp) => {
|
const respData = resp.data
|
if (respData.code == 0) {
|
if (respData.data.success) {
|
// 分段提交
|
this.pieceSubmit(list, 0, listDisNumber, 0)
|
} else {
|
// 投料不足,提示人工选择
|
// respData.data.message
|
let confirmInfo = ''
|
const confirmMessage = respData.data.message
|
confirmMessage.forEach((item) => {
|
confirmInfo = confirmInfo + item + ';<br>'
|
})
|
this.$confirm(
|
confirmInfo +
|
'<span style="color:red;">是否继续报工?</span>',
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
customClass: 'validate-over-feed-message',
|
dangerouslyUseHTMLString: true,
|
closeOnClickModal: false
|
}
|
)
|
.then(() => {
|
// 分段提交
|
this.pieceSubmit(list, 0, listDisNumber, 0)
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消报工'
|
})
|
this.saveDisabled = false
|
})
|
}
|
} else {
|
this.$message.error('投料是否充足校验失败')
|
this.saveDisabled = false
|
}
|
})
|
.catch((error) => {
|
console.log('失败' + new Date().getTime())
|
this.saveDisabled = false
|
})
|
} else {
|
// 弹出密码框
|
this.tipeInfo = resData.data.message
|
this.showTaskSecretForm = true
|
this.confirmList = list
|
this.saveDisabled = false
|
}
|
} else {
|
this.$message.error('工单数量校验失败')
|
this.saveDisabled = false
|
}
|
})
|
.catch((error) => {
|
console.log('失败' + new Date().getTime())
|
this.saveDisabled = false
|
})
|
}
|
} else {
|
this.$message.error(validateMsg)
|
this.saveDisabled = false
|
}
|
} else {
|
this.$message.warning('无产出数据可提交!')
|
this.saveDisabled = false
|
}
|
}
|
},
|
// 分段提交
|
pieceSubmit(oriList, idx, listDisNumber, nowListIndex) {
|
const disNumber = listDisNumber[nowListIndex]
|
const once = 100 // 每次提交数量
|
const submitCount = Math.ceil(disNumber / once) // 该条总提交次数
|
const count = idx + 1 // 当前第几次
|
const loading = this.$loading({
|
lock: true,
|
text:
|
'正在处理序号' +
|
(nowListIndex + 1) +
|
' (' +
|
(idx * once + 1) +
|
'~' +
|
Math.min(count * once, disNumber) +
|
')/' +
|
disNumber,
|
spinner: 'el-icon-loading',
|
background: 'rgba(0, 0, 0, 0.7)'
|
})
|
|
const list = []
|
list.push(oriList[nowListIndex])
|
// 将数据的盘数 分成段后 更新此次盘数
|
const thisNumber = Math.min(once, disNumber - idx * once)
|
if (thisNumber > 0) {
|
// 修改盘数
|
list[0].discsNumber = thisNumber
|
for (let i = 0; i < list[0].productOutputList.length; i++) {
|
list[0].productOutputList[i].disNumber = thisNumber
|
}
|
}
|
list.forEach((ele) => {
|
ele.orderSnGenerateIdList = this.orderSnGenerateIdList
|
})
|
// 提交
|
batchSaveProductMain(list)
|
.then((res) => {
|
var data = res.data
|
if (data.code == 0) {
|
// 返回报工主表id,用于刷新页面
|
var productMainId = data.data
|
// console.log(idx)
|
// console.log(submitCount)
|
// console.log(listDisNumber)
|
loading.close()
|
// 已完成数据 消息记录
|
this.messageMap['' + nowListIndex] =
|
(this.messageMap['' + nowListIndex] || 0) + thisNumber
|
if (
|
nowListIndex < listDisNumber.length - 1 ||
|
idx < submitCount - 1
|
) {
|
idx++
|
if (disNumber <= idx * once) {
|
// 下一个序号的
|
nowListIndex++
|
idx = 0
|
}
|
this.pieceSubmit(oriList, idx, listDisNumber, nowListIndex)
|
} else {
|
// 批量提交完成,刷新报工页面数据
|
this.$emit('refreshTaskDetailInfoList')
|
console.log(this.messageMap)
|
this.$message.success('新增成功')
|
this.innerVisible = false
|
}
|
} else {
|
this.$message.error('新增失败')
|
}
|
this.saveDisabled = false
|
loading.close()
|
})
|
.catch((error) => {
|
loading.close()
|
console.log('失败' + new Date().getTime())
|
this.saveDisabled = false
|
this.showError()
|
})
|
},
|
|
showError() {
|
const msg = Object.keys(this.messageMap)
|
.map((item, i) => {
|
return '序号' + (i + 1) + '已成功新增' + this.messageMap[item] + '条'
|
})
|
.join(';')
|
if (msg) {
|
this.$message.error('发生错误! ' + msg)
|
}
|
},
|
confirmSecret() {
|
// 准备分量提交-每次100条
|
const listDisNumber = [] // 原始盘数
|
for (let i = 0; i < this.confirmList.length; i++) {
|
listDisNumber.push(this.confirmList[i].discsNumber)
|
}
|
// 校验投料是否充足
|
validateOverFeed(this.confirmList)
|
.then((resp) => {
|
const respData = resp.data
|
if (respData.code == 0) {
|
if (respData.data.success) {
|
// 分段提交
|
this.pieceSubmit(this.confirmList, 0, listDisNumber, 0)
|
} else {
|
// 投料不足,提示人工选择
|
// respData.data.message
|
let confirmInfo = ''
|
const confirmMessage = respData.data.message
|
confirmMessage.forEach((item) => {
|
confirmInfo = confirmInfo + item + ';<br>'
|
})
|
this.$confirm(
|
confirmInfo + '<span style="color:red;">是否继续报工?</span>',
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning',
|
customClass: 'validate-over-feed-message',
|
dangerouslyUseHTMLString: true,
|
closeOnClickModal: false
|
}
|
)
|
.then(() => {
|
// 分段提交
|
this.pieceSubmit(this.confirmList, 0, listDisNumber, 0)
|
})
|
.catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消报工'
|
})
|
this.saveDisabled = false
|
})
|
}
|
} else {
|
this.$message.error('投料是否充足校验失败')
|
this.saveDisabled = false
|
}
|
})
|
.catch((error) => {
|
console.log('失败' + new Date().getTime())
|
this.saveDisabled = false
|
})
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.clickDateArr = []
|
this.products = []
|
this.isChangeShift = false
|
if (this.parentInfo.productOutId == null) {
|
for (let i = 0; i < this.productList.length; i++) {
|
this.products.push(this.productList[i])
|
}
|
this.$nextTick(() => {
|
this.$refs.productOutPersonList.clearSelection()
|
})
|
} else {
|
for (let i = 0; i < this.productList.length; i++) {
|
this.products.push(this.productList[i])
|
}
|
this.$nextTick(() => {
|
this.$refs.productOutPersonList.clearSelection()
|
})
|
}
|
}
|
}
|
}
|
}
|
</script>
|