Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 91 Next »

System Profile

System Full NameCanadian Port State Control System
Product Owner(s)Bill Henderson
Business OwnerNaim Nazha

Technology Assessment

Database Platform and VersionOracle 18c
Development Language and FrameworkClassic ASP
Javascript
HTML
Visual Basic 6 (COM)
Fytek PDF Writer DLL
Operating System and VersionWindows Server 2016

Environment Access Information

DEV

User (admin): greenj

Pass: See RDIMS #13232403

UNC: \\wwwapps2mssdev\wwwappsroot\saf-sec-sur\4\cpscs-scepc

URL: http://wwwapps2mssdev/saf-sec-sur/4/cpscs-scepc/

DB:  CPSCS_EXTA@CPSCSD.WORLD, CPSCSW_USER@CPSCSD.WORLD

Web Services:

ACC

User (admin): greenj

Pass: See RDIMS #13232403

UNC:  \\wwwapps2test\wwwappsroot\saf-sec-sur\4\cpscs-scepc

URL: https://wwwapps2test.tc.gc.ca/saf-sec-sur/4/cpscs-scepc/

DB: CPSCS_EXTA@CPSCSA.WORLD

Web Services:

PROD

User (admin): greenj

Pass: See RDIMS #13232403

UNC:  \\wwwapps2\wwwappsroot\saf-sec-sur\4\cpscs-scepc

URL:   https://wwwapps2.tc.gc.ca/saf-sec-sur/4/cpscs-scepc/

DB: CPSCS_EXTA@CPSCSP.WORLD

LogFiles: \\ncrws554\wwwfiles\cpscs\logs

Web Services:

Source Code:
            Dev

System

Overview

<…either point to some document or put some info / diagram here>

Good To Know

Installation of new THETIS certificate

When the THETIS certificate, issued by EMSA, is about to expire, EMSA will contact the CPSCS stakeholders to begin the process of getting a new server-side THETIS certificate created.  Here are the steps required to generate and install the new certificate.

  1. Ask Web Group to create a valid CSR that can be sent to EMSA. This CSR is used by EMSA to generate a new certificate to allow communication with THETIS.
  2. Send the CSR to EMSA along with any provided forms filled out in conjunction with the CPSCS business owner.
  3. EMSA will create a signed digital certificate (*.pem) and send that back to the CPSCS business owners.  
  4. Send the PEM file to the Web Group and ask them to use the PEM file to generate the PFX file. 
  5. Using the PFX file, the certificate can be installed on the appropriate servers.  Be sure to refer to "CPSCS - <NO IM> - CPSCS-THETIS web service cannot access THETIS web service" below for further instructions when installing the certificate on the server.  Long story short: explicit permission must be given to the app pool requesting to use the certificate for communication with THETIS.
  6. Ask the Web Group to install the certificate on ACC servers (wwwappstest).  
  7. Ask the Web Group to send us the PFX file and password so that we can install the certificate on the appropriate dev server (hosting the CPSCS-THETIS web service).
  8. Note: latest certificates for CPSCS-THETIS web service can be found in the following directory and subdirectories: \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\THETIS\Certificates.

Test Vessel

When performing testing, particularly in production, care must be taken to avoid corrupting or polluting the CPSCS database.  Testing is generally performed using the Douglas Bay (or Douglas Bay - Test) vessel - IMO number 7411636. This vessel and its inspections are ignored in reporting - and should be ignored if you are creating new reports for the CPSCS stakeholders.

If you need an account for user testing, you should log into the CPSCS web application as an admin user (see RDIMS #13232403) to locate a test user account.  When in doubt, contact the client admin to identify a good account to use for testing.

Log Files

Log files for CPSCS and its associated web services and can be found in the following locations:


CPSCS-THETIS web service log file directories:
  • \\ncrws536\wwwfiles\cpscs-ws\logs 
  • \\ncrws537\wwwfiles\cpscs-ws\logs
  • \\ncrws538\wwwfiles\cpscs-ws\logs
 
CPSCS-APCIS web service log file directories:
  • \\ncrws536\wwwfiles\cpscs-apcis-ws\logs
  • \\ncrws537\wwwfiles\cpscs-apcis-ws\logs
  • \\ncrws538\wwwfiles\cpscs-apcis-ws\logs
  • \\ncrws554\wwwfiles\cpscs\logs

CPSCS-INNAV web service log file directories:

  • \\ncrws536\wwwfiles\tc-cpscs-ws\logs
  • \\ncrws537\wwwfiles\tc-cpscs-ws\logs
  • \\ncrws538\wwwfiles\tc-cpscs-ws\logs

CPSCS-VTP (Vessel Traffic Processor) log file directory:

  • \\tcwebscripts\wwwfiles\cpscs\logs


CPSCS web site log files:
  • \\wwwapps2\wwwfiles\cpscs\logs
 
Note: any requests made to THETIS/APCIS to pull import vessel and/or inspection information will appear in log files with the following naming scheme: "requestXXXXXXX.log"
where XXXXXXX is a numeric string representing the CPSCS inspection ID.
Note: any request made to THETIS/APCIS to export vessel/inspection data will appear in the log files with the following naming scheme: thetis-export-XXXXXXX.log or apcis-export-XXXXXXX.log where XXXXXXX is the inspection ID related to the exported information.
Testing Connection to THETIS: Which Function do I call?
The easiest way to test the connection to the THETIS production web service, log into the CPSCS production web site as an admin, perform a vessel search, and then click the Modify button for one of the returned vessel records. This will initiate a call to the THETIS production web service: if the call works (based on log files or if onscreen messaging is not red), the call worked.
To test the connection to THETIS without the web site (if the test above failed), use SOAP UI to make a call to the THETIS production web service.  To avoid any possible issues or complications, always make a call to GetShipParticularsJSON with a valid IMO number. This call will connect to the THETIS web service (via the CPSCS-THETIS web service) and attempt to download updated vessel information.

Testing: Inspection Types

When creating test inspections, it is best to stick with the following inspection types:

  • Initial
  • More Detailed
  • Expanded
  • Canadian Tanker (for tanker vessel types)

All other inspection types may result in testing issues and are not compatible with THETIS and APCIS (as of October 2019).

Testing: Operational Controls

Please note that operational controls can not be selected for Initial inspections. In addition, changing the inspection type to Initial will clear all currently selected operational controls associated with the inspection you are working with on the CPSCS web site.

How-To and Fixes


CPSCS - IM295914 - PAC - NADKARC - urgent - CPSCS Inspection creation (submission) error

Problem: Client got an error trying to submit a saved inspection:

(Inspection:InspectionTombstone Method)​
strSQL = 'Inspection:InspectionTombstone Method (1): VID=759742, CurrVID = 759741, SaveID = 759741'​
Invalid procedure call or argument​ 

Solution:

Client says that inspection is missing. Returning to the database and running query:
select * from vessel where vessel_id=759741;
vessel_id=759741 or vessel_id=759742
Looks like we updated the wrong inspection. We run this in the user_saved_inspections. First we need user_id
select user_id from user_profile where username='NADKARC'; returned 226
select * from user_saved_inspections where user_id=226;
returned 6 rows each with vessel_id=759742:
Image
All returned inspection rows show 759742 vessel id. Vessel Id linked to inspection needs to be 759742 also for it to show up for user . We update vessel id 759741 to 759742 in the vessel table:
Update vessel set vessel_id=759742 where vessel_id=759741;commit;
Saved inspection now shows up and user will try submitting again.

CPSCS - <NO IM> - CPSCS-THETIS web service cannot access THETIS web service

Problem:

On calling the thetis webservice this error is returned: [GetShipParticulars Error] Unexpected error has occured: '(5): The request was aborted: Could not create SSL/TLS secure channel.

This error was caused by 2 issues:

  1. The cpscs-ws.tc.gc.ca.pfx appeared to not have been properly installed, there was no key found in the C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\ on server.
  2. The account under which the CPSCS-Thetis web service runs IIS AppPool\CPSCS-Thetis did not have read permission on the key file above.

Solution involved deleting and reinstalling the certificate, and granting read permission to service account on all 3 servers: ncrws536, ncrws537, ncrws538:

To install certificate:

  • Start - Run "mmc".
  • Add snap-ins for Certificates: My User and Computer Account.
  • For both My User and Computer Account:
    • Right-click Personal - All Tasks - Import.
    • Browse and select "cpscs-ws.tc.gc.ca.pfx".
    • Password can be found here: \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\THETIS\Certificates\March 2018\Certificate Installation Instruction.txt
    • Next right-click Intermediate Certificate Authorities - All Tasks - Import.
    • Browse and select emsa-prod.ca-bundle.cer and install to Intermediate Certificates.
    • Look under the Intermediate Certificates and double-click on the MarApps Production Intermediate - SHA256 certificate.
    • Open the Certification Path tab and double-click on the EMSA Root CA certificate.
    • Install this certificate to the Trusted Root Certification Authorities.

To grant access:

  • Use elevated powershell to find the Guid key for this certificate in
    C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\
    • $Cert = Get-Item Cert:\LocalMachine\My\<Thumbprint of Certificate>
    • $Cert.PrivateKey.CspKeyContainerInfo.UniqueKeyContainerName
      • <Thumbprint of Certificate> can be found from MMC: Certificates(Local Computer)->Personal->Certificates->cpscs-ws.tc.gc.ca

      • In Certificate property window, it’s at the bottom of the Details tab

      • If a key is not returned, the certificate may not have been properly installed and need to be reinstalled.

    • Full path to key is C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\<key returned>
    • To to grant access, run following with key returned:

      ICACLS <Full path to key> "IIS AppPool\CPSCS-Thetis:R"

Info from DOS:


Asuquo Eniang
commented Nov 26, 2019
 
This confirms that IIS AppPool\CPSCS-Thetis account access to the certificate key file is the issue; Here's a before and after screen shots of permissions on this folder, on dev server:
BeforeAndAfter.png
Asuquo Eniang
commented Nov 23, 2019
 
Publish modified (pointing to thetis prod) project to Dev.
Test service from SOAP-UI, it passed:
   "ErrCode":{
      "errNum":"0",
      "errMsg":"[GetShipParticulars Success] Ok"
   },
   "Receipt":{
      "ShipParticulars":{
         "Name":{
            "Value":"SLOMAN HELIOS",
            "EffectDate":"2016-08-31T20:00:00-04:00",
            "EffectDateSpecified":true
         }
}}
Asuquo Eniang
commented Nov 23, 2019
 
(edited)
Researching the error "The request was aborted: Could not create SSL/TLS secure channel." further, this Stack Overflow page suggests to use ICAL to register certificate with ASP.
  • Install Certificate in Dev LocalMachine
    1. Instructions located here:
      \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\THETIS\Certificates\March 2018
    2. If this certificate is not installed, you'll get: Unexpected error has occured: '(91): Object reference not set to an instance of an object. when service is called.
    3. It is possible for a certificate to exist in MMC console but missing a file entry in C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys
  • Find certificate path using tool FindPrivateKey.exe
    1. Copy the tool FindPrivateKey.exe from
      \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\THETIS\Certificates\March 2018 to a location on Dev server
    2. open command prompt as administrator, navigate to location of tool.
    3. Run command: FindPrivateKey.exe My LocalMachine -n "MarApps Production Intermediate - SHA256" -a
    4. Copy and save the result: C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\ff85bd97ae6a76c3dcbc4925e3eb6ca3_518d76a8-4ded-49de-b4a9-d981cc355562
  • Use ICALS to grant IIS AppPool access to the .cer file, with path:
    1. ICACLS C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\ff85bd97ae6a76c3dcbc4925e3eb6ca3_518d76a8-4ded-49de-b4a9-d981cc355562 /grant "IIS AppPool\CPSCS-Thetis:R"
    2. Confirm result: Successfully processed 1 files; Failed processing 0 files
Asuquo Eniang
commented Nov 23, 2019
 
(edited)
Download and install the Microsoft Windows HTTP Services (WinHTTP) Certificate Configuration Tool winhttpcertcfg here: https://www.microsoft.com/en-ca/download/details.aspx?id=19801

After installing, run this:
winhttpcertcfg -i C:\Users\enianga\Documents\Tools\CPSCS_THETIS_Certs_Mar2018\cpscs-ws.tc.gc.ca.pfx -c LOCAL_MACHINE\Root -a IIS_IUSRS -p <cert_password>

Testing the site again, it didn't work, same error.
Asuquo Eniang
commented Nov 22, 2019
 
(edited)
Next we test on dev server NCRWS535
Build and publish source code with temp changes:
            'Me.Url = Global.cpscs_ws.My.MySettings.Default.cpscs_ws_thetis_test_THETISDataExchangeService
            Me.Url = Global.cpscs_ws.My.MySettings.Default.cpscs_ws_thetis_ws_THETISDataExchangeService
and PROD_RELEASE = 1
Add new url to the CPSCS-THETIS-WS-Debug test project in Soap-UI. This url should point to cpscs-ws on dev server:
It returned:
"ErrCode":{
"errNum":"-1",
"errMsg":"[GetShipParticulars Error] Unexpected error has occured: '(5): The request was aborted: Could not create SSL/TLS secure channel.'"
}
We need to install the same certificate on the server as we did locally, then test again. This certificate may not have been previously installed on dev server 535 since it was never needed. Justin is working on this.
Asuquo Eniang
commented Nov 25, 2019
 
(edited)
After granting access following steps below, service was tested and passed on three servers 336, 337 and 338:
Log can be found here: \\ncrws536\wwwfiles\cpscs-ws\logs
Asuquo Eniang
commented Nov 25, 2019
 
The solution below failed on first try on Prod server. 
FindPrivateKey.exe My LocalMachine -n "MarApps Production Intermediate - SHA256" -a
FindPrivateKey failed for the following reason:
No certificates with key 'MarApps Production Intermediate - SHA256' found in the store.
We need to verify that the certificate is properly installed.
Look under Certificates(Local Computer)->Personal->Certificates
Image
Next we use elevated powershell to find the Guid key for this certificate in
C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\
Run:


$Cert = Get-Item Cert:\LocalMachine\My\<Thumbprint of Certificate>


$Cert.PrivateKey.CspKeyContainerInfo.UniqueKeyContainerName



Where <Thumbprint of Certificate> can be found from MMC: Certificates(Local Computer)->Personal->Certificates->cpscs-ws.tc.gc.ca

In Certificate property window, it’s at the bottom of the Details tab. See attached image.


If a key is not returned, the certificate may not have been properly installed.

Right click and delete it from the console. Install the certificate again. Instructions can be found here:

\\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\THETIS\Certificates\March 2018



Once the certificate is installed, this command should be able to return a full path to the key:

FindPrivateKey.exe My LocalMachine -n "MarApps Production Intermediate - SHA256" -a


To to grant access, run following with key returned:

ICACLS <Full path to key> "IIS AppPool\CPSCS-Thetis:R"





Asuquo Eniang
commented Nov 23, 2019
 
@Justin Green  I found a way to grant IIS AppPool access to the thetis certificate (MarApps Production...)
I tested on dev and it worked. You can find more details in the child tasks of bug 4195.
Web team would have to follow these steps to correct the issue. Step 1 can be skipped if certificate is already installed.
  • Install Certificate in Prod LocalMachine
    1. Instructions located here:
      \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\THETIS\Certificates\March 2018
    2. If this certificate is not installed, you'll get: Unexpected error has occured: '(91): Object reference not set to an instance of an object. when service is called.
  • Find certificate path using tool FindPrivateKey.exe
    1. Copy the tool FindPrivateKey.exe from
      \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\THETIS\Certificates\March 2018 to a location on server
    2. open command prompt as administrator, navigate to location of tool.
    3. Run command: FindPrivateKey.exe My LocalMachine -n "MarApps Production Intermediate - SHA256" -a
    4. Copy and save the result: C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\ff85bd97ae6a76c3dcbc4925e3eb6ca3_518d76a8-4ded-49de-b4a9-d981cc355562
  • Use ICALS to grant IIS AppPool access to the .cer file, with path:
    1. ICACLS C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\ff85bd97ae6a76c3dcbc4925e3eb6ca3_518d76a8-4ded-49de-b4a9-d981cc355562 /grant "IIS AppPool\CPSCS-Thetis":R
    2. Confirm result: Successfully processed 1 files; Failed processing 0 files

Error: Call Sign must confirm to Basic and ITU data validation standards

Problem:

On updating Vessel Tombstone page user getting error, Call Sign must confirm to Basic and ITU data validation standards, for the call sign J8QY1. 

Solution:

Details from the backlog: see below for an appropriate The call sign should be formatted according to ITU Radio Regulations. The last digit for the call sign J8QY1 is "1" which is invalid as per the regulation.


Kajal Chaudhari
commented Oct 10, 2019
 
See the attached email from APCIS support. They have mentioned :
According to the DVR for Ship Callsigns, callsigns shall be formatted according to ITU Radio Regulations Section III-Formation of call signs, in one of the following 11 formats:

 Image

where a=any alpha character A-Z incl., n=any digit 0-9 incl., N=only digits 2-9
Here the callsign J8QY1 is formed according to the 5-character format “aNaaN” but according to the rules the last digit should be from 2 to 9 (other than the digits 0 or 1).  The last digit of the callsign J8QY1 is 1, so this callsign does not comply to DVR. This is why this callsign is not accepted by the APCIS system.

If ship call sign is unavailable or it does not comply the DVR, it is recommended to enter “n/a” into the field “Callsign” of the inspection report.

THETIS Export Error: Invalid Procedure Call or argument

Problem:
While user export the inspection to THETIS its throwing error Invalid Procedure Call or argument. Issue occurs only if no deficiency has been reported in the inspection. 

Solution:
This issue has been resolved by the code fix.  

Kajal Chaudhari
commented Sep 19, 2019
 

Here are the list of IMO with the error “Invalid Procedure call or argument “ and have no deficiencies. These were failing to export due to the code error “If i > 0 Then  dictDeficiencies.Add "deficiency", dictDefs “


  1. 9400370 CHEMBULK JAKARTA
  2. 9496135 JAG RADHA
  3. 9748564 MICHELE FOSS                
  4. 9846079 LA LUNA
  5. 9241061 QUEEN MARY 2    
  6. 9660085 EAGLE I-STAR                  
  7. 9433274 HUMBERGRACHT          
  8. 9590735 GLOBAL TRINITY             
  9. 9746231 OBSIDIAN                         
  10. 9364992 CMA CGM ORFEO         
  11. 9200419 FEDERAL ASAHI              
  12. 9629885 RAMFORM TITAN          
  13. 9512331 NBA MAGRITTE              
  14. 9484493 MARIVICTORIA               
  15. 9457024 NAVE COSMOS
  16. 9800051 NORDIC AMI                    
  17. 9546461 TAAGBORG
  18. 9740342 TRF HORTEN
Asuquo Eniang
commented Sep 18, 2019
 
Issue traced on dev server (pointing to prod db) with recompiled cspsc6010.dll, to line where array of dictionaries is getting added to inspection object. Line updated to
If i > 0 Then dictDeficiencies.Add "deficiency", dictDefs
and tested.
Asuquo Eniang
commented Sep 18, 2019
 
@Justin Green  Running IIS locally on Asuquo's Machine and pointing to Prod DB, passes(see image below): Is there a way we can remove COM+ (For CPSCS only) on the Dev server and test?
Image
Asuquo Eniang
commented Sep 13, 2019
 
(edited)
Tried exporting vessel 9546461 running web app in visual studio debug and server cpscs6010.dll against prod db
It exported ok, though a similar test against dev db had failed.
Moved to test next vessel on updated failure list in Done IMO 9590735 GLOBAL TRINITY. It also passed.
Asuquo Eniang
commented Sep 13, 2019
 
Copied over and registered production dll. Tested in Visual Studio against production database, IMO 9546461 exported ok:
9546461.png
Asuquo Eniang
commented Sep 12, 2019
 
Debugging full web site in visual studio, with breakpoint on line 474 of vel.asp file does not return error: Inspection is successfully posted:
WebDebug_Passes.png

CPSCS-IM287825-NCR - Tower C 10-D125 -JONESSI- CPSCS glitch - ORIENT SKY (IMO 9792022)

Problem:

  • 0 of 1 inspections successfully sent to THETIS
  • Inspection ID 731326: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Deficiencies: ISM deficiency 15150 - ISM but no deficiency marked as ISM Related (IMO: 9792022)

Solution:

See solution :

Asuquo Eniang
commented Sep 18, 2019
 
(edited)
After some discussion with Bill, and approval from Justin (See attached email), we're updating the THETIS_CD column to 14615. Run this script:
Update S_Deficiency_Code d SET THETIS_CD = 14615
Where def_code_id = 600884;
commit;
result:
1 row updated. Commit complete.

After the update, issue was resolved:
Image
Asuquo Eniang
commented Sep 17, 2019
 
(edited)
The error is:
    • 0 of 1 inspections successfully sent to THETIS
    • Inspection ID 731326: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Deficiencies: ISM deficiency 15150 - ISM but no deficiency marked as ISM Related (IMO: 9792022)
According to Simon:
9792022 ORIENT SKY: This error is the reason the report was submitted.  It’s claiming that none of the deficiencies were marked as ISM related, which is a prerequisite to having an ISM deficiency.  Deficiency 14615 has in fact been marked as ISM related.

To find this deficiency, we run the following query:
select d.DEFICIENCY_ID,
    d.DEF_CODE_ID,
    d.INSPECTION_ID,
    d.ISM_RELATED_IND,
    dc.CODE,
    dc.THETIS_CD,
    dc.APCIS_CD,
    d.NOTES
From Deficiency d Left Join S_DEFICIENCY_CODE dc on d.def_code_id = dc.def_code_id

Where d.INSPECTION_ID = 731326 and dc.code = 14615
It returns:
Image
We can see that the THETIS_CD column is null. To check with Bill on what the correct code should be.

CIC Questionnaire Glitch: when NO or N/A is selected as answer its not saving 

Problem:
While adding new inspection if user select No or N/A as the answer of CIC Questionnaire, the info doesn't save.

Solution:
While setting up the Questionnaire, if Admin has put the spaces between the answers for the  “Possible values if you selected radio buttons” then the selected option will not be populated. 

Try to reproduce the problem in DEV.
  • Assigned the Vessel to Inspector and add the inspection.
  • Click on the CIC Performed as Yes which prompt the questionnaire which seems different than the production one.
_____________________________________________________________________________________________
  1. Login to the CPSCS Production as Admin user.
  2. From the Menu Select Admin
  3. Click on the Questionnaire Button from the left panel.
  4. Click on the Action button for CIC on Emergency Systems and Procedures which populate the cic questions.
    1. Image
  5. Here, the issue is with the first question. Click on modify Action Button.
  6. For the "Possible values if you selected radio buttons " there is a space between the answers. i.e. YES; NO; N/A
  7. Remove the spaces, Click Update and checked in the inspection. Now its showing the option N/A is selected.
    1. Image
  8. Because of the space the correct data was not retrieved and selection was not populated.
  9. Send email to the user about resolution.

APCIS Export Error A.IE.2: : Conversion failed when converting date and/or time from character string. 

Problem:
The inspection could not be exported to APCIS and giving  APCIS Export Error A.IE.2: Conversion failed when converting date and/or time from character string. (IMO: 9433315)<br />WARNING: Certificate code 524 is not a valid APCIS certificate.

Solution:
Typo error in Date of Issue of one of the certificates. 

Error:

0 of 1 inspections successfully sent to APCIS<br /><hr width="100%">Inspection ID 731507: ERROR: APCIS Export Error A.IE.2: Conversion failed when converting date and/or time from character string. (IMO: 9433315)<br />WARNING: Certificate code 524 is not a valid APCIS certificate.

 (IMO: 9433315)


______________________________________________________________________________________________________________________
  • Open the cpscsfroup.vbg project form CPSCSDLL and debug through.
  • Uncomment the line Call apc.InspectionExport("731507", "E") on CPSCSTest
  • Update the path for logfile and set the path for local folder.
  • Put the breakpoint on Function PostWebservice to stop accidentally send data to APCIS web-service.
  • Get the value of strParam from the InspectionExport function
  • Export to JSON. Check the JSON file for the value of Date fields.
  • Found that a typo error in entering date. (CertDateOfIssue)
  • Image
  • Able to reach PostWebService and inspection is ready to export. Now stop debugging and check log file. 
  • The log file showing that some certificates are not valid APCIS certificates(See attached log file) ehich are 524,525,526,528,524,527,531 and 524.
  • Login to CPSCS website and go to certificates.
  • Image
  • Check for the value of APCIS code and certificate title.
    •  SELECT
          sct.title_id,
          sct.code,
          sct.english_value,
          sct.apcis_cd APCIS_CODE
      FROM
          s_certificate_title   sct,
          certificates          c
      WHERE
          c.title_id = sct.title_id
          AND c.inspection_id = 731507;
    • Here some APCIS_CODE are found with value n/a.
    • Image
    • Here are the code with value null.
    • Image
Sent email to the client.
The NULL and n/a APCIS_Code can be ignored as those Certificates are related to THETIS. 

THETIS Export Error: Deficiencies: value  of Default Description is not valid 

Problem:
The inspection could not be exported to THETIS because Deficiencies: value  of Default Description is not valid (IMO:XXXXXXX)

Solution:
Date of Issue of certificate is after the Date of Inspection which cause this issue.

Here the errors are:
Deficiencies: value  of Default Description is not valid (IMO: 9691620)  (Inspection ID 729367)
Deficiencies: value  of Default Description is not valid (IMO: 9594121)  (Inspection ID 729347)


Lets check in the database, default description id for the inspection_id = 729367 


SELECT
    sdc.code as Def_Code,
    sdd.english_value,
    sdd.thetis_cd,
    dd.deficiency_id,
   dd.def_desc_id
FROM
    s_deficiency_description   sdd,
    (
        SELECT
            def_desc_id,
            deficiency_id
        FROM
            deficiency_description
    ) dd,
    (
        SELECT
            deficiency_id,
            def_code_id
        FROM
            deficiency
        WHERE
            inspection_id = 729367
    ) did,
    s_deficiency_code          sdc
WHERE
    dd.deficiency_id = did.deficiency_id
    AND did.def_code_id = sdc.def_code_id
    AND sdd.def_desc_id = dd.def_desc_id;
Found the result as below:
DEF_CODE          ENGLISH_VALUE      THETIS_CD        Deficiency_ID        DEF_DESC_ID
13199                 Other                       1238                  709767                 10511
04117                 Not as required                                 709768                 10508
Here for Def_code 04117 the THETIS_CD is NULL for the "Not as required" deficiency description.  
Check the THETIS deficiency description list to see if we can find a code for "Not as required":
\\tc4s0b\AFCCB\MS_APPS\CPSCS\CODE EXTRACTS\THETIS\JULY 4 2019 (PROD)\defaultDescription 01072019.xls
Not as required is shown as having code 1011.
Confirm the value of THETIS_CD in S_DEFICIENCY_DESCRIPTION table.
select * from s_deficiency_description where def_desc_id = 10508;
THETIS_CD=NULL
Now set the value of THETIS_CD as 1011.
UPDATE s_deficiency_description set thetis_cd = '1011' where def_desc_id = 10508;
_______________________________________________________________________________________________________________
Now lets repeat the same steps for  inspection_id = 729347

SELECT
    sdc.code as Def_Code,
    sdd.english_value,
    sdd.thetis_cd,
    dd.deficiency_id,
    dd.def_desc_id
FROM
    s_deficiency_description   sdd,
    (
        SELECT
            def_desc_id,
            deficiency_id
        FROM
            deficiency_description
    ) dd,
    (
        SELECT
            deficiency_id,
            def_code_id
        FROM
            deficiency
        WHERE
            inspection_id = 729347
    ) did,
    s_deficiency_code          sdc
WHERE
    dd.deficiency_id = did.deficiency_id
    AND did.def_code_id = sdc.def_code_id
    AND sdd.def_desc_id = dd.def_desc_id;
Here, the deficiencies, 18312,18408,11110, 18316,14109, which was earlier has a missing THETIS code for the "Not as required" deficiency description, is now showing the THETIS_CD=1011 because we have updated  the THETIS_CD for  def_desc_id = 10508;

Asuquo Eniang
commented Sep 5, 2019
 
(edited)
Notes from parent bug shows that this item was action-ed by Justin. Missing THETIS codes were added. Not sure if client retried submitting after that.
To be sure, ran this query:
--get deficiencies
select d.deficiency_id,
    d.def_code_id, d.inspection_id, d.notes
from deficiency d where inspection_id=725110
result:
Image
Next, we find deficiency
--get default descriptions associated with the deficiency_id's
select dd.DEFICIENCY_ID, dd.DEF_DESC_ID, d.ENGLISH_VALUE, d.THETIS_CD
from deficiency_description dd, s_deficiency_description d
where dd.DEF_DESC_ID = d.DEF_DESC_ID and
(dd.deficiency_id = 706510
or dd.deficiency_id = 706510
or dd.deficiency_id = 706508
or dd.deficiency_id = 706509
or dd.deficiency_id = 706511
or dd.deficiency_id = 706512)
result:
Image
We find no missing thetis codes. Same with the other inspections. To ask user to try exporting again.


CPSCS :APCIS webservice Ro Related Detainable Defects Bug

Problem:
On exporting detention inspection to APCIS, its sending RO related deficiencies even though inspector has not selected RO related deficiency. 

Solution:

Starting in 2016, APCIS required that ALL detainable deficiencies reported be marked as “RO related”.  If inspectors do not mark the inspection as RO related in CPSCS, the upload process sets the flag automatically and uses the vessel’s recognized organization (RO) for the reported detainable deficiency. 

Asuquo Eniang
commented Sep 5, 2019
 
(edited)
Notes from parent bug shows that this item was action-ed by Justin. Missing THETIS codes were added. Not sure if client retried submitting after that.
To be sure, ran this query:
--get deficiencies
select d.deficiency_id,
    d.def_code_id, d.inspection_id, d.notes
from deficiency d where inspection_id=725110
result:
Image
Next, we find deficiency
--get default descriptions associated with the deficiency_id's
select dd.DEFICIENCY_ID, dd.DEF_DESC_ID, d.ENGLISH_VALUE, d.THETIS_CD
from deficiency_description dd, s_deficiency_description d
where dd.DEF_DESC_ID = d.DEF_DESC_ID and
(dd.deficiency_id = 706510
or dd.deficiency_id = 706510
or dd.deficiency_id = 706508
or dd.deficiency_id = 706509
or dd.deficiency_id = 706511
or dd.deficiency_id = 706512)
result:
Image
We find no missing thetis codes. Same with the other inspections. To ask user to try exporting again.

Problem:

Client needs to update Vessel Name in CDN Tanker Inspection 2018 11 05 - CHAMPION CONTEST - IMO 9272199

Solution:

Run queries to locate, update and verify affected rows in database. Verify results on web page. 

Asuquo Eniang
commented Aug 28, 2019
 
(edited)
vessel_id = 743759 obtained in initial assessment:
Run this query to confirm typo in vessel name reported in ticket:
select i.inspection_id, i.vessel_id, i.imo_no, i.date_of_inspection, v.vessel_name
from inspection i, vessel v
where i.imo_no=9272199 and i.date_of_inspection = to_date('2018-11-05', 'YYYY-MM-DD')
    and i.vessel_id = v.vessel_id
Result: vessel_id = 743759
Done
Issue can (and should) be fixed by system admin according to scrum master. Email sent to Simon to fix issue. Awaiting feedback.
Before update, check vessel names:
Run
select vessel_id, vessel_name, vessel_name_uc
from vessel where vessel_id = 743759
Result:
Image
Run this query to update vessel name:
update vessel
set
    vessel_name='CHAMPION CONTEST',
    vessel_name_uc='CHAMPION CONTEST';
where vessel_id=743759
commit;
Result: 1 row updated. Commit complete.
Run select to confirm values after update:
select vessel_id, vessel_name, vessel_name_uc
from vessel where vessel_id = 743759
Result:
Image
Names successfully updates

APCIS Export Error: APCIS asking for certificate which is not on the inspection report

Problem:
The inspection could not be exported to APCIS because APCIS asking for certificate 530 when there is no Code 530 certificate in the inspection report. 

Solution:
Date of Issue of certificate is after the Date of Inspection which cause this issue. 

  1. Login as CPSCS admin and search for IMO 9794680. From the URL get the inspection id = 729870
  2. SELECT
        sct.title_id,
        sct.code,
        sct.english_value
    FROM
        s_certificate_title   sct,
        certificates          c
    WHERE
        c.title_id = sct.title_id
        AND c.inspection_id = 729870;
  3. The result contains certificate 530 Civil Liability for Oil Pollution Damage. Title_ID=600126
  4. select * from certificates where title_id = 600126 and inspection_id = 729870; 
  5. Image
  6. Check the date of Inspection.
    1.  select DATE_OF_INSPECTION from inspection where inspection_id = 729870;
    2. Image
  7. So here date of issue is after date of first visit. Lets search for the certificate where issue date is higher than date of inspection.
    1. SELECT
          c.certificate_id,
          c.title_id,
          c.date_issued,
          i.date_of_inspection,
          sct.title_id,
          sct.code,
          sct.english_value
      FROM
          certificates          c,
          inspection            i,
          s_certificate_title   sct
      WHERE
          c.inspection_id = i.inspection_id
          AND c.date_issued > i.date_of_inspection
          AND c.title_id = sct.title_id
          AND i.inspection_id = 729870;
    2. Image
  8. These both certificates are not showing up on the inspection report. Lets reset the date and inform the client to correct the date of certificate issue. 
    1.  update certificates set date_issued = to_date('2019-01-01','YYYY-MM-DD') where certificate_id in(904712,904713);
       commit;
  9. Now verify both the certificates are shows up in CPSCS (https://wwwapps2.tc.gc.ca/saf-sec-sur/4/cpscs-scepc). 
    1. Image

Multiple issues, one after the other was fixed:

Problem:

  1. 0 of 1 inspections successfully sent to APCIS<br /><hr width="100%">Inspection ID 729507: ERROR: APCIS Export Error A.IE.2: Inspection Actions shall not be empty (IMO: 9283538)<br />WARNING: Certificate code 526 is not a valid APCIS certificate. (IMO: 9283538)
  2. 0 of 1 inspections successfully sent to APCIS<br /><hr width="100%">Inspection ID 729507: ERROR: APCIS Export Error A.IE.2: Invalid Deficiency Convention Code '5001' shall not according code deficiency '1209' (IMO: 9283538)
  3. 0 of 1 inspections successfully sent to APCIS<br /><hr width="100%">Inspection ID 729507: ERROR: APCIS Export Error A.IE.2: There are more than one certificate with code '510' (IMO: 9283538)

Solution:

Asuquo Eniang
commented Aug 26, 2019
 
Run query:
select convention_id, def_code_id, deficiency_id from deficiency where inspection_id=729507;
Result:
Image
select def_code_id, apcis_cd from s_convention where convention_id=10726;
Result:
Image
select def_code_id, code, apcis_cd from s_deficiency_code where def_code_id=22;
Result:
Image
From spreadsheet: \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\CODE EXTRACTS\APCIS\January 2017\Deficiencies.xls
Deficiency code 01209 is mapped to Convention 1020 in column D

Update APCIS code in DB:
update s_convention set apcis_cd=1050 where convention_id=10726;
Result: 1 row updated.
Sent client instruction to try the export again. It came back with a different error. This is the third different error raised by this vessel export. To be investigated in a different task.

Get all the deficiencies and their associated default descriptions

Solution:

The has been generated using the following query.
SELECT
    sdc.code,
    sdc.english_value   defective_item,
    sdd.english_value   nature_of_defect
FROM
    (select * from s_deficiency_code where active_flag='A')         sdc,
    s_def_desc_mapping         m,
    (select * from s_deficiency_description where active_flag='A')   sdd
WHERE
    sdc.def_code_id = m.def_code_id
    AND m.def_desc_id = sdd.def_desc_id 
order by sdc.code;

Exported the result in excel spreadsheet and sent to the client. 

CPSCS: Duplicate MMSI Numbers.

Problem:
Client want to change the MMSI number to 371518000 for vessel SALINAS, IMO 9805324. But MMSI 371518000 is already using by some other vessel.

Solution:

Found something similar in the TFS (BUG 12248)
Let's check the database first to see whether MMSI is duplicated anywhere or not?
Login to CPSCSP database. For credentials refer RDIMS #13232403
Now filter the VESSEL table for MRTM_MBL_SRVC_TXT='371518000' and  imo_no =  9805324
That's returned no records. That means IMO 9805324 is not using MSSI 371518000.

Now filter again with MRTM_MBL_SRVC_TXT='371518000' or imo_no =  9805324.
Found that IMO 9328572 has MRTM_MBL_SRVC_TXT='371518000'.

IMO 9805324 is using MMSI 371518001 and 371518002.

But as MMSI 371518000 is using by another IMO 9328572 so we can not set duplicate MMSI for IMO 9805324. \
Need to ask Justin.
___________________________________________________________________________________________________________
TEMP (FROM JUSTIN):
for vessel IMO 9328572:
update vessel set mrtm_mbl_srvc_txt = '229571000' where imo_no = '9328572';
for IMO 9805324:
update vessel set mrtm_mbl_srvc_txt = '371518000' where imo_no = '9805324';
Flag state check:
IMO 9328572:
select flag_state_id from vessel where imo_no = '9328572' and is_latest=1;
flag_state_id = 126
 
 To check MID for MMSI:
 select * from YM001_FLAG_STATE_MID where flag_state_id = 126 and MID_NUM = '229';
Not found - so now we need to check the flag state of vessel 9328572;
First - let's try to download the latest vessel info for IMO 9328572 in the CPSCS production web site.
Log in as admin, do a vessel search for IMO 9328572, and click the Modify button for the record returned. This will trigger a download from APCIS/THETIS.
New information was found in APCIS/THETIS. That didn't help.
Step 1: Get flag state ID for Malta.
select flag_state_id from s_flag_state where lower(english_value) like '%malta%';
flag_state_id = 105
Step 2: Check MID for Malta.
 select * from YM001_FLAG_STATE_MID where flag_state_id = 105 and MID_NUM = '229';
 Yes - record found.
 
Step 3: Change flag state for IMO 9328572 to MALTA.
update vessel set flag_state_id = 105 where imo_no = '9328572' and is_latest=1;
commit;
 
 IMO 9805324:
 select flag_state_id from vessel where imo_no = '9805324' and is_latest=1;
 Flag state id = 126
 
 To check MID for MMSI:
 select * from YM001_FLAG_STATE_MID where flag_state_id = 126 and MID_NUM = '371';
 Record found - we're good.
 _________________________________________________________________________________________________________
Justin verified and explained as above.

Now, let's update the Flag_Stat_Id

select * from YM001_FLAG_STATE_MID where flag_state_id = 126 and MID_NUM = '229';
update vessel set flag_state_id = 105 where imo_no = '9328572' and is_latest=1;
commit;

Now after updating the Flag_Stat_Id, lets verify the MID and MMSI.
select * from YM001_FLAG_STATE_MID where flag_state_id = 105 and MID_NUM = '229';

Now as IMO 9328572 is currently using MMSI 371518000, so we need to change it to 229571000
update vessel set mrtm_mbl_srvc_txt = '229571000' where imo_no = '9328572' and is_latest=1;

Set MMSI 371518000 to IMO  9805324
update vessel set mrtm_mbl_srvc_txt = '371518000' where imo_no = '9805324' and is_latest=1;
commit;

Email has been sent to the client, see the attachment. 
Closing the SMGS ticket.



CPSCS: Export Error - THETIS certificates [DOS 2267]

Problem:
Client gets and invalid certificate error when exporting to THETIS:

ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Statutory Certificates: value of Issuing Authority is not valid

Solution:

Run query on CPSCSP.WORD db:
SELECT
    certificate_id,​
    c.title_id,​
    sct.english_value,​
    sct.code CpscsCode, ​
    sct.thetis_cd ThetisCode​
FROM​
    certificates c,​
    s_certificate_title sct​
WHERE​
    c.inspection_id = 728868​
    AND c.title_id = sct.title_id;
Results show that all certificates have THETIS codes.
Check for expiry dates. If a certificate is expired, check against the spreadsheet statutoryCertificate 01072019.xls located here: \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\CODE EXTRACTS\THETIS\JULY 4 2019 (PROD). If expired, contact Scrum Master.
Check inspections for this item: 
select * from inspection where inspection_id = '728868';
In returned data THETIS_UPLOAD_DTE = 09-JUL-19 which means this item was successfully uploaded. Contact client and ask if this is still an issue. May have been resolved by client.

THETIS export issue: THETIS Export Error T.IE.5: Deficiencies: The Convention SOLAS ch. II-1 Parts C, D, E, F is not valid for deficiency 04111- Damage control plan 

Problem:
Client encounters an issue when attempting to export an inspection to THETIS.   Error code T.IE.5 (convention issue).

Solution:

  1. Let's get the inspection ID from the CSPCS Web site and Login as Admin.
  2. Go to Vetting - Export Queue. Look for IMO 9397858 under THETIS heading and click on the inspection..
  3. Grab the inspection id from the URL. Here IID=729867
  4. Check all the conventions associated with inspection ID 729867:
    1.    SELECT
          sdc.code DEFCODE,
          sdc.thetis_cd,
          sc.convention_id,
          sc.english_value Convention,
          sc.reference Reference,
          sc.thetis_cd Con_Thetis_Cd
      FROM
          deficiency d,
          s_deficiency_code sdc,
          s_convention sc
      WHERE
          d.inspection_id = 729867
          AND d.def_code_id = sdc.def_code_id 
          AND sc.convention_id=d.convention_id; 
    2. For the deficiency 04111  the convention_id  2117 and THETIS_CODE=01022, Convention Detail= SOLAS ch. II-1, Reference=SOLAS CHII-1 Reg 19. 
  5. Let's check for this code in \\tc4s0b\Groups\ MS_APPS\CPSCS\CODE EXTRACTS\THETIS\JULY 4 2019 (PROD)\Conventions.xls does the code refers to correct description.
  6. In the Convention table the description is The Convention SOLAS ch. II-1 Parts C, D, E, F  refers to THETIS CODE 01022 .
  7. Now lets check the deficiency exist for thetis_code 01022.
    1.  Select def_code_id,english_value from s_convention where thetis_cd = '01022' and def_code_id='04111';
    2. The result shows the there is no record found.
  8. The Inspection has SOLAS ch. II-1 selected. Let's check how many times this convention is used? Convention_Id=2117
    1. select * from deficiency  where convention_id=2117;
    2. Result shows this convention is used two times.
    3. SOLAS 06 Amend / II-1 / Reg. 19 (IID=724131, Date_Created=19-02-21)
      SOLAS 89/90 Amend / II-1 / Reg. 23-1 (IID=729867, Date_Created=19-08-01)
    4. 724131 was inspected in February.  Was this sent to THETIS? Yes.
  9. What conventions are valid for deficiency code 04111?
    1. Check \\tc4s0b\Groups\AFCCB\MS_APPS\CPSCS\THETIS\Paris MoU Deficiencies  01112016.pdf
    2. According to that document, only SOLAS ch. II-1 Parts A, A-1, B, B-1,B-2, B-3, B-4 is valid. This maps to THETIS_CODE 01021.
    3. def_code_id = 245 (select def_code_id from s_deficiency_code where code=04111;)
  10. Can we change the convention_id for 245?  How many times is 245 used?
    1. select * from deficiency where def_code_id = 245;
    2. Used a lot.  Convention reference (Paris MoU Deficiencies  01112016.pdf) is dated 2016.  When were the deficiencies (245) recorded?

    3.  select * from inspection i, deficiency d where d.def_code_id = 245 and d.inspection_id = i.inspection_id;

    4. Three inspections recorded after 2016: 729867,724812,724131

  11. To fix this issue, we need to change the mapping in s_convention:(But after consulting with Product owner)
    1. update s_convention set thetis_cd='01021', apcis_cd='01021' where convention_id = 2117;
      commit;
  12. Received confirmation from the client so lets apply the above query.
           

THETIS export issue: THETIS Export Error T.IE.5: Statutory Certificates: value  of Title is not valid

Problem:
Client encounters an issue when attempting to export an inspection to THETIS (or APCIS).  Error code T.IE.5 (certificate title issue).

Solution:

Let's run some queries against CPSCSP.WORLD
Review certificates for inspection ID 728729
SELECT
    certificate_id,
    c.title_id,
    sct.english_value,
    sct.code CpscsCode, 
    sct.thetis_cd ThetisCode
FROM
    certificates c,
    s_certificate_title sct
WHERE
    c.inspection_id = 728729
    AND c.title_id = sct.title_id;

Results show that certificate 526 (Engine International Air Pollution Prevention) is missing a valid THETIS certificate (certificate_id = 902441).
Review certificates for inspection ID 728749
SELECT
    certificate_id,
    c.title_id,
    sct.english_value,
    sct.code CpscsCode, 
    sct.thetis_cd ThetisCode
FROM
    certificates c,
    s_certificate_title sct
WHERE
    c.inspection_id = 728749
    AND c.title_id = sct.title_id;

Results show that certificate 526 (Engine International Air Pollution Prevention) is missing a valid THETIS certificate (certificate_id = 902490).

Let's see if there are any other active certificates missing THETIS codes.
SELECT
    title_id,
    english_value,
    code, 
    thetis_cd 
FROM
    s_certificate_title
WHERE
    active_flag = 'A'
    and thetis_cd is null;

Result: Just the one certificate is missing the THETIS code.

Check the \\tc4s0b\groups\afccb\ms_apps\cpscs\CODE EXTRACTS folder to see if there is a CODE EXTRACT folder for the current month (e.g. July XX 2019).  If there is a recent code extract, you can step the next steps to get an updated code extract.

To get a new code extract from THETIS:
Let's check THETIS for the code.
  1. Go to https://portal.emsa.europa.eu/login.html
  2. Login using the username/password to access the EMSA THETIS portal. Credentials found in RDIMS 13232403: see the  Prod App Credentials for the CPSCS-THETIS WS.
  3. Using the menu towards the top of the screen, click Portals - THETIS - Homepage.
  4. Click "Documents" in the menu bar.
  5. Click the "Code Extracts" link.
  6. Click the "Background Tables DDMMYYYY.zip" link.  The associated date in the link changes monthly to reflect the current codes in use by THETIS.
  7. Click the Download link.
  8. Extract the download ZIP file to a new CODE EXTRACT folder:  \\tc4s0b\groups\afccb\ms_apps\cpscs\CODE EXTRACTS\{Month Day Year).
In the most recent code extract folder, open the statutoryCertificate Excel file. We want to see if there is a THETIS code for the 
Engine International Air Pollution Prevention certificate.  In the latest extract, found the certificate associated with THETIS code 526.

Update the production database with the missing THETIS code (run against CPSCSP.WORLD):
update s_certificate_title set thetis_cd = '526' where code = '526';
commit;

 Contact client - issue is resolved. (see attachments)

THETIS export issue: THETIS Export Error T.IE.2 (and possibly other issues related to THETIS and APCIS inspection exports):

Problem:
Client encounters an issue when attempting to export an inspection to THETIS (or APCIS).  Error code T.IE.2.

Solution:

Solution Summary:
The URLS for the CSPCS-APCIS and CPSCS-THETIS proxy web service URL's stored in the S_SYSTEM table were listed as "HTTP" instead of "HTTPS".  Changing these to HTTPS using the following commands run against the CPSCSP.WORLD database resolved the issue:
--
Details:

To test export using the CPSCS VB6 DLL:
1. Open cpscsgroup.vbg.
2. In project1, open the cmdTest_Click.
3. After the database set-up (objects initialized, if-elseif-else testing the optDB value), comment out all function calls except Thetis.InspectionExport or apc.InspectionExport (depending on whether you want to test THETIS or APCIS).
4. Set the inspection ID in the call to match the inspection ID causing problems (e.g. Call Thetis.InspectionExport("728526", "E"))
5. Open the InspectionExport function and set a breakpoint on the line containing a call to "PostWebservice".  You must make sure that you do NOT call this function lightly if testing using the production CSPCS database (which points to the production THETIS and APCIS web services).  Sending bad data or test data to the production APCIS or THETIS web services will require you to contact the CPSCS business owner to discuss what happened, what was sent, and then discuss options for resolving the issue.
5b. If you don't have a local D:\wwwfiles\cpscs\logs directory, you'll need to make the following adjustment in the InspetionExport function:
CHANGE
 'Setup Log file
 Set objRequestLog = New CTextFile
 strLogFile = strLogDirectory & "\thetis-export-" & arrIID(i) & ".log"
 objRequestLog.Filename = strLogFile
 objRequestLog.OpenNewFile
TO
 'Setup Log file
 Set objRequestLog = New CTextFile
 strLogFile = {local logfile directory} & "\thetis-export-" & arrIID(i) & ".log"
 objRequestLog.Filename = strLogFile
 objRequestLog.OpenNewFile
 
where {local logfile directory} is any local directory where the CPSCS can write and edit log files.
 
6. When you run "project1" in debug mode, select the appropriate database using the radio buttons on the form displayed and then click the "CPSCS Test" button.
7. Step through the code and note any errors that come up: you'll have to determine how to resolve any issues based on what you observe while stepping through the code.
8. To view all of the inspection data being sent to APCIS or THETIS while stepping through InspectionExport, advance to the breakpoint on the call to PostWebservice.  The inspection data is contained in the strParam variable (set via strParam = JSON.toString(dictExport)).
Looking at  IM281786 [DOS 2156]:
Error: Inspection ID 728526: ERROR: THETIS Export Error T.IE.2: Error encountered while sending ship particulars to THETIS for inspection 728526
Solution:
- Follow debug instructions above.
- Set a breakpoint on a line immediately preceding error T.IE.2.
Let's take a look at the shipcall information: strVesselCallID = 78615
In CPSCSP.WORLD database, "select * from wm026_vessel_call where vessel_call_id = 78615;"
This port call/vessel call does not have an associated vessel_traffic_data_id meaning that it was created on the fly upon inspection upload. That's fine - standard operating procedure.  There is no thetis_shipcall_cd meaning that THETIS has not registered the vessel arrival yet - why?
Let's step through the code: CheckVesselThetis.
The call to GetPreInspectionDataJSON is failing with the following error: "The server cannot service the request because the media type is unsupported."
I would guess that this is related to the forced HTTPS update that occurred on production servers ealier this week. Checking CPSCS-THETIS web service log files (\\ncrws333\wwwfiles\cpscs-ws\logs, \\ncrws334\wwwfiles\cpscs-ws\logs, \\ncrws335\wwwfiles\cpscs-ws\logs) to see if we can get more detail for Web Technical Support team.
The call to GetPreInspectionDataJSON is not getting through to the web service on WWWAPPS.  Can I make any calls to the web service from my local computer?
Let's make a call:
Call di.DoIt("9487615", "123456", "E")
This function will contact both APCIS and THETIS and attempt to import vessel data for IMO. Noticing that the URL's being used for these calls are not HTTPS but they should be.
Let's fix that in the database:
update s_system set THETIS_PROXY_URL_TXT = 'https://wwwapps.tc.gc.ca/saf-sec-sur/4/cpscs-ws/service.asmx';
Let's try the call to THETIS export again to see if the call to CheckVesselThetis works.  That fixed it.  Let's check this same export from the CPSCS production web site.
Log into https://wwwapps2.tc.gc.ca/saf-sec-sur/4/cpscs-scepc as an admin.  Go to Vetting - Export Queue, click the checkbox for the BBC OREGON (IMO 9501265) in the THETIS section. This is one of the vessels mentioned in the support ticket DOS 2156. And it worked.  Sending notification to client that the issue was resolved.
How did this happen? Not sure.  There is a chance that the URL's were always HTTP and the recent forced HTTPS change (C191243) on WWWAPPS2 had repercussions on the system, forcing us to update the proxy web service URL's. In any case, issue is fixed for now.

How-To Publish PMOU Manual Revision

Problem:
CPSCS client needs to update the PMOU Manual Revision in CPSCS production.

Solution:
CPSCS: How-to add a new PMOU manual revision

How-To: Get latest code extracts from EMSA THETIS portal

  1. Go to https://portal.emsa.europa.eu/login.html
  2. Login using the username/password to access the EMSA THETIS portal. Credentials found in RDIMS 13232403: see the  Prod App Credentials for the CPSCS-THETIS WS.
  3. Using the menu towards the top of the screen, click Portals - THETIS - Homepage.
  4. Click "Documents" in the menu bar.
  5. Click the "Code Extracts" link.
  6. Click the "Background Tables DDMMYYYY.zip" link.  The associated date in the link changes monthly to reflect the current codes in use by THETIS.
  7. Click the Download link.
  8. Extract the download ZIP file to a new CODE EXTRACT folder:  \\tc4s0b\groups\afccb\ms_apps\cpscs\CODE EXTRACTS\{Month Day Year).

How-To: Get latest code extracts from APCIS portal

  1. Contact product owner / business owner for CPSCS and ask for the latest code extract from APCIS.
  2. Product owner / business owner identified in RDIMS #14140748.
  3. Once extracts are received, create a new directory (Current Month + Year) in the following directory: \\tc4s0b\Groups\AFCCB\MS_APPS\CPSCS\CODE EXTRACTS\APCIS
  4. Place the code extracts in that folder.

To: Step through and debug the CPSCS VB6 dll

1. Open cpscsgroup.vbg.

2. In project1, open the cmdTest_Click.
3. After the database set-up (objects initialized, if-elseif-else testing the optDB value), comment out all function calls except Thetis.InspectionExport or apc.InspectionExport (depending on whether you want to test THETIS or APCIS).
4. Set the inspection ID in the call to match the inspection ID causing problems (e.g. Call Thetis.InspectionExport("728526", "E"))
5. Open the InspectionExport function and set a breakpoint on the line containing a call to "PostWebservice".  You must make sure that you do NOT call this function lightly if testing using the production CSPCS database (which points to the production THETIS and APCIS web services).  Sending bad data or test data to the production APCIS or THETIS web services will require you to contact the CPSCS business owner to discuss what happened, what was sent, and then discuss options for resolving the issue.
5b. If you don't have a local D:\wwwfiles\cpscs\logs directory, you'll need to make the following adjustment in the InspetionExport function:
CHANGE
 'Setup Log file
 Set objRequestLog = New CTextFile
 strLogFile = strLogDirectory & "\thetis-export-" & arrIID(i) & ".log"
 objRequestLog.Filename = strLogFile
 objRequestLog.OpenNewFile
TO
 
'Setup Log file
 Set objRequestLog = New CTextFile
 strLogFile = {local logfile directory} & "\thetis-export-" & arrIID(i) & ".log"
 objRequestLog.Filename = strLogFile
 objRequestLog.OpenNewFile
 
where {local logfile directory} is any local directory where the CPSCS can write and edit log files.
 
6. When you run "project1" in debug mode, select the appropriate database using the radio buttons on the form displayed and then click the "CPSCS Test" button.
7. Step through the code and note any errors that come up: you'll have to determine how to resolve any issues based on what you observe while stepping through the code.
8. To view all of the inspection data being sent to APCIS or THETIS while stepping through InspectionExport, advance to the breakpoint on the call to PostWebservice.  The inspection data is contained in the strParam variable (set via strParam = JSON.toString(dictExport)).
*FYI If you update the dll or create a new one, you will need to register the DLL and recreate all COM objects. You can do this by deleting the old COM objects, and then creating new ones. Point to the new dll as the reference file when you are creating them. If you don't do this you will get an error similar to  'ASP 0177 : 800401f3' Server.CreateObject Failed

Oracle Database Account Locked

Problem:
Clients appear to be locked out of the web application due to the following error: ORA-28000: the account is locked.

Solution:
Oracle database accounts can become locked for any number of reasons.  After verifying that the application is using the correct database username and password, contact the DBA group and ask them to unlock the account.  Efforts should also be made to discover why the account was locked and make the necessary changes to prevent future recurrences.

See below for an example of this issue and the steps taken to resolve it.

Issue related to Oracle: CPSCS_EXTA @ CPSCSP.WORLD is locked.  

ORA-28000: the account is locked

I've contacted the DBA and Web Technical Support teams to fix this issue ASAP.  See attached e-mail.

DBA group replied: database is unlocked but DBA warns that the account was locked because someone was attempting to access the database using an older password, forcing the database to lock. I've contacted Stephen Massey (scrum master/project manager for CPSCS mobile application) and Bill Henderson (CPSCS OPI) about possible causes of the account lock.  See attachments for e-mail sent.

While we look for the source of the bad password, DBA group contacted to identify workarounds to this issue to prevent further locks should we be unable to identify the source of the issue.

Source of issue identified: CPSCS-INNAV .NET CORE API was attempting to access production database with the wrong password.   Repeated attempts to hit PROD locked the account.  Team Kraken is updating the CPSCS-INNAV .NET CORE API code and pipelines to avoid similar issues from occurring in the future. CPSCS production data was NOT affected by this issue. Sent details to client (see Attachments).

THETIS Export: The MMSI contains too many digits when exporting, inspection stuck in THETIS export queue.

Problem:
Client is locked out of the vessel tombstone and cannot complete the export due to issue above.

Solution:

select mrtm_mbl_srvc_txt from vessel where imo_no=9583653;
Too many vessels listed.
Client said that vessel tombstone locked - that means that we can't look at the latest record. Must be an older record.  Let's get the vessel id from the inspection instead.  export_to_sirenac = 1 means that the vessel is on the THETIS export queue.
select vessel_id from inspection where  imo_no=9583653 and export_to_sirenac = 1;

vessel_id = 753020

select mrtm_mbl_srvc_txt  from vessel where vessel_id = 753020;
MMSI =  219005000
Let's select the length - must be a white space causing issues.
select length(mrtm_mbl_srvc_txt)  from vessel where vessel_id = 753020;
length = 10
Let's reset the MMSI to 9 digits:
update vessel set mrtm_mbl_srvc_txt= '219005000' where vessel_id = 753020;
commit;
Double-check:
select length(mrtm_mbl_srvc_txt)  from vessel where vessel_id = 753020;
Worked. Length = 9.  Contacting clients and closing tickets.

Generate XML for inspection sent to APCIS

Problem:
Client needs to have the XML for an inspection exported to APCIS.

Solution:

To produce the XML, you'll need:
To generate the XML request for an inspection being sent to APCIS, we'll run through the CPSCSDLL VB6 project and produce the JSON request for the APCIS export.  We'll then convert the JSON data to XML and then send that to the client.

Step 1: Set-up project to run an APCIS export
  • Grab a copy of the CPSCSDLL directoy - do not update the code in the TFS (or DevOps) repository.
  • Open the project: cpscsgroup.vbg
  • Double-click on the CPSCSTest form in Project1.
  • Double-click the CPSCS Test button: this should place you in the cmdTest_Click function.
  • Starting at the beginning of the function, local variables, settings, and database connections will be created.  After the IF - ELSEIF - ELSE block for setting up the connnections, driven by the optDB(0).Value, you can comment out the rest of the code in the function.
Step 2: Get the inspection ID's for the two inspections identified by the client
There are two inspections identified: 
  • FSL PERTH – IMO 9299355
  • BBG INTEGRITY, IMO 9789867
select * from inspection where imo_no = 9299355;
Only one inspection returned: inspection_id = 727050
select * from inspection where imo_no =9789867;
Only one inspection returned: inspection_id = 727159

Step 3A: Run APCIS export for inspection 727050
  • Back in the cmdTest_Click function, you'll want to make a call to the APCIS object's InspectionExport function: call apc.InspectionExport("727050","E") - make sure that all other function and sub-procedure calls are commented out. You do not want to accidentally run any further code. 
  • In the InspectionExport function, place a breakpoint on the following line: strResult = PostWebservice(strAPCISServer, strSoapAction, strXML) 
  • Go back to the cmdTest_Click function in Project1 and click the Start button.
  • When the form opens, be sure to select the PROD database radio button then click CPSCS Test button.
  • Step-through until you hit the breakpoint in the InspectionExport function.
  • In the Immediate window, type "?strParam" and hit Enter: this will display the full JSON call for the current inspection being exported.  Grab a copy of that JSON data and save it elsewhere.  
  • Stop the debugger: you will not actually send anything to APCIS at this time.
Step 3B: Run APCIS export for inspection 727159
  • Back in the cmdTest_Click function, you'll want to make a call to the APCIS object's InspectionExport function: call apc.InspectionExport("727159","E") - make sure that all other function and sub-procedure calls are commented out. You do not want to accidentally run any further code. 
  • In the InspectionExport function, place a breakpoint on the following line: strResult = PostWebservice(strAPCISServer, strSoapAction, strXML) 
  • Go back to the cmdTest_Click function in Project1 and click the Start button.
  • When the form opens, be sure to select the PROD database radio button then click CPSCS Test button.
  • Step-through until you hit the breakpoint in the InspectionExport function.
  • In the Immediate window, type "?strParam" and hit Enter: this will display the full JSON call for the current inspection being exported.  Grab a copy of that JSON data and save it elsewhere.  
  • Stop the debugger: you will not actually send anything to APCIS at this time.
Step 4: Convert JSON data to XML
Take each of the JSON data dumps created in Steps 3A and 3B above and convert them to XML.   Tools to do this should be available online (e.g. http://www.utilities-online.info/xmltojson/#.XOwkIqJKiUk).
Send the XML data to the client to have APCIS review and let us know why errors are occurring and closing tickets.
Will record this information in Confluence.


THETIS Export: Place of last survey is not valid

Problem:
Client gets the following error when attempting to upload an inspection to THETIS: "Inspection ID XXXXX: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Statutory Certificates: value  of Place of last survey is not valid (IMO: YYYYYYY)", where XXXXXX is the inspection ID and YYYYYYY is the vesssel IMO number.

Solution:

Issue is "Statutory Certificates: value  of Place of last survey is not valid (IMO: 9190119)".
Log into CPSCS (https://wwwapps2.tc.gc.ca/saf-sec-sur/4/cpscs-scepc/) as an admin.  See RDIMS 13232403 for credentials.
  1. Admin - Vetting - Export Queue
  2. Click on the Modify button for the Augusta Mars inspection in the THETIS section.
  3. Go to Certificates tab (to review Statutory Certificates).
  4. Click the Modify for each certificate listed. We're looking for a certificate that had a survey done (date of last survey is not blank) that has a missing or invalid Country of Last Survey.
Everything looks okay.  Let's review all valid certificates from the database to see what we can find. From the URL when reviewing the August Mars inspection, we can see IID = 725527 (inspection_id), imo_no = 9190119.
Run any queries against the CPSCSP.WORLD database.
select * from certificates where inspection_id = 725527;

Nothing obvious but I do see one certificate where the country of last survey was Canada. Is that allowed? Check RDIMS 12288983, see what rules exist regarding country/place of last survey. According to docmentation, "value  of Place of last survey is not valid" is the result of the following rule being broken:


Values provided for the following attributes are not valid (Date of the first visit is between Creation Date and Expiry Date) or don't exist in the system:

    • Certificate Title
    • Issuing authority - Flag
    • Issuing authority - RO
    • Surveying authority - Flag
    • Surveying authority - RO
    • Place of last survey
Let's check to see which values of place of last survey are currently valid according to THETIS (\\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\CODE EXTRACTS\THETIS\September 25 2018 (PROD)\countries 019092018.xls).
According to our query above, the following countries of last survey were used: 30, 118, 62, 6. These CPSCS country codes correspond to the THETIS codes in the following query:
select flag_state_id, CODE, ENGLISH_VALUE, THETIS_CD from s_flag_state where flag_state_id in (30,118,62,6);
In the list returned, we can that Curacao is missing a THETIS code. From the spreadsheet review above, (countries 019092018.xls), Curacao's THETIS code is "AN".  Let's update the database.
update s_flag_state set THETIS_CD = 'AN' where flag_state_id = 6;
commit;
Inspection should now upload to THETIS. Contact client to have them confirm.

THETIS Export: Date of issue must be before date of first visit

Problem:
Client gets the following error when attempting to upload an inspection to THETIS: "Inspection ID XXXXX: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Statutory Certificates: Date of issue must be before date of first visit (IMO: YYYYYYY)", where XXXXXX is the inspection ID and YYYYYYY is the vesssel IMO number.

Solution:

Found possibly related tickets in TFS:
First thing to check (related to 10913): are the certificate issue dates all valid for the inspection:
What is date of first visit (a.k.a. inspection date) for inspection ID 725547;
select DATE_OF_INSPECTION from inspection where inspection_id = 725547;
(2019-03-29)
Are there any certificates issued after 2019-03-29;
select * from certificates where inspection_id = 725547;
Certificate ID 894152 (title_id = 4) shows an issue date of 2019-12-12.  This is likely a typo given that all other certificates were issued in Feb. 2019.
The client will need to resolve this issue but to do this, we'll need to update the issue date to occur on or before the date of inspection: this will allow the certificate to show up in the Certificates tab for the inspection.
Will set issue date to 1900-01-01 and contact the client to update the certificate date and upload to THETIS.
update certificates set date_issued = to_date('2019-01-01','YYYY-MM-DD') where certificate_id = 894152;
commit;
Verify that the certificate now shows up in CPSCS (https://wwwapps2.tc.gc.ca/saf-sec-sur/4/cpscs-scepc).  Log in using credentials found in RDIMS 13232403.
Certificate now shows up in the list.
We need the certificate title/name to pass along to the client: 
select english_value || ' (' || code || ')'  from s_certificate_title where title_id = 4;
Cargo Ship Safety Radio (503)
Sending e-mail to client (see attachments).
 

APCIS Export: Empty Deficiency Action List error

Problem:
Client gets the following error when attempting to export a CPSCS inspection to APCIS: "APCIS Export Error A.IE.1: Empty deficiency action list () for deficiency #YY (IMO: XXXXXXX)" (where XXXXXXX is the inspection vessel's IMO number and YY is the number of the deficiency as reported by the CPSCS).

Solution:

Client has identified this as a priority issue.
This issue is normally the result of the deficiency included deficiency actions that are not valid or recognized by the MOU.  APCIS (Tokyo MOU) is much pickier when it comes to deficiency actions. 
First - let's take a look at deficiency #11 for the inspection in question (IMO 9215543).
Go to https://wwwapps2.tc.gc.ca/saf-sec-sur/4/cpscs-scepc/ and log in as an admin. Use the credentials found in RDIMS 13232403. Bot to Vetting - Export Queue and you'll find the inspection under the APCIS section header.
Go deficiency tab and count down to find Deficiency #11 (10105).  Take a look at RDIMS 12048947 - these document will show you which deficiency action are valid. The pair (17,10) seems valid for deficiency10105.  So what else is going on?
Easiest way to diagnose the issue is to open a copy of the current production DLL in Visual Basic 6 and do a sample APCIS export:
Update the test application to make a call to APCIS using the following call:
apc.InspectionExport("725353", "E") where 725353 is the inspection ID for this inspection which you can pull from the query string when viewing the inspection in the steps above (iid=725353).
Set a breakpoint on the call and step through to see why the deficiency action list is empty. Issue should be apparent in the BuildInpectionExport function.
In that function, you'll find the line:
strTemp = strTemp & IfNull(rsDefs("def_action_list"))

This line marks the beginning of deficiency action processing and this runs straight through to the end of the BuildInspectionExport function.  Loop through until you start processing deficiency #11.
If strTemp after calling strTemp = SortDefActionsV2(strTemp, HasDate(strRemarks), HasString(strRemarks, arrPorts), strDefCode, (strRemarks) <> "") is empty, this is a problem.
Ah - wait.  The deficinecy code causing issues is 02101.  It has the following deficiency actions:
55, 17, 10.  There is also a code 30 attached because the Grounds for Detention checkbox has been checked.
Issue found. According to the spreadsheet (RDIMS 12048947), APCIS does not allow Code 30 (ground for detention) and Code 17 (rectify before departure) on the same deficiency. 
Advise client that the code 17 should be removed for deficiency code 02101. (see attachments)

Delete a  CPSCS Inspection

Problem:
Delete an inspection from CPSCS given IMO number and inspection date.

Solution:
See TFS 14178 for an appropriate solution.

Related to DOS 594.
Before committing any changes, always run with rollback; first and then with commit; after confirming that number of deleted rows seem reasonable.  Important: only 1 row should ever be deleted from the INSPECTION table (per vessel inspection being deleted).
Delete the inspections listed (in CPSCSP.WORLD database):

KOTA EKSPRES IMO 9644990
To find the proper inspection ID:
SELECT
    i.inspection_id,
    so.english_value
FROM
    inspection i,
    s_office so,
    tm008_port tm008
WHERE
    imo_no = 9644990
    AND TO_CHAR(date_of_inspection,'DD/MM/YYYY') = '12/04/2019'
    AND i.inspection_port_cd = tm008.port_cd
    AND tm008.office_id = so.office_id;
Inspection ID associated with St. John's is IID = 725886.  Delete this one.

Global Echo IMO 9633288
To find the proper inspection ID:
SELECT
    i.inspection_id,
    so.english_value
FROM
    inspection i,
    s_office so,
    tm008_port tm008
WHERE
    imo_no = 9633288 
    AND TO_CHAR(date_of_inspection,'DD/MM/YYYY') = '12/04/2019'
    AND i.inspection_port_cd = tm008.port_cd
    AND tm008.office_id = so.office_id
   AND is_vetted = 0;

We need to specify is_vetted = 0 because client wants the inspection showing in the vetting list to be deleted.  An inspection only appears in the Vetting list if it has NOT been vetted (is_vetted = 0);
IID = 725968
Chiara D’Amato, IMO 9423267

SELECT
    i.inspection_id,
    so.english_value
FROM
    inspection i,
    s_office so,
    tm008_port tm008
WHERE
    imo_no = 9423267
    AND TO_CHAR(date_of_inspection,'DD/MM/YYYY') = '24/04/2019'
    AND i.inspection_port_cd = tm008.port_cd
    AND tm008.office_id = so.office_id;
IID = 726228

Before deleting anything, also verify with client that the inspection ID's identified are correct.  This could be via phone call or screen shot. To check IID, search on IMO number and match up the inspection ID found with the IID query string parameter (&IID=XXXXXXXX). See e-mail sent to client in Attachments.  Once client confirms, we can delete the inspections.
The delete script can be found at: \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\scripts; file name is CPSCS_delete_inspection.sql. Replace the "&&inspection_id" value with the appropriate values identified above. If the query works, comment out "rollback;" and and uncomment "commit;" before running a second time.
KOTA EKSPRES IMO 9644990
delete from inspection where inspection_id = 725886;
delete from deficiency_action_code where deficiency_id in (select deficiency_id from deficiency where inspection_id = 725886);
delete from deficiency_description where deficiency_id in (select deficiency_id from deficiency where inspection_id = 725886);
delete from certificates where inspection_id = 725886;
delete from deficiency where inspection_id = 725886;
delete from detention where inspection_id = 725886;
delete from inspection_area where inspection_id = 725886;
delete from operational_control where inspection_id = 725886;
delete from vessel_action_code where inspection_id = 725886;
Delete From Tm028_Xref_Inspection_Up Where Inspection_Id = 725886;
update vessel set last_inspection_id = null where last_inspection_id = 725886;
delete from inspection where inspection_id = 725886;
rollback;
-- commit;

Global Echo IMO 9633288
delete from inspection where inspection_id = 725968;
delete from deficiency_action_code where deficiency_id in (select deficiency_id from deficiency where inspection_id = 725968);
delete from deficiency_description where deficiency_id in (select deficiency_id from deficiency where inspection_id = 725968);
delete from certificates where inspection_id = 725968;
delete from deficiency where inspection_id = 725968;
delete from detention where inspection_id = 725968;
delete from inspection_area where inspection_id = 725968;
delete from operational_control where inspection_id = 725968;
delete from vessel_action_code where inspection_id = 725968;
Delete From Tm028_Xref_Inspection_Up Where Inspection_Id = 725968;
update vessel set last_inspection_id = null where last_inspection_id = 725968;
delete from inspection where inspection_id = 725968;
rollback;
-- commit;
Chiara D’Amato, IMO 9423267
delete from inspection where inspection_id = 726228;
delete from deficiency_action_code where deficiency_id in (select deficiency_id from deficiency where inspection_id = 726228);
delete from deficiency_description where deficiency_id in (select deficiency_id from deficiency where inspection_id = 726228);
delete from certificates where inspection_id = 726228;
delete from deficiency where inspection_id = 726228;
delete from detention where inspection_id = 726228;
delete from inspection_area where inspection_id = 726228;
delete from operational_control where inspection_id = 726228;
delete from vessel_action_code where inspection_id = 726228;
Delete From Tm028_Xref_Inspection_Up Where Inspection_Id = 726228;
update vessel set last_inspection_id = null where last_inspection_id = 726228;
delete from inspection where inspection_id = 726228;
rollback;
-- commit;
Inspections deleted. Contacting client (see attachments).
Will update Confluence and then close ticket.
Here we require to delete Test Vessel Inspections associated with billuser account.

In the email, client has mentioned about three vessels.
“CPSCS Test Vessel 1” (IMO 1114561) 
TEST VESSEL (IMO 3456755)
SECOND TEST VESSEL V5.2.1 (IMO 2000016)
Lets first login to Prod and check the test vessels in the Vetting list. The result is as below:
IMO Number Vessel Name      Date of Inspection
1114561  CPSCS TEST VESSEL 1    2019 07 04
2000016  SECOND TEST VESSEL V5.2.1   2019 07 04
3456755  TEST VESSEL      2019 07 05
Now lets confirm that are these inspections are related to billuser account? Aldo find the inspection id.
    select inspection_id, date_of_inspection,created_by_user_id from inspection where imo_no='1114561';
select inspection_id, date_of_inspection,created_by_user_id from inspection where imo_no='2000016';
select inspection_id, date_of_inspection,created_by_user_id from inspection where imo_no='3456755';
IMO  Inspection_ID Inspection_Date Created_by_user_id
1114561 728787   19-07-04  236
2000016 728866   19-07-04  236
3456755 728806   19-07-05  236
select username from user_profile where user_id='236';
Here USERNAME = BILLUSER
Now lets delete the inspection for IMO=1114561 and Inspection_ID=728787
In the \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\SQL Queries directory, grab the following sql from CPSCS_delete_inspection.sql and replace "&&inspection_id" with "728787". 
We want to first make sure that running these commands won't have unexpected consequences in CPSCS.  Add a "rollback;" at the end of the delete so that you can verify that a reasonable numbers of rows were deleted.  
For example, only one inspection should be deleted.  You may also have as many as 10-20 deficiencies and certificates deleted. 
But if you see hundreds of rows updated, further investigation may be required - contact current CPSCS "SME" in DSD or contact CPSCS client to discuss with them.
delete from inspection where inspection_id = 728787;
delete from deficiency_action_code where deficiency_id in (select deficiency_id from deficiency where inspection_id = 728787);
delete from deficiency_description where deficiency_id in (select deficiency_id from deficiency where inspection_id = 728787);
delete from certificates where inspection_id = 728787;
delete from deficiency where inspection_id = 728787;
delete from detention where inspection_id = 728787;
delete from inspection_area where inspection_id = 728787;
delete from operational_control where inspection_id = 728787;
delete from vessel_action_code where inspection_id = 728787;
Delete From Tm028_Xref_Inspection_Up Where Inspection_Id = 728787;
update vessel set last_inspection_id = null where last_inspection_id = 728787;
delete from inspection where inspection_id = 728787;
rollback;
-- commit;
The result is as below:
Error starting at line : 2 in command -
delete from inspection where inspection_id = 728787
Error report -
ORA-02292: integrity constraint (CPSCSW.FK_DEFICIEN_REF_134_INSPECTI) violated - child record found
1 row deleted.
1 row deleted.
2 rows deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row updated.
1 row deleted.(Here is where the inspection is deleted.)
Rollback complete.
This looks good. Let's run it for real by replacing "rollback;" with "commit;"
Now lets confirm the inspection is deleted from the Vetting list by login to production site.
We are good the inspection is deleted from the Vetting queue.
Now lets repeat same steps to delete the inspection for IMO=2000016 and Inspection_ID=728866
delete from inspection where inspection_id = 728866;
delete from deficiency_action_code where deficiency_id in (select deficiency_id from deficiency where inspection_id = 728866);
delete from deficiency_description where deficiency_id in (select deficiency_id from deficiency where inspection_id = 728866);
delete from certificates where inspection_id = 728866;
delete from deficiency where inspection_id = 728866;
delete from detention where inspection_id = 728866;
delete from inspection_area where inspection_id = 728866;
delete from operational_control where inspection_id = 728866;
delete from vessel_action_code where inspection_id = 728866;
Delete From Tm028_Xref_Inspection_Up Where Inspection_Id = 728866;
update vessel set last_inspection_id = null where last_inspection_id = 728866;
delete from inspection where inspection_id = 728866;
rollback;
Error starting at line : 1 in command -
delete from inspection where inspection_id = 728866
Error report -
ORA-02292: integrity constraint (CPSCSW.FK_DEFICIEN_REF_134_INSPECTI) violated - child record found
10 rows deleted.
2 rows deleted.
3 rows deleted.
2 rows deleted.
1 row deleted.
10 rows deleted.
8 rows deleted.
8 rows deleted.
2 rows deleted.
1 row updated.
1 row deleted.
Rollback complete.
Here multiple rows are deleted. 
Lets check the deficiency table. For inspection_id = 728866 there are two deficiency_id (709327,709328)
Here all the 10 records in the deficiency_action_code are created on 2019-08-07 and created by the user BILLUSER.
Same way checked all the tables where multiple records deleted and found that those records are  created on 2019-08-07 and created by the user BILLUSER.

So now we are good to go.
Lets run the delete queries with commit and delete the inspection.

Now lets repeat same steps to delete the inspection for IMO=3456755 and Inspection_ID=728806  

delete from inspection where inspection_id = 728806;
delete from deficiency_action_code where deficiency_id in (select deficiency_id from deficiency where inspection_id = 728806);
delete from deficiency_description where deficiency_id in (select deficiency_id from deficiency where inspection_id = 728806);
delete from certificates where inspection_id = 728806;
delete from deficiency where inspection_id = 728806;
delete from detention where inspection_id = 728806;
delete from inspection_area where inspection_id = 728806;
delete from operational_control where inspection_id = 728806;
delete from vessel_action_code where inspection_id = 728806;
Delete From Tm028_Xref_Inspection_Up Where Inspection_Id = 728806;
update vessel set last_inspection_id = null where last_inspection_id = 728806;
delete from inspection where inspection_id = 728806;
rollback;
Query Result:

Error starting at line : 1 in command -
delete from inspection where inspection_id = 728806
Error report -
ORA-02292: integrity constraint (CPSCSW.FK_DEFICIEN_REF_134_INSPECTI) violated - child record found
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row deleted.
1 row updated.
1 row deleted.
Rollback complete.

Let's run with commit.
Now lets confirm the inspection is deleted from the Vetting list by login to production site.
We are good the inspection is deleted from the Vetting queue.
All the three inspections are deleted so inform the client and close the SMGS ticket.

Default Descriptions listing Error on THETIS export

Problem:
0 of 1 inspections successfully sent to THETIS<br /><hr width="100%">Inspection ID 724621: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Deficiencies: value of Default Description is not valid (IMO: 9321914)

Solution:
See TFS 14115 or TFS 14005 for appropriate solutions.

Deficiency Action Error on THETIS Upload

Problem:
Inspection ID 724621: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Deficiencies: Deficiency Actions is missing (IMO: 9321914)

Solution:
See TFS 14165 for an appropriate solution.

Nature of Defect Issue

Problem:

Inspection ID 723726: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Deficiencies: The Nature of Defect Fee not paid for delivery cargo residues is not valid for deficiency 01102 - Cargo Ship Safety Construction (including exempt.) (IMO: 6725432)

Solution:

http://tfsprod:8080/tfs/Marine Safety/Marine Safety Portfolio/_workitems?id=14006


Default Descriptions Error on THETIS Export

Problem:

Receiving the following error on export to THETIS:


Inspection ID 723666: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Deficiencies: value  of Default Description is not valid

(IMO: 9312664)

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=14005

 

CPSCS - IM268001 - VTP Issues

Problem:

Last week we had our CPSCS - VTP finally come back as there was problem since the ORCALE Migration and now over the weekend there was the “Security Patch” and systems went down. CPSCS’s VTP did not come back up.

As reference her is e- mails to DBA Group. Which may help to fix the problem.

This is causing over 100 Marine Inspectors access to Vessel arrivals to assist in targeting vessel for inspection and therefore can not perform their duties.


Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13995

 

CPSCS - IM267488 - CPSCS Active Port Calls not working

Problem: 

Please pass on to Marine Safety IT to investigate why the Active Port Calls are not working in CPSCS, I have checked a number of the regions and district offices and no port calls are being displayed. See below Vancouver.

 

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13942

 

CPSCS - <NO IM> - THETIS and APCIS Export/Import not working following DB migration

Problem:

Client reports that THETIS and APCIS exports are not working following the Oracle migration on January 19, 2019.


Possible tests:

  1. Verify that the global.asa for CPSCS is using a valid connection string.
  2. Verify that the web services are up and running (https://wwwapps.tc.gc.ca/saf-sec-sur/4/cpscs-apcis-ws/ApcisProxyWs.asmx and  https://wwwapps.tc.gc.ca/saf-sec-sur/4/cpscs-ws/service.asmx)
  3. Check log files on NCRWS333/334/335 to see what is being reported in terms of errors.
  4. Attempt to export an inspection to THETIS (try to use an inspection that previously failed - we don't want to export an inspection that is not ready for export)
  5. Worst-case: load up CPSCS DLL for version 6.0.10, connect to production database, and step through the export process to see where things are failing.

 

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13901

 

CPSCS-EXCEL: Spreadsheet not working following DB migration

Problem:

Spreadsheet stopped responding after Oracle migration.  See Discussion for steps used to solve the issues and Acceptance criteria for solution.


Things to check:

  1. Is the correct version of the spreadsheet in RDIMS?
  2. Is the correct version of the spreadsheet in CPSCS?
  3. Is the spreadsheet version number in the database correct?
  4. Is the connection string correct in the spreadsheet?
  5. Can we connect to the CPSCS database with the credentials in the spreadsheet?

Once the spreadsheet was fixed, need to correct specific instances of the spreadsheet as identified by Bill. 


Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13889

 

 

CPSCS - IM263543 - NCR - Tower C - 10 - D127 - HENDERW - Issue With Link in RuleCheck

Problem:

Hello,

The Transport Canada Marine Inspectors are all currently experiencing an error with the ‘EMSA RuleCheck’ hyper-link.
The link seems to be broken and does not take them to the right place. Currently the link goes to https://rulecheck.emsa.europa.eu/emsaweb/srcweb/checkdeficiencies/RcCheckItems.jsp?shipType=340&constructionDate=29/10/2003&deficiencyCode=04118
This appears to go nowhere and none of the inspectors are able to access RuleCheck.

Al Rushwan suggested that I could contact you for assistance in this case. Here is an image with the hyperlink in blue.

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13522

 

 

CPSCS - IM263215 - GOTLAN SOFIA - IMO 9328144 - Export Error URGENT

Problem:

Fixed initial error but new error on upload:


Inspection ID 722331: ERROR: THETIS Export Error T.IE.5: [PostInspectionResultsJson Error] Unexpected error processing inspection. message.inspection-visit.visitDate-after-last-inspection-visit (IMO: 9328144)


Dear Service Desk:


THIS is URGENT as is a DETENTION.


Please pass on to Marine Safety IT to investigate and fix why the inspection for the Detention of the GOTLAND SAFIA, IMO 9328144 which was detained in Quebec, that I am getting Error deficiency action is Missing, but all deficiency action codes are entered.


See error message attached.

 

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13456

CPSCS- IM261825 - QUE - RMK - NM - CPSCS - Guay, Mathieu - Port de Rimouski disparu de la liste.

Problem:

24 hours as important in Rimouski office as not getting the arrival information to target vessels. 

From: Green, Justin
Sent: Wednesday, November 28, 2018 11:27 AM
To: Henderson, William <william.henderson@tc.gc.ca>
Subject: RE: L'Interaction SD1045782 a été enregistrée pour vous avec les détails suivants /Interaction SD1045782 has been added for you with the details as follows

Thanks Bill.

That may be the cause of the issue and gives me a good starting point.  I’ll try and take a look soon.  If you had to pick – when would you need this resolved: 24 hours, few days, 1 week, or 1 month?  Sorry – we’re stretched very thin at the moment but I’d like to do what I can to help. 

Regards,

Justin

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13292

 

CPSCS - IM261581 - NCR - Tower C - 10 - D127 - HENDERW - Error Submitting ATENI, IMO 9656175 - Prince Rupert to CPSCS

Problem:

NCR - Tower C - 10 - D127 - HENDERW - Error Submitting ATENI, IMO 9656175 - Prince Rupert to CPSCS

William D Henderson - 6139797809

IMO 9656175 is not allowing submission to CPSCS.
Attached is email with error message in it.

Solution:

NCR - Tower C - 10 - D127 - HENDERW - Error Submitting ATENI, IMO 9656175 - Prince Rupert to CPSCS

William D Henderson - 6139797809

IMO 9656175 is not allowing submission to CPSCS.
Attached is email with error message in it.

 

CPSCS - IM261600 - Submission Reports in CPSCS Web (SALDANHA BAY, IMO 9458377)

Problem:

Dear Service Desk:

Please pass on to Marine Safety IT – Inspector in Sept-iles   second one in last couple days can not submit completed inspection reports into CPSCS. The vessel in question is SALDANHA BAY, IMO 9458377  - user Denis Rodrigue.  The error message returned is below.
Inspection is in User’s saved inspections.   I tried it here at HQ and get the same error.

Regards

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13107

 

CPSCS - IM260498 - NCR - Tower C - 10 - D127 - HENDERW - Connection with APCIS Webservice - URGENT

Problem:

NCR - Tower C - 10 - D127 - HENDERW - Connection with APCIS Webservice - URGENT
William  Henderson - 6139797809

Solution:

NCR - Tower C - 10 - D127 - HENDERW - Connection with APCIS Webservice - URGENT
William  Henderson - 6139797809

 

CPSCS - IM258313 - NCR - Tower C-8-D101-HENDERW-APCIS error reporting - Defect Photos

Problem:

Could you let me know before I go to TMOU meeting the problem we are having with the uploading of Deficiency photos is it our side or APCIS side.
Example of the error follows:

4 of 6 inspections successfully sent to APCIS<br /><hr width="100%">Inspection ID 720769: ERROR: APCIS Export Error A.IE.2: Error : UploadInspectionReport : ??????? "http://server.soap.apcis.tmou.org/inspection/v1:ShipDeadweight" ??????????????: ????????
"0" ??????????????? ? ????? ?????? ??? ???? ?????? "http://server.soap.apcis.tmou.org/inspection/v1:T_ShipDeadweight" — ???? ??????????? MinInclusive. (IMO: 7235707)<br /><hr width="100%">Inspection ID 720771: OK (IMO: 9597563)<br /><hr width="100%">Inspection ID 720773: ERROR: APCIS Export Error A.IE.2: Invalid Surveying Authority value in certificate with code '503' (IMO: 9679799)<br />WARNING: Certificate code 528 is not a valid APCIS certificate.
 (IMO: 9679799)<br /><hr width="100%">Inspection ID 720787: OK (IMO: 9537628)<br /><hr width="100%">Inspection ID 720786: OK (IMO: 9207443)<br /><hr width="100%">Inspection ID 720770: ERROR: APCIS Export Error A.IE.3: Error : UploadDeficiencyImages :
Access Denied for putReportDeficiencyPhotos methodERROR: APCIS Export Error A.IE.3: Error : UploadDeficiencyImages : Access Denied for putReportDeficiencyPhotos method (IMO: 9595888)<br />WARNING: Certificate code 531 is not a valid APCIS certificate.
 (IMO: 9595888)

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12679

 

CPSCS - IM257341 - CPSCS list of Vessel with Defect Photos - URGENT

Problem:

Dear service Desk: 

Could you please pass on to Marine Safety IT to have a list of Vessel Inspections over the last Three years which have Photos attached to Deficiencies. As required for PSC Refresher training Oct 9-11 

Regards

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12421

 

CPSCS - IM256472 - ATL NS DAR - George M Anderson - CPSC Report List of Vessels

Problem:

ATL NS DAR - George M Anderson - CPSC Report List of Vessels
Attached full email.

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12395

 

CPSCS - IM256403 - Three uploads to THETIS failed due to Default Description errors

Problem:

See attached THETIS error: 

These are all in Export Queue. 

Three uploads to THETIS failed due to Default Description errors.

IMO 9446726 had defect codes 11101, 13199, 07115 and 07124 

IMO 9359600 had defect codes: 04114, 07114, 11113, 11101 and 14501 

IMO 9239800 had defect codes: 10136, 08101, 11101 and 11101 

I don’t know which is causing the problem and when I look under Defect codes in ADMIN there is nothing that shows the THETIS Code. 

Regards

Bill

 

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12262

 

CPSCS - IM256332 - COSRICH Lake IMO 9646986 - MMSI Duplicate - URGENT

Problem:

Dear Service Desk: 

Please pass on to Marine Safety IT to have the MMSI changed for the vessel COSRICH LAKE IMO 9646986 from 373442000 to 373442002 as vessel changed flag and mmsi and it is being used by another vessel EMERALD STAR imo 9623738.

Please inform me when done. 

Regards


 

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12248

 

CPSCS - IM256232 - PSC Inspection Changes - Error Message - Can't change deficiency action code

Problem:

 Please pass on to Marine Safety IT to investigate why I can not change a deficiency action taken code from code 17 to Code 15 and add the next port. See attached what should be changed to and the error message. 

Solution:

 http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12244

 

CPSCS - IM256258 - CPSCS inspection submission error - MESABI, IMO 9359600

Problem:

Dear Service desk: 

Please pass on to Marine Safety IT to investigate why the submission of the inspection report for the vessel MESABI, IMO 9359600 is getting the attached error. Also I have included the EXCEL spreadsheet for reference. 

Regards

 

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12235

 

CPSCS - IM255238 - NCR - Tower C - 10 D127 - HENDERW - APCIS Export Error investigate why

Problem:

NCR - Tower C - 10 D127 - HENDERW - APCIS Export Error investigate why

William D Henderson - 61397978

See attachment

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12203

 

CPSCS - IM255287 - NCR - Tower C - 10 - D127 - HENDERW - APCIS EXPORT FOR Detention CAP PASADO, IMO 9311799 - -RO RELAT

Problem:


Dear Service Desk:

Could you please pass this on to Marine Safety IT to determine why RO Related was uploaded to APCIS via the batch as per comments from APCIS (attached) when in fact looking at the report in CPSCS the related Deficiencies does not have RO related checked.
Please determine why and let us know the result.

Regards

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=12201

 

CPSCS - IM267488 - CPSCS Active Port Calls not working

Problem:

Dear service Desk: 

Please pass on to Marine Safety IT to investigate why the Active Port Calls are not working in CPSCS, I have checked a number of the regions and district offices and no port calls are being displayed. See below Vancouver.

Regards

 

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13942

 

CPSCS - IM261600 - Submission Reports in CPSCS Web (SALDANHA BAY, IMO 9458377)

Problem:

Dear Service Desk:

Please pass on to Marine Safety IT – Inspector in Sept-iles   second one in last couple days can not submit completed inspection reports into CPSCS. The vessel in question is SALDANHA BAY, IMO 9458377  - user Denis Rodrigue.  The error message returned is below.
Inspection is in User’s saved inspections.   I tried it here at HQ and get the same error.

Regards

Solution:

http://tfsprod:8080/tfs/Marine%20Safety/Marine%20Safety%20Portfolio/_workitems?id=13107


CPSCS - IM310089 - CPSCS: Server Certificate Expiring

Problem:

The SSL certificate for apcis.tmou.org which is installed on our web servers – for the CPSCS web application - will expire on June 11, 2020.


Solution:

Provide a replacement certificate before it expires:

In Dev

  • Create a new folder under \\tc4s0b\groups\AFCCB\MS_APPS\CPSCS\CERTIFICATES\ and store the new APCIS certificate (apcis.tmou.org.cer) in that folder, ex. July 2021. 
  • Ensure that you can access the file when you Remote into NCRWS535
  • Remote into NCRWS535.
  • From NCRWS535, open the Certificate Manager, under Personal/Certificates, find the existing apcis.tmou.org



  • Install new apcis.tmou.org certificate in Current User and Local Computer certificate stores (Personal and Trusted Root) by right clicking on the Personal/Certificates → All Tasks → Import
  • Double click on the apcis.tmou.org.  On the Details Tab.  Notice the Subject info and the Issuer info.  Those elements are what is used to populate the keys in the config below in  GREEN.
  • Update web.config (\\ncrws535\wwwappsroot\saf-sec-sur\4\cpscs-apcis-ws\web.config) as follows:
  1.  Comment out the last entry that has the serverCertificateSubject and serverCertificateIssuer
           <!-- CERT UPDATE - TFS 12982 -->
           <add key="serverCertificateSubject" value="CN=apcis.tmou.org, OU=IT, O=FGBU AMP Primorskogo Kraya i Vostochnoy Arktiki, L=Vladivostok, S=Primorskiy kray, C=RU"/>
          <add key="serverCertificateIssuer" value="CN=GeoTrust RSA CA 2018, OU=www.digicert.com, O=DigiCert Inc, C=US"/>
    
      2.  Add the following three lines to the web.config below the removed keys.  Note that the info in Green is taken from 
           <!-- CERT UPDATE - DOS 110024-->
          <add key="serverCertificateSubject" value="CN=apcis.tmou.org, O=FSI PRIMORSKY REGION MARITIME PORT ADMINISTRATION, L=Vladivostok, S=Primorsky Krai, C=RU"/>
          <add key="serverCertificateIssuer" value="CN=GeoTrust RSA CA 2018, OU=www.digicert.com, O=DigiCert Inc, C=US"/>
Test the cpscs-apcis web Service in Dev NCRWS535:

1. Go to http://wwwappsmssdev/saf-sec-sur/4/cpscs-apcis-ws/apcisproxyws.asmx?op=GetLatestVesselInfo
2. Enter "7411636" into the IMO field.
3. Click Invoke.
4. You should receive the following return message signifying that APCIS was successfully contacted.
<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://tempuri.org/">{"ErrCode":2,"Result":"Inspection information not found."}</string>
After the Dev process is confirmed to be working, request that the Web Team (marcin) installs the new certificate
More to follow.

After confirming that Dev is working, make a request to the web team that the new certificate be installed in ACC.  Edit the config in ACC and test accordingly.

To verify in ACC,  go to the Vetting.Export Queue Tab and select one of the vessels, then click export

After ACC confirmed, request that the certificate be installed in PROD by the web team.  Also request access to the web.config to make changes (compare/kdiff) etc.

To verify in PROD, ask the client to check  in CPSCS 


CPSCS - IM312504 - A list of the inspectors in Marine Safety (by specific role, or for all).

Problem:

Is there a way of getting a list (Excel or CV) all of the inspectors in Marine Safety with a designation of “Port State Control Officer”?


Solution:

This solution could apply to any specific type of inspector role, or for all.

The list of possible inspector roles can be found in the S_USER_ROLE table in the CPSCSP database. In the case of this ticket we were looking for the "PSCO" (Port State Control Officer) role.

Get List of Inspector Roles
Select * from S_USER_ROLE;

One of the roles you'll see is the "PSCO" / ROLE_ID = 3. Knowing the role Id allows for the following:

Get List of Inspectors matching the PSCO role
SELECT up.FIRST_NAME, up.LAST_NAME, ur.ROLE_ID, ur.ENGLISH_VALUE FROM S_USER_ROLE ur, USER_PROFILE up WHERE ur.ROLE_ID = up.ROLE_ID AND ur.ROLE_ID = 3;

The SQL above can be modified to drill for as much data on the PSCO inspectors as required, based on the information available in the USER_PROFILE table.

The returned data from the above can then be exported or copied into whatever file format the requester is asking for.

CPSCS - IM312526 - Remove (or modify) a deficiency. Find a deficiency in the DB from the website or client given deficiency #

Problem:

The client will give you a deficiency # that is not the same as what you need to drill for in the database to get to the same record.

" I am attempting to modify two deficiencies in the 2020-07-02 inspection report for the GOLDEN ARCUS (IMO 9743162). I am trying to delete deficiency 15150, and I am trying to remove the “ISM-related” mark from deficiency 10138. "


Solution:

Log into CPSCSWEB https://wwwapps2.tc.gc.ca/saf-sec-sur/4/cpscs-scepc/ using the login/pw from the password file.

Click on "Vessel Search" and search the IMO# given in the ticket.

Click on the Details button:


Click on the Inspections button:


Click on the Details button:


Click on the Deficiencies tab:


Look for the deficiencies # that client stipulated and press the details button:


The pop-up will have the actual DB value ("DID") to query against:


Logged into CPSCSP.world:

Get the Deficiency
select * from cpscsw.deficiency t where t.Deficiency_ID = 719372; 

  (as per the example above)

From this point the deficiency record can be modified or deleted.

To delete a deficiency (deletes done in order below):

Delete the Deficiency
--15150 deficiency # from client
select * from cpscsw.deficiency t where t.Deficiency_ID = 719372;

--deleteing a defeciancy requires this order;
delete from CPSCSW.deficiency_description where Deficiency_ID = 719372;
delete from CPSCSW.deficiency_images where Deficiency_ID = 719372;
delete from CPSCSW.deficiency_action_code where Deficiency_ID = 719372;
delete from CPSCSW.deficiency where Deficiency_ID = 719372;

CPSCS - IM321375 - APCIS Export Failure: "Empty deficiency action list() for deficiency #xxxxx (IMO XXXXXXX)"

Problem:

Export failure for an inspection with deficiencies.

"Inspection report for the CALLISTO (IMO 9040077) failed to export to APCIS."

Solution:

The solution is based on a previous one described above.

APCIS does not allow Code 30 (“Grounds for detention") and Code 17 (“Rectify deficiency before departure”) on the same deficiency. 

Advise client that the code 17 (“Rectify deficiency before departure”) should be removed from all deficiencies where both it and "Grounds for detention" are used, and then try the export to APCIS again.

CPSCS - Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed

Problem:

When running CPSCS locally in Visual Studio you get the following error:  Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed

Solution:

The solution is to open a command prompt 'run as administrator' and unregister and re-register the DLL using the following commands:

regsvr32 -u C:\Users\graingm\source\repos\CPSCS\src\CPSCS_ROOT\CPSCS\CPSCS_Objects\cpscs6010.dll

regsvr32 C:\Users\graingm\source\repos\CPSCS\src\CPSCS_ROOT\CPSCS\CPSCS_Objects\cpscs6010.dll

Then rerun the application.


CPSCS - Application is down

Problem:

CPSCS is down

Solution:

Contact the web services team. They will do the following to resolve the issue:

1-     Restarted App Pool that did not fix the issue so I

2-     Restarted WPAS Service this also did not work I then verified the COM+ I notice that that service was hung so i

3-     Restarted Component Service and then verified the COM+ and the list was empty so I

4-     Restarted Server then verified everything when all came back on and all was fixed and working since your application relies on .dll’s and that the COM+ was having issues I suspect that the problem was with the Component Service being hung and a reboot fixed the issue.


Step #3/4 seems to be the common fix for this type of problem: the component services are being hung-up, so the team restarts the server


CPSCS - Application is down - EXPLAINED

Problem:

CPSCS is down

Solution:

CPSCS might have become inaccessible because the printing function will sometimes freeze up and stall the entire website. In this case, we follow the steps provided in solution, above.

Long-term solution:

Remove the COM+ components permanently and register the website’s dll (CPSCS6010.dll) through command prompt:

  1. Stop application pool (Also, ensure that 32 bit application support is enabled in the application pool settings)

  2. End the running process for the application in question (CPSCS): COM+ Applications > Running Processes > CPSCS> Right-click > Shut Down

  3. Delete all CPSCS COM+ Components from COM+ Applications > CPSCS > Components

  4. Delete aspSmartUpload (if applicable) COM+ Component from COM+ Applications > Common Components > Components

  5. Delete build.Report.1 (if applicable) COM+ Component from COM+ Applications > Common Components > Components

  6. Register CPSCS6010.dll by opening command prompt : regsvr32 {PATH TO DLL}\CPSCS6010.dll

  7. Register build.Report.1 by opening command prompt : regsvr32 D:\WWWROOT\CommonApps\pdfrwr.dll

  8. Register aspSmartUpload by opening command prompt : regsvr32 D:\WWWROOT\CommonApps\aspSmartUpload.dll

  9. Start application pool
    Note* You will not be able to see the application under Running Process anymore, as it relies on the COM+ Component to view

To summarize, we want to remove and conflicting COM+ Components from the server (build.Report.1 / aspSmartUpload / CPSCS6010.dll) and utilize these dlls by registering them in CMD Prompt instead: regsvr32 [path to dll]. You will need to shut down the application pool and running components before attempting.


CPSCS - Vetting Vessel Needs to be put back in the Export Queue

Problem:

ON occasion, we may need to put a record back in the APCIS Export Queue, to do so  Bill H will provide the IMO NO and the Inspection ID. Make sure they are both in the select otherwise  you will get several records that shouldn't be  processed

Solution:

-- 1. Select the set of records and confirm
select * from INSPECTION
where imo_no in (9413913,9323065,9566382)
and inspection_id in(754927,754987,755087)
order by export_to_apcis desc;

-- 2. Update the flag and set export_to_apcis to 1

update inspection
set export_to_apcis = 1
where imo_no in (9413913,9323065,9566382)
and inspection_id in(754927,754987,755087);

  • No labels