<!--
|
* @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="90%"
|
title="分割表单"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
:close-on-click-modal="false"
|
class="split-task-form"
|
>
|
<div
|
style="width: 100%;box-sizing: border-box;display:flex;margin-bottom:10px;"
|
>
|
<div style="line-height:32px;margin-right:10px;font-size:15px;">
|
<span>任务类型</span>
|
</div>
|
<div>
|
<el-select
|
v-model="taskType"
|
placeholder="请选择"
|
@change="taskTypeChange"
|
>
|
<el-option
|
v-for="item in taskTypeOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
<div
|
style="width: 100%;box-sizing: border-box;display:flex;justify-content:space-between;"
|
>
|
<div style="width: 23%;">
|
<div style="margin-bottom:10px;">
|
<el-input
|
ref="sn_seach_input"
|
v-model="stockFieldInfo"
|
v-focus
|
@keyup.enter.native="querySpliteStock"
|
>
|
<el-button
|
slot="append"
|
icon="el-icon-search"
|
@click="openSelectStock"
|
></el-button>
|
</el-input>
|
</div>
|
<div>
|
<el-table :data="stockList" border style="width: 100%">
|
<el-table-column
|
prop="partBatchNo"
|
label="SN号"
|
align="center"
|
width="110px"
|
>
|
</el-table-column>
|
<el-table-column prop="adjustQty" label="可用数量" align="center">
|
</el-table-column>
|
<el-table-column label="报废数量" align="center">
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.scrapQty"
|
placeholder="请输入"
|
@blur="changeQty(scope.row)"
|
clearable
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" width="55px">
|
<template slot-scope="scope">
|
<el-button
|
size="text"
|
type="danger"
|
@click="stockDelete(scope.$index, scope.row)"
|
>删除</el-button
|
>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
<div style="width: 75%;">
|
<el-table :data="splitResultList" border style="width: 100%">
|
<el-table-column type="index" label="序号" align="center">
|
</el-table-column>
|
<el-table-column
|
prop="partNo"
|
label="零件号"
|
align="center"
|
show-overflow-tooltip
|
width="125px"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="partName"
|
label="零件名称"
|
align="center"
|
show-overflow-tooltip
|
>
|
</el-table-column>
|
<el-table-column prop="partBatchNo" label="SN号" align="center">
|
</el-table-column>
|
<el-table-column label="载具编号" align="center">
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.reelNumber"
|
placeholder="请输入"
|
clearable
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="盘数" align="center">
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.diskNum"
|
placeholder="请输入"
|
clearable
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column label="生产数量" align="center">
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.productQty"
|
placeholder="请输入"
|
clearable
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column prop="unit" label="单位" align="center" width="50px">
|
</el-table-column>
|
<el-table-column label="分段描述" align="center">
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.segmentDesc"
|
placeholder="请输入"
|
clearable
|
></el-input>
|
</template>
|
</el-table-column>
|
<el-table-column prop="ifsBatchNo" label="IFS批次号" align="center">
|
</el-table-column>
|
<el-table-column label="备注" align="center">
|
<template slot-scope="scope">
|
<el-input
|
v-model="scope.row.remark"
|
placeholder="请输入"
|
clearable
|
></el-input>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
</div>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button
|
type="primary"
|
:disabled="saveDisabled"
|
v-thinclick="`dataFormSubmit`"
|
>确 定</el-button
|
>
|
</div>
|
<splitStockDialog
|
:currshowlist.sync="showSplitStock"
|
:paramObj="paramObj"
|
@listenToStockEvent="returnSelectStock"
|
/>
|
<splitTaskBack
|
v-if="backFeed"
|
ref="backFeed"
|
:splitTaskBackList="stockList"
|
@selectBackStock="goOnSave"
|
></splitTaskBack>
|
</el-dialog>
|
</template>
|
<style>
|
.split-task-form .el-dialog__body {
|
padding-bottom: 0px;
|
}
|
|
.split-task-form .el-dialog__body:after {
|
content: '';
|
clear: both;
|
overflow: hidden;
|
display: block;
|
visibility: hidden;
|
}
|
|
.split-task-form .el-dialog__body .el-table__header th {
|
padding-top: 0px;
|
}
|
|
.split-task-form .el-dialog__body .el-table__body-wrapper {
|
height: 260px;
|
overflow-y: auto;
|
}
|
|
.split-task-form .el-dialog__body .el-table::before {
|
height: 0px;
|
}
|
|
/*
|
字符串过长时,隐藏显示省略号
|
*/
|
.inline-el-hidden {
|
display: block;
|
width: 93%;
|
overflow: hidden;
|
text-overflow: ellipsis;
|
white-space: nowrap;
|
margin: 0 auto;
|
}
|
</style>
|
<script>
|
import {
|
addSegmentationTaskRecord,
|
addSegmentationTaskRecordCheck
|
} from '@/api/product/segmentationtaskrecord'
|
import ElButton from '../../../../node_modules/element-ui/packages/button/src/button.vue'
|
import splitStockDialog from './split-stock.vue'
|
import { getStock } from '@/api/product/personboard'
|
import { mapGetters } from 'vuex'
|
import splitTaskBack from './splitTask-back.vue'
|
export default {
|
components: { ElButton, splitStockDialog, splitTaskBack },
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
workstationId: {
|
type: Number,
|
default: 0
|
},
|
currentDutyRecord: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
},
|
personBoardList: {
|
type: Array,
|
default: () => {
|
return []
|
}
|
}
|
},
|
data() {
|
return {
|
innerVisible: false,
|
saveDisabled: false,
|
taskTypeOptions: [
|
{
|
value: 'CENT_LINE',
|
label: '分盘'
|
},
|
{
|
value: 'MERGE_DISH',
|
label: '拼盘'
|
},
|
{
|
value: 'CHECK_CENT_LINE',
|
label: '检号分盘'
|
}
|
],
|
taskType: null,
|
stockFieldInfo: null,
|
stockList: [],
|
splitResultList: [],
|
showSplitStock: false,
|
paramObj: { workstationId: null },
|
batchNo: null,
|
ifsBatchNo: null,
|
backFeed: false
|
}
|
},
|
directives: {
|
focus: {
|
inserted: function(el, option) {
|
var defClass = 'el-input'
|
var defTag = 'input'
|
var value = option.value || true
|
if (typeof value === 'boolean')
|
value = { cls: defClass, tag: defTag, foc: value }
|
else
|
value = {
|
cls: value.cls || defClass,
|
tag: value.tag || defTag,
|
foc: value.foc || false
|
}
|
// if (el.classList.contains(value.cls) && value.foc)
|
el.getElementsByTagName(value.tag)[0].focus()
|
}
|
}
|
},
|
computed: {
|
...mapGetters(['permissions', 'userInfo'])
|
},
|
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
|
}
|
}
|
},
|
checkDiskNumQuality() {
|
let flag = true
|
let flagMsg = ''
|
for (let i = 0; i < this.splitResultList.length; i++) {
|
if (
|
this.splitResultList[i].diskNum == null ||
|
this.splitResultList[i].diskNum == ''
|
) {
|
flag = false
|
flagMsg = flagMsg + '盘数不能为空;'
|
} else {
|
if (!this.checkZero(this.splitResultList[i].diskNum)) {
|
flag = false
|
flagMsg = flagMsg + '盘数不能为0;'
|
} else {
|
if (!this.checkPositive(this.splitResultList[i].diskNum)) {
|
flag = false
|
flagMsg = flagMsg + '盘数需为正数;'
|
} else {
|
if (!this.checkDecimal(this.splitResultList[i].diskNum)) {
|
flag = false
|
flagMsg = flagMsg + '盘数最多六位小数;'
|
}
|
}
|
}
|
}
|
}
|
if (!flag) {
|
this.$message.error(flagMsg)
|
}
|
return flag
|
},
|
checkProductQuality() {
|
let flag = true
|
let flagMsg = ''
|
for (let i = 0; i < this.splitResultList.length; i++) {
|
if (
|
this.splitResultList[i].productQty == null ||
|
this.splitResultList[i].productQty == ''
|
) {
|
flag = false
|
flagMsg = flagMsg + '生产数量不能为空;'
|
} else {
|
if (!this.checkZero(this.splitResultList[i].productQty)) {
|
flag = false
|
flagMsg = flagMsg + '生产数量不能为0;'
|
} else {
|
if (!this.checkPositive(this.splitResultList[i].productQty)) {
|
flag = false
|
flagMsg = flagMsg + '生产数量需为正数;'
|
} else {
|
if (!this.checkDecimal(this.splitResultList[i].productQty)) {
|
flag = false
|
flagMsg = flagMsg + '生产数量最多六位小数;'
|
}
|
}
|
}
|
}
|
}
|
if (!flag) {
|
this.$message.error(flagMsg)
|
}
|
return flag
|
},
|
checkScrapQtyQuality() {
|
let flag = true
|
let flagMsg = ''
|
for (let i = 0; i < this.stockList.length; i++) {
|
if (this.stockList[i].scrapQty == '') {
|
flag = true
|
} else {
|
if (!this.checkPositive(this.stockList[i].scrapQty)) {
|
flag = false
|
flagMsg = flagMsg + '报废数量需为正数;'
|
} else {
|
if (!this.checkDecimal(this.stockList[i].scrapQty)) {
|
flag = false
|
flagMsg = flagMsg + '报废数量最多六位小数;'
|
}
|
}
|
}
|
}
|
if (!flag) {
|
this.$message.error(flagMsg)
|
}
|
return flag
|
},
|
checkZero(value) {
|
if (value == 0) {
|
return false
|
} else {
|
return true
|
}
|
},
|
checkPositive(value) {
|
if (!/^[0-9]+.?[0-9]*$/.test(value)) {
|
return false
|
} else {
|
return true
|
}
|
},
|
checkDecimal(value) {
|
if (
|
!/(^[1-9]([0-9]+)?(\.[0-9]{1,6})?$)|(^(0){1}$)|(^[0-9]\.[0-9]{1,6}$)/.test(
|
value
|
)
|
) {
|
return false
|
} else {
|
return true
|
}
|
},
|
querySpliteStock() {
|
// 根据任务类型,判断添加条数
|
if (this.taskType != null) {
|
if (this.workstationId && this.workstationId != null) {
|
// 根据扫入的字符串信息,判断扫的是条形码,还是二维码
|
if (this.stockFieldInfo != null) {
|
let scanParamObject
|
if (this.stockFieldInfo.indexOf('lot_batch_no') != -1) {
|
// 二维码
|
const scanContentJson = JSON.parse(
|
this.stockFieldInfo.replace(/\n/g, '').replace(/\s*/g, '')
|
)
|
const partNo = scanContentJson.part_no
|
this.ifsBatchNo = scanContentJson.lot_batch_no
|
scanParamObject = {
|
partNo: partNo,
|
ifsBatchNo: this.ifsBatchNo
|
}
|
} else {
|
// 条形码
|
this.batchNo = this.stockFieldInfo
|
scanParamObject = {
|
partBatchNo: this.batchNo
|
}
|
}
|
const query = Object.assign(
|
{ current: 0, size: 50 },
|
{ workstationId: this.workstationId },
|
scanParamObject,
|
{ operationStockStatus: false }
|
)
|
// 合格
|
getStock(query)
|
.then((response) => {
|
this.dealStockResponse(response)
|
})
|
.catch(() => {})
|
} else {
|
this.$message.error('请扫码')
|
}
|
}
|
} else {
|
this.$message.error('请先选择任务类型!')
|
}
|
},
|
dealStockResponse(response) {
|
const data = response.data
|
if (data.code === 0) {
|
const newScanSplitList = data.data.records
|
if (newScanSplitList != null && newScanSplitList.length > 0) {
|
const _this = this
|
if (this.stockList.length > 0) {
|
// 页面已有零件
|
if (
|
this.taskType == 'CENT_LINE' ||
|
this.taskType == 'CHECK_CENT_LINE'
|
) {
|
this.$message.error('只能分盘一条库存!')
|
} else {
|
let flag = true
|
let diffFlag = true
|
for (let i = 0; i < newScanSplitList.length; i++) {
|
const newScanSplitItem = newScanSplitList[i]
|
const partFlag = this.stockList.every((x) => {
|
return x.partId == newScanSplitItem.partId
|
})
|
if (!partFlag) {
|
flag = false
|
break
|
}
|
const isExist = this.stockList.find((x) => {
|
return x.stockId == newScanSplitItem.id
|
})
|
if (isExist) {
|
diffFlag = false
|
break
|
}
|
}
|
|
if (flag) {
|
if (diffFlag) {
|
newScanSplitList.forEach((item) => {
|
// 往stockList塞入值
|
_this.stockList.push({
|
oriAdjustQty: item.availableStockQuantity,
|
adjustQty: item.availableStockQuantity,
|
id: 0,
|
ifsBatchNo: item.ifsBatchNo,
|
partBatchNo: item.partBatchNo,
|
partName: item.partName,
|
partNo: item.partNo,
|
partId: item.partId,
|
scrapQty: 0,
|
stockId: item.id
|
})
|
})
|
} else {
|
this.$message.error('该库存已选!')
|
}
|
} else {
|
this.$message.error('零件需相同!')
|
}
|
}
|
} else {
|
// 页面无零件,需判断newScanSplitList的长度
|
if (newScanSplitList.length > 1) {
|
if (
|
this.taskType == 'CENT_LINE' ||
|
this.taskType == 'CHECK_CENT_LINE'
|
) {
|
this.$message.error('只能分盘一条库存!')
|
} else {
|
newScanSplitList.forEach((item) => {
|
// 往stockList塞入值
|
_this.stockList.push({
|
oriAdjustQty: item.availableStockQuantity,
|
adjustQty: item.availableStockQuantity,
|
id: 0,
|
ifsBatchNo: item.ifsBatchNo,
|
partBatchNo: item.partBatchNo,
|
partName: item.partName,
|
partNo: item.partNo,
|
partId: item.partId,
|
scrapQty: 0,
|
stockId: item.id
|
})
|
})
|
// 往splitResultList塞入值
|
_this.splitResultList.push({
|
partName: newScanSplitList[0].partName,
|
id: 0,
|
partNo: newScanSplitList[0].partNo,
|
partId: newScanSplitList[0].partId,
|
partBatchNo: null,
|
reelNumber: null,
|
diskNum: null,
|
productQty: null,
|
unit: newScanSplitList[0].unit,
|
segmentDesc: null,
|
ifsBatchNo: null,
|
remark: null,
|
taskType: _this.taskType,
|
productionUser: null
|
})
|
}
|
} else {
|
newScanSplitList.forEach((item) => {
|
// 往stockList塞入值
|
_this.stockList.push({
|
oriAdjustQty: item.availableStockQuantity,
|
adjustQty: item.availableStockQuantity,
|
id: 0,
|
ifsBatchNo: item.ifsBatchNo,
|
partBatchNo: item.partBatchNo,
|
partName: item.partName,
|
partNo: item.partNo,
|
partId: item.partId,
|
scrapQty: 0,
|
stockId: item.id
|
})
|
})
|
// 往splitResultList塞入值
|
_this.splitResultList.push({
|
partName: newScanSplitList[0].partName,
|
id: 0,
|
partNo: newScanSplitList[0].partNo,
|
partId: newScanSplitList[0].partId,
|
partBatchNo: null,
|
reelNumber: null,
|
diskNum: null,
|
productQty: null,
|
unit: newScanSplitList[0].unit,
|
segmentDesc: null,
|
ifsBatchNo: null,
|
remark: null,
|
taskType: _this.taskType,
|
productionUser: null
|
})
|
}
|
}
|
}
|
this.stockFieldInfo = null
|
} else {
|
this.$message.error('获取线边仓物料信息失败')
|
}
|
},
|
openSelectStock() {
|
this.paramObj.workstationId = this.workstationId
|
this.paramObj.operationStockStatus = false
|
this.showSplitStock = true
|
},
|
returnSelectStock(param) {
|
// 根据任务类型,判断添加条数
|
if (this.taskType != null) {
|
// 校验stockList是不是零件都一样
|
if (this.stockList.length > 0) {
|
if (
|
this.taskType == 'CENT_LINE' ||
|
this.taskType == 'CHECK_CENT_LINE'
|
) {
|
this.$message.error('只能分盘一条库存!')
|
} else {
|
let flag = true
|
let diffFlag = true
|
for (let i = 0; i < this.stockList.length; i++) {
|
if (this.stockList[i].partId != param.partId) {
|
flag = false
|
break
|
}
|
if (this.stockList[i].stockId == param.id) {
|
diffFlag = false
|
break
|
}
|
}
|
if (flag) {
|
if (diffFlag) {
|
// 往stockList塞入值
|
this.stockList.push({
|
oriAdjustQty: param.availableStockQuantity,
|
adjustQty: param.availableStockQuantity,
|
id: 0,
|
ifsBatchNo: param.ifsBatchNo,
|
partBatchNo: param.partBatchNo,
|
partName: param.partName,
|
partNo: param.partNo,
|
partId: param.partId,
|
scrapQty: 0,
|
stockId: param.id
|
})
|
} else {
|
this.$message.error('该库存已选!')
|
}
|
} else {
|
this.$message.error('零件需相同!')
|
}
|
}
|
} else {
|
// 往stockList塞入值
|
this.stockList.push({
|
oriAdjustQty: param.availableStockQuantity,
|
adjustQty: param.availableStockQuantity,
|
id: 0,
|
ifsBatchNo: param.ifsBatchNo,
|
partBatchNo: param.partBatchNo,
|
partName: param.partName,
|
partNo: param.partNo,
|
partId: param.partId,
|
scrapQty: 0,
|
stockId: param.id
|
})
|
// 往splitResultList塞入值
|
this.splitResultList.push({
|
partName: param.partName,
|
id: 0,
|
partNo: param.partNo,
|
partId: param.partId,
|
partBatchNo: null,
|
reelNumber: null,
|
diskNum: null,
|
productQty: null,
|
unit: param.unit,
|
segmentDesc: null,
|
ifsBatchNo: null,
|
remark: null,
|
taskType: this.taskType,
|
productionUser: null
|
})
|
}
|
} else {
|
this.$message.error('请先选择任务类型!')
|
}
|
},
|
changeQty(row) {
|
const flag = this.checkScrapQtyQuality()
|
if (flag) {
|
let scrapQty
|
if (row.scrapQty == '') {
|
scrapQty = 0
|
row.scrapQty = 0
|
} else {
|
scrapQty = row.scrapQty
|
}
|
const newAdjustQty = Number(
|
(Number(row.oriAdjustQty) - Number(scrapQty)).toFixed(6)
|
)
|
if (newAdjustQty < 0) {
|
row.scrapQty = 0
|
row.adjustQty = row.oriAdjustQty
|
this.$message.error('报废数量大于可用数量!')
|
} else {
|
row.adjustQty = newAdjustQty
|
}
|
} else {
|
row.scrapQty = 0
|
row.adjustQty = row.oriAdjustQty
|
}
|
},
|
dataFormSubmit() {
|
if (this.splitResultList.length <= 0) {
|
this.$message.error('请先选择需要分割或拼盘的库存零件!')
|
} else {
|
// 校验当前登录人,是否在当班人员中
|
const exsitMan = this.personBoardList.find((item) => {
|
return item.staffId == this.userInfo.staffId
|
})
|
if (exsitMan) {
|
const flag = this.checkProductQuality()
|
if (flag) {
|
const diskFlag = this.checkDiskNumQuality()
|
if (diskFlag) {
|
// 校验stockList的可用数量之和要大于等于splitResultList中的盘数*生产数量
|
let allAdjustQty = 0
|
const inputs = []
|
this.stockList.forEach((item) => {
|
allAdjustQty = allAdjustQty + Number(item.adjustQty)
|
inputs.push({
|
id: 0,
|
adjustQty: item.adjustQty,
|
ifsBatchNo: item.ifsBatchNo,
|
partBatchNo: item.partBatchNo,
|
partName: item.partName,
|
partNo: item.partNo,
|
scrapQty: item.scrapQty,
|
stockId: item.stockId
|
})
|
})
|
const splitResult = this.splitResultList[0]
|
const dataObj = {
|
id: 0,
|
diskNum: splitResult.diskNum,
|
ifsBatchNo: splitResult.ifsBatchNo,
|
partBatchNo: splitResult.partBatchNo,
|
partId: splitResult.partId,
|
partName: splitResult.partName,
|
partNo: splitResult.partNo,
|
productQty: splitResult.productQty,
|
productionUser: null,
|
reelNumber: splitResult.reelNumber,
|
remark: splitResult.remark,
|
segmentDesc: splitResult.segmentDesc,
|
taskType: this.taskType,
|
unit: splitResult.unit,
|
dutyRecordId: this.currentDutyRecord.id,
|
workstationId: this.workstationId,
|
inputs: inputs,
|
returnInputStockId: null
|
}
|
const allResultProductQty =
|
Number(splitResult.diskNum) * Number(splitResult.productQty)
|
if (Number(allAdjustQty.toFixed(6)) >= allResultProductQty) {
|
addSegmentationTaskRecordCheck(dataObj)
|
.then((response) => {
|
const resData = response.data
|
if (resData.data) {
|
// 直接保存
|
this.save(null)
|
} else {
|
// 弹窗选库存
|
this.backFeed = true
|
this.$nextTick(() => {
|
this.$refs.backFeed.init()
|
})
|
}
|
})
|
.catch((error) => {
|
console.log(error)
|
})
|
} else {
|
this.$message.error('生产数量需小于等于可用数量!')
|
}
|
}
|
}
|
} else {
|
this.$message.error('当前登录人非当班人员!')
|
}
|
}
|
},
|
goOnSave(param) {
|
if (param) {
|
this.save(param.stockId)
|
}
|
},
|
save(returnInputStockId) {
|
this.saveDisabled = true
|
if (this.splitResultList.length <= 0) {
|
this.saveDisabled = false
|
this.$message.error('请先选择需要分割或拼盘的库存零件!')
|
} else {
|
// 校验当前登录人,是否在当班人员中
|
const exsitMan = this.personBoardList.find((item) => {
|
return item.staffId == this.userInfo.staffId
|
})
|
console.log('exsitMan', exsitMan)
|
if (exsitMan) {
|
const flag = this.checkProductQuality()
|
if (flag) {
|
const diskFlag = this.checkDiskNumQuality()
|
if (diskFlag) {
|
// 校验stockList的可用数量之和要大于等于splitResultList中的盘数*生产数量
|
let allAdjustQty = 0
|
const inputs = []
|
this.stockList.forEach((item) => {
|
allAdjustQty = allAdjustQty + Number(item.adjustQty)
|
inputs.push({
|
id: 0,
|
adjustQty: item.adjustQty,
|
ifsBatchNo: item.ifsBatchNo,
|
partBatchNo: item.partBatchNo,
|
partName: item.partName,
|
partNo: item.partNo,
|
scrapQty: item.scrapQty,
|
stockId: item.stockId
|
})
|
})
|
const splitResult = this.splitResultList[0]
|
const dataObj = {
|
id: 0,
|
diskNum: splitResult.diskNum,
|
ifsBatchNo: splitResult.ifsBatchNo,
|
partBatchNo: splitResult.partBatchNo,
|
partId: splitResult.partId,
|
partName: splitResult.partName,
|
partNo: splitResult.partNo,
|
productQty: splitResult.productQty,
|
productionUser: this.userInfo.staffName,
|
reelNumber: splitResult.reelNumber,
|
remark: splitResult.remark,
|
segmentDesc: splitResult.segmentDesc,
|
taskType: this.taskType,
|
unit: splitResult.unit,
|
dutyRecordId: this.currentDutyRecord.id,
|
workstationId: this.workstationId,
|
inputs: inputs,
|
returnInputStockId: returnInputStockId
|
}
|
const allResultProductQty =
|
Number(splitResult.diskNum) * Number(splitResult.productQty)
|
if (Number(allAdjustQty.toFixed(6)) >= allResultProductQty) {
|
addSegmentationTaskRecord(dataObj)
|
.then((data) => {
|
this.$message.success('保存成功')
|
this.innerVisible = false
|
this.saveDisabled = false
|
this.$emit('refreshDataList')
|
})
|
.catch((error) => {
|
this.saveDisabled = false
|
console.log(error)
|
})
|
} else {
|
this.$message.error('生产数量需小于等于可用数量!')
|
this.saveDisabled = false
|
}
|
} else {
|
this.saveDisabled = false
|
}
|
} else {
|
this.saveDisabled = false
|
}
|
} else {
|
this.$message.error('当前登录人非当班人员!')
|
this.saveDisabled = false
|
}
|
}
|
},
|
stockDelete(index, row) {
|
this.stockList.splice(index, 1)
|
if (this.stockList.length < 1) {
|
this.splitResultList = []
|
}
|
},
|
taskTypeChange() {
|
// console.log('sadasd')
|
// this.$refs.sn_seach_input.focus()
|
this.stockFieldInfo = null
|
this.stockList = []
|
this.splitResultList = []
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.taskType = null
|
this.stockFieldInfo = null
|
this.stockList = []
|
this.splitResultList = []
|
this.$nextTick(() => {
|
this.$refs.sn_seach_input.focus()
|
})
|
}
|
}
|
}
|
}
|
</script>
|