Fix some of enhanced format flags
C2016-008: Create an enhanced step if it is missing from a source
This commit is contained in:
parent
ac49c296cd
commit
3bcd01ce8d
Binary file not shown.
@ -863,7 +863,12 @@ namespace VEPROMS.CSLA.Library
|
||||
tmp = InsertEnhancedSmartTemplateSubStep(text, number, this, addType, (int)type, fromType, newSourceID);
|
||||
}
|
||||
else
|
||||
tmp = InsertEnhancedSmartTemplateSteps(text, number, this, addType, 20002, newSourceID);
|
||||
{
|
||||
// if 'type' is high level, use standard hls as type.
|
||||
// if 'type' is caution/note, use the base caution/note for 'type'
|
||||
int ltype = IsHigh ? 20002 : (IsNote ? 20007 : 20006);
|
||||
tmp = InsertEnhancedSmartTemplateSteps(text, number, this, addType, ltype, newSourceID);
|
||||
}
|
||||
if (tmp == null) return null;
|
||||
|
||||
// if next exists, it is updated in SQL so we have to manually force the iteminfo updates
|
||||
@ -1447,6 +1452,67 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
RefreshConfig();
|
||||
}
|
||||
public ItemInfo DoAddMissingEnhancedSteps(int enhtype)
|
||||
{
|
||||
// from this step, need to find an insertion point in the enhanced procedure/section. Look for a step that has enhanced
|
||||
// links in its config: first go through previous steps, then if none found in previous go through next, if none found
|
||||
// go to parent
|
||||
ItemInfo newEnh = null;
|
||||
// look through pervious first:
|
||||
ItemInfo iiCur = this.MyPrevious;
|
||||
EAddpingPart addtype = EAddpingPart.After;
|
||||
while (iiCur != null && newEnh == null)
|
||||
{
|
||||
foreach (EnhancedDocument edSource in iiCur.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edSource.Type == enhtype) // found one to use:
|
||||
{
|
||||
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID);
|
||||
}
|
||||
}
|
||||
iiCur = iiCur.MyPrevious;
|
||||
}
|
||||
|
||||
// no previous have enhanced links. now go through next:
|
||||
ItemInfo iiNxt = this.GetNextItem();
|
||||
addtype = EAddpingPart.Before;
|
||||
while (iiNxt != null && newEnh == null)
|
||||
{
|
||||
foreach (EnhancedDocument edSource in iiNxt.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edSource.Type == enhtype) // found one to use:
|
||||
{
|
||||
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID);
|
||||
}
|
||||
}
|
||||
iiNxt = iiNxt.GetNextItem();
|
||||
}
|
||||
|
||||
// no next either, try the parent.
|
||||
ItemInfo iiPar = this.MyParent;
|
||||
addtype = EAddpingPart.Child;
|
||||
while (iiPar != null && !iiPar.IsProcedure && newEnh == null)
|
||||
{
|
||||
foreach (EnhancedDocument edSource in iiPar.GetMyEnhancedDocuments())
|
||||
{
|
||||
if (edSource.Type == enhtype) // found one to use:
|
||||
{
|
||||
ItemInfo exEnh = ItemInfo.Get(edSource.ItemID);
|
||||
newEnh = exEnh.InsertEnhancedSteps(MyContent.Text, null, addtype, MyContent.Type, edSource.Type, this.ItemID);
|
||||
}
|
||||
}
|
||||
iiPar = iiPar.MyParent;
|
||||
}
|
||||
if (newEnh != null)
|
||||
{
|
||||
StepConfig sc = new StepConfig(MyContent.Config);
|
||||
sc.AddEnhancedDocument(enhtype, newEnh.ItemID);
|
||||
SaveConfig(sc.ToString());
|
||||
}
|
||||
return newEnh;
|
||||
}
|
||||
#endregion
|
||||
#region DataPortal
|
||||
private void DataPortal_Fetch(PastingPartCriteria criteria)
|
||||
|
@ -1399,6 +1399,33 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
public void AddMissingEnhancedStep(ItemInfo ii, int EnhType)
|
||||
{
|
||||
// if the missing enhanced step is a cuation or note, check that parent HLS has the needed
|
||||
// enhanced step to insert the caution/note from. If not, do a message.
|
||||
if (ii.IsCaution || ii.IsNote)
|
||||
{
|
||||
bool canMakeMissingStep = false;
|
||||
StepConfig sc = ii.MyHLS.MyConfig as StepConfig;
|
||||
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
|
||||
{
|
||||
if (EnhType == ed.Type) // the hls has an enhanced linked step of this type, the caution/note can be made:
|
||||
{
|
||||
canMakeMissingStep = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!canMakeMissingStep)
|
||||
{
|
||||
MessageBox.Show("Cannot create the missing enhanced step, the Enhanced Step for the High Level step must be created first.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
ItemInfo newEnh = ii.DoAddMissingEnhancedSteps(EnhType);
|
||||
// if enhanced items were created, then see if they need displayed:
|
||||
if (newEnh != null) AddAllEnhancedItemsToDisplay(MyItemInfo);
|
||||
SetFocus();
|
||||
}
|
||||
private string GetChangeId(ItemInfo iiDest)
|
||||
{
|
||||
// get the change id for the destination's procedure's change id.
|
||||
|
Loading…
x
Reference in New Issue
Block a user