Method PostSearchPOs

Summary

Search POs

Remarks

Will return a list of POs that meet the below search criteria. You can search by Vendor number, requisition number, creation date range or change date range.

Requires

Input Parameters

NameTypeLengthDescription
vendorNumber System.String 7 Vendor number to search by.
reqNumber System.String 10 Requisition number to search by.
issueDateFrom mmddyy 6 Search from Date Issued in MMDDYY format.
issueDateTo mmddyy 6 Search to Date Issued in MMDDYY format.
chgDateFrom mmddyy 6 Search from Date Changed in MMDDYY format.
chgDateTo mmddyy 6 Search to Date Changed in MMDDYY format.

Example

POST http://localhost/FusionServices/v3/Naviline/ProductInventory/SearchPOs

Return Values

NameDescription
PONumber Purchase Order number
ChangeOrderNumber Change Order Number
POStatCode PO Status Code
POVendorNumber PO Vendor Number
POVendorName PO Vendor Name
ContractNumber Contract Number
PODateYear PO Date Year
PODateMonth PO Date Month
PODateDay PO Date Day
ChangeDateYear Change Date Year
ChangeDateMonth Change Date Month
ChangeDateDay Change Date Day
POType PO Type
BuyerCode Buyer Code
ConfirmedBy Confirmed By
DeliveryByYear Delivery By Year
DeliveryByMonth Delivery By Month
DeliveryByDay Delivery By Day
ShipToLocCode Ship To Location Code
BillToDefault Bill To Default
ErrorCode 0000=Success
ErrorDescription Error message describing any error that occurred

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v3/Naviline/ProductInventory/SearchPOs";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("vendorNumber",System.Web.HttpUtility.UrlEncode("0002622"));

   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")
   {
        JArray jRows = (JArray)response["Rows"];
        foreach (JObject row in jRows)
        {
             string PONumber = row["PONumber"].ToString();
             string ChangeOrderNumber = row["ChangeOrderNumber"].ToString();
             string POStatCode = row["POStatCode"].ToString();
             string POVendorNumber = row["POVendorNumber"].ToString();
             string POVendorName = row["PIVNM"].ToString();
             string PODateYear = row["PODateYear"].ToString();
             string PODateMonth = row["PODateMonth"].ToString();
             string PODateDay = row["PODateDay"].ToString();
             string ChangeDateYear = row["ChangeDateYear"].ToString();
             string ChangeDateMonth = row["ChangeDateMonth"].ToString();
             string ChangeDateDay = row["ChangeDateDay"].ToString();
             string POType = row["POType"].ToString();
             string BuyerCode = row["BuyerCode"].ToString();
             string ConfirmedBy = row["ConfirmedBy"].ToString();
             string DeliveryByYear = row["DeliveryByYear"].ToString();
             string DeliveryByMonth = row["DeliveryByMonth"].ToString();
             string DeliveryByDay = row["DeliveryByDay"].ToString();
             string ShipToLocCode = row["ShipToLocCode"].ToString();
             string BillToDefault = row["BillToDefault"].ToString();
             // 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 PostSearchPOs
   {
       // Add property for each input param in order to map a field to it
       [RegularExpression("^(?=.{0,7}$).*", ErrorMessage = "Must be 7 characters or less. ")]
       public string vendorNumber{get; set;}

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

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

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

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

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

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

@{
   ViewBag.Title = "PostSearchPOs";
}

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

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

// 
// POST: /MyController/PostSearchPOs
[HttpPost]
public ActionResult PostSearchPOs(FormCollection collection)
{
   string url = "v3/Naviline/ProductInventory/SearchPOs";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("vendorNumber", collection["vendorNumber"]);
   inputParms.Add("reqNumber", collection["reqNumber"]);
   inputParms.Add("issueDateFrom", collection["issueDateFrom"]);
   inputParms.Add("issueDateTo", collection["issueDateTo"]);
   inputParms.Add("chgDateFrom", collection["chgDateFrom"]);
   inputParms.Add("chgDateTo", collection["chgDateTo"]);

   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", "PostSearchPOs");
       return View("Error", info);
   }
}