project QadFinancials > class BMfgLocationDet > method CreateLocationDet

Description

Creates Location Record


Parameters


icSiteinputcharacterSite
icLocationinputcharacterLocation
icPartinputcharacterPart
icLotSerialinputcharacterLot Serial
icLotReferenceinputcharacterLot Reference
icTransactionTypeinputcharacter
itEffectiveDateinputdate
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BMfgLocationDet.UpdateQuantity


program code (program1/bmfglocationdet.p)

/*Creates a Location Detail Record if it does not exist*******  */
/* Input Parameters                                             */
/*      icSite          Site                                    */
/*      icLocation      Location                                */
/****************************************************************/

assign oiReturnStatus = -98.

<M-2 run AddDetailLine
   (input  'ld_det':U (icTable), 
    input  '':U (icParentRowid), 
    output viFcReturnSuper (oiReturnStatus)) in BMfgLocationDet>
    
if viFcReturnSuper <> 0  then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0   then return.

/* get site attributes */
<Q-3 run SiteForInventoryStatusLoc (all) (Read) (NoCache)
   (input vcDomainCode, (Domain)
    input icSite, (Site)
    output dataset tqSiteForInventoryStatusLoc) in BMfgSite >
find first tqSiteForInventoryStatusLoc no-error.
if not available tqSiteForInventoryStatusLoc
then do:
    assign vcMessage = #T-4'Site &1 in domain &2 has not been defined.':255(64853)t-4#
           vcMessage = substitute(vcMessage, icSite, vcDomainCode).
    <M-5 run SetMessage
       (input  vcMessage (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-6798':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BMfgLocationDet>
    assign oiReturnStatus = -1.
    return.
end.

assign tld_det.ld_site   = icSite
       tld_det.ld_loc    = icLocation
       tld_det.ld_part   = icPart
       tld_det.ld_lot    = icLotSerial
       tld_det.ld_ref    = icLotReference
       tld_det.ld_status = tqSiteForInventoryStatusLoc.tcsi_status.
       
if icTransactionType begins "R"
then do:
     <Q-8 run ItemForShelfLife (all) (Read) (NoCache)
        (input vcDomainCode, (Domain)
         input icPart, (Part)
         output dataset tqItemForShelfLife) in BMfgItem > 
    find first tqItemForShelfLife no-error.
    if available tqItemForShelfLife
    then do:
         if tqItemForShelfLife.tipt_shelflife = 0
         then assign tld_det.ld_expire = ?.
         else assign tld_det.ld_expire = itEffectiveDate + tqItemForShelfLife.tipt_shelflife.
     end.
end.

if oiReturnStatus = -98 then assign oiReturnStatus = 0.