예제 #1
0
 function act_onSampleCoefficient($cName, $sampleTypeId)
 {
     //启动一个系数,在一个事务中
     try {
         TransactionBaseModel::begin();
         $set = "SET is_open=0 ";
         $where = "WHERE cName<>'{$cName}' and sampleTypeId='{$sampleTypeId}' ";
         //先将该sampleTypeID下cName<>$cName的is_open设为0
         $affectRow1 = SampleCoefficientModel::updateSampleCoefficient($set, $where);
         $set = "SET is_open=1 ";
         $where = "WHERE cName='{$cName}' and sampleTypeId='{$sampleTypeId}' ";
         //将该sampleTypeID下$cName设为1
         $affectRow2 = SampleCoefficientModel::updateSampleCoefficient($set, $where);
         if (!$affectRow2) {
             //如果is_open=1没有更新的话,则表示已经启动或找不到该记录
             throw new Exception('update error');
         }
         TransactionBaseModel::commit();
         TransactionBaseModel::autoCommit();
         return 1;
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         self::$errCode = "1101";
         self::$errMsg = $e;
         return 0;
     }
 }
예제 #2
0
 function act_updateDefectiveProducts($defectiveId, $infoId, $num, $note, $scrappedStatus)
 {
     //QC对不良品列表中进行对报废和内部处理
     //$scrappedStatus表示处理方向,1为报废,2为内部处理,3为待退回
     try {
         TransactionBaseModel::begin();
         $now = time();
         $select = 'startTime';
         $where = "WHERE id='{$defectiveId}'";
         $defectiveProductsList = DefectiveProductsModel::getDefectiveProductsList($select, $where);
         //修改记录前看是否是第一次插入
         $set = "SET processedNum=processedNum+'{$num}' ";
         if (empty($defectiveProductsList[0]['startTime'])) {
             //如果是第一次插入则加入首次处理时间
             $set .= ",startTime='{$now}' ";
         }
         DefectiveProductsModel::updateDefectiveProducts($set, $where);
         //先将该不良品记录的相关字段修改
         $select = 'spu,sku,defectiveNum,processedNum';
         $defectiveProductsList = DefectiveProductsModel::getDefectiveProductsList($select, $where);
         $spu = $defectiveProductsList[0]['spu'];
         $sku = $defectiveProductsList[0]['sku'];
         $defectiveNum = $defectiveProductsList[0]['defectiveNum'];
         //不良品记录的总数量
         $processedNum = $defectiveProductsList[0]['processedNum'];
         //已处理数量
         if ($scrappedStatus == 1 || $scrappedStatus == 2) {
             $set = "SET infoId='{$infoId}',spu='{$spu}',sku='{$sku}',scrappedNum='{$num}',processTypeId='{$scrappedStatus}',note='{$note}' ";
             ScrappedProductsModel::addScrappedProducts($set);
             //在报废,内部处理表中添加记录;
         } elseif ($scrappedStatus == 3) {
             $set = "SET infoId='{$infoId}',spu='{$spu}',sku='{$sku}',returnNum='{$num}',note='{$note}' ";
             ReturnProductsModel::addReturnProducts($set);
             //在退回表中表中添加记录;
         } else {
             throw new Exception("error status");
         }
         if ($defectiveNum == $processedNum) {
             //检测该不良品记录是否处理完成
             $set = "SET defectiveStatus='2',lastModified='{$now}' ";
             $where = "WHERE id='{$defectiveId}'";
             DefectiveProductsModel::updateDefectiveProducts($set, $where);
             //先将该不良品记录的相关字段修改
         }
         TransactionBaseModel::commit();
         TransactionBaseModel::autoCommit();
         return 1;
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         self::$errCode = '0000';
         self::$errMsg = $e;
         return 0;
     }
 }
예제 #3
0
 function act_addWhShipingOrderCAT()
 {
     global $memc_obj;
     //调用memcache获取sku信息
     $jsonArr = isset($_GET['jsonArr']) ? $_GET['jsonArr'] : '';
     //传过来的base64编码的json字符串(客户端要先json然后再base64))
     if (empty($jsonArr)) {
         self::$errCode = '0101';
         self::$errMsg = 'empty jsonArr';
         return 0;
     }
     $jsonArr = json_decode(base64_decode($jsonArr), true);
     //对base64及json解码
     if (!is_array($jsonArr)) {
         self::$errCode = '0201';
         self::$errMsg = 'error array';
         return 0;
     }
     if (!is_array($jsonArr['shipOrderDetail'])) {
         self::$errCode = '0301';
         self::$errMsg = 'shipOrderDetail error array';
         return 0;
     }
     try {
         TransactionBaseModel::begin();
         $originOrderId = $jsonArr['originOrderId'];
         //订单ID
         if (intval($originOrderId) == 0) {
             self::$errCode = '0401';
             self::$errMsg = 'error originOrderId';
             return 0;
         }
         $recordNumber = $jsonArr['recordNumber'];
         //订单记录各平台id号
         $shipOrderDetail = $jsonArr['shipOrderDetail'];
         //订单详细,为数组记录
         $username = $jsonArr['username'];
         //收件人
         $platformUsername = $jsonArr['platformUsername'];
         //对应平台的用户登陆名称,买家id
         $email = $jsonArr['email'];
         //客户邮箱
         $countryName = $jsonArr['countryName'];
         //收件人国家名称
         $countrySn = $jsonArr['countrySn'];
         //收件人国家简称
         $state = $jsonArr['state'];
         //收件人省份,州名
         $city = $jsonArr['city'];
         //收件人城市名称
         $street = $jsonArr['street'];
         //收件人街道
         $address2 = $jsonArr['address2'];
         //收件人地址2
         $address3 = $jsonArr['address3'];
         //收件人地址3
         $currency = $jsonArr['currency'];
         //币种
         $landline = $jsonArr['landline'];
         //座机
         $phone = $jsonArr['phone'];
         //手机
         $zipCode = $jsonArr['zipCode'];
         //邮政编码
         $transportId = $jsonArr['transportId'];
         //运输方式ID
         $accountId = $jsonArr['accountId'];
         //发货单对应销售账号
         $orderAttributes = $jsonArr['orderAttributes'];
         //发货单属性状态id,为数组
         if (empty($orderAttributes) || !is_array($orderAttributes)) {
             self::$errCode = '0501';
             self::$errMsg = 'error orderAttributes';
             return 0;
         }
         $pmId = $jsonArr['pmId'];
         //包装材料ID
         $isFixed = $jsonArr['isFixed'];
         //是否固定运输方式,默认2最优运输方式;1固定运输方式
         $total = $jsonArr['total'];
         //发货单总价值
         $channelId = $jsonArr['channelId'];
         //渠道ID
         $calcWeight = $jsonArr['calcWeight'];
         //估算重量,单位是kg
         $calcShipping = $jsonArr['calcShipping'];
         //估算运费
         $createdTime = $jsonArr['createdTime'] ? $jsonArr['createdTime'] : time();
         //添加时间
         $orderTypeId = $jsonArr['orderTypeId'] ? $jsonArr['orderTypeId'] : 1;
         //发货单类别,默认为1,发货单;2为配货单
         $companyId = $jsonArr['companyId'] ? $jsonArr['companyId'] : 1;
         //公司名称ID,默认赛维网络科技
         $storeId = $jsonArr['storeId'] ? $jsonArr['storeId'] : 1;
         //仓库ID,默认为1赛维网络深圳仓库
         $tName = 'wh_shipping_order';
         $set = "SET username='******',platformUsername='******',email='{$email}',countryName='{$countryName}',\n\t\t\t        countrySn='{$countrySn}',state='{$state}',city='{$city}',street='{$street}',address2='{$address2}',\n\t\t\t        address3='{$address3}',currency='{$currency}',landline='{$landline}',\n\t\t\t        phone='{$phone}',zipCode='{$zipCode}',transportId='{$transportId}',\n\t\t\t        accountId='{$accountId}',pmId='{$pmId}',\n\t\t\t        isFixed='{$isFixed}',total='{$total}',channelId='{$channelId}',\n\t\t\t        calcWeight='{$calcWeight}',calcShipping='{$calcShipping}',createdTime='{$createdTime}',\n\t\t\t        orderTypeId='{$orderTypeId}',companyId='{$companyId}',storeId='{$storeId}' ";
         $insertId = WhIoStoreModel::addTNameRow($tName, $set);
         if (!$insertId) {
             self::$errCode = '0801';
             self::$errMsg = 'addRow error';
             throw new Exception('add shipOrder error');
         }
         $shipOrderId = $insertId;
         //发货单ID
         foreach ($shipOrderDetail as $detail) {
             $sku = $detail['sku'];
             //sku
             $amount = $detail['amount'];
             //配货数量
             if (!preg_match("/^[A-Z0-9]+(_[A-Z0-9]+)*\$/", $sku) || intval($amount) == 0) {
                 self::$errCode = '0811';
                 self::$errMsg = 'sku or amount error';
                 throw new Exception('sku or amount error');
             }
             //echo 'sku == '.$sku.'<br/>';
             $storeId = $detail['storeId'] ? $detail['storeId'] : 1;
             //仓库ID,默认为1赛维网络深圳仓库
             //echo '$memc_obj====';
             //print_r($memc_obj);
             //echo'<br/>';
             $skuInfo = $memc_obj->get_extral("sku_info_" . $sku);
             //调用memcache取得对应单料号或组合料号的重量
             //echo '$skuInfo=======';
             //print_r($skuInfo);
             //echo'<br/>';
             if (empty($skuInfo)) {
                 self::$errCode = '0814';
                 self::$errMsg = 'empty skuInfo';
                 throw new Exception('skuInfo');
             }
             //				$ppp = $memc_obj->get_extral("pc_packing_material"); //调用memcache取得对应单料号或组合料号的重量
             //				//echo '$ppp=======';
             //				//print_r($ppp);
             //				//echo'<br/>';
             if (!empty($skuInfo['sku']) && is_array($skuInfo['sku'])) {
                 //为组合料号
                 foreach ($skuInfo['sku'] as $key => $value) {
                     //循环$skuInfo下的sku的键,找出所有真实料号及对应数量,$key为组合料号下对应的真实单料号,value为对应数量
                     if (!preg_match("/^[A-Z0-9]+(_[A-Z0-9]+)*\$/", $key) || intval($value) == 0) {
                         self::$errCode = '0812';
                         self::$errMsg = 'sku or amount error';
                         throw new Exception('sku or amount error');
                     }
                     $singSkuAmount = $value * $amount;
                     //echo '$key == '.$key.'<br/>';
                     //echo '$singSkuAmount == '.$singSkuAmount.'<br/>';
                     $tName = 'wh_shipping_orderdetail';
                     $set = "SET shipOrderId='{$shipOrderId}',combineSku='{$sku}',combineNum='{$amount}',sku='{$key}',\n\t\t\t\t\t\t        amount='{$singSkuAmount}',storeId='{$storeId}' ";
                     $insertDetailId = WhIoStoreModel::addTNameRow($tName, $set);
                     if (!$insertDetailId) {
                         self::$errCode = '0802';
                         self::$errMsg = 'add shipOrderDetail1 error';
                         throw new Exception('add shipOrderDetail1 error');
                     }
                 }
             } else {
                 $tName = 'wh_shipping_orderdetail';
                 $set = "SET shipOrderId='{$shipOrderId}',sku='{$sku}',\n\t\t\t\t\t        amount='{$amount}',storeId='{$storeId}' ";
                 $insertDetailId = WhIoStoreModel::addTNameRow($tName, $set);
                 //echo'++++++++++++++++++++++++++';
                 //echo '$insertDetailId========='.$insertDetailId.'<br/>';
                 if (!$insertDetailId) {
                     self::$errCode = '0822';
                     self::$errMsg = 'add shipOrderDetail2 error';
                     throw new Exception('add shipOrderDetail2 error');
                 }
             }
         }
         //插入发货单和属性关系表
         //echo '$orderAttributes=======';
         //print_r($orderAttributes);
         //echo'<br/>';
         $tName = 'wh_order_attributes_relation';
         foreach ($orderAttributes as $orderAttribute) {
             if ($orderAttribute != 1 && $orderAttribute != 2) {
                 self::$errCode = '0805';
                 self::$errMsg = 'orderAttribute error';
                 throw new Exception('orderAttribute error');
             }
             $set = "SET shippingOrderId='{$shipOrderId}',attributeId='{$orderAttribute}'";
             $insertARId = WhIoStoreModel::addTNameRow($tName, $set);
             //echo'++++++++++++++++++++++++++';
             //echo '$insertARId========='.$insertARId.'<br/>';
             if ($insertARId !== 0) {
                 self::$errCode = '0806';
                 self::$errMsg = 'add insertARId error';
                 throw new Exception('add insertARId error');
             }
         }
         //插入订单发货单关系表
         $tName = 'wh_shipping_order_relation';
         $set = "SET originOrderId='{$originOrderId}',shipOrderId='{$shipOrderId}',recordNumber='{$recordNumber}',storeId='{$storeId}' ";
         $insertRelationId = WhIoStoreModel::addTNameRow($tName, $set);
         if (!$insertRelationId) {
             self::$errCode = '0803';
             self::$errMsg = 'add relation error';
             throw new Exception('add relation error');
         }
         TransactionBaseModel::commit();
         TransactionBaseModel::autoCommit();
         self::$errCode = '222';
         self::$errMsg = "success";
         return 1;
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         TransactionBaseModel::autoCommit();
         self::$errCode = '404';
         self::$errMsg = $e->getMessage();
         return 0;
     }
 }
예제 #4
0
 function act_addWhRecManageDetail($jsonArr)
 {
     if (empty($jsonArr)) {
         self::$errCode = 0101;
         self::$errMsg = 'empty jsonArr';
         return 0;
     }
     if (!is_array($jsonArr)) {
         self::$errCode = 0201;
         self::$errMsg = 'error array';
         return 0;
     }
     $sku = $jsonArr['sku'];
     //sku
     $nums = $jsonArr['nums'];
     //到货数量
     $userId = $jsonArr['userId'];
     //添加人id
     $batchNum = $jsonArr['batchNum'];
     //到货批次
     $now = time();
     $flag = 0;
     //标识变量,用来判断是否要进行采购未订单;
     try {
         TransactionBaseModel::begin();
         if (empty($sku)) {
             //sku不能为空
             self::$errCode = 0101;
             self::$errMsg = 'empty sku';
             throw new Exception('empty sku');
         }
         if (empty($nums)) {
             //到货数量不能为空
             self::$errCode = 0201;
             self::$errMsg = 'empty nums';
             throw new Exception('empty nums');
         }
         if (intval($nums) == 0) {
             //数量不能为0
             self::$errCode = 0311;
             self::$errMsg = 'error nums';
             throw new Exception('error nums');
         }
         if (empty($userId)) {
             //操作人id不能为空
             self::$errCode = 0301;
             self::$errMsg = 'empty userId';
             throw new Exception('empty userId');
         }
         //            if (empty ($batchNum)) { //批次不能为空
         //				self :: $errCode = 0302;
         //				self :: $errMsg = 'empty $atchNum';
         //				throw new Exception('empty batchNum');
         //			}
         $tName = 'wh_receipt_management';
         $select = '*';
         $where = "WHERE reStatus=0 AND sku='{$sku}' ORDER BY createdTime";
         //reStatus为0,且sku符合的收货表记录
         $whRecManageList = WhRecManageModel::getTNameList($tName, $select, $where);
         if (empty($whRecManageList)) {
             //没有找到该sku对应的记录时,直接全部未订单
             self::$errCode = 222;
             self::$errMsg = 'success';
             $resupplyOrder = array();
             //采购未订单数组
             $resupplyOrder['sku'] = $sku;
             $resupplyOrder['nums'] = $nums;
             return $resupplyOrder;
         }
         $diffNums = $whRecManageList[0]['amount'] - $whRecManageList[0]['arrivedNums'];
         //该记录中能插入的最大到货数量
         if ($nums <= $diffNums) {
             //nums小于本条记录能支持的最大到货数量
             $tName = 'wh_receipt_management_details';
             $set = "SET rmId='{$whRecManageList[0]['id']}',nums='{$nums}',userId='{$userId}',batchNum='{$batchNum}',insertTime='{$now}'";
             $affectRowAdd = WhRecManageModel::addTNameRow($tName, $set);
             if (!$affectRowAdd) {
                 //未插入成功报错
                 self::$errCode = 0501;
                 self::$errMsg = 'affectRowAdd error';
                 throw new Exception('affectRowAdd error');
             }
             //同时更新匹配记录的字段,arrivedNums和reStatus
             $tName = 'wh_receipt_management';
             $set = "SET arrivedNums=arrivedNums+'{$nums}' ";
             if ($nums == $diffNums) {
                 $set .= ",reStatus=1 ";
             }
             $where = "WHERE id='{$whRecManageList[0]['id']}'";
             $affectRowUp = WhRecManageModel::updateTNameRow($tName, $set, $where);
             if (!$affectRowUp) {
                 //未插入成功报错
                 self::$errCode = 0501;
                 self::$errMsg = 'affectRowUp error';
                 throw new Exception('affectRowUp error');
             }
             $flag = 1;
         } else {
             //如果nums大于本条记录能支持的最大到货数量
             foreach ($whRecManageList as $value) {
                 $diffNums = $value['amount'] - $value['arrivedNums'];
                 //该记录中能插入的最大到货数量,此时第一次循环是,$num一定是>diffnums的
                 if ($nums <= $diffNums) {
                     //本次到货数量小于本条记录能支持的最大到货数量
                     $tName = 'wh_receipt_management_details';
                     $set = "SET rmId='{$value['id']}',nums='{$nums}',userId='{$userId}',batchNum='{$batchNum}',insertTime='{$now}'";
                     $affectRowAdd = WhRecManageModel::addTNameRow($tName, $set);
                     if (!$affectRowAdd) {
                         //未插入成功报错
                         self::$errCode = 0501;
                         self::$errMsg = 'affectRowAdd error';
                         throw new Exception('affectRowAdd error');
                     }
                     //同时更新匹配记录的字段,arrivedNums和reStatus
                     $tName = 'wh_receipt_management';
                     $set = "SET arrivedNums=arrivedNums+'{$nums}' ";
                     if ($nums == $diffNums) {
                         $set .= ",reStatus=1 ";
                     }
                     $where = "WHERE id='{$value['id']}'";
                     $affectRowUp = WhRecManageModel::updateTNameRow($tName, $set, $where);
                     if (!$affectRowUp) {
                         //未插入成功报错
                         self::$errCode = 0501;
                         self::$errMsg = 'affectRowUp error';
                         throw new Exception('affectRowUp error');
                     }
                     $flag = 1;
                     break;
                     //$nums <= $diffNums时,退出循环
                 } else {
                     //直接先将第一条匹配记录的最大差值填入
                     $tName = 'wh_receipt_management_details';
                     $set = "SET rmId='{$value['id']}',nums='{$diffNums}',userId='{$userId}',batchNum='{$batchNum}',insertTime='{$now}'";
                     $affectRowAdd = WhRecManageModel::addTNameRow($tName, $set);
                     if (!$affectRowAdd) {
                         //未插入成功报错
                         self::$errCode = 0501;
                         self::$errMsg = 'affectRowAdd error';
                         throw new Exception('affectRowAdd error');
                     }
                     //同时更新匹配记录的字段,arrivedNums和reStatus
                     $tName = 'wh_receipt_management';
                     $set = "SET arrivedNums=arrivedNums+'{$diffNums}',reStatus=1 ";
                     $where = "WHERE id='{$value['id']}'";
                     $affectRowUp = WhRecManageModel::updateTNameRow($tName, $set, $where);
                     if (!$affectRowUp) {
                         //未插入成功报错
                         self::$errCode = 0501;
                         self::$errMsg = 'affectRowUp error';
                         throw new Exception('affectRowUp error');
                     }
                     $nums = $nums - $diffNums;
                     //减去本次插入的数量,下次循环继续比对
                 }
             }
         }
         TransactionBaseModel::commit();
         TransactionBaseModel::autoCommit();
         if ($flag == 1) {
             //不需要采购未订单
             self::$errCode = 200;
             self::$errMsg = 'success';
             return 1;
         } else {
             //需要采购未订单
             self::$errCode = 222;
             self::$errMsg = 'success';
             $resupplyOrder = array();
             //采购未订单数组
             $resupplyOrder['sku'] = $sku;
             $resupplyOrder['nums'] = $nums;
             return $resupplyOrder;
         }
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         TransactionBaseModel::autoCommit();
         return 0;
     }
 }
예제 #5
0
 function act_apiUpdatePendingProducts($pendingId, $infoId, $pendingNum, $userId, $status)
 {
     //QC对待定列表中进行修改图片,正常回测,待退回(全部,不分部分)
     //$pendingProductsList表示待定表中的指定记录
     try {
         TransactionBaseModel::begin();
         $now = time();
         if ($status == 2) {
             //修改图片
             $set = "SET pendingStatus='2',auditId={$userId},processedNum='{$pendingNum}',lastModified='{$now}' ";
             //状态改为需要修改图片
             $where = "WHERE id='{$pendingId}'";
             PendingProductsModel::updatePendingProducts($set, $where);
             //先将该待定记录的相关字段修改
             //这里还要调用API在产品中心待修改列表中添加一条记录//
             //先略过,到时处理
         } else {
             if ($status == 5) {
                 //正常回测
                 $set = "SET pendingStatus='5',auditId={$userId},processedNum='{$pendingNum}',lastModified='{$now}' ";
                 //状态改为已处理pendingStatus='3'
                 if (empty($startTime)) {
                     //如果不是从修改完图片进行回测的话(即开始处理时间为空),要加上开始处理时间
                     $set .= ",startTime='{$now}' ";
                 }
                 $where = "WHERE id='{$pendingId}'";
                 //echo $set;
                 PendingProductsModel::updatePendingProducts($set, $where);
                 //先将该待定记录的相关字段修改
                 //这里还要在wh_sample_info中将$infoId这条记录的detectStatus状态改为1(待检测),pid=$pendingId
                 $select = 'id';
                 $where = "WHERE id='{$infoId}'";
                 $whInfoList = PendingProductsModel::getWhInfo($select, "WHERE id='{$infoId}'");
                 //取出wh_info表中关联pendingId的记录
                 if (empty($whInfoList)) {
                     //如果该infoid在whInfo中找不到记录的话
                     throw new Exception("error infoId");
                 }
                 $set = "set detectStatus='1',pid='{$pendingId}' ";
                 $affectRow = PendingProductsModel::updateWhInfo($set, $where);
                 //更新原来的wh_info表中的该记录
                 if ($affectRow != 1) {
                     //如果更新记录数不是唯一的,也报错
                     throw new Exception("update error");
                 }
             } else {
                 if ($status == 4) {
                     //待退回
                     $set = "SET pendingStatus='4',auditId={$userId},processedNum='{$pendingNum}',startTime='{$now}',lastModified='{$now}' ";
                     $where = "WHERE id='{$pendingId}'";
                     PendingProductsModel::updatePendingProducts($set, $where);
                     //先将该待定记录的相关字段修改
                     $note = '待定移至待退回';
                     $set = "SET infoId='{$infoId}',spu='{$spu}',sku='{$sku}',auditId={$userId},note='{$note}',returnNum='{$pendingNum}'";
                     ReturnProductsModel::addReturnProducts($set);
                     //在退回表中表中添加记录;
                 } else {
                     throw new Exception("error status");
                 }
             }
         }
         TransactionBaseModel::commit();
         TransactionBaseModel::autoCommit();
         return "申请成功";
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         self::$errCode = '0000';
         self::$errMsg = $e;
         return "申请失败";
     }
 }
예제 #6
0
 function act_operatePendingProducts()
 {
     //QC对待定列表中进行修改图片,正常回测,待退回(全部,不分部分)
     //$pendingId表示待定表中的记录ID,$status表示修改图片,正常回测或待退回
     try {
         $cTime1 = time() + microtime();
         $pendingId = isset($_GET['pendingId']) ? post_check($_GET['pendingId']) : '';
         $status = isset($_GET['status']) ? post_check($_GET['status']) : '';
         $tracktime = isset($_GET['tracktime']) ? post_check($_GET['tracktime']) : '';
         //echo $pendingId.'   '.$status;
         $select = '*';
         $where = "WHERE id='{$pendingId}'";
         $pendingProductsList = PendingProductsModel::getPendingProductsList($select, $where);
         if (empty($pendingProductsList)) {
             throw new Exception("error");
         }
         TransactionBaseModel::begin();
         $selectStatus = $pendingProductsList[0]['pendingStatus'];
         if ($selectStatus != 0 && $selectStatus != 2) {
             //如果该条待定记录中的状态不是0或2(待处理或者是图片修改完成时,报错)
             throw new Exception("error");
         }
         $startTime = $pendingProductsList[0]['startTime'];
         $pendingNum = $pendingProductsList[0]['pendingNum'];
         $pendingId = $pendingProductsList[0]['id'];
         $infoId = $pendingProductsList[0]['infoId'];
         // 			$spu = $pendingProductsList[0]['spu'];
         $sku = $pendingProductsList[0]['sku'];
         $now = time();
         if ($status == 1) {
             //修改图片
             $set = "SET pendingStatus='1',processedNum='{$pendingNum}',startTime='{$now}' ";
             //状态改为需要修改图片
             $where = "WHERE id='{$pendingId}'";
             PendingProductsModel::updatePendingProducts($set, $where);
             //先将该待定记录的相关字段修改
             //这里还要调用API在产品中心待修改列表中添加一条记录//
             //先略过,到时处理
         } elseif ($status == 2) {
             //正常回测
             $set = "SET pendingStatus='3',processedNum='{$pendingNum}',lastModified='{$now}' ";
             //状态改为已处理pendingStatus='3'
             if (empty($startTime)) {
                 //如果不是从修改完图片进行回测的话(即开始处理时间为空),要加上开始处理时间
                 $set .= ",startTime='{$now}' ";
             }
             $where = "WHERE id='{$pendingId}'";
             //echo $set;
             PendingProductsModel::updatePendingProducts($set, $where);
             //先将该待定记录的相关字段修改
             //这里还要在wh_sample_info中将$infoId这条记录的detectStatus状态改为1(待检测),pid=$pendingId
             $select = 'id';
             $where = "WHERE id='{$infoId}'";
             $whInfoList = PendingProductsModel::getWhInfo($select, "WHERE id='{$infoId}'");
             //取出wh_info表中关联pendingId的记录
             if (empty($whInfoList)) {
                 //如果该infoid在whInfo中找不到记录的话
                 throw new Exception("error infoId");
             }
             $set = "set detectStatus='1',pid='{$pendingId}' ";
             $affectRow = PendingProductsModel::updateWhInfo($set, $where);
             //更新原来的wh_info表中的该记录
             if ($affectRow != 1) {
                 //如果更新记录数不是唯一的,也报错
                 throw new Exception("update error");
             }
         } elseif ($status == 3) {
             //待退回
             $set = "SET pendingStatus='3',processedNum='{$pendingNum}',startTime='{$now}',lastModified='{$now}' ";
             $where = "WHERE id='{$pendingId}'";
             PendingProductsModel::updatePendingProducts($set, $where);
             //先将该待定记录的相关字段修改
             $note = '待定移至待退回';
             $set = "SET infoId='{$infoId}',sku='{$sku}',note='{$note}',returnNum='{$pendingNum}'";
             ReturnProductsModel::addReturnProducts($set);
             //在退回表中表中添加记录;
         } else {
             throw new Exception("error status");
         }
         TransactionBaseModel::commit();
         TransactionBaseModel::autoCommit();
         $cTime2 = time() + microtime();
         self::$errCode = $cTime2 . '    ' . $cTime1;
         self::$errMsg = 'Success';
         return 1;
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         $cTime2 = time() + microtime();
         self::$errCode = $cTime2 . '    ' . $cTime1;
         self::$errMsg = $e->getMessage();
         return 0;
     }
 }
예제 #7
0
 function act_updatePendingProducts($pendingProductsList, $status)
 {
     //QC对待定列表中进行修改图片,正常回测,待退回(全部,不分部分)
     //$pendingProductsList表示待定表中的指定记录
     try {
         TransactionBaseModel::begin();
         $selectStatus = $pendingProductsList[0]['pendingStatus'];
         if ($selectStatus != 0 && $selectStatus != 2) {
             //如果该条待定记录中的状态不是0或2(待处理或者是图片修改完成时,报错)
             throw new Exception("error");
         }
         $startTime = $pendingProductsList[0]['startTime'];
         $pendingNum = $pendingProductsList[0]['pendingNum'];
         $pendingId = $pendingProductsList[0]['id'];
         $infoId = $pendingProductsList[0]['infoId'];
         $spu = $pendingProductsList[0]['spu'];
         $sku = $pendingProductsList[0]['sku'];
         $now = time();
         if ($status == 1) {
             //修改图片
             $set = "SET pendingStatus='1',processedNum='{$pendingNum}',startTime='{$now}' ";
             //状态改为需要修改图片
             $where = "WHERE id='{$pendingId}'";
             PendingProductsModel::updatePendingProducts($set, $where);
             //先将该待定记录的相关字段修改
             //这里还要调用API在产品中心待修改列表中添加一条记录//
             //先略过,到时处理
         } elseif ($status == 2) {
             //正常回测
             $set = "SET pendingStatus='3',processedNum='{$pendingNum}',lastModified='{$now}' ";
             //状态改为已处理pendingStatus='3'
             if (empty($startTime)) {
                 //如果不是从修改完图片进行回测的话(即开始处理时间为空),要加上开始处理时间
                 $set .= ",startTime='{$now}' ";
             }
             $where = "WHERE id='{$pendingId}'";
             //echo $set;
             PendingProductsModel::updatePendingProducts($set, $where);
             //先将该待定记录的相关字段修改
             //这里还要在wh_sample_info中将$infoId这条记录的detectStatus状态改为3(检测完成)
             //同时在wh_sample_info中插入一条新记录,记录字段和$infoId一样,而且set pid='$pendingId'
             $select = '*';
             $where = "WHERE id='{$infoId}'";
             $whInfoList = PendingProductsModel::getWhInfo('*', "WHERE id='{$infoId}'");
             //取出wh_info表中关联pendingId的记录
             if (empty($whInfoList)) {
                 //如果该infoid在whInfo中找不到记录的话
                 throw new Exception("error infoId");
             }
             $set = "set detectStatus='3' ";
             $affectRow = PendingProductsModel::updateWhInfo($set, $where);
             //更新原来的wh_info表中的该记录
             if ($affectRow != 1) {
                 //如果更新记录数不是唯一的,也报错
                 throw new Exception("update error");
             }
             $sku = $whInfoList[0]['sku'];
             $num = $whInfoList[0]['num'];
             $printerId = $whInfoList[0]['printerId'];
             $printTime = $whInfoList[0]['printTime'];
             $getUserId = $whInfoList[0]['getUserId'];
             $getTime = $whInfoList[0]['getTime'];
             $detectorId = $whInfoList[0]['detectorId'];
             $detectStartTime = time();
             $detectStatus = 2;
             $pid = $pendingId;
             $purchaseId = $whInfoList[0]['purchaseId'];
             $sellerId = $whInfoList[0]['sellerId'];
             $typeId = $whInfoList[0]['typeId'];
             $ichibanNum = $whInfoList[0]['ichibanNum'];
             $set = "SET sku='{$sku}',num='{$num}',printerId='{$printerId}',printTime='{$printTime}',getUserId='{$getUserId}',getTime='{$getTime}',detectorId='{$detectorId}',detectStartTime='{$detectStartTime}',detectStatus='{$detectStatus}',pid='{$pid}',purchaseId='{$purchaseId}',sellerId='{$sellerId}',typeId='{$typeId}',ichibanNum='{$ichibanNum}' ";
             $affectRow = PendingProductsModel::addgetWhInfo($set);
             //待定审核后回测,将新记录插入wh_info表中,pid='$pendingId'
             if (!$affectRow) {
                 //插入数据失败时
                 throw new Exception("add WhInfo error");
             }
         } elseif ($status == 3) {
             //待退回
             $set = "SET pendingStatus='3',processedNum='{$pendingNum}',startTime='{$now}',lastModified='{$now}' ";
             $where = "WHERE id='{$pendingId}'";
             PendingProductsModel::updatePendingProducts($set, $where);
             //先将该待定记录的相关字段修改
             $note = '待定移至待退回';
             $set = "SET infoId='{$infoId}',spu='{$spu}',sku='{$sku}',note='{$note}',returnNum='{$pendingNum}'";
             ReturnProductsModel::addReturnProducts($set);
             //在退回表中表中添加记录;
         } else {
             throw new Exception("error status");
         }
         TransactionBaseModel::commit();
         TransactionBaseModel::autoCommit();
         return 1;
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         self::$errCode = '0000';
         self::$errMsg = $e;
         return 0;
     }
 }
예제 #8
0
 function act_auditIoStore()
 {
     $ordersn = isset($_GET['ordersn']) ? $_GET['ordersn'] : '';
     //单据编码
     $auditStatus = isset($_GET['auditStatus']) ? $_GET['auditStatus'] : '';
     //审核状态,1为通过,2为不通过
     $auditorId = isset($_GET['auditorId']) ? $_GET['auditorId'] : '';
     //审核人id
     $now = time();
     //当前时间
     if (empty($ordersn)) {
         self::$errCode = 0201;
         self::$errMsg = 'empty ordersn';
         return 3;
     }
     if (intval($auditStatus) != 1 && intval($auditStatus) != 2) {
         self::$errCode = 0201;
         self::$errMsg = 'error auditStatus';
         return 5;
     }
     if (intval($auditorId) == 0) {
         self::$errCode = 0201;
         self::$errMsg = 'error auditorId';
         return 6;
     }
     //根据ordersn取出对应的invoiceTypeId,storeId
     $tName = 'wh_iostore';
     $select = 'invoiceTypeId,storeId';
     $where = "WHERE is_delete=0 AND ordersn='{$ordersn}'";
     $whIostoreList = WhAuditModel::getTNameList($tName, $select, $where);
     if (empty($whIostoreList)) {
         //ioStore表中不存在ordersn这条记录
         self::$errCode = 0201;
         self::$errMsg = 'empty whIostoreList';
         return 7;
     }
     $invoiceTypeId = $whIostoreList[0]['invoiceTypeId'];
     //出入库单据类型
     $storeId = $whIostoreList[0]['storeId'];
     //仓库id
     try {
         TransactionBaseModel::begin();
         $nowInsertALevel = 0;
         //定义一个变量用来存放本次插入的审核等级
         $whARByOrdersn = WhAuditModel::getAuditRecordsByOrdersn($ordersn);
         //根据ordersn在records表中查找出最大id,其最大id所在的auditrelationId所关联的auditlevel就是该ordersn已经存在的最大审核级别记录
         if (empty($whARByOrdersn)) {
             //如果$whARByOrdersn为空,则表示records表中没有该ordersn的记录,
             $minALevel = WhAuditModel::getMinALevelByIS($invoiceTypeId, $storeId);
             //取出list表中invoiceTypeId,storeId下已经开启的最小的auditLevel
             if (empty($minALevel)) {
                 //如果$minALevel为空,表示list表中不存在开启的$invoiceTypeId,$storeId的记录
                 self::$errCode = 0201;
                 self::$errMsg = 'empty minALevel';
                 return 8;
             }
             $whWillInsertAid = WhAuditModel::getALIdByAA($invoiceTypeId, $storeId, $minALevel, $auditorId);
             //取得invoiceTypeId,storeId下和本次auditorId匹配的最小level的list中的id
             if (empty($whWillInsertAid)) {
                 //如果$whWillInsertAid为空,表示该最小的level没有和auditor有对应的关系,可能是不存在这条审核类型记录或者是审核人无权限,或者是审核类型记录被禁用了
                 self::$errCode = 0201;
                 self::$errMsg = 'empty whWillInsertAid';
                 return 9;
             }
             $tName = 'wh_audit_records';
             $set = "SET ordersn='{$ordersn}',auditRelationId='{$whWillInsertAid}',auditStatus='{$auditStatus}',auditTime='{$now}'";
             $affectRow = WhAuditModel::addTNameRow($tName, $set);
             if (!$affectRow) {
                 //插入错误或者是影响记录数为0时抛出异常
                 throw new Exception('add error');
             }
             $nowInsertALevel = $minALevel;
             //本次插入的审核等级
         } else {
             //如果$whARByOrdersn不为空,则表示records表中有该ordersn的记录,此时需要找出记录中最大的auditlevel
             $whARAidsArray = array();
             //定义一个数组存放$whARByOrdersn中的auditRelationId
             foreach ($whARByOrdersn as $value) {
                 $whARAidsArray[] = $value['auditRelationId'];
             }
             $whARAidsString = implode(',', $whARAidsArray);
             //将$whARAidsArray转化成id1,id2,id3形式的字符串
             $maxALevel = WhAuditModel::getMaxLevelByAIds($whARAidsString);
             //查找出$whARAidsString中auditLevel最大的
             if (empty($maxALevel)) {
                 //如果为空,表示$whARAidsString中在list中都没有已经开启的记录,可能是全被人禁用了
                 self::$errCode = 0201;
                 self::$errMsg = 'empty maxALevel';
                 return 10;
             }
             $whNextALevel = WhAuditModel::getNextLevelByISL($invoiceTypeId, $storeId, $maxALevel);
             //根据当前最大的auditLevel取得下一个auditLevel的值
             if (empty($whNextALevel)) {
                 //如果$whNextALevel为空,表示当前record表中最大的审核等级已经是list中最大的审核等级,不存在下一级审核了
                 self::$errCode = 0201;
                 self::$errMsg = 'empty whNextALevel';
                 return 11;
             }
             $whWillInsertAid = WhAuditModel::getALIdByAA($invoiceTypeId, $storeId, $whNextALevel, $auditorId);
             //查找本次要插入records表记录的auditRelationId
             if (empty($whWillInsertAid)) {
                 //$whWillInsertAid为空,表示$auditorId不存在该开启的这条记录中
                 self::$errCode = 0201;
                 self::$errMsg = 'empty whWillInsertAid';
                 return 12;
             }
             $tName = 'wh_audit_records';
             $set = "SET ordersn='{$ordersn}',auditRelationId='{$whWillInsertAid}',auditStatus='{$auditStatus}',auditTime='{$now}'";
             $affectRow = WhAuditModel::addTNameRow($tName, $set);
             if (!$affectRow) {
                 throw new Exception('add error2');
             }
             $nowInsertALevel = $whNextALevel;
             //本次要插入的审核等级
         }
         if ($auditStatus == 2) {
             //如果本次审核结果为不通过时,反些iostore表中该ordersn的ioStatus为不通过,和endTime
             $tName = 'wh_iostore';
             $set = "SET ioStatus='3',endTime='{$now}',operatorId='{$auditorId}' ";
             $where = "WHERE ordersn='{$ordersn}' AND is_delete=0";
             $affectRow = WhAuditModel::updateTNameRow($tName, $set, $where);
             if (!$affectRow) {
                 throw new Exception('update error1');
             }
         } else {
             //如果审核为通过时,要判断本次审核是不是最后一次审核,如果是最后一次审核,则要反写ioStatus中的值
             if ($nowInsertALevel == 0) {
                 //如果$nowInsertALevel为0,表示程序异常
                 self::$errCode = 0201;
                 self::$errMsg = 'empty $nowInsertALevel';
                 return 13;
             }
             $whNextALevel = WhAuditModel::getNextLevelByISL($invoiceTypeId, $storeId, $nowInsertALevel);
             //本次审核等级的下次审核等级
             if (empty($whNextALevel)) {
                 //如果$whNextALevel为空,表示没有下一级审核,该次审核为最后一次审核,此时要反写ioStatus等信息
                 $tName = 'wh_iostore';
                 if ($auditStatus == 1) {
                     $ioStatus = 2;
                 } else {
                     $ioStatus = 3;
                 }
                 $set = "SET ioStatus='{$ioStatus}',endTime='{$now}',operatorId='{$auditorId}' ";
                 $where = "WHERE ordersn='{$ordersn}' AND is_delete=0";
                 $affectRow = WhAuditModel::updateTNameRow($tName, $set, $where);
                 if (!$affectRow) {
                     throw new Exception('update error2');
                 }
                 if ($auditStatus == 1) {
                     //如果是最后一级审核,并且审核通过的话,添加出入库记录及加减库存
                     $ioTypeList = WhAuditModel::getIoTypeById($invoiceTypeId);
                     //根据id查出invoiceType表中的ioType和ioTypeId
                     if (empty($ioTypeList)) {
                         //如果没找到对应的ioTypeId,和ioType,则抛出异常
                         throw new Exception('empty ioTypeList');
                     }
                     $ioType = $ioTypeList['ioType'];
                     $ioTypeId = $ioTypeList['ioTypeId'];
                     $whIoRecordsAct = new WhIoRecordsAct();
                     //库方法中
                     $ioType = $ioType == 0 ? 1 : 2;
                     //在act_addIoRecoresForWh中inType为1表示出库,2表示入库
                     $iostoreId = WhAuditModel::getIdByOrdersn($ordersn);
                     //取得ordersn所在的iostoreId
                     $tName = 'wh_iostoredetail';
                     $select = '*';
                     $where = "WHERE is_delete=0 AND iostoreId='{$iostoreId}'";
                     $iostoreDetailList = WhAuditModel::getTNameList($tName, $select, $where);
                     if (empty($iostoreDetailList)) {
                         throw new Exception('empty iostoreDetailList');
                     }
                     foreach ($iostoreDetailList as $value) {
                         //进行出入库记录和添加库存操作
                         $sku = $value['sku'];
                         $amount = $value['amount'];
                         $purchaseId = $value['purchaseId'];
                         $userId = $auditorId;
                         if (empty($ordersn)) {
                             self::$errCode = '0301';
                             self::$errMsg = 'empty ordersn';
                             return 0;
                         }
                         if (empty($sku)) {
                             self::$errCode = '0401';
                             self::$errMsg = 'sku';
                             return 0;
                         }
                         if (empty($amount)) {
                             self::$errCode = '0501';
                             self::$errMsg = 'empty amount';
                             return 0;
                         }
                         if (empty($purchaseId)) {
                             self::$errCode = '0601';
                             self::$errMsg = 'empty purchaseId';
                             return 0;
                         }
                         if (empty($ioType)) {
                             self::$errCode = '0701';
                             self::$errMsg = '';
                             return 0;
                         }
                         if (empty($ioTypeId)) {
                             self::$errCode = '0801';
                             self::$errMsg = 'empty ioTypeId';
                             return 0;
                         }
                         if (empty($userId)) {
                             self::$errCode = '0901';
                             self::$errMsg = 'empty userId';
                             return 0;
                         }
                         if (empty($storeId)) {
                             self::$errCode = '1001';
                             self::$errMsg = 'emptyOrError storeId';
                             return 0;
                         }
                         if ($ioType != 1 && $ioType != 2) {
                             self::$errCode = '1101';
                             self::$errMsg = 'error ioType';
                             return 0;
                         }
                         $tName = 'wh_iorecords';
                         $set = "SET ordersn='{$ordersn}',sku='{$sku}',amount='{$amount}',purchaseId='{$purchaseId}',ioType='{$ioType}',ioTypeId='{$ioTypeId}',userId='{$userId}',reason='{$reason}',createdTime='{$now}',storeId='{$storeId}'";
                         $ret = WhIoRecordsModel::addTNameRow($tName, $set);
                         //添加入库记录
                         if ($ret) {
                             $tName = 'wh_sku_location';
                             if ($ioType == 1) {
                                 $amount = -1 * $amount;
                             }
                             $set = "SET actualStock=actualStock+{$amount}";
                             $where = "WHERE sku='{$sku}' AND storeId='{$storeId}'";
                             $affectRow = WhIoRecordsModel::updateTNameRow($tName, $set, $where);
                             //库存变化
                             if (!$affectRow) {
                                 throw new Exception('');
                             }
                         } else {
                             throw new Exception('');
                         }
                     }
                 }
             }
         }
         TransactionBaseModel::commit();
         TransactionBaseModel::autoCommit();
         self::$errCode = 200;
         self::$errMsg = 'success';
         return 200;
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         TransactionBaseModel::autoCommit();
         return 404;
     }
 }
예제 #9
0
 function act_addIoRecores()
 {
     $paraArr = isset($_GET['paraArr']) ? $_GET['paraArr'] : '';
     //参数base64,json数组,具体键如下,
     try {
         TransactionBaseModel::begin();
         if (empty($paraArr)) {
             self::$errCode = '0101';
             self::$errMsg = 'empty paraArr';
             throw new Exception('');
         }
         $paraArr = json_decode(base64_decode($paraArr), true);
         //对base64及json解码
         if (!is_array($paraArr)) {
             self::$errCode = '0201';
             self::$errMsg = 'is not array';
             throw new Exception('');
         }
         $ordersn = $paraArr['ordersn'];
         //发货单号或者是单据的ordersn
         $sku = $paraArr['sku'];
         //sku
         $amount = $paraArr['amount'];
         //数量
         $purchaseId = $paraArr['purchaseId'];
         //采购员id
         $ioType = $paraArr['ioType'];
         //出/入库,1为出库,2为入库
         $ioTypeId = $paraArr['ioTypeId'];
         //出入库类型id,即出入库类型表中对应的id
         $userId = $paraArr['userId'];
         //添加人id
         $reason = isset($paraArr['reason']) ? $paraArr['reason'] : '';
         //原因
         $storeId = isset($paraArr['storeId']) ? intval($paraArr['storeId']) : 1;
         $createdTime = time();
         $tName = 'wh_iorecords';
         if (empty($ordersn)) {
             self::$errCode = '0301';
             self::$errMsg = 'empty ordersn';
             throw new Exception('');
         }
         if (empty($sku)) {
             self::$errCode = '0401';
             self::$errMsg = 'sku';
             throw new Exception('');
         }
         if (empty($amount)) {
             self::$errCode = '0501';
             self::$errMsg = 'empty amount';
             throw new Exception('');
         }
         if (empty($purchaseId)) {
             self::$errCode = '0601';
             self::$errMsg = 'empty purchaseId';
             throw new Exception('');
         }
         if (empty($ioType)) {
             self::$errCode = '0701';
             self::$errMsg = '';
             throw new Exception('');
         }
         if (empty($ioTypeId)) {
             self::$errCode = '0801';
             self::$errMsg = 'empty ioTypeId';
             throw new Exception('');
         }
         if (empty($userId)) {
             self::$errCode = '0901';
             self::$errMsg = 'empty userId';
             throw new Exception('');
         }
         if (empty($storeId)) {
             self::$errCode = '1001';
             self::$errMsg = 'emptyOrError storeId';
             throw new Exception('');
         }
         if ($ioType != 1 && $ioType != 2) {
             self::$errCode = '1101';
             self::$errMsg = 'error ioType';
             throw new Exception('');
         }
         $set = "SET ordersn='{$ordersn}',sku='{$sku}',amount='{$amount}',purchaseId='{$purchaseId}',ioType='{$ioType}',ioTypeId='{$ioTypeId}',userId='{$userId}',reason='{$reason}',createdTime='{$createTime}',storeId='{$storeId}'";
         $ret = WhIoRecordsModel::addTNameRow($tName, $set);
         //添加入库记录
         if ($ret) {
             $tName = 'wh_sku_location';
             if ($ioType == 1) {
                 $amount = -1 * $amount;
             }
             $set = "SET actualStock=actualStock+{$amount}";
             $where = "WHERE sku='{$sku}' AND storeId='{$storeId}'";
             $affectRow = WhIoRecordsModel::updateTNameRow($tName, $set, $where);
             if ($affectRow) {
                 self::$errCode = '200';
                 self::$errMsg = 'success';
                 TransactionBaseModel::commit();
                 TransactionBaseModel::autoCommit();
                 return 1;
             } else {
                 self::$errCode = '1201';
                 //库存加减错误
                 self::$errMsg = 'addAmount error';
                 throw new Exception('');
             }
         } else {
             self::$errCode = '1301';
             //添加记录错误
             self::$errMsg = 'addRecords error';
             throw new Exception('');
         }
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         TransactionBaseModel::autoCommit();
         return 0;
     }
 }
예제 #10
0
 function act_deleteWhIoStore()
 {
     $iostoreId = isset($_GET['iostoreId']) ? $_GET['iostoreId'] : '';
     //传过来的base64编码的json字符串
     try {
         TransactionBaseModel::begin();
         //开始事务
         if (empty($iostoreId)) {
             //如果iostoreId为空,则抛出异常
             self::$errCode = 0101;
             self::$errMsg = 'empty iostoreId';
             throw new Exception('empty iostoreId');
         }
         $tName = 'wh_iostore';
         $set = "SET is_delete=1 ";
         $where = "WHERE id='{$iostoreId}' ";
         $affectRows = WhIoStoreModel::updateTNameRow($tName, $set, $where);
         //将ioStore表记录标记为删除,is_delete=1
         if (!$affectRows) {
             //执行错误或者affectedRows为0则抛出异常
             self::$errCode = 0201;
             self::$errMsg = 'deleteRow error';
             throw new Exception('deleteRow error');
         }
         $tName = 'wh_iostoredetail';
         $where = "WHERE iostoreId='{$iostoreId}' ";
         $affectRowsDetail = WhIoStoreModel::updateTNameRow($tName, $set, $where);
         //对应iostoreId的iostoredetail表中也标记删除对应记录
         if ($affectRowsDetail === false) {
             //执行错误则抛出异常(不包括影响记录为0的情况)
             self::$errCode = 0301;
             self::$errMsg = 'deleteDetailRow error';
             throw new Exception('deleteDetailRow error');
         }
         TransactionBaseModel::commit();
         //执行
         TransactionBaseModel::autoCommit();
         //重新设置事务为自动提交
         self::$errCode = 200;
         self::$errMsg = 'success';
         return 1;
         //返回正确
     } catch (Exception $e) {
         TransactionBaseModel::rollback();
         //回滚
         TransactionBaseModel::autoCommit();
         return 0;
     }
 }