admin
2024-10-18 b29049d4ed2a4216c941244b46732366e0385dec
包装库存优化
已添加2个文件
已修改3个文件
118 ■■■■■ 文件已修改
_Main/BL/Type_PackagingPlanCell/Attribute_NewSupply.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/Sys/Repr/Global/PackagingPlanCell.qrp 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_PackagingPlanCell/Attribute_NewSupply.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
Quintiq file version 2.0
#parent: #root
Attribute NewSupply
{
  #keys: '3[415754.0.436130246][415754.0.436130245][415754.0.436130247]'
  Description: '供应'
  ValueType: Real
}
_Main/BL/Type_PackagingPlanCell/StaticMethod_GenerateReport.qbl
@@ -62,15 +62,17 @@
        
        // å¤§è¿žå·¥åŽ‚è®¾ç½®å€¼
        if ( factory = "大连工厂" ) {
          // å‡€éœ€æ±‚&剩余库存
          // å‡€éœ€æ±‚&剩余库存&供应量
          cell.NetDemand( cell.NetDemand() + pispipl.DependentDemandAndSalesDemandQuantity() );
          cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
          cell.NewSupply( cell.NewSupply() + pispipl.NewSupplyQuantity() );
        }
        
        // é•¿æ˜¥å·¥åŽ‚è®¾ç½®å€¼
        if ( factory = "长春工厂" ) {
          // å‰©ä½™åº“å­˜
          // å‰©ä½™åº“å­˜&供应量
          cell.EndingInventory( cell.EndingInventory() + pispipl.InventoryLevelEnd() );
          cell.NewSupply( cell.NewSupply() + pispipl.NewSupplyQuantity() );
          
          // å‡€éœ€æ±‚【只取线边库】&包装库存&非包装库存
          if ( pisp.StockingPointID().Regex( "外租库" ) ) {
_Main/BL/Type_PackagingPlanCell/StaticMethod_SetPackagingAndUnpackingValues.qbl
@@ -91,5 +91,56 @@
        }
      }
    }
    // è®¾ç½®æ‹†åŒ…值(符合lotsize和一日最大包装量)
    traverse ( macroPlan, PackagingPlanRow, ppr/*, ppr.Factory() = "大连工厂" and ppr.ProductID() = "06K103011CM"*/ ) {
      traverse ( ppr, PackagingPlanCell, ppcell/*, ppcell.StartDate() <= Date::Construct( 2025, 1, 4 )*/ ) {
        // Product_MP
        pmp                     := select( macroPlan, Product_MP, tempPMP, tempPMP.IsLeaf() and tempPMP.ID() = ppr.ProductID() );
        // åŒ…装lotsize
        ppls                    := select( macroPlan, PackagingPlanLotSize, tempPPLS, tempPPLS.Factory() = ppr.Factory() and
                                           tempPPLS.ProductID() = ifexpr( exists( macroPlan, PackagingPlanLotSize, tempPPLS1, tempPPLS1.ProductID() = pmp.ID() ),
                                                                          pmp.ID(),
                                                                          pmp.ParentID() ) );
        // ä¸€æ—¥åŒ…装容量
        ppnc                    := select( macroPlan, PackagingPlanNewCapability, tempPPNC, tempPPNC.Factory() = ppr.Factory() and
                                           tempPPNC.ProductID() = ifexpr( exists( macroPlan, PackagingPlanNewCapability, tempPPNC1, tempPPNC1.ProductID() = pmp.ID() ),
                                                                          pmp.ID(),
                                                                          pmp.ParentID() ) );
        // Unit
        us                      := selectset( macroPlan, Unit, tempU, tempU.ID().Regex( ppr.FactoryAbbreviation() + " " + ppr.Category() ) );
        // å½“前非包装库存 + ä¸‹ä¸€å¤©çš„NewSupply < ä¸‹ä¸€å¤©çš„净需求
        if ( ppcell.UnpackagedInventory() < guard( ppcell.Next().NetDemand(), 0 ) and not isnull( ppls ) and not isnull( ppnc ) ) {
          // éœ€è¦åŒ…装的数量
          needPackagingQuantity := abs( ppcell.PackagingInventory() ).Round( 0 );
          // åŒ…装开始的索引
          indexPPCell           := ppcell.Previous();
    //      info( "产线个数:", us.Size(), "    å¼€å§‹æ—¶é—´ï¼š", ppcell.StartDate().Format( "Y-M2-D2" ), "    åŒ…装库存数量:", ppcell.PackagingInventory(), "    éœ€è¦åŒ…装的数量:", needPackagingQuantity,
    //            "    åŒ…装lotsize:",guard( ppls.LotSize(), 0 ), "    æœ€å¤§åŒ…装容量:", ppnc.MaximumDailyPackagingQuantity() );
          while ( not isnull( indexPPCell )                                                   and
                  indexPPCell.StartDate() >= plannedStartDate                                 and
                  exists( us, Elements.UnitPeriod.astype( UnitPeriodTime ).ShiftPlan, tempSP,
                          tempSP.UnitPeriodTime().StartDate() = indexPPCell.StartDate(),
                          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();
    //        info( "开始包装的日期:", indexPPCell.StartDate().Format( "Y-M2-D2" ), "    èƒ½åŒ…装的数量:", canPackagingQuantity );
            indexPPCell.Package( canPackagingQuantity );
            Transaction::Transaction().Propagate( attribute( PackagingPlanCell, PackagingInventory ) );
            Transaction::Transaction().Propagate( attribute( PackagingPlanCell, UnpackagedInventory ) );
            needPackagingQuantity := needPackagingQuantity - canPackagingQuantity;
            indexPPCell           := indexPPCell.Previous();
          }
        }
      }
    }
  *]
}
_Main/Sys/Repr/Global/PackagingPlanCell.qrp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
Quintiq file version 2.0
#parent: #root
TypeRepresentation PackagingPlanCell
{
  AttributeRepresentation EndingInventory
  {
    AttributeKey: '[413988.0.1393320114]'
    Synonym: 'Inventory end'
  }
  AttributeRepresentation NetDemand
  {
    AttributeKey: '[413988.0.1393320104]'
    Synonym: 'Demand'
  }
  AttributeRepresentation NewSupply
  {
    AttributeKey: '[415754.0.436130245]'
    Synonym: 'New supply'
  }
  AttributeRepresentation Out
  {
    AttributeKey: '[413988.0.1393320156]'
    Synonym: 'Transport-out'
  }
  AttributeRepresentation Package
  {
    AttributeKey: '[413988.0.1393320188]'
    Synonym: 'Package'
  }
  AttributeRepresentation PackagingInventory
  {
    AttributeKey: '[413988.0.1393320143]'
    Synonym: 'Packaged'
  }
  AttributeRepresentation TransferIn
  {
    AttributeKey: '[413988.0.1393320166]'
    Synonym: 'Transport-in'
  }
  AttributeRepresentation UnpackagedInventory
  {
    AttributeKey: '[413988.0.1393320130]'
    Synonym: 'Unpackaged'
  }
  AttributeRepresentation Unpacking
  {
    AttributeKey: '[413988.0.1393320198]'
    Synonym: 'Unpackage'
  }
  RelationRepresentation AsFirst { RelationKey: '[413988.0.1425205682]' Visibility: 'Normal' }
}
_Main/UI/MacroPlannerWebApp/Component_FormPackagingPlan/Component_MatrixEditor493.def
@@ -26,7 +26,7 @@
      ]
      Properties:
      [
        Attributes: 'NetDemand;EndingInventory;UnpackagedInventory;PackagingInventory;Out;TransferIn;Package;Unpacking'
        Attributes: 'NetDemand;NewSupply;EndingInventory;Out;TransferIn;UnpackagedInventory;PackagingInventory;Package;Unpacking'
        Column: 'PackagingPlanColumn'
        Row: 'PackagingPlanRow'
        Taborder: 0