//
//  DBDaoMgr.h
//  TaiZhouTobacco_7s
//
//  Created by JianjiYuan on 14-8-27.
//  Copyright (c) 2014年 JianjiYuan. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BaseDao.h"

@interface DBDaoMgr : NSObject

// ================= 通用方法 =================
+ (NSString *)convertArrayToString:(NSArray *)array;
+ (NSString *)getMaxTimeFromTable:(NSString *)table;
+ (NSString *)getMaxTimeFromTable:(NSString *)table conditions:(NSDictionary *)conditions;
+ (NSString *)getMaxTimeBySql:(NSString *)sql;

// ================= 通知 =================
+ (BOOL)insertNotice:(NSDictionary *)dic;
+ (NSArray *)fetchNoticeByUserId:(NSString *)userID;
+ (NSArray *)fetchUnReadNoticeByUserId:(NSString *)userID;
+ (NSArray *)fetchBackGroundMusic:(NSString *)userID;
+ (BOOL)updateNoticeById:(NSString *)nid;
+ (BOOL)deleteNoticeByUserID:(NSString*)userID andNoticeID:(NSString*)noticeID;

// ================= 指导书信息 =================
+ (BOOL)insertInstructionBookInfo:(NSString *)totalBytesRead andTotalBytesExpectedToRead:(NSString*)totalBytesExpectedToRead andName:(NSString*)name andTaskStartTime:(NSString*)taskStartTime andTaskEndTime:(NSString*)taskEndTime;
+ (NSArray *)fetchAllInstructionBookInfo;
+ (NSArray *)fetchInstructionBookInfoByName:(NSString *)name;
+ (BOOL)updateInstructionBookInfoSize:(NSString*)size ByName:(NSString *)name;
+ (BOOL)updateInstructionBookInfoStatus:(NSString*)status ByName:(NSString *)name;
+ (BOOL)deleteInstructionBookInfoByName:(NSString *)name;
// ================= 图片 =================
+ (BOOL)insertImages:(NSArray *)images;
+ (NSArray *)fetchImagesByIds:(NSArray *)imageIds;
+ (NSArray *)fetchImagesByType:(NSString *)type checkPointId:(NSString *)checkPointId;
+ (NSArray *)fetchUnUploadedImageIdsByType:(NSString *)type;
+ (BOOL)updateImageTagUploaded:(NSString *)imageId;
+ (BOOL)updateImagesTagUploaded:(NSArray *)images;

// ================= 检查点 =================
+ (BOOL)insertCheckPointInfos:(NSArray *)checkInfos;
+ (NSArray *)fetchCheckPointInfosByIds:(NSArray *)checkInfoIds;
+ (NSArray *)fetchCheckPointInfoByType:(NSString *)type checkPointId:(NSString *)checkPointId;
+ (NSArray *)fetchUnUploadedCheckPointIdsByType:(NSString *)type;
+ (BOOL)updateCheckPointTagUploaded:(NSString *)checkPointId;
+ (BOOL)updateCheckPointInfosTagUploaded:(NSArray *)checkPointIds;


#if 0
// ================= 检查标准 =================
+ (BOOL)insertTaskCheckStandards:(NSArray *)standards;
+ (NSArray *)fetchAllTaskCheckStandards;
+ (NSArray *)fetchTaskCheckStandardsByIds:(NSArray *)standardIds;
+ (BOOL)insertLogisticsStandards:(NSArray *)standards;
+ (NSArray *)fectchLogisticsStandardsByType:(NSString *)equipType;
+ (NSArray *)fectchLogisticsStandardsByIds:(NSArray *)ids;

// ================= 主页菜单 =================
+ (NSArray *)fectchAllModules;
+ (NSArray *)fectchModulesByMenu:(NSString *)menu;

// ================= 任务检查 =================
+ (BOOL)insertTaskChecks:(NSArray *)taskChecks;
+ (NSArray *)fectchAllTaskChecks;
+ (BOOL)updateTaskCheckById:(NSString *)taskId withStandardIds:(NSArray *)standardIds;
+ (BOOL)updateTaskCheckById:(NSString *)taskId withImageIds:(NSArray *)imageIds;

// ================= 临时检查 =================
+ (BOOL)insertTempCheck:(NSObject *)entity;

// ================= 历史检查 =================
+ (BOOL)insertHistoryChecks:(NSArray *)historyChecks;
+ (NSArray *)fectchHistoryChecksByPlaceCode:(NSString *)placeCode;

// ================= 数据上传 =================
+ (NSArray *)fetchUnUploaded7sDatas;
//更新未上传7S数据为已上传
+ (BOOL)updateUnUploadedDatasTagUploaded:(NSArray *)taskChecks;

// ================= 物流设备 =================
//物流巡检设备类型
+ (BOOL)insertLogisticsEquipType:(NSArray *)equipTypes;
+ (NSArray *)fectchAllLogisticsEquipTypes;
//物流巡检设备
+ (BOOL)insertLogisticsEquipments:(NSArray *)equipments;
+ (NSArray *)fectchLogisticsEquipmentsByTypeId:(NSString *)typeId;

/*
// ================= 物流巡检 =================
//Common  热膜，分拣设备，分拣线
+ (BOOL)insertLogisticsCommonChecks:(NSArray *)commonChecks;
+ (NSArray *)fectchAllLogisticsCommonChecksByTypeId:(NSString *)typeId;
+ (BOOL)updateLogisticsCommonCheckByEquipId:(NSString *)equipId withStandardIds:(NSArray *)standardIds;
+ (BOOL)updateLogisticsCommonCheckByEquipId:(NSString *)equipId withImageIds:(NSArray *)imageIds;
// Lift -- 升降机
+ (BOOL)insertLogisticsLiftChecks:(NSArray *)commonChecks;
+ (NSArray *)fectchAllLogisticsLiftChecksByTypeId:(NSString *)typeId;
+ (BOOL)updateLogisticsLiftCheckByEquipId:(NSString *)equipId withStandardIds:(NSArray *)standardIds;
+ (BOOL)updateLogisticsLiftCheckByEquipId:(NSString *)equipId withImageIds:(NSArray *)imageIds;
// Compressor -- 空压机
+ (BOOL)insertLogisticsCompressorChecks:(NSArray *)commonChecks;
+ (NSArray *)fectchAllLogisticsCompressorChecksByTypeId:(NSString *)typeId;
+ (BOOL)updateLogisticsCompressorCheckByEquipId:(NSString *)equipId withStandardIds:(NSArray *)standardIds;
+ (BOOL)updateLogisticsCompressorCheckByEquipId:(NSString *)equipId withImageIds:(NSArray *)imageIds;
 */

// ================= 机房巡检 =================
+ (BOOL)insertRoomStandards:(NSArray *)roomStandards;
+ (NSArray *)fectchAllRoomStandards;
+ (NSArray *)fectchRoomStandardsByIds:(NSArray *)arrStandardIds;

#endif

@end
