Skip to main content
Skip table of contents

TbeStockReceiptBusinessController

TbeStockReceiptBusinessController

Die Klasse stellt das Funktionalität des Wareneingangs-Moduls im Codeblock zur Verfügung.

Eigenschaft

Bezeichung

CbOptions:O

Options-Objekt

CbBookingOptions:O

Options-Objekt für Buchungsrelevante Eigenschaften

Funktionen und Methoden

Beschreibung

CbClearOptions

Optionen (CbOptions / CbBookingOptions) zurücksetzen

CbCancel

Vorgang abbrechen

Parameter

Beschreibung

aStockReceiptBO:O

Wareneingangs-Businessobjekt

CbInsert

Neuen Wareneingangskopf anlegen

Parameter

Beschreibung

aStockReceiptBO:O

Wareneingangs-Businessobjekt

CbEdit

Wareneingangskopf bearbeiten

Parameter

Beschreibung

aStockReceiptBO:O

Wareneingangs-Businessobjekt

CbValidate

Wareneingansposition validieren (wird schon im CbPost ausgeführt)

Parameter

Beschreibung

aStockReceiptBO:O

Wareneingangs-Businessobjekt

CbDelete

Wareneingangskopf löschen

Parameter

Beschreibung

aStockReceiptBO:O

Wareneingangs-Businessobjekt

CbPost

Wareneingangskopf speichern

Parameter

Beschreibung

aStockReceiptBO:O

Wareneingangs-Businessobjekt

CbInsertPosition

Neue Wareneingangsposition anlegen

Parameter

Beschreibung

aStockReceiptPositionBO:O

Wareneingangspostions-Businessobjekt

CbEditPosition

Wareneingangsposition editieren

Parameter

Beschreibung

aStockReceiptPositionBO:O

Wareneingangspostions-Businessobjekt

CbValidatePosition

Wareneingansposition validieren (wird schon im CbPostPosition ausgeführt)

Parameter

Beschreibung

aStockReceiptPositionBO:O

Wareneingangspostions-Businessobjekt

CbDeletePosition

Wareneingangsposition löschen

Parameter

Beschreibung

aStockReceiptPositionBO:O

Wareneingangspostions-Businessobjekt

CbPostPosition

Wareneingangsposition speichern

Parameter

Beschreibung

aStockReceiptPositionBO:O

Wareneingangspostions-Businessobjekt

CbBookAllPositions

Alle Positionen im Wareneingangskopf buchen

Parameter

Beschreibung

aStockReceiptBO:O

Wareneingangs-Businessobjekt

aStockReceiptPositionBO:O

Wareneingangspostions-Businessobjekt

Beispiel

Codeblock-Beispiel
CODE
|oBC:O, oBO:O, oPositionBO:O, oDM:O, cStep:C|

// Notwendige Anpassungen in der Datenbank:
// B-1: Platzverwaltung = J
// DabPAL: WE Autom.Buchung zu Joblisten = alle
// DabPAL: Bedingung Autom. Buchung = DAB255:JOBLISTE <> 5

//******************************************************************************
function Resume(cNextStep)
Result := JN('DONE: ' + cStep + CRLF + 'NEXT: ' + cNextStep),
if Result then
cStep := cNextStep,
endif,
end,

//******************************************************************************
function LogAndCopy(cText)
writeln(cText),
if belmBeas <> LoadedModule then
CopyToClipboard(cText),
endif,
end,

//******************************************************************************
function CreateSR(
nPersNo:N,
cType:C,
cSenderType:C,
nSenderNo:N,
cCommission:C,
dCommissionDate:D)
|_|
oDM.CbTransaction_Begin(),
startseq
oBC.CbInsert(oBO),
oBO.CbPersonalNo := nPersNo,
oBO.CbReceiType := cType,
oBO.CbBookingDate := Today(),
oBO.CbSenderType := cSenderType,
oBO.CbSenderNo := nSenderNo,
oBO.CbVoucherNo := cCommission,
oBO.CbVoucherDate := dCommissionDate,
oBO.CbPackType := ArrToStr({{'BOX', 1, 1}}),
oBC.CbPost(oBO),
oDM.CbTransaction_Commit(),
Result := oBO.CbStockReceiptNo,
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function EditSR(
cSRNumber:C,
cType:C,
cSenderType:C,
nSenderNo:N,
aPackType:A)
|_|
oDM.CbTransaction_Begin(),
startseq
oBO.CbGoToStockReceiptNo(cSRNumber),
oBC.CbEdit(oBO),
oBO.CbReceiType := cType,
oBO.CbSenderType := cSenderType,
oBO.CbSenderNo := nSenderNo,
oBO.CbPackType := ArrToStr(aPackType),
oBC.CbPost(oBO),
oDM.CbTransaction_Commit(),
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function CancelSR(
cSRNumber:C)
|_|
oDM.CbTransaction_Begin(),
startseq
oBO.CbGoToStockReceiptNo(cSRNumber),
oBC.CbEdit(oBO),
oBO.CbPackType := ArrToStr({{'Canceled', 1, 1}}),
oBC.CbCancel(oBO),
oDM.CbTransaction_Commit(),
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function DeleteSR(
cSRNumber:C)
|_|
oDM.CbTransaction_Begin(),
startseq
oBO.CbGoToStockReceiptNo(cSRNumber),
oBC.CbDelete(oBO),
oDM.CbTransaction_Commit(),
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function CreatePosition(
cArticleNo:C,
nExpected:N,
nCurrent:N,
nJobList:N)
|_|
oDM.CbTransaction_Begin(),
startseq
oBC.CbInsertPosition(oBO, oPositionBO),
oPositionBO.CbPersonalNo := oBO.CbPersonalNo,
oPositionBO.CbArticleNo := cArticleNo,
oPositionBO.CbExpectedQuantity := nExpected,
oPositionBO.CbCurrentQuantity := nCurrent,
oPositionBO.CbPackagingUnits := ArrToStr({{nCurrent, 1}}),
oPositionBO.CbJobList := nJobList,
oBC.CbBookingOptions.CommissionArray := {{,nExpected,nCurrent}},
oBC.CbBookingOptions.StoreNo := '0',
oBC.CbPostPosition(oPositionBO),
oDM.CbTransaction_Commit(),
Result := oPositionBO.CbStockReceiptPositionNo,
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function EditPosition(
cSRPositionNumber:C,
cArticleNo:C,
nExpected:N,
nCurrent:N,
nJobList:N:=-1)
|_|
oDM.CbTransaction_Begin(),
startseq
oPositionBO.CbGoToStockReceiptPositionNo(cSRPositionNumber),
oBC.CbEditPosition(oPositionBO), ,
oPositionBO.CbArticleNo := cArticleNo,
oPositionBO.CbExpectedQuantity := nExpected,
oPositionBO.CbCurrentQuantity := nCurrent,
oPositionBO.CbPackagingUnits := ArrToStr({{nCurrent, 1}}),
oPositionBO.CbCharges := ArrToStr({{'WOW',
nCurrent, nExpected, 0, 0, 0, 0, false}}),
if nJobList <> -1 then
oPositionBO.CbJobList := nJobList,
endif,
oBC.CbPostPosition(oPositionBO),
oDM.CbTransaction_Commit(),
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function CancelPosition(
cSRPositionNumber:C)
|_|
oDM.CbTransaction_Begin(),
startseq
oPositionBO.CbGoToStockReceiptPositionNo(cSRPositionNumber),
oBC.CbEditPosition(oPositionBO),
oPositionBO.CbArticleNo := 'MASCHINE',
oPositionBO.CbExpectedQuantity := 2,
oPositionBO.CbCurrentQuantity := 2,
oPositionBO.CbPackagingUnits := ArrToStr({{2, 1}}),
oPositionBO.CbCharges := ArrToStr({{'WOW1', 1, 1}, {'WOW2', 1, 1}}),
oBC.CbCancelPosition(oPositionBO),
oDM.CbTransaction_Commit(),
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function DeletePosition(
cSRPositionNo:C)
|_|
oDM.CbTransaction_Begin(),
startseq
oPositionBO.CbGotoStockReceiptPositionNo(cSRPositionNo),
oBC.CbDeletePosition(oPositionBO),
oDM.CbTransaction_Commit(),
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function Interactive()
| sr_no, pos_no |
cStep := 'Create SR',
sr_no := CreateSR(1, 'W', 'Z', 70000000, 'PAKET0', Today()),
LogAndCopy(cStep + ': ' + sr_no),

if Resume('Edit SR') then
EditSR(sr_no, 'K', 'K', 10000000, {{'PAKET', 2, 2}}),
LogAndCopy(cStep + ': ' + sr_no),
endif,

if Resume('Cancel SR') then
CancelSR(sr_no),
LogAndCopy(cStep + ': ' + sr_no),
endif,

if Resume('Create Position') then
pos_no := CreatePosition('MUTTER M4', 100, 100, 2),
LogAndCopy(cStep + ': ' + pos_no),

if Resume('Edit Position') then
EditPosition(pos_no, 'KLEBSTOFF', 50, 50),
LogAndCopy(cStep + ': ' + pos_no),
endif,

if Resume('Cancel Position') then
CancelPosition(pos_no),
LogAndCopy(cStep + ': ' + pos_no),
endif,

if Resume('Delete Position') then
DeletePosition(pos_no),
LogAndCopy(cStep + ': ' + pos_no),
endif,
endif,

if Resume('Delete SR') then
DeleteSR(sr_no),
LogAndCopy(cStep + ': ' + sr_no),
endif,
end,

//******************************************************************************
function NormalRun()
| sr_no, pos_no |
sr_no := CreateSR(1, 'K', 'K', 10000000, 'PAKET1', Today()),
EditSR(sr_no, 'W', 'Z', 70000000, {{'PAKET', 2, 2}}),
CancelSR(sr_no),
pos_no := CreatePosition('MUTTER M4', 100, 100, 5),
EditPosition(pos_no, 'KLEBSTOFF', 50, 50),
CancelPosition(pos_no),
DeletePosition(pos_no),
DeleteSR(sr_no),
writeln('Normal run: OK'),
end,

//******************************************************************************
function AutoBookRun()
| sr_no, pos_no |
sr_no := CreateSR(1, 'W', 'Z', 70000000, 'PAKET2', Today()),
pos_no := CreatePosition('B-1', 15, 15, 2),
startseq
DeletePosition(pos_no),
onerror
writeln('AutoBook run: Cant delete done position'),
stopseq,
startseq
DeleteSR(sr_no),
onerror
writeln('AutoBook run: Cant delete done SR'),
stopseq,
if oPositionBO.CbStockReceiptPositionNo == pos_no then
writeln('AutoBook run: OK'),
else
SetError('AutoBook run: Deleted position!'),
endif,
end,

//******************************************************************************
function BookAllRun()
| sr_no, pos_no |
sr_no := CreateSR(1, 'W', 'Z', 70000000, 'PAKET3', Today()),
pos_no := CreatePosition('B-1', 15, 15, 5),
pos_no := CreatePosition('MUTTER M4', 100, 100, 5),
pos_no := CreatePosition('MUTTER M4', 500, 500, 5),

oDM.CbTransaction_Begin(),
startseq
oBC.CbBookingOptions.PersonalNo := 1,
oBC.CbBookingOptions.StoreNo := '0',
oBC.CbBookingOptions.BookAll := true,
oBC.CbBookAllPositions(oBO, oPositionBO),
oDM.CbTransaction_Commit(),
writeln('BookAllRun: OK'),
always
oDM.CbTransaction_TryRollback(),
stopseq,
end,

//******************************************************************************
function SetDone()
| sr_no, pos_no, i |
sr_no := CreateSR(1, 'W', 'Z', 70000000, 'PAKET4', Today()),

oBC.CbOptions.MarkAsDone := true,
pos_no := CreatePosition('B-1', 15, 15, 2),
writeln('Dab250:Done', oBO.CbDone),
if oBO.CbDone then
writeln('SetDone: OK 2'),
else
writeln('SetDone: Failure 2'),
endif,
end,

//******************************************************************************
function RunTests()
NormalRun(),
AutoBookRun(),
BookAllRun(),
SetDone(),
end,

//******************************************************************************
// MAIN PROGRAM
//******************************************************************************
function Main()

oDM := CreateObject('TbeDbGet'),
startseq
oBC := CreateObject('TbeStockReceiptBusinessController',,oDM),
oBO := CreateObject('TbeStockReceiptBO',,oDM),
oPositionBO := CreateObject('TbeStockReceiptPositionBO',,oDM),

oBC.CbDataModule := oDM,
oBO.CbDataModule := oDM,
oPositionBO.CbDataModule := oDM,

Interactive(),

RunTests(),
always
DestroyObject(oDM),
stopseq,
end,

Main()

Weitere Verknüpfungen

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.