Method PostInventoryIssue

Summary

Inventory Issue

Remarks

This method allows the user to perform one of six possible ISSUE 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 ISSUE request.

Input Parameters

NameTypeLengthDescription
action System.String 1 [Required] Action Code. Valid values are: R - to request a new ISSUE ticket number, A - to add a line item to the ISSUE ticket), O - to add a line item with override (s) to the ISSUE ticket, C - to complete the ISSUE 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
failureCode System.String 4 Failure Code
overrideCode System.String 40 Override Code Array

Example

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

Return Values

NameDescription
IN_ISSUE# 0163420
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/InventoryIssue";
   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 PostInventoryIssue
   {
       // 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,4}$).*", ErrorMessage = "Must be 4 characters or less. ")]
       public string failureCode{get; set;}

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

       public PostInventoryIssue()
       {
           //Set any defaults here
       }
   }
}
@* NOTE: Use Add->View to add the View. *@
@* NOTE: Check the 'Create strongly-typed view checkbox, and select the PostInventoryIssue 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.PostInventoryIssue

@{
   ViewBag.Title = "PostInventoryIssue";
}

<h2>PostInventoryIssue</h2>
@using (Html.BeginForm()) {
   @Html.AntiForgeryToken()
   @Html.ValidationSummary(true)
   <fieldset>
   <legend>PostInventoryIssue</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.failureCode)
       </div>
       <div class="editor-field">
           @Html.EditorFor(model => model.failureCode)
           @Html.ValidationMessageFor(model => model.failureCode)
       </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/PostInventoryIssue
public ActionResult PostInventoryIssue()
{
   // Create a new instance of the model to pick up any default values.
   PostInventoryIssue model =  new PostInventoryIssue();

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

// 
// POST: /MyController/PostInventoryIssue
[HttpPost]
public ActionResult PostInventoryIssue(FormCollection collection)
{
   string url = "v3/Naviline/BarCode/InventoryIssue";
   // 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("failureCode", collection["failureCode"]);
   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", "PostInventoryIssue");
       return View("Error", info);
   }
}