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


PHP BaseModel::commit方法代码示例

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


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

示例1: act_updateSkuConversion


//.........这里部分代码省略.........
         self::$errMsg = "登陆超时,请重试";
         return;
     }
     $tName = 'pc_sku_conversion';
     $select = 'new_sku';
     $where = "WHERE id={$id} and is_delete=0";
     $skuConNewSkuList = OmAvailableModel::getTNameList($tName, $select, $where);
     //在料号转换表中找到id所在记录的新料号new_sku
     $skuConNewSku = $skuConNewSkuList[0]['new_sku'];
     if (empty($skuConNewSku)) {
         self::$errCode = '104';
         self::$errMsg = "记录的新料号不存在";
         return;
     }
     if ($skuConNewSku == $new_sku) {
         self::$errCode = '111';
         self::$errMsg = "修改前后料号相同,无修改";
         return;
     }
     $tName = 'pc_goods';
     $select = '*';
     $where = "WHERE is_delete=0 AND sku='{$skuConNewSku}'";
     $newSkuPcList = OmAvailableModel::getTNameList($tName, $select, $where);
     //在产品表里找是否存在未修改前的料号
     $newSkuPc = $newSkuPcList[0];
     //未修改前的料号信息
     if (empty($newSkuPc)) {
         self::$errCode = '105';
         self::$errMsg = "修改前的料号 {$skuConNewSku} 在产品列表中不存在";
         return;
     }
     $newSkuPcSku = $newSkuPc['sku'];
     //$newSkuPcArr = array_filter(explode('_',$newSkuPc));//修改前的sku按照_来截取
     //        $newSpuPc = $newSkuPcArr[0];//取得新料号的SPU
     //        $newSkuArr = array_filter(explode('_',$new_sku));//修改后的sku按照_来截取
     //        $newSpu = $newSkuArr[0];//取得新料号的SPU
     //        if($newSpuPc != $newSpu){
     //            self::$errCode = '107';
     //            self::$errMsg = "修改前后的SPU不符,请检查";
     //            return;
     //        }
     try {
         BaseModel::begin();
         $tName = 'pc_sku_conversion';
         $set = "SET new_sku='{$new_sku}',modifiedUserId='{$modifiedUserId}',modifiedTime='{$modifiedTime}'";
         $where = "WHERE id={$id} and is_delete=0";
         OmAvailableModel::updateTNameRow($tName, $set, $where);
         //先将转换记录修改
         $tName = 'pc_goods';
         $set = "SET goodsStatus=101,is_delete=1";
         //将未修改前的sku状态改为 料号转化,并delete
         $where = "WHERE is_delete=0 and sku='{$newSkuPcSku}'";
         OmAvailableModel::updateTNameRow($tName, $set, $where);
         $where = "WHERE is_delete=0 and sku='{$new_sku}'";
         $newSkuCount = OmAvailableModel::getTNameCount($tName, $where);
         if ($newSkuCount) {
             //如果新料号在产品中已经存在,则只添加转换记录
             self::$errCode = '200';
             self::$errMsg = "修改转换记录成功,新料号:{$new_sku} 已经存在记录";
         } else {
             //如果新料号在产品表中不存在,则自动添加旧料号的记录进去
             unset($newSkuPc['id']);
             //去掉旧记录的id
             $newSkuPc['sku'] = $new_sku;
             //将旧的sku换成新的sku
             OmAvailableModel::addTNameRow2arr($tName, $newSkuPc);
             self::$errCode = '200';
             self::$errMsg = "修改转换记录成功,新料号:{$new_sku} 记录已插入成功";
         }
         //下面对关联单料号的组合料号进行修改
         $tName = 'pc_sku_combine_relation';
         $select = '*';
         $where = "WHERE sku='{$newSkuPcSku}' group by combineSku";
         $skuRelationList = OmAvailableModel::getTNameList($tName, $select, $where);
         if (empty($skuRelationList)) {
             self::$errMsg .= "<br/>其中,无关联组合料号被更新";
         } else {
             $combineSkuArr = array();
             foreach ($skuRelationList as $value) {
                 $combineSkuArr[] = $value['combineSku'];
             }
             $combineSkuStr = implode(',', $combineSkuArr);
             $set = "SET sku='{$new_sku}'";
             $where = "WHERE sku='{$newSkuPcSku}'";
             $affectRows = OmAvailableModel::updateTNameRow($tName, $set, $where);
             self::$errMsg .= "<br/>";
             self::$errMsg .= "其中,组合料号 {$combineSkuStr} 中共有 {$affectRows} 条单料号数据已更新";
         }
         //////
         BaseModel::commit();
         BaseModel::autoCommit();
         return;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         self::$errCode = '404';
         self::$errMsg = $e->getMessage();
         return;
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:skuConversion.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


//.........这里部分代码省略.........
                         //$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();
                 }
             }
         }
     }
     $this->smarty->assign('modify_showerrorinfo', $modify_showerrorinfo);
     $omAvailableAct = new OmAvailableAct();
     //平台信息
     $platform = $omAvailableAct->act_getTNameList('om_platform', 'id,platform', 'WHERE is_delete=0');
     //var_dump($platform);
     $platformList = array();
     foreach ($platform as $v) {
         $platformList[$v['id']] = $v['platform'];
     }
     $this->smarty->assign('platformList', $platformList);
     /**导航 start**/
     $this->smarty->assign('ostatus', $ostatus);
     $this->smarty->assign('otype', $otype);
     //二级目录
     $StatusMenuAct = new StatusMenuAct();
     $ostatusList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = 0 AND is_delete=0');
     //var_dump($ostatusList);
     $this->smarty->assign('ostatusList', $ostatusList);
     $otypeList = $StatusMenuAct->act_getStatusMenuList('statusCode,statusName', 'WHERE groupId = "' . $ostatus . '" AND is_delete=0');
     //var_dump($otypeList);
     $this->smarty->assign('otypeList', $otypeList);
     /*$o_secondlevel =  $omAvailableAct->act_getTNameList('om_status_menu','*','WHERE is_delete=0 and groupId=0 order by sort asc');
     		$this->smarty->assign('o_secondlevel', $o_secondlevel);*/
     $second_count = array();
     $second_type = array();
     foreach ($ostatusList as $o_secondinfo) {
         $orderStatus = $o_secondinfo['statusCode'];
开发者ID:ohjack,项目名称:newErp,代码行数:67,代码来源:orderModify.view.php

示例4: pickupOrder


//.........这里部分代码省略.........
         $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;
                     }
                 } else {
                     $rollback = true;
                 }
             } else {
                 $rollback = true;
             }
         }
     }
     if ($rollback == false) {
         BaseModel::commit();
         BaseModel::autoCommit();
         $result['msg'] = 'success';
     } else {
         BaseModel::rollback();
         BaseModel::autoCommit();
         $result['msg'] = '';
     }
     return json_encode($result);
 }
开发者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


//.........这里部分代码省略.........
                     }
                 }
             }
         }
         $new_user = array();
         //插入用户信息
         foreach ($userinfo as $key => $value) {
             $new_user[$key] = $value;
             if ($key == 'omOrderId') {
                 $new_user[$key] = $id;
             }
         }
         $sql = array();
         foreach ($new_user as $key => $value) {
             if (is_numeric($value)) {
                 $sql[] = "{$key}={$value}";
             } else {
                 $sql[] = "{$key}='{$value}'";
             }
         }
         $sql = implode(",", $sql);
         $msg = splitOrderModel::insertUser($sql, $userId);
         if (!$msg) {
             self::$errCode = 613;
             self::$errMsg = "插入拆分订单用户信息失败!";
             BaseModel::rollback();
             return false;
         }
         //插入订单扩展信息
         $new_extension = array();
         foreach ($extension as $key => $value) {
             if ($key == 'omOrderId') {
                 $new_extension[$key] = $id;
                 continue;
             }
             $new_extension[$key] = $value;
         }
         $sql = array();
         foreach ($new_extension as $key => $value) {
             if (is_numeric($value)) {
                 $sql[] = "{$key}={$value}";
             } else {
                 $sql[] = "{$key}='{$value}'";
             }
         }
         $sql = implode(",", $sql);
         $msg = splitOrderModel::insertExtension($table, $sql, $userId);
         if (!$msg) {
             self::$errCode = 614;
             self::$errMsg = "插入订单扩展信息失败!";
             BaseModel::rollback();
             return false;
         }
         //插入复制订单仓库信息
         if ($warehouse) {
             $new_warehouse = array();
             foreach ($warehouse as $key => $value) {
                 if ($key == 'omOrdeId') {
                     $new_warehouse[$key] = $id;
                     continue;
                 }
                 $new_warehouse[$key] = $value;
             }
             $sql = array();
             foreach ($new_warehouse as $key => $value) {
                 if (is_numeric($value)) {
                     $sql[] = "{$key}={$value}";
                 } else {
                     $sql[] = "{$key}='{$value}'";
                 }
             }
             $sql = implode(",", $sql);
             $msg = splitOrderModel::insertWarehouse($sql, $userId);
             if (!$msg) {
                 self::$errCode = 615;
                 self::$errMsg = "插入拆分订单仓库信息失败!";
                 BaseModel::rollback();
                 return false;
             }
         }
         //完全插入成功再插入拆分记录和订单操作记录
         $msg = splitOrderModel::insertSplitRecord($orderid, $id, $userId);
         if (!$msg) {
             self::$errCode = 616;
             self::$errMsg = "插入拆分订单记录失败!";
             BaseModel::rollback();
             return false;
         }
         //最后修改原订单为拆分订单订单
         $msg = splitOrderModel::updateOrder($orderid);
         if (!$msg) {
             self::$errCode = 617;
             self::$errMsg = "修改原订单失败!";
             BaseModel::rollback();
             return false;
         }
     }
     BaseModel::commit();
     return true;
 }
开发者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_copyOrder


//.........这里部分代码省略.........
         }
         $new_extension[$key] = $value;
     }
     $sql = array();
     foreach ($new_extension as $key => $value) {
         if (is_numeric($value)) {
             $sql[] = "{$key}={$value}";
         } else {
             $sql[] = "{$key}='{$value}'";
         }
     }
     $sql = implode(",", $sql);
     $msg = copyOrderModel::insertExtension($table, $sql, $userId);
     if (!$msg) {
         self::$errCode = 505;
         self::$errMsg = "插入复制订单扩展信息失败!";
         BaseModel::rollback();
         return false;
     }
     //插入复制订单仓库信息
     if ($warehouse) {
         $new_warehouse = array();
         foreach ($warehouse as $key => $value) {
             if ($key == 'omOrdeId') {
                 $new_warehouse[$key] = $id;
                 continue;
             }
             $new_warehouse[$key] = $value;
         }
         $sql = array();
         foreach ($new_warehouse as $key => $value) {
             if (is_numeric($value)) {
                 $sql[] = "{$key}={$value}";
             } else {
                 $sql[] = "{$key}='{$value}'";
             }
         }
         $sql = implode(",", $sql);
         $msg = copyOrderModel::insertWarehouse($sql, $userId);
         if (!$msg) {
             self::$errCode = 506;
             self::$errMsg = "插入复制订单仓库信息失败!";
             BaseModel::rollback();
             return false;
         }
     }
     //插入复制订单备注信息
     if ($notes) {
         $new_note = array();
         foreach ($notes as $key => $value) {
             if ($key == 'omOrdeId') {
                 $new_note[$key] = $id;
                 continue;
             }
             if ($key == 'userId') {
                 $new_note[$key] = $userId;
                 continue;
             }
             if ($key == 'createdTime') {
                 $new_note[$key] = time();
                 continue;
             }
             $new_note[$key] = $value;
         }
         $sql = array();
         foreach ($new_note as $key => $value) {
             if (is_numeric($value)) {
                 $sql[] = "{$key}={$value}";
             } else {
                 $sql[] = "{$key}='{$value}'";
             }
         }
         $sql = implode(",", $sql);
         $msg = copyOrderModel::insertNote($sql);
         if (!$msg) {
             self::$errCode = 506;
             self::$errMsg = "插入复制订单备注信息失败!";
             BaseModel::rollback();
             return false;
         }
     }
     //完全插入成功再插入复制记录和订单操作记录
     $msg = copyOrderModel::insertCopyRecord($orderid, $id, $userId);
     if (!$msg) {
         self::$errCode = 507;
         self::$errMsg = "插入复制订单记录失败!";
         BaseModel::rollback();
         return false;
     }
     //最后修改原订单为复制订单
     $msg = copyOrderModel::updateOrder($orderid);
     if (!$msg) {
         self::$errCode = 508;
         self::$errMsg = "修改原订单失败!";
         BaseModel::rollback();
         return false;
     }
     BaseModel::commit();
     return true;
 }
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:copyOrder.action.php

示例9: act_updateSpecialTMTCOn

 public function act_updateSpecialTMTCOn()
 {
     $id = $_POST['id'] ? trim($_POST['id']) : 0;
     $specialTransportManagerName = $_POST['specialTransportManagerName'] ? trim($_POST['specialTransportManagerName']) : '';
     $isOn = $_POST['isOn'] ? trim($_POST['isOn']) : '';
     //$canOrNot = $_POST['canOrNot'] ? (trim($_POST['canOrNot'])) : '';
     $transportIdArr = !empty($_POST['transportId']) ? $_POST['transportId'] : array();
     //选中的transportId数组
     //print_r($transportIdArr);exit;
     $tName = 'pc_special_transport_manager';
     $where = "WHERE id='{$id}'";
     $pspIsExist = OmAvailableModel::getTNameCount($tName, $where);
     if (!$pspIsExist) {
         $status = "记录不存在,错误";
         echo '<script language="javascript">
                     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();
//.........这里部分代码省略.........
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:spuSpecialProperty.action.php

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

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

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

示例13: insertAllOrderRow


//.........这里部分代码省略.........
         $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']);
         unset($buyerInfo['currency']);
         $insertBuyerInfo = self::insertBuyerInfoRow($buyerInfo);
         if (!$insertBuyerInfo) {
             BaseModel::rollback();
             //throw new Exception('insert BuyerInfo error');
         }
         $ProductStatus = new ProductStatus();
         if (!$ProductStatus->updateSkuStatusByOrderStatus(array($insertOrderDataRow))) {
             BaseModel::rollback();
             //throw new Exception('update puchaseinfo error');
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         return $insertOrderDataRow;
     } else {
         self::$errCode = "400";
         self::$errMsg = "已经包含订单信息,不能重复插入!";
         return false;
     }
 }
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:orderAdd.model.php

示例14: act_operateAbOrderAPI


//.........这里部分代码省略.........
         $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)) {
                 if (!OrderLogModel::insertOrderLog($_spitId, 'INSERT ORDER')) {
                     BaseModel::rollback();
                     self::$errCode = '001';
                     self::$errMsg = "插入订单日志失败!";
                     return false;
                 }
                 if (!OrderRecordModel::insertSpitRecords($orderId, $_spitId)) {
                     BaseModel::rollback();
                     self::$errCode = '002';
                     self::$errMsg = "插入拆分日志失败!";
                     return false;
                 }
             } else {
                 BaseModel::rollback();
                 self::$errCode = '010';
                 self::$errMsg = "插入订单信息失败!";
                 return false;
             }
             $returnStatus0 = array('isCopy' => 1, 'calcWeight' => $calcWeight);
             $rtn = $WarehouseAPIAct->act_operateAbOrder($invoiceids[$k], $calcWeight);
             if (!$rtn) {
                 BaseModel::rollback();
                 self::$errCode = '011';
                 self::$errMsg = "调用仓库系统拆分功能失败!";
                 return false;
             }
         } else {
             $returnStatus0 = array('orderStatus' => $insert_orderData['orderStatus'], 'orderType' => $insert_orderData['orderType']);
         }
         if (!OrderindexModel::updateOrder($tableName, $returnStatus0, $where)) {
             BaseModel::rollback();
             self::$errCode = '002';
             self::$errMsg = "订单移动到缺货异常失败!";
             return false;
         }
         BaseModel::commit();
         BaseModel::autoCommit();
     }
     self::$errCode = 200;
     self::$errMsg = '缺货拆分完成!';
     return true;
 }
开发者ID:ohjack,项目名称:newErp,代码行数:101,代码来源:abnormalStock.action.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::commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。