From b6e0c9175e15545fbe890611d3b6ce71a3fc916d Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期一, 09 十二月 2024 00:08:40 +0800
Subject: [PATCH] 修复一些bug,优化计划汇总报表
---
_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl | 9 -
_Main/BL/Type_LocalTool/StaticMethod_GetYYYYMM.qbl | 23 ++++
_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl | 66 +++++++++++++
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly.def | 25 +++++
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight445.def | 1
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelMonthly_bApply902_OnClick.def | 19 +++
_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPatternByMonth#139.qbl | 60 ++++++++++++
_Main/BL/Type_Test/StaticMethod_Test.qbl | 7 +
_Main/BL/Type_LocalTool/StaticMethod_AddMonthByYYYYMM.qbl | 40 ++++++++
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly743.def | 36 +++++++
10 files changed, 275 insertions(+), 11 deletions(-)
diff --git a/_Main/BL/Type_LocalTool/StaticMethod_AddMonthByYYYYMM.qbl b/_Main/BL/Type_LocalTool/StaticMethod_AddMonthByYYYYMM.qbl
new file mode 100644
index 0000000..a246691
--- /dev/null
+++ b/_Main/BL/Type_LocalTool/StaticMethod_AddMonthByYYYYMM.qbl
@@ -0,0 +1,40 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod AddMonthByYYYYMM (
+ Number data,
+ Number addMonthNumber
+) as Number
+{
+ TextBody:
+ [*
+ // Akari Dec-6-2024 (created)
+ stringData := [String]data;
+ if( stringData.Length() <> 6 ){
+ error( "wrong date: " + [String]data );
+ }
+ year := [Number]stringData.SubString( 0,4 );
+ month := [Number]stringData.SubString( 4,2 );
+
+ while( addMonthNumber >= 12 ){
+ addMonthNumber := addMonthNumber - 12;
+ year := year + 1;
+ }
+
+ if( month + addMonthNumber > 12 ){
+ year := year + 1;
+ month := month + addMonthNumber - 12;
+ }else{
+ month := month + addMonthNumber;
+ }
+
+ result := [String]year;
+
+ if( month < 10 ){
+ result := result + "0" + [String]month;
+ }else{
+ result := result + [String]month;
+ }
+
+ return [Number]result;
+ *]
+}
diff --git a/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl b/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl
index 31bd0a7..285f0da 100644
--- a/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl
+++ b/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl
@@ -25,17 +25,8 @@
i := flag;
flag := i.StartOfNextWeek();
temp--;
-
- info( i.Format( "Y-M2-D2") );
- info( flag.Format( "Y-M2-D2") );
}
}
- }
-
- info( "----------------------------");
-
- traverse( saveDays,Elements,element ){
- info( element.Format( "Y-M2-D2"));
}
dayPeriod_MPs := selectsortedset( owner,Period_MP,period_MP,
diff --git "a/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPatternByMonth\043139.qbl" "b/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPatternByMonth\043139.qbl"
new file mode 100644
index 0000000..06d2ae4
--- /dev/null
+++ "b/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPatternByMonth\043139.qbl"
@@ -0,0 +1,60 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod BatchSetUnitShiftPatternByMonth (
+ Unit unit,
+ ShiftPattern shiftPattern,
+ Date startDate,
+ Date endDate,
+ Number skipMonth
+)
+{
+ TextBody:
+ [*
+ // Akari Oct-10-2024 (created)
+ owner := unit.MacroPlan();
+
+ saveMonths := construct( Numbers );
+
+ for( i := LocalTool::GetYYYYMM( startDate ); i < LocalTool::GetYYYYMM( endDate ) ; i := LocalTool::AddMonthByYYYYMM( i,skipMonth ) ){
+
+ saveMonths.Add( i );
+
+ }
+
+
+ dayPeriod_MPs := selectsortedset( owner,Period_MP,period_MP,
+ period_MP.TimeUnit() = 'Day' and
+ period_MP.StartDate() >= startDate and
+ period_MP.EndDate() <= endDate and exists( saveMonths, Elements,month,month = LocalTool::GetYYYYMM( period_MP.StartDate() )) ,period_MP.StartDate());
+ weekPeriod_MPs := selectsortedset( owner,Period_MP,period_MP,
+ period_MP.TimeUnit() = 'Week' and
+ period_MP.StartDate() >= startDate and
+ period_MP.EndDate() <= endDate and exists( saveMonths, Elements,month,month = LocalTool::GetYYYYMM( period_MP.StartDate() )) ,period_MP.StartDate());
+ monthPeriod_MPs := selectsortedset( owner,Period_MP,period_MP,
+ period_MP.TimeUnit() = 'Month' and
+ period_MP.StartDate() >= startDate and
+ period_MP.EndDate() <= endDate and exists( saveMonths, Elements,month,month = LocalTool::GetYYYYMM( period_MP.StartDate() )) ,period_MP.StartDate());
+
+
+
+ if( dayPeriod_MPs.Size() > 0 ){
+ unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,exists( dayPeriod_MPs,Elements,period_MP,period_MP = unitPeriodTime.Period_MP()));
+ if( unitPeriodTimes.Size() > 0 ){
+ info( unitPeriodTimes.Size() );
+ LocalTool::SetUnitShiftPattern( owner,unitPeriodTimes,shiftPattern );
+ }
+ }
+ if( weekPeriod_MPs.Size() <> 0 ){
+ unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,exists( weekPeriod_MPs,Elements,period_MP,period_MP = unitPeriodTime.Period_MP()));
+ if( unitPeriodTimes.Size() > 0 ){
+ LocalTool::SetUnitShiftPattern( owner,unitPeriodTimes,shiftPattern );
+ }
+ }
+ if( monthPeriod_MPs.Size() <> 0 ){
+ unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,exists( monthPeriod_MPs,Elements,period_MP,period_MP = unitPeriodTime.Period_MP()));
+ if( unitPeriodTimes.Size() > 0 ){
+ LocalTool::SetUnitShiftPattern( owner,unitPeriodTimes,shiftPattern );
+ }
+ }
+ *]
+}
diff --git a/_Main/BL/Type_LocalTool/StaticMethod_GetYYYYMM.qbl b/_Main/BL/Type_LocalTool/StaticMethod_GetYYYYMM.qbl
new file mode 100644
index 0000000..df6dd0c
--- /dev/null
+++ b/_Main/BL/Type_LocalTool/StaticMethod_GetYYYYMM.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetYYYYMM (
+ Date date
+) as Number
+{
+ TextBody:
+ [*
+ // Akari Dec-6-2024 (created)
+ year := date.Year();
+ month := date.Month();
+
+ result := [String]year;
+
+ if( month < 10 ){
+ result := result + "0" + [String]month;
+ }else{
+ result := result + [String]month;
+ }
+
+ return [Number]result;
+ *]
+}
diff --git a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
index daaba1f..1bb5094 100644
--- a/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
+++ b/_Main/BL/Type_MP_Cell_ScheduleSummary0/StaticMethod_CreateFullTable.qbl
@@ -43,7 +43,19 @@
localTable := recycleBin.LocalTable( relnew,Name := ArchiveCell_ScheduleSummary::GetTableName() );
// 鑾峰彇寮�濮嬫椂闂村拰缁撴潫鏃堕棿
- startDate := minselect( archive,ActualDailyProductionData,data,data.ProductionDate() ).ProductionDate();
+ 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 := maxselect( macroPlan,Period_MP,period,period.EndDate() ).EndDate();
// 鏋勫缓LocalColumn鐨勭储寮�
@@ -172,7 +184,9 @@
// 璁″垝寮�濮嬩箣鍓嶇殑浜у嚭鍙栧疄闄呮瘡鏃ョ敓浜ф帴鍙�
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() );
@@ -210,7 +224,57 @@
localCell.WorkingDay( localCell.WorkingDay() + workingDay );
localCell.Capacity( localCell.Capacity() + capacity );
localCell.Output( localCell.Output() + output );
+ }
+ }
+
+ traverse( archive,ArchiveShiftPlanRow,row ){
+ localRow := null( LocalRow );
+ {
+ localRowHandle := localRowIndexTree.GetHandle( row.UnitID());
+ localRowIndex := guard( localRowIndexTree.Root().Child( localRowHandle ),null( NamedValue ));
+ if( isnull( localRowIndex )){
+ localRow := localTable.LocalRow( relnew,CustomName := row.UnitID(),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() );
+ workingDay := 0;
+ capacity := 0.0;
+ shiftPatterns := construct( Strings );
+
+ traverse( archiveCells,Elements,cell ){
+ // capacity := capacity + cell.Capacity();
+ if( cell.Outcome() <> "" ){
+ workingDay := workingDay + 1;
+ shiftPatterns.Add( cell.Outcome() );
+ }
+ }
+
+
+ localCell := null( LocalCell_ScheduleSummary );
+ {
+ localCellHandle := localCellIndexTree.GetHandle( row.UnitID() + 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() );
+ }
+ }
+
+ localCell.ShiftPattern( selectuniquevalues( shiftPatterns,Elements,element,element ).Concatenate( "/" ) );
+
+ localCell.WorkingDay( localCell.WorkingDay() + workingDay );
+ localCell.Capacity( localCell.Capacity() + capacity );
}
}
diff --git a/_Main/BL/Type_Test/StaticMethod_Test.qbl b/_Main/BL/Type_Test/StaticMethod_Test.qbl
index a114517..7518a65 100644
--- a/_Main/BL/Type_Test/StaticMethod_Test.qbl
+++ b/_Main/BL/Type_Test/StaticMethod_Test.qbl
@@ -9,5 +9,10 @@
InterfaceDataset interfaceDataset
)
{
- TextBody: '//archive.ActualDailyProductionData( relnew ,ActualOut := 100,Fac := "CC",LineName := "CC1",ProductionDate := Date::ActualDate(),ProductNo := "112233445566",ShiftCode := "3",ShiftName := "鐧界彮");'
+ TextBody:
+ [*
+ //archive.ActualDailyProductionData( relnew ,ActualOut := 100,Fac := "CC",LineName := "CC1",ProductionDate := Date::ActualDate(),ProductNo := "112233445566",ShiftCode := "3",ShiftName := "鐧界彮");
+
+ info( LocalTool::AddMonthByYYYYMM( 202401,25 ) )
+ *]
}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly.def b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly.def
new file mode 100644
index 0000000..c0efe40
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly.def
@@ -0,0 +1,25 @@
+Quintiq file version 2.0
+Component PanelMonthly
+{
+ #keys: '[414996.1.263421916]'
+ BaseType: 'WebPanel'
+ Children:
+ [
+ #child: PanelMonthly743
+ Component bApply902
+ {
+ #keys: '[414996.1.265980213]'
+ BaseType: 'WebButton'
+ Properties:
+ [
+ Label: 'Apply'
+ Taborder: 1
+ ]
+ }
+ ]
+ Properties:
+ [
+ Taborder: 2
+ Title: 'Monthly'
+ ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly743.def b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly743.def
new file mode 100644
index 0000000..c651816
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelMonthly743.def
@@ -0,0 +1,36 @@
+Quintiq file version 2.0
+Component PanelMonthly743
+{
+ #keys: '[414996.1.263422034]'
+ BaseType: 'WebPanel'
+ Children:
+ [
+ Component efMonthly
+ {
+ #keys: '[414996.1.263422035]'
+ BaseType: 'WebEditField'
+ Properties:
+ [
+ Label: 'Recur every '
+ Taborder: 0
+ Text: '1'
+ ]
+ }
+ Component LabelMonthly
+ {
+ #keys: '[414996.1.263422036]'
+ BaseType: 'WebLabel'
+ Properties:
+ [
+ Label: 'month(s)'
+ Taborder: 1
+ ]
+ }
+ ]
+ Properties:
+ [
+ FixedSize: true
+ Orientation: 'horizontal'
+ Taborder: 0
+ ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight445.def b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight445.def
index 12cb959..832f40e 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight445.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight445.def
@@ -7,6 +7,7 @@
[
#child: PanelDaily_478
#child: PanelWeekly_791
+ #child: PanelMonthly
]
Properties:
[
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelMonthly_bApply902_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelMonthly_bApply902_OnClick.def
new file mode 100644
index 0000000..ff15a7e
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelMonthly_bApply902_OnClick.def
@@ -0,0 +1,19 @@
+Quintiq file version 2.0
+#parent: PanelMonthly/bApply902
+Response OnClick () id:Response_PanelMonthly_bApply902_OnClick
+{
+ #keys: '[414996.1.265980212]'
+ CanBindMultiple: false
+ DefinitionID: 'Responsedef_WebButton_OnClick'
+ GroupServerCalls: true
+ QuillAction
+ {
+ Body:
+ [*
+
+ skipMonth := [Number]efMonthly.Text();
+ LocalTool::BatchSetUnitShiftPatternByMonth( dhSelectUnit.Data(),ddlShiftPattern.Data(),dsStartDate.Date(),dsEndDate.Date() ,skipMonth );
+ WebMessageBox::Success( "Success");
+ *]
+ }
+}
--
Gitblit v1.9.3