From 57deece540ff0a66d80403f4bbd85edac5ed35ed Mon Sep 17 00:00:00 2001 From: lihongji <3117313295@qq.com> Date: 星期二, 15 十月 2024 16:54:51 +0800 Subject: [PATCH] 上线计划优化 --- _Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl | 156 ++++++++++++++++++++++++++-------------------------- 1 files changed, 78 insertions(+), 78 deletions(-) diff --git a/_Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl b/_Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl index 1d69434..386e280 100644 --- a/_Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl +++ b/_Main/BL/Type_AssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl @@ -7,83 +7,83 @@ { TextBody: [* - macroPlan.AssemblyOnlinePlanRow( relflush ); - macroPlan.AssemblyOnlinePlanColumn( relflush ); - - // 鎵捐閰嶇嚎琛� - oprs := selectsortedset( opt, OfflinePlanRow, tempOPR, - tempOPR.ProductionLine() = "DL MoMo" - or - tempOPR.ProductionLine() = "CC MoMo" - or - tempOPR.ProductionLine() = "DL ZKM" - , - tempOPR.ProductionLine(), tempOPR.ProductID(), tempOPR.Type() ); - opcs := selectsortedset( opt, OfflinePlanColumn, tempOPC, true, tempOPC.ColumnDate() ); - - // 鐢熸垚琛ㄦ牸 - traverse ( opcs, Elements, opc ) { - aopc := macroPlan.AssemblyOnlinePlanColumn( relnew, ColumnDate := opc.ColumnDate(), ColumnIndex := opc.ColumnIndex() ); - traverse ( oprs, Elements, opr ) { - aopr := select( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductID() = opr.ProductID() and tempAOPR.ProductionLine() = opr.ProductionLine() and tempAOPR.Type() = opr.Type() ); - if ( isnull( aopr ) ) { - aopr := macroPlan.AssemblyOnlinePlanRow( relnew, ProductID := opr.ProductID(), ProductionLine := opr.ProductionLine(), Type := opr.Type() ); - } - - cellOPC := select( opr, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanColumn() = opc ); - if ( not isnull( cellOPC ) ) { - cellAOPC := aopc.AssemblyOnlinePlanCell( relnew, Value := cellOPC.Value() ); - cellAOPC.AssemblyOnlinePlanRow( relset, aopr ); - } - } - } - - // 澶勭悊鏃ュ巻浜嬩欢 - pls := selectuniquevalues( macroPlan, AssemblyOnlinePlanRow, tempAOPR, true, tempAOPR.ProductionLine() ); - traverse ( pls, Elements, pl ) { - targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ), - ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) ) - ); - - u := select( macroPlan, Unit, tempU, tempU.ID() = pl ); - drainPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "鎷夌┖" ), false ) ); - lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "閾虹嚎" ), false ) ); - - // 澶勭悊鎺掔┖ - info( "褰撳墠浜х嚎锛�", pl, " 澶勭悊鎷夌┖--------------------------" ); - traverse ( drainPs, Elements, p ) { - traverse ( p, ExplicitTimeInterval, eti ) { - info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), " 缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) ); - // 鍓嶄竴澶╂棩鍘� - aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = ( eti.Start().Date() - 1 ) ); - info( "闇�瑕佹媺绌虹殑涓婄嚎璁″垝鏃堕棿锛�", aopc.ColumnDate().Format( "Y-M2-D2" ) ); - aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and - exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) ); - aopr := maxselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc, - [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) ); - cell := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and - tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); - - cell.Value( [String] ( [Number]cell.Value() - targetQuantity ) ); - } - } - - info( "褰撳墠浜х嚎锛�", pl, " 澶勭悊閾虹嚎--------------------------" ); - // 澶勭悊閾虹嚎 - traverse ( lineLyingPs, Elements, p ) { - traverse ( p, ExplicitTimeInterval, eti ) { - info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), " 缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) ); - info( "闇�瑕侀摵绾跨殑涓婄嚎璁″垝鏃堕棿锛�", eti.Start().Format( "Y-M2-D2" ) ); - aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = eti.Start().Date() ); - aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and - exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) ); - aopr := minselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc, - [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) ); - cell := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and - tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); - cell.Value( [String] ( [Number]cell.Value() + targetQuantity ) ); - } - } - } + //macroPlan.AssemblyOnlinePlanRow( relflush ); + //macroPlan.AssemblyOnlinePlanColumn( relflush ); + // + //// 鎵捐閰嶇嚎琛� + //oprs := selectsortedset( opt, OfflinePlanRow, tempOPR, + // tempOPR.ProductionLine() = "DL MoMo" + // or + // tempOPR.ProductionLine() = "CC MoMo" + // or + // tempOPR.ProductionLine() = "DL ZKM" + // , + // tempOPR.ProductionLine(), tempOPR.ProductID(), tempOPR.Type() ); + //opcs := selectsortedset( opt, OfflinePlanColumn, tempOPC, true, tempOPC.ColumnDate() ); + // + //// 鐢熸垚琛ㄦ牸 + //traverse ( opcs, Elements, opc ) { + // aopc := macroPlan.AssemblyOnlinePlanColumn( relnew, ColumnDate := opc.ColumnDate(), ColumnIndex := opc.ColumnIndex() ); + // traverse ( oprs, Elements, opr ) { + // aopr := select( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductID() = opr.ProductID() and tempAOPR.ProductionLine() = opr.ProductionLine() and tempAOPR.Type() = opr.Type() ); + // if ( isnull( aopr ) ) { + // aopr := macroPlan.AssemblyOnlinePlanRow( relnew, ProductID := opr.ProductID(), ProductionLine := opr.ProductionLine(), Type := opr.Type() ); + // } + // + // cellOPC := select( opr, OfflinePlanCell, tempOPC, tempOPC.OfflinePlanColumn() = opc ); + // if ( not isnull( cellOPC ) ) { + // cellAOPC := aopc.AssemblyOnlinePlanCell( relnew, Value := cellOPC.Value() ); + // cellAOPC.AssemblyOnlinePlanRow( relset, aopr ); + // } + // } + //} + // + //// 澶勭悊鏃ュ巻浜嬩欢 + //pls := selectuniquevalues( macroPlan, AssemblyOnlinePlanRow, tempAOPR, true, tempAOPR.ProductionLine() ); + //traverse ( pls, Elements, pl ) { + // targetQuantity := ifexpr( pl = "CC MoMo", guard( macroPlan.AssemblyOnlineQuantity().CCMoMo(), 0 ), + // ifexpr( pl = "DL MoMo", guard( macroPlan.AssemblyOnlineQuantity().DLMoMo(), 0 ), guard( macroPlan.AssemblyOnlineQuantity().DLZKM(), 0 ) ) + // ); + // + // u := select( macroPlan, Unit, tempU, tempU.ID() = pl ); + // drainPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "鎷夌┖" ), false ) ); + // lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "閾虹嚎" ), false ) ); + // + // // 澶勭悊鎺掔┖ + // info( "褰撳墠浜х嚎锛�", pl, " 澶勭悊鎷夌┖--------------------------" ); + // traverse ( drainPs, Elements, p ) { + // traverse ( p, ExplicitTimeInterval, eti ) { + // info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), " 缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) ); + // // 鍓嶄竴澶╂棩鍘� + // aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = ( eti.Start().Date() - 1 ) ); + // info( "闇�瑕佹媺绌虹殑涓婄嚎璁″垝鏃堕棿锛�", aopc.ColumnDate().Format( "Y-M2-D2" ) ); + // aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and + // exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) ); + // aopr := maxselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc, + // [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) ); + // cell := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and + // tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); + // + // cell.Value( [String] ( [Number]cell.Value() - targetQuantity ) ); + // } + // } + // + // info( "褰撳墠浜х嚎锛�", pl, " 澶勭悊閾虹嚎--------------------------" ); + // // 澶勭悊閾虹嚎 + // traverse ( lineLyingPs, Elements, p ) { + // traverse ( p, ExplicitTimeInterval, eti ) { + // info( "寮�濮嬫椂闂达細", eti.Start().Format( "Y-M2-D2" ), " 缁撴潫鏃堕棿锛�", eti.End().Format( "Y-M2-D2" ) ); + // info( "闇�瑕侀摵绾跨殑涓婄嚎璁″垝鏃堕棿锛�", eti.Start().Format( "Y-M2-D2" ) ); + // aopc := select( macroPlan, AssemblyOnlinePlanColumn, tempAOPC, tempAOPC.ColumnDate() = eti.Start().Date() ); + // aoprs := selectset( macroPlan, AssemblyOnlinePlanRow, tempAOPR, tempAOPR.ProductionLine() = pl and tempAOPR.Type() = "2" and + // exists( tempAOPR, AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc and tempAOPC.Value() <> "" ) ); + // aopr := minselect( aoprs, Elements.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanColumn() = aopc, + // [Number]tempAOPC.Value().ReplaceAll( "#0", "" ) ); + // cell := select( macroPlan, AssemblyOnlinePlanRow.AssemblyOnlinePlanCell, tempAOPC, tempAOPC.AssemblyOnlinePlanRow().ProductionLine() = pl and tempAOPC.AssemblyOnlinePlanColumn() = aopc and + // tempAOPC.AssemblyOnlinePlanRow().Type() = "1" and tempAOPC.AssemblyOnlinePlanRow().ProductID() = aopr.AssemblyOnlinePlanRow().ProductID() ); + // cell.Value( [String] ( [Number]cell.Value() + targetQuantity ) ); + // } + // } + //} *] } -- Gitblit v1.9.3