Megaventory API v2017a

<back to all web services

WorkOrderCancel

The following routes are available for this service:
POST/WorkOrder/WorkOrderCancelCancels a work order.Uses your API Key and cancels the specified Work Order if its status is InProcess or InProcessPartiallyCompleted. Optionally, you can use mvInsertUpdateDeleteSourceApplication when an external application ( eg WooCommerce ) is the one that triggers the WorkOrderCancel call.

Examples:



A.

Cancel Work Order with Id 15863 and add some comments to describe it.

Value:

 {
  "WorkOrderId": 15863,
  "Comments": "Work Order cancelled."
}  


Response:

{
  "mvWorkOrder": {
    "WorkOrderId": 67815,
    "WorkOrderTypeId": -8,
    "WorkOrderFinishedGoodTypeId": -9,
    "WorkOrderTypeAbbreviation": "WO",
    "WorkOrderTypeDescription": "Work order",
    "WorkOrderNo": "50",
    "WorkOrderFinishedGoodSKU": "Finished Good 1",
    "WorkOrderStartDate": "/Date(1684443600000-0000)/",
    "WorkOrderDueDate": "/Date(-62135596800000-0000)/",
    "WorkOrderPriority": "Medium",
    "WorkOrderCurrencyCode": "USD",
    "WorkOrderInventoryLocationID": 4442,
    "WorkOrderComments": "",
    "WorkOrderTags": "",
    "WorkOrderReferenceNo": "",
    "WorkOrderReferenceApplication": "",
    "TopLevelWorkOrderId": 0,
    "WorkOrderOrderedQuantity": 10,
    "WorkOrderReceivedQuantity": 0,
    "WorkOrderTotalMaterialCost": 0,
    "WorkOrderTotalLabourCost": 0,
    "WorkOrderTotalOverheadCost": 0,
    "WorkOrderFinishedGoodUnitCost": 0,
    "WorkOrderDetails": [
      {
        "WorkOrderBOMRowProductSKU": "Material 1",
        "WorkOrderBOMRowProductDescription": "This material is used to construct the finished good",
        "WorkOrderBOMRowProductVariant": "",
        "WorkOrderBOMRowOrderedQuantity": 20,
        "WorkOrderBOMRowTotalAllocatedQuantity": 0,
        "WorkOrderBOMRowProductQuantityUnit": "Kg",
        "WorkOrderBOMRowRemarks": "",
        "WorkOrderRowAllocatedDetails": []
      },
      {
        "WorkOrderBOMRowProductSKU": "Material 2",
        "WorkOrderBOMRowProductDescription": "This material is used to construct the finished good",
        "WorkOrderBOMRowProductVariant": "",
        "WorkOrderBOMRowOrderedQuantity": 10,
        "WorkOrderBOMRowTotalAllocatedQuantity": 0,
        "WorkOrderBOMRowProductQuantityUnit": "",
        "WorkOrderBOMRowRemarks": "",
        "WorkOrderRowAllocatedDetails": []
      }
    ],
    "WorkOrderStatus": "Cancelled",
    "WorkOrderCreationDate": "/Date(1684505779493-0000)/",
    "WorkOrderLastUpdatedDate": "/Date(1685463400826+0300)/"
  },
  "ResponseStatus": {
    "ErrorCode": "0"
  },
  "entityID": 15863
}
 

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

HTTP + JSV

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

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

{
	APIKEY: String,
	WorkOrderId: 0,
	Comments: String,
	mvInsertUpdateDeleteSourceApplication: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	mvWorkOrder: 
	{
		WorkOrderId: 0,
		WorkOrderTypeId: 0,
		WorkOrderFinishedGoodTypeId: 0,
		WorkOrderTypeAbbreviation: String,
		WorkOrderTypeDescription: String,
		WorkOrderNo: String,
		WorkOrderFinishedGoodSKU: String,
		WorkOrderStartDate: 0001-01-01,
		WorkOrderDueDate: 0001-01-01,
		WorkOrderPriority: Medium,
		WorkOrderCurrencyCode: String,
		WorkOrderInventoryLocationID: 0,
		WorkOrderComments: String,
		WorkOrderTags: String,
		WorkOrderReferenceNo: String,
		WorkOrderReferenceApplication: String,
		TopLevelWorkOrderId: 0,
		WorkOrderOrderedQuantity: 0,
		WorkOrderReceivedQuantity: 0,
		WorkOrderTotalMaterialCost: 0,
		WorkOrderTotalLabourCost: 0,
		WorkOrderTotalOverheadCost: 0,
		WorkOrderFinishedGoodUnitCost: 0,
		WorkOrderDetails: 
		[
			{
				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
							}
						]
					}
				]
			}
		],
		WorkOrderStatus: Pending,
		WorkOrderCreationDate: 0001-01-01,
		WorkOrderLastUpdatedDate: 0001-01-01
	},
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String
			}
		]
	},
	entityID: 0,
	InternalErrorCode: String
}