Skip to content

Testy

Scenariusze

  • PZ WZ INDEKS
  • PZ WZ INDEKS SERYJNY
  • PZ WZ INDEKS SERYJNY LOKACJA
  • PZ WZ INDEKS LOKACJA WYMAGANA

Algorytm przyjęcia

  1. [erp].[documentline_InsertUpdate]
  2. [erp].[documentlineIN_Commit]

Algorytm wydania

  1. [erp].[documentlineout_insertupdate]
  2. [erp].[documentlineOUT_Commit]

Wazne obiekty bazy danych

  • [document].[checkUnitConversion] - sprawdzanaie konwersji jednostek
  • EXEC [document].[document_updateSysValues] @documentID = @documentID, @documentLineID = @documentLineID - naglowki
  • [wms].[stockBalanceFix_date] @documentLineID = @documentLineID -- stany
  • [document].[documentLine_updateCoordinationValue] aktualiazcaj ceny materialu na pzk

Nowy algorytm nie oblsuguje

  • PZK - WZK czyli kooperacja
  • nei obsluguje czytnikow one podaja kod lokacji i nie id

Signvalue

signvalue = isnull(cordl.sign, dl.sign)

SQL
select
            sum(case when dl.sign = 1 then 1 else 0 end * dl.itemQuantity) itemQuantityIn
            , sum(case when dl.sign = -1 then 1 else 0 end * dl.itemQuantity) itemQuantityOut
            , sum(case when dl.sign = 1 then 1 else 0 end * isnull(cordl.sign, dl.sign) * dl.sysItemValue) itemValueIn
            , sum(case when dl.sign = -1 then -1 else 0 end * isnull(cordl.sign, dl.sign) * dl.sysItemValue) itemValueOut
            , dl.itemID, dl.locationID, dl.itemSerialNumber, warehouseID ,
            --!UWAGA data
            cast(d.documentdate as date) stockDate
        from document.documentLine dl
            inner join document.document d on d.documentID = dl.documentID
            LEFT JOIN document.documentLine cordl ON dl.initialSourceDocumentLineId = cordl.documentLineID and dl.isCorrectiveLine = 1

1. Dodanie pozycji STANDARD , Dodanie z numerem seryjnym , dokumentu magazynowego

  • nr seryjny musi byc unikalny w ramach dokumentu
  • indeks seryjny wymaga numeru seryjnego
  • jezeli na pozycji zlecenia wms.commsionline.reservedItemSerialNumber jest zarezerwowany nr seryjny wtedy pobiera

Przyklad procedury

SQL
declare @getRandomDecimal3 decimal(18,3) = [dbo].[fn_getRandomDecimal_3](0.1,1000)
declare @getRandomDecimal2 decimal(18,2) = [dbo].[fn_getRandomDecimal_2](400,1000)
declare @price decimal (18,2) =  @getRandomDecimal2/@getRandomDecimal3
declare @documentlineid uniqueidentifier = newID()

exec [erp].[documentline_InsertUpdate]
    @documentid = '0b3782c2-be43-4dac-91dc-d3742221fcbf',
    @documentLineID = @documentlineid,
    @itemSerialNumber = '',                                 -- numer seryjny
    @itemID = '8058af6c-a2e5-4e3f-9258-ff617612b8c7',
    @itemQuantity = @getRandomDecimal3,
    @itemPrice = @price,                                    -- cena moze byc pusta wtedy ostatnia
    @itemValue = @getRandomDecimal2,
    --@locationName = '',                                     -- lokacja po nazwie
    @locationid = GUID,                                     -- lokacja zrodlowa
    @locationIdB = GUID,                                    -- lokacja docelowa
    --@itemConvertUnit = '59fda1d1-1f33-41fb-ae24-e0c1ff42ec0d',
    --@itemConvertQuantity = '10',
    --@itemConvertPrice = '10.23',
    @itemSupplierCode = '',
    @username = 'marcin@platformaerp.com',
    --@commisionLineId = GUID                       -- powiazanie do pozycji zlecenia wazne dla PW/ZW
    --@isCorrectiveLine=1                           -- oznacza korekte default =0
    --@sourceDocumentLineID = GUID                  -- powiązanie do ZW lub korekty
    --@inventorySheetLineId = GUID                  --powiązanie z pozycją arkszua spisowego
    --@orderlineid = GUID                            --powiązanie z pozycja zamowienia