Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Dispatch (
|
InterfaceDataset interfaceDataset,
|
const Archive archive,
|
String executor
|
)
|
{
|
TextBody:
|
[*
|
// Akari Aug-21-2024 (created)
|
now := DateTime::Now();
|
|
interfaceLoginfo := maxselect( interfaceDataset,InterfaceLoginfo,loginfo,loginfo.Name() = Translations::InterfaceDataset_ShiftPlanPPPSPush_Name() ,loginfo.InterfaceDateTime() );
|
if( not isnull( interfaceLoginfo )){
|
if( not interfaceLoginfo.IsShow() ){
|
interfaceLoginfo.Delete();
|
}else{
|
interfaceLoginfo.Last( false );
|
}
|
}
|
|
interfaceLoginfo := interfaceDataset.InterfaceLoginfo( relnew,
|
ExecuteUser := executor,
|
Name := Translations::InterfaceDataset_ShiftPlanPPPSPush_Name(),
|
InterfaceDateTime := now,
|
Last := true,
|
Message := '班次计划(PPA+IDS)数据推送' );
|
|
dispatchShiftPlans := selectset( interfaceLoginfo,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();
|
traverse( archive,ArchiveShiftPlanRow.ArchiveShiftPlanCell,archiveShiftPlan ){
|
factoryName := archiveShiftPlan.ArchiveShiftPlanRow().FactoryName();
|
|
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( archiveShiftPlan.Remark() );
|
dispatchShiftPlan.VersionName( archiveShiftPlan.MacroPlanName() );
|
dispatchShiftPlan.InterfaceTime( now );
|
}else{
|
if( archiveShiftPlan.Outcome() <> "" ){
|
dispatchShiftPlan := interfaceLoginfo.DispatchShiftPlan( relnew,ID := OS:: GenerateGUIDAsString(),
|
ProductLine := productLine,
|
FactoryName := factoryName,
|
ShiftQty := archiveShiftPlan.Outcome(),
|
|
ShiftDate := shiftDate,
|
Tips := archiveShiftPlan.Remark(),
|
VersionName := archiveShiftPlan.MacroPlanName(),
|
InterfaceTime := now );
|
dispatchShiftPlan.CalcFac();
|
}
|
}
|
}
|
DispatchShiftPlan::Publish( interfaceLoginfo );
|
*]
|
}
|