Esempio n. 1
0
 function perform()
 {
     //パラメータ取得
     $company_id = $this->af->get('company_id');
     $warehouse_id = $this->af->get('warehouse_id');
     $product_id = $this->af->get('product_id');
     $keyword = $this->af->get('keyword');
     $bc_1 = $this->af->get('bc_1');
     $ai = $this->af->get('ai');
     $ai_arr = array();
     if (!empty($ai)) {
         foreach ($ai as $key => $value) {
             $ai_arr[] = '%(' . str_replace('y', '_', $key) . ')' . $value . '%';
         }
     }
     try {
         $dao = DaoFactory::ZaikoD();
         $params = array('company_id' => $company_id, 'warehouse_id' => $warehouse_id, 'product_id' => $product_id, 'barcode' => $bc_1, 'keyword' => $keyword, 'ai_arr' => $ai_arr);
         $output = $dao->searchZaikoListForApi($params);
     } catch (Exception $e) {
         // 致命的なエラーが発生
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array('500', $e->getMessage());
     }
     return array('json', $output);
 }
Esempio n. 2
0
 /**
  * 在庫一覧のデータを返す
  * @access public
  * @return array 在庫一覧
  * @see Admin_ActionClass::perform()
  */
 public function perform()
 {
     // get request params ( search )
     $warehouse_id_arr = $this->af->get('warehouse_id_arr');
     $product_id = $this->af->get('product_id');
     $product_name = $this->af->get('product_name');
     $ai_cd = $this->af->get('ai_cd');
     $ai = $this->af->get('ai');
     $keyword = $this->af->get('keyword');
     // get request params ( pager )
     $limit = $this->af->get('limit');
     // default 50
     $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');
     // setting pager
     $start_page = ($page - 1) * $limit + 1;
     $end_page = ($page - 1) * $limit + $limit;
     $output = array();
     $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 {
         $stock = DaoFactory::ZaikoD();
         //検索
         $params = array('company_id' => $company_id, 'product_id2' => $product_id, 'product_name' => $product_name, 'start_page' => $start_page, 'warehouse_id_arr' => $warehouse_id_arr, 'end_page' => $end_page, 'order' => $order, 'column' => $column, 'keyword' => $keyword);
         $result = $stock->getZaikoList($params);
         $total = $result[0];
         $list = $stock->getZaikoAiList($params)->fetchAll(PDO::FETCH_ASSOC);
         // pager array setting
         $pagerData = 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'] = $total;
         $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);
 }
Esempio n. 3
0
 /**
  * 在庫一覧の保存が成功したかJSON形式で返す
  * @access public
  * @see Admin_ActionClass::perform()
  */
 function perform()
 {
     set_time_limit(DEFAULT_CSV_PROCESS_TIME_LIMIT);
     // 初期化
     $warehouse_id_arr = $this->af->get('warehouse_id_arr');
     $product_id = $this->af->get('product_id');
     $product_name = $this->af->get('product_name');
     $ai = $this->af->get('ai');
     $record_arr = $this->af->get('record_arr');
     $keyword = $this->af->get('keyword');
     $company_id = $this->session->get('company_id');
     if (!empty($record_arr)) {
         $params = array('company_id' => $company_id, 'record_arr' => $record_arr);
     } else {
         $params = array('company_id' => $company_id, 'warehouse_id_arr' => $warehouse_id_arr, 'product_id' => $product_name, 'product_name' => $product_id, 'keyword' => $keyword);
     }
     $ai_arr = array();
     if ('' != $ai) {
         $tmparr = explode(';', $ai);
         foreach ($tmparr as $value) {
             $row = explode('=', $value);
             $ai_arr[] = '%(' . str_replace('y', '_', $row[0]) . ')' . $row[1] . '%';
         }
         $params['ai_arr'] = $ai_arr;
     }
     try {
         // 一覧を取得
         $sth = DaoFactory::ZaikoD()->getZaikoForCsvData($params);
         // 書き込みクラスを生成
         require_once 'csv/ZaikoDCsvWriter.class.php';
         $writer = new ZaikoDCsvWriter();
         if (!isset($params['ai_arr'])) {
             unset($writer->format['AI_INFO']);
         }
     } catch (Exception $e) {
         // 致命的なエラーが発生
         $this->logger->log(LOG_DEBUG, $e->getTraceAsString());
         return array('500', $e->getMessage());
     }
     return array('csv', $writer, $sth, 'ZaikoD' . date('YmdHis') . '.csv');
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 /**
  * 一覧のデータを返す
  * @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);
 }