B2021-143 leading zeros in revision numbers were being removed when the auto increment was used.
This commit is contained in:
		@@ -636,7 +636,12 @@ namespace VEPROMS
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			bool rv = true;
 | 
								bool rv = true;
 | 
				
			||||||
			if (Regex.IsMatch(ap.RevNumber, "^[0-9]+$"))
 | 
								if (Regex.IsMatch(ap.RevNumber, "^[0-9]+$"))
 | 
				
			||||||
				ap.RevNumber = (int.Parse(ap.RevNumber) + 1).ToString();
 | 
								{
 | 
				
			||||||
 | 
									// B2021-143 build a string format that will put leading zeros if the rev number (integer) has less digits than the initial rev string length
 | 
				
			||||||
 | 
									string preZerosRevFmt = string.Format("D{0}", ap.RevNumber.Length);
 | 
				
			||||||
 | 
									int revNum = int.Parse(ap.RevNumber) + 1;
 | 
				
			||||||
 | 
										ap.RevNumber = revNum.ToString(preZerosRevFmt);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			else if (Regex.IsMatch(ap.RevNumber, "^[0-9]*[a-yA-Y]+$"))
 | 
								else if (Regex.IsMatch(ap.RevNumber, "^[0-9]*[a-yA-Y]+$"))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				char lastCar = ap.RevNumber[ap.RevNumber.Length - 1];
 | 
									char lastCar = ap.RevNumber[ap.RevNumber.Length - 1];
 | 
				
			||||||
@@ -650,10 +655,9 @@ namespace VEPROMS
 | 
				
			|||||||
				string[] parts = ap.RevNumber.Split(".".ToCharArray());
 | 
									string[] parts = ap.RevNumber.Split(".".ToCharArray());
 | 
				
			||||||
				string sep = "";
 | 
									string sep = "";
 | 
				
			||||||
				string lastPart = parts[parts.Length - 1];
 | 
									string lastPart = parts[parts.Length - 1];
 | 
				
			||||||
				int w = lastPart.Length;
 | 
									// B2021-143 build a string format that will put leading zeros if the rev number (integer) has less digits than the initial rev string length
 | 
				
			||||||
				lastPart = (int.Parse(lastPart) + 1).ToString();
 | 
									string preZerosRevFmt = string.Format("D{0}", lastPart.Length);
 | 
				
			||||||
				//if(w > lastPart.Length)
 | 
									lastPart = (int.Parse(lastPart) + 1).ToString(preZerosRevFmt);
 | 
				
			||||||
					lastPart = lastPart.PadLeft(w, '0');
 | 
					 | 
				
			||||||
				parts[parts.Length - 1] = lastPart;
 | 
									parts[parts.Length - 1] = lastPart;
 | 
				
			||||||
				StringBuilder sb = new StringBuilder();
 | 
									StringBuilder sb = new StringBuilder();
 | 
				
			||||||
				foreach (string part in parts)
 | 
									foreach (string part in parts)
 | 
				
			||||||
@@ -664,7 +668,7 @@ namespace VEPROMS
 | 
				
			|||||||
				ap.RevNumber = sb.ToString();
 | 
									ap.RevNumber = sb.ToString();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if (Regex.IsMatch(ap.RevNumber, "[?]$"))
 | 
								else if (Regex.IsMatch(ap.RevNumber, "[?]$"))
 | 
				
			||||||
				rv = false;	//do nothing
 | 
									rv = false; //do nothing
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				ap.RevNumber += " ?";
 | 
									ap.RevNumber += " ?";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user