From 9a98e63bb83734992047689bf0751159883e2c5f Mon Sep 17 00:00:00 2001 From: lyt Date: Thu, 23 May 2019 13:57:07 +0800 Subject: [PATCH] =?UTF-8?q?pvt=E5=9B=A2=E8=A1=8C=E7=A8=8B=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=90=88=E5=B9=B6;=E4=BB=A3=E6=94=B6=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E8=AE=B0=E5=BD=95;=E8=AE=A2=E5=8D=95=E6=97=A5?= =?UTF-8?q?=E5=BF=97;=E8=AE=A2=E5=8D=95=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vendorPlanSync/controllers/Tulanduo.php | 25 +++++++++---------- .../models/BIZ_orders_model.php | 19 ++++++++++++++ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/webht/third_party/vendorPlanSync/controllers/Tulanduo.php b/webht/third_party/vendorPlanSync/controllers/Tulanduo.php index 427937c9..abb2979c 100644 --- a/webht/third_party/vendorPlanSync/controllers/Tulanduo.php +++ b/webht/third_party/vendorPlanSync/controllers/Tulanduo.php @@ -246,7 +246,6 @@ class Tulanduo extends CI_Controller */ public function push_trippest($vas=null) { -log_message('error',__LINE__); // return "[Tulanduo>push_trippest] Done. "; // test /** 目的地 */ $userId = $this->send_host["30"]["userId"]; @@ -267,13 +266,11 @@ log_message('error',__LINE__); if(empty($orderinfo)) {return "[Tulanduo>push_trippest] Not found order detail. ";} $COLI_ID = $orderinfo[0]->COLI_ID; $set_pvt = strval($orderinfo[0]->is_pvt); - // TODO 增加收款方参数, 增加代收款项 -log_message('error',__LINE__); + // 增加收款方参数, 增加代收款项 $vei_with_haina = $GLOBALS['__HAINA_VEI__'] . "," . $vei_sn_str; $all_payment = $this->BIZ_order->get_paymentDetails($COLI_ID, $vei_with_haina); $travel_fees = array(); $replace_collections = array(); -log_message('error',__LINE__); foreach ($all_payment as $kall => $vall) { if (in_array($vall->payment_vei, array($GLOBALS['__HAINA_VEI__'], 0)) ) { $travel_fees[] = $vall; @@ -281,28 +278,24 @@ log_message('error',__LINE__); $replace_collections[] = $vall; } } -log_message('error',__LINE__); - // 按产品拆分 todo:按订单类型拆分? 单团/拼团 + // 按产品拆分 按订单类型拆分? 单团/拼团; 未设置则按产品类型:接送 $fill_order = array(); $processed_date = array(); $processed_cold = array(); foreach ($orderinfo as $ko => $cold) { - // $cold->package_info = array(); if ( ! in_array($cold->COLD_SN, $processed_cold) && $cold->pag_code != '') { $processed_cold[] = $cold->COLD_SN; $all_package = $this->trippest->tour_code($cold->pag_code); $pag_info = $this->BIZ_order->get_packageDetails(my_implode("'",",",$all_package)); if ($set_pvt==='1') { - // $cold->package_info[] = $cold->pag_code; $fill_order[0]["cold"][] = $cold; - // $fill_order[0]["package_info"] = $pag_info; // todo ??? 这里是否丢失了产品 } else { $fill_order[$cold->pag_code]["cold"][] = $cold; $fill_order[$cold->pag_code]["package_info"] = $pag_info; } } } - // 多产品PVT的合并 + // 多产品PVT的合并,避免丢失产品 $pvt_pagcode = array(); if ($set_pvt==='1') { foreach ($fill_order[0]['cold'] as $kcd => $vcd) { @@ -314,14 +307,15 @@ log_message('error',__LINE__); // $fill_order = array_values($fill_order); $i=0; $take_apart = count($fill_order)>1 ? true : false; + $coli_sn = 0; foreach ($fill_order as $kf => $vf) { $i++; + $coli_sn = $vf['cold'][0]->COLI_SN; $this->tldOrderBuilder->resetBizContent(); $order_type = $set_pvt; if ($set_pvt==='0') { $code_type_arr = array_map(function($pag) { return intval($pag->PAG_ExtendType); }, $vf["package_info"]); $order_type = in_array(39009, $code_type_arr) ? 1 : 2; - // $order_type = intval($vf["package_info"][0]->PAG_ExtendType)===39009 ? 1 : 2; } $last_code = count($vf["package_info"])-1; $last_date = count($vf["cold"])-1; @@ -340,7 +334,11 @@ log_message('error',__LINE__); $tour_code = mb_strtoupper($vf["cold"][0]->pag_code); } $agcOrderNo .= "(" . $vf["cold"][0]->operator . ")"; - $order_remark = ""; // todo + $order_remark = ""; + if ($i===1) { // 只写一次备注.备注中可能包含代收信息,避免多次收取 + $order_remark_arr = array_filter(array_map( function($element){return $element->COLD_vendorMemo;}, $vf["cold"] )) ; + $order_remark = empty($order_remark_arr) ? "" : implode("\n", $order_remark_arr) ; + } $COLD_SN_str = implode(',', array_map( function($element){return $element->COLD_SN;}, $vf["cold"] )) ; $guestlist = $this->BIZ_order->get_guestlist($COLD_SN_str); @@ -356,7 +354,6 @@ log_message('error',__LINE__); ->setTravelDate(strstr($vf["cold"][0]->COLD_StartDate, " ", true)) ->setLeavedDate($end_date) ->setOrderRemark($order_remark) - // ->setOrderRemark(trim($orderinfo[0]->COLI_Memo . "\r\n" . $orderinfo[0]->COLD_Memo . "\r\n" . $orderinfo[0]->COLD_MemoText)) // todo 抵离交通 // ->setToTraffic($toTraffic) // ->setBackTraffic($backTraffic) @@ -543,8 +540,10 @@ log_message('error',$resp); ); if ($vps_sn === 0) { $sync_id = $this->Group_model->insert_VendorPlanSync($sync_ret); + $this->BIZ_orders_model->insert_biz_order_log($coli_sn, "vendorPlanSendout_" . $tour_code); } else { $update = $this->Group_model->update_VendorPlanSync($vps_sn, $sync_ret); + $this->BIZ_orders_model->insert_biz_order_log($coli_sn, "vendorPlanUpdateSendout_" . $tour_code); } /** VendorArrangeState VAS_IsReceive */ $this->Group_model->set_plan_received($vas_sn); diff --git a/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php b/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php index 9e3cf896..3765469a 100644 --- a/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php +++ b/webht/third_party/vendorPlanSync/models/BIZ_orders_model.php @@ -35,6 +35,7 @@ class BIZ_Orders_model extends CI_Model { public function get_orderinfo_detail($gri_sn, $vei_sn_str) { $sql = "SELECT coli.COLI_ID, + coli.COLI_SN, coli.COLI_Department, cold.COLD_ServiceSN, (select PAG_Code from biz_packageinfo where PAG_SN=cold.COLD_ServiceSN) as pag_code, @@ -1831,5 +1832,23 @@ log_message('error',$sql); $query = $this->HT->query($sql); } + /*! + * 写入商务订单操作记录 + * @param [int] $coli_sn + * @param [string] $log_info varchar(100) + */ + public function insert_biz_order_log($coli_sn, $log_info) + { + $db_column = array( + "BOL_COLI_SN" => $coli_sn + ,"BOL_OPI_SN" => 29 + ,"BOL_OPType" => $log_info + ,"BOL_OPTime" => date('Y-m-d H:i:s') + ,"BOL_Creator" => 29 + ,"BOL_CreateTime" => date('Y-m-d H:i:s') + ); + return $this->HT->insert("BIZ_OrderOperationLog", $db_column); + } + }