Exemple #1
0
 function act_getTypeInfo()
 {
     $cate = $_POST['cate'];
     $num = $_POST['num'];
     $sku = $_POST['sku'];
     $where = "where sampleTypeId='{$cate}' and minimumLimit<='{$num}' and maximumLimit>='{$num}' limit 1";
     $list = DetectStandardModel::getNowStandardList("*", $where);
     if ($list) {
         $list[0]['sku'] = get_sku_imgName($sku);
         return $list;
     } else {
         self::$errCode = "003";
         self::$errMsg = "未找到该类别的检测标准!";
         return false;
     }
 }
 public function view_openSampleType()
 {
     $standard_arr = array();
     $sampleType = DetectStandardModel::getSampleTypeList("*", "where 1");
     $this->smarty->assign('sampleType', $sampleType);
     $sampleStandardList = SampleStandardModel::getNowStandardList("*", "group by sName,sampleTypeId");
     foreach ($sampleStandardList as $sample) {
         $standard_arr[$sample['sampleTypeId']][] = array('sName' => $sample['sName'], 'is_open' => $sample['is_open']);
     }
     $this->smarty->assign('standard_arr', $standard_arr);
     $this->smarty->assign('secnev', '4');
     //二级导航
     $this->smarty->assign('module', '开启检测样本标准');
     $this->smarty->assign('username', $_SESSION['userName']);
     $navarr = array("<a href='index.php?mod=nowSampleStandard&act=sampleStandardList'>检测样本标准</a>", ">>", "开启检测样本标准");
     $this->smarty->assign('navarr', $navarr);
     $this->smarty->display('sampleStandardOpen.html');
 }
 public function view_onSampleCoefficient()
 {
     if (!isset($_SESSION['userId'])) {
         //检测用户是否登陆
         header('location:index.php?mod=login&act=index');
         exit;
     }
     $sampleCoefficientAct = new SampleCoefficientAct();
     $sampleTypeOnId = isset($_GET['sampleTypeOnId']) ? post_check($_GET['sampleTypeOnId']) : '';
     $cNameOn = isset($_GET['cNameOn']) ? post_check($_GET['cNameOn']) : '';
     if (empty($sampleTypeOnId) || empty($cNameOn)) {
         //为空时,跳转到列表页面,输出错误信息
         $status = '启动失败,id为空';
         header("location:index.php?mod=sampleCoefficient&act=getSampleCoefficientList&status={$status}");
         exit;
     }
     $return = $sampleCoefficientAct->act_onSampleCoefficient($cNameOn, $sampleTypeOnId);
     //启动该系数
     if ($return) {
         $flag = DetectStandardModel::updateSampleStandard();
         if ($flag) {
             $status = '启动成功,检测标准已自动更新';
         } else {
             $status = '启动成功,自动更新失败';
         }
     } else {
         $status = '找不到指定记录或已经启动';
     }
     header("location:index.php?mod=sampleCoefficient&act=getSampleCoefficientList&status={$status}");
 }
 function act_getnowStandard()
 {
     $update = DetectStandardModel::updateSampleStandard();
     if ($update) {
         return true;
     } else {
         self::$errCode = "003";
         self::$errMsg = "";
         return false;
     }
 }
 public static function updateSampleStandard()
 {
     self::initDB();
     self::delete('where 1');
     $sql = "select a.minimumLimit,a.maximumLimit,a.sampleTypeId,b.sampleNum,c.Ac,c.Re,c.Al,c.Rt\n\t\t\t\tfrom qc_sample_standard as a left join qc_sample_size_code as b on a.sizeCodeId=b.id\n\t\t\t\tleft join qc_sample_coefficient as c on a.sampleTypeId=c.sampleTypeId and b.id=c.sizeCodeId\n\t\t\t\twhere a.is_open=1 and c.is_open=1";
     $query = self::$dbConn->query($sql);
     if ($query) {
         $result = self::$dbConn->fetch_array_all($query);
         foreach ($result as $res) {
             $data = array();
             $data = array('sampleTypeId' => $res['sampleTypeId'], 'minimumLimit' => $res['minimumLimit'], 'maximumLimit' => $res['maximumLimit'], 'sampleNum' => $res['sampleNum'], 'Ac' => $res['Ac'], 'Re' => $res['Re'], 'Al' => $res['Al'], 'Rt' => $res['Rt']);
             self::insertRow($data);
         }
         return true;
     } else {
         self::$errCode = "003";
         self::$errMsg = "error";
         return false;
     }
 }