function content_526616b983b8b3_14494234($_smarty_tpl)
    {
        echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

<script type="text/javascript" src="./js/fancyBox/source/jquery.fancybox.js?v=2.1.3"></script>
<link rel="stylesheet" type="text/css" href="./js/fancyBox/source/jquery.fancybox.css?v=2.1.2" media="screen" />
<script type="text/javascript" src="./js/goodslist.js"></script>
<div class="fourvar">
            	<div class="pathvar">
                <?php 
        echo $_smarty_tpl->getSubTemplate('pcNav.htm', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

                </div>
                <div class="texvar">
                </div>
                <div class="pagination">
                <?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

                </div>
            </div>
			<div class="servar products-servar">
								  <span>查找:
								   <input name="seachdata" type="text" id="seachdata" value="<?php 
        echo $_GET['seachdata'];
        ?>
"/>
								   <select name="searchs" id="searchs" >
									<option value="1" <?php 
        if ($_GET['searchs'] == 1) {
            ?>
selected='selected'<?php 
        }
        ?>
>SPU</option>
									<option value="2" <?php 
        if ($_GET['searchs'] == 2) {
            ?>
selected='selected'<?php 
        }
        ?>
>SKU</option>
								  </select>
								   </span>
								   <span>新/老品:
								   <select name="isNew" id="isNew" >
								    <option value="0" ></option>
									<option value="1" <?php 
        if ($_GET['isNew'] == 1) {
            ?>
selected='selected'<?php 
        }
        ?>
>新品</option>
									<option value="2" <?php 
        if ($_GET['isNew'] == 2) {
            ?>
selected='selected'<?php 
        }
        ?>
>老品</option>
								  </select>
								   </span>
                                   <span>采购员:
								   <select name="purchaseId" id="purchaseId" >
								    <option value="0" > </option>
								    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = Auth::getApiPurchaseUsers();
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
									<option value="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['userId'];
            ?>
" <?php 
            if ($_GET['purchaseId'] == $_smarty_tpl->tpl_vars['value']->value['userId']) {
                ?>
selected='selected'<?php 
            }
            ?>
><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['userName'];
            ?>
</option>
									<?php 
        }
        ?>
								  </select>
								   </span>
								<span>类别&nbsp;&nbsp;
									<select name="sku_category" id="pid_one" onchange="select_one();">
										<option value="0"></option>
										<?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = CategoryModel::getCategoryList('*', "where is_delete=0 and pid=0");
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
										<option value="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
"><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['name'];
            ?>
</option>
										<?php 
        }
        ?>
									</select>
									<span align="left" id="div_two" style="width:auto; display:none"></span>
									<span align="left" id="div_three" style="width:auto; display:none"></span>
									<span align="left" id="div_four" style="width:auto; display:none"></span>
								</span>
                                   <span><button id='seachGoods'/>搜索</button></span>
                                   &nbsp;
                                   <?php 
        if ($_smarty_tpl->tpl_vars['categorySearch']->value != '') {
            ?>
                                   <span style="color: green;">上次您搜索的类别为:<?php 
            echo $_smarty_tpl->tpl_vars['categorySearch']->value;
            ?>
</span>
                                   <?php 
        }
        ?>
                                   <span style="color: red;" id="error"><?php 
        echo $_GET['status'];
        ?>
</span>
            </div>
            <div class="main feedback-main">
            	<table class="products-action" cellspacing="0" width="100%">
                   <tr class="title">
					    <td>产品图片</td>
                        <td width="25%">产品名称</td>
                        <td>SPU</td>
                        <td>SKU</td>
						<td>产品类别</td>
						<td>产品成本</td>
						<td>包材</td>
						<td>重量</td>
						<td>采购负责人</td>
						<td>新/老品</td>
                        <td>供应商</td>
						<td>操作</td>
                    </tr>
                    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['productList']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
                                <tr id="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
">
									<td>
									<a class="fancybox" href="http://192.168.200.200:9998/imgs/<?php 
            echo get_sku_imgName($_smarty_tpl->tpl_vars['value']->value['sku']);
            ?>
-G.jpg" target="_blank">
									<img  src="http://192.168.200.200:9998/imgs/<?php 
            echo get_sku_imgName($_smarty_tpl->tpl_vars['value']->value['sku']);
            ?>
-G_thumnail.jpg" width="50" height="50" style="border-style:solid;border-width:0" />
									</a>
									</td>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['goodsName'];
            ?>
</td>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['spu'];
            ?>
</td>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['sku'];
            ?>
</td>
									<td><?php 
            echo getAllCateNameByPath($_smarty_tpl->tpl_vars['value']->value['goodsCategory']);
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['goodsCost'];
            ?>
</td>
									<td><?php 
            echo PackingMaterialsModel::getPmNameById($_smarty_tpl->tpl_vars['value']->value['pmId']);
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['goodsWeight'];
            ?>
</td>
									<td><?php 
            echo getPersonNameById($_smarty_tpl->tpl_vars['value']->value['purchaseId']);
            ?>
</td>
									<td><?php 
            if ($_smarty_tpl->tpl_vars['value']->value['isNew'] == 0) {
                ?>
老品<?php 
            } else {
                ?>
新品<?php 
            }
            ?>
</td>
                                    <td><?php 
            echo OmAvailableModel::getParterNameBySku($_smarty_tpl->tpl_vars['value']->value['sku']);
            ?>
</td>
									<td>
									<input type="button" value="修改" tid="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
" class="mod"/>
									<input type="button" value="删除" tid="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
" class="del"/>
									</td>
                                </tr>
                                <?php 
        }
        ?>
                </table>
            </div>
            <div class="bottomvar">
            	<div class="texvar">

            	</div>
            	<div class="pagination">
					<?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

            	</div>
            </div>
<?php 
        echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

<script type="text/javascript">
		$(document).ready(function() {
			$(".fancybox").fancybox({
				helpers: {
					title : {
						type : 'outside'
					},
					overlay : {
						speedOut : 0
					}
				}
			});

		});
</script><?php 
    }
Exemple #2
0
 public function view_addAppointPerson()
 {
     $searchDepId = $_GET['searchDepId'] ? post_check(trim($_GET['searchDepId'])) : 0;
     $searchUserId = $_GET['searchUserId'] ? post_check(trim($_GET['searchUserId'])) : 0;
     $addDepId = $_GET['addDepId'] ? post_check(trim($_GET['addDepId'])) : 0;
     $addUserId = $_GET['addUserId'] ? post_check(trim($_GET['addUserId'])) : 0;
     $addDepId = intval($addDepId);
     $addUserId = intval($addUserId);
     $status = '';
     if ($addDepId <= 0 || $addUserId <= 0) {
         $status = "部门或指派工程师为空,添加失败";
     } else {
         $addDepName = getDepNameByDepId($addDepId);
         $addUserName = getPersonNameById($addUserId);
         if (empty($addDepName) || empty($addUserName)) {
             $status = "部门或指派工程师不存在,添加失败";
         } else {
             $tName = 'pc_products_appoint_person';
             $where = "WHERE is_delete=0 AND depId='{$addDepId}' AND appointPersonId='{$addUserId}'";
             $isExistDU = OmAvailableModel::getTNameCount($tName, $where);
             if ($isExistDU) {
                 $status = "记录已经存在,添加失败";
             } else {
                 $dataArr = array();
                 $dataArr['depId'] = $addDepId;
                 $dataArr['appointPersonId'] = $addUserId;
                 $dataArr['addUserId'] = $_SESSION['userId'];
                 $dataArr['addTime'] = time();
                 OmAvailableModel::addTNameRow2arr($tName, $dataArr);
                 $status = "部门:{$addDepName} 指派工程师:{$addUserName} 添加成功";
             }
         }
     }
     header("Location:index.php?mod=products&act=getAppointPersonList&status={$status}&addDepId={$addDepId}&addUserId={$addUserId}&searchDepId={$searchDepId}&searchUserId={$searchUserId}");
 }
Exemple #3
0
 public function view_addOrUpdateSpeicailSpuOn()
 {
     $useId = $_SESSION['userId'];
     $personName = getPersonNameById($useId);
     if (empty($personName)) {
         $status = "<font color=red>系统找不到登录人信息!</font><br/>";
         echo $status;
         exit;
     }
     if (isset($_POST['submit']) && $_POST['submit'] != '') {
         $uploadfile = 'addOrUpdateSpeicailSpuExcelImport_' . date("Y") . date("m") . date("d") . date("H") . date('i') . date('s') . '_' . $personName . ".xls";
         if (move_uploaded_file($_FILES['upfile']['tmp_name'], 'upload/' . $uploadfile)) {
             echo "<font color=BLUE>文件上传成功!</font><br>";
         } else {
             echo "<font color=red> 文件上传失败!</font>";
             exit;
         }
         $fileName = 'upload/' . $uploadfile;
         $filePath = $fileName;
         $PHPExcel = new PHPExcel();
         $PHPReader = new PHPExcel_Reader_Excel2007();
         if (!$PHPReader->canRead($filePath)) {
             $PHPReader = new PHPExcel_Reader_Excel5();
             if (!$PHPReader->canRead($filePath)) {
                 echo 'no Excel';
                 return;
             }
         }
         $PHPExcel = $PHPReader->load($filePath);
         $currentSheet = $PHPExcel->getSheet(0);
         $highestRow = $currentSheet->getHighestRow();
         //表格中的最大行数
         echo "表格总行数为 {$highestRow} <br />";
         if ($highestRow > 30000) {
             echo "表格不能超过30000行,请重新整理表格导入,谢谢!";
             exit;
         }
         $status = '';
         $flag = true;
         //标识检测结果
         $tName = 'pc_special_property';
         $select = 'id,propertyName';
         $where = "WHERE isOn=1";
         $pspList = OmAvailableModel::getTNameList($tName, $select, $where);
         $IPArr = array();
         foreach ($pspList as $value) {
             $IPArr[$value['id']] = $value['propertyName'];
         }
         if (empty($IPArr)) {
             echo "启用的特殊属性记录为空,退出";
             exit;
         }
         for ($i = 2; $i <= $highestRow; $i++) {
             //先检查导入表格的正确性
             $spu = trim($currentSheet->getCell('A' . $i)->getValue());
             //spu
             $spu = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $spu);
             $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu;
             $specailPropertyName = trim($currentSheet->getCell('B' . $i)->getValue());
             //$specailPropertyName = preg_replace("/(\s|\&nbsp\;| |\xc2\xa0)/","",$specailPropertyName);
             if (empty($spu)) {
                 $status .= "第 {$i} 行,SPU为空 <br/>";
                 $flag = false;
                 continue;
             }
             $tName = 'pc_auto_create_spu';
             $where = "WHERE is_delete=0 AND isSingSpu=1 AND spu='{$spu}'";
             if (!OmAvailableModel::getTNameCount($tName, $where)) {
                 $status .= "第 {$i} 行,SPU不存在 <br/>";
                 $flag = false;
                 continue;
             }
             $propertyId = intval(array_search($specailPropertyName, $IPArr));
             if ($propertyId <= 0) {
                 $status .= "第 {$i} 行,找不到 {$specailPropertyName} 这个特殊属性记录 <br/>";
                 $flag = false;
                 continue;
             }
         }
         if (!$flag) {
             //验证不通过
             echo "<font color=red>{$status}</font>";
             exit;
         } else {
             $status = '';
             for ($i = 2; $i <= $highestRow; $i++) {
                 //先检查导入表格的正确性
                 $spu = trim($currentSheet->getCell('A' . $i)->getValue());
                 //spu
                 $spu = preg_replace("/(\\s|\\&nbsp\\;| | )/", "", $spu);
                 $spu = strpos($spu, '_') === false ? str_pad($spu, 3, '0', STR_PAD_LEFT) : $spu;
                 $specailPropertyName = trim($currentSheet->getCell('B' . $i)->getValue());
                 //spu
                 $propertyId = intval(array_search($specailPropertyName, $IPArr));
                 $tName = 'pc_special_property_spu';
                 $where = "WHERE spu='{$spu}' AND propertyId={$propertyId}";
                 if (OmAvailableModel::getTNameCount($tName, $where)) {
                     $status .= "第 {$i} 行,{$spu} 已经存在 {$specailPropertyName} 这个特殊属性<br/>";
                 } else {
                     $dataArr = array();
                     $dataArr['spu'] = $spu;
                     $dataArr['propertyId'] = $propertyId;
                     OmAvailableModel::addTNameRow2arr($tName, $dataArr);
                     $status .= "第 {$i} 行,{$spu} 添加至 {$specailPropertyName} 成功 <br/>";
                 }
             }
             echo "<font color=green>{$status}</font>";
             exit;
         }
     }
 }
         }
     } elseif ($value4['platformId'] == 2) {
         //aliexpress平台
         $aliexpressSaler = getPersonNameById($value4['salerId']);
         if ($value4['isHandsOn'] == 1 && !empty($value4['addTime'])) {
             $aliexpressHanderTime = date('Y-m-d', $value4['addTime']);
         }
     } elseif ($value4['platformId'] == 11) {
         //Amazon平台
         $amazonSaler = getPersonNameById($value4['salerId']);
         if ($value4['isHandsOn'] == 1 && !empty($value4['addTime'])) {
             $amazonHanderTime = date('Y-m-d', $value4['addTime']);
         }
     } elseif ($value4['platformId'] == 14) {
         //Amazon平台
         $overseaSaler = getPersonNameById($value4['salerId']);
         if ($value4['isHandsOn'] == 1 && !empty($value4['addTime'])) {
             $overseaHanderTime = date('Y-m-d', $value4['addTime']);
         }
     }
 }
 $row[] = $excelOutSpu;
 $row[] = $excelOutCombineSku;
 $row[] = $trueSkuInfoStr;
 $row[] = '';
 //类别
 $row[] = '';
 //状态
 $row[] = '';
 //采购
 $row[] = $excelOutCombineUser;
    if ($goodsWeight == 0) {
        $goodsWeight = "<span style='color:red'>无</span>";
    }
    if (empty($pmId)) {
        $pmId = "<span style='color:red'>无</span>";
    } else {
        $tName = 'pc_packing_material';
        $select = 'pmName';
        $where = "WHERE id='{$pmId}'";
        $pmList = OmAvailableModel::getTNameList($tName, $select, $where);
        $pmId = $pmList[0]['pmName'];
    }
    if (empty($purchaseId)) {
        $purchaseId = "<span style='color:red'>无</span>";
    } else {
        $purchaseId = getPersonNameById($purchaseId);
    }
    if (empty($goodsCategory)) {
        $goodsCategory = "<span style='color:red'>无</span>";
    } else {
        $goodsCategory = getAllCateNameByPath($goodsCategory);
    }
    $tdIndex = $index + 1;
    $table .= "<tr><td>{$tdIndex}</td><td>{$sku}</td><td>{$goodsWeight}</td><td>{$pmId}</td><td>{$purchaseId}</td><td>{$goodsCategory}</td></tr>";
}
$table .= "</table>";
$table .= '<p style="' . $css_height . '">欲知所有问题料号,请联系产品中心负责人。详情请登录:<a href="' . $system_url . '" target="_blank">' . $system_name . '</a><br/></br>' . date('Y-m-d', $endTime) . '<br/>' . $system_name . '</p>';
//$table = '1111111';
echo $table . "\n";
echo 'table length = ' . strlen($table) . "\n";
echo 'table urlencode length = ' . strlen(urlencode($table)) . "\n";
require_once "/data/htdocs/zhuqingting.dev.com/pc.valsun.cn/framework.php";
require_once "/data/htdocs/zhuqingting.dev.com/pc.valsun.cn/lib/php-export-data.class.php";
Core::getInstance();
session_start();
header("Content-type:text/html;charset=utf-8");
date_default_timezone_set("Asia/Shanghai");
session_cache_expire(30);
//session有效时间为30分钟
$fileName = "/data/htdocs/zhuqingting.dev.com/pc.valsun.cn/html/excel/illSku" . date("Y-m-d_H_i_s") . ".xls";
$tName = 'pc_goods';
$select = 'sku,goodsName,goodsCategory,purchaseId';
$where = "where is_delete=0 and sku not like'MT%'";
$goodsList = OmAvailableModel::getTNameList($tName, $select, $where);
//print_r($goodsList);
//exit;
$excel = new ExportDataExcel('file');
$excel->filename = $fileName;
$excel->initialize();
$excel->addRow(array('sku', '描述', '类别', '采购'));
foreach ($goodsList as $value) {
    $tName = 'pc_goods_category';
    $where = "WHERE path like'{$value['goodsCategory']}-%' and is_delete=0";
    $count = OmAvailableModel::getTNameCount($tName, $where);
    if ($count || empty($value['goodsCategory'])) {
        //不是最小分类,或者无分类
        $personName = getPersonNameById($value['purchaseId']);
        $row = array($value['sku'], $value['goodsName'], empty($value['goodsCategory']) ? '' : getAllCateNameByPath($value['goodsCategory']), $personName);
        $excel->addRow($row);
    }
}
$excel->finalize();
    function content_526616c3586904_20926076($_smarty_tpl)
    {
        if (!is_callable('smarty_modifier_date_format')) {
            include 'D:\\wamp\\www\\ftpPc.valsun.cn\\lib\\template\\smarty\\plugins\\modifier.date_format.php';
        }
        echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

<script type="text/javascript" src="./js/goodslist.js"></script>
<div class="fourvar">
            	<div class="pathvar">
                <?php 
        echo $_smarty_tpl->getSubTemplate('pcNav.htm', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

                </div>
                <div class="texvar">
                </div>
                <div class="pagination">
                <?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

                </div>
            </div>
			<div class="servar products-servar">
								  <span>SPU:
								   <input name="combineSpu" type="combineSpu" id="combineSpu" value="<?php 
        echo $_GET['combineSpu'];
        ?>
"/>
								   </span>
                                   <span><button id='searchCombineList'/>搜索</button></span>
                                   &nbsp;
                                   <span style="color: red;" id="error"><?php 
        echo $_GET['status'];
        ?>
</span>
            </div>
            <div class="main feedback-main" >
            	<table class="products-action" cellspacing="0" width="100%">
                   <tr class="title">
					    <td>SPU</td>
                        <td>SKU</td>
                        <td>成本</td>
						<td>重量</td>
                        <td>真实料号</td>
						<td>长</td>
						<td>宽</td>
						<td>高</td>
						<td>备注</td>
						<td>组合人</td>
						<td>添加时间</td>
                        <td>操作</td>
                    </tr>
                    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['combineList']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
                                <tr id="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
">
									<td>
									   <?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineSpu'];
            ?>

									</td>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineSku'];
            ?>
</td>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineCost'];
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineWeight'];
            ?>
</td>
                                    <td>
                                    <?php 
            $_smarty_tpl->tpl_vars['vv'] = new Smarty_Variable();
            $_smarty_tpl->tpl_vars['vv']->_loop = false;
            $_from = OmAvailableModel::getTrueSkuForCombine($_smarty_tpl->tpl_vars['value']->value['combineSku']);
            if (!is_array($_from) && !is_object($_from)) {
                settype($_from, 'array');
            }
            foreach ($_from as $_smarty_tpl->tpl_vars['vv']->key => $_smarty_tpl->tpl_vars['vv']->value) {
                $_smarty_tpl->tpl_vars['vv']->_loop = true;
                ?>
                                      <?php 
                echo $_smarty_tpl->tpl_vars['vv']->value['sku'];
                ?>

                                    <?php 
            }
            ?>
                                    </td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineLength'];
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineWidth'];
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineHeight'];
            ?>
</td>
									<td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['combineNote'];
            ?>
</td>
									<td><?php 
            echo getPersonNameById($_smarty_tpl->tpl_vars['value']->value['combineUserId']);
            ?>
</td>
                                    <td><?php 
            echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['value']->value['addTime'], "Y-m-d H:i");
            ?>
</td>
									<td>
                                        <input type="button" onclick="window.location.href = 'index.php?mod=goods&act=updateCombine&id=<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
'" value="修改"/>
                                    </td>
                                </tr>
                                <?php 
        }
        ?>
                </table>
            </div>
            <div class="bottomvar">
            	<div class="texvar">

            	</div>
            	<div class="pagination">
					<?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

            	</div>
            </div>
<?php 
        echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
    }
    function content_5265dbe4ca0254_58096823($_smarty_tpl)
    {
        if (!is_callable('smarty_modifier_date_format')) {
            include 'D:\\wamp\\www\\ftpPc.valsun.cn\\lib\\template\\smarty\\plugins\\modifier.date_format.php';
        }
        echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

<script type="text/javascript" src="./js/fancyBox/source/jquery.fancybox.js?v=2.1.3"></script>
<link rel="stylesheet" type="text/css" href="./js/fancyBox/source/jquery.fancybox.css?v=2.1.2" media="screen" />
<script type="text/javascript" src="./js/goodslist.js"></script>
<div class="fourvar">
            	<div class="pathvar">
               <?php 
        echo $_smarty_tpl->getSubTemplate('pcNav.htm', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

                </div>
                <div class="texvar">
                </div>
                <div class="pagination">
                <?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

                </div>
            </div>
			<div class="servar products-servar">
								  <span>SPU:
								   <input name="spu" type="text" id="spu" value="<?php 
        echo $_GET['spu'];
        ?>
"/>
								   </span>
								   <span>是否进系统:
								   <select name="autoStatus" id="autoStatus" >
								    <option value="0" > </option>
									<option value="1" <?php 
        if ($_GET['status'] == 1) {
            ?>
selected='selected'<?php 
        }
        ?>
>No</option>
									<option value="2" <?php 
        if ($_GET['status'] == 2) {
            ?>
selected='selected'<?php 
        }
        ?>
>Yes</option>
								  </select>
								   </span>
								   <span>单/虚拟料号:
								   <select name="isSingSpu" id="isSingSpu" >
								    <option value="0" > </option>
									<option value="1" <?php 
        if ($_GET['isSingSpu'] == 1) {
            ?>
selected='selected'<?php 
        }
        ?>
>单料号</option>
									<option value="2" <?php 
        if ($_GET['isSingSpu'] == 2) {
            ?>
selected='selected'<?php 
        }
        ?>
>虚拟料号</option>
								  </select>
								   </span>
								   <span>采购员:
								   <select name="purchaseId" id="purchaseId" >
								    <option value="0" > </option>
								    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = Auth::getApiPurchaseUsers();
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
									<option value="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['userId'];
            ?>
" <?php 
            if ($_GET['purchaseId'] == $_smarty_tpl->tpl_vars['value']->value['userId']) {
                ?>
selected='selected'<?php 
            }
            ?>
><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['userName'];
            ?>
</option>
									<?php 
        }
        ?>
								  </select>
								   </span>
								</span>
                                   <span><button id='seachAutoSpuList'>搜索</button></span>
            &nbsp;
			<span style="color: red;"><?php 
        echo $_smarty_tpl->tpl_vars['status']->value;
        ?>
</span>
            <span style="float: right;"><a href="index.php?mod=spu&act=addAutoSpuForOld">添加旧数据进自动生成列表</a></span>
            </div>
            <div class="main feedback-main">
            	<table class="products-action" cellspacing="0" width="100%">
                   <tr class="title">
                        <tr>
                            <td>SPU</td>
							<td>申请人</td>
							<td>是否进系统</td>
							<td>添加时间</td>
							<td>单/虚拟料号</td>
							<td>操作</td>
                        </tr>
                    </tr>
                    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['spuList']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
                                <tr>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['spu'];
            ?>
</td>
                                    <td><?php 
            echo getPersonNameById($_smarty_tpl->tpl_vars['value']->value['purchaseId']);
            ?>
</td>
									<td><?php 
            if ($_smarty_tpl->tpl_vars['value']->value['status'] == 1) {
                ?>
<img alt="No" src="http://misc.erp.valsun.cn/img/wrong.png"/><?php 
            } else {
                ?>
<img alt="Yes" src="http://misc.erp.valsun.cn/img/right.png"/><?php 
            }
            ?>
</td>
                                    <td><?php 
            echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['value']->value['createdTime'], "Y-m-d H:i");
            ?>
</td>
                                    <td><?php 
            if ($_smarty_tpl->tpl_vars['value']->value['isSingSpu'] == 1) {
                ?>
单料号<?php 
            } else {
                ?>
虚拟料号<?php 
            }
            ?>
</td>
                                    <td>
                                    <?php 
            if ($_SESSION['userId'] == $_smarty_tpl->tpl_vars['value']->value['purchaseId']) {
                ?>
                                    	<?php 
                if ($_smarty_tpl->tpl_vars['value']->value['status'] == 1 && $_smarty_tpl->tpl_vars['value']->value['isSingSpu'] == 1) {
                    ?>
                                        <input type="button" onclick="window.location.href = 'index.php?mod=autoCreateSpu&act=editAutoCreateSpuCate&spu=<?php 
                    echo $_smarty_tpl->tpl_vars['value']->value['spu'];
                    ?>
'" value="添加档案"/>
                                        <?php 
                }
                ?>
                                        <?php 
                if ($_smarty_tpl->tpl_vars['value']->value['isSingSpu'] == 1 && OmAvailableModel::isSpuAudit($_smarty_tpl->tpl_vars['value']->value['spu']) == true || $_smarty_tpl->tpl_vars['value']->value['isSingSpu'] == 2) {
                    ?>
                                        <input type="button" onclick="window.location.href = 'index.php?mod=autoCreateSpu&act=addSku&spu=<?php 
                    echo $_smarty_tpl->tpl_vars['value']->value['spu'];
                    ?>
'" value="添加子料号"/>
                                        <?php 
                }
                ?>
                                        <?php 
                if ($_smarty_tpl->tpl_vars['value']->value['status'] == 1) {
                    ?>
                                    	<input type="button" class="deleteAutoCreateSpu" spu="<?php 
                    echo $_smarty_tpl->tpl_vars['value']->value['spu'];
                    ?>
" value="删除SPU"/>
                                    	<?php 
                }
                ?>
									<?php 
            }
            ?>
                                    </td>
                                </tr>
                     <?php 
        }
        ?>
                </table>
            </div>
            <div class="bottomvar">
            	<div class="texvar">

            	</div>
            	<div class="pagination">
					<?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

            	</div>
            </div>
<?php 
        echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
    }
Exemple #9
0
 function act_updateSpuHsRelaById()
 {
     $id = intval($_POST['id']);
     if ($id <= 0) {
         self::$errCode = '101';
         self::$errMsg = '无效记录';
         return false;
     }
     $userId = $_SESSION['userId'];
     if ($id <= 0) {
         self::$errCode = '103';
         self::$errMsg = '登陆超时';
         return false;
     }
     $personName = getPersonNameById($userId);
     $tName = 'pc_spu_tax_hscode';
     $select = 'spu';
     $where = "WHERE id='{$id}'";
     $psthList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (empty($psthList)) {
         self::$errCode = '102';
         self::$errMsg = "无记录";
         return false;
     }
     $dataTmpArr = array();
     $dataTmpArr['customsName'] = !empty($_POST['customsName']) ? $_POST['customsName'] : '';
     $dataTmpArr['materialCN'] = !empty($_POST['materialCN']) ? $_POST['materialCN'] : '';
     $dataTmpArr['customsNameEN'] = !empty($_POST['customsNameEN']) ? $_POST['customsNameEN'] : '';
     $dataTmpArr['materialEN'] = !empty($_POST['materialEN']) ? $_POST['materialEN'] : '';
     $dataTmpArr['hsCode'] = !empty($_POST['hsCode']) ? $_POST['hsCode'] : '';
     $dataTmpArr['exportRebateRate'] = !empty($_POST['exportRebateRate']) ? $_POST['exportRebateRate'] : '';
     $dataTmpArr['importMFNRates'] = !empty($_POST['importMFNRates']) ? $_POST['importMFNRates'] : '';
     $dataTmpArr['generalRate'] = !empty($_POST['generalRate']) ? $_POST['generalRate'] : '';
     $dataTmpArr['RegulatoryConditions'] = !empty($_POST['RegulatoryConditions']) ? $_POST['RegulatoryConditions'] : '';
     $dataTmpArr = array_filter($dataTmpArr);
     $jsonData = json_encode($dataTmpArr);
     if (!empty($dataTmpArr)) {
         OmAvailableModel::updateTNameRow2arr($tName, $dataTmpArr, $where);
         error_log(date('Y-m-d_H:i') . "——{$psthList[0]['spu']} 更新成功 BY {$personName}, data: {$jsonData} \r\n", 3, WEB_PATH . "log/spuHscodeTax.txt");
         self::$errCode = '200';
         self::$errMsg = "更新成功";
         return true;
     } else {
         self::$errCode = '200';
         self::$errMsg = "无数据提交";
         return true;
     }
 }
Exemple #10
0
 function act_getAppointPersonList()
 {
     $searchDepId = $_GET['searchDepId'] ? post_check(trim($_GET['searchDepId'])) : 0;
     $searchUserId = $_GET['searchUserId'] ? post_check(trim($_GET['searchUserId'])) : 0;
     $tName = 'pc_products_appoint_person';
     $select = '*';
     $where = "WHERE is_delete=0 ";
     if (intval($searchDepId) > 0) {
         $where .= "AND depId='{$searchDepId}' ";
     }
     if (intval($searchUserId) > 0) {
         $where .= "AND appointPersonId='{$searchUserId}' ";
     }
     $total = OmAvailableModel::getTNameCount($tName, $where);
     $num = 50;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= "order by id desc " . $page->limit;
     $appointPersonList = OmAvailableModel::getTNameList($tName, $select, $where);
     if (!empty($appointPersonList)) {
         $countAppointPersonList = count($appointPersonList);
         for ($i = 0; $i < $countAppointPersonList; $i++) {
             $appointPersonList[$i]['depName'] = getDepNameByDepId($appointPersonList[$i]['depId']);
             $appointPersonList[$i]['userName'] = getPersonNameById($appointPersonList[$i]['appointPersonId']);
             $appointPersonList[$i]['addUserName'] = getPersonNameById($appointPersonList[$i]['addUserId']);
         }
     }
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     return array('appointPersonList' => $appointPersonList, 'show_page' => $show_page);
 }
    function content_526616d124ef17_38368080($_smarty_tpl)
    {
        if (!is_callable('smarty_modifier_date_format')) {
            include 'D:\\wamp\\www\\ftpPc.valsun.cn\\lib\\template\\smarty\\plugins\\modifier.date_format.php';
        }
        echo $_smarty_tpl->getSubTemplate("header.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

<script type="text/javascript" src="./js/goodslist.js"></script>
<div class="fourvar">
            	<div class="pathvar">
                <?php 
        echo $_smarty_tpl->getSubTemplate('pcNav.htm', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
        ?>

                </div>
                <div class="texvar">
                </div>
                <div class="pagination">
                <?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

                </div>
            </div>
			<div class="servar products-servar">
            					  <span>SPU:
								   <input name="spu" type="text" id="spu" value="<?php 
        echo $_GET['spu'];
        ?>
"/>
								   </span>
								   <span>审核状态:
								   <select name="auditStatus" id="auditStatus" >
								    <option value="0" > </option>
									<option value="1" <?php 
        if ($_GET['auditStatus'] == 1) {
            ?>
selected='selected'<?php 
        }
        ?>
>待审核</option>
									<option value="2" <?php 
        if ($_GET['auditStatus'] == 2) {
            ?>
selected='selected'<?php 
        }
        ?>
>审核通过</option>
								  	<option value="3" <?php 
        if ($_GET['auditStatus'] == 3) {
            ?>
selected='selected'<?php 
        }
        ?>
>审核不通过</option>
								  </select>
                                  <span>采购员:
								   <select name="purchaseId" id="purchaseId" >
								    <option value="0" > </option>
								    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = Auth::getApiPurchaseUsers();
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
									<option value="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['userId'];
            ?>
" <?php 
            if ($_GET['purchaseId'] == $_smarty_tpl->tpl_vars['value']->value['userId']) {
                ?>
selected='selected'<?php 
            }
            ?>
><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['userName'];
            ?>
</option>
									<?php 
        }
        ?>
								  </select>
								   </span>
								   </span>
								   <span>类别&nbsp;&nbsp;
									<select name="sku_category" id="pid_one" onchange="select_one();">
										<option value="0">请选择</option>
										<?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = CategoryModel::getCategoryList('*', "where is_delete=0 and pid=0");
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
										<option value="<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['id'];
            ?>
"><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['name'];
            ?>
</option>
										<?php 
        }
        ?>
									</select>
									<span align="left" id="div_two" style="width:auto; display:none"></span>
									<span align="left" id="div_three" style="width:auto; display:none"></span>
									<span align="left" id="div_four" style="width:auto; display:none"></span>
								</span>
                                   <span><button id='seachSpuArchive'>搜索</button></span>
                                   <?php 
        if ($_smarty_tpl->tpl_vars['categorySearch']->value != '') {
            ?>
                                   <span style="color: green;">上次您搜索的类别为:<?php 
            echo $_smarty_tpl->tpl_vars['categorySearch']->value;
            ?>
</span>
                                   <?php 
        }
        ?>
            &nbsp;
			<span style="color: red;"><?php 
        echo $_smarty_tpl->tpl_vars['status']->value;
        ?>
</span>
            </div>
            <div class="main feedback-main">
            	<table class="products-action" cellspacing="0" width="100%">
                   <tr class="title">
                        <tr>
                            <td>SPU</td>
							<td>采购员</td>
							<td>类型</td>
							<td>在线状态</td>
							<td>审核状态</td>
							<td>添加时间</td>
							<td>单/虚拟料号</td>
							<td>操作</td>
                        </tr>
                    </tr>
                    <?php 
        $_smarty_tpl->tpl_vars['value'] = new Smarty_Variable();
        $_smarty_tpl->tpl_vars['value']->_loop = false;
        $_from = $_smarty_tpl->tpl_vars['spuArchiveList']->value;
        if (!is_array($_from) && !is_object($_from)) {
            settype($_from, 'array');
        }
        foreach ($_from as $_smarty_tpl->tpl_vars['value']->key => $_smarty_tpl->tpl_vars['value']->value) {
            $_smarty_tpl->tpl_vars['value']->_loop = true;
            ?>
                                <tr>
                                    <td><?php 
            echo $_smarty_tpl->tpl_vars['value']->value['spu'];
            ?>
</td>
                                    <td><?php 
            echo getPersonNameById($_smarty_tpl->tpl_vars['value']->value['purchaseId']);
            ?>
</td>
									<td><?php 
            echo getAllCateNameByPath($_smarty_tpl->tpl_vars['value']->value['categoryPath']);
            ?>
</td>
                                    <td>
                                    <?php 
            if ($_smarty_tpl->tpl_vars['value']->value['spuStatus'] == 1) {
                ?>
下线<?php 
            }
            ?>
                                    <?php 
            if ($_smarty_tpl->tpl_vars['value']->value['spuStatus'] == 2) {
                ?>
上线<?php 
            }
            ?>
                                    <?php 
            if ($_smarty_tpl->tpl_vars['value']->value['spuStatus'] == 3) {
                ?>
部分停售<?php 
            }
            ?>
                                    <?php 
            if ($_smarty_tpl->tpl_vars['value']->value['spuStatus'] == 4) {
                ?>
停售<?php 
            }
            ?>
                                    <?php 
            if ($_smarty_tpl->tpl_vars['value']->value['spuStatus'] == 5) {
                ?>
部分下线<?php 
            }
            ?>
                                    </td>
                                    <td>
                                    <?php 
            if ($_smarty_tpl->tpl_vars['value']->value['auditStatus'] == 1) {
                ?>
待审核<?php 
            }
            ?>
                                    <?php 
            if ($_smarty_tpl->tpl_vars['value']->value['auditStatus'] == 2) {
                ?>
<img alt="审核通过" src="http://misc.erp.valsun.cn/img/right.png"/><?php 
            }
            ?>
                                    <?php 
            if ($_smarty_tpl->tpl_vars['value']->value['auditStatus'] == 3) {
                ?>
<img alt="审核不通过" src="http://misc.erp.valsun.cn/img/wrong.png"/><?php 
            }
            ?>
                                    </td>
                                    <td><?php 
            echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['value']->value['spuCreatedTime'], "Y-m-d H:i");
            ?>
</td>
                                    <td><?php 
            if ($_smarty_tpl->tpl_vars['value']->value['isSingSpu'] == 1) {
                ?>
单料号<?php 
            } else {
                ?>
虚拟料号<?php 
            }
            ?>
</td>
                                    <td>
										<input type="button" onclick="window.location.href = 'index.php?mod=autoCreateSpu&act=scanSpuArchive&spu=<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['spu'];
            ?>
'" value="查看"/>
                                        <input type="button" onclick="window.location.href = 'index.php?mod=autoCreateSpu&act=updateSpuArchive&spu=<?php 
            echo $_smarty_tpl->tpl_vars['value']->value['spu'];
            ?>
'" value="编辑"/>

                                    </td>
                                </tr>
                     <?php 
        }
        ?>
                </table>
            </div>
            <div class="bottomvar">
            	<div class="texvar">

            	</div>
            	<div class="pagination">
					<?php 
        echo $_smarty_tpl->tpl_vars['show_page']->value;
        ?>

            	</div>
            </div>
<?php 
        echo $_smarty_tpl->getSubTemplate("footer.htm", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);
    }
Exemple #12
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;
     }
 }
Exemple #13
0
function updatePurchaseIdModify($sku, $purchaseId, $userId, $isTranDL = true)
{
    $tName = 'pc_goods';
    $dataPurchaseArr = array();
    $dataPurchaseArr['purchaseId'] = $purchaseId;
    $where = "WHERE sku='{$sku}'";
    OmAvailableModel::updateTNameRow2arr($tName, $dataPurchaseArr, $where);
    $purchaseName = getPersonNameById($purchaseId);
    $userName = getPersonNameById($userId);
    error_log(date('Y-m-d_H:i') . " {$userName} 将 {$sku} 转移给了 {$purchaseName} \r\n", 3, WEB_PATH . "log/updatePurchaseIdModify.txt");
}
Exemple #14
0
 public function view_pkSpuByAuditTimeExcelOutPutOn()
 {
     $startTimeDate = $_POST['pkSpuAuditStartTime'];
     $endTimeDate = $_POST['pkSpuAuditEndTime'];
     if (empty($startTimeDate) || empty($endTimeDate)) {
         echo '起始时间不能为空!';
         exit;
     }
     $startTimeStr = strtotime($startTimeDate . ' 00:00:00');
     $endTimeStr = strtotime($endTimeDate . ' 23:59:59');
     if ($startTimeStr > $endTimeStr) {
         echo '开始时间不能大于结束时间!';
         exit;
     }
     $tName = 'pc_spu_archive';
     $select = 'spu,spuPurchasePrice,purchaseId,auditTime,secretInfo';
     $where = "WHERE spuStatus=51 AND auditStatus=2 AND auditTime>={$startTimeStr} AND auditTime<={$endTimeStr} AND is_delete=0 order by auditTime";
     $spuArchiveList = OmAvailableModel::getTNameList($tName, $select, $where);
     $fileName = "pkSpuExcel_" . $startTimeDate . '_' . $endTimeDate . ".xls";
     $excel = new ExportDataExcel('browser', $fileName);
     $excel->initialize();
     $tableHeader = array('登记日期', '被PK的SPU/SKU', '被PK料号描述', '原单价', '被PK采购', '被PK部门', 'PK料号', 'PK单价', '提交采购', '所属部门', '是否勾选被PK的SKU');
     $excel->addRow($tableHeader);
     $totalRows = array();
     foreach ($spuArchiveList as $value) {
         $tName = 'pc_spu_archive_pk_sku';
         $select = 'sku';
         $where = "WHERE spu='{$value['spu']}'";
         $pkSkuList = OmAvailableModel::getTNameList($tName, $select, $where);
         if (!empty($pkSkuList)) {
             foreach ($pkSkuList as $key => $valuePkSku) {
                 $row = array();
                 $tName = 'pc_goods';
                 $select = 'sku,goodsName,goodsCost,purchaseId';
                 $where = "WHERE sku='{$valuePkSku['sku']}' AND is_delete=0 order by goodsStatus limit 1";
                 $skuList = OmAvailableModel::getTNameList($tName, $select, $where);
                 $bePkedSpu = '';
                 //被PK料号
                 $bePkedSpuName = '';
                 //被PK料号描述
                 $bePkedSpuCost = '';
                 //被PK料号原价
                 $bePkedSpuPurchese = '';
                 //被PK料号采购
                 $bePkedSpuPurcheseDept = '';
                 //被PK料号
                 if (!empty($skuList)) {
                     $bePkedSpu = $skuList[0]['sku'];
                     $bePkedSpuName = $skuList[0]['goodsName'];
                     $tName = 'pc_goods_cost_history_record';
                     $select = 'purchaseCost';
                     $where = "WHERE sku='{$skuList[0]['sku']}' and addTime<='{$value['auditTime']}' order by addTime desc limit 1";
                     $CostUpdateRecordList = OmAvailableModel::getTNameList($tName, $select, $where);
                     if (!empty($CostUpdateRecordList)) {
                         //add by zqt 20140416
                         $bePkedSpuCost = $CostUpdateRecordList[0]['purchaseCost'];
                     } else {
                         $bePkedSpuCost = $skuList[0]['goodsCost'];
                     }
                     if (!empty($skuList[0]['purchaseId'])) {
                         $bePkedSpuPurchese = getPersonNameById($skuList[0]['purchaseId']);
                         $tmpArr = getDeptInfoByUserId($skuList[0]['purchaseId']);
                         $bePkedSpuPurcheseDept = $tmpArr[0]['dept_name'];
                     }
                 }
                 //PK料号信息
                 if ($key == 0) {
                     $auditTime = date('Y-m-d', $value['auditTime']);
                     //登记时间
                     $pkSpu = $value['spu'];
                     //PK料号
                     $pkSpuCost = $value['spuPurchasePrice'];
                     //PK成本
                     $pkSpuPurchse = getPersonNameById($value['purchaseId']);
                     //PK采购
                     $tmpArr = getDeptInfoByUserId($value['purchaseId']);
                     $pkSpuPurchseDept = $tmpArr[0]['dept_name'];
                     $isCheckedSku = 'Y';
                 } else {
                     $pkSpu = '';
                     $pkSpuCost = '';
                     $pkSpuPurchse = '';
                     $pkSpuPurchseDept = '';
                     $auditTime = '';
                     $isCheckedSku = '';
                 }
                 $row[] = $auditTime;
                 $row[] = $bePkedSpu;
                 $row[] = $bePkedSpuName;
                 $row[] = $bePkedSpuCost;
                 $row[] = $bePkedSpuPurchese;
                 $row[] = $bePkedSpuPurcheseDept;
                 $row[] = $pkSpu;
                 $row[] = $pkSpuCost;
                 $row[] = $pkSpuPurchse;
                 $row[] = $pkSpuPurchseDept;
                 $row[] = $isCheckedSku;
                 $excel->addRow($row);
             }
         } else {
             //如果没细分SKU的话
             $row = array();
             $tName = 'pc_goods';
             $select = 'sku,goodsName,goodsCost,purchaseId';
             $where = "WHERE spu='{$value['secretInfo']}' AND is_delete=0 order by goodsStatus limit 1";
             $skuList = OmAvailableModel::getTNameList($tName, $select, $where);
             $bePkedSpuName = '';
             //被PK料号描述
             $bePkedSpuCost = '';
             //被PK料号原价
             $bePkedSpuPurchese = '';
             //被PK料号采购
             $bePkedSpuPurcheseDept = '';
             //被PK料号
             if (!empty($skuList)) {
                 $bePkedSpuName = $skuList[0]['goodsName'];
                 $tName = 'pc_goods_cost_history_record';
                 $select = 'purchaseCost';
                 $where = "WHERE sku='{$skuList[0]['sku']}' and addTime<='{$value['auditTime']}' order by addTime desc limit 1";
                 $CostUpdateRecordList = OmAvailableModel::getTNameList($tName, $select, $where);
                 if (!empty($CostUpdateRecordList)) {
                     //add by zqt 20140416
                     $bePkedSpuCost = $CostUpdateRecordList[0]['purchaseCost'];
                 } else {
                     $bePkedSpuCost = $skuList[0]['goodsCost'];
                 }
                 if (!empty($skuList[0]['purchaseId'])) {
                     $bePkedSpuPurchese = getPersonNameById($skuList[0]['purchaseId']);
                     $tmpArr = getDeptInfoByUserId($skuList[0]['purchaseId']);
                     $bePkedSpuPurcheseDept = $tmpArr[0]['dept_name'];
                 }
             }
             //PK料号信息
             $pkSpu = $value['spu'];
             //PK料号
             $pkSpuCost = $value['spuPurchasePrice'];
             //PK成本
             $pkSpuPurchse = getPersonNameById($value['purchaseId']);
             //PK采购
             $tmpArr = getDeptInfoByUserId($value['purchaseId']);
             $pkSpuPurchseDept = $tmpArr[0]['dept_name'];
             $auditTime = date('Y-m-d', $value['auditTime']);
             //登记时间
             $bePkedSpu = $value['secretInfo'];
             //被PK料号
             $row[] = $auditTime;
             $row[] = $bePkedSpu;
             $row[] = $bePkedSpuName;
             $row[] = $bePkedSpuCost;
             $row[] = $bePkedSpuPurchese;
             $row[] = $bePkedSpuPurcheseDept;
             $row[] = $pkSpu;
             $row[] = $pkSpuCost;
             $row[] = $pkSpuPurchse;
             $row[] = $pkSpuPurchseDept;
             $row[] = 'N';
             $excel->addRow($row);
         }
     }
     $excel->finalize();
     exit;
 }
Exemple #15
0
 function act_addSpu()
 {
     $data = array();
     $data['spu'] = trim($_POST['spu']);
     $data['sort'] = trim($_POST['sort']);
     $data['prefix'] = trim($_POST['prefix']);
     $data['isSingSpu'] = trim($_POST['isSingSpu']);
     $data['createdTime'] = time();
     $data['purchaseId'] = $_SESSION['userId'];
     //验证生成的SPU是否合法
     if (!preg_match("/^[A-Z]{2}[0-9]{6}\$/", $data['spu'])) {
         self::$errCode = 01;
         self::$errMsg = "{$data['spu']} 不合法,请联系IT人员查看";
         return false;
     }
     if (intval($data['purchaseId']) <= 0) {
         self::$errCode = 02;
         self::$errMsg = "登陆超时,请重试";
         return false;
     }
     //验证spu是否已经存在
     $res = OmAvailableModel::getTNameCount('pc_auto_create_spu', "where spu='{$data['spu']}'");
     if (!empty($res)) {
         self::$errCode = 03;
         self::$errMsg = "{$data['spu']}已经存在,请重新生成";
         return false;
     } else {
         if (SpuModel::insertSkuRow($data)) {
             //这里添加对应销售人记录逻辑
             //addSalerInfoForAny($data['spu'], $data['isSingSpu'], $_SESSION['userId'], $_SESSION['userId']);//取消在申请SPU的时候添加销售人信息,改为在添加真实SKU的时候添加
             //
             $dataAuto = array();
             $dataAuto['sku'] = $data['spu'];
             $dataAuto['cguser'] = getPersonNameById($data['purchaseId']);
             $dataAuto['mainsku'] = $data['sort'];
             $dataAuto['status'] = 2;
             $dataAuto['addtime'] = time();
             if ($data['prefix'] == 'TK') {
                 $type = 4;
             }
             if ($data['prefix'] == 'MT') {
                 $type = 3;
             }
             if ($data['prefix'] == 'OS') {
                 $type = 6;
             }
             if ($data['prefix'] == 'CB') {
                 $type = 7;
             }
             $dataAuto['type'] = $type;
             OmAvailableModel::newData2ErpInterfOpen('pc.erp.addAutoCreatSpu', $dataAuto, 'gw88');
             return true;
         } else {
             self::$errCode = SpuModel::$errCode;
             self::$errMsg = '生成失败,请重试';
             return false;
         }
     }
 }
Exemple #16
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>';
     }
 }
 /**
  *功能:我自己运行的接口,批量更新数据,根据需求批量更新销售是陈智兴的虚拟料号,将其销售人员改为对应真实SPU的销售人员
  * */
 public function act_updateBatchForSalers()
 {
     $tName = 'pc_spu_saler_combine';
     $select = 'spu';
     $where = "WHERE is_delete=0 and platformId=2 and isAgree=2 and salerId=60";
     $combineSpuList = OmAvailableModel::getTNameList($tName, $select, $where);
     foreach ($combineSpuList as $value) {
         $combineSpu = $value['spu'];
         $tName = 'pc_goods_combine';
         $select = 'combineSku';
         $where = "WHERE is_delete=0 and combineSpu='{$combineSpu}'";
         $combineSkuList = OmAvailableModel::getTNameList($tName, $select, $where);
         if (!empty($combineSkuList)) {
             $tName = 'pc_sku_combine_relation';
             $select = 'sku';
             $where = "WHERE combineSku='{$combineSkuList[0]['combineSku']}'";
             $skuList = OmAvailableModel::getTNameList($tName, $select, $where);
             if (!empty($skuList)) {
                 $tName = 'pc_goods';
                 $select = 'spu';
                 $where = "WHERE is_delete=0 and sku='{$skuList[0]['sku']}'";
                 $spuList = OmAvailableModel::getTNameList($tName, $select, $where);
                 if (!empty($spuList)) {
                     $tName = 'pc_spu_saler_single';
                     $select = 'salerId';
                     $where = "WHERE is_delete=0 and platformId=2 and isAgree=2 and spu='{$spuList[0]['spu']}'";
                     $singleSpuSalerIdList = OmAvailableModel::getTNameList($tName, $select, $where);
                     if (!empty($singleSpuSalerIdList)) {
                         $salerId = $singleSpuSalerIdList[0]['salerId'];
                         $saler = getPersonNameById($salerId);
                         $tName = 'pc_spu_saler_combine';
                         $where = "WHERE is_delete=0 and spu='{$combineSpu}'";
                         $dataArr = array();
                         $dataArr['salerId'] = $salerId;
                         OmAvailableModel::updateTNameRow2arr($tName, $dataArr, $where);
                         echo "{$combineSpu} 的原销售是 陈智兴,真实销售是 {$saler} <br />";
                     } else {
                         echo "{$combineSpu} 的原销售是 陈智兴,真实销售为空 <br />";
                     }
                 }
             }
         }
     }
 }
 function act_unAuditSkuConversion()
 {
     $id = $_GET['id'] ? post_check(trim($_GET['id'])) : 0;
     $id = intval($id);
     $auditUserId = intval($_SESSION['userId']);
     $auditTime = time();
     if ($id <= 0) {
         self::$errCode = '100';
         self::$errMsg = "异常";
         return;
     }
     if ($auditUserId <= 0) {
         self::$errCode = '101';
         self::$errMsg = "登陆超时";
         return;
     }
     $tName = 'pc_sku_conversion';
     $select = 'id ,old_sku,new_sku,addUserId,createdTime,auditStatus';
     $where = "WHERE id={$id} and is_delete=0";
     $skuConNewSkuList = OmAvailableModel::getTNameList($tName, $select, $where);
     //在料号转换表中找到id所在记录的新料号new_sku
     //var_dump($skuConNewSkuList[0]);exit;
     $skuConId = $skuConNewSkuList[0]['id'];
     $old_sku = $skuConNewSkuList[0]['old_sku'];
     $new_sku = $skuConNewSkuList[0]['new_sku'];
     $addUserId = $skuConNewSkuList[0]['addUserId'];
     $createdTime = $skuConNewSkuList[0]['createdTime'];
     $addUser = getPersonNameById($addUserId);
     $auditStatus = $skuConNewSkuList[0]['auditStatus'];
     $paArr = array('old_sku' => $old_sku, 'new_sku' => $new_sku);
     //var_dump($paArr);exit;
     if (empty($skuConId)) {
         self::$errCode = '104';
         self::$errMsg = "记录{$old_sku}不存在";
         return;
     }
     if ($auditStatus != 2) {
         self::$errCode = '105';
         self::$errMsg = "记录{$old_sku} 不在审核状态,不能反审核";
         return;
     }
     try {
         BaseModel::begin();
         $tName = 'pc_sku_conversion';
         $set = "SET auditStatus='1',auditUserId='0',auditTime='0'";
         $where = "WHERE id={$id} and is_delete=0";
         //var_dump($data);exit;
         /* if(UserCacheModel::$errCode!=200){
         				self::$errCode	= 1088;
         				self::$errMsg	=  "erp中已存在{$old_sku}的转换记录";
         				return;
         			} */
         OmAvailableModel::updateTNameRow($tName, $set, $where);
         //先将转换记录修改
         $data = OmAvailableModel::newData2ErpInterfOpen("erp.deletePurchaseSkuConversion", $paArr, "88", false);
         BaseModel::commit();
         BaseModel::autoCommit();
         $auditUserName = getPersonNameById($auditUserId);
         error_log(date('Y-m-d_H:i') . " {$old_sku} 转 {$new_sku} 反审核成功 by {$auditUserName}({$auditUserId}) \r\n", 3, WEB_PATH . "log/skuConversionLog.txt");
         self::$errCode = 200;
         self::$errMsg = "{$old_sku}转{$new_sku}反审核成功";
         return;
     } catch (Exception $e) {
         BaseModel::rollback();
         BaseModel::autoCommit();
         self::$errCode = '404';
         self::$errMsg = $e->getMessage();
         return;
     }
 }