/// <summary> /// 「MU状態ログ」テーブル /// 搬送オーダ処理中の異常のみ表示する。 /// MU有効 and muエラーレベル、muエラーコードが共に<>0の場合 /// で且つ、”搬送オーダID”<>0のレコードから、搬送オーダIDから /// 「搬送オーダ状態履歴テーブル」を参照し、オーダ処理ステータス=100(異常) /// の該当するレコードより発部署/ST,着部署/着STを表示。(着ST空白有り) /// *この着部署・着STは、13項と同様の処理(巡回、不在等) /// *①、②の異常内容、詳細の表示は「CELL異常情報マスタ」、「MU異常情報 /// マスタ」を参照し表示する。 /// 尚、部署、STの登録がない場合は空白表示 /// </summary> /// <returns></returns> private static string GetMuErrorSql(string localeCode) { string sql = "SELECT" + " to_char(mu_log_datetime, 'yyyy-MM-dd') AS date" + ", to_char(mu_log_datetime, 'HH24:MI:SS') AS time" + ", CAST('MU' AS text) AS type" + ", mu_name_" + localeCode + " AS name" + ", CAST(mu_log_order_id AS text) AS req_sect" + ", CAST(mu_log_order_id AS text) AS req_station" + ", CAST(mu_log_order_id AS text) AS to_sect" + ", CAST(mu_log_order_id AS text) AS to_station" + // ", (" + SectionMaster.SelectNameSql(localeCode, "order_log_from_sect") + ") AS req_sect" + // ", (" + StationMaster.SelectNameSql(localeCode, "order_log_from_pt") + ") AS req_station" + // ", CASE WHEN order_log_round_flg = 1 OR order_log_forward_list is NULL THEN order_log_stop_to_sects ELSE order_log_forward_list END AS to_sect" + // ", order_log_stop_to_points AS to_station" + // ", CAST(mu_log_cart_id AS text) AS cart_id" + ", (" + CartMaster.SelectNameSql(localeCode, "mu_log_cart_id") + ") AS cart_id" + ", mu_log_errcode AS code" + ", (SELECT mu_errinfo_msg_" + localeCode + " FROM mu_error_info_master WHERE mu_errinfo_code = mu_log_errcode) AS message" + ", (SELECT mu_errinfo_msgdetail_" + localeCode + " FROM mu_error_info_master WHERE mu_errinfo_code = mu_log_errcode) AS detail" + " FROM mu_status_log" + " LEFT JOIN mu_master ON mu_id=mu_log_mu_id" + //" LEFT JOIN order_status_log ON order_log_id=mu_log_order_id" + これだと複数行になってしまう " WHERE" + " mu_log_errlevel<> 0" + " AND mu_log_errcode<> 0"; return(sql); }
public static string GetListSql(string conditionSql) { string localeCode = CommonUtil.GetAppLocaleCode(); string sql = "SELECT" + " to_char(order_result_reserve_datetime, '" + Properties.Resources.FORMAT_DATE + "') as reserve_date" + ",to_char(order_result_reserve_datetime, 'HH24:MI:SS') as reserve_time" + ",to_char(order_result_start_datetime, '" + Properties.Resources.FORMAT_DATE + "') as start_date" + ", to_char(order_result_start_datetime, 'HH24:MI:SS') as start_time" + ", to_char(order_result_datetime, '" + Properties.Resources.FORMAT_DATE + "') as result_date" + ", to_char(order_result_datetime, 'HH24:MI:SS') as result_time" + ", (" + SectionMaster.SelectNameSql(localeCode, "order_result_from_sect") + ") AS req_sect" + ", (" + StationMaster.SelectNameByPointSql(localeCode, "order_result_from_pt") + ") AS req_station" + ", CASE WHEN order_result_round_flg = 1 OR order_result_forward_list is NULL THEN order_result_stop_to_sects ELSE order_result_forward_list END AS to_sect" + ", order_result_stop_to_points AS to_station" + ", (" + CartMaster.SelectNameSql(localeCode, "order_result_cart_id") + ") AS cart_id" + ", (" + MuMaster.SelectNameSql(localeCode, "order_result_mu_id") + ") AS mu_id" + // ", order_result_cart_id AS cart_id" + // ", order_result_mu_id AS mu_id" + ", CASE order_result_status WHEN 0 THEN '" + Mocs.Properties.Resources.ORDER_RESULT_STATUS_0 + "' WHEN 1 THEN '" + Mocs.Properties.Resources.ORDER_RESULT_STATUS_1 + "' WHEN 10 THEN '" + Mocs.Properties.Resources.ORDER_RESULT_STATUS_10 + "' WHEN 20 THEN '" + Mocs.Properties.Resources.ORDER_RESULT_STATUS_20 + "' WHEN 100 THEN '" + Mocs.Properties.Resources.ORDER_RESULT_STATUS_100 + "' ELSE CAST(order_result_status AS text) END AS status" + " FROM order_result_log"; if (conditionSql == null || conditionSql.Length == 0) { conditionSql = DBAccess.GetTodayConditionSql("order_result_datetime"); } sql += " WHERE " + conditionSql; sql += " ORDER BY order_result_datetime DESC, order_result_start_datetime DESC, order_result_reserve_datetime DESC"; return(sql); }