Skip to main content
Question

Automatic connect photo to an IFS Object


eqbstal
Superhero (Partner)
Forum|alt.badge.img+21
  • Superhero (Partner)
  • 701 replies

Hello,

Is there anybody that has the following in place: user takes a picture and the photo is automatically uploaded to a server. Some script runs frequently and scans the photo (its name) and connects it automatically to an object in IFS.

I know it is not easy, but have an idea how to connect the photo to the correct object, if the name of the photo contains the key of the object (think of a project number in the name of the photo to know the project is the object in IFS).

Problem that I face is that the name of the photo needs to change on a regular base. Today project 23, the next day project 2998. 

I’m thinking of a camera with FTP or iPad with photo link to directory that IFS can read one way or the other. Still the name of the photo is a sequence number that is hard to change automatically.

AI might help, I think, but have no idea how (maybe barcode in photo??)

Any idea is helpful.

Thanks

This topic has been closed for replies.

4 replies

dsj
Ultimate Hero (Partner)
Forum|alt.badge.img+22
  • Ultimate Hero (Partner)
  • 906 replies
  • May 20, 2021

Hi @eqbstal ,

 

We had similar requirement with a manufacturing customer where they want to add pictures of the finished product as media items in IFS automatically and connect to shop order so I  sense of deja vu :sunglasses: 

In our scenario images are saved in a folder accessible by IFS where we can identify the shop order by picture name.

Tricky part was to read and attach the image when a shop order is created rather than putting file into Connect IN folder.

Method we used was, first checked in image into  DOCMAN using Batch_Transfer_Handler_API.Upload_To_Db and then create media library and insert the image from docman.

It’s not simpler to summarize is few words but hope you get the idea :)

 

Regarding the name change of the photo and mapping to IFS project id: I didn’t understand the requirement well but I assume it’s related to the name sequence of photo is different from project IDs? For such uses data Migration conversion lists works well, where you can map the relations between different entities.

 

Hope it helps!

Damith


durette
Superhero (Customer)
Forum|alt.badge.img+19
  • Superhero (Customer)
  • 542 replies
  • May 27, 2021

Here's how I'd do it. It's crude, but crude things are easier to debug.

1. You'd have a folder where the pictures would get dumped off as soon as they're taken.
2. You'd OCR those files and put them into either an error queue or an IFS queue.
3. A process in IFS would read the files in its queue and process them from there.

 

The hardest part is probably reading the directory listing from IFS. Oracle doesn’t make that easy.

 

 

 

 

You need not use a schedule to look for new files if you use the .NET class FileSystemWatcher: https://docs.microsoft.com/en-us/dotnet/api/system.io.filesystemwatcher?redirectedfrom=MSDN&view=net-5.0

 

You’d probably also want an error queue where IFS can dump bad files so the whole process doesn’t choke on one bad file.


Forum|alt.badge.img+7
  • Hero
  • 69 replies
  • May 28, 2021

Agree with what @durette has mentioned. You will need an OCR software to rename the file so that it has a match to IFS part name. I have many processes set up that are utilizing Oracle’s utl_file package to read external files and write their content back to IFS, so reckon you could use something similar.

The only drawback is as it cannot read the file listing as @durette has indicated. Utl_file.fopen() procedure requires you pass a specific file name to read. What you can do is try something similar to an old school brute forcing. Its effectiveness will largely depending on the number  of parts in your system and the performance impact.

I’d loop through a cursor having a select of all parts applicable, and construct a dynamic file name, such as <part_no>.jpg, and then use utl_file package to check if this file exists. If it doesn’t, move to the next part. If the file exists, then attach the file to a business object in IFS using standard IFS method. See snippet below:

 

FOR rec1 IN all_parts LOOP
    
    utl_file.fgetattr('FILE_DIRECTORY',
                      rec1.constructed_file_name,
                      l_exists,
                      l_size,
                      l_block_size);
    IF (l_exists) THEN

 --do processes to import files

    END IF;

END LOOP;


durette
Superhero (Customer)
Forum|alt.badge.img+19
  • Superhero (Customer)
  • 542 replies
  • May 28, 2021

You don’t need to fetch ALL the files. You can just grab the first file, move it out when you’re done, and recursively search until you run out of files.

 

Here’s the piece of the solution to retrieve the first file in a folder:

1DECLARE
2 tmp_ VARCHAR2(32767);
3BEGIN
4 tmp_ := dbms_java.endsession_and_related_state;
5END;
6/
7
8
9CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "CDirectoryListing"
10AS
11import java.io.*;
12public class CDirectoryListing {
13 public static String getFirstFile(String absoluteDirectory) {
14 File file = new File(absoluteDirectory.replace("\\", "/"));
15 String[] allFiles = file.list();
16 if (allFiles.length == 0) {
17 return "";
18 }
19 return allFiles[0];
20 }
21}
22/
23
24CREATE OR REPLACE PACKAGE c_directory_listing_api IS
25/*
26module_ CONSTANT VARCHAR2(25) := 'FNDBAS';
27lu_name_ CONSTANT VARCHAR(25) := 'CDirectoryListing';
28*/
29FUNCTION get_first_file(
30 absolute_directory_ IN VARCHAR2) RETURN VARCHAR2;
31
32PROCEDURE init;
33
34END c_directory_listing_api;
35/
36
37CREATE OR REPLACE PACKAGE BODY c_directory_listing_api IS
38
39FUNCTION get_first_file(
40 absolute_directory_ IN VARCHAR2) RETURN VARCHAR2
41IS
42LANGUAGE JAVA
43 NAME 'CDirectoryListing.getFirstFile(java.lang.String) return java.lang.String';
44
45PROCEDURE init IS BEGIN NULL; END init;
46
47END c_directory_listing_api;
48/
49
50GRANT EXECUTE ON c_directory_listing_api TO ifssys;
51
52EXEC dictionary_sys.rebuild_dictionary_storage_(0, 'PACKAGES');
53
54SELECT c_directory_listing_api.get_first_file('\\some_server\some_share\some_subfolder\') AS first_file
55 FROM DUAL;
56

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings