diff --git a/klp-ui/src/views/cost/comprehensive.vue b/klp-ui/src/views/cost/comprehensive.vue index 7d6b1ea0..1d5f83ce 100644 --- a/klp-ui/src/views/cost/comprehensive.vue +++ b/klp-ui/src/views/cost/comprehensive.vue @@ -21,6 +21,7 @@ {{ parseTime(activeReport.reportDate,'{y}-{m}-{d}') }} 投入{{ activeReport.inputWeight }}t 产出{{ activeReport.outputWeight }}t 保存 列配置 + 价格管理 {{ inputMode ? '录入' : '查看' }} @@ -174,11 +175,14 @@ input_weight output_weight + price(价格) + +
确 定 @@ -187,6 +191,24 @@ + + + + + + + + + + +
+ 保存 + 取消 +
+
+ @@ -365,7 +387,8 @@ export default { lineOptions: [], lineType: null, noLineType: false, - inputMode: false + inputMode: false, + priceOpen: false, priceList: [], priceSaving: false } }, computed: { @@ -511,7 +534,7 @@ export default { }, doPickMetric() { this.selMp.forEach(m => { - this.allCols.push({ $type: 'metric', metricId: m.metricId, metricName: m.metricName, metricFormula: m.metricFormula, unit: m.remark||'', isShift: false, color: null }) + this.allCols.push({ $type: 'metric', metricId: m.metricId, metricName: m.metricName, metricFormula: m.metricFormula, unit: m.remark||'', isShift: false, color: null, metricValue: m.metricValue, usePrice: m.usePrice }) }) this.metricPickOpen = false }, @@ -521,15 +544,15 @@ export default { this.mgrList = this._allMetricDefs || [] this.mgrOpen = true }, - addMetricDef() { this.defForm = { metricId: null, metricName: '', metricFormula: '', unit: '' }; this.defTitle = '新增指标'; this.defOpen = true }, - editMetricDef(row) { this.defForm = { metricId: row.metricId, metricName: row.metricName, metricFormula: row.metricFormula, unit: row.remark||'' }; this.defTitle = '编辑指标'; this.defOpen = true }, + addMetricDef() { this.defForm = { metricId: null, metricName: '', metricFormula: '', unit: '', usePrice: 0, metricValue: '' }; this.defTitle = '新增指标'; this.defOpen = true }, + editMetricDef(row) { this.defForm = { metricId: row.metricId, metricName: row.metricName, metricFormula: row.metricFormula, unit: row.remark||'', usePrice: row.usePrice || 0, metricValue: row.metricValue || '' }; this.defTitle = '编辑指标'; this.defOpen = true }, async submitMetricDef() { const f = this.defForm if (!f.metricName) { this.$modal.msgWarning('请输入指标名称'); return } if (f.metricId) { - await updateProdMetric({ metricId: f.metricId, metricName: f.metricName, metricFormula: f.metricFormula, remark: f.unit }) + await updateProdMetric({ metricId: f.metricId, metricName: f.metricName, metricFormula: f.metricFormula, remark: f.unit, usePrice: f.usePrice, metricValue: f.metricValue || 0 }) } else { - await addProdMetric({ reportId: this.activeReport.reportId, metricCode: f.metricName, metricName: f.metricName, metricFormula: f.metricFormula, metricValue: 0, remark: f.unit || '' }) + await addProdMetric({ reportId: this.activeReport.reportId, metricCode: f.metricName, metricName: f.metricName, metricFormula: f.metricFormula, metricValue: f.metricValue || 0, remark: f.unit || '', usePrice: f.usePrice }) } this.defOpen = false; this.$modal.msgSuccess('保存成功') await this.openMetricMgr() @@ -542,6 +565,29 @@ export default { }) }, + /* price management */ + async openPriceMgr() { + await this.loadAllMetrics(this.activeReport.reportId) + this.priceList = (this._allMetricDefs || []).filter(m => m.usePrice == 1).map(m => ({ + ...m, + _originValue: m.metricValue + })) + this.priceOpen = true + }, + async savePrices() { + this.priceSaving = true + try { + for (const m of this.priceList) { + if (m.metricValue !== m._originValue) { + await updateProdMetric({ metricId: m.metricId, metricValue: m.metricValue || 0 }) + } + } + this.priceOpen = false + this.$modal.msgSuccess('保存成功') + await this.loadAllMetrics(this.activeReport.reportId) + } finally { this.priceSaving = false } + }, + async saveColCfg() { const rid = this.activeReport.reportId; this.colSaving = true try { @@ -549,7 +595,7 @@ export default { for (const m of metricCols) { if (!m.metricName) { this.$modal.msgWarning('存在空指标列'); return } if (m.metricFormula) { - const testF = m.metricFormula.replace(/@\{[^}]+\}/g, '1').replace(/input_weight|output_weight/g, '1') + const testF = m.metricFormula.replace(/@\{[^}]+\}/g, '1').replace(/input_weight|output_weight|price/g, '1') if (this.evalF(testF) === null) { this.$modal.msgError('指标 "' + m.metricName + '" 公式无效'); return } } } @@ -601,7 +647,7 @@ export default { if (!def && c.id) { try { const r = await getProdMetric(c.id); if (r.data) { def = r.data; this._allMetricDefs.push(def) } } catch(e) {} } - if (def) cols.push({ $type: 'metric', metricId: def.metricId, metricName: def.metricName, metricFormula: def.metricFormula, unit: def.remark||'', isShift: !!c.s, color: c.c || null }) + if (def) cols.push({ $type: 'metric', metricId: def.metricId, metricName: def.metricName, metricFormula: def.metricFormula, unit: def.remark||'', isShift: !!c.s, color: c.c || null, metricValue: def.metricValue, usePrice: def.usePrice }) } } this.allCols = cols @@ -649,7 +695,7 @@ export default { f = f.replace(new RegExp('@\\{'+code+'\\}\\.甲班','g'), v).replace(new RegExp('@\\{'+code+'\\}\\.乙班','g'), v).replace(new RegExp('@\\{'+code+'\\}','g'), v) } }) - f = f.replace(/input_weight/g, rp.inputWeight||0).replace(/output_weight/g, rp.outputWeight||0) + f = f.replace(/input_weight/g, rp.inputWeight||0).replace(/output_weight/g, rp.outputWeight||0).replace(/price/g, (m.usePrice == 1) ? (m.metricValue || 0) : 0) return this.evalF(f) } if (m.isShift) { row['mv'+m.mIdx+'_1']=ef('1'); row['mv'+m.mIdx+'_2']=ef('2') } @@ -695,7 +741,7 @@ export default { else if (sc.t === 'm') { const sid = String(sc.id) let def = this._allMetricDefs.find(m=>String(m.metricId)===sid) - if (def && !usedMids.has(sid)) { usedMids.add(sid); this.allCols.push({ $type:'metric', metricId:String(def.metricId), metricName:def.metricName, metricFormula:def.metricFormula, unit:def.remark||'', isShift:!!sc.s, color:sc.c||null }) } + if (def && !usedMids.has(sid)) { usedMids.add(sid); this.allCols.push({ $type:'metric', metricId:String(def.metricId), metricName:def.metricName, metricFormula:def.metricFormula, unit:def.remark||'', isShift:!!sc.s, color:sc.c||null, metricValue: def.metricValue, usePrice: def.usePrice }) } } }) this.copyCfgOpen = false; let mi = 0; this.allCols.forEach(c => { if (c.$type === 'metric') c.mIdx = mi++ }) @@ -778,6 +824,7 @@ export default { .vars-tag:hover { opacity: 0.8; } .var-sys { background: #ecf5ff; border-color: #d9ecff; color: #409eff; } .var-mtr { background: #f0f9eb; border-color: #e1f3d8; color: #67c23a; } +.var-price { background: #fef0f0; border-color: #fbc4c4; color: #f56c6c; } .drag-handle { cursor: grab; font-size: 14px; color: #909399; padding: 2px; display: inline-flex; align-items: center; } .drag-handle:active { cursor: grabbing; } .drag-handle:hover { color: #409eff; } diff --git a/klp-ui/src/views/wms/anneal/plan/ctrl.vue b/klp-ui/src/views/wms/anneal/plan/ctrl.vue index 7ea5ccb3..5a0c7728 100644 --- a/klp-ui/src/views/wms/anneal/plan/ctrl.vue +++ b/klp-ui/src/views/wms/anneal/plan/ctrl.vue @@ -279,6 +279,7 @@ export default { currentCoilNo: undefined, status: 0, dataType: 1, + exclusiveStatus: 0, }, statusForm: { planId: undefined, diff --git a/klp-ui/src/views/wms/anneal/plan/index.vue b/klp-ui/src/views/wms/anneal/plan/index.vue index a9a8ebcc..d9932dea 100644 --- a/klp-ui/src/views/wms/anneal/plan/index.vue +++ b/klp-ui/src/views/wms/anneal/plan/index.vue @@ -146,7 +146,7 @@ @@ -257,6 +257,7 @@ export default { currentCoilNo: undefined, status: 0, dataType: 1, + exclusiveStatus: 0, }, statusForm: { planId: undefined, @@ -522,6 +523,7 @@ export default { this.$message.success('已入炉'); }, handleUnbind(row) { + console.log(row); this.$confirm('确定解绑该钢卷吗?', '提示', { confirmButtonText: '确定', cancelButtonText: '取消', diff --git a/klp-ui/src/views/wms/coil/panels/do.vue b/klp-ui/src/views/wms/coil/panels/do.vue index 7217308d..97874b0e 100644 --- a/klp-ui/src/views/wms/coil/panels/do.vue +++ b/klp-ui/src/views/wms/coil/panels/do.vue @@ -318,7 +318,7 @@ - @@ -375,6 +375,7 @@ export default { pageSize: 20, dataType: 1, status: 0, + exclusiveStatus: 0, enterCoilNo: null, currentCoilNo: null }, diff --git a/klp-ui/src/views/wms/coil/panels/stepSplit.vue b/klp-ui/src/views/wms/coil/panels/stepSplit.vue index 330375a7..e22cefc8 100644 --- a/klp-ui/src/views/wms/coil/panels/stepSplit.vue +++ b/klp-ui/src/views/wms/coil/panels/stepSplit.vue @@ -77,9 +77,10 @@ - +