|
|
|
@ -14,7 +14,7 @@ |
|
|
|
<el-col :span="16"> |
|
|
|
<el-form-item :label="'材料卷号:'"> |
|
|
|
<el-input ref="rmRollNo" @keyup.native="recordTime" |
|
|
|
@keyup.enter.native="checkRmRollNo" |
|
|
|
@keyup.enter.native="checkRmRollNoBun" |
|
|
|
v-model="pageData.rmRollNo" |
|
|
|
style="width: 120px"> |
|
|
|
</el-input> |
|
|
|
@ -24,14 +24,7 @@ |
|
|
|
<el-row> |
|
|
|
<el-col :span="16"> |
|
|
|
<el-form-item :label="'BOM 序号:'"> |
|
|
|
<el-select v-model="pageData.bomItemNo" :disabled="selectFlag" style="width: 120px"> |
|
|
|
<el-option |
|
|
|
v-for="(item, index) in bomList" |
|
|
|
:key="index" |
|
|
|
:label="item.itemNo" |
|
|
|
:value="item.itemNo"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
<el-input v-model="pageData.bomItemNo" readonly style="width: 120px"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
@ -70,7 +63,7 @@ |
|
|
|
</el-form> |
|
|
|
</el-container> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" @click="connectToolInstanceIdBun">确 定</el-button> |
|
|
|
<el-button type="primary" @click="connectMaterialRollBun">确 定</el-button> |
|
|
|
<el-button type="primary" @click="closeDialog">关闭</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
@ -79,17 +72,16 @@ |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
countToolUsedQty, |
|
|
|
checkConnectToolInstanceId, |
|
|
|
connectToolInstanceId, |
|
|
|
checkConnectMaterialRoll, |
|
|
|
connectMaterialRoll, |
|
|
|
} |
|
|
|
from '@/api/yieldReport/com_replace_tool.js'; |
|
|
|
from '@/api/yieldReport/com_replace_material.js'; |
|
|
|
export default { |
|
|
|
name: "com_defect_roll", |
|
|
|
data() { |
|
|
|
return { |
|
|
|
titleCon: '换料', |
|
|
|
readonlyFlag: true, |
|
|
|
timeArray: [], |
|
|
|
scheduleData: { |
|
|
|
site: this.$store.state.user.site, |
|
|
|
userName: this.$store.state.user.name, |
|
|
|
@ -123,12 +115,11 @@ export default { |
|
|
|
rollNo: '', |
|
|
|
operatorId: '', |
|
|
|
histSeqNo: 0, |
|
|
|
toolInstanceId: '', |
|
|
|
oriToolInstanceId: '', |
|
|
|
replaceFlag: 'Y', |
|
|
|
bomItemNo: -1, |
|
|
|
rmRollNo: '', |
|
|
|
oriRmRollNo: '', |
|
|
|
reportDate: this.dayjs(new Date()).format('YYYY-MM-DD'), |
|
|
|
reportTime: this.dayjs(new Date()).format('HH:mm:ss'), |
|
|
|
downTimeFlag: 'Y', |
|
|
|
downTimeQty: 0, |
|
|
|
consumeQty: 0, |
|
|
|
oriConsumeQty: 0, |
|
|
|
@ -144,13 +135,14 @@ export default { |
|
|
|
seqNo: '', |
|
|
|
showFlag: false |
|
|
|
}, |
|
|
|
oriToolData: { |
|
|
|
oriMaterialData: { |
|
|
|
site: this.$store.state.user.site, |
|
|
|
userName: this.$store.state.user.name, |
|
|
|
orderNo: '', |
|
|
|
itemNo: 0, |
|
|
|
seqNo: '', |
|
|
|
toolInstanceId: '' |
|
|
|
histSeqNo: '', |
|
|
|
rmRollNo: '', |
|
|
|
}, |
|
|
|
dataListLoading: false, |
|
|
|
} |
|
|
|
@ -158,10 +150,10 @@ export default { |
|
|
|
methods: { |
|
|
|
|
|
|
|
//初始化组件的参数 |
|
|
|
init(scheduleData, operatorData, oriToolData) { |
|
|
|
init(scheduleData, operatorData, oriMaterialData) { |
|
|
|
//初始化参数 |
|
|
|
this.scheduleData = scheduleData; |
|
|
|
this.oriToolData = oriToolData; |
|
|
|
this.oriMaterialData = oriMaterialData; |
|
|
|
//初始化操作员对象 |
|
|
|
this.operatorData = JSON.parse(JSON.stringify(operatorData)); |
|
|
|
//设置参数 |
|
|
|
@ -170,43 +162,31 @@ export default { |
|
|
|
this.pageData.seqNo = scheduleData.seqNo; |
|
|
|
this.pageData.rollNo = scheduleData.rollNo; |
|
|
|
this.pageData.operatorId = operatorData.operatorId; |
|
|
|
this.pageData.histSeqNo = oriToolData.histSeqNo; |
|
|
|
this.pageData.oriToolInstanceId = oriToolData.toolInstanceId; |
|
|
|
this.pageData.histSeqNo = oriMaterialData.histSeqNo; |
|
|
|
this.pageData.oriRmRollNo = oriMaterialData.rmRollNo; |
|
|
|
this.pageData.bomItemNo = oriMaterialData.sAPBOMItemNo; |
|
|
|
this.pageData.rmRollNo = ''; |
|
|
|
//自动获取焦点 |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.toolInstanceId.focus(); |
|
|
|
this.$refs.rmRollNo.focus(); |
|
|
|
}); |
|
|
|
//区分是否是切换切换的 |
|
|
|
this.pageData.toolInstanceId = ''; |
|
|
|
this.pageData.consumeQty = 0; |
|
|
|
this.pageData.oriConsumeQty = 0; |
|
|
|
this.pageData.totalConsumeQty = 0; |
|
|
|
this.pageData.downTimeQty = 0; |
|
|
|
this.readonlyFlag = true; |
|
|
|
this.replaceFlag = true; |
|
|
|
//重置校验的标记 |
|
|
|
this.pageData.checkFlag = false; |
|
|
|
//刷新当前工具实例的数量数据 |
|
|
|
this.refreshToolUsedQty(); |
|
|
|
}, |
|
|
|
|
|
|
|
/*添加刀模记录*/ |
|
|
|
refreshToolUsedQty(){ |
|
|
|
countToolUsedQty(this.pageData).then(({data}) => { |
|
|
|
this.pageData.oriConsumeQty = parseFloat(data.usedQty); |
|
|
|
this.pageData.totalConsumeQty = parseFloat(data.usedQty); |
|
|
|
}); |
|
|
|
/*关闭modal*/ |
|
|
|
closeDialog(){ |
|
|
|
this.$emit('update:visible', false); |
|
|
|
}, |
|
|
|
|
|
|
|
/*数量失去焦点的事件*/ |
|
|
|
changeToolQty(){ |
|
|
|
let consumeQty = parseFloat(this.pageData.consumeQty); |
|
|
|
if(consumeQty <= 0){ |
|
|
|
this.$message.error('本卷生产数量不能小于0!'); |
|
|
|
return false; |
|
|
|
/*记录每一次录入字符串的时间*/ |
|
|
|
recordTime(){ |
|
|
|
//判断是否清掉所有的内容 |
|
|
|
if(this.pageData.rmRollNo.trim().length === 0){ |
|
|
|
this.timeArray = []; |
|
|
|
}else{ |
|
|
|
this.timeArray.push(new Date().getTime()); |
|
|
|
} |
|
|
|
//汇总数量 |
|
|
|
this.pageData.totalConsumeQty = this.pageData.oriConsumeQty + consumeQty; |
|
|
|
}, |
|
|
|
|
|
|
|
/*验证时长的参数*/ |
|
|
|
@ -218,89 +198,54 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/*关闭modal*/ |
|
|
|
closeDialog(){ |
|
|
|
this.$emit('update:visible', false); |
|
|
|
/*检查材料卷号的数据*/ |
|
|
|
checkRmRollNoBun() { |
|
|
|
//首先判断时间是否超过100毫秒 |
|
|
|
let len = this.timeArray.length; |
|
|
|
let timeDiff = this.timeArray[len - 1] - this.timeArray[0]; |
|
|
|
//判断时间是否在范围之内 |
|
|
|
if(timeDiff > 1000){ |
|
|
|
this.$message.error('请扫码输入!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
//判断null和空字符串 |
|
|
|
if (this.pageData.rmRollNo == null || this.pageData.rmRollNo === '') { |
|
|
|
this.$message.error('材料卷号不能为空!'); |
|
|
|
return false; |
|
|
|
}else{ |
|
|
|
this.pageData.rmRollNo = this.pageData.rmRollNo.trim(); |
|
|
|
} |
|
|
|
//调用方法检查材料的数据(验证通过调用检查的方法) |
|
|
|
this.checkConnectRmRollNoOperation(); |
|
|
|
}, |
|
|
|
|
|
|
|
/*检查新的工具实例信息*/ |
|
|
|
checkConnectToolInstanceIdBun(){ |
|
|
|
/*验证工具的实例*/ |
|
|
|
if(this.pageData.toolInstanceId == null || this.pageData.toolInstanceId == ''){ |
|
|
|
this.$message.error('请扫描工具实例!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
checkConnectRmRollNoOperation(){ |
|
|
|
/*调用检查的方法检验下*/ |
|
|
|
checkConnectToolInstanceId(this.pageData).then(({data}) => { |
|
|
|
checkConnectMaterialRoll(this.pageData).then(({data}) => { |
|
|
|
//判断是否存在异常 |
|
|
|
if(data.code == 500){ |
|
|
|
this.$message.error(data.msg); |
|
|
|
}else if (data.resultMap.resultCode == 201){ |
|
|
|
let msg = data.resultMap.resultMsg; |
|
|
|
this.$confirm(msg, '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: "warning" |
|
|
|
}).then(() => { |
|
|
|
this.pageData.checkFlag = true; |
|
|
|
}).catch(() => { |
|
|
|
this.pageData.checkFlag = false; |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
this.pageData.checkFlag = true; |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
/*检查新的工具实例信息*/ |
|
|
|
connectToolInstanceIdBun(){ |
|
|
|
/*验证工具的实例*/ |
|
|
|
if(this.pageData.toolInstanceId == null || this.pageData.toolInstanceId == ''){ |
|
|
|
this.$message.error('请扫描工具实例!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
/*耗用的参数*/ |
|
|
|
let consumeQty = parseFloat(this.pageData.consumeQty); |
|
|
|
if(consumeQty <= 0){ |
|
|
|
this.$message.error('本卷生产数量不能小于0!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
/*验证时长的参数*/ |
|
|
|
/*接料操作*/ |
|
|
|
connectMaterialRollBun(){ |
|
|
|
let downTimeQty = this.pageData.downTimeQty; |
|
|
|
if(downTimeQty <= 0){ |
|
|
|
this.$message.error('时长必须大于0!'); |
|
|
|
return false; |
|
|
|
} |
|
|
|
checkConnectToolInstanceId(this.pageData).then(({data}) => { |
|
|
|
connectMaterialRoll(this.pageData).then(({data}) => { |
|
|
|
//判断是否存在异常 |
|
|
|
if(data.code == 500){ |
|
|
|
this.$message.error(data.msg); |
|
|
|
}else if (data.resultMap.resultCode == 201){ |
|
|
|
let msg = data.resultMap.resultMsg; |
|
|
|
this.$confirm(msg, '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: "warning" |
|
|
|
}).then(() => { |
|
|
|
//调用存储过程实现 |
|
|
|
this.connectToolInstanceIdOperation(); |
|
|
|
}).catch(() => { |
|
|
|
this.pageData.checkFlag = false; |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
//调用存储过程实现 |
|
|
|
this.connectToolInstanceIdOperation(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
/*替换刀模的功能*/ |
|
|
|
connectToolInstanceIdOperation(){ |
|
|
|
connectToolInstanceId(this.pageData).then(({data}) => { |
|
|
|
//如果成功关闭当前的页面 刷新原始的菜单 |
|
|
|
if(data.code == 500){ |
|
|
|
this.$message.error(data.msg); |
|
|
|
}else{ |
|
|
|
//关闭当前的页面 |
|
|
|
this.closeDialog(); |
|
|
|
this.$message.success(data.msg); |
|
|
|
//关闭当前的组件 |
|
|
|
this.closeDialog(); |
|
|
|
|