diff --git a/src/views/PlanManagement/SelfMakePlando/index.vue b/src/views/PlanManagement/SelfMakePlando/index.vue index c1d7f08..d487876 100644 --- a/src/views/PlanManagement/SelfMakePlando/index.vue +++ b/src/views/PlanManagement/SelfMakePlando/index.vue @@ -392,19 +392,32 @@ {{ scope.row.taskDescription || '' }} - - + + + + - + + + + + + - - - - - - - - - - - diff --git a/src/views/PlanManagement/SelfMakePlandone/index.vue b/src/views/PlanManagement/SelfMakePlandone/index.vue index 9c11cd8..05ba4da 100644 --- a/src/views/PlanManagement/SelfMakePlandone/index.vue +++ b/src/views/PlanManagement/SelfMakePlandone/index.vue @@ -180,12 +180,12 @@ @click="getitemdata(scope.row.订单号)">查看 - + diff --git a/src/views/PlanManagement/WorkstationPlan/index.vue b/src/views/PlanManagement/WorkstationPlan/index.vue index 80847ac..b0cfc4d 100644 --- a/src/views/PlanManagement/WorkstationPlan/index.vue +++ b/src/views/PlanManagement/WorkstationPlan/index.vue @@ -61,6 +61,8 @@ 工位 / 日期 标准工时 + 结算工时 + 结算单件工时 生产订单 计划号 销售订单 @@ -96,6 +98,8 @@ {{ stationGroup.totalHours }} + {{ stationGroup.totalSettlementHours }} + @@ -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; }