Skip to content

Sale Order Service

API ใบสั่งขาย


Header Request

FieldValue
GUIDGUID สำหรับการเชื่อมต่อ (smlx เสมอ)
providerชื่อผู้ใช้บริการ
databaseNameชื่อฐานข้อมูล
configFileNameไฟล์ตั้งค่าผู้ให้บริการ
ใส่ SMLConfig และตามด้วยชื่อผู้ให้บริการ และตามด้วย .xml (SMLConfig___.xml)

Header Example

{
  "GUID" : "smlx"
  "provider" : "DATA"
  "databaseName" : "data1"
  "configFileName" : "SMLConfigDATA.xml"
}

HTTP Response

StatusDescripton
200Success return with data
500Bas Request
401Unauthorize

SaleOrder List

แสดงข้อมูลเอกสารใบสั่งขาย ทั้งหมด

EndPoint

GET /SMLJavaRESTService/saleorder/v4

Query Request

FieldDescription
pagenumber of page
sizepage size

Example:

GET localhost:8084/SMLJavaRESTService/saleorder/v4?page=1&size=2

SaleOrder Information

เป็นการดึงข้อมูลเอกสารใบสั่งขาย มาแสดงทีละ 1 เอกสารโดยจะต้องระบุเลขที่เอกสาร

EndPoint

GET /SMLJavaRESTService/saleorder/v4/{docno}

Path Parameter:

NameDescriptionExample
docnoเลขที่เอกสารSO23020001

example:

GET localhost:8084/SMLJavaRESTService/saleorder/v4/SO23020001

Response Success

{
    "success": true,
    "data": {
        "trans_type": 2,
        "trans_flag": 36,
        "doc_date": "2023-02-27",
        "doc_no": "SO23020001",
        "tax_doc_no": "SO23020001",
        "tax_doc_date": "2023-02-27",
        "inquiry_type": 0,
        "vat_type": 1,
        "cust_code": "AR00016",
        "contactor": "",
        "branch_code": "001",
        "sale_area_code": "",
        "send_type": 0,
        "send_day": 0,
        "credit_day": 0,
        "answer_type": 0,
        "transport_value": 0,
        "vat_rate": 7,
        "currency_code": "",
        "exchange_rate": 0,
        "total_cost": 0,
        "total_value": 150,
        "total_discount": 0,
        "total_vat_value": 9.813,
        "total_after_vat": 150,
        "total_except_vat": 0,
        "total_amount": 150,
        "balance_amount": 0,
        "approve_code": "",
        "status": 0,
        "user_request": "",
        "expire_day": 0,
        "doc_ref_trans": "",
        "credit_date": "2023-02-27",
        "total_before_vat": 140.187,
        "doc_time": "14:19",
        "last_status": 0,
        "not_approve_1": 0,
        "user_approve": "",
        "approve_status": 0,
        "doc_format_code": "SO",
        "creator_code": "RESTAPI",
        "create_datetime": "2023-02-27 14:34:41.000",
        "is_pos": 0,
        "details": [
            {
                "trans_type": 2,
                "trans_flag": 36,
                "doc_date": 1677430800000,
                "doc_no": "SO23020001",
                "item_code": "AC-00014",
                "item_name": "น้ำยาบัดกรี",
                "unit_code": "อัน",
                "qty": 3,
                "price": 50,
                "sum_amount": 150,
                "status": 0,
                "line_number": 0,
                "branch_code": "001",
                "wh_code": "CENTER",
                "shelf_code": "CENTER",
                "total_vat_value": 9.81,
                "calc_flag": 1,
                "last_status": 0,
                "tax_type": 0,
                "is_permium": 0,
                "sum_amount_exclude_vat": 140.187,
                "discount_amount": 0,
                "price_exclude_vat": 46.73
            }
        ]
    }
}

Response Error

  {
    "error": true,
    "code": "99",
    "message": "error message"
  }

Add SaleOrder

สร้างเอกสารใบสั่งขาย

EndPoint

POST /SMLJavaRESTService/saleorder/v4

Body Data:

JSON body with SaleOrder Request Attribute

example:

json
{
    "doc_no": "SO23020001",
    "doc_date": "2023-02-27",
    "doc_time": "14:19",
    "doc_format_code": "SO",
    "doc_ref": "",
    "doc_ref_date": null,
    "doc_group": "",
    "cust_code": "AR00016",
    "cust_name": "",
    "contactor": "",
    "tax_doc_no": "SO23020001",
    "tax_doc_date": "2023-02-27",
    "inquiry_type": 0,
    "vat_type": 1,
    "vat_rate": 7,
    "sale_code": "S001",
    "sale_group": "",
    "branch_code": "001",
    "department_code": "",
    "allocate_code": "",
    "project_code": "",
    "job_code": "",
    "side_code": "",
    "send_type": 0,
    "send_day": 0,
    "send_date": null,
    "credit_day": 30,
    "credit_date": "2023-03-29",
    "expire_day": 0,
    "expire_date": null,
    "on_hold": 0,
    "approve_code": "",
    "user_request": "",
    "cashier_code": "",
    "discount_word": "",
    "total_value": 150,
    "total_discount": 0,
    "total_before_vat": 140.187,
    "total_vat_value": 9.813,
    "total_after_vat": 150,
    "total_except_vat": 0,
    "total_amount": 150,
    "remark": "",
    "remark_2": "",
    "remark_3": "",
    "remark_4": "",
    "remark_5": "",
    "details": [
        {
            "line_number": 0,
            "item_code": "AC-00014",
            "barcode": "",
            "unit_code": "อัน",
            "qty": 3,
            "price": 50,
            "discount": "",
            "discount_amount": 0,
            "sum_amount": 150,
            "sum_amount_exclude_vat": 140.187,
            "price_exclude_vat": 46.729,
            "vat_amount": 9.813,
            "tax_type": 0,
            "wh_code": "CENTER",
            "shelf_code": "CENTER",
            "ref_doc_no": "",
            "due_date": null,
            "lot_number_1": "",
            "remark": "",
            "is_permium": 0,
            "is_get_price": 1
        }
    ]
}

Response Success

{
    "success": true,
    "data": {
        "code": "SO23020001"
    }
}

Response Error

  {
    "error": true,
    "code": "99",
    "message": "error message"
  }

Update Approve Status

อัปเดตสถานะการอนุมัติเอกสารใบสั่งขาย (approve_status = 1)

EndPoint

POST /SMLJavaRESTService/saleorder/v4/updateapprovestatus

Body Data:

FieldTypeDescription
docNoStringเลขที่เอกสาร

example:

{
    "docNo": "SO23020001"
}

Response Success

{
    "success": true,
    "data": {
        "trans_type": 2,
        "trans_flag": 36,
        "doc_no": "SO23020001",
        "approve_status": 1,
        ...
    }
}

Response Error

{
    "error": true,
    "code": "98",
    "message": "Not Found Sale Order : SO23020001"
}

SaleOrder Attribute

ฟิลด์ที่ระบุ (required) คือฟิลด์ที่ต้องส่งใน POST request

Field NameField TypeLengthDescription
adjust_reasonString25เหตุผลการปรับปรุง
advance_amountFloatตัดเงินมัดจำ
allocate_codeString25การจัดสรร
allocate_code_toString25ถึงการจัดสรร
answer_typeIntegerลูกค้าตอบกลับ
approve_codeString25กลุ่มผู้อนุมัติ
approve_dateDateวันที่อนุมัติ
approve_statusIntegerสถานะการอนุมัติ
auto_approvedIntegerอนุมัติโดยอัตโนมัติ
auto_createIntegerสร้างโดยโปรแกรม
balance_amountFloatยอดเงินคงเหลือ
branch_codeString25สาขา
branch_code_toString25ถึงสาขา
cancel_codeString255ผู้ยกเลิกเอกสาร
cancel_datetimeDateเวลายกเลิกเอกสาร
cancel_typeIntegerประเภทการยกเลิก
cashier_codeString25Cashier
contactorString25ผู้ติดต่อ
create_datetimeDateวันที่สร้างเอกสาร
creator_codeString255ผู้สร้างเอกสาร
credit_dateDateวันที่ครบกำหนด
credit_dayIntegerวันเครดิต
currency_codeString25รหัสสกุลเงิน
currency_moneyFloatยอดคงเหลือ (ตามสกุลเงิน)
cust_codeString25ลูกหนี้/เจ้าหนี้ (required)
cust_nameString255ชื่อลูกหนี้/เจ้าหนี้
delivery_dateDateวันที่ส่งของ
department_codeString25แผนก
department_code_toString25ถึงแผนก
deposit_dateDateระยะเวลาภายใน (วันที่)
deposit_dayIntegerระยะเวลาภายใน (วัน)
discount_wordString25ส่วนลด
discount_word_2String50ส่วนลด (สกุลเงิน)
doc_closeIntegerปิดเอกสาร
doc_dateDateเอกสารวันที่ (required)
doc_format_codeString25รหัสเอกสาร
doc_groupString25กลุ่มเอกสาร
doc_noString25เอกสารเลขที่ (required)
doc_no_guidString25เลขที่เอกสารเปรียบเทียบ
doc_reasonString500เหตุผล
doc_refString255เอกสารอ้างอิง
doc_ref_dateDateเอกสารอ้างอิงวันที่
doc_ref_transString25อ้างอิงเอกสาร
doc_ref_typeStringประเภทเอกสารอ้างอิง
doc_successIntegerสิ้นสุด
doc_timeString5เวลา (HH:mm)
doc_typeIntegerประเภทเอกสาร
due_dateDateวันที่ครบกำหนด
exchange_rateFloatอัตราแลกเปลี่ยน
expire_dateDateวันที่หมดอายุ
expire_dayIntegerจำนวนวันหมดอายุ
expire_statusIntegerสถานะหมดอายุ
extra_wordString100ข้อความเพิ่มเติม
guid_codeStringGUID
inquiry_typeIntegerประเภทรายการ
is_cancelIntegerเอกสารยกเลิก
is_doc_copyIntegerเป็นเอกสารที่ออกแทน
is_holdIntegerระงับเอกสาร
is_manual_vatIntegerบันทึกรายการภาษีเอง
is_posIntegerจากระบบ POS (default: 0)
job_codeString25งาน
job_code_toString25ถึงงาน
last_editor_codeString255ผู้แก้ไขเอกสารล่าสุด
last_statusIntegerสถานะล่าสุด
lastedit_datetimeDateวันที่แก้ไขล่าสุด
location_fromStringพื้นที่เก็บ (ต้นทาง)
location_toStringพื้นที่เก็บ (ปลายทาง)
lost_profit_exchange_amountFloatผลต่างจากอัตราแลกเปลี่ยน
member_codeString25รหัสสมาชิก
moneyFloatจำนวนเงินคืน
not_approve_1Integerไม่อนุมัติ
on_holdIntegerระงับชั่วคราว
pass_book_codeStringสมุดเงินฝาก
pay_amountFloatเงินชำระ
period_guidString50GUID กะ
point_telephoneStringหมายเลขโทรศัพท์
pos_bill_changeInteger0=ปรกติ, 1=ใบแทน
pos_bill_typeInteger0=อย่างย่อ, 1=อย่างเต็ม
pos_idStringหมายเลขเครื่อง POS
pos_transferIntegerโอนมาจาก POS
project_codeString25โครงการ
project_code_toString25ถึงโครงการ
recheck_countIntegerเปิดระบบเตือนตรวจนับซ้ำ
recheck_count_dayFloatเตือนย้อนหลัง (วัน)
ref_amountFloatมูลค่าเอกสารเดิม
ref_diffFloatผลต่าง
ref_new_amountFloatมูลค่าที่ถูกต้อง
remarkString255หมายเหตุ
remark_2String255หมายเหตุ 2
remark_3String255หมายเหตุ 3
remark_4String255หมายเหตุ 4
remark_5String255หมายเหตุ 5
sale_area_codeString25เขตการขาย
sale_codeString25พนักงานขาย
sale_groupString25กลุ่มพนักงานขาย
sale_shift_idString50รอบการขาย
send_dateDateวันที่รับ/ส่งสินค้า
send_dayIntegerรับ/ส่ง ภายใน (วัน)
send_mailIntegerแจ้งส่งทางอีเมล์
send_smsIntegerแจ้งส่งทาง SMS
send_to_pick_and_packIntegerสั่งจัดสินค้า
send_typeIntegerประเภทการส่ง
sender_codeString25พนักงานขนส่ง
service_charge_wordString25Service Charge
side_codeString25ฝ่าย
side_code_toString25ถึงฝ่าย
statusIntegerสถานะ
sum_pay_money_diffFloatผลต่างยอดชำระ
sum_pointFloatแต้ม
sum_point_2Floatยอดแต้มสะสมระบบกลาง
table_numberString25หมายเลขโต๊ะ
tax_doc_dateDateวันที่ใบกำกับ
tax_doc_noString25เลขที่ใบกำกับ
total_after_vatFloatมูลค่าหลังคิดภาษี
total_amountFloatมูลค่าสุทธิ (required)
total_amount_2Floatมูลค่าสุทธิ (สกุลเงิน)
total_amout_oldFloatมูลค่าสุทธิเดิม
total_before_vatFloatยอดก่อนภาษี
total_costFloatต้นทุนสินค้า
total_debt_amountFloatยอดหนี้รวมภาษี
total_discountFloatมูลค่าส่วนลด
total_discount_2Floatมูลค่าส่วนลด (สกุลเงิน)
total_except_vatFloatมูลค่ายกเว้นภาษี
total_manualIntegerบันทึกยอดรวมเอง
total_service_chargeFloatมูลค่า Service Charge
total_vat_valueFloatภาษีมูลค่าเพิ่ม
total_valueFloatมูลค่าสินค้า (required)
total_value_2Floatมูลค่าสินค้า (สกุลเงิน)
trans_flagIntegerรายวันระบบ (36 = ใบสั่งขาย, auto)
trans_typeIntegerประเภทรายวัน (2 = ขาย, auto)
transport_codeString25ขนส่งโดย
transport_valueFloatค่าขนส่ง
used_statusIntegerมีการอ้างอิงแล้ว
used_status_2Integerสถานะ 2
user_approveString25ผู้อนุมัติ
user_requestString25ผู้ขออนุมัติ
vat_rateFloatอัตราภาษี
vat_typeIntegerประเภทภาษี (0=ไม่มีภาษี, 1=แยกนอก, 3=รวมใน)
want_dateDateต้องการภายใน (วันที่)
want_dayIntegerต้องการภายใน (วัน)
wh_fromString25คลัง (ต้นทาง)
wh_toString25คลัง (ปลายทาง)
detailsArrayObjectรายละเอียดสินค้า

SaleOrder Detail

ฟิลด์ที่ระบุ (required) คือฟิลด์ที่ต้องส่งใน POST request

Field NameField TypeLengthDescription
auto_createIntegerสร้างโดยโปรแกรม
average_costFloatราคาทุนเฉลี่ย
average_cost_1Floatราคาทุนเฉลี่ยแฝง
bank_branchStringสาขาธนาคาร
bank_branch_2Stringสาขาธนาคาร 2
bank_nameStringธนาคาร
bank_name_2Stringธนาคาร 2
barcodeString25Barcode
bat_dateDatebat date
bat_numberStringbat number
branch_codeString25สาขา
calc_flagIntegerบวกหรือลบ (1=บวก, -1=ลบ, default: -1)
cancel_qtyFloatจำนวนยกเลิก
chq_numberStringเลขที่เช็ค
create_datetimeDateวันที่สร้างเอกสาร
creator_codeString25ผู้สร้างเอกสาร
currency_codeString25สกุลเงิน
cust_codeString25ลูกหนี้/เจ้าหนี้
date_dueDateวันครบกำหนด
date_expireDateหมดอายุ
department_codeString25แผนก
discountString25ส่วนลด
discount_amountFloatมูลค่าส่วนลด
discount_amount_2Floatมูลค่าส่วนลด (สกุลเงิน)
discount_changedIntegerมีการแก้ไขส่วนลด
discount_numberIntegerหมายเลขส่วนลด
divide_valueFloatตัวหาร
doc_dateDateเอกสารวันที่
doc_date_calcDateวันที่สำหรับคำนวณ
doc_groupString25กลุ่มเอกสาร
doc_noString25เอกสารเลขที่
doc_refString25เอกสารอ้างอิง
doc_ref_typeIntegerประเภทเอกสารอ้างอิง
doc_timeString5เวลา
doc_time_calcStringเวลาสำหรับคำนวณ
due_dateDateวันที่ต้องการ
exchange_rateFloatอัตราแลกเปลี่ยน
exchange_rate_oldFloatอัตราแลกเปลี่ยนเดิม
fee_amountFloatค่าธรรมเนียม
hidden_cost_1Floatต้นทุนแฝงบริหาร
hidden_cost_1_exclude_vatFloatต้นทุนแฝงบริหารไม่รวมภาษี
hidden_cost_2Floatต้นทุนแฝงบัญชี
hidden_cost_2_exclude_vatFloatต้นทุนแฝงบัญชีไม่รวมภาษี
ic_colorString25สีสินค้า
ic_patternString25รูปแบบสินค้า
ic_sizeString25ขนาดสินค้า
inquiry_typeIntegerประเภทการขาย
is_doc_copyIntegerเป็นเอกสารที่ออกแทน
is_get_priceIntegerให้ดึงราคาขาย (1=ดึง)
is_lock_costIntegerกำหนดต้นทุนเอง
is_permiumInteger1=ของแถม
is_posIntegerจาก POS
is_serial_numberIntegerมีหมายเลขเครื่อง
item_codeString25รหัสสินค้า (required)
item_code_2String25รหัสสินค้า 2
item_code_mainString25สินค้าหลัก
item_nameString255ชื่อสินค้า
item_typeIntegerประเภทสินค้า
last_editor_codeString25ผู้แก้ไขเอกสารล่าสุด
last_statusIntegerสถานะล่าสุด (0=Normal, 1=ยกเลิก)
lastedit_datetimeDateวันที่แก้ไขล่าสุด
line_numberIntegerบรรทัด
lot_number_1Stringเลข LOT
mfd_dateDateวันที่ผลิต
mfn_codeString50รหัสผู้ผลิต
mfn_nameStringผู้ผลิต
priceFloatราคา (required)
price_2Floatราคา (สกุลเงิน)
price_baseFloatราคากลาง
price_changedIntegerมีการแก้ไขราคา
price_defaultFloatราคาเริ่มต้น
price_exclude_vatFloatราคาไม่รวมภาษี
price_guidStringPrice Guid
price_modeIntegerกลุ่มราคา
price_set_ratioFloatอัตราส่วนราคาสินค้าชุด
price_typeIntegerประเภทราคา
priority_levelIntegerความสำคัญ
product_weekStringสัปดาห์ที่ผลิต
product_yearStringปีที่ผลิต
profit_lost_cost_amountFloatกำไรขาดทุน
promotion_codeString50รหัสโปรโมชั่น
qtyFloatจำนวน (required)
qty_2Floatจำนวนขาย
ratioFloatอัตราส่วน
ref_cust_codeString25อ้างอิง เจ้าหนี้/ลูกหนี้
ref_doc_dateDateอ้างอิง วันที่
ref_doc_noString25อ้างอิงเอกสาร
ref_guidStringref_guid
ref_line_numberIntegerอ้างอิง บรรทัด
ref_rowIntegerref_row
remarkString255หมายเหตุ
sale_codeString25รหัสพนักงานขาย
sale_groupString25กลุ่มพนักงานขาย
sale_shift_idString50รอบการขาย
set_ref_lineStringบรรทัดอ้างอิง (สินค้าชุด)
set_ref_priceFloatราคาอ้างอิง (สินค้าชุด)
set_ref_qtyFloatจำนวนอ้างอิง (สินค้าชุด)
shelf_codeString25พื้นที่เก็บ (required)
shelf_code_2String25พื้นที่เก็บ 2
stand_valueFloatตัวตั้ง
statusIntegerสถานะ
sum_amountFloatรวมมูลค่า (required)
sum_amount_2Floatรวมมูลค่า (สกุลเงิน)
sum_amount_exclude_vatFloatรวมมูลค่าไม่รวมภาษี
sum_of_costFloatรวมต้นทุน
sum_of_cost_1Floatต้นทุนรวมต้นทุนแฝงบริหาร
sum_of_cost_fixFloatต้นทุน (กำหนดเอง)
tax_typeIntegerประเภทภาษี (0=มีภาษี, 1=ยกเว้น)
temp_float_1Floatตัวเลข 1
temp_float_2Floatตัวเลข 2
temp_string_1Stringตัวอักษร 1
total_qtyFloatจำนวนคงเหลือ
total_sizeFloatรวมหน่วยนับ 2
total_vat_valueFloatภาษีมูลค่าเพิ่ม
trans_flagIntegerรายวันระบบ (36 = ใบสั่งขาย, auto)
trans_typeIntegerประเภทรายวัน (2 = ขาย, auto)
transfer_amountFloatยอดโอนเงิน
unit_codeString25หน่วยนับ (required)
unit_code_2String25หน่วยช่วยขาย
unit_sizeFloatขนาดสินค้า
user_approveString25รหัสผู้อนุมัติ
vat_typeIntegerประเภทภาษี (0=แยกนอก, 1=รวมใน, 2=อัตรา 0)
wh_codeString25คลัง (required)
wh_code_2String25คลัง 2