fix(wms): 修复出库查询中箱子材质信息问题

- 在子查询中添加 box_type 字段
- 新增与 md_me_materialbase 表的左连接,获取材质名称
- 移除 bst_ivt_boxinfo 表的左连接,不再使用箱型信息
This commit is contained in:
yangyufu
2025-07-10 13:57:31 +08:00
committed by zhouz
parent 13ea603036
commit b3833d52ce

View File

@@ -266,8 +266,8 @@
base.cust_name,
dis.sect_name,
dis.box_no,
bib.material_code box_material_code,
bib.material_name box_material_name,
sub.box_type box_material_code,
mmm.material_name box_material_name,
dis.qty_unit_name,
mater.material_code,
mater.material_name,
@@ -330,6 +330,7 @@
record.bill_code,
record.container_name,
record.package_box_sn,
record.box_type,
record.sap_pcsn,
max(record.customer_name) as customer_name,
max(record.customer_description) as customer_description,
@@ -353,7 +354,9 @@
record.bill_code,
record.container_name,
record.sap_pcsn,
record.package_box_sn) sub ON (sub.container_name = dis.pcsn AND sub.package_box_sn = dis.box_no AND sub.bill_id = mst.iostorinv_id)
record.package_box_sn,
record.box_type) sub ON (sub.container_name = dis.pcsn AND sub.package_box_sn = dis.box_no AND sub.bill_id = mst.iostorinv_id)
LEFT JOIN md_me_materialbase mmm ON sub.box_type = mmm.material_code
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name
LEFT JOIN (SELECT
container_name,
@@ -388,8 +391,8 @@
base.cust_name,
dis.sect_name,
dis.box_no,
bib.material_code box_material_code,
bib.material_name box_material_name,
sub.box_type box_material_code,
mmm.material_name box_material_name,
dis.qty_unit_name,
mater.material_code,
mater.material_name,
@@ -441,7 +444,6 @@
a.pcsn
) AS c
inner JOIN st_ivt_iostorinvdis dis ON dis.iostorinvdis_id = c.iostorinvdis_id
LEFT JOIN bst_ivt_boxinfo bib ON dis.box_no = bib.box_no
inner JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
inner JOIN st_ivt_iostorinvdtl dtl ON dtl.iostorinvdtl_id = dis.iostorinvdtl_id
LEFT JOIN md_cs_transportationbase base ON base.cust_code = mst.trans_code
@@ -452,6 +454,7 @@
record.bill_code,
record.container_name,
record.package_box_sn,
record.box_type,
record.sap_pcsn,
max(record.customer_name) as customer_name,
max(record.customer_description) as customer_description,
@@ -475,7 +478,9 @@
record.bill_code,
record.container_name,
record.sap_pcsn,
record.package_box_sn) sub ON (sub.container_name = dis.pcsn AND sub.package_box_sn = dis.box_no AND sub.bill_id = mst.iostorinv_id)
record.package_box_sn,
record.box_type) sub ON (sub.container_name = dis.pcsn AND sub.package_box_sn = dis.box_no AND sub.bill_id = mst.iostorinv_id)
LEFT JOIN md_me_materialbase mmm ON sub.box_type = mmm.material_code
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name
LEFT JOIN (SELECT
container_name,