当前位置: 首页>>代码示例>>PHP>>正文


PHP CommonModel::calcNowOrderWeight方法代码示例

本文整理汇总了PHP中CommonModel::calcNowOrderWeight方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonModel::calcNowOrderWeight方法的具体用法?PHP CommonModel::calcNowOrderWeight怎么用?PHP CommonModel::calcNowOrderWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommonModel的用法示例。


在下文中一共展示了CommonModel::calcNowOrderWeight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: overWeightSplitB2B

 public static function overWeightSplitB2B($omOrderId)
 {
     !self::$dbConn ? self::initDB() : null;
     global $memc_obj;
     //调用memcache获取sku信息
     $mctime = time();
     //var_dump($moOrderIdArr);
     $tableName = 'om_unshipped_order';
     $where = ' WHERE id = ' . $omOrderId . ' and is_delete = 0 and storeId = 1';
     $orderData = OrderindexModel::showOrderList($tableName, $where);
     $orderDetail = $orderData[$omOrderId]['orderDetail'];
     $obj_order_data = $orderData[$omOrderId]['orderData'];
     $orderExtenData = $orderData[$omOrderId]['orderExtenData'];
     $orderUserInfoData = $orderData[$omOrderId]['orderUserInfoData'];
     $_actualTotal = $obj_order_data['actualTotal'];
     $_actualShipping = $obj_order_data['actualShipping'];
     $_platformId = $obj_order_data['platformId'];
     $_mainId = $obj_order_data['id'];
     $_transportId = $obj_order_data['transportId'];
     //var_dump($orderDetail); exit;
     $omAvailableAct = new OmAvailableAct();
     $GLOBAL_EBAY_ACCOUNT = $omAvailableAct->act_getTNameList2arrById('om_account', 'id', 'account', ' WHERE is_delete=0 AND platformId in(1,5) ');
     $weightlists = array();
     $skuinfo = array();
     $goods_sn_nums = 0;
     $shippfee_arr = array();
     $ebay_total_be = 0;
     foreach ($orderDetail as $k => $f) {
         $sku = trim($f['orderDetailData']['sku']);
         $amount = $f['orderDetailData']['amount'];
         $shippingFee = $f['orderDetailData']['shippingFee'];
         $goods_sn_nums += $amount;
         $ebay_total_be += $f['orderDetailData']['amount'] * $f['orderDetailData']['itemPrice'];
         $shippfee_arr[$sku] = round($shippingFee / $amount, 3);
         //单个料号的运费
         $skuinfo[$sku] = $f;
         for ($i = 1; $i <= $amount; $i++) {
             $var = $sku;
             $oneskuweight = CommonModel::calcOnlySkuWeight($var, 1);
             //一个sku的重量
             $weightlists[$var][] = $oneskuweight[0];
         }
     }
     $rate = $_actualTotal / $ebay_total_be;
     //var_dump($weightlists); exit;
     if ($goods_sn_nums <= 1) {
         self::$errCode = '0020';
         self::$errMsg = "只有一个料号组成,不允许超重拆分";
         return false;
     }
     //echo "==========="; exit;
     $keyarray = array();
     $keyarrays = array();
     $checkweight = 0;
     $arrinfo = CommonModel::calcNowOrderWeight($omOrderId);
     //var_dump($arrinfo); exit;
     $realweight = $arrinfo[0];
     $realcosts = $arrinfo[2];
     $itemprices = $arrinfo[3];
     foreach ($weightlists as $wk => $wv) {
         foreach ($wv as $weightlist) {
             $checkweight += $weightlist;
             if ($checkweight > 1.85) {
                 $keyarrays[] = $keyarray;
                 $keyarray = array();
                 $checkweight = $weightlist;
                 $keyarray[$wk][] = $wk;
             } else {
                 $keyarray[$wk][] = $wk;
             }
         }
     }
     if (!empty($keyarray)) {
         $keyarrays[] = $keyarray;
     }
     //var_dump($keyarrays); exit;
     BaseModel::begin();
     //开始事务
     $insert_orderData = array();
     foreach ($keyarrays as $keyarray) {
         $ebay_total = 0;
         $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']);
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:splitOrder.model.php

示例2: combinePackage

 public static function combinePackage($tableName, $plateform_arr, $carrierIds, $id_array, $storeId = 1)
 {
     self::initDB();
     $list = self::selectList($tableName, $plateform_arr, $carrierIds, $id_array);
     //var_dump($list); exit;
     if (!$list) {
         self::$errCode = 301;
         self::$errMsg = "没有需要合并的订单!";
         return false;
     }
     /*foreach($list as $key=>$value){
     			$key = $value['id'];
     		}
     		var_dump($key); exit;*/
     BaseModel::begin();
     $combineNum = 0;
     foreach ($list as $key => $value) {
         $where = "b.userName = '{$value['userName']}' \n\t\t\t\t\tAND b.countryName = '{$value['countryName']}' \n\t\t\t\t\tAND a.accountId = {$value['accountId']} \n\t\t\t\t\tAND a.transportId = {$value['transportId']} \n\t\t\t\t\tAND b.state='{$value['state']}' \n\t\t\t\t\tAND b.city='{$value['city']}' \n\t\t\t\t\tAND b.street='{$value['street']}' \n\t\t\t\t\tAND a.orderType={$value['orderType']}\n\t\t\t\t\tAND a.calcWeight<=2 \n\t\t\t\t\tAND a.isLock=0 \n\t\t\t\t\tAND a.is_delete=0 \n\t\t\t\t\tAND a.combinePackage=0 \n\t\t\t\t\tAND a.orderStatus={$value['orderStatus']}\n\t\t\t\t\tAND a.orderType={$value['orderType']}\n\t\t\t\t\tAND is_delete = 0 AND storeId = " . $storeId;
         $records = combinePackageModel::selectRecord($tableName, $where, $id_array);
         //var_dump($records); exit;
         if (!$records) {
             continue;
         } else {
             $weightlists = array();
             $orderinfo = array();
             $countryName = $records[0]['countryName'];
             $transportId = $records[0]['transportId'];
             foreach ($records as $record) {
                 $omOrderId = $record['id'];
                 $omOrderId = $record['id'];
                 $orderinfo[$record['id']] = $record;
                 $arrinfo = CommonModel::calcNowOrderWeight($omOrderId);
                 //var_dump($arrinfo); exit;
                 $realweight = $arrinfo[0];
                 $realcosts = $arrinfo[2];
                 $itemprices = $arrinfo[3];
                 $weightlists[$omOrderId] = $realweight;
             }
             //var_dump($weightlists); exit;
             $keyarray = array();
             $keyarrays = array();
             $checkweight = 0;
             foreach ($weightlists as $wk => $weightlist) {
                 $checkweight += $weightlist;
                 if ($checkweight > 1.85) {
                     $keyarrays[] = $keyarray;
                     $keyarray = array();
                     $checkweight = $weightlist;
                     $keyarray[] = $wk;
                 } else {
                     $keyarray[] = $wk;
                 }
             }
             if (!empty($keyarray)) {
                 $keyarrays[] = $keyarray;
             }
             //var_dump($keyarrays); echo "<br>";
             foreach ($keyarrays as $orderlist) {
                 if (count($orderlist) < 2) {
                     continue;
                 }
                 $ordervalueweight = array();
                 $ordervalueactualTotal = array();
                 foreach ($orderlist as $orderid) {
                     $ordervalueweight[$orderid] = $weightlists[$orderid];
                     $ordervalueactualTotal[$orderid] = $orderinfo[$orderid]['actualTotal'];
                 }
                 //var_dump($ordervalueactualTotal); exit;
                 //var_dump($ordervalueweight); exit;
                 $firstorder = array_shift($orderlist);
                 //第一个订单编号信息
                 //var_dump($firstorder);
                 $combineInfo = CommonModel::calcshippingfee(array_sum($ordervalueweight), $countryName, array_sum($ordervalueactualTotal), $transportId);
                 //邮寄方式计算
                 //var_dump($combineInfo); exit;
                 $weight2fee = calceveryweight($ordervalueweight, $combineInfo['fee']['fee']);
                 //var_dump($weight2fee); exit;
                 $firstweightfee = array_shift($weight2fee);
                 //第一个订单重量运费信息
                 $data = array();
                 $data['combinePackage'] = 1;
                 $data['orderStatus'] = C('STATEPENDING');
                 $data['orderType'] = C('STATEPENDING_CONPACK');
                 $where = ' WHERE id = ' . $firstorder;
                 if (!OrderindexModel::updateOrder($tableName, $data, $where)) {
                     self::$errCode = 303;
                     self::$errMsg = "更新主订单失败!";
                     BaseModel::rollback();
                     return false;
                 }
                 foreach ($orderlist as $sonorder) {
                     $data['combinePackage'] = 2;
                     $data['orderStatus'] = C('STATEPENDING');
                     $data['orderType'] = C('STATEPENDING_CONPACK');
                     $where = ' WHERE id = ' . $sonorder;
                     if (!OrderindexModel::updateOrder($tableName, $data, $where)) {
                         self::$errCode = 304;
                         self::$errMsg = "更新子订单失败!";
                         BaseModel::rollback();
                         return false;
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:combinePackage.model.php

示例3: 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)) {
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:abnormalStock.action.php


注:本文中的CommonModel::calcNowOrderWeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。