open-insight/LSL2/STPROC/OBJ_INVENTORY.txt
2024-05-22 14:06:46 -07:00

118 lines
6.0 KiB
Plaintext

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<wafer_inv_inventory_lot_num$>
InvLotCnts = WIRec<wafer_inv_inventory_lot_num_qty$>
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<wafer_inv_order_no$>, @vm )
LineFoundOn = 0
for Ww = 1 to OLCnt
ThisInvOrderNo = WIRec<wafer_inv_order_no$,Ww>
ThisInvOrderLine = WIRec<wafer_inv_order_line$,Ww>
ThisInvLotPart = WIRec<wafer_inv_mfg_lot_no$,Ww>
ThisInvInProc = WIRec<wafer_inv_in_process$,Ww>
ThisInvInvoiceNo = WIRec<wafer_inv_lsl_invoice_no$,Ww>
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<mtext$> = '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<micon$> = '!'
Void = msg( '', MsgInfo )
end else
* UPDATE THE INVENTORY
if LineFoundOn > 0 then
WIRec<wafer_inv_order_no$,LineFoundOn> = OrderNo
WIRec<wafer_inv_order_line$,LineFoundOn> = Row
WIRec<wafer_inv_lsl_po$,LineFoundOn> = .po->text
WIRec<wafer_inv_mfg_lot_no$,LineFoundOn> = LotPart
WIRec<wafer_inv_lsl_wo$,LineFoundOn> = CurWo
WIRec<wafer_inv_ship_date$,LineFoundOn> = date()
WIRec<wafer_inv_in_process$,LineFoundOn> = WIQty
end else
* ADD TO THE BOTTOM
Npos = OLCnt + 1
WIRec<wafer_inv_order_no$,Npos> = OrderNo
WIRec<wafer_inv_order_line$,Npos> = Row
WIRec<wafer_inv_lsl_po$,Npos> = .po->text
WIRec<wafer_inv_mfg_lot_no$,Npos> = LotPart
WIRec<wafer_inv_lsl_wo$,Npos> = CurWo
WIRec<wafer_inv_ship_date$,Npos> = date()
WIRec<wafer_inv_in_process$,Npos> = 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<mtext$> = '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<micon$> = '!'
Void = msg( '', MsgInfo )
end
end else
MsgInfo = ''
MsgInfo<mtext$> = 'No update on wafer inventory#':CurWafInv:' for order line ':Row:' due to no Lot Number on row ':Row:'...'
MsgInfo<micon$> = '!'
Void = msg( '', MsgInfo )
end
unlock WafInvTable, CurWafInv else
MsgInfo = ''
MsgInfo<mtext$> = 'Unable to unlock wafer inventory#':CurWafInv
MsgInfo<micon$> = '!'
Void = msg( '', MsgInfo )
end
end else
MsgInfo = ''
MsgInfo<mtext$> = '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<micon$> = '!'
Void = msg( '', MsgInfo )
end
RETURN ''