Inventory Calculation

  • Entry the incoming stock data
    • Table: NKK 入庫記録 NyuukoKiroku
      Date IDBangou
      (IDB: ID number, ID番号)
      Suuryou
      (SRY: quantity/amount, 数量)

      update on this table will require
      – calculation of NKSS (Tbl: NKK)
      – update of NKSS (Tbl: DTC)

    • Table: DTC DataCenter

      IDBangou
      (IDB: ID number, ID番号)
      GenzaiZaikosuu
      (GZZKS: Current/Default Amount of Stock,
      現在在庫数)
      ZaikoSuu
      (ZKS: Amount of Stock,
      在庫数)FINAL INFORMATION after calculation
      NyuukoSousuu
      (NKSS: Total Incoming Stock,
      入庫総数)Preliminary calculation (data from Tbl:NKK)
      ShukkoSousuu
      (SKSS: Total Outgoing Stock,
      出庫総数)
      • calculate NKSS
        = sum of SR in Tbl: NKK
        = ZKDB.getNyuukoSousuu()
      • update NKSS in Tbl:DTC
      • calculate ZKS in Tbl:DTC
        ZKS = GZZKS + NKSS – SKSS
      • update ZKS in in Tbl:DTC 
  • Entry the outgoing stock data (leaving warehouse)
    • Table: SKK 出庫記録 ShukkoKiroku
      Date IDBangou
      (IDB: ID number, ID番号)
      Suuryou
      (SRY: quantity/amount, 数量)
      Shukkosha
      (SKS: person who takes items from the warehouse, 出庫者)

      update on this table will require
      – calculation of SKSS (Tbl: SKK)
      – update of SKSS (Tbl: DTC)

    • Table: DTC DataCenter

      IDBangou
      (IDB: ID number, ID番号)
      GenzaiZaikosuu
      (GZZKS: Current/Default Amount of Stock,
      現在在庫数)
      ZaikoSuu
      (ZKS: Amount of Stock,
      在庫数)FINAL INFORMATION after calculation
      NyuukoSousuu
      (NKSS: Total Incoming Stock,
      入庫総数)
      ShukkoSousuu
      (SKSS: Total Outgoing Stock,
      出庫総数)Preliminary calculation (data from Tbl:SKK)
      • calculate SKSS
        = sum of SR in Tbl: NKK
        = ZKDB.getNyuukoSousuu()
      • update SKSS in Tbl:DTC
      • calculate ZKS in Tbl:DTC
        ZKS = GZZKS + NKSS – SKSS
      • update ZKS in in Tbl:DTC

Database related

  • ZKDB.deleteFromShukkoNyuukoKiroku()
    • if tableName = ShuukoKiroku
      • check first if data is available
        query1
        SELECT * FROM ShukkoKiroku WHERE Date = __ AND KojinBangou = ___ AND IDBangou = ___ AND Suuryou = ___ AND Shukkosha = ___ AND rowid= (SELECT COUNT(*) FROM ShukkoKiroku) – __currentRow__–> currentRow: index number in UI ZaikoKanri Page SKK
        –> reason: in UI ZaikoKanri Page SKK, the order is the opposite of the table in the database
      • execute deletion
        query
        DELETE FROM ShukkoKiroku WHERE Date = __ AND KojinBangou = ___ AND IDBangou = ___ AND Suuryou = ___ AND Shukkosha = ___ AND rowid= (SELECT COUNT(*) FROM ShukkoKiroku) – __currentRow__
      • get/calculate SKSS
        getShukkoSousuu()
      • update SKSS in Tbl: DTC
        UPDATE DataCenter SET ShukkoSousuu = __ WHERE IDBangou = __
    • if tableName = NyuukoKiroku
      • check first if data is available
        query1
        SELECT * FROM NyuukoKiroku WHERE Date = __ AND KojinBangou = ___ AND IDBangou = ___ AND Suuryou = ___ AND rowid= (SELECT COUNT(*) FROM NyuukoKiroku) – __currentRow__–> currentRow: index number in UI ZaikoKanri Page SKK
        –> reason: in UI ZaikoKanri Page SKK, the order is the opposite of the table in the database
      • execute deletion
        query
        DELETE FROM NyuukoKiroku WHERE Date = __ AND KojinBangou = ___ AND IDBangou = ___ AND Suuryou = ___ AND rowid= (SELECT COUNT(*) FROM NyuukoKiroku) – __currentRow__
      • get/calculate NKSS
        getNyuukoSousuu()
      • update NKSS in Tbl: DTC
        UPDATE DataCenter SET NyuukoSousuu = __ WHERE IDBangou = __