xiaoding721
2024-10-11 ed741bb79accbd1998c56fbe05c4c266ee965345
修复一些bug
已添加1个文件
已修改1个文件
已删除1个文件
96 ■■■■■ 文件已修改
_Main/BL/Relations/Relation_DispatchShiftPlan_Archive_Archive_DispatchShiftPlan.qbl 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Relations/Relation_DispatchShiftPlan_RecycleBin_RecycleBin_DispatchShiftPlan.qbl 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_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'
  }
}
_Main/BL/Relations/Relation_DispatchShiftPlan_RecycleBin_RecycleBin_DispatchShiftPlan.qbl
文件已删除
_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();
  *]
}