Skip to content

Request Take Out Item Service

API ขอเบิกสินค้า/วัตถุดิบ (trans_flag = 122, trans_type = 3)


Header Request

FieldValue
GUIDGUID สำหรับการเชื่อมต่อ (smlx เสมอ)
providerชื่อผู้ใช้บริการ
databaseNameชื่อฐานข้อมูล
configFileNameชื่อไฟล์ตั้งค่า — รูปแบบ SMLConfig<provider>.xml
Content-Typeapplication/json; charset=utf-8

Header Example

json
{
  "GUID": "smlx",
  "provider": "DATA",
  "databaseName": "data1",
  "configFileName": "SMLConfigDATA.xml",
  "Content-Type": "application/json; charset=utf-8"
}

HTTP Response

Statusความหมาย
200สำเร็จ
400ข้อมูลผิดพลาด (code = 99) เช่น เลขที่เอกสารซ้ำ / ข้อมูลที่จำเป็นไม่ครบ — ดูสาเหตุจริงใน message
404ไม่พบเอกสารตามเลขที่ที่ระบุ (code = 404) หรือเรียก URL / path ไม่ถูกต้อง
405ใช้ HTTP method ไม่ถูกต้อง
500payload ผิดรูป หรือข้อผิดพลาดภายในระบบ

RequestTakeOutItem List

แสดงข้อมูลเอกสารขอเบิกสินค้า/วัตถุดิบ ทั้งหมด

EndPoint

GET /SMLJavaRESTService/requesttakeoutitem/v4

Query Request

FieldDescriptionExample
dateกรองเฉพาะวันเดียว2026-09-15
from_dateตั้งแต่วันที่ (≥) — ใช้คู่กับ to_date ได้2026-09-01
to_dateจนถึงวันที่ (≤) — ใช้คู่กับ from_date ได้2026-09-30
cust_codeรหัสลูกหนี้/เจ้าหนี้AR00016
sale_codeรหัสพนักงานขายS001
pay_typecash = inquiry_type 1, credit = 0cash
doc_noเลขที่เอกสาร (ค้นแบบตรงตัว)WD69090001
last_statusสถานะเอกสาร (0 = ปกติ) ไม่ส่ง = ไม่กรอง0
pageหน้าที่ (เริ่ม 1)1
sizeจำนวนต่อหน้า10

หมายเหตุ: ถ้าส่ง date มาแล้ว ระบบจะใช้ date ก่อน (ไม่สนใจ from_date/to_date)

Example:

GET localhost:8086/SMLJavaRESTService/requesttakeoutitem/v4?page=1&size=10
GET localhost:8086/SMLJavaRESTService/requesttakeoutitem/v4?from_date=2026-09-01&to_date=2026-09-30&page=1&size=10
GET localhost:8086/SMLJavaRESTService/requesttakeoutitem/v4?last_status=0&page=1&size=10
GET localhost:8086/SMLJavaRESTService/requesttakeoutitem/v4?doc_no=WD69090004&page=1&size=10

Response Success

ตัวอย่างด้านล่างคือผลของ ?doc_no=WD69090004&page=1&size=10

json
{
    "success": true,
    "data": [
        {
            "trans_type": 3,
            "trans_flag": 122,
            "doc_date": "2026-09-18",
            "doc_no": "WD69090004",
            "inquiry_type": 0,
            "remark": "ขอเบิกวัตถุดิบเข้าไลน์ผลิต",
            "status": 0,
            "doc_time": "13:45",
            "last_status": 0,
            "used_status": 0,
            "doc_success": 0,
            "doc_format_code": "WD",
            "is_pos": 0,
            "creator_code": "RESTAPI",
            "create_datetime": "2026-09-18 12:11:02.696",
            "details": [
                {
                    "trans_type": 3,
                    "trans_flag": 122,
                    "doc_date": "2026-09-18",
                    "doc_no": "WD69090004",
                    "inquiry_type": 0,
                    "item_code": "BB001",
                    "item_name": "กูลิโกะโคลลอนช็อกโกแลต 54 กรัม",
                    "unit_code": "กล่อง",
                    "qty": 8,
                    "remark": "ด่วน",
                    "status": 0,
                    "line_number": 0,
                    "wh_code": "LOCATION",
                    "shelf_code": "LOCATION_1",
                    "stand_value": 1.0,
                    "divide_value": 1.0,
                    "calc_flag": 0,
                    "doc_time": "13:45",
                    "doc_date_calc": "2026-09-18",
                    "doc_time_calc": "13:45",
                    "is_serial_number": 0
                },
                {
                    "trans_type": 3,
                    "trans_flag": 122,
                    "doc_date": "2026-09-18",
                    "doc_no": "WD69090004",
                    "inquiry_type": 0,
                    "item_code": "BB002",
                    "item_name": "กูลิโกะโคลลอนสตรอเบอร์รี่ 54 กรัม",
                    "unit_code": "แพ็ค",
                    "qty": 3,
                    "status": 0,
                    "line_number": 1,
                    "wh_code": "LOOK",
                    "shelf_code": "ROOM2",
                    "stand_value": 12.0,
                    "divide_value": 1.0,
                    "calc_flag": 0,
                    "doc_time": "13:45",
                    "doc_date_calc": "2026-09-18",
                    "doc_time_calc": "13:45",
                    "is_serial_number": 0
                }
            ],
            "wh_code": "LOCATION",
            "shelf_code": "LOCATION_1"
        }
    ],
    "pages": {
        "size": 10,
        "page": 1,
        "total_record": 1,
        "max_page": 1
    }
}

Response Error

json
{
    "success": false,
    "error": true,
    "message": "ข้อความแจ้งสาเหตุจากฐานข้อมูล",
    "code": "99"
}

RequestTakeOutItem Information

แสดงข้อมูลเอกสารขอเบิกสินค้า/วัตถุดิบ ตามเลขที่เอกสาร

EndPoint

GET /SMLJavaRESTService/requesttakeoutitem/v4/{doc_no}

Path Parameter

FieldDescriptionExample
doc_noเลขที่เอกสารWD69090001

Example:

GET localhost:8086/SMLJavaRESTService/requesttakeoutitem/v4/WD69090001

Response Success

json
{
    "success": true,
    "data": {
        "trans_type": 3,
        "trans_flag": 122,
        "doc_date": "2026-09-18",
        "doc_no": "WD69090004",
        "inquiry_type": 0,
        "remark": "ขอเบิกวัตถุดิบเข้าไลน์ผลิต",
        "status": 0,
        "doc_time": "13:45",
        "last_status": 0,
        "used_status": 0,
        "doc_success": 0,
        "doc_format_code": "WD",
        "is_pos": 0,
        "creator_code": "RESTAPI",
        "create_datetime": "2026-09-18 12:11:02.696",
        "details": [
            {
                "trans_type": 3,
                "trans_flag": 122,
                "doc_date": "2026-09-18",
                "doc_no": "WD69090004",
                "inquiry_type": 0,
                "item_code": "BB001",
                "item_name": "กูลิโกะโคลลอนช็อกโกแลต 54 กรัม",
                "unit_code": "กล่อง",
                "qty": 8,
                "remark": "ด่วน",
                "status": 0,
                "line_number": 0,
                "wh_code": "LOCATION",
                "shelf_code": "LOCATION_1",
                "stand_value": 1.0,
                "divide_value": 1.0,
                "calc_flag": 0,
                "doc_time": "13:45",
                "doc_date_calc": "2026-09-18",
                "doc_time_calc": "13:45",
                "is_serial_number": 0
            },
            {
                "trans_type": 3,
                "trans_flag": 122,
                "doc_date": "2026-09-18",
                "doc_no": "WD69090004",
                "inquiry_type": 0,
                "item_code": "BB002",
                "item_name": "กูลิโกะโคลลอนสตรอเบอร์รี่ 54 กรัม",
                "unit_code": "แพ็ค",
                "qty": 3,
                "status": 0,
                "line_number": 1,
                "wh_code": "LOOK",
                "shelf_code": "ROOM2",
                "stand_value": 12.0,
                "divide_value": 1.0,
                "calc_flag": 0,
                "doc_time": "13:45",
                "doc_date_calc": "2026-09-18",
                "doc_time_calc": "13:45",
                "is_serial_number": 0
            }
        ],
        "wh_code": "LOCATION",
        "shelf_code": "LOCATION_1"
    }
}

Response Error

ไม่พบเอกสาร — HTTP 404

json
{
    "success": false,
    "error": true,
    "message": "RequestTakeOutItem not found: WD69090099",
    "code": "404"
}

Add RequestTakeOutItem

สร้างเอกสารขอเบิกสินค้า/วัตถุดิบ

EndPoint

POST /SMLJavaRESTService/requesttakeoutitem/v4

Body Data:

JSON body ตาม RequestTakeOutItem Attribute

ฟิลด์ที่ต้องส่ง: doc_no, doc_date, wh_code, shelf_code และ details อย่างน้อย 1 รายการ

ถ้ารายการใน details ไม่ส่ง wh_code/shelf_code มา ระบบจะใช้ค่าระดับเอกสารแทนให้

example:

json
{
    "doc_no": "WD69090004",
    "doc_date": "2026-09-18",
    "doc_time": "13:45",
    "doc_format_code": "WD",
    "wh_code": "LOCATION",
    "shelf_code": "LOCATION_1",
    "inquiry_type": 0,
    "remark": "ขอเบิกวัตถุดิบเข้าไลน์ผลิต",
    "details": [
        {
            "line_number": 0,
            "item_code": "BB001",
            "unit_code": "กล่อง",
            "qty": 8,
            "remark": "ด่วน"
        },
        {
            "line_number": 1,
            "item_code": "BB002",
            "unit_code": "แพ็ค",
            "qty": 3,
            "wh_code": "LOOK",
            "shelf_code": "ROOM2"
        }
    ]
}

บรรทัดที่ 0 ไม่ได้ส่ง wh_code/shelf_code มา ระบบจึงใช้ LOCATION/LOCATION_1 ของระดับเอกสารให้ ส่วนบรรทัดที่ 1 ส่งมาเอง จะใช้ LOOK/ROOM2 ตามที่ส่ง

Response Success — HTTP 200

json
{
    "success": true,
    "data": {
        "code": "WD69090004"
    }
}

Response Error — HTTP 400

ข้อมูลที่จำเป็นไม่ครบ

json
{
    "success": false,
    "error": true,
    "message": "wh_code is required",
    "code": "99"
}

เลขที่เอกสารซ้ำ

json
{
    "success": false,
    "error": true,
    "message": "Error in executeUpdate, ERROR: duplicate key value violates unique constraint \"ic_trans_ic_trans_pk_primary\"\n  Detail: Key (doc_no, trans_flag)=(WD69090004, 122) already exists.",
    "code": "99"
}

หมายเหตุ: เอกสารขอเบิกไม่ตัดสต๊อก — รายการสินค้าถูกบันทึกด้วย calc_flag = 0 การตัดสต๊อกจริงเกิดตอนบันทึกเอกสารเบิกสินค้า (trans_flag = 56)


RequestTakeOutItem 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ลูกหนี้/เจ้าหนี้
delivery_dateDateวันที่ส่งของ
department_codeString25แผนก
department_code_toString25ถึงแผนก
deposit_dateDateระยะเวลาภายใน (วันที่)
deposit_dayIntegerระยะเวลาภายใน (วัน)
detailsArrayObjectรายละเอียดสินค้า (required)
discount_wordString25ส่วนลด
discount_word_2String25ส่วนลด(สกุลเงิน)
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_successIntegerสิ้นสุด
doc_timeString5เวลา
doc_typeIntegerประเภทเอกสาร
due_dateDateวันที่ครบกำหนด
exchange_rateFloatอัตราแลกเปลี่ยน
expire_dateDateวันที่หมดอายุ
expire_dayIntegerจำนวนวันหมดอายุ
expire_statusIntegerสถานะหมดอายุ
extra_wordString100ข้อความเพิ่มเติม
guid_codeString35GUID
inquiry_typeIntegerประเภทรายการ
is_cancelIntegerเอกสารยกเลิก
is_doc_copyIntegerเป็นเอกสารที่ออกแทน
is_holdIntegerระงับเอกสาร
is_manual_vatIntegerบันทึกรายการภาษีเอง
is_posIntegerจากระบบ POS
job_codeString25งาน
job_code_toString25ถึงงาน
last_editor_codeString255ผู้แก้ไขเอกสารล่าสุด
last_statusIntegerสถานะ
lastedit_datetimeDateวันที่แก้ไขล่าสุด
location_toString25ที่เก็บปลายทาง
lost_profit_exchange_amountFloatผลต่างจากอัตราแลกเปลี่ยน
member_codeString25รหัสสมาชิก
moneyFloatจำนวนเงินคืน
not_approve_1Integerไม่อนุมัติ
on_holdIntegerระงับชั่วคราว
pass_book_codeString25สมุดเงินฝาก
pay_amountFloatเงินชำระ
period_guidString50GUID กะ
point_telephoneString25หมายเลขโทรศัพท์
pos_bill_changeInteger0=ปรกติ,1=ใบแทน
pos_bill_typeInteger0=อย่างย่อ,1=อย่างเต็ม
pos_idString25หมายเลขเครื่อง POS
pos_transferIntegerโอนมาจากPOS
project_codeString25โครงการ
project_code_toString25ถึงโครงการ
recheck_countIntegerเปิดระบบเตือนตรวจนับซ้ำ
recheck_count_dayFloatเตือนย้อนหลัง (วัน)
ref_amountFloatมูลค่าเอกสารเดิม
ref_diffFloatผลต่าง
ref_doc_typeString50ประเภทเอกสาร
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
shelf_codeString25ที่เก็บสินค้า (required)
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มูลค่าสุทธิ
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_valueFloatมูลค่าสินค้า
total_value_2Floatมูลค่าสินค้า(สกุลเงิน)
total_vat_valueFloatภาษีมูลค่าเพิ่ม
trans_flagIntegerรายวันระบบ
trans_typeIntegerประเภทรายวัน
transport_codeString25ขนส่งโดย
transport_valueFloatค่าขนส่ง
used_statusIntegerมีการอ้างอิงแล้ว
used_status_2Integerสถานะ 2
user_approveString25ผู้อนุมัติ
user_requestString25ผู้ขออนุมัติ
vat_rateFloatอัตราภาษี
vat_typeIntegerประเภทภาษี
want_dateDateต้องการภายใน (วันที่)
want_dayIntegerต้องการภายใน (วัน)
wh_codeString25คลังสินค้า (required)
wh_toString25คลังปลายทาง

RequestTakeOutItem Detail

Field NameField TypeLengthDescription
auto_createIntegerสร้างโดยโปรแกรม
average_costFloatราคาทุนเฉลี่ย
average_cost_1Floatราคาทุนเฉลี่ยแฝง
bank_branchString25สาขา
bank_branch_2String25สาขา
bank_nameString25ธนาคาร
bank_name_2String25ธนาคาร
barcodeString25Barcode
bat_dateDatebat date
bat_numberString255bat number
branch_codeString25สาขา
calc_flagIntegerบวกหรือลบ (1=บวก,-1=ลบ)
cancel_qtyFloatจำนวนยกเลิก
chq_numberString25เลขที่เช็ค
create_datetimeDateวันที่สร้างเอกสาร
creator_codeString255ผู้สร้างเอกสาร
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_refString255เอกสารอ้างอิง
doc_ref_typeIntegerประเภทเอกสาร
doc_timeString5เวลา
doc_time_calcString5เวลาสำหรับคำนวณ
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รหัสสินค้า
item_code_mainString25สินค้าหลัก
item_nameString255ชื่อสินค้า
item_typeIntegerประเภทสินค้า
last_editor_codeString255ผู้แก้ไขเอกสารล่าสุด
last_statusIntegerสถานะล่าสุด (0=Normal,1=ยกเลิก)
lastedit_datetimeDateวันที่แก้ไขล่าสุด
line_numberIntegerบรรทัด
lot_number_1String50เลข LOT
mfd_dateDateวันที่ผลิต
mfn_codeString50รหัสผู้ผลิต
mfn_nameString255ผู้ผลิต
priceFloatราคา
price_2Floatราคา
price_baseFloatราคากลาง
price_changedIntegerมีการแก้ไขราคา
price_defaultFloatราคาเริ่มต้น
price_exclude_vatFloatราคาไม่รวมภาษี
price_guidString55Price Guid
price_modeIntegerกลุ่มราคา
price_set_ratioFloatอัตราส่วนราคาสินค้าชุด
price_typeIntegerประเภทราคา
priority_levelIntegerความสำคัญ
product_weekString10สัปดาห์ที่ผลิต
product_yearString10ปีที่ผลิต
profit_lost_cost_amountFloatกำไรขาดทุน
promotion_codeString50รหัสโปรโมชั่น
qtyFloatจำนวน (required)
qty_2Floatจำนวนขาย
ratioFloatอัตราส่วน
ref_cust_codeString25อ้างอิง เจ้าหนี้/ลูกหนี้
ref_doc_dateDateอ้างอิง วันที่
ref_doc_noString25อ้างอิง
ref_guidString40ref_guid
ref_line_numberIntegerอ้างอิง บรรทัด
ref_rowIntegerref_row
remarkString255หมายเหตุ
sale_codeString25รหัสพนักงานขาย
sale_groupString25กลุ่มพนักงานขาย
sale_shift_idString50รอบการขาย
set_ref_lineString40บรรทัดอ้างอิง (สินค้าชุด)
set_ref_priceFloatราคาอ้างอิง (สินค้าชุด)
set_ref_qtyFloatจำนวนอ้างอิง (สินค้าชุด)
shelf_codeString25พื้นที่เก็บ
shelf_code_2String25พื้นที่เก็บ
stand_valueFloatตัวตั้ง
statusIntegerสถานะ
sum_amountFloatรวมมูลค่า
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_1String25ตัวอักษร 1
total_qtyFloatจำนวนคงเหลือ
total_sizeFloatรวมหน่วยนับ 2
total_vat_valueFloatภาษีมูลค่าเพิ่ม
trans_flagIntegerรายวันระบบ
trans_typeIntegerประเภทรายวัน
transfer_amountFloatยอดโอนเงิน
unit_codeString25หน่วยนับ (required)
unit_code_2String25หน่วยช่วยขาย
unit_sizeFloatขนาดสินค้า
user_approveString25รหัสผู้อนุมัติ
vat_typeIntegerประเภทภาษี (0=แยกนอก,1=รวมใน,2=อัตรา 0)
wh_codeString25คลัง
wh_code_2String25คลัง