From ed741bb79accbd1998c56fbe05c4c266ee965345 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期五, 11 十月 2024 17:27:19 +0800
Subject: [PATCH] 修复一些bug
---
/dev/null | 23 -----------
_Main/BL/Relations/Relation_DispatchShiftPlan_Archive_Archive_DispatchShiftPlan.qbl | 23 +++++++++++
_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl | 50 +++++++++++++++++-------
3 files changed, 58 insertions(+), 38 deletions(-)
diff --git a/_Main/BL/Relations/Relation_DispatchShiftPlan_Archive_Archive_DispatchShiftPlan.qbl b/_Main/BL/Relations/Relation_DispatchShiftPlan_Archive_Archive_DispatchShiftPlan.qbl
new file mode 100644
index 0000000..f45c374
--- /dev/null
+++ b/_Main/BL/Relations/Relation_DispatchShiftPlan_Archive_Archive_DispatchShiftPlan.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation DispatchShiftPlan_Archive_Archive_DispatchShiftPlan
+{
+ #keys: '1[414996.1.121982603]'
+ DefaultRelationStrategy
+ {
+ }
+ RelationSide.LeftSide Archive
+ {
+ #keys: '3[414996.1.121982605][414996.1.121982604][414996.1.121982606]'
+ Cardinality: '0to1'
+ ObjectDefinition: DispatchShiftPlan
+ OwningSide: 'Reference'
+ }
+ RelationSide.RightSide DispatchShiftPlan
+ {
+ #keys: '3[414996.1.121982608][414996.1.121982607][414996.1.121982609]'
+ Cardinality: '1toN'
+ ObjectDefinition: Archive
+ OwningSide: 'Owned'
+ }
+}
diff --git a/_Main/BL/Relations/Relation_DispatchShiftPlan_RecycleBin_RecycleBin_DispatchShiftPlan.qbl b/_Main/BL/Relations/Relation_DispatchShiftPlan_RecycleBin_RecycleBin_DispatchShiftPlan.qbl
deleted file mode 100644
index 37b7f50..0000000
--- a/_Main/BL/Relations/Relation_DispatchShiftPlan_RecycleBin_RecycleBin_DispatchShiftPlan.qbl
+++ /dev/null
@@ -1,23 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Relation DispatchShiftPlan_RecycleBin_RecycleBin_DispatchShiftPlan
-{
- #keys: '1[414996.1.17706936]'
- DefaultRelationStrategy
- {
- }
- RelationSide.LeftSide RecycleBin
- {
- #keys: '3[414996.1.17706938][414996.1.17706937][414996.1.17706939]'
- Cardinality: '0to1'
- ObjectDefinition: DispatchShiftPlan
- OwningSide: 'Reference'
- }
- RelationSide.RightSide DispatchShiftPlan
- {
- #keys: '3[414996.1.17706941][414996.1.17706940][414996.1.17706942]'
- Cardinality: '1toN'
- ObjectDefinition: RecycleBin
- OwningSide: 'Owned'
- }
-}
diff --git a/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl b/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
index 35bca5a..5d69146 100644
--- a/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
+++ b/_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
@@ -2,19 +2,27 @@
#parent: #root
StaticMethod Dispatch (
const MacroPlan macroPlan,
- RecycleBin owner,
+ Archive owner,
String versionFlag
)
{
TextBody:
[*
// Akari Aug-21-2024 (created)
- owner.DispatchShiftPlan( relflush );
+ // owner.DispatchShiftPlan( relflush );
// owner.RB_DispatchShiftPlanBroker().Source().FlatQuery( "truncate table A_DispatchShiftPlan" );
+
+ dispatchShiftPlans := selectset( owner,DispatchShiftPlan,dispatchShiftPlan,true );
+ dispatchShiftPlanIndexTree := NamedValueTree::Create();
+ for( i := 0 ; i < dispatchShiftPlans.Size() ; i++){
+ dispatchShiftPlan := dispatchShiftPlans.Element( i );
+ dispatchShiftPlanHandle := dispatchShiftPlanIndexTree.GetHandle( dispatchShiftPlan.FactoryName() + dispatchShiftPlan.ProductLine() + dispatchShiftPlan.ShiftDate().AsQUILL() );
+ dispatchShiftPlanIndexTree.Root().AddChild( dispatchShiftPlanHandle,i );
+ }
now := DateTime::Now();
macroPlanName := macroPlan.MDSMacroPlan().Description();
- traverse( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan,shiftPlan ){
+ traverse( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan,shiftPlan ,shiftPlan.UnitPeriodTime().Period_MP().StartDate() >= macroPlan.StartOfPlanning().Date()){
factory := shiftPlan.UnitPeriodTime().Unit();
while( factory.HasParent() ){
temp1 := factory;
@@ -23,19 +31,31 @@
factory := temp1;
}
}
-
- owner.DispatchShiftPlan( relnew,ID := OS:: GenerateGUIDAsString(),
- ProductLine := shiftPlan.UnitPeriodTime().Unit().ID(),
- ShiftDate := shiftPlan.UnitPeriodTime().Period_MP().StartDate(),
- Tips := shiftPlan.Remark(),
- VersionName := macroPlanName,
- VersionFlag := versionFlag,
- FactoryName := factory.ID(),
- InterfaceTime := now
- );
-
+ productLine := shiftPlan.UnitPeriodTime().Unit().ID();
+ shiftDate := shiftPlan.UnitPeriodTime().Period_MP().StartDate();
+ factoryName := factory.ID();
+
+ dispatchShiftPlanHandle := dispatchShiftPlanIndexTree.GetHandle( factoryName + productLine + shiftDate.AsQUILL() );
+ dispatchShiftPlanIndex := guard( dispatchShiftPlanIndexTree.Root().Child( dispatchShiftPlanHandle ),null( NamedValue ));
+ if( not isnull( dispatchShiftPlanIndex )){
+ dispatchShiftPlan := dispatchShiftPlans.Element( dispatchShiftPlanIndex.GetValueAsNumber() );
+ dispatchShiftPlan.Tips( shiftPlan.Remark() );
+ dispatchShiftPlan.VersionName( macroPlanName );
+ dispatchShiftPlan.VersionFlag( versionFlag );
+ dispatchShiftPlan.InterfaceTime( now );
+ }else{
+ owner.DispatchShiftPlan( relnew,ID := OS:: GenerateGUIDAsString(),
+ ProductLine := productLine,
+ FactoryName := factory.ID(),
+
+ ShiftDate := shiftDate,
+ Tips := shiftPlan.Remark(),
+ VersionName := macroPlanName,
+ VersionFlag := versionFlag,
+ InterfaceTime := now );
+ }
}
- owner.RB_DispatchShiftPlanBroker().AsyncExecute();
+ // owner.RB_DispatchShiftPlanBroker().AsyncExecute();
*]
}
--
Gitblit v1.9.3