Method PostAddReceipt

Summary

Add Receipt AssetWorks version

Remarks

AssetWorks version

Requires

Input Parameters

NameTypeLengthDescription
poNumber System.String 6 [Required] Purchase Order number
rcvBy System.String 15 [Required] Received by
rcvDate System.String 6 [Required] Receive date: Numeric right justified zero filled, MMDDYY
lineQuantity System.String 1200 [Required] Line number and quantities: Array of 50 line numbers, quantity, unit cost and return/credit indicator, Each array element is 24 characters long, Line number is 3 long, Numeric right justified zero filled, Quantity is 9 long, Numeric right justified zero filled, 2 decimal positions assumed, Unit cost is 11 long, Numeric right justified zero filled, 4 decimal positions assumed, Return/credit indicator is 1 long, “Y” indicates a return/credit and will cause the positive value in the above quantity field to be converted to a negative number when processing on the NaviLine side., Example of receipting line number 1 with a quantity of 12 unit cost $3.00 and line number 4 for a return with a quantity of 5 unit cost $12.25, 00100000120000000030000N, 00400000050000000122500Y

Example

POST http://localhost/FusionServices/v2/Naviline/ProductInventory/AddReceipt

Return Values

NameDescription
ErrorCode 00000000:Success;0001:Receive by cannot be blanks;0002:Invalid receive date;0003:Invalid PO number;0004:Invalid line number quantity data;0006:Invalid environment parameters
ErrorDescription Success

Sample Responses

Sample Code

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

public void MethodName(parms)
{
   string uri = "http://localhost/FusionServices/v2/Naviline/ProductInventory/AddReceipt";
   System.Collections.Specialized.NameValueCollection postParms = 
     new System.Collections.Specialized.NameValueCollection(); 
   // Set paramater values
   postParms.Add("poNumber",System.Web.HttpUtility.UrlEncode("021015"));
   postParms.Add("rcvBy",System.Web.HttpUtility.UrlEncode("Faith N"));
   postParms.Add("rcvDate",System.Web.HttpUtility.UrlEncode("021318"));
   postParms.Add("lineQuantity",System.Web.HttpUtility.UrlEncode("00100000010000000112345N00200000020000000020022N00300000030000000030033Y"));

   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 PostAddReceipt
   {
       // Add property for each input param in order to map a field to it
       [Required(ErrorMessage = "Required")]
       [RegularExpression("^(?=.{0,6}$).*", ErrorMessage = "Must be 6 characters or less. ")]
       public string poNumber{get; set;}

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

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

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

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

@{
   ViewBag.Title = "PostAddReceipt";
}

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

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

// 
// POST: /MyController/PostAddReceipt
[HttpPost]
public ActionResult PostAddReceipt(FormCollection collection)
{
   string url = "v2/Naviline/ProductInventory/AddReceipt";
   // Get the value from each input field
   NameValueCollection inputParms = new NameValueCollection();
   inputParms.Add("poNumber", collection["poNumber"]);
   inputParms.Add("rcvBy", collection["rcvBy"]);
   inputParms.Add("rcvDate", collection["rcvDate"]);
   inputParms.Add("lineQuantity", collection["lineQuantity"]);

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