Quantcast
Channel: aras PLM community
Viewing all articles
Browse latest Browse all 1103

How to use js method in c# code using inn.applyMethod() , it is possible? or c# code to save Item type Programmatically

$
0
0

hiii

I am new to aras innovator . i written following code but method in inn.applyMethod() is js and it gives error that it is not currently supported


Innovator inn = this.getInnovator();
{
string sFormulaId = this.getProperty("id");
Item iDisp = inn.newItem("Symbi_Dispensing BMR","get");
iDisp.setProperty("id",sFormulaId);
Item result = iDisp.apply();
//return inn.newError(result.ToString());

/////////////////////////////GET DISPENSING TAB ITEM//////////////
Item iDispItem = this.newItem("Symbi_Dispensing_Item","get");
iDispItem.setProperty("source_id",iDisp.getProperty("id"));
iDispItem.getAttribute("select","related_id");
Item resDispItem = iDispItem.apply();
int countDispItem = resDispItem.getItemCount();
for(int i=0; i<countDispItem; i++)
{
    Item DispItemRel = resDispItem.getItemByIndex(i);
    Item rItem = DispItemRel.getRelatedItem();
//return inn.newError(DispItemRel.getProperty("symbi_net_uom"));

    /////////////////////////////GET THE ADDED ITEM ////////////////////
Item rFMItem = this.newItem(rItem.getType());
rFMItem.setID(rItem.getID());
Item resFMItem = rFMItem.apply("get");
    //return inn.newError(resFMItem.getProperty("symbi_qtybal_uom"));
string FMItemUOM = resFMItem.getProperty("symbi_qtybal_uom");
string FMItemid = resFMItem.getProperty("id");
string dispQtyUOM = DispItemRel.getProperty("symbi_net_uom");
//return inn.newError(DispItemRel.getProperty("symbi_net_uom"));
    if(dispQtyUOM==FMItemUOM)
        {
   
string sQtyBal = resFMItem.getProperty("symbi_qty_balance");
string sNetwt =  DispItemRel.getProperty("symbi_net_wt");
if(int.Parse(sNetwt) ==0)
{
    return inn.newError("Quantity is Zero");
}


    if(int.Parse(sNetwt) <= int.Parse(sQtyBal))
    {
   
////////////////////ADD BIN CARD BASED ON NUMBER OF ITEM PRESENT IN  DISPENSING ITEM TAB////////////////
Item iBinCard = this.newItem("Symbi_Bin Card");
iBinCard.setProperty("symbi_ar_no",DispItemRel.getProperty("symbi_ar_no"));
iBinCard.setProperty("symbi_quantity",DispItemRel.getProperty("symbi_net_wt"));
iBinCard.setProperty("symbi_action_type","Issues");
iBinCard.setProperty("symbi_uom",DispItemRel.getProperty("symbi_net_uom"));
iBinCard.setProperty("symbi_other",DispItemRel.getProperty("id"));
iBinCard.setProperty("symbi_batch_no",result.getProperty("symbi_batch_no"));
Item resBinCard = iBinCard.apply("add");



//////////////////////////RELATED THE BIN CARD WITH ADDED ITEM /////////////////
Item rItemBinCard = this.newItem("Symbi_Item_BinCard");
rItemBinCard.setProperty("source_id",rFMItem.getID());
rItemBinCard.setProperty("related_id",resBinCard.getProperty("id"));
Item resItemBinCard = rItemBinCard.apply("add");

Item results = inn.applyMethod("Symbi_Create_BPR", "");

//string content = "<table>";
//content += "" +
//string content = "<script type='text/javascript'>";
//          function myFunction()
//          {
//                    rFMItem = resFMItem.getItemByIndex(0);
//                    top.aras.saveItemEx(rFMItem.node,undefined,true);
//                    rFMItem.lockItem();          
//           }+
//content +="</script>";
//content = "</table>";


//rFMItem.lockItem();
//  rFMItem = resFMItem.getItemByIndex(0);
//  inn.saveItemEx(rFMItem.node,true);
//  rFMItem.lockItem();
}
else
{
    return inn.newError("Insufficient Quantity");
}
    }
    else
    {
        return inn.newError("UOM Should be same as Item Master's quantity balanced UOM");
    }

}

}

return this;

thanks in advance


Viewing all articles
Browse latest Browse all 1103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>