/** * xxxの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { $flg = $this->af->get('flg'); $company_id = $this->session->get('company_id'); try { $params = array('company_id' => $company_id); $methodarr = array(); $methodarr[] = 'setOrderingMDShohinCdNullForGtin14'; $methodarr[] = 'setOrderingMDShohinCdNullForBarcode'; $methodarr[] = 'setOrderingMDShohinCdNullByAi'; $dao = DaoFactory::OrderingMD(); $dao->BeginTransaction(); // 一覧を取得 $null_num_before = $dao->getOrderingMDShohinCdNullCount($params); foreach ($methodarr as $method) { $res = $dao->{$method}($params); if (!$res) { throw new Exception("DB更新が失敗しました"); } } $null_num_after = $dao->getOrderingMDShohinCdNullCount($params); $dao->CommitTransaction(); $dir = dirname(BASE) . DIRECTORY_SEPARATOR . 'batch'; exec('php ' . $dir . DIRECTORY_SEPARATOR . 'batch_zaiko_all.php ' . $company_id . ' ' . $warehouse_id . ' > /dev/null &'); $output = array(); $output['result'] = '0'; $output['updated_count'] = intval($null_num_before) - intval($null_num_after); $output['null_num'] = $null_num_after; return array('json', $output); } catch (Exception $e) { // 致命的なエラーが発生 $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } exit; }
/** * 代行発注CSVを出力 * @access public * @see Admin_ActionClass::perform() */ function perform() { set_time_limit(DEFAULT_CSV_PROCESS_TIME_LIMIT); // get request params $hyoji_kbn = $this->af->get('hyoji_kbn'); $start_date = $this->af->get('start_date'); $end_date = $this->af->get('end_date'); $buyer_cd = $this->af->get('buyer_cd'); $staff_id = $this->af->get('staff_id'); // $soko_name = $this->af->get('staff_id'); $warehouse_id = $this->af->get('warehouse_id'); $terminal_id = $this->af->get('terminal_id'); $order_no = $this->af->get('order_no'); $barcode = $this->af->get('barcode'); $download_flg = $this->af->get('download_flg'); $keyword = $this->af->get('keyword'); $terminal_arr = $this->af->get('terminal_arr'); $warehouse_arr = $this->af->get('warehouse_arr'); $order_no_arr = $this->af->get('order_no_arr'); $seq_arr = $this->af->get('seq_arr'); $barcode_arr = $this->af->get('barcode_arr'); $order = $this->af->get('order'); // default asc $column = $this->af->get('column'); $page = $this->af->get('page'); $limit = $this->af->get('limit'); // pager setting $start_page = ($page - 1) * $limit + 1; $end_page = ($page - 1) * $limit + $limit; $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); $shohin_cd = trim($this->af->get('shohin_cd')); $shohin_mei = trim($this->af->get('shohin_mei')); if ($hyoji_kbn == '1') { if ($column == 'shohin_cd' || $column == 'shohin_mei' || $column == 'barcode' || $column == 'amount') { $column = ''; } } elseif ($hyoji_kbn == '2') { if ($column == 'quantum') { $column = ''; } } elseif ($hyoji_kbn == '3') { if ($column != 'shohin_cd' && $column != 'shohin_mei' && $column != 'amount' && $column != 'barcode') { $column = ''; } } try { // 一覧を取得 $params = array('shohin_cd' => $shohin_cd, 'shohin_mei' => $shohin_mei, 'company_id' => $company_id, 'user_id' => $user_id, 'start_date' => $start_date, 'end_date' => $end_date, 'buyer_cd' => $buyer_cd, 'order_no' => $order_no, 'staff_id' => $staff_id, 'warehouse_id' => $warehouse_id, 'terminal_id' => $terminal_id, 'barcode' => $barcode, 'download_flg' => $download_flg, 'keyword' => $keyword, 'order' => $order, 'column' => $column, 'start_page' => $start_page, 'end_page' => $end_page, 'csv' => true, 'terminal_arr' => $terminal_arr, 'order_no_arr' => $order_no_arr, 'warehouse_arr' => $warehouse_arr, 'seq_arr' => $seq_arr, 'barcode_arr' => $barcode_arr); if ($hyoji_kbn == '1') { $sth = DaoFactory::OrderingMD()->OrderingMD_Get($params); // 書き込みクラスを生成 require_once 'csv/OrderingMDCsvWriter.class.php'; $writer = new OrderingMDCsvWriter(); return array('csv', $writer, $sth, 'OrderingMD' . date('ymd') . '.csv'); } elseif ($hyoji_kbn == '2') { $sth = DaoFactory::OrderingMD()->OrderingMD_Get($params); // 書き込みクラスを生成 require_once 'csv/OrderingMDCsvWriter.class.php'; $writer = new OrderingMDCsvWriter(); return array('csv', $writer, $sth, 'OrderingMD' . date('ymd') . '.csv'); } else { if ($hyoji_kbn == '3') { $sth = DaoFactory::OrderingMD()->OrderingMD_GetGroupByBarcode($params); // 書き込みクラスを生成 require_once 'csv/OrderingMDGroupCsvWriter.class.php'; $writer = new OrderingMDGroupCsvWriter(); return array('csv', $writer, $sth, 'ShohinTaniShuukei' . date('ymd') . '.csv'); } else { //detail output unset($params); $params = array('company_id' => $company_id, 'user_id' => $user_id, 'order_no_op' => $order_no, 'warehouse_id_op' => $warehouse_id, 'terminal_id_op' => $terminal_id, 'keyword' => $keyword, 'order' => $order, 'column' => $column, 'csv' => true); $sth = DaoFactory::OrderingMD()->OrderingMD_Get($params); // 書き込みクラスを生成 require_once 'csv/OrderingMDCsvWriter.class.php'; $writer = new OrderingMDCsvWriter(); return array('csv', $writer, $sth, 'OrderingMD' . date('ymd') . '.csv'); } } } catch (Exception $e) { // 致命的なエラーが発生 $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } }
/** * 代行発注のデータをJSON形式で返す * @access public * @return array 代行発注 * @see Admin_ActionClass::perform() */ public function perform() { // get request params ( search ) $hyoji_kbn = $this->af->get('hyoji_kbn'); $start_date = $this->af->get('start_date'); $end_date = $this->af->get('end_date'); $buyer_cd = $this->af->get('buyer_cd'); $order_no = $this->af->get('order_no'); $staff_id = $this->af->get('staff_id'); $warehouse_id = $this->af->get('warehouse_id'); $terminal_id = $this->af->get('terminal_id'); $barcode = $this->af->get('barcode'); $ai = $this->af->get('ai'); $ai_cd = $this->af->get('ai_cd'); $download_flg = $this->af->get('download_flg'); $shohin_cd = trim($this->af->get('shohin_cd')); $shohin_mei = trim($this->af->get('shohin_mei')); // get request params ( pager ) $limit = $this->af->get('limit'); $page = $this->af->get('page'); $order = $this->af->get('order'); $column = $this->af->get('column'); $keyword = $this->af->get('keyword'); if ($hyoji_kbn == '1') { if ($column == 'shohin_cd' || $column == 'shohin_mei' || $column == 'barcode' || $column == 'amount') { $column = ''; } } elseif ($hyoji_kbn == '2') { if ($column == 'quantum') { $column = ''; } } elseif ($hyoji_kbn == '3') { if ($column != 'shohin_cd' && $column != 'shohin_mei' && $column != 'amount' && $column != 'barcode') { $column = ''; } } if ($column == 'order_no') { $column = 'to_number(order_no)'; } $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); // pager setting $start_page = ($page - 1) * $limit + 1; $end_page = ($page - 1) * $limit + $limit; $ai_arr = array(); if ('' != $ai) { $tmparr = explode(';', $ai); foreach ($tmparr as $value) { $row = explode('=', $value); $ai_arr[] = '%(' . str_replace('y', '_', $row[0]) . ')' . $row[1] . '%'; } } try { $params = array('company_id' => $company_id, 'user_id' => $user_id, 'start_date' => $start_date, 'end_date' => $end_date, 'buyer_cd' => $buyer_cd, 'order_no' => $order_no, 'staff_id' => $staff_id, 'warehouse_id' => $warehouse_id, 'barcode' => $barcode, 'ai_arr' => $ai_arr, 'download_flg' => $download_flg, 'shohin_cd' => $shohin_cd, 'shohin_mei' => $shohin_mei, 'keyword' => $keyword, 'order' => $order, 'column' => $column, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 if ($hyoji_kbn == '1') { $list = DaoFactory::OrderingD()->getOrderingList($params); } elseif ($hyoji_kbn == '2') { $list = DaoFactory::OrderingMD()->OrderingMD_Get($params); } else { $list = DaoFactory::OrderingMD()->OrderingMD_GetGroupByBarcode($params); } // ページ情報を設定 $pager = array('result_page' => $page, 'result_start_num' => $start_page, 'result_end_num' => $end_page, 'result_all_count' => count($list) ? $list[0]['FOUND_ROWS'] : 0, 'result_get_count' => count($list), 'result_limit' => $limit, 'hyoji_kbn' => $hyoji_kbn); // output にセット $output['totalData'] = array(); $output['listData'] = $list; $output['pagerData'] = $pager; } catch (Exception $e) { // 致命的なエラーが発生 $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } return array('json', $output); }