1 把取数前的逻辑校验去重,增加性能
2 forecast和customerorder的货币参数调整
3 actualpispip库存值汇总
4 stock相关拼写逻辑回退
5 operationid取值修改
6 lanes默认可用
已修改20个文件
102 ■■■■ 文件已修改
_Main/BL/Type_ActualProductInStockingPointInPeriod/StaticMethod_CreateOrUpdate.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Forecast/StaticMethod_CreateOrUpdate.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Lane/StaticMethod_CreateLane.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_LaneLeg/StaticMethod_CreateLaneLegFromJson.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingInventoryValueAndCostData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataSupplyPurchase.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_ProductInLane/StaticMethod_CreateOrUpdate.qbl 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_ActualProductInStockingPointInPeriod/StaticMethod_CreateOrUpdate.qbl
@@ -12,7 +12,7 @@
  TextBody:
  [*
    // Administrator Sep-6-2023 (created)
    date := Date :: Today();
    date := owner.StartOfPlanning().Date()-1;
    actualpispip := ActualProductInStockingPointInPeriod::FindActualProductInStockingPointInPeriodTypeIndex( productid, stockingpointid, date, manufactureddate );
    
    if( isnull( actualpispip ) ){
@@ -25,7 +25,7 @@
                                                    manufactureddate,
                                                    true);
      }else{
        actualpispip.Update( actualinventorylevelend, description, true );
        actualpispip.Update(  actualinventorylevelend+actualpispip.ActualInventoryLevelEnd(), description, true );
        }
  *]
}
_Main/BL/Type_CustomerOrder/StaticMethod_CreateOrUpdate.qbl
@@ -27,7 +27,7 @@
    product := Product_MP::FindById( macroPlan, productId );
    salesSegment := SalesSegment_MP::FindByName( macroPlan, salesSegmentName );
    stockingPoint := StockingPoint_MP::FindById(  macroPlan, stockingPointId );
    currency := Currency_MP::FindById( macroPlan, currencyId );
    //currency := Currency_MP::FindById( macroPlan, currencyId );
    unitOfMeasure := null( UnitOfMeasure_MP )
    priority := null( Priority );
    if( unitOfMeasureName <> "" ) {
@@ -38,32 +38,32 @@
    }
    // 检查依赖项
    if( isnull( product) ) {
        error( "product not found" );
        info( "product not found" );
    }
    if( isnull( salesSegment) ) {
        error( "sales segment not found" );
        info( "sales segment not found" );
    }
    if( isnull( stockingPoint) ) {
        error( "stock point not found" );
        info( "stock point not found" );
    }
    if( isnull( currency) ) {
        error( "currency not found" );
    }
    //if( isnull( currency) ) {
    //    error( "currency not found" );
    //}
    if( unitOfMeasureName <> "" and isnull( unitOfMeasure) ) {
        error( "unit of measure not found" );
        info( "unit of measure not found" );
    }
    if( priorityName <> "" and isnull( stockingPoint) ) {
        error( "priority not found" );
        info( "priority not found" );
    }
    // 新增/更新
    result := CustomerOrder::FindById( macroPlan, id );
    if( isnull( result ) ) {
        CustomerOrder::Create( product, stockingPoint, id, orderDate, quantity, price, 
                               priorityName, salesSegmentName, currency.Name(), unitOfMeasureName,
                               priorityName, salesSegmentName, currencyId, unitOfMeasureName,
                               false, customerName, customerId, orderId, orderLineId, true, true, true );
    } else {
        result.Update( product, stockingPoint, orderDate, quantity, price, 
                       priorityName, salesSegmentName, currency.Name(), unitOfMeasureName,
                       priorityName, salesSegmentName, currencyId, unitOfMeasureName,
                       false, customerName, customerId, orderId, orderLineId, true, true, true );
    }
    return result;
_Main/BL/Type_Forecast/StaticMethod_CreateOrUpdate.qbl
@@ -55,7 +55,7 @@
    if( isnull( result) ) {
        result := Forecast::Create( product, stockingPoint, id, 
                                    startDate, endDate, quantity, price, 
                                    priorityName, salesSegmentName, guard( currency.Name(), "" ), unitOfMeasureName,
                                    priorityName, salesSegmentName, currencyId, unitOfMeasureName,
                                    0.0, false, true );
    } else {
        result.Update( product, stockingPoint, 
_Main/BL/Type_Lane/StaticMethod_CreateLane.qbl
@@ -12,7 +12,7 @@
  [*
    // Administrator Jul-12-2023 (created)
    //Set default value
    isenabled := false;
    isenabled := true;
    datestart := Date::Construct(1900, 1, 1) ;
    dateend := Date::Construct(9999, 12, 31);
    standardleadtime := Duration::Zero();
_Main/BL/Type_LaneLeg/StaticMethod_CreateLaneLegFromJson.qbl
@@ -9,8 +9,8 @@
  [*
    // Administrator Jul-12-2023 (created)
    laneid := datarow.Get( "laneid" ).GetString();
    originstockingpointid := datarow.Get( "originstockingpointid" ).GetString()+"_STOCK";
    destinationstockingpointid := datarow.Get( "destinationstockingpointid" ).GetString()+"_STOCK";
    originstockingpointid := datarow.Get( "originstockingpointid" ).GetString();
    destinationstockingpointid := datarow.Get( "destinationstockingpointid" ).GetString();
    name := datarow.Get( "name" ).GetString();
    userleadtime := datarow.Get( "userleadtime" );
    processingtime := Duration::Zero();
_Main/BL/Type_MacroPlan/Method_InitialUnitAndStockingPoint.qbl
@@ -11,7 +11,7 @@
    currencyid := "CNY";
    startdate := Date::Date( 1900, 1, 1 );
    enddate := Date::Date( 9999, 12, 31 );
    capacitytype := "Infinite";
    capacitytype := "Transport quantity";
    
    if( isnull( Unit::FindById( this, "空运" ) ) ){
      this.Unit( relnew, 
_Main/BL/Type_MacroPlan/Method_MappingActualPISPIPData.qbl
@@ -9,7 +9,7 @@
  [*
    // renhao Aug-14-2023 (created)
    date := Date :: Today();
    listtodeal := selectset( this,MappingActualPISPIP,actual,not isnull( Product_MP::FindById( this, actual.ProductID() ) ) );
    listtodeal := selectset( this,MappingActualPISPIP,actual,true );
    totalcount := listtodeal.Size();
    info( "ActualPISPIP has " + totalcount.AsQUILL() + " rows in total" );
    
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -9,15 +9,14 @@
  [*
    // renhao Aug-14-2023 (created)
    
    listtodeal := selectset( this,MappingExternalSupply,externalSupply,
                             not isnull( StockingPoint_MP::FindById( this, externalSupply.StockingPointID() ) ) and not isnull( Product_MP::FindById( this, externalSupply.ProductID() ) ) );
    listtodeal := selectset( this,MappingExternalSupply,externalSupply, true );
    totalcount := listtodeal.Size();
    info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
    
    count := 0;
    traverse( listtodeal,Elements,externalSupply){
      count := count + 1;
      if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
      if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "ExternalSupply " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
        }
      product := select( this,MappingProduct,product,product.ID() = externalSupply.ProductID() and product.KeyProduct() = nuclear,true);
_Main/BL/Type_MacroPlan/Method_MappingInventoryValueAndCostData.qbl
@@ -5,14 +5,14 @@
  TextBody:
  [*
    // yypsybs Aug-15-2023 (created)
    listtodeal := selectset( this,MappingInventoryValueAndCost,item,not isnull( Product_MP::FindById( this, item.ProductID() ) ), not isnull( StockingPoint_MP::FindById( this, item.StockingPointID() ) ) );
    listtodeal := selectset( this,MappingInventoryValueAndCost,item,true );
    totalcount := listtodeal.Size();
    info( "InventoryCost has " + totalcount.AsQUILL() + " rows in total" );
    
    count := 0;
    traverse( listtodeal, Elements, item ) {
      count := count + 1;
      if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
      if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "InventoryCost " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
        }
      if( not isnull( Product_MP::FindById( this, item.ProductID() ) ) ){
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl
@@ -29,19 +29,19 @@
        routingRows := selectset( bomList, Elements, item, true, routingId = item.OrganCode() + "_" + item.ProductCode() );
        if( routingRows.Size() > 0 ) {
            firstRow := routingRows.Element( 0 );
            stockingPointId := firstRow.OrganCode()  + "_" + firstRow.ProductType() + "_STOCK";
            inputStockingPointId := firstRow.OrganCode()  + "_" + firstRow.ComponentType() + "_STOCK";
            stockingPointId := firstRow.OrganCode()  + "_" + firstRow.ProductType() + "_Stock";
            inputStockingPointId := firstRow.OrganCode()  + "_" + firstRow.ComponentType() + "_Stock";
            // ========检查========
            product := Product_MP::FindById( this, firstRow.ProductCode() );
            product := Product_MP::FindProductTypeIndex( firstRow.ProductCode() );
            if( not isnull( product ) ) {
    //              error( "product : " + firstRow.ProductCode() + " not found" );
              stockingPoint := StockingPoint_MP::FindById( this, stockingPointId );
              inputStockingPoint := StockingPoint_MP::FindById( this, inputStockingPointId );
              stockingPoint := StockingPoint_MP::FindStockingPointTypeIndex( stockingPointId );
              inputStockingPoint := StockingPoint_MP::FindStockingPointTypeIndex(  inputStockingPointId );
    //          info( stockingPointId.AsQUILL() );
      //        if( isnull( stockingPoint ) ) {
      //            error( "stockingPoint : " + stockingPointId + " not found" );
      //        }
              routing := Routing::FindById( this, routingId );
              routing := Routing::FindRoutingTypeIndex(  routingId );
              if( not isnull( routing ) ) {
    //              error( "routing : " + routingId + " not found" );
                // ========处理输出========
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl
@@ -67,7 +67,7 @@
                        alterProd := Product_MP::FindById( this, alterRow.AlternativeMaterialCode() );
                        if( not isnull( alterProd ) ) {
        //                    error( "alterProd : " + alterRow.AlternativeMaterialCode() + " not found" );
                          stockingPointIdAlter := alterRow.OrganCode()  + "_" + alterRow.ProductType() + "_STOCK";
                          stockingPointIdAlter := alterRow.OrganCode()  + "_" + alterRow.ProductType() + "_Stock";
                          stockingPointAlter := StockingPoint_MP::FindById( this, stockingPointIdAlter );
                          if( isnull( stockingPointAlter ) ) {
                              error( "stockingPoint : " + stockingPointIdAlter + " not found" );
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataSupplyPurchase.qbl
@@ -20,7 +20,7 @@
    if( isnull( product ) ) {
        info(  "product : " + productId + " not found" );
    }
    stockingPointId := orgCode + "_" + productType + "_STOCK";
    stockingPointId := orgCode + "_" + productType + "_Stock";
    stockingPoint := StockingPoint_MP::FindById( this, stockingPointId );
    if( isnull( stockingPoint ) ) {
        info( "stockingPoint : " + stockingPointId + " not found" );
_Main/BL/Type_MacroPlan/Method_MappingOperationCostData.qbl
@@ -38,7 +38,7 @@
    // Get the operation cost data
    traverse( listtodealwithmaxsn, Elements, item ){
      count := count + 1;
      if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
      if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "OperationCost " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
        }
      id := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection() + "_" + item.Line();
_Main/BL/Type_MacroPlan/Method_MappingOperationData.qbl
@@ -26,7 +26,7 @@
        routingId := item.OrganCode() + "_" + item.ProductID();
        unitId := item.OrganCode() + "_" + item.PlantName() + "_" + item.ProcessSection();
        routingStepName := item.ProcessSection() + "_" + [String]item.SequenceNumber();
        operationId := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection();
        operationId := item.OrganCode() + "_" + item.ProductID() + "_" + item.ProcessSection()+"_" + [String]item.SequenceNumber();
    //    info( "========" )
    //    info( "routingId:" + routingId );
    //    info( "unitId:" + unitId );
@@ -51,15 +51,16 @@
        if( isnull( routingStep ) ) {
            routingStep := RoutingStep::Create( routing, routingStepName, "", true );
        }
        // UnitOfMeasure
        unitOfMeasure := UnitOfMeasure_MP::FindByName( this, item.UnitOfMeasureName() );
        if( isnull( unitOfMeasure ) ) {
            error( "unit of measure [" + item.UnitOfMeasureName() + "] not found for routing [" + routingId + "]" );
        }
        // Unit
        unit := Unit::FindById( this, unitId );
        if( isnull( unit ) ) {
            unit := this.Unit( relnew,
          // UnitOfMeasure
        unitOfMeasure := UnitOfMeasure_MP::FindByName( this, item.UnitOfMeasureName() );
          if( isnull( unitOfMeasure ) ) {
              info( "unit of measure [" + item.UnitOfMeasureName() + "] not found for routing [" + routingId + "]" );
          }
           unit := this.Unit( relnew,
                              ID := unitId, Name := unitId, CapacityType := "Infinite",
                              DefaultGridX := 0, DefaultGridY := 0,
                              IsManuallyConfigured := false,
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl
@@ -22,10 +22,10 @@
          }
    } else {
        if( iskeyproduct = true ){
          listToDeal := selectset( this, MappingProduct, item, item.KeyProduct() = true, businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 );
          listToDeal := selectset( this, MappingProduct, item, item.KeyProduct() = true,  businesstypes.Find(  item.BusinessType()) > 0 );
          }
        else{
        listToDeal := selectset( this, MappingProduct, item, businesstypes.Difference( businesstypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 );
        listToDeal := selectset( this, MappingProduct, item, businesstypes.Find(  item.BusinessType()) > 0 );
        }
    }
    totalcount := listToDeal.Size();
_Main/BL/Type_MacroPlan/Method_MappingProductInLaneData.qbl
@@ -7,7 +7,7 @@
  [*
    // Administrator Aug-17-2023 (created)
    // list to deal
    listtodeal := selectset( this, MappingProductInLane, item, not isnull( Product_MP::FindById( this, item.ProductID() ) ), not isnull( Lane::FindLaneTypeIndex( item.LineID() ) ) );
    listtodeal := selectset( this, MappingProductInLane, item ,true );
    totalcount := listtodeal.Size();
    info( "ProductInLane has " + totalcount.AsQUILL() + " rows in total" );
    
@@ -15,7 +15,7 @@
    // Create ProductInLane
    traverse( listtodeal, Elements, item ){
      count := count + 1;
      if( count - [Number](count/100) * 100 = 0 or count = totalcount ){
      if( count - [Number](count/1000) * 1000 = 0 or count = totalcount ){
        info( "Now is dealing with the " + count.AsQUILL() + "ProductInLane " + "( " + count.AsQUILL() + "/" + totalcount.AsQUILL() + " ) " + (count/totalcount*100).Round( 1 ).AsQUILL() + "%" );
        }
      ProductInLane::CreateOrUpdate( this, item.ProductID(), item.LineID() );
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
@@ -22,7 +22,7 @@
    
    //Set the Default values
    unitofmeasurename := "PCS";
    capacitytype := "Infinite";
    capacitytype := "Transport quantity";
    
    // Get the root data
    Unit::CreateOrUpdate( this, 
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -132,7 +132,7 @@
    
    // todo 制造成本-16
    info( "InventoryCost Finished, Start OperationCost Mapping" );
    macroPlan.MappingOperationCostData( businessTypes );
    //macroPlan.MappingOperationCostData( businessTypes );
    
    // 订单预测-17
    Forecast::DoSync( macroPlan, businessTypes );
_Main/BL/Type_ProductInLane/StaticMethod_CreateOrUpdate.qbl
@@ -17,12 +17,14 @@
    product :=  Product_MP::FindById( owner, productid );
    line :=  Lane::FindLaneTypeIndex( lineid );
    
    productinline := ProductInLane::FindProductInLaneTypeIndex( lineid, productid );
    if( not isnull( product) and not isnull( line)){
      productinline := ProductInLane::FindProductInLaneTypeIndex( lineid, productid );
    
    if( isnull( productinline ) ){
      if( isnull( productinline ) ){
      ProductInLane::Create( product, line, isexcluded, isfromdb );
      }else{
        productinline.Update( productid, lineid, isexcluded, isfromdb );
       productinline.Update( productid, lineid, isexcluded, isfromdb );
        }
    }
  *]
}
_Main/BL/Type_StockingPoint_MP/StaticMethod_CreateStockingpointFromJson.qbl
@@ -9,7 +9,7 @@
  TextBody:
  [*
    // Administrator Jul-7-2023 (created)
    id := datarow.Get( "id" ).GetString()+"_STOCK";
    id := datarow.Get( "id" ).GetString();
    unitid := datarow.Get( "unitid" ).GetString();
    name := datarow.Get( "name" ).GetString();