xiaoding721
2024-10-17 f7e27cb24f4cdbe6a25af74549867dbd49b1b401
_Main/BL/Type_NewAssemblyOnlinePlanCell/StaticMethod_RefreshData.qbl
@@ -61,7 +61,7 @@
                               );
      
      u           := select( macroPlan, Unit, tempU, tempU.ID() = pl );
      drainPs     := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "拉空" ), false ) );
      drainPs     := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "拉空" ) or tempP.Event().Subject().Regex( "排空" ), false ) );
      lineLyingPs := selectset( u, UnitCalendar.Participation, tempP, guard( tempP.Event().Subject().Regex( "铺线" ), false ) );
      
      // 处理拉空
@@ -69,13 +69,24 @@
      traverse ( drainPs, Elements, p ) {
        traverse ( p, ExplicitTimeInterval, eti ) {
    //      info( "开始时间:", eti.Start().Format( "Y-M2-D2" ), "    结束时间:", eti.End().Format( "Y-M2-D2" ) );
          naopc := select( macroPlan, NewAssemblyOnlinePlanColumn, tempNAOPC, tempNAOPC.StartDate() = ( eti.Start().Date() - 1 ) );
          
          cell  := maxselect( macroPlan, NewAssemblyOnlinePlanRow.NewAssemblyOnlinePlanCell, tempNAOPCell, 
                              tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl                         and
                              tempNAOPCell.NewAssemblyOnlinePlanColumn().StartDate()   = ( eti.Start().Date() - 1 ) and
                              tempNAOPCell.NewAssemblyOnlinePlanRow().Type()           = "1",
                              tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl    and
                              tempNAOPCell.NewAssemblyOnlinePlanColumn()               = naopc and
                              tempNAOPCell.NewAssemblyOnlinePlanRow().Type()           = "1"   and
                              tempNAOPCell.Quantity()                                  > 0,
                              tempNAOPCell.OrderNr() ); 
          while ( isnull( cell ) and not isnull( naopc ) ){
            naopc := naopc.PreviousNAOPColumn();
            cell  := maxselect( macroPlan, NewAssemblyOnlinePlanRow.NewAssemblyOnlinePlanCell, tempNAOPCell,
                              tempNAOPCell.NewAssemblyOnlinePlanRow().ProductionLine() = pl    and
                              tempNAOPCell.NewAssemblyOnlinePlanColumn()               = naopc and
                              tempNAOPCell.NewAssemblyOnlinePlanRow().Type()           = "1"   and
                              tempNAOPCell.Quantity()                                  > 0,
                              tempNAOPCell.OrderNr() );
          }
          if ( not isnull( cell ) ) {
            cell.Quantity( cell.Quantity() - targetQuantity );
          }