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


PHP BaseModel::rollback方法代码示例

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


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

示例1: 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

示例2: act_addRefundInfo


//.........这里部分代码省略.........
         self::$errMsg = '参数Id为空!';
         return false;
     }
     if ($orderType == 1) {
         //$ppRtnInfo = $this->act_curlRefund($refundInfo);
         $httpParsedResponseAr = $this->act_curlRefund($refundInfo);
         //var_dump($httpParsedResponseAr);exit;
         if ("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
             $dataArr = $refundInfo;
             $operator = $_SESSION["userCnName"];
             $time = time();
             $sql = "insert into ebay_refund_log (order_id,trade_id,ebay_account,buyer_id,refund_reson,refund_type,operator,refund_time,paypal_account,money,currency,country) values ('{$dataArr['id']}','{$dataArr['PayPalPaymentId']}','{$dataArr['accountId']}','{$dataArr['platformUsername']}','{$dataArr['reason']}','{$dataArr['refundType']}','{$operator}','{$time}','{$dataArr['paypalAccount']}','{$dataArr['refundSum']}','{$dataArr['currency']}','{$dataArr['countryName']}')";
             //echo $sql."\n";
             $dbcon->execute($sql);
             //记录操作信息
             $sql = "insert into ebay_refund_log_detail (order_id,sku,amount) values ";
             //记录退款单个sku 信息
             $skuArr = $dataArr['skuArr'];
             foreach ($skuArr as $key => $sku) {
                 $sql .= "('{$dataArr['id']}','{$sku['sku']}','{$sku['amount']}')";
                 if ($key < count($skuArr) - 1) {
                     $sql .= ",";
                 }
             }
             if ($dbcon->execute($sql)) {
                 $rtnMsg = "订单编号: " . $dataArr['id'] . "退款成功";
             } else {
                 $rtnMsg = $sql;
             }
             $sql = " UPDATE `om_unshipped_order` SET orderStatus=2000 , orderType=1004 WHERE id={$dataArr['id']}";
             $dbConn->execute($sql);
             $sql = " UPDATE `om_shipped_order` SET orderStatus=660 , orderType=710 WHERE id={$dataArr['id']}";
             $dbConn->execute($sql);
             self::$errCode = 200;
         } else {
             self::$errCode = 404;
             $rtnMsg = "订单编号: " . $dataArr['id'] . "退款失败" . urldecode($httpParsedResponseAr['L_LONGMESSAGE0']) . '错误代码:' . $httpParsedResponseAr['L_ERRORCODE0'];
             self::$errMsg = $rtnMsg;
             return false;
         }
     }
     //$orderObj = new OrderRefundModel();
     BaseModel::begin();
     $sysUserId = $_SESSION['sysUserId'];
     $time = time();
     $data = array();
     $data['omOrderId'] = $refundInfo['id'];
     $data['recordNumber'] = $refundInfo['recordNumber'];
     $data['sellerAccountId'] = $refundInfo['accountId'];
     $data['totalSum'] = $refundInfo['totalSum'];
     $data['refundSum'] = $refundInfo['refundSum'];
     $data['refundType'] = $refundInfo['refundType'] == 'Full' ? 1 : 0;
     $data['platformUsername'] = $refundInfo['platformUsername'];
     $data['platformId'] = $refundInfo['platformId'];
     $data['platform'] = $refundInfo['platform'];
     $data['transId'] = $refundInfo['PayPalPaymentId'];
     $data['paypalAccount'] = $refundInfo['paypalAccount'];
     $data['pass'] = $refundInfo['pass'];
     $data['signature'] = $refundInfo['signature'];
     $data['reason'] = $refundInfo['reason'];
     $data['note'] = $refundInfo['note'];
     $data['currency'] = $refundInfo['currency'];
     $data['orderType'] = $orderType;
     $data['addTime'] = $time;
     $data['creatorId'] = $sysUserId;
     $tableRefund = 'om_order_refund';
     $setField = array2sql($data);
     $insertId = OrderRefundModel::addTNameRow($tableRefund, $setField);
     if ($insertId !== FALSE) {
         foreach ($refundInfo['skuArr'] as $key => $orderInfo) {
             $refundDetail = array();
             $refundDetail['orderRefundId'] = $insertId;
             $refundDetail['sku'] = $orderInfo['sku'];
             $refundDetail['amount'] = $orderInfo['amount'];
             $refundDetail['actualPrice'] = $orderInfo['actualPrice'];
             $refundDetail['addTime'] = $time;
             $tableRefundDetail = 'om_order_refund_detail';
             $setFields = array2sql($refundDetail);
             $ret2 = OrderRefundModel::addTNameRow($tableRefundDetail, $setFields);
             if ($ret2 !== FALSE) {
                 //
             } else {
                 self::$errCode = OrderRefundModel::$errCode;
                 self::$errMsg = OrderRefundModel::$errMsg;
                 BaseModel::rollback();
                 return false;
             }
         }
     } else {
         self::$errCode = OrderRefundModel::$errCode;
         self::$errMsg = OrderRefundModel::$errMsg;
         BaseModel::rollback();
         return false;
     }
     //echo '88888888888888888';
     BaseModel::commit();
     //self::$errMsg   = '生成单据成功!';
     self::$errMsg = $rtnMsg;
     return true;
 }
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:orderRefund.action.php

示例3: view_modifyOrderList


//.........这里部分代码省略.........
                         $update_userinfo['state'] = $_POST['edit_state'];
                     }
                     if ($_POST['countryName'] != $_POST['edit_countryName']) {
                         $update_userinfo['countryName'] = $_POST['edit_countryName'];
                     }
                     if ($_POST['zipCode'] != $_POST['edit_zipCode']) {
                         $update_userinfo['zipCode'] = $_POST['edit_zipCode'];
                     }
                     if ($_POST['landline'] != $_POST['edit_landline']) {
                         $update_userinfo['landline'] = $_POST['edit_landline'];
                     }
                     if ($_POST['phone'] != $_POST['edit_phone']) {
                         $update_userinfo['phone'] = $_POST['edit_phone'];
                     }
                     if ($_POST['transportId'] != $_POST['edit_transportId']) {
                         $update_order['transportId'] = $_POST['edit_transportId'];
                     }
                     if ($_POST['edit_tracknumber']) {
                         $update_tracknumber['omOrderId'] = $orderid;
                         $update_tracknumber['tracknumber'] = $_POST['edit_tracknumber'];
                         $update_tracknumber['addUser'] = $sysUserId;
                         $update_tracknumber['createdTime'] = time();
                         //var_dump($update_tracknumber); exit;
                     }
                     BaseModel::begin();
                     //开始事务
                     if ($update_order) {
                         //$sql = "UPDATE om_unshipped_order set ".array2sql($update_order)." WHERE id = ".$orderid;
                         //$msg = OrderLogModel::orderLog($orderid,$update_order['orderStatus'],$update_order['orderType'],$sql);
                         if (OrderindexModel::updateOrder('om_unshipped_order', $update_order, ' WHERE id = ' . $orderid)) {
                             if ($updatestatus) {
                                 $ProductStatus = new ProductStatus();
                                 if (!$ProductStatus->updateSkuStatusByOrderStatus(array($orderid), $batch_ostatus_val, $batch_otype_val)) {
                                     BaseModel::rollback();
                                 }
                             }
                             $modify_showerrorinfo = "<font color='green'>更新成功</font>";
                         } else {
                             $modify_showerrorinfo = "<font color='red'>更新失败</font>";
                             BaseModel::rollback();
                         }
                     }
                     if ($update_userinfo) {
                         //var_dump($update_userinfo);
                         if (OrderindexModel::updateOrder('om_unshipped_order_userInfo', $update_userinfo, ' WHERE omOrderId = ' . $orderid)) {
                             $modify_showerrorinfo = "<font color='green'>更新成功</font>";
                         } else {
                             $modify_showerrorinfo = "<font color='red'>更新失败</font>";
                             BaseModel::rollback();
                         }
                     }
                     if ($update_tracknumber) {
                         //echo $msg;
                         if (!OrderAddModel::insertOrderTrackRow($update_tracknumber)) {
                             /*self :: $errCode = "001";
                             		self :: $errMsg =  "跟踪号插入失败";
                             		return false;*/
                             $modify_showerrorinfo = "<font color='red'>跟踪号插入失败</font>";
                             BaseModel::rollback();
                         }
                     }
                     BaseModel::commit();
                     BaseModel::autoCommit();
                 }
             }
         }
开发者ID:ohjack,项目名称:newErp,代码行数:67,代码来源:orderModify.view.php

示例4: pickupOrder

 public function pickupOrder()
 {
     global $dbConn;
     $skulist = $_POST['skulist'];
     $operator_id = $_SESSION[C('USER_AUTH_SYS_ID')];
     //操作人员ID
     $comid = $_SESSION[C('USER_COM_ID')];
     //公司ID
     $type = $_POST['type'];
     BaseModel::begin();
     //开始事务
     $rollback = false;
     foreach ($skulist as $key => $sku) {
         $price = PurchaseOrderModel::getPriceBySku($sku['sku']);
         //SKU单价
         //$parid      = CommonAct::actgetPartnerIdBySku($sku['sku']);//供应商ID
         $purid = $this->getPurchaseidBySku($sku['sku']);
         $parid = $this->getPartnerId($sku['sku']);
         //供应商ID
         $parid = $parid['partnerId'];
         $storeid = 1;
         //仓库ID
         $orderData = $this->getOwOrderSN($parid, $purid);
         //判断同供应商、采购员跟踪号是否已存在
         $orderSN = $orderData['recordnumber'];
         if ($key == 0 && $type == "oversea") {
             $orderSN = null;
         }
         $main = array();
         $detail = array();
         if (!empty($orderSN)) {
             //存在符合条件的跟踪号,直接插入采购订单明细
             //$detail['sku_id'] = $skuid;//SKU编号
             $detail['sku'] = $sku['sku'];
             $detail['price'] = $price;
             //单价
             $detail['count'] = $sku['rec'];
             //采购数量
             //$detail['is_new']  = $sku['is_new'];// 是否是新品
             $detail['goods_recommend_count'] = $sku['rec'];
             //采购数量
             $detail['recordnumber'] = $orderData['recordnumber'];
             $poid = $orderData['id'];
             //根据跟踪号取采购主订单编号
             $detail['po_id'] = $poid;
             $dataSet = array2sql($detail);
             $sql = "insert into ph_ow_order_detail set {$dataSet}  ";
             $rtndetail = $dbConn->execute($sql);
             if ($rtndetail === false) {
                 $rollback = true;
             }
         } else {
             //不存在符合条件的跟踪号重新生成
             //生成跟踪号需通过公司编号生成前缀
             $recordnumber = PurchaseOrderModel::autoCreateOrderSn($purid, $comid);
             //生成对应公司的采购订单跟踪号
             if (!empty($recordnumber)) {
                 //生成采购订单号成功
                 $main['recordnumber'] = $recordnumber;
                 //跟踪号
                 $main['purchaseuser_id'] = $purid;
                 //采购员ID
                 $main['operator_id'] = $operator_id;
                 //操作人员id
                 $main['warehouse_id'] = $storeid;
                 //仓库ID
                 $main['partner_id'] = $parid;
                 //供应商ID
                 $main['company_id'] = $comid;
                 //公司编号
                 $main['addtime'] = time();
                 if ($type == "oversea") {
                     $main['order_type'] = 5;
                     // 给海外仓备货的订单
                 } else {
                     $main['order_type'] = 1;
                     // 正常订单
                 }
                 $dataSet = array2sql($main);
                 $sql = "insert into ph_ow_order set {$dataSet}  ";
                 $rtnmain = $dbConn->execute($sql);
                 if ($rtnmain) {
                     //主订单添加成功
                     $detail['sku'] = $sku['sku'];
                     $detail['price'] = $price;
                     //单价
                     $detail['count'] = $sku['rec'];
                     //采购数量
                     $detail['goods_recommend_count'] = $sku['rec'];
                     //采购数量
                     //$detail['is_new']  = $sku['is_new'];// 是否是新品
                     $detail['recordnumber'] = $recordnumber;
                     $poid = PurchaseOrderModel::getOrderIdByNum($recordnumber);
                     //根据跟踪号取采购主订单编号
                     $detail['po_id'] = $poid;
                     $dataSet = array2sql($detail);
                     $sql = "insert into ph_ow_order_detail set {$dataSet}  ";
                     $dbConn->execute($sql);
                     if ($rtndetail === false) {
                         $rollback = true;
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:purchaseOrder.action.php

示例5: view_productsCombineSpuComplete

 public function view_productsCombineSpuComplete()
 {
     $combineSpu = $_GET['combineSpu'] ? $_GET['combineSpu'] : '';
     $id = $_GET['id'] ? $_GET['id'] : '';
     $userId = $_SESSION['userId'];
     $now = time();
     if (intval($userId) <= 0) {
         $status = "未登录";
         header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
         exit;
     }
     if (empty($id)) {
         $status = "id为空";
         header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
         exit;
     }
     $idArr = array_filter(explode(',', $id));
     foreach ($idArr as $value) {
         if (intval($value) <= 0) {
             $status = "含有非法id";
             header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
             exit;
         }
     }
     $newIdArr = implode(',', $idArr);
     try {
         BaseModel::begin();
         $tName = 'pc_spu_web_maker';
         $set = "SET isComplete=1,completeTime='{$now}'";
         $where = "WHERE id in({$newIdArr})";
         OmAvailableModel::updateTNameRow($tName, $set, $where);
         BaseModel::commit();
         BaseModel::autoCommit();
         $status = "制作完成成功";
         header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         $status = $e->getMessage();
         header("Location:index.php?mod=products&act=getProductsCombineSpuTakeList&status={$status}&combineSpu={$combineSpu}");
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:42,代码来源:products.view.php

示例6: act_autoSplitOrder

 public function act_autoSplitOrder()
 {
     $type = isset($_POST['type']) ? $_POST['type'] : "";
     $key = isset($_POST['key']) ? $_POST['key'] : "";
     $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : "";
     $userId = $_SESSION['sysUserId'];
     $order = splitOrderModel::selectOrder($orderid);
     $details = splitOrderModel::selectDetail($orderid);
     $userinfo = splitOrderModel::selectUser($orderid);
     global $memc_obj;
     $platformId = $order['platformId'];
     $plateform = splitOrderModel::selectplatform($platformId);
     $table = "om_unshipped_order_extension_" . $plateform;
     $extension = splitOrderModel::selectExtension($table, $orderid);
     $warehouse = splitOrderModel::selectWarehouse($orderid);
     if ($type == 1) {
         $amount = 0;
         foreach ($details as $detail) {
             $nums = 0;
             //每个料号数量
             $result = $memc_obj->get_extral("sku_info_" . $detail['sku']);
             for ($i = 0; $i < $detail['amount']; $i++) {
                 if ($amount == $key) {
                     $skus[$detail['sku']] = $nums;
                     $new_orders[] = array($skus, $weight, $shippingfee);
                     $weight = 0;
                     $shippingfee = 0;
                     $amount = 0;
                 }
                 $shippingfee += $detail['shippingfee'];
                 $weight += $result['weight'];
                 $amount += 1;
                 $nums += 1;
             }
         }
         $skus[$detail['sku']] = $nums;
     } elseif ($type == 2) {
         $weight = 0;
         foreach ($details as $num => $detail) {
             $amount = 0;
             $result = $memc_obj->get_extral("sku_info_" . $detail['sku']);
             foreach ($detail as $value) {
                 if ($weight + $result['weight'] > $key) {
                     $skus[$detail['sku']] = $amount;
                     $new_orders[] = array($skus, $weight, $shippingfee);
                     $weight = 0;
                     $shippingfee = 0;
                     $amount = 0;
                 }
                 //$price += $value['itemPrice']
                 $shippingfee += $value['shippingfee'];
                 $weight += $result['weight'];
                 $amount += 1;
             }
             $skus[$detail['sku']] = $amount;
         }
     }
     //获取新订单数组
     BaseModel::begin();
     foreach ($new_orders as $neworder) {
         //先插入订单
         foreach ($order as $key => $value) {
             if ($key == 'id') {
                 continue;
             }
             if ($key == 'isSplit') {
                 $new_order[$key] = 2;
                 continue;
             }
             if ($key == 'calcWeight') {
                 $new_order[$key] = $neworder[1];
                 continue;
             }
             if ($key == 'calcShipping') {
                 $new_order[$key] = $neworder[2];
                 continue;
             }
             $new_order[$key] = $value;
         }
         $sql = array();
         foreach ($new_order as $key => $value) {
             if (is_numeric($value)) {
                 $sql[] = "{$key}={$value}";
             } else {
                 $sql[] = "{$key}='{$value}'";
             }
         }
         $sql = implode(",", $sql);
         $id = splitOrderModel::insertOrder($sql, $userId);
         if (!$id) {
             self::$errCode = 611;
             self::$errMsg = "拆分订单订单插入失败!";
             BaseModel::rollback();
             return false;
         }
         //插入订单明细信息
         foreach ($details as $nums => $detail) {
             foreach ($neworder[0] as $key1 => $sku_amount) {
                 if ($key1 == $setail['sku']) {
                     $new_detail = array();
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:splitOrder.action.php

示例7: act_addInput

 function act_addInput()
 {
     //$pidNew = $_POST['pidNew']?post_check($_POST['pidNew']):'';//类别
     $finalIdArr = $_POST['finalIdStr'];
     //新建属性-类别4
     $inputName = $_POST['inputName'] ? post_check($_POST['inputName']) : '';
     //类别
     $textStatus = $_POST['textStatus'] ? post_check($_POST['textStatus']) : '';
     //文本方式
     if (empty($finalIdArr) || empty($inputName)) {
         self::$errCode = 101;
         self::$errMsg = '类别或属性名不能为空';
         return false;
     }
     if (intval($textStatus) <= 0) {
         self::$errCode = 102;
         self::$errMsg = '文本方式有误';
         return false;
     }
     $tmpArr = array();
     if (!is_array($finalIdArr)) {
         $tmpArr[] = $finalIdArr;
         $finalIdArr = $tmpArr;
     }
     $finalPathArr = array();
     foreach ($finalIdArr as $cid) {
         $catePath = CategoryModel::getCategoryPathById($cid);
         if (empty($catePath)) {
             self::$errCode = 109;
             self::$errMsg = '类别有误';
             return false;
         }
         $finalPathArr[] = $catePath;
     }
     $tName = 'pc_goods_category';
     foreach ($finalPathArr as $value) {
         $where = "WHERE path like'%{$value}-%' and is_delete=0";
         $count = OmAvailableModel::getTNameCount($tName, $where);
         if ($count) {
             self::$errCode = 105;
             self::$errMsg = '只能在最小分类进行复制';
             return false;
         }
     }
     try {
         $pidNewStr = '';
         BaseModel::begin();
         $tName = 'pc_archive_input';
         foreach ($finalPathArr as $value) {
             $where = "WHERE inputName='{$inputName}' AND categoryPath='{$value}'";
             $countIN = OmAvailableModel::getTNameCount($tName, $where);
             if (!$countIN) {
                 $pidNewStr .= CategoryModel::getCategoryNameByPath($value) . ' ';
                 $set = "SET inputName='{$inputName}',categoryPath='{$value}',textStatus='{$textStatus}'";
                 OmAvailableModel::addTNameRow($tName, $set);
             }
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         self::$errCode = 200;
         self::$errMsg = "{$inputName} 添加到 {$pidNewStr} 成功";
         return true;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         self::$errCode = 201;
         self::$errMsg = $e->getMessage();
         return false;
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:70,代码来源:property.action.php

示例8: act_updateSpecialTMTCOn


//.........这里部分代码省略.........
                     alert("' . $status . '");
                     </script>';
         exit;
     }
     if (empty($specialTransportManagerName)) {
         $status = "特殊运输方式名称为空";
         echo '<script language="javascript">
                     alert("' . $status . '");
                     </script>';
         exit;
     }
     if (intval($isOn) <= 0) {
         $status = "是否启用有误";
         echo '<script language="javascript">
                     alert("' . $status . '");
                     </script>';
         exit;
     }
     if (empty($transportIdArr)) {
         $status = "所选的运输方式为空,错误";
         echo '<script language="javascript">
                     alert("' . $status . '");
                     </script>';
         exit;
     }
     $tName = 'pc_special_transport_manager';
     $where = "WHERE specialTransportManagerName='{$specialTransportManagerName}' AND id<>'{$id}'";
     $properNameIsExist = OmAvailableModel::getTNameCount($tName, $where);
     if ($properNameIsExist) {
         $status = "该特殊运输方式名称已经存在,请检查";
         echo '<script language="javascript">
                     alert("' . $status . '");
                     </script>';
         exit;
     }
     try {
         BaseModel::begin();
         $tName = 'pc_special_transport_manager';
         $dataTmpArr = array();
         $dataTmpArr['specialTransportManagerName'] = $specialTransportManagerName;
         $dataTmpArr['isOn'] = $isOn;
         $where = "WHERE id='{$id}'";
         OmAvailableModel::updateTNameRow2arr($tName, $dataTmpArr, $where);
         $tName = 'pc_special_stmnid_transportid';
         $select = '*';
         $where = "WHERE stmnId='{$id}'";
         $psptList = OmAvailableModel::getTNameList($tName, $select, $where);
         $psptIdArr = array();
         foreach ($psptList as $value) {
             $psptIdArr[] = $value['id'];
         }
         $psptIdStr = !empty($psptIdArr) ? implode(',', $psptIdArr) : 0;
         $tName = 'pc_special_stid_channel';
         $where = "WHERE stId in({$psptIdStr})";
         OmAvailableModel::deleteTNameRow($tName, $where);
         //删除渠道关系表的相关数据
         $tName = 'pc_special_stmnid_transportid';
         $where = "WHERE stmnId='{$id}'";
         OmAvailableModel::deleteTNameRow($tName, $where);
         //删除运输方式关系表的相关数据
         foreach ($transportIdArr as $transportId) {
             if (intval($transportId) > 0) {
                 $channelIdArr = !empty($_POST['tc' . $transportId]) ? $_POST['tc' . $transportId] : array();
                 //该transpordeId下的channel数组
                 $tName = 'pc_special_stmnid_transportid';
                 $dataTmpArr = array();
                 $dataTmpArr['stmnId'] = $id;
                 $dataTmpArr['transportId'] = $transportId;
                 $insertPTId = OmAvailableModel::addTNameRow2arr($tName, $dataTmpArr);
                 if (intval($insertPTId) <= 0) {
                     throw new Exception('insertPTId 错误');
                 }
                 foreach ($channelIdArr as $channelId) {
                     if (intval($channelId) > 0) {
                         $tName = 'pc_special_stid_channel';
                         $dataTmpArr = array();
                         $dataTmpArr['stId'] = $insertPTId;
                         $dataTmpArr['channelId'] = $channelId;
                         OmAvailableModel::addTNameRow2arr($tName, $dataTmpArr);
                     }
                 }
             }
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         $status = "修改成功";
         echo '<script language="javascript">
                     alert("' . $status . '");
                     </script>';
         exit;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         $status = '失败,原因为:' . $e->getMessage();
         echo '<script language="javascript">
                     alert("' . $status . '");
                     </script>';
         exit;
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:spuSpecialProperty.action.php

示例9: view_updatePropertyOn

 public function view_updatePropertyOn()
 {
     $id = $_GET['id'];
     $propertyName = $_GET['propertyName'] ? post_check(trim($_GET['propertyName'])) : '';
     $pid = $_GET['pid'] ? post_check(trim($_GET['pid'])) : '';
     $isRadio = $_GET['isRadio'] ? post_check(trim($_GET['isRadio'])) : '';
     $isRequired = $_GET['isRequired'] ? post_check(trim($_GET['isRequired'])) : '';
     if (intval($id) == 0) {
         $status = "属性Id错误";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     if (empty($propertyName)) {
         if (intval($id) == 0) {
             $status = "属性Id错误";
             header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
             exit;
         }
         $tName = 'pc_archive_spu_property_value_relation';
         $where = "WHERE propertyId={$id}";
         $countPP = OmAvailableModel::getTNameCount($tName, $where);
         if ($countPP) {
             $status = "该属性已经绑定了SPU,不能删除";
             header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
             exit;
         }
         $tName = 'pc_archive_property_value';
         $select = 'id';
         $where = "WHERE propertyId={$id}";
         $ppvList = OmAvailableModel::getTNameList($tName, $select, $where);
         //该属性下所有的属性值
         foreach ($ppvList as $value) {
             $propertyValueId = $value['id'];
             if (intval($propertyValueId) != 0) {
                 $tName = 'pc_archive_spu_property_value_relation';
                 $where = "WHERE propertyId={$id} and propertyValueId={$propertyValueId}";
                 $countPPV = OmAvailableModel::getTNameCount($tName, $where);
                 if ($countPPV) {
                     $status = "该属性下已有属性值绑定了SPU,不能删除";
                     header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
                     exit;
                 }
             }
         }
         try {
             BaseModel::begin();
             foreach ($ppvList as $value) {
                 $propertyValueId = $value['id'];
                 if (intval($propertyValueId) != 0) {
                     $tName = 'pc_archive_property_value';
                     $where = "WHERE id={$propertyValueId}";
                     OmAvailableModel::deleteTNameRow($tName, $where);
                 }
             }
             $tName = 'pc_archive_property';
             $where = "WHERE id={$id}";
             OmAvailableModel::deleteTNameRow($tName, $where);
             BaseModel::commit();
             BaseModel::autoCommit();
             $status = "属性删除成功";
             header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
             exit;
         } catch (Exception $e) {
             BaseModel::rollback();
             BaseModel::autoCommit();
             $status = $e->getMessage();
             header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
             exit;
         }
     }
     if (empty($pid)) {
         $status = "类型不能为空";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     if (empty($isRadio)) {
         $status = "录入方式不能为空";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     if (intval($isRequired) == 0) {
         $status = "是否必填不能为空";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     $tName = 'pc_archive_property';
     $select = '*';
     $where = "WHERE id='{$id}'";
     $propertyList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($propertyList)) {
         $status = "不存在该属性记录";
         header("Location:index.php?mod=property&act=getPropertyList&status={$status}");
         exit;
     }
     $categoryName = getAllCateNameByPath($pid);
     $pathImplodeStr = getAllPathBypid($pid);
     $i = strrpos($pathImplodeStr, ',');
     if ($i !== false) {
         $pathImplodeStr = substr($pathImplodeStr, 0, $i);
     }
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:property.view.php

示例10: act_cancelCombine

 public function act_cancelCombine()
 {
     //更新主从订单状态及记录
     $str = isset($_POST['str']) ? $_POST['str'] : "";
     $orderids = explode(",", $str);
     $userId = $_SESSION['sysUserId'];
     BaseModel::begin();
     foreach ($orderids as $orderid) {
         $order = cancelCombineModel::selectRecord($orderid);
         if ($order[0]['combinePackage'] == 1) {
             $msg = cancelCombineModel::updateOrder($orderid);
             if (!$msg) {
                 self::$errCode = 402;
                 self::$errMsg = "更新主订单失败!";
                 BaseModel::rollback();
                 return false;
             }
             $sonOrders = cancelCombineModel::selectSonOrder($orderid);
             foreach ($sonOrders as $sonorder) {
                 $msg1 = cancelCombineModel::updateOrder($sonorder['split_order_id']);
                 if (!$msg1) {
                     self::$errCode = 403;
                     self::$errMsg = "更新子订单失败!";
                     BaseModel::rollback();
                     return false;
                 }
                 if (in_array($sonorder['split_order_id'], $orderids)) {
                     unset($orderids[$sonorder['split_order_id']]);
                 }
             }
             $msg2 = cancelCombineModel::updateRecords($orderid, $userId);
             if (!$msg2) {
                 self::$errCode = 404;
                 self::$errMsg = "更新合并包裹记录失败!";
                 BaseModel::rollback();
                 return false;
             }
         }
         if ($order[0]['combinePackage'] == 2) {
             $mainOrder = cancelCombineModel::selectMainOrder($order[0]['id']);
             $sonOrders = cancelCombineModel::selectSonOrder($mainOrder);
             if (count($sonOrders) == 1) {
                 $msg3 = cancelCombineModel::updateOrder($mainorder);
                 if (!$msg3) {
                     self::$errCode = 405;
                     self::$errMsg = "更新主订单失败!";
                     BaseModel::rollback();
                     return false;
                 }
                 if (in_array($mainOrder, $orderids)) {
                     unset($orderids[$mainOrder]);
                 }
                 $msg4 = cancelCombineModel::updateOrder($sonOrders[0]['split_order_id']);
                 if (!$msg4) {
                     self::$errCode = 406;
                     self::$errMsg = "更新子订单失败!";
                     BaseModel::rollback();
                     return false;
                 }
             } else {
                 $msg5 = cancelCombineModel::updateOrder($orderid);
                 if (!$msg5) {
                     self::$errCode = 407;
                     self::$errMsg = "更新子订单失败!";
                     BaseModel::rollback();
                     return false;
                 }
             }
             $msg6 = cancelCombineModel::updateRecords($orderid, $userId, "son");
             if (!$msg6) {
                 self::$errCode = 408;
                 self::$errMsg = "更新合并包裹记录失败!";
                 BaseModel::rollback();
                 return false;
             }
         }
     }
     BaseModel::commit();
     return true;
 }
开发者ID:ohjack,项目名称:newErp,代码行数:80,代码来源:cancelCombine.action.php

示例11: act_copyOrder

 public function act_copyOrder()
 {
     $orderid = isset($_POST['orderid']) ? $_POST['orderid'] : "";
     $countryName = isset($_POST['countryName']) ? $_POST['countryName'] : "";
     $state = isset($_POST['state']) ? $_POST['state'] : "";
     $detail_sku = isset($_POST['detail_sku']) ? $_POST['detail_sku'] : "";
     $city = isset($_POST['city']) ? $_POST['city'] : "";
     $landline = isset($_POST['landline']) ? $_POST['landline'] : "";
     $phone = isset($_POST['phone']) ? $_POST['phone'] : "";
     $zipCode = isset($_POST['zipCode']) ? $_POST['zipCode'] : "";
     $street = isset($_POST['street']) ? $_POST['street'] : "";
     $address2 = isset($_POST['address2']) ? $_POST['address2'] : "";
     $address3 = isset($_POST['address3']) ? $_POST['address3'] : "";
     $transport = isset($_POST['transport']) ? $_POST['transport'] : "";
     $note = isset($_POST['note']) ? $_POST['note'] : "";
     $userId = $_SESSION['sysUserId'];
     $order = copyOrderModel::selectOrder($orderid);
     $user = copyOrderModel::selectUser($orderid);
     $details = copyOrderModel::selectDetail($orderid);
     $platformId = $order['platformId'];
     $plateform = copyOrderModel::selectplatform($platformId);
     $table = "om_unshipped_order_extension_" . $plateform;
     $extension = copyOrderModel::selectExtension($table, $orderid);
     $warehouse = copyOrderModel::selectWarehouse($orderid);
     $notes = copyOrderModel::selectNote($orderid);
     BaseModel::begin();
     if (!$order) {
         self::$errCode = 501;
         self::$errMsg = "原订单已完成或不存在!";
         return false;
     }
     if ($order['isCopy'] == 2) {
         self::$errCode = 502;
         self::$errMsg = "此订单是复制产生的订单,不能在被复制!";
         return false;
     }
     $new_order = array();
     foreach ($order as $key => $value) {
         if ($key == 'id') {
             continue;
         }
         $new_order[$key] = $value;
         if ($key == 'isCopy') {
             $new_order[$key] = 2;
         }
     }
     //$statuslist = copyOrderModel::selectStatus($status);
     //$new_order['orderStatus'] = $statusList['groupId'];
     //$new_order['orderType'] = $statusList['statusCode'];
     //先插入订单生成订单id
     //$sql = "";
     foreach ($new_order as $key => $value) {
         if (is_numeric($value)) {
             $sql[] = "{$key}={$value}";
         } else {
             $sql[] = "{$key}='{$value}'";
         }
     }
     $sql = implode(",", $sql);
     $id = copyOrderModel::insertOrder($sql, $userId);
     if (!$id) {
         self::$errCode = 503;
         self::$errMsg = "复制订单插入失败!";
         BaseModel::rollback();
         return false;
     }
     $new_user = array();
     //插入用户信息
     foreach ($user as $key => $value) {
         $new_user[$key] = $value;
         if ($key == 'omOrderId') {
             $new_user[$key] = $id;
         }
         if ($key == 'countryName') {
             $new_user[$key] = $countryName;
         }
         if ($key == 'state') {
             $new_user[$key] = $state;
         }
         if ($key == 'city') {
             $new_user[$key] = $city;
         }
         if ($key == 'landline') {
             $new_user[$key] = $landline;
         }
         if ($key == 'phone') {
             $new_user[$key] = $phone;
         }
         if ($key == 'zipCode') {
             $new_user[$key] = $zipCode;
         }
         if ($key == 'street') {
             $new_user[$key] = $street;
         }
         if ($key == 'address2') {
             $new_user[$key] = $address2;
         }
         if ($key == 'address3') {
             $new_user[$key] = $address3;
         }
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:copyOrder.action.php

示例12: view_updateSpuPersonOn


//.........这里部分代码省略.........
                     $dataEbayArr['isAgree'] = 1;
                     //add by zqt 20140421,如果换人了的话,则变为待定状态
                     $dataEbayArr['addTime'] = time();
                     OmAvailableModel::updateTNameRow2arr($tName, $dataEbayArr, $where);
                 }
             } else {
                 //插入新数据时,则默认销售同意/拒绝状态为待定
                 $dataEbayArr = array();
                 $dataEbayArr['spu'] = $spu;
                 $dataEbayArr['salerId'] = $amazonSalerId;
                 $dataEbayArr['platformId'] = 11;
                 $dataEbayArr['addTime'] = time();
                 $dataEbayArr['isAgree'] = 1;
                 OmAvailableModel::addTNameRow2arr($tName, $dataEbayArr);
             }
         }
         if (!empty($overseaSalerId)) {
             $where = "WHERE is_delete=0 AND spu='{$spu}' AND platformId=14";
             //amazon平台
             $ebaySpuSalerList = OmAvailableModel::getTNameList($tName, $select, $where);
             if (!empty($ebaySpuSalerList)) {
                 //更新时如果人员改动会更新是否接手状态,但是不会更新是否被销售同意/拒绝状态
                 if ($ebaySpuSalerList[0]['salerId'] != $overseaSalerId) {
                     $dataEbayArr = array();
                     $dataEbayArr['salerId'] = $overseaSalerId;
                     $dataEbayArr['isAgree'] = 1;
                     //add by zqt 20140421,如果换人了的话,则变为待定状态
                     $dataEbayArr['addTime'] = time();
                     OmAvailableModel::updateTNameRow2arr($tName, $dataEbayArr, $where);
                 }
             } else {
                 //插入新数据时,则默认销售同意/拒绝状态为待定
                 $dataEbayArr = array();
                 $dataEbayArr['spu'] = $spu;
                 $dataEbayArr['salerId'] = $overseaSalerId;
                 $dataEbayArr['platformId'] = 14;
                 $dataEbayArr['addTime'] = time();
                 $dataEbayArr['isAgree'] = 1;
                 OmAvailableModel::addTNameRow2arr($tName, $dataEbayArr);
             }
         }
         if (!empty($webMakerId)) {
             $tName = 'pc_spu_web_maker';
             $select = 'webMakerId,isAgree,isTake';
             $where = "WHERE is_delete=0 AND spu='{$spu}' order by id desc limit 1";
             $spuWebMakerList = OmAvailableModel::getTNameList($tName, $select, $where);
             if (empty($spuWebMakerList)) {
                 //不存在该SPU的指派记录
                 $dataWebMakerArr = array();
                 $dataWebMakerArr['spu'] = $spu;
                 $dataWebMakerArr['isSingSpu'] = $isSingSpu;
                 $dataWebMakerArr['webMakerId'] = $webMakerId;
                 $dataWebMakerArr['isAgree'] = 1;
                 //add by 20140513,待定状态
                 $dataWebMakerArr['addTime'] = time();
                 OmAvailableModel::addTNameRow2arr($tName, $dataWebMakerArr);
             } else {
                 //存在指派记录时
                 if ($spuWebMakerList[0]['webMakerId'] != $webMakerId) {
                     //提交的人和之前的不一致则修改/添加,否则不变
                     if ($spuWebMakerList[0]['isTake'] == 1) {
                         //如果是已经被工程师领取,则表示接手
                         $dataWebMakerArr = array();
                         $dataWebMakerArr['spu'] = $spu;
                         $dataWebMakerArr['isSingSpu'] = $isSingSpu;
                         $dataWebMakerArr['webMakerId'] = $webMakerId;
                         $dataWebMakerArr['addTime'] = time();
                         $dataWebMakerArr['isAgree'] = $spuWebMakerList[0]['isAgree'];
                         //add by 20140513,同意/拒绝状态不变
                         $dataWebMakerArr['isHandsOn'] = 1;
                         OmAvailableModel::addTNameRow2arr($tName, $dataWebMakerArr);
                     } else {
                         //如果未被领取,则只是修改记录
                         $dataWebMakerArr = array();
                         $dataWebMakerArr['webMakerId'] = $webMakerId;
                         $dataWebMakerArr['addTime'] = time();
                         $dataWebMakerArr['isAgree'] = 1;
                         //add by 20140513,未领取的话,重新变成待定状态
                         OmAvailableModel::updateTNameRow2arr($tName, $dataWebMakerArr, $where);
                     }
                 }
             }
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         $status = "更新成功";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
         exit;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         $status = $e->getMessage();
         echo '<script language="javascript">
                 alert("' . '添加失败——' . $status . '");
               </script>';
         exit;
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:autoCreateSpu.view.php

示例13: shiftOrderList

 public static function shiftOrderList($where)
 {
     BaseModel::begin();
     //开始事务
     $unshipped_tableName = 'om_unshipped_order';
     $shipped_tableName = 'om_shipped_order';
     $orderList = self::showOrderList($unshipped_tableName, $where);
     //echo "<pre>"; print_r($orderList); exit;
     if (empty($orderList)) {
         self::$errCode = '000';
         self::$errMsg = "无操作数据!";
         return false;
     }
     foreach ($orderList as $omOrderId => $orderData) {
         $obj_order_data = $orderData['orderData'];
         $orderDetail = $orderData['orderDetail'];
         $insert_orderDetail = array();
         foreach ($orderDetail as $detail) {
             $insert_orderDetailData = $detail['orderDetailData'];
             //unset ($insert_orderDetailData['id']);
             $insert_orderDetailExtenData = $detail['orderDetailExtenData'];
             //unset ($insert_orderDetailExtenData['omOrderdetailId']);
             $insert_orderDetail[] = array('orderDetailData' => $insert_orderDetailData, 'orderDetailExtenData' => $insert_orderDetailExtenData);
         }
         //BaseModel :: rollback();\
         //self :: $dbConn->query('SET AUTOCOMMIT=1');
         //return FALSE;
         //unset ($obj_order_data['id']);
         $orderExtenData = $orderData['orderExtenData'];
         //unset ($orderExtenData['omOrderId']);
         $orderUserInfoData = $orderData['orderUserInfoData'];
         //unset ($orderExtenData['omOrderId']);
         $orderWhInfoData = $orderData['orderWhInfoData'];
         //unset ($orderWhInfoData['omOrderId']);
         //$obj_order_data['orderStatus'] = C('STATEBUJI');
         //$obj_order_data['orderType'] = C('STATEBUJI_DONE');
         $insert_orderData = array();
         $insert_orderData = array('orderData' => $obj_order_data, 'orderExtenData' => $orderExtenData, 'orderUserInfoData' => $orderUserInfoData, 'orderDetail' => $insert_orderDetail, 'orderWhInfoData' => $orderWhInfoData);
         //var_dump($insert_orderData); exit;
         if ($insertId = OrderAddModel::shiftAllOrderRowNoEvent($insert_orderData)) {
             //echo $split_log .= 'insert success!' . "\n"; exit;
             //var_dump($_mainId,$_spitId); exit;
             if (!OrderLogModel::insertOrderLog($insertId, '从unshipped表转移数据到shipped表中,第一步:添加shipped表数据')) {
                 BaseModel::rollback();
                 self::$errCode = '001';
                 self::$errMsg = "转移数据添加日志失败,第一步:添加shipped表数据失败!";
                 return false;
             }
         } else {
             BaseModel::rollback();
             self::$errCode = '002';
             self::$errMsg = "INSERT数据失败!";
             return false;
         }
         if (self::killAllOrderRowNoEvent($omOrderId, $obj_order_data['platformId'])) {
             //echo $split_log .= 'insert success!' . "\n"; exit;
             //var_dump($_mainId,$_spitId); exit;
             if (!OrderLogModel::insertOrderLog($omOrderId, '从unshipped表转移数据到shipped表中,第二步:删除unshipped表中数据')) {
                 BaseModel::rollback();
                 self::$errCode = '003';
                 self::$errMsg = "转移数据添加日志失败,第二步:删除unshipped表中数据失败!";
                 return false;
             }
         } else {
             BaseModel::rollback();
             self::$errCode = '004';
             self::$errMsg = "KILL数据失败!";
             return false;
         }
     }
     BaseModel::commit();
     BaseModel::autoCommit();
     self::$errCode = '200';
     self::$errMsg = "转移数据成功!";
     return TRUE;
 }
开发者ID:ohjack,项目名称:newErp,代码行数:76,代码来源:orderindex.model.php

示例14: insertAllOrderRow

 /**
  * 插入订单对应下的总表信息
  * @para $data as array
  * @add by Herman.Xi
  * @last modified 20131022
  * $in 默认为进入订单模式
  */
 public static function insertAllOrderRow($orderData, $extension = 'ebay', $in = true)
 {
     self::initDB();
     //var_dump($orderData); exit;
     $obj_order_data = $orderData['orderData'];
     $orderExtenData = $orderData['orderExtenData'];
     $orderUserInfoData = $orderData['orderUserInfoData'];
     $orderDetailArr = $orderData['orderDetail'];
     if ($obj_order_data['platformId'] == "2") {
         //ebay
         $ebay_orderid = $orderExtenData['orderId'];
         $tName = 'om_unshipped_order_extension_ebay';
         $where = "WHERE orderId='{$ebay_orderid}'";
         $flagCountUnshipped = OmAvailableModel::getTNameCount($tName, $where);
         $tName = 'om_shipped_order_extension_ebay';
         $flagCountshipped = OmAvailableModel::getTNameCount($tName, $where);
     } else {
         $tName = 'om_unshipped_order';
         $where = "WHERE accountId='{$obj_order_data['accountId']}' AND recordNumber='{$obj_order_data['recordNumber']}' AND platformId={$obj_order_data['platformId']} and is_delete ='0'";
         $flagCountUnshipped = OmAvailableModel::getTNameCount($tName, $where);
         $tName = 'om_shipped_order';
         $flagCountshipped = OmAvailableModel::getTNameCount($tName, $where);
     }
     //if (empty ($flagCountUnshipped) && empty ($flagCountshipped)) { //判断订单是否已经在系统2个订单表(未发货和已发货)中存在
     if (empty($flagCountUnshipped) && empty($flagCountshipped)) {
         $platfrom = omAccountModel::getPlatformSuffixById($obj_order_data['platformId']);
         $extension = $platfrom['suffix'];
         //获取后缀名称
         BaseModel::begin();
         //开始事务
         $insertOrderDataRow = self::insertOrderRow($obj_order_data);
         //插入到order表
         if (empty($insertOrderDataRow)) {
             BaseModel::rollback();
             //throw new Exception('insert orderData error');
         }
         $orderExtenData['omOrderId'] = $insertOrderDataRow;
         $orderUserInfoData['omOrderId'] = $insertOrderDataRow;
         $resultExten = self::insertExtension($orderExtenData, $extension);
         //插入到order_extend表
         if (!$resultExten) {
             BaseModel::rollback();
             //throw new Exception('insert orderExtenData error');
         }
         $resultUserInfo = self::insertUserinfoRow($orderUserInfoData);
         //插入到order_userInfo表
         if (!$resultUserInfo) {
             BaseModel::rollback();
             //throw new Exception('insert orderUserInfoData error');
         }
         foreach ($orderDetailArr as $orderDetail) {
             $orderDetailData = $orderDetail['orderDetailData'];
             $orderDetailExtenData = $orderDetail['orderDetailExtenData'];
             $orderDetailData['omOrderId'] = $insertOrderDataRow;
             $orderDetailData['createdTime'] = time();
             $insertOrderDatilRow = self::insertOrderdetail($orderDetailData);
             //插入到detail表
             if (empty($insertOrderDatilRow)) {
                 BaseModel::rollback();
                 //throw new Exception('insert orderDetailData error');
             }
             $orderDetailExtenData['omOrderdetailId'] = $insertOrderDatilRow;
             if ($orderDetailExtenData) {
                 $resultOrderDetailExten = self::insertDetailExtension($orderDetailExtenData, $extension);
                 //插入到detailExtend
                 if (!$resultOrderDetailExten) {
                     BaseModel::rollback();
                     //throw new Exception('insert orderDetailExtenData error');
                 }
             }
         }
         if ($obj_order_data['platformId'] == 1) {
             $insertOrderidsDada = array('omOrderId' => $insertOrderDataRow, 'PayPalPaymentId' => $orderData['orderExtenData']['PayPalPaymentId'], 'orderid' => $orderData['orderExtenData']['orderId'], 'accountId' => $orderData['orderData']['accountId'], 'saletime' => time());
             $insertOrderids = OrderidsModel::insertOrderidsList($insertOrderidsDada);
             if (!$insertOrderids) {
                 BaseModel::rollback();
                 //throw new Exception('insert orderIds error');
             }
         }
         if (isset($orderData['orderNote']) && !empty($orderData['orderNote'])) {
             $orderNote = $orderData['orderNote'];
             $insertOrderNoteDada = array('omOrderId' => $insertOrderDataRow, 'content' => $orderNote['content'], 'userId' => $orderNote['userId'], 'createdTime' => $orderNote['createdTime']);
             $insertOrderNoteids = OrderAddModel::insertOrderNotesRow($insertOrderNoteDada);
             if (!$insertOrderNoteids) {
                 BaseModel::rollback();
                 //throw new Exception('insert orderNote error');
             }
         }
         $buyerInfo = $orderUserInfoData;
         $buyerInfo['platformId'] = $obj_order_data['platformId'];
         unset($buyerInfo['omOrderId']);
         unset($buyerInfo['countrySn']);
         unset($buyerInfo['currency']);
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:orderAdd.model.php

示例15: act_confirmReceivingByMFG

 function act_confirmReceivingByMFG()
 {
     $ioStoreId = !empty($_POST['ioStoreId']) ? $_POST['ioStoreId'] : 0;
     $comfirmUserId = $_SESSION['userId'];
     $now = time();
     if (intval($ioStoreId) <= 0) {
         self::$errCode = '101';
         self::$errMsg = "id有误";
         return false;
     }
     if (intval($comfirmUserId) <= 0) {
         self::$errCode = '102';
         self::$errMsg = "登陆超时,请重试";
         return false;
     }
     $tName = 'pc_products_iostore';
     $select = '*';
     $where = "WHERE is_delete=0 AND isAudit=2 AND id='{$ioStoreId}'";
     $ioStoreList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($ioStoreList)) {
         self::$errCode = '103';
         self::$errMsg = "该单据不存在或者未审核通过";
         return false;
     }
     try {
         BaseModel::begin();
         //标记表头已经确认
         $dataIoStore = array();
         $dataIoStore['isComfirm'] = 2;
         //标记单据已经确认
         $dataIoStore['comfirmUserId'] = $comfirmUserId;
         $dataIoStore['comfirmTime'] = $now;
         OmAvailableModel::updateTNameRow2arr($tName, $dataIoStore, $where);
         //标记表体确认
         $tName = 'pc_products_iostore_detail';
         $dataIoStoreDetail = array();
         $dataIoStoreDetail['isComfirm'] = 2;
         $where = "WHERE iostoreId='{$ioStoreId}'";
         OmAvailableModel::updateTNameRow2arr($tName, $dataIoStoreDetail, $where);
         //如果是新品领料单,则产品部确认后,该单据下的sku才进入产品制作表
         if ($ioStoreList[0]['iostoreTypeId'] == 1 && $ioStoreList[0]['useTypeId'] == 1) {
             $select = 'sku';
             $skuList = OmAvailableModel::getTNameList($tName, $select, $where);
             foreach ($skuList as $value) {
                 $sku = $value['sku'];
                 $tName = 'pc_products';
                 $dataProducts = array();
                 $dataProducts['sku'] = $sku;
                 OmAvailableModel::addTNameRow2arr($tName, $dataProducts);
                 //将detail中的sku加入到产品制作表中
             }
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         self::$errCode = '200';
         self::$errMsg = "确认收货成功";
         return true;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         self::$errCode = '404';
         self::$errMsg = $e->getMessage();
         return false;
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:65,代码来源:ioStore.action.php


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