Method PostInventoryReturn

Summary

Inventory Return

Remarks

This method allows the user to perform one of seven possible RETURN functions for an inventory item in NaviLine’s Purchasing and Inventory application. Parameters are sent by the user from a mobile device, including an action code which determines the function to be done for the RETURN request.

Input Parameters

NameTypeLengthDescription
action System.String 1 [Required] Action Code. Valid values are: R - to request a new ticket number, F - to find eligible tickets for inventory RETURN, A - to add an inventory RETURN transaction, O - to add an inventory RETURN transaction with override codes, C - to complete the ticket(print if requested), G - to return a result set of Failure Codes, E - to return a result set of Equipment Codes by Reference Number
userID System.String 10 [Required] User ID. Required for Action Codes R, A, O, C
issueNumber System.String 7 [Required] Issue Ticket Number. Required for Action Codes A, O, C
issuedTo System.String 15 [Required] Issued To. Required for Action Codes R, A, O
issuedBy System.String 15 [Required] Issued By. Required for Action Codes R, A, O
equipmentNumber System.String 5 [Required] Equipment Number. Required for Action Code R, or will use Ref number to find this if not provided.
refNumber System.String 10 [Required] Reference Number. Required for Action Code E and possibly R if equipment number not provided.
comment System.String 40 Optional Comments
repairNumber System.String 7 Repair Number
jobNumber System.String 5 Job Number
manualJobNumber System.String 5 Manual Job Number
projectNumber System.String 6 Project Number
workOrderNumber System.String 9 Work Order Number
workOrderJobNumber System.String 3 Work Order Job Number
bldgCode System.String 2 Building Code
commodityCode System.String 3 Commodity Code
subCommodityCode System.String 3 Sub-commodity Code
itemNumber System.String 5 Item Number
quantity System.String 9 Quantity: If provided, all 9 positions should be filled using the format 999999.99
accountNumber System.String 50 G/L Account Number
overrideCode System.String 40 Override Code Array

Example

POST http://localhost/FusionServices/v3/Naviline/BarCode/InventoryReturn

Return Values

NameDescription
ErrorCode
ERR_DESC
IN_ISSUE# 0163425
IN_EQNO 00814
IN_REFN
ERR_TYPE

Sample Responses

Sample Code

using System.Net;
using Newtonsoft.Json.Linq;

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/BarCode/InventoryReturn";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("action",System.Web.HttpUtility.UrlEncode("R"));
   postParms.Add("userID",System.Web.HttpUtility.UrlEncode("QCLE"));
   postParms.Add("issuedTo",System.Web.HttpUtility.UrlEncode("QCLE"));
   postParms.Add("issuedBy",System.Web.HttpUtility.UrlEncode("QCLE"));
   postParms.Add("equipmentNumber",System.Web.HttpUtility.UrlEncode("00814"));

   WebClient req = new WebClient();
   wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
   wc.Headers.Set("X-APPID", "YOURID");
   wc.Headers.Set("X-APPKEY", "YOURKEY");

   byte[] responseBytes = wc.UploadValues(new Uri(uri), "POST", postParms);
   string stringResult = Encoding.UTF8.GetString(responseBytes); 
   JObject response = JObject.Parse(stringResult);
   string error = response["OutputParms"]["ErrorCode"].ToString();
   if (error == "0000")
   {
         // TODO - YOUR CODE HERE
   }
}

C# Razor MVC Sample Code

using System;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Collections.Specialized;
using FusionServiceHelper.Models;

// NOTE: Use the namespace generated when you add the class, so that it is correct.
namespace FusionRazor.Models
{
   public class PostInventoryReturn
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,1}$).*", ErrorMessage = "Must be 1 characters or less. ")]
       public string action{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,10}$).*", ErrorMessage = "Must be 10 characters or less. ")]
       public string userID{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,7}$).*", ErrorMessage = "Must be 7 characters or less. ")]
       public string issueNumber{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,15}$).*", ErrorMessage = "Must be 15 characters or less. ")]
       public string issuedTo{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,15}$).*", ErrorMessage = "Must be 15 characters or less. ")]
       public string issuedBy{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
       public string equipmentNumber{get; set;}

       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,10}$).*", ErrorMessage = "Must be 10 characters or less. ")]
       public string refNumber{get; set;}

       [RegularExpression("^(?=.{0,40}$).*", ErrorMessage = "Must be 40 characters or less. ")]
       public string comment{get; set;}

       [RegularExpression("^(?=.{0,7}$).*", ErrorMessage = "Must be 7 characters or less. ")]
       public string repairNumber{get; set;}

       [RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
       public string jobNumber{get; set;}

       [RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
       public string manualJobNumber{get; set;}

       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string projectNumber{get; set;}

       [RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
       public string workOrderNumber{get; set;}

       [RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
       public string workOrderJobNumber{get; set;}

       [RegularExpression("^(?=.{0,2}$).*", ErrorMessage = "Must be 2 characters or less. ")]
       public string bldgCode{get; set;}

       [RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
       public string commodityCode{get; set;}

       [RegularExpression("^(?=.{0,3}$).*", ErrorMessage = "Must be 3 characters or less. ")]
       public string subCommodityCode{get; set;}

       [RegularExpression("^(?=.{0,5}$).*", ErrorMessage = "Must be 5 characters or less. ")]
       public string itemNumber{get; set;}

       [RegularExpression("^(?=.{0,9}$).*", ErrorMessage = "Must be 9 characters or less. ")]
       public string quantity{get; set;}

       [RegularExpression("^(?=.{0,50}$).*", ErrorMessage = "Must be 50 characters or less. ")]
       public string accountNumber{get; set;}

       [RegularExpression("^(?=.{0,40}$).*", ErrorMessage = "Must be 40 characters or less. ")]
       public string overrideCode{get; set;}

       public PostInventoryReturn()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostInventoryReturn class. *@
@* NOTE: Select Edit as the Scaffold template. *@
@* NOTE: Use the @model line that is generated at the top.  Replace the rest with the lines below.
@model FusionRazor.Models.PostInventoryReturn

@{
   ViewBag.Title = "PostInventoryReturn";
}

<h2>PostInventoryReturn</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostInventoryReturn</legend>
       <div class="editor-label">
           @Html.LabelFor(model => model.action)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.action)
           @Html.ValidationMessageFor(model => model.action)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.userID)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.userID)
           @Html.ValidationMessageFor(model => model.userID)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.issueNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.issueNumber)
           @Html.ValidationMessageFor(model => model.issueNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.issuedTo)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.issuedTo)
           @Html.ValidationMessageFor(model => model.issuedTo)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.issuedBy)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.issuedBy)
           @Html.ValidationMessageFor(model => model.issuedBy)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.equipmentNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.equipmentNumber)
           @Html.ValidationMessageFor(model => model.equipmentNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.refNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.refNumber)
           @Html.ValidationMessageFor(model => model.refNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.comment)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.comment)
           @Html.ValidationMessageFor(model => model.comment)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.repairNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.repairNumber)
           @Html.ValidationMessageFor(model => model.repairNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.jobNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.jobNumber)
           @Html.ValidationMessageFor(model => model.jobNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.manualJobNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.manualJobNumber)
           @Html.ValidationMessageFor(model => model.manualJobNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.projectNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.projectNumber)
           @Html.ValidationMessageFor(model => model.projectNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderNumber)
           @Html.ValidationMessageFor(model => model.workOrderNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.workOrderJobNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.workOrderJobNumber)
           @Html.ValidationMessageFor(model => model.workOrderJobNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.bldgCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.bldgCode)
           @Html.ValidationMessageFor(model => model.bldgCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.commodityCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.commodityCode)
           @Html.ValidationMessageFor(model => model.commodityCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.subCommodityCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.subCommodityCode)
           @Html.ValidationMessageFor(model => model.subCommodityCode)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.itemNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.itemNumber)
           @Html.ValidationMessageFor(model => model.itemNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.quantity)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.quantity)
           @Html.ValidationMessageFor(model => model.quantity)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.accountNumber)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.accountNumber)
           @Html.ValidationMessageFor(model => model.accountNumber)
       </div>
       <div class="editor-label">
           @Html.LabelFor(model => model.overrideCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.overrideCode)
           @Html.ValidationMessageFor(model => model.overrideCode)
       </div>
       <p>
       <input type="submit" value="Submit"/>
       </p>
   </fieldset>

}

@section Scripts {
   @Scripts.Render("~/bundles/jqueryval")
}
using System;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using FusionServiceHelper.Models;

// NOTE: Replace 'MyController' with the name of your controller.

// 
// GET: /MyController/PostInventoryReturn
public ActionResult PostInventoryReturn()
{
   // Create a new instance of the model to pick up any default values.
   PostInventoryReturn model =  new PostInventoryReturn();

   // pass model to set to default values
   // NOTE: Change 'MyFolderPath' to the path to the .cshtml file.
   return View("~/Views/MyFolderPath/PostInventoryReturn.cshtml", model);
}

// 
// POST: /MyController/PostInventoryReturn
[HttpPost]
public ActionResult PostInventoryReturn(FormCollection collection)
{
   string url = "v3/Naviline/BarCode/InventoryReturn";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("action", collection["action"]);
   inputParms.Add("userID", collection["userID"]);
   inputParms.Add("issueNumber", collection["issueNumber"]);
   inputParms.Add("issuedTo", collection["issuedTo"]);
   inputParms.Add("issuedBy", collection["issuedBy"]);
   inputParms.Add("equipmentNumber", collection["equipmentNumber"]);
   inputParms.Add("refNumber", collection["refNumber"]);
   inputParms.Add("comment", collection["comment"]);
   inputParms.Add("repairNumber", collection["repairNumber"]);
   inputParms.Add("jobNumber", collection["jobNumber"]);
   inputParms.Add("manualJobNumber", collection["manualJobNumber"]);
   inputParms.Add("projectNumber", collection["projectNumber"]);
   inputParms.Add("workOrderNumber", collection["workOrderNumber"]);
   inputParms.Add("workOrderJobNumber", collection["workOrderJobNumber"]);
   inputParms.Add("bldgCode", collection["bldgCode"]);
   inputParms.Add("commodityCode", collection["commodityCode"]);
   inputParms.Add("subCommodityCode", collection["subCommodityCode"]);
   inputParms.Add("itemNumber", collection["itemNumber"]);
   inputParms.Add("quantity", collection["quantity"]);
   inputParms.Add("accountNumber", collection["accountNumber"]);
   inputParms.Add("overrideCode", collection["overrideCode"]);

   try
   {
       // Send the request
       FusionServiceRequest request = new FusionServiceRequest();
       FusionServiceResult result = request.Post(url, inputParms);

       return View("Result", result);
   }
   catch(Exception e)
   {
       HandleErrorInfo info = new HandleErrorInfo(e, "MyController", "PostInventoryReturn");
       return View("Error", info);
   }
}