|
|
|
|
@ -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);
|
|
|
|
|
|