Skip to content

Purchase Order (ใบสั่งซื้อ)

List Purchase Order

เป็นการแสดงรายการใบสั่งซื้อ

EndPoint

GET /SMLJavaRESTService/v3/api/purchaseorderGET /SMLJavaRESTService/v3/api/purchaseorder/{doc_no}

Header

Required SMLRequestHeader

Query Parameter

Transaction Query Paremeter

example:

GET http://localhost:8086/SMLJavaRESTService/v3/api/purchaseorder?from_date=2020-01-01&to_date=2020-01-02

GET http://localhost:8086/SMLJavaRESTService/v3/api/purchaseorder/PO6301-0020

Response Success:

JSON
{
	"success": true,
	"data": [
		{
			"doc_no": "PO6301-0020",
			"doc_date": "2020-01-15",
			"doc_time": "08:00",
			"cust_code": "AP01-011",
			"supplier_name": "บริษัท บางกอก ดิสทริบิวเตอร์ จำกัด",
			"total_value": 73212.0,
			"discount_word": "2196.36",
			"total_discount": 2196.36,
			"total_before_vat": 71015.64,
			"vat_rate": 7.0,
			"total_vat_value": 4971.09,
			"total_amount": 75986.73,
			"items": [
				{
					"doc_date": 1579107600000,
					"item_code": "3-P-01",
					"item_name": "ปีโป้ สตอเบอรี่ 230 มล.",
					"unit_code": "ลัง",
					"qty": 200.0,
					"price": 366.06,
					"discount_amount": 0,
					"sum_amount": 73212.0,
					"is_permium": 0,
					"line_number": 0,
					"tax_type": 0
				}
			]
		}
	],
	"pages": {
		"size": 20,
		"page": 1,
		"total_record": 12,
		"max_page": 1
	}
}

New Purchase Order

เป็นการสร้างรายการสั่งซื้อสินค้า

EndPoint

POST /SMLJavaRESTService/v3/api/purchaseorder

Parameter:

Request Header:

NameDescription
GUIDGUID สำหรับการเชื่อมต่อ (smlx เสมอ)
providerรหัสผู้ใช้บริการ
databaseNameชื่อฐานข้อมูล

Body Data:

JSON body with Transaction Attrubte

example

JSON
{
  "doc_no": "PO1701NASTEST3",
  "approve_status": 0,
  "not_approve_1": 0,
  "user_approve": "",
  "user_request": "SUPERADMIN",
  "doc_date": "2022-01-02",
  "doc_time": "12:46",
  "cust_code": "AP001",
  "supplier_name": "บริษัท แอล.เจ.อาร์.อินดัสตรี จำกัด",
  "vat_type": 1,
  "total_value": 180.00,
  "total_discount": 0,
  "total_before_vat": 168.22,
  "vat_rate": 7.00,
  "total_vat_value": 11.78,
  "total_amount": 180.00,
  "branch_code": "001",
  "total_after_vat": 180.00,
  "total_except_vat": 0,
  "items": [
    {
      "item_code": "BT-00002",
      "item_name": "สายสัญญาณ 20M",
      "unit_code": "ม้วน",
      "qty": 1.00,
      "price": 180.00,
      "discount_amount": 0,
      "sum_amount": 180.00,
      "is_permium": 0,
      "line_number": 0,
      "tax_type": 0
    }
  ]
}

Response:

Response Success

HTTP Status : 201

Response Success JSON Message

json
{
    "status" :  "success", 
    "message" : "create success"
}

Response Error

HTTP Status : 400

Response Success JSON Message

json
{
    "status" :  "error",
    "message" : "Message Error"
}