This error has occurred as stock has inadvertently been taken out of the WIP warehouse. According to the current job you are processing, there is stock that needs to be actioned for this job but it is no longer available.
This stored procedure will display a list of the lines on the job, the quantity associated to the line, the inventory quantity on hand in the WIP warehouse and a difference. If the difference is negative, this will mean that after the processing of the line, the on hand quantity in that warehouse will be less than zero.
To execute the stored procedure you need to run the following command from SQL:
EXEC ERALIS_CUSTOM_QTYONHAND_DIFF
CREATE PROCEDURE ERALIS_CUSTOM_QTYONHAND_DIFF
@jobid INT
AS
BEGIN
DECLARE
@wipwhs NVARCHAR(8)
DECLARE @results_TBL TABLE
( SEQNO INT,
JOBID INT,
ITEMCODE NVARCHAR(23),
QTY NUMERIC(19,6),
ONHAND NUMERIC(19,6),
QTY_DIFF NUMERIC(19,6) );
SELECT @wipwhs=WIPWHS
FROM ERALIS_JOBCOST_SETUP
INSERT INTO @results_TBL
( JOBID,SEQNO,ITEMCODE,QTY,ONHAND )
SELECT @jobid,SEQNO,STOCKCODE,QTY,
( SELECT ONHAND
FROM OITW
WHERE WhsCode=@wipwhs AND OITW.ItemCode=JL.STOCKCODE ) AS WHS_ONHAND
FROM ERALIS_JOBCOST_JOBLINESVIEW JL
JOIN OITM ON OITM.ItemCode=JL.STOCKCODE
WHERE OITM.InvntItem='Y' AND JOBID=@jobid AND JL.LINETYPE<>'Q' AND JL.STATUS IN (1,2,3)
SELECT JOBID,SEQNO,ITEMCODE,QTY,ONHAND,ONHAND-QTY AS 'Diff'
FROM @results_TBL
END
Comments
0 comments
Please sign in to leave a comment.