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 ){
|
|
unitIDCell := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 1 );
|
shiftNameCell := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 );
|
firstSingleShiftQuantityCell := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 3 );
|
secondSingleShiftQuantityCell := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 4 );
|
thirdSingleShiftQuantityCell := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 5 );
|
maintenanceDeduction := select( row, GeneralExcelImportAndExportDataCell, tempGEIAEDC, tempGEIAEDC.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 6 );
|
|
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(), "" ),
|
FirstSingleShiftQuantity := guard( [Real]firstSingleShiftQuantityCell.Value(), 0.0 ),
|
SecondSingleShiftQuantity := guard( [Real]secondSingleShiftQuantityCell.Value(), 0.0 ),
|
ThirdSingleShiftQuantity := guard( [Real]thirdSingleShiftQuantityCell.Value(), 0.0 ),
|
MaintenanceDeduction := guard( [Real]maintenanceDeduction.Value(), 0.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 );
|
//}
|
*]
|
}
|