| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod Import ( | 
|   MacroPlan macroPlan, | 
|   GeneralExcelImportAndExportDataTable table | 
| ) | 
| { | 
|   TextBody: | 
|   [* | 
|     // 清空原始数据 | 
|     units := selectset( macroPlan,Unit,unit,true ); | 
|     unitIndexTree := NamedValueTree::Create(); | 
|     for( i := 0; i< units.Size(); i++ ){ | 
|       unit := units.Element( i ); | 
|       unit.SingleShiftConfig( relflush ); | 
|        | 
|       unitHandle := unitIndexTree.GetHandle( unit.ID() ); | 
|       unitIndexTree.Root().AddChild( unitHandle,i ); | 
|     } | 
|      | 
|     // 校验文件名 | 
|     //if ( table.GeneralExcelImportAndExportDataSource().Name() <> "发动机匹配-六位码.xlsx" ) { | 
|     //  error( Translations::A_VWED_GeneralExcelImportAndExportDataSource_UploadError2() ); | 
|     //} | 
|      | 
|     // 生成数据 | 
|     rows := selectsortedset( table,GeneralExcelImportAndExportDataRow,row,row.RowNr()); | 
|      | 
|     traverse( rows,Elements,row ){ | 
|        | 
|       // idCell             := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 0 ); | 
|       shiftNameCell            := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 1 ); | 
|       singleShiftNameCell     := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 ); | 
|       standardYieldCell           := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 3 ); | 
|       unitIDCell            := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 4 ); | 
|        | 
|       unitID := guard( unitIDCell.Value(), "" ); | 
|       if( unitID = "" ){ | 
|         error( "Unit ID 为必填项。" ); | 
|       } | 
|       unitHandle := unitIndexTree.GetHandle( unitID ); | 
|       unitIndex := guard( unitIndexTree.Root().Child( unitHandle ),null( NamedValue )); | 
|       if( not isnull( unitIndex )){ | 
|         unit := units.Element( unitIndex.GetValueAsNumber() ); | 
|         unit.SingleShiftConfig( relnew, | 
|                                 ID := IDHolder::GetGUID(), | 
|                                 ShiftName := guard( shiftNameCell.Value(), "" ), | 
|                                 SingleShiftName := guard( singleShiftNameCell.Value(), "" ), | 
|                                 StandardYield := [Real]guard( standardYieldCell.Value(), "0" )); | 
|       }else{ | 
|         error( "无法在【" + macroPlan.MDSMacroPlan().Description() + "】内找到产线【" + unitID + "】。"); | 
|       } | 
|     } | 
|      | 
|     //// 校验数据 | 
|     //feedback            := ""; | 
|     //sanitycheckfeedback := ""; | 
|     //flag                := true; | 
|     // | 
|     //traverse ( macroPlan, SixDigitCode, sdc, flag ) { | 
|     //  SixDigitCode::ValidateInput( feedback, sanitycheckfeedback, macroPlan, sdc.Code(), sdc.Curve(), sdc.VehicleModel(), sdc.ProducingArea(), sdc.Engine(), sdc.Power(), sdc.EnginePartNumber(),  | 
|     //                               sdc.EngineFourDigitCode(), sdc.Remarks(), sdc ); | 
|     //  flag := feedback = ""; | 
|     //} | 
|     // | 
|     //if ( not flag ) { | 
|     //  error( feedback ); | 
|     //} | 
|   *] | 
| } |