lihongji
2024-06-05 f19751d1feceb0090f4ca6f127ed95d344ad0e54
库存同步实际库存
已修改3个文件
57 ■■■■ 文件已修改
_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_InventoryInterfaceData/StaticMethod_SynchronizeStartingInventory.qbl
@@ -9,44 +9,39 @@
{
  TextBody:
  [*
    // 获取指定日期库存数据
    // 获取指定日期库存接口数据
    iids := selectset( interfaceDataset, InventoryInterfaceData, tempIID, tempIID.Date() = date );
    
    // 清空原本数量
    traverse ( iids, Elements.InventoryInterfaceDataDetail, iidd, iidd.InventoryPointSelection().IsIncluded() ) {
      product_MP    := select( products, Elements, tempPMP, tempPMP.ID() = iidd.PartNumber() );
      pisp          := guard( select( product_MP, ProductInStockingPoint_MP, tempPISPMP, tempPISPMP.StockingPointID() = iidd.InventoryPointSelection().StockpoingPoint() ),
                              null( ProductInStockingPoint_MP ) );
      
      if ( not isnull( pisp ) ) {
      }
    //      if ( not isnull( product_MP ) and not isnull( stockpoing_MP ) ) {
    //        apispip := select( targetMacroPlan, Actual.astype( ActualProductInStockingPointInPeriod ), tempA,
    //                           tempA.ProductID() = product_MP.ID()              and
    //                           tempA.StockingPointID() = stockpoing_MP.ID()     and
    //                           tempA.Date() = ici.DateTime().Date()                 and
    //                           tempA.ManufacturedDate() = Date::MinDate() );
    //        if ( isnull( apispip ) ) {
    //          ActualProductInStockingPointInPeriod::Create( targetMacroPlan, product_MP, stockpoing_MP, ici.DateTime().Date(),
    //                                                        Date::MinDate(), [Real]ici.ActualInventoryLevelEnd(), "", false );
    //        } else {
    //          apispip.Update( apispip.ActualInventoryLevelEnd() + [Real]ici.ActualInventoryLevelEnd(), "", false );
    //        }
    //      }
    //    } else if ( guard( lisp.StockingPointID() = "HQ-总仓RF待返", false ) or
    //                guard( lisp.StockingPointID() = "HQ-总仓2D待返", false ) ) {
    //      // 创建翻新库存
    //      product_MP    := select( targetMacroPlan, Product_MP, tempPMP, tempPMP.ID() = ici.ProductID() );
    //      stockpoing_MP := select( targetMacroPlan, StockingPoint_MP, tempSPMP, tempSPMP.ID() = "待翻新库存仓" );
    //
    //      if ( not isnull( product_MP ) and not isnull( stockpoing_MP ) ) {
    //        InventorySupply::Create( OS::GenerateGUIDAsString(), product_MP, stockpoing_MP, ici.DateTime().Date(),
    //                                 Date::MinDate(), guard( [Real]ici.ActualInventoryLevelEnd(), 0.0 ), "", false );
    //      }
    //    }
    //  }
        apispip := select( pisp, ActualProductInStockingPointInPeriod, tempAPISPIP, tempAPISPIP.Date() = date );
        if ( not isnull( apispip ) ) {
          apispip.Update( 0.0, "", false );
        }
      }
    }
    
    //info( "个数: ", icis.Size() );
    // 同步接口数据
    traverse ( iids, Elements.InventoryInterfaceDataDetail, iidd, iidd.InventoryPointSelection().IsIncluded() ) {
      product_MP    := select( products, Elements, tempPMP, tempPMP.ID() = iidd.PartNumber() );
      pisp          := guard( select( product_MP, ProductInStockingPoint_MP, tempPISPMP, tempPISPMP.StockingPointID() = iidd.InventoryPointSelection().StockpoingPoint() ),
                              null( ProductInStockingPoint_MP ) );
      if ( not isnull( pisp ) ) {
        apispip := select( pisp, ActualProductInStockingPointInPeriod, tempAPISPIP, tempAPISPIP.Date() = date );
        if ( isnull( apispip ) ) {
          ActualProductInStockingPointInPeriod::Create( macroPlan, product_MP, pisp.StockingPoint_MP(), date,
                                                        Date::MinDate(), [Real]iidd.Quantity(), "", false );
          Transaction::Transaction().Propagate( relation( ActualProductInStockingPointInPeriod, ProductInStockingPoint_MP ) );
        } else {
          apispip.Update( apispip.ActualInventoryLevelEnd() + [Real]iidd.Quantity(), "", false );
        }
      }
    }
  *]
}
_Main/BL/Type_InventoryInterfaceData/StaticMethod_Test.qbl
@@ -9,7 +9,7 @@
    interfaceDataset.InventoryInterfaceData( relflush );
    interfaceDataset.InventoryPointSelection( relflush );
    
    iid1 := interfaceDataset.InventoryInterfaceData( relnew, Date := Date::ActualDate(), PartNumber := "BLEU EV2 Sports" );
    iid1 := interfaceDataset.InventoryInterfaceData( relnew, Date := Date::Construct( 2020, 1, 28 ), PartNumber := "BLEU EV2 Sports" );
    iid1.InventoryInterfaceDataDetail( relnew, Date := Date::Construct( 2020, 1, 28 ), PartNumber := "BLEU EV2 Sports", InventoryPoint := "PXSN", Quantity := 900 );
    iid1.InventoryInterfaceDataDetail( relnew, Date := Date::Construct( 2020, 1, 28 ), PartNumber := "BLEU EV2 Sports", InventoryPoint := "LPLE", Quantity := 800 );
    iid1.InventoryInterfaceDataDetail( relnew, Date := Date::Construct( 2020, 1, 28 ), PartNumber := "BLEU EV2 Sports", InventoryPoint := "3PLE", Quantity := 3100 );
_Main/UI/MacroPlannerWebApp/Component_DialogSynchronizeStartingInventory/_ROOT_Component_DialogSynchronizeStartingInventory.def
@@ -16,7 +16,7 @@
    EnterButton: 'btnOk'
    EscapeButton: 'btnCancel'
    ExcludeFromActiveComponent: true
    MinimumRows: 30
    MinimumColumns: 30
    Padding: 'false'
    Title: 'Synchronize Starting Inventory'
  ]