Sunday, 6 September 2026

Apriso

DELMIA APRISO

  • Apriso Desktop Client
  • Apriso Process Builder
  • Global Process manager
  • Archive
  • Apriso Configuration Manager

Certificates:

  • Apriso Brand Essentials Program
  • Apriso Foundation 
  • Apriso Process Builder 
  • Complex Assembly Production
  • Repetitive Production 
  • Quality 
  • Maintenance 
  • Warehouse Shipping
  • Time & Labor 

GPM Entity tables:
PB_Project
Operation
Operation_Header
Operation_Link


Standard Table
Role
Employee
EmployeRole
Group_
Product
Product_Group
Resource_
Resource_Labor
Equipment
Serial_No

Wip_order
Wip_order_Type
Wip_order_Status
Wip_Operation
Container
Container_Class
Inventory2
Warehouse
Warehouse_Location
Text
Text_Translation
Literal
Literal_Translation
Literal_Dictionary
Literal_Dictionary_Translation


Text_Translation
Unit
Unit_characteristic


Who Columns:
Createdon
Creatdby
Lastupdateon
Lastupdatedby
Active
Referenceid
Rowversionstamp
Lastdeleteon
LastDeletedby
LastArchiveon
LastArchivedby


APRISO Configuration Manager
a.   WebAddress : App101
b.   Database Configurations:
c.   Reporting Service
       Untitled
d.   Literal Provider
    
e.   Security     
    
  • Apriso Desktop client:
• Company
• Facility
• Department
• Warehouse
• Warehouse Location
• Warehouse Location Class
• Warehouse Location Relation
• Location Relationship Class
• Location Lookup
• Zone
• Work center
• Equipment Explorer
• Equipment Class
• Resource Explorer
• Container
• Container Class
• Container Lookup
• Reason Code
• Reason Class
• Reason Type
• Product Maintenance
• Employee Maintenance
• Group
• Group Class
• Work Instructions
• Work Instruction Class
• UOM Maintenance
• Role
• Skill
• Dictionary Links
• Dictionary Translation
• System Parameter & list
• Advanced Determination Designer
• Advanced Determination value Editor
• Flex Part Configuration
• Machine Integrator Configuration
• Machine Integrator Monitoring
• Disposition
• Disposition Content
• Disposition Line
• Disposition Reading
• Disposition Test
• Disposition Test Sample
• Approval Cockpit
• Dispatching Board
• Production Line
• Order
• Operation
• Order Line
• Order Status History
• Order Type
• Machine Time Cockpit
• Maintenance Cockpit
• Maintenance Order
• Maintenance Calendar
• Maintenance Template
• Time Manager Cockpit
• Weighing & Dispensing Cockpit

APRISO MES Folder Configurations
a.   Labels Definitions
C:\Program Files\Dassault Systemes\DELMIA Apriso 2019\Labels Definitions
.prn File
.Xml File
b.   Report Definitions(Standard Reports of Attendance, Producton, Labor, Quality, Warehouse)
.rpt File
.Xml File
c.   Services
MI Service
Maintenace Service
Job Scheduler & Executor Service
PB Service
GPM Service
d.   WebSite
CentralConfiguarion
Portal
WebService
MI(Machine Integrator)
Adv:
       Data Acquisition
       Alaram & Notifications
       Automatic Logging
       Simulations
OPC Server Communication:
Connector
DataSource
PointGroup
Point

GPM(Global Process Manager)
Types:
a.   Generate From Selection
b.   Generate Cumulative
c.   Generate Differential    
Create GPM:
       1.Goto GPM --> Console Tree --> Projects -->Create New Folder(LineAllocation)
       -->Right Click LineAllocation Folder --> New Projects --> Give Project Name(LineAllocation)--> ok

       2.Click LineAllocation Project --> then Click Add Item-->Select Screen -->select Scren
       Similarly(Layout, View, Operation and other dependies)

       3.then Finaly Generate Cumulative -->ok, Now GPM is Ready.
      
       4.Go to Package Repository-->Generated --> select Generated Package -->Save it


Package Actions:
       a. Executing
       b. Pending
       c. History
Deploy the GPM:
a.   Received
b.   Loaded
c.   Generated

      

Load GPM File
       Right Click --> Package Repository -->Righ Click-->load from file --> select file -->ok
       right click the package --> deploy

FlexPart Configuraion
       Url Generate for Page
URL Generate
PB-->Right click screen--> publish As FlexPart--> create and Save
ADC-->Administration-->SystemAdministration-->MenuMaintenance-->select Screen -->save

Process Builder:
Entity Manager :
It is contains List of Process, Operation, View, Layout, Screen

Entity Status :
1. Design In Progress 
a. The new entity created and can not be execute.
2. Development In Progress
a. While working on the development
3. Compiling In Progress
a. Temporary status occur between status change
4. On Hold 
a. Put on hold
5. Cancelled
a. If it defection or no longer user we can cancel it
6. Prototype 
a. Used for testing purpose
b. We can move back to design in Progress
7. Active  - cannot move back to design or development status
Project Manager
• Project :
○ File -> New -> Project (Name & Revision)
○ Open the Project from Project manager -> Right click project -> Add module
○ Add reference of another module
• Screen:
○ File -> New -> Screen (Name,  Revision, Project, Module)
○ Screen (Name,  Revision, Title, Description, Layout, On-initialize, On-Load)
• Layout:
○ Using Panel we can design  the screen
○ we can divide multiple panels
○ View are liked to panel.
○ Like header, Title, tabs, Filter, context, footer
• View:
○ Header - Header, Button on view
○ Form
Action and Forms
Button and control on view, Generic portal Form.
View Action Type:
□ Button (Primary)
□ Button (Secondary)
□ Calculated
Cannot be displayed
Routing can be added as a view and Operation action triggered based on business logic
□ Tab
□ Numeric - for mobile view
○ General
Button on a view and Business control
Tab, Grid, Tree, Visualization
○ Html - Button on a view and HTML editor
○ Html Header -  Header, Button on a view and HTML editor
• Operation
○ Generic
Business components and user interface components
○ View
rendering section of screen and only one user interface elements.
○ Action
can not any user interface components, only for action which contain business logic
○ Change
used with form type and it is called after change the textbox, Dropdown, Radio, Checkbox
○ Validate
to validation
○ Data
retrieve data from Database
○ Initialize
to initialize a screen
○ Extension
○ Process
for transaction
○ Interface 
triggered by FI Invocation schema that maps interface   

• Function :
Input to Output
User Formula
Web service
SQL Query
Stored Procedure
Determination
Sub Operation
Sub task
Submit Print Request
Business Control
Show Message
Apriso Message
Message Broker
MI Script
DAL Query
MDX Query



Process :
○ Top of process model.
○ Collection Of process Operation, Resources, Materials
Operation:
○ Child entity of Process
○ Collection of Steps, Resources, Materials
Step: 
○ Child entity of Operation
○ Work instruction with collection of function.  Resources, Materials
Function:
○ Child entity of step.
○ Business logic, collection of Input and Output.
Input :
○ data received by function
Output :
○ Data sent by function


Function :
• Call Webservice :
CustomHeaders - Content-Type :application/json;
Payload - json input
Url - https:test.com/inventory
 
BC :
• Send Mail : SendEmailToEmployee_v3 -> FromEmailAddress, ToEmailAddress, Subject, Message, SMTPServer (mandatory fields)
 
• Get Translation : GetDictionaryItemTranslation - DictionaryItemCode, LanguageID
 
• Set MI Points : SetList
• Get MI Points : GetList 


Modules Type(PB)
f.   Production
              1.Bill Of Material
                     Component
                     Componenet_...
              2.Genealogy
                     Genealogy
                     Genealogy_Detail
3.Recipe
       Component
       Recipe
       Recipe_Status
Recipe_Characterstic
Validation_Status
Validation_entity_type
4.Wip Orders
       Wip_Order
       Wip_Order_cONTAINER
       Wip_Order_Lot
       Wip_Order_Relation
Wip_Order_Status
Wip_Order_Type
Work_Flow_Status
5.Work Instructions
       Operation_Step+Work_Instruction
       Unit
Work_Instruction
Work_Instruction_Class
6.Operations
       Progress_Status
       Wip_Componenet
       Wip_Container
       Wip_Operations
       Wip_Operation_Step
       Wip_Req_Resource
Work_Center
Wip_Operation_...
      
g.   Quality
1.Issue Management
       Capa
Capa_Class
Capa_Status
Capa_Link
Capa_Step
Capa_Task
2.Quality Defect
Quality_Defect
Quality_Defect_Location
Quality_Defect_Type
Quality_Defect_Status
Unit_Document
3.Quality Inspection
       Disposition
       Disposition_Class
Disposition_Content
Disposition_Line
Disposition_Resource
Disposition_Status
Disposition_Test
Disposition_type
Disposition_User_Status
4.Quality Planning
Inspection_Plan
Inspection_Line
Inspection_Plan_Class
Inspection_Plan_Group
Quality_Gate
Inspection_Severity

h.   Maintenance
Main_Order_Task
Maint_Template
Maint_Template_Task
Resource_Maint_Task_Template
Resource_Maint_Task_Schedule

i.   Warehouse
1.Inventory
2.Packaging
3.Transactions
4.Counting

j.   Time and Labour
1.Attendance
       Attendance
       Attendance_Status
       Employee_Class
       Employee_Facility
       Pay_Cycle
Pay_Rule

2.Calendar
       Calendar
       Calendar_Type
       Calendar_Day
Employee_Calendar

3.Labour
       Labor
       Labor_Detail
       Labor_Status
       Lbor_Type
Work_Center
Labor_Code

4.Schedule
       Employee_Work_Schedule
       Employee_Break_Schedule
       Facility_Work_Schedule
Schedule_Type
Schedule_Status

5.Shifts
       Work_Shift
Break_Type
Work_Shift_Type

Types Of Entity
1.Screen
2.Layout
3.View
4.Operation
5.Process
6.ActionScript
7.Project

Entity Status
a.   Active
b.   Prototype (Ctrl + Shift + P)
c.   Developemt in Progress(Ctrl + Shift + G)
d.   Design in Progress(Ctrl + Shift + D)
e.   On Hold
f.   Cancelled

Validate(Ctrl + Shift + V)
Compile(Ctrl + Shift + B)

SubType of View
g.   General
h.   Form
i.   Header
j.   Html
k.   Html Header
Type of Operation
a.   Generic
b.   View
c.   Action
d.   Change
e.   Validate
f.   Data
g.   Iniyalize
h.   Extension
i.   Process
j.   Interface
k.   Labor
l.   Machine
m.   Background
SubType of Process
a.   Discreate Production
b.   Sequenced Production
c.   Production Rework
d.   Corrective Maintenance
e.   Predictive Maintenance
f.   Stablity testing
g.   Quality Recall
h.   Supplier release
i.   Supplier Purchase
j.   Warehouse Replenishment
k.   Receiving
Session Variables
Step to step data transfer
External Variables
Screen to Screen, View to view data transfer
System Parameter Variables
       Configued static data with Key & Value.
Project Manager
Entity Manager
List of Created and Modified Entity
ActionScript Manager
Bisiness Component Repository
Dictonary Manager
       Add and Manage Dictonary items
SystemParameter & List Manager
       Confiured Syated Parameter List
Determination Manager
       Configued static and Dynamic data with with Multiple columns(DET2_ViewName).
Web Service Manager
Work Instructions
Change Management
       Instead on one configure alternative Material and etc..
Quality Spectifications
Function
       Input/Output
Show Message
Sql Query
Stored Procedure
Sub Operation
User Formula
WebService
Submit Print Request
Sub Task
Business Componenet
Business Control
Determination

Steps
       Add functions
Input/Output Parameter
       Add input
       Add outpt
       Add Pair
Routing
      Route one step to another step basedon condition
Label Printing(QR/Bar code)
       Generete QR and BAR code
Scheduled Jobs

Select Values From System Parameter
SELECT spv.Value_ AS Image    
FROM System_Parameter sp
INNER JOIN SYSTEM_PARAMETER_VALUE spv ON sp.ID = spv.SystemParameterID
WHERE sp.Name = 'PRY_MBL4_MATERIAL_IMAGE'

Array Concodinate
Out_SelectedWipOrderNo = CurrentSelectedWipOrderNo.Concat(PreviousSelectedWipOrderNo).ToArray();

Remove List of data From Array
List<string> rest = Selected_WipOrderNo.Except(ReSelected_WipOrderNo).ToList();
FinalSelected_WipOrderNo = rest.ToArray();

Read the Inputs to ScreenInterface
$Context.inputs.Product

Set Output From ScreenInterface
$Context.outputs.Product

Js Code:
• Write Console log in Browser (Js) :
var msgObj = JSON.parse(msg);
if ($Context.inputs.ConsoleLogEnabled) {
console.log("Leftover data:");
console.log(msgObj);
}
 
• Apriso Popup Dragable:
<script>
$View.onLoaded(function(){
 
$('.apr-popup').css({"top": "90px" , "margin-top":"10px"}).draggable({ cursor: "move",
containment: "body",
scroll: false,
iframeFix: true,
handle: ".apr-popup-head"
});
});

</script>

Remove the data from Array
Array.prototype.remove = function(x)
{
     var i;
      for(i in this)
      {
       if(this[i].toString() == x.toString())
              {
                this.splice(i,1)
       }
     }
}

Compare Two Array
function compareArrays(arr1, arr2)
{
       return $(arr1).not(arr2).length == 0 && $(arr2).not(arr1).length == 0;
};

EX: var compereProductFamilyArray = compareArrays(SelectedProductNoExt_ProductFamily? 'true' : 'false'
                    
Add Selected table row value to Array
var SelectedProductNo = [];
$("table tr.selected").each(function ()
{     
var data = $(this).find("td:eq(1)").text();
       SelectedProductNo.push(data);
});

Tab View in HTML(GenericPortalTab)
<!-- Portal Tabs -->
<div class="TabList">
       <button type="button" data-flx-iterate="i,_inlineTabList" data-flx-bind="Action" value="{_inlineTabList[i]}" class="{_inlineTabClassList[i]}">
              <span>{_inlineTabTitleList[i]}</span>
              <span data-flx-filter="_inlineNotifyCountList[i] > 0" class="TabNotify" data-portal-id="{Panel}{_inlineTabList[i]}">{_inlineNotifyCountList[i]}</span>
       </button>
</div>
<div data-flx-subop="Call_PortalGenerateTabList"/>

Disable the button
$("button[value='MANAGE']").prop("disabled"false);

Table row click event
       $(".DynamicGrid table tbody").delegate("tr""click"function()
       {
       <!-- code -->

});

Selected row count
       $('.DynamicGrid table tbody tr.selected').length;

Place Holder to Textbox
       $('.fc_OrderNo input').attr("placeholder","Enter Order No");
       $('.fc_Update_ActivityID input').attr("readonly","readonly");

Hide Columns in Grid (Fields2HideList- List Of char)
Fields2Hide = new Array();
if(ColumnList !=null)
{      var Columns = ColumnList.split(',');
       for(var i = 0i < Columns.lengthi++)
       {   
           Fields2Hide.push(Columns[i]);
       }
}

List to Array in Apriso
List<string> _JobId = new List<string>();
for (int i=0i<WipOrderNoListForBatch.Lengthi++)
{
       _JobId.Add(In_JobId);
}
JobId = _JobId.ToArray();

List to Button Display in view Operation Code
<div class="btn_selection" data-flx-iterate="i,ButtonHtmlList"> {ButtonHtmlList[i]:html}</div>
<div data-flx-subop="Call_PortalGenerateButtonList"/>

Join array as string
Result = string.Join(", ", array);

Compare a string with List of string
foreach (string Machine in MachineList)
       {
           if(SelectedMachineName == Machine)
              {
                     SelectedMachineisAlternative = true; 
                     SelectedAlternativeMachineName = SelectedMachineName;
              }
       }

Number Validation in JQuery
$(document).on('keypress','div.decimal input',function(evt)
       {
              var result = $(this);
              result.val(result.val().replace(/[^0-9\.]/g, ''));
              if (result.val() = '' && (evt.which != 46 || result.val().indexOf('.'!= -1&& (evt.which < 48 || evt.which > 57))
              {
                     evt.preventDefault();
              }
       });


JqxPopup
Html:
<div id='scheduleWindow'>
       <div id="scheduleWindowHeader">
              <span></span>
       </div>
       <div id="schedulerWindowContent">
             <span></span>
       </div>
</div>
JavaScript:
$('#scheduleWindow').jqxWindow({
              width: 600,
              height: 200,
              resizable: false,
              isModaltrue,
              autoOpenfalse,
        });


C# Code:
• DebugMode code (c#): 
if (DebugMode)
{
throw new OperationException(Message,"");
}
• Input Value in Screen Interface (Js)
var consoleLogEnabled = $Context.inputs.ConsoleLogEnabled;
 
• Output Value in Screen Interface (Js)
$Context.outputs.RackContainerNo = containerNo;       
 
• Write MI log :
Log.Info("Exception in Machine Tracking operation: " + DateTime.UtcNow);
 
• Convert Scalar To List : Recipient -char, ToEmailAddress-char list
ToEmailAddress = new String[]{Recipient};
 
• Remove Empty String from Array :
Var ErrorList = ErrorCodes.Where(x => !string.IsNullOrEmpty(x)).ToArray();
VerificationStatus = ErrorList.Length == 0 ? MIPointValue : 0;
• Get JSON Based on input in Userformula:
JsonResult = Serializer.SerializeToJson(this.GetInputsObjectArray("")[0]);

• Get JSON Based on input in Userformula:
var payload = new
{Inputs = new
{
MachineId,
ProductNo,
ProductRevision1,
ProductRevision2,
LearningParamNames,
LearningParamTypes,
LearningParamValues,
LearningCRC,
Caller = "Apriso"
}
};
 
Payload = JsonConvert.SerializeObject(payload);
 
• Existing JSON add new field:
Newtonsoft.Json.Linq.JObject jsonData = Newtonsoft.Json.Linq.JObject.Parse(_Message);
if (jsonData.HasValues)
{
jsonData.Add("CreationTimestamp", CurrentUTCTime);
jsonData.Add("CreatedBy", CreatedBy);
}
Message = JsonConvert.SerializeObject(jsonData);
 
 
• Read From JSON List Data :
List<string> tempparent = new List<string>();
List<string> tempnumber = new List<string>();
List<string> tempsource = new List<string>();
List<string> tempproject_name = new List<string>();
List<string> tempproject_state = new List<string>();
 
dynamic dynJson = JsonConvert.DeserializeObject(Input);
foreach (var item in dynJson)
{
tempparent.Add(item.parent.ToString());
tempnumber.Add(item.number.ToString());
tempsource.Add(item.source.ToString());
tempproject_name.Add(item.project_name.ToString());
tempproject_state.Add(item.project_state.ToString());
}
 
parent = tempparent.ToArray();
number = tempnumber.ToArray();
source = tempsource.ToArray();
project_name = tempproject_name.ToArray();
project_state = tempproject_state.ToArray();
 
• Create Array in
Comments = new Array();
StockingPoints = new Array();
 
if (OperationIDList.length > 0)
{
for (var i=0;i<OperationIDList.length;i++)
{
Comments.push("");
StockingPoints.push("");
}
}
 
• Debug Mode:
if (DebugMode){
throw new OperationException("Debug mode enabled, database transactions are rolled back","");
}
• Remove Empty String form Array list
var ErrorList = ErrorCodes.Where(x => !string.IsNullOrEmpty(x)).ToArray();
 
• Array List to Scalar :
List<int> status = new List<int>();
WipOrderFound = false;
 
 
if (WorkOrderStatusList.Length >0 ){
WorkOrderStatus = WorkOrderStatusList[0];       
}
for (int count=0; count < AWOLPWipOrderNoList.Length; count++)
{
if (VerificationStatus == AWOLPStatusList[count])
{
WipOrderFound = true;
WipOrderNo = AWOLPWipOrderNoList[count];
WipOrderType = AWOLPWipOrderTypeList[count];
WorkOrderStatus = WorkOrderStatusList[count];
ProductID = AWOLPProductIDList[count];
SequenceNo = AWOLPSequenceNoList[count];
break;
}
}
 
• JSON to LIST :
Newtonsoft.Json.Linq.JObject jsonData = Newtonsoft.Json.Linq.JObject.Parse(JsonErrorsDictionary);
 
string error = "";
var jsonDictionaryErrorsList = jsonData["Items"].Select(p =>
   new
   {
       ID = (int)p["ID"],
       Code = (string)p["Code"],
       ShortText = (string)p["ShortText"],
       MediumText = (string)p["MediumText"],
       ExtendedText = (string)p["ExtendedText"]
   }
).ToList();

string errWrongResource = (from lst in jsonDictionaryErrorsList where lst.Code == "BS_ERR_PREPID_WRONG_RESOURCE" select lst.MediumText).FirstOrDefault();
string errInCorrectStatus = (from lst in jsonDictionaryErrorsList where lst.Code == "BS_ERR_PREPID_WRONG_STATUS" select lst.MediumText).FirstOrDefault();                                       
string errInWrongNoOfPrepID = (from lst in jsonDictionaryErrorsList where lst.Code == "BS_ERR_PREPID_WRONG_NO_OF_PREP" select lst.MediumText).FirstOrDefault();                                       
• Convert JSON to string :
 
if (string.IsNullOrEmpty(JsonString))
   return;
 
var MaterialLotObject = new
{
   partNumber = string.Empty,
quantity = 0m,
   kanbancardid = string.Empty,
   uuid = string.Empty,
valueStream = string.Empty,
workStation = string.Empty,
expirationDate = string.Empty,
uom  = string.Empty,
};
 
var outputMaterialLotObjectList = new[]
{
MaterialLotObject
}.ToList();
 
outputMaterialLotObjectList.Clear();
 
List<object> MaterialLotObjectList = new List<object>();
MaterialLotObjectList.Add(MaterialLotObject);
 
var ourObject = new
{
   MaterialLots = MaterialLotObjectList
};
 
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.FloatParseHandling = Newtonsoft.Json.FloatParseHandling.Decimal;
var deserializedObject = JsonConvert.DeserializeAnonymousType(JsonString, ourObject, settings);
 
foreach (var MaterialLot in deserializedObject.MaterialLots)
{
   var deserializedMaterial = JsonConvert.DeserializeAnonymousType(MaterialLot.ToString(), MaterialLotObject, settings);
 
   MaterialLotObject = new
   {
       deserializedMaterial.partNumber,
       deserializedMaterial.quantity,
       deserializedMaterial.kanbancardid,
       deserializedMaterial.uuid,
deserializedMaterial.valueStream,
deserializedMaterial.workStation,
deserializedMaterial.expirationDate,
deserializedMaterial.uom
   };
   outputMaterialLotObjectList.Add(MaterialLotObject);
}
 
List<decimal> quantityList = new List<decimal>();
List<string> PartNumberList = new List<string>();
List<string> KanbanCardIDList = new List<string>();
List<string> UUIDList = new List<string>();
List<string> ValueStreamList = new List<string>();
List<string> WorkStationList = new List<string>();
List<string> ExpirationDateList = new List<string>();
List<string> UOMList = new List<string>();
 
foreach (var MaterialLot in outputMaterialLotObjectList)
{
   PartNumberList.Add(MaterialLot.partNumber);
   quantityList.Add(MaterialLot.quantity);
   KanbanCardIDList.Add(MaterialLot.kanbancardid);
   UUIDList.Add(MaterialLot.uuid);
ValueStreamList.Add(MaterialLot.valueStream);
WorkStationList.Add(MaterialLot.workStation);
ExpirationDateList.Add(MaterialLot.expirationDate);
   UOMList.Add(MaterialLot.uom);
}
 
PartNumbers = string.Join(",",PartNumberList);
Quantities =  string.Join(",",quantityList);
KanbanCardIDs = string.Join(",",KanbanCardIDList);
UUIDs =  string.Join(",",UUIDList);
ValueStreams = string.Join(",",ValueStreamList);
WorkStations =  string.Join(",",WorkStationList);
ExpirationDates = string.Join(",",ExpirationDateList);
UOMs = string.Join(",",UOMList);
 

 
I/p:
{"MaterialLots": [{"partNumber":"36300777","quantity":"50.0","kanbancardid":"1000385413","uuid":"D1A4C958-7C45-4F4A-B3F6-D6470853B851","uom":"m","valueStream":"87","workStation":"31A_CELL02A","expirationDate":"2024-11-11"},{"partNumber":"37300777","quantity":"20.0","kanbancardid":"1000452132","uuid":"D1A4C958-7C45-4F4A-B3F6-D6470853B851","uom":"a","valueStream":"82","workStation":"31A_CELL02A","expirationDate":"2024-11-17"},{"partNumber":"38300777","quantity":"90.0","kanbancardid":"1000356758","uuid":"E6F2B682-9G35-5B6H-H3U3-N3294646C359","uom":"s","valueStream":"82","workStation":"31A_CELL02A","expirationDate":"2024-11-08"}]}



Inventory Sync Display:

SQL:
SELECT
createdon AS "LastInvSynch_IN"
from Inventory2 
where createdby='BOSS IBA1' 
order by createdon desc
fetch first 1 row  only
 
HTML :
<div class="apr-laflex-container apr-direction-vertical apr-la-fill ">
<dir class="apr-bg-gray-section apr-font-me apr-la-space-me" style="width:600px" >
<div class="apr-laflex-container apr-direction-horizontal">
<div class="apr-laflex-item ">Last inventory synch from Apriso to BOSS:</div>
<div><b>{LastInvSynch_OUT:yyyy-MM-dd HH:mm:ss}</b></div>
</div>
<div class="apr-laflex-container apr-direction-horizontal">
<div class="apr-laflex-item ">Last inventory created in Apriso:</div>
<div><b>{AprisoLastInvCreatedOn:yyyy-MM-dd HH:mm:ss}</b></div>
</div>
<div class="apr-laflex-container apr-direction-horizontal">
<div class="apr-laflex-item">Last inventory synch from BOSS to Apriso:</div>
<div><b>{LastInvSynch_IN:yyyy-MM-dd HH:mm:ss}</b></div>
</div>
</dir>
<div data-flx-bc="Grid"/>
</div>

Issue check display

SQL:
select IssueType, Count(IssueType) as IssueCount
from table(AF_MASTERDATA_INTEGRITYCHECK())
group by IssueType
 
Grid Query:
select IssueType, IssueDesc, Details
from table(AF_MASTERDATA_INTEGRITYCHECK())
 
HTML:
<div class=" apr-laflex-container apr-la-fill apr-direction-vertical">
<div class="apr-cttabhorizontal">
 <div onclick="setFilter('{IssueType[i]}')" data-flx-iterate="i, IssueType" >
   <span>{IssueType[i]}</span>
   <span class="apr-notify">{IssueCount[i]}</span>
 </div>
</div>
</div>
  
<script>
function setFilter(issueType)
{
console.log($(".DynamicGrid").dgGetFilters());
$(".DynamicGrid").dgSetFilters({"filter_issuetype":issueType});
 
}
</script>


Web service list display Grid:
SQL :
 
SELECT DISTINCT
WS.Name AS "WS_NameList",
WS.Enabled AS "WS_EnabledList",
WS.OperationCode AS "WS_OperationList",
--WS.Parameters AS "WS_Parameters"
PP.Name AS "WS_ProjectList",
xmltype(WS.Parameters).extract('//ProcessBuilderWebServiceType/text()').getstringval() as "WS_TypeList"
FROM WEBSERVICE WS
 JOIN OPERATION_HEADER OH
ON OH.ID = WS.OperationHeaderID
JOIN OPERATION O
ON O.OperatioNHeaderID = OH.ID
JOIN OPERATION_LINK OL
ON OL.Operationid = O.ID
AND OL.IsDefaultRevision = 1
LEFT JOIN PB_PROJECT PP
ON PP.ID = OH.ProjectID 
WHERE WS.Name NOT LIKE 'APR%'
ORDER BY WS.Name
 
HTML:
<div class="apr-font-me apr-laflex-container">
<div class="apr-laflex-container apr-direction-vertical">
<!-- system parameter config -->
<div class="apr-font-me apr-la-space-me">Web Services</div>
<table class="bs-table">
<thead class="apr-bg-ds-dark">
<tr>
<th>Web Service Name</th>
<th>Operation</th>
<th>Enabled</th>
<th>Type</th>
<th>URL</th>
</tr>
</thead>
<tbody>
<tr data-flx-iterate="i,WS_NameList">
<td>{WS_NameList[i]}</td>
<td>{WS_OperationList[i]}</td>
<td data-flx-filter="WS_EnabledList[i] == 1" class="apr-bg-green-medium">ON</td>
<td data-flx-filter="WS_EnabledList[i] != 1" class="apr-bg-red-medium">OFF</td>
<td data-flx-filter="WS_TypeList[i] == '1'" class="apr-bg-orange-medium">SOAP</td>
<td data-flx-filter="WS_TypeList[i] != '1'" class="">REST</td>
<td>(server name)/Apriso/httpServices/operations/{WS_NameList[i]}<span data-flx-filter="WS_ProjectList[i] != '' &&WS_TypeList[i] == '2' ">/project/{WS_ProjectList[i]}</span></td>
</tr>
</tbody>
</table>
</div>
</div>






Performance Issue:

Server performance issue:
• Due to application log generation c drive is full;
• IIS logs in web server c drive is full
• Memory consuming more then 90 % (user not properly logout)
 
Application Performance issue:
• Indexing problem
• Log enabled like debugging, error, perfromance
• User has process role
• Query / operation execution taking time

Concurrency violation issue





Thursday, 4 February 2021

Call A Web Service From SQL Server

 Step 1

 
Create a stored procedure in your SQL Server.
  1. CREATE proc [dbo].[spHTTPRequest]     
  2.       @URI varchar(2000) = 'http://localhost:55253/',          
  3.       @methodName varchar(50) = 'Get',     
  4.       @requestBody varchar(8000) = '',     
  5.       @SoapAction varchar(255),     
  6.       @UserName nvarchar(100), -- Domain\UserName or UserName     
  7.       @Password nvarchar(100),     
  8.       @responseText varchar(8000) output    
  9. as    
  10. SET NOCOUNT ON    
  11. IF    @methodName = ''    
  12. BEGIN    
  13.       select FailPoint = 'Method Name must be set'    
  14.       return    
  15. END    
  16. set   @responseText = 'FAILED'    
  17. DECLARE @objectID int    
  18. DECLARE @hResult int    
  19. DECLARE @source varchar(255), @desc varchar(255)     
  20. EXEC @hResult = sp_OACreate 'MSXML2.ServerXMLHTTP', @objectID OUT    
  21. IF @hResult <> 0     
  22. BEGIN    
  23.       EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT    
  24.       SELECT      hResult = convert(varbinary(4), @hResult),     
  25.                   source = @source,     
  26.                   description = @desc,     
  27.                   FailPoint = 'Create failed',     
  28.                   MedthodName = @methodName     
  29.       goto destroy     
  30.       return    
  31. END    
  32. -- open the destination URI with Specified method     
  33. EXEC @hResult = sp_OAMethod @objectID, 'open'null, @methodName, @URI, 'false', @UserName, @Password    
  34. IF @hResult <> 0     
  35. BEGIN    
  36.       EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT    
  37.       SELECT      hResult = convert(varbinary(4), @hResult),     
  38.             source = @source,     
  39.             description = @desc,     
  40.             FailPoint = 'Open failed',     
  41.             MedthodName = @methodName     
  42.       goto destroy     
  43.       return    
  44. END    
  45. -- set request headers     
  46. EXEC @hResult = sp_OAMethod @objectID, 'setRequestHeader'null'Content-Type''text/xml;charset=UTF-8'    
  47. IF @hResult <> 0     
  48. BEGIN    
  49.       EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT    
  50.       SELECT      hResult = convert(varbinary(4), @hResult),     
  51.             source = @source,     
  52.             description = @desc,     
  53.             FailPoint = 'SetRequestHeader failed',     
  54.             MedthodName = @methodName     
  55.       goto destroy     
  56.       return    
  57. END    
  58. -- set soap action     
  59. EXEC @hResult = sp_OAMethod @objectID, 'setRequestHeader'null'SOAPAction', @SoapAction     
  60. IF @hResult <> 0     
  61. BEGIN    
  62.       EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT    
  63.       SELECT      hResult = convert(varbinary(4), @hResult),     
  64.             source = @source,     
  65.             description = @desc,     
  66.             FailPoint = 'SetRequestHeader failed',     
  67.             MedthodName = @methodName     
  68.       goto destroy     
  69.       return    
  70. END    
  71. declare @len int    
  72. set @len = len(@requestBody)     
  73. EXEC @hResult = sp_OAMethod @objectID, 'setRequestHeader'null'Content-Length', @len     
  74. IF @hResult <> 0     
  75. BEGIN    
  76.       EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT    
  77.       SELECT      hResult = convert(varbinary(4), @hResult),     
  78.             source = @source,     
  79.             description = @desc,     
  80.             FailPoint = 'SetRequestHeader failed',     
  81.             MedthodName = @methodName     
  82.       goto destroy     
  83.       return    
  84. END    
  85. /*    
  86. -- if you have headers in a table called RequestHeader you can go through them with this    
  87. DECLARE @HeaderKey varchar(500), @HeaderValue varchar(500)    
  88. DECLARE RequestHeader CURSOR   
  89. LOCAL FAST_FORWARD    
  90. FOR   
  91.       SELECT      HeaderKey, HeaderValue    
  92.       FROM RequestHeaders    
  93.       WHERE       Method = @methodName    
  94. OPEN RequestHeader    
  95. FETCH NEXT FROM RequestHeader    
  96. INTO @HeaderKey, @HeaderValue    
  97. WHILE @@FETCH_STATUS = 0    
  98. BEGIN   
  99.       --select @HeaderKey, @HeaderValue, @methodName    
  100.       EXEC @hResult = sp_OAMethod @objectID, 'setRequestHeader'null, @HeaderKey, @HeaderValue    
  101.       IF @hResult <> 0    
  102.       BEGIN   
  103.             EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT   
  104.             SELECT      hResult = convert(varbinary(4), @hResult),    
  105.                   source = @source,    
  106.                   description = @desc,    
  107.                   FailPoint = 'SetRequestHeader failed',    
  108.                   MedthodName = @methodName    
  109.             goto destroy    
  110.             return   
  111.       END   
  112.       FETCH NEXT FROM RequestHeader    
  113.       INTO @HeaderKey, @HeaderValue    
  114. END   
  115. CLOSE RequestHeader    
  116. DEALLOCATE RequestHeader    
  117. */     
  118. -- send the request     
  119. EXEC @hResult = sp_OAMethod @objectID, 'send'null, @requestBody     
  120. IF    @hResult <> 0     
  121. BEGIN    
  122.       EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT    
  123.       SELECT      hResult = convert(varbinary(4), @hResult),     
  124.             source = @source,     
  125.             description = @desc,     
  126.             FailPoint = 'Send failed',     
  127.             MedthodName = @methodName     
  128.       goto destroy     
  129.       return    
  130. END    
  131. declare @statusText varchar(1000), @status varchar(1000)     
  132. -- Get status text     
  133. exec sp_OAGetProperty @objectID, 'StatusText', @statusText out    
  134. exec sp_OAGetProperty @objectID, 'Status', @status out    
  135. select @status, @statusText, @methodName     
  136. -- Get response text     
  137. exec sp_OAGetProperty @objectID, 'responseText', @responseText out    
  138. IF @hResult <> 0     
  139. BEGIN    
  140.       EXEC sp_OAGetErrorInfo @objectID, @source OUT, @desc OUT    
  141.       SELECT      hResult = convert(varbinary(4), @hResult),     
  142.             source = @source,     
  143.             description = @desc,     
  144.             FailPoint = 'ResponseText failed',     
  145.             MedthodName = @methodName     
  146.       goto destroy     
  147.       return    
  148. END    
  149. destroy:     
  150.       exec sp_OADestroy @objectID     
  151. SET NOCOUNT OFF    
  152.      
  153. GO    
The Stored Procedure takes the following parameters.
  1. @URI: the URI of the web service
  2. @MethodName: this would be ‘GET’ or ‘POST’
  3. @RequestBody: this is the SOAP xml that you want to send
  4. @SoapAction: this the operation that you want to call on your service
  5. @UserName: NT UserName if your web service requires authentication
  6. @Password: the password if using NT Authentication on the web service
  7. @ResponseText: this is an out parameter that contains the response from the web service
Step 2
 
Make the setting in SQL for it.
  1. Use master  
  2. sp_configure 'show advanced options', 1   
  3.   
  4. GO   
  5. RECONFIGURE;   
  6. GO   
  7. sp_configure 'Ole Automation Procedures', 1   
  8. GO   
  9. RECONFIGURE;   
  10. GO   
  11. sp_configure 'show advanced options', 1   
  12. GO   
  13. RECONFIGURE;  
Step 3

Call the stored procedure (Here is a sample call to my service).

  1. declare @xmlOut varchar(8000)  
  2. Declare @RequestText as varchar(8000);  
  3. set @RequestText=  
  4. '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">  
  5.    <soapenv:Header/>  
  6.    <soapenv:Body>  
  7.       <tem:CreateOrder>  
  8.          <!--Optional:-->  
  9.          <tem:OrderRequest>  
  10.             <tem:OrderId>200</tem:OrderId>  
  11.             <!--Optional:-->  
  12.             <tem:OrderName>something</tem:OrderName>  
  13.          </tem:OrderRequest>  
  14.       </tem:CreateOrder>  
  15.    </soapenv:Body>  
  16. </soapenv:Envelope>'  
  17. exec spHTTPRequest  
  18. 'http://localhost/testwebservices/helloworldservice.asmx',  
  19. 'POST',  
  20. @RequestText,  
  21. 'http://tempuri.org/CreateOrderForMe',   -- this is your SOAPAction:  
  22. '''', @xmlOut out  
  23. select @xmlOut   
Make sure your SOAP action is correct. Copy this action from your services. It will show up when your service is RUN.
 

Conclusion 

 
In this blog, I have explained how to call a web service from the stored procedure in SQL.