Merged PR 34240: Updates to PCR3 document section

Updates to PCR3 document section
This commit is contained in:
Tucker Chase (CSC FI SPS MESLEO) 2025-01-15 16:52:17 +01:00 committed by Phares Mike (CSC FI SPS MESLEO)
parent b99b721458
commit 123bbdb9fe
8 changed files with 64 additions and 63 deletions

View File

@ -48,60 +48,27 @@ public class ChangeControlController : Controller {
}
public ActionResult Edit(int issueID) {
int isITARCompliant = 1;
ChangeControlViewModel cc = new ChangeControlViewModel();
cc = ccDMO.GetChangeControlRead(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
string jwt = Session["JWT"].ToString();
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
string refreshToken = Session["RefreshToken"].ToString();
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
List<ApproversListViewModel> userList = MiscDMO.GetApproversListByDocument(cc.PlanNumber, cc.CurrentStep, (int)GlobalVars.DocumentType.ChangeControl);
ApproversListViewModel appUser = userList.Find(delegate (ApproversListViewModel al) { return al.UserID == (int)Session[GlobalVars.SESSION_USERID]; });
if (appUser != null) {
ViewBag.IsApprover = "true";
}
// TODO locked functionality
if (isITARCompliant == 0) // not ITAR Compliant
{
return View("UnAuthorizedAccess");
} else {
if ((int)Session[GlobalVars.SESSION_USERID] == cc.OwnerID)
ViewBag.IsOriginator = "true";
else
ViewBag.IsOriginator = "false";
if ((cc.RecordLockIndicator && cc.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID]) ||
cc.ClosedDate != null) {
return RedirectToAction("ReadOnlyCC", new { issueID = issueID });
} else {
cc = ccDMO.GetChangeControl(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
ViewBag.Attendees = ccDMO.GetUsers();
ViewBag.Generations = ccDMO.GetGenerations();
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
ViewBag.Processes = ccDMO.GetProcesses();
ViewBag.Logistics = ccDMO.GetLogistics();
ViewBag.AIResponsibles = ccDMO.GetActionItemResponsible();
ViewBag.Sites = ccDMO.GetSites();
return View(cc);
}
}
return Redirect(mrbUrl);
}
public ActionResult ReadOnlyCC(int issueID) {
int isITARCompliant = 1;
ChangeControlViewModel cc = new ChangeControlViewModel();
cc = ccDMO.GetChangeControlRead(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
// TODO locked functionality
string jwt = Session["JWT"].ToString();
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
string refreshToken = Session["RefreshToken"].ToString();
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
if (isITARCompliant == 0) // not ITAR Compliant
{
return View("UnAuthorizedAccess");
} else {
ViewBag.MeetingList = ccDMO.GetMeetingList(issueID);
ViewBag.Generations = ccDMO.GetGenerations();
ViewBag.PartNumbers = ccDMO.GetPartNumbers();
ViewBag.Processes = ccDMO.GetProcesses();
ViewBag.Logistics = ccDMO.GetLogistics();
return View(cc);
}
return Redirect(mrbUrl);
}
[HttpPost]

View File

@ -92,15 +92,15 @@
"https://localhost:7255";
string mrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/mrb/new";
<li><a href="@mrbUrl">Create MRB</a></li>
@*string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/pcrb/new";
<li><a href="@pcrbUrl">Create PCRB</a></li>*@
string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/pcrb/new";
<li><a href="@pcrbUrl">Create PCRB</a></li>
} else {
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
string mrbUrl = wasmClientUrl + "/redirect?redirectPath=/mrb/new";
<li><a href="@mrbUrl">Create MRB</a></li>
@*string pcrbUrl = wasmClientUrl + "/redirect?redirectPath=/pcrb/new";
<li><a href="@pcrbUrl">Create PCRB</a></li>*@
string pcrbUrl = wasmClientUrl + "/redirect?redirectPath=/pcrb/new";
<li><a href="@pcrbUrl">Create PCRB</a></li>
}
@*<li><a href=@Url.Action("CreateWorkRequest", "LotTraveler")>Create Special Work Request</a></li>*@
@*<li><a href=@Url.Action("Create", "ChangeControl")>Create PCR</a></li>*@
@ -152,8 +152,8 @@
"https://localhost:7255";
string mrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/mrb/all";
menu.Add().Text("MRB").Url(mrbUrl);
//string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/pcrb/all";
//menu.Add().Text("PCRB").Url(pcrbUrl);
string pcrbUrl = wasmClientUrl + "/redirect?jwt=" + encodedJwt + "&refreshToken=" + encodedRefreshToken + "&redirectPath=/pcrb/all";
menu.Add().Text("PCRB").Url(pcrbUrl);
//menu.Add().Text("Special Work Requests").Action("SpecialWorkRequestList", "Home");
//menu.Add().Text("PCRB").Action("ChangeControlList", "Home");
//menu.Add().Text("MRB").Action("MRBList", "Home");

View File

@ -30,4 +30,11 @@
<ProjectReference Include="..\MesaFabApproval.Shared\MesaFabApproval.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\appsettings.Development.json">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -19,6 +19,7 @@
@bind-Value="@document.DocNumbers"
@bind-Text="@document.DocNumbers"
Immediate
Required
AutoGrow
AutoFocus />
@if (DocNumberIsNA()) {
@ -49,8 +50,8 @@
</MudPaper>
</DialogContent>
<DialogActions>
@if ((DocNumberIsNA() && !string.IsNullOrWhiteSpace(document.Comment)) ||
(!DocNumberIsNA() && ecnNoIsValid)) {
@if (!string.IsNullOrWhiteSpace(document.DocNumbers) && ((DocNumberIsNA() && !string.IsNullOrWhiteSpace(document.Comment)) ||
(!DocNumberIsNA() && ecnNoIsValid))) {
<MudButton Variant="Variant.Filled"
Color="Color.Tertiary"
Class="m1-auto"
@ -111,6 +112,10 @@
document.CompletedDate = DateTime.Now;
}
if (string.IsNullOrWhiteSpace(document.DocNumbers)) {
throw new Exception("Document Numbers cannot be empty");
}
if (!DocNumberIsNA() && !ecnNoIsValid)
throw new Exception($"{document.ECNNumber} is not a valid ECN#");
if (DocNumberIsNA() && string.IsNullOrWhiteSpace(document.Comment))
@ -135,7 +140,9 @@
private bool DocNumberIsNA() {
if (document.DocNumbers.ToLower().Equals("na") ||
document.DocNumbers.ToLower().Equals("n/a")) {
document.DocNumbers.ToLower().Equals("n/a") ||
document.DocNumbers.ToLower().Equals("n a") ||
document.DocNumbers.ToLower().Equals("not applicable")) {
return true;
}
return false;

View File

@ -236,13 +236,14 @@
int currentStagePendingActionItemCount = currentStageActionItems.Where(a => a.ClosedStatus == false).Count();
bool allActionItemsComplete = current_i < 3 || actionItems.Where(a => a.ClosedStatus == false).Count() == 0;
bool actionItemsAreComplete = actionItems.Where(a => a.ClosedStatus == false).Count() == 0;
bool attachmentsMissing = currentStageAttachments.Count() == 0;
bool actionItemsIncomplete = current_i < 3 && currentStagePendingActionItemCount > 0;
bool affectedDocumentsIncomplete = current_i == 3 && pcr3Documents.Where(d => d.CompletedByID <= 0).Count() > 0;
bool approvalsIncomplete = currentStageApprovals.Count() > 0 && currentStagePendingApprovalsCount > 0;
<MudExpansionPanel Expanded="@(previousStageSubmitted && (attachmentsMissing || actionItemsIncomplete ||
<MudExpansionPanel Class="m-2" Expanded="@(previousStageSubmitted && (attachmentsMissing || actionItemsIncomplete ||
affectedDocumentsIncomplete || !currentStageSubmitted || approvalsIncomplete))">
<TitleContent>
<MudText Typo="Typo.h4" Align="Align.Center">@($"PCR {current_i}")</MudText>
@ -495,7 +496,17 @@
<MudTd DataLabel="Document Type">@context.DocType</MudTd>
<MudTd DataLabel="Document Numbers">@context.DocNumbers</MudTd>
<MudTd DataLabel="Comments">@context.Comment</MudTd>
<MudTd DataLabel="ECN#">@context.GetEcnNumberString()</MudTd>
<MudTd DataLabel="ECN#">
@if (string.IsNullOrWhiteSpace(context.GetEcnNumberString())) {
context.GetEcnNumberString();
} else {
<MudLink
Href=@($"{config["OldFabApprovalUrl"]}/ECN/Edit?IssueID={context.GetEcnNumberString()}")
Target="_blank">
@context.GetEcnNumberString()
</MudLink>
}
</MudTd>
<MudTd DataLabel="Closed Date">@(DateTimeUtilities.GetDateAsStringMaxDefault(context.CompletedDate))</MudTd>
<MudTd DataLabel="Closed By">
@(context.CompletedBy is null ? string.Empty : context.CompletedBy.GetFullName())
@ -568,6 +579,11 @@
<MudDivider DividerType="DividerType.Middle" Class="my-1" />
<MudText Typo="Typo.h5" Align="Align.Center">Approvers</MudText>
@if (!actionItemsAreComplete && current_i == 3) {
<MudText Align="Align.Center" Color="Color.Secondary" Typo="Typo.subtitle1">
All actions must be completed before PCR3 is submitted for approval
</MudText>
}
<MudTable Items="@approvals.Where(a => a.Step == current_i).OrderBy(a => a.CompletedDate)"
Class="m-2"
Striped="true"

View File

@ -0,0 +1,4 @@
{
"OldFabApprovalUrl": "https://mesaapproval-test.mes.infineon.com",
"FabApprovalApiBaseUrl": "https://mesaapproval-test.mes.infineon.com:7114"
}

View File

@ -1,4 +1,4 @@
{
"OldFabApprovalUrl": "https://mesaapproval-test.mes.infineon.com",
"FabApprovalApiBaseUrl": "https://mesaapproval-test.mes.infineon.com:7114"
"OldFabApprovalUrl": "https://mesaapproval.mes.infineon.com",
"FabApprovalApiBaseUrl": "https://mesaapproval.mes.infineon.com:7114"
}

View File

@ -6,7 +6,7 @@ public class PCR3Document {
public int ID { get; set; }
public required int PlanNumber { get; set; }
public required string DocType { get; set; }
public string DocNumbers { get; set; } = "N/A";
public string DocNumbers { get; set; } = string.Empty;
public DateTime CompletedDate { get; set; } = DateTimeUtilities.MAX_DT;
public int CompletedByID { get; set; } = 0;
public User? CompletedBy { get; set; }