我面临的问题是 NetSuite 序列号/批号可以重复如下图所示,
我想通过设置/开发或退一步,一份报告/ SuiteQL 来监控重复的批号,以防止出现重复的批号。
提前感谢您的任何提示!
感谢SuiteQL 查询工具的支持 你可能会得到下面的 SQL。
--2022/3/4 Query Lot/Serial Number Duplicate Purchase Order
SELECT
B.tran_id,
A.inventory_number
FROM
(
SELECT
inventoryNumber.inventorynumber AS inventory_number
FROM
transaction INNER JOIN
transactionLine ON transaction.id = transactionLine.transaction
INNER JOIN
inventoryAssignment ON (transactionLine.id = inventoryAssignment.transactionline
AND
transactionLine.transaction = inventoryAssignment.transaction )
INNER JOIN
inventoryNumber ON inventoryAssignment.inventorynumber = inventoryNumber.id
WHERE
UPPER(transaction.type) IN ('PURCHORD')
GROUP BY
inventoryNumber.inventorynumber
HAVING COUNT(inventoryNumber.inventorynumber) > 1
) AS A
JOIN
(
SELECT
transaction.tranid AS tran_id,
inventoryNumber.inventorynumber AS lot_number
FROM
transaction FULL JOIN
transactionLine ON transaction.id = transactionLine.transaction
INNER JOIN
inventoryAssignment ON (transactionLine.id = inventoryAssignment.transactionline
AND
transactionLine.transaction = inventoryAssignment.transaction )
INNER JOIN
inventoryNumber ON inventoryAssignment.inventorynumber = inventoryNumber.id
WHERE
UPPER(transaction.type) IN ('PURCHORD')
) AS B
ON A.inventory_number = B.lot_number