Commit 76978cd6 by Kazuyuki Hida

Merge branch 'contract/sato/1.0.300_51462' into 'contract/sato/1.0.300_dev'

Contract/sato/1.0.300 51462

See merge request !258
parents c3fd5041 93022493
......@@ -60,6 +60,10 @@ public class OperationListJSON extends AcmsCommonJSON {
public static final String OperationGroupMasterIdList = "operationGroupMasterIdList";
public static final String QuickReport = "quickReport";
public static final String statusNotStartedCount = "statusNotStartedCount"; //「未実施」数
public static final String statusWorkingCount = "statusWorkingCount"; //「作業中」数
public static final String statusCompletedCount = "statusCompletedCount"; // 「作業完了」数
public List<OperationDto> operationList;
public OperationListJSON(String jsonString) throws AcmsException {
......@@ -90,6 +94,9 @@ public class OperationListJSON extends AcmsCommonJSON {
dto.enableReportEdit = operationJson.has(EnableReportEdit) ? operationJson.getInt(EnableReportEdit) : 0; // 作業編集区分
dto.enableAddReport = operationJson.has(EnableAddReport) ? operationJson.getInt(EnableAddReport) : 0; // 作業追加区分
dto.quickReport = operationJson.has(QuickReport) ? operationJson.getInt(QuickReport) : 0;
dto.statusNotStartedCount = operationJson.has(statusNotStartedCount) ? operationJson.getInt(statusNotStartedCount) : 0; //「未実施」数
dto.statusWorkingCount = operationJson.has(statusWorkingCount) ? operationJson.getInt(statusWorkingCount) : 0; //「未実施」数 //「作業中」数
dto.statusCompletedCount = operationJson.has(statusCompletedCount) ? operationJson.getInt(statusCompletedCount) : 0; //「未実施」数 // 「作業完了」数
// 作業終了更新日
if (operationJson.has(OperationLastEditDate)) {
......
......@@ -19,7 +19,7 @@ import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;
public class DBConnector {
private static volatile DBConnector dbConnector = null;
public static final String DatabaseName = "ABVJE";
public static final int DatabaseVersion = DatabaseVersions.Ver1_0_3;
public static final int DatabaseVersion = DatabaseVersions.Ver1_0_5;
protected SQLiteDatabase db = null;
......
......@@ -5,5 +5,7 @@ public class DatabaseVersions {
public static final int Ver1_0_0 = 1;
public static final int Ver1_0_2 = 11; // SATO HACCP 1.0.2
public static final int Ver1_0_3 = 21; // @From カテゴリ選択機能追加
public static final int Ver1_0_4 = 31; // @From 作業の進捗状況を追加
public static final int Ver1_0_5 = 41; // @From 作業のロック、差し戻し対応
public static final int Ver1_0_6 = 51; // @From 作業のロック情報を追加
}
......@@ -117,6 +117,21 @@ public class OperationDao extends AbstractDao {
dto.quickReport = cursor.getInt(column);
}
column = cursor.getColumnIndex("status_not_started_count");
if (column != -1) {
dto.statusNotStartedCount = cursor.getInt(column);
}
column = cursor.getColumnIndex("status_working_count");
if (column != -1) {
dto.statusWorkingCount = cursor.getInt(column);
}
column = cursor.getColumnIndex("status_completed_count");
if (column != -1) {
dto.statusCompletedCount = cursor.getInt(column);
}
return dto;
}
......@@ -188,9 +203,12 @@ public class OperationDao extends AbstractDao {
+ "enable_report_history, "
+ "enable_report_edit,"
+ "enable_add_report,"
+ "status_not_started_count, "
+ "status_working_count, "
+ "status_completed_count, "
+ "quick_report) "
+ "values "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
}
......@@ -212,6 +230,9 @@ public class OperationDao extends AbstractDao {
+ "enable_report_history=?, "
+ "enable_report_edit=?, "
+ "enable_add_report=?, "
+ "status_not_started_count=?, "
+ "status_working_count=?, "
+ "status_completed_count=?, "
+ "quick_report=? "
+ "where operation_id=?",
dto.getUpdateValues());
......
package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -16,6 +17,10 @@ public class TaskReportDao extends AbstractDao {
private static final String TAG = "TaskReportDao";
private static final int REPORT_LOCKING = 0;
private static final int REPORT_UNLOCKED = 1;
private static final int REPORT_PENDING = 2;
/*package*/ TaskReportDao() {
}
......@@ -92,6 +97,44 @@ public class TaskReportDao extends AbstractDao {
dto.localSavedFlg = toBool(cursor.getInt(column));
}
column = cursor.getColumnIndex("report_lock_user_id");
if (column != -1) {
dto.reportLockUserId = cursor.getString(column);
}
column = cursor.getColumnIndex("report_lock_user_name");
if (column != -1) {
dto.reportLockUserName = cursor.getString(column);
}
column = cursor.getColumnIndex("report_lock_time");
if (column != -1) {
dto.reportLockTime = DateTimeUtil.toDate(cursor.getString(column), "UTC", DateTimeFormat.yyyyMMddHHmmss_hyphen);
}
column = cursor.getColumnIndex("send_back_user_id");
if (column != -1) {
dto.sendBackUserId = cursor.getString(column);
}
column = cursor.getColumnIndex("send_back_user_name");
if (column != -1) {
dto.sendBackUserName = cursor.getString(column);
}
column = cursor.getColumnIndex("send_back_comment");
if (column != -1) {
dto.sendBackComment = cursor.getString(column);
}
column = cursor.getColumnIndex("task_status");
if (column != -1) {
dto.taskStatus = cursor.getString(column);
}
column = cursor.getColumnIndex("report_status");
if (column != -1) {
dto.reportStatus = cursor.getInt(column);
}
return dto;
}
......@@ -113,9 +156,17 @@ public class TaskReportDao extends AbstractDao {
+ "report_end_date, "
+ "enable_report, "
+ "task_report_level, "
+ "report_lock_user_id, "
+ "report_lock_user_name, "
+ "report_lock_time, "
+ "send_back_user_id, "
+ "send_back_user_name, "
+ "send_back_comment, "
+ "task_status, "
+ "report_status, "
+ "local_saved_flg ) "
+ "values "
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?)",
+ "(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
dto.getInsertValues());
}
......@@ -137,21 +188,77 @@ public class TaskReportDao extends AbstractDao {
sql.append("enable_report=?, ");
sql.append("task_report_level=?, ");
sql.append("local_saved_flg=?, ");
sql.append("report_lock_user_id=?, ");
sql.append("report_lock_user_name=?, ");
sql.append("report_lock_time=?, ");
sql.append("send_back_user_id=?, ");
sql.append("send_back_user_name=?, ");
sql.append("send_back_comment=?, ");
sql.append("task_status=?, ");
sql.append("report_status=?, ");
sql.append("task_report_info_id=? ");
sql.append("WHERE task_key=? AND task_report_level=?");
if (dto.reportStartDate != null) {
sql.append(" AND datetime(report_start_date)=datetime(?)");
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg,
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg, dto.taskReportInfoId, dto.taskKey, dto.taskReportLevel, dto.reportStartDate};
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg,
dto.reportLockUserId, dto.reportLockUserName, dto.reportLockTime, dto.sendBackUserId, dto.sendBackUserName, dto.sendBackComment, dto.taskStatus, dto.reportStatus,
dto.taskReportInfoId, dto.taskKey, dto.taskReportLevel, dto.reportStartDate};
} else {
objects = new Object[]{dto.jsonData, dto.attachedFileName, dto.localAttachedFileName, dto.attachedFileSendFlg, dto.dataSendFlg,
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg, dto.taskReportInfoId, dto.taskKey, dto.taskReportLevel};
dto.reportEndDate, dto.enableReport, dto.taskReportLevel, dto.localSavedFlg,
dto.reportLockUserId, dto.reportLockUserName, dto.reportLockTime, dto.sendBackUserId, dto.sendBackUserName, dto.sendBackComment, dto.taskStatus, dto.reportStatus,
dto.taskReportInfoId, dto.taskKey, dto.taskReportLevel};
}
return update(sql.toString(), objects) > 0;
}
/**
* ロック、アンロック時の状態変更
*
* @param taskKey
* @param reportStartDate
* @param reportStatus
* @param reportLockUserId
* @param reportLockUserName
* @param reportLockTime
* @return
*/
public boolean updateReportLock(
String taskKey,
Date reportStartDate,
int reportStatus,
String reportLockUserId,
String reportLockUserName,
Date reportLockTime
) {
StringBuilder sql = new StringBuilder();
List<Object> args = new ArrayList<Object>();
sql.append("UPDATE t_task_report SET ");
sql.append(" report_status=?, ");
sql.append(" report_lock_user_id=?, ");
sql.append(" report_lock_user_name=?, ");
sql.append(" report_lock_time=? ");
sql.append("WHERE task_key=? ");
if (reportStartDate != null) {
sql.append("AND datetime(report_start_date)=datetime(?);");
}
args.add(reportStatus);
args.add(reportLockUserId);
args.add(reportLockUserName);
args.add(reportLockTime);
args.add(taskKey);
if (reportStartDate != null) {
args.add(reportStartDate);
}
return update(sql.toString(), args.toArray()) > 0;
}
/**
* 作業IDで報告取得
* (作業報告タイプ 昇順、作業報告ID 昇順、報告開始日 昇順)
* @param operationId
......
......@@ -44,6 +44,9 @@ public class TOperation extends SQLiteTableScript {
sql.append(" , enable_add_report SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , operation_open_date DATETIME ");
sql.append(" , quick_report SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , status_not_started_count INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , status_working_count INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , status_completed_count INTEGER NOT NULL DEFAULT 0 ");
sql.append(" , PRIMARY KEY (operation_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
......@@ -59,6 +62,11 @@ public class TOperation extends SQLiteTableScript {
ddl.add(" ALTER TABLE t_operation ADD COLUMN operation_open_date DATETIME ");
ddl.add(" ALTER TABLE t_operation ADD COLUMN quick_report SMALLINT NOT NULL DEFAULT 0 ");
}
if (oldVersion < DatabaseVersions.Ver1_0_4) {
ddl.add(" ALTER TABLE t_operation ADD COLUMN status_not_started_count INTEGER NOT NULL DEFAULT 0 ");
ddl.add(" ALTER TABLE t_operation ADD COLUMN status_working_count INTEGER NOT NULL DEFAULT 0 ");
ddl.add(" ALTER TABLE t_operation ADD COLUMN status_completed_count INTEGER NOT NULL DEFAULT 0 ");
}
return ddl;
}
......
......@@ -35,6 +35,14 @@ public class TTaskReport extends SQLiteTableScript {
sql.append(" , enable_report SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , task_report_level SMALLINT NOT NULL DEFAULT 0 ");
sql.append(" , local_saved_flg BOOLEAN DEFAULT 0 ");
sql.append(" , report_lock_user_id TEXT "); // 報告ロックユーザId
sql.append(" , report_lock_user_name TEXT "); //報告ロックユーザ名
sql.append(" , report_lock_time DATETIME "); // 報告ロック日時
sql.append(" , send_back_user_id TEXT "); // 差し戻しユーザId 差し戻された場合のみ" +
sql.append(" , send_back_user_name TEXT "); // 差し戻しユーザ名 差し戻された場合のみ
sql.append(" , send_back_comment TEXT "); // 確認コメント 差し戻された場合のみ
sql.append(" , report_status INTEGER NOT NULL DEFAULT 0 "); // 0:ロック成功、1:ロック中、2:承認中、999:その他エラー
sql.append(" , task_status TEXT "); // 状況 0:未実施、1:作業中、999:作業完了
sql.append(" ) ");
ddl.add(sql.toString());
......@@ -44,7 +52,20 @@ public class TTaskReport extends SQLiteTableScript {
@Override
public List<String> getUpgradeScript(int oldVersion, int newVersion) {
return null;
List<String> ddl = new ArrayList<String>();
if (oldVersion < DatabaseVersions.Ver1_0_5) {
ddl.add(" ALTER TABLE t_task_report ADD COLUMN report_lock_user_id TEXT"); // 報告ロックユーザId
ddl.add(" ALTER TABLE t_task_report ADD COLUMN report_lock_user_name TEXT"); //報告ロックユーザ名
ddl.add(" ALTER TABLE t_task_report ADD COLUMN report_lock_time DATETIME"); // 報告ロック日時
ddl.add(" ALTER TABLE t_task_report ADD COLUMN send_back_user_id TEXT"); // 差し戻しユーザId 差し戻された場合のみ" +
ddl.add(" ALTER TABLE t_task_report ADD COLUMN send_back_user_name TEXT"); // 差し戻しユーザ名 差し戻された場合のみ
ddl.add(" ALTER TABLE t_task_report ADD COLUMN send_back_comment TEXT"); // 確認コメント 差し戻された場合のみ
ddl.add(" ALTER TABLE t_task_report ADD COLUMN task_status TEXT"); // 状況 0:未実施、1:作業中、999:作業完了
}
if (oldVersion < DatabaseVersions.Ver1_0_6) {
ddl.add(" ALTER TABLE t_task_report ADD COLUMN report_status INTEGER NOT NULL DEFAULT 0"); // 0:ロック成功、1:ロック中、2:承認中、999:その他エラー
}
return ddl;
}
@Override
......
......@@ -33,6 +33,10 @@ public class OperationDto extends AbstractDto {
public int enableAddReport; // 作業追加区分
public int quickReport; // 簡易帳票区分
public int statusNotStartedCount; //「未実施」数
public int statusWorkingCount; //「作業中」数
public int statusCompletedCount; // 「作業完了」数
// 作業担当グループリスト
public List<TaskWorkerGroupDto> taskWorkerGroupDtoList;
// 作業種別に紐づく作業Dto
......@@ -49,12 +53,12 @@ public class OperationDto extends AbstractDto {
@Override
public Object[] getInsertValues() {
return new Object[] { operationId, operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, enableReportEdit, enableAddReport, quickReport };
return new Object[] { operationId, operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, enableReportEdit, enableAddReport, statusNotStartedCount, statusWorkingCount, statusCompletedCount, quickReport };
}
@Override
public Object[] getUpdateValues() {
return new Object[] { operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, enableReportEdit, enableAddReport, quickReport, operationId };
return new Object[] { operationName, operationDescriptions, operationStartDate, operationEndDate, operationType, reportType, lastEditDate, contentCreatingFlg, editLockFlg, needSyncFlg, reportCycle, enableReportUpdate, enableReportHistory, enableReportEdit, enableAddReport, statusNotStartedCount, statusWorkingCount, statusCompletedCount, quickReport, operationId };
}
@Override
......
......@@ -26,14 +26,23 @@ public class TaskReportDto extends AbstractDto {
public String attachedFileName;
public boolean localSavedFlg; // 一時保存用
public String reportLockUserId; // 報告ロックユーザId
public String reportLockUserName; // 報告ロックユーザ名
public Date reportLockTime; // 報告ロック日時
public String sendBackUserId; // 差し戻しユーザId 差し戻された場合のみ
public String sendBackUserName; // 差し戻しユーザ名 差し戻された場合のみ
public String sendBackComment; // 確認コメント 差し戻された場合のみ
public String taskStatus; // 状況 0:未実施、1:作業中、999:作業完了
public int reportStatus;
@Override
public Object[] getInsertValues() {
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, enableReport, taskReportLevel, localSavedFlg};
return new Object[] { taskKey, jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, taskReportId, taskReportInfoId, reportStartDate, reportEndDate, enableReport, taskReportLevel, reportLockUserId, reportLockUserName, reportLockTime, sendBackUserId, sendBackUserName, sendBackComment, taskStatus, reportStatus, localSavedFlg};
}
@Override
public Object[] getUpdateValues() {
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reportEndDate, enableReport, taskReportLevel, localSavedFlg, taskKey, taskReportLevel , reportStartDate };
return new Object[] { jsonData, attachedFileName, localAttachedFileName, attachedFileSendFlg, dataSendFlg, reportEndDate, enableReport, taskReportLevel, localSavedFlg, taskKey, taskReportLevel , reportLockUserId, reportLockUserName, reportLockTime, sendBackUserId, sendBackUserName, sendBackComment, taskStatus, reportStatus, reportStartDate };
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment