From 5bc0c6525a4d15c513cc8017e764528f2e8f202f Mon Sep 17 00:00:00 2001 From: lyt Date: Fri, 6 Dec 2019 12:30:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E6=88=90=E6=9C=AC=E6=80=BB=E9=A2=9D=E5=92=8C=E8=B4=A6=E5=8D=95?= =?UTF-8?q?=E4=B8=8D=E4=B8=80=E8=87=B4=E7=9A=84=E5=9B=A2=E6=88=90=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/order_finance.php | 12 ++++--- .../controllers/vendor_money.php | 35 +++++++++++++------ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/webht/third_party/trippestOrderSync/controllers/order_finance.php b/webht/third_party/trippestOrderSync/controllers/order_finance.php index 6bc6cb55..961e6585 100644 --- a/webht/third_party/trippestOrderSync/controllers/order_finance.php +++ b/webht/third_party/trippestOrderSync/controllers/order_finance.php @@ -35,14 +35,16 @@ class Order_finance extends CI_Controller { // 重新生成账单 // HT批量按钮调用 // 仅读取成本信息计算 - public function single_order_report($coli_sn=0, $debug=false) + public function single_order_report($coli_sn=0, $debug=false, $force_action=false ) { + $debug = boolval($debug); + $force_action = boolval($force_action); $order_info = $this->OrderFinance_model->get_order_info($coli_sn); if (empty($order_info)) { return; } $report_order_exists = $this->OrderFinance_model->get_report_order($order_info->ordernumber); - if ( ! empty($report_order_exists) && $debug===false) { + if ( ! empty($report_order_exists) && $debug===false && $force_action===false) { return $this->output->set_content_type('application/json')->set_output(json_encode($report_order_exists)); } return $this->generate_report($order_info, $debug); @@ -50,15 +52,17 @@ class Order_finance extends CI_Controller { // 重新生成账单 // HT单团财务表页面调用, 先刷新一次成本 - public function single_order_report_refresh($coli_sn=0, $debug=false) + public function single_order_report_refresh($coli_sn=0, $debug=false, $force_action=false) { ignore_user_abort(true); + $debug = boolval($debug); + $force_action = boolval($force_action); // 刷新成本 $controller_name = "TulanduoApi"; require_once($controller_name . '.php'); $vendor_class = new $controller_name(); $ret = $vendor_class->insert_HT_order_operation($coli_sn, null, false); - $this->single_order_report($coli_sn, $debug); + $this->single_order_report($coli_sn, $debug, $force_action); } /*! diff --git a/webht/third_party/trippestOrderSync/controllers/vendor_money.php b/webht/third_party/trippestOrderSync/controllers/vendor_money.php index a93d39e9..b22c3401 100644 --- a/webht/third_party/trippestOrderSync/controllers/vendor_money.php +++ b/webht/third_party/trippestOrderSync/controllers/vendor_money.php @@ -207,6 +207,8 @@ class Vendor_money extends CI_Controller { } // 财务表成本和实际成本不相等 $result['diff_cost'] = $this->money_model->report_tour_diff($start_date, $end_date, implode(',', $vendors)); + $this->async_fresh_report($result['diff_cost'], 'gci_no'); + $result['diff_cost'] = $this->money_model->report_tour_diff($start_date, $end_date, implode(',', $vendors)); return $this->load->view('vendor_money_sum', $result); // return $this->output->set_content_type('application/json')->set_output(json_encode($result)); ; @@ -323,17 +325,7 @@ class Vendor_money extends CI_Controller { $xls_data = $this->read_excel($read_path); unlink($upload_data['upload_data']['full_path']); $xls_ht_diff = $this->diff_xls_ht_cost($xls_data, $HT_combine_cost); - foreach ($xls_ht_diff['cost_error'] as $kc => $cost_error) { - $colis = $this->get_gci_coli($cost_error['GCI_combineNo'], false); - if (array_sum(array_column($colis['data'], 'no_fresh')) > 0 - || array_sum(array_column($colis['data'], 'cgi_check')) > 0 - ) { - continue; - } - foreach ($colis['data'] as $kco => $coli) { - async_curl("https://www.mycht.cn/webht.php/apps/trippestOrderSync/order_finance/single_order_report_refresh/" . $coli['COLI_SN'], 2); - } - } + $this->async_fresh_report($xls_ht_diff['cost_error']); } if ( ! empty($xls_data)) { // 批量`重新生成账单`之后, 在对比一次 @@ -345,6 +337,27 @@ class Vendor_money extends CI_Controller { return $this->load->view('order_report_precheck', $ret); } + /*! + * @Author: LYT: lyt@hainatravel.com + * @Date: 2019-12-06 11:25:16 + * @Desc: 批量重新生成账单, 跳过含有其他供应商的和已审核保存的 + */ + private function async_fresh_report($gci_nos, $key_name='GCI_combineNo') + { + foreach ($gci_nos as $kc => $gci) { + $colis = $this->get_gci_coli($gci[$key_name], false); + if (array_sum(array_column($colis['data'], 'no_fresh')) > 0 + || array_sum(array_column($colis['data'], 'cgi_check')) > 0 + ) { + continue; + } + foreach ($colis['data'] as $kco => $coli) { + async_curl("https://www.mycht.cn/webht.php/apps/trippestOrderSync/order_finance/single_order_report_refresh/" . $coli['COLI_SN'] . "/0/1", 2); + } + } + return false; + } + private function diff_xls_ht_cost($xls_data, $HT_combine_cost) { $cost_error = array();