#tables#ic
คลังสินค้า (ic_warehouse)
หน้าที่: master ของคลังสินค้า 1 แถว = 1 คลัง (code) ใช้เป็นรหัสอ้างจาก wh_code ในบรรทัดเอกสาร รายการสินค้าในเอกสาร (ic_trans_detail), wh_from/wh_to ในหัวเอกสาร หัวเอกสารสินค้า/ซื้อ/ขาย (ic_trans), คลังเริ่มต้นใน รายละเอียดสินค้าเพิ่มเติม (ic_inventory_detail) และการผูกสินค้า-คลัง-ที่เก็บใน สินค้ากับคลังและที่เก็บ (ic_wh_shelf) ที่เก็บย่อยในคลังอยู่ใน พื้นที่เก็บสินค้า (ic_shelf)
คอลัมน์ (จากสคีมาหน้าจอ icWarehouse.ts:28-100)
| column | ความหมาย | หมายเหตุ |
|---|---|---|
code |
รหัสคลัง (key) | ตรวจซ้ำก่อนบันทึก WarehouseScreen.tsx:376 |
name_1, name_2 |
ชื่อคลัง ไทย / อังกฤษ | icWarehouse.ts |
address, telephone, fax |
ที่อยู่ / โทรศัพท์ / โทรสาร | icWarehouse.ts |
user_group |
กลุ่มผู้ใช้งาน | ไม่ชัดจากโค้ดว่านำไปกรองสิทธิ์ที่ใด |
wh_manager |
ผู้จัดการคลัง (รหัสผู้ใช้ erp_user) |
WarehouseScreen.tsx:204 ดึงชื่อจาก erp_user — ผู้ใช้/พนักงานในฐานบริษัท |
branch_code |
สาขาของคลัง (erp_branch_list — ทะเบียนสาขา) | WarehouseScreen.tsx:208 |
branch_use |
สาขาที่ใช้งานคลัง (ถ้าไม่ว่างชนะ branch_code) |
perm_wh_shelf_rest.go:47-49 |
latitude, longitude |
พิกัดคลัง | WarehouseScreen.tsx:1073-1096 |
ความสัมพันธ์และกระบวนการ
- 1 คลัง : n ที่เก็บ พื้นที่เก็บสินค้า (ic_shelf) (
ic_shelf.whcode = ic_warehouse.code) - 1 คลัง : n สินค้ากับคลังและที่เก็บ (ic_wh_shelf) (
wh_code) และ n บรรทัดเอกสาร รายการสินค้าในเอกสาร (ic_trans_detail) (wh_code,wh_code_2) - เขียน: หน้าจอ "กำหนดคลังสินค้า"
menu_setup_ic_wh(frontend/account/master/WarehouseScreen.tsx) INSERT/UPDATE/DELETE ผ่าน/query/execเพราะตารางอยู่ใน allow-listlegacyClientWritable(backend/internal/domain/query/write_policy_legacy.go:33) ยังไม่มี endpoint ใน/api/process - ลบ: หน้าจอตรวจก่อนว่าไม่มีการใช้ใน
ic_trans_detail(wh_code/wh_code_2),ic_shelf(whcode) และic_wh_shelf(wh_code) (WarehouseScreen.tsx:482-490) - กรองสิทธิ์: เมื่อ
erp_option.perm_wh_shelf = 1รายการคลังที่ผู้ใช้เลือกได้ถูกจำกัดตามerp_user_group_wh_shelf(perm_wh_shelf.go:7-8,perm_wh_shelf_rest.go:40-60) ดู สิทธิ์คลัง/ที่เก็บรายกลุ่มผู้ใช้ (perm_wh_shelf), erp_option — ตัวเลือกระบบ (สวิตช์ + ทศนิยมของบริษัท) - กรองสาขา: ยอดคงเหลือที่รายงานกรองคลังตาม
COALESCE(branch_use,'')='' ? branch_code : branch_use LIKE %สาขา%(perm_wh_shelf_rest.go:47-49) - ค่าเริ่มต้น POS: ถ้าไม่มีตั้งค่า ใช้คลังรหัสน้อยสุด (
pos_config.go:402)
ข้อควรระวัง
- ที่เก็บในคลังใช้ชื่อคอลัมน์
whcode(ไม่มี underscore) ใน พื้นที่เก็บสินค้า (ic_shelf) แต่ตารางอื่นใช้wh_code— ระวังตอน join (perm_wh_shelf_rest.go:74) - ไม่มีบันทึกบัญชี/สต๊อกในตารางนี้ เป็นแค่ master
ที่มาในโค้ด
frontend/src/config/schemas/icWarehouse.ts:28-100frontend/account/master/WarehouseScreen.tsx:188,:204-210,:376,:482-490,:1073-1096backend/internal/domain/query/write_policy_legacy.go:33backend/internal/application/process/perm_wh_shelf.go:7-8backend/internal/application/process/perm_wh_shelf_rest.go:40-60,:74backend/internal/application/process/pos_config.go:402