From 922e32f3483318a2f733b8a3d9074264d6bd3613 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期三, 11 十二月 2024 16:29:10 +0800
Subject: [PATCH] 修复一些bug
---
_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl | 129 +++++++------------------
_Main/BL/Type_DispatchShiftProductionInformation/Attribute_OrderNumber.qbl | 7 +
_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl | 22 +++-
_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateHistoryTempTable.qbl | 105 +++++++++++++++++++++
_Main/BL/Type_ShiftPlan/StaticMethod_GetWorkHoursByShiftPatternName.qbl | 31 ++++++
5 files changed, 196 insertions(+), 98 deletions(-)
diff --git a/_Main/BL/Type_DispatchShiftProductionInformation/Attribute_OrderNumber.qbl b/_Main/BL/Type_DispatchShiftProductionInformation/Attribute_OrderNumber.qbl
new file mode 100644
index 0000000..0f3a203
--- /dev/null
+++ b/_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
+}
diff --git a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
index 7c0d781..e64130f 100644
--- a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_GenerateDispatchData.qbl
+++ b/_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{
- product.DispatchShiftSchedulingDetail( relnew,ShiftVolume := 0 ,SingleShiftName := "涓夌彮");
+ 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){
diff --git a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
index 1bb5094..e99f055 100644
--- a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
@@ -85,66 +85,8 @@
unitIndexTree.Root().AddChild( unitHandle,i );
}
- //// 寮�濮嬫嫾鎺ュ瓨妗f暟鎹�
- //traverse( tables,Elements.ArchiveRow,row ){
- // // 鍏堝鎵緇ocalRow锛屾壘涓嶅埌灏辨柊寤猴紝骞跺垱寤虹储寮�
- // 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 );
}
diff --git a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateHistoryTempTable.qbl b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateHistoryTempTable.qbl
new file mode 100644
index 0000000..3f11939
--- /dev/null
+++ b/_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 );
+ }
+
+ // 杩囧幓鐨勭増鏈紝鐝锛屽伐浣滄棩鍙栧瓨妗rchiveShiftPlan锛屼骇鍑哄彇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;
+ *]
+}
diff --git a/_Main/BL/Type_ShiftPlan/StaticMethod_GetWorkHoursByShiftPatternName.qbl b/_Main/BL/Type_ShiftPlan/StaticMethod_GetWorkHoursByShiftPatternName.qbl
new file mode 100644
index 0000000..1a71cfe
--- /dev/null
+++ b/_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;
+ *]
+}
--
Gitblit v1.9.3