Android Open Source - WarehouseBarcode Barcode






From Project

Back to project page WarehouseBarcode.

License

The source code is released under:

MIT License

If you think the Android project WarehouseBarcode listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.hlgranite.warehousescanner;
/* w  w  w.  j av  a2  s .c om*/
import java.util.Date;

/**
 * Created by yeang-shing.then on 9/19/13.
 */
public class Barcode {

    private String stockCode;
    public String getStockCode() {
        return this.stockCode;
    }

    private int width;
    public int getWidth() {
        return this.width;
    }

    private int length;
    public int getLength() {
        return this.length;
    }

    private String shipment;
    public String getShipment() {
        return this.shipment;
    }

    private String warehouseCode;
    public String getWarehouse() {
        return this.warehouseCode;
    }

    private String number;
    public void setNumber(String number) {
        this.number = number;
        if(number.length() >= 4)
            this.stockCode = number.substring(0, 4);
        if(number.length() >= 8)
            this.width = Integer.parseInt(number.substring(4,8));
        if(number.length() >= 12)
            this.length = Integer.parseInt(number.substring(8,12));
        if(number.length() >= 15) {
            this.shipment = number.substring(12,15);
            this.shipDate = FusionManager.getInstance().getShipDate(this.shipment);
            this.lastUpdated = FusionManager.getInstance().getShipDate(this.shipment);
        }
        if(number.length() >= 16)
            this.warehouseCode = number.substring(15,16);
//        Log.i("INFO", "Stock: " + stockCode);
//        Log.i("INFO", "Width: " + width);
//        Log.i("INFO", "Length: " + length);
//        Log.i("INFO", "Shipment: " + shipment);
//        Log.i("INFO", "Warehouse: " + warehouseCode);
    }
    public String getNumber() {
        return this.number;
    }

    private Date shipDate;
    /**
     * Return ship date for this barcode.
     * @return
     */
    public Date getShipDate() {
        return this.shipDate;
    }

    private Date lastUpdated;
    /**
     * Return last updated date. This will be recent checkout date if not return shipment date.
     * @return
     */
    public Date getLastUpdated() {
        return this.lastUpdated;
    }

    public Barcode(String number) {
        setNumber(number);
    }
    public Barcode(String stockCode, int width, int length, String shipment, String warehouse) {
        this.stockCode = stockCode;
        this.width = width;
        this.length = length;
        this.shipment = shipment;
        this.shipDate = FusionManager.getInstance().getShipDate(this.shipment);
        this.lastUpdated = FusionManager.getInstance().getShipDate(this.shipment);
        this.warehouseCode = warehouse;
        this.number = toString();
    }

    /**
     * Keep the last updated date either shipment or checkout date.
     * @param date
     */
    public void setLastUpdated(Date date) {
        if(date == null) return;

        if(this.shipDate == null) this.shipDate = date;
        if(this.lastUpdated == null) {
            this.lastUpdated = date;
        } else {
            if(date.compareTo(this.lastUpdated) > 0) {
                this.lastUpdated = date;
            }
        }
    }

    @Override
    public String toString() {
        return this.stockCode+String.format(Unit.LENGTH_FORMAT, this.width)
                + String.format(Unit.LENGTH_FORMAT, this.length)+this.shipment+this.warehouseCode;
    }

    //<editor-fold desc="Determine uniqueness when calling Collections.contains">
    @Override
    public int hashCode() {
        return toString().hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if(this == obj) return true;
        Barcode b = (Barcode)obj;
        return toString().equals(b.toString());
    }
    //</editor-fold>
}




Java Source Code List

com.hlgranite.Utils.java
com.hlgranite.warehousescanner.AboutActivity.java
com.hlgranite.warehousescanner.AreaComparator.java
com.hlgranite.warehousescanner.Area.java
com.hlgranite.warehousescanner.BalanceActivity.java
com.hlgranite.warehousescanner.Barcode.java
com.hlgranite.warehousescanner.CheckoutActivity.java
com.hlgranite.warehousescanner.Customer.java
com.hlgranite.warehousescanner.FusionManager.java
com.hlgranite.warehousescanner.HistoryActivity.java
com.hlgranite.warehousescanner.InventoryAdapter.java
com.hlgranite.warehousescanner.InventoryExpandableAdapter.java
com.hlgranite.warehousescanner.MainActivity.java
com.hlgranite.warehousescanner.ManualActivity.java
com.hlgranite.warehousescanner.QuantityComparator.java
com.hlgranite.warehousescanner.SettingsActivity.java
com.hlgranite.warehousescanner.ShipCode.java
com.hlgranite.warehousescanner.Shipment.java
com.hlgranite.warehousescanner.StockCodeComparator.java
com.hlgranite.warehousescanner.Stock.java
com.hlgranite.warehousescanner.Unit.java
com.hlgranite.warehousescanner.Warehouse.java
com.hlgranite.warehousescanner.WorkOrderAdapter.java
com.hlgranite.warehousescanner.WorkOrder.java