示例#1
0
 function act_accountAllListById()
 {
     $res = omAccountModel::accountAllListById();
     self::$errCode = omAccountModel::$errCode;
     self::$errMsg = omAccountModel::$errMsg;
     return $res;
 }
示例#2
0
 function act_getAccountListByPlatform()
 {
     $pid = !empty($_POST['platformId']) ? $_POST['platformId'] : 0;
     $accountList = omAccountModel::accountListByPid($pid);
     if (!$accountList) {
         self::$errCode = 400;
         self::$errMsg = "没取到对应账号列表!";
         return $accountList;
     } else {
         self::$errCode = 200;
         self::$errMsg = "获取到账号列表!";
         return $accountList;
     }
 }
示例#3
0
 public static function index($tableName, $where)
 {
     //数据查找
     !self::$dbConn ? self::initDB() : NULL;
     $set = "";
     //???
     //var_dump(array($id, $ostatus));
     //if($ostatus != C('STATEHASSHIPPED')){
     /*$orderForm					=	'om_unshipped_order';
     		$orderDetailForm			=	'om_unshipped_order_detail';
     		$orderDetailExtensionForm	=	'om_unshipped_order_detail_extension';
     		$orderExtensionForm			=	'om_unshipped_order_extension';
     		$orderUserInfoForm			=	'om_unshipped_order_userInfo';
     		$orderWarehouseForm			=	'om_unshipped_order_warehouse';*/
     /*} else {
     			$orderForm					=	'om_shipped_order';
     			$orderDetailForm			=	'om_shipped_order_detail';
     			$orderDetailExtensionForm	=	'om_shipped_order_detail_extension';
     			$orderExtensionForm			=	'om_shipped_order_extension';
     			$orderUserInfoForm			=	'om_shipped_order_userInfo';
     			$orderWarehouseForm			=	'om_shipped_order_warehouse';
     		}*/
     $platfrom = omAccountModel::getPlatformSuffixById($orderData['platformId']);
     $extension = $platfrom['suffix'];
     //获取后缀名称
     $orderExtensionForm .= '_' . $extension;
     $orderDetailExtensionForm .= '_' . $extension;
     $sql = "SELECT\n\t\t\t\t\tda.*,\n\t\t\t\t\tdb.reviews,\n\t\t\t\t\tdb.sku,\n\t\t\t\t\tdb.amount,\n\t\t\t\t\tdb.itemPrice,\n\t\t\t\t\tdb.id AS datailId,\n\t\t\t\t\tdc.*,\n\t\t\t\t\tdd.platform,\n\t\t\t\t\tde.transId,\n\t\t\t\t\tde.PayPalPaymentId,\n\t\t\t\t\tde.feedback,\n\t\t\t\t\tde.currency,\n\t\t\t\t\tde.PayPalEmailAddress,\n\t\t\t\t\tdf.account,\n\t\t\t\t\tdf.email AS accountEmail,\n\t\t\t\t\tdh.content,\n\t\t\t\t\tdh.userId,\n\t\t\t\t\tdh.createdTime,\n\t\t\t\t\tdi.actualWeight,\n\t\t\t\t\tdi.actualShipping\n\t\t\t\tFROM\n\t\t\t\t\t" . $orderForm . " AS da\n\t\t\t\tLEFT JOIN " . $orderDetailForm . " AS db ON db.omOrderId = da.id\n\t\t\t\tLEFT JOIN " . $orderUserInfoForm . " AS dc ON dc.omOrderId = da.id\n\t\t\t\tLEFT JOIN om_platform AS dd ON dd.id\t= da.platformId\n\t\t\t\tLEFT JOIN " . $orderExtensionForm . " AS de ON de.omOrderId\t= da.id\n\t\t\t\tLEFT JOIN om_account AS df ON df.id\t= da.accountId\n\t\t\t\tLEFT JOIN om_order_notes AS dh ON dh.omOrderId\t= da.id\n\t\t\t\tLEFT JOIN " . $orderWarehouseForm . " AS di ON di.omOrderId\t= da.id\n\t\t\t\tWHERE\n\t\t\t\t\tda.id\t=\t" . $id;
     //echo $sql; echo "<br>";
     $query = self::$dbConn->query($sql);
     if ($query) {
         $ret = self::$dbConn->fetch_array_all($query);
         return $ret;
     } else {
         return false;
     }
 }
示例#4
0
 public function act_repeatShipments2()
 {
     date_default_timezone_set("Asia/Chongqing");
     error_reporting(0);
     $currenctyList = CurrencyModel::getCurrencyList('currency,rates', 'where 1=1');
     foreach ($currenctyList as $value) {
         $currenctys[$value['currency']] = $value['rates'];
         //汇率数组
     }
     $packinglists = GoodsModel::getMaterInfo();
     //获取全部包材记录
     foreach ($packinglists as $packinglist) {
         $packings[$packinglist['id']]['pmName'] = $packinglist['pmName'];
         $packings[$packinglist['id']]['pmCost'] = $packinglist['pmCost'];
     }
     unset($packinglists);
     $carrierLists = CommonModel::getCarrierList();
     //获取全部运输方式
     foreach ($carrierLists as $carrierList) {
         $carriers[$carrierList['id']] = $carrierList['carrierNameCn'];
     }
     unset($carrierLists);
     $channelLists = CommonModel::getAllChannelList();
     //获取全部运输方式下的渠道记录
     foreach ($channelLists as $channelList) {
         $channels[$channelList['id']] = $channelList['channelName'];
     }
     unset($channelLists);
     $staffInfoLists = CommonModel::getStaffInfoList();
     //获取全部人员
     foreach ($staffInfoLists as $staffInfoList) {
         $staffLists[$staffInfoList['global_user_id']] = $staffInfoList['global_user_name'];
     }
     unset($staffInfoLists);
     //print_r($packings);
     //        exit;
     $ebayaccount = omAccountModel::ebayaccountAllList();
     //获取全部账号信息
     foreach ($ebayaccount as $value) {
         $ebayaccounts[$value['ebay_platform']][] = $value['id'];
         //账号id对应名称
     }
     unset($ebayaccount);
     $accountLists = omAccountModel::accountAllList();
     //获取全部账号信息
     foreach ($accountLists as $value) {
         $accounts[$value['id']] = $value['account'];
         //账号id对应名称
     }
     $time1 = time();
     $start = strtotime($_REQUEST['start']);
     $end = strtotime($_REQUEST['end']);
     $mailway = $_REQUEST['mailway'];
     $account = $_REQUEST['account'];
     ///////////////////////////////////////////////
     $accountStr = '';
     if ($account != '') {
         //组合成sql 中accountId In() 语句
         $account = explode("#", $account);
         foreach ($account as $value) {
             if ($value != '') {
                 $accountStr .= " accountId='" . $value . "' or ";
             }
         }
     }
     $accountStr = substr($accountStr, 0, strlen($accountStr) - 3);
     if (empty($accountStr)) {
         $accountStr = ' 1=1';
     }
     //$shipOrderList = OrderInfoModel :: getShipOrderList($start, $end, $accountStr);
     $tNameUnShipped = 'om_shipped_order';
     //已發貨订单表
     $where = " WHERE id IN ('8344971','8344971','8344971','8849112','9027686','9118441','9253209','9255395','9337524','9337524','9393954','9395762','9423987','9423987','9425121','9437038','9440042','9440042','9440042','9457399','9461841','9465559','9466929','9472244','9472244','9472244','9488351','9488351','9488479','9489408','9489408','9489408','9489408','9499144','9518194','9518200','9518866','9518866','9518866','9518866','9518898','9519076','9522183','9522183','9532719','9535192','9549634','9549634','9549634','9549643','9552004','9552004','9552004','9560244','9560244','9560244','9560244','9576989','9576989','9576989','9596753','9612887','9622477','9622500','9622512','9623276','9623276','9624016','9626076','9626076','9626076','9626076','9626316','9626385','9626385','9626385','9626403','9627404','9628837','9630913','9630913','9640585','9640585','9640585','9640604','9640770','9641002','9641274','9641274','9641274','9641395','9641529','9641529','9641744','9641829','9641829','9641892','9641892','9641946','9642205','9642205','9642380','9642780','9643939','9643939','9644644','9644644','9647186','9648475','9648478','9648478','9649284','9649286','9649649','9649649','9649649','9649652','9649652','9649652','9649885','9649909','9650192','9650192','9650198','9650198','9650241','9650322','9650322','9650322','9650322','9650380','9650381','9650388','9650571','9650571','9650571','9650612','9650615','9650637','9650649','9650673','9650673','9650681','9650685','9650696','9650704','9650704','9650726','9650741','9650741','9650761','9650785','9650826','9650834','9650834','9650834','9650834','9650838','9650841','9650841','9650914','9650937','9650937','9650958','9650958','9650989','9650995','9651008','9651120','9651151','9651333','9651351','9651351','9651351','9651363','9651618','9652039','9652041','9652172','9652197','9652294','9652355','9652355','9652365','9652547','9652570','9652815','9652829','9652829','9652830','9652830','9652830','9652834','9653349','9653350','9653677','9653677','9653784','9653786','9653790','9653790','9653826','9653866','9653866','9653866','9653866','9653868','9653869','9653869','9653869','9653870','9653870','9653871','9653874','9653878','9653878','9653878','9653878','9653879','9653884','9653884','9653959','9654059','9654071','9654332','9654572','9654572','9654572','9654573','9654573','9654778','9654778','9654784','9654792','9654961','9654964','9655556','9655630','9655630','9655643','9655643','9655643','9655646','9655734','9655775','9655777','9656086','9656208','9656209','9656210','9656529','9656529','9656593','9656629','9656634','9656746','9656983','9657511','9657566','9657566','9657566','9657566','9657641','9657641','9657677','9657678','9657680','9657802','9657802','9657803','9657985','9658074','9658081','9658321','9658337','9658449','9658458','9658501','9658501','9658840','9659006','9659144','9659726','9659726','9660877','9661308','9662160','9662162','9663236','9663236','9663236','9663236','9663236','9663236','9663254','9663408','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664335','9664338','9664338','9664341','9665707','9667826','9667826','9667826','9667826','9667826','9667826','9667826','9667826','9667835','9667843','9667849','9667849','9667849','9667849','9667849','9670393','9670393','9670393','9670393','9670393','9670393','9670407','9670407','9670407','9670407','9670407','9670417','9670426','9670683','9673777','9673777','9673777','9673777','9673777','9673778','9675229','9675242','9675595','9675595','9675595','8526402','8809110','8842096','8842096','8842096','8862631','8862631','8905974','8905974','8968635','9046612','9162772','9180940','9180940','9180940','9180940','9241329','9241329','9241329','9308486','9308486','9308486','9376347','9378671','9393969','9411833','9457216','9474385','9474385','9474385','9474385','9474603','9476126','9477416','9477416','9478721','9489020','9489608','9489608','9489608','9498874','9505075','9505075','9505075','9505075','9505151','9505151','9505151','9505151','9505733','9510621','9520197','9528779','9537456','9537668','9550596','9550596','9550596','9566234','9566234','9566248','9566248','9592573','9593512','9593512','9593512','9593512','9593512','9593512','9593512','9602420','9602420','9607647','9607647','9607647','9607647','9607647','9610633','9610776','9610776','9611433','9612362','9615401','9618958','9618958','9623437','9628510','9628510','9628655','9628655','9638991','9641400','9649804','9649855','9649855','9649855','9649855','9649894','9650472','9650472','9650552','9650556','9650583','9650585','9651279','9651509','9651712','9652013','9652013','9652273','9652273','9652274','9652274','9652274','9652441','9652483','9652513','9652523','9652523','9652929','9652929','9652929','9652929','9652929','9652929','9652929','9652929','9653014','9653027','9653027','9653027','9653027','9653103','9653345','9653345','9653345','9653345','9653345','9653489','9653567','9653637','9653938','9653938','9653938','9653938','9653938','9653941','9653941','9653941','9654055','9654055','9654055','9654055','9654061','9654075','9654084','9654323','9654641','9655179','9655255','9655255','9655506','9655506','9655538','9655671','9655835','9655967','9655967','9655967','9656198','9656251','9656251','9656251','9656277','9656279','9656329','9656329','9656329','9656329','9656522','9656541','9656541','9656655','9656921','9656921','9656942','9656942','9657107','9657174','9657174','9657175','9657175','9657175','9657345','9657860','9657860','9657994','9658000','9658000','9658004','9658004','9658012','9658030','9658030','9658030','9658030','9658114','9658141','9658141','9658156','9658209','9658286','9658286','9658295','9658295','9658295','9658295','9658296','9658296','9658595','9658595','9658649','9658691','9658784','9658784','9658784','9658784','9658798','9658809','9658834','9658845','9658852','9658852','9658852','9658914','9658914','9659007','9659009','9659083','9659084','9659148','9659151','9659151','9659355','9659378','9659401','9659451','9659451','9659594','9659804','9660076','9660076','9660393','9660399','9660399','9660406','9660453','9660453','9660453','9660453','9660460','9660603','9660603','9660603','9660862','9660862','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660864','9660942','9660952','9660952','9661096','9661096','9661156','9661187','9661292','9661481','9661622','9661850','9661890','9661890','9662030','9662113','9662113','9662146','9662146','9662249','9662249','9662343','9662457','9662471','9662471','9662502','9662696','9662732','9662732','9662732','9662733','9662733','9662733','9662832','9662908','9662908','9662909','9662971','9663010','9663010','9663010','9663014','9663380','9663380','9663380','9663386','9663386','9663692','9663693','9663754','9663754','9663826','9663826','9663894','9663998','9664012','9664080','9664090','9664093','9664112','9664112','9664112','9664112','9664175','9664191','9664191','9664192','9664192','9664196','9664554','9664554','9664968','9665016','9665209','9665222','9665222','9665309','9665392','9665396','9665667','9665667','9665667','9665668','9665668','9659581','9660388','9662117','9662117','9664751','9666120','9666124','9666258','9666258','9666262','9666264','9666344','9666377','9666383','9666383','9666383','9666383','9666384','9666384','9666384','9666384','9666828','9666828','9666947','9667031','9667031','9667206','9667206','9667206','9667206','9667332','9667564','9667564','9667564','9667564','9667567','9667567','9667567','9667567','9667567','9667567','9667580','9667580','9667581','9667597','9667754','9667802','9667802','9667802','9667802','9667949','9667949','9668151','9668151','9668683','9668685','9668773','9668802','9668802','9668802','9668808','9668808','9669255','9669262','9669265','9669268','9669268','9669273','9669285','9669541','9669883','9669964','9669964','9669964','9669964','9669964','9669972','9670114','9670129','9670129','9670286','9670338','9670338','9670411','9671287','9671290','9671452','9671531','9671634','9671634','9671634','9671680','9671680','9671693','9671896','9671934','9671973','9671988','9671988','9672000','9672194','9672194','9672339','9672362','9672362','9672698','9672735','9672743','9672751','9672790','9672911','9672911','9672911','9672993','9673004','9673004','9673101','9673218','9673319','9673323','9673380','9673421','9673452','9673475','9673516','9673643','9673643','9673643','9673668','9673747','9673749','9673753','9673753','9673760','9674395','9674395','9674419','9674419','9674848','9674848','9674850','9674850','9674850','9674850','9674852','9674854','9674854','9674854','9674885','9674899','9674899','9674899','9674899','9674899','9674899','9674908','9674913','9674913','9674913','9674920','9674920','9674920','9674920','9675055','9675087','9675087','9675087','9675137','9675137','9675137','9675137','9675137','9675157','9675157','9675157','9675271','9675583','9675584','9675586','9675586','9696845','9696880','9696880','9697073','9697082','9697092','9697095','9697095','9697095','9697095','9697105','9697110','9697110','9697110','9697115','9697115','9697115','9697254','9698356','9632026','9658246','9661119','9661119','9661119','9661119','9661119','9662121','9666751','9697750','9697750','9698264','9698805','9698808','9698810','9698810','9698810','9698810','9698813','9699173','9699175','9699179','9699179','9699179','9699182','9699184','9699267','9699267','9699267','9699821','9699821','9699892','9699900','9699908','9699923','9699924','9699924','9699924','9699927','9699930','9699930','9699976','9700235','9700312','9700333','9700357','9700357','9700399','9700399','9700931','9700973','9701169','9701449','9701648','9704135')";
     //$where = " WHERE `paymentTime` > $start AND `paymentTime` < $end AND `accountId` = '336' LIMIT 1,100";
     $shipOrderList = OrderindexModel::showOrderList($tNameUnShipped, $where);
     $fileName = "repeatShipments" . date('Y-m-d', $end) . ".xls";
     $excel = new ExportDataExcel('browser', $fileName);
     $excel->initialize();
     $row = array('日期', 'ebay store', '交易号', '客户ID', '仓位号', '料号', '数量', '料号重量', '成本', '国家', '包裹总价值', '邮费', '币种', '运输方式', '邮寄公司', '挂号条码', '是/否', '重量', '收件人姓名', '客户电话', '地址', '英文州名', '英文城市名', '邮编', '订单编号', '包装员', '配货员', '扫描员', '分区人员', '料号描述');
     $excel->addRow($row);
     foreach ($shipOrderList as $key => $value) {
         //key代表最外层的维数
         /*$value分别有7个对应的键,分别为
         		  orderData,//订单表头数据记录
         		  orderExtenData,//订单表扩展数据记录
         		  orderUserInfoData,//订单表中客户的数据记录
         		  orderWhInfoData,//物料对订单进行操作的数据记录
         		  orderNote,//订单的备注(销售人员添加)记录
         		  orderTracknumber,//订单的追踪号记录
         		  orderAudit,//订单明细审核记录
         		  orderDetail //订单明细记录
         		*/
         $orderData = $value['orderData'];
         //订单表头数据记录,为一维数组
         $orderExtenData = $value['orderExtenData'];
         //扩展表头数据记录,为一维数组
         $orderUserInfoData = $value['orderUserInfoData'];
         //订单客户数据记录,为一维数组
         $orderWhInfoData = $value['orderWhInfoData'];
         //物料对订单进行操作的数据记录,为一维数组
         $orderNote = $value['orderNote'];
         //订单备注记录,二维数组
         $orderTracknumber = $value['orderTracknumber'];
         //订单跟踪号,二维数组
         $orderAudit = $value['orderAudit'];
         //订单明细审核记录,二维数组
         $orderDetail = $value['orderDetail'];
         //订单明细记录,三维数组
         $orderId = $orderData['id'];
         //****订单编号 $ebay_id
         $orderPaidtime = @date('Y-m-d', $orderData['paymentTime']);
         //****订单付款时间 paidtime
         $orderUserInfoEmail = $orderUserInfoData['email'];
         //****客户邮箱 emial
         $platformUsername = $orderExtenData['platformUsername'];
         //****客户平台登录名称 $ebay_userid,用扩展表中的该字段 ebay_username
         $username = @html_entity_decode($orderUserInfoData['username'], ENT_QUOTES, 'UTF-8');
         //****客户真实名称(收件人) username
         $orderUserInfoStreet1 = @$orderUserInfoData['street'];
         //**** 街道地址 street1
         $orderUserInfoStreet2 = @$orderUserInfoData['address2'];
         //*** 街道地址2 steet2(一般订单会有两个街道地址)
         $orderUserInfoCity = $orderUserInfoData['city'];
         //**** 市 city
         $orderUserInfoState = $orderUserInfoData['state'];
         //**** 州 state
         $orderUserInfoCountryName = $orderUserInfoData['countryName'];
         //**** 国家全名
         //客服部小霞提出 导出列 国家 显示英文 方便退款处理
         //$cnname                   = $country[$countryname];
         $orderUserInfoZip = $orderUserInfoData['zipCode'];
         //**** 邮编 zipCode
         $orderUserInfoTel = $orderUserInfoData['landline'];
         //**** 座机 landline
         $orderWhInfoActualShipping = $orderWhInfoData['actualShipping'];
         //****实际运费,warehouse表中,ebay_shipfee
         $orderExtenFeedback = $orderExtenData['feedback'];
         //****客户留言 ebay_note
         $OrderActualTotal = @round($orderData['actualTotal'], 2);
         //****实际收款总价 $ebay_total
         $orderTracknumberOne = @$orderTracknumber[0]['tracknumber'];
         //****追踪号,这里只读取记录数的第一条记录的追踪号 $ebay_tracknumber
         $accountName = @$accounts[$orderData['accountId']];
         //****账号名称 $ebay_account
         $orderRecordnumber = @$orderData['recordNumber'];
         //****订单编码(对应平台上的编码) $recordnumber0??????
         //$ebay_carrier				= @$shipOrder['transportId'];//transportId ebay_carrier
         $orderUserInfoPhone = $orderUserInfoData['phone'];
         //****客户手机号码 $ebay_phone
         $orderExtenCurrency = $orderExtenData['currency'];
         //****币种 $ebay_currency
         $orderWhInfoPackersId = $orderWhInfoData['packersId'];
         //包装人员Id
         $packinguser = $staffLists[$orderWhInfoPackersId];
         //对应包装人员姓名
         //var_dump($packinguser);
         $OrderChannelId = $orderData['channelId'];
         //渠道Id $channelId
         $orderCalcShipping = $orderData['calcShipping'];
         //估算运费 $ordershipfee
         $orderExtenPayPalPaymentId = $orderExtenData['PayPalPaymentId'];
         //Paypal付款ID $ebay_ptid
         $orderExtenPayPalEmailAddress = $orderExtenData['PayPalEmailAddress'];
         //PayPal付款邮箱地址 $ebay_pp
         $isCopy = $orderData['isCopy'];
         //默认为0为原始订单,1为被复制订单,2为复制订单
         $isCopy = $isCopy == '0' ? '' : ($isCopy == '1' ? '被复制订单' : '复制订单');
         //$ebay_noteb				= $is_main_order==2 ? '复制 订单' : ($is_main_order==1 ? '被复制 订单' : '');
         $isBuji = $orderData['isBuji'];
         //是否补寄订单。默认0正常订单;1为被补寄的订单;2为补寄产生的新订单
         $isBuji = $isBuji == '0' ? '' : ($isBuji == '1' ? '被补寄订单' : '补寄产生新订单');
         //$isBuji					= isset ($sendreplacement[$isBuji]) ? $sendreplacement[$isBuji] : '';
         //$is_sendreplacement		= $isBuji;
         $isSplit = $orderData['isSplit'];
         //默认0正常订单;1为被拆分的订单;2为拆分产生的订单
         $isSplit = $isSplit == '0' ? '' : ($isSplit == '1' ? '被拆分订单' : '拆分产生新订单');
         //$ebay_splitorder
         $isCombinePackage = $orderData['combinePackage'];
         //是否合并包裹。合并包裹状态,0为正常订单;1为合并包裹主订单;2为合并包裹子订单
         $isCombinePackage = $isCombinePackage == '0' ? '' : ($isCombinePackage == '1' ? '合并包裹主订单' : '合并包裹子订单');
         $weighStaffId = isset($orderWhInfoData[0]['weighStaffId']) ? $orderWhInfoData[0]['weighStaffId'] : '';
         //扫描员ID//称重
         $weighStaff = $weighStaffId != '' ? $staffLists[$weighStaffId] : '';
         //扫描员
         $districtStaffId = isset($orderWhInfoData[0]['districtStaffId']) ? $orderWhInfoData[0]['districtStaffId'] : '';
         //分区人员ID
         $districtStaff = $districtStaffId != '' ? $staffLists[$districtStaffId] : '';
         //分区人员
         $OrderTransportId = $orderData['transportId'];
         //运输方式Id $transportId
         $carrierName = $carriers[$OrderTransportId];
         //运输方式名称 $ebay_carrier
         $address = $orderUserInfoStreet1 . "\n" . $orderUserInfoStreet2 . "\n" . $orderUserInfoCity . "\n" . $orderUserInfoState . "\n" . $orderUserInfoZip . "\n" . $orderUserInfoCountryName;
         //字段拼接成地址
         $orderWhInfoWeighTime = date('Y-m-d', $orderWhInfoData['weighTime']);
         //称重时间,亦可以当做发货时间 $scantime
         $OrderCalcWeight = $orderData['calcWeight'];
         //估算重量,单位是kg  $calculate_weight
         $orderWhInfoActualWeight = number_format($orderWhInfoData['actualWeight'] / 1000, 3);
         //实际重量 $orderweight2
         $totalweight = $orderWhInfoActualWeight;
         //总重量
         $mailway_c = $channels[$OrderChannelId];
         //根据运输管理系统的接口获取
         $isContainCombineSku = CommonModel::judge_contain_combinesku($orderId);
         //$ebay_combineorder 判断订单是否包含组合料号,返回true or false
         if (count($orderDetail) == 1) {
             //订单明细中只有一条记录时,订单中只有一种料号
             $orderDetailTotalData = array_pop($orderDetail);
             //取得orderDetail中的这条总记录数据,包括orderDetailData和orderDetailExtenData
             $orderDetailData = $orderDetailTotalData['orderDetailData'];
             //明细中的常用数据
             $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
             //明细中的扩展数据
             $orderDetailSku = $orderDetailData['sku'];
             //该明细下的$sku
             $orderDetailExtenItemId = $orderDetailExtenData['itemId'];
             //itemId $ebay_itemid
             $orderDetailAmount = intval($orderDetailData['amount']);
             //$amount 该明细下的sku对应的数量
             $orderDetailRecordnumber = $orderDetailData['recordNumber'];
             //该明细对应平台的recordnumber $recordnumber
             $orderDetailItemPrice = round($orderDetailData['itemPrice'], 2) * $orderDetailAmount;
             //itemPrice(平台对应的销售单价)*对应数量 $ebay_itemprice
             //	$ebay_shipfee			=	round_num(($OrderActualTotal - $orderDetailItemPrice), 2);
             $ebay_shipfee = CommonModel::calcshippingfee($totalweight, $orderUserInfoCountryName, $OrderActualTotal, $OrderTransportId);
             //round_num(($OrderActualTotal - $orderDetailItemPrice), 2); //订单总价-sku对应的总价得出运费,$ebay_shipfee
             $ebay_shipfee = isset($ebay_shipfee['fee']) ? $ebay_shipfee['fee']['fee'] : '';
             $skus = GoodsModel::get_realskuinfo($orderDetailSku);
             //获取该sku下对应的真实料号信息(包括料号转换及组合料号对应真实料号信息)
             $values_skus = array_values($skus);
             //得到sku的数量
             $goods_location = CommonModel::getPositionBySku($orderDetailSku);
             //仓位
             $goodsInfo = GoodsModel::getSkuinfo($orderDetailSku);
             //获取真实sku的详细信息,包括采购名称和可用库存
             $goodsWeight = $goodsInfo['goodsWeight'];
             //料号重量
             $goods_cost = isset($goodsInfo['goodsCost']) ? round($goodsInfo['goodsCost'], 2) : 0;
             //采购成本
             $pmId = isset($goodsInfo['pmId']) ? $goodsInfo['pmId'] : '';
             //包材Id
             $ebay_packingmaterial = $packings[$pmId]['pmName'];
             //包材名称
             $ebay_packingCost = $packings[$pmId]['pmCost'];
             //包材成本
             $purchaseId = isset($goodsInfo['purchaseId']) ? $goodsInfo['purchaseId'] : '';
             $cguser = $staffLists[$purchaseId];
             //采购名称
             $combineSku = GoodsModel::getCombineSkuinfo($orderDetailSku);
             //判断该sku是否是组合料号,如果是返回combineSku,sku,count关系记录数据,不是则返回false
             if ($combineSku !== false) {
                 //为组合订单
                 $goods_costs = 0;
                 $combine_weight_list = array();
                 $goods_costs_list = array();
                 foreach ($skus as $k => $v) {
                     $goodsInfo2 = GoodsModel::getSkuinfo($k);
                     $combine_weight_list[$k] = $orderDetailAmount * $v * $goodsInfo2['goodsWeight'];
                     //组合订单重量数组
                     $goods_costs_list[$k] = $orderDetailAmount * $v * $goodsInfo2['goodsCost'];
                     //货本数组
                     $goods_costs += $orderDetailAmount * $v * $goodsInfo2['goodsCost'];
                 }
                 $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, $goods_location, $orderDetailSku, $orderDetailAmount, $goodsWeight, $goods_cost, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, '');
                 $excel->addRow($row);
                 foreach ($skus as $k => $v) {
                     $goodsInfo3 = GoodsModel::getSkuinfo($k);
                     $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
                     $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0;
                     $goods_location2 = CommonModel::getPositionBySku($k);
                     //仓位
                     $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : '';
                     $ebay_packingmaterial = $packings[$pmId]['pmName'];
                     $ebay_packingCost = $packings[$pmId]['pmCost'];
                     $purchaseId = isset($goodsInfo3[0]['purchaseId']) ? $goodsInfo3[0]['purchaseId'] : '';
                     $cguser = $staffLists[$purchaseId];
                     $ishipfee = round_num($goods_costs_list[$k] / array_sum($goods_costs_list) * $ebay_shipfee, 2);
                     //根据货本比ebay运费
                     $iorderweight2 = round($combine_weight_list[$k] / array_sum($combine_weight_list) * $orderWhInfoActualWeight, 3);
                     $iordershipfee = round_num($combine_weight_list[$k] / array_sum($combine_weight_list) * $orderCalcShipping, 2);
                     $iprice = round_num(($goods_costs_list[$k] + $iordershipfee) / (array_sum($goods_costs_list) + $orderCalcShipping) * $ebay_itemprice, 2);
                     //根据货本比产品价格  last modified by herman.xi @20130916
                     $row = array('', '', '', '', $goods_location2, $k, $v, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
                     $excel->addRow($row);
                 }
             } else {
                 //非组合订单
                 $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, $goods_location, $orderDetailSku, $orderDetailAmount, $goodsWeight, $goods_cost, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, '');
                 $excel->addRow($row);
             }
             unset($combine_weight_list);
             unset($goods_costs_list);
         } else {
             //订单详细记录>1
             $cctotal = 0;
             $ebay_itemprice = 0;
             $goods_costs = 0;
             $goods_list = array();
             $goods_lists = array();
             $goods_weight_list = array();
             $goods_costs_list = array();
             $calculate_weight = 0;
             foreach ($orderDetail as $orderDetailTotalData) {
                 //$orderDetailTotalData ,包括orderDetailData和orderDetailExtenData
                 $orderDetailData = $orderDetailTotalData['orderDetailData'];
                 //明细中的常用数据
                 $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
                 //明细中的扩展数据
                 $detail_id = $orderDetailData['id'];
                 $sku = $orderDetailData['sku'];
                 $skus = GoodsModel::get_realskuinfo($sku);
                 $_ebay_itemprice = round($orderDetailData['itemPrice'], 2);
                 $ebay_itemprice += $orderDetailData['amount'] * $_ebay_itemprice;
                 foreach ($skus as $k => $v) {
                     $goodsInfo3 = GoodsModel::getSkuinfo($k);
                     $_ebay_amount = intval($orderDetailData['amount'] * $v);
                     $cctotal += $_ebay_amount;
                     $calculate_weight += $_ebay_amount * $goodsInfo3['goodsWeight'];
                     $goods_weight_list[$detail_id . $sku][$k] = $_ebay_amount * $goodsInfo3['goodsWeight'];
                     $goods_costs_list[$detail_id . $sku][$k] = round($goodsInfo3['goodsCost'], 2) * $_ebay_amount;
                     $goods_costs += round($goodsInfo3['goodsCost'], 2) * $_ebay_amount;
                 }
             }
             //echo "---------$ebay_itemprice--------";
             $ebay_shipfee = CommonModel::calcshippingfee($totalweight, $orderUserInfoCountryName, $OrderActualTotal, $OrderTransportId);
             $ebay_shipfee = isset($ebay_shipfee['fee']) ? $ebay_shipfee['fee']['fee'] : '';
             //	$ebay_shipfee = round_num(($OrderActualTotal - $ebay_itemprice), 2);
             $row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, '', '', $cctotal, '', $ebay_itemprice, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, '');
             $excel->addRow($row);
             foreach ($orderDetail as $orderDetailTotalData) {
                 //$orderDetailTotalData ,包括orderDetailData和orderDetailExtenData
                 $orderDetailData = $orderDetailTotalData['orderDetailData'];
                 //明细中的常用数据
                 $orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
                 //明细中的扩展数据
                 $detail_id = $orderDetailData['id'];
                 $skuDe = $orderDetailData['sku'];
                 $recordnumber = $orderDetailData['recordNumber'];
                 $orderDetailExtenItemId = $orderDetailExtenData['itemId'];
                 //itemId $ebay_itemid
                 //$ebay_itemid = $detail_array['ebay_itemid'];
                 $amount = intval($orderDetailData['amount']);
                 $dshipingfee = $orderDetailData['shippingFee'];
                 $debay_itemprice = round($orderDetailData['itemPrice'], 2);
                 $goods_location = CommonModel::getPositionBySku($skuDe);
                 $goodsInfo3 = GoodsModel::getSkuinfo($skuDe);
                 $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
                 $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : 0;
                 $ebay_packingmaterial = $packings[$pmId]['pmName'];
                 $ebay_packingCost = $packings[$pmId]['pmCost'];
                 $purchaseId = isset($goodsInfo3['purchaseId']) ? $goodsInfo3['purchaseId'] : '';
                 $cguser = $staffLists[$purchaseId];
                 $dordershipfee = round($orderCalcShipping * (array_sum($goods_weight_list[$detail_id . $skuDe]) / $calculate_weight), 2);
                 $dorderweight2 = round($orderWhInfoActualWeight * (array_sum($goods_weight_list[$detail_id . $skuDe]) / $calculate_weight), 3);
                 $combineSku = GoodsModel::getCombineSkuinfo($skuDe);
                 //$is_combineSku = count($combineSku);
                 if ($combineSku !== false) {
                     //为组合料号
                     $skus = GoodsModel::get_realskuinfo($skuDe);
                     foreach ($skus as $k => $v) {
                         $goods_location = CommonModel::getPositionBySku($k);
                         $goodsInfo3 = GoodsModel::getSkuinfo($k);
                         $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
                         $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0;
                         $pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : '';
                         $ebay_packingmaterial = $packings[$pmId]['pmName'];
                         $ebay_packingCost = $packings[$pmId]['pmCost'];
                         $purchaseId = isset($goodsInfo3['purchaseId']) ? $goodsInfo3['purchaseId'] : '';
                         $cguser = $staffLists[$purchaseId];
                         //$iprice = round_num(($goods_costs_list[$detail_id.$k][$k]/array_sum($goods_costs_list[$detail_id.$k])) * $debay_itemprice * $amount,2); //根据货本比产品价格
                         $ishipfee = round_num($goods_costs_list[$detail_id . $skuDe][$k] / array_sum($goods_costs_list[$detail_id . $skuDe]) * $dshipingfee, 2);
                         //根据货本比ebay运费
                         $iorderweight2 = round($goods_weight_list[$detail_id . $skuDe][$k] / array_sum($goods_weight_list[$detail_id . $skuDe]) * $dorderweight2, 3);
                         $iordershipfee = round_num($goods_weight_list[$detail_id . $skuDe][$k] / array_sum($goods_weight_list[$detail_id . $skuDe]) * $dordershipfee, 2);
                         $iprice = round_num(($goods_costs_list[$detail_id . $skuDe][$k] + $iordershipfee) / (array_sum($goods_costs_list[$detail_id . $skuDe]) + $dordershipfee) * $debay_itemprice * $amount, 2);
                         //根据货本比产品价格  last modified by herman.xi @20130916
                         $row = array('', '', '', '', $goods_location, $k, $v, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
                         $excel->addRow($row);
                     }
                 } else {
                     $goods_location = CommonModel::getPositionBySku($skuDe);
                     $goodsInfo3 = GoodsModel::getSkuinfo($skuDe);
                     $goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
                     $goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0;
                     $row = array('', '', '', '', $goods_location, $skuDe, $amount, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
                     $excel->addRow($row);
                 }
             }
             unset($goods_weight_list);
             unset($goods_costs_list);
         }
     }
     $excel->finalize();
     exit;
 }
示例#5
0
 public static function combineOrder($orderIdArr)
 {
     self::initDB();
     BaseModel::begin();
     //开始事务
     $serchSql = "SELECT * FROM om_unshipped_order WHERE id in ('" . join("','", $orderIdArr) . "') and is_delete = 0 and storeId = 1 ";
     $querySql = self::$dbConn->query($serchSql);
     $serchSqlArr = self::$dbConn->fetch_array_all($querySql);
     //判断一:订单数量统计
     if (count($serchSqlArr) < 2) {
         self::$errCode = "1111";
         self::$errMsg = "合并订单最少需要选择两个或两个以上的订单!";
         return false;
     }
     $platfrom = omAccountModel::getPlatformSuffixById($serchSqlArr[0]['platformId']);
     $extension = $platfrom['suffix'];
     //获取后缀名称
     $temporderStatus = "";
     //相同状态一
     $temporderStatus2 = "";
     //相同状态二
     $userinfo = array();
     //订单相同条件
     $orderSn = array();
     //订单编号
     $onlineTotal = 0;
     //线上总价
     $actualTotal = 0;
     //实际收款总价
     $calcWeight = 0;
     //估算重量,单位是kg
     $calcShipping = 0;
     //估算运费
     foreach ($serchSqlArr as $selectArr) {
         $orderSn[] = $selectArr['id'];
         $onlineTotal += $selectArr['onlineTotal'];
         $actualTotal += $selectArr['actualTotal'];
         $calcWeight += $selectArr['calcWeight'];
         $calcShipping += $selectArr['calcShipping'];
         //判断二:订单被其他人 <锁定> 订单判断
         if ($selectArr['isLock'] == 1) {
             self::$errCode = "2222";
             self::$errMsg = "订单[" . $selectArr['id'] . "]已经被 [" . UserModel::getUsernameById($selectArr['lockUser']) . "] 锁定,不能合并操作。";
             return false;
         }
         //判断三:已合并订单,无法再次合并判断
         if (in_array($selectArr['combineOrder'], array(1, 2))) {
             self::$errCode = "3333";
             self::$errMsg = "订单[" . $selectArr['id'] . "]已经有订单合并操作,不能重复订单合并。";
             return false;
         }
         //判断四:已合并包裹订单,无法合并判断
         if (in_array($selectArr['combinePackage'], array(1, 2))) {
             self::$errCode = "4444";
             self::$errMsg = "订单[" . $selectArr['id'] . "]是合并包裹订单,不能订单合并操作。";
             return false;
         }
         //判断五:订单信息不相同判断
         $userinfsql = "SELECT * FROM om_unshipped_order_userInfo WHERE omOrderId = {$selectArr['id']}";
         $userinfsql = self::$dbConn->fetch_first($userinfsql);
         $tempArr = array();
         $tempArr['accountId'] = trim($selectArr['accountId']);
         $tempArr['platformUsername'] = trim($userinfsql['platformUsername']);
         $tempArr['username'] = trim($userinfsql['username']);
         $tempArr['countryName'] = trim($userinfsql['countryName']);
         $tempArr['state'] = trim($userinfsql['state']);
         $tempArr['city'] = trim($userinfsql['city']);
         $tempArr['street'] = trim($userinfsql['street']);
         $tempArr['currency'] = trim($userinfsql['currency']);
         //币种判断
         if (!empty($userinfo) && $userinfo != $tempArr) {
             self::$errCode = "5555";
             self::$errMsg = "订单信息不相同,无法合并订单操作。";
             return false;
         }
         $userinfo = $tempArr;
         //订单信息相同,进入下次比较。
         //判断六:同状态判断
         $orderStatus = "";
         //订单状态一
         $orderType = "";
         //订单状态二
         $orderStatus = $selectArr['orderStatus'];
         $orderType = $selectArr['orderType'];
         if (!empty($temporderStatus) && $temporderStatus != $orderStatus) {
             self::$errCode = "6666";
             self::$errMsg = "订单不在同一文件夹,无法合并订单操作。";
             return false;
         }
         $temporderStatus = $orderStatus;
         if (!empty($temporderStatus2) && $temporderStatus2 != $orderType) {
             self::$errCode = "6666";
             self::$errMsg = "订单不在同一文件夹,无法合并订单操作。";
             return false;
         }
         $orderExtensql = "SELECT * FROM om_unshipped_order_extension_" . $extension . " WHERE omOrderId = {$selectArr['id']}";
         $orderExtensql = self::$dbConn->fetch_first($orderExtensql);
         $temporderStatus2 = $orderType;
     }
     $insertOrder = array();
     $insertOrder['orderData'] = $serchSqlArr[0];
     $insert_userinfo = $userinfsql;
     unset($insert_userinfo['omOrderId']);
     $insertOrder['orderUserInfoData'] = $insert_userinfo;
     $insert_orderExtensql = $orderExtensql;
     unset($insert_orderExtensql['omOrderId']);
     $insertOrder['orderExtenData'] = $insert_orderExtensql;
     //$insertOrder['orderNote'] = $userinfsql;
     unset($insertOrder['orderData']['id']);
     $insertOrder['orderData']['onlineTotal'] = $onlineTotal;
     $insertOrder['orderData']['actualTotal'] = $actualTotal;
     $insertOrder['orderData']['calcWeight'] = $calcWeight;
     $insertOrder['orderData']['calcShipping'] = $calcShipping;
     $insertOrder['orderData']['orderAddTime'] = time();
     $insertOrder['orderData']['combineOrder'] = 2;
     $insertOrder['orderData']['orderAttribute'] = 3;
     //$insertOrder['orderDetail'] = array();
     $detailSql = "SELECT * FROM om_unshipped_order_detail WHERE omOrderId in ('" . join("','", $orderIdArr) . "') and is_delete = 0 and storeId = 1 ";
     $detailSql = self::$dbConn->query($detailSql);
     $detailSqlArr = self::$dbConn->fetch_array_all($detailSql);
     $orderDetail = array();
     foreach ($detailSqlArr as $value) {
         //$orderDetailData = array();
         //$orderDetailExtenData = array();
         $obj_orderDetail = $value;
         unset($obj_orderDetail['id']);
         unset($obj_orderDetail['omOrderId']);
         $orderDetailData = $obj_orderDetail;
         $detailExtenSql = "SELECT * FROM om_unshipped_order_detail_extension_" . $extension . " WHERE omOrderdetailId = '" . $value['id'] . "' ";
         $detailExtenSql = self::$dbConn->query($detailExtenSql);
         $detailExtenSqlArr = self::$dbConn->fetch_array($detailExtenSql);
         $obj_orderDetailExten = $detailExtenSqlArr;
         unset($obj_orderDetailExten['omOrderdetailId']);
         $orderDetailExtenData = $obj_orderDetailExten;
         $orderDetail[] = array('orderDetailData' => $orderDetailData, 'orderDetailExtenData' => $orderDetailExtenData);
     }
     $insertOrder['orderDetail'] = $orderDetail;
     //var_dump($insertOrder); exit;
     if ($insertId = OrderAddModel::insertAllOrderRowNoEvent($insertOrder)) {
         //echo $split_log .= 'insert success!' . "\n"; exit;
         //var_dump($_mainId,$_spitId); exit;
         if (!OrderLogModel::insertOrderLog($insertId, '合并产生新订单')) {
             BaseModel::rollback();
             self::$errCode = '001';
             self::$errMsg = "合并失败!";
             return false;
         }
         if (!OrderRecordModel::insertCombineRecord($serchSqlArr[0]['id'], $insertId)) {
             BaseModel::rollback();
             self::$errCode = '002';
             self::$errMsg = "合并订单失败添加记录失败!";
             return false;
         }
         $updateOrder = array();
         $updateOrder['is_delete'] = 1;
         $updateOrder['combineOrder'] = 1;
         if (!OrderindexModel::updateOrder("om_unshipped_order", $updateOrder, " WHERE id in ('" . join("','", $orderSn) . "')")) {
             BaseModel::rollback();
             //事物回滚
             self::$errCode = "0012";
             self::$errMsg = "合并更新原始订单失败!";
             return false;
         }
     } else {
         //$split_log .= '补寄新订单产生失败!' . "\n";
         BaseModel::rollback();
         self::$errCode = '003';
         self::$errMsg = "合并新订单产生失败";
         return false;
     }
     BaseModel::commit();
     self::$errCode = '200';
     self::$errMsg = "合并新订单成功!";
     return TRUE;
 }
示例#6
0
 public static function getOrderInfo($tableName, $orderId, $storeId = 1)
 {
     self::initDB();
     $where = " WHERE id = {$orderId} and is_delete = 0 and storeId = " . $storeId;
     $orderList = OrderindexModel::showOrderList($tableName, $where);
     $orderData = $orderList[$orderId];
     $orderInfo = array();
     /*$table = " `om_unshipped_order` a , `om_unshipped_order_detail` b , `om_unshipped_order_extension_ebay` c,`om_unshipped_order_userInfo` d,`om_platform` e ";
       $field = " a.id,a.recordNumber,a.accountId,a.platformId,a.ordersTime,a.paymentTime,a.actualTotal,a.calcShipping,b.sku,b.amount,b.itemPrice,c.PayPalPaymentId,c.currency,d.platformUsername,e.id as platformId,e.platform ";
       $where = " WHERE a.id = '$id' AND a.id = b.omOrderId AND a.id = c.omOrderId AND a.id = d.omOrderId AND a.platformId = e.id ";*/
     if ($orderData) {
         $platformListById = omAccountModel::platformListById();
         $orderInfo['id'] = $orderId;
         $orderInfo['recordNumber'] = $orderData['orderData']['recordNumber'];
         $orderInfo['accountId'] = $orderData['orderData']['accountId'];
         $orderInfo['platformId'] = $orderData['orderData']['platformId'];
         $orderInfo['ordersTime'] = $orderData['orderData']['ordersTime'];
         $orderInfo['paymentTime'] = $orderData['orderData']['paymentTime'];
         $orderInfo['actualTotal'] = $orderData['orderData']['actualTotal'];
         $orderInfo['calcShipping'] = $orderData['orderData']['calcShipping'];
         $orderInfo['countryName'] = $orderData['orderUserInfoData']['countryName'];
         $orderInfo['PayPalPaymentId'] = $orderData['orderExtenData']['PayPalPaymentId'];
         $orderInfo['currency'] = $orderData['orderExtenData']['currency'];
         $orderInfo['platformUsername'] = $orderData['orderUserInfoData']['platformUsername'];
         $orderInfo['platform'] = $platformListById[$orderData['orderData']['platformId']];
         $orderInfo['detail'] = array();
         if ($orderData['orderDetail']) {
             foreach ($orderData['orderDetail'] as $detailData) {
                 //$detail = array();
                 $detail['sku'] = $detailData['orderDetailData']['sku'];
                 $detail['amount'] = $detailData['orderDetailData']['amount'];
                 $detail['itemPrice'] = $detailData['orderDetailData']['itemPrice'];
                 $orderInfo['detail'][] = $detail;
             }
         }
         //$accountId = $orderInfo['accountId'];
         if (!$orderInfo['accountId']) {
             self::$errCode = 04;
             self::$errMsg = '对应账号ID为空!';
             return FALSE;
         }
         if ($orderInfo['platformId'] == 1) {
             //$accountInfo = OrderRefundModel::getTNameList($table, $field, $where);
             $accountInfo = self::getAccountInfo($orderInfo['accountId']);
             if (!$accountInfo) {
                 self::$errCode = 05;
                 self::$errMsg = '没有对应PayPal账号信息!';
                 return FALSE;
             }
             $orderInfo['paypalAccount1'] = $accountInfo['account1'];
             $orderInfo['pass1'] = $accountInfo['pass1'];
             $orderInfo['signature1'] = $accountInfo['signature1'];
             $orderInfo['paypalAccount2'] = $accountInfo['account2'];
             $orderInfo['pass2'] = $accountInfo['pass2'];
             $orderInfo['signature2'] = $accountInfo['signature2'];
         }
     }
     self::$errCode = 200;
     self::$errMsg = '获取信息成功';
     return $orderInfo;
 }
示例#7
0
 function act_addInStatusIds()
 {
     //global $memc_obj; //调用memcache获取sku信息
     $outid = $_POST['outid'];
     $idArr = $_POST['idArr'];
     $uid = $_SESSION['sysUserId'];
     $data = array();
     $data['visible_movefolder'] = $this->act_getAllInStatusIds();
     //var_dump($data);
     $data['visible_movefolder'][$outid] = $idArr;
     $data['visible_movefolder'] = json_encode($data['visible_movefolder'], JSON_UNESCAPED_UNICODE);
     //var_dump($data);
     $rtn = OmAccountModel::addUserCompense($uid, $data);
     $visible_movefolder = omAccountModel::idTransferName($data['visible_movefolder']);
     //调用老系统接口,同步老系统文件夹
     $rtnInfo = OldsystemModel::erpSyncMovefolders($visible_movefolder, $_SESSION['userCnName']);
     if ($rtnInfo['res_code'] == 200) {
         self::$errCode = OmAccountModel::$errCode;
         self::$errMsg = OmAccountModel::$errMsg;
         return $rtn;
     } else {
         self::$errCode = $rtnInfo['res_code'];
         self::$errMsg = '同步老系统文件夹移动权限失败';
         return false;
     }
 }
示例#8
0
 /**
  * OrderPushModel::limitApplyPrintInfo($orderid)
  * 推送信息给仓库系统
  * @return  array
  */
 public static function limitApplyPrintInfo($orderid)
 {
     self::initDB();
     $storeId = 1;
     //基础信息
     $sql = "SELECT * FROM " . self::$table_order . " WHERE id = '{$orderid}' AND is_delete = 0 AND storeId = {$storeId} ";
     $query = self::$dbConn->query($sql);
     $orderData = self::$dbConn->fetch_array($query);
     if ($orderData['transportId'] == '') {
         //echo $sql;
         //var_dump($orderData);
         self::$errCode = "0021";
         self::$errMsg = "订单无运输方式不能申请打印!";
         return false;
     }
     $platfrom = omAccountModel::getPlatformSuffixById($orderData['platformId']);
     $extension = $platfrom['suffix'];
     //获取后缀名称
     $ids[] = $orderid;
     if ($orderData['combinePackage'] == 2) {
         self::$errCode = "1041";
         self::$errMsg = "此订单为合并包裹子订单,不能单独申请打印!";
         return false;
     } else {
         if ($orderData['combinePackage'] == 1) {
             //如果是合并包裹
             $sql = "SELECT split_order_id FROM " . self::$table_package . " WHERE main_order_id = '{$orderid}' AND is_enable = 1";
             $query = self::$dbConn->query($sql);
             $affectedrows = self::$dbConn->affected_rows();
             if ($affectedrows) {
                 $result = self::$dbConn->fetch_array_all($query);
                 for ($i = 0; $i < count($result); $i++) {
                     $ids[] = $result[$i]['split_order_id'];
                 }
             }
         }
     }
     /*$actualTotal = 0;
     		$actualShipping = 0;
     		$calcWeight = 0;
     		$calcShipping = 0;
     		if(count($ids) > 1){
     			foreach($ids as $vid){
     				$sql = "SELECT * FROM ".self::$table_order." WHERE id = '{$vid}' ";
     				$query	= self::$dbConn->query($sql);
     				$orderOneInfo = self::$dbConn->fetch_array($query);
     				$actualTotal += $orderOneInfo['actualTotal'];
     				$actualShipping += $orderOneInfo['actualShipping'];
     				$calcWeight += $orderOneInfo['calcWeight'];
     				$calcShipping += $orderOneInfo['calcShipping'];
     			}
     			$orderData['actualTotal'] = $actualTotal;
     			$orderData['actualShipping'] = $actualShipping;
     			$orderData['calcWeight'] = $calcWeight;
     			$orderData['calcShipping'] = $calcShipping;
     		}*/
     /*$sql = "SELECT * FROM ".self::$table_order_extension.$extension." WHERE omOrderId = '{$orderid}' ";
     		$query	= self::$dbConn->query($sql);
     		$orderExtenData = self::$dbConn->fetch_array($query);
     		
     		$sql = "SELECT * FROM ".self::$table_userinfo." WHERE omOrderId = '{$orderid}' ";
     		$query	= self::$dbConn->query($sql);
     		$orderUserInfoData = self::$dbConn->fetch_array($query);*/
     $sql = "SELECT * FROM " . self::$table_tracknumber . " WHERE omOrderId = '{$orderid}' AND is_delete = 0 ";
     $query = self::$dbConn->query($sql);
     $orderTrackInfoData = self::$dbConn->fetch_array($query);
     if ($orderData['transportId'] == 6 && empty($orderTrackInfoData)) {
         self::$errCode = "0021";
         self::$errMsg = "EUB订单号无跟踪号拒绝申请打印!";
         return false;
     }
     $sql = "SELECT * FROM " . self::$table_express_remark . " WHERE omOrderId = '{$orderid}' ";
     $query = self::$dbConn->query($sql);
     $orderExpressRemark = self::$dbConn->fetch_array($query);
     if (in_array($orderData['transportId'], array(5, 8, 9)) && empty($orderExpressRemark)) {
         self::$errCode = "0025";
         self::$errMsg = "EMS\\FEDEX\\DHL无快递描述不允许推送到仓库系统!";
         return false;
     }
     /*$sql = "SELECT * FROM ".self::$table_notes." WHERE omOrderId = '{$orderid}' AND is_delete = 0 ";
     		$query	= self::$dbConn->query($sql);
     		$orderNotesInfoData = self::$dbConn->fetch_array_all($query);
     		
     		$sql = "SELECT * FROM ".self::$table_detail." WHERE omOrderId IN (".join(',', $ids).") AND is_delete = 0 AND storeId = {$storeId} ";
     		$query	= self::$dbConn->query($sql);
     		$orderDetailData = self::$dbConn->fetch_array_all($query);
     		
     		$detailids = array();
     		foreach($orderDetailData as $dv){
     			$detailids[] = $dv['id'];	
     		}
     		if($detailids){
     			$sql = "SELECT * FROM ".self::$table_detail_extension.$extension." WHERE omOrderdetailId IN (".join(',', $detailids).") ";
     			$query	= self::$dbConn->query($sql);
     			$orderDetailExtenData = self::$dbConn->fetch_array_all($query);
     		}else{
     			$orderDetailExtenData = array();	
     		}
     		
     		$obj_order_detail_data = array();	 
     		foreach($orderDetailData as $detailValue){
     			$obj_order_detail_data[] = array('orderDetailData' => $detailValue,			
     											 'orderDetailExtenData' => $orderDetailExtenData);	
     		}
     		
     		$orderDataInfo = array('orderData' => $orderData,
     							   'orderExtenData' => $orderExtenData,
     							   'orderUserInfoData' => $orderUserInfoData,
     							   'orderDetail' => $obj_order_detail_data,
     							   'tracknumbers' => $orderTrackInfoData,
     							   'notes' => $orderNotesInfoData,
     							   'flag'  => $flag,//1发货单,0配货单
     							  );
     		$exchange='send_order_exchange';
     		if($rabbitMQClass->queue_publish($exchange,$orderDataInfo)){
     			$sql = "UPDATE ".self::$table_order." SET orderStatus = ".C("STATESHIPPED").", orderType = ".C("STATESHIPPED_PRINTPEND")." WHERE id IN (".join(',', $ids).") AND is_delete = 0 AND storeId = {$storeId} ";
     			if(!self::$dbConn->query($sql)){
     				self::$errCode = "0023";
     				self::$errMsg = "订单号申请打印之后,更新状态失败!";
     				return false;	
     			}
     			foreach($ids as $id){
     				MarkShippingModel::insert_mark_shipping($id);
     			}
     		}*/
     $where = " WHERE id = " . $orderid;
     $returnStatus0 = array('orderStatus' => C("STATESHIPPED"), 'orderType' => C('STATESHIPPED_APPLYPRINT'));
     if (OrderindexModel::updateOrder(self::$table_order, $returnStatus0, $where)) {
         self::$errCode = "200";
         self::$errMsg = "申请打印成功!";
         return true;
     } else {
         self::$errCode = "002";
         self::$errMsg = "申请打印失败!";
         return false;
     }
 }
示例#9
0
 function act_addDistributorOrder()
 {
     $orderArrJson = json_decode($_POST["orderArr"], true);
     $app_key = trim($_POST['app_key']);
     $account = $this->getOrderSystemAccount($app_key);
     $accountInfo = omAccountModel::getAccountInfoByName($account);
     $accountId = $accountInfo['id'];
     $orderAddAct = new OrderAddAct();
     $rtnArr = array();
     foreach ($orderArrJson as $val) {
         $itemRtn = array();
         $orderId = $val['orderId'];
         $check = $orderAddAct->checkDuplicateOrder($orderId, '16');
         if ($check) {
             $itemRtn["errcode"] = 80001;
             $itemRtn["orderId"] = $orderId;
             $itemRtn["msg"] = "系统已经存在[" . $orderId . "]这个订单";
             $rtnArr[] = $itemRtn;
             continue;
         }
         //return $rtnArr;
         $insertOrder = array();
         /***************BEGIN 订单表数据***************/
         //$unshipedOrder = array();
         $orderdata['recordNumber'] = $orderId;
         $orderdata['platformId'] = 16;
         //国内销售部
         $orderdata['accountId'] = $accountId;
         $orderdata['orderStatus'] = C('STATEPENDING');
         $orderdata['orderType'] = C('STATEPENDING');
         //daichu
         //$gmtCreate = time_shift($val['gmtCreate']);
         $orderdata['ordersTime'] = $val['gmtCreate'];
         $orderdata['paymentTime'] = "";
         //$pay_time[0];
         $orderdata['onlineTotal'] = "";
         //$order['initOderAmount']['amount'];  //线上总金额
         $orderdata['actualTotal'] = "";
         //$orderDetail2['payAmount']['amount'];//付款总金额
         $orderdata['calcShipping'] = $orderdata['orderAddTime'] = time();
         $orderdata['isFixed'] = 1;
         /***************END 订单表数据***************/
         /***************BEGIN 订单扩展表数据***************/
         $orderExtAli = array();
         //
         $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;
 }
示例#10
0
 public function act_updateDetail()
 {
     global $memc_obj;
     $start = time();
     //ob_start();//不加这个是不行的(貌似不加可以)
     $omAvailableAct = new OmAvailableAct();
     global $definedArr;
     require_once WEB_PATH . "conf/scripts/script.ebay.config.php";
     $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', ' WHERE is_delete=0 ');
     $FLIP_GLOBAL_EBAY_ACCOUNT = array_flip($GLOBAL_EBAY_ACCOUNT);
     $definedArr = get_defined_vars();
     /*$end = time();
     		echo $end-$start; echo "<br>";
     		$start = $end;*/
     //var_dump($_POST); exit;
     $orderid = $_POST['orderid'];
     $omOrderDetailId = $_POST['omOrderDetailId'];
     //$data = unset($_POST['omOrderDetailId']);
     $update_detail = array();
     $update_detail_extral = array();
     $update_detail['recordNumber'] = $_POST['recordNumber'];
     $update_detail['sku'] = $_POST['sku'];
     $update_detail_extral['itemTitle'] = $_POST['itemTitle'];
     $update_detail['itemPrice'] = $_POST['itemPrice'];
     $update_detail['shippingFee'] = $_POST['shippingFee'];
     $update_detail['amount'] = $_POST['amount'];
     $update_detail_extral['note'] = $_POST['note'];
     $platformId = $_POST['detail_platformId'];
     $platfrom = omAccountModel::getPlatformSuffixById($platformId);
     $extension = $platfrom['suffix'];
     //获取后缀名称
     $detailArr = explode(',', $omData);
     //缺少事件
     BaseModel::begin();
     //开始事务
     $tableName = "om_unshipped_order_detail";
     $where = " WHERE id = " . $omOrderDetailId;
     if ($update_detail) {
         $rtn = OrderindexModel::updateOrder($tableName, $update_detail, $where);
         if ($rtn) {
             /*$tableName = "om_unshipped_order";
             				$where = " WHERE id = ".$orderid;
             				
             				$updateOrder = array();
             				$orderData = OrderindexModel::showOrderList($tableName, $where);
             				$orderData = $orderData[$orderid];
             				//var_dump($orderData);
             				$orderDetail = $orderData['orderDetail'];
             				$calcInfo = CommonModel :: calcAddOrderWeight($orderDetail);//计算重量和包材
             				//var_dump($calcInfo); exit;
             				$updateOrder['calcWeight'] = $calcInfo[0];
             				$updateOrder['pmId'] = $calcInfo[1];
             				if(count($orderDetail) > 1){
             					$updateOrder['orderAttribute'] = 3;
             				}else if(isset($orderDetail[0]['orderDetailData']['amount']) && $orderDetail[0]['orderDetailData']['amount'] > 1){
             					$updateOrder['orderAttribute'] = 2;
             				}
             				$calcShippingInfo = CommonModel :: calcAddOrderShippingFee($orderData,1);//计算运费
             
             				//var_dump($calcShippingInfo); exit;
             				//$insert_orderData['orderData']['calcShipping'] = $calcShippingInfo['fee']['fee'];
             				$updateOrder['channelId'] = $calcShippingInfo['fee']['channelId'];
             				
             				$interceptInfo = CommonModel :: auto_contrast_intercept($orderData);
             				//print_r($interceptInfo); exit;
             
             				$updateOrder['orderStatus'] = $interceptInfo['orderStatus'];
             				$updateOrder['orderType'] = $interceptInfo['orderType'];
             				
             				$rtn2 = OrderindexModel::updateOrder($tableName, $updateOrder, $where);
             				if(!$rtn2){
             					BaseModel :: rollback();
             				}*/
         } else {
             BaseModel::rollback();
         }
     }
     //ob_end_clean();
     if ($update_detail_extral) {
         $tableName = "om_unshipped_order_detail_extension_" . $extension;
         $where = " WHERE omOrderdetailId = " . $omOrderDetailId;
         $rtn = OrderindexModel::updateOrder($tableName, $update_detail_extral, $where);
         if (!$rtn) {
             BaseModel::rollback();
         }
     }
     BaseModel::commit();
     BaseModel::autoCommit();
     self::$errCode = OrderindexModel::$errCode;
     self::$errMsg = OrderindexModel::$errMsg;
     return $rtn;
 }
示例#11
0
 public static function deleteUserCompense($omOrderId)
 {
     !self::$dbConn ? self::initDB() : null;
     $sql = "DELETE FROM " . self::$UserCompenseTable . " WHERE global_user_id = " . $omOrderId;
     //echo $sql;
     if (!self::$dbConn->query($sql)) {
         self::$errCode = "002";
         self::$errMsg = " 插入数据失败! ";
         return false;
         //失败则设置错误码和错误信息, 返回false
     } else {
         self::$errCode = "200";
         self::$errMsg = " 插入数据成功! ";
         return true;
         //失败则设置错误码和错误信息, 返回true
     }
 }
示例#12
0
 public function act_showOrderListAPI()
 {
     $id = $_GET['id'] ? $_GET['id'] : '';
     if (!$id) {
         self::$errCode = '5806';
         self::$errMsg = 'id is error';
         return array();
     }
     //$orderinfo = $this->act_showOrder('', '', ' limit 1 ', array('id'=>$id));
     $where = "where `id` ={$id}";
     $orderinfo = omAvailableModel::getTNameList("`om_unshipped_order`", "*", $where);
     if ($orderinfo) {
         $platfrom = omAccountModel::getPlatformSuffixById($orderinfo[0]['platformId']);
         $extension = $platfrom['suffix'];
         //获取后缀名称
         $where = "where omOrderId={$id}";
         $msg = omAvailableModel::getTNameList("`om_unshipped_order_detail`", "*", $where);
         $detailId = $msg[0]['id'];
         $info = omAvailableModel::getTNameList("om_unshipped_order_detail_extension_" . $extension, "*", "where omOrderdetailId={$detailId}");
         if ($info) {
             self::$errCode = '200';
             self::$errMsg = 'success';
             return $info;
         }
     } else {
         $orderinfo = omAvailableModel::getTNameList("`om_shipped_order`", "*", $where);
         $platfrom = omAccountModel::getPlatformSuffixById($orderinfo[0]['platformId']);
         $extension = $platfrom['suffix'];
         //获取后缀名称
         $where = "where omOrderId={$id}";
         $msg = omAvailableModel::getTNameList("`om_shipped_order_detail`", "*", $where);
         $detailId = $msg[0]['id'];
         $info = omAvailableModel::getTNameList("om_shipped_order_detail_extension_" . $extension, "*", "where omOrderdetailId={$detailId}");
         if ($info) {
             self::$errCode = '200';
             self::$errMsg = 'success';
             return $info;
         }
     }
 }
示例#13
0
 public static function killAllOrderRowNoEvent($omOrderId, $platformId, $tableName = 'om_unshipped_order')
 {
     !self::$dbConn ? self::initDB() : null;
     /*$where = ' WHERE id = {$omOrderId} AND storeId = 1 AND is_delete = 0 ';
     		$sql = "SELECT * FROM $tableName $where";
             //echo $sql.'<br>';
     		
     		$query = self :: $dbConn->query($sql);
     		$orderList = self :: $dbConn->fetch_array($query);
     		$orderData = $orderList[$omOrderId];
     		$omOrderId = $orderData['id'];
     		//echo $omOrderId; echo "<br>";
     		$orderList[$omOrderId]['orderData'] = $orderData;*/
     if (!self::killOrder($omOrderId)) {
         self::$errCode = "010";
         self::$errMsg = "删除订单表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     $platfrom = omAccountModel::getPlatformSuffixById($platformId);
     $extension = $platfrom['suffix'];
     //获取后缀名称
     if (!self::killOrderExtenData($tableName, 'WHERE omOrderId = ' . $omOrderId, $extension)) {
         self::$errCode = "011";
         self::$errMsg = "删除订单附带表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     //var_dump($orderExtenData);
     if (!self::killOrderUserInfoData($tableName, 'WHERE omOrderId = ' . $omOrderId, $extension)) {
         self::$errCode = "012";
         self::$errMsg = "删除订单用户信息表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     if (!self::killOrderWhInfoData($tableName, 'WHERE omOrderId = ' . $omOrderId, $extension)) {
         self::$errCode = "013";
         self::$errMsg = "删除订单仓库信息表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     if (!self::killOrderDetailList($tableName, 'WHERE omOrderId = ' . $omOrderId, $extension)) {
         self::$errCode = "014";
         self::$errMsg = "删除订单明细表失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
     /*if(!self::killOrderDetailList($tableName, 'WHERE omOrderId = '.$omOrderId, $extension)){
     			self :: $errCode = "015";
     			self :: $errMsg = "删除订单明细表失败";
     			return false; //失败则设置错误码和错误信息, 返回false	
     		}*/
     return true;
 }
示例#14
0
 /**
  * 转移订单对应下的总表信息,没有批量处理事件
  * @para $data as array
  * @add by Herman.Xi
  * @last modified 20131022
  * $in 默认为进入订单模式
  */
 public static function shiftAllOrderRowNoEvent($orderData, $tName = 'om_shipped_order')
 {
     self::initDB();
     //var_dump($orderData); exit;
     $obj_order_data = $orderData['orderData'];
     $orderExtenData = $orderData['orderExtenData'];
     $orderUserInfoData = $orderData['orderUserInfoData'];
     $orderDetailArr = $orderData['orderDetail'];
     $orderWhInfoData = $orderData['orderWhInfoData'];
     //var_dump($obj_order_data); exit;
     //$tName = 'om_unshipped_order';
     $where = "WHERE recordNumber='{$obj_order_data['recordNumber']}' AND platformId={$obj_order_data['platformId']}";
     $flagCountUnshipped = OmAvailableModel::getTNameCount($tName, $where);
     //var_dump($flagCountUnshipped); exit;
     /*$tName = 'om_shipped_order';
     		$flagCountshipped = OmAvailableModel :: getTNameCount($tName, $where);*/
     if ($obj_order_data) {
         //判断订单是否已经在系统2个订单表(未发货和已发货)中存在
         $platfrom = omAccountModel::getPlatformSuffixById($obj_order_data['platformId']);
         $extension = $platfrom['suffix'];
         //获取后缀名称
         //echo $extension; echo "<br>"; exit;
         $insertOrderDataRow = self::insertOrderRow($obj_order_data, $tName);
         //插入到order表
         if (empty($insertOrderDataRow)) {
             self::$errCode = "020";
             self::$errMsg = "插入订单失败!";
             return false;
         }
         //$orderExtenData['omOrderId'] = $obj_order_data['id'];
         //$orderExtenData['omOrderId'] = $insertOrderDataRow;
         //$orderUserInfoData['omOrderId'] = $insertOrderDataRow;
         //$orderUserInfoData['omOrderId'] = $obj_order_data['id'];
         if ($orderExtenData) {
             $resultExten = self::insertExtension($orderExtenData, $extension, $tName);
             //插入到order_extend表
             if (!$resultExten) {
                 self::$errCode = "021";
                 self::$errMsg = "插入订单附加表失败!";
                 return false;
             }
         }
         if ($orderUserInfoData) {
             $resultUserInfo = self::insertUserinfoRow($orderUserInfoData, $tName);
             //插入到order_userInfo表
             if (!$resultUserInfo) {
                 self::$errCode = "022";
                 self::$errMsg = "插入用户信息表失败!";
                 return false;
             }
         }
         if ($orderWhInfoData) {
             $resultWhInfo = self::insertWhInfoRow($orderWhInfoData, $tName);
             //插入到order_userInfo表
             if (!$resultWhInfo) {
                 self::$errCode = "022";
                 self::$errMsg = "插入仓库信息表失败!";
                 return false;
             }
         }
         foreach ($orderDetailArr as $orderDetail) {
             $orderDetailData = $orderDetail['orderDetailData'];
             $orderDetailExtenData = $orderDetail['orderDetailExtenData'];
             //$orderDetailData['omOrderId'] = $insertOrderDataRow;
             //$orderDetailData['omOrderId'] = $obj_order_data['id'];
             $orderDetailData['createdTime'] = time();
             $insertOrderDatilRow = self::insertOrderdetail($orderDetailData, $tName);
             //插入到detail表
             if (empty($insertOrderDatilRow)) {
                 self::$errCode = "023";
                 self::$errMsg = "插入订明细单失败!";
                 return false;
             }
             //$orderDetailExtenData['omOrderdetailId'] = $insertOrderDatilRow;
             //$orderDetailExtenData['omOrderdetailId'] = $orderDetailData['id'];
             if ($orderDetailExtenData) {
                 $resultOrderDetailExten = self::insertDetailExtension($orderDetailExtenData, $extension, $tName);
                 //插入到detailExtend
                 if (!$resultOrderDetailExten) {
                     self::$errCode = "024";
                     self::$errMsg = "插入订单明细附带表失败!";
                     return false;
                 }
             }
         }
         /*if($obj_order_data['platformId'] == 1 && $in){
         			$insertOrderidsDada = array('omOrderId'=>$insertOrderDataRow,'PayPalPaymentId'=>$orderData['orderExtenData']['PayPalPaymentId'],'orderid'=>$orderData['orderExtenData']['orderId'],'accountId'=>$orderData['orderData']['accountId'],'saletime'=>time());
         			$insertOrderids = OrderidsModel::insertOrderidsList($insertOrderidsDada);
         			if (!$insertOrderids) {
         				self::$errCode	=	"025";
         				self::$errMsg	=	"插入ebay订单IDS失败!";
         				return false;
         			}
         		}
         		if(isset($orderData['orderNote']) && !empty($orderData['orderNote'])){
         			$orderNote = $orderData['orderNote'];
         			$insertOrderNoteDada = array('omOrderId'=>$insertOrderDataRow,'content'=>$orderNote['content'],'userId'=>$orderNote['userId'],'createdTime'=>$orderNote['createdTime']);
         			$insertOrderNoteids = self::insertOrderNotesRow($insertOrderNoteDada);
         			if (!$insertOrderNoteids) {
         				self::$errCode	=	"026";
         				self::$errMsg	=	"插入订单Note失败!";
         				return false;
         			}
         		}*/
         /*$buyerInfo = $orderUserInfoData;
         		$buyerInfo['platformId'] = $obj_order_data['platformId'];
         		unset($buyerInfo['omOrderId']);
         		unset($buyerInfo['countrySn']);
         		unset($buyerInfo['currency']);
         		unset($buyerInfo['currency']);
         		//var_dump($buyerInfo);
         		$insertBuyerInfo = self::insertBuyerInfoRow($buyerInfo);
         		//var_dump($insertBuyerInfo);
         		if (!$insertBuyerInfo) {
         			return false;
         		}
         		$ProductStatus = new ProductStatus();			
         		if(!$ProductStatus->updateSkuStatusByOrderStatus(array($insertOrderDataRow))){
         			self::$errCode	=	"400";
         			self::$errMsg	=	"已经包含订单信息,不能重复插入!";
         			return false;
         		}*/
         //var_dump($insertOrderDataRow); exit;
         //return $insertOrderDataRow;
         self::$errCode = "200";
         self::$errMsg = "转移成功!";
         return true;
     } else {
         self::$errCode = "400";
         self::$errMsg = "已经包含订单信息,不能重复插入!";
         return false;
     }
 }