ue_api_wo

This object supports the management of manufacturing orders

 

Declare:

declare=mywo=ue_api_wo

mywo=methods=parameter

destroy=mywo

 

hmtoggle_plus1Examples

Simple create Workorder

declare=mywo=ue_api_wo

mywo=new

mywo=line=itemcode=FP

mywo=line=quantity=10

mywo=add

destroy mywo

 

Create Workorder with 2 Lines

declare=mywo=ue_api_wo

mywo=new

mywo=line=itemcode=FP

mywo=line=quantity=10

mywo=line=add

mywo=line=itemcode=FP

mywo=line=itemname=Alternative description

mywo=line=version=001

mywo=line=quantity=15

mywo=add

destroy mywo

 

Call from a customer order

declare=mywo=ue_api_wo

mywo=new

mywo=baseentry=24=1=K

mywo=line=baseentry=24=1=K

mywo=line=quantity=3.5

mywo=add

 

Add Line to existing work order

declare=wo=ue_api_wo

wo=loadworkorder=1411

wo.line.add

wo.line.itemcode=FP

wo.line.quantity_ve=5

wo.line.belpos_id=100

wo.line.save

destroy=wo

 

Change quantity in existing work order

declare=wo=ue_api_wo

wo=loadworkorder=1411

wo.line.gotobelpos_id=10

wo.line.quantity_ve=15

wo.line.save

// Now we must calculate total quantity in BoM

wo.bom_quantity=1411=10

destroy=wo

hmtoggle_plus1Create and edit  work order

Create new work order

declare=mywo=ue_api_wo

mywo=new

mywo=project=ABC

..

mywo.add

 

Methode

Description

new

Start to insert a new workorder. For every Workorder make a new-command.

baseentry

 

mywo=basentry=[docentry]=[linenum]=[source OINV or ORDR]

 

create the reference to customer order on work order level

and insert all relevant informations and define the order number

 

cardcode

set cardcode, street, city etc.

add

Add Workorder

line=add

Add Line  to Workorder (befor Add Workorder!) See Line

reset

Should you need to add more workorders, a Reset must occur!

allocateorder=Y/N

Y/N.

Y    ->  accumulative workorder will be generated. All work steps and  parts lists positions will be inserted into the first position.

allocateordername

With this command you can change this Name.

This only can be done via Script

"workordermanagement.src:allocateorder". api_wo in this case has the name "mywo"

Example:

It is grouped after match code, so the name should be the match code of the first article.

select u_match from oitm where itemcode='e_itemcode'

mywo=allocateorder=<wert1>

 

getorderstring=<typ>=<docentry>=<linenum>

save order-String (beas_Fthaupt.auftrag) in field field header.auftrag (if valid) and in value "value"

 

Edit existing workorders

You can open and update existing Workorder. But you can't insert new position. beas don't explode new Postion

Methode

Description

loadworkorder=nr

load Workorder and Workorderposition

updateworkorder

Update the change

setrow

Set the current Workorder-Postion, first row = 1

typchange=typ_id

Set new typ. please do not work with "type" in existing workorders

 

 

 

Name

Columnname

Property

docentry

belnr_id


baseentry

auftrag, auftragint, auftragpos

set baseentryinformation (see methods)

order

auftrag

ordernumber for workorder (char)

date

beldat

Date from Workorder

deliverydate

lfgdat


udf1 ... udf15

udf1 ... udf15

UserDefined Fields

cardcode

knd_id

if set, then city, street etc.

cardname

kndname


priority

prio_id

Priority from Workorder

additionaltext

zusatztext

additional text

type

typ

Type from Workorder

(only, if you create a new workorder. For Change an Existing Workorder, use typchange)

project

projekt

Project

prjuid

prjuid

Project Activity - Uid (beas_prj_line.prjuid)

projectuser1

projectuser1

Project User 1 (ousr.u_name)

projectuser2

projectuser2

Project User 2 (ousr.u_name)

information2

information2

Information Page Project (textfield)

startstructure

startzeit_structure

set structure start date (for calculation)

startdate

anfzeit

set start date and time of work order (beas 9.1 PL 8)

calcstart

anfzeit

set the calulate start date time

enddate

endzeit

set end date and time of work order (beas 9.1 PL 8)

 

 

Property

read

write

Description

add

 

x

add a line

save

 

x

save the line

setrow

 

x

go to the internal datastore row

example: if you have 3 work order position, you have row 1...3

gotobelpos_id

 

x

 

wo=line=gotobelpos_id=20

 

return values:

ret_code=-1 -> not found, 1=found

ret_linenum=internal linenum inside datastore

 

if beas find the entry in datastore, it set this as current line for all additional activities.

 

destroy=wo

declare=wo=ue_api_wo

// load workorder Nr 1240

wo=loadworkorder=1240

wo=line=gotobelpos_id=20

if <wo.ret_code> = 1 then

 messagebox=<wo.ret_linenum>

end if

gotonewline

 

x

 

if current line is a new line, beas do nothing

if current not a new line, beas add a new line

 

wo=loadworkorder=1240

wo=line=gotonewline

wo=line=itemcode=A001

wo=line=quantity=10

rowcount

x

 

 

wo=loadworkorder=1240

messagebox=<wo.line.rowcount>

 

alternative:

messagebox=<wo.line.linecount>

currentrow

x

 

 

wo=loadworkorder=1240

messagebox=<wo.line.currentrow>

 

alternative:

messagebox=<wo.line.getrow>

 

Propertys Pos from Workorder (beas_ftpos)

Name

Columnname

Property

baseentry

auftragint,auftragpos,itemcode, basetype, docentry, basedocnum, baseline, vri, shortvariant, project, lieferdatum, itemname

set baseentryinformation. This function set base-Information, Deliverydate, base-Itemcode, Variant, Project, Itemname
object=baseentry=<basedocentry>=<baselinenum>

 

Only Customer Order ("K") and Pre-Invoice (V)

baseentrybyorder

basetype, docentry, basedocnum, baseline

baseentrybyorder=<basetype>=<docentry>=<docnum>=<linenum>

set the base-Reference with one Line

basetype

basetype, auftragherkunft

set the base-type
K=Customer Order
V=PreInvoice

P=Project

M=Maintenance




basedocnum

basedocnum, auftragint

set the base-docnum

baseline

baseline, auftragpos

set the base-linenum 1

baseline2

baseline2

set the base-linenum 2 (example Workorder - bom-Position)

itemcode

itemcode

the itemcode

only if you create a new workorder

quantity

menge_verbrauch

menge

Quantity in production unit

convert automatically to inventory unit

only if you create a new workorder

 

Quantity < 0 not allowed. In this case the system replace this with 0 and mark work order as "wrong". Quantity =0 allowed.

bom / stlitemcode

stlitemcode

Optional: bom id for using

routingid

routingid

Optional: routing for using

drawingnumber

u_znr


version

u_beas_ver

Use Item Version number

udf1...udf15

udf1 ... udf15


orderquantity

menge_bestellt

quantity from order in whs-unit

itemname

itemname


deliverydate

lieferdatum


startstructure

startzeit_strukutr

date of start date from complete structure (beas 9.1 PL 8)

startdate

startzeit

planed start date (beas 9.1 PL 8)

calcstart

anfzeit

calculated start date and time (beas 9.1 PL 8)

calcend

endzeit

calculated end date and time (beas 9.1 PL 8)

additionaltext

zusatztext


batchnum

charge_id

only a informatino

price

vkpreis


din

din


group

gruppe


matchcode

match


rawmaterial

wst_id





variant, vri

vri

Number from Variant

shortvariant

shortvariant

Char A..Z from shortvariant

whscode

whscode

Warehouse-Code Workorder ( > beas8.8)

project

project

Project-Id

prjuid

prjuid

Link to Project-Activity

 

 

Events

In the file workordermanagement.src the event calls can be put down. These are put down as Functions.

Example:

function allocateorder

..

end

 

Event

Description

allocateorder

it is called if it concerns a collective order and the first article is inserted.

Article will be stored in variable "e_itemcode"

corder2worder

(customer order to workorder):

It is called with call of a customer order for a manufacturing order (single call) at the moment of the manufacturing order arrangement.

 

Following Variables can be used:

e_typ, e_zusatztext, e_prior, e_udf1... e_udf4

 

Read Only Variables:

e_itemcode, e_docentry, e_docnum, e_linenum, e_cardcode
str_parm.belnr_id

createworkorder

Will be called aftert corder2worder., regardless of  Manufacturing order type

Variable

setvar=makeonelevel=true: create all order related assemlbys as pseudo-items - make all to one level

postcreateworkorder

It is called after production of the manufacturing order

 

 

hmtoggle_plus1Additional Methods

 

Function

Description

bom_additem

object=ue_api_wo=bom_additem=<belnr_id>=<belpos_id>=<itemcode>=<qty>

qty in using-unit (menge_verbrauch)

return in "<e_pos_id>" the new pos_id

 

help-achtungYou cannot add a phantom item to a workorder material list (incl. existing routings)!

bom_close

Example

 

object=ue_api_wo=bom_close=<belnr_id>=<belpos_id>=<pos_id>

bom_quantity

if quantity of assembly changed or from Bill of material position, the total quantity must be calculated

 

For complete work order

wo.bom_quantity=x

 

For work order position

wo.bom_quantity=x=y

 

For Bill of Material position

wo.bom_quantity=x=y=z

bom_reopen

Example

object=ue_api_wo=bom_reopen=<belnr_id>=<belpos_id>=<pos_id>

bom_replaceitem

setvar=ls_newitemcode=[new itemcode]

declare=mywo=ue_api_wo

mywo=bom_replaceitem=<ll_belnr_id>=<ll_belpos_id>=<ll_pos_id>=<ls_newitemcode>

 

help-achtungYou cannot replace a material in a workorder position with a phantom item or assembly!

bomcandelete=belnr_id,belpos_id,pos_id

beas check all subassembly from this position and the bom-Position self. Return in Value "value" "1"=can delete , -1 can not delete

object=ue_api_wo=bomcandelete=<belnr_id>=<belpos_id>=<pos_id>

messagebox=<value>

checkrelease

 

object=ue_api_wo=checkrelease=fttyp=..<tab>itemcode=...

if <return> = success then

 // all ok

else

 messagebox=error$<value>

end if

 

Properties

fttyp

beas work order type beas_fttyp

itemcode

assemlby itemcode

stlitemcode

id from used bill of material. empty=same as itemcode

routingid

id from routing plan. empty = same as itemcode

deliverydate

date of delivery. empty=today

version

Version of assembly. Empty = don't check version

 

Return

failure = error. In "value" you've the error message

success = all ok

 

closeposition

 

declare=mywo=ue_api_wo

mywo=closeposition=<str_parm.belnr_id>=<str_parm.belpos_id>

 

Before closing, all necessary tests would be conducted.

There must be no open feedback exist.

A "Close" under certain circumstances can NOT be undone.

copy_wopos

object=ue_api_wo=<from-belnr_id>=<from-belpos_id>=<to-belnr_id>

insert this position in at last in work order <to-belnr_id>

beas9.0-000-001-007

copy_workorder

object=ue_api_wo=<belnr_id>

messagebox=<value>

display -1 = error otherwise the new number

deleteworkorder

you don't need to load this

 

object=ue_api_wo=deleteworkorder=<belnr_id>

if <return> = -1 then

 // error handling

end if

delposition

 

 

Example Delete Workorder-Position

declare=mywo=ue_api_wo

mywo=delposition=<belnr_id>=<belpos_id>=0

 

All necessary tests would be conducted before erasing.

If position is complete or feedback exists, no cancellation is possible.

beas delete all eraseable sub-Positionen and close the rest. In this case base close the actual position and clear the WIA-Accounts.

 

If the assembly has sub-groups with feedback, a cancellation is not possible.

The script workordermanagement:delstl() will be called. Is this a failure,  a cancellation is not possible.

The script workordermanagement:delpos() will be called. Is this a failure, a cancellation is not possible.

 

Delete BoM-Position

declare=mywo=ue_api_wo

mywo=delposition=<belnr_id>=<belpos_id>=<pos_id>

 

You can check the deletable of this position with "bomcandelete"

 

help-achtungYou cannot delete a phantom item (because you will not no the contents of this item)!

ftpos_refresh

 

declare=mywo=ue_api_wo

mywo=ftpos_refresh=<str_parm.belnr_id>=<str_parm.belpos_id>

 

Manufacturing assembly will be removed and re-imported. Working consequences, where feedback exists will not be deleted (depending on the option).

Whether an upgrade is possible, is dependent on other settings. If the assembly or production order is closed, no update is possible.

ftzuordnung=<parameter>

Parameter with tab

belnr_id,belpos_id

Check workorder ...

receipt

Check for this receipt-document

distnumber

this is the distnumber from receipt-document.

Works only with batches!

issue

check only for this issue-document (optional)

getissue

get the issue-document automatically (examle for backflushing-procress) ... get the last issue-docentry which is created 4 min before the receipt document.

beas9.9-000-003-000

 

 

destroy=lds

declare=lds=ue_datastorevalues

lds=select "BEAS_FTPOS"."BELNR_ID"+0 as "BELNR_ID","BEAS_FTPOS"."BELPOS_ID"+0 as "BELPOS_ID" &

  from "BEAS_FTPOS"  &

  inner join "OITM" on "OITM"."ItemCode"="BEAS_FTPOS"."ItemCode" and &                        ("OITM"."ManBtchNum"='Y' or "OITM"."ManSerNum"='Y')

 

for ll_loop=1 to <lds.rowcount>

 lds.setrow=<ll_loop>

 object=ue_api_wo=ftzuordnung=belnr_id=<lds.belnr_id><tab>belpos_id=<lds.belpos_id>

next

destroy=lds

 

getbomquantitysql

This part sequence requires the tables "beas_ftpos" and "beas_ftstl"

declare=mywo=ue_api_wo

select "BEAS_FTSTL"."POS_ID",<mywo.getquantitysql> as "Quantity" from "BEAS_FTSTL","BEAS_FTPOS" where "BEAS_FTSTL"."BELNR_ID"="BEAS_FTPOS"."BELNR_ID" and "BEAS_FTSTL"."BELPOS_ID"="BEAS_FTPOS"."BELPOS_ID"

getsubassembly=belnr_id,belpos_id,pos_id

object=ue_api_wo=getsubassemlby=<belnr_id>=<belpos_id>=<pos_id>

messagebox=<value>

Return as example: "20,30,40"

gettimesql

The partial sequence required the tables beas_ftapl,beas_ftpos and beas_ftapl

 

declare=mywo=ue_api_wo

select "BEAS_FTSTL"."POS_ID",<mywo.gettimesql> as wotime from

"BEAS_FTAPL" inner join "BEAS_FTPOS" on "BEAS_FTAPL"."BELNR_ID"="BEAS_FTPOS"."BELNR_ID" and "BEAS_FTAPL"."BELPOS_ID"="BEAS_FTPOS"."BELPOS_ID" left outer join "BEAS_APLATZ" on "BEAS_FTAPL"."APLATZ_ID"="BEAS_APLATZ"."APLATZ_ID"

where "BEAS_FTAPL"."BELNR_ID"=<str_parm.belnr_id> and "BEAS_FTAPL"."BELPOS_ID"=<str_parm.belpos_id>

select beas_ftstl.pos_id,<mywo.gettimesql> as wotime from

beas_ftapl inner join beas_ftpos on beas_ftapl.belnr_id=beas_ftpos.belnr_id and beas_ftapl.belpos_id=beas_ftpos.belpos_id left outer join beas_aplatz on beas_ftapl.aplatz_id=beas_aplatz.aplatz_id

where beas_ftapl.belnr_id=<str_parm.belnr_id> and beas_ftapl.belpos_id=<str_parm.belpos_id>

inventoryaudit

wo=inventoryaudit=docnumber=posnumber=routingnumber

if <value> = -1 then

  message=info$<valuetext>

end if

Executes an Material
Executes inventory audit for the work sequence.

Return value will be stored in "value"
-1 Inventory not enough
1  Inventory OK

If return value is -1 so the reason will be stored in Variable <valuetext>.


 

loadworkorder

Load work order in memory and allow to change properties on workorder level or add / change work order positions on position level

 

Add Line to existing work order

declare=wo=ue_api_wo

wo=loadworkorder=1411

wo.line.add

wo.line.itemcode=FP

wo.line.quantity_ve=5

wo.line.belpos_id=100

wo.line.save

destroy=wo

 

Change quantity in existing work order

declare=wo=ue_api_wo

wo=loadworkorder=1411

wo.line.gotobelpos_id=10

wo.line.quantity_ve=15

wo.line.save

// Now we must calculate total quantity in BoM

wo.bom_quantity=1411=10

destroy=wo

 

opcandelete=belnr_id,belpos_id,pos_id

return in value: -1 = you can't delete, 1 = you can delete

beas check beas_arbzeit,beas_ftstmp,pch1,por1

object=ue_api_wo=opcandelete=<belnr_id>=<belpos_id>=<pos_id>

messagebox=<value>

refreshschema=belnr_id=belpos_id

This method delete the current schema on BEAS_FTPOS_SCHEMA and insert the updated selected schema.

 

object=ue_api_wo=refreshschema=<belnr_id>=<belpos_id>

reset / new

Delete all instances, insert new entries

residualquantity=belnr_id=belpos_id=pos_id=pos2_id

object=ue_api_wo=residualquantity=<belnr_id>=<belpos_id>=<pos_id>=<pos2_id>

messagebox=Residual Quantity = <value,#0.000000>

routing_close

object=ue_api_wo=routing_close=<belnr_id>=<belpos_id>=<pos_id>

routing_reopen

object=ue_api_wo=routing_reopen=<belnr_id>=<belpos_id>=<pos_id>

set

For set make a load.

you can set some properties in a workorder (beas 9.1 PL: 08)

 

declare=mywo=ue_api_wo

mywo=set=prior_id=1050=10=high

if <return> = -1 then

 messagebox=you can not set the priority!

end if

destroy=mywo

 

 

Settigs for creation or refresh

function

Description

validdate=<date>

set valid date to check bom/routing valid date
you must set before create work order (beas 9.1 PL 8)

capacityautomatic=true/false

make capacity planing automatically after refresh or save (standard = true)

 

 

settings for existing work orders

Function

Description

prior_id=<belnr_id>=<belpos_id>=<value>

set the prior_id

apsstatus=<belnr_id>=<belpos_id>=<value>

set planed 1=planed, 0=unplaned

sperrung=<belnr_id>=<belpos_id>=<value>

lock the workorder J=locked, N=unlock

starttime,startzeit,startzeit_struktur
  =<belnr_id>=<belpos_id>=<value>

Set the "startzeit_struktur" work order.

Date must be always equal or greater than today. If date is previous than today system will assign <today> date.

deliverydate, lieferdatum

  =<belnr_id>=<belpos_id>=<value>

Set the deliverydate infor to work order position

fix, freeze

 

Set all routing position from this work order position and all sub positions to freeze (1) or unfreeze (0)

// freeze all routing position from this

// work order position and his sub structure

object=ue_api_wo=set=freeze=<belnr_id>=<belpos_id>=1

 

ue_api_wo_freeze

 

updateworkorder

wo=loadworkorder=<belnr_id>

// changes

wo=updateworkorder

wipclear=belnr_id=

belpos_id

we found an error in the account-settings. we want to make a automatic correction for all closed workorders

In this script we open the workorder, call the wipclear-Function and close the position.

 

destroy=lds

declare=lds=ue_datastorevalues

lds=select "BELNR_ID","BELPOS_ID","ABGKZ_DATE" from "BEAS_FTPOS" where "ABGKZ"='J'

for ll_loop=1 to <lds.rowcount>

   lds.setrow=<ll_loop>

   select "ABGKZ" from "BEAS_FTHAUPT" where "BELNR_ID"=<lds.belnr_id.value>

   setvar=ls_abgkz=<wert1>

   if <ls_abgkz> = J then

     sql=update "BEAS_FTHAUPT" set "ABGKZ"='N' where "BELNR_ID"=<lds.belnr_id.value>

   end if

   sql=update beas_ftpos set abgkz='N' where belnr_id=<lds.belnr_id.value> &

       and belpos_id=<lds.belpos_id.value>

   setvar=e_date=<lds.abgkz_date,yyyy/mm/dd>

   object=ue_api_wo=wipclear=<lds.belnr_id.value>=<lds.belpos_id.value>

   sql=update "BEAS_FTPOS" set "ABGKZ"='J' where "BELNR_ID"=<lds.belnr_id.value> &

       and "BELPOS_ID"=<lds.belpos_id.value>

   if <ls_abgkz> = J then

     sql=update "BEAS_FTHAUPT" set "ABGKZ"='J' where "BELNR_ID"=<lds.belnr_id.value>

   end if

next

wocanclose

wocanclose=<belnr_id>=<belpos_id>

if <return> n= -1 then

 message=error$you can not close this position

end if