Quintiq file version 2.0
#parent: pl_splite_info/btn_splite_add
Response OnClick () id:Response_pl_splite_info_btn_splite_add_OnClick
{
  #keys: '[414724.0.292801656]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebButton_OnClick'
  Precondition:
  [*
    return not isnull( dh_Paramer_FCOS.Data());
  *]
  QuillAction
  {
    Body:
    [*
      // 拆分一个订单
      SQty:=[Number]np_Qty_FCOS.Number().Round( 0);
      if(SQty>0)
      {
        OrderInfo :=dh_Paramer_FCOS.Data();
        MacroPlan.S_DT_SpliteStruct(relnew,ID := H_FunctionClass::SM_GenerateID( "OSR")
                                            ,OrderID := OrderInfo.OrderID()
                                            ,ID_S_DT_CustomOrder := OrderInfo.ID()
                                            ,SpliteReason := ef_SpliteReason_FCOS.Text()
                                            ,Qty :=SQty
                                            ,Status := 1
                                            ,ForecastDate:= ds_ForcastDate_FCOS.Date());
        // 计算剩余拆分
        LQty:= OrderInfo.Quantity()-sum(MacroPlan,S_DT_SpliteStruct,obj,obj.ID_S_DT_CustomOrder()=OrderInfo.ID() and obj.Status()=1,obj.Qty()) ;
        np_Qty_FCOS.Max(LQty);
        np_Qty_FCOS.Number(LQty);
        if( np_Qty_FCOS.Max()=0)
        {
         WebMessageBox::Information( "订单已经全部拆完！");  
        }
      }
      else
      {
        if( np_Qty_FCOS.Max()=0)
        {
         WebMessageBox::Information( "订单已经全部拆完！");  
        }
        else
        {
          WebMessageBox::Information( "请调整 订单数量");  
        }
      }
    *]
    GroupServerCalls: false
  }
}
