Пример #1
0
 /**
  * 일반
  */
 private function bid_b($workload)
 {
     $bidkey = BidKey::findOne($workload['bidid']);
     if ($bidkey !== null) {
         return;
     }
     $bidkey = new BidKey();
     $bidkey->bidid = $workload['bidid'];
     $bidkey->notinum = $workload['notinum'];
     $bidkey->notinum_ex = $workload['notinum_ex'];
     $bidkey->whereis = $workload['whereis'];
     $bidkey->syscode = $workload['syscode'];
     $bidkey->bidtype = $workload['bidtype'];
     $bidkey->bidview = $workload['bidview'] ? $workload['bidview'] : $workload['bidtype'];
     $bidkey->constnm = $workload['constnm'];
     $bidkey->org_i = $workload['org_i'];
     $bidkey->orgcode_y = $workload['orgcode_y'];
     //도로공사 bidseq 저장 (차수정보)
     $bidkey->bidcls = $workload['bidcls'];
     $bidkey->succls = $workload['succls'];
     $bidkey->conlevel = $workload['conlevel'];
     $bidkey->noticedt = $workload['noticedt'];
     $bidkey->registdt = $workload['registdt'];
     $bidkey->basic = $workload['basic'];
     $bidkey->presum = $workload['presum'];
     $bidkey->contract = $workload['contract'];
     $bidkey->opendt = $workload['opendt'];
     $bidkey->closedt = $workload['closedt'];
     $bidkey->constdt = $workload['constdt'];
     $bidkey->explaindt = $workload['explaindt'];
     $bidkey->agreedt = $workload['agreedt'];
     $bidkey->pqdt = $workload['pqdt'];
     $bidkey->convention = $workload['convention'];
     $bidkey->location = $workload['location'];
     $bidkey->bidproc = 'B';
     $bidkey->state = $workload['state'];
     $bidkey->writedt = $workload['writedt'] ? $workload['writedt'] : date('Y-m-d H:i:s');
     $bidkey->editdt = date('Y-m-d H:i:s');
     $bidkey->opt = $workload['opt'];
     $bidkey->state = 'N';
     $maxno = $this->module->db->createCommand("select max([[no]]) from bid_key")->queryScalar();
     $bidkey->no = $maxno + 1;
     $codeorg = CodeOrgI::findByOrgname($bidkey->org_i);
     if ($codeorg !== null) {
         $bidkey->orgcode_i = $codeorg->org_Scode;
     }
     $bidvalue = BidValue::findOne($bidkey->bidid);
     if ($bidvalue === null) {
         $bidvalue = new BidValue(['bidid' => $bidkey->bidid]);
     }
     $bidvalue->yegatype = $workload['yegatype'];
     $bidvalue->yegarng = $workload['yegarng'];
     $bidvalue->charger = $workload['charger'];
     $bidvalue->multispare = $workload['multispare'];
     $bidcontent = BidContent::findOne($bidkey->bidid);
     if ($bidcontent === null) {
         $bidcontent = new BidContent(['bidid' => $bidkey->bidid]);
     }
     $bidcontent->orign_lnk = $workload['orign_lnk'];
     $bidcontent->attchd_lnk = $workload['attchd_lnk'];
     $bidcontent->bidcomment = $workload['bidcomment'];
     if (isset($workload['bid_html'])) {
         $bidcontent->bid_html = $workload['bid_html'];
     }
     try {
         if (is_array($workload['goods'])) {
             foreach ($workload['goods'] as $g) {
                 $bidgoods = new BidGoods(['bidid' => $bidkey->bidid, 'seq' => $g['seq'], 'gcode' => $g['gcode'], 'gname' => $g['gname'], 'standard' => $g['standard'], 'unit' => $g['unit'], 'cnt' => $g['cnt']]);
                 $bidgoods->save();
             }
         }
         $sublocal = '';
         if (is_array($workload['bid_local'])) {
             foreach ($workload['bid_local'] as $loc) {
                 $code = codeLocal::findByName($loc['name']);
                 if ($code !== null) {
                     $tname = str_replace($loc['hname'], '', $code->name);
                     if (strpos($sublocal, $tname) === false) {
                         $bidlocal = new BidLocal(['bidid' => $bidkey->bidid, 'name' => $loc['name'], 'code' => $code->code]);
                         if ($sublocal == '') {
                             $sublocal = trim($tname);
                         } else {
                             $sublocal = $sublocal . ',' . trim($tname);
                         }
                         $sublocal = trim($sublocal);
                         $bidlocal->save();
                     }
                 }
             }
             if ($sublocal !== '' and ($bidkey->opt & pow(2, 11)) == 0) {
                 $bidkey->opt += pow(2, 11);
             }
         }
         $this->stdout(" > {$sublocal}\n", Console::FG_GREEN);
         $this->stdout(" > {$bidkey->constnm}\n", Console::FG_GREEN);
         if ($bidkey->constnm !== null and $sublocal !== '') {
             if (strpos($bidkey->constnm, '//') !== false) {
                 $bidkey->constnm = $bidkey->constnm . '(' . $sublocal . ')';
             } else {
                 $bidkey->constnm = $bidkey->constnm . '//' . '(' . $sublocal . ')';
             }
         }
         $this->stdout(" > {$bidkey->constnm}\n", Console::FG_GREEN);
         $bidkey->save();
         $bidvalue->save();
         $bidcontent->save();
         if (($bidkey->opt & pow(2, 1)) > 0) {
             $this->stdout(" > 정정공고 입력이 완료되었습니다.\n", Console::FG_GREEN);
         } else {
             $this->stdout(" > 일반공고 입력이 완료되었습니다.\n", Console::FG_GREEN);
         }
     } catch (\Exception $e) {
         throw $e;
     }
 }
Пример #2
0
 public function getBidGoods()
 {
     return $this->hasMany(BidGoods::className(), ['bidid' => 'bidid']);
 }