Compare commits
1 Commits
aa38d17daf
...
origin/Pro
| Author | SHA1 | Date | |
|---|---|---|---|
| ab800974b7 |
12
Fab2ApprovalMKLink/.vscode/mklink.md
vendored
12
Fab2ApprovalMKLink/.vscode/mklink.md
vendored
@ -35,15 +35,3 @@ 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"
|
||||
```
|
||||
|
||||
105
Fab2ApprovalSystem-Development.yml
Normal file
105
Fab2ApprovalSystem-Development.yml
Normal file
@ -0,0 +1,105 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- Development
|
||||
paths:
|
||||
include:
|
||||
- "Fab2ApprovalSystem/*"
|
||||
exclude:
|
||||
- "**/*.yaml"
|
||||
- "**/*.yml"
|
||||
- "SQL/*"
|
||||
- "references/*"
|
||||
- "packages/*"
|
||||
- "Kendo/*"
|
||||
|
||||
pool:
|
||||
name: Mesa-IIS
|
||||
demands: Fab2ApprovalSystem-Development
|
||||
|
||||
variables:
|
||||
# solution: '**/*.sln'
|
||||
# buildPlatform: 'Any CPU'
|
||||
buildConfiguration: "Debug"
|
||||
ASPNETCORE_ENVIRONMENT: "Development"
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
set assemblyTitle=Fab2ApprovalSystem
|
||||
echo %assemblyTitle%
|
||||
echo ##vso[task.setvariable variable=AssemblyTitle;]%assemblyTitle%
|
||||
echo $(AssemblyTitle)
|
||||
displayName: AssemblyTitle
|
||||
|
||||
- script: |
|
||||
set targetFrameworkVersion=v4.8
|
||||
echo %targetFrameworkVersion%
|
||||
echo ##vso[task.setvariable variable=TargetFrameworkVersion;]%targetFrameworkVersion%
|
||||
echo $(TargetFrameworkVersion)
|
||||
displayName: TargetFrameworkVersion
|
||||
|
||||
- script: |
|
||||
set coreVersion=na
|
||||
echo %coreVersion%
|
||||
echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion%
|
||||
echo $(CoreVersion)
|
||||
displayName: CoreVersion
|
||||
|
||||
- script: |
|
||||
set configuration=Debug
|
||||
echo %configuration%
|
||||
echo ##vso[task.setvariable variable=Configuration;]%configuration%
|
||||
echo $(Configuration)
|
||||
displayName: Configuration
|
||||
|
||||
- script: |
|
||||
REM set nugetSource=https://messa017.infineon.com/v3/index.json
|
||||
set nugetSource=https://eaf-prod.mes.infineon.com/v3/index.json
|
||||
echo %nugetSource%
|
||||
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
|
||||
echo $(NugetSource)
|
||||
displayName: NugetSource
|
||||
|
||||
- script: |
|
||||
set gitCommit=$(Build.SourceVersion)
|
||||
set gitCommitSeven=%gitCommit:~0,7%
|
||||
echo %gitCommitSeven%
|
||||
echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven%
|
||||
echo $(GitCommitSeven)
|
||||
displayName: GitCommitSeven
|
||||
|
||||
- script: |
|
||||
echo $(AssemblyTitle)
|
||||
echo $(Build.BuildId)
|
||||
echo $(Build.Reason)
|
||||
echo $(Build.Repository.Id)
|
||||
echo $(Build.Repository.Name)
|
||||
echo $(Build.SourceVersion)
|
||||
echo $(CoreVersion)
|
||||
echo $(Configuration)
|
||||
echo $(NugetSource)
|
||||
echo $(GitCommitSeven)
|
||||
echo $(TargetFrameworkVersion)
|
||||
REM echo $(pipelinePassword)
|
||||
displayName: "Echo Check"
|
||||
|
||||
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:RestoreSources=$(NugetSource) $(AssemblyTitle).csproj'
|
||||
workingDirectory: Fab2ApprovalSystem
|
||||
displayName: "Framework Restore"
|
||||
|
||||
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj'
|
||||
workingDirectory: Fab2ApprovalSystem
|
||||
displayName: "Framework Build"
|
||||
|
||||
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:DebugSymbols=false /p:DeleteExistingFiles=true /p:DeployOnBuild=true /p:EnableUpdateAble=true /p:ExcludeApp_Data=true /p:LastUsedBuildConfiguration=$(Configuration) /p:LastUsedPlatform="Any CPU" /p:LaunchSiteAfterPublish=true /p:OutputPath="D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" /p:PreCompileBeforePublish=true /p:PublishProvider=FileSystem /p:PublishUrl="D:/PublishUrl" /p:SiteUrlToLaunchAfterPublish="" /p:WDPMergeOption=DoNotMerge /p:WebPublishMethod=FileSystem $(AssemblyTitle).csproj'
|
||||
workingDirectory: Fab2ApprovalSystem
|
||||
displayName: "Framework Pack"
|
||||
|
||||
- script: '"C:/Program Files (x86)/IIS/Microsoft Web Deploy V3/MSDeploy.exe" -AllowUntrusted -dest:auto -disableLink:AppPoolExtension -disableLink:CertificateExtension -disableLink:ContentExtension -setParam:name="IIS Web Application Name",value=$(Build.Repository.Name) -setParamFile:"D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" "/_PublishedWebsites/$(Build.Repository.Name)_Package/$(Build.Repository.Name).SetParameters.xml" -source:package="D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" "/_PublishedWebsites/$(AssemblyTitle)_Package/$(AssemblyTitle).zip" -verb:sync'
|
||||
workingDirectory: Fab2ApprovalSystem
|
||||
displayName: "Framework Deploy"
|
||||
enabled: false
|
||||
|
||||
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
|
||||
displayName: "Force Fail"
|
||||
enabled: false
|
||||
@ -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,8 +12,7 @@
|
||||
.my-form [class*="col-"] {
|
||||
padding: 0 2px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
body {
|
||||
padding-top: 50px;
|
||||
padding-bottom: 20px;
|
||||
@ -30,10 +29,10 @@ body {
|
||||
/*input,
|
||||
select
|
||||
{
|
||||
max-width: 280px;
|
||||
max-width: 280px;
|
||||
}*/
|
||||
|
||||
.row {
|
||||
.row{
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px
|
||||
}
|
||||
@ -72,10 +71,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;
|
||||
@ -90,7 +89,7 @@ input[type="checkbox"].input-validation-error {
|
||||
|
||||
.label-color {
|
||||
background-color: #e5e0e0;
|
||||
}
|
||||
}
|
||||
|
||||
.linkbutton {
|
||||
display: inline-block;
|
||||
@ -102,17 +101,6 @@ 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;
|
||||
}
|
||||
@ -24,9 +24,12 @@ 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) {
|
||||
@ -66,7 +69,7 @@ public class AccountController : Controller {
|
||||
bool isLoginValid;
|
||||
|
||||
HttpClient httpClient = HttpClientFactory.Create();
|
||||
httpClient.BaseAddress = new Uri(GlobalVars.AppSettings.ApiBaseUrl);
|
||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||
|
||||
LoginResult loginResult = await AccountDMO.LoginAsync(httpClient, model);
|
||||
|
||||
@ -118,7 +121,7 @@ public class AccountController : Controller {
|
||||
bool isLoginValid;
|
||||
|
||||
HttpClient httpClient = HttpClientFactory.Create();
|
||||
httpClient.BaseAddress = new Uri(GlobalVars.AppSettings.ApiBaseUrl);
|
||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||
|
||||
LoginResult loginResult = await AccountDMO.ExternalAuthSetupAsync(httpClient, authAttempt);
|
||||
|
||||
|
||||
@ -48,23 +48,60 @@ public class ChangeControlController : 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}";
|
||||
int isITARCompliant = 1;
|
||||
ChangeControlViewModel cc = new ChangeControlViewModel();
|
||||
cc = ccDMO.GetChangeControlRead(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
|
||||
return Redirect(mrbUrl);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult ReadOnlyCC(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}";
|
||||
int isITARCompliant = 1;
|
||||
ChangeControlViewModel cc = new ChangeControlViewModel();
|
||||
cc = ccDMO.GetChangeControlRead(issueID, out isITARCompliant, (int)Session[GlobalVars.SESSION_USERID]);
|
||||
// TODO locked functionality
|
||||
|
||||
return Redirect(mrbUrl);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@ -953,7 +953,8 @@ public class ECNController : PdfViewController {
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public void NotifyApproversForCancellation(int ecnNumber, ECN ecn, byte currentStep, int documentType, string ecnTypeString) {
|
||||
public void NotifyApproversForCancellation(int ecnNumber, byte currentStep, int documentType, string ecnTypeString) {
|
||||
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||
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 });
|
||||
@ -976,10 +977,10 @@ public class ECNController : PdfViewController {
|
||||
} catch { }
|
||||
}
|
||||
|
||||
public void NotifyTECNCancellation(int ecnNumber, string ecnFolderPath, string comments) {
|
||||
public void NotifyTECNCancellation(int ecnNumber, string ecnFolderPath) {
|
||||
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||
List<int> notificationUserList = ecnDMO.GetTECNNotificationUsers().ToList();
|
||||
string emailSentList = ECNHelper.NotifyTECNCancellation(_AppSettings, userDMO, ecnNumber, ecnFolderPath, comments, ecn, notificationUserList);
|
||||
string emailSentList = ECNHelper.NotifyTECNCancellation(_AppSettings, userDMO, ecnNumber, ecnFolderPath, ecn, notificationUserList);
|
||||
try {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "E-TECN", OperationType = "Email", Comments = "Approvers for Cancellation :" + emailSentList });
|
||||
} catch { }
|
||||
@ -1156,24 +1157,22 @@ public class ECNController : PdfViewController {
|
||||
return Content(ecnDMO.PCRBExists(pcrb).ToString());
|
||||
}
|
||||
|
||||
public ActionResult CancelDocument(int ecnNumber, byte currentStep, int documentType, string ecnTypeString, string comments = "") {
|
||||
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||
public ActionResult CancelDocument(int ecnNumber, byte currentStep, int documentType, string ecnTypeString) {
|
||||
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, ecn, currentStep, documentType, ecnTypeString);
|
||||
} else { // TODO Automatically close the
|
||||
lastApproverAndLastStep = ApproveCancellation(ecnNumber, currentStep, comments, documentType, ecnTypeString);
|
||||
NotifyApproversForCancellation(ecnNumber, currentStep, documentType, ecnTypeString);
|
||||
} else // TODO Automatically close the
|
||||
{
|
||||
lastApproverAndLastStep = ApproveCancellation(ecnNumber, currentStep, "", documentType, ecnTypeString);
|
||||
}
|
||||
|
||||
if (!lastApproverAndLastStep) {
|
||||
try {
|
||||
lastApproverAndLastStep = true;
|
||||
|
||||
ECNPdf ecnPDF = new ECNPdf();
|
||||
GenerateECNPdf(ecnNumber, out ecnPDF);
|
||||
ECNPdf ecn = new ECNPdf();
|
||||
GenerateECNPdf(ecnNumber, out ecn);
|
||||
|
||||
string sourceDirectory = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString() + "\\";
|
||||
string outputFullFilePath = "";
|
||||
@ -1185,7 +1184,7 @@ public class ECNController : PdfViewController {
|
||||
|
||||
Zipper zip = new Zipper();
|
||||
zip.CreateZip(outputFullFilePath, sourceDirectory);
|
||||
NotifyTECNCancellation(ecnNumber, outputFullFilePath, comments);
|
||||
NotifyTECNCancellation(ecnNumber, outputFullFilePath);
|
||||
|
||||
} catch (Exception ex) {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "TECN", OperationType = "Error", Comments = ex.Message });
|
||||
@ -1209,20 +1208,19 @@ 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, ecn, currentStep, documentType, ecnTypeString);
|
||||
NotifyApproversForCancellation(ecnNumber, currentStep, documentType, ecnTypeString);
|
||||
}
|
||||
|
||||
if (lastApprover && lastStep) {
|
||||
try {
|
||||
lastApproverAndLastStep = true;
|
||||
|
||||
ECNPdf ecnPDF = new ECNPdf();
|
||||
GenerateECNPdf(ecnNumber, out ecnPDF);
|
||||
ECNPdf ecn = new ECNPdf();
|
||||
GenerateECNPdf(ecnNumber, out ecn);
|
||||
|
||||
string sourceDirectory = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString() + "\\";
|
||||
string outputFullFilePath = "";
|
||||
@ -1234,7 +1232,7 @@ public class ECNController : PdfViewController {
|
||||
|
||||
Zipper zip = new Zipper();
|
||||
zip.CreateZip(outputFullFilePath, sourceDirectory);
|
||||
NotifyTECNCancellation(ecnNumber, outputFullFilePath, comments);
|
||||
NotifyTECNCancellation(ecnNumber, outputFullFilePath);
|
||||
|
||||
} catch (Exception ex) {
|
||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "TECN", OperationType = "Error", Comments = ex.Message });
|
||||
|
||||
@ -79,7 +79,9 @@ public class MRBController : Controller {
|
||||
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=/mrb/{issueID}";
|
||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
||||
"https://localhost:7255";
|
||||
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
|
||||
|
||||
return Redirect(mrbUrl);
|
||||
}
|
||||
@ -102,7 +104,9 @@ public class MRBController : Controller {
|
||||
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=/mrb/{issueID}";
|
||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
||||
"https://localhost:7255";
|
||||
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
|
||||
|
||||
return Redirect(mrbUrl);
|
||||
}
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,6 @@ 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 });
|
||||
|
||||
@ -15,7 +15,6 @@ 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();
|
||||
|
||||
@ -368,7 +367,7 @@ public class ECN_DMO {
|
||||
return ecnItem;
|
||||
}
|
||||
|
||||
public ECN GetECN(int ecnNumber) {
|
||||
internal ECN GetECN(int ecnNumber) {
|
||||
ECN ecnItem = new();
|
||||
DynamicParameters parameters = new();
|
||||
parameters.Add("@ECNNumber", value: ecnNumber);
|
||||
|
||||
@ -6,8 +6,6 @@ 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/>
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
<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>
|
||||
@ -255,7 +255,6 @@
|
||||
<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" />
|
||||
@ -388,10 +387,8 @@
|
||||
<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" />
|
||||
@ -516,7 +513,6 @@
|
||||
<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" />
|
||||
|
||||
@ -126,7 +126,7 @@ public class ECNHelper {
|
||||
return emailSentList;
|
||||
}
|
||||
|
||||
public static string NotifyTECNCancellation(AppSettings appSettings, UserAccountDMO userDMO, int ecnNumber, string ecnFolderPath, string comments, ECN ecn, List<int> notificationUserList) {
|
||||
public static string NotifyTECNCancellation(AppSettings appSettings, UserAccountDMO userDMO, int ecnNumber, string ecnFolderPath, ECN ecn, List<int> notificationUserList) {
|
||||
string emailSentList = "";
|
||||
List<string> emailIst = MiscDMO.GetTECNCancelledApprovalNotifyList(ecnNumber).Distinct().ToList();
|
||||
foreach (int userId in notificationUserList) {
|
||||
@ -135,27 +135,23 @@ public class ECNHelper {
|
||||
emailIst.Add(email);
|
||||
}
|
||||
|
||||
string subject;
|
||||
string emailTemplate;
|
||||
string senderName = "ECN";
|
||||
string subject = string.Empty;
|
||||
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;
|
||||
string emailTemplate = "TECNCancelled.txt";
|
||||
if (ecn.CancellationApprovalDate == null) {
|
||||
subject = "TECN Cancellation Initiated Notice - " + ecnNumber + " for " + ecn.Title + ", Cancellation Initiated on:" + DateTime.Now;
|
||||
} else {
|
||||
emailTemplate = "TECNReturnedToProcess.txt";
|
||||
subject = "TECN Return to Process Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Returned:" + dateTime;
|
||||
subject = "TECN Cancellation Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Cancelled:" + ecn.CancellationApprovalDate;
|
||||
}
|
||||
string senderName = "ECN";
|
||||
|
||||
EmailNotification en = new(appSettings, subject);
|
||||
string[] emailparams = new string[6];
|
||||
string[] emailparams = new string[5];
|
||||
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;
|
||||
|
||||
@ -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,7 +46,6 @@ public class AppSettings {
|
||||
string urls,
|
||||
int userId,
|
||||
bool userIsAdmin,
|
||||
string wasmClientUrl,
|
||||
string wsr_URL,
|
||||
string? workingDirectoryName) {
|
||||
AdminNotificationRecepient = adminNotificationRecepient;
|
||||
@ -89,12 +88,11 @@ 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; }
|
||||
@ -132,7 +130,6 @@ 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; }
|
||||
|
||||
@ -214,15 +211,12 @@ 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 = Environment.GetEnvironmentVariable("FabApprovalApiBaseUrl") ??
|
||||
throw new ArgumentNullException("FabApprovalApiBaseUrl environment variable not found");
|
||||
string? apiBaseUrl = ConfigurationManager.AppSettings["FabApprovalApiBaseUrl"]?.ToString();
|
||||
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,
|
||||
@ -262,7 +256,6 @@ public class AppSettings {
|
||||
urls: urls,
|
||||
userId: userId,
|
||||
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
|
||||
wasmClientUrl: wasmClientUrl,
|
||||
wsr_URL: Misc.GlobalVars.WSR_URL,
|
||||
workingDirectoryName: workingDirectoryName);
|
||||
return result;
|
||||
|
||||
@ -231,7 +231,6 @@ 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>();
|
||||
|
||||
@ -380,43 +380,6 @@
|
||||
</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">
|
||||
@ -2213,7 +2176,6 @@
|
||||
$('#txtApprovedDate').attr("disabled", true);
|
||||
$('#txtRelatedMRB').attr("disabled", true);
|
||||
$('#CATypeList').data("kendoDropDownList").enable(false);
|
||||
$('#CAStandardTypeList').data("kendoDropDownList").enable(false);
|
||||
$('#d0Comments').attr("disabled", true);
|
||||
}
|
||||
|
||||
@ -3727,7 +3689,6 @@
|
||||
TeamCaptainID: $("#TeamCaptainList").data("kendoDropDownList").value(),
|
||||
CASponsorID: $("#CASponsorList").data("kendoDropDownList").value(),
|
||||
CASubmitted: isCASubmitted,
|
||||
CAStandardType : $("#CAStandardTypeList").data("kendoDropDownList").value(),
|
||||
|
||||
//D0
|
||||
D0Comments : $("#d0Comments").val(),
|
||||
|
||||
@ -325,16 +325,6 @@
|
||||
</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">
|
||||
|
||||
@ -86,48 +86,30 @@
|
||||
|
||||
if (Model.IsTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
|
||||
&& !Model.ExpirationProcessed && !Model.Converted
|
||||
&& !Model.LockedForConversion)
|
||||
&& !Model.LockedForConversion
|
||||
&& (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today))
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today)
|
||||
&& Model.ConversionApprovalInProgress == false
|
||||
&& (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.ExpirationProcessed && !Model.Converted
|
||||
&& (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today))
|
||||
{
|
||||
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" />
|
||||
@ -1269,9 +1251,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@Html.Partial("_ECNCancel")
|
||||
@Html.Partial("_ECNReturnToProcess")
|
||||
|
||||
@Html.Partial("_ECNReassignOriginator")
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -2209,6 +2188,40 @@
|
||||
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();
|
||||
|
||||
@ -1,75 +0,0 @@
|
||||
<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">×</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>
|
||||
@ -1,75 +0,0 @@
|
||||
<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">×</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>
|
||||
@ -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");
|
||||
|
||||
@ -54,7 +54,7 @@ public class HomeControllerTests {
|
||||
|
||||
private static void GetMyOpenActionItems(ILogger? logger, AppSettings appSettings) {
|
||||
SetGlobalVars(logger, appSettings);
|
||||
LotDispositionDMO lotDispositionDMO = new();
|
||||
LotDispositionDMO lotDispositionDMO = new(appSettings);
|
||||
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();
|
||||
LotDispositionDMO lotDispositionDMO = new(appSettings);
|
||||
IssuesViewModel[] issuesViewModels = lotDispositionDMO.GetTaskList(appSettings.UserId).ToArray();
|
||||
if (issuesViewModels.Length == 0) { }
|
||||
}
|
||||
|
||||
@ -56,8 +56,8 @@ public class AdminDMOTests {
|
||||
AdminDMO adminDMO = new();
|
||||
// void AddNewTrainingGroup(string groupName);
|
||||
// void AddUserRoles(int subRole, string userids);
|
||||
// void AddUserToGroup(appSettings.UserId, int groupId);
|
||||
// void DeleteFromGroup(appSettings.UserId, int groupId);
|
||||
// void AddUserToGroup(int userId, int groupId);
|
||||
// void DeleteFromGroup(int userId, int groupId);
|
||||
// void DeleteTrainingGroup(int groupID);
|
||||
// adminDMO.DeleteUserFromAllTrainingGroups(appSettings.UserId);
|
||||
// void DeleteUserRoles(int subRole, string userids);
|
||||
|
||||
@ -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, appSettings.UserId);
|
||||
// Audit GetAuditItemReadOnly(int auditNo, appSettings.UserId);
|
||||
// Audit GetAuditItem(int auditNo, int userID);
|
||||
// Audit GetAuditItemReadOnly(int auditNo, int 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(appSettings.UserId, int issueID);
|
||||
// void UpdateAudit(Audit audit, appSettings.UserId);
|
||||
// void ReleaseLockOnDocument(int userID, int issueID);
|
||||
// void UpdateAudit(Audit audit, int userID);
|
||||
// void UpdateCAFindings(CAFindings model);
|
||||
if (auditDMO is null) { }
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
@ -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();
|
||||
ChangeControlDMO changeControlDMO = new(appSettings);
|
||||
// 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, appSettings.UserId);
|
||||
// void ReassignOwner(int planNumber, int newOwnerID, string comments, int userID);
|
||||
if (changeControlDMO is null) { }
|
||||
#pragma warning restore IDE0059
|
||||
}
|
||||
|
||||
@ -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();
|
||||
// void ApproveSection(int issueID, appSettings.UserId, string DSection);
|
||||
CorrectiveActionDMO correctiveActionDMO = new(appSettings);
|
||||
// void ApproveSection(int issueID, int 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, appSettings.UserId);
|
||||
// CorrectiveAction GetCAItemReadOnly(int caNo, appSettings.UserId);
|
||||
// CorrectiveAction GetCAItem(int caNo, int userID);
|
||||
// CorrectiveAction GetCAItemReadOnly(int caNo, int 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(appSettings.UserId, int caId);
|
||||
// bool IsAIAssignee(int userId, int caId);
|
||||
// bool IsLastSectionApprover(int caNo, string dSection);
|
||||
// bool IsUserSectionApprover(int issueId, appSettings.UserId);
|
||||
// void RejectSection(int issueID, appSettings.UserId, string DSection, string comments);
|
||||
// void ReleaseLockOnDocument(appSettings.UserId, int issueID);
|
||||
// bool IsUserSectionApprover(int issueId, int userId);
|
||||
// void RejectSection(int issueID, int userID, string DSection, string comments);
|
||||
// void ReleaseLockOnDocument(int 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, appSettings.UserId, int worlflowNumber);
|
||||
// void StartSectionApproval(int issueID, appSettings.UserId, string DSection);
|
||||
// int StartApproval(int issueID, int userID, int worlflowNumber);
|
||||
// void StartSectionApproval(int issueID, int userID, string DSection);
|
||||
// void UpdateCorrectiveAction(CorrectiveAction model);
|
||||
// void UpdateD3ContainmentAction(D3ContainmentAction model);
|
||||
// void UpdateD5D6CorrectivetAction(D5D6CorrectivetAction model);
|
||||
|
||||
@ -58,30 +58,30 @@ public class EngChangeNoticeDMOTests {
|
||||
ECN_DMO ecnDMO = new();
|
||||
// void CancelECN(int? ecnNumber);
|
||||
// bool CanSubmitECN(int ecnNumber);
|
||||
// void DeleteDocument(int ecnNumber, appSettings.UserId, string ecnTypeString);
|
||||
// void DeleteDocument(int ecnNumber, int 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);
|
||||
// bool ECNApproveCancelled_ExpiredDocument(int issueID, byte step, string comments, out bool lastStep, int userID, int documentType);
|
||||
// void ECNResetTECNAtRejection(int ecnNumber, int 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(appSettings.UserId, int maxDays);
|
||||
// IEnumerable<IssuesViewModel> GetMyExpiredTECNs(appSettings.UserId, int maxDays);
|
||||
// IEnumerable<IssuesViewModel> GetMyExpiringTECNs(appSettings.UserId, int maxDays);
|
||||
// IEnumerable<IssuesViewModel> GetMyConvertedTECNsToECNs(int userID, int maxDays);
|
||||
// IEnumerable<IssuesViewModel> GetMyExpiredTECNs(int userID, int maxDays);
|
||||
// IEnumerable<IssuesViewModel> GetMyExpiringTECNs(int 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, 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 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 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 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 TECNExtensionLog(int ecnNumber, DateTime extensionDate);
|
||||
// void UpdateECNType(int ecnNumber, string ecnType);
|
||||
if (ecnDMO is null) { }
|
||||
|
||||
@ -1,108 +0,0 @@
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@ -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();
|
||||
LotDispositionDMO lotDispositionDMO = new(appSettings);
|
||||
// void DeleteAllLotDispoLot(int issueID);
|
||||
// void DeleteCADocument(int CANo, appSettings.UserId, string caTypeString);
|
||||
// void DeleteCADocument(int CANo, int 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, appSettings.UserId);
|
||||
// LotDisposition GetLotDispositionItemForRead(int issueID, out int isITAR, appSettings.UserId);
|
||||
// LotDisposition GetLotDispositionItem(int issueID, out int isITAR, int userID);
|
||||
// LotDisposition GetLotDispositionItemForRead(int issueID, out int isITAR, int 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(appSettings.UserId, int issueID);
|
||||
// void ReleaseLockOnDocument(int userID, int issueID);
|
||||
// Lot[] SearchLots(string searchText);
|
||||
// int SubmitDocument(int issueID, bool peRequired, bool mrbRequired, appSettings.UserId);
|
||||
// int SubmitDocument(int issueID, bool peRequired, bool mrbRequired, int userID);
|
||||
// void UpdateLotDispoLot(Lot lot);
|
||||
// void UpdateLotDisposition(LotDisposition lotDispo);
|
||||
// void UpdateLotScrapReleaseStatus(ScrapLot scrap);
|
||||
|
||||
@ -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();
|
||||
LotTravelerDMO lotTravelerDMO = new(appSettings);
|
||||
// int CanAddLocationOperation(LTLotTravelerHoldSteps model);
|
||||
// int CreateLotTravelerRevision(LTLotTravelerHoldSteps model, appSettings.UserId);
|
||||
// void CreateTraveler(int ltLotID, int workRequestID, appSettings.UserId);
|
||||
// int CreateWorkRequestRevision(LTWorkRequest data, appSettings.UserId);
|
||||
// int CreateLotTravelerRevision(LTLotTravelerHoldSteps model, int userID);
|
||||
// void CreateTraveler(int ltLotID, int workRequestID, int UserID);
|
||||
// int CreateWorkRequestRevision(LTWorkRequest data, int 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, appSettings.UserId);
|
||||
// LTLotTravelerHeaderViewModel GetLotTravelerHeaderForUpdate(int ltLotID, int 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, appSettings.UserId);
|
||||
// void ReassignOriginator(int workRequestID, int newOriginatorID, string comments, appSettings.UserId);
|
||||
// void ReleaseLockOnDocument(appSettings.UserId, int workRequestID);
|
||||
// void ReleaseLockOnLotTravelerUpdateDoc(appSettings.UserId, int ltLotID);
|
||||
// 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);
|
||||
// void RestoreLotTravToPrevRevision(int prevLotTravRevID, int newLotTravRevID);
|
||||
// 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);
|
||||
// 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);
|
||||
if (lotTravelerDMO is null) { }
|
||||
#pragma warning restore IDE0059
|
||||
}
|
||||
|
||||
@ -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();
|
||||
PartsRequestDMO partsRequestDMO = new(appSettings);
|
||||
// void DeleteAttachment(int attachmentID);
|
||||
// void DeleteDocument(int prNumber, appSettings.UserId);
|
||||
// void DeleteDocument(int prNumber, int 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, appSettings.UserId);
|
||||
// void Submit(int prNumber, int userID);
|
||||
// void Update(PartsRequest pr);
|
||||
if (partsRequestDMO is null) { }
|
||||
#pragma warning restore IDE0059
|
||||
|
||||
@ -60,8 +60,8 @@ public class TrainingDMOTests {
|
||||
// bool CheckTrainingStatus(int trainingAssignmentID);
|
||||
// bool CheckValidDocAck(int docAckId);
|
||||
// int Create(int issueId);
|
||||
// int CreateAssignment(int trainingId, appSettings.UserId);
|
||||
// void DeleteAssignmentByUserId(appSettings.UserId);
|
||||
// int CreateAssignment(int trainingId, int userId);
|
||||
// void DeleteAssignmentByUserId(int 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, appSettings.UserId);
|
||||
// List<TrainingAssignment> GetTrainingAssignmentsByUserID(appSettings.UserId);
|
||||
// List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, int userID);
|
||||
// List<TrainingAssignment> GetTrainingAssignmentsByUserID(int 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(appSettings.UserId, int trainingId);
|
||||
// bool isUserTrainingMember(int groupId, appSettings.UserId);
|
||||
// bool IsUserAssigned(int userId, int trainingId);
|
||||
// bool isUserTrainingMember(int groupId, int userId);
|
||||
// void reOpenTraining(int trainingId);
|
||||
// void SetTrainingFlag(int ECNNumber);
|
||||
// void UpdateAssignmentStatus(int trainingAssignmentID);
|
||||
|
||||
@ -50,25 +50,22 @@ public class WorkflowDMOTests {
|
||||
try { throw new Exception(); } catch (Exception) { }
|
||||
}
|
||||
|
||||
private static void WorkflowDMO(ILogger? logger, AppSettings appSettings, int issueID, string comments, int documentType) {
|
||||
private static void WorkflowDMO(ILogger? logger, AppSettings appSettings) {
|
||||
#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 check = workflowDMO.Approve(appSettings, issueID, ecn.CurrentStep, comments, out isLastStep, appSettings.UserId, documentType, ecn.WorkFlowNumber);
|
||||
// bool Approve(int issueID, byte step, string comments, out bool lastStep, int userID, int documentType, int 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, 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);
|
||||
// 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);
|
||||
if (workflowDMO is null) { }
|
||||
#pragma warning restore IDE0059
|
||||
}
|
||||
@ -77,14 +74,13 @@ public class WorkflowDMOTests {
|
||||
[Ignore]
|
||||
#endif
|
||||
[TestMethod]
|
||||
[DataRow(82700, "comment", 3)]
|
||||
public void WorkflowDMOIsAttachedOnly(int issueID, string comments, int documentType) {
|
||||
public void WorkflowDMOIsAttachedOnly() {
|
||||
_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, issueID, comments, documentType);
|
||||
WorkflowDMO(_Logger, appSettings);
|
||||
_Logger?.LogInformation("{TestName} completed", _TestContext?.TestName);
|
||||
NonThrowTryCatch();
|
||||
}
|
||||
|
||||
@ -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();
|
||||
CorrectiveActionDMO caDMO = new(appSettings);
|
||||
ca = caDMO.GetCAItemReadOnly(caNo, appSettings.UserId);
|
||||
if (ca is null)
|
||||
throw new Exception($"{nameof(ca)}");
|
||||
|
||||
@ -53,36 +53,4 @@ public class ECNController : ControllerBase {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("ecn/allNumbers")]
|
||||
public async Task<IActionResult> GetAllECNNumbers() {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isInternalError = false;
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation($"Attempting to get all ECN#s");
|
||||
|
||||
IEnumerable<int> allEcnNumbers = await _ecnService.GetAllECNNumbers();
|
||||
|
||||
return Ok(allEcnNumbers);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot get all ECN#s, because {ex.Message}";
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "GetAllECNNumbers";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,6 @@ public class PCRBController : ControllerBase {
|
||||
|
||||
[HttpPost]
|
||||
[Route("pcrb/attachment")]
|
||||
[ApiExplorerSettings(IgnoreApi = true)]
|
||||
public async Task<IActionResult> UploadAttachment([FromForm] IFormFile file, [FromForm] PCRBAttachment attachment) {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isArgumentError = false;
|
||||
|
||||
@ -132,6 +132,9 @@ builder.Services.AddSwaggerGen(c => {
|
||||
|
||||
WebApplication app = builder.Build();
|
||||
|
||||
if (Debugger.IsAttached)
|
||||
app.Services.GetRequiredService<IApprovalService>();
|
||||
|
||||
app.UseCors();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
@ -219,10 +219,7 @@ public class ApprovalService : IApprovalService {
|
||||
queryBuilder.Append($"select a.*, src.SubRoleCategoryItem from Approval a ");
|
||||
queryBuilder.Append("join SubRole sr on a.SubRoleID=sr.SubRoleID ");
|
||||
queryBuilder.Append("join SubRoleCategory src on sr.SubRoleCategoryID=src.SubRoleCategoryID ");
|
||||
queryBuilder.Append($"where UserID={userId} and ItemStatus=0 and ");
|
||||
queryBuilder.Append($"(AssignedDate is not null and ");
|
||||
queryBuilder.Append($"AssignedDate <= '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}' and ");
|
||||
queryBuilder.Append($"AssignedDate > '{DateTimeOffset.Now.AddYears(-2).DateTime.ToString("yyyy-MM-dd HH:mm:ss")}') and ");
|
||||
queryBuilder.Append($"where UserID={userId} and ");
|
||||
queryBuilder.Append($"((CompletedDate >= '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}') or ");
|
||||
queryBuilder.Append($"(CompletedDate is null));");
|
||||
string sql = queryBuilder.ToString();
|
||||
|
||||
@ -4,7 +4,6 @@ namespace MesaFabApproval.API.Services;
|
||||
|
||||
public interface IECNService {
|
||||
Task<bool> IsValidECNNumber(int number);
|
||||
Task<IEnumerable<int>> GetAllECNNumbers();
|
||||
}
|
||||
|
||||
public class ECNService : IECNService {
|
||||
@ -44,19 +43,4 @@ public class ECNService : IECNService {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<int>> GetAllECNNumbers() {
|
||||
try {
|
||||
_logger.LogInformation("Attempting to get all ECN#s");
|
||||
|
||||
string sql = "select ECNNumber from ECN where Deleted=0 and Cancelled=0";
|
||||
|
||||
IEnumerable<int> allEcnNumbers = await _dalService.QueryAsync<int>(sql);
|
||||
|
||||
return allEcnNumbers;
|
||||
} catch (Exception ex) {
|
||||
_logger.LogError($"Unable to get all ECN#s, because {ex.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -852,8 +852,8 @@ public class MRBService : IMRBService {
|
||||
convertToPart += partStr;
|
||||
}
|
||||
|
||||
dt.Rows.Add(action.Action, convertFromCustomer, convertFromPart, action.LotNumber,
|
||||
action.Quantity.ToString(), convertToCustomer, convertToPart,
|
||||
dt.Rows.Add(action.Action, convertFromCustomer, convertFromPart, action.Quantity.ToString(),
|
||||
convertToCustomer, convertToPart,
|
||||
DateTimeUtilities.GetDateAsStringMinDefault(action.AssignedDate),
|
||||
DateTimeUtilities.GetDateAsStringMaxDefault(action.CompletedDate),
|
||||
action.CompletedByUser is null ? "" : action.CompletedByUser.GetFullName());
|
||||
|
||||
@ -485,20 +485,6 @@ public class PCRBService : IPCRBService {
|
||||
int rowsAffected = await _dalService.ExecuteAsync(queryBuilder.ToString());
|
||||
|
||||
if (rowsAffected <= 0) throw new Exception("update failed in database");
|
||||
|
||||
IEnumerable<PCRBAttendee>? attendees = _cache.Get<IEnumerable<PCRBAttendee>>($"pcrbAttendees{attendee.PlanNumber}");
|
||||
if (attendees is not null) {
|
||||
foreach (PCRBAttendee cachedAttendee in attendees) {
|
||||
if (cachedAttendee.ID == attendee.ID) {
|
||||
cachedAttendee.Location = attendee.Location;
|
||||
cachedAttendee.Attended = attendee.Attended;
|
||||
cachedAttendee.JobTitle = attendee.JobTitle;
|
||||
cachedAttendee.AttendeeID = attendee.AttendeeID;
|
||||
cachedAttendee.Step = attendee.Step;
|
||||
}
|
||||
}
|
||||
_cache.Set($"pcrbAttendees{attendee.PlanNumber}", attendees, DateTimeOffset.Now.AddMinutes(15));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
_logger.LogError($"Unable to update attendee, because {ex.Message}");
|
||||
throw;
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
paths:
|
||||
include:
|
||||
- MesaFabApproval.API
|
||||
- MesaFabApproval.Shared
|
||||
|
||||
variables:
|
||||
buildConfiguration: "Release"
|
||||
|
||||
stages:
|
||||
- stage: Test
|
||||
displayName: "Test"
|
||||
pool:
|
||||
name: MesaFabApproval
|
||||
demands: Fab2ApprovalSystem-Dev
|
||||
jobs:
|
||||
- job: BuildPublish
|
||||
steps:
|
||||
- script: |
|
||||
echo build configuration: $(BuildConfiguration)
|
||||
displayName: "Echo Check"
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Build"
|
||||
inputs:
|
||||
command: "build"
|
||||
configuration: $(BuildConfiguration)
|
||||
projects: MesaFabApproval.API
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Publish"
|
||||
inputs:
|
||||
command: "publish"
|
||||
publishWebProjects: false
|
||||
projects: MesaFabApproval.API
|
||||
zipAfterPublish: true
|
||||
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: "Copy Files"
|
||||
inputs:
|
||||
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
||||
TargetFolder: 'D:\$(Build.Repository.Name)\API\$(Build.BuildId)\$(BuildConfiguration)'
|
||||
CleanTargetFolder: true
|
||||
retryCount: "3"
|
||||
|
||||
- stage: Prod
|
||||
displayName: "Prod"
|
||||
pool:
|
||||
name: MesaFabApproval
|
||||
demands: Fab2ApprovalSystem
|
||||
jobs:
|
||||
- job: BuildPublish
|
||||
steps:
|
||||
- script: |
|
||||
echo build configuration: $(BuildConfiguration)
|
||||
displayName: "Echo Check"
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Build"
|
||||
inputs:
|
||||
command: "build"
|
||||
configuration: $(BuildConfiguration)
|
||||
projects: MesaFabApproval.API
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Publish"
|
||||
inputs:
|
||||
command: "publish"
|
||||
publishWebProjects: false
|
||||
projects: MesaFabApproval.API
|
||||
zipAfterPublish: true
|
||||
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: "Copy Files"
|
||||
inputs:
|
||||
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
||||
TargetFolder: 'D:\$(Build.Repository.Name)\API\$(Build.BuildId)\$(BuildConfiguration)'
|
||||
CleanTargetFolder: true
|
||||
retryCount: "3"
|
||||
@ -30,11 +30,4 @@
|
||||
<ProjectReference Include="..\MesaFabApproval.Shared\MesaFabApproval.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="wwwroot\appsettings.Development.json">
|
||||
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,2 +1,65 @@
|
||||
@page "/redirect"
|
||||
@attribute [AllowAnonymous]
|
||||
@inject MesaFabApprovalAuthStateProvider authStateProvider
|
||||
@inject IAuthenticationService authService
|
||||
@inject IUserService userService
|
||||
@inject ISnackbar snackbar
|
||||
@inject MesaFabApprovalAuthStateProvider authStateProvider
|
||||
@inject NavigationManager navigationManager
|
||||
|
||||
@code {
|
||||
private string? _jwt;
|
||||
private string? _refreshToken;
|
||||
private string? _redirectPath;
|
||||
|
||||
protected override async Task OnParametersSetAsync() {
|
||||
try {
|
||||
Uri uri = navigationManager.ToAbsoluteUri(navigationManager.Uri);
|
||||
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("jwt", out var jwt)) {
|
||||
_jwt = System.Net.WebUtility.UrlDecode(jwt);
|
||||
}
|
||||
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("refreshToken", out var refreshToken)) {
|
||||
_refreshToken = System.Net.WebUtility.UrlDecode(refreshToken);
|
||||
}
|
||||
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("redirectPath", out var redirectPath)) {
|
||||
_redirectPath = redirectPath.ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_jwt) && !string.IsNullOrWhiteSpace(_refreshToken)) {
|
||||
await authService.SetTokens(_jwt, _refreshToken);
|
||||
|
||||
ClaimsPrincipal principal = authService.GetClaimsPrincipalFromJwt(_jwt);
|
||||
|
||||
string loginId = userService.GetLoginIdFromClaimsPrincipal(principal);
|
||||
|
||||
await authService.ClearCurrentUser();
|
||||
await authService.ClearTokens();
|
||||
|
||||
await authService.SetLoginId(loginId);
|
||||
await authService.SetTokens(_jwt, _refreshToken);
|
||||
await authService.SetCurrentUser(null);
|
||||
|
||||
await authStateProvider.StateHasChanged(principal);
|
||||
}
|
||||
|
||||
if (authStateProvider.CurrentUser is not null && !string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||
navigationManager.NavigateTo(_redirectPath);
|
||||
} else {
|
||||
await authStateProvider.Logout();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||
navigationManager.NavigateTo($"login/{_redirectPath}");
|
||||
} else {
|
||||
navigationManager.NavigateTo("login");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
snackbar.Add($"Redirect failed, because {ex.Message}", Severity.Error);
|
||||
navigationManager.NavigateTo("login");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
using MesaFabApproval.Client.Services;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
|
||||
using MudBlazor;
|
||||
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace MesaFabApproval.Client.Pages;
|
||||
|
||||
public partial class AuthenticatedRedirect {
|
||||
[Inject] MesaFabApprovalAuthStateProvider authStateProvider { get; set; }
|
||||
[Inject] IAuthenticationService authService { get; set; }
|
||||
[Inject] IUserService userService { get; set; }
|
||||
[Inject] ISnackbar snackbar { get; set; }
|
||||
[Inject] NavigationManager navigationManager { get; set; }
|
||||
|
||||
private string? _jwt;
|
||||
private string? _refreshToken;
|
||||
private string? _redirectPath;
|
||||
|
||||
protected override async Task OnParametersSetAsync() {
|
||||
try {
|
||||
Uri uri = navigationManager.ToAbsoluteUri(navigationManager.Uri);
|
||||
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("jwt", out var jwt)) {
|
||||
_jwt = System.Net.WebUtility.UrlDecode(jwt);
|
||||
}
|
||||
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("refreshToken", out var refreshToken)) {
|
||||
_refreshToken = System.Net.WebUtility.UrlDecode(refreshToken);
|
||||
}
|
||||
|
||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("redirectPath", out var redirectPath)) {
|
||||
_redirectPath = redirectPath.ToString();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_jwt) && !string.IsNullOrWhiteSpace(_refreshToken)) {
|
||||
await authService.SetTokens(_jwt, _refreshToken);
|
||||
|
||||
ClaimsPrincipal principal = authService.GetClaimsPrincipalFromJwt(_jwt);
|
||||
|
||||
string loginId = userService.GetLoginIdFromClaimsPrincipal(principal);
|
||||
|
||||
await authService.ClearCurrentUser();
|
||||
await authService.ClearTokens();
|
||||
|
||||
await authService.SetLoginId(loginId);
|
||||
await authService.SetTokens(_jwt, _refreshToken);
|
||||
await authService.SetCurrentUser(null);
|
||||
|
||||
await authStateProvider.StateHasChanged(principal);
|
||||
}
|
||||
|
||||
if (authStateProvider.CurrentUser is not null && !string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||
navigationManager.NavigateTo(_redirectPath);
|
||||
} else {
|
||||
await authStateProvider.Logout();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||
navigationManager.NavigateTo($"login/{_redirectPath}");
|
||||
} else {
|
||||
navigationManager.NavigateTo("login");
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
await authStateProvider.Logout();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||
navigationManager.NavigateTo($"login/{_redirectPath}");
|
||||
} else {
|
||||
navigationManager.NavigateTo("login");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,9 @@
|
||||
bool actionIsValid = mrbAction.Action.Equals("Block") || mrbAction.Action.Equals("Convert") ||
|
||||
mrbAction.Action.Equals("Other") || mrbAction.Action.Equals("Recall") || mrbAction.Action.Equals("Scrap") ||
|
||||
mrbAction.Action.Equals("Unblock") || mrbAction.Action.Equals("Waiver");
|
||||
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.LotNumber);
|
||||
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.Customer) &&
|
||||
!string.IsNullOrWhiteSpace(mrbAction.PartNumber) &&
|
||||
!string.IsNullOrWhiteSpace(mrbAction.LotNumber);
|
||||
actionIsValid = actionIsValid && mrbAction.Quantity > 0;
|
||||
|
||||
if (mrbAction.Action.Equals("Convert", StringComparison.InvariantCultureIgnoreCase)) {
|
||||
@ -223,9 +225,6 @@
|
||||
!string.IsNullOrWhiteSpace(convertFromPart) &&
|
||||
!string.IsNullOrWhiteSpace(convertToCustomer) &&
|
||||
!string.IsNullOrWhiteSpace(convertToPart);
|
||||
} else {
|
||||
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.Customer) &&
|
||||
!string.IsNullOrWhiteSpace(mrbAction.PartNumber);
|
||||
}
|
||||
|
||||
if (mrbAction.Action.Equals("Scrap", StringComparison.InvariantCultureIgnoreCase))
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
@bind-Value="@document.DocNumbers"
|
||||
@bind-Text="@document.DocNumbers"
|
||||
Immediate
|
||||
Required
|
||||
AutoGrow
|
||||
AutoFocus />
|
||||
@if (DocNumberIsNA()) {
|
||||
@ -31,16 +30,16 @@
|
||||
Immediate
|
||||
AutoGrow />
|
||||
} else {
|
||||
<MudAutocomplete @bind-Value="@document.ECNNumber"
|
||||
T="int"
|
||||
SearchFunc="Search"
|
||||
<MudTextField @bind-Value="@document.ECNNumber"
|
||||
Required
|
||||
Clearable
|
||||
RequiredError="You must provide a valid ECN#"
|
||||
Clearable
|
||||
Variant="Variant.Outlined"
|
||||
InputType="@InputType.Number"
|
||||
Validation="@(new Func<int, Task<string>>(ECNNoIsValid))"
|
||||
Label="ECN#"
|
||||
Immediate />
|
||||
Immediate
|
||||
AutoGrow />
|
||||
}
|
||||
<MudCheckBox Label="Complete"
|
||||
Color="Color.Tertiary"
|
||||
@ -50,8 +49,8 @@
|
||||
</MudPaper>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
@if (!string.IsNullOrWhiteSpace(document.DocNumbers) && ((DocNumberIsNA() && !string.IsNullOrWhiteSpace(document.Comment)) ||
|
||||
(!DocNumberIsNA() && ecnNoIsValid))) {
|
||||
@if ((DocNumberIsNA() && !string.IsNullOrWhiteSpace(document.Comment)) ||
|
||||
(!DocNumberIsNA() && ecnNoIsValid)) {
|
||||
<MudButton Variant="Variant.Filled"
|
||||
Color="Color.Tertiary"
|
||||
Class="m1-auto"
|
||||
@ -79,8 +78,6 @@
|
||||
[Parameter]
|
||||
public required PCR3Document document { get; set; }
|
||||
|
||||
private IEnumerable<int> allEcnNumbers = new List<int>();
|
||||
|
||||
private string[] errors = { };
|
||||
|
||||
private bool complete = false;
|
||||
@ -91,8 +88,6 @@
|
||||
|
||||
protected override async Task OnParametersSetAsync() {
|
||||
complete = document.CompletedByID > 0;
|
||||
|
||||
allEcnNumbers = await ecnService.GetAllECNNumbers();
|
||||
}
|
||||
|
||||
private async Task Save() {
|
||||
@ -116,10 +111,6 @@
|
||||
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))
|
||||
@ -144,11 +135,7 @@
|
||||
|
||||
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("not applicable")) {
|
||||
if (string.IsNullOrWhiteSpace(document.Comment))
|
||||
document.Comment = "Not required";
|
||||
document.DocNumbers.ToLower().Equals("n/a")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -161,13 +148,4 @@
|
||||
StateHasChanged();
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<int>> Search(string searchValue, CancellationToken token) {
|
||||
if (string.IsNullOrWhiteSpace(searchValue))
|
||||
return allEcnNumbers;
|
||||
|
||||
return allEcnNumbers
|
||||
.Where(x => x.ToString().StartsWith(searchValue, StringComparison.InvariantCultureIgnoreCase))
|
||||
.Order();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,16 @@
|
||||
@page "/"
|
||||
@page "/Dashboard"
|
||||
@inject IConfiguration Configuration
|
||||
@inject MesaFabApprovalAuthStateProvider stateProvider
|
||||
@inject IApprovalService approvalService
|
||||
@inject IMemoryCache cache
|
||||
@inject NavigationManager navigationManager
|
||||
@inject ISnackbar snackbar
|
||||
@inject IMRBService mrbService
|
||||
@inject IPCRBService pcrbService
|
||||
@inject IECNService ecnService
|
||||
@inject ICAService caService
|
||||
@inject IJSRuntime jsRuntime
|
||||
|
||||
<PageTitle>Dashboard</PageTitle>
|
||||
|
||||
@ -215,3 +226,138 @@
|
||||
</MudTabPanel>
|
||||
</MudTabs>
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
private IEnumerable<Approval> approvalList = new List<Approval>();
|
||||
private IEnumerable<MRB> myMRBs = new List<MRB>();
|
||||
private IEnumerable<PCRB> myPCRBs = new List<PCRB>();
|
||||
|
||||
private IEnumerable<int> ecnNumbers = new HashSet<int>();
|
||||
private IEnumerable<int> caNumbers = new HashSet<int>();
|
||||
private IEnumerable<int> mrbNumbers = new HashSet<int>();
|
||||
private IEnumerable<int> pcrbNumbers = new HashSet<int>();
|
||||
|
||||
private bool myApprovalsProcessing = false;
|
||||
private bool myMrbsProcessing = false;
|
||||
private bool myPcrbsProcessing = false;
|
||||
|
||||
private string mrbSearchString = "";
|
||||
private string pcrbSearchString = "";
|
||||
|
||||
protected async override Task OnParametersSetAsync() {
|
||||
try {
|
||||
if (stateProvider.CurrentUser is not null) {
|
||||
myApprovalsProcessing = true;
|
||||
approvalList = (await approvalService.GetApprovalsForUserId(stateProvider.CurrentUser.UserID, true))
|
||||
.Where(a => a.CompletedDate > DateTime.Now && a.ItemStatus == 0)
|
||||
.ToList()
|
||||
.OrderByDescending(x => x.AssignedDate);
|
||||
myApprovalsProcessing = false;
|
||||
|
||||
myMrbsProcessing = true;
|
||||
myMRBs = (await mrbService.GetAllMRBs(false)).Where(m => m.OriginatorID == stateProvider.CurrentUser.UserID)
|
||||
.ToList()
|
||||
.OrderByDescending(x => x.SubmittedDate);
|
||||
myMrbsProcessing = false;
|
||||
|
||||
myPcrbsProcessing = true;
|
||||
myPCRBs = (await pcrbService.GetAllPCRBs(false)).Where(p => p.OwnerID == stateProvider.CurrentUser.UserID)
|
||||
.ToList()
|
||||
.OrderByDescending(p => p.InsertTimeStamp);
|
||||
myPcrbsProcessing = false;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
myApprovalsProcessing = false;
|
||||
myMrbsProcessing = false;
|
||||
myPcrbsProcessing = false;
|
||||
snackbar.Add($"Unable to load the dashboard, because {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task FollowLink(int issueId) {
|
||||
HashSet<Task> tasks = new();
|
||||
|
||||
bool isEcn = false;
|
||||
bool isCa = false;
|
||||
bool isMrb = false;
|
||||
bool isPcrb = false;
|
||||
if (ecnNumbers.Contains(issueId))
|
||||
isEcn = true;
|
||||
if (caNumbers.Contains(issueId))
|
||||
isCa = true;
|
||||
if (mrbNumbers.Contains(issueId))
|
||||
isMrb = true;
|
||||
if (pcrbNumbers.Contains(issueId))
|
||||
isPcrb = true;
|
||||
|
||||
if (!isEcn && !isCa && !isMrb) {
|
||||
Task<bool> isEcnTask = ecnService.ECNNumberIsValid(issueId);
|
||||
tasks.Add(isEcnTask);
|
||||
|
||||
Task<bool> isCaTask = caService.CANumberIsValid(issueId);
|
||||
tasks.Add(isCaTask);
|
||||
|
||||
Task<bool> isMrbTask = mrbService.NumberIsValid(issueId);
|
||||
tasks.Add(isMrbTask);
|
||||
|
||||
Task<bool> isPcrbTask = pcrbService.IdIsValid(issueId);
|
||||
tasks.Add(isPcrbTask);
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
|
||||
if (isEcnTask.Result) {
|
||||
isEcn = true;
|
||||
} else if (isCaTask.Result) {
|
||||
isCa = true;
|
||||
} else if (isMrbTask.Result) {
|
||||
isMrb = true;
|
||||
} else if (isPcrbTask.Result) {
|
||||
isPcrb = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isEcn) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/ECN/Edit?IssueID={issueId}", "");
|
||||
if (isCa) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/CorrectiveAction/Edit?IssueID={issueId}", "");
|
||||
if (isMrb) GoTo($"mrb/{issueId}");
|
||||
if (isPcrb) GoTo($"pcrb/{issueId}");
|
||||
}
|
||||
|
||||
private void GoTo(string page) {
|
||||
cache.Set("redirectUrl", page);
|
||||
navigationManager.NavigateTo("/" + page);
|
||||
}
|
||||
|
||||
private async Task GoToExternal(string url, string content) {
|
||||
IJSObjectReference windowModule = await jsRuntime.InvokeAsync<IJSObjectReference>("import", "./js/OpenInNewWindow.js");
|
||||
await windowModule.InvokeAsync<object>("OpenInNewWindow", url, content);
|
||||
}
|
||||
|
||||
private bool FilterFuncForMRBTable(MRB mrb) => MRBFilterFunc(mrb, mrbSearchString);
|
||||
|
||||
private bool MRBFilterFunc(MRB mrb, string searchString) {
|
||||
if (string.IsNullOrWhiteSpace(searchString))
|
||||
return true;
|
||||
if (mrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
||||
return true;
|
||||
if (mrb.MRBNumber.ToString().Contains(searchString.Trim()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool FilterFuncForPCRBTable(PCRB pcrb) => PCRBFilterFunc(pcrb, pcrbSearchString);
|
||||
|
||||
private bool PCRBFilterFunc(PCRB pcrb, string searchString) {
|
||||
if (string.IsNullOrWhiteSpace(searchString))
|
||||
return true;
|
||||
if (pcrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
||||
return true;
|
||||
if (pcrb.PlanNumber.ToString().Contains(searchString.Trim()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private string GetCurrentPCRBStep(int step) {
|
||||
if (step < 0 || step > (PCRB.Stages.Length - 1)) return string.Empty;
|
||||
else return PCRB.Stages[step];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,157 +0,0 @@
|
||||
using MesaFabApproval.Client.Services;
|
||||
using MesaFabApproval.Shared.Models;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
using MudBlazor;
|
||||
|
||||
namespace MesaFabApproval.Client.Pages;
|
||||
|
||||
public partial class Dashboard {
|
||||
[Inject] IConfiguration Configuration { get; set; }
|
||||
[Inject] MesaFabApprovalAuthStateProvider stateProvider { get; set; }
|
||||
[Inject] IApprovalService approvalService { get; set; }
|
||||
[Inject] IMemoryCache cache { get; set; }
|
||||
[Inject] NavigationManager navigationManager { get; set; }
|
||||
[Inject] ISnackbar snackbar { get; set; }
|
||||
[Inject] IMRBService mrbService { get; set; }
|
||||
[Inject] IPCRBService pcrbService { get; set; }
|
||||
[Inject] IECNService ecnService { get; set; }
|
||||
[Inject] ICAService caService { get; set; }
|
||||
[Inject] IJSRuntime jsRuntime { get; set; }
|
||||
|
||||
private IEnumerable<Approval> approvalList = new List<Approval>();
|
||||
private IEnumerable<MRB> myMRBs = new List<MRB>();
|
||||
private IEnumerable<PCRB> myPCRBs = new List<PCRB>();
|
||||
|
||||
private IEnumerable<int> ecnNumbers = new HashSet<int>();
|
||||
private IEnumerable<int> caNumbers = new HashSet<int>();
|
||||
private IEnumerable<int> mrbNumbers = new HashSet<int>();
|
||||
private IEnumerable<int> pcrbNumbers = new HashSet<int>();
|
||||
|
||||
private bool myApprovalsProcessing = false;
|
||||
private bool myMrbsProcessing = false;
|
||||
private bool myPcrbsProcessing = false;
|
||||
|
||||
private string mrbSearchString = "";
|
||||
private string pcrbSearchString = "";
|
||||
|
||||
protected async override Task OnParametersSetAsync() {
|
||||
try {
|
||||
if (stateProvider.CurrentUser is not null) {
|
||||
myApprovalsProcessing = true;
|
||||
approvalList = (await approvalService.GetApprovalsForUserId(stateProvider.CurrentUser.UserID, true))
|
||||
.Where(a => a.CompletedDate > DateTime.Now && a.ItemStatus == 0)
|
||||
.ToList()
|
||||
.OrderByDescending(x => x.AssignedDate);
|
||||
myApprovalsProcessing = false;
|
||||
|
||||
myMrbsProcessing = true;
|
||||
myMRBs = (await mrbService.GetAllMRBs(false)).Where(m => m.OriginatorID == stateProvider.CurrentUser.UserID)
|
||||
.ToList()
|
||||
.OrderByDescending(x => x.SubmittedDate);
|
||||
myMrbsProcessing = false;
|
||||
|
||||
myPcrbsProcessing = true;
|
||||
myPCRBs = (await pcrbService.GetAllPCRBs(false)).Where(p => p.OwnerID == stateProvider.CurrentUser.UserID)
|
||||
.ToList()
|
||||
.OrderByDescending(p => p.InsertTimeStamp);
|
||||
myPcrbsProcessing = false;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
myApprovalsProcessing = false;
|
||||
myMrbsProcessing = false;
|
||||
myPcrbsProcessing = false;
|
||||
snackbar.Add(ex.Message, Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task FollowLink(int issueId) {
|
||||
HashSet<Task> tasks = new();
|
||||
|
||||
bool isEcn = false;
|
||||
bool isCa = false;
|
||||
bool isMrb = false;
|
||||
bool isPcrb = false;
|
||||
if (ecnNumbers.Contains(issueId))
|
||||
isEcn = true;
|
||||
if (caNumbers.Contains(issueId))
|
||||
isCa = true;
|
||||
if (mrbNumbers.Contains(issueId))
|
||||
isMrb = true;
|
||||
if (pcrbNumbers.Contains(issueId))
|
||||
isPcrb = true;
|
||||
|
||||
if (!isEcn && !isCa && !isMrb) {
|
||||
Task<bool> isEcnTask = ecnService.ECNNumberIsValid(issueId);
|
||||
tasks.Add(isEcnTask);
|
||||
|
||||
Task<bool> isCaTask = caService.CANumberIsValid(issueId);
|
||||
tasks.Add(isCaTask);
|
||||
|
||||
Task<bool> isMrbTask = mrbService.NumberIsValid(issueId);
|
||||
tasks.Add(isMrbTask);
|
||||
|
||||
Task<bool> isPcrbTask = pcrbService.IdIsValid(issueId);
|
||||
tasks.Add(isPcrbTask);
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
|
||||
if (isEcnTask.Result) {
|
||||
isEcn = true;
|
||||
} else if (isCaTask.Result) {
|
||||
isCa = true;
|
||||
} else if (isMrbTask.Result) {
|
||||
isMrb = true;
|
||||
} else if (isPcrbTask.Result) {
|
||||
isPcrb = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isEcn) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/ECN/Edit?IssueID={issueId}", "");
|
||||
if (isCa) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/CorrectiveAction/Edit?IssueID={issueId}", "");
|
||||
if (isMrb) GoTo($"mrb/{issueId}");
|
||||
if (isPcrb) GoTo($"pcrb/{issueId}");
|
||||
}
|
||||
|
||||
private void GoTo(string page) {
|
||||
cache.Set("redirectUrl", page);
|
||||
navigationManager.NavigateTo("/" + page);
|
||||
}
|
||||
|
||||
private async Task GoToExternal(string url, string content) {
|
||||
IJSObjectReference windowModule = await jsRuntime.InvokeAsync<IJSObjectReference>("import", "./js/OpenInNewWindow.js");
|
||||
await windowModule.InvokeAsync<object>("OpenInNewWindow", url, content);
|
||||
}
|
||||
|
||||
private bool FilterFuncForMRBTable(MRB mrb) => MRBFilterFunc(mrb, mrbSearchString);
|
||||
|
||||
private bool MRBFilterFunc(MRB mrb, string searchString) {
|
||||
if (string.IsNullOrWhiteSpace(searchString))
|
||||
return true;
|
||||
if (mrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
||||
return true;
|
||||
if (mrb.MRBNumber.ToString().Contains(searchString.Trim()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool FilterFuncForPCRBTable(PCRB pcrb) => PCRBFilterFunc(pcrb, pcrbSearchString);
|
||||
|
||||
private bool PCRBFilterFunc(PCRB pcrb, string searchString) {
|
||||
if (string.IsNullOrWhiteSpace(searchString))
|
||||
return true;
|
||||
if (pcrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
||||
return true;
|
||||
if (pcrb.PlanNumber.ToString().Contains(searchString.Trim()))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private string GetCurrentPCRBStep(int step) {
|
||||
if (step < 0 || step > (PCRB.Stages.Length - 1)) return string.Empty;
|
||||
else return PCRB.Stages[step];
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,6 @@ namespace MesaFabApproval.Client.Services;
|
||||
public interface IECNService {
|
||||
Task<string> ECNNumberIsValidStr(int ecnNumber);
|
||||
Task<bool> ECNNumberIsValid(int number);
|
||||
Task<IEnumerable<int>> GetAllECNNumbers();
|
||||
}
|
||||
|
||||
public class ECNService : IECNService {
|
||||
@ -50,32 +49,4 @@ public class ECNService : IECNService {
|
||||
throw new Exception($"Unable to determine if {number} is a valid ECN#, because {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<int>> GetAllECNNumbers() {
|
||||
try {
|
||||
HttpClient httpClient = _httpClientFactory.CreateClient("API");
|
||||
|
||||
HttpRequestMessage requestMessage = new(HttpMethod.Get, $"ecn/allNumbers");
|
||||
|
||||
HttpResponseMessage responseMessage = await httpClient.SendAsync(requestMessage);
|
||||
|
||||
if (responseMessage.IsSuccessStatusCode) {
|
||||
string responseContent = await responseMessage.Content.ReadAsStringAsync();
|
||||
|
||||
JsonSerializerOptions jsonSerializerOptions = new() {
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
IEnumerable<int> allEcnNumbers =
|
||||
JsonSerializer.Deserialize<IEnumerable<int>>(responseContent, jsonSerializerOptions) ??
|
||||
new List<int>();
|
||||
|
||||
return allEcnNumbers;
|
||||
} else {
|
||||
throw new Exception(responseMessage.ReasonPhrase);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new Exception($"Unable to get all ECN#s, because {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,84 +0,0 @@
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- master
|
||||
paths:
|
||||
include:
|
||||
- MesaFabApproval.Client
|
||||
- MesaFabApproval.Shared
|
||||
|
||||
variables:
|
||||
buildConfiguration: "Release"
|
||||
|
||||
stages:
|
||||
- stage: Test
|
||||
displayName: "Test"
|
||||
pool:
|
||||
name: MesaFabApproval
|
||||
demands: Fab2ApprovalSystem-Dev
|
||||
jobs:
|
||||
- job: BuildPublish
|
||||
steps:
|
||||
- script: |
|
||||
echo build configuration: $(BuildConfiguration)
|
||||
displayName: "Echo Check"
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Build"
|
||||
inputs:
|
||||
command: "build"
|
||||
configuration: $(BuildConfiguration)
|
||||
projects: MesaFabApproval.Client
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Publish"
|
||||
inputs:
|
||||
command: "publish"
|
||||
publishWebProjects: false
|
||||
projects: MesaFabApproval.Client
|
||||
zipAfterPublish: true
|
||||
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: "Copy Files"
|
||||
inputs:
|
||||
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
||||
TargetFolder: 'D:\$(Build.Repository.Name)\Client\$(Build.BuildId)\$(BuildConfiguration)'
|
||||
CleanTargetFolder: true
|
||||
retryCount: "3"
|
||||
|
||||
- stage: Prod
|
||||
displayName: "Prod"
|
||||
pool:
|
||||
name: MesaFabApproval
|
||||
demands: Fab2ApprovalSystem
|
||||
jobs:
|
||||
- job: BuildPublish
|
||||
steps:
|
||||
- script: |
|
||||
echo build configuration: $(BuildConfiguration)
|
||||
displayName: "Echo Check"
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Build"
|
||||
inputs:
|
||||
command: "build"
|
||||
configuration: $(BuildConfiguration)
|
||||
projects: MesaFabApproval.Client
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "Publish"
|
||||
inputs:
|
||||
command: "publish"
|
||||
publishWebProjects: false
|
||||
projects: MesaFabApproval.Client
|
||||
zipAfterPublish: true
|
||||
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
||||
|
||||
- task: CopyFiles@2
|
||||
displayName: "Copy Files"
|
||||
inputs:
|
||||
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
||||
TargetFolder: 'D:\$(Build.Repository.Name)\Client\$(Build.BuildId)\$(BuildConfiguration)'
|
||||
CleanTargetFolder: true
|
||||
retryCount: "3"
|
||||
@ -1,4 +0,0 @@
|
||||
{
|
||||
"OldFabApprovalUrl": "https://mesaapproval-test.mes.infineon.com",
|
||||
"FabApprovalApiBaseUrl": "https://mesaapproval-test.mes.infineon.com:7114"
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"OldFabApprovalUrl": "https://mesaapproval.mes.infineon.com",
|
||||
"FabApprovalApiBaseUrl": "https://mesaapproval.mes.infineon.com:7114"
|
||||
"OldFabApprovalUrl": "https://mesaapproval-test.mes.infineon.com",
|
||||
"FabApprovalApiBaseUrl": "https://mesaapproval-test.mes.infineon.com:7114"
|
||||
}
|
||||
@ -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; } = string.Empty;
|
||||
public string DocNumbers { get; set; } = "N/A";
|
||||
public DateTime CompletedDate { get; set; } = DateTimeUtilities.MAX_DT;
|
||||
public int CompletedByID { get; set; } = 0;
|
||||
public User? CompletedBy { get; set; }
|
||||
|
||||
16
Programmability/Functions/EncodeHtml.sql
Normal file
16
Programmability/Functions/EncodeHtml.sql
Normal file
@ -0,0 +1,16 @@
|
||||
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, '&', '&'), '<', '<'),
|
||||
'>',
|
||||
'>'
|
||||
)
|
||||
END
|
||||
GO
|
||||
@ -0,0 +1,33 @@
|
||||
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
|
||||
@ -0,0 +1,28 @@
|
||||
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
|
||||
64
Programmability/Functions/fnGetApprovalFullNames.sql
Normal file
64
Programmability/Functions/fnGetApprovalFullNames.sql
Normal file
@ -0,0 +1,64 @@
|
||||
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
|
||||
24
Programmability/Functions/fnGetITARUsers.sql
Normal file
24
Programmability/Functions/fnGetITARUsers.sql
Normal file
@ -0,0 +1,24 @@
|
||||
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
|
||||
33
Programmability/Functions/fnGetLotCount_Fab.sql
Normal file
33
Programmability/Functions/fnGetLotCount_Fab.sql
Normal file
@ -0,0 +1,33 @@
|
||||
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
|
||||
33
Programmability/Functions/fnGetLotCount_Probe.sql
Normal file
33
Programmability/Functions/fnGetLotCount_Probe.sql
Normal file
@ -0,0 +1,33 @@
|
||||
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
|
||||
33
Programmability/Functions/fnGetLotCount_QDB.sql
Normal file
33
Programmability/Functions/fnGetLotCount_QDB.sql
Normal file
@ -0,0 +1,33 @@
|
||||
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
|
||||
37
Programmability/Functions/fnGetLotCount_RH_MA.sql
Normal file
37
Programmability/Functions/fnGetLotCount_RH_MA.sql
Normal file
@ -0,0 +1,37 @@
|
||||
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
|
||||
27
Programmability/Functions/fnGetLot_RH.sql
Normal file
27
Programmability/Functions/fnGetLot_RH.sql
Normal file
@ -0,0 +1,27 @@
|
||||
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
|
||||
63
Programmability/Functions/fnGetMRB_SPN_HoldLots.sql
Normal file
63
Programmability/Functions/fnGetMRB_SPN_HoldLots.sql
Normal file
@ -0,0 +1,63 @@
|
||||
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
|
||||
70
Programmability/Functions/fnGetScrapCost.sql
Normal file
70
Programmability/Functions/fnGetScrapCost.sql
Normal file
@ -0,0 +1,70 @@
|
||||
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
|
||||
32
Programmability/Functions/fnGetScrapCount.sql
Normal file
32
Programmability/Functions/fnGetScrapCount.sql
Normal file
@ -0,0 +1,32 @@
|
||||
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
|
||||
109
Programmability/Functions/fnGetStep1Roles.sql
Normal file
109
Programmability/Functions/fnGetStep1Roles.sql
Normal file
@ -0,0 +1,109 @@
|
||||
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
|
||||
50
Programmability/Functions/fnGetStep1RolesMA_YE.sql
Normal file
50
Programmability/Functions/fnGetStep1RolesMA_YE.sql
Normal file
@ -0,0 +1,50 @@
|
||||
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
|
||||
45
Programmability/Functions/fnGetStep1RolesMA_YE_PE.sql
Normal file
45
Programmability/Functions/fnGetStep1RolesMA_YE_PE.sql
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
50
Programmability/Functions/fnGetStep1RolesRH_YE.sql
Normal file
50
Programmability/Functions/fnGetStep1RolesRH_YE.sql
Normal file
@ -0,0 +1,50 @@
|
||||
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
|
||||
45
Programmability/Functions/fnGetStep1RolesRH_YE_PE.sql
Normal file
45
Programmability/Functions/fnGetStep1RolesRH_YE_PE.sql
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
108
Programmability/Functions/fnGetStep1Roles_PERequired.sql
Normal file
108
Programmability/Functions/fnGetStep1Roles_PERequired.sql
Normal file
@ -0,0 +1,108 @@
|
||||
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
|
||||
45
Programmability/Functions/fnGetStep2Roles_GT_10Wafers.sql
Normal file
45
Programmability/Functions/fnGetStep2Roles_GT_10Wafers.sql
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
45
Programmability/Functions/fnGetStep2Roles_PlantManager.sql
Normal file
45
Programmability/Functions/fnGetStep2Roles_PlantManager.sql
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
49
Programmability/Functions/fnGetStep2Roles_RhMaQdbPeMRB.sql
Normal file
49
Programmability/Functions/fnGetStep2Roles_RhMaQdbPeMRB.sql
Normal file
@ -0,0 +1,49 @@
|
||||
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
|
||||
44
Programmability/Functions/fnGetStep3Role_QDB.sql
Normal file
44
Programmability/Functions/fnGetStep3Role_QDB.sql
Normal file
@ -0,0 +1,44 @@
|
||||
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
|
||||
45
Programmability/Functions/fnGetStep3Roles_Fab.sql
Normal file
45
Programmability/Functions/fnGetStep3Roles_Fab.sql
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
45
Programmability/Functions/fnGetStep3Roles_Probe.sql
Normal file
45
Programmability/Functions/fnGetStep3Roles_Probe.sql
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
27
Programmability/Functions/fnIsUserITARCompliant.sql
Normal file
27
Programmability/Functions/fnIsUserITARCompliant.sql
Normal file
@ -0,0 +1,27 @@
|
||||
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
|
||||
70
Programmability/Functions/fnLotDispositionLotSummary.sql
Normal file
70
Programmability/Functions/fnLotDispositionLotSummary.sql
Normal file
@ -0,0 +1,70 @@
|
||||
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
|
||||
@ -0,0 +1,30 @@
|
||||
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
|
||||
@ -0,0 +1,28 @@
|
||||
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
|
||||
29
Programmability/Functions/fnSplitCSV.sql
Normal file
29
Programmability/Functions/fnSplitCSV.sql
Normal file
@ -0,0 +1,29 @@
|
||||
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
|
||||
48
Programmability/Functions/fn_Get8DAuditByUser.sql
Normal file
48
Programmability/Functions/fn_Get8DAuditByUser.sql
Normal file
@ -0,0 +1,48 @@
|
||||
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
|
||||
132
Programmability/Functions/fn_Get8DCAByUser.sql
Normal file
132
Programmability/Functions/fn_Get8DCAByUser.sql
Normal file
@ -0,0 +1,132 @@
|
||||
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
|
||||
50
Programmability/Functions/fn_Get8DCASectionByUser.sql
Normal file
50
Programmability/Functions/fn_Get8DCASectionByUser.sql
Normal file
@ -0,0 +1,50 @@
|
||||
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
|
||||
45
Programmability/Functions/fn_GetChangeControl.sql
Normal file
45
Programmability/Functions/fn_GetChangeControl.sql
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
67
Programmability/Functions/fn_GetECNs.sql
Normal file
67
Programmability/Functions/fn_GetECNs.sql
Normal file
@ -0,0 +1,67 @@
|
||||
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
|
||||
170
Programmability/Functions/fn_GetECNsByUser.sql
Normal file
170
Programmability/Functions/fn_GetECNsByUser.sql
Normal file
@ -0,0 +1,170 @@
|
||||
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
|
||||
155
Programmability/Functions/fn_GetECNsByUserPrev.sql
Normal file
155
Programmability/Functions/fn_GetECNsByUserPrev.sql
Normal file
@ -0,0 +1,155 @@
|
||||
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
|
||||
88
Programmability/Functions/fn_GetExpiredTECNByOriginator.sql
Normal file
88
Programmability/Functions/fn_GetExpiredTECNByOriginator.sql
Normal file
@ -0,0 +1,88 @@
|
||||
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
|
||||
59
Programmability/Functions/fn_GetLTWorkRequests.sql
Normal file
59
Programmability/Functions/fn_GetLTWorkRequests.sql
Normal file
@ -0,0 +1,59 @@
|
||||
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
|
||||
140
Programmability/Functions/fn_GetLTWorkRequestsByUser.sql
Normal file
140
Programmability/Functions/fn_GetLTWorkRequestsByUser.sql
Normal file
@ -0,0 +1,140 @@
|
||||
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
|
||||
76
Programmability/Functions/fn_GetLotDispositions.sql
Normal file
76
Programmability/Functions/fn_GetLotDispositions.sql
Normal file
@ -0,0 +1,76 @@
|
||||
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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user