trippest 同步: 海纳的直接取原来的团GRI_SN

feature/pay
lyt 7 years ago
parent 2ba03b4430
commit a239cc12e9

@ -167,6 +167,7 @@ class TulanduoApi extends CI_Controller
$this->Orders_model->BIZ_COLI_SN = $this->Orders_model->GRI_SN = $this->Orders_model->GCI_SN = null;
$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"))) {
$real_groupCode = $this->analysis_groupCode($vo['agcOrderNo']);
@ -174,10 +175,7 @@ class TulanduoApi extends CI_Controller
$this->Orders_model->get_SN_by_groupCode($real_groupCode, $real_groupCode);
}
/** insert HT */
if ($this->Orders_model->BIZ_COLI_SN === null) {
/** BIZ_Guest */
$this->Orders_model->GUT_LastName = $vo['customerName'];
$this->Orders_model->biz_guest_save();
if ($this->Orders_model->GRI_SN === null) {
/** GRoupInfo */
$travelDate = new DateTime($vo['travelDate']);
$leaveDate = new DateTime($vo['leaveDate']);
@ -189,7 +187,15 @@ class TulanduoApi extends CI_Controller
$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;
$this->Orders_model->groupinfo_save();
}
if ($this->Orders_model->BIZ_COLI_SN === null) {
/** BIZ_Guest */
$this->Orders_model->GUT_LastName = $vo['customerName'];
$this->Orders_model->biz_guest_save();
/**BIZ_ConfirmLineInfo*/
$this->Orders_model->BIZ_COLI_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null;
$this->Orders_model->BIZ_COLI_GroupCode = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_No : "";

@ -231,6 +231,10 @@ class Orders_model extends CI_Model {
public $GRI_Days; // 行程天数
public $GRI_IsCancel=0;
public $GRI_DeleteFlag=0;
public $GRI_OPI_ID=0;
public $GRI_operator=0;
public $GRI_Creator=0;
public $GRI_CreateDate=0;
/** 团信息 */
public function groupinfo_save()
{
@ -241,8 +245,12 @@ class Orders_model extends CI_Model {
,GRI_Days
,GRI_IsCancel
,DeleteFlag
,GRI_OPI_ID
,GRI_operator
,GRI_Creator
,GRI_CreateDate
,GRI_OrderType)
VALUES (N?,N?,?,?,?,?,?)";
VALUES (N?,N?,?,?,?,?,?,?,?,GETDATE(),?)";
$query = $this->HT->query($sql, array(
$this->GRI_No,
$this->GRI_Name,
@ -250,6 +258,9 @@ class Orders_model extends CI_Model {
$this->GRI_Days,
$this->GRI_IsCancel,
$this->GRI_DeleteFlag,
$this->GRI_OPI_ID,
$this->GRI_operator,
$this->GRI_Creator,
$this->GRI_OrderType
));
$this->GRI_SN = $this->HT->query("select MAX(GRI_SN) as insert_id FROM GRoupInfo WHERE GRI_No='" . $this->GRI_No . "'")->row('insert_id');
@ -500,19 +511,26 @@ class Orders_model extends CI_Model {
public function get_SN_by_groupCode($code, $NoName)
{
$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
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
WHERE gri.GRI_No LIKE '%$code%' and gri.GRI_Name like '%$NoName%' ";
$query = $this->HT->query($sql);
if ($query->row()) {
$this->BIZ_COLI_SN = $query->row()->COLI_SN;
$this->GRI_SN = $query->row()->GRI_SN;
$this->COLD_PlanVEI_SN = $query->row()->COLD_PlanVEI_SN;
return $query->row();
$gri_sql = "SELECT top 1 GRI_SN,GRI_OPI_ID,GRI_operator,GRI_No,GRI_Name
from GRoupInfo
where GRI_Name like '%$code%' ";
$gri_query = $this->HT->query($gri_sql);
if ($gri_query->num_rows() > 0) {
$this->GRI_SN = $gri_query->row()->GRI_SN;
$this->GRI_operator = $gri_query->row()->GRI_operator;
$coli_sql = "SELECT top 1 COLI_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
FROM BIZ_ConfirmLineInfo coli
inner join BIZ_ConfirmLineDetail cold on cold.COLD_COLI_SN=COLI_SN
where COLI_GRI_SN=" . $this->GRI_SN;
$coli_query = $this->HT->query($coli_sql);
if ($coli_query->num_rows() > 0) {
$this->BIZ_COLI_SN = $coli_query->row()->COLI_SN;
$this->COLD_PlanVEI_SN = $coli_query->row()->COLD_PlanVEI_SN;
}
return NULL;
return json_decode(json_encode(array_merge(json_decode(json_encode($gri_query->row()), true), json_decode(json_encode($coli_query->row()), true))));
}
return NULL;
}
/*!

Loading…
Cancel
Save