Subversion Repositories SmartDukaan

Rev

Rev 4500 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/**
 * 
 */
package in.shop2020.warehouse.domain;

import in.shop2020.warehouse.ScanType;

import java.util.Date;

/**
 * @author mandeep
 *
 */
public class Scan {
    private long id;
    private long inventoryItemId;
    private long quantity;
    private Long orderId; // The order that was fulfilled with thin scan!
    private long warehouseId;
    private long transferLotId;
    private ScanType type;
    private Date scannedAt;
    private String remarks;
    
    public static Scan create(in.shop2020.warehouse.Scan thriftScan) {
        Scan scan = new Scan();
        scan.id = thriftScan.getId();
        scan.inventoryItemId = thriftScan.getInventoryItemId();
        scan.quantity = thriftScan.getQuantity();
        scan.warehouseId = thriftScan.getWarehouseId();
        scan.transferLotId = thriftScan.getTransferLotId();
        scan.type = thriftScan.getType();
        scan.scannedAt = new Date(thriftScan.getScannedAt());
        scan.remarks = thriftScan.getRemarks();

        if (thriftScan.isSetOrderId()) {
            scan.orderId = thriftScan.getOrderId();
        }

        return scan;
    }

    public in.shop2020.warehouse.Scan convert() {
        in.shop2020.warehouse.Scan scan = new in.shop2020.warehouse.Scan();
        scan.setId(id);
        scan.setInventoryItemId(inventoryItemId);
        scan.setQuantity(quantity);
        scan.setWarehouseId(warehouseId);
        scan.setTransferLotId(transferLotId);
        scan.setType(type);
        scan.setScannedAt(scannedAt.getTime());
        scan.setRemarks(remarks);
        if (orderId != null) {
            scan.setOrderId(orderId);
        }

        return scan;
    }

    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    public long getInventoryItemId() {
        return inventoryItemId;
    }
    public void setInventoryItemId(long inventoryItemId) {
        this.inventoryItemId = inventoryItemId;
    }
    public long getQuantity() {
        return quantity;
    }
    public void setQuantity(long quantity) {
        this.quantity = quantity;
    }
    public Long getOrderId() {
        return orderId;
    }
    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }
    public long getWarehouseId() {
        return warehouseId;
    }
    public void setWarehouseId(long warehouseId) {
        this.warehouseId = warehouseId;
    }
    public ScanType getType() {
        return type;
    }
    public void setType(ScanType type) {
        this.type = type;
    }
    public Date getScannedAt() {
        return scannedAt;
    }
    public void setScannedAt(Date scannedAt) {
        this.scannedAt = scannedAt;
    }
        public String getRemarks() {
                return remarks;
        }
        public void setRemarks(String remarks) {
                this.remarks = remarks;
        }
        public long getTransferLotId() {
                return transferLotId;
        }
        public void setTransferLotId(long transferLotId) {
                this.transferLotId = transferLotId;
        }
}