xiaoding721
2024-11-22 8efa02c57ec252109a3d8bd9e72482ae353816ab
_Main/BL/Type_DispatchShiftPlan/StaticMethod_Dispatch.qbl
@@ -2,7 +2,7 @@
#parent: #root
StaticMethod Dispatch (
  InterfaceDataset interfaceDataset,
  const MacroPlan macroPlan,
  const Archive archive,
  String executor
)
{
@@ -36,31 +36,29 @@
    }
    
    now := DateTime::Now();
    macroPlanName := macroPlan.MDSMacroPlan().Description();
    traverse( macroPlan,Unit.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan,shiftPlan ,shiftPlan.UnitPeriodTime().Period_MP().StartDate() >= macroPlan.StartOfPlanning().Date()){
       factory := LocalTool::GetFactoryByUnit( shiftPlan.UnitPeriodTime().Unit() );
    traverse( archive,ArchiveShiftPlanRow.ArchiveShiftPlanCell,archiveShiftPlan ){
       factoryName := archiveShiftPlan.ArchiveShiftPlanRow().FactoryName();
       
       productLine :=  shiftPlan.UnitPeriodTime().Unit().ID();
       shiftDate := shiftPlan.UnitPeriodTime().Period_MP().StartDate();
       factoryName := factory.ID();
       productLine :=  archiveShiftPlan.ArchiveShiftPlanRow().UnitID();
       shiftDate := archiveShiftPlan.ArchiveShiftPlanColumn().StartDate();
       
       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.Tips( archiveShiftPlan.Remark() );
         dispatchShiftPlan.VersionName( archiveShiftPlan.MacroPlanName() );
         dispatchShiftPlan.InterfaceTime( now );
       }else{
         if( shiftPlan.Outcome() <> "" ){
         if( archiveShiftPlan.Outcome() <> "" ){
           interfaceLoginfo.DispatchShiftPlan( relnew,ID := OS:: GenerateGUIDAsString(),
                                               ProductLine := productLine,
                                               FactoryName := factory.ID(),
                                               ShiftQty := shiftPlan.Outcome(),
                                               FactoryName := factoryName,
                                               ShiftQty := archiveShiftPlan.Outcome(),
                                  
                                               ShiftDate := shiftDate,
                                               Tips := shiftPlan.Remark(),
                                               VersionName := macroPlanName,
                                               Tips := archiveShiftPlan.Remark(),
                                               VersionName := archiveShiftPlan.MacroPlanName(),
                                               InterfaceTime := now );
         }
       }