_Main/BL/Type_DispatchShiftProductionInformation/Attribute_OrderNumber.qbl | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateHistoryTempTable.qbl | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
_Main/BL/Type_ShiftPlan/StaticMethod_GetWorkHoursByShiftPatternName.qbl | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
_Main/BL/Type_DispatchShiftProductionInformation/Attribute_OrderNumber.qbl
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,7 @@ Quintiq file version 2.0 #parent: #root Attribute OrderNumber { #keys: '3[414996.1.268920158][414996.1.268920157][414996.1.268920159]' ValueType: Number } _Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
@@ -51,7 +51,7 @@ } } traverse( row,NewOfflinePlanCell,cell, startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate()){ traverse( row,NewOfflinePlanCell,cell, startDate <= cell.NewOfflinePlanColumn().StartDate() and endDate >= cell.NewOfflinePlanColumn().EndDate() and cell.Quantity() > 0){ product := null( DispatchShiftSchedulingProduct ); tips := ""; if( not isnull( unit )){ @@ -77,6 +77,7 @@ productIndex := guard( productIndexTree.Root().Child( productHandle ),null( NamedValue )); if( isnull( productIndex )){ product := line.DispatchShiftSchedulingProduct( relnew,ProductID := row.ProductID() ); product.OrderNumber( cell.OrderNr() ); product.ProductionQuantity( cell.Quantity() ); products.Add( product ); productIndexTree.Root().AddChild( productHandle,products.Size() - 1 ); @@ -106,7 +107,7 @@ } } traverse( row,NewAssemblyOnlinePlanCell,cell, startDate <= cell.NewAssemblyOnlinePlanColumn().StartDate() and endDate >= cell.NewAssemblyOnlinePlanColumn().EndDate()){ traverse( row,NewAssemblyOnlinePlanCell,cell, startDate <= cell.NewAssemblyOnlinePlanColumn().StartDate() and endDate >= cell.NewAssemblyOnlinePlanColumn().EndDate() and cell.Quantity() > 0){ product := null( DispatchShiftSchedulingProduct ); tips := ""; if( not isnull( unit )){ @@ -132,6 +133,7 @@ productIndex := guard( productIndexTree.Root().Child( productHandle ),null( NamedValue )); if( isnull( productIndex )){ product := line.DispatchShiftSchedulingProduct( relnew,ProductID := row.ProductID() ); product.OrderNumber( cell.OrderNr() ); product.ProductionQuantity( cell.Quantity() ); products.Add( product ); productIndexTree.Root().AddChild( productHandle,products.Size() - 1 ); @@ -157,7 +159,7 @@ // 481 lineQuantity := line.LineQuantity(); tempProducts := selectsortedset( line,DispatchShiftSchedulingProduct,object,object.ProductionQuantity() ); tempProducts := selectsortedset( line,DispatchShiftSchedulingProduct,object,object.OrderNumber() ); if( line.ShiftName() = "3" ){ @@ -188,7 +190,7 @@ } } for( i := tempProducts.Size() - 1;i >= 0; i-- ){ for( i := 0;i < tempProducts.Size(); i++ ){ product := tempProducts.Element( i ); productionQuantity := product.ProductionQuantity(); @@ -214,7 +216,9 @@ singleShiftVolume3 := singleShiftVolume3 - productionQuantity; productionQuantity := productionQuantity - detail.ShiftVolume(); }else{ if( i = tempProducts.Size() - 1 ){ product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "ä¸ç"); } } } @@ -242,7 +246,7 @@ } } for( i := tempProducts.Size() - 1;i >= 0; i-- ){ for( i := 0 ;i < tempProducts.Size(); i++ ){ product := tempProducts.Element( i ); productionQuantity := product.ProductionQuantity(); @@ -262,13 +266,17 @@ detail := product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := ifexpr( tempProductQuantity > 0 ,productionQuantity,singleShiftVolume2 ) ,SingleShiftName := "äºç"); singleShiftVolume2 := singleShiftVolume2 - productionQuantity; productionQuantity := productionQuantity - detail.ShiftVolume(); }else{ if( i = tempProducts.Size() - 1 ){ product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "äºç"); } } } }else if( line.ShiftName() = "1" ){ singleShiftVolume1 := lineQuantity; for( i := tempProducts.Size() - 1;i >= 0; i-- ){ for( i := 0 ;i < tempProducts.Size(); i++ ){ product := tempProducts.Element( i ); productionQuantity := product.ProductionQuantity(); if( singleShiftVolume1 > 0 and productionQuantity > 0){ _Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
@@ -85,66 +85,8 @@ unitIndexTree.Root().AddChild( unitHandle,i ); } //// å¼å§æ¼æ¥åæ¡£æ°æ® //traverse( tables,Elements.ArchiveRow,row ){ // // å 寻æ¾localRowï¼æ¾ä¸å°å°±æ°å»ºï¼å¹¶åå»ºç´¢å¼ // localRow := null( LocalRow ); // { // localRowHandle := localRowIndexTree.GetHandle( row.Name() ); // localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue )); // if( isnull( localRowIndex )){ // localRow := localTable.LocalRow( relnew,CustomName := row.Name(),Index := localTable.GetRowIndexCache() ); // localRows.Add( localRow ); // localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 ); // }else{ // localRow := localRows.Element( localRowIndex.GetValueAsNumber()); // } // } // // 循ç¯åå»ºææ°æ® // traverse( localColumns,Elements,localColumn ){ // archiveCells := selectset( row,ArchiveCell.astype( ArchiveCell_ScheduleSummary ),cell, // cell.IsFristWeekData() and // cell.ArchiveColumn().CustomDate() >= localColumn.CustomDate() and // cell.ArchiveColumn().CustomDate() < localColumn.CustomDate().StartOfNextMonth() ); // // isFuture := macroPlan.StartOfPlanning().Date() <= localColumn.CustomDate(); // // workingDay := 0; // capacity := 0.0; // output := 0.0; // shiftPatterns := construct( Strings ); // // localCell := null( LocalCell_ScheduleSummary ); // { // localCellHandle := localCellIndexTree.GetHandle( row.Name() + localColumn.CustomDate().AsQUILL() ); // localCellIndex := guard( localCellIndexTree.Root().Child( localCellHandle ),null( NamedValue )); // if( isnull( localCellIndex )){ // localCell := localRow.LocalCell( relnew,LocalCell_ScheduleSummary,LocalColumn := localColumn ); // localCells.Add( localCell ); // localCellIndexTree.Root().AddChild( localCellHandle , localCells.Size() - 1 ); // }else{ // localCell := localCells.Element( localCellIndex.GetValueAsNumber() ); // } // } // // traverse( archiveCells,Elements,cell,cell.IsFristWeekData() ){ // workingDay := workingDay + cell.WorkingDay(); // capacity := capacity + cell.Capacity(); // if( cell.ShiftPattern() <> "" ){ // shiftPatterns.Add( cell.ShiftPattern() ); // } // } // // localCell.ShiftPattern( selectuniquevalues( shiftPatterns,Elements,element,element ).Concatenate( "/" ) ); // localCell.WorkingDay( localCell.WorkingDay() + workingDay ); // localCell.Capacity( localCell.Capacity() + capacity ); // localCell.Output( localCell.Output() + output ); // } //} tempArchiveTable := ArchiveCell_ScheduleSummary::CreateTempTable( macroPlan,recycleBin ); traverse( tempArchiveTable,LocalRow,row ){ localRow := null( LocalRow ); { localRowHandle := localRowIndexTree.GetHandle( row.CustomName()); @@ -157,7 +99,8 @@ localRow := localRows.Element( localRowIndex.GetValueAsNumber()); } } traverse( localColumns,Elements,localColumn ){ // å¾ªç¯æ¶é´ä¸ºè®¡åå¼å§æ¥æä¹åçæ¶é´ traverse( localColumns,Elements,localColumn ,localColumn.CustomDate() >= macroPlan.StartOfPlanning().Date() or LocalTool::GetYYYYMM( localColumn.CustomDate() ) = LocalTool::GetYYYYMM( macroPlan.StartOfPlanning().Date() )){ archiveCells := selectset( row,LocalCell.astype( LocalCell_ScheduleSummary ),cell, cell.LocalColumn().CustomDate() >= localColumn.CustomDate() and cell.LocalColumn().CustomDate() < localColumn.CustomDate().StartOfNextMonth() ); @@ -179,22 +122,6 @@ newSupply.ProductInStockingPointInPeriodPlanning().Period_MP().StartDate() < localColumn.CustomDate().StartOfNextMonth() and newSupply.ProductInStockingPointInPeriodPlanning().Period_MP().TimeUnit() = "Day", newSupply.Quantity()); } } // 计åå¼å§ä¹åç产åºåå®é æ¯æ¥ç产æ¥å£ if( localColumn.CustomDate() < macroPlan.StartOfPlanning().Date() ){ // å¼å§æ¶é´åæ¯è¾å°çå¼å§æ¶é´ historyStartDate := ifexpr( macroPlan.StartOfPlanning().Date() <= localColumn.CustomDate(), macroPlan.StartOfPlanning().Date(), localColumn.CustomDate() ); // ç»ææ¶é´åæ¯è¾å¤§çå¼å§æ¶é´ï¼å¦æå计åå¼å§æ¶é´å¤äºåä¸ä¸ªæä»½ï¼åå计åå¼å§æ¶é´ï¼å¦ååæåºæ¶é´ historyEndDate := ifexpr( macroPlan.StartOfPlanning().Date() > localColumn.CustomDate().StartOfNextMonth() and macroPlan.StartOfPlanning().Date().Month() = localColumn.CustomDate().Month() and macroPlan.StartOfPlanning().Date().Year() = localColumn.CustomDate().Year() ,macroPlan.StartOfPlanning().Date(), localColumn.CustomDate().StartOfNextMonth() ); { actualOut := sum( archive,ActualDailyProductionData,data,data.LineName() = row.CustomName() and data.ProductionDate() >= historyStartDate and data.ProductionDate() < historyEndDate,data.ActualOut() ); output := output + actualOut; } } @@ -220,47 +147,67 @@ } localCell.ShiftPattern( selectuniquevalues( shiftPatterns,Elements,element,element ).Concatenate( "/" ) ); localCell.WorkingDay( localCell.WorkingDay() + workingDay ); localCell.Capacity( localCell.Capacity() + capacity ); localCell.Output( localCell.Output() + output ); } } traverse( archive,ArchiveShiftPlanRow,row ){ historyTempTable := ArchiveCell_ScheduleSummary::CreateHistoryTempTable( archive,recycleBin,macroPlan ); traverse( historyTempTable,LocalRow,row ){ localRow := null( LocalRow ); { localRowHandle := localRowIndexTree.GetHandle( row.UnitID()); localRowHandle := localRowIndexTree.GetHandle( row.CustomName()); localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue )); if( isnull( localRowIndex )){ localRow := localTable.LocalRow( relnew,CustomName := row.UnitID(),Index := localTable.GetRowIndexCache() ); localRow := localTable.LocalRow( relnew,CustomName := row.CustomName(),Index := localTable.GetRowIndexCache() ); localRows.Add( localRow ); localRowIndexTree.Root().AddChild( localRowHandle,localRows.Size() - 1 ); }else{ localRow := localRows.Element( localRowIndex.GetValueAsNumber()); } } traverse( localColumns,Elements,localColumn ){ archiveCells := selectset( row,ArchiveShiftPlanCell,cell, cell.ArchiveShiftPlanColumn().StartDate() >= localColumn.CustomDate() and cell.ArchiveShiftPlanColumn().StartDate() < localColumn.CustomDate().StartOfNextMonth() ); // å¾ªç¯æ¶é´ä¸ºè®¡åå¼å§æ¥æä¹åçæ¶é´ traverse( localColumns,Elements,localColumn , localColumn.CustomDate() < macroPlan.StartOfPlanning().Date() or LocalTool::GetYYYYMM( localColumn.CustomDate() ) = LocalTool::GetYYYYMM( macroPlan.StartOfPlanning().Date() )){ archiveCells := selectset( row,LocalCell.astype( LocalCell_ScheduleSummary ),cell, cell.LocalColumn().CustomDate() >= localColumn.CustomDate() and cell.LocalColumn().CustomDate() < localColumn.CustomDate().StartOfNextMonth() ); workingDay := 0; capacity := 0.0; output := 0.0; shiftPatterns := construct( Strings ); traverse( archiveCells,Elements,cell ){ // capacity := capacity + cell.Capacity(); if( cell.Outcome() <> "" ){ if( cell.ShiftPattern() <> "" ){ workingDay := workingDay + 1; shiftPatterns.Add( cell.Outcome() ); capacity := capacity + cell.Capacity(); shiftPatterns.Add( cell.ShiftPattern() ); } } // 计åå¼å§ä¹åç产åºåå®é æ¯æ¥ç产æ¥å£ { // å¼å§æ¶é´åæ¯è¾å°çå¼å§æ¶é´ historyStartDate := ifexpr( macroPlan.StartOfPlanning().Date() <= localColumn.CustomDate(), macroPlan.StartOfPlanning().Date(), localColumn.CustomDate() ); // ç»ææ¶é´åæ¯è¾å¤§çå¼å§æ¶é´ï¼å¦æå计åå¼å§æ¶é´å¤äºåä¸ä¸ªæä»½ï¼åå计åå¼å§æ¶é´ï¼å¦ååæåºæ¶é´ historyEndDate := ifexpr( macroPlan.StartOfPlanning().Date() > localColumn.CustomDate().StartOfNextMonth() and macroPlan.StartOfPlanning().Date().Month() = localColumn.CustomDate().Month() and macroPlan.StartOfPlanning().Date().Year() = localColumn.CustomDate().Year() ,macroPlan.StartOfPlanning().Date(), localColumn.CustomDate().StartOfNextMonth() ); { actualOut := sum( archive,ActualDailyProductionData,data,data.Fac() +" "+ data.LineName() = row.CustomName() and data.ProductionDate() >= historyStartDate and data.ProductionDate() < historyEndDate,data.ActualOut() ); output := output + actualOut; } } localCell := null( LocalCell_ScheduleSummary ); { localCellHandle := localCellIndexTree.GetHandle( row.UnitID() + localColumn.CustomDate().AsQUILL() ); localCellHandle := localCellIndexTree.GetHandle( row.CustomName() + localColumn.CustomDate().AsQUILL() ); localCellIndex := guard( localCellIndexTree.Root().Child( localCellHandle ),null( NamedValue )); if( isnull( localCellIndex )){ localCell := localRow.LocalCell( relnew,LocalCell_ScheduleSummary,LocalColumn := localColumn ); @@ -272,9 +219,9 @@ } localCell.ShiftPattern( selectuniquevalues( shiftPatterns,Elements,element,element ).Concatenate( "/" ) ); localCell.WorkingDay( localCell.WorkingDay() + workingDay ); localCell.Capacity( localCell.Capacity() + capacity ); localCell.Output( localCell.Output() + output ); } } @@ -292,19 +239,19 @@ scheduleSummaryOutputDataIndex := guard( scheduleSummaryOutputDataIndexTree.Root().Child( scheduleSummaryOutputDataHandle ),null( NamedValue )); if( not isnull( scheduleSummaryOutputDataIndex )){ scheduleSummaryOutputData := scheduleSummaryOutputDatas.Element( scheduleSummaryOutputDataIndex.GetValueAsNumber() ); if( scheduleSummaryOutputData.Output() <> -1 ){ if( scheduleSummaryOutputData.Output() <> 0 ){ output := scheduleSummaryOutputData.Output(); cell.Output( output ); } if( scheduleSummaryOutputData.WorkingDay() <> -1 ){ if( scheduleSummaryOutputData.WorkingDay() <> 0 ){ workingDay := scheduleSummaryOutputData.WorkingDay(); cell.WorkingDay( workingDay ); } if( scheduleSummaryOutputData.Capacity() <> -1 ){ if( scheduleSummaryOutputData.Capacity() <> 0 ){ capacity := scheduleSummaryOutputData.Capacity(); cell.Capacity( capacity ); } if( scheduleSummaryOutputData.ShiftPattern() <> "-1"){ if( scheduleSummaryOutputData.ShiftPattern() <> "0"){ shiftPattern := scheduleSummaryOutputData.ShiftPattern(); cell.ShiftPattern( shiftPattern ); } _Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateHistoryTempTable.qbl
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,105 @@ Quintiq file version 2.0 #parent: #root StaticMethod CreateHistoryTempTable ( const Archive archive, RecycleBin recycleBin, const MacroPlan macroPlan ) as LocalTable { TextBody: [* // rislai Aug-6-2024 (created) table := recycleBin.LocalTable( relnew,Name := ArchiveCell_ScheduleSummary::GetTableName()); // è·åå¼å§æ¶é´åç»ææ¶é´ startDate := Date::Construct( Date::ActualDate().Year() - 1, 6, 1 ); { minActualDailyProductionDataDate := guard( minselect( archive,ActualDailyProductionData,data,data.ProductionDate() ).ProductionDate(),Date::MaxDate() ); minArchiveShiftPlanDate := guard( minselect( archive,ArchiveShiftPlanColumn,data,data.StartDate()).StartDate(),Date::MaxDate() ); if( minActualDailyProductionDataDate <> Date::MaxDate() or minArchiveShiftPlanDate <> Date::MaxDate() ){ if( minArchiveShiftPlanDate > minActualDailyProductionDataDate ){ startDate := minActualDailyProductionDataDate; }else { startDate := minArchiveShiftPlanDate; } } } endDate := macroPlan.StartOfPlanning().Date(); // è·åå®é çäº§æ°æ® actualDailyProductionDataIndexTree := NamedValueTree::Create(); actualDailyProductionDatas := selectset( archive,ActualDailyProductionData,data, data.ProductionDate() <= endDate ); // exists( tables,Elements.ArchiveRow,row,row.CustomName() = data.LineName() )); // æå»ºå®é çäº§æ°æ®ç´¢å¼ for( i :=0;i < actualDailyProductionDatas.Size();i++ ){ actualDailyProductionData := actualDailyProductionDatas.Element( i ); actualDailyProductionDataKey := actualDailyProductionData.LineName() + actualDailyProductionData.ProductionDate().AsQUILL(); actualDailyProductionDataHandle := actualDailyProductionDataIndexTree.GetHandle( actualDailyProductionDataKey ); actualDailyProductionDataIndexTree.Root().AddChild( actualDailyProductionDataHandle,i ); } // unitçç´¢å¼ units := selectset( macroPlan,Unit,unit,unit.HasCapacityTypeTime() and not unit.HasChild()); unitIndexTree := NamedValueTree::Create(); for( i := 0 ; i< units.Size() ; i++ ){ unit := units.Element( i ); unitHandle := unitIndexTree.GetHandle( unit.ID() ); unitIndexTree.Root().AddChild( unitHandle,i ); } columns := construct( LocalColumns ); columnIndexTree := NamedValueTree::Create(); for( i := startDate;i < endDate; i := i + 1){ column := table.LocalColumn( relnew,CustomDate := i ); columnHandle := columnIndexTree.GetHandle( i.AsQUILL() ); columns.Add( column ); columnIndexTree.Root().AddChild( columnHandle,columns.Size() - 1 ); } // è¿å»ççæ¬ï¼ç次ï¼å·¥ä½æ¥ååæ¡£ArchiveShiftPlanï¼äº§åºåActualDailyProductionData,产è½åçæ¬¡æ¶é´*å½åçæ¬çèæ traverse( archive,ArchiveShiftPlanRow,archiveShiftPlanRow ){ // unit.AsEntity().DisplayNameForSelection() row := table.LocalRow( relnew,CustomName := archiveShiftPlanRow.UnitID(),Index := table.GetRowIndexCache() ); unit := constnull( Unit ); { unitHandle := unitIndexTree.GetHandle( row.CustomName() ); unitIndex := guard( unitIndexTree.Root().Child( unitHandle ),null( NamedValue )); if( not isnull( unitIndex )){ unit := units.Element( unitIndex.GetValueAsNumber() ); } } throughput := guard( sum( unit,Operation,operation,operation.Throughput() ) / unit.Operation( relsize ) , 0 ); archiveShiftPlanCells := selectset( archiveShiftPlanRow,ArchiveShiftPlanCell,cell, cell.ArchiveShiftPlanColumn().StartDate() >= startDate and cell.ArchiveShiftPlanColumn().StartDate() < endDate ); traverse( archiveShiftPlanCells,Elements,archiveShiftPlanCell ){ columnHandle := columnIndexTree.GetHandle( archiveShiftPlanCell.ArchiveShiftPlanColumn().StartDate().AsQUILL() ); columnIndex := guard( columnIndexTree.Root().Child( columnHandle ),null( NamedValue )); if( not isnull( columnIndex )){ workDay := ifexpr( archiveShiftPlanCell.Outcome() <> "",1,0 ); column := columns.Element( columnIndex.GetValueAsNumber() ); capacity := 0.0; capacity := ShiftPlan::GetWorkHoursByShiftPatternName( archiveShiftPlanCell.Outcome() ) * throughput //* workHours.Capacity().HoursAsReal() row.LocalCell( relnew,LocalCell_ScheduleSummary,LocalColumn := column, ShiftPattern := archiveShiftPlanCell.Outcome(), WorkingDay := workDay, Capacity := capacity, Output := 0 ); } } } traverse( table,LocalColumn,column,column.LocalCell( relsize ) = 0 ){ column.Delete(); } return table; *] } _Main/BL/Type_ShiftPlan/StaticMethod_GetWorkHoursByShiftPatternName.qbl
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,31 @@ Quintiq file version 2.0 #parent: #root StaticMethod GetWorkHoursByShiftPatternName ( String shiftPatternName ) const declarative as Real { TextBody: [* // Akari Sep-6-2024 (created) result := 0.0; if( shiftPatternName = "1" ){ result := 8.0; }else if( shiftPatternName = "2" ){ result := 16.0; }else if(shiftPatternName = "9+9"){ result := 18.0; }else if(shiftPatternName = "10+10"){ result := 20.0; }else if(shiftPatternName = "11+11"){ result := 22.0; }else if(shiftPatternName = "1(9)" or shiftPatternName = "1ï¼9ï¼"){ result := 9.0; }else if(shiftPatternName = "1(10)" or shiftPatternName = "1ï¼10ï¼"){ result := 10.0; }else if(shiftPatternName = "3"){ result := 22.5; } return result; *] }