| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod Upload ( | 
|   MacroPlan macroPlan, | 
|   OfflinePlanTable opt, | 
|   GeneralExcelImportAndExportDataTable table | 
| ) | 
| { | 
|   TextBody: | 
|   [* | 
|     indexUnitID    := ""; | 
|     indexProductID := ""; | 
|      | 
|     traverse ( table, GeneralExcelImportAndExportDataRow, row ) { | 
|       firstColumn  := select( table, GeneralExcelImportAndExportDataColumn, tempC, tempC.ColumnIndex() = 0 ); | 
|       secondColumn := select( table, GeneralExcelImportAndExportDataColumn, tempC, tempC.ColumnIndex() = 1 ); | 
|        | 
|       firstCell    := select( row, GeneralExcelImportAndExportDataCell, tempC, tempC.GeneralExcelImportAndExportDataColumn() = firstColumn ); | 
|       u            := select( macroPlan, Unit, tempU, tempU.ID() = firstCell.Value() ); | 
|       product      := select( macroPlan, Product_MP, tempPMP, tempPMP.ID() = firstCell.Value() ); | 
|        | 
|       secondCell    := select( row, GeneralExcelImportAndExportDataCell, tempC, tempC.GeneralExcelImportAndExportDataColumn() = secondColumn ); | 
|        | 
|       if ( not isnull( u ) and secondCell.Value() = "" ) { | 
|         indexUnitID := u.ID(); | 
|         opr         := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = indexUnitID and tempOPR.ProductID() = "" and tempOPR.Type() = "0" ); | 
|         opr.OfflinePlanCell( relflush ); | 
|          | 
|         OfflinePlanImportData::UpdateCell( table, row, opt, opr ); | 
|       } else if ( not isnull( product ) and secondCell.Value() = "Quantity" ) { | 
|         indexProductID := product.ID(); | 
|         opr            := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = indexUnitID and tempOPR.ProductID() = indexProductID and tempOPR.Type() = "1" ); | 
|         opr.OfflinePlanCell( relflush ); | 
|          | 
|         OfflinePlanImportData::UpdateCell( table, row, opt, opr ); | 
|       } else if ( isnull( product ) and secondCell.Value() = "Order" ) { | 
|         opr := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = indexUnitID and tempOPR.ProductID() = indexProductID and tempOPR.Type() = "2" ); | 
|         opr.OfflinePlanCell( relflush ); | 
|          | 
|         OfflinePlanImportData::UpdateCell( table, row, opt, opr ); | 
|       } else if ( firstCell.Value() = "合计" and secondCell.Value() = "总量" ) { | 
|         opr := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = indexUnitID and tempOPR.ProductID() = "Z" and tempOPR.Type() = "3" ); | 
|         opr.OfflinePlanCell( relflush ); | 
|          | 
|         OfflinePlanImportData::UpdateCell( table, row, opt, opr ); | 
|       } else if ( firstCell.Value() = "" and secondCell.Value() = "班次" ) { | 
|         opr := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = indexUnitID and tempOPR.ProductID() = "Z" and tempOPR.Type() = "4" ); | 
|         opr.OfflinePlanCell( relflush ); | 
|          | 
|         OfflinePlanImportData::UpdateCell( table, row, opt, opr ); | 
|       } else if ( firstCell.Value() = "" and secondCell.Value() = "班次开始时间" ) { | 
|         opr := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = indexUnitID and tempOPR.ProductID() = "Z" and tempOPR.Type() = "5" ); | 
|         opr.OfflinePlanCell( relflush ); | 
|          | 
|         OfflinePlanImportData::UpdateCell( table, row, opt, opr ); | 
|       } else if ( firstCell.Value() = "" and secondCell.Value() = "班次结束时间" ) { | 
|         opr := select( opt, OfflinePlanRow, tempOPR, tempOPR.ProductionLine() = indexUnitID and tempOPR.ProductID() = "Z" and tempOPR.Type() = "6" ); | 
|         opr.OfflinePlanCell( relflush ); | 
|          | 
|         OfflinePlanImportData::UpdateCell( table, row, opt, opr ); | 
|       } else { | 
|         error( "导入失败,数据异常" ); | 
|       } | 
|     } | 
|   *] | 
| } |