renhao
2023-09-18 5ac4d4f977b27ee53ec4bc544cc2a6b4019c8fbd
1 接口数据修正
已添加1个文件
已修改8个文件
112 ■■■■■ 文件已修改
_Main/BL/Type_MacroPlan/Method_DeleteSnaityCheck.qbl 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_MacroPlan/Method_DeleteSnaityCheck.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
Quintiq file version 2.0
#parent: #root
Method DeleteSnaityCheck
{
  TextBody:
  [*
    // renhao Sep-13-2023 (created)
    //删除没有汇率的货币
    traverse(  this,Currency_MP,currency,not currency.IsBase() and currency.CurrencyRate_MP( relsize ) = 0 ){
      currency.Delete();
    }
    //删除没有产品的车道
    traverse( this,Unit.Lane,lane,not isnull( lane) and lane.ProductInLane(relsize )=0 ){
      lane.Delete();
    }
    //删除没有用到产品和lane的库存点
    traverse( this,StockingPoint_MP,stock,stock.ProductInStockingPoint_MP(relsize ) = 0 ){
      stock.Delete();
    }
  *]
}
_Main/BL/Type_MacroPlan/Method_MappingCustomerOrderData.qbl
@@ -23,6 +23,7 @@
    info( "CustomerOrder has " + totalcount.AsQUILL() + " rows in total" );
    
    count := 0;
    priorityName :="Normal";
    // å¤„理
    traverse( listToDeal, Elements, item ) {
      count := count + 1;
@@ -33,7 +34,7 @@
    //    info( item.ProductID().AsQUILL() );
      CustomerOrder::CreateOrUpdate( this, item.CurrencyID(), item.Customer(), item.CustomerID(), item.ID(), 
                                     item.OrderDate(), item.OrderID(), item.OrderLineID(), item.Price(), 
                                     item.PriorityName(), item.ProductID(),
                                     priorityName, item.ProductID(),
                                     item.StockPointID(), 
                                     item.SalesSegmentName(), 
                                     item.Quantity(), item.UnitOfMeasureName(), item.OrderType(), item.IsAvailable());
_Main/BL/Type_MacroPlan/Method_MappingExternalSupplyData.qbl
@@ -8,8 +8,9 @@
  TextBody:
  [*
    // renhao Aug-14-2023 (created)
    listtodeal := selectset( this,MappingExternalSupply,externalSupply, externalSupply.UserQuantity()>0 );
    queryStartDate := guard( min( this, Period_MP, item, true, item.StartDate() ) - Duration::Days( 30 ), DateTime::MinDateTime() ).Date();
    queryEndDate := guard( max( this, Period_MP, item, true, item.EndDate() ), Date::MaxDate() );
    listtodeal := selectset( this,MappingExternalSupply,externalSupply, externalSupply.UserQuantity()>0 and externalSupply.Date() >= queryStartDate and externalSupply.Date() <= queryEndDate);
    totalcount := listtodeal.Size();
    description := "在途在制";
    info( "ExternalSupply has " + totalcount.AsQUILL() + " rows in total" );
@@ -19,7 +20,7 @@
      count := count + 1;
      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(),true);
      
      
_Main/BL/Type_MacroPlan/Method_MappingForecastData.qbl
@@ -11,9 +11,9 @@
    // å¾…处理数据
    listToDeal := construct( structured[MappingForecast] );
    if( isnull( businessTypes ) or businessTypes.Size() = 0 ) {
        listToDeal := selectset( this, MappingForecast, item, true );
        listToDeal := selectset( this, MappingForecast, item, item.Quantity() > 0 );
    } else {
        listToDeal := selectset( this, MappingForecast, item, businessTypes.Find( item.BusinessType() ) <> -1 );
        listToDeal := selectset( this, MappingForecast, item, businessTypes.Find( item.BusinessType() ) <> -1 and item.Quantity()>0 );
    }
    queryStartDate := guard( min( this, Period_MP, item, true, item.StartDate() ) - Duration::Days( 30 ), DateTime::MinDateTime() ).Date();
    queryEndDate := guard( max( this, Period_MP, item, true, item.EndDate() ), Date::MaxDate() );
@@ -23,6 +23,7 @@
    info( "Forecast has " + totalcount.AsQUILL() + " rows in total" );
    
    count := 0;
    priorityName := "Normal";
    // å¤„理
    traverse( listToDeal, Elements, item ) {
      count := count + 1;
@@ -31,7 +32,7 @@
        }
    //  if( not isnull( Product_MP::FindById( this, item.ProductID() ) ) ){
      Forecast::CreateOrUpdate( this, 
                                item.ProductID(), item.SalesSegmentName(), item.StockingPointID(), item.PriorityName(),
                                item.ProductID(), item.SalesSegmentName(), item.StockingPointID(), priorityName,
                                item.CurrencyID(), item.UnitOfMeasureName(),
                                item.ID(), item.StartDate(), item.EndDate(), item.Quantity(), item.Price());
    //  }else{
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMData.qbl
@@ -12,16 +12,17 @@
    
    keyProductList := construct( Strings );
    if( isKeyProduct ) {
        keyProductList := selectuniquevalues( this, MappingProduct, item, item.KeyProduct(), item.ID() );
        keyProductList := selectuniquevalues( this, MappingProduct, item, item.ProductMajorType()="成品" or item.ProductMajorType()="半成品", item.ID() );
    }
    bomList := selectsortedset(  this, MappingBOM, item,
                                 ifexpr( isnull( businessTypes ) or businessTypes.Size() = 0, 
                                         true, 
    //                                     businessTypes.Difference( businessTypes.Difference( item.BusinessType().Tokenize( ", " ) ) ).Size() > 0 )
                                         businessTypes.Find( item.BusinessType() ) >= 0 )
                                 and ifexpr( isKeyProduct,
                                             keyProductList.Size() > 0 and keyProductList.Find( item.ComponentCode() ) >= 0,
                                             true ),
    //                             and ifexpr( isKeyProduct,
    //                                         keyProductList.Size() > 0 and keyProductList.Find( item.ComponentCode() ) >= 0,
    //                                         true )
                                 ,
                                 item.OrganCode() + "_" + item.ProductCode() + "_" + item.ProcessSection() );
    // æŒ‰routing及routingStep分组
    routingIds := selectuniquevalues( bomList, Elements, item, true, item.OrganCode() + "_" + item.ProductCode() );
@@ -56,7 +57,13 @@
                  
                }
                if( not isnull( inputStockingPoint)){
                  this.MappingOperationBOMDataRouting( routing,routingRows,inputStockingPoint,keyProductList);
                  if( isKeyProduct){
                      keyRows := selectset( routingRows,Elements,routingrow,keyProductList.Find( routingrow.ComponentCode())>=0);
                      this.MappingOperationBOMDataRouting( routing,keyRows);
                    }else{
                      this.MappingOperationBOMDataRouting( routing,routingRows);
                    }
                }
              }
           }
_Main/BL/Type_MacroPlan/Method_MappingOperationBOMDataRouting#576.qbl
@@ -2,9 +2,7 @@
#parent: #root
Method MappingOperationBOMDataRouting (
  Routing routing,
  MappingBOMs routingRows,
  StockingPoint_MP stockingPoint,
  Strings keyProductIds
  MappingBOMs routingRows
)
{
  TextBody:
@@ -32,6 +30,8 @@
                  if( not isnull( component ) ) {
    //                  error( "component : " + noAlterRow.ComponentCode() + " not found" );
                  // è¿žæŽ¥äº§å“ä¸Žoperation
                  inputStockingPointId := noAlterRow.OrganCode()  + "_" + noAlterRow.ComponentType() + "_Stock";
                  stockingPoint := StockingPoint_MP::FindStockingPointTypeIndex( inputStockingPointId);
                  pisp := ProductInStockingPoint_MP::CreateIfNotFound( component, stockingPoint );
                  trash := construct( OperationBOMs );
                  operationBOM := toLink.LinkProduct( component, true, BaseOperationLink::GetGroupID( toLink, true, false ), pisp, 
@@ -54,6 +54,8 @@
    //          }
                traverse( routingStep, Operation, toLink ) {
                    // è¿žæŽ¥äº§å“ä¸Žoperation
                    inputStockingPointId := firstAlterRow.OrganCode()  + "_" + firstAlterRow.ComponentType() + "_Stock";
                    stockingPoint := StockingPoint_MP::FindStockingPointTypeIndex( inputStockingPointId);
                    pisp := ProductInStockingPoint_MP::CreateIfNotFound( component, stockingPoint );
                    trash := construct( OperationBOMs );
                    mainBOM := toLink.LinkProduct( component, true, BaseOperationLink::GetGroupID( toLink, true, false ), pisp, 
@@ -67,13 +69,14 @@
                        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.ComponentType() + "_Stock";
                          stockingPointAlter := StockingPoint_MP::FindById( this, stockingPointIdAlter );
                          if( isnull( stockingPointAlter ) ) {
                              error( "stockingPoint : " + stockingPointIdAlter + " not found" );
                          }
                          pispAlter := ProductInStockingPoint_MP::CreateIfNotFound( alterProd, stockingPointAlter );
                          mainInput := toLink.LastOperationInput();
                          //mainInput := toLink.LastOperationInput();
                          mainInput := select( toLink,OperationInput,operationInut,operationInut.ProductID()=alterRow.ComponentCode());
                          trash := construct( OperationBOMs );
                          if( not isnull( mainInput ) ) {
                              alterBom := mainInput.Operation().LinkPISP( pispAlter, true, mainInput.OperationLinkGroupID(), trash );
_Main/BL/Type_MacroPlan/Method_MappingProductData.qbl
@@ -62,25 +62,25 @@
        productmajortype := "全部物料产品";
        }
       
      if( not item.ProductSubclassType() = "" ){
        Product_MP::CreateOrUpdate( this,
                                    item.ProductSubclassType(),
                                    productmajortype,
                                    item.ProductSubclassType(),
                                    "PCS",
                                    item.ProductSubclassType(),
                                    0.0,false,false
                                    );
        }
      productsubclasstype := item.ProductSubclassType();
      if( productsubclasstype="" ){
          productsubclasstype := productmajortype;
        }
    //  if( not item.ProductSubclassType() = "" ){
    //    Product_MP::CreateOrUpdate( this,
    //                                item.ProductSubclassType(),
    //                                productmajortype,
    //                                item.ProductSubclassType(),
    //                                "PCS",
    //                                item.ProductSubclassType(),
    //                                0.0,false,false
    //                                );
    //    }
    //  productsubclasstype := item.ProductSubclassType();
    //  if( productsubclasstype="" ){
    //      productsubclasstype := productmajortype;
    //    }
      
      if( not item.ID() = "" ){
          Product_MP::CreateOrUpdate( this, 
                                      item.ID(), 
                                      productsubclasstype,
                                      productmajortype,
                                      item.ID(), 
                                      item.UnitOfMeasureName(), 
                                      item.Name(),
_Main/BL/Type_MacroPlan/Method_MappingUnitData.qbl
@@ -22,6 +22,7 @@
    
    //Set the Default values
    unitofmeasurename := "PCS";
    infinite := "Infinite";
    capacitytype := "Transport quantity";
    
    // Get the root data
@@ -29,7 +30,7 @@
                          "天马集团", 
                          "天马集团", 
                          "", 
                          capacitytype,
                          infinite,
                          unitofmeasurename );
    
    // Get the sub root data
@@ -37,14 +38,14 @@
                          "生产", 
                          "生产", 
                          "天马集团", 
                          capacitytype,
                          infinite,
                          unitofmeasurename );
    
    Unit::CreateOrUpdate( this, 
                          "供应商", 
                          "供应商", 
                          "天马集团", 
                          capacitytype,
                          infinite,
                          unitofmeasurename );
    
    Unit::CreateOrUpdate( this, 
@@ -65,7 +66,7 @@
                            item.OrganCode(), 
                            OrgName, 
                            "生产", 
                            capacitytype,
                            infinite,
                            unitofmeasurename );
                           
      //Get the second level unit
@@ -74,7 +75,7 @@
                            secondlevelid, 
                            secondlevelid, 
                            item.OrganCode(), 
                            capacitytype,
                            infinite,
                            unitofmeasurename );
        
      //Get the third level unit
_Main/BL/Type_MacroPlan/StaticMethod_DoSync0.qbl
@@ -140,6 +140,9 @@
    // è®¢å•需求-18
    CustomerOrder::DoSync( macroPlan, businessTypes );
    
    //删除多余报错数据-19
    //macroPlan.DeleteSnaityCheck();
    //// todo ä¾›åº”商能力
    //info( "ProviderCapacity::DoSync" )