lihongji
2024-11-14 6241712a7a2ad2cb543fb4aea7110868b8c92ce3
包装计划优化
已修改2个文件
66 ■■■■■ 文件已修改
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackage_Lotsize.qbl 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackage_Lotsize.qbl
@@ -44,9 +44,16 @@
                          tempSP.Outcome() <> "" )                                            and
                  needPackagingQuantity > 0 ) {
            // 能包装的数量
            canPackagingQuantity  := ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ),
                                             ceil( needPackagingQuantity / ppls.LotSize() ),
                                             floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ) ) * ppls.LotSize();
            canPackagingQuantity    := [Number]ifexpr( ceil( needPackagingQuantity / ppls.LotSize() ) < floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ),
                                                       ceil( needPackagingQuantity / ppls.LotSize() ),
                                                       floor( ppnc.MaximumDailyPackagingQuantity() / ppls.LotSize() ) ) * ppls.LotSize();
            // 改类下其他产品包装总和
            categoryPackageQuantity := sum( indexPPCell, PackagingPlanColumn.PackagingPlanCell, tempPPCell,
                                            tempPPCell <> indexPPCell                                                            and
                                            tempPPCell.PackagingPlanRow().Factory() = indexPPCell.PackagingPlanRow().Factory()   and
                                            tempPPCell.PackagingPlanRow().Category() = indexPPCell.PackagingPlanRow().Category(),
                                            tempPPCell.Package() );
            canPackagingQuantity    := minvalue( [Number] ( ppnc.MaximumDailyPackagingQuantity() - categoryPackageQuantity ), canPackagingQuantity );
    //        info( "开始包装的日期:", indexPPCell.StartDate().Format( "Y-M2-D2" ), "    能包装的数量:", canPackagingQuantity );
            
            indexPPCell.Package( canPackagingQuantity );
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValuesCC.qbl
@@ -6,26 +6,43 @@
{
  TextBody:
  [*
    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "长春工厂" /*and ppr.ProductID() = "06K103011CM"*/ ) {
      traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
        unpackagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                   tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
                                   tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
                                   tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" )      and
                                   tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ),
                                   tempPIT.Quantity()
                                  );
        ppcell.Unpacking( unpackagedQuantity );
    traverse ( macroPlan, PackagingPlanRow, ppr, ppr.Factory() = "长春工厂" /*and ppr.Category() = "ZKG" and ppr.ProductID() = "06K103011CP"*/ ) {
      u  := select( macroPlan, Unit, tempU, tempU.ID() = "CC " + ppr.Category() + " 线边和外租库间");
      ts := selectset( u, Lane.LaneLeg.Trip, tempT,
                       guard( select( tempT, ProductInTrip, tempPIT, tempPIT.ProductID() = ppr.ProductID() ).Quantity() > 0, false ) );
      traverse ( ts, Elements.ProductInTrip, pit, pit.Quantity() > 0 and pit.ProductID() = ppr.ProductID() ) {
        ppcell := select( ppr, PackagingPlanCell, tempPPCell, tempPPCell.PackagingPlanColumn().StartDate() = pit.Trip().Departure().Date() );
        
        packagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
                                 tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
                                 tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
                                 tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" )      and
                                 tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ),
                                 tempPIT.Quantity()
                                );
        ppcell.Package( packagedQuantity );
        if ( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ) and pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ) ) {
          ppcell.Unpacking( pit.Quantity() );
        }
        if ( pit.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ) and pit.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ) ) {
          ppcell.Package( pit.Quantity() );
        }
      }
    //  traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
    //    unpackagedQuantity := sum( u, Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
    //                               tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
    //                               tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
    //                               tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" )      and
    //                               tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" ),
    //                               tempPIT.Quantity()
    //                              );
    //    ppcell.Unpacking( unpackagedQuantity );
    //
    //    packagedQuantity := sum( macroPlan, Unit.Lane.LaneLeg.Trip.ProductInTrip, tempPIT,
    //                             tempPIT.ProductID()          = ppcell.PackagingPlanRow().ProductID()                               and
    //                             tempPIT.Trip().Departure().Date() = ppcell.StartDate()                                             and
    //                             tempPIT.Trip().LaneLeg().AsOriginStockingPointLeg().StockingPoint_MP().ID().Regex( "线边库" )      and
    //                             tempPIT.Trip().LaneLeg().AsDestinationStockingPointLeg().StockingPoint_MP().ID().Regex( "外租库" ),
    //                             tempPIT.Quantity()
    //                            );
    //    ppcell.Package( packagedQuantity );
    //  }
    }
  *]
}