Browse Source

2025-12-02

机台工作台换料优化
master
fengyuan_yang 1 month ago
parent
commit
bceea007f8
  1. 104
      src/views/modules/yieldReport/com_replace_material.vue

104
src/views/modules/yieldReport/com_replace_material.vue

@ -2,7 +2,7 @@
<div class="customer-css">
<el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners"
width="405px" style="height: 310px;" class="customer-dialog">
<el-container style="height: 135px;">
<el-container style="height: 170px;">
<el-form :inline="true" label-position="top" label-width="80px">
<!-- 换材料 -->
<el-container>
@ -35,25 +35,41 @@
<el-container style="margin-left: 170px; margin-top: -120px;">
<fieldset class="customer-fieldset" style="width: 210px;">
<legend>{{ labels.downTimeTitle }}</legend>
<!-- 原工具信息 -->
<!-- 开始时间 -->
<el-row>
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.startTime>
<el-date-picker v-model="pageData.reportDate" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" style="width: 100px;"></el-date-picker>
value-format="yyyy-MM-dd" @change="calculateDuration" style="width: 100px;"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="customer-item" label=" ">
<el-time-picker v-model="pageData.reportTime" format="HH:mm:ss"
value-format="HH:mm:ss" style="width: 80px;"></el-time-picker>
value-format="HH:mm:ss" @change="calculateDuration" style="width: 80px;"></el-time-picker>
</el-form-item>
</el-col>
</el-row>
<!-- 结束时间 -->
<el-row>
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.endTime>
<el-date-picker v-model="pageData.endDate" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" @change="calculateDuration" style="width: 100px;"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="customer-item" label=" ">
<el-time-picker v-model="pageData.endTime" format="HH:mm:ss"
value-format="HH:mm:ss" @change="calculateDuration" style="width: 80px;"></el-time-picker>
</el-form-item>
</el-col>
</el-row>
<!-- 时长 -->
<el-row>
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.downTimes>
<el-input v-model="pageData.downTimeQty" @blur="changeTimeQty"type="number" style="width: 100px;" ></el-input>
<el-input v-model="pageData.downTimeQty" @blur="changeTimeQty" type="number" style="width: 100px;" ></el-input>
</el-form-item>
</el-col>
</el-row>
@ -137,6 +153,8 @@ export default {
oriRmRollNo: '',
reportDate: '',
reportTime: '',
endDate: '', //
endTime: '', //
downTimeQty: 0,
consumeQty: 0,
oriConsumeQty: 0,
@ -194,6 +212,7 @@ export default {
bomItemNo: 'BOM序号:',
downTimeTitle: '停机',
startTime: '开始时间:',
endTime: '结束时间:',
downTimes: '时长:',
downTimesMustMoreThanZero: '时长必须大于0!',
materialRollCantBeNull: '材料卷号不能为空!',
@ -236,7 +255,13 @@ export default {
objectId: 'startTime',
objectType: 'label',
tableId: '*'
}, {
}, {
functionId: functionId,
languageValue: '结束时间:',
objectId: 'endTime',
objectType: 'label',
tableId: '*'
}, {
functionId: functionId,
languageValue: '时长:',
objectId: 'downTimes',
@ -285,6 +310,8 @@ export default {
//
this.pageData.reportDate = this.dayjs(new Date()).format('YYYY-MM-DD');
this.pageData.reportTime = this.dayjs(new Date()).format('HH:mm:ss');
this.pageData.endDate = this.dayjs(new Date()).format('YYYY-MM-DD');
this.pageData.endTime = this.dayjs(new Date()).format('HH:mm:ss');
this.pageData.downTimeQty = 0;
this.pageData.rmRollNo = '';
//
@ -326,6 +353,46 @@ export default {
}
},
/*计算时长(分钟)*/
calculateDuration() {
//
if (!this.pageData.reportDate || !this.pageData.reportTime ||
!this.pageData.endDate || !this.pageData.endTime) {
return;
}
try {
//
const startDateTime = `${this.pageData.reportDate} ${this.pageData.reportTime}`;
const endDateTime = `${this.pageData.endDate} ${this.pageData.endTime}`;
//
const startTime = this.dayjs(startDateTime);
const endTime = this.dayjs(endDateTime);
//
if (!startTime.isValid() || !endTime.isValid()) {
console.warn('时间格式无效');
return;
}
//
const durationMinutes = endTime.diff(startTime, 'minute');
//
if (durationMinutes < 0) {
this.$message.warning('结束时间不能早于开始时间');
this.pageData.downTimeQty = 0;
return;
}
//
this.pageData.downTimeQty = durationMinutes;
} catch (error) {
console.error('计算时长失败:', error);
}
},
/*检查材料卷号的数据*/
checkRmRollNoBun() {
//100
@ -367,7 +434,30 @@ export default {
this.$message.error(this.labels.downTimesMustMoreThanZero);
return false;
}
connectMaterialRoll(this.pageData).then(({data}) => {
// endDate endTime
const submitData = {
site: this.pageData.site,
username: this.pageData.username,
orderNo: this.pageData.orderNo,
itemNo: this.pageData.itemNo,
seqNo: this.pageData.seqNo,
rollNo: this.pageData.rollNo,
operatorId: this.pageData.operatorId,
histSeqNo: this.pageData.histSeqNo,
bomItemNo: this.pageData.bomItemNo,
rmRollNo: this.pageData.rmRollNo,
oriRmRollNo: this.pageData.oriRmRollNo,
reportDate: this.pageData.reportDate,
reportTime: this.pageData.reportTime,
downTimeQty: this.pageData.downTimeQty,
consumeQty: this.pageData.consumeQty,
oriConsumeQty: this.pageData.oriConsumeQty,
totalConsumeQty: this.pageData.totalConsumeQty,
checkFlag: this.pageData.checkFlag
};
connectMaterialRoll(submitData).then(({data}) => {
//
if(data.code == 500){
this.$message.error(data.msg);

Loading…
Cancel
Save