package sql.com.yz.db;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.sxyz.rfid.greendao.model.WmsInventoryTaskDetail;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "wms_inventory_task_detail".
*/
public class WmsInventoryTaskDetailDao extends AbstractDao<WmsInventoryTaskDetail, Long> {

    public static final String TABLENAME = "wms_inventory_task_detail";

    /**
     * Properties of entity WmsInventoryTaskDetail.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property DetailId = new Property(0, Long.class, "detailId", true, "detail_id");
        public final static Property TaskId = new Property(1, Integer.class, "taskId", false, "task_id");
        public final static Property InventoryId = new Property(2, Integer.class, "inventoryId", false, "inventory_id");
        public final static Property MaterialId = new Property(3, Integer.class, "materialId", false, "material_id");
        public final static Property WarehouseId = new Property(4, Integer.class, "warehouseId", false, "warehouse_id");
        public final static Property WarehouseName = new Property(5, String.class, "warehouseName", false, "warehouse_name");
        public final static Property AreaId = new Property(6, Integer.class, "areaId", false, "area_id");
        public final static Property AreaName = new Property(7, String.class, "areaName", false, "area_name");
        public final static Property LocationId = new Property(8, Integer.class, "locationId", false, "location_id");
        public final static Property LocationName = new Property(9, String.class, "locationName", false, "location_name");
        public final static Property BatchNo = new Property(10, String.class, "batchNo", false, "batch_no");
        public final static Property SystemQty = new Property(11, Float.class, "systemQty", false, "system_quantity");
        public final static Property ActualQty = new Property(12, Float.class, "actualQty", false, "actual_quantity");
        public final static Property DiffQty = new Property(13, Float.class, "diffQty", false, "difference_rate");
        public final static Property DiffReason = new Property(14, String.class, "diffReason", false, "difference_reason");
        public final static Property CheckStatus = new Property(15, String.class, "checkStatus", false, "check_status");
        public final static Property CheckerId = new Property(16, Integer.class, "checkerId", false, "checker_id");
        public final static Property CheckerName = new Property(17, String.class, "checkerName", false, "checker_name");
        public final static Property CheckTime = new Property(18, String.class, "checkTime", false, "check_time");
        public final static Property RfidTag = new Property(19, String.class, "rfidTag", false, "rfid_tag");
        public final static Property Barcode = new Property(20, String.class, "barcode", false, "barcode");
        public final static Property IsBlindZone = new Property(21, String.class, "isBlindZone", false, "is_blind_zone");
        public final static Property QualityStatus = new Property(22, String.class, "qualityStatus", false, "quality_status");
        public final static Property DelFlag = new Property(23, String.class, "delFlag", false, "del_flag");
        public final static Property CreateTime = new Property(24, String.class, "createTime", false, "create_time");
        public final static Property UpdateTime = new Property(25, String.class, "updateTime", false, "update_time");
        public final static Property Remark = new Property(26, String.class, "remark", false, "remark");
    }


    public WmsInventoryTaskDetailDao(DaoConfig config) {
        super(config);
    }
    
    public WmsInventoryTaskDetailDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"wms_inventory_task_detail\" (" + //
                "\"detail_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: detailId
                "\"task_id\" INTEGER," + // 1: taskId
                "\"inventory_id\" INTEGER," + // 2: inventoryId
                "\"material_id\" INTEGER," + // 3: materialId
                "\"warehouse_id\" INTEGER," + // 4: warehouseId
                "\"warehouse_name\" TEXT," + // 5: warehouseName
                "\"area_id\" INTEGER," + // 6: areaId
                "\"area_name\" TEXT," + // 7: areaName
                "\"location_id\" INTEGER," + // 8: locationId
                "\"location_name\" TEXT," + // 9: locationName
                "\"batch_no\" TEXT," + // 10: batchNo
                "\"system_quantity\" REAL," + // 11: systemQty
                "\"actual_quantity\" REAL," + // 12: actualQty
                "\"difference_rate\" REAL," + // 13: diffQty
                "\"difference_reason\" TEXT," + // 14: diffReason
                "\"check_status\" TEXT," + // 15: checkStatus
                "\"checker_id\" INTEGER," + // 16: checkerId
                "\"checker_name\" TEXT," + // 17: checkerName
                "\"check_time\" TEXT," + // 18: checkTime
                "\"rfid_tag\" TEXT," + // 19: rfidTag
                "\"barcode\" TEXT," + // 20: barcode
                "\"is_blind_zone\" TEXT," + // 21: isBlindZone
                "\"quality_status\" TEXT," + // 22: qualityStatus
                "\"del_flag\" TEXT," + // 23: delFlag
                "\"create_time\" TEXT," + // 24: createTime
                "\"update_time\" TEXT," + // 25: updateTime
                "\"remark\" TEXT);"); // 26: remark
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"wms_inventory_task_detail\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, WmsInventoryTaskDetail entity) {
        stmt.clearBindings();
 
        Long detailId = entity.getDetailId();
        if (detailId != null) {
            stmt.bindLong(1, detailId);
        }
 
        Integer taskId = entity.getTaskId();
        if (taskId != null) {
            stmt.bindLong(2, taskId);
        }
 
        Integer inventoryId = entity.getInventoryId();
        if (inventoryId != null) {
            stmt.bindLong(3, inventoryId);
        }
 
        Integer materialId = entity.getMaterialId();
        if (materialId != null) {
            stmt.bindLong(4, materialId);
        }
 
        Integer warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(5, warehouseId);
        }
 
        String warehouseName = entity.getWarehouseName();
        if (warehouseName != null) {
            stmt.bindString(6, warehouseName);
        }
 
        Integer areaId = entity.getAreaId();
        if (areaId != null) {
            stmt.bindLong(7, areaId);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(8, areaName);
        }
 
        Integer locationId = entity.getLocationId();
        if (locationId != null) {
            stmt.bindLong(9, locationId);
        }
 
        String locationName = entity.getLocationName();
        if (locationName != null) {
            stmt.bindString(10, locationName);
        }
 
        String batchNo = entity.getBatchNo();
        if (batchNo != null) {
            stmt.bindString(11, batchNo);
        }
 
        Float systemQty = entity.getSystemQty();
        if (systemQty != null) {
            stmt.bindDouble(12, systemQty);
        }
 
        Float actualQty = entity.getActualQty();
        if (actualQty != null) {
            stmt.bindDouble(13, actualQty);
        }
 
        Float diffQty = entity.getDiffQty();
        if (diffQty != null) {
            stmt.bindDouble(14, diffQty);
        }
 
        String diffReason = entity.getDiffReason();
        if (diffReason != null) {
            stmt.bindString(15, diffReason);
        }
 
        String checkStatus = entity.getCheckStatus();
        if (checkStatus != null) {
            stmt.bindString(16, checkStatus);
        }
 
        Integer checkerId = entity.getCheckerId();
        if (checkerId != null) {
            stmt.bindLong(17, checkerId);
        }
 
        String checkerName = entity.getCheckerName();
        if (checkerName != null) {
            stmt.bindString(18, checkerName);
        }
 
        String checkTime = entity.getCheckTime();
        if (checkTime != null) {
            stmt.bindString(19, checkTime);
        }
 
        String rfidTag = entity.getRfidTag();
        if (rfidTag != null) {
            stmt.bindString(20, rfidTag);
        }
 
        String barcode = entity.getBarcode();
        if (barcode != null) {
            stmt.bindString(21, barcode);
        }
 
        String isBlindZone = entity.getIsBlindZone();
        if (isBlindZone != null) {
            stmt.bindString(22, isBlindZone);
        }
 
        String qualityStatus = entity.getQualityStatus();
        if (qualityStatus != null) {
            stmt.bindString(23, qualityStatus);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(24, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(25, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(26, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(27, remark);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, WmsInventoryTaskDetail entity) {
        stmt.clearBindings();
 
        Long detailId = entity.getDetailId();
        if (detailId != null) {
            stmt.bindLong(1, detailId);
        }
 
        Integer taskId = entity.getTaskId();
        if (taskId != null) {
            stmt.bindLong(2, taskId);
        }
 
        Integer inventoryId = entity.getInventoryId();
        if (inventoryId != null) {
            stmt.bindLong(3, inventoryId);
        }
 
        Integer materialId = entity.getMaterialId();
        if (materialId != null) {
            stmt.bindLong(4, materialId);
        }
 
        Integer warehouseId = entity.getWarehouseId();
        if (warehouseId != null) {
            stmt.bindLong(5, warehouseId);
        }
 
        String warehouseName = entity.getWarehouseName();
        if (warehouseName != null) {
            stmt.bindString(6, warehouseName);
        }
 
        Integer areaId = entity.getAreaId();
        if (areaId != null) {
            stmt.bindLong(7, areaId);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(8, areaName);
        }
 
        Integer locationId = entity.getLocationId();
        if (locationId != null) {
            stmt.bindLong(9, locationId);
        }
 
        String locationName = entity.getLocationName();
        if (locationName != null) {
            stmt.bindString(10, locationName);
        }
 
        String batchNo = entity.getBatchNo();
        if (batchNo != null) {
            stmt.bindString(11, batchNo);
        }
 
        Float systemQty = entity.getSystemQty();
        if (systemQty != null) {
            stmt.bindDouble(12, systemQty);
        }
 
        Float actualQty = entity.getActualQty();
        if (actualQty != null) {
            stmt.bindDouble(13, actualQty);
        }
 
        Float diffQty = entity.getDiffQty();
        if (diffQty != null) {
            stmt.bindDouble(14, diffQty);
        }
 
        String diffReason = entity.getDiffReason();
        if (diffReason != null) {
            stmt.bindString(15, diffReason);
        }
 
        String checkStatus = entity.getCheckStatus();
        if (checkStatus != null) {
            stmt.bindString(16, checkStatus);
        }
 
        Integer checkerId = entity.getCheckerId();
        if (checkerId != null) {
            stmt.bindLong(17, checkerId);
        }
 
        String checkerName = entity.getCheckerName();
        if (checkerName != null) {
            stmt.bindString(18, checkerName);
        }
 
        String checkTime = entity.getCheckTime();
        if (checkTime != null) {
            stmt.bindString(19, checkTime);
        }
 
        String rfidTag = entity.getRfidTag();
        if (rfidTag != null) {
            stmt.bindString(20, rfidTag);
        }
 
        String barcode = entity.getBarcode();
        if (barcode != null) {
            stmt.bindString(21, barcode);
        }
 
        String isBlindZone = entity.getIsBlindZone();
        if (isBlindZone != null) {
            stmt.bindString(22, isBlindZone);
        }
 
        String qualityStatus = entity.getQualityStatus();
        if (qualityStatus != null) {
            stmt.bindString(23, qualityStatus);
        }
 
        String delFlag = entity.getDelFlag();
        if (delFlag != null) {
            stmt.bindString(24, delFlag);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(25, createTime);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(26, updateTime);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(27, remark);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    @Override
    public WmsInventoryTaskDetail readEntity(Cursor cursor, int offset) {
        WmsInventoryTaskDetail entity = new WmsInventoryTaskDetail( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // detailId
            cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1), // taskId
            cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // inventoryId
            cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // materialId
            cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4), // warehouseId
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // warehouseName
            cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6), // areaId
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // areaName
            cursor.isNull(offset + 8) ? null : cursor.getInt(offset + 8), // locationId
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // locationName
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // batchNo
            cursor.isNull(offset + 11) ? null : cursor.getFloat(offset + 11), // systemQty
            cursor.isNull(offset + 12) ? null : cursor.getFloat(offset + 12), // actualQty
            cursor.isNull(offset + 13) ? null : cursor.getFloat(offset + 13), // diffQty
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // diffReason
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // checkStatus
            cursor.isNull(offset + 16) ? null : cursor.getInt(offset + 16), // checkerId
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // checkerName
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // checkTime
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // rfidTag
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // barcode
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // isBlindZone
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // qualityStatus
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // delFlag
            cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // createTime
            cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // updateTime
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // remark
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, WmsInventoryTaskDetail entity, int offset) {
        entity.setDetailId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setTaskId(cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1));
        entity.setInventoryId(cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2));
        entity.setMaterialId(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3));
        entity.setWarehouseId(cursor.isNull(offset + 4) ? null : cursor.getInt(offset + 4));
        entity.setWarehouseName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setAreaId(cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6));
        entity.setAreaName(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setLocationId(cursor.isNull(offset + 8) ? null : cursor.getInt(offset + 8));
        entity.setLocationName(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setBatchNo(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setSystemQty(cursor.isNull(offset + 11) ? null : cursor.getFloat(offset + 11));
        entity.setActualQty(cursor.isNull(offset + 12) ? null : cursor.getFloat(offset + 12));
        entity.setDiffQty(cursor.isNull(offset + 13) ? null : cursor.getFloat(offset + 13));
        entity.setDiffReason(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setCheckStatus(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setCheckerId(cursor.isNull(offset + 16) ? null : cursor.getInt(offset + 16));
        entity.setCheckerName(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setCheckTime(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setRfidTag(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setBarcode(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setIsBlindZone(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setQualityStatus(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setDelFlag(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setCreateTime(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
        entity.setUpdateTime(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
        entity.setRemark(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(WmsInventoryTaskDetail entity, long rowId) {
        entity.setDetailId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(WmsInventoryTaskDetail entity) {
        if(entity != null) {
            return entity.getDetailId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(WmsInventoryTaskDetail entity) {
        return entity.getDetailId() != null;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
