本文整理汇总了PHP中DaoFactory::GtinMst方法的典型用法代码示例。如果您正苦于以下问题:PHP DaoFactory::GtinMst方法的具体用法?PHP DaoFactory::GtinMst怎么用?PHP DaoFactory::GtinMst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DaoFactory
的用法示例。
在下文中一共展示了DaoFactory::GtinMst方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: perform
/**
* Gtinマスタの保存が成功したかJSON形式で返す
* @access public
* @see Admin_ActionClass::perform()
*/
function perform()
{
// get request params
$record_arr = $this->af->get('record_arr');
// get session params
$company_id = $this->session->get('company_id');
// dao
$gtinDao = DaoFactory::GtinMst();
try {
// begin
$gtinDao->BeginTransaction();
$params = array('company_id' => $company_id);
if ($_REQUEST['del'] == 'all') {
$gtinDao->Delete(' company_id = ? ', $params);
} else {
$del_arr = array();
foreach ($record_arr as $gtin => $bc_1_and_value) {
foreach ($bc_1_and_value as $bc_1 => $value) {
$del_arr[] = array('gtin' => $gtin, 'bc_1' => $bc_1);
}
}
foreach ($del_arr as $del_params) {
$gtinDao->Delete(' COMPANY_ID = ? AND GTIN = ? AND BC_1 = ? ', array($company_id, $del_params['gtin'], $del_params['bc_1']));
}
}
$gtinDao->CommitTransaction();
} catch (Exception $e) {
$gtinDao->AbortTransaction();
$this->logger->log(LOG_DEBUG, $e->getTraceAsString());
return array(500, $e->getMessage());
}
exit;
}
示例2: perform
/**
* GtinマスタCSVを出力
* @access public
* @see Admin_ActionClass::perform()
*/
function perform()
{
set_time_limit(DEFAULT_CSV_PROCESS_TIME_LIMIT);
// get request params
$gtin = $this->af->get('gtin');
$bc_1 = $this->af->get('bc_1');
$keyword = $this->af->get('keyword');
$record_arr = $this->af->get('record_arr');
// get session params
$company_id = $this->session->get('company_id');
// pager setting
$order = $this->af->get('order');
// default asc
$column = $this->af->get('column');
// default warehouse_id
try {
// 一覧を取得
$params = array('company_id' => $company_id, 'gtin' => $gtin, 'bc_1' => $bc_1, 'keyword' => $keyword, 'record_arr' => $record_arr, 'order' => $order, 'column' => $column);
$sth = DaoFactory::GtinMst()->GtinMst_GetGtinList($params);
// 書き込みクラスを生成
require_once 'csv/GtinMstCsvWriter.class.php';
$writer = new GtinMstCsvWriter();
} catch (Exception $e) {
// 致命的なエラーが発生
return array('500', $e->getMessage());
}
return array('csv', $writer, $sth, 'GtinMst.csv');
}
示例3: perform
/**
* GtinマスタのCSVをインポートする
* @access public
* @see Admin_ActionClass::perform()
*/
function perform()
{
//タイムアウト時間を設定
set_time_limit(DEFAULT_CSV_PROCESS_TIME_LIMIT);
// get request params
$file = $this->af->get('file');
$ignore = $this->af->get('ignore');
// get session params
$company_id = $this->session->get('company_id');
$user_id = $this->session->get('user_id');
// csv reader を生成
require_once 'csv/GtinMstCsvReader.class.php';
$reader = new GtinMstCsvReader($file['tmp_name']);
$reader->ignore = $ignore;
// dao
$gtinDao = DaoFactory::GtinMst();
try {
// start transaction
$gtinDao->BeginTransaction();
// ファイルから1行取得する
while ($params = $reader->read()) {
$cnt++;
$nowrow = $cnt + $ignore;
$params['gtin'] = trim($params['gtin']);
$params['bc_1'] = trim($params['bc_1']);
$params['qty'] = trim($params['qty']);
// 共通項目を設定する
$params['company_id'] = $company_id;
$params['UID'] = $user_id;
$params['PGM'] = get_class();
// insert or update ( merge )
$gtinDao->GtinMst_Merge($params);
$tmp_arr[] = $params;
}
// commit transaction
$gtinDao->CommitTransaction();
} catch (CsvReaderException $e) {
// csv reader is exception
$gtinDao->AbortTransaction();
return array('400', $e->getMessage());
} catch (Exception $e) {
// dao is exception
$gtinDao->AbortTransaction();
return array('500', $e->getMessage());
}
exit;
}
示例4: perform
/**
* Gtinマスタの保存が成功したかJSON形式で返す
* @access public
* @see Admin_ActionClass::perform()
*/
function perform()
{
// get request params
$gtin = $this->af->get('gtin');
$bc_1 = $this->af->get('bc_1');
$qty = $this->af->get('qty');
// get session params
$company_id = $this->session->get('company_id');
$user_id = $this->session->get('user_id');
// dao
$gtinDao = DaoFactory::GtinMst();
try {
// begin
$gtinDao->BeginTransaction();
// cd exists
if (substr($gtin, 0, 1) == '0') {
$params = array('company_id' => $company_id, 'gtin' => $gtin, 'bc_1' => $bc_1);
$exists = $gtinDao->Retrieve(" company_id = ? AND gtin = ? AND bc_1 = ?", $params);
if (!empty($exists)) {
$def1 = $this->af->getDef('gtin');
$def2 = $this->af->getDef('bc_1');
$err_msg = array('gtin' => "入力された" . $def1['name'] . "は既に登録されています", 'bc_1' => "入力された" . $def2['name'] . "は既に登録されています");
return array(400, $err_msg);
}
} else {
$params = array();
$params = array('company_id' => $company_id, 'gtin' => $gtin);
$exists = $gtinDao->Retrieve(" company_id = ? AND gtin = ? ", $params);
if (!empty($exists)) {
$def1 = $this->af->getDef('gtin');
$err_msg = array('gtin' => "入力された" . $def1['name'] . "は既に登録されています");
return array(400, $err_msg);
}
}
// set params
$params = array('company_id' => $company_id, 'gtin' => $gtin, 'bc_1' => $bc_1, 'qty' => $qty, 'UID' => $user_id, 'PGM' => get_class());
// dao insert
$gtinDao->Insert($params);
// commit
$gtinDao->CommitTransaction();
} catch (Exception $e) {
$gtinDao->AbortTransaction();
$this->logger->log(LOG_DEBUG, $e->getTraceAsString());
return array(500, $e->getMessage());
}
}
示例5: perform
/**
* GtinマスタのデータをJSON形式で返す
* @access public
* @return array Gtinマスタ
* @see Admin_ActionClass::perform()
*/
public function perform()
{
// get request params ( search )
$gtin = $this->af->get('gtin');
$bc_1 = $this->af->get('bc_1');
// get session params
$company_id = $this->session->get('company_id');
try {
// DAO パラメータ定義
$params = array('company_id' => $company_id, 'gtin' => $gtin, 'bc_1' => $bc_1);
// 詳細を取得
$detail = DaoFactory::GtinMst()->Retrieve(' company_id = ? AND gtin = ? AND bc_1 = ? ', $params);
// output にセット
$output['totalData'] = array();
$output['listData'] = $detail;
$output['pagerData'] = array();
} catch (Exception $e) {
// 致命的なエラーが発生
return array('500', $e->getMessage());
}
return array('json', $output);
}
示例6: perform
/**
* Gtinマスタの保存が成功したかJSON形式で返す
* @access public
* @see Admin_ActionClass::perform()
*/
function perform()
{
// get request params
$gtin = $this->af->get('gtin');
$bc_1 = $this->af->get('bc_1');
$qty = $this->af->get('qty');
// get session params
$company_id = $this->session->get('company_id');
$user_id = $this->session->get('user_id');
// dao
$gtinDao = DaoFactory::GtinMst();
try {
// begin
$gtinDao->BeginTransaction();
// cd not exists
$params = array('company_id' => $company_id, 'gtin' => $gtin, 'bc_1' => $bc_1);
$exists = $gtinDao->Retrieve(" company_id = ? AND gtin = ? AND bc_1 = ?", $params);
if (empty($exists)) {
$def1 = $this->af->getDef('gtin');
$def2 = $this->af->getDef('bc_1');
$err_msg = array('gtin' => "入力された" . $def1['name'] . "は登録されていません", 'bc_1' => "入力された" . $def2['name'] . "は登録されていません");
return array(400, $err_msg);
}
// set params
$params = array('qty' => $qty, 'UID' => $user_id, 'PGM' => get_class());
// dao update
$gtinDao->Update($params, ' company_id = ? AND gtin = ? and bc_1 = ?', array($company_id, $gtin, $bc_1));
// commit
$gtinDao->CommitTransaction();
} catch (Exception $e) {
// rollback
$gtinDao->AbortTransaction();
$this->logger->log(LOG_DEBUG, $e->getTraceAsString());
return array(500, $e->getMessage());
}
exit;
}
示例7: perform
/**
* 商品マスタのデータをJSON形式で返す
* @access public
* @return array 商品マスタ
* @see Admin_ActionClass::perform()
*/
public function perform()
{
// get request params
$gtin = $this->af->get('gtin');
$bc_1 = $this->af->get('bc_1');
$keyword = $this->af->get('keyword');
// get session params
$company_id = $this->session->get('company_id');
// pager setting
$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
$start_page = ($page - 1) * $limit + 1;
$end_page = ($page - 1) * $limit + $limit;
try {
// DAO パラメータ定義
$params = array('gtin' => $gtin, 'bc_1' => $bc_1, 'keyword' => $keyword, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page);
// 一覧を取得
$list = DaoFactory::GtinMst()->GtinMst_GetGtinList($params)->fetchAll();
// ページ情報を設定
$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);
// output にセット
$output['totalData'] = array();
$output['listData'] = $list;
$output['pagerData'] = $pager;
} catch (Exception $e) {
// 致命的なエラーが発生
return array('500', $e->getMessage());
}
return array('json', $output);
}