/** * 商品マスタの保存が成功したか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 $productDao = DaoFactory::ProductMst(); try { // begin $productDao->BeginTransaction(); $params = array('company_id' => $company_id); if ($_REQUEST['del'] == 'all') { $productDao->Delete(' company_id = ? ', $params); } else { foreach ($record_arr as $key => $pk) { $params['product_id'] = $pk['product_id']; $productDao->Delete(' company_id = ? AND product_id = ? ', $params); } } $productDao->CommitTransaction(); } catch (Exception $e) { $productDao->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 $product_id = $this->af->get('product_id'); $product_name = $this->af->get('product_name'); $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, 'product_id' => $product_id, 'product_name' => $product_name, 'keyword' => $keyword, 'record_arr' => $record_arr, 'order' => $order, 'column' => $column); $sth = DaoFactory::ProductMst()->ProductMst_GetProductList($params); // 書き込みクラスを生成 require_once 'csv/ProductMstCsvWriter.class.php'; $writer = new ProductMstCsvWriter(); } catch (Exception $e) { // 致命的なエラーが発生 return array('500', $e->getMessage()); } return array('csv', $writer, $sth, 'productMst.csv'); }
/** * 棚卸調整マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $chousei_date = $this->af->get('chousei_date'); $chousei = $this->af->get('chousei'); $biko = $this->af->get('biko'); // get session params $company_id = $this->session->get('company_id'); $s_user_id = $this->session->get('user_id'); // dao $zaikoChoseiDDao = DaoFactory::ZaikoChouseiD(); $zaikoChouseiMDDao = DaoFactory::ZaikoChouseiMD(); $warehouseDao = DaoFactory::WarehouseMst(); $productDao = DaoFactory::ProductMst(); try { // begin $zaikoChoseiDDao->BeginTransaction(); // print_r($chousei); if (!empty($chousei)) { foreach ($chousei as $warehouseId => $val) { // shop_cd 存在チェック $warehouse = $warehouseDao->Retrieve(' company_id = ? AND warehouse_id = ? ', array('company_id' => $company_id, 'warehouse_id' => $warehouseId)); if (empty($warehouse)) { throw new Exception("入力された 倉庫ID: {$warehouseId} は登録されていません"); } // 枝番号初期化 $edaban = 0; foreach ($val as $product_id => $chousei_num) { // chousei_num 空、0チェック if (!$chousei_num) { continue; } // ゼロ、空文字であればスルー // 調整NOの最大値を取得 $chousei_no = intval($zaikoChoseiDDao->maxByColumn('CHOUSEI_NO', " company_id = ? AND terminal_id = '-' AND warehouse_id = ? ", array('company_id' => $company_id, 'warehouse_id' => $warehouseId))); $chousei_no += 1; // D に insert $params = array('company_id' => $company_id, 'terminal_id' => '-', 'chousei_no' => $chousei_no, 'bc_bunrui' => '0', 'warehouse_id' => $warehouseId, 'chousei_date' => array('value' => $chousei_date, 'type' => 'date'), 'nyushutsu_kbn' => '1', 'soshin_flg' => '0', 'zaiko_koshin_flg' => '0', 'biko' => $biko, 'UID' => $s_user_id, 'PGM' => get_class()); // print_r($params); $zaikoChoseiDDao->Insert($params); // MD に insert $edaban += 1; $params = array('company_id' => $company_id, 'terminal_id' => '-', 'chousei_no' => $chousei_no, 'warehouse_id' => $warehouseId, 'edaban' => $edaban, 'bc_1' => '', 'stock_update_flg' => '0', 'product_id' => $product_id, 'suryo' => $chousei_num, 'UID' => $s_user_id, 'PGM' => get_class()); $zaikoChouseiMDDao->Insert($params); } } } DaoFactory::ZaikoBatchPkg()->batch_zaiko_chousei_d(array('company_id' => $company_id, 'upd_uid' => $s_user_id, 'upd_pgm' => get_class())); // commit $zaikoChoseiDDao->CommitTransaction(); } catch (Exception $e) { // rollback // print_r($e); $zaikoChoseiDDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
function getArrayOption_shiiresaki() { $params = array('company_id' => $this->backend->getSession()->get('company_id')); $shops = DaoFactory::ProductMst()->ProductMst_GetShiiresakiList($params)->fetchAll(PDO::FETCH_NUM); $result = array('' => ''); foreach ($shops as $shop) { $result[$shop[0]] = $shop[1]; } return $result; }
/** * 商品マスタの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/ProductMstCsvReader.class.php'; $reader = new ProductMstCsvReader($file['tmp_name']); $reader->ignore = $ignore; // dao $productDao = DaoFactory::ProductMst(); try { // start transaction $productDao->BeginTransaction(); // ファイルから1行取得する while ($params = $reader->read()) { $cnt++; $nowrow = $cnt + $ignore; $params['bc_1'] = trim($params['bc_1']); $params['bc_2'] = trim($params['bc_2']); // 共通項目を設定する $params['company_id'] = $company_id; $params['UID'] = $user_id; $params['PGM'] = get_class(); // insert or update ( merge ) $productDao->ProductMst_Merge($params); } // commit transaction $productDao->CommitTransaction(); } catch (CsvReaderException $e) { // csv reader is exception $productDao->AbortTransaction(); return array('400', $e->getMessage()); } catch (Exception $e) { // dao is exception $productDao->AbortTransaction(); return array('500', $e->getMessage()); } exit; }
/** * 商品マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // get request params $product_id = $this->af->get('product_id'); $bc_1 = $this->af->get('bc_1'); $bc_2 = $this->af->get('bc_2'); $product_name = $this->af->get('product_name'); $shiiresaki_cd = $this->af->get('shiiresaki_cd'); $retail_price = $this->af->get('retail_price'); $inventory_value = $this->af->get('inventory_value'); $product_spec = $this->af->get('product_spec'); // get session params $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); // dao $productDao = DaoFactory::ProductMst(); try { // begin $productDao->BeginTransaction(); // cd not exists $params = array('company_id' => $company_id, 'product_id' => $product_id); $exists = $productDao->Retrieve(" company_id = ? AND product_id = ? ", $params); if (empty($exists)) { $def1 = $this->af->getDef('product_id'); $err_msg = array('product_id' => "入力された" . $def1['name'] . "は登録されていません"); return array(400, $err_msg); } // set params $params = array('bc_1' => $bc_1, 'bc_2' => $bc_2, 'product_name' => $product_name, 'retail_price' => $retail_price, 'inventory_value' => $inventory_value, 'product_spec' => $product_spec, 'shiiresaki_cd' => $shiiresaki_cd, 'UID' => $user_id, 'PGM' => get_class()); // dao update $productDao->Update($params, ' company_id = ? AND product_id = ? ', array($company_id, $product_id)); // commit $productDao->CommitTransaction(); } catch (Exception $e) { // rollback $productDao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * 商品マスタのデータをJSON形式で返す * @access public * @return array 商品マスタ * @see Admin_ActionClass::perform() */ public function perform() { // get request params ( search ) $product_id = $this->af->get('product_id'); // get session params $company_id = $this->session->get('company_id'); try { // DAO パラメータ定義 $params = array('company_id' => $company_id, 'product_id' => $product_id); // 詳細を取得 $detail = DaoFactory::ProductMst()->Retrieve(' company_id = ? AND product_id = ? ', $params); // output にセット $output['totalData'] = array(); $output['listData'] = $detail; $output['pagerData'] = array(); } catch (Exception $e) { // 致命的なエラーが発生 return array('500', $e->getMessage()); } return array('json', $output); }
/** * 商品マスタのデータをJSON形式で返す * @access public * @return array 商品マスタ * @see Admin_ActionClass::perform() */ public function perform() { // get request params $product_id = $this->af->get('product_id'); $not_product_id = $this->af->get('not_product_id'); $product_name = $this->af->get('product_name'); $shiiresaki_cd = $this->af->get('shiiresaki_cd'); $shiiresaki_mei = $this->af->get('shiiresaki_mei'); $product_spec = $this->af->get('product_spec'); $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('product_id' => $product_id, 'not_product_id' => $not_product_id, 'product_name' => $product_name, 'shiiresaki_cd' => $shiiresaki_cd, 'shiiresaki_mei' => $shiiresaki_mei, 'product_spec' => $product_spec, 'keyword' => $keyword, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 $list = DaoFactory::ProductMst()->ProductMst_GetProductList($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); }
function perform() { //パラメータ取得 $company_id = $this->af->get('company_id'); $warehouse_id = $this->af->get('warehouse_id'); $product_id = $this->af->get('product_id'); $zk = DaoFactory::ZaikoD()->Retrieve(" company_id = ? and warehouse_id = ? and product_id = ? ", array($company_id, $warehouse_id, $product_id)); $product = DaoFactory::ProductMst()->Retrieve(" company_id = ? and product_id = ? ", array($company_id, $product_id)); $warehouse = DaoFactory::WarehouseMst()->Retrieve(" company_id = ? and warehouse_id = ? ", array($company_id, $warehouse_id)); try { $rec['PRODUCT_ID'] = $product_id; $rec['PRODUCT_NAME'] = $product["PRODUCT_NAME"]; $rec['WAREHOUSE_ID'] = $warehouse_id; $rec['WAREHOUSE_NAME'] = $warehouse['WAREHOUSE_NAME']; $rec['QTY'] = empty($zk['ZAIKOSU']) ? "0" : $zk['ZAIKOSU']; } catch (Exception $e) { // 致命的なエラーが発生 $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } return array('json', $rec); }
/** * 商品マスタのデータをJSON形式で返す * @access public * @return array 商品マスタ * @see Admin_ActionClass::perform() */ public function perform() { // 初期化 $keyword = $this->af->get('product_keyword'); $company_id = $this->session->get('company_id'); $set_flg = $this->af->get('set_flg'); try { $params = array('keyword' => $keyword, 'company_id' => $company_id); // 一覧を取得 $list = DaoFactory::ProductMst()->ProductMst_GetProductList($params); // ページ情報を設定 $pager = array('result_page' => '', 'result_start_num' => '', 'result_end_num' => '', 'result_all_count' => count($list) ? $list[0]['FOUND_ROWS'] : 0, 'result_get_count' => count($list), 'result_limit' => ''); // 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); }