有什么办法可以在分配日期之前修改SLA DateTime吗?

时间:2016-07-29 03:14:58

标签: customization acumatica

正如我上面在CaseScrren(screenID:CR306000)上提出的问题,它是默认值,它按创建案例的日期时间设置SLA Datetime。 例如:案例1创建于01/01/2016 09:58 AM,严重性:H表示3Days,因此SLA日期时间应为01/03/2016 09:58 AM。但案例1我于01/02/2016 09:58 AM分配给了所有者。我刚刚添加了新的字段名称:Test SLA

 [PXDBDate(PreserveTime = true, DisplayMask = "g")]
 [PXUIField(DisplayName="Test SLA")]
 [PXFormula(typeof(Default<CRCase.contractID, CRCase.severity, CRCase.caseClassID>))]


 protected void CRCase_UsrTestSLA_FieldDefaulting(PXCache cache, PXFieldDefaultingEventArgs e)
 {

       CR.CRCase row = e.Row as CR.CRCase;
       if (row == null || row.AssignDate == null) return;

       if (row.ClassID != null && row.Severity != null)
       {
         CR.CRClassSeverityTime severity = PXSelect<CR.CRClassSeverityTime,
                                      Where<CR.CRClassSeverityTime.caseClassID, Equal<Required<CR.CRClassSeverityTime.caseClassID>>,
                                      And<CR.CRClassSeverityTime.severity, Equal<Required<CR.CRClassSeverityTime.severity>>>>>
                                      .Select(Base,row.ClassID,row.Severity);
         if (severity != null && severity.TimeReaction != null)
         {
           e.NewValue = ((DateTime)row.AssignDate).AddMinutes((int)severity.TimeReaction);
           e.Cancel = true;
         }
       }

       if (row.Severity != null && row.ContractID != null)
       {
          Contract template = PXSelect<Contract, Where<Contract.contractID, Equal<Required<CRCase.contractID>>>>
                        .Select(Base, row.ContractID);
          if (template == null) return;

          ContractSLAMapping sla = PXSelect<ContractSLAMapping,
                             Where<ContractSLAMapping.severity, Equal<Required<CRCase.severity>>,
                             And<ContractSLAMapping.contractID, Equal<Required<CRCase.contractID>>>>>
                             .Select(Base, row.Severity, template.TemplateID);
          if (sla != null && sla.Period != null)
          {
            e.NewValue = ((DateTime)row.AssignDate).AddMinutes((int)sla.Period);
            e.Cancel = true;
          }
       }

}

0 个答案:

没有答案