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:
CREATE PROCEDURE ERALIS_CUSTOM_QTYONHAND_DIFF
DECLARE @results_TBL TABLE
( SEQNO INT,
QTY_DIFF NUMERIC(19,6) );
INSERT INTO @results_TBL
( JOBID,SEQNO,ITEMCODE,QTY,ONHAND )
( SELECT ONHAND
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'