lazhen
2024-08-15 ea1c035b2abbbf99b05eb95ccc5293b8490412cf
_Main/BL/Type_MachiningPipelineSource0/StaticMethod_Initialize.qbl
@@ -76,8 +76,6 @@
              if( iscc or isdl ){
                row.SetCellInventoryValue( daycolumn, iscc, [Real]inventoryquantity );
                if( weekcolumn.EndDate() = pispip.Start().Date() or pispip.Period_MP() = endperiod ){
    //            if( pispip.Start() = weekstart + Duration::Days( 6 ) or pispip.Period_MP() = endperiod ){
    //              weekstart      := ( weekstart + Duration::Days( 7 ) ).Date();
                  row.SetCellInventoryValue( weekcolumn, iscc, [Real]inventoryquantity );
                }
              }
@@ -88,25 +86,33 @@
    }
    
    //生成调拨数据
    traverse( owner, TransferPlanRow, tprow, ( tprow.SourceStockpoingPointID() = 'CC' and tprow.TargetStockpoingPointID() = 'DL' ) or ( tprow.SourceStockpoingPointID() = 'DL' and tprow.TargetStockpoingPointID() = 'CC' ) ){
      row := selectobject( table, Row, row, row.Name() = tprow.Name() );
      traverse( table, Column, column ){
        cell := selectobject( row, Cell, cell, cell.Column() = column );
        if( column.TimeUnit() = Translations::MP_GlobalParameters_Day() ){
          tpcell := selectobject( tprow, TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() = column.StartDate() );
          if( tprow.SourceStockpoingPointID() = 'CC' and tprow.TargetStockpoingPointID() = 'DL' ){
            cell.CCTransferQty( [Real]tpcell.Value() );
          }else if( tprow.SourceStockpoingPointID() = 'DL' and tprow.TargetStockpoingPointID() = 'CC' ){
            cell.DLTransferQty( [Real]tpcell.Value() );
          }
        }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Week() ){
          period := column.StartDate() + Duration::Days( 6 );
          tpcell := selectobject( tprow, TransferPlanCell, tpcell, tpcell.TransferPlanColumn().ColumnDate() = period.Date() );
          if( tprow.SourceStockpoingPointID() = 'CC' and tprow.TargetStockpoingPointID() = 'DL' ){
            cell.CCTransferQty( [Real]tpcell.Value() );
          }else if( tprow.SourceStockpoingPointID() = 'DL' and tprow.TargetStockpoingPointID() = 'CC' ){
            cell.DLTransferQty( [Real]tpcell.Value() );
    traverse( owner, TransferPlanRow, tprow ){
      product               := selectobject( owner, Product_MP, product, product.ID() = tprow.ProductID() );
      productparents        := product.GetAllParent();
      if( exists( productparents, Elements, e, e.ID() = productparent ) ){//查询产品类型是发动机
        //起始库存点是否是大连or长春
        originsp              := selectobject( owner, StockingPoint_MP, sp, sp.ID() = tprow.SourceStockpoingPointID() );
        originunit            := originsp.Unit();
        originparentunits     := originunit.GetAllParent();
        originiscc            := originsp.ID() = ccunit or originunit.ID() = ccunit or exists( originparentunits, Elements, punit, punit.ID() = ccunit );
        originisdl            := originsp.ID() = dlunit or originunit.ID() = dlunit or exists( originparentunits, Elements, punit, punit.ID() = dlunit );
        //目的地是否是长春外租库
        destisp               := selectobject( owner, StockingPoint_MP, sp, sp.ID() = tprow.TargetStockpoingPointID() );
        destiunit             := originsp.Unit();
        destiparentunits      := destiunit.GetAllParent();
        destiiscc             := destisp.ID() = ccunit or destiunit.ID() = ccunit or exists( destiparentunits, Elements, punit, punit.ID() = ccunit );
        destiisdl             := destisp.ID() = dlunit or destiunit.ID() = dlunit or exists( destiparentunits, Elements, punit, punit.ID() = dlunit );
        if( ( originiscc and destiisdl ) or ( originisdl and destiiscc ) ){
          row := selectobject( table, Row, row, row.Name() = tprow.Name() );
          traverse( tprow, TransferPlanCell, tpcell ){
            //天
            daycolumn        := table.GetColumnByUnit( Translations::MP_GlobalParameters_Day(), tpcell.TransferPlanColumn().ColumnDate() );
            //周
            weekcolumn       := table.GetColumnByUnit( Translations::MP_GlobalParameters_Week(), tpcell.TransferPlanColumn().ColumnDate() );
            quantity         := [Real]tpcell.Value();//四舍五入
            row.SetCellTransferValue( daycolumn, ( originiscc and destiisdl ), quantity );
            row.SetCellTransferValue( weekcolumn, ( originiscc and destiisdl ), quantity );
          }
        }
      }