xiaoding721
2024-10-15 4b9a2cb1df3fb79c51f4982b62236c35e27846b7
_Main/BL/Type_NewOfflinePlanCell/StaticMethod_RefreshOfflinePlan.qbl
@@ -69,7 +69,16 @@
        traverse ( nopt, NewOfflinePlanColumn, nopc ) {
          cell   := select( nopr, NewOfflinePlanCell, tempNOPCell, tempNOPCell.NewOfflinePlanColumn() = nopc );
          if ( isnull( cell ) ) {
            cell := nopr.NewOfflinePlanCell( relnew );
            uptb := select( macroPlan, Unit.UnitPeriod.astype( UnitPeriodTimeBase ), tempUPTB,
                            tempUPTB.UnitID() = nopr.ProductionLine() and tempUPTB.StartDate() = nopc.StartDate() and tempUPTB.End().Date() = nopc.EndDate() );
            // ShiftPattern
            sp   := uptb.ShiftPattern();
            // ShiftDayTime
            sdt  := select( sp, ShiftDayTime, tempSDT, tempSDT.Name() = tempSDT.ShiftPattern().Name() );
            cell := nopr.NewOfflinePlanCell( relnew,
                                             ShiftPatternName  := guard( sp.Name(), "" ),
                                             ShiftPatternStart := guard( sdt.StartDateTime().Format( "H:m" ), "" ),
                                             ShiftPatternEnd   := guard( sdt.EndDateTIme().Format( "H:m" ), "" ) );
            cell.NewOfflinePlanColumn( relset, nopc );
          }
        }
@@ -79,15 +88,14 @@
      totalNOPR   := nopt.NewOfflinePlanRow( relnew, ProductID := "All", ProductionLine := u.ID(), Type := "2" );
      detailNOPRs := selectset( nopt, NewOfflinePlanRow, tempNOPR, tempNOPR.ProductionLine() = u.ID() and tempNOPR.Type() = "1" );
      traverse ( detailNOPRs, Elements, detailNOPR ) {
        shiftPatternNOPCell := select( detailNOPR, NewOfflinePlanCell, tempNOPCell, tempNOPCell.ShiftPatternName() <> "" );
        traverse ( detailNOPR, NewOfflinePlanCell, detailNOPCell ) {
          // 生产下线计划【产线合计】单元格
          totalNOPRCell   := select( totalNOPR, NewOfflinePlanCell, tempNOPCell, tempNOPCell.NewOfflinePlanColumn() = detailNOPCell.NewOfflinePlanColumn() );
          if ( isnull( totalNOPRCell ) ) {
            totalNOPRCell := totalNOPR.NewOfflinePlanCell( relnew, 
                                                           ShiftPatternName  := shiftPatternNOPCell.ShiftPatternName(),
                                                           ShiftPatternStart := shiftPatternNOPCell.ShiftPatternStart(),
                                                           ShiftPatternEnd   := shiftPatternNOPCell.ShiftPatternEnd() );
                                                           ShiftPatternName  := detailNOPCell.ShiftPatternName(),
                                                           ShiftPatternStart := detailNOPCell.ShiftPatternStart(),
                                                           ShiftPatternEnd   := detailNOPCell.ShiftPatternEnd() );
            totalNOPRCell.NewOfflinePlanColumn( relset, detailNOPCell.NewOfflinePlanColumn() ); // 设置列
            // 将明细单元格关联到合计单元格
            totalNOPRCell.Detailed( relinsert, detailNOPCell );