Quintiq file version 2.0 #parent: Panel647/btn_InitialData Response OnClick () id:Response_Panel647_btn_InitialData_OnClick { #keys: '[414724.0.93657952]' CanBindMultiple: false DefinitionID: 'Responsedef_WebButton_OnClick' Precondition: [* return not isnull( MacroPlan); *] QuillAction { Body: [* // 没有用的按钮和函数,只为了测试生成假数据。 StrCustoms:="XM_2023,小米;HW_2023,华为;OV_2023,VIVO;OP_2023,OPPO;HX_2023,海信;YJ_2023,一加;HE_2023,海尔;GL_2023,格力;"; ArrayCustom := StrCustoms.Tokenize( ";"); //8个客户 idx :=0; for( i:=0;i<20;i:=i+1) { idx :=Number::Random( 0,7); arrCustomInfo := ArrayCustom.Element( idx).Tokenize( ","); MacroPlan.H_Forecast(relnew, CustomName := arrCustomInfo.Element( 1),CustomCode := arrCustomInfo.Element( 0),ForecastQty := Number::Random( 100,5000), Department := "销售1部",NeedTime := Date::ActualDate(),OrderCode := H_FunctionClass::SM_GenerateID( "OF") ,SKU := "SKU-CP-2023-N"+(Number::Random( 1000,9999)).AsQUILL(),Util := "PCS"); } // 生成预测 实时数据,反签数据,授权数据(反签 授权默认为0,对自动创建,这里不再添加) traverse(MacroPlan,H_Forecast ,Obj,not isnull(Obj) ) { MacroPlan.H_OrderForecastRealQty(relnew,CustomID := Obj.CustomCode(),CustomName := Obj.CustomName(),ForecatsQty := Obj.ForecastQty(), ForecatsRealQty := Obj.ForecastQty(),ID := H_FunctionClass::SM_GenerateID( "OF"),Month := Date::ActualDate(), OrderCode := Obj.OrderCode(),SKU := Obj.SKU(),Unit := Obj.Util()); } *] GroupServerCalls: false } }