Example #1
0
 public function view_sampleSizeEditSubmit()
 {
     if (!isset($_SESSION['userName'])) {
         header('Location:index.php?mod=login&act=index');
     }
     //获取POST数据
     $sizeCode = "";
     $sampleNum = "";
     $EditId = "";
     if (isset($_POST['EditId']) && !empty($_POST['EditId'])) {
         $EditId = trim($_POST['EditId']);
     }
     if (isset($_POST['sizeCodeInput']) && !empty($_POST['sizeCodeInput'])) {
         $sizeCode = "sizeCode = '" . trim($_POST['sizeCodeInput']) . "'";
     }
     if (isset($_POST['sampleNumInput']) && !empty($_POST['sampleNumInput'])) {
         $sampleNum = "sampleNum = '" . trim($_POST['sampleNumInput']) . "'";
     }
     $this->where = $sizeCode . " , " . $sampleNum . " where id = " . $EditId;
     //验证是否修改信息
     global $dbConn;
     $existSql = "SELECT * FROM qc_sample_size_code WHERE id = {$EditId}";
     $existInfo = $dbConn->fetch_first($existSql);
     if ($existInfo['sizeCode'] == trim($_POST['sizeCodeInput']) && $existInfo['sampleNum'] == trim($_POST['sampleNumInput'])) {
         $urldata = array('msg' => array('操作错误,信息未改变!'), 'link' => 'index.php?mod=sampleStandard&act=sampleSizeEditList&EditId=' . $EditId);
         $urldata = urlencode(json_encode($urldata));
         header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
         exit;
     } else {
         $existRepeatSql = "SELECT * FROM qc_sample_size_code WHERE {$sizeCode} and id != {$EditId}";
         $existRepeatSql = $dbConn->fetch_first($existRepeatSql);
         if (empty($existRepeatSql)) {
             $qcStandard = new qcStandardAct();
             $list = $qcStandard->act_sampleSizeEditSubmit($this->where);
             if ($list) {
                 header('Location:index.php?mod=sampleStandard&act=sampleSizeList');
             } else {
                 $urldata = array('msg' => array('系统出错啦!'), 'link' => 'index.php?mod=sampleStandard&act=sampleSizeEditList&EditId=' . $EditId);
                 $urldata = urlencode(json_encode($urldata));
                 header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
                 exit;
             }
         } else {
             $urldata = array('msg' => array('此执行标准已经存在,请勿重复添加!'), 'link' => 'index.php?mod=sampleStandard&act=sampleSizeEditList&EditId=' . $EditId);
             $urldata = urlencode(json_encode($urldata));
             header('location:index.php?mod=showerror&act=showerror&data=' . $urldata);
             exit;
         }
     }
 }
Example #2
0
 public function view_iqcExportExcel()
 {
     header("Content-type:text/html;charset=utf-8");
     $condition = array();
     $where = "";
     $sku = trim($_POST['sku']);
     $d_status = $_POST['d_status'];
     //导出类型:0->显示所以信息 1:->不良品统计表导出
     $isCombine = $_POST['isCombine'];
     //是否合并:0->需要合并   1:->默认不合并
     $sellerId = $_POST['sellerId'];
     //大卖家ID
     $j_status = $_POST['j_status'];
     //检测类型
     $t_status = $_POST['t_status'];
     //SKU分类检测
     if (!empty($_POST['startTime']) && !empty($_POST['endTime'])) {
         $startTime = strtotime(trim($_POST['startTime']));
         //开始时间
         $endTime = strtotime(trim($_POST['endTime']));
         //结束时间
         $condition[] = "checkTime BETWEEN {$startTime} AND {$endTime}";
         $startTime = trim($_POST['startTime']);
         //开始时间
         $endTime = trim($_POST['endTime']);
         //结束时间
     }
     $condition[] = "sellerId = '{$sellerId}'";
     if (!empty($j_status)) {
         $condition[] = "checkTypeID = '{$j_status}'";
     }
     if (!empty($t_status)) {
         $condition[] = "skuTypeCheckID = '{$t_status}'";
     }
     if (!empty($sku)) {
         $condition[] = "sku = '{$sku}'";
     }
     $combine = false;
     if ($d_status == 1) {
         if ($isCombine == 0) {
             $combine = true;
             $condition[] = "rejectsNum > 0 GROUP BY sku";
         } else {
             $condition[] = "rejectsNum > 0";
         }
     }
     $where = "where " . implode(" and ", $condition);
     $IqcCompleteInfoAct = new IqcCompleteInfoAct();
     $iqcCompleteInfoList = $IqcCompleteInfoAct->act_iqcCompleteInfo($where, $combine);
     //echo "<pre>"; print_r($iqcCompleteInfoList); exit;
     //检测类型
     $qcStandard = new qcStandardAct();
     $detectionTypeArrList = $qcStandard->act_detectionTypeList($this->where);
     $detectionTypeArr = array();
     foreach ($detectionTypeArrList as $listValue) {
         $detectionTypeArr[$listValue['id']] = $listValue['typeName'];
     }
     //SKU分类检测
     $qcStandard = new qcStandardAct();
     $skuTypeQcArrList = $qcStandard->act_skuTypeQcList($this->where);
     $skuTypeQcArr = array();
     foreach ($skuTypeQcArrList as $skuTypeList) {
         $skuTypeQcArr[$skuTypeList['id']] = $skuTypeList['typeName'];
     }
     //echo "<pre>";print_r($detectionTypeArrList); exit;
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")->setLastModifiedBy("Maarten Balliauw")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', '导出类型');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1', '料号');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1', '名称');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('D1', '到货数');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('E1', '检测类型');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('F1', '抽检数');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('G1', 'SKU分类检测');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('H1', '不良数');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('I1', '不良原因');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('J1', '检测人');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('K1', '检测时间');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('L1', '大卖家');
     //echo "<pre>"; print_r($iqcCompleteInfoList); exit;
     if ($d_status == 1) {
         $objPHPExcel->setActiveSheetIndex(0)->getCell('A2')->setValueExplicit('不良品统计表', PHPExcel_Cell_DataType::TYPE_STRING);
     } else {
         $objPHPExcel->setActiveSheetIndex(0)->getCell('A2')->setValueExplicit('检测信息统计', PHPExcel_Cell_DataType::TYPE_STRING);
     }
     $a = 2;
     if (!empty($iqcCompleteInfoList)) {
         foreach ($iqcCompleteInfoList as $key => $iqcExportArr) {
             //echo $skuTypeQcArr[$iqcExportArr['skuTypeCheckID']]; echo "<br>";
             if (is_numeric($iqcExportArr['checkUser'])) {
                 $username = UserModel::getUsernameById($iqcExportArr['checkUser']);
                 if (!empty($username)) {
                     $iqcExportArr['checkUser'] = $username;
                 }
             }
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue('B' . $a, $iqcExportArr['sku']);
             //SKU导出类型修改 add by chenwei 2013.12.20
             //$objPHPExcel->setActiveSheetIndex(0)->getCell('B'.$a)->setValueExplicit($iqcExportArr['sku'], PHPExcel_Cell_DataType::TYPE_STRING);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('C' . $a)->setValueExplicit(Deal_SC($iqcExportArr['goodsName']), PHPExcel_Cell_DataType::TYPE_STRING);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('D' . $a)->setValueExplicit($iqcExportArr['arrivalNum'], PHPExcel_Cell_DataType::TYPE_STRING);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('E' . $a)->setValueExplicit($detectionTypeArr[$iqcExportArr['checkTypeID']], PHPExcel_Cell_DataType::TYPE_STRING);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('F' . $a)->setValueExplicit($iqcExportArr['checkNum'], PHPExcel_Cell_DataType::TYPE_NUMERIC);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('G' . $a)->setValueExplicit(@$skuTypeQcArr[$iqcExportArr['skuTypeCheckID']], PHPExcel_Cell_DataType::TYPE_STRING);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('H' . $a)->setValueExplicit($iqcExportArr['rejectsNum'], PHPExcel_Cell_DataType::TYPE_NUMERIC);
             //TYPE_NUMERIC 数值型 ADD BY chenwei 2013.12.20
             $objPHPExcel->setActiveSheetIndex(0)->getCell('I' . $a)->setValueExplicit($iqcExportArr['rejectsReason'], PHPExcel_Cell_DataType::TYPE_STRING);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('J' . $a)->setValueExplicit($iqcExportArr['checkUser'], PHPExcel_Cell_DataType::TYPE_STRING);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('K' . $a)->setValueExplicit(date("Y-m-d H:i:s", $iqcExportArr['checkTime']), PHPExcel_Cell_DataType::TYPE_STRING);
             $objPHPExcel->setActiveSheetIndex(0)->getCell('L' . $a)->setValueExplicit('赛维网络', PHPExcel_Cell_DataType::TYPE_STRING);
             //echo $a.'&nbsp;&nbsp;&nbsp;'.$iqcExportArr['sku'].'&nbsp;&nbsp;&nbsp;'.$iqcExportArr['goodsName'].'<br/>';
             $a++;
         }
     }
     $objPHPExcel->getActiveSheet(0)->getStyle('A1:N500')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('A')->setWidth(20);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('B')->setWidth(30);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('C')->setWidth(50);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('F')->setWidth(10);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('E')->setWidth(20);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('D')->setWidth(10);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('G')->setWidth(20);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('H')->setWidth(10);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('I')->setWidth(50);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('J')->setWidth(15);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('K')->setWidth(30);
     $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension('L')->setWidth(20);
     $title = "QcWorkInfoExport" . date('Y-m-d');
     $titlename = "QcWorkInfoExport" . date('Y-m-d') . ".xls";
     $objPHPExcel->getActiveSheet()->setTitle($title);
     $objPHPExcel->setActiveSheetIndex(0);
     header('Content-Type: application/vnd.ms-excel');
     header("Content-Disposition: attachment;filename={$titlename}");
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
     exit;
 }
Example #3
0
 function act_getSkuInfo()
 {
     global $memc_obj;
     $sku_name = '';
     $cate = '';
     $sku = $_POST['sku'];
     if (is_numeric($sku) && $sku > 1000000) {
         //此sku为goods_code
         $goods_codes = WhStandardModel::goods_codeTosku($sku);
         $sku = $goods_codes['sku'];
     }
     //读取数据库
     $categoryStr = "";
     //$time1 = time();
     //SKU信息API接口
     $OmAvailableApiAct = new OmAvailableApiAct();
     $skuInfo = $OmAvailableApiAct->act_getGoodsInfoBySku($sku);
     $skuInfo = $skuInfo['data'];
     //$skuInfo       = $memc_obj->get_extral('pc_goods_'.$sku);
     $reSku = $skuInfo['sku'];
     //接口返回SKU
     $reSpu = $skuInfo['spu'];
     //接口返回SKU
     $skuName = $skuInfo['goodsName'];
     //产品描述
     $purchaseId = $skuInfo['purchaseId'];
     //采购人ID
     $goodsCategory = $skuInfo['goodsCategory'];
     //SKU分类path
     $qcCategoryListAct = new qcCategoryListAct();
     $where = 'WHERE is_delete=0 and path= "' . $goodsCategory . '"';
     $categoryList = $qcCategoryListAct->act_getCategoryList('*', $where);
     $getCategoryArr = $qcCategoryListAct->act_getCategoryArr();
     //获取产品类别列表信息
     $sampleTypeListId = empty($categoryList) ? 1 : $categoryList[0]['sampleTypeId'];
     $qcStandard = new qcStandardAct();
     $skuTypeQcArrList = $qcStandard->act_skuTypeQcList('');
     $sampleTypeList = array();
     $categoryInfo_ids = array();
     $categoryInfo = array();
     foreach ($skuTypeQcArrList as $skuTypeQcArrListValue) {
         $categoryInfo[$skuTypeQcArrListValue['id']] = $skuTypeQcArrListValue['typeName'];
         $sampleTypeList[$skuTypeQcArrListValue['id']] = $skuTypeQcArrListValue['typeName'] . "  " . $skuTypeQcArrListValue['describe'];
     }
     $goodsCategoryNameArray = explode("-", $goodsCategory);
     $goodsCategoryName = array();
     foreach ($goodsCategoryNameArray as $cvalue) {
         $goodsCategoryName[] = $getCategoryArr[$cvalue];
     }
     $goodsCategoryNameStr = join('-', $goodsCategoryName);
     //$categoryInfo_ids = array_keys($categoryInfo_ids);
     //$categoryStr = $sampleTypeList[$sampleTypeListId];
     //$img_return = $OmAvailableApiAct->act_getAllPic($reSpu, 'F');//图片接口
     //var_dump($img_return); exit;
     $data = UserCacheModel::qccenterGetErpGoodscount($sku);
     $goods_count = $data['goods_count'];
     /*$goods_location = $data['goods_location'];
     		$cguser = $data['cguser'];*/
     //$categoryL     = explode('-',$goodsCategory);
     /*foreach($category as $c_key=>$categoryArr){
     			if(in_array($categoryL[0],$categoryArr)){
     				if($c_key == '1'){
     					//SKU分类信息API接口
     					$cate			  = 1;
     					$goodsCategorySt  = $memc_obj->get_extral('pc_goods_category_'.$goodsCategory);
     					$categoryStr      = "{$goodsCategorySt['name']}:功能检测";	
     					break;
     				}else if($c_key == '2'){
     					//SKU分类信息API接口
     					$cate			  = 2;
     					$goodsCategorySt  = $memc_obj->get_extral('pc_goods_category_'.$goodsCategory);
     					$categoryStr    = "{$goodsCategorySt['name']}:尺寸质量检测";
     					break;
     				}else if($c_key == '3'){
     					//SKU分类信息API接口
     					$cate			  = 3;
     					$goodsCategorySt  = $memc_obj->get_extral('pc_goods_category_'.$goodsCategory);
     					$categoryStr    = "{$goodsCategorySt['name']}:对图检测";
     					break;
     				}
     			}else{
     				continue;	
     			}
     		}*/
     $where = "where sku='{$sku}' and is_delete=0 and sellerId=1 and getUserId='{$_SESSION['sysUserId']}' and detectStatus=1 order by getTime asc limit 1";
     $list = WhStandardModel::getNowWhList("*", $where);
     $num = $list[0]['num'];
     $infoid = $list[0]['id'];
     $goods_location = $list[0]['location'];
     $cguser = UserModel::getUsernameById($list[0]['purchaseId']);
     //$goods_count     = 'TEST';
     $where2 = "where sampleTypeId='{$sampleTypeListId}' and minimumLimit<='{$num}' and maximumLimit>='{$num}' limit 1";
     $list2 = DetectStandardModel::getNowStandardList("*", $where2);
     //如果是正常回测,获取待定回测信息备注
     $pendingInfo = PendingProductsModel::getPendingProductsList('backNote', ' WHERE infoId=' . $infoid);
     if ($pendingInfo) {
         $backNote = $pendingInfo[0]['backNote'];
     }
     //$time2 = time();
     //echo ($time2-$time1);
     if ($list) {
         self::$errCode = "200";
         $info = array();
         $info['info'] = "{$reSku} {$skuName} <br> 产品分类: {$goodsCategoryNameStr} <br>【 来货 {$num} 个,现有库存 " . $goods_count . " 个,仓位:" . $goods_location . ",采购:{$cguser} 】";
         $info['category'] = $sampleTypeListId;
         $info['categoryInfo'] = $categoryInfo;
         $info['sku'] = $reSku;
         $info['spu'] = $reSpu;
         $info['num'] = $num;
         $info['infoid'] = $infoid;
         $info['cate'] = $list2;
         $info['images'] = $img_return['data']['Description'][0];
         $info['backNote'] = !empty($backNote) ? $backNote : '';
         return $info;
     } else {
         self::$errCode = "003";
         self::$errMsg = "未找到该料号[{$sku}]对于的{$_SESSION['userName']}领取记录!";
         return false;
     }
 }