|
|
|
@ -395,7 +395,7 @@ import { |
|
|
|
saveStandardOperation, // 新增工序 |
|
|
|
calculationTime, // 计算工时 |
|
|
|
} from '@/api/part/routingManagement.js' |
|
|
|
import {verifyData} from '@/api/part/partInformation.js' |
|
|
|
import {verifyData, getPartItem} from '@/api/part/partInformation.js' |
|
|
|
import ChooseList from '@/views/modules/common/Chooselist_eam' |
|
|
|
import {Decimal} from "decimal.js"; |
|
|
|
export default { |
|
|
|
@ -407,7 +407,7 @@ export default { |
|
|
|
deep: true, |
|
|
|
handler: function (newV, oldV) { |
|
|
|
newV.forEach(item => { |
|
|
|
item.formula = this.getFormula(item.operationName) |
|
|
|
item.formula = this.getFormula(item) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -636,6 +636,8 @@ export default { |
|
|
|
copyPartList: [], |
|
|
|
standardOperationList: [], |
|
|
|
standardOperationSelections: [], |
|
|
|
// 物料属性信息 |
|
|
|
partItemsMap: {}, |
|
|
|
// ======== 列表表头 ======== |
|
|
|
columnList: [ |
|
|
|
{ |
|
|
|
@ -1842,6 +1844,9 @@ export default { |
|
|
|
printUnitName: row.printUnitName, |
|
|
|
alternativeNo: row.alternativeNo, |
|
|
|
} |
|
|
|
// 获取物料属性信息 |
|
|
|
this.loadPartItems(row.site, row.buNo, row.partNo, row.codeNo) |
|
|
|
|
|
|
|
// 查routing明细 |
|
|
|
queryRoutingDetail(this.modalData).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
@ -2690,29 +2695,160 @@ export default { |
|
|
|
this.componentData.laborClassDesc = '' |
|
|
|
}, |
|
|
|
|
|
|
|
getFormula(value) { |
|
|
|
switch (value) { |
|
|
|
/** |
|
|
|
* 加载物料属性信息 |
|
|
|
*/ |
|
|
|
loadPartItems(site, buNo, partNo, codeNo) { |
|
|
|
const tempData = { |
|
|
|
site: site, |
|
|
|
buNo: buNo, |
|
|
|
partNo: partNo, |
|
|
|
codeNo: codeNo, |
|
|
|
recordType: 'IP' |
|
|
|
} |
|
|
|
getPartItem(tempData).then(({data}) => { |
|
|
|
if (data && data.code === 0 && data.rows.length > 0) { |
|
|
|
// 将物料属性转换为 Map 方便查询 |
|
|
|
const itemsMap = {} |
|
|
|
data.rows.forEach(item => { |
|
|
|
const key = item.itemDesc |
|
|
|
const value = item.numValue != null ? item.numValue : item.textValue |
|
|
|
itemsMap[key] = value |
|
|
|
}) |
|
|
|
this.partItemsMap = itemsMap |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
getFormula(item) { |
|
|
|
if (!item) return '' |
|
|
|
|
|
|
|
const operationName = item.operationName |
|
|
|
const crewSize = item.crewSize || 0 |
|
|
|
const refSpeed = item.refSpeed || 0 |
|
|
|
const refTime = item.refTime || 0 |
|
|
|
const refEfficiency = item.refEfficiency || 0 |
|
|
|
|
|
|
|
// 格式化数字:小数位大于3位保留3位,小于等于3位保持原数字 |
|
|
|
const formatNum = (num) => { |
|
|
|
const value = parseFloat(num || 0) |
|
|
|
// 如果是整数,直接返回整数形式 |
|
|
|
if (value === Math.floor(value)) { |
|
|
|
return Math.floor(value).toString() |
|
|
|
} |
|
|
|
// 转换为字符串,检查小数位数 |
|
|
|
const str = value.toString() |
|
|
|
const decimalIndex = str.indexOf('.') |
|
|
|
if (decimalIndex === -1) { |
|
|
|
return str |
|
|
|
} |
|
|
|
const decimalPlaces = str.length - decimalIndex - 1 |
|
|
|
// 如果小数位数大于3位,四舍五入保留3位 |
|
|
|
if (decimalPlaces > 3) { |
|
|
|
return value.toFixed(3) |
|
|
|
} |
|
|
|
// 小数位数小于等于3位,保持原样 |
|
|
|
return str |
|
|
|
} |
|
|
|
|
|
|
|
let formula = '' |
|
|
|
let calculation = '' |
|
|
|
|
|
|
|
switch (operationName) { |
|
|
|
case '一复': case '熟化': case 'RFID前道检品': |
|
|
|
return '人数/(速度x时间x效率)' |
|
|
|
formula = '人数/(速度×时间×效率)' |
|
|
|
if (refSpeed && refTime && refEfficiency) { |
|
|
|
const result = crewSize / (refSpeed * refTime * refEfficiency) |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)})` |
|
|
|
} |
|
|
|
break |
|
|
|
case '印刷': case 'RFID-蚀刻': case 'RFID-分切': |
|
|
|
return '人数/(速度x时间x效率)/Printing lanes' |
|
|
|
formula = '人数/(速度×时间×效率)/Printing lanes' |
|
|
|
if (refSpeed && refTime && refEfficiency) { |
|
|
|
const printingLanes = this.partItemsMap['Printing lanes'] || null |
|
|
|
if (printingLanes) { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)})/${formatNum(printingLanes)}` |
|
|
|
} else { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)})/Printing lanes` |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
case 'RFID绑定-TAL': case'RFID绑定-Paris': case'RFID绑定-MLI':case 'RFID编码': case 'RFID编码打印': |
|
|
|
return '人数/(UPH(每小时产量)*效率)*1KCT' |
|
|
|
formula = '人数/(UPH(每小时产量)×效率)×1KCT' |
|
|
|
if (refSpeed && refEfficiency) { |
|
|
|
const uph = refSpeed |
|
|
|
const result = crewSize / (uph * refEfficiency) * 1000 |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(uph)}×${formatNum(refEfficiency)})×1000` |
|
|
|
} |
|
|
|
break |
|
|
|
case 'RFID多条检测': |
|
|
|
return '人数/(速度x时间xCDx效率)*1KCT' |
|
|
|
formula = '人数/(速度×时间×CD×效率)×1KCT' |
|
|
|
if (refSpeed && refTime && refEfficiency) { |
|
|
|
const cd = this.partItemsMap['CL60k-CD'] || null |
|
|
|
if (cd) { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(cd)}×${formatNum(refEfficiency)})×1000` |
|
|
|
} else { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×CD×${formatNum(refEfficiency)})×1000` |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
case 'RFID复合模切检测': |
|
|
|
return '人数/(速度x时间x效率x(CDx复合列数))*1KCT' |
|
|
|
formula = '人数/(速度×时间×效率×(CD×复合列数))×1KCT' |
|
|
|
if (refSpeed && refTime && refEfficiency) { |
|
|
|
const cd = this.partItemsMap['CL60k-CD'] || null |
|
|
|
const compoundLanes = this.partItemsMap['复合列数'] || null |
|
|
|
if (cd && compoundLanes) { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)}×(${formatNum(cd)}×${formatNum(compoundLanes)}))×1000` |
|
|
|
} else { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)}×(CD×复合列数))×1000` |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
case 'RFID后道检品': |
|
|
|
return '人数/UPH(每小时产量)*100%*1KCT' |
|
|
|
formula = '人数/UPH(每小时产量)×100%×1KCT' |
|
|
|
if (refSpeed) { |
|
|
|
const uph = refSpeed |
|
|
|
const result = crewSize / uph * 1 * 1000 |
|
|
|
calculation = ` = ${formatNum(crewSize)}/${formatNum(uph)}×1.000×1000` |
|
|
|
} |
|
|
|
break |
|
|
|
case 'RFID自动贴标': |
|
|
|
return '人数/(速度x时间x效率x(CDx贴标列数))*1KCT' |
|
|
|
formula = '人数/(速度×时间×效率×(CD×贴标列数))×1KCT' |
|
|
|
if (refSpeed && refTime && refEfficiency) { |
|
|
|
const cd = this.partItemsMap['CL60k-CD'] || null |
|
|
|
const labelingLanes = this.partItemsMap['贴标列数'] || null |
|
|
|
if (cd && labelingLanes) { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)}×(${formatNum(cd)}×${formatNum(labelingLanes)}))×1000` |
|
|
|
} else { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)}×(CD×贴标列数))×1000` |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
case 'Voyantic在线检测': |
|
|
|
return '人数/(速度x时间x效率x(CDx检测列数))*1KCT' |
|
|
|
formula = '人数/(速度×时间×效率×(CD×检测列数))×1KCT' |
|
|
|
if (refSpeed && refTime && refEfficiency) { |
|
|
|
const cd = this.partItemsMap['CL60k-CD'] || null |
|
|
|
const detectionLanes = this.partItemsMap['检测列数'] || null |
|
|
|
if (cd && detectionLanes) { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)}×(${formatNum(cd)}×${formatNum(detectionLanes)}))×1000` |
|
|
|
} else { |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(refSpeed)}×${formatNum(refTime)}×${formatNum(refEfficiency)}×(CD×检测列数))×1000` |
|
|
|
} |
|
|
|
} |
|
|
|
break |
|
|
|
case 'Packaging': |
|
|
|
return '人数/(日产量/8小时/17人均摊)*1KCT' |
|
|
|
formula = '人数/(日产量/8小时/17人均摊)×1KCT' |
|
|
|
if (refSpeed) { |
|
|
|
const dailyOutput = refSpeed |
|
|
|
const result = crewSize / (dailyOutput / 8 / 17) * 1000 |
|
|
|
calculation = ` = ${formatNum(crewSize)}/(${formatNum(dailyOutput)}/8.000/17.000)×1000` |
|
|
|
} |
|
|
|
break |
|
|
|
default: |
|
|
|
return '' |
|
|
|
} |
|
|
|
|
|
|
|
return formula + calculation |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|