Megaventory API v2017a

<back to all web services

WorkOrderClose

The following routes are available for this service:
POST/WorkOrder/WorkOrderCloseCloses a work order.Uses your API Key and closes the WorkOrder specified by the WorkOrderId, only if the WorkOrder is fully received. If the WorkOrder specified has slack quantity, by setting ReturnSlackQuantity field to true, when WorkOrder closes, the exceed quantity of the product will be returned. Optionally, you can use mvInsertUpdateDeleteSourceApplication when an external application ( eg WooCommerce ) is the one that triggers the WorkOrderClose call.

Examples:



A.

Close a fully received Work Order with Id 15863 that has slack quantity on the finished good without returning the exceed quantity of it and add some comments to describe it.

Value:

 {
  "WorkOrderId": 15863,
  "Comments": "Work Order closed.",
  "ReturnSlackQuantity": false
}  


Response:

{
  "mvWorkOrder": {
    "WorkOrderId": 15863,
    "WorkOrderTypeId": -8,
    "WorkOrderFinishedGoodTypeId": -9,
    "WorkOrderTypeAbbreviation": "WO",
    "WorkOrderTypeDescription": "Work order",
    "WorkOrderNo": "54",
    "WorkOrderFinishedGoodSKU": "Finished Good 1",
    "WorkOrderStartDate": "/Date(1685394000000-0000)/",
    "WorkOrderDueDate": "/Date(-62135596800000-0000)/",
    "WorkOrderPriority": "Medium",
    "WorkOrderCurrencyCode": "EUR",
    "WorkOrderInventoryLocationID": 4442,
    "WorkOrderComments": "",
    "WorkOrderTags": "",
    "WorkOrderReferenceNo": "",
    "WorkOrderReferenceApplication": "",
    "TopLevelWorkOrderId": 0,
    "WorkOrderOrderedQuantity": 20,
    "WorkOrderReceivedQuantity": 24,
    "WorkOrderTotalMaterialCost": 99.572588679,
    "WorkOrderTotalLabourCost": 0,
    "WorkOrderTotalOverheadCost": 0,
    "WorkOrderFinishedGoodUnitCost": 4.148857862,
    "WorkOrderDetails": [
      {
        "WorkOrderBOMRowProductSKU": "Material 1",
        "WorkOrderBOMRowProductDescription": "This material is used to construct the finished good",
        "WorkOrderBOMRowProductVariant": "",
        "WorkOrderBOMRowOrderedQuantity": 40,
        "WorkOrderBOMRowTotalAllocatedQuantity": 0,
        "WorkOrderBOMRowProductQuantityUnit": "Kg",
        "WorkOrderBOMRowRemarks": "",
        "WorkOrderRowAllocatedDetails": [
          {
            "WorkOrderBOMRowAllocatedQuantity": 40,
            "WorkOrderBOMRowAllocatedDateTime": "/Date(1685436151380-0000)/",
            "WorkOrderBOMRowAllocatedDateTimeFormatted": ""
          }
        ]
      },
      {
        "WorkOrderBOMRowProductSKU": "Material 2",
        "WorkOrderBOMRowProductDescription": "This material is used to construct the finished good",
        "WorkOrderBOMRowProductVariant": "",
        "WorkOrderBOMRowOrderedQuantity": 60,
        "WorkOrderBOMRowTotalAllocatedQuantity": 0,
        "WorkOrderBOMRowProductQuantityUnit": "",
        "WorkOrderBOMRowRemarks": "",
        "WorkOrderRowAllocatedDetails": [
          {
            "WorkOrderBOMRowAllocatedQuantity": 4,
            "WorkOrderBOMRowAllocatedDateTime": "/Date(1685436306213-0000)/",
            "WorkOrderBOMRowAllocatedDateTimeFormatted": ""
          },
          {
            "WorkOrderBOMRowAllocatedQuantity": 4,
            "WorkOrderBOMRowAllocatedDateTime": "/Date(1685438198027-0000)/",
            "WorkOrderBOMRowAllocatedDateTimeFormatted": ""
          },
          {
            "WorkOrderBOMRowAllocatedQuantity": 52,
            "WorkOrderBOMRowAllocatedDateTime": "/Date(1685438371487-0000)/",
            "WorkOrderBOMRowAllocatedDateTimeFormatted": ""
          }
        ]
      }
    ],
    "WorkOrderStatus": "Closed",
    "WorkOrderCreationDate": "/Date(1685434175397-0000)/",
    "WorkOrderLastUpdatedDate": "/Date(1685455866974+0300)/"
  },
  "ResponseStatus": {
    "ErrorCode": "0"
  },
  "entityID": 15863
}  
 

To override the Content-type in your clients HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /csv/reply/WorkOrderClose HTTP/1.1 
Host: api.megaventory.com 
Content-Type: text/csv
Content-Length: length

APIKEY,WorkOrderId,Comments,ReturnSlackQuantity,mvInsertUpdateDeleteSourceApplication
String,0,String,False,String

HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

WorkOrderId,WorkOrderTypeId,WorkOrderFinishedGoodTypeId,WorkOrderTypeAbbreviation,WorkOrderTypeDescription,WorkOrderNo,WorkOrderFinishedGoodSKU,WorkOrderStartDate,WorkOrderDueDate,WorkOrderPriority,WorkOrderCurrencyCode,WorkOrderInventoryLocationID,WorkOrderComments,WorkOrderTags,WorkOrderReferenceNo,WorkOrderReferenceApplication,TopLevelWorkOrderId,WorkOrderOrderedQuantity,WorkOrderReceivedQuantity,WorkOrderTotalMaterialCost,WorkOrderTotalLabourCost,WorkOrderTotalOverheadCost,WorkOrderFinishedGoodUnitCost,WorkOrderDetails,WorkOrderStatus,WorkOrderCreationDate,WorkOrderLastUpdatedDate
0,0,0,String,String,String,String,0001-01-01,0001-01-01,Medium,String,0,String,String,String,String,0,0,0,0,0,0,0,"[{WorkOrderBOMRowProductSKU:String,WorkOrderBOMRowProductDescription:String,WorkOrderBOMRowProductVariant:String,WorkOrderBOMRowOrderedQuantity:0,WorkOrderBOMRowTotalAllocatedQuantity:0,WorkOrderBOMRowProductQuantityUnit:String,WorkOrderBOMRowRemarks:String,WorkOrderRowAllocatedDetails:[{WorkOrderBOMRowAllocatedQuantity:0,WorkOrderBOMRowAllocatedDateTime:0001-01-01,WorkOrderBOMRowAllocatedDateTimeFormatted:String,WorkOrderBOMRowAllocatedSerialNumbers:[String],WorkOrderBOMRowAllocatedBatchNumbers:[{BatchNumberName:String,ExpiryDate:0001-01-01,AssignedQTYInDetail:0}]}]}]",Pending,0001-01-01,0001-01-01