| @@ -176,7 +176,7 @@ open class BomService( | |||||
| this.description = req.description | this.description = req.description | ||||
| this.item = item | this.item = item | ||||
| this.outputQty = req.outputQty | this.outputQty = req.outputQty | ||||
| this.outputQtyUom = req.outputQtyUom | |||||
| this.outputQtyUom = uom?.udfudesc | |||||
| this.yield = req.yield | this.yield = req.yield | ||||
| this.uom = uom | this.uom = uom | ||||
| // this.excelUom = req.excelUom | // this.excelUom = req.excelUom | ||||
| @@ -712,7 +712,24 @@ open class BomService( | |||||
| } | } | ||||
| "種類" -> request.description = topTargetValueCell.stringCellValue.trim() | "種類" -> request.description = topTargetValueCell.stringCellValue.trim() | ||||
| "份量 (Qty)" -> request.outputQty = topTargetValueCell.numericCellValue.toBigDecimal() | "份量 (Qty)" -> request.outputQty = topTargetValueCell.numericCellValue.toBigDecimal() | ||||
| "單位" -> request.outputQtyUom = topTargetValueCell.stringCellValue.trim() | |||||
| "單位" -> { | |||||
| val rawUomCode = topTargetValueCell.stringCellValue.trim() | |||||
| // 先把 Excel 字原封不動存起來 | |||||
| request.outputQtyUom = rawUomCode | |||||
| // 用它當作 UOM code 去 uom_conversion 找 | |||||
| val uom = uomConversionRepository.findByCodeAndDeletedFalse(rawUomCode) | |||||
| if (uom != null) { | |||||
| // 之後 saveBomEntity 會用這個 id 拿到 entity | |||||
| request.uomId = uom.id | |||||
| // 如果你希望 outputQtyUom 存「標準 code」而不是 Excel 原字,可以改成: | |||||
| // request.outputQtyUom = uom.code | |||||
| } else { | |||||
| // 找不到就維持 Excel 原字,或在 issue log 裡紀錄問題(看你要不要) | |||||
| } | |||||
| } | |||||
| } | } | ||||
| // ----------------------------------------------------------------------------------------------- // | // ----------------------------------------------------------------------------------------------- // | ||||
| // --------------------- assigning value that is next to a header to request ------------------------ // | // --------------------- assigning value that is next to a header to request ------------------------ // | ||||
| @@ -740,6 +757,8 @@ open class BomService( | |||||
| "0" -> score = 0 | "0" -> score = 0 | ||||
| "Yes" -> score = 5 | "Yes" -> score = 5 | ||||
| "1" -> score = 5 | "1" -> score = 5 | ||||
| "1.0" -> score = 5 | |||||
| "0.0" -> score = 0 | |||||
| " " -> score = 0 | " " -> score = 0 | ||||
| "" -> score = 0 | "" -> score = 0 | ||||
| } | } | ||||