feat: 增加结算工时和历史工时选择
This commit is contained in:
@@ -392,19 +392,32 @@
|
||||
<span :class="{ 'bold-text': scope.row.level === 1 }">{{ scope.row.taskDescription || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="productionOrderNo" label="生产订单号" width="130" align="center" show-overflow-tooltip>
|
||||
<el-table-column prop="settlementReportPieceHours" label="结算报工单件工时" width="140" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.productionOrderNo || '' }}
|
||||
{{ scope.row.settlementReportPieceHours*60 || 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="settlementAuxiliaryPieceHours" label="结算辅助单件工时" width="140" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.settlementAuxiliaryPieceHours*60 || 0 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="station" label="工位" width="110" align="center" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.station || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="productionOrderNo" label="生产订单号" width="130" align="center" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.productionOrderNo || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operatorNames" label="操作人" width="180" align="center" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.operatorNames || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="reportWorkHours" label="报工工时" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'bold-text': scope.row.level <= 2 }">{{ scope.row.reportWorkHours || '' }}</span>
|
||||
@@ -447,23 +460,6 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="settlementReportPieceHours" label="结算报工单件工时" width="140" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.settlementReportPieceHours || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="settlementAuxiliaryPieceHours" label="结算辅助单件工时" width="140" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.settlementAuxiliaryPieceHours || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="operatorNames" label="操作人" width="180" align="center" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.operatorNames || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
|
||||
@@ -180,12 +180,12 @@
|
||||
@click="getitemdata(scope.row.订单号)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="历史工时" width="100">
|
||||
<!-- <el-table-column align="center" label="历史工时" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini"
|
||||
@click="getWorkHour(scope.row.产品编码)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column align="center" prop="备注" label="备注" width="150" show-overflow-tooltip/>
|
||||
<el-table-column align="center" prop="行文本备注" label="工艺备注" width="120" />
|
||||
<el-table-column align="center" prop="任务概述" label="工艺说明" width="120" />
|
||||
|
||||
@@ -61,6 +61,8 @@
|
||||
<th class="col-tree">工位 / 日期</th>
|
||||
<!-- <th class="col-num">排产数量</th> -->
|
||||
<th class="col-hours">标准工时</th>
|
||||
<th class="col-settlement-hours">结算工时</th>
|
||||
<th class="col-settlement-piece">结算单件工时</th>
|
||||
<th class="col-order">生产订单</th>
|
||||
<th class="col-plan">计划号</th>
|
||||
<th class="col-contract">销售订单</th>
|
||||
@@ -96,6 +98,8 @@
|
||||
</td>
|
||||
<!-- <td>{{ stationGroup.totalQuantity }}</td> -->
|
||||
<td>{{ stationGroup.totalHours }}</td>
|
||||
<td>{{ stationGroup.totalSettlementHours }}</td>
|
||||
<td></td>
|
||||
<td colspan="21"></td>
|
||||
</tr>
|
||||
<template v-for="dateGroup in stationGroup.dates">
|
||||
@@ -110,6 +114,8 @@
|
||||
</td>
|
||||
<!-- <td>{{ dateGroup.totalQuantity }}</td> -->
|
||||
<td>{{ dateGroup.totalHours }}</td>
|
||||
<td>{{ dateGroup.totalSettlementHours }}</td>
|
||||
<td></td>
|
||||
<td colspan="21"></td>
|
||||
</tr>
|
||||
<tr
|
||||
@@ -121,7 +127,17 @@
|
||||
@click="handleRowClick(task)">
|
||||
<td></td>
|
||||
<!-- <td class="number-cell">{{ task.指派数量 || task.计划数量 }}</td> -->
|
||||
<td class="number-cell">{{ task.标准工时*task.指派数量 }}</td>
|
||||
<td class="number-cell">{{ calcStandardHours(task) }}</td>
|
||||
<td class="number-cell">{{ calcSettlementHours(task) }}</td>
|
||||
<td class="number-cell" @click.stop>
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
class="work-hour-button"
|
||||
@click="openWorkHourDialog(task)">
|
||||
{{ hasValue(task.结算单件工时) ? formatNumber(task.结算单件工时) : '选择' }}
|
||||
</el-button>
|
||||
</td>
|
||||
<td>{{ task.订单号 }}</td>
|
||||
<td>{{ task.计划号 }}</td>
|
||||
<td>{{ task.合同号 }}</td>
|
||||
@@ -303,6 +319,102 @@
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="dialogcasual2" title="历史工时" center style="min-height: 300px;" width="1400px">
|
||||
<el-card style="height: 550px">
|
||||
<el-table
|
||||
v-loading="workHourLoading"
|
||||
:data="workHourData"
|
||||
:height="'55vh'"
|
||||
border
|
||||
size="mini"
|
||||
style="margin-top: 20px; width: 95%;">
|
||||
<el-table-column label="选择" width="120" align="center" fixed>
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
:disabled="!canSelectHistoryHour(scope.row.settlementReportPieceHours)"
|
||||
@click="selectSettlementPieceHour(scope.row, 'report')">报工</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
:disabled="!canSelectHistoryHour(scope.row.settlementAuxiliaryPieceHours)"
|
||||
@click="selectSettlementPieceHour(scope.row, 'auxiliary')">辅助</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taskDescription" label="任务描述" min-width="380" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'bold-text': scope.row.level === 1 }">{{ scope.row.taskDescription || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="settlementReportPieceHours" label="结算报工单件工时" width="140" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ formatHistoryPieceHours(scope.row.settlementReportPieceHours) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="settlementAuxiliaryPieceHours" label="结算辅助单件工时" width="140" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ formatHistoryPieceHours(scope.row.settlementAuxiliaryPieceHours) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="station" label="工位" width="110" align="center" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.station || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="productionOrderNo" label="生产订单号" width="130" align="center" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.productionOrderNo || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="operatorNames" label="操作人" width="180" align="center" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.operatorNames || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="reportWorkHours" label="报工工时" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'bold-text': scope.row.level <= 2 }">{{ scope.row.reportWorkHours || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="auxiliaryWorkHours" label="辅助工时" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'bold-text': scope.row.level <= 2 }">{{ scope.row.auxiliaryWorkHours || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="reportFinishQty" label="报工完成数" width="110" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'bold-text': scope.row.level <= 2 }">{{ scope.row.reportFinishQty || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="auxiliaryFinishQty" label="辅助完成数" width="110" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'bold-text': scope.row.level <= 2 }">{{ scope.row.auxiliaryFinishQty || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalWorkHours" label="合计工时" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'bold-text': scope.row.level <= 2 }">{{ scope.row.totalWorkHours || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="clampingTime" label="装夹时间" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.clampingTime || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="programTime" label="调程时间" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.programTime || '' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="recordCount" label="记录数" width="90" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span :class="{ 'bold-text': scope.row.level <= 2 }">{{ scope.row.recordCount || '' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
@@ -432,7 +544,11 @@ export default {
|
||||
}
|
||||
},
|
||||
currentTime: "",
|
||||
itemdata:[]
|
||||
itemdata:[],
|
||||
dialogcasual2:false,
|
||||
workHourData:[],
|
||||
workHourLoading:false,
|
||||
workHourCurrentRow:null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -450,6 +566,8 @@ export default {
|
||||
const station = task.指派对象 || '未指派'
|
||||
const planDate = this.formatDate(task.计划开始时间) || '未排日期'
|
||||
const hours = Number(task.标准工时) || 0
|
||||
const settlementPieceHours = Number(task.结算单件工时)
|
||||
const hasSettlementHours = this.hasValue(task.结算单件工时) && !Number.isNaN(settlementPieceHours)
|
||||
|
||||
if (!stationMap.has(station)) {
|
||||
stationMap.set(station, {
|
||||
@@ -457,6 +575,8 @@ export default {
|
||||
totalCount: 0,
|
||||
totalQuantity: 0,
|
||||
totalHours: 0,
|
||||
totalSettlementHours: 0,
|
||||
settlementHoursCount: 0,
|
||||
dateMap: new Map()
|
||||
})
|
||||
}
|
||||
@@ -466,12 +586,18 @@ export default {
|
||||
stationGroup.totalCount += 1
|
||||
stationGroup.totalQuantity += quantity
|
||||
stationGroup.totalHours += hours*quantity
|
||||
if (hasSettlementHours) {
|
||||
stationGroup.totalSettlementHours += settlementPieceHours * quantity
|
||||
stationGroup.settlementHoursCount += 1
|
||||
}
|
||||
|
||||
if (!stationGroup.dateMap.has(planDate)) {
|
||||
stationGroup.dateMap.set(planDate, {
|
||||
date: planDate,
|
||||
totalQuantity: 0,
|
||||
totalHours: 0,
|
||||
totalSettlementHours: 0,
|
||||
settlementHoursCount: 0,
|
||||
tasks: []
|
||||
})
|
||||
}
|
||||
@@ -479,6 +605,10 @@ export default {
|
||||
const dateGroup = stationGroup.dateMap.get(planDate)
|
||||
dateGroup.totalQuantity += quantity
|
||||
dateGroup.totalHours += hours*quantity
|
||||
if (hasSettlementHours) {
|
||||
dateGroup.totalSettlementHours += settlementPieceHours * quantity
|
||||
dateGroup.settlementHoursCount += 1
|
||||
}
|
||||
dateGroup.tasks.push(task)
|
||||
})
|
||||
|
||||
@@ -489,6 +619,7 @@ export default {
|
||||
...dateGroup,
|
||||
totalQuantity: dateGroup.totalQuantity,
|
||||
totalHours: Number(dateGroup.totalHours.toFixed(2)),
|
||||
totalSettlementHours: dateGroup.settlementHoursCount > 0 ? Number(dateGroup.totalSettlementHours.toFixed(2)) : '',
|
||||
tasks: dateGroup.tasks.sort((a, b) => getTime(a.计划开始时间) - getTime(b.计划开始时间))
|
||||
}))
|
||||
|
||||
@@ -497,6 +628,7 @@ export default {
|
||||
totalCount: stationGroup.totalCount,
|
||||
totalQuantity: stationGroup.totalQuantity,
|
||||
totalHours: Number(stationGroup.totalHours.toFixed(2)),
|
||||
totalSettlementHours: stationGroup.settlementHoursCount > 0 ? Number(stationGroup.totalSettlementHours.toFixed(2)) : '',
|
||||
dates
|
||||
}
|
||||
})
|
||||
@@ -640,6 +772,111 @@ export default {
|
||||
const key = this.stationDateKey(station, date)
|
||||
this.$set(this.expandedDates, key, !this.isDateExpanded(station, date))
|
||||
},
|
||||
hasValue(value) {
|
||||
return value !== null && value !== undefined && value !== ''
|
||||
},
|
||||
formatNumber(value) {
|
||||
if (!this.hasValue(value)) return ''
|
||||
const number = Number(value)
|
||||
if (Number.isNaN(number)) return value
|
||||
return Number(number.toFixed(2))
|
||||
},
|
||||
getTaskQuantity(task) {
|
||||
return Number(task.指派数量 || task.计划数量) || 0
|
||||
},
|
||||
calcStandardHours(task) {
|
||||
const hours = Number(task.标准工时) || 0
|
||||
return Number((hours * this.getTaskQuantity(task)).toFixed(2))
|
||||
},
|
||||
calcSettlementHours(task) {
|
||||
if (!this.hasValue(task.结算单件工时)) return ''
|
||||
const pieceHours = Number(task.结算单件工时)
|
||||
if (Number.isNaN(pieceHours)) return ''
|
||||
return Number((pieceHours * this.getTaskQuantity(task)).toFixed(2))
|
||||
},
|
||||
formatHistoryPieceHours(value) {
|
||||
if (!this.canSelectHistoryHour(value)) return ''
|
||||
return Number((Number(value) * 60).toFixed(2))
|
||||
},
|
||||
canSelectHistoryHour(value) {
|
||||
if (!this.hasValue(value)) return false
|
||||
const number = Number(value)
|
||||
return !Number.isNaN(number) && number > 0
|
||||
},
|
||||
openWorkHourDialog(row) {
|
||||
this.handleRowClick(row)
|
||||
this.workHourCurrentRow = row
|
||||
this.dialogcasual2 = true
|
||||
this.workHourLoading = true
|
||||
this.workHourData = []
|
||||
|
||||
const param = []
|
||||
param.push(["产品编码", row.产品编码])
|
||||
param.push(["合同号", ''])
|
||||
param.push(["订单号", ''])
|
||||
param.push(["工位", ''])
|
||||
param.push(["开始日期", ''])
|
||||
param.push(["结束日期", ''])
|
||||
param.push(["数据条数", 100])
|
||||
const Data = this.CreateData('11', '生产管理_结算工时_查询', param)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
if (response.data && Array.isArray(response.data)) {
|
||||
response.data.forEach(element => {
|
||||
if (element.Level == 2) {
|
||||
this.workHourData.push(element)
|
||||
}
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$message.error('历史工时查询失败')
|
||||
}).finally(() => {
|
||||
this.workHourLoading = false
|
||||
})
|
||||
},
|
||||
selectSettlementPieceHour(historyRow, type) {
|
||||
const rawValue = type === 'auxiliary'
|
||||
? historyRow.settlementAuxiliaryPieceHours
|
||||
: historyRow.settlementReportPieceHours
|
||||
const pieceHours = this.formatHistoryPieceHours(rawValue)
|
||||
|
||||
if (!this.hasValue(pieceHours)) {
|
||||
this.$message.error('历史工时为空,无法选择')
|
||||
return
|
||||
}
|
||||
|
||||
this.saveSettlementPieceHour(this.workHourCurrentRow, pieceHours)
|
||||
},
|
||||
saveSettlementPieceHour(row, pieceHours) {
|
||||
if (!row) {
|
||||
this.$message.error('请选择任务')
|
||||
return
|
||||
}
|
||||
|
||||
const number = Number(pieceHours)
|
||||
if (Number.isNaN(number)) {
|
||||
this.$message.error('结算单件工时格式错误')
|
||||
return
|
||||
}
|
||||
|
||||
const params = []
|
||||
params.push(["editstr", `[结算单件工时] = ${number}`])
|
||||
params.push(["订单号", row.订单号])
|
||||
params.push(["订单行号", row.订单行号])
|
||||
params.push(["订单拆分内码", row.拆分内码])
|
||||
const Data = this.CreateData('12', 'MES_OrderPlanned_EditTaskPlanned', params)
|
||||
this.ExecDatabase(Data).then(response => {
|
||||
const result = response.data && response.data[0]
|
||||
if (!result || result.result !== '1') {
|
||||
this.$message.error('保存失败')
|
||||
return
|
||||
}
|
||||
this.$set(row, '结算单件工时', number)
|
||||
this.dialogcasual2 = false
|
||||
this.$message.success('保存成功')
|
||||
}).catch(() => {
|
||||
this.$message.error('保存失败')
|
||||
})
|
||||
},
|
||||
//you
|
||||
getitemdata(item){
|
||||
var param = []
|
||||
@@ -1506,7 +1743,7 @@ export default {
|
||||
}
|
||||
.station-table {
|
||||
width: 100%;
|
||||
min-width: 2580px;
|
||||
min-width: 2800px;
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
color: #24364a;
|
||||
@@ -1598,6 +1835,10 @@ export default {
|
||||
.station-table .compact-group {
|
||||
width: 110px;
|
||||
}
|
||||
.station-table .work-hour-button {
|
||||
max-width: 100px;
|
||||
padding: 0;
|
||||
}
|
||||
.station-table ::v-deep .el-input__inner {
|
||||
height: 24px;
|
||||
padding: 0 8px;
|
||||
@@ -1622,6 +1863,8 @@ export default {
|
||||
.col-name { width: 170px; }
|
||||
.col-plan-num { width: 70px; }
|
||||
.col-hours { width: 90px; }
|
||||
.col-settlement-hours { width: 90px; }
|
||||
.col-settlement-piece { width: 120px; }
|
||||
.col-process { width: 120px; }
|
||||
.col-station { width: 120px; }
|
||||
.col-date { width: 130px; }
|
||||
|
||||
Reference in New Issue
Block a user