From cbf2cc895f1d1e7dcf522a462e77709d92667747 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 11 十月 2024 18:10:13 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev-zlg
---
_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl | 50 +++++++++++++++++++++++++++++++++++---------------
1 files changed, 35 insertions(+), 15 deletions(-)
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