From 925024a1ed984f8eea5a0db4c7f69e070bd8618c Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期四, 10 十月 2024 15:43:43 +0800
Subject: [PATCH] 添加批量维护班次信息功能
---
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight.def | 164 ++++++++++++++++----------
_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl | 43 +++++++
_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelRight_bApply_OnClick.def | 39 ++++++
_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl | 3
_Main/BL/Type_LocalTool/StaticMethod_SetUnitShiftPattern.qbl | 70 +++++++++++
5 files changed, 254 insertions(+), 65 deletions(-)
diff --git a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl
index da1f73a..1de3a99 100644
--- a/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl
+++ b/_Main/BL/Type_DispatchShiftSchedulingInformation/StaticMethod_SplitShifts.qbl
@@ -22,6 +22,9 @@
shiftSchedulingInformation3 := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume / 3 );
shiftSchedulingInformation3.SingleShiftName( "3鐝�" );
shiftSchedulingInformations.Add( shiftSchedulingInformation3 );
+ }else{
+ shiftSchedulingInformation := owner.DispatchShiftSchedulingInformation( relnew ,ID := IDHolder::GetGUID(),ShiftName := shiftName,ShiftVolume := shiftVolume );
+ shiftSchedulingInformations.Add( shiftSchedulingInformation );
}
diff --git a/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl b/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl
new file mode 100644
index 0000000..c4d476f
--- /dev/null
+++ b/_Main/BL/Type_LocalTool/StaticMethod_BatchSetUnitShiftPattern.qbl
@@ -0,0 +1,43 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod BatchSetUnitShiftPattern (
+ Unit unit,
+ ShiftPattern shiftPattern,
+ Date startDate,
+ Date endDate,
+ Numbers weekdays
+)
+{
+ TextBody:
+ [*
+ // Akari Oct-10-2024 (created)
+ owner := unit.MacroPlan();
+ dayPeriod_MPs := selectsortedset( owner,Period_MP,period_MP,
+ period_MP.TimeUnit() = 'Day' and
+ period_MP.StartDate() >= startDate and
+ period_MP.EndDate() <= endDate and exists( weekdays, Elements,dayOfWeek,dayOfWeek = period_MP.StartDate().DayOfWeek() ) ,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( weekdays, Elements,dayOfWeek,dayOfWeek = period_MP.StartDate().DayOfWeek() ),period_MP.StartDate());
+ traverse( dayPeriod_MPs ,Elements,element ){
+ info( element.StartDate().DayOfWeek() );
+ }
+
+ if( dayPeriod_MPs.Size() > 0 ){
+ unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,exists( dayPeriod_MPs,Elements,period_MP,period_MP = unitPeriodTime.Period_MP()) and not isnull( unitPeriodTime.UnitAvailability()));
+ if( unitPeriodTimes.Size() > 0 ){
+ LocalTool::SetUnitShiftPattern( owner,unitPeriodTimes,shiftPattern );
+ }
+
+ }
+ if( weekPeriod_MPs.Size() <> 0 ){
+ traverse( weekPeriod_MPs,Elements,period_MP ){
+ unitPeriodTimes := selectset( unit,UnitPeriod.astype( UnitPeriodTime ),unitPeriodTime,period_MP = unitPeriodTime.Period_MP() and not isnull( unitPeriodTime.UnitAvailability()));
+ if( unitPeriodTimes.Size() > 0 ){
+ LocalTool::SetUnitShiftPattern( owner,unitPeriodTimes,shiftPattern );
+ }
+ }
+ }
+ *]
+}
diff --git a/_Main/BL/Type_LocalTool/StaticMethod_SetUnitShiftPattern.qbl b/_Main/BL/Type_LocalTool/StaticMethod_SetUnitShiftPattern.qbl
new file mode 100644
index 0000000..92b0e44
--- /dev/null
+++ b/_Main/BL/Type_LocalTool/StaticMethod_SetUnitShiftPattern.qbl
@@ -0,0 +1,70 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SetUnitShiftPattern (
+ MacroPlan macroPlan,
+ UnitPeriodTimes unitPeriodTimes,
+ ShiftPattern shiftPattern
+)
+{
+ TextBody:
+ [*
+ // Akari Oct-10-2024 (created)
+ firstElement := minselect( unitPeriodTimes, Elements, e, true, e.Start() );
+
+ start := macroPlan.Start();
+ timeunit := macroPlan.StartOfPlanningPeriod().TimeUnit();
+ maintenance := Duration::Zero();
+ efficiency := 1.0;
+ allocation := 1.0;
+
+ maxloadpercentage := macroPlan.GlobalParameters_MP().DefaultMaxLoadPercentage();
+ nrofunitopen := 1;
+ minloadthreshold := 0.0;
+
+ if( not isnull( firstElement ) ){
+ // To inherit the value from last unit availability while creating a new unit availability
+ unitavailability := firstElement.UnitAvailability();
+ start := firstElement.Start();
+
+ if( not isnull( unitavailability ) ){
+ timeunit := unitavailability.TimeUnit();
+ maintenance := unitavailability.Maintenance();
+ efficiency := unitavailability.Efficiency();
+ allocation := unitavailability.Allocation();
+
+ maxloadpercentage := unitavailability.MaximumLoadPercentage();
+ nrofunitopen := unitavailability.NrOfUnitsOpen();
+ minloadthreshold := unitavailability.MinimumLoadThreshold();
+ }else{
+ timeunit := firstElement.Period_MP().TimeUnit();
+ maintenance := firstElement.Maintenance();
+ efficiency := firstElement.Efficiency();
+ allocation := firstElement.Allocation();
+
+ maxloadpercentage := firstElement.MaximumLoadPercentage();
+ nrofunitopen := firstElement.NrOfOpen();
+ minloadthreshold := firstElement.MinimumLoadThreshold();
+ }
+ }
+
+ isbatchedit := unitPeriodTimes.Size() > 1;
+ UnitAvailability::CreateOrUpdateForUnitPeriodTimes( unitPeriodTimes,
+ not isbatchedit or false,
+ timeunit,
+ maintenance,
+ not isbatchedit or false,
+ efficiency,
+ false,
+ allocation,
+ not isbatchedit or true,
+ shiftPattern,
+ not isbatchedit or false,
+ maxloadpercentage,
+ not isbatchedit or false,
+ nrofunitopen,
+ false,
+ not isbatchedit or false,
+ minloadthreshold
+ );
+ *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight.def b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight.def
index 8538493..3731f86 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Component_PanelRight.def
@@ -5,69 +5,6 @@
BaseType: 'WebPanel'
Children:
[
- Component cbMonday
- {
- #keys: '[414996.1.116589495]'
- BaseType: 'WebCheckbox'
- Properties:
- [
- Taborder: 3
- ]
- }
- Component cbTuesday
- {
- #keys: '[414996.1.116589517]'
- BaseType: 'WebCheckbox'
- Properties:
- [
- Taborder: 4
- ]
- }
- Component cbWednesday
- {
- #keys: '[414996.1.116589519]'
- BaseType: 'WebCheckbox'
- Properties:
- [
- Taborder: 5
- ]
- }
- Component cbThursday
- {
- #keys: '[414996.1.116589521]'
- BaseType: 'WebCheckbox'
- Properties:
- [
- Taborder: 6
- ]
- }
- Component cbFriday
- {
- #keys: '[414996.1.116589523]'
- BaseType: 'WebCheckbox'
- Properties:
- [
- Taborder: 7
- ]
- }
- Component cbSaturday
- {
- #keys: '[414996.1.116589525]'
- BaseType: 'WebCheckbox'
- Properties:
- [
- Taborder: 8
- ]
- }
- Component cbSunday
- {
- #keys: '[414996.1.116589527]'
- BaseType: 'WebCheckbox'
- Properties:
- [
- Taborder: 9
- ]
- }
Component dsStartDate
{
#keys: '[414996.1.116589712]'
@@ -75,7 +12,7 @@
Properties:
[
Label: 'Start'
- Taborder: 1
+ Taborder: 2
]
}
Component dsEndDate
@@ -85,7 +22,7 @@
Properties:
[
Label: 'End'
- Taborder: 2
+ Taborder: 3
]
}
Component LabelSelectUnit
@@ -105,6 +42,103 @@
Properties:
[
Label: 'Apply'
+ Taborder: 11
+ ]
+ }
+ Component ddlShiftPattern
+ {
+ #keys: '[414996.1.116430349]'
+ BaseType: 'WebDropDownList'
+ Databinding: 'ShiftPattern'
+ Children:
+ [
+ Component deContent710 id:deContent710_593
+ {
+ #keys: '[414996.1.116430350]'
+ BaseType: 'WebDataExtractor'
+ Properties:
+ [
+ DataType: 'MacroPlan'
+ Source: 'MacroPlan'
+ Taborder: 0
+ Transformation: 'ShiftPattern'
+ ]
+ }
+ ]
+ Properties:
+ [
+ DisplayField: 'Name'
+ Label: 'Shift pattern 1'
+ Taborder: 1
+ ]
+ }
+ Component cbMonday
+ {
+ #keys: '[414996.1.117120493]'
+ BaseType: 'WebCheckbox'
+ Properties:
+ [
+ Label: 'Monday'
+ Taborder: 4
+ ]
+ }
+ Component cbTuesday
+ {
+ #keys: '[414996.1.117120516]'
+ BaseType: 'WebCheckbox'
+ Properties:
+ [
+ Label: 'Tuesday'
+ Taborder: 5
+ ]
+ }
+ Component cbWednesday
+ {
+ #keys: '[414996.1.117120539]'
+ BaseType: 'WebCheckbox'
+ Properties:
+ [
+ Label: 'Wednesday'
+ Taborder: 6
+ ]
+ }
+ Component cbThursday
+ {
+ #keys: '[414996.1.117120576]'
+ BaseType: 'WebCheckbox'
+ Properties:
+ [
+ Label: 'Thursday'
+ Taborder: 7
+ ]
+ }
+ Component cbFriday
+ {
+ #keys: '[414996.1.117120599]'
+ BaseType: 'WebCheckbox'
+ Properties:
+ [
+ Label: 'Friday'
+ Taborder: 8
+ ]
+ }
+ Component cbSaturday id:cbSaturday_682
+ {
+ #keys: '[414996.1.117120636]'
+ BaseType: 'WebCheckbox'
+ Properties:
+ [
+ Label: 'Saturday'
+ Taborder: 9
+ ]
+ }
+ Component cbSunday
+ {
+ #keys: '[414996.1.117120659]'
+ BaseType: 'WebCheckbox'
+ Properties:
+ [
+ Label: 'Sunday'
Taborder: 10
]
}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelRight_bApply_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelRight_bApply_OnClick.def
new file mode 100644
index 0000000..1a2c721
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormProductionLineBatchSetShiftPattern/Response_PanelRight_bApply_OnClick.def
@@ -0,0 +1,39 @@
+Quintiq file version 2.0
+#parent: PanelRight/bApply
+Response OnClick () id:Response_PanelRight_bApply_OnClick
+{
+ #keys: '[414996.1.117189721]'
+ CanBindMultiple: false
+ DefinitionID: 'Responsedef_WebButton_OnClick'
+ GroupServerCalls: true
+ QuillAction
+ {
+ Body:
+ [*
+ weekdays := construct( Numbers );
+ if( cbMonday.Checked() ){
+ weekdays.Add( 1 );
+ }
+ if( cbTuesday.Checked() ){
+ weekdays.Add( 2 );
+ }
+ if( cbWednesday.Checked() ){
+ weekdays.Add( 3 );
+ }
+ if( cbThursday.Checked() ){
+ weekdays.Add( 4 );
+ }
+ if( cbFriday.Checked() ){
+ weekdays.Add( 5 );
+ }
+ if( cbSaturday.Checked() ){
+ weekdays.Add( 6 );
+ }
+ if( cbSunday.Checked() ){
+ weekdays.Add( 7 );
+ }
+ LocalTool::BatchSetUnitShiftPattern( dhSelectUnit.Data(),ddlShiftPattern.Data(),dsStartDate.Date(),dsEndDate.Date(),weekdays );
+ WebMessageBox::Success( "Success");
+ *]
+ }
+}
--
Gitblit v1.9.3