COMPILE Function obj_Inventory(Method,Parm1,Parm2) /* * ADJUST INVENTORY TO INPROCESS IF APPLICABLE if ( CurWafInv <> '' ) then PossibleWafInvUpdate = true$ * THERE IS AN INVENTORY NUMBER AND THE QUANTITY HAS EITHER CHANGED * OR THIS IS A NEW LINE * NOW LETS MAKE SURE THERE IS A QTY WIqty = ThisOrderLine<1,Qty$> if ( WIQty > 0 and ( WIQty <> ThisOOrderLine<1,Qty$> ) ) or ( ForceUpdate = true$ and WIQty > 0 ) or ( CurWafInv <> OOrderDetail<1,WafInv$> ) then lock WafInvTable, CurWafInv then WIRec = xlate( 'WAFER_INV', CurWafInv, '', 'X' ) if CurLotNum <> '' then CurLotNum = trim( CurLotNum ) InvLotNums = WIRec InvLotCnts = WIRec locate CurLotNum in InvLotNums using @vm setting WIpos then * NOW LOOP THROUGH EACH LINE AND DO A TOTCNT ON THIS LOTNUM * OR PART NUM IF THE LOT NUM BEGINS WITH OK CAUSE THEY * USE THE CUSTOMERS PART NUMBER CAUSE THEY DO NOT * WANT A BREAK DOWN BY LOT * ALSO ON EACH LINE CHECK TO SEE IF IT IS FOR THIS * ORDER AND FOR THIS LINE MaxAllowed = InvLotCnts<1,WIpos> * NO MORE POSTING THE PARTNUMBER TO WAFER INVENTORY * AS OF 3/18/99 TO SATISFY OKMETIC *if CurLotNum[1,2] = 'OK' then * LotPart = CurPartNum *end else LotPart = CurLotNum *end TotLotPartCnt = 0 OLCnt = fieldcount( WIRec, @vm ) LineFoundOn = 0 for Ww = 1 to OLCnt ThisInvOrderNo = WIRec ThisInvOrderLine = WIRec ThisInvLotPart = WIRec ThisInvInProc = WIRec ThisInvInvoiceNo = WIRec if ThisInvLotPart = LotPart then * CHECKING BELOW THAT THE LSL INVOICE NO IS BLANK * CAUSE WE DO NOT WANT TO UPDATE AN INVOICE LINE if ( ThisInvInvoiceNo = '' ) and ( ThisInvOrderNo = OrderNo ) and ( ThisInvOrderLine = Row ) then LineFoundOn = Ww end else TotLotPartCnt += ThisInvInProc end end next Ww * ACCOUNT FOR THE QTY THAT WE ARE ADDING TotLotPartCnt += ThisOrderLine<1,Qty$> if TotLotPartCnt > MaxAllowed then * ERROR MESSAGE MsgInfo = '' MsgInfo = 'No update on wafer inventory#':CurWafInv:' for order line ':Row:' due to alloted amount for lot number ':CurLotNum:' being ':MaxAllowed:', and this would put it at ':TotLotPartCnt MsgInfo = '!' Void = msg( '', MsgInfo ) end else * UPDATE THE INVENTORY if LineFoundOn > 0 then WIRec = OrderNo WIRec = Row WIRec = .po->text WIRec = LotPart WIRec = CurWo WIRec = date() WIRec = WIQty end else * ADD TO THE BOTTOM Npos = OLCnt + 1 WIRec = OrderNo WIRec = Row WIRec = .po->text WIRec = LotPart WIRec = CurWo WIRec = date() WIRec = WIQty end if InvUpdateMsg = '' then InvUpdateMsg = 'The following wafer inventory records were updated: ':CrLf$ end InvUpdateMsg := 'Inventory#':CurWafInv:' from order line ':Row:CrLf$ write WIRec on WafInvTable, CurWafInv else Void = msg( '', 'Unable to write ':CurWafInv:' on WAFER_INV...' ) end end end else MsgInfo = '' MsgInfo = 'No update on wafer inventory#':CurWafInv:' for order line ':Row:' due to lot number ':CurLotNum:' not found in the lot number qty breakdown portion...' MsgInfo = '!' Void = msg( '', MsgInfo ) end end else MsgInfo = '' MsgInfo = 'No update on wafer inventory#':CurWafInv:' for order line ':Row:' due to no Lot Number on row ':Row:'...' MsgInfo = '!' Void = msg( '', MsgInfo ) end unlock WafInvTable, CurWafInv else MsgInfo = '' MsgInfo = 'Unable to unlock wafer inventory#':CurWafInv MsgInfo = '!' Void = msg( '', MsgInfo ) end end else MsgInfo = '' MsgInfo = 'Unable to update wafer inventory#':CurWafInv:' for order line ':Row:' due to it currently being in use. You will need to manually update this inventory...' MsgInfo = '!' Void = msg( '', MsgInfo ) end RETURN ''