diff --git a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php index b2370792..1320495c 100644 --- a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php +++ b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php @@ -169,7 +169,8 @@ class TulanduoApi extends CI_Controller $tmpv = $this->city_info[$vo['operationDep']]['PlanVEI_SN'] ? $this->city_info[$vo['operationDep']]['PlanVEI_SN'] : 1343; // set GCI_SN $this->Orders_model->get_SN_by_vendorOrderId($vo['orderId'], $tmpv); // 查询订单是否已经录入过 - if ($this->Orders_model->BIZ_COLI_SN === null && in_array($vo['agcName'], array("D目的地桂林组", "Trippest"))) { + // if ($this->Orders_model->BIZ_COLI_SN===null && in_array($vo['agcName'], array("D目的地桂林组", "Trippest"))) { + if ($this->Orders_model->BIZ_COLI_SN === null) { $real_groupCode = analysis_groupCode($vo['agcOrderNo']); // set BIZ_COLI_SN, GRI_SN at Orders_model $this->Orders_model->get_SN_by_groupCode($real_groupCode, $vo['orderId']); @@ -263,9 +264,6 @@ class TulanduoApi extends CI_Controller */ public function insert_HT_order_operation($coli_sn=null,$get_vendorID=null) { - // if ($coli_sn == null) { - // return null; - // } log_message('error','get_order_operation From TuLanDuo '); $this->load->model('Order_update'); if ($coli_sn !== null && $coli_sn != 0) { @@ -303,6 +301,7 @@ class TulanduoApi extends CI_Controller } continue; } + $detail_jsonResp->orderDetail->agcOrderNo = mb_ereg_replace('( )', '', trim($detail_jsonResp->orderDetail->agcOrderNo)); // 去掉中文的全角空格 // 目的地的团已经主动取消, 只有其他渠道的团需要更新状态 if (mb_strstr($detail_jsonResp->orderDetail->agcOrderNo, "取消") !== false) { $this->plan_cancel($order->GCI_VendorOrderId); @@ -330,17 +329,120 @@ class TulanduoApi extends CI_Controller } } /** HT 开始 */ - /** UPDATE */ $cnt++; $vei_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] ? $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] : $order->COLD_PlanVEI_SN; $getInfo_byGroupCode = null; - if (in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) { - $real_groupCode = analysis_groupCode($detail_jsonResp->orderDetail->agcOrderNo); - $getInfo_byGroupCode = $this->Orders_model->get_SN_by_groupCode($real_groupCode, $detail_jsonResp->orderDetail->orderId); + $real_groupCode = analysis_groupCode($detail_jsonResp->orderDetail->agcOrderNo); + if (intval($order->COLI_OPI_ID) === 435 ) { + $getInfo_byGroupCodeArr = $this->Orders_model->get_order_by_groupcode($real_groupCode); + if ( empty($getInfo_byGroupCodeArr) ){ + $getInfo_byGroupCode = null; // 没有该团号的团信息 + } elseif (strval($getInfo_byGroupCodeArr[0]->COLI_OPI_ID) !== '435') { // 避免intval(null)=0 + $getInfo_byGroupCode = $getInfo_byGroupCodeArr[0]; // 渠道和目的地有重复操作的团 + } else { + foreach ($getInfo_byGroupCodeArr as $kg => $vg) { + if (mb_substr($vg->GRI_No, 0, 49) === $detail_jsonResp->orderDetail->agcOrderNo) { + // 地接拆分的团号,需要全部匹配; 否则为没有团信息 + $getInfo_byGroupCode = $vg; + break; + } + } + } + if ($getInfo_byGroupCode === null) { + $PAG_Code = $pag_sub = null; + preg_match('/[a-zA-Z]+\-[0-9\-]+/', characet($detail_jsonResp->orderDetail->routeName, "UTF-8"), $temp_array); + if (empty($temp_array) && isset($pag_no_tmp[$detail_jsonResp->orderDetail->routeName])) { + $PAG_Code = $pag_no_tmp[$detail_jsonResp->orderDetail->routeName]; + $split_code = explode("-", $PAG_Code); + $PAG_Code = $split_code[0] . "-" . $split_code[1]; + isset($split_code[2]) ? $pag_sub=$split_code[2] : null; + } else if ( ! empty($temp_array)) { + $PAG_Code = $pag_sub = null; + $split_code = explode("-", $temp_array[0]); + $PAG_Code = $split_code[0] . "-" . $split_code[1]; + isset($split_code[2]) ? $pag_sub=$split_code[2] : null; + } else { + log_message('error',"未识别的线路名称 $PAG_Code " . $detail_jsonResp->orderDetail->orderId . " " . $detail_jsonResp->orderDetail->routeName . var_export($temp_array, 1)); + } + $PAG_Code = in_array($PAG_Code, array("SHALC-6","SHALC-7","SHALC-8","SHALC-9")) ? "SHSIC-45" : $PAG_Code; + $serviceSN = $this->Orders_model->get_packageSN($PAG_Code); + $COLD_MemoText = raw_json_encode(array("Pick up"=>$detail_jsonResp->orderDetail->toTraffic, "Drop off"=>$detail_jsonResp->orderDetail->backTraffic)); + /** INSERT GRoupInfo */ + $travelDate = new DateTime($detail_jsonResp->orderDetail->travelDate); + $leaveDate = new DateTime($detail_jsonResp->orderDetail->leaveDate); + $date_diff = $travelDate->diff($leaveDate); + $this->Orders_model->GRI_No = mb_substr($detail_jsonResp->orderDetail->agcOrderNo, 0, 49); + $this->Orders_model->GRI_OrderType = 227002; // 商务 + $this->Orders_model->GRI_Name = mb_substr($detail_jsonResp->orderDetail->agcName . $detail_jsonResp->orderDetail->agcOrderNo, 0, 49); + $this->Orders_model->GRI_PersonNum = $detail_jsonResp->orderDetail->adultNum+$detail_jsonResp->orderDetail->childNum; + $this->Orders_model->GRI_Days = intval($date_diff->format('%R%a')+1); + $this->Orders_model->GRI_IsCancel = 0; + $this->Orders_model->DeleteFlag = 0; + $this->Orders_model->GRI_OPI_ID = 435; + $this->Orders_model->GRI_operator = 435; + $this->Orders_model->GRI_Creator = 435; + $groupSN = $this->Orders_model->groupinfo_save(); + /** BIZ_Guest */ + $this->Orders_model->GUT_LastName = $detail_jsonResp->orderDetail->customers[0]->name; + $this->Orders_model->biz_guest_save(); + /** BIZ_ConfirmLineInfo*/ + $this->Orders_model->BIZ_COLI_GRI_SN = $groupSN; + $this->Orders_model->BIZ_COLI_GroupCode = $this->Orders_model->GRI_No; + $this->Orders_model->BIZ_GUT_SN = $this->Orders_model->GUT_SN; + $this->Orders_model->BIZ_COLI_ID = $this->Orders_model->biz_make_order_number(); + $this->Orders_model->BIZ_COLI_ApplyDate = $detail_jsonResp->orderDetail->orderTime; + $this->Orders_model->BIZ_COLI_sourcetype = empty($this->city_info[$detail_jsonResp->orderDetail->operationDep]) ? 32090 : $this->city_info[$detail_jsonResp->orderDetail->operationDep]['COLI_sourcetype']; + $this->Orders_model->BIZ_COLI_State = 9; + $this->Orders_model->BIZ_COLI_servicetype = 'D'; + $this->Orders_model->BIZ_COLI_ConfirmType = 52001; + $this->Orders_model->BIZ_COLI_Memo = ""; + $this->Orders_model->BIZ_COLI_OrderDetailText = "来自图兰朵系统同步" . $detail_jsonResp->orderDetail->orderId . ";线路:" . $detail_jsonResp->orderDetail->routeName . "; 团名: " . $detail_jsonResp->orderDetail->agcOrderNo; + $this->Orders_model->BIZ_COLI_GUT_SN = $this->Orders_model->BIZ_GUT_SN ? $this->Orders_model->BIZ_GUT_SN : null; + $this->Orders_model->BIZ_COLI_OPI_ID = 435; + $this->Orders_model->BIZ_COLI_PayManner = 15006; + $coli_sn = $this->Orders_model->biz_confirm_save(); + $coli_id = $this->Orders_model->BIZ_COLI_ID; + /**BIZ_ConfirmLineDetail*/ + $this->Orders_model->COLD_COLI_SN = $this->Orders_model->BIZ_COLI_SN; + $this->Orders_model->COLD_ServiceType = "D"; + $this->Orders_model->COLD_ServiceSN = $serviceSN->PAG2_PAG_SN; + $this->Orders_model->COLD_ServiceSN2 = $pag_sub; + $this->Orders_model->COLD_ServiceCity = $serviceSN->PAG_CII_SN; + $this->Orders_model->COLD_StartDate = $detail_jsonResp->orderDetail->travelDate; + $this->Orders_model->COLD_EndDate = $detail_jsonResp->orderDetail->leaveDate; + $this->Orders_model->COLD_PersonNum = $detail_jsonResp->orderDetail->adultNum; + $this->Orders_model->COLD_ChildNum = $detail_jsonResp->orderDetail->childNum; + $this->Orders_model->cold_state = 9 + $this->Orders_model->DeleteFlag = 0; + $this->Orders_model->COLD_PlanVEI_SN = $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] ? $this->city_info[$detail_jsonResp->orderDetail->operationDep]['PlanVEI_SN'] : 1343; + $this->Orders_model->COLD_MemoText = $COLD_MemoText; + $cold_sn = $this->Orders_model->biz_confirm_detail_save(); + } + $groupSN = $groupSN ? $groupSN : $getInfo_byGroupCode->GRI_SN; + $coli_sn = $coli_sn ? $coli_sn : $getInfo_byGroupCode->COLI_SN; + $coli_id = $coli_id ? $coli_id : $getInfo_byGroupCode->COLI_ID; + $coli_memo = ($getInfo_byGroupCode!==null) ? $getInfo_byGroupCode->COLI_Memo : ""; + $coli_orderdetailtext = ($getInfo_byGroupCode!==null) ? $getInfo_byGroupCode->COLI_OrderDetailText : ""; + $coli_state = ($getInfo_byGroupCode!==null) ? $getInfo_byGroupCode->COLI_State : 9; + $cold_sn = $cold_sn ? $cold_sn : $getInfo_byGroupCode->COLD_SN; + } else { + // $getInfo_byGroupCode = null; + $getInfo_byGroupCode = $getInfo_byGroupCode[0]; + $groupSN = $order->COLI_GRI_SN; + $coli_sn = $order->COLI_SN; + $coli_id = $order->COLI_ID; + $coli_memo = $order->COLI_Memo; + $coli_orderdetailtext = $order->COLI_OrderDetailText; + $coli_state = $order->COLI_State; + $cold_sn = $order->COLD_SN; } - $groupSN = $getInfo_byGroupCode!==null ? $getInfo_byGroupCode->GRI_SN : $order->COLI_GRI_SN; - $coli_sn = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_SN : $order->COLI_SN; - $coli_id = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_ID : $order->COLI_ID; + // if (in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) { + // $getInfo_byGroupCode = $this->Orders_model->get_SN_by_groupCode($real_groupCode, $detail_jsonResp->orderDetail->orderId); + // } + /** UPDATE */ + $groupSN = $groupSN ? $groupSN : $order->COLI_GRI_SN; + $coli_sn = $coli_sn ? $coli_sn : $order->COLI_SN; + $coli_id = $coli_id ? $coli_id : $order->COLI_ID; $coli_memo = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_Memo : $order->COLI_Memo; $coli_orderdetailtext = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLI_OrderDetailText : $order->COLI_OrderDetailText; $coli_state = isset($getInfo_byGroupCode->COLI_SN) ? @@ -349,12 +451,10 @@ class TulanduoApi extends CI_Controller $cold_sn = isset($getInfo_byGroupCode->COLI_SN) ? $getInfo_byGroupCode->COLD_SN : $order->COLD_SN; // HT 订单有重复时, 以图兰朵的团号为正确的订单, 原本已录入的设为无效 if ($getInfo_byGroupCode === null) { - } elseif ($getInfo_byGroupCode->GRI_SN != $order->COLI_GRI_SN && in_array($order->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) { + } elseif ($getInfo_byGroupCode->GRI_SN != $order->COLI_GRI_SN && intval($order->COLI_OPI_ID)===435) { if ( $order->COLI_ID && $order->COLI_ID != $getInfo_byGroupCode->COLI_ID) { $allDetails_to_HT .= "\r\n疑似重复,请更新订单状态:" . $order->COLI_ID; - if (intval($order->COLI_OPI_ID) === 435 ) { - $this->order_cancel($order->COLI_ID); - } + $this->order_cancel($order->COLI_ID); } } /** groupcombineinfo */ @@ -369,6 +469,15 @@ class TulanduoApi extends CI_Controller ,"GCI_createTime" => date('Y-m-d H:i:s') ); $this->Order_update->biz_groupcombineinfo_update($gci_update_column); + /** GRoupInfo */ + if (intval($order->COLI_OPI_ID) === 435 ) { + $gri_update_column = array( + "GRI_No" => $detail_jsonResp->orderDetail->agcOrderNo + ,"GRI_Name" => $detail_jsonResp->orderDetail->agcOrderNo + ); + $this->Order_update->gri_where_update = " GRI_SN=" . $groupSN; + $this->Order_update->biz_groupinfo_update($gci_update_column); + } /** BIZ_ConfirmLineInfo */ $this->Order_update->coli_where_update = " COLI_SN=" . $coli_sn; $old_memo = mb_strstr($coli_memo, " orderRemark", true)!==false ? mb_strstr($coli_memo, " orderRemark", true) : $coli_memo; @@ -396,9 +505,18 @@ class TulanduoApi extends CI_Controller ,"COLI_State" => $coli_state ,"COLI_Price" => $travel_fee ,"COLI_CUrrency" => $travel_fee_currency + ,"COLI_GroupCode" => $detail_jsonResp->orderDetail->agcOrderNo ); $this->Order_update->biz_confirmlineinfo_update($coli_update_column); /** BIZ_ConfirmLineDetail */ + if (intval($order->COLI_OPI_ID) === 435) { + $cold_update_column = array( + "COLD_PersonNum" => $detail_jsonResp->orderDetail->adultNum + ,"COLD_ChildNum" => $detail_jsonResp->orderDetail->childNum + ); + $this->Order_update->cold_where_update = " COLD_SN=" . $getInfo_byGroupCode->COLD_SN; + $this->Order_update->biz_confirmlinedetail_update($cold_update_column); + } /** INSERT */ /*BIZ_BookPeople*/ if ($this->Orders_model->bookpeople_exist($cold_sn) === array()) { @@ -652,6 +770,7 @@ class TulanduoApi extends CI_Controller */ public function get_history_order_list($oldest_date=null) { + $this->load->model('Tulanduo_sync_model', 'sync_model'); // $oldest_date===null ? $oldest_date = $this->Orders_model->get_oldest_offset() : null; $oldest_date===null ? $oldest_date = '2018-05-10' : null; // test $startTravelDate = date('Y-m-d', strtotime("-1 day", strtotime($oldest_date))); @@ -677,7 +796,7 @@ class TulanduoApi extends CI_Controller if ($resp_arr["responseData"]["totalRows"] == 0) { log_message('error','TulanduoApi get_orderlist history 0. '); // 继续往前滚日期 - $this->get_history_order_list($startTravelDate); + return $this->get_history_order_list($startTravelDate); } $all_list = $resp_arr["responseData"]["orders"]; for($pi=2; $pi <= $resp_arr['responseData']['pageCount']; $pi++) { @@ -695,10 +814,52 @@ class TulanduoApi extends CI_Controller $exists_ht = $this->Orders_model->get_exists_vendorOrderId($all_vendor_order_id_str); $exists_ht_order_id = array_map(function($ele){ return intval($ele->GCI_VendorOrderId);}, $exists_ht); $to_insert = array_diff($all_vendor_order_id, $exists_ht_order_id); - var_export($to_insert); if (empty($to_insert) || count($to_insert)==1) { // 继续往前滚日期 - $this->get_history_order_list($startTravelDate); + return $this->get_history_order_list($startTravelDate); + } + foreach ($all_list as $k => $vo) { + if ( ! in_array($value['orderId'], $to_insert)) { + continue; + } + $vo['agcOrderNo'] = mb_ereg_replace('( )', '', trim($vo['agcOrderNo'])); // 去掉中文的全角空格 + // 解析产品编号 + $PAG_Code = $pag_sub = null; + preg_match('/[a-zA-Z]+\-[0-9\-]+/', $this->characet($vo['routeName'], "UTF-8"), $temp_array); + if (empty($temp_array) && isset($pag_no_tmp[$vo['routeName']])) { + $PAG_Code = $pag_no_tmp[$vo['routeName']]; + $split_code = explode("-", $PAG_Code); + $PAG_Code = $split_code[0] . "-" . $split_code[1]; + isset($split_code[2]) ? $pag_sub=$split_code[2] : null; + } else if ( ! empty($temp_array)) { + $PAG_Code = $pag_sub = null; + $split_code = explode("-", $temp_array[0]); + $PAG_Code = $split_code[0] . "-" . $split_code[1]; + isset($split_code[2]) ? $pag_sub=$split_code[2] : null; + } else { + log_message('error',"未识别的线路名称 $PAG_Code " . $vo['orderId'] . " " . $vo['routeName'] . var_export($temp_array, 1)); + } + $PAG_Code = in_array($PAG_Code, array("SHALC-6","SHALC-7","SHALC-8","SHALC-9")) ? "SHSIC-45" : $PAG_Code; + $serviceSN = $this->Orders_model->get_packageSN($PAG_Code); + $COLD_MemoText = raw_json_encode(array("Pick up"=>$vo['toTraffic'], "Drop off"=>$vo['backTraffic'])); + $tmpv = $this->city_info[$vo['operationDep']]['PlanVEI_SN'] ? $this->city_info[$vo['operationDep']]['PlanVEI_SN'] : 1343; + // if (in_array($vo['agcName'], array("D目的地桂林组", "Trippest"))) { + $real_groupCode = analysis_groupCode($vo['agcOrderNo']); + // check BIZ_COLI_SN,GRI_SN + $this->Orders_model->get_SN_by_groupCode($real_groupCode, $vo['orderId']); + // } + /** INSERT */ + /** biz_groupcombineinfo*/ + $this->Orders_model->GCI_combineNo = isset($vo['groupOrderNo']) ? $vo['groupOrderNo'] : ''; + $this->Orders_model->GCI_GRI_SN = $this->sync_model->GRI_SN; + $this->Orders_model->GCI_VEI_SN = $this->city_info[$vo['operationDep']]['PlanVEI_SN'] ? $this->city_info[$vo['operationDep']]['PlanVEI_SN'] : 1343; + $this->Orders_model->GCI_VendorOrderId = $vo['orderId']; + $this->Orders_model->GCI_FromAgc = $vo['agcName']; + $this->Orders_model->GCI_groupType = $vo['orderType']; + $this->Orders_model->GCI_travelDate = $vo['travelDate']; + $this->Orders_model->GCI_leaveDate = $vo['leaveDate']; + $this->Orders_model->GCI_createTime = date('Y-m-d H:i:s'); + $this->Orders_model->biz_groupcombineinfo_save(); } exit(); } diff --git a/webht/third_party/trippestOrderSync/controllers/api.php b/webht/third_party/trippestOrderSync/controllers/api.php index fa89eb5d..1562f36b 100644 --- a/webht/third_party/trippestOrderSync/controllers/api.php +++ b/webht/third_party/trippestOrderSync/controllers/api.php @@ -39,7 +39,7 @@ class Api extends CI_Controller { { return $ele->GCI_combineNo; }, $order_project)); - $ret['operation'] = null; + $ret['operation'] = array(); $operation = $this->Orders_model->get_operation($all_combine_no); // 司机, 导游 if ( ! empty($operation)) { diff --git a/webht/third_party/trippestOrderSync/models/order_update.php b/webht/third_party/trippestOrderSync/models/order_update.php index 7c2b17f0..bff88fd2 100644 --- a/webht/third_party/trippestOrderSync/models/order_update.php +++ b/webht/third_party/trippestOrderSync/models/order_update.php @@ -56,6 +56,20 @@ class Order_update extends CI_Model { return $update_exc; } + /*! + * 更新团信息 + */ + public $gri_where_update = ""; // where 条件 + public function biz_groupinfo_update($column_data) + { + if ($this->gri_where_update == "" || empty($column_data)) { + return false; + } + $update_str = $this->HT->update_string('GroupInfo', $column_data, $this->gri_where_update); + $update_exc = $this->HT->query($update_str); + return $update_exc; + } + /*! * 地接计划状态变更 * @param [type] $vas_sn [description] diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php index 43ecc465..ae96731a 100644 --- a/webht/third_party/trippestOrderSync/models/orders_model.php +++ b/webht/third_party/trippestOrderSync/models/orders_model.php @@ -122,18 +122,7 @@ class Orders_model extends CI_Model { } return NULL; } - public function get_exists_vendorOrderId($vendorOrderIds="") - { - $sql = "SELECT GCI_VendorOrderId FROM GroupCombineInfo - WHERE GCI_VendorOrderId IN ($vendorOrderIds) "; - return $this->HT->query($sql)->result(); - } - public function get_oldest_offset() - { - $sql = "SELECT top 1 CAST(GCI_travelDate as DATE) old_date from GroupCombineInfo - order by GCI_travelDate asc"; - return $this->HT->query($sql)->row()->old_date; - } + /*! * 需要更新调度信息的订单 -- 商务表 * @param integer $coli_sn [description] @@ -145,7 +134,7 @@ class Orders_model extends CI_Model { $sql = "SELECT top 10 coli.COLI_ID, coli.COLI_SN, coli.COLI_GRI_SN, cold.COLD_SN, coli.COLI_OrderDetailText, coli.COLI_Memo,coli.COLI_State,coli.COLI_OPI_ID, cold.COLD_PlanVEI_SN, gci.* FROM GroupCombineInfo gci - LEFT JOIN BIZ_ConfirmLineInfo coli ON coli.COLI_GRI_SN=gci.GCI_GRI_SN and coli.COLI_State NOT IN ('30','40','50') + LEFT JOIN BIZ_ConfirmLineInfo coli ON coli.COLI_GRI_SN=gci.GCI_GRI_SN --and coli.COLI_State NOT IN ('30','40','50') LEFT JOIN BIZ_ConfirmLineDetail cold ON cold.COLD_COLI_SN=coli.COLI_SN WHERE 1=1 "; if ($coli_sn !== 0) { @@ -524,13 +513,19 @@ class Orders_model extends CI_Model { return NULL; } + /*! + * 1. 获取列表时: 按团号查询团是否已存在, 避免渠道和目的地组同时操作 + * @param [type] $code [description] + * @param [type] $vendorOrderId [description] + */ public function get_SN_by_groupCode($code, $vendorOrderId=NULL) { $sql = "SELECT top 1 COLI_SN,gri.GRI_SN,cold.COLD_PlanVEI_SN,cold.COLD_SN,coli.COLI_ID,coli.COLI_Memo,coli.COLI_OrderDetailText,coli.COLI_State,coli.COLI_OPI_ID,coli.COLI_Price,coli.COLI_CUrrency ,GRI_OPI_ID,GRI_operator,GRI_No,GRI_Name FROM BIZ_ConfirmLineInfo coli - inner join BIZ_ConfirmLineDetail cold on cold.COLD_COLI_SN=COLI_SN and COLI_State not in (30,40,50) + inner join BIZ_ConfirmLineDetail cold on cold.COLD_COLI_SN=COLI_SN --and COLI_State not in (30,40,50) LEFT JOIN GRoupInfo gri ON coli.COLI_GRI_SN=gri.GRI_SN and GRI_OrderType=227002 + and gri.GRI_operator<>435 and gri.GRI_operator is not null WHERE gri.GRI_No LIKE '%$code%' order by COLI_SN desc"; // and gri.GRI_Name like '%$NoName%' $query = $this->HT->query($sql); @@ -545,6 +540,27 @@ class Orders_model extends CI_Model { return NULL; } + /*! + * 更新时: + * @date 2018-08-23 + * @param [type] $code [description] + */ + public function get_order_by_groupcode($code) + { + $sql = "SELECT COLI_SN,gri.GRI_SN,cold.COLD_PlanVEI_SN,cold.COLD_SN,coli.COLI_ID, + coli.COLI_OrderDetailText, + coli.COLI_State,coli.COLI_OPI_ID,coli.COLI_Price,coli.COLI_CUrrency + GRI_OPI_ID,GRI_operator,GRI_No,GRI_Name, + coli.COLI_Memo + FROM BIZ_ConfirmLineInfo coli + inner join BIZ_ConfirmLineDetail cold on cold.COLD_COLI_SN=COLI_SN + left JOIN GRoupInfo gri ON coli.COLI_GRI_SN=gri.GRI_SN and GRI_OrderType=227002 + WHERE gri.GRI_No LIKE '%$code%' + order by case COLI_OPI_ID when 435 then 1 else 0 end asc,COLI_SN desc"; + $query = $this->HT->query($sql); + return $query->result(); + } + /*! * 获取地接社接受计划的人员信息 * @param $vendorID 地接社ID