/** * 店舗マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // 初期化 $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); $warehouse_id_arr = $this->af->get('warehouse_id_arr'); // 削除 $warehouse = DaoFactory::WarehouseMst(); try { $warehouse->BeginTransaction(); $params = array('company_id' => $company_id); if ($_REQUEST['del'] == 'all') { $warehouse->Delete(' company_id = ? ', $params); } else { foreach ($warehouse_id_arr as $warehouse_id) { $params['warehouse_id'] = $warehouse_id; $warehouse->Delete(' company_id = ? and warehouse_id = ? ', $params); } } $warehouse->CommitTransaction(); } catch (Exception $e) { $warehouse->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array(500, $e->getMessage()); } exit; }
/** * 店舗マスタの保存が成功したかJSON形式で返す * @access public * @see Admin_ActionClass::perform() */ function perform() { // 初期化 $company_id = $this->session->get('company_id'); $user_id = $this->session->get('user_id'); $warehouse_id = $this->af->get('warehouse_id'); $warehouse_name = $this->af->get('warehouse_name'); $stock_move_rcv_ways = $this->af->get('stock_move_rcv_ways'); // 保存 $warehouse = DaoFactory::WarehouseMst(); try { $warehouse->BeginTransaction(); // WAREHOUSE_MSTに保存 $params = array('warehouse_name' => $warehouse_name, 'stock_move_rcv_ways' => implode(',', array_keys($stock_move_rcv_ways)), 'UID' => $user_id, 'PGM' => get_class()); // 店舗コード存在チェック $exist = $warehouse->Retrieve(' company_id = ? AND warehouse_id = ? ', array($company_id, $warehouse_id)); if (!is_array($exist)) { $def1 = $this->af->getDef('warehouse_id'); $err_msg = array('warehouse_id' => $def1['name'] . "が登録されていません"); return array(400, $err_msg); } $warehouse->Update($params, 'company_id=? AND warehouse_id=?', array($company_id, $warehouse_id)); $warehouse->CommitTransaction(); } catch (Exception $e) { $warehouse->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 ) $warehouse_id = $this->af->get('warehouse_id'); // get session params $company_id = $this->session->get('company_id'); try { // DAO パラメータ定義 $params = array('company_id' => $company_id, 'warehouse_id' => $warehouse_id); // 詳細を取得 $detail = DaoFactory::WarehouseMst()->Retrieve(' company_id = ? AND warehouse_id = ? ', $params); unset($detail['COMPANY_ID']); // パスワードは出力させない if ('' != $detail['STOCK_MOVE_RCV_WAYS']) { $arr = explode(',', $detail['STOCK_MOVE_RCV_WAYS']); } else { $arr = array(); } foreach ($arr as $value) { $detail['STOCK_MOVE_RCV_WAYS[' . $value . ']'] = 1; } // 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 * @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; }
/** * リクエストの店舗がDBに登録されているかチェックする * @param string $name フォーム名 */ public function check_warehouse_id_exists($name) { // 店舗を取得 $params = array('company_id' => $this->backend->getSession()->get('company_id'), 'warehouse_id' => $this->form_vars['warehouse_id']); $warehouse = DaoFactory::WarehouseMst()->Retrieve(' company_id = ? AND warehouse_id = ? ', $params); // 店舗が存在しない場合 if (empty($warehouse)) { $this->ae->add($name, "入力された{form}は登録されていません", E_FORM_INVALIDCHAR); } }
function getArrayOption_warehouse() { $params = array('company_id' => $this->backend->getSession()->get('company_id')); $warehouses = DaoFactory::WarehouseMst()->getWarehousesByCompanyID($params); $result = array('' => ''); foreach ($warehouses as $warehouse) { $result[$warehouse['WAREHOUSE_ID']] = $warehouse['WAREHOUSE_NAME']; } return $result; }
/** * 場所コードの取得 * @param string $name フォーム名 */ public function getArrayOption_warehouse_id() { $ret[''] = ''; $company_id = $this->backend->getSession()->get('company_id'); $list = DaoFactory::WarehouseMst()->Select(" company_id = ? order by warehouse_id ", array($company_id)); foreach ($list as $val) { $ret[$val['WAREHOUSE_ID']] = $val['WAREHOUSE_ID'] . ':' . $val['WAREHOUSE_NAME']; } return $ret; }
/** * 店舗マスタのデータをJSON形式で返す * @access public * @return array 店舗マスタ * @see Admin_ActionClass::perform() */ public function perform() { // 初期化 $not_warehouse_id = $this->af->get('not_warehouse_id'); $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; $not_warehouse_id = explode(',', urldecode($not_warehouse_id)); try { $params = array('not_warehouse_id' => $not_warehouse_id, 'limit' => $limit, 'page' => $page, 'order' => $order, 'column' => $column, 'keyword' => $keyword, 'company_id' => $company_id, 'start_page' => $start_page, 'end_page' => $end_page); // 一覧を取得 $list = DaoFactory::WarehouseMst()->warehouseMst_GetWarehouseList($params)->fetchAll(); $ways = Section::$STOCK_MOVE_RCV_WAYS; foreach ($list as $key => $row) { $waysname = array(); $tmp = explode(',', $row['STOCK_MOVE_RCV_WAYS']); foreach ($tmp as $value) { $waysname[] = $ways[$value]; } $list[$key]['RCV_WAYS_NAME'] = $waysname; } // ページ情報を設定 $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); }
/** * 店舗マスタのデータをJSON形式で返す * @access public * @return array 店舗マスタ * @see Admin_ActionClass::perform() */ public function perform() { // 初期化 $keyword = $this->af->get('warehouse_keyword'); $company_id = $this->session->get('company_id'); try { $params = array('keyword' => $keyword, 'company_id' => $company_id); // 一覧を取得 $list = DaoFactory::WarehouseMst()->warehouseMst_GetWarehouseList($params)->fetchAll(); // ページ情報を設定 $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); }
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); }
function perform() { //パラメータ取得 $company_name = $this->af->get('company_name'); $address = $this->af->get('address'); $contact = $this->af->get('contact'); $tel = $this->af->get('tel'); $mail = $this->af->get('mail'); $psw = $this->af->get('psw'); $psw2 = $this->af->get('psw2'); $uuid = $this->af->get('uuid'); $locale = $this->af->get('locale'); if ($locale == "zh-Hans") { $default_locale = "zh-Hans-CN"; } elseif ($locale == "ja") { $default_locale = "ja_JP"; } else { $default_locale = "en_US"; } $params = array('company_name' => $company_name, 'address' => $address, 'contact' => $contact, 'company_tel' => $tel, 'mail' => $mail, 'UID' => 'terminal', 'PGM' => get_class()); try { //fixme $dao = DaoFactory::CompanyMst(); $wdao = DaoFactory::WarehouseMst(); $tdao = DaoFactory::TerminalMst(); $sdao = DaoFactory::StaffMst(); $tudao = DaoFactory::TerminalUdidMst(); $dao->BeginTransaction(); $company_id = $dao->getNewCompanyId(); $argu = array('company_id' => $company_id, 'example_id' => $this->config->get('template_company_id'), 'uuid' => $uuid, 'upd_uid' => 'terminal', 'upd_pgm' => get_class()); $dao->addNewCompanyForApi($argu); $where = ' COMPANY_ID = ? '; $bind = array($company_id); $dao->Update($params, $where, $bind); $wdao->Update(array('address' => $address, 'warehouse_tel' => $tel, 'contact' => $contact, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $sdao->Update(array('staff_tel' => $tel, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $tdao->Update(array('password' => $psw, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); $tudao->Update(array('terminal_id' => $terminal_id, 'udid' => $udid, 'UID' => 'terminal', 'PGM' => get_class()), $where, $bind); DaoFactory::UserMst()->Update(array('user_pwd' => $psw, 'UID' => 'terminal', 'PGM' => get_class(), 'E_MAIL' => $mail, 'DEFAULT_LOCALE' => $default_locale), $where, $bind); $warehouse_id = $wdao->getMaxWarehouseIdByCompany(array('company_id' => $company_id)); $terminal_id = $tdao->getMaxTerminalIdByCompany(array('company_id' => $company_id)); $staff_id = $sdao->getMaxStaffIdByCompany(array('company_id' => $company_id)); //commit $dao->CommitTransaction(); } catch (Exception $e) { // 致命的なエラーが発生 $dao->AbortTransaction(); $this->logger->log(LOG_DEBUG, $e->getTraceAsString()); return array('500', $e->getMessage()); } mb_language('uni'); if ($locale == 'ja') { $subject = "{$this->config->get('system_name')}利用開始のご案内"; $message = "\r\n{$company_name} \r\n{$contact} 様\r\n\r\nこの度は「{$this->config->get('system_name')}」サービスにご登録いただきまして、誠にありがとうございます。\r\n本メールは iPhone/iPod touch の {$this->config->get('app_name')}アプリからアカウント申請を行っていただいた方に自動送信されています。\r\n本メールの心当たりがない場合は、本メールの破棄と弊社までご連絡頂ますようお願い申し上げます。\r\n\r\nアカウント申請後は {$this->config->get('app_name')}アプリのログイン画面にて申請時に入力したパスワードでログインが可能です。\r\n新規でご登録していただいたアカウントには端末1台2ヶ月まで無料ご利用いただけます。\r\n別の端末でログインするには、管理画面から端末追加登録とライセンス購入する必要がございます。\r\nライセンスのご購入はライセンスマスタ管理画面の購入リンクを押すか、直接AsShopにて、オンラインにてご購入いただけます。\r\n\r\nアカウント申請に伴い {$this->config->get('system_name')}に下記の情報が登録されています。\r\n-----------------アカウント情報------------------\r\n\t 会社ID:{$company_id}\r\n 初期管理者ユーザID:admin\r\n 管理者パスワード:申請時ご入力いただいたパスワード (端末のログインパスワードも同じです)※セキュリティのためパスワード本メールに含んでいません\r\n WEB管理画面URL: {$this->config->get('url')}?company_id={$company_id}\r\n \r\n------------------デモ情報-------------------------\r\n**登録後すぐに端末からログインし、ご利用いただけるように、上記のアカウント情報以外に\r\n下記必要なデモデータも自動的に作成されています。\r\n 倉庫/場所/発注先 コード:{$warehouse_id}\r\n 端末ID:{$terminal_id}\r\n 担当者ID:{$staff_id}\r\n---------------------------------------------------\r\n\r\n本サービスはiPhone/iPod touch用バーコードリーダー「AsReader」を併用すると更に便利にご利用になれます。\r\n詳しくはホームページまで。\r\nhttp://asreader.com/\r\n\r\n本サービスご利用にあたり、質問などお困りの時がございましたら、下記のサイトまでご参照ください。\r\nサービスホーム http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net\r\n\r\n "; } elseif ($locale == 'zh-Hans') { $subject = "{$this->config->get('app_name')}服务使用向导"; $message = "\r\n{$company_name} \r\n{$contact} 您好!\r\n \t\r\n非常感谢您登录{$this->config->get('app_name')}。\r\n这封邮件是在您通过iPhone/iPod touch的{$this->config->get('app_name')}应用程序,申请账号时自动发送给您的。\r\n如果您对该邮件不知情,请销毁本邮件并与我们联系。\r\n \t\r\n账户申请后,您就可以使用申请账号时所设置的密码在 {$this->config->get('app_name')}应用程序的登录画面中登录使用了。\r\n新注册的账号里已自动生成1台终端,可免费使用两个月。\r\n如需新增使用其他终端,需要在管理画面中的“终端管理”进行终端添加并购买证书后方可使用。\r\n \t\r\n以下是您所申请的{$this->config->get('app_name')}账户的相关信息。\r\n-----------------账户信息------------------\r\n\t 公司ID:{$company_id}\r\n \t 管理员ID:admin\r\n\t 管理员密码:申请账户时填写的密码 (与终端登录密码相同)\r\n\t WEB管理页面URL: {$this->config->get('url')}?company_id={$company_id}\r\n \t \r\n------------------模板信息-------------------------\r\n**为了在注册后您可以马上使用终端登录来体验我们的服务,除以上账户信息外,\r\n我们也为你创建了以下必要的基本信息。\r\n\t 仓库/场所/供货方 代码:{$warehouse_id}\r\n\t 终端ID:{$terminal_id}\r\n\t 操作员ID:{$staff_id}\r\n---------------------------------------------------\r\n \t\r\n如在使用本服务中遇到任何问题,请查看以下相关网站。\r\n服务总站 http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net \r\n \t\r\n"; } else { $subject = "Thank you for signing up {$this->config->get('app_name')} service"; $message = "\r\n{$company_name} \r\nHi {$contact} \r\n \t \r\nThank you for signing up our service {$this->config->get('app_name')}. \r\nThis mail is sent to every user who has registered an new account from our iOS app {$this->config->get('app_name')}.\r\nPlease feel free to contact us if you were not aware that you were going to receive it.\r\n \t \r\nYou can login to the app {$this->config->get('app_name')} with the password you have input in the register form upon receipt of this email.\r\n \t \r\nAccount Information:\r\n-----------------Account info------------------\r\n\t Company ID:{$company_id}\r\n\t Admin User ID:admin\r\n\t Password:The password you set in registration form\r\n\t Admin page URL: {$this->config->get('url')}?company_id={$company_id}\r\nEvery new account is assoiated with one preset terminal with a 2month free license.\r\nIf you want more terminals or longer licenses, please create terminal in the back-end admin system and buy license from our online shop.\r\n\r\n------------------demo data-------------------------\r\nBesides the account information above, we have also created some demo datas in order to help you test or learn our system easier.\r\n\t Warehouse/Place/Seller ID:{$warehouse_id}\r\n\t Terminal ID:{$terminal_id}\r\n\t Staff ID:{$staff_id}\r\n---------------------------------------------------\r\n \t \r\nOur app support AsReader 100% internally. AsReader is a series of hardware for iOS devices, they have ability to scan barcode or RFID tags and send the data to iOS devices.\r\nSo, it can easily turn your iPhones/iPods into a powerful handheld termials.\r\nfor more information, please refer to their official site:\r\nhttp://asreader.com/\r\n\r\nIf you have any question during using our service, please consult our following site for more information.\r\nService Home http://www.asx4.net\r\nAsWiki https://wiki.asx4.net\r\nAsHelp https://support.asx4.net\r\nAsShop https://ec.asx4.net\r\n\r\nBest regards,\r\n\r\nAsApps Team\r\n \t \r\n"; } $headers = "From: {$this->config->get('admin_email_address')}"; mb_send_mail($mail, $subject, $message, $headers); $output['company_id'] = $company_id; $output['warehouse_id'] = $warehouse_id; $output['terminal_id'] = $terminal_id; $output['staff_id'] = $staff_id; $output['server_url'] = $this->config->get('url'); return array('json', $output); }
public function getWarehouseIdOptions() { $company_id = $this->backend->getSession()->get('company_id'); $list = DaoFactory::WarehouseMst()->Select(" company_id = ? order by warehouse_id ", array($company_id)); // $options = array('' => ''); foreach ($list as $value) { $options[$value['WAREHOUSE_ID']] = $value['WAREHOUSE_ID'] . ' : ' . $value['WAREHOUSE_NAME']; } return $options; }