xiaoding721
2024-09-12 5655862ec81022848c46d1862404f077b919f9fa
添加新增Forecast的时候可以使用Curve拆分的功能
已修改6个文件
已添加7个文件
201 ■■■■■ 文件已修改
_Main/BL/Type_Archive/StaticMethod_GenerateForecast.qbl 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Archive/StaticMethod_Success.qbl 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Forecast/StaticMethod_SplitUsingCurve.qbl 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Component_PanelCurve.def 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Component_PanelGeneral.def 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Component_PanelOrigin.def 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Component_pnlActions.def 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Response_MacroPlanner_PanelCurve_DropDownStringListCurve_OnCreated.def 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Response_MacroPlanner_pnlActions_bSplitUsingCurve_OnClick.def 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/_ROOT_Component_DialogCreateEditForecast.def 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormForecasts/Component_ListSalesDemands.def 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormForecasts/Component_listContextMenuSD.def 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/UI/MacroPlannerWebApp/Component_FormForecasts/Response_ListSalesDemands_MenuCreate_OnClick#715.def 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
_Main/BL/Type_Archive/StaticMethod_GenerateForecast.qbl
@@ -2,13 +2,16 @@
#parent: #root
StaticMethod GenerateForecast (
  ArchiveExecutionStatus archiveExecutionStatus,
  MacroPlan macroPlan
  MacroPlan macroPlan,
  Boolean isClearForecast
)
{
  TextBody:
  [*
    traverse ( macroPlan, SalesDemand.astype( Forecast ), f ) {
      f.Delete();
    if( isClearForecast ){
      traverse ( macroPlan, SalesDemand.astype( Forecast ), f ) {
        f.Delete();
      }
    }
    
    productMPs := selectset( macroPlan,Product_MP,prod,not prod.IsSystem() );
_Main/BL/Type_Archive/StaticMethod_Success.qbl
@@ -17,7 +17,7 @@
      archiveExecutionStatus.AES_TemporaryDemandData().Execute();
      
      // ç”ŸæˆForecast
      Archive::GenerateForecast( archiveExecutionStatus, macroPlan );
      Archive::GenerateForecast( archiveExecutionStatus, macroPlan ,true );
      
      // æ¸…空临时数据库
      archiveExecutionStatus.AES_TemporaryDemandData().Source().FlatQuery( "truncate table A_Forecasts" );
_Main/BL/Type_Forecast/StaticMethod_SplitUsingCurve.qbl
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
Quintiq file version 2.0
#parent: #root
StaticMethod SplitUsingCurve (
  SalesSegment_MP salesSegment,
  Product_MP product,
  StockingPoint_MP stockingPoint,
  Date startDate,
  Date endDate,
  Real quantity,
  String curve,
  const Archive archive,
  ArchiveExecutionStatus archiveExecutionStatus
)
{
  TextBody:
  [*
    // Akari Sep-11-2024 (created)
    // è¯·æ±‚参数
    macroPlan := salesSegment.MacroPlan();
    ac := select( archive, ArchiveCurve, tempAC, true );
    json          := JSON::Object()
                     .Add( "salesSegment", salesSegment.Name() )
                     .Add( "productID", product.ID() )
                     .Add( "stockingPointID", stockingPoint.ID() )
                     .Add( "startDate", startDate.Format( "Y-M2-D2") )
                     .Add( "endDate", endDate.Format( "Y-M2-D2") )
                     .Add( "quantity", quantity )
                     .Add( "curve", curve )
                     .Add( "pathCurve", ac.FilePath() ).Build().AsString();
    // è°ƒç”¨æŽ¥å£
    url := "/IDSPPACurve/ImportCurveIncremental";
    i := HTTPInterface::Create( archive.JavaInterfaceAddress(), archive.JavaInterfacePort() );
    i.URL( url );
    i.PostMethod( true );
    i.MediaType( "application/json" );
    i.TimeOut( Duration::Minutes( 5 ) );
    i.Call( json );
    htmlresult := i.Result();
    respJSON   := JSON::Parse( htmlresult );
    code    := respJSON.Get( "code" ).GetNumber();
    message := respJSON.Get( "message" ).GetString();
    if( code = 200 ){
        // èŽ·å–éœ€æ±‚
      archiveExecutionStatus.AES_TemporaryDemandData().Execute();
      // ç”ŸæˆForecast
      Archive::GenerateForecast( archiveExecutionStatus, macroPlan ,false );
      // æ¸…空临时数据库
      archiveExecutionStatus.AES_TemporaryDemandData().Source().FlatQuery( "truncate table A_Forecasts" );
    }else{
      error( message );
    }
  *]
}
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Component_PanelCurve.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
Quintiq file version 2.0
Component PanelCurve
{
  #keys: '[414996.1.77261280]'
  BaseType: 'WebPanel'
  Children:
  [
    Component DropDownStringListCurve
    {
      #keys: '[414996.1.79651031]'
      BaseType: 'WebDropDownStringList'
      Properties:
      [
        Label: 'Curve'
        Taborder: 0
      ]
    }
  ]
  Properties:
  [
    Taborder: 9
    Visible: false
  ]
}
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Component_PanelGeneral.def
@@ -4,5 +4,6 @@
  Children:
  [
    #child: PanelOrigin
    #child: PanelCurve
  ]
}
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Component_PanelOrigin.def
@@ -21,6 +21,7 @@
  ]
  Properties:
  [
    FixedSize: true
    Taborder: 8
  ]
}
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Component_pnlActions.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
Quintiq file version 2.0
Component pnlActions #extension
{
  Children:
  [
    Component btnOk #extension
    {
      Properties:
      [
        Taborder: 1
      ]
    }
    Component btnCancel #extension
    {
      Properties:
      [
        Taborder: 2
      ]
    }
    Component bSplitUsingCurve
    {
      #keys: '[414996.1.79889444]'
      BaseType: 'WebButton'
      Properties:
      [
        Label: 'Split using Curve'
        Taborder: 0
        Visible: false
      ]
    }
  ]
}
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Response_MacroPlanner_PanelCurve_DropDownStringListCurve_OnCreated.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
Quintiq file version 2.0
#parent: PanelCurve/DropDownStringListCurve
Response OnCreated () id:Response_MacroPlanner_PanelCurve_DropDownStringListCurve_OnCreated
{
  #keys: '[414996.1.77271766]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebComponent_OnCreated'
  GroupServerCalls: true
  QuillAction
  {
    Body:
    [*
      curves := selectuniquevalues( MacroPlan,SixDigitCode,code,code.Curve());
      this.Strings( curves.Concatenate( ";"));
    *]
  }
}
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/Response_MacroPlanner_pnlActions_bSplitUsingCurve_OnClick.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
Quintiq file version 2.0
#parent: pnlActions/bSplitUsingCurve
Response OnClick () id:Response_MacroPlanner_pnlActions_bSplitUsingCurve_OnClick
{
  #keys: '[414996.1.77291489]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebButton_OnClick'
  GroupServerCalls: true
  QuillAction
  {
    Body:
    [*
      Forecast::SplitUsingCurve( DropDownListSalesSegment.Data(),
                                 DropDownListProduct.Data(),
                                 DropDownListStockingPoint.Data(),
                                 DateSelectorStart.Date(),
                                 DateSelectorEnd.Date(),
                                 [Real]EditFieldQuantityUom.Text(),
                                 DropDownStringListCurve.Text(),
                                 Archive,
                                 ArchiveExecutionStatus );
      WebMessageBox::Success( "Success" );
      Form.Close();
    *]
  }
}
_Main/UI/MacroPlannerWebApp/Component_DialogCreateEditForecast/_ROOT_Component_DialogCreateEditForecast.def
@@ -6,5 +6,6 @@
  Children:
  [
    #child: pnlContent
    #child: pnlActions
  ]
}
_Main/UI/MacroPlannerWebApp/Component_FormForecasts/Component_ListSalesDemands.def
@@ -5,6 +5,10 @@
  [
    Component DataSetLevelSalesDemands #extension
    {
      Children:
      [
        #child: listContextMenuSD
      ]
      Properties:
      [
        Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeAllConstraint","columnid":"All constraints","title":"All constraints","subtotals":"","tooltip":"","width":1,"display":"shown"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ImgNotLinkedToPeriod","title":"ImgNotLinkedToPeriod","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ImgNotLinkedToPeriod"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"ImgIsPostponed","title":"ImgIsPostponed","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"ImgIsPostponed"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StockingPoint_MP.ID","title":"Stocking point","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"StockingPoint_MP.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"SalesSegment_MP.Name","title":"Sales segment","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"SalesSegment_MP.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Product_MP.ID","title":"Product","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"Product_MP.ID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"Start","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"End","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"UnitOfMeasure_MP.Name","title":"Quantity UoM","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"UnitOfMeasure_MP.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Quantity","title":"Original Qty","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Quantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"NettedQuantity","title":"Quantity","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"NettedQuantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"FulfilledQuantity","title":"Fulfilled","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"FulfilledQuantity"}},{"attribute":{"classtype":"WebApiDefinitionAttributeChart","columnid":"Fulfillment Illustration","title":"Fulfillment","subtotals":"","tooltip":"","width":-1,"display":"shown","type":"stackbar","relative":true,"attributes":[{"name":"Fulfilled demand","color":"rgb(87,184,71)","expression":{"classtype":"WebApiDefinitionAttributeExpression","columnid":"Fulfillment","title":"Fulfilled demand","subtotals":"","tooltip":"","width":-1,"display":"shown","expressionbody":"object.FulfilledQuantity().Round(2)"}},{"name":"Unfulfilled demand","color":"rgb(232,123,0)","expression":{"classtype":"WebApiDefinitionAttributeExpression","columnid":"Unfulfilled demand","title":"Unfulfilled demand","subtotals":"","tooltip":"","width":-1,"display":"shown","expressionbody":"maxvalue(object.NettedQuantity()-object.FulfilledQuantity(),0.0).Round(2)"}}]}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Price","title":"Price","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Price"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"PriceUoM","title":"PriceUoM","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"PriceUoM"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Priority.Name","title":"Priority","subtotals":"","tooltip":"","width":-1,"display":"shown","attribute":"Priority.Name"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"DemandUncertaintyPercentage","title":"Uncertainty","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"DemandUncertaintyPercentage"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Origin","title":"Origin","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Origin"}}]'
_Main/UI/MacroPlannerWebApp/Component_FormForecasts/Component_listContextMenuSD.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,4 @@
Quintiq file version 2.0
Component listContextMenuSD #extension
{
}
_Main/UI/MacroPlannerWebApp/Component_FormForecasts/Response_ListSalesDemands_MenuCreate_OnClick#715.def
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
Quintiq file version 2.0
#parent: ListSalesDemands
Response OnClick () inherited id:Response_ListSalesDemands_MenuCreate_OnClick_715 #extension
{
  QuillAction #extension
  {
    Body:
    [*
      //Create new sales demand
      dlg := construct( DialogCreateEditForecast );
      dlg.New();
      dlg.bSplitUsingCurve().Visible( true );
      dlg.PanelCurve().Visible( true );
    *]
  }
}