/** * AIカスタムマスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // 初期化 $record_arr = $this->af->get('record_arr'); $del = $this->af->get('del'); $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); // 削除 $dao = DaoFactory::AicustomMst(); try { $dao->BeginTransaction(); $params = array(); if ($del == 'all') { $dao->Delete(' company_id = ? ', array($company_id)); } else { foreach ($record_arr as $row) { $params['ai'] = $row['ai']; $params['gtin14'] = $row['gtin14']; $params['company_id'] = $company_id; $dao->Delete(' ai = ? and gtin14= ? and company_id = ? ', $params); } } $dao->CommitTransaction(); } catch (Exception $e) { $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * AIカスタムマスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // 初期化 $ai = $this->af->get('ai'); $ai_name = $this->af->get('ai_name'); $company_id = $this->session->get('company_id'); $data_length = $this->af->get('data_length'); $gtin14 = $this->af->get('gtin14'); $user_id = $this->session->get('user_id'); try { // 保存 $dao = DaoFactory::AicustomMst(); $dao->BeginTransaction(); // WAREHOUSE_MSTに保存 $params = array('ai_name' => $ai_name, 'data_length' => $data_length, 'UID' => $user_id, 'PGM' => get_class()); // AIカスタムコード存在チェック // $exist = $dao->Retrieve(' ai = ? AND company_id = ? ', array($ai, $company_id)); // if(!is_array($exist)){ // $def1 = $this->af->getDef('ai'); // $err_msg = array( // 'ai' => $def1['name'] ."が登録されていません", // ); // return array(400, $err_msg); // } $dao->Update($params, 'ai = ? and gtin14 = ? and company_id = ? ', array($ai, $gtin14, $company_id)); $dao->CommitTransaction(); } catch (Exception $e) { $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } return array('json', array('status' => '200')); }
/** * AIカスタムマスタのデータをJSON形式で返す * @access public * @return array AIカスタムマスタ * @see Admin_ActionClass::perform() */ public function perform() { // 初期化 $limit = $this->af->get('limit'); // default 50 $page = $this->af->get('page'); // default 1 $order = $this->af->get('order'); // default asc $column = $this->af->get('column'); // default warehouse_id $keyword = $this->af->get('keyword'); $company_id = $this->session->get('company_id'); $start_page = ($page - 1) * $limit + 1; $end_page = ($page - 1) * $limit + $limit; try { $params = array('company_id' => $company_id, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'keyword' => $keyword, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 $list = DaoFactory::AicustomMst()->getAicustomList($params); // ページ情報を設定 $pager = array('result_page' => $page, 'result_start_num' => ($page - 1) * $limit + 1, 'result_end_num' => ($page - 1) * $limit + $limit, 'result_all_count' => count($list) ? $list[0]['FOUND_ROWS'] : 0, 'result_get_count' => count($list), 'result_limit' => $limit); // output にセット $output['totalData'] = array(); $output['listData'] = $list; $output['pagerData'] = $pager; } catch (Exception $e) { // 致命的なエラーが発生 return array('500', $e->getMessage()); } return array('json', $output); }
/** * リクエストのAIカスタムがDBに登録されていないことをチェックする * @param string $name フォーム名 */ public function check_ai_not_exists($name) { // AIカスタムを取得 $params = array('company_id' => $this->backend->getSession()->get('company_id'), 'ai' => $this->form_vars['ai'], 'gtin14' => $this->form_vars['gtin14']); $ai = DaoFactory::AicustomMst()->Retrieve('company_id= ? and ai= ? and gtin14= ? ', $params); // AIカスタムが存在する場合 if ($ai) { $this->ae->add($name, "入力された{form}は既に登録されています", E_FORM_INVALIDCHAR); } }
/** * AIカスタムマスタのデータをJSON形式で返す * @access public * @return array AIカスタムマスタ * @see Admin_ActionClass::perform() */ public function perform() { // get request params ( search ) $ai = $this->af->get('ai'); $gtin14 = $this->af->get('gtin14'); $company_id = $this->session->get('company_id'); try { // DAO パラメータ定義 $params = array('ai' => $ai, 'gtin14' => $gtin14, 'company_id' => $company_id); // 詳細を取得 $detail = DaoFactory::AicustomMst()->Retrieve(' ai = ? AND gtin14 = ? and company_id = ? ', $params); // output にセット $output['totalData'] = array(); $output['listData'] = $detail; $output['pagerData'] = array(); } catch (Exception $e) { // 致命的なエラーが発生 return array('500', $e->getMessage()); } return array('json', $output); }
/** * 一覧のデータを返す * @access public * @return array 一覧 * @see Admin_ActionClass::perform() */ public function perform() { // get request params ( search ) $warehouse_id = $this->af->get('warehouse_id'); $product_id = $this->af->get('product_id'); $ai_info = $this->af->get('ai_info'); $keyword = $this->af->get('keyword'); // get request params ( pager ) // $limit = $this->af->get('limit'); // default 50 $limit = 500; $page = $this->af->get('page'); // default 1 $order = $this->af->get('order'); // default desc $column = $this->af->get('column'); // default uriage_bi // get session params $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); // setting pager $start_page = ($page - 1) * $limit + 1; $end_page = ($page - 1) * $limit + $limit; $output = array(); if ('' != $ai_info) { $ai_arr[] = $ai_info; } try { $dao = DaoFactory::ZaikoD(); //検索 $params = array(); $params = array('company_id' => $company_id, 'warehouse_id' => $warehouse_id, 'product_id' => $product_id, 'ai_info' => $ai_info, 'keyword' => $keyword, 'start_page' => $start_page, 'end_page' => $end_page, 'order' => $order, 'keyword' => $keyword); $params2 = array('company_id' => $company_id, 'warehouse_id' => $warehouse_id, 'product_id2' => $product_id, 'ai_arr' => $ai_arr); $total = $dao->getZaikoList($params2); $result = $dao->getZaikoGs128Data($params); $list = array(); $aiarr = array(); foreach ($result as $row) { $row['AI_INFO'] = ltrim($row['AI_INFO'], '('); $tmparr = explode('(', $row['AI_INFO']); foreach ($tmparr as $value) { $arr = explode(')', $value); $list[] = array('AI' => $arr[0], 'AI_NAME' => '', 'VALUE' => $arr[1]); if (!in_array($arr[0], $aiarr)) { $aiarr[] = $arr[0]; } } } $result = DaoFactory::AicustomMst()->getAiOptions(array('company_id' => $company_id, 'ai_arr' => $aiarr)); // $result[1]['AI'] = '3101'; // file_put_contents('/tmp/zai_result',var_export($result,true)); $namearr = array(); foreach ($result as $row) { if ($row['AI'][0] == '3' && strlen($row['AI']) == 4) { //处理310y的情况,只按前三位处理 // file_put_contents('/tmp/run'.$row['AI'],1); $namearr[substr($row['AI'], 0, 3)] = $row['AI_NAME']; } else { $namearr[$row['AI']] = $row['AI_NAME']; } } // file_put_contents('/tmp/zai_namearr',var_export($namearr,true)); foreach ($list as $key => $row) { if ($row['AI'][0] == '3' && strlen($row['AI']) == 4) { //处理310y的情况,只按前三位处理 $list[$key]['AI_NAME'] = $namearr[substr($row['AI'], 0, 3)]; } else { $list[$key]['AI_NAME'] = $namearr[$row['AI']]; } } // file_put_contents('/tmp/zai_list',var_export($list,true)); // pager array setting $pagerData = array('result_page' => $page, 'result_start_num' => $start_page, 'result_end_num' => $end_page, 'result_all_count' => count($list), 'result_get_count' => count($list), 'result_limit' => $limit); // output にセット $output['totalData'] = $total[0]; $output['listData'] = $list; $output['pagerData'] = $pagerData; } catch (Exception $e) { // 致命的なエラーが発生 $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } return array('json', $output); }
public function getArrayOption_ai() { $company_id = $this->backend->getSession()->get('company_id'); $list = DaoFactory::AicustomMst()->getAiOptions(array('company_id' => $company_id)); $ret = array('' => ''); foreach ($list as $row) { $ret[$row['AI']] = $row['AI'] . ' : ' . $row['AI_NAME']; } return $ret; }