lazhen
2024-10-31 fa55a671f97d901ab03bc7a258cf3da8c4f9c0de
_Main/BL/Type_NewOfflinePlanCell/StaticMethod_DeductionOfReplacementLoss.qbl
@@ -14,7 +14,7 @@
    allProductionLines := selectuniquevalues( newNOPT, NewOfflinePlanRow, tempNOPR, true, tempNOPR.ProductionLine() );
    
    traverse ( allProductionLines, Elements, pl
    //           , pl = "eMotor Assy (France)"
    //           , pl = "CC MoMo"
             ) 
    {
      // 下线计划当前产线下的行
@@ -24,11 +24,12 @@
      preNOPCell := null( NewOfflinePlanCell );
      
      traverse ( newNOPT, NewOfflinePlanColumn, nopc
    //             , nopc.StartDate() >= macroPlan.StartOfPlanning().Date() and nopc.StartDate() <= Date::Construct( 2024, 4, 17 ) // 测试时可以过滤时间
    //             , nopc.StartDate() >= macroPlan.StartOfPlanning().Date() and nopc.StartDate() <= Date::Construct( 2025, 1, 16 ) // 测试时可以过滤时间
               ) 
      {         
        for ( i := 1; i < 10; i++ ) {
          nopcell := select( noprs, Elements.NewOfflinePlanCell, tempNOPC, tempNOPC.NewOfflinePlanColumn() = nopc and tempNOPC.OrderNr() = i );
          nopcell := select( noprs, Elements.NewOfflinePlanCell, tempNOPC, tempNOPC.NewOfflinePlanColumn() = nopc and tempNOPC.OrderNr() = i and tempNOPC.Order() <> "" );
          // 换型损失参数
          cls     := select( macroPlan, ChangeLossSetting, tempCLS, 
                             tempCLS.ProductFirst().ID()  = guard( preNOPCell.NewOfflinePlanRow().ProductID(), "" ) and
@@ -39,10 +40,12 @@
    
          // 扣减换型损失
          if ( not isnull( preNOPCell ) and not isnull( nopcell ) and not isnull( cls ) ) {
            preNOPCell.Quantity( preNOPCell.Quantity() - cls.ChangeLossNumber() );
    //        info( "当前产品序号:", nopcell.OrderNr(),  "    ", nopcell.Order(), "    ", i );
    //        info( "当前列时间:", nopc.StartDate().Format( "Y-M2-D2" ), 
    //              "    上一个产品当前序号:", preNOPCell.Order(), "    上一个产品数量:", preNOPCell.Quantity(), "    上一个产品名:", preNOPCell.NewOfflinePlanRow().ProductID(),
    //              "    当前产品序号:"      , nopcell.Order()   , "    当前产品数量:"     , nopcell.Quantity(), "    当前产品名:"  , nopcell.NewOfflinePlanRow().ProductID() );
    //              "    当前产品序号:"      , nopcell.Order()   , "    当前产品数量:"     , nopcell.Quantity(), "    当前产品名:"  , nopcell.NewOfflinePlanRow().ProductID(),
    //              "    需要扣减的数量:", cls.ChangeLossNumber() );
            preNOPCell.Quantity( preNOPCell.Quantity() - cls.ChangeLossNumber() );
          }
          
          // 设置上一个生产的产品Cell