Merge branch 'jskim-node' of https://g.wace.me/jskim/vexplor_dev into jskim-node
This commit is contained in:
@@ -543,6 +543,9 @@ export async function getItems(req: AuthenticatedRequest, res: Response) {
|
||||
const result = await pool.query(
|
||||
`SELECT
|
||||
id, item_number, item_name, size AS spec, material, unit,
|
||||
COALESCE(width::text, '') AS width,
|
||||
COALESCE(height::text, '') AS height,
|
||||
COALESCE(thickness::text, '') AS thickness,
|
||||
COALESCE(CAST(NULLIF(standard_price, '') AS numeric), 0) AS standard_price
|
||||
FROM item_info
|
||||
WHERE ${conditions.join(" AND ")}
|
||||
|
||||
@@ -991,6 +991,9 @@ export async function getItems(req: AuthenticatedRequest, res: Response) {
|
||||
const dataResult = await pool.query(
|
||||
`SELECT
|
||||
id, item_number, item_name, size AS spec, material, unit,
|
||||
COALESCE(width::text, '') AS width,
|
||||
COALESCE(height::text, '') AS height,
|
||||
COALESCE(thickness::text, '') AS thickness,
|
||||
COALESCE(CAST(NULLIF(standard_price, '') AS numeric), 0) AS standard_price
|
||||
FROM item_info
|
||||
WHERE ${whereClause}
|
||||
|
||||
@@ -333,7 +333,7 @@ export async function getShipmentPlanSource(req: AuthenticatedRequest, res: Resp
|
||||
LEFT JOIN sales_order_detail d ON sp.detail_id = d.id AND sp.company_code = d.company_code
|
||||
LEFT JOIN sales_order_mng m ON sp.sales_order_id = m.id AND sp.company_code = m.company_code
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT item_name FROM item_info
|
||||
SELECT item_name, width, height, thickness FROM item_info
|
||||
WHERE item_number = COALESCE(d.part_code, m.part_code) AND company_code = sp.company_code
|
||||
LIMIT 1
|
||||
) i ON true
|
||||
@@ -353,6 +353,9 @@ export async function getShipmentPlanSource(req: AuthenticatedRequest, res: Resp
|
||||
COALESCE(d.part_code, m.part_code, '') AS item_code,
|
||||
COALESCE(i.item_name, d.part_name, m.part_name, COALESCE(d.part_code, m.part_code, '')) AS item_name,
|
||||
COALESCE(d.spec, m.spec, '') AS spec,
|
||||
COALESCE(i.width::text, '') AS width,
|
||||
COALESCE(i.height::text, '') AS height,
|
||||
COALESCE(i.thickness::text, '') AS thickness,
|
||||
COALESCE(m.material, '') AS material,
|
||||
COALESCE(c.customer_name, '') AS customer_name,
|
||||
COALESCE(m.partner_id, d.delivery_partner_code, '') AS partner_code,
|
||||
@@ -400,7 +403,7 @@ export async function getSalesOrderSource(req: AuthenticatedRequest, res: Respon
|
||||
FROM sales_order_detail d
|
||||
LEFT JOIN sales_order_mng m ON d.order_no = m.order_no AND d.company_code = m.company_code
|
||||
LEFT JOIN LATERAL (
|
||||
SELECT item_name FROM item_info
|
||||
SELECT item_name, width, height, thickness FROM item_info
|
||||
WHERE item_number = d.part_code AND company_code = d.company_code
|
||||
LIMIT 1
|
||||
) i ON true
|
||||
@@ -418,6 +421,9 @@ export async function getSalesOrderSource(req: AuthenticatedRequest, res: Respon
|
||||
d.id, d.order_no, d.part_code AS item_code,
|
||||
COALESCE(i.item_name, d.part_name, d.part_code) AS item_name,
|
||||
COALESCE(d.spec, '') AS spec, COALESCE(m.material, '') AS material,
|
||||
COALESCE(i.width::text, '') AS width,
|
||||
COALESCE(i.height::text, '') AS height,
|
||||
COALESCE(i.thickness::text, '') AS thickness,
|
||||
COALESCE(NULLIF(d.qty,'')::numeric, 0) AS qty,
|
||||
COALESCE(NULLIF(d.balance_qty,'')::numeric, 0) AS balance_qty,
|
||||
COALESCE(c.customer_name, COALESCE(d.delivery_partner_code, m.partner_id, '')) AS customer_name,
|
||||
@@ -465,7 +471,10 @@ export async function getItemSource(req: AuthenticatedRequest, res: Response) {
|
||||
const query = `
|
||||
SELECT
|
||||
item_number AS item_code, item_name,
|
||||
COALESCE(size, '') AS spec, COALESCE(material, '') AS material
|
||||
COALESCE(size, '') AS spec, COALESCE(material, '') AS material,
|
||||
COALESCE(width::text, '') AS width,
|
||||
COALESCE(height::text, '') AS height,
|
||||
COALESCE(thickness::text, '') AS thickness
|
||||
FROM item_info
|
||||
WHERE ${whereClause}
|
||||
ORDER BY item_name
|
||||
|
||||
Reference in New Issue
Block a user