Esempio n. 1
0
 function act_updateCostAndAddHistory()
 {
     $sku = $_GET['sku'] ? post_check(trim($_GET['sku'])) : '';
     //sku
     $purchaseCost = $_GET['purchaseCost'] ? post_check(trim($_GET['purchaseCost'])) : 0;
     //成本
     $addUserId = $_GET['addUserId'] ? post_check(trim($_GET['addUserId'])) : 0;
     //添加人
     $addTime = time();
     if (empty($sku)) {
         self::$errCode = '101';
         self::$errMsg = 'sku为空';
         return false;
     }
     if (!is_numeric($purchaseCost) || $purchaseCost <= 0) {
         self::$errCode = '102';
         self::$errMsg = '成本必须大于0';
         return false;
     }
     if (intval($addUserId) <= 0) {
         self::$errCode = '103';
         self::$errMsg = '添加人id不合法';
         return false;
     }
     $tName = 'pc_goods';
     $select = '*';
     $where = "WHERE sku='{$sku}' and is_delete=0";
     $skuList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($skuList)) {
         self::$errCode = '104';
         self::$errMsg = "找不到 {$sku} 料号";
         return false;
     }
     try {
         BaseModel::begin();
         //先更新goods表中对应sku的goodsCost
         $set = "SET goodsCost='{$purchaseCost}'";
         OmAvailableModel::updateTNameRow($tName, $set, $where);
         //然后再历史记录表中添加一条记录
         $tName = 'pc_goods_cost_history_record';
         $set = "SET sku='{$sku}',purchaseCost='{$purchaseCost}',addUserId='{$addUserId}',addTime='{$addTime}'";
         OmAvailableModel::addTNameRow($tName, $set);
         //更新mem中的sku
         $key = 'pc_goods_' . $sku;
         $value = $skuList[0];
         $value['goodsCost'] = $purchaseCost;
         setMemNewByKey($key, $value);
         //这里不保证能添加成功
         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;
     }
 }
Esempio n. 2
0
 public function view_addCombineOn()
 {
     $combineSpu = $_POST['combineSpu'] ? post_check(trim($_POST['combineSpu'])) : '';
     if (empty($combineSpu)) {
         $status = "空的SPU";
         echo '<script language="javascript">
                 alert("' . $status . '");      
               </script>';
         exit;
     }
     if (intval($_SESSION['userId']) <= 0) {
         $status = "登陆超时!";
         echo '<script language="javascript">
                 alert("' . $status . '");      
               </script>';
         exit;
     }
     $tName = 'pc_auto_create_spu';
     $select = 'status';
     $where = "WHERE spu='{$combineSpu}' and is_delete=0";
     $autoSpuList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($autoSpuList)) {
         $status = "自动生成SPU列表中不存在 {$combineSpu}";
         echo '<script language="javascript">
                 alert("' . $status . '");      
               </script>';
         exit;
     }
     $amount = $_POST['amount'] ? post_check(trim($_POST['amount'])) : 0;
     $amount = intval($amount);
     if ($amount <= 0 || $amount > 500) {
         $status = "数量必须在1-500之间";
         echo '<script language="javascript">
                 alert("' . $status . '");      
               </script>';
         exit;
     }
     $tName = 'pc_goods_combine';
     $where = "WHERE is_delete=0 AND combineSpu='{$combineSpu}'";
     $countComSpu = OmAvailableModel::getTNameCount($tName, $where);
     $tmpArr = array();
     for ($index = 0; $index <= $amount; $index++) {
         $combineSku = $_POST['combineSku' . $index] ? post_check(trim($_POST['combineSku' . $index])) : '';
         $combineSku = $combineSpu . $combineSku;
         if ($index == 0 && $countComSpu > 0 && $combineSku == $combineSpu) {
             $status = "存在为空的子料号,请检查!";
             echo '<script language="javascript">
                     alert("' . $status . '");      
                   </script>';
             exit;
         }
         if ($index > 0 && $combineSku == $combineSpu) {
             //只可能index=0时候,$combineSku==$combineSpu,其他表示无效
             continue;
         }
         $combineLength = $_POST['combineLength' . $index] ? post_check(trim($_POST['combineLength' . $index])) : '';
         $combineWidth = $_POST['combineWidth' . $index] ? post_check(trim($_POST['combineWidth' . $index])) : '';
         $combineHeight = $_POST['combineHeight' . $index] ? post_check(trim($_POST['combineHeight' . $index])) : '';
         $combineNote = $_POST['combineNote' . $index] ? trim($_POST['combineNote' . $index]) : '';
         $skuArr = $_POST['sku' . $index];
         $countArr = $_POST['count' . $index];
         if (strlen($combineSku) > 30) {
             $status = "{$combineSku} 字符长度大于30,错误!";
             echo '<script language="javascript">
                     alert("' . $status . '");      
                   </script>';
             exit;
         }
         if (!preg_match("/^{$combineSpu}(_[A-Z0-9]+)*\$/", $combineSku)) {
             $status = "{$combineSku} 不规范,请检查格式是否正确";
             echo '<script language="javascript">
                     alert("' . $status . '");      
                   </script>';
             exit;
         }
         if ($combineSku == $combineSpu && $amount > 1) {
             $status = "存在SKU为空的参数";
             echo '<script language="javascript">
                     alert("' . $status . '");
                   </script>';
             exit;
         }
         $tmpArr[] = $combineSku;
         if (!empty($combineLength)) {
             if (!is_numeric($combineLength) || $combineLength < 0) {
                 $status = "{$combineSku} 长度必须为数字";
                 echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
                 exit;
             }
         }
         if (!empty($combineWidth)) {
             if (!is_numeric($combineWidth) || $combineWidth < 0) {
                 $status = "{$combineSku} 宽度必须为数字";
                 echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
                 exit;
             }
         }
         if (!empty($combineHeight)) {
             if (!is_numeric($combineHeight) || $combineHeight < 0) {
                 $status = "{$combineSku} 高度必须为数字";
                 echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
                 exit;
             }
         }
         if (empty($skuArr[0]) || empty($countArr[0])) {
             $status = "{$combineSku} 至少要包含一条不为空的真实料号对应记录";
             echo '<script language="javascript">
                     alert("' . $status . '");
                   </script>';
             exit;
         }
         $tName = 'pc_goods_combine';
         $where = "WHERE combineSku='{$combineSku}' and is_delete=0";
         $count = OmAvailableModel::getTNameCount($tName, $where);
         if ($count) {
             $status = "{$combineSku} 已经存在";
             echo '<script language="javascript">
                     alert("' . $status . '");
                   </script>';
             exit;
         }
         if (count($skuArr) != count(array_unique($skuArr))) {
             $status = "{$combineSku} 中存在重复的真实料号,请检查";
             echo '<script language="javascript">
                     alert("' . $status . '");
                   </script>';
             exit;
         }
         $tName = 'pc_goods';
         foreach ($skuArr as $value) {
             if (!empty($value)) {
                 $where = "WHERE sku='{$value}' and is_delete=0";
                 $count = OmAvailableModel::getTNameCount($tName, $where);
                 if (!$count) {
                     $status = "{$combineSku} 真实料号 {$value} 不存在";
                     echo '<script language="javascript">
                             alert("' . $status . '");
                           </script>';
                     exit;
                 }
             }
         }
         foreach ($countArr as $value) {
             if (intval($value) <= 0) {
                 $status = "{$combineSku} 对应真实料号的数量有误";
                 echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
                 exit;
             }
         }
     }
     $tmpArr = array_filter($tmpArr);
     if (count($tmpArr) != count(array_unique($tmpArr))) {
         $status = "存在重复的虚拟子料号,请检查!";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
         exit;
     }
     try {
         $ebayGoodsArr = array();
         //同步数据数组
         BaseModel::begin();
         for ($index = 0; $index <= $amount; $index++) {
             $combineSku = $_POST['combineSku' . $index] ? post_check(trim($_POST['combineSku' . $index])) : '';
             $combineSku = $combineSpu . $combineSku;
             if ($index > 0 && $combineSku == $combineSpu) {
                 //只可能index=0时候,$combineSku==$combineSpu,其他表示无效
                 continue;
             }
             $combineLength = $_POST['combineLength' . $index] ? post_check(trim($_POST['combineLength' . $index])) : '';
             $combineWidth = $_POST['combineWidth' . $index] ? post_check(trim($_POST['combineWidth' . $index])) : '';
             $combineHeight = $_POST['combineHeight' . $index] ? post_check(trim($_POST['combineHeight' . $index])) : '';
             $combineNote = $_POST['combineNote' . $index] ? trim($_POST['combineNote' . $index]) : '';
             $skuArr = $_POST['sku' . $index];
             $countArr = $_POST['count' . $index];
             $dataCom = array();
             $dataCom['combineSpu'] = $combineSpu;
             $dataCom['combineSku'] = $combineSku;
             $dataCom['combineCost'] = $combineCost;
             $dataCom['combineWeight'] = $combineWeight;
             $dataCom['combineLength'] = $combineLength;
             $dataCom['combineWidth'] = $combineWidth;
             $dataCom['combineHeight'] = $combineHeight;
             $dataCom['combineNote'] = $combineNote;
             $dataCom['combineUserId'] = $_SESSION['userId'];
             $dataCom['addTime'] = time();
             $tName = 'pc_goods_combine';
             $insertIdCom = OmAvailableModel::addTNameRow2arr($tName, $dataCom);
             if (!$insertIdCom) {
                 throw new Exception('add combine error');
             }
             $dataRelation = array();
             $dataRelationMem = array();
             for ($i = 0; $i < count($skuArr); $i++) {
                 if (!empty($skuArr[$i]) && !empty($countArr[$i])) {
                     $dataRelation[] = array('combineSku' => $combineSku, 'sku' => $skuArr[$i], 'count' => $countArr[$i]);
                     $dataRelationMem[] = array('sku' => $skuArr[$i], 'count' => $countArr[$i]);
                 }
             }
             if (!empty($dataRelation)) {
                 $tName = 'pc_sku_combine_relation';
                 $where = "WHERE combineSku='{$combineSku}'";
                 $dataRelationCount = OmAvailableModel::getTNameCount($tName, $where);
                 if ($dataRelationCount) {
                     OmAvailableModel::deleteTNameRow($tName, $where);
                 }
                 foreach ($dataRelation as $value) {
                     if (!empty($value['combineSku']) && !empty($value['sku']) && !empty($value['count'])) {
                         $insertId = OmAvailableModel::addTNameRow2arr($tName, $value);
                     }
                 }
             }
             if ($autoSpuList[0]['status'] != 2) {
                 $tName = 'pc_auto_create_spu';
                 $set = "SET status=2";
                 $where = "WHERE spu='{$combineSpu}'";
                 $affectRow = OmAvailableModel::updateTNameRow($tName, $set, $where);
             }
             //将新添加的sku添加到mem中
             $key = 'pc_goods_combine_' . $combineSku;
             $dataCom['detail'] = $dataRelationMem;
             $value = $dataCom;
             setMemNewByKey($key, $value);
             //这里不保证能添加成功
             //同步新数据到旧系统中
             $ebayProductsCombine = array();
             $ebayProductsCombine['id'] = $insertIdCom;
             $ebayProductsCombine['goods_sn'] = $combineSku;
             $goods_sncombine = array();
             $truesku = array();
             foreach ($dataRelationMem as $value) {
                 $str = '';
                 $strTrue = '';
                 $str = $value['sku'] . '*' . $value['count'];
                 $strTrue = '[' . $value['sku'] . ']';
                 $goods_sncombine[] = $str;
                 $truesku[] = $strTrue;
             }
             $ebayProductsCombine['goods_sncombine'] = implode(',', $goods_sncombine);
             $ebayProductsCombine['notes'] = $combineNote;
             $ebayProductsCombine['goods_price'] = $combineCost;
             $ebayProductsCombine['goods_weight'] = $combineWeight;
             $ebayProductsCombine['cguser'] = getPersonNameById($_SESSION['userId']);
             $ebayProductsCombine['ebay_user'] = '******';
             $ebayProductsCombine['createdtime'] = time();
             $ebayProductsCombine['truesku'] = implode(',', $truesku);
             $ebayGoodsArr[] = $ebayProductsCombine;
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         addSalerInfoForAny($combineSpu, 2, $_SESSION['userId'], $_SESSION['userId']);
         //add by zqt 20140519,添加销售人逻辑
         //同步数据到深圳ERP
         foreach ($ebayGoodsArr as $value) {
             $ret = OmAvailableModel::newData2ErpInterfOpen('pc.erp.addGoodsCombine', $value, 'gw88');
         }
         $status = "添加成功";
         echo '<script language="javascript">
                 alert("' . $status . '");
                 window.parent.location.href = "index.php?mod=goods&act=getCombineList&searchComField=1&fieldValue=' . $combineSpu . '";
               </script>';
         exit;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         echo $e->getMessage();
         $status = "添加失败,请联系系统技术部,谢谢";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
     }
 }
Esempio n. 3
0
 public static function updateCateMem()
 {
     //更新mem
     $categoryList = self::getCategoryList('*', "WHERE is_delete=0");
     if (!empty($categoryList)) {
         $key = 'pc_goods_category_all';
         setMemNewByKey($key, $categoryList);
         foreach ($categoryList as $value) {
             if (!empty($value)) {
                 $key = 'pc_goods_category_' . $value['path'];
                 setMemNewByKey($key, $value);
             }
         }
     }
     //
 }
Esempio n. 4
0
 public function view_addPmOn()
 {
     $packingMaterials = new PackingMaterialsAct();
     $pmAlias = isset($_POST['pmAlias']) ? post_check($_POST['pmAlias']) : '';
     $pmName = isset($_POST['pmName']) ? post_check($_POST['pmName']) : '';
     $pmNotes = isset($_POST['pmNotes']) ? post_check($_POST['pmNotes']) : '';
     $pmLength = isset($_POST['pmLength']) ? post_check($_POST['pmLength']) : '';
     $pmWidth = isset($_POST['pmWidth']) ? post_check($_POST['pmWidth']) : '';
     $pmHeight = isset($_POST['pmHeight']) ? post_check($_POST['pmHeight']) : '';
     $pmCost = isset($_POST['pmCost']) ? post_check($_POST['pmCost']) : '';
     $pmWeight = isset($_POST['pmWeight']) ? post_check($_POST['pmWeight']) : '';
     $pmDimension = isset($_POST['pmDimension']) ? post_check($_POST['pmDimension']) : '';
     $pmDivider = isset($_POST['pmDivider']) ? post_check($_POST['pmDivider']) : '';
     $pmRatio = isset($_POST['pmRatio']) ? post_check($_POST['pmRatio']) : '';
     if (empty($pmRatio)) {
         $pmRatio = null;
     }
     if (empty($pmAlias) || empty($pmName) || empty($pmLength) || empty($pmWidth) || empty($pmHeight) || empty($pmCost) || empty($pmWeight)) {
         $status = "添加失败,存在空数据";
         header("Location:index.php?mod=packingMaterials&act=getPmList&status={$status}");
         exit;
     }
     $countPmName = $packingMaterials->act_getPmCount("where pmName='{$pmName}' and is_delete=0");
     $countPmDivider = $packingMaterials->act_getPmCount("where pmName='{$pmDivider}' and is_delete=0");
     if ($countPmName > 0) {
         $status = "添加失败,已经存在该包材类名记录";
     } elseif (trim($pmDivider) != '' && $countPmDivider <= 0) {
         $status = " 添加失败,不存在该包材类名为 '{$pmDivider}' 的记录(包材除数)";
     } else {
         $set = "set pmAlias='{$pmAlias}',pmName='{$pmName}',pmNotes='{$pmNotes}',pmLength='{$pmLength}',pmWidth='{$pmWidth}',pmHeight='{$pmHeight}',pmCost='{$pmCost}',pmWeight='{$pmWeight}',pmDimension='{$pmDimension}',pmDivider='{$pmDivider}'";
         if (!empty($pmRatio)) {
             $set .= ",pmRatio='{$pmRatio}'";
         }
         $insertId = $packingMaterials->act_addPm($set);
         if ($insertId) {
             $status = "添加成功";
             //将新的包材信息添加到mem中
             $key = 'pc_pm_' . $insertId;
             $dataPm = array();
             $dataPm['id'] = $insertId;
             $dataPm['pmAlias'] = $pmAlias;
             $dataPm['pmName'] = $pmName;
             $dataPm['pmNotes'] = $pmNotes;
             $dataPm['pmLength'] = $pmLength;
             $dataPm['pmWidth'] = $pmWidth;
             $dataPm['pmHeight'] = $pmHeight;
             $dataPm['pmCost'] = $pmCost;
             $dataPm['pmWeight'] = $pmWeight;
             $dataPm['pmDimension'] = $pmDimension;
             $dataPm['pmRatio'] = $pmRatio;
             $value = $dataPm;
             setMemNewByKey($key, $value);
             //这里不保证能添加成功
             //更新全部包材的mem信息
             $pmList = $packingMaterials->act_getPmList('*', "WHERE is_delete=0");
             if (!empty($pmList)) {
                 setMemNewByKey('pc_pm_all', $pmList);
                 //这里不保证能添加成功
             }
         } else {
             $status = "添加失败";
         }
     }
     header("Location:index.php?mod=packingMaterials&act=getPmList&status={$status}");
 }
Esempio n. 5
0
 public function view_addSkuSingOn()
 {
     $spu = $_POST['spu'] ? post_check(trim($_POST['spu'])) : '';
     $pid = $_POST['pid'] ? post_check(trim($_POST['pid'])) : '';
     $id = $_POST['id'] ? post_check(trim($_POST['id'])) : '';
     $goodsStatus = $_POST['goodsStatus'] ? post_check(trim($_POST['goodsStatus'])) : '';
     $isNew = $_POST['isNew'] ? post_check(trim($_POST['isNew'])) : '';
     if (!preg_match("/^[A-Z0-9]+\$/", $spu)) {
         $status = "非法spu";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
         exit;
     }
     if (empty($pid)) {
         $status = "类别为空";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
         exit;
     }
     $skuArr = $_POST['sku'];
     $goodsNameArr = $_POST['goodsName'];
     $goodsCostArr = $_POST['goodsCost'];
     $goodsNoteArr = $_POST['goodsNote'];
     $goodsColorArr = $_POST['goodsColor'];
     $goodsSizeArr = $_POST['goodsSize'];
     if (!isset($skuArr[0])) {
         $status = "空的SKU记录";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
         exit;
     }
     if (empty($skuArr[0]) && !empty($skuArr[1])) {
         $status = "只能是一个子料号情况下,SKU才能为空";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
         exit;
     }
     if (count($skuArr) != count(array_unique($skuArr))) {
         $status = "错误,存在重复的SKU";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
         exit;
     }
     $userId = $_SESSION['userId'];
     if (intval($userId) <= 0) {
         $status = "登陆超时,请重新登陆!";
         echo '<script language="javascript">
                 alert("' . $status . '");
               </script>';
         exit;
     }
     for ($i = 0; $i < count($skuArr); $i++) {
         $sku = post_check($spu . trim($skuArr[$i]));
         if (strlen($sku) > 30) {
             $status = "{$sku} 字符长度大于30,错误!";
             echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
             exit;
         }
         if (!preg_match("/^{$spu}(_[A-Z0-9]+)*\$/", $sku)) {
             $status = "{$sku} 格式非法";
             echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
             exit;
         }
         $goodsName = !empty($goodsNameArr[$i]) ? $goodsNameArr[$i] : '';
         $goodsCost = !empty($goodsCostArr[$i]) ? $goodsCostArr[$i] : 0;
         $goodsNote = !empty($goodsNoteArr[$i]) ? $goodsNoteArr[$i] : '';
         $goodsColor = !empty($goodsColorArr[$i]) ? $goodsColorArr[$i] : 0;
         $goodsSize = !empty($goodsSizeArr[$i]) ? $goodsSizeArr[$i] : 0;
         if ($i >= 1 && $sku == $spu) {
             continue;
         }
         if (empty($goodsName)) {
             $status = "{$sku} 的描述不能为空";
             echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
             exit;
         }
         if (strpos($goodsName, '#') !== false || strpos($goodsNote, '#') !== false) {
             //如果描述中有#则报错
             $status = "{$sku} 的描述/备注 不能含有'井'号等特殊字符";
             echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
             exit;
         }
         if (!is_numeric($goodsCost) || $goodsCost <= 0) {
             $status = "{$sku} 的成本必须为正数";
             echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
             exit;
         }
         $tName = 'pc_goods';
         $where = "WHERE is_delete=0 AND sku='{$sku}'";
         $count = OmAvailableModel::getTNameCount($tName, $where);
         if ($count) {
             $status = "{$sku} 已经存在";
             echo '<script language="javascript">
                         alert("' . $status . '");
                       </script>';
             exit;
         }
     }
     try {
         $ebayGoodsArr = array();
         //同步数据数组
         BaseModel::begin();
         for ($i = 0; $i < count($skuArr); $i++) {
             $sku = post_check($spu . trim($skuArr[$i]));
             $goodsName = !empty($goodsNameArr[$i]) ? $goodsNameArr[$i] : '';
             $goodsCost = !empty($goodsCostArr[$i]) ? $goodsCostArr[$i] : 0;
             $goodsNote = !empty($goodsNoteArr[$i]) ? $goodsNoteArr[$i] : '';
             $goodsColor = !empty($goodsColorArr[$i]) ? $goodsColorArr[$i] : 0;
             $goodsSize = !empty($goodsSizeArr[$i]) ? $goodsSizeArr[$i] : 0;
             if ($i >= 1 && $sku == $spu) {
                 continue;
             }
             $dataSku = array();
             $dataSku['spu'] = $spu;
             $dataSku['goodsCategory'] = $pid;
             $dataSku['purchaseId'] = $userId;
             $dataSku['goodsCreatedTime'] = time();
             $dataSku['goodsSort'] = intval(substr($spu, 2));
             $dataSku['sku'] = $sku;
             $dataSku['goodsName'] = $goodsName;
             $dataSku['goodsCost'] = $goodsCost;
             $dataSku['goodsNote'] = $goodsNote;
             $dataSku['goodsStatus'] = $goodsStatus;
             $dataSku['isNew'] = $isNew;
             $dataSku['goodsColor'] = $goodsColor;
             $dataSku['goodsSize'] = $goodsSize;
             $tName = 'pc_goods';
             $insertId = OmAvailableModel::addTNameRow2arr($tName, $dataSku);
             addWeightBackupsModify($sku, 0, $userId, false);
             //添加默认的重量变化记录
             addVolumeBackupsModify($sku, 0, 0, 0, $userId, false);
             //添加默认的体积变化记录
             addPmBackupsModify($sku, 0, 1, $userId, false);
             //添加默认的包材变化记录
             addCostBackupsModify($sku, $goodsCost, $userId, false);
             //添加默认的成本变化记录
             addStatusBackupsModify($sku, $goodsStatus, '', $userId, false);
             //添加默认的状态变化记录
             //将新添加的sku添加到mem中
             $key = 'pc_goods_' . $sku;
             $value = $dataSku;
             setMemNewByKey($key, $value);
             //这里不保证能添加成功
             //同步新数据到旧系统中
             $ebayGoods = array();
             $ebayGoods['goods_id'] = $insertId;
             $ebayGoods['goods_name'] = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $goodsName);
             $ebayGoods['goods_sn'] = $sku;
             $ebayGoods['goods_price'] = $goodsCost;
             $ebayGoods['goods_cost'] = $goodsCost;
             //$ebayGoods['goods_weight'] = $goodsWeight;
             $ebayGoods['goods_note'] = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $goodsNote);
             $ebayGoods['goods_category'] = $pid;
             //$ebayGoods['isPacking'] = $isPacking;
             $ebayGoods['ebay_user'] = '******';
             //$ebayGoods['factory'] = $partnerId;
             $ebayGoods['cguser'] = empty($_SESSION['userId']) ? '' : getPersonNameById($_SESSION['userId']);
             //$ebayGoods['capacity'] = $pmCapacity;
             //$ebayGoods['ebay_packingmaterial'] = empty($pmId)?'':PackingMaterialsModel::getPmNameById($pmId);
             $ebayGoods['add_time'] = time();
             $ebayGoods['spu'] = $spu;
             $ebayGoods['goods_code'] = $insertId + 1000000;
             $ebayGoods['color'] = $goodsColor;
             $ebayGoods['size'] = $goodsSize;
             if ($goodsStatus == 1) {
                 //在线
                 $ebayGoods['isuse'] = 0;
             } elseif ($goodsStatus == 51) {
                 //PK产品
                 $ebayGoods['isuse'] = 51;
             } else {
                 //其余的都做下线处理
                 $ebayGoods['isuse'] = 1;
             }
             $ebayGoodsArr[] = $ebayGoods;
         }
         BaseModel::commit();
         BaseModel::autoCommit();
         //同步数据到深圳ERP
         foreach ($ebayGoodsArr as $value) {
             $res = OmAvailableModel::newData2ErpInterfOpen('pc.erp.addGoods', $value, 'gw88');
         }
         $status = "添加成功";
         echo '<script language="javascript">
                 alert("' . $status . '");
                 window.parent.location.href = "index.php?mod=goods&act=getGoodsList&searchs=1&status=' . $status . '&seachdata=' . $spu . '";
               </script>';
         exit;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         $status = $e->getMessage();
         echo '<script language="javascript">
                 alert("' . '添加失败——' . $status . '");
                 window.parent.location.href = "index.php?mod=goods&act=getGoodsList&searchs=1&status=' . $status . '&seachdata=' . $spu . '";
               </script>';
         exit;
     }
 }