本文整理匯總了PHP中CommonModel::calcAddOrderShippingFee方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonModel::calcAddOrderShippingFee方法的具體用法?PHP CommonModel::calcAddOrderShippingFee怎麽用?PHP CommonModel::calcAddOrderShippingFee使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonModel
的用法示例。
在下文中一共展示了CommonModel::calcAddOrderShippingFee方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
$msg = DLdlModel::insertOrderDetailExtDL($sql);
if(!$msg){
echo "訂單{$orderdata['recordnumber']}訂單明細擴展信息插入失敗!\r\n";
BaseModel::rollback();
}*/
$obj_order_detail_data[] = array('orderDetailData' => $orderdata_detail, 'orderDetailExtenData' => $orderDetailExtDL);
$ebay_fedex_remark[$categoryName][] = array('real_price' => $ShenBaoQuantity, 'qty' => $ShenBaoUnitPrice, 'hamcodes' => $customCode, 'detail' => $material);
}
$insertOrder = array('orderData' => $orderdata, 'orderExtenData' => $orderExtDL, 'orderUserInfoData' => $orderUserInfo, 'orderDetail' => $obj_order_detail_data, 'orderNote' => $orderNote);
$calcInfo = CommonModel::calcAddOrderWeight($insertOrder['orderDetail']);
//計算重量和包材
//var_dump($calcInfo); exit;
$insertOrder['orderData']['calcWeight'] = $calcInfo[0];
$insertOrder['orderData']['pmId'] = $calcInfo[1];
//$insertOrder['orderData']['transportId'] = $flip_transportList[get_carrier($insertOrder['orderData']['calcWeight'], $insertOrder['orderUserInfoData']['countryName'])];
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, 1);
//計算運費
//var_dump($calcShippingInfo); exit;
//$insert_orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
$insertOrder['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
$insertOrder = AutoModel::auto_contrast_intercept($insertOrder);
$omOrderId = OrderAddModel::insertAllOrderRow($insertOrder, 'cndl');
if ($omOrderId) {
echo "訂單 {$orderdata['recordnumber']} 信息添加成功!ERP訂單號為{$omOrderId}--" . date("Y-M-d H:i:s", $mctime) . "--\n";
}
foreach ($ebay_fedex_remark as $k => $v) {
$fedex_remark = array();
if ($carrierList[$orderdata['transportId']] == 'FedEx') {
$fedex_remark['description'] = "[No Brand]" . $k . "({$v[0]['detail']})";
$fedex_remark['type'] = 1;
} elseif ($carrierList[$orderdata['transportId']] == 'DHL' || $carrierList[$orderdata['transportId']] == 'EMS') {
示例2: act_sureAddOrder
//.........這裏部分代碼省略.........
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['amount'] += $sku_count[$i];
//累加
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['recordNumber'] = $recordNumber;
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['createdTime'] = time();
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['itemTitle'] = $ebay_itemtitle[$i];
}
foreach ($orderData as $id => $order) {
//$orderData 中第一維隻有一個元素,方便起見這裏用foreach,雖然隻循環一次
$ret = commonModel::checkOrder($recordNumber);
if ($ret) {
$returnArr['errCode'] = 101;
$returnArr['errMsg'] = "訂單{$recordNumber}已存在!";
return $returnArr;
}
//計算訂單屬性
if (count($order['orderDetail']) == 1) {
$detail = current($order['orderDetail']);
if ($detail['orderDetailData']['amount'] == 1) {
$orderData[$id]['orderData']['orderAttribute'] = 1;
} else {
$orderData[$id]['orderData']['orderAttribute'] = 2;
}
} else {
$orderData[$id]['orderData']['orderAttribute'] = 3;
}
//計算訂單重量及包材
$obj_order_detail_data = array();
foreach ($order['orderDetail'] as $sku => $detail) {
$obj_order_detail_data[] = $detail['orderDetailData'];
}
$weightfee = commonModel::calcOrderWeight($obj_order_detail_data);
$orderData[$id]['orderData']['calcWeight'] = $weightfee[0];
$orderData[$id]['orderData']['pmId'] = $weightfee[1];
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($orderData[$id], $orderData[$id]['orderData']['isFixed']);
//計算運費
$orderData[$id]['orderData']['channelId'] = $calcShippingInfo['channelId'];
$orderData[$id]['orderData']['calcShipping'] = $calcShippingInfo['fee'];
//調用舊係統接口,先插入數據到舊係統
$rtn = OldsystemModel::orderErpInsertorder($orderData[$id]);
$insertData = array();
if (empty($rtn)) {
$returnArr['errCode'] = 102;
$returnArr['errMsg'] = "接口返回異常,請重試!";
return $returnArr;
}
if ($rtn['errcode'] == 200) {
$rtn_data = $rtn['data'];
$orderId = $rtn_data['orderId'];
//echo "插入老係統成功,訂單編號 [$orderId] \n";
$pmId = $rtn_data['pmId'];
$totalweight = $rtn_data['totalweight'];
$shipfee = $rtn_data['shipfee'];
$carrier = $rtn_data['carrier'];
$carrierId = $rtn_data['carrierId'];
$status = $rtn_data['status'];
$orderData[$id]['orderData']['id'] = $orderId;
//賦予新係統訂單編號
if ($orderData['orderData']['calcWeight'] != $totalweight) {
$insertData['old_totalweight'] = $totalweight;
$insertData['new_totalweight'] = $orderData[$id]['orderData']['calcWeight'];
$orderData[$id]['orderData']['calcWeight'] = $totalweight;
}
if ($orderData['orderData']['pmId'] != $pmId) {
$insertData['old_pmId'] = $pmId;
$insertData['new_pmId'] = $orderData[$id]['orderData']['pmId'];
$orderData[$id]['orderData']['pmId'] = $pmId;
示例3: overWeightSplitB2B
//.........這裏部分代碼省略.........
$totalweight = 0;
$insert_ebay_ids = array();
//var_dump($skuinfo); echo "<br>";
foreach ($keyarray as $k => $kav) {
//var_dump($skuinfo[$k]['orderDetailData']['itemPrice'], count($kav));
//$ebay_total += ($skuinfo[$k]['orderDetailData']['itemPrice'] + $shippfee_arr[$k]) * count($kav);
$ebay_total += $skuinfo[$k]['orderDetailData']['itemPrice'] * count($kav);
}
$ebay_total = $rate * $ebay_total;
$shipfee = 0;
//$val = generateOrdersn();
$insert_obj_order_data = $obj_order_data;
unset($insert_obj_order_data['id']);
$insert_obj_order_data['actualTotal'] = $ebay_total;
$insert_obj_order_data['orderType'] = C('STATEPENDING_OWDONE');
$insert_obj_order_data['orderAddTime'] = $mctime;
$insert_obj_order_data['isSplit'] = 2;
$insert_orderExtenData = $orderExtenData;
unset($insert_orderExtenData['id']);
$insert_orderUserInfoData = $orderUserInfoData;
unset($insert_orderUserInfoData['id']);
$insert_orderData = array('orderData' => $insert_obj_order_data, 'orderExtenData' => $insert_orderExtenData, 'orderUserInfoData' => $insert_orderUserInfoData);
/*$sql = "insert into ebay_splitorder (recordnumber, main_order_id, split_order_id, create_date) values ('$recordnumber', '$ebay_id', '$insert_ebay_id', '".date("Y-m-d H:i:s")."')";
$split_log .= "添加主定單和拆分訂單到關係表中\r\n".$sql ."\r\n";
$dbcon->execute($sql) or die("Fail : $sql");*/
$obj_order_detail_data = array();
foreach ($keyarray as $k => $kav) {
$sku = $k;
$amount = count($kav);
$insert_orderDetailData = $skuinfo[$k]['orderDetailData'];
unset($insert_orderDetailData['id']);
$insert_orderDetailData['sku'] = strtoupper($sku);
$insert_orderDetailData['amount'] = $amount;
$insert_orderDetailData['createdTime'] = $mctime;
if (isset($shippfee_arr[$sku])) {
$insert_orderDetailData['shippingFee'] = $shippfee_arr[$sku] * $amount;
//相同料號運費拆分
}
$insert_orderDetailExtenData = $skuinfo[$k]['orderDetailExtenData'];
unset($insert_orderDetailExtenData['id']);
$obj_order_detail_data[] = array('orderDetailData' => $insert_orderDetailData, 'orderDetailExtenData' => $insert_orderDetailExtenData);
}
$insert_orderData['orderDetail'] = $obj_order_detail_data;
//echo "<pre>";
//var_dump($obj_order_detail_data); exit;
$calcInfo = CommonModel::calcAddOrderWeight($obj_order_detail_data);
//計算重量和包材
//var_dump($calcInfo); exit;
$insert_orderData['orderData']['calcWeight'] = $calcInfo[0];
$insert_orderData['orderData']['pmId'] = $calcInfo[1];
//var_dump($insert_orderData); exit;
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($insert_orderData, 1);
//計算運費
//var_dump($calcShippingInfo); exit;
$insert_orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
$insert_orderData['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
/*$interceptInfo = CommonModel :: auto_contrast_intercept($orderData);
//print_r($interceptInfo); exit;
$orderData['orderData']['orderStatus'] = $interceptInfo['orderStatus'];
$orderData['orderData']['orderType'] = $interceptInfo['orderType'];*/
if ($_spitId = OrderAddModel::insertAllOrderRowNoEvent($insert_orderData)) {
//echo $split_log .= 'insert success!' . "\n"; exit;
//var_dump($_mainId,$_spitId); exit;
if (!OrderLogModel::insertOrderLog($_spitId, 'INSERT ORDER')) {
BaseModel::rollback();
self::$errCode = '0021';
self::$errMsg = "split error!";
return false;
}
if (!OrderRecordModel::insertSpitRecords($_mainId, $_spitId)) {
BaseModel::rollback();
self::$errCode = '0022';
self::$errMsg = "split error!";
return false;
}
} else {
$split_log .= 'insert error!' . "\n";
BaseModel::rollback();
self::$errCode = '0023';
self::$errMsg = "split error!";
return false;
}
if (!OrderindexModel::deleteOrderData($tableName, $where)) {
self::$errCode = '0024';
self::$errMsg = "split error!";
return false;
}
if (!OrderLogModel::insertOrderLog($_mainId, 'DELETE ORDER')) {
BaseModel::rollback();
self::$errCode = '0025';
self::$errMsg = "split error!";
return false;
}
BaseModel::commit();
BaseModel::autoCommit();
}
self::$errCode = '200';
self::$errMsg = "split success!";
return true;
}
示例4: act_addDistributorOrder
//.........這裏部分代碼省略.........
//
$orderExtAli['declaredPrice'] = $val['orderAmount']['amount'];
$orderExtAli['paymentStatus'] = "";
//$order['fundStatus'];
$orderExtAli['transId'] = "";
//$val['tradeID'];//$order['id'];//$orderdetail["id"]; // 交易id;;
//$orderExtAli[PayPalPaymentId"] = '';
//$orderExtAli["site"] = '';
$orderExtAli['orderId'] = $val['orderId'];
$orderExtAli['platformUsername'] = "";
//$order['buyerSignerFullname'];;
$orderExtAli['currency'] = $val['orderAmount']['currencyCode'];
$orderExtAli['PayPalEmailAddress'] = "";
//$order['buyerInfo']['email'];;
$orderExtAli['eBayPaymentStatus'] = "";
//1?//$order['orderStatus']; //訂單狀態;
/***************END 訂單擴展表數據***************/
/***************BEGIN 訂單用戶表數據***************/
$orderUserInfo = array();
$orderUserInfo['username'] = $val['receiptAddress']['contactPerson'];
$orderUserInfo['platformUsername'] = "";
//$order['buyerSignerFullname'];
$orderUserInfo['email'] = "";
//$order['buyerInfo']['email'];
$orderUserInfo['countryName'] = get_country_name($val['receiptAddress']['country']);
$orderUserInfo['countrySn'] = $val['receiptAddress']['country'];
$orderUserInfo['currency'] = $val['orderAmount']['currencyCode'];
$orderUserInfo['state'] = $val['receiptAddress']['province'];
$orderUserInfo['city'] = $val['receiptAddress']['city'];
$orderUserInfo['street'] = $val['receiptAddress']['address1'];
//?//$val['receiptAddress']['detailAddress'];
$orderUserInfo['address2'] = isset($val['receiptAddress']['address2']) ? $val['receiptAddress']['address2'] : "";
$orderUserInfo['zipCode'] = $val['receiptAddress']['zip'];
$orderUserInfo['phone'] = $val['receiptAddress']['phoneNumber'];
/*************END 訂單用戶表數據***************/
$carrier = array();
$item_notes = array();
$noteb = array();
$insertOrder = array('orderData' => $orderdata, 'orderExtenData' => $orderExtAli, 'orderUserInfoData' => $orderUserInfo);
$orderweight = "";
$obj_order_detail_data = array();
foreach ($val['childOrderList'] as $orderdetail) {
//明細表
$orderdata_detail = array();
//$orderdata_detail['omOrderId'] = $insertId;//$order["id"];
$orderdata_detail['recordNumber'] = $orderId;
$orderdata_detail['sku'] = $orderdetail['productAttributes']['sku'];
//substr($orderdetail['skuCode'],0,stripos($orderdetail['skuCode'],'#'));
$orderdata_detail['itemPrice'] = $orderdetail['productAttributes']['itemPrice'];
$orderdata_detail['amount'] = $orderdetail['lotNum'];
//$orderdata_detail["shippingFee"] = '';
//$orderdata_detail["reviews"] = '';
$orderdata_detail['createdTime'] = time();
//明細擴展表
$orderDetailExtAli = array();
$orderDetailExtAli['itemTitle'] = $orderdetail['productAttributes']['itemTitle'];
$orderDetailExtAli['itemURL'] = $orderdetail['productAttributes']['skuUrl'];
$orderDetailExtAli['itemId'] = "";
//$orderdetail['productId'];
$orderDetailExtAli['transId'] = 0;
//$orderId;//$orderdetail['orderId']; // 交易id;
$orderDetailExtAli['note'] = "";
//$item_notes[$orderdetail['orderId']];
$obj_order_detail_data[] = array('orderDetailData' => $orderdata_detail, 'orderDetailExtenData' => $orderDetailExtAli);
}
$insertOrder['orderDetail'] = $obj_order_detail_data;
$calcInfo = CommonModel::calcAddOrderWeight($obj_order_detail_data);
//計算重量和包材
$insertOrder['orderData']['calcWeight'] = $calcInfo[0];
$insertOrder['orderData']['pmId'] = $calcInfo[1];
if (count($insertOrder['orderDetail']) > 1) {
$insertOrder['orderData']['orderAttribute'] = 3;
} else {
if (isset($insertOrder['orderDetail'][0]['orderDetailData']['amount']) && $insertOrder['orderDetail'][0]['orderDetailData']['amount'] > 1) {
$insertOrder['orderData']['orderAttribute'] = 2;
}
}
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, 1);
//計算運費
$insertOrder['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
$insertOrder = AutoModel::auto_contrast_intercept($insertOrder);
$opflag = "false";
if (OrderAddModel::insertAllOrderRow($insertOrder)) {
$itemRtn["errcode"] = 0;
$itemRtn["orderId"] = $orderId;
$itemRtn["msg"] = "success";
$rtnArr[] = $itemRtn;
$opflag = "success";
} else {
$itemRtn["errcode"] = 80005;
$itemRtn["orderId"] = $orderId;
$itemRtn["msg"] = "添加訂單失敗";
$rtnArr[] = $itemRtn;
}
$logfile = date("Y-m-d") . ".log";
@file_put_contents("/home/ebay_order_cronjob_logs/auto_contrast_intercept/" . $account . "/" . $logfile, $_POST["orderArr"] . "==" . $opflag . "\r\n", FILE_APPEND);
}
$rtnStr = json_encode($rtnArr);
echo $rtnStr;
}
示例5: view_guoneiSaleImport
//.........這裏部分代碼省略.........
$orderData[$recordNumber]['orderData']['isFixed'] = 1;
}
}
}
}
foreach ($transportation as $tranValue) {
if ($tranValue['carrierNameCn'] == $carrierNameCn) {
$orderData[$recordNumber]['orderData']['transportId'] = $tranValue['id'];
break;
}
}
if ($trackNumber != '') {
$orderData[$recordNumber]['orderTrack']['tracknumber'] = $trackNumber;
$orderData[$recordNumber]['orderTrack']['addUser'] = $_SESSION['sysUserId'];
$orderData[$recordNumber]['orderTrack']['createdTime'] = time();
}
//order擴展信息
$orderData[$recordNumber]['orderExtenData']['currency'] = $currency;
$orderData[$recordNumber]['orderExtenData']['paymentStatus'] = "PAY_SUCCESS";
$orderData[$recordNumber]['orderExtenData']['transId'] = $recordNumber;
// 交易id;;
$orderData[$recordNumber]['orderExtenData']['PayPalPaymentId'] = $PayPalPaymentId;
$orderData[$recordNumber]['orderExtenData']['platformUsername'] = $platformUsername;
$orderData[$recordNumber]['orderExtenData']['currency'] = $currency;
//user信息
$orderData[$recordNumber]['orderUserInfoData']['platformUsername'] = $platformUsername;
$orderData[$recordNumber]['orderUserInfoData']['username'] = $username;
$orderData[$recordNumber]['orderUserInfoData']['email'] = $email;
$orderData[$recordNumber]['orderUserInfoData']['street'] = $street1;
$orderData[$recordNumber]['orderUserInfoData']['address2'] = ${$street2};
$orderData[$recordNumber]['orderUserInfoData']['currency'] = $currency;
//$orderData[$recordNumber]['orderUserInfoData']['address3'] = $address3;
$orderData[$recordNumber]['orderUserInfoData']['city'] = $city;
$orderData[$recordNumber]['orderUserInfoData']['state'] = $state;
$orderData[$recordNumber]['orderUserInfoData']['zipCode'] = $zipCode;
$orderData[$recordNumber]['orderUserInfoData']['countryName'] = $countryName;
$orderData[$recordNumber]['orderUserInfoData']['landline'] = $phone;
$orderData[$recordNumber]['orderUserInfoData']['phone'] = $phone;
//note信息
if (!empty($note)) {
$orderData[$recordNumber]['orderNote'][$c]['content'] = $note;
$orderData[$recordNumber]['orderNote'][$c]['userId'] = $_SESSION['sysUserId'];
}
}
//print_r($orderData);
//echo "<pre>";print_r($orderData);//exit;
$message = "";
foreach ($orderData as $id => $order) {
//echo $id;
//$msg = commonModel::checkOrder($id);
$msg = commonModel::checkRecordNumber($id, $platformId, $plataccountId);
if ($msg) {
$message .= "<font color='red'>訂單{$id}已存在!</font><br>";
continue;
}
//計算訂單屬性
if (count($order['orderDetail']) == 1) {
$detail = current($order['orderDetail']);
if ($detail['orderDetailData']['amount'] == 1) {
$orderData[id]['orderData']['orderAttribute'] = 1;
} else {
$orderData[id]['orderData']['orderAttribute'] = 2;
}
} else {
$orderData[id]['orderData']['orderAttribute'] = 3;
}
//計算訂單重量及包材
$obj_order_detail_data = array();
foreach ($order['orderDetail'] as $sku => $detail) {
$obj_order_detail_data[] = $detail['orderDetailData'];
}
$weightfee = commonModel::calcOrderWeight($obj_order_detail_data);
$orderData[$id]['orderData']['calcWeight'] = $weightfee[0];
//$orderData[$value[0]]['orderData']['calcShipping'] = $weightfee[3];
$orderData[$id]['orderData']['pmId'] = $weightfee[1];
//計算運費
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, $orderData[$id]['orderData']['isFixed']);
//計算運費
$orderData[$id]['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
//$orderData[$id]['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
//缺貨攔截
$orderData[$id] = AutoModel::auto_contrast_intercept($orderData[$id]);
/*$orderData[$id]['orderData']['orderStatus'] = $status['orderStatus'];
$orderData[$id]['orderData']['orderType'] = $status['orderType'];*/
//echo "<pre>";print_r($orderData[$id]);
//print_r($orderData);
//exit;
//插入訂單
$info = OrderAddModel::insertAllOrderRowNoEvent($orderData[$id]);
if ($info) {
$message .= "<font color='green'>訂單{$id}上傳成功!</font><br>";
} else {
$message .= "<font color='red'>訂單{$id}上傳失敗!</font><br>";
}
}
$this->smarty->assign("showerrorinfo", $message);
//header("location:index.php?mod=underLineOrderImport&act=importOrder");
}
$this->smarty->display('guoneiSaleImport.htm');
}
示例6: act_transportFee
public function act_transportFee()
{
$omOrderId = $_POST['id'];
$tableName = 'om_unshipped_order';
$where = ' WHERE id = ' . $omOrderId;
$orderList = OrderindexModel::showOrderList($tableName, $where);
$orderData = $orderList[$omOrderId];
$data = array();
//print_r($orderData);
$obj_order_detail_data = array();
foreach ($orderData['orderDetail'] as $sku => $detail) {
$obj_order_detail_data[] = $detail['orderDetailData'];
}
$weightfee = commonModel::calcOrderWeight($obj_order_detail_data);
$data['calcWeight'] = $weightfee[0];
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($orderData, 1);
//計算運費
//var_dump($calcShippingInfo); exit;
$calcInfo = CommonModel::calcAddOrderWeight($orderData['orderDetail']);
//計算重量和包材
//var_dump($calcInfo); exit;
$data['calcWeight'] = $calcInfo[0];
$data['pmId'] = $calcInfo[1];
$data['calcShipping'] = $calcShippingInfo['fee']['fee'];
$data['channelId'] = $calcShippingInfo['fee']['channelId'];
if (OrderindexModel::updateOrder($tableName, $data, $where)) {
self::$errCode = OrderindexModel::$errCode;
self::$errMsg = OrderindexModel::$errMsg;
return true;
} else {
self::$errCode = OrderindexModel::$errCode;
self::$errMsg = OrderindexModel::$errMsg;
return false;
}
}
示例7: view_aliexpressimport
//.........這裏部分代碼省略.........
}
}
}
}
$transportation = CommonModel::getCarrierList();
//所有的
foreach ($transportation as $tranValue) {
if ($tranValue['carrierNameCn'] == $carrierNameCn) {
$orderData[$recordNumber]['orderData']['transportId'] = $tranValue['id'];
break;
}
//$transportationList[$tranValue['id']] = $tranValue['carrierNameCn'];
}
//order擴展信息
$orderData[$recordNumber]['orderExtenData']['currency'] = $currency;
$orderData[$recordNumber]['orderExtenData']['paymentStatus'] = "PAY_SUCCESS";
$orderData[$recordNumber]['orderExtenData']['transId'] = $recordNumber;
// 交易id;;
$orderData[$recordNumber]['orderExtenData']['platformUsername'] = $platformUsername;
//$orderData[$recordNumber]['orderExtenData']['currency'] = $currency;
//user信息
$orderData[$recordNumber]['orderUserInfoData']['platformUsername'] = $platformUsername;
$orderData[$recordNumber]['orderUserInfoData']['username'] = $username;
$orderData[$recordNumber]['orderUserInfoData']['email'] = $email;
$orderData[$recordNumber]['orderUserInfoData']['street'] = $street;
$orderData[$recordNumber]['orderUserInfoData']['currency'] = $currency;
$orderData[$recordNumber]['orderUserInfoData']['address2'] = $address2;
$orderData[$recordNumber]['orderUserInfoData']['address3'] = $address3;
$orderData[$recordNumber]['orderUserInfoData']['city'] = $city;
$orderData[$recordNumber]['orderUserInfoData']['state'] = $state;
$orderData[$recordNumber]['orderUserInfoData']['zipCode'] = $zipCode;
$orderData[$recordNumber]['orderUserInfoData']['countryName'] = $countryName;
$orderData[$recordNumber]['orderUserInfoData']['landline'] = $landline;
//detail信息
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['sku'] = $sku;
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['amount'] = $amount;
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['itemPrice'] = $itemPrice;
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['shippingFee'] = $shippingFee;
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['recordNumber'] = $recordNumber;
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailData']['createdTime'] = time();
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['itemTitle'] = $itemTitle;
//$orderData['orderDetail']['orderDetailExtenData']['note'] = $value[10];
$orderData[$recordNumber]['orderDetail'][$sku]['orderDetailExtenData']['transId'] = $transId;
//note信息
if (!empty($note)) {
$orderData[$recordNumber]['orderNote'][$c]['content'] = $note;
$orderData[$recordNumber]['orderNote'][$c]['userId'] = $_SESSION['sysUserId'];
}
}
}
//echo "<pre>";print_r($orderData);
$message = "";
foreach ($orderData as $id => $order) {
$msg = commonModel::checkOrder($id);
if ($msg) {
$message .= "<font color='red'>訂單{$id}已存在!</font><br>";
continue;
}
//計算訂單屬性
if (count($order['orderDetail']) == 1) {
$detail = current($order['orderDetail']);
if ($detail['orderDetailData']['amount'] == 1) {
$orderData[id]['orderData']['orderAttribute'] = 1;
} else {
$orderData[id]['orderData']['orderAttribute'] = 2;
}
} else {
$orderData[id]['orderData']['orderAttribute'] = 3;
}
//計算訂單重量及包材
$obj_order_detail_data = array();
foreach ($order['orderDetail'] as $sku => $detail) {
$obj_order_detail_data[] = $detail['orderDetailData'];
}
$weightfee = commonModel::calcOrderWeight($obj_order_detail_data);
$orderData[$id]['orderData']['calcWeight'] = $weightfee[0];
//$orderData[$value[0]]['orderData']['calcShipping'] = $weightfee[3];
$orderData[$id]['orderData']['pmId'] = $weightfee[1];
//計算運費
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, $orderData[$id]['orderData']['isFixed']);
//計算運費
$orderData[$id]['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
//缺貨攔截
$status = commonModel::auto_contrast_intercept($orderData[$id]);
$orderData[$id]['orderData']['orderStatus'] = $status['orderStatus'];
$orderData[$id]['orderData']['orderType'] = $status['orderType'];
//print_r($order);
//插入訂單
$info = OrderAddModel::insertAllOrderRowNoEvent($order);
if ($info) {
$message .= "<font color='green'>訂單{$id}上傳成功!</font><br>";
} else {
$message .= "<font color='red'>訂單{$id}上傳失敗!</font><br>";
}
}
$this->smarty->assign("showerrorinfo", $message);
//header("location:index.php?mod=underLineOrderImport&act=importOrder");
}
$this->smarty->display('underLineOrderImport.htm');
}
示例8: invokeListOrders
//.........這裏部分代碼省略.........
}
if ($order->isSetBuyerEmail()) {
//買家email
$orderUserInfoData['email'] = $order->getBuyerEmail();
//echo ("email ==== ");
//echo ($orderUserInfoData['email'] . "\n");
}
if ($order->isSetShipmentServiceLevelCategory()) {
$orderExtenData['ShipmentServiceLevelCategory'] = $order->getShipmentServiceLevelCategory();
//echo ("ShipmentServiceLevelCategory ==== ");
//echo ($orderExtenData['ShipmentServiceLevelCategory'] . "\n");
}
//$orderData['ebay_user'] = $user;
$orderData['platformId'] = 11;
//amazon的平台ID為11
$orderData['accountId'] = $accountId;
//amazon的賬號ID
//echo ("accountId ==== ");
//echo ($orderData['accountId'] . "\n");
$orderData['orderAddTime'] = time();
//添加到係統的時間
//echo ("orderAddTime ==== ");
//echo ($orderData['orderAddTime'] . "\n");
$orderData['orderStatus'] = C('STATEPENDING');
//默認訂單狀態
$orderData['orderType'] = C('STATEPENDING_CONV');
//默認訂單類型
$insertOrder = array('orderData' => $orderData, 'orderExtenData' => $orderExtenData, 'orderUserInfoData' => $orderUserInfoData);
$tName = 'om_unshipped_order';
$where = "WHERE recordNumber='{$orderData['recordNumber']}' AND platformId={$orderData['platformId']}";
$flagCountUnshipped = OmAvailableModel::getTNameCount($tName, $where);
$tName = 'om_shipped_order';
$flagCountshipped = OmAvailableModel::getTNameCount($tName, $where);
if (empty($flagCountUnshipped) && empty($flagCountshipped)) {
//判斷訂單是否已經在係統2個訂單表(未發貨和已發貨)中存在
//$orderData['ebay_ordersn'] = generateOrdersn();
$detailrequest = new MarketplaceWebServiceOrders_Model_ListOrderItemsRequest();
$detailrequest->setSellerId(MERCHANT_ID);
$detailrequest->setAmazonOrderId($orderData['recordNumber']);
$orderDetailArr = invokeListOrderItems($service, $detailrequest);
for ($i = 0; $i < count($orderDetailArr); $i++) {
$orderDetailArr[$i]['orderDetailData']['recordNumber'] = $orderData['recordNumber'];
}
//print_r($orderDetailArr);
if (!empty($orderDetailArr)) {
$insertOrder['orderDetail'] = $orderDetailArr;
//var_dump($obj_order_detail_data); echo "<br>";
$calcInfo = CommonModel::calcAddOrderWeight($orderDetailArr);
//計算重量和包材
//var_dump($calcInfo); exit;
$insertOrder['orderData']['calcWeight'] = $calcInfo[0];
$insertOrder['orderData']['pmId'] = $calcInfo[1];
if (count($insertOrder['orderDetail']) > 1) {
$insertOrder['orderData']['orderAttribute'] = 3;
} else {
if (isset($insertOrder['orderDetail'][0]['orderDetailData']['amount']) && $insertOrder['orderDetail'][0]['orderDetailData']['amount'] > 1) {
$insertOrder['orderData']['orderAttribute'] = 2;
}
}
$insertOrder['orderData']['transportId'] = $flip_transportList[get_carrier($insertOrder['orderData']['calcWeight'], $insertOrder['orderUserInfoData']['countryName'])];
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, 1);
//計算運費
//var_dump($calcShippingInfo); exit;
//$insert_orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
$insertOrder['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
$insertOrder = AutoModel::auto_contrast_intercept($insertOrder);
//print_r($interceptInfo); exit;
/*$insertOrder['orderData']['orderStatus'] = $interceptInfo['orderStatus'];
$insertOrder['orderData']['orderType'] = $interceptInfo['orderType'];*/
//var_dump($insertOrder); exit;
if (OrderAddModel::insertAllOrderRow($insertOrder)) {
//echo 'insert success!' . "\n";
echo "-----" . date("Y-m-d H:i:s") . ", 新增訂單{$orderData['recordNumber']}成功\r\n";
} else {
echo "-----" . date("Y-m-d H:i:s") . ", 新增訂單{$orderData['recordNumber']}失敗\r\n";
//echo OrderAddModel :: $errMsg;
}
} else {
//echo "Amazon ID: ".$orderData['recordnumber']." 訂單詳情添加失敗\n";
echo "Amazon ID: " . $orderData['recordNumber'] . " has no detail \n";
}
} else {
echo "Amazon ID: " . $orderData['recordNumber'] . " had exist\n";
}
}
}
}
} catch (MarketplaceWebServiceOrders_Exception $ex) {
echo "Caught Exception: " . $ex->getMessage() . "\n";
echo "Response Status Code: " . $ex->getStatusCode() . "\n";
echo "Error Code: " . $ex->getErrorCode() . "\n";
echo "Error Type: " . $ex->getErrorType() . "\n";
echo "Request ID: " . $ex->getRequestId() . "\n";
echo "XML: " . $ex->getXML() . "\n";
} catch (Exception $e) {
BaseModel::rollback();
BaseModel::autoCommit();
echo $e->getMessage() . "\n";
}
}
示例9: act_operateAbOrderAPI
public function act_operateAbOrderAPI()
{
if (!isset($_POST['omData'])) {
self::$errCode = 500;
self::$errMsg = '未成功接收數據!';
return false;
}
$ostatus = 770;
$otype = 0;
$storeId = 1;
$orderstr = $_POST['omData'];
$orderstr2 = $_POST['omData2'];
$orderids = array_unique(explode(',', $orderstr));
$invoiceids = array_unique(explode(',', $orderstr2));
if (!$orderids) {
self::$errCode = 400;
self::$errMsg = '未獲取訂單編號信息!';
return false;
}
//var_dump($orderids); exit;
$OrderindexAct = new OrderindexAct();
$WarehouseAPIAct = new WarehouseAPIAct();
foreach ($orderids as $k => $orderId) {
BaseModel::begin();
//開始事務
$insertOrderData = array();
$AbOrderInfo = $WarehouseAPIAct->act_getAbOrderInfo($invoiceids[$k]);
//var_dump($AbOrderInfo); echo "<br>";
//exit;
$where = ' WHERE id = ' . $orderId . ' and is_delete = 0 AND storeId = ' . $storeId . ' LIMIT 1';
$orderList = $OrderindexAct->act_showOrderList($ostatus, $otype, $where);
//var_dump($orderList);exit;
$order = $orderList[$orderId];
$orderData = $order['orderData'];
$insert_orderData = $orderData;
unset($insert_orderData['id']);
$insert_orderData['orderStatus'] = C('STATEOUTOFSTOCK');
$insert_orderData['orderType'] = C('STATEOUTOFSTOCK_ABNORMAL');
$orderExtenData = $order['orderExtenData'];
$insert_orderExtenData = $orderExtenData;
unset($insert_orderExtenData['omOrderId']);
$orderUserInfoData = $order['orderUserInfoData'];
$insert_orderUserInfoData = $orderUserInfoData;
unset($insert_orderUserInfoData['omOrderId']);
//$orderTracknumber = $order['orderTracknumber'];
//$orderAudit = $order['orderAudit'];
$orderDetail = $order['orderDetail'];
$insertOrderData['orderData'] = $insert_orderData;
$insertOrderData['orderExtenData'] = $insert_orderExtenData;
$insertOrderData['orderUserInfoData'] = $insert_orderUserInfoData;
$insert_orderDetail = array();
$need_delete_ids = array();
foreach ($orderDetail as $dkey => $detailValue) {
$orderDetailData = $detailValue['orderDetailData'];
$orderDetailExtenData = $detailValue['orderDetailExtenData'];
if (!isset($AbOrderInfo[$orderDetailData['sku']]) || $AbOrderInfo[$orderDetailData['sku']] == 0) {
$insert_orderDetailData = $orderDetailData;
unset($insert_orderDetailData['id']);
unset($insert_orderDetailData['omOrderId']);
$insert_orderDetailExtenData = $orderDetailExtenData;
unset($insert_orderDetailExtenData['omOrderdetailId']);
$insert_orderDetail[$dkey]['orderDetailData'] = $insert_orderDetailData;
$insert_orderDetail[$dkey]['orderDetailExtenData'] = $insert_orderDetailExtenData;
$need_delete_ids[] = $orderDetailData['id'];
}
}
$insertOrderData['orderDetail'] = $insert_orderDetail;
$count_insert_orderDetail = count($insert_orderDetail);
$count_orderDetail = count($orderDetail);
$tableName = "om_unshipped_order";
if ($count_insert_orderDetail > 0 && $count_insert_orderDetail < $count_orderDetail) {
$calcWeight = CommonModel::calcNowOrderWeight($orderId);
//重新計算原來訂單的重量
if (!OrderindexModel::deleteOrderDetail(array('is_delete' => 1), ' where id in(' . join(',', $need_delete_ids) . ')')) {
BaseModel::rollback();
self::$errCode = '005';
self::$errMsg = "刪除原訂單明細失敗!";
return false;
}
$insertOrderData['orderData']['isCopy'] = 2;
$insertOrderData['orderData']['actualTotal'] = 0.0;
//var_dump($orderData);exit;
$calcInfo = CommonModel::calcAddOrderWeight($insert_orderDetail);
//計算重量和包材
//var_dump($calcInfo); exit;
$insertOrderData['orderData']['calcWeight'] = $calcInfo[0];
$insertOrderData['orderData']['pmId'] = $calcInfo[1];
if (count($insertOrderData['orderDetail']) > 1) {
$insertOrderData['orderData']['orderAttribute'] = 3;
} else {
if (isset($insertOrderData['orderDetail'][0]['orderDetailData']['amount']) && $insertOrderData['orderDetail'][0]['orderDetailData']['amount'] > 1) {
$insertOrderData['orderData']['orderAttribute'] = 2;
}
}
$calcShippingInfo = CommonModel::calcAddOrderShippingFee($insertOrder, 1);
//計算運費
$insertOrderData['orderData']['channelId'] = $calcShippingInfo['fee']['channelId'];
$insertOrderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
//print_r($insertOrderData); exit;
if ($_spitId = OrderAddModel::insertAllOrderRowNoEvent($insertOrderData)) {
//.........這裏部分代碼省略.........