6 Commits

Author SHA1 Message Date
e020ec8c01 Ready to publish
Added new Email Template and new Modal form for expired TECNs.
Updated Email Template and new Modal form for TECNs.
Added more margin on all modal dialogs
2025-01-22 09:30:59 -07:00
e68a1a4c3b Fixed app settings 2025-01-17 10:24:26 -07:00
7ddda56987 Moved GetEnvironmentVariable calls to Application_Start 2025-01-15 15:16:36 -07:00
77f45fabb1 Added PCRB controller for my task links 2025-01-15 14:54:22 -07:00
1b22ffa439 Ready to test new column 2025-01-15 17:21:42 +01:00
123bbdb9fe Merged PR 34240: Updates to PCR3 document section
Updates to PCR3 document section
2025-01-15 16:52:17 +01:00
585 changed files with 695 additions and 39799 deletions

View File

@ -35,3 +35,15 @@ mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\PdfGenerator" "L
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Jobs" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Jobs"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\JobSchedules" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\JobSchedules"
```
```bash 1734015544321 = 638696123443210000 = Thu Dec 12 2024 07:59:03 GMT-0700 (Mountain Standard Time)
mklink /J ".vscode\.UserSecrets" "%AppData%\Microsoft\UserSecrets\f2da5035-aba9-4676-9f8d-d6689f84663d"
mklink /J "DMO" "..\Fab2ApprovalSystem\DMO"
mklink /J "Jobs" "..\Fab2ApprovalSystem\Jobs"
mklink /J "JobSchedules" "..\Fab2ApprovalSystem\JobSchedules"
mklink /J "Misc" "..\Fab2ApprovalSystem\Misc"
mklink /J "Models" "..\Fab2ApprovalSystem\Models"
mklink /J "PdfGenerator" "..\Fab2ApprovalSystem\PdfGenerator"
mklink /J "Utilities" "..\Fab2ApprovalSystem\Utilities"
mklink /J "ViewModels" "..\Fab2ApprovalSystem\ViewModels"
```

View File

@ -1,9 +1,9 @@
 /*vertical height between form-groups*/
.my-form .form-group {
/*vertical height between form-groups*/
.my-form .form-group {
margin-bottom: 4px;
}
}
@media (min-width:768px) {
@media (min-width:768px) {
.my-form .row {
margin-left: -1px;
margin-right: -1px;
@ -12,7 +12,8 @@
.my-form [class*="col-"] {
padding: 0 2px;
}
}
}
body {
padding-top: 50px;
padding-bottom: 20px;
@ -29,10 +30,10 @@ body {
/*input,
select
{
max-width: 280px;
max-width: 280px;
}*/
.row{
.row {
margin-top: 2px;
margin-bottom: 2px
}
@ -71,10 +72,10 @@ input[type="checkbox"].input-validation-error {
padding-left: 20px;
padding-right: 20px;
background-color: #87b3de;
background-image: -moz-linear-gradient(top,#87b3de, #4d79a5);
background-image: -ms-linear-gradient(top,#87b3de, #4d79a5);
background-image: -webkit-gradient(linear, 0 0, 0 50%, from( #87b3de), to(#4d79a5));
background-image: -webkit-linear-gradient(top,#87b3de, #4d79a5);
background-image: -moz-linear-gradient(top, #87b3de, #4d79a5);
background-image: -ms-linear-gradient(top, #87b3de, #4d79a5);
background-image: -webkit-gradient(linear, 0 0, 0 50%, from(#87b3de), to(#4d79a5));
background-image: -webkit-linear-gradient(top, #87b3de, #4d79a5);
background-image: -o-linear-gradient(top, #87b3de, #4d79a5);
background-image: linear-gradient(top, #87b3de, #4d79a5);
background-repeat: repeat-x;
@ -89,7 +90,7 @@ input[type="checkbox"].input-validation-error {
.label-color {
background-color: #e5e0e0;
}
}
.linkbutton {
display: inline-block;
@ -101,6 +102,17 @@ input[type="checkbox"].input-validation-error {
border: 0;
vertical-align: middle;
}
.linkbutton.edit {
background: url('/Content/icons/edit.gif');
}
.modal-dialog {
margin-top: 80px;
}
.affix {
position: fixed;
top: 55px;
left: 25px;
}

View File

@ -24,12 +24,9 @@ namespace Fab2ApprovalSystem.Controllers;
[Authorize]
public class AccountController : Controller {
private string _apiBaseUrl;
public AccountController()
: this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()))) {
_apiBaseUrl = Environment.GetEnvironmentVariable("FabApprovalApiBaseUrl") ??
throw new ArgumentNullException("FabApprovalApiBaseUrl environment variable not found");
}
public AccountController(UserManager<ApplicationUser> userManager) {
@ -69,7 +66,7 @@ public class AccountController : Controller {
bool isLoginValid;
HttpClient httpClient = HttpClientFactory.Create();
httpClient.BaseAddress = new Uri(_apiBaseUrl);
httpClient.BaseAddress = new Uri(GlobalVars.AppSettings.ApiBaseUrl);
LoginResult loginResult = await AccountDMO.LoginAsync(httpClient, model);
@ -121,7 +118,7 @@ public class AccountController : Controller {
bool isLoginValid;
HttpClient httpClient = HttpClientFactory.Create();
httpClient.BaseAddress = new Uri(_apiBaseUrl);
httpClient.BaseAddress = new Uri(GlobalVars.AppSettings.ApiBaseUrl);
LoginResult loginResult = await AccountDMO.ExternalAuthSetupAsync(httpClient, authAttempt);

View File

@ -48,60 +48,23 @@ 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 mrbUrl = $"{GlobalVars.AppSettings.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 mrbUrl = $"{GlobalVars.AppSettings.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

@ -953,8 +953,7 @@ public class ECNController : PdfViewController {
} catch { }
}
public void NotifyApproversForCancellation(int ecnNumber, byte currentStep, int documentType, string ecnTypeString) {
ECN ecn = ecnDMO.GetECN(ecnNumber);
public void NotifyApproversForCancellation(int ecnNumber, ECN ecn, byte currentStep, int documentType, string ecnTypeString) {
string emailSentList = ECNHelper.NotifyApproversForCancellation(_AppSettings, ecnNumber, currentStep, documentType, ecnTypeString, ecn);
try {
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
@ -977,10 +976,10 @@ public class ECNController : PdfViewController {
} catch { }
}
public void NotifyTECNCancellation(int ecnNumber, string ecnFolderPath) {
public void NotifyTECNCancellation(int ecnNumber, string ecnFolderPath, string comments) {
ECN ecn = ecnDMO.GetECN(ecnNumber);
List<int> notificationUserList = ecnDMO.GetTECNNotificationUsers().ToList();
string emailSentList = ECNHelper.NotifyTECNCancellation(_AppSettings, userDMO, ecnNumber, ecnFolderPath, ecn, notificationUserList);
string emailSentList = ECNHelper.NotifyTECNCancellation(_AppSettings, userDMO, ecnNumber, ecnFolderPath, comments, ecn, notificationUserList);
try {
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "E-TECN", OperationType = "Email", Comments = "Approvers for Cancellation :" + emailSentList });
} catch { }
@ -1157,22 +1156,24 @@ public class ECNController : PdfViewController {
return Content(ecnDMO.PCRBExists(pcrb).ToString());
}
public ActionResult CancelDocument(int ecnNumber, byte currentStep, int documentType, string ecnTypeString) {
public ActionResult CancelDocument(int ecnNumber, byte currentStep, int documentType, string ecnTypeString, string comments = "") {
ECN ecn = ecnDMO.GetECN(ecnNumber);
bool lastApproverAndLastStep = false;
if (ecn.IsTECN && ecn.SubmitedDate is not null && currentStep >= 1)
Approve(ecnNumber, currentStep, comments, documentType, ecnTypeString);
int appoverCount = ecnDMO.SubmitForCancellation(ecnNumber, (byte)GlobalVars.WorkFLowStepNumber.Step1, (int)Session[GlobalVars.SESSION_USERID], documentType, ecnTypeString, (int)GlobalVars.TECNExpirationCancellation.Cancellation);
if (appoverCount > 0) {
NotifyApproversForCancellation(ecnNumber, currentStep, documentType, ecnTypeString);
} else // TODO Automatically close the
{
lastApproverAndLastStep = ApproveCancellation(ecnNumber, currentStep, "", documentType, ecnTypeString);
NotifyApproversForCancellation(ecnNumber, ecn, currentStep, documentType, ecnTypeString);
} else { // TODO Automatically close the
lastApproverAndLastStep = ApproveCancellation(ecnNumber, currentStep, comments, documentType, ecnTypeString);
}
if (!lastApproverAndLastStep) {
try {
lastApproverAndLastStep = true;
ECNPdf ecn = new ECNPdf();
GenerateECNPdf(ecnNumber, out ecn);
ECNPdf ecnPDF = new ECNPdf();
GenerateECNPdf(ecnNumber, out ecnPDF);
string sourceDirectory = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString() + "\\";
string outputFullFilePath = "";
@ -1184,7 +1185,7 @@ public class ECNController : PdfViewController {
Zipper zip = new Zipper();
zip.CreateZip(outputFullFilePath, sourceDirectory);
NotifyTECNCancellation(ecnNumber, outputFullFilePath);
NotifyTECNCancellation(ecnNumber, outputFullFilePath, comments);
} catch (Exception ex) {
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "TECN", OperationType = "Error", Comments = ex.Message });
@ -1208,19 +1209,20 @@ public class ECNController : PdfViewController {
public bool ApproveCancellation(int ecnNumber, byte currentStep, string comments, int documentType, string ecnTypeString) {
bool lastApproverAndLastStep = false;
bool lastStep = false;
ECN ecn = ecnDMO.GetECN(ecnNumber);
bool lastApprover = ecnDMO.ECNApproveCancelled_ExpiredDocument(ecnNumber, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType);
while (lastApprover && !lastStep) {
currentStep++;
lastApprover = ecnDMO.ECNApproveCancelled_ExpiredDocument(ecnNumber, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType);
NotifyApproversForCancellation(ecnNumber, currentStep, documentType, ecnTypeString);
NotifyApproversForCancellation(ecnNumber, ecn, currentStep, documentType, ecnTypeString);
}
if (lastApprover && lastStep) {
try {
lastApproverAndLastStep = true;
ECNPdf ecn = new ECNPdf();
GenerateECNPdf(ecnNumber, out ecn);
ECNPdf ecnPDF = new ECNPdf();
GenerateECNPdf(ecnNumber, out ecnPDF);
string sourceDirectory = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString() + "\\";
string outputFullFilePath = "";
@ -1232,7 +1234,7 @@ public class ECNController : PdfViewController {
Zipper zip = new Zipper();
zip.CreateZip(outputFullFilePath, sourceDirectory);
NotifyTECNCancellation(ecnNumber, outputFullFilePath);
NotifyTECNCancellation(ecnNumber, outputFullFilePath, comments);
} catch (Exception ex) {
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "TECN", OperationType = "Error", Comments = ex.Message });

View File

@ -79,9 +79,7 @@ public class MRBController : Controller {
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=/mrb/{issueID}";
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
return Redirect(mrbUrl);
}
@ -104,9 +102,7 @@ public class MRBController : Controller {
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=/mrb/{issueID}";
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
return Redirect(mrbUrl);
}

View File

@ -0,0 +1,20 @@
using System;
using System.Web.Mvc;
using Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
[SessionExpireFilter]
public class PCRBController : Controller {
public ActionResult Edit(int issueID) {
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 mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
return Redirect(mrbUrl);
}
}

View File

@ -90,6 +90,7 @@ public class CorrectiveActionDMO {
parameters.Add("@EscapePoint", model.EscapePoint);
parameters.Add("@FollowUpDate", model.FollowUpDate);
parameters.Add("@CASubmitted", model.CASubmitted);
parameters.Add("@CAStandardType", model.CAStandardType);
db.Execute("_8DUpdateCorrectiveAction", parameters, commandType: CommandType.StoredProcedure);
EventLogDMO.Add(new WinEventLog { UserID = "System", Comments = "Saved Corrective Action", DocumentType = "9", IssueID = model.CANo, OperationType = "Status", SysDocumentID = 1 });

View File

@ -15,6 +15,7 @@ using Fab2ApprovalSystem.ViewModels;
namespace Fab2ApprovalSystem.DMO;
public class ECN_DMO {
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
private readonly WorkflowDMO wfDMO = new();
@ -367,7 +368,7 @@ public class ECN_DMO {
return ecnItem;
}
internal ECN GetECN(int ecnNumber) {
public ECN GetECN(int ecnNumber) {
ECN ecnItem = new();
DynamicParameters parameters = new();
parameters.Add("@ECNNumber", value: ecnNumber);

View File

@ -6,6 +6,8 @@ Please review the cancelled TECN form in the attachment.
<br/><br/>
https://messa016ec.infineon.com/ECN/Edit?issueID={1}
<br/><br/>
Comments: {5}
<br/><br/>
If you have any questions or trouble logging on please contact a site administrator.
<br/><br/>

View File

@ -0,0 +1,17 @@
<font size="2" face="verdana">
*****Please DO NOT reply to this email*****
<br/><br/>
{3}# {0} has been returned to process. Please remove posted TECN from point of use. The returned to process date is {4}
Please review the returned to process TECN form in the attachment.
<br/><br/>
https://messa016ec.infineon.com/ECN/Edit?issueID={1}
<br/><br/>
Comments: {5}
<br/><br/>
If you have any questions or trouble logging on please contact a site administrator.
<br/><br/>
Thank you!
</font>

View File

@ -255,6 +255,7 @@
<Compile Include="Controllers\TrainingController.cs" />
<Compile Include="Controllers\WebAPIController.cs" />
<Compile Include="Controllers\WorkflowController.cs" />
<Compile Include="Controllers\PCRBController.cs" />
<Compile Include="DMO\AccountDMO.cs" />
<Compile Include="DMO\AdminDMO.cs" />
<Compile Include="DMO\ApprovalLogDMO.cs" />
@ -387,8 +388,10 @@
<Content Include="Views\CorrectiveAction\_D7PAAttachment.cshtml" />
<Content Include="Views\CorrectiveAction\Edit.cshtml" />
<Content Include="Views\CorrectiveAction\ReadOnlyCA.cshtml" />
<Content Include="Views\ECN\_ECNCancel.cshtml" />
<Content Include="Views\ECN\_ECNLayout.cshtml" />
<Content Include="Views\ECN\_ECNReassignOriginator.cshtml" />
<Content Include="Views\ECN\_ECNReturnToProcess.cshtml" />
<Content Include="Views\ECN\Acknowledge.cshtml" />
<Content Include="Views\ECN\ECNApprovalPdf.cshtml" />
<Content Include="Views\ECN\ECNPdf.cshtml" />
@ -513,6 +516,7 @@
<Content Include="EmailTemplates\TECNExpirationApproval.txt" />
<Content Include="EmailTemplates\TECNExpired.txt" />
<Content Include="EmailTemplates\TECNExtensionReject.txt" />
<Content Include="EmailTemplates\TECNReturnedToProcess.txt" />
<Content Include="EmailTemplates\WorkRequestApproval.txt" />
<Content Include="EmailTemplates\WorkRequestAssigned.txt" />
<Content Include="EmailTemplates\WorkRequestReAssigned.txt" />

View File

@ -126,7 +126,7 @@ public class ECNHelper {
return emailSentList;
}
public static string NotifyTECNCancellation(AppSettings appSettings, UserAccountDMO userDMO, int ecnNumber, string ecnFolderPath, ECN ecn, List<int> notificationUserList) {
public static string NotifyTECNCancellation(AppSettings appSettings, UserAccountDMO userDMO, int ecnNumber, string ecnFolderPath, string comments, ECN ecn, List<int> notificationUserList) {
string emailSentList = "";
List<string> emailIst = MiscDMO.GetTECNCancelledApprovalNotifyList(ecnNumber).Distinct().ToList();
foreach (int userId in notificationUserList) {
@ -135,23 +135,27 @@ public class ECNHelper {
emailIst.Add(email);
}
string subject = string.Empty;
string userEmail = string.Empty;
string emailTemplate = "TECNCancelled.txt";
if (ecn.CancellationApprovalDate == null) {
subject = "TECN Cancellation Initiated Notice - " + ecnNumber + " for " + ecn.Title + ", Cancellation Initiated on:" + DateTime.Now;
} else {
subject = "TECN Cancellation Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Cancelled:" + ecn.CancellationApprovalDate;
}
string subject;
string emailTemplate;
string senderName = "ECN";
string userEmail = string.Empty;
DateTime dateTime = ecn.CancellationApprovalDate is null ? DateTime.Now : ecn.CancellationApprovalDate.Value;
if (ecn.ExpirationDate > DateTime.Today || ecn.ExtensionDate > DateTime.Today) {
emailTemplate = "TECNCancelled.txt";
subject = "TECN Cancellation Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Cancelled:" + dateTime;
} else {
emailTemplate = "TECNReturnedToProcess.txt";
subject = "TECN Return to Process Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Returned:" + dateTime;
}
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
string[] emailparams = new string[6];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "TECN";
emailparams[4] = DateTime.Now.ToString();
emailparams[5] = comments;
#if (DEBUG)
userEmail = GlobalVars.SENDER_EMAIL;

View File

@ -8,7 +8,7 @@ namespace Fab2ApprovalSystem.Models;
public class AppSettings {
public AppSettings(string adminNotificationRecepient,
string? apiBaseUrl,
string apiBaseUrl,
string attachmentFolder,
string? attachmentUrl,
string caBlankFormsLocation,
@ -46,6 +46,7 @@ public class AppSettings {
string urls,
int userId,
bool userIsAdmin,
string wasmClientUrl,
string wsr_URL,
string? workingDirectoryName) {
AdminNotificationRecepient = adminNotificationRecepient;
@ -88,11 +89,12 @@ public class AppSettings {
UserId = userId;
UserIsAdmin = userIsAdmin;
WSR_URL = wsr_URL;
WasmClientUrl = wasmClientUrl;
WorkingDirectoryName = workingDirectoryName;
}
public string AdminNotificationRecepient { get; }
public string? ApiBaseUrl { get; }
public string ApiBaseUrl { get; }
public string AttachmentFolder { get; }
public string? AttachmentUrl { get; }
public string CABlankFormsLocation { get; }
@ -130,6 +132,7 @@ public class AppSettings {
public string URLs { get; }
public int UserId { get; }
public bool UserIsAdmin { get; }
public string WasmClientUrl { get; }
public string WSR_URL { get; }
public string? WorkingDirectoryName { get; }
@ -211,12 +214,15 @@ public class AppSettings {
throw new ArgumentNullException("SSRSPassword environment variable not found");
string testEmailRecipients = ConfigurationManager.AppSettings["Test Email Recipients"] ??
throw new ArgumentNullException("Test Email Recipients environment variable not found");
string? apiBaseUrl = ConfigurationManager.AppSettings["FabApprovalApiBaseUrl"]?.ToString();
string apiBaseUrl = Environment.GetEnvironmentVariable("FabApprovalApiBaseUrl") ??
throw new ArgumentNullException("FabApprovalApiBaseUrl environment variable not found");
string? attachmentUrl = ConfigurationManager.AppSettings["AttachmentUrl"]?.ToString();
string? company = ConfigurationManager.AppSettings["Company"]?.ToString();
string? smtpServer = ConfigurationManager.AppSettings["SMTP Server"]?.ToString();
string? urls = ConfigurationManager.AppSettings["URLs"]?.ToString();
string? workingDirectoryName = ConfigurationManager.AppSettings["WorkingDirectoryName"]?.ToString();
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
result = new(adminNotificationRecepient: adminNotificationRecepient,
apiBaseUrl: apiBaseUrl,
attachmentFolder: attachmentFolder,
@ -256,6 +262,7 @@ public class AppSettings {
urls: urls,
userId: userId,
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
wasmClientUrl: wasmClientUrl,
wsr_URL: Misc.GlobalVars.WSR_URL,
workingDirectoryName: workingDirectoryName);
return result;

View File

@ -231,6 +231,7 @@ public class CorrectiveAction {
public DateTime? NextDueDate { get; set; }
public DateTime? FollowUpDate { get; set; }
public bool CASubmitted { get; set; }
public string CAStandardType { get; set; }
public DateTime? ClosedDate { get; set; }
public CorrectiveAction() {
TeamMemberIDs = new List<int>();

View File

@ -380,6 +380,43 @@
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">CA Standard Type:</label>
</div>
<div class="col-sm-9">
@(Html.Kendo().DropDownList()
.Name("CAStandardTypeList")
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem()
{
Text = "IATF16949",
Value = "IATF16949"
},
new SelectListItem()
{
Text = "ISO14001",
Value = "ISO14001"
},
new SelectListItem()
{
Text = "ISO45001",
Value = "ISO45001"
}
}
)
.OptionLabel("Select")
.Value(Model.CAStandardType)
)
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">
@ -2176,6 +2213,7 @@
$('#txtApprovedDate').attr("disabled", true);
$('#txtRelatedMRB').attr("disabled", true);
$('#CATypeList').data("kendoDropDownList").enable(false);
$('#CAStandardTypeList').data("kendoDropDownList").enable(false);
$('#d0Comments').attr("disabled", true);
}
@ -3689,6 +3727,7 @@
TeamCaptainID: $("#TeamCaptainList").data("kendoDropDownList").value(),
CASponsorID: $("#CASponsorList").data("kendoDropDownList").value(),
CASubmitted: isCASubmitted,
CAStandardType : $("#CAStandardTypeList").data("kendoDropDownList").value(),
//D0
D0Comments : $("#d0Comments").val(),

View File

@ -325,6 +325,16 @@
</div>
</div>
</div>
<div class="col-sm-3">
<div class="row">
<div class="col-sm-3">
<label class="control-label pull-right">CA Standard Type:</label>
</div>
<div class="col-sm-9">
@Html.TextBoxFor(model => model.CAStandardType, new { id = "txtCAStandardType", @class = "k-textbox", Readonly = "Readonly", style = "background-color:lightblue" })
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3">

View File

@ -86,30 +86,48 @@
if (Model.IsTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
&& !Model.ExpirationProcessed && !Model.Converted
&& !Model.LockedForConversion
&& (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today))
&& !Model.LockedForConversion)
{
ViewBag.CanResubmit = "true";
<input type="button" value="Change Type" class="btn btn-primary btn-xs" id="ReSubmitDocument" disabled="disabled" />
if (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today)
{
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
}
else
{
<input type="button" value="Return to Process" class="btn btn-primary btn-xs" id="ReturnToProcessDocument" />
}
}
else if (Model.IsTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
&& !Model.ExpirationProcessed
&& Model.ConversionApprovalInProgress == false
&& (Model.ExpirationDate >= DateTime.Today || Model.ExtensionDate >= DateTime.Today))
&& Model.ConversionApprovalInProgress == false)
{
if (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today)
{
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
}
else
{
<input type="button" value="Return to Process" class="btn btn-primary btn-xs" id="ReturnToProcessDocument" />
}
}
else if (Model.IsEmergencyTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
&& !Model.ExpirationProcessed && !Model.Converted
&& (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today))
&& !Model.ExpirationProcessed && !Model.Converted)
{
ViewBag.CanResubmit = "true";
<input type="button" value="Change Type" class="btn btn-primary btn-xs" id="ReSubmitDocument" disabled="disabled" />
if (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today)
{
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
}
else
{
<input type="button" value="Return to Process" class="btn btn-primary btn-xs" id="ReturnToProcessDocument" />
}
}
}
<input type="button" value="PRINT PDF" class="btn btn-primary btn-xs" id="PrintPDF" />
@ -1251,6 +1269,9 @@
</div>
</div>
@Html.Partial("_ECNCancel")
@Html.Partial("_ECNReturnToProcess")
@Html.Partial("_ECNReassignOriginator")
<script type="text/javascript">
@ -2188,40 +2209,6 @@
return false;
});
$('#CancelDocument').on('click', function () {
docType = 5;
if (confirm("Are you sure you want to Cancel this document?")) {
$.ajax({
url: "/ECN/CancelDocument",
type: "GET",
datatype: "json",
data: {
ecnNumber: $("#txtECNNumber").val(),
currentStep: 1,
documentType: docType,
ecnTypeString: ecnTypeString
},
success: function (data) {
if (data == 'Redirect') {
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
}
else {
// TODO alert an error message
}
},
error: function (result) {
alert("Failed on Cancel" + result);
}
});
}
return false;
});
var returnNoOfDays = function () {
//var start = new Date($('#txSubmitDate').val());
var start = new Date();

View File

@ -0,0 +1,75 @@
<div class="modal fade" id="Cancel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel"><center>Has the process returned to the original state?</center></h4>
</div>
<div class="modal-body">
<div class="control-group">
<div class="row">
<div class="col-sm-13">
<h4 class="modal-title">Comments (Required):</h4>
<textarea class="form-control" rows="5" id="comments" style="resize: none;"></textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" class="btn btn-primary" id="ConfirmCancel">Confirm Cancel (Yes)</button>
</div>
</div>
</div>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#CancelDocument").click(function (e) {
$("#comments").val("");
$("#Cancel").modal('show');
});
$('#ConfirmCancel').on('click', function () {
if ($("#comments").val() == "") {
alert("Comments are required");
return;
}
$('#ConfirmCancel').attr("disabled", true);
$.ajax({
url: "/ECN/CancelDocument",
type: "GET",
datatype: "json",
data: {
ecnNumber: $("#txtECNNumber").val(),
currentStep: 1,
documentType: 5,
ecnTypeString: ecnTypeString,
comments: $("#comments").val(),
},
success: function (data) {
$("#Cancel").modal('hide');
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
},
error: function (result) {
$('#ConfirmCancel').attr("disabled", false);
alert("Server error while canceling document");
}
});
});
});
</script>

View File

@ -0,0 +1,75 @@
<div class="modal fade" id="ReturnToProcess" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModalLabel"><center>Has the process returned to the original state?</center></h4>
</div>
<div class="modal-body">
<div class="control-group">
<div class="row">
<div class="col-sm-13">
<h4 class="modal-title">Comments (Required):</h4>
<textarea class="form-control" rows="5" id="ReturnToProcessComments" style="resize: none;"></textarea>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button type="button" class="btn btn-primary" id="ConfirmReturnToProcess">Confirm Return to Process (Yes)</button>
</div>
</div>
</div>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("#ReturnToProcessDocument").click(function (e) {
$("#ReturnToProcessComments").val("");
$("#ReturnToProcess").modal('show');
});
$('#ConfirmReturnToProcess').on('click', function () {
if ($("#ReturnToProcessComments").val() == "") {
alert("Comments are required");
return;
}
$('#ConfirmReturnToProcess').attr("disabled", true);
$.ajax({
url: "/ECN/CancelDocument",
type: "GET",
datatype: "json",
data: {
ecnNumber: $("#txtECNNumber").val(),
currentStep: 1,
documentType: 5,
ecnTypeString: ecnTypeString,
comments: $("#ReturnToProcessComments").val(),
},
success: function (data) {
$("#ReturnToProcess").modal('hide');
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
url = url.replace('amp;', '');
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
},
error: function (result) {
$('#ConfirmReturnToProcess').attr("disabled", false);
alert("Server error while ReturnToProcessing document");
}
});
});
});
</script>

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

@ -54,7 +54,7 @@ public class HomeControllerTests {
private static void GetMyOpenActionItems(ILogger? logger, AppSettings appSettings) {
SetGlobalVars(logger, appSettings);
LotDispositionDMO lotDispositionDMO = new(appSettings);
LotDispositionDMO lotDispositionDMO = new();
OpenActionItemViewModel[] openActionItemViewModels = lotDispositionDMO.GetMyOpenActionItems(appSettings.UserId).ToArray();
if (openActionItemViewModels.Length == 0) { }
}
@ -76,7 +76,7 @@ public class HomeControllerTests {
private static void GetTaskList(ILogger? logger, AppSettings appSettings) {
SetGlobalVars(logger, appSettings);
LotDispositionDMO lotDispositionDMO = new(appSettings);
LotDispositionDMO lotDispositionDMO = new();
IssuesViewModel[] issuesViewModels = lotDispositionDMO.GetTaskList(appSettings.UserId).ToArray();
if (issuesViewModels.Length == 0) { }
}

View File

@ -56,8 +56,8 @@ public class AdminDMOTests {
AdminDMO adminDMO = new();
// void AddNewTrainingGroup(string groupName);
// void AddUserRoles(int subRole, string userids);
// void AddUserToGroup(int userId, int groupId);
// void DeleteFromGroup(int userId, int groupId);
// void AddUserToGroup(appSettings.UserId, int groupId);
// void DeleteFromGroup(appSettings.UserId, int groupId);
// void DeleteTrainingGroup(int groupID);
// adminDMO.DeleteUserFromAllTrainingGroups(appSettings.UserId);
// void DeleteUserRoles(int subRole, string userids);

View File

@ -62,8 +62,8 @@ public class AuditDMOTests {
// IEnumerable<int> GetAuditFindingCategoryIdsByFindingId(int auditFindingsID);
// AuditFindings GetAuditFindingsByID(int auditFindingsID);
// IEnumerable<AuditFindings> GetAuditFindingsList(int auditNo);
// Audit GetAuditItem(int auditNo, int userID);
// Audit GetAuditItemReadOnly(int auditNo, int userID);
// Audit GetAuditItem(int auditNo, appSettings.UserId);
// Audit GetAuditItemReadOnly(int auditNo, appSettings.UserId);
Auditor[] auditors = auditDMO.GetAuditorList().ToArray();
// IEnumerable<AuditReportAttachment> GetAuditReportAttachments(int auditNo);
// C_8DAuditedStandard[] c_8DAuditedStandards = auditDMO.GetAuditStandardList().ToArray();
@ -78,8 +78,8 @@ public class AuditDMOTests {
// void InsertAuditReportAttachment(AuditReportAttachment attach);
// void InsertCAFindings(CAFindings model);
// int IsCAAssignedToAudit(int CANo, int auditNo);
// void ReleaseLockOnDocument(int userID, int issueID);
// void UpdateAudit(Audit audit, int userID);
// void ReleaseLockOnDocument(appSettings.UserId, int issueID);
// void UpdateAudit(Audit audit, appSettings.UserId);
// void UpdateCAFindings(CAFindings model);
if (auditDMO is null) { }
#pragma warning restore IDE0059

View File

@ -53,12 +53,12 @@ public class ChangeControlDMOTests {
private static void ChangeControlDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
ChangeControlDMO changeControlDMO = new(appSettings);
ChangeControlDMO changeControlDMO = new();
// IEnumerable<CCAttachment> GetCCAttachment(int planNumber);
// IEnumerable<CCMeetingAttachment> GetMeetingAttachments(int meetingID);
// IEnumerable<MeetingDecisionSummaryList> GetMeetingDecisionSummaryList(int planNumber);
// IEnumerable<CCMeeting> GetMeetingList(int planNumber);
// void ReassignOwner(int planNumber, int newOwnerID, string comments, int userID);
// void ReassignOwner(int planNumber, int newOwnerID, string comments, appSettings.UserId);
if (changeControlDMO is null) { }
#pragma warning restore IDE0059
}

View File

@ -55,8 +55,8 @@ public class CorrectiveActionDMOTests {
private static void CorrectiveActionDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
CorrectiveActionDMO correctiveActionDMO = new(appSettings);
// void ApproveSection(int issueID, int userID, string DSection);
CorrectiveActionDMO correctiveActionDMO = new();
// void ApproveSection(int issueID, appSettings.UserId, string DSection);
// void DeleteCAAttachment(int attachmentID);
// void DeleteD3ContainmentActionItem(int d3ContainmentActionID);
// void DeleteD5D6CorrectivetAction(int d5d6CAID);
@ -67,8 +67,8 @@ public class CorrectiveActionDMOTests {
// IEnumerable<CA_Attachment> GetCAAttachmentsList(int caNo, string section);
CAD3D5D7Due[] cAD3D5D7Dues = correctiveActionDMO.GetCAD3D5D7Due().ToArray();
// IEnumerable<CA_Attachment> GetCAFindingsItemAttachments(int caFindingsID);
// CorrectiveAction GetCAItem(int caNo, int userID);
// CorrectiveAction GetCAItemReadOnly(int caNo, int userID);
// CorrectiveAction GetCAItem(int caNo, appSettings.UserId);
// CorrectiveAction GetCAItemReadOnly(int caNo, appSettings.UserId);
// IEnumerable<CASectionApproval> GetCASectionApprovalLog(int caNo);
CASource[] cASources = correctiveActionDMO.GetCASourceList().ToArray();
// IEnumerable<D3ContainmentAction> GetD3ContainmentActions(int caNo);
@ -89,17 +89,17 @@ public class CorrectiveActionDMOTests {
// void InsertD3ContainmentAction(D3ContainmentAction model);
// void InsertD5D6CorrectivetAction(D5D6CorrectivetAction model);
// void InsertD7PreventiveAction(D7PreventiveAction model);
// bool IsAIAssignee(int userId, int caId);
// bool IsAIAssignee(appSettings.UserId, int caId);
// bool IsLastSectionApprover(int caNo, string dSection);
// bool IsUserSectionApprover(int issueId, int userId);
// void RejectSection(int issueID, int userID, string DSection, string comments);
// void ReleaseLockOnDocument(int userID, int issueID);
// bool IsUserSectionApprover(int issueId, appSettings.UserId);
// void RejectSection(int issueID, appSettings.UserId, string DSection, string comments);
// void ReleaseLockOnDocument(appSettings.UserId, int issueID);
// DateTime SetCAComplete(int issueID);
// DateTime SetCAD3DueDate(int issueID);
// DateTime SetCAD5D7DueDate(int issueID);
// void SetD3D5D7NotificationDate(int caNo, string section);
// int StartApproval(int issueID, int userID, int worlflowNumber);
// void StartSectionApproval(int issueID, int userID, string DSection);
// int StartApproval(int issueID, appSettings.UserId, int worlflowNumber);
// void StartSectionApproval(int issueID, appSettings.UserId, string DSection);
// void UpdateCorrectiveAction(CorrectiveAction model);
// void UpdateD3ContainmentAction(D3ContainmentAction model);
// void UpdateD5D6CorrectivetAction(D5D6CorrectivetAction model);

View File

@ -58,30 +58,30 @@ public class EngChangeNoticeDMOTests {
ECN_DMO ecnDMO = new();
// void CancelECN(int? ecnNumber);
// bool CanSubmitECN(int ecnNumber);
// void DeleteDocument(int ecnNumber, int userid, string ecnTypeString);
// void DeleteDocument(int ecnNumber, appSettings.UserId, string ecnTypeString);
// void DeleteECNAttachment(int attachmentID);
// bool ECNApproveCancelled_ExpiredDocument(int issueID, byte step, string comments, out bool lastStep, int userID, int documentType);
// void ECNResetTECNAtRejection(int ecnNumber, int userID, int docType);
// bool ECNApproveCancelled_ExpiredDocument(int issueID, byte step, string comments, out bool lastStep, appSettings.UserId, int documentType);
// void ECNResetTECNAtRejection(int ecnNumber, appSettings.UserId, int docType);
IssuesViewModel[] issuesViewModels = ecnDMO.GetAllTECNs().ToArray();
// IEnumerable<ApprovalLogHistory> GetECNApprovalLogHistory(int ecnNumber);
// IEnumerable<ECNAttachment> GetECNAttachments(int ecnNumber);
IssuesViewModel[] issuesViewModelsB = ecnDMO.GetECN_TECNPendingApprovals(appSettings.UserId).ToArray();
// string GetFileName(string attachmentID);
// IEnumerable<IssuesViewModel> GetMyConvertedTECNsToECNs(int userID, int maxDays);
// IEnumerable<IssuesViewModel> GetMyExpiredTECNs(int userID, int maxDays);
// IEnumerable<IssuesViewModel> GetMyExpiringTECNs(int userID, int maxDays);
// IEnumerable<IssuesViewModel> GetMyConvertedTECNsToECNs(appSettings.UserId, int maxDays);
// IEnumerable<IssuesViewModel> GetMyExpiredTECNs(appSettings.UserId, int maxDays);
// IEnumerable<IssuesViewModel> GetMyExpiringTECNs(appSettings.UserId, int maxDays);
// List<string> GetRejectionOrginatorEmailList(int ecnNumber);
int[] ints = ecnDMO.GetTECNNotificationUsers().ToArray();
// void InsertECNAttachment(ECNAttachment attach);
// int PCRBExists(int pcrb);
// void ReassignOriginatorECN(int ecnNumber, int newOriginatorID, string comments, int userID);
// void ReleaseLockOnDocument(int userID, int issueID);
// int ReSubmitDocument(int issueID, int userID, int documentType, out int allowedITAR, string descriptionOfChange, string reasonForChange, string ecnTypeString, out int newECNNumber, int categoryId);
// void ReassignOriginatorECN(int ecnNumber, int newOriginatorID, string comments, appSettings.UserId);
// void ReleaseLockOnDocument(appSettings.UserId, int issueID);
// int ReSubmitDocument(int issueID, appSettings.UserId, int documentType, out int allowedITAR, string descriptionOfChange, string reasonForChange, string ecnTypeString, out int newECNNumber, int categoryId);
// void SaveAfterSubmitByApprover(int ecnNumber, string implementationDetails);
// void SetToExecutionStep(int ecnNumber, int userid, int documentType, string ecnTypeString);
// int SubmitDocument(int issueID, int userID, int documentType, out int allowedITAR);
// int SubmitForCancellation(int issueID, byte currentStep, int userID, int documentType, string ecnType, int TECNOperationType);
// int SubmitTECNExtensionDocument(int issueID, int userID, int documentType, DateTime extensionDate);
// void SetToExecutionStep(int ecnNumber, appSettings.UserId, int documentType, string ecnTypeString);
// int SubmitDocument(int issueID, appSettings.UserId, int documentType, out int allowedITAR);
// int SubmitForCancellation(int issueID, byte currentStep, appSettings.UserId, int documentType, string ecnType, int TECNOperationType);
// int SubmitTECNExtensionDocument(int issueID, appSettings.UserId, int documentType, DateTime extensionDate);
// void TECNExtensionLog(int ecnNumber, DateTime extensionDate);
// void UpdateECNType(int ecnNumber, string ecnType);
if (ecnDMO is null) { }

View File

@ -0,0 +1,108 @@
using System;
using System.Linq;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalTests.DMO;
[TestClass]
public class EngineeringChangeNoticeDMOTests {
#pragma warning disable CS8618
private static ILogger? _Logger;
private static TestContext _TestContext;
private static WebApplicationFactory<Fab2ApprovalMKLink.Program> _WebApplicationFactory;
#pragma warning restore
public static void SetGlobalVars(ILogger? logger, AppSettings appSettings) {
logger?.LogDebug("Starting to set Fab2ApprovalSystem.Misc.GlobalVars");
Fab2ApprovalSystem.Misc.GlobalVars.AppSettings = appSettings;
Fab2ApprovalSystem.Misc.GlobalVars.AttachmentUrl = appSettings.AttachmentUrl is null ? string.Empty : appSettings.AttachmentUrl;
Fab2ApprovalSystem.Misc.GlobalVars.CA_BlankFormsLocation = appSettings.CABlankFormsLocation;
Fab2ApprovalSystem.Misc.GlobalVars.DBConnection = appSettings.DBConnection;
Fab2ApprovalSystem.Misc.GlobalVars.DB_CONNECTION_STRING = appSettings.DBConnectionString;
Fab2ApprovalSystem.Misc.GlobalVars.hostURL = appSettings.HostURL;
Fab2ApprovalSystem.Misc.GlobalVars.IS_INFINEON_DOMAIN = appSettings.IsInfineonDomain;
Fab2ApprovalSystem.Misc.GlobalVars.MesaTemplateFiles = appSettings.MesaTemplateFiles;
Fab2ApprovalSystem.Misc.GlobalVars.NDriveURL = appSettings.NDriveURL;
Fab2ApprovalSystem.Misc.GlobalVars.SENDER_EMAIL = appSettings.SenderEmail;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ID = appSettings.UserId;
Fab2ApprovalSystem.Misc.GlobalVars.USER_ISADMIN = appSettings.UserIsAdmin;
Fab2ApprovalSystem.Misc.GlobalVars.WSR_URL = appSettings.WSR_URL;
logger?.LogDebug("Finished setting Fab2ApprovalSystem.Misc.GlobalVars");
}
[ClassInitialize]
public static void ClassInitAsync(TestContext testContext) {
_TestContext = testContext;
_WebApplicationFactory = new WebApplicationFactory<Fab2ApprovalMKLink.Program>();
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
_Logger = serviceProvider.GetRequiredService<ILogger<Fab2ApprovalMKLink.Program>>();
}
private static void NonThrowTryCatch() {
try { throw new Exception(); } catch (Exception) { }
}
private static void EngineeringChangeNoticeDMO(ILogger? logger, AppSettings appSettings, int maxDays, int ecnNumber) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
ECN_DMO ecnDMO = new();
ECN ecn = ecnDMO.GetECN(ecnNumber);
// void CancelECN(int? ecnNumber);
bool canSubmitECN = ecnDMO.CanSubmitECN(ecnNumber);
// void DeleteDocument(int ecnNumber, appSettings.UserId, string ecnTypeString);
// void DeleteECNAttachment(int attachmentID);
// bool ECNApproveCancelled_ExpiredDocument(int issueID, byte step, string comments, out bool lastStep, appSettings.UserId, int documentType);
// void ECNResetTECNAtRejection(int ecnNumber, appSettings.UserId, int docType);
IssuesViewModel[] issuesViewModels = ecnDMO.GetAllTECNs().ToArray();
ApprovalLogHistory[] approvalLogHistories = ecnDMO.GetECNApprovalLogHistory(ecnNumber).ToArray();
ECNAttachment[] eCNAttachments = ecnDMO.GetECNAttachments(ecnNumber).ToArray();
IssuesViewModel[] issuesViewModelsB = ecnDMO.GetECN_TECNPendingApprovals(appSettings.UserId).ToArray();
// string GetFileName(string attachmentID);
IssuesViewModel[] issuesViewModelsC = ecnDMO.GetMyConvertedTECNsToECNs(appSettings.UserId, maxDays).ToArray();
IssuesViewModel[] issuesViewModelsD = ecnDMO.GetMyExpiredTECNs(appSettings.UserId, maxDays).ToArray();
IssuesViewModel[] issuesViewModelsE = ecnDMO.GetMyExpiringTECNs(appSettings.UserId, maxDays).ToArray();
// List<string> GetRejectionOrginatorEmailList(int ecnNumber);
int[] ints = ecnDMO.GetTECNNotificationUsers().ToArray();
// void InsertECNAttachment(ECNAttachment attach);
// int PCRBExists(int pcrb);
// void ReassignOriginatorECN(int ecnNumber, int newOriginatorID, string comments, appSettings.UserId);
// void ReleaseLockOnDocument(appSettings.UserId, int issueID);
// int ReSubmitDocument(int issueID, appSettings.UserId, int documentType, out int allowedITAR, string descriptionOfChange, string reasonForChange, string ecnTypeString, out int newECNNumber, int categoryId);
// void SaveAfterSubmitByApprover(int ecnNumber, string implementationDetails);
// void SetToExecutionStep(int ecnNumber, appSettings.UserId, int documentType, string ecnTypeString);
// int SubmitDocument(int issueID, appSettings.UserId, int documentType, out int allowedITAR);
// int SubmitForCancellation(int issueID, byte currentStep, appSettings.UserId, int documentType, string ecnType, int TECNOperationType);
// int SubmitTECNExtensionDocument(int issueID, appSettings.UserId, int documentType, DateTime extensionDate);
// void TECNExtensionLog(int ecnNumber, DateTime extensionDate);
// void UpdateECNType(int ecnNumber, string ecnType);
if (ecnDMO is null) { }
#pragma warning restore IDE0059
}
#if Release
[Ignore]
#endif
[TestMethod]
[DataRow(1, 82700)]
public void EngineeringChangeNoticeIsAttachedOnlyDMO(int maxDays, int ecnNumber) {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
EngineeringChangeNoticeDMO(_Logger, appSettings, maxDays, ecnNumber);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}
}

View File

@ -55,9 +55,9 @@ public class LotDispositionDMOTests {
private static void LotDispositionDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
LotDispositionDMO lotDispositionDMO = new(appSettings);
LotDispositionDMO lotDispositionDMO = new();
// void DeleteAllLotDispoLot(int issueID);
// void DeleteCADocument(int CANo, int userID, string caTypeString);
// void DeleteCADocument(int CANo, appSettings.UserId, string caTypeString);
// void DeleteLotDispoAttachment(int attachmentID);
// void DeleteLotDispoLot(int lotID);
AuditList[] auditLists = lotDispositionDMO.GetAuditList(appSettings.UserId).ToArray();
@ -68,8 +68,8 @@ public class LotDispositionDMOTests {
IssuesViewModel[] issuesViewModelsB = lotDispositionDMO.GetECNList(appSettings.UserId).ToArray();
// string GetFileName(string attachmentID);
// Attachment[] GetLotDispoAttachments(int issueID);
// LotDisposition GetLotDispositionItem(int issueID, out int isITAR, int userID);
// LotDisposition GetLotDispositionItemForRead(int issueID, out int isITAR, int userID);
// LotDisposition GetLotDispositionItem(int issueID, out int isITAR, appSettings.UserId);
// LotDisposition GetLotDispositionItemForRead(int issueID, out int isITAR, appSettings.UserId);
IssuesViewModel[] issuesViewModelsC = lotDispositionDMO.GetLotDispositionList(appSettings.UserId).ToArray();
// Lot[] GetLotDispositionLots(int issueID);
// LotDispositionLotSummaryViewModel GetLotDispositionLotSummary(int issueID);
@ -91,9 +91,9 @@ public class LotDispositionDMOTests {
// int InsertLot(Lot lot, bool getLotInfo);
// LotDisposition InsertLotDisposition(LotDisposition lotDispo);
// void InsertLotDispositionAttachment(Attachment attach);
// void ReleaseLockOnDocument(int userID, int issueID);
// void ReleaseLockOnDocument(appSettings.UserId, int issueID);
// Lot[] SearchLots(string searchText);
// int SubmitDocument(int issueID, bool peRequired, bool mrbRequired, int userID);
// int SubmitDocument(int issueID, bool peRequired, bool mrbRequired, appSettings.UserId);
// void UpdateLotDispoLot(Lot lot);
// void UpdateLotDisposition(LotDisposition lotDispo);
// void UpdateLotScrapReleaseStatus(ScrapLot scrap);

View File

@ -53,17 +53,17 @@ public class LotTravelerDMOTests {
private static void LotTravelerDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
LotTravelerDMO lotTravelerDMO = new(appSettings);
LotTravelerDMO lotTravelerDMO = new();
// int CanAddLocationOperation(LTLotTravelerHoldSteps model);
// int CreateLotTravelerRevision(LTLotTravelerHoldSteps model, int userID);
// void CreateTraveler(int ltLotID, int workRequestID, int UserID);
// int CreateWorkRequestRevision(LTWorkRequest data, int userID);
// int CreateLotTravelerRevision(LTLotTravelerHoldSteps model, appSettings.UserId);
// void CreateTraveler(int ltLotID, int workRequestID, appSettings.UserId);
// int CreateWorkRequestRevision(LTWorkRequest data, appSettings.UserId);
// void DeleteLot(int ltLotID);
// IEnumerable<LTLot> GetLotList(int workRequestID);
// IEnumerable<LTLot> GetLotListBasedOnSWRNumber(int swrNumber);
// IEnumerable<LotWithTraveler> GetLotsWithTraveler(int workRequestID);
// LTLotTravelerHeaderViewModel GetLotTravelerHeaderForReadOnly(int ltLotID, int revisionNumber);
// LTLotTravelerHeaderViewModel GetLotTravelerHeaderForUpdate(int ltLotID, int UserID);
// LTLotTravelerHeaderViewModel GetLotTravelerHeaderForUpdate(int ltLotID, appSettings.UserId);
// IEnumerable<LTLotTravelerHoldSteps> GetLotTravelerHolStepsByRevision(int ltLotID, int revisionNumber);
// IEnumerable<RevisionHistory> GetLotTravelerRevisionHistory(int lotID);
// IEnumerable<LTLotTravelerHoldSteps> GetLotTravHoldSteps(int ltLotID);
@ -76,15 +76,15 @@ public class LotTravelerDMOTests {
// IEnumerable<RevisionHistory> GetWorkReqRevisionHistory(int swrNumber);
// List<Revision> GetWorkReqRevisions(int swrNumber);
// void InsertLot(LTLot lot);
// int InsertLotTravelerHoldStep(LTLotTravelerHoldSteps model, int userID);
// void ReassignOriginator(int workRequestID, int newOriginatorID, string comments, int userID);
// void ReleaseLockOnDocument(int userID, int workRequestID);
// void ReleaseLockOnLotTravelerUpdateDoc(int userID, int ltLotID);
// int InsertLotTravelerHoldStep(LTLotTravelerHoldSteps model, appSettings.UserId);
// void ReassignOriginator(int workRequestID, int newOriginatorID, string comments, appSettings.UserId);
// void ReleaseLockOnDocument(appSettings.UserId, int workRequestID);
// void ReleaseLockOnLotTravelerUpdateDoc(appSettings.UserId, int ltLotID);
// void RestoreLotTravToPrevRevision(int prevLotTravRevID, int newLotTravRevID);
// int SubmitDocument(int workRequestID, int userID, int documentType, out int allowedITAR);
// int UpdateLotTravelerHoldStep(LTLotTravelerHoldSteps model, int userID);
// void UpdateLotTravlerExecution(int lotTravHoldStepID, string taskComments, bool CompletedFlag, int userID);
// int UpdateRevisedLotTravelerHoldStep(LTLotTravelerHoldSteps model, int userID);
// int SubmitDocument(int workRequestID, appSettings.UserId, int documentType, out int allowedITAR);
// int UpdateLotTravelerHoldStep(LTLotTravelerHoldSteps model, appSettings.UserId);
// void UpdateLotTravlerExecution(int lotTravHoldStepID, string taskComments, bool CompletedFlag, appSettings.UserId);
// int UpdateRevisedLotTravelerHoldStep(LTLotTravelerHoldSteps model, appSettings.UserId);
if (lotTravelerDMO is null) { }
#pragma warning restore IDE0059
}

View File

@ -54,9 +54,9 @@ public class PartsRequestDMOTests {
private static void PartsRequestDMO(ILogger? logger, AppSettings appSettings) {
#pragma warning disable IDE0059
SetGlobalVars(logger, appSettings);
PartsRequestDMO partsRequestDMO = new(appSettings);
PartsRequestDMO partsRequestDMO = new();
// void DeleteAttachment(int attachmentID);
// void DeleteDocument(int prNumber, int userid);
// void DeleteDocument(int prNumber, appSettings.UserId);
// PartsRequest Get(int PRNumber);
// IEnumerable<ApprovalLogHistory> GetApprovalLogHistory(int prNumber);
// IEnumerable<PartsRequestAttachmentList> GetAttachments(int prNumber);
@ -65,7 +65,7 @@ public class PartsRequestDMOTests {
PartsRequestList[] partsRequestLists = partsRequestDMO.GetPartsRequestList().ToArray();
// void Insert(PartsRequest pr);
// void InsertAttachment(PartsRequestAttachment attach);
// void Submit(int prNumber, int userID);
// void Submit(int prNumber, appSettings.UserId);
// void Update(PartsRequest pr);
if (partsRequestDMO is null) { }
#pragma warning restore IDE0059

View File

@ -60,8 +60,8 @@ public class TrainingDMOTests {
// bool CheckTrainingStatus(int trainingAssignmentID);
// bool CheckValidDocAck(int docAckId);
// int Create(int issueId);
// int CreateAssignment(int trainingId, int userId);
// void DeleteAssignmentByUserId(int userId);
// int CreateAssignment(int trainingId, appSettings.UserId);
// void DeleteAssignmentByUserId(appSettings.UserId);
// void DeleteTraining(int trainingId);
// void DeleteTrainingAssignment(int trainingAssignmentId);
// void DeleteTrainingDocAck(int trainingAssignmentId);
@ -75,15 +75,15 @@ public class TrainingDMOTests {
// List<int> GetTrainees(int groupId);
// Training GetTraining(int trainingId);
// List<TrainingAssignment> GetTrainingAssignments(int TrainingID);
// List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, int userID);
// List<TrainingAssignment> GetTrainingAssignmentsByUserID(int userID);
// List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, appSettings.UserId);
// List<TrainingAssignment> GetTrainingAssignmentsByUserID(appSettings.UserId);
// TrainingGroup GetTrainingGroupByID(int groupId);
// TrainingGroup[] trainingGroups = trainingDMO.GetTrainingGroups().ToArray();
// int GetTrainingId(int issueId);
// int GetTrainingIdByAssignment(int trainingAssignmentID);
// Training[] trainingsC = trainingDMO.GetTrainings().ToArray();
// bool IsUserAssigned(int userId, int trainingId);
// bool isUserTrainingMember(int groupId, int userId);
// bool IsUserAssigned(appSettings.UserId, int trainingId);
// bool isUserTrainingMember(int groupId, appSettings.UserId);
// void reOpenTraining(int trainingId);
// void SetTrainingFlag(int ECNNumber);
// void UpdateAssignmentStatus(int trainingAssignmentID);

View File

@ -50,22 +50,25 @@ public class WorkflowDMOTests {
try { throw new Exception(); } catch (Exception) { }
}
private static void WorkflowDMO(ILogger? logger, AppSettings appSettings) {
private static void WorkflowDMO(ILogger? logger, AppSettings appSettings, int issueID, string comments, int documentType) {
#pragma warning disable IDE0059
bool isLastStep;
SetGlobalVars(logger, appSettings);
ECN_DMO ecnDMO = new();
ECN ecn = ecnDMO.GetECN(issueID);
WorkflowDMO workflowDMO = new();
// string AddAdditionalApproval(int issueID, string userIDs, byte step, int documentType);
// string AddEECNApproval(int ecnNumber, byte step, int documentType, string engUserIDs, string opUserIDs);
// bool Approve(int issueID, byte step, string comments, out bool lastStep, int userID, int documentType, int workFlowNumber);
bool check = workflowDMO.Approve(appSettings, issueID, ecn.CurrentStep, comments, out isLastStep, appSettings.UserId, documentType, ecn.WorkFlowNumber);
// string DelegateDocumentApproval(int issueID, int delegateFromUser, int delegateToUser);
// string GetApproversForCancelled_ExpiredTECNDocs(int ecnNumber);
// string GetSubRoleItems(int issueID, int docType);
// string GetSubRolesForPartsRequestNextStep(int prNumber);
// WorkflowSteps GetWorkflowStep(int docTypeID, int wfNumber, int stepNumber);
// string ReAssignApproval(int issueID, int assignedFromUser, int assignedToUser, byte step, int docType);
// bool Recall(int issueID, byte step, string comments, int userID, int docType);
// bool Reject(int issueID, byte step, string comments, int userID, int docType);
// void RejectTECNExtension(int ecnNumber, byte step, string comments, int userID, int docType);
// bool Recall(int issueID, byte step, string comments, appSettings.UserId, int docType);
// bool Reject(int issueID, byte step, string comments, appSettings.UserId, int docType);
// void RejectTECNExtension(int ecnNumber, byte step, string comments, appSettings.UserId, int docType);
if (workflowDMO is null) { }
#pragma warning restore IDE0059
}
@ -74,13 +77,14 @@ public class WorkflowDMOTests {
[Ignore]
#endif
[TestMethod]
public void WorkflowDMOIsAttachedOnly() {
[DataRow(82700, "comment", 3)]
public void WorkflowDMOIsAttachedOnly(int issueID, string comments, int documentType) {
_Logger?.LogInformation("Starting Web Application");
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
AppSettings? appSettings = serviceProvider?.GetRequiredService<AppSettings>();
Assert.IsTrue(appSettings is not null);
if (System.Diagnostics.Debugger.IsAttached)
WorkflowDMO(_Logger, appSettings);
WorkflowDMO(_Logger, appSettings, issueID, comments, documentType);
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
NonThrowTryCatch();
}

View File

@ -102,7 +102,7 @@ public class CorrectiveActionTests {
internal static void TestCorrectiveAction(ILogger? logger, AppSettings appSettings, int caNo) {
SetGlobalVars(logger, appSettings);
CorrectiveAction ca;
CorrectiveActionDMO caDMO = new(appSettings);
CorrectiveActionDMO caDMO = new();
ca = caDMO.GetCAItemReadOnly(caNo, appSettings.UserId);
if (ca is null)
throw new Exception($"{nameof(ca)}");

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; }

View File

@ -1,16 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[EncodeHtml] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[EncodeHtml] (@RawStr varchar(max)) RETURNS varchar(max) AS BEGIN RETURN REPLACE(
REPLACE(REPLACE(@RawStr, '&', '&AMP;'), '<', '&lt;'),
'>',
'&gt;'
)
END
GO

View File

@ -1,33 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn8DConvertCANoToCADisplayFormat] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fn8DConvertCANoToCADisplayFormat] (
-- Add the parameters for the function here
@CANo INT
) RETURNS VARCHAR(10) AS BEGIN -- Declare the return variable here
DECLARE @CADisplay VARCHAR(10) -- Add the T-SQL statements to compute the return value here
SET
@CADisplay = LTRIM(
RTRIM(
CAST(
'C' + RIGHT(
'00000' + ISNULL(CAST(@CANo AS VARCHAR(10)), ''),
5
) AS VARCHAR(50)
)
)
) -- Return the result of the function
RETURN @CADisplay
END
GO

View File

@ -1,28 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnAuditConvertAuditNoToDisplayFormat] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnAuditConvertAuditNoToDisplayFormat] (
-- Add the parameters for the function here
@AuditNo INT
) RETURNS VARCHAR(10) AS BEGIN -- Declare the return variable here
DECLARE @Display VARCHAR(10) -- Add the T-SQL statements to compute the return value here
SET
@Display = LTRIM(
RTRIM(
CAST(
'A' + RIGHT(
'00000' + ISNULL(CAST(@AuditNo AS VARCHAR(10)), ''),
5
) AS VARCHAR(50)
)
)
) -- Return the result of the function
RETURN @Display
END
GO

View File

@ -1,64 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetApprovalFullNames] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnGetApprovalFullNames] (
@IssueID int,
@DocumentTypeID int,
@Separator varchar(10),
@IncludeRole bit,
@IncludeSubRole bit,
@IncludePending bit,
@IncludeApproved bit,
@IncludeOthers bit
) RETURNS varchar(max) AS BEGIN DECLARE @r varchar(max) DECLARE @t TABLE(u varchar(200))
INSERT INTO
@t
SELECT
@Separator + ISNULL(U.FirstName, '') + ' ' + ISNULL(U.LastName, '') + CASE
WHEN @IncludeRole <> 0 THEN ' (' + A.RoleName + ')'
ELSE ''
END + CASE
WHEN @IncludeSubRole <> 0 THEN ' (' + A.SubRole + ')'
ELSE ''
END
FROM
Approval A
LEFT OUTER JOIN Users U ON A.UserID = U.UserID
WHERE
A.IssueID = @IssueID
AND A.DocumentTypeID = @DocumentTypeID
AND (
(
@IncludeOthers <> 0
AND A.ItemStatus NOT IN (0, 1)
)
OR (
@IncludePending <> 0
AND A.ItemStatus = 0
)
OR (
@IncludeApproved <> 0
AND A.ItemStatus = 1
)
)
ORDER BY
A.Step,
U.FirstName,
U.LastName
SELECT
@r = (
SELECT
u + ''
FROM
@t FOR XML PATH('')
) IF @r <> ''
SET
@r = STUFF(@r, 1, LEN(@Separator), '') RETURN @r
END
GO

View File

@ -1,24 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetITARUsers] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetITARUsers] () RETURNS TABLE AS RETURN (
SELECT
UserID,
HasITARAccess
FROM
SAMUsers
WHERE
HasITARAccess = 1
)
GO

View File

@ -1,33 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetLotCount_Fab] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetLotCount_Fab] (
-- Add the parameters for the function here
@IssueID INT
) RETURNS FLOAT AS BEGIN DECLARE @FabCount INT -- Declare the return variable here
SET
@FabCount = 0
SET
@FabCount = (
SELECT
COUNT(*)
FROM
Lot L
WHERE
L.IssueID = @IssueID
AND L.Location NOT IN ('6300', '6400 ', '6600', 'QDB')
) -- Return the result of the function
RETURN @FabCount
END
GO

View File

@ -1,33 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetLotCount_Probe] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetLotCount_Probe] (
-- Add the parameters for the function here
@IssueID INT
) RETURNS FLOAT AS BEGIN DECLARE @ProbeCount INT -- Declare the return variable here
SET
@ProbeCount = 0
SET
@ProbeCount = (
SELECT
COUNT(*)
FROM
Lot L
WHERE
L.IssueID = @IssueID
AND L.Location IN ('6300', '6400 ', '6600')
) -- Return the result of the function
RETURN @ProbeCount
END
GO

View File

@ -1,33 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetLotCount_QDB] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetLotCount_QDB] (
-- Add the parameters for the function here
@IssueID INT
) RETURNS FLOAT AS BEGIN DECLARE @QDBCount INT -- Declare the return variable here
SET
@QDBCount = 0
SET
@QDBCount = (
SELECT
COUNT(*)
FROM
Lot L
WHERE
L.IssueID = @IssueID
AND L.Location = 'QDB'
) -- Return the result of the function
RETURN @QDBCount
END
GO

View File

@ -1,37 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetLotCount_RH_MA] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetLotCount_RH_MA] (
-- Add the parameters for the function here
@IssueID INT
) RETURNS FLOAT AS BEGIN DECLARE @QDBCount INT -- Declare the return variable here
SET
@QDBCount = 0
SET
@QDBCount = (
SELECT
COUNT(*)
FROM
LotDisposition LD
INNER JOIN Lot L ON LD.IssueID = L.IssueID
WHERE
(
L.ProductFamily = 'RH'
OR L.ProductFamily = 'MA'
)
AND LD.IssueID = @IssueID
) -- Return the result of the function
RETURN @QDBCount
END
GO

View File

@ -1,27 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetLot_RH] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetLot_RH] (
-- Add the parameters for the function here
@IssueID INT
) RETURNS TABLE AS RETURN (
SELECT
L.IssueID
FROM
LotDisposition LD
INNER JOIN Lot L ON LD.IssueID = L.IssueID
WHERE
LD.IssueID = @IssueID
)
GO

View File

@ -1,63 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetMRB_SPN_HoldLots] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetMRB_SPN_HoldLots] (
-- Add the parameters for the function here
@MRBNumber INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
L.LotNumber,
MD.MRBNumber
FROM
MRBDispositionByMRB MD
INNER JOIN MRBLot L ON MD.DispositionType = L.DispoType
INNER JOIN MRB M ON M.MRBNumber = MD.MRBNumber
WHERE
CloseToQDBOptionID = 1
AND L.MRBNumber = @MRBNumber
AND MD.MRBNumber = @MRBNumber
AND L.LotNumber + CONVERt(VARCHAR(10), MD.MRBNumber) NOT IN (
SELECT
LotNumber + CONVERt(VARCHAR(10), MRBNumber)
FROM
MRB_SPN_HoldFlagLot
)
UNION
SELECT
LotNumber,
MRBNumber
FROM
MRB_SPN_HoldFlagLot
WHERE
LotNumber IN (
SELECT
DISTINCT L.LotNumber
FROM
MRBDispositionByMRB MD
INNER JOIN MRBLot L ON MD.DispositionType = L.DispoType
INNER JOIN MRB M ON M.MRBNumber = MD.MRBNumber
WHERE
CloseToQDBOptionID = 1
AND L.MRBNumber = @MRBNumber
AND MD.MRBNumber = @MRBNumber
AND L.LotNumber + CONVERt(VARCHAR(10), MD.MRBNumber) NOT IN (
SELECT
LotNumber + CONVERt(VARCHAR(10), MRBNumber)
FROM
MRB_SPN_HoldFlagLot
)
)
)
GO

View File

@ -1,70 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetScrapCost] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetScrapCost] (
-- Add the parameters for the function here
@IssueID INT
) RETURNS FLOAT AS BEGIN -- Declare the return variable here
DECLARE @WaferCount INT DECLARE @DieCount INT DECLARE @ScrapWaferCount INT DECLARE @ScrapCost FLOAT DECLARE @ScrapDieCount INT DECLARE @TotalCost FLOAT DECLARE @PerWaferCost FLOAT DECLARE @PerDieCost FLOAT DECLARE @TotalScrapCost FLOAT DECLARE @LotStatusOptionID INT
SET
@TotalScrapCost = 0 DECLARE ScrapCostCursor CURSOR FOR
SELECT
L.TotalCost,
L.WaferCount,
L.DieCount,
S.ScrapCount,
L.LotStatusOptionID
FROM
Lot L
INNER JOIN ScrapLot S ON L.IssueID = S.IssueID
AND L.LotNumber = S.LotNo
WHERE
L.IssueID = @IssueID OPEN ScrapCostCursor FETCH NEXT
FROM
ScrapCostCursor INTO @TotalCost,
@WaferCount,
@DieCount,
@ScrapWaferCount,
@LotStatusOptionID WHILE @ @FETCH_STATUS = 0 BEGIN
SET
@PerWaferCost = 0
SET
@PerDieCost = 0 IF @ScrapWaferCount > 0
AND @WaferCount > 0
AND @TotalCost > 0 BEGIN
SET
@PerWaferCost = @TotalCost / @WaferCount;
SET
@ScrapCost = @ScrapWaferCount * @PerWaferCost --PRINT @ScrapCost
SET
@TotalScrapCost = @TotalScrapCost + @ScrapCost
END
ELSE IF @DieCount > 0
AND @LotStatusOptionID = 2 BEGIN
SET
@ScrapCost = @TotalCost
SET
@TotalScrapCost = @TotalScrapCost + @ScrapCost
END FETCH NEXT
FROM
ScrapCostCursor INTO @TotalCost,
@WaferCount,
@ScrapDieCount,
@ScrapWaferCount,
@LotStatusOptionID
END CLOSE ScrapCostCursor DEALLOCATE ScrapCostCursor -- Return the result of the function
RETURN @TotalScrapCost
END
GO

View File

@ -1,32 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetScrapCount] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetScrapCount] (
-- Add the parameters for the function here
@IssueID INT
) RETURNS INT AS BEGIN -- Declare the return variable here
DECLARE @ScrapCount INT -- Add the T-SQL statements to compute the return value here
SELECT
@ScrapCount = SUM(ScrapCount)
FROM
LotDisposition LD
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN ScrapLot S ON L.IssueID = S.IssueID
AND L.LotNumber = S.LotNo
WHERE
LD.IssueID = @IssueID
AND ScrapCount > 0 -- Return the result of the function
RETURN @ScrapCount
END
GO

View File

@ -1,109 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep1Roles] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep1Roles] (
-- Add the parameters for the function here
@IssueID INT,
@CurrentDate DATETIME
) RETURNS TABLE AS RETURN (
-- Get Roles based on the Responibility
SELECT
DISTINCT IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
DocumentType D
INNER JOIN Workflows W ON D.DocumentTypeID = W.DocumentTypeID
INNER JOIN WorkFlowSteps WS ON W.WorkflowID = WS.WorkflowID
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN ResponsibilityIssue RI ON LTRIM(RTRIM(SRC.SubRoleCategoryItem)) = LTRIM(RTRIM(RI.Issue))
INNER JOIN LotDisposition LD ON RI.ResponsibilityIssueID = LD.ResponsibilityIssueID -- Get the em
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
AND WorkflowStepNumber = LD.CurrentStep
AND DocumentType = 'LotDisposition'
UNION
ALL -- Get YE Roles Based on Product and Gen
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
AND LTRIM(RTRIM(L.ProductFamily)) + '-G' + LTRIM(RTRIM(CONVERT(CHAR(10), L.Gen))) = SRC.SubRoleCategoryItem
AND RoleName = 'Yield Engineer'
UNION
ALL -- M_Suffix
SELECT
DISTINCT Ld.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
INNER JOIN LotStatusOption LSO ON L.LotStatusOptionID = LSO.LotStatusOptionID
WHERE
LD.IssueID = @IssueID
AND LSO.LotStatusOption = SRC.SubRoleCategoryItem
)
GO

View File

@ -1,50 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep1RolesMA_YE] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep1RolesMA_YE] (
-- Add the parameters for the function here
@IssueID INT,
@CurrentDate DATETIME
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
AND (SRC.SubRoleCategoryItem = 'MA-All')
AND (RoleName = 'Yield Engineer')
)
GO

View File

@ -1,45 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep1RolesMA_YE_PE] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep1RolesMA_YE_PE] (@IssueID INT, @CurrentDate DATETIME) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
AND (SRC.SubRoleCategoryItem = 'MA-All')
)
GO

View File

@ -1,50 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep1RolesRH_YE] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep1RolesRH_YE] (
-- Add the parameters for the function here
@IssueID INT,
@CurrentDate DATETIME
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
AND (SRC.SubRoleCategoryItem = 'RH-All')
AND (RoleName = 'Yield Engineer')
)
GO

View File

@ -1,45 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep1RolesRH_YE_PE] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep1RolesRH_YE_PE] (@IssueID INT, @CurrentDate DATETIME) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
AND (SRC.SubRoleCategoryItem = 'RH-All')
)
GO

View File

@ -1,108 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep1Roles_PERequired] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep1Roles_PERequired] (
-- Add the parameters for the function here
@IssueID INT,
@CurrentDate DATETIME
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
DocumentType D
INNER JOIN Workflows W ON D.DocumentTypeID = W.DocumentTypeID
INNER JOIN WorkFlowSteps WS ON W.WorkflowID = WS.WorkflowID
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN ResponsibilityIssue RI ON LTRIM(RTRIM(SRC.SubRoleCategoryItem)) = LTRIM(RTRIM(RI.Issue))
INNER JOIN LotDisposition LD ON RI.ResponsibilityIssueID = LD.ResponsibilityIssueID -- Get the em
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
AND WorkflowStepNumber = LD.CurrentStep
AND DocumentType = 'LotDisposition'
UNION
ALL --YE and PE Rquired
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
AND LTRIM(RTRIM(L.ProductFamily)) + '-G' + LTRIM(RTRIM(CONVERT(CHAR(10), L.Gen))) = SRC.SubRoleCategoryItem
UNION
ALL -- M_Suffix
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
INNER JOIN LotStatusOption LSO ON L.LotStatusOptionID = LSO.LotStatusOptionID
WHERE
LD.IssueID = @IssueID
AND LSO.LotStatusOption = SRC.SubRoleCategoryItem
)
GO

View File

@ -1,45 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep2Roles_GT_10Wafers] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep2Roles_GT_10Wafers] (@IssueID INT, @CurrentDate DATETIME) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN LotDispoDepartment LDD ON LD.IssueID = LDD.IssueID
AND SRC.SubRoleCategoryID = LDD.DepartmentID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
)
GO

View File

@ -1,45 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep2Roles_PlantManager] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep2Roles_PlantManager] (@IssueID INT, @CurrentDate DATETIME) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
AND (SRC.SubRoleCategoryItem = 'Plant Manager')
INNER JOIN LotDispoDepartment LDD ON LD.IssueID = LDD.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
)
GO

View File

@ -1,49 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep2Roles_RhMaQdbPeMRB] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep2Roles_RhMaQdbPeMRB] (@IssueID INT, @CurrentDate DATETIME) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
AND (
SRC.SubRoleCategoryItem <> 'Facilities'
AND SRC.SubRoleCategoryItem <> 'Plant Manager'
AND SRC.SubRoleCategoryItem <> 'M_Suffix'
)
INNER JOIN LotDispoDepartment LDD ON LD.IssueID = LDD.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
)
GO

View File

@ -1,44 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep3Role_QDB] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnGetStep3Role_QDB] (
-- Add the parameters for the function here
@IssueID INT,
@Current DATETIME
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@Current AS 'AssignedDate',
@Current AS 'NotifyDate',
@Current AS 'RoleAssignedDate',
2 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
AND SRC.SubRoleCategoryItem = 'QDB'
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
)
GO

View File

@ -1,45 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep3Roles_Fab] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep3Roles_Fab] (@IssueID INT, @Current DATETIME) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@Current AS 'AssignedDate',
@Current AS 'NotifyDate',
@Current AS 'RoleAssignedDate',
2 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
AND SRC.SubRoleCategoryItem = 'Fab'
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @issueID
)
GO

View File

@ -1,45 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnGetStep3Roles_Probe] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnGetStep3Roles_Probe] (@IssueID INT, @Current DATETIME) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT LD.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@Current AS 'AssignedDate',
@Current AS 'NotifyDate',
@Current AS 'RoleAssignedDate',
2 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Workflows W ON WS.WorkflowID = W.WorkflowID
INNER JOIN DocumentType D ON W.DocumentTypeID = D.DocumentTypeID
AND DocumentType = 'LotDisposition'
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
AND SRC.SubRoleCategoryItem = 'Probe'
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
WHERE
LD.IssueID = @IssueID
)
GO

View File

@ -1,27 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnIsUserITARCompliant] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fnIsUserITARCompliant] (@UserID INT) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
--SELECT SAM.* FROM [TEM-CDB02].SAM.dbo.vwSamActiveUsersWithSupervisorID SAM
SELECT
SAM.*
FROM
SAMUsers SAM
INNER JOIN Users U ON SAM.UserID = U.LoginID
WHERE
HasITARAccess = 1
AND U.UserID = @UserID -- Return the result of the function
)
GO

View File

@ -1,70 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnLotDispositionLotSummary] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnLotDispositionLotSummary](@IssueID int) RETURNS TABLE AS RETURN (
SELECT
SUM(
CASE
WHEN L.LotStatusOptionID IN (1, 4, 6)
AND L.DieCount > 0 THEN L.TotalCost -- Release, M_Suffix, CloseToQDB
WHEN S.ReleaseCount > 0
AND L.WaferCount > 0
AND L.TotalCost > 0 THEN S.ReleaseCount * (L.TotalCost / L.WaferCount)
ELSE 0
END
) AS [TotalReleaseCost],
SUM(
CASE
WHEN S.ReleaseCount > 0
AND L.WaferCount > 0
AND L.TotalCost > 0 THEN S.ReleaseCount
ELSE 0
END
) AS [TotalReleaseWaferCount],
SUM(
CASE
WHEN L.LotStatusOptionID IN (1, 4, 6) -- Release, M_Suffix, CloseToQDB
AND L.DieCount > 0 THEN L.DieCount
ELSE 0
END
) AS [TotalDieReleaseCount],
SUM(
CASE
WHEN L.LotStatusOptionID = 2
AND L.DieCount > 0 THEN L.TotalCost -- Scrap
WHEN S.ScrapCount > 0
AND L.WaferCount > 0
AND L.TotalCost > 0 THEN S.ScrapCount * (L.TotalCost / L.WaferCount)
ELSE 0
END
) AS [TotalScrapCost],
SUM(
CASE
WHEN S.ScrapCount > 0
AND L.WaferCount > 0
AND L.TotalCost > 0 THEN S.ScrapCount
ELSE 0
END
) AS [TotalScrapWaferCount],
SUM(
CASE
WHEN L.LotStatusOptionID = 2
AND L.DieCount > 0 THEN L.DieCount -- Scrap
ELSE 0
END
) AS [TotalScrapDieCount],
COUNT(L.LotNumber) AS LotCount
FROM
ScrapLot S
INNER JOIN Lot L ON S.IssueID = L.IssueID
AND S.LotNo = L.LotNumber
WHERE
S.IssueID = @IssueID
)
GO

View File

@ -1,30 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnPartsRequestGetSubRolesForNextStep] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnPartsRequestGetSubRolesForNextStep] (@PRNumber int) RETURNS varchar(100) AS BEGIN DECLARE @NextStep int = 0 DECLARE @r varchar(100)
SELECT
@NextStep = CurrentStep + 1
FROM
PartsRequest
WHERE
PRNumber = @PRNumber
SET
@r = CASE
WHEN @NextStep = 1 THEN 'Part Assignment'
WHEN @NextStep = 2 THEN 'Pre-Approver'
WHEN @NextStep = 3 THEN 'Tech Lead'
WHEN @NextStep = 4 THEN 'Finance'
WHEN @NextStep = 5 THEN 'SAP'
WHEN @NextStep = 6 THEN 'Source List & Info Record'
WHEN @NextStep = 7 THEN 'Buyer/Planner'
WHEN @NextStep = 8 THEN 'Close to Folder'
ELSE 'Part Assignment'
END RETURN @r
END
GO

View File

@ -1,28 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnPlanConvertPlanNoToDisplayFormat] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnPlanConvertPlanNoToDisplayFormat] (
-- Add the parameters for the function here
@PlanNo INT
) RETURNS VARCHAR(10) AS BEGIN -- Declare the return variable here
DECLARE @Display VARCHAR(10) -- Add the T-SQL statements to compute the return value here
SET
@Display = LTRIM(
RTRIM(
CAST(
'P' + RIGHT(
'0000' + ISNULL(CAST(@PlanNo AS VARCHAR(10)), ''),
5
) AS VARCHAR(50)
)
)
) -- Return the result of the function
RETURN @Display
END
GO

View File

@ -1,29 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fnSplitCSV] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fnSplitCSV](@csv varchar(max)) RETURNS @r TABLE (Position int, Val varchar(max)) AS BEGIN DECLARE @I INT = 1 DECLARE @VAL VARCHAR(1000) DECLARE @SEPERATOR CHAR(1) = ',' DECLARE @SP INT DECLARE @WORK VARCHAR(MAX) = @csv WHILE PATINDEX('%' + @SEPERATOR + '%', @WORK) <> 0 BEGIN
SELECT
@SP = PATINDEX('%' + @SEPERATOR + '%', @WORK)
SELECT
@VAL = LEFT(@WORK, @SP - 1)
SELECT
@WORK = STUFF(@WORK, 1, @SP, '')
INSERT INTO
@r
VALUES
(@I, @VAL)
SET
@I = @I + 1
END IF @WORK <> ''
INSERT INTO
@r
VALUES
(@I, @WORK) RETURN
END
GO

View File

@ -1,48 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_Get8DAuditByUser] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_Get8DAuditByUser] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'Audit' AS DocumentType,
'Audit' AS SubDoc,
*
FROM
(
SELECT
DISTINCT A.AuditNo as IssueID,
A.AuditNo DocID,
A.AuditDate,
'' AS LotNos,
'' AS 'PendingApprovers',
A.AuditTitle AS Title,
'' AS IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
A.AuditDate SubmitedDate,
NULL AS CloseDate,
'' AS ItemStatus,
NULL AS NextDueDate
FROM
_8DAudit A
INNER JOIN Users U2 ON A.OriginatorID = U2.UserID
WHERE
A.OriginatorID = @UserID
AND (A.AuditStatus = 0)
) AS A
)
GO

View File

@ -1,132 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_Get8DCAByUser] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_Get8DCAByUser] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'CorrectiveAction' AS DocumentType,
'CA' AS SubDoc,
*
FROM
(
SELECT
DISTINCT CA.CANo as IssueID,
CA.CANo as DocID,
CA.IssueDate,
'' AS LotNos,
pdg.Names AS 'PendingApprovers',
CA.CATitle AS Title,
CA.D2ProblemDescription IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
CA.CACompleteDate SubmitedDate,
CA.ClosedDate CloseDate,
A.ItemStatus,
CASE
WHEN Status = 1 THEN NULL
WHEN Status IN (10, 9, 3) THEN CA.D3DueDate
WHEN Status IN (4, 5, 6, 7) THEN CA.D5D7DueDate
WHEN Status = 11 THEN CA.FollowUpDate
ELSE CA.D8DueDate
END AS NextDueDate
FROM
_8DCorrectiveAction CA
INNER JOIN Approval A ON A.IssueID = CA.CANo
AND DocumentTypeID = 9
LEFT JOIN Users U2 ON CA.RequestorID = U2.UserID
INNER JOIN Users U1 ON A.UserID = U1.UserID
LEFT JOIN (
SELECT
DISTINCT CA.CANo,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 9
AND A.IssueID = CA.CANo
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
_8DCorrectiveAction CA
) AS pdg ON CA.CANo = pdg.CANo
WHERE
A.UserID = @UserID
AND Status NOT IN (1, 11)
AND CA.Deleted = 0
UNION
SELECT
DISTINCT CA.CANo as IssueID,
CA.CANo as DocID,
CA.IssueDate,
'' AS LotNos,
pdg.Names AS 'PendingApprovers',
CA.CATitle AS Title,
CA.D2ProblemDescription IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
CA.CACompleteDate SubmitedDate,
CA.ClosedDate CloseDate,
A.ItemStatus,
CASE
WHEN Status = 1 THEN NULL
WHEN Status IN (10, 9, 3) THEN CA.D3DueDate
WHEN Status IN (4, 5, 6, 7) THEN CA.D5D7DueDate
WHEN Status = 11 THEN CA.FollowUpDate
ELSE CA.D8DueDate
END AS NextDueDate
FROM
_8DCorrectiveAction CA
LEFT JOIN Approval A ON A.IssueID = CA.CANo
AND DocumentTypeID = 9
INNER JOIN Users U2 ON CA.RequestorID = U2.UserID
LEFT JOIN (
SELECT
DISTINCT CA.CANo,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 9
AND A.IssueID = CA.CANo
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
_8DCorrectiveAction CA
) AS pdg ON CA.CANo = pdg.CANo
WHERE
CA.QAID = @UserID
AND CA.ClosedDate IS NULL -- added the where clause below on 8/2/2019 RJK
AND Status <> 1
AND CA.Deleted = 0
) AS A
)
GO

View File

@ -1,50 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_Get8DCASectionByUser] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_Get8DCASectionByUser] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'CorrectiveAction' AS DocumentType,
'CA' AS SubDoc,
*
FROM
(
SELECT
DISTINCT CA.CANo as IssueID,
CA.CANo as DocID,
CA.IssueDate,
'' AS LotNos,
'' AS 'PendingApprovers',
CONCAT(A.DSection, ' Approval', ' - ', CA.CATitle) AS Title,
'' AS 'IssueDescription',
U2.FirstName + ' ' + U2.LastName AS Originator,
A.DateAssigned AS SubmitedDate,
'' AS CloseDate,
'' AS ItemStatus,
NULL AS NextDueDate
FROM
_8DCorrectiveAction CA
INNER JOIN _8DSectionApproval A ON A.CaNo = CA.CANo
LEFT JOIN Users U2 ON CA.RequestorID = U2.UserID
WHERE
A.Approved IS NULL
AND A.UserId = @UserID
AND CA.Deleted = 0
) AS A
)
GO

View File

@ -1,45 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetChangeControl] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetChangeControl] () RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'ChangeControl' AS DocumentType,
'ChangeControl' AS SubDoc,
CC.PlanNumber AS IssueID,
CC.PlanNumber AS DocID,
CC.InsertTimeStamp AS IssueDate,
'' AS LotNos,
'' AS 'PendingApprovers',
Title,
ChangeDescription AS IssueDescription,
U.FirstName + ' ' + U.LastName AS Originator,
Dates.StartDate AS SubmitedDate,
ClosedDate AS CloseDate
FROM
CCChangeControl CC
LEFT JOIN Users U ON CC.OwnerID = U.UserID
LEFT JOIN (
SELECT
PlanNumber,
MIN(MeetingDate) AS StartDate,
MAX(MeetingDate) AS StatusDate
FROM
CCMeeting
GROUP BY
PlanNumber
) AS Dates ON CC.PlanNumber = Dates.PlanNumber
)
GO

View File

@ -1,67 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetECNs] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetECNs] () RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
'ECN' AS DocumentType,
CASE
WHEN E.IsECN = 1 THEN 'ECN'
WHEN E.IsTECN = 1 THEN 'TECN'
WHEN E.IsEmergencyTECN = 1 THEN 'E-TECN'
ELSE 'ECN'
END AS SubDoc,
E.ECNNumber AS IssueID,
E.ECNNumber AS DocID,
IssueDate,
'' AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
DescriptionOfChange AS IssueDescription,
U.FirstName + ' ' + U.LastName AS Originator,
SubmitedDate,
CloseDate
FROM
ECN E
LEFT JOIN Users U ON E.OriginatorID = U.UserID
LEFT JOIN (
SELECT
DISTINCT E.ECNNumber AS IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
(
A.DocumentTypeID = 3
OR A.DocumentTypeID = 4
)
AND A.IssueID = E.ECNNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
ECN E
) AS pdg ON E.ECNNumber = pdg.IssueID
WHERE
E.Deleted = 0
)
GO

View File

@ -1,170 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetECNsByUser] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetECNsByUser] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'ECN' AS DocumentType,
*
FROM
(
SELECT
CASE
WHEN E.IsECN = 1 THEN 'ECN'
WHEN E.IsTECN = 1 THEN 'TECN'
WHEN E.IsEmergencyTECN = 1 THEN 'E-TECN'
ELSE 'ECN'
END AS SubDoc,
E.ECNNumber AS IssueID,
E.ECNNumber AS DocID,
IssueDate,
'' AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
DescriptionOfChange AS IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
SubmitedDate,
CloseDate,
A.ItemStatus,
NULL AS NextDueDate
FROM
ECN E
INNER JOIN Approval A ON A.IssueID = E.ECNNumber
AND (
A.DocumentTypeID = 3
OR A.DocumentTypeID = 4
OR A.DocumentTypeID = 5
)
INNER JOIN Users U2 ON E.OriginatorID = U2.UserID
INNER JOIN Users U1 ON A.UserID = U1.UserID
LEFT JOIN (
SELECT
DISTINCT E.ECNNumber AS IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
(
A.DocumentTypeID = 3
OR A.DocumentTypeID = 4
OR A.DocumentTypeID = 5
)
AND A.IssueID = E.ECNNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
ECN E
) AS pdg ON E.ECNNumber = pdg.IssueID
WHERE
A.UserID = @UserID
AND E.Deleted = 0
AND (
ItemStatus = 0
OR (
ItemStatus = 2
AND DisplayDeniedDocument = 1
)
OR (
A.ItemStatus = 8
AND (
ExtensionDate > GETDATE()
OR ExpirationDate > GETDATE()
)
)
)
AND E.CancellationApproved = 0 --List of documents orginated by the user
UNION
ALL
SELECT
DISTINCT CASE
WHEN E.IsECN = 1 THEN 'ECN'
WHEN E.IsTECN = 1 THEN 'TECN'
WHEN E.IsEmergencyTECN = 1 THEN 'E-TECN'
ELSE 'ECN'
END AS SubDoc,
E.ECNNumber AS IssueID,
E.ECNNumber AS DocID,
IssueDate,
'' AS LotNos,
ISNULL(pdg.Names, '') AS 'PendingApprovers',
Title,
DescriptionOfChange AS IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
SubmitedDate,
CloseDate,
AP.ItemStatus,
NULL AS NextDueDate
FROM
ECN E
INNER JOIN Users U1 ON E.OriginatorID = U1.UserID
LEFT JOIN Approval AP ON E.ECNNumber = AP.IssueID
LEFT JOIN (
SELECT
DISTINCT E.ECNNumber AS IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
(
A.DocumentTypeID = 3
OR A.DocumentTypeID = 4
OR A.DocumentTypeID = 5
)
AND A.IssueID = E.ECNNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
ECN E
) AS pdg ON E.ECNNumber = pdg.IssueID
WHERE
U1.UserID = @UserID
AND E.Deleted = 0
AND E.CancellationApproved = 0
AND E.ECNNumber NOT IN (
SELECT
IssueID
FROM
Approval
WHERE
IssueID = E.ECNNumber
AND ItemStatus <> 2
AND ItemStatus <> 8
AND (
DocumentTypeID = 3
OR DocumentTypeID = 4
)
)
) AS A
)
GO

View File

@ -1,155 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetECNsByUserPrev] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetECNsByUserPrev] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'ECN' AS DocumentType,
*
FROM
(
SELECT
CASE
WHEN E.IsECN = 1 THEN 'ECN'
WHEN E.IsTECN = 1 THEN 'TECN'
WHEN E.IsEmergencyTECN = 1 THEN 'E-TECN'
ELSE 'ECN'
END AS SubDoc,
E.ECNNumber AS IssueID,
IssueDate,
'' AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
DescriptionOfChange AS IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
SubmitedDate,
CloseDate,
A.ItemStatus
FROM
ECN E
INNER JOIN Approval A ON A.IssueID = E.ECNNumber
AND (
A.DocumentTypeID = 3
OR A.DocumentTypeID = 4
OR A.DocumentTypeID = 5
)
INNER JOIN Users U2 ON E.OriginatorID = U2.UserID
INNER JOIN Users U1 ON A.UserID = U1.UserID
LEFT JOIN (
SELECT
DISTINCT E.ECNNumber AS IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
(
A.DocumentTypeID = 3
OR A.DocumentTypeID = 4
OR A.DocumentTypeID = 5
)
AND A.IssueID = E.ECNNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
ECN E
) AS pdg ON E.ECNNumber = pdg.IssueID
WHERE
A.UserID = @UserID
AND E.Deleted = 0
AND (
ItemStatus = 0
OR (
ItemStatus = 2
AND DisplayDeniedDocument = 1
)
) --List of documents orginated by the user
UNION
ALL
SELECT
DISTINCT CASE
WHEN E.IsECN = 1 THEN 'ECN'
WHEN E.IsTECN = 1 THEN 'TECN'
WHEN E.IsEmergencyTECN = 1 THEN 'E-TECN'
ELSE 'ECN'
END AS SubDoc,
E.ECNNumber AS IssueID,
IssueDate,
'' AS LotNos,
ISNULL(pdg.Names, '') AS 'PendingApprovers',
Title,
DescriptionOfChange AS IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
SubmitedDate,
CloseDate,
AP.ItemStatus
FROM
ECN E
INNER JOIN Users U1 ON E.OriginatorID = U1.UserID
LEFT JOIN Approval AP ON E.ECNNumber = AP.IssueID
LEFT JOIN (
SELECT
DISTINCT E.ECNNumber AS IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
(
A.DocumentTypeID = 3
OR A.DocumentTypeID = 4
OR A.DocumentTypeID = 5
)
AND A.IssueID = E.ECNNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
ECN E
) AS pdg ON E.ECNNumber = pdg.IssueID
WHERE
U1.UserID = @UserID
AND E.ECNNumber NOT IN (
SELECT
IssueID
FROM
Approval
WHERE
IssueID = E.ECNNumber
AND ItemStatus <> 2
AND (
DocumentTypeID = 3
OR DocumentTypeID = 4
)
)
) AS A
)
GO

View File

@ -1,88 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetExpiredTECNByOriginator] ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetExpiredTECNByOriginator] (
-- Add the parameters for the function here
@UserID INT,
@MaxDays INT
) RETURNS TABLE AS RETURN (
SELECT
DISTINCT 'ECN' AS DocumentType,
CASE
WHEN E.IsECN = 1 THEN 'ECN'
WHEN E.IsTECN = 1 THEN 'TECN'
WHEN E.IsEmergencyTECN = 1 THEN 'E-TECN'
ELSE 'ECN'
END AS SubDoc,
E.ECNNumber AS IssueID,
E.ECNNumber AS DocID,
IssueDate,
'' AS LotNos,
ISNULL(pdg.Names, '') AS 'PendingApprovers',
Title,
DescriptionOfChange AS IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
SubmitedDate,
CloseDate,
ItemStatus,
NULL AS NextDueDate
FROM
ECN E
INNER JOIN Users U1 ON E.OriginatorID = U1.UserID
LEFT JOIN Approval AP ON E.ECNNumber = AP.IssueID
LEFT JOIN (
SELECT
DISTINCT E.ECNNumber AS IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
(
A.DocumentTypeID = 3
OR A.DocumentTypeID = 4
OR A.DocumentTypeID = 5
)
AND A.IssueID = E.ECNNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
ECN E
) AS pdg ON E.ECNNumber = pdg.IssueID
WHERE
E.OriginatorID = @UserID
AND E.IsTECN = 1
AND (
(
ExtensionDate IS NULL
AND DATEDIFF(dd, ExpirationDate, GETDATE()) BETWEEN 0
AND @MaxDays
)
OR (
DATEDIFF(dd, ExtensionDate, GETDATE()) BETWEEN 0
AND @MaxDays
)
)
AND CloseDate IS NOT NULL
AND ExpirationDate < GETDATE()
AND Deleted = 0
)
GO

View File

@ -1,59 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetLTWorkRequests] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetLTWorkRequests] () RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'LotTraveler' AS DocumentType,
'LotTraveler' AS SubDoc,
W.SWRNumber AS IssueID,
W.ID AS DocID,
W.OriginatedDate AS IssueDate,
W.LotNumber AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
PurposeOfRequest,
U.FirstName + ' ' + U.LastName AS Originator,
SubmitedDate,
CloseDate
FROM
LTWorkRequest W
LEFT JOIN Users U ON W.OriginatorID = U.UserID
LEFT JOIN (
SELECT
DISTINCT W.ID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 6
AND A.IssueID = W.ID
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
LTWorkRequest W
) AS pdg ON W.ID = pdg.ID
WHERE
IsCurrentRevision = 1
)
GO

View File

@ -1,140 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetLTWorkRequestsByUser] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetLTWorkRequestsByUser] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'LotTraveler' AS DocumentType,
'LotTraveler' AS SubDoc,
*
FROM
(
SELECT
DISTINCT W.SWRNumber AS IssueID,
W.ID AS DocID,
W.OriginatedDate AS IssueDate,
W.LotNumber AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
PurposeOfRequest,
U2.FirstName + ' ' + U2.LastName AS Originator,
SubmitedDate,
CloseDate,
A.ItemStatus,
NULL AS NextDueDate
FROM
LTWorkRequest W WITH(NOLOCK)
INNER JOIN Approval A WITH(NOLOCK) ON A.IssueID = W.ID
AND DocumentTypeID = 6
INNER JOIN Users U2 WITH(NOLOCK) ON W.OriginatorID = U2.UserID
INNER JOIN Users U1 WITH(NOLOCK) ON A.UserID = U1.UserID --LEFT JOIN
--(SELECT DISTINCT M.MRBNumber, STUFF
-- ((SELECT '/' + CAST(L.LotNumber AS varchar(512))
-- FROM MRBLot L
-- WHERE L.MRBNumber = M.MRBNumber FOR XML PATH('')), 1, 1, '') AS LotNo
-- FROM MRB M) AS SQ
--ON M.MRBNumber = SQ.MRBNumber
LEFT JOIN (
SELECT
DISTINCT W.ID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A WITH(NOLOCK)
INNER JOIN Users U WITH(NOLOCK) ON A.UserID = U.UserID
WHERE
DocumentTypeID = 6
AND A.IssueID = W.ID
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
LTWorkRequest W WITH(NOLOCK)
) AS pdg ON W.ID = pdg.ID
WHERE
A.UserID = @UserID
AND (ItemStatus = 0)
AND IsCurrentRevision = 1
UNION
ALL
SELECT
DISTINCT W.SWRNumber AS IssueID,
W.ID AS DocID,
W.OriginatedDate AS IssueDate,
W.LotNumber AS LotNos,
ISNULL(pdg.Names, '') AS 'PendingApprovers',
Title,
PurposeOfRequest,
U1.FirstName + ' ' + U1.LastName AS Originator,
SubmitedDate,
CloseDate,
AP.ItemStatus,
NULL AS NextDueDate
FROM
LTWorkRequest W WITH(NOLOCK)
INNER JOIN Users U1 WITH(NOLOCK) ON W.OriginatorID = U1.UserID
LEFT JOIN Approval AP WITH(NOLOCK) ON W.ID = AP.IssueID --LEFT JOIN
--(SELECT DISTINCT LD.IssueID, STUFF
-- ((SELECT '/' + CAST(L.LotNumber AS varchar(512))
-- FROM Lot L
-- WHERE L.IssueID = LD.IssueID FOR XML PATH('')), 1, 1, '') AS LotNo
-- FROM LotDisposition LD) AS SQ
--ON LD.IssueID = SQ.IssueID
LEFT JOIN (
SELECT
DISTINCT W.ID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A WITH(NOLOCK)
INNER JOIN Users U WITH(NOLOCK) ON A.UserID = U.UserID
WHERE
DocumentTypeID = 6
AND A.IssueID = W.ID
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
LTWorkRequest W WITH(NOLOCK)
) AS pdg ON W.ID = pdg.ID
WHERE
U1.UserID = @UserID
AND W.ID NOT IN (
SELECT
IssueID
FROM
Approval WITH(NOLOCK)
WHERE
IssueID = W.ID
AND ItemStatus <> 2
AND DocumentTypeID = 6
)
AND IsCurrentRevision = 1
) AS A
)
GO

View File

@ -1,76 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetLotDispositions] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetLotDispositions] () RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
'LotDisposition' AS DocumentType,
'LotDisposition' AS SubDoc,
LD.IssueID,
LD.IssueID AS DocID,
IssueDate,
SQ.LotNo AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
IssueDescription,
U.FirstName + ' ' + U.LastName AS Originator,
SubmitedDate,
CloseDate
FROM
LotDisposition LD
LEFT JOIN Users U ON LD.OriginatorID = U.UserID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
Lot L
WHERE
L.IssueID = LD.IssueID FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
LotDisposition LD
) AS SQ ON LD.IssueID = SQ.IssueID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
A.DocumentTypeID = 1
AND A.IssueID = LD.IssueID
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
LotDisposition LD
) AS pdg ON LD.IssueID = pdg.IssueID
)
GO

View File

@ -1,170 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetLotDispositionsByUser] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetLotDispositionsByUser] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'LotDisposition' AS DocumentType,
'LotDisposition' AS SubDoc,
*
FROM
(
SELECT
DISTINCT LD.IssueID,
LD.IssueID AS DocID,
IssueDate,
ISNULL(SQ.LotNo, '') AS LotNos,
ISNULL(pdg.Names, '') AS 'PendingApprovers',
Title,
IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
SubmitedDate,
CloseDate,
A.ItemStatus,
NULL AS NextDueDate
FROM
LotDisposition LD
INNER JOIN Approval A ON A.IssueID = LD.IssueID
AND DocumentTypeID = 1
LEFT JOIN Users U2 ON LD.OriginatorID = U2.UserID
INNER JOIN Users U1 ON A.UserID = U1.UserID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
Lot L
WHERE
L.IssueID = LD.IssueID FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
LotDisposition LD
) AS SQ ON LD.IssueID = SQ.IssueID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 1
AND A.IssueID = LD.IssueID
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
LotDisposition LD
) AS pdg ON LD.IssueID = pdg.IssueID
WHERE
A.UserID = @UserID
AND (
ItemStatus = 0
OR (
ItemStatus = 2
AND DisplayDeniedDocument = 1
)
)
UNION
ALL
SELECT
DISTINCT LD.IssueID,
LD.IssueID AS DocID,
IssueDate,
ISNULL(SQ.LotNo, '') AS LotNos,
ISNULL(pdg.Names, '') AS 'PendingApprovers',
Title,
IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
SubmitedDate,
CloseDate,
AP.ItemStatus,
NULL AS NextDueDate
FROM
LotDisposition LD
INNER JOIN Users U1 ON LD.OriginatorID = U1.UserID
LEFT JOIN Approval AP ON LD.IssueID = AP.IssueID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
Lot L
WHERE
L.IssueID = LD.IssueID FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
LotDisposition LD
) AS SQ ON LD.IssueID = SQ.IssueID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50)) + '(' + A.RoleName + ')'
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 1
AND A.IssueID = LD.IssueID
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
LotDisposition LD
) AS pdg ON LD.IssueID = pdg.IssueID
WHERE
U1.UserID = @UserID
AND LD.IssueID NOT IN (
SELECT
IssueID
FROM
Approval
WHERE
IssueID = LD.IssueID
AND ItemStatus <> 2
AND DocumentTypeID = 1
)
) AS A
)
GO

View File

@ -1,166 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetLotDispositionsByUserPrev] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetLotDispositionsByUserPrev] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'LotDisposition' AS DocumentType,
'LotDisposition' AS SubDoc,
*
FROM
(
SELECT
DISTINCT LD.IssueID,
IssueDate,
ISNULL(SQ.LotNo, '') AS LotNos,
ISNULL(pdg.Names, '') AS 'PendingApprovers',
Title,
IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
SubmitedDate,
CloseDate,
A.ItemStatus
FROM
LotDisposition LD
INNER JOIN Approval A ON A.IssueID = LD.IssueID
AND DocumentTypeID = 1
INNER JOIN Users U2 ON LD.OriginatorID = U2.UserID
INNER JOIN Users U1 ON A.UserID = U1.UserID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
Lot L
WHERE
L.IssueID = LD.IssueID FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
LotDisposition LD
) AS SQ ON LD.IssueID = SQ.IssueID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 1
AND A.IssueID = LD.IssueID
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
LotDisposition LD
) AS pdg ON LD.IssueID = pdg.IssueID
WHERE
A.UserID = @UserID
AND (
ItemStatus = 0
OR (
ItemStatus = 2
AND DisplayDeniedDocument = 1
)
)
UNION
ALL
SELECT
DISTINCT LD.IssueID,
IssueDate,
ISNULL(SQ.LotNo, '') AS LotNos,
ISNULL(pdg.Names, '') AS 'PendingApprovers',
Title,
IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
SubmitedDate,
CloseDate,
AP.ItemStatus
FROM
LotDisposition LD
INNER JOIN Users U1 ON LD.OriginatorID = U1.UserID
LEFT JOIN Approval AP ON LD.IssueID = AP.IssueID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
Lot L
WHERE
L.IssueID = LD.IssueID FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
LotDisposition LD
) AS SQ ON LD.IssueID = SQ.IssueID
LEFT JOIN (
SELECT
DISTINCT LD.IssueID,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 1
AND A.IssueID = LD.IssueID
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
LotDisposition LD
) AS pdg ON LD.IssueID = pdg.IssueID
WHERE
U1.UserID = @UserID
AND LD.IssueID NOT IN (
SELECT
IssueID
FROM
Approval
WHERE
IssueID = LD.IssueID
AND ItemStatus <> 2
AND DocumentTypeID = 1
)
) AS A
)
GO

View File

@ -1,163 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetMRBByUser] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetMRBByUser] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'MRB' AS DocumentType,
'MRB' AS SubDoc,
*
FROM
(
SELECT
DISTINCT M.MRBNumber as IssueID,
M.MRBNumber as DocID,
M.SubmittedDate AS IssueDate,
SQ.LotNo AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
SubmittedDate,
CloseDate,
A.ItemStatus,
NULL AS NextDueDate
FROM
MRB M
INNER JOIN Approval A ON A.IssueID = M.MRBNumber
INNER JOIN Users U2 ON M.OriginatorID = U2.UserID
INNER JOIN Users U1 ON A.UserID = U1.UserID
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
MRBAction L
WHERE
L.MRBNumber = M.MRBNumber FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
MRB M
) AS SQ ON M.MRBNumber = SQ.MRBNumber
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
A.IssueID = M.MRBNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
MRB M
) AS pdg ON M.MRBNumber = pdg.MRBNumber
WHERE
A.UserID = @UserID
AND (ItemStatus = 0) --List of documents orginated by the user
UNION
ALL
SELECT
DISTINCT M.MRBNumber AS IssueID,
M.MRBNumber as DocID,
M.SubmittedDate AS IssueDate,
SQ.LotNo AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
M.SubmittedDate AS SubmitedDate,
M.CloseDate AS CloseDate,
AP.ItemStatus,
NULL AS NextDueDate
FROM
MRB M
INNER JOIN Users U1 ON M.OriginatorID = U1.UserID
LEFT JOIN Approval AP ON M.MRBNumber = AP.IssueID
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
MRBAction L
WHERE
L.MRBNumber = M.MRBNumber FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
MRB M
) AS SQ ON M.MRBNumber = SQ.MRBNumber
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 2
AND A.IssueID = M.MRBNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
MRB M
) AS pdg ON M.MRBNumber = pdg.MRBNumber
WHERE
U1.UserID = @UserID
AND AP.DocumentTypeID = 2
AND M.MRBNumber NOT IN (
SELECT
IssueID
FROM
Approval
WHERE
IssueID = M.MRBNumber
AND ItemStatus = 1
AND DocumentTypeID = 2
)
) AS A
)
GO

View File

@ -1,161 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetMRBByUserPrev] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetMRBByUserPrev] (
-- Add the parameters for the function here
@UserID INT
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT 'MRB' AS DocumentType,
'MRB' AS SubDoc,
*
FROM
(
SELECT
DISTINCT M.MRBNumber as IssueID,
M.MRBRaisedDate AS IssueDate,
SQ.LotNo AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
IssueDescription,
U2.FirstName + ' ' + U2.LastName AS Originator,
SubmitedDate,
CloseDate,
A.ItemStatus
FROM
MRB M
INNER JOIN Approval A ON A.IssueID = M.MRBNumber
AND DocumentTypeID = 2
INNER JOIN Users U2 ON M.Owner = U2.UserID
INNER JOIN Users U1 ON A.UserID = U1.UserID
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
MRBLot L
WHERE
L.MRBNumber = M.MRBNumber FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
MRB M
) AS SQ ON M.MRBNumber = SQ.MRBNumber
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 2
AND A.IssueID = M.MRBNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
MRB M
) AS pdg ON M.MRBNumber = pdg.MRBNumber
WHERE
A.UserID = @UserID
AND (ItemStatus = 0) --List of documents orginated by the user
UNION
ALL
SELECT
DISTINCT M.MRBNumber AS IssueID,
M.MRBRaisedDate AS IssueDate,
SQ.LotNo AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
M.SubmitedDate AS SubmitedDate,
M.CloseDate AS CloseDate,
AP.ItemStatus
FROM
MRB M
INNER JOIN Users U1 ON M.Owner = U1.UserID
LEFT JOIN Approval AP ON M.MRBNumber = AP.IssueID
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
MRBLot L
WHERE
L.MRBNumber = M.MRBNumber FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
MRB M
) AS SQ ON M.MRBNumber = SQ.MRBNumber
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
DocumentTypeID = 2
AND A.IssueID = M.MRBNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
MRB M
) AS pdg ON M.MRBNumber = pdg.MRBNumber
WHERE
U1.UserID = @UserID
AND AP.DocumentTypeID = 2
AND M.MRBNumber NOT IN (
SELECT
IssueID
FROM
Approval
WHERE
IssueID = M.MRBNumber
AND ItemStatus = 1
AND DocumentTypeID = 2
)
) AS A
)
GO

View File

@ -1,76 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetMRBs] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetMRBs] () RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
'MRB' AS DocumentType,
'MRB' AS SubDoc,
M.MRBNumber AS IssueID,
M.MRBNumber AS DocID,
M.SubmittedDate IssueDate,
SQ.LotNo AS LotNos,
pdg.Names AS 'PendingApprovers',
Title,
M.IssueDescription,
U.FirstName + ' ' + U.LastName AS Originator,
SubmittedDate,
CloseDate
FROM
MRB M
LEFT JOIN Users U ON M.OriginatorID = U.UserID
LEFT JOIN (
SELECT
DISTINCT M.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(L.LotNumber AS varchar(512))
FROM
MRBLot L
WHERE
L.MRBNumber = M.MRBNumber FOR XML PATH('')
),
1,
1,
''
) AS LotNo
FROM
MRB M
) AS SQ ON m.MRBNumber = SQ.MRBNumber
LEFT JOIN (
SELECT
DISTINCT m.MRBNumber,
STUFF (
(
SELECT
'/' + CAST(U.FirstName AS varchar(50)) + ' ' + CAST(U.LastName AS varchar(50))
FROM
Approval A
INNER JOIN Users U ON A.UserID = U.UserID
WHERE
A.DocumentTypeID = 2
AND A.IssueID = m.MRBNumber
AND ItemStatus = 0 FOR XML PATH('')
),
1,
1,
''
) AS Names
FROM
MRB m
) AS pdg ON M.MRBNumber = pdg.MRBNumber
)
GO

View File

@ -1,45 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetMeetingAI_Responsibles] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetMeetingAI_Responsibles] (
-- Add the parameters for the function here
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT AI.ID AS MeetingActionItemID,
STUFF (
(
SELECT
', ' + LTRIM(
RTRIM(
CAST(U.FirstName + ' ' + U.LastName AS VARCHAR(50))
)
)
FROM
CCMeetingActionItemResponsible AIR
INNER JOIN Users U ON AIR.ActionItemResponsible = U.UserID
WHERE
AI.ID = AIR.MeetingActionItemID
AND AI.ClosedDate IS NULL FOR XML PATH('')
),
1,
1,
''
) AS Responsibles
FROM
CCMeetingActionItem AI
WHERE
AI.ClosedDate IS NOT NULL
)
GO

View File

@ -1,43 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetMeetingAI_Responsibles_ByCC] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetMeetingAI_Responsibles_ByCC] (
-- Add the parameters for the function here
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
SELECT
DISTINCT M.MeetingID,
STUFF (
(
SELECT
', ' + LTRIM(
RTRIM(
CAST(U.FirstName + ' ' + U.LastName AS VARCHAR(50))
)
)
FROM
vCCMeetingActionResponsible AIR
INNER JOIN Users U ON AIR.ActionItemResponsible = U.UserID
INNER JOIN CCMeeting CM ON CM.MeetingID = AIR.MeetingID
WHERE
M.meetingID = AIR.MeetingID FOR XML PATH('')
),
1,
1,
''
) AS Responsibles
FROM
CCMeeting M
)
GO

View File

@ -1,30 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetPRs] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fn_GetPRs]() RETURNS TABLE AS RETURN (
SELECT
'PartsRequest' AS DocumentType,
'PR' AS SubDoc,
PR.PRNumber AS IssueID,
PR.PRNumber AS DocID,
CreateDate AS IssueDate,
'' AS LotNos,
dbo.fnGetApprovalFullNames(PR.PRNumber, 10, ' / ', 0, 1, 1, 0, 0) AS 'PendingApprovers',
Title,
Description AS IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
SubmitDate AS SubmitedDate,
CloseDate
FROM
PartsRequest PR
INNER JOIN Users U1 ON PR.RequestorID = U1.UserID
WHERE
CurrentStep >= 0
)
GO

View File

@ -1,47 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetPRsByUser] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fn_GetPRsByUser] (@UserID INT) RETURNS TABLE AS RETURN (
SELECT
DISTINCT 'PartsRequest' AS DocumentType,
*
FROM
(
SELECT
'Parts Request' AS SubDoc,
PR.PRNumber AS IssueID,
PR.PRNumber AS DocID,
CreateDate AS IssueDate,
'' AS LotNos,
dbo.fnGetApprovalFullNames(PR.PRNumber, 10, ' / ', 0, 1, 1, 0, 0) AS 'PendingApprovers',
Title,
Description AS IssueDescription,
U1.FirstName + ' ' + U1.LastName AS Originator,
SubmitDate AS SubmitedDate,
CloseDate,
A.ItemStatus,
NULL AS NextDueDate
FROM
PartsRequest PR
INNER JOIN Approval A ON A.IssueID = PR.PRNumber
AND A.DocumentTypeID = 10 --INNER JOIN Users U2 ON PR.OriginatorID = U2.UserID
INNER JOIN Users U1 ON PR.RequestorID = U1.UserID
WHERE
(A.UserID = @UserID)
AND (
ItemStatus = 0
OR (
ItemStatus = 2
AND DisplayDeniedDocument = 1
)
)
AND CurrentStep >= 0
) AS A
)
GO

View File

@ -1,48 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_GetRole_MSuffix] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE FUNCTION [dbo].[fn_GetRole_MSuffix] (
-- Add the parameters for the function here
@IssueID INT,
@CurrentDate DATETIME
) RETURNS TABLE AS RETURN (
-- Add the SELECT statement with parameter references here
-- M_Suffix
SELECT
DISTINCT Ld.IssueID,
R.RoleName,
SRC.SubRoleCategoryItem AS 'SubRole',
U.UserID,
SR.SubRoleID,
0 AS 'ItemStatus',
WS.WorkflowStepNumber AS 'Step',
@CurrentDate AS 'AssignedDate',
@CurrentDate AS 'NotifyDate',
@CurrentDate AS 'RoleAssignedDate',
1 AS ApprovalType
FROM
LotDisposition LD
INNER JOIN WorkflowSteps WS ON LD.CurrentStep = WS.WorkflowStepNumber
INNER JOIN Role R ON WS.RoleID = R.RoleID
INNER JOIN SubRole SR ON R.RoleID = SR.RoleID
INNER JOIN SubRoleCategory SRC ON SR.SubRoleCategoryID = SRC.SubRoleCategoryID
INNER JOIN Lot L ON LD.IssueID = L.IssueID
INNER JOIN UserSubRole USR ON SR.SubRoleID = USR.SubRoleID
INNER JOIN Users U ON U.UserID = USR.UserID
INNER JOIN LotStatusOption LSO ON L.LotStatusOptionID = LSO.LotStatusOptionID
WHERE
LD.IssueID = @IssueID
AND LSO.LotStatusOption = SRC.SubRoleCategoryItem
)
GO

View File

@ -1,40 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: UserDefinedFunction [dbo].[fn_IsECNITAR] Script Date: 11/21/2024 11:31:55 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[fn_IsECNITAR] (
-- Add the parameters for the function here
@ECNNumber INT
) RETURNS INT AS BEGIN -- Declare the return variable here
DECLARE @Count INT -- Add the T-SQL statements to compute the return value here
SET
@Count = (
SELECT
COUNT(*)
FROM
ECN E
WHERE
(
(
E.IsRH = 1
AND E.IsAU = 0
AND E.IsIndustrial = 0
AND E.IsMA = 0
)
OR (IsDocEC = 1)
)
AND E.ECNNumber = @ECNNumber
) -- Return the result of the function
RETURN @Count
END
GO

View File

@ -1,29 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: StoredProcedure [dbo].[AddUserToTrainingGroup] Script Date: 11/21/2024 11:29:04 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[AddUserToTrainingGroup] -- Add the parameters for the stored procedure here
@GroupID INT,
@UserID INT,
@UserFullName VARCHAR(150) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET
NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO
TrainingGroupMembers (TrainingGroupID, UserID, FullName)
VALUES
(@GroupID, @UserID, @UserFullName)
END
GO

View File

@ -1,329 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: StoredProcedure [dbo].[AnalyzeLotAncestry] Script Date: 11/21/2024 11:29:04 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[AnalyzeLotAncestry] @LotNo varchar(20),
@IncidentTime datetime = NULL,
@LogIssueID int = NULL,
@LogDocumentType int = NULL,
@LogParms xml = NULL,
@AnalysisType CHAR(1) = NULL AS BEGIN
SET
NOCOUNT ON DECLARE @RootLotNo varchar(20) = @LotNo DECLARE @IncidentLotNo varchar(20) = @LotNo IF @LotNo LIKE '%.%' BEGIN
SET
@RootLotNo = LEFT(@LotNo, CHARINDEX('.', @LotNo)) + '1'
SET
@IncidentLotNo = @LotNo
END DECLARE @sql nvarchar(max) DECLARE @lots TABLE(LotNo varchar(20), Queried bit) DECLARE @results TABLE(
[WT_RECORD_CODE] [varchar](2) NULL,
[WT_LOT_NO] [varchar](10) NULL,
[WT_ACTION_DATE] [varchar](14) NULL,
[WT_LOT_1] [varchar](10) NULL,
[WT_LOT_2] [varchar](10) NULL,
[WT_LOT_3] [varchar](10) NULL,
[WT_LOT__4] [varchar](10) NULL,
[WT_LOT_5] [varchar](10) NULL
) DECLARE @transaction TABLE(
[WT_RECORD_CODE] [varchar](2) NULL,
[WT_LOT_NO] [varchar](10) NULL,
[WT_ACTION_DATE] [varchar](14) NULL,
[WT_LOT_TARGET] [varchar](10) NULL
) DECLARE @finalresults TABLE(
[ID] [int] NOT NULL IDENTITY(1, 1),
[ParentLotNo] [varchar](20) NOT NULL,
[LotNo] [varchar](20) NOT NULL,
[ActionTime] [datetime] NOT NULL,
[ActionType] [varchar](2) NOT NULL,
[IsAffected] bit NULL
) --INSERT INTO @lots(LotNo, Queried) VALUES (@RootLotNo, 0)
INSERT INTO
@lots(LotNo, Queried)
VALUES
(@IncidentLotNo, 0) WHILE EXISTS (
SELECT
1
FROM
@lots
WHERE
Queried = 0
) BEGIN
SELECT
TOP 1 @LotNo = LotNo
FROM
@lots
WHERE
Queried = 0
SET
@sql = FORMATMESSAGE(
'SELECT * FROM OPENQUERY(FAB2SPN, ' + '''SELECT WT_RECORD_CODE, WT_LOT_NO, WT_ACTION_DATE, WT_LOT_1, WT_LOT_2, WT_LOT_3, WT_LOT__4, WT_LOT_5 ' + 'FROM WT_RECORD ' + 'WHERE WT_WP_DIRECT_KEY = ''''3002%s '''' AND WT_RECORD_CODE IN (''''SP'''',''''CB'''')'') ',
@LotNo
)
DELETE FROM
@results
INSERT INTO
@results EXEC sp_executesql @sql
DELETE FROM
@transaction
INSERT INTO
@transaction(
[WT_RECORD_CODE],
[WT_LOT_NO],
[WT_ACTION_DATE],
[WT_LOT_TARGET]
)
SELECT
[WT_RECORD_CODE],
[WT_LOT_NO],
[WT_ACTION_DATE],
[WT_LOT_TARGET]
FROM
(
SELECT
[WT_RECORD_CODE],
[WT_LOT_NO],
[WT_ACTION_DATE],
WT_LOT_1 AS [WT_LOT_TARGET]
FROM
@results
UNION
SELECT
[WT_RECORD_CODE],
[WT_LOT_NO],
[WT_ACTION_DATE],
WT_LOT_2 AS [WT_LOT_TARGET]
FROM
@results
UNION
SELECT
[WT_RECORD_CODE],
[WT_LOT_NO],
[WT_ACTION_DATE],
WT_LOT_3 AS [WT_LOT_TARGET]
FROM
@results
UNION
SELECT
[WT_RECORD_CODE],
[WT_LOT_NO],
[WT_ACTION_DATE],
WT_LOT__4 AS [WT_LOT_TARGET]
FROM
@results
UNION
SELECT
[WT_RECORD_CODE],
[WT_LOT_NO],
[WT_ACTION_DATE],
WT_LOT_5 AS [WT_LOT_TARGET]
FROM
@results
) subtable
WHERE
[WT_LOT_TARGET] <> ''
INSERT INTO
@lots(LotNo, Queried)
SELECT
DISTINCT WT_LOT_TARGET,
0
FROM
@transaction
WHERE
NOT EXISTS (
SELECT
1
FROM
@lots l
WHERE
l.LotNo = WT_LOT_TARGET
)
UPDATE
@lots
SET
Queried = 1
WHERE
LotNo = @LotNo
INSERT INTO
@finalresults(
[ParentLotNo],
[LotNo],
[ActionTime],
[ActionType]
)
SELECT
RTRIM(WT_LOT_NO),
RTRIM(WT_LOT_TARGET),
CONVERT(
datetime,
STUFF(
STUFF(
STUFF(
STUFF(STUFF(WT_ACTION_DATE, 5, 0, '-'), 8, 0, '-'),
11,
0,
' '
),
14,
0,
':'
),
17,
0,
':'
),
20
),
WT_RECORD_CODE
FROM
@transaction
WHERE
WT_RECORD_CODE = 'SP'
INSERT INTO
@finalresults(
[ParentLotNo],
[LotNo],
[ActionTime],
[ActionType]
)
SELECT
RTRIM(WT_LOT_TARGET),
RTRIM(WT_LOT_NO),
CONVERT(
datetime,
STUFF(
STUFF(
STUFF(
STUFF(STUFF(WT_ACTION_DATE, 5, 0, '-'), 8, 0, '-'),
11,
0,
' '
),
14,
0,
':'
),
17,
0,
':'
),
20
),
WT_RECORD_CODE
FROM
@transaction
WHERE
WT_RECORD_CODE = 'CB'
END;
WITH relevantresults as (
SELECT
*
FROM
@finalresults
WHERE
(ActionTime >= @IncidentTime)
OR (@IncidentTime IS NULL)
),
affectedlots as (
SELECT
ID,
ParentLotNo,
LotNo,
ActionTime
FROM
relevantresults
WHERE
ParentLotNo = @IncidentLotNo
UNION
ALL
SELECT
rr.ID,
rr.ParentLotNo,
rr.LotNo,
rr.ActionTime
FROM
affectedlots
INNER JOIN relevantresults rr ON rr.ParentLotNo = affectedlots.LotNo
AND rr.ActionTime > affectedlots.ActionTime
)
UPDATE
@finalresults
SET
IsAffected = 1
WHERE
ID IN (
SELECT
ID
FROM
affectedlots
)
UPDATE
@finalresults
SET
IsAffected = 1
WHERE
LotNo = @IncidentLotNo
INSERT INTO
@finalresults(
ParentLotNo,
LotNo,
ActionTime,
ActionType,
IsAffected
)
SELECT
'',
@IncidentLotNo,
'01/01/2001',
'',
1
WHERE
NOT EXISTS (
SELECT
1
FROM
@finalresults
WHERE
LotNo = @IncidentLotNo
AND IsAffected = 1
)
SELECT
*
FROM
@finalresults
ORDER BY
ActionTime IF @LogIssueID IS NOT NULL
AND @LogDocumentType IS NOT NULL BEGIN
INSERT INTO
LotSplitAnalysisLog(
[IssueID],
[DocumentType],
[LotNumber],
AnalysisType,
[AnalysisTime],
[AnalysisData]
)
SELECT
@LogIssueID,
@LogDocumentType,
@LotNo,
@AnalysisType,
GETDATE(),
(
SELECT
@LogParms AS 'parms',
(
SELECT
*
FROM
@finalresults FOR XML PATH('results'),
TYPE
) FOR XML PATH('log')
)
END
END
GO

View File

@ -1,61 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: StoredProcedure [dbo].[CCAddPCRBAttendees] Script Date: 11/21/2024 11:29:04 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[CCAddPCRBAttendees] @PCRBID INT,
@AttendeeID VARCHAR(300),
@JobTitle VARCHAR(50),
@Location VARCHAR(50) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET
NOCOUNT ON;
Declare @AttendeeName VARCHAR(200)
SET
@AttendeeName = CONCAT(
(
SELECT
FirstName
FROM
Users
WHERE
UserID = @AttendeeID
),
' ',
(
SELECT
LastName
FROM
Users
WHERE
UserID = @AttendeeID
)
) -- Insert statements for procedure here
INSERT INTO
CCPCRBAttendee (
AttendeeName,
PCRBID,
AttendeeID,
JobTitle,
Location
)
VALUES
(
@AttendeeName,
@PCRBID,
@AttendeeID,
@JobTitle,
@Location
)
END
GO

View File

@ -1,30 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: StoredProcedure [dbo].[CCCancelCC] Script Date: 11/21/2024 11:29:04 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[CCCancelCC] -- Add the parameters for the stored procedure here
@PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET
NOCOUNT ON;
-- Insert statements for procedure here
UPDATE
CCChangeControl
SET
Status = 2,
ClosedDate = GETDATE()
WHERE
PlanNumber = @PlanNumber
END
GO

View File

@ -1,30 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: StoredProcedure [dbo].[CCCompleteCC] Script Date: 11/21/2024 11:29:04 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[CCCompleteCC] -- Add the parameters for the stored procedure here
@PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET
NOCOUNT ON;
-- Insert statements for procedure here
UPDATE
CCChangeControl
SET
Status = 1,
ClosedDate = GETDATE()
WHERE
PlanNumber = @PlanNumber
END
GO

View File

@ -1,26 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: StoredProcedure [dbo].[CCDeleteCCAttachment] Script Date: 11/21/2024 11:29:04 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[CCDeleteCCAttachment] -- Add the parameters for the stored procedure here
@ID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET
NOCOUNT ON;
-- Insert statements for procedure here
DELETE CCAttachment
WHERE
ID = @ID
END
GO

View File

@ -1,25 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: StoredProcedure [dbo].[CCDeleteDecisionSummary] Script Date: 11/21/2024 11:29:04 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[CCDeleteDecisionSummary] @ID INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET
NOCOUNT ON;
-- Insert statements for procedure here
DELETE CCDecisionSummary
WHERE
ID = @ID
END
GO

View File

@ -1,24 +0,0 @@
USE [FabApprovalSystem]
GO
/****** Object: StoredProcedure [dbo].[CCDeleteGenerations] Script Date: 11/21/2024 11:29:04 AM ******/
SET
ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[CCDeleteGenerations] @PlanNumber INT AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET
NOCOUNT ON;
DELETE CCGeneration
WHERE
PlanNumber = @PlanNumber
END
GO

Some files were not shown because too many files have changed in this diff Show More