| | |
| | | #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; |
| | |
| | | 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(); |
| | | *] |
| | | } |