_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;