/** * 获取下拉框的值 */ public function getList() { try { $action = new FaultLogsAction(); $result = $action->getList(); return $result; } catch (Exception $e) { system_out("FaultLogs.getList error:" . $e); throw new Exception($e); } }
/** * 删除数据 * * @param array $data * @return boolean */ public function deleted($data) { try { $action = new ComplaintAction(); $result = $action->delete($data); return true; } catch (Exception $e) { system_out("Complaint.delete error:" . $e); throw new Exception($e); } }
/** * 删除 * * @param $data * @return boolean */ public function del($data) { try { $dao = new BilltypeDao(); if ($data["id"] != '') { $dao->deleteById($data["id"]); } } catch (Exception $e) { system_out("BilltypeSetup exception:" . $e); return false; } }
/** * 删除共享内存的值 * * @param string $name //变量名 * @return object //返回值 */ public static function delShareMemory($name) { try { $shm = new ShmBase(MSG_SEMKEY, MSG_SHMKEY, SHARE_MEM_SIZE); $ret = $shm->lock(); if ($ret) { $tasks = $shm->delete($name); $shm->unlock(); return true; } } catch (Exception $e) { system_out("ShareMemory.getShareMemory error:{$e}"); return false; } return false; }
public function save($data) { try { $dao = new CheckoutCardDao(); system_out(print_r($data['installer_logger'], true)); if ($data["id"] != '' && $data["id"] != 0) { $vo = $dao->createVo('modify', '', 'id', $data["id"], $data); $result = $dao->save($vo); } else { $vo = $dao->createVo('add', '', 'id', 0, $data); $result = $dao->add($vo); } return $result; } catch (Exception $e) { throw new Exception($e); } }
/** * 扫一位置,再扫一表置确认 * * @param string $billdata * @return boolean */ private function confirmInStationBK1($billdata) { try { $struct = new StructControlAction(); //关闭状态 //开表灯 $station = ''; $code = ''; system_out("starting trunoff light"); $result = $struct->trunOff(array("No" => "GN05"), array("GN05A0101"), 'put'); if (!$result) { system_out("trun off false"); } else { system_out("trun off succeed"); } } catch (Executive $e) { system_out("StocksManager.ConfirmInStationBk1 error:{$e}"); throw new Exception($e); } //返回值 return $confirmerror; }
/** * 获取系统菜单 * * @param String $loginname */ public function getMenu($loginname = '') { try { $dao = new ModulesDao(); $result = $dao->findAll("upnode='0' and enabled = 1", '', '*', 'moduleNo'); if ($result->isEmpty()) { throw new Exception("没有系统菜单项"); } $parent = $result->toResultSet(); $dao->commit(); $ddo = new ModulesDao(); $result = $ddo->findAll(); system_out("ddo result:" . print_r($result, true)); for ($i = 0; $i < sizeof($parent); $i++) { $node = $parent[$i]["moduleNo"]; $result = $dao->findAll("upnode='{$node}' and enabled = 1", '', '*', 'moduleNo'); $rtn[$i][0] = $parent[$i]; $rtn[$i][1] = $result->toResultSet(); } return $rtn; } catch (Exception $e) { throw new Exception($e->getMessage()); } }
/** *获取数据 * * @return unknown */ public function readData() { $result = $this->read(); if (false === $result) { return false; } system_out("in rtn1[" . strlen($result) . "]:" . $result); $result = ereg_replace("[^a-zA-Z0-9]", '', $result); system_out("in rtn2[" . strlen($result) . "]:" . $result); system_out("in code:" . $result); switch ($this->type) { case 'type1': $this->device = substr($result, 0, 2); $result = substr($result, 2); default: } $len = strlen($result); return $result; }
/** * 删除库房 * @param $id * @return boolean */ public function deleted($data) { try { $storeage = new StorageDao(); //检查仓库是否已经使用 $storageName = $data["storageName"]; $stocks = new CurrentStocksDao(); $count = $stocks->getCount("place='{$storageName}' or station = '{$storageName}'"); if ($count > 0) { $this->setError("该" . $data['stype'] . "含有库存,不能删除!"); return false; } $id = $data["id"]; $result = $storeage->deleteById($id); } catch (Exception $e) { system_out("StorageAction delete exception:" . $e); throw new Exception($e); } return $result; }
/** * 保存接口配置 * * @param object $data */ public function saveInterfaceParm($data) { if (empty($data)) { return; } try { $dao = new SystemDao(); $dao->deleteAll("paramname like 'interface%'"); foreach ($data as $key => $value) { $vo = new SystemVo(); $vo->paramname = $key; $vo->paramvalue = $value; $dao->add($vo); Session::set($key, $value); } } catch (Exception $e) { system_out($e); return false; } return true; }
/** * 通过条码字典获取条码信息 * * @param $code */ private function getInfoByCodeFromCodeDict($code) { if (!Session::is_set('codeparm') || !Session::is_set('codedict')) { return false; } $codeparm = Session::get('codeparm'); $codedict = Session::get('codedict'); $codeinfo = array(); foreach ($codeparm as $key => $value) { $s = (int) $value["start"] - 1; $l = $value["length"]; $data = $codedict[$key][substr($code, $s, $l)]; if ($data == '' || $data == null) { continue; } switch ($key) { case '品名': $codeinfo['goodsName'] = $data; break; case '型号': $codeinfo['spec'] = $data; break; case '电流': $codeinfo['current1'] = $data; break; case '电压': $codeinfo['voltage1'] = $data; break; case '方向': $codeinfo['direct'] = $data; break; case '常数': $codeinfo['constant'] = $data; break; case '等级': $codeinfo['grade'] = $data; break; case '生产厂商': $codeinfo['madeIn'] = $data; break; case '生产日期': $codeinfo['madeDate'] = $data; break; } } system_out(print_r($codeinfo, true)); if (sizeof($codeinfo)) { $codeinfo['code'] = $code; return $codeinfo; } else { return false; } }
/** +---------------------------------------------------------- * 重新编译项目全部模版 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @param mixed $tmplContent 模板内容 * @param string $charset 模板输出字符集 +---------------------------------------------------------- * @return string +---------------------------------------------------------- */ public function buildAllTemplate($tmplPath = TMPL_PATH) { // 遍历模版目录 $themes = scandir($tmplPath); foreach ($themes as $key => $theme) { $modules = scandir($tmplPath . $theme); foreach ($modules as $key => $module) { $actions = scandir($tmplPath . $theme . '/' . $module); foreach ($actions as $key => $file) { //读出原模板内容 $tmplTemplateFile = $tmplPath . $theme . '/' . $module . '/' . $file; $tmplContent = file_get_contents($tmplTemplateFile); //编译模板内容 $tmplContent = $this->compiler($tmplContent); //重写Cache文件 $tmplCacheFile = CACHE_PATH . md5($tmplTemplateFile) . C('CACHFILE_SUFFIX'); if (false === file_put_contents($tmplCacheFile, trim($tmplContent))) { system_out('模版缓存文件' . $tmplCacheFile . '写入失败!'); } } } } }
/** * 接受数据 * * @param int $count * @param bool $command * @return string | bool */ protected function read($count = 128, $command = false) { if (false === COM_TO_NET) { return $this->serial->readPort(); } if (!is_resource($this->socket)) { $this->setError("Please call open function first!"); return false; } socket_set_nonblock($this->socket); $content = ''; //是否设置了重试值 if ($this->timeOut) { $while = true; $trytimes = 1; while ($while) { $content = socket_read($this->socket, $count); if (false === $content) { if (11 == socket_last_error($this->socket)) { usleep(1000 * 200); } else { $this->setError = "Read failed! reason: " . socket_strerror(socket_last_error($this->socket)); return false; } } elseif (strlen($content) > 1) { $while = false; } //timeout $trytimes++; if ($trytimes > $this->timeOut) { $this->setError("Read time out!"); return false; } } } else { $content = socket_read($this->socket, $count); if (false === $content) { $error = "Read failed! reason: " . socket_strerror(socket_last_error($this->socket)); $this->setError($error); return false; } } //显示结果 $readdata = ''; $unpack = unpack("C*", $content); foreach ($unpack as $value) { $readdata .= sprintf("%02s", sprintf("%x", $value)); } $this->setLogs("read result:{$readdata}"); if (SHOWCOMMAND === true) { system_out("readdata:" . $readdata); } //system_out("Read Len :" . strlen($content)); if ($command) { return $content; } else { return substr($content, 2); } }
/** * 删除条码对照表 * * @param object $data */ public function delCodeDict($data) { try { system_out(print_r($data, true)); $dao = new CodeDictDao(); if ($data["id"] != '') { $dao->deleteById($data["id"]); } } catch (Exception $e) { system_out("CodeRuleSetup exception:" . $e); return false; } return true; }
/** * /表架开一位置灯,确认一表 * * @param string $billdate * @param array $data * @return boolean */ private function confirmInStationBK2($billdate, $data) { try { $stocksmanager = new StocksManagerAction(); $scanner = new ScannerADD(Session::get('scanneradd'), Session::get('scannerport')); $action = new ConfirmStationAction(); $struct = new StructControlAction(); $device = null; //条码枪地址 //确认错误信息 $confirmerror = array(); //循环参数 $while = true; //删除错误信息 ShareMemory::delShareMemory("confirmerror"); //设置共享内存 ShareMemory::setShareMemory("while", $while); $station = ''; $code = ''; $limit = 0; //第一个灯位 if (sizeof($data) > 0) { $station = $data[0]; //开灯 $struct->trunOnPutLightByStation(array($station)); } else { return; } //进行无限循环 while ($while) { sleep(1); //当前的位置码 //system_out("station:".$station); //如果错了三次,则该表位跳过 if ($limit >= 3) { array_push($confirmerror, "[{$station}]表位确认不成功!"); ShareMemory::setShareMemory('confirmerror', $confirmerror); //将该位置码去掉 array_shift($data); //获取新的位置码,并重新初始 if (sizeof($data) > 0) { $station = $data[0]; $code = ''; $limit = 0; //开灯 $struct->trunOnPutLightByStation($station); } else { array_push($confirmerror, "表位进行确认完毕,如果还有表位没确认,请重新开始程序!"); ShareMemory::setShareMemory("confirmerror", $confirmerror); return true; } } //读取是否有人为中断 $while = ShareMemory::getShareMemory("while"); if (!$while) { system_out("break by user"); //array_push($confirmerror,"人为中断确认!"); ShareMemory::setShareMemory("confirmerror", $confirmerror); break; } //读取数据 $rtn = $scanner->readData(); if ($rtn == '' || $rtn == null || $rtn == false) { continue; } $rtn = strtoupper($rtn); //system_out("result:".$rtn); $device = substr($rtn, 0, 2); $rtn = substr($rtn, 2); //如果编码是表位,则退出 if (substr($rtn, 0, 2) == 'GN') { //亮红灯 $scanner->sendRedLight($device); $scanner->readData(); array_push($confirmerror, "请扫描表码,不要扫描位置码!"); ShareMemory::setShareMemory('confirmerror', $confirmerror); $limit++; continue; } else { //设置表码 $code = $rtn; } //end if 1 //如果两者都不为空,则确认 if ($station != '' && $station != '*' && $code != '' && $code != '*') { //开始确认挂表位置和表的关系 $item["station"] = $station; $item["code"] = $code; $result = $action->confirmInstation($billdate, $item); //确认失败 if (!$result) { //亮红灯 $scanner->sendRedLight($device); $scanner->readData(); $result = $action->getError(); //输出错误 system_out("confirm error:" . $result); array_push($confirmerror, $result); //将错误信息写进共享内存 ShareMemory::setShareMemory('confirmerror', $confirmerror); $code = ''; $limit++; continue; } //确认成功 //亮绿灯 $scanner->sendGreenLight($device); $scanner->readData(); //将该位置码去掉 array_shift($data); //如果所有的表都扫完了,则终止循环 if (sizeof($data) == 0) { array_push($confirmerror, "表位进行确认完毕,如果还有表位没确认,请重新开始程序!"); ShareMemory::setShareMemory("confirmerror", $confirmerror); ShareMemory::setShareMemory("while", false); $struct->close(array("No" => substr($station, 0, 4)), 'put'); break; } else { $station = $data[0]; $code = ''; $limit = 0; //开灯 $struct->trunOnPutLightByStation(array($station)); } } //end if 2 } } catch (Executive $e) { system_out("StocksManager.confirmInStationBK2 error:{$e}"); throw new Exception($e); } //返回值 return $confirmerror; }
/** * 周转箱确认方式 * * @param string $billdata * @return boolean */ private function confirmInStationBK3($billdata) { try { $type = Session::get('scannertype') ? Session::get('scannertype') : 'type1'; $stocksmanager = new StocksManagerAction(); $scanner = new ScannerADD(Session::get('scanneradd'), Session::get('scannerport'), $type); $action = new ConfirmStationAction(); $struct = new StructControlAction(); $device = null; //条码枪地址 //确认错误信息 $confirmerror = array(); //循环参数 $while = true; //删除错误信息 ShareMemory::delShareMemory("confirmerror"); //设置共享内存 ShareMemory::setShareMemory("while", $while); $boxhead = Session::get('boxhead'); $boxheadlength = Session::get('boxheadlength'); $station = ''; $code = ''; system_out("start confirmInStationBK3"); //进行无限循环 while ($while) { sleep(1); //读取是否有人为中断 $while = ShareMemory::getShareMemory("while"); if (!$while) { //array_push($confirmerror,"人为中断确认!"); ShareMemory::setShareMemory("confirmerror", $confirmerror); break; } //读取数据 $rtn = $scanner->readData(); if (!$rtn) { continue; } //$rtn = strtoupper($rtn); $device = $scanner->device; //如果是周转箱字母头,则设置station if (substr($rtn, 0, $boxheadlength) == $boxhead) { system_out("statino:" . $rtn); $station = $rtn; if ($type == 'type1') { $scanner->sendGreenLight($device); $scanner->readData(); } } else { //如果没有扫周转箱码,就扫表码,报错,重新开始 if ($station == '') { if ($type == 'type1') { $scanner->sendRedLight($device); $scanner->readData(); } $code = ''; array_push($confirmerror, "请先扫描周转箱:"); ShareMemory::setShareMemory('confirmerror', $confirmerror); continue; } else { //设置表码 $code = $rtn; } } //end if 1 //system_out("station:".$station); //system_out("code:".$code); //如果两者都不为空,则确认 if (trim($station) != '' && $station != null && trim($code) != '' && $code != null) { //system_out('begin confirm'); //开始确认挂表位置和表的关系 $item["station"] = $station; $item["code"] = $code; $result = $action->confirmInstation($billdata, $item); //确认失败 if (!$result) { $result = $action->getError(); array_push($confirmerror, $result); system_out($result); //将错误信息写进共享内存 ShareMemory::setShareMemory('confirmerror', $confirmerror); $code = ''; if ($type == 'type1') { $scanner->sendRedLight($device); $scanner->readData(); } continue; } //确认成功 if ($type == 'type1') { $scanner->sendGreenLight($device); $scanner->readData(); } //清空条码继续等待扫描 $code = ''; } //end if 2 } } catch (Executive $e) { system_out("StocksManager.confirmInStationBK3 error:{$e}"); throw new Executive($e); } //返回值 return $confirmerror; }
/** * 扫一位置,再扫一表置确认 * * @param string $billdata * @return boolean */ private function confirmInStationBK1($billdata) { try { $type = Session::get('scannertype') ? Session::get('scannertype') : 'type1'; $stocksmanager = new StocksManagerAction(); $scanner = new ScannerADD(Session::get('scanneradd'), Session::get('scannerport'), $type); $action = new ConfirmStationAction(); $struct = new StructControlAction(); $device = null; //条码枪地址 //确认错误信息 $confirmerror = array(); //循环参数 $while = true; //删除错误信息 ShareMemory::delShareMemory("confirmerror"); //设置共享内存 ShareMemory::setShareMemory("while", $while); //关闭状态 //开表灯 $station = ''; $code = ''; system_out("starting confirm"); //进行无限循环 while ($while) { sleep(1); //读取是否有人为中断 $while = ShareMemory::getShareMemory("while"); if (!$while) { //array_push($confirmerror,"人为中断确认!"); ShareMemory::setShareMemory("confirmerror", $confirmerror); break; } //读取数据 $rtn = $scanner->readData(); if (!$rtn) { continue; } //$rtn = strtoupper($rtn); $device = $scanner->device; if (substr($rtn, 0, 2) == 'GN') { //如果位置码位空,则设置位置码 if ($station == '') { //赋值位置码 $station = $rtn; if ($type == 'type1') { $scanner->sendGreenLight($device); $scanner->readData(); } continue; } else { //如果已经扫了表位,且不是原来那个,则报错,重新开始 if ($station != $rtn) { if ($type == 'type1') { $scanner->sendRedLight($device); $scanner->readData(); } $station = ''; $code = ''; continue; } else { if ($type == 'type1') { $scanner->sendGreenLight($device); $scanner->readData(); } continue; } } } else { //如果没有扫表位置码,就扫表码,报错,重新开始 if ($station == '') { if ($type == 'type1') { $scanner->sendRedLight($device); $scanner->readData(); } $station = ''; $code = ''; continue; } //设置表码 $code = $rtn; } //end if 1 //如果两者都不为空,则确认 if (trim($station) != '' && $station != '*' && trim($code) != '' && $code != '*') { //开始确认挂表位置和表的关系 $item["station"] = $station; $item["code"] = $code; $result = $action->confirmInstation($billdata, $item); //确认错误 if (!$result) { //亮红灯 if ($type == 'type1') { $scanner->sendRedLight($device); $scanner->readData(); } //获取错误 $result = $action->getError(); array_push($confirmerror, $result); system_out($result); //将错误信息写进共享内存 ShareMemory::setShareMemory('confirmerror', $result); $station = ''; $code = ''; continue; } //已确认 //亮绿灯 if ($type == 'type1') { $scanner->sendGreenLight($device); $scanner->readData(); } //关闭灯 try { system_out("starting trunoff light:{$station} ,length:" . strlen($station)); $result = $struct->trunOff(array("No" => substr($station, 0, 4)), array($station), 'put'); if ($result) { system_out("trunoff light succeed"); } else { system_out("trunoff light fault"); } } catch (Exception $e) { system_out("trunoff light error:" . $e->getMessage()); $error = $struct->getLogs(); system_out("错误日志:" . $error); $station = ''; $code = ''; continue; } //重置,开始新的等待 $station = ''; $code = ''; } //end if 2 } } catch (Executive $e) { system_out("StocksManager.ConfirmInStationBk1 error{$e}"); throw new Exception($e); } //返回值 return $confirmerror; }
/** * 如果是表架的,则删除表架灯开灯记录 * * @param array $data * @param string $state */ public function delUnconfirmStation($data, $state) { try { $confirm = new ConfirmStationAction(); if (is_array($data)) { $condition = "`station` in ('" . implode($data, "','") . "') and `state`='{$state}'"; } else { $condition = "`state`='{$state}'"; } $confirm->delUnconfirmStation($condition); } catch (Executive $e) { system_out("StocksManager.finishConfirn Exceptoin:{$e},condition:{$condition}"); throw new Exception($e); } return true; }
/** * 保存 * * @param Array $data Example:$data["modify"] = array() * $data["delete"} = array() * @return boolean true if succeed */ public function save($data) { //明细表 $stocks = new StocksDao(); $stocks->startTrans(); //当前库存表 $current = new CurrentStocksDao(); $current->startTrans(); $modify = $data["modify"]; $delete = $data["delete"]; //删除的数据 for ($i = 0; $i < sizeof($delete); $i++) { try { $tablename = StocksIndexAction::getSaveTableName($delete[$i]["billDate"]); if ($delete[$i]["id"] != '') { $vo = $stocks->find("id=" . $delete[$i]["id"], $tablename); //if($vo==true && $vo->station != '' && $vo->station != null) //{ // $stocks->rollback(); // $current->rollback() ; // $this->setError("[" . $delete[$i]["code"] . "]已经确认位置,不能删除"); // return false ; //} $rtn = $stocks->deleteById($delete[$i]["id"], $tablename); //减库存 if ($vo != null && !$vo->isEmpty()) { $rtn = $this->createCurrentStocks($current, '', $vo->toArray()); if (!$rtn) { $stocks->rollback(); $current->rollback(); $this->setError($this->getError()); return false; } } } //end if } catch (Exception $e) { $current->rollback(); $stocks->rollback(); throw new Exception($e); } //end try } //end for //保存人员近参数表 $otherparm = new OtherParmSetupAction(); $otherparm->addParm('other', 'member', $modify[0]['sendMan']); $mis = new MIS(); //添加/修改的数据 for ($i = 0; $i < sizeof($modify); $i++) { //保存进库存明细表 try { $tablename = StocksIndexAction::getSaveTableName($modify[$i]["billDate"]); if ($modify[$i]["id"] == '' || $modify[$i]["id"] == null || $modify[$i]["id"] == 0) { $vo = $stocks->createVo('add', '', 'id', 0, $modify[$i]); $result = $stocks->add($vo, $tablename); if (!$result) { $stocks->rollback(); $current->rollback(); system_out("StocksManagerActin.save error:新增数据保存出错,errcode:{$result}"); $this->setError("数据保存出错!"); return false; } //生成当前库存表 $rtn = $this->createCurrentStocks($current, $vo->toArray(), ''); if (!$rtn) { $current->rollback(); $stocks->rollback(); $this->setError($this->getError()); return false; } //增加条码索引 if ($vo->code != '' && $vo->code != null) { CodeIndexAction::addCodeIndex($vo->billDate, $vo->code); } //输出出库列表 $result = $mis->outPut($modify[$i]); } else { $vo = $stocks->find("id=" . $modify[$i]["id"], $tablename); if (!$vo) { $stocks->rollback(); $current->rollback(); $this->setError("数据保存出错,数据在保存前已被删除!"); return false; } $oldvo = clone $vo; //给Vo对象赋值 $this->refreshStocksInfo(&$vo, $modify[$i]); $result = $stocks->save($vo, $tablename); if (!$result) { $stocks->rollback(); $current->rollback(); system_out("StocksManagerActin.save error:修改数据保存出错,errcode:{$result}"); $this->setError("数据保存出错,数据在保存前已被删除!"); return false; } //生成当前库存表 $rtn = $this->createCurrentStocks($current, $vo->toArray(), $oldvo->toArray()); if (!$rtn) { $current->rollback(); $stocks->rollback(); $this->setError($this->getError()); return false; } } //end if } catch (Exception $e) { $current->rollback(); $stocks->rollback(); throw new Exception($e); } //end try } //end for $stocks->commit(); $current->commit(); return true; }
/** * 出仓发货确认 *@param array $data //单据数据 * @param string $code //表码 * @return Boolean */ public function confirmOutstation($data, $code) { try { $stocksmanager = new StocksManagerAction(); $result = $stocksmanager->queryCurrentStocks("code ='{$code}'"); if (sizeof($result) > 0) { $item = $result[0]; $item["inoutType"] = 'OUT'; $item["sysno"] = $data["sysno"]; $item["billType"] = $data["billType"]; $item["billDate"] = $data["billDate"]; $item["billNo"] = $data["billNo"]; $item["place"] = $data["place"]; $item["placeno"] = $data["placeno"]; $item["toplace"] = $data["toplace"]; $item["sendMan"] = $data["sendMan"]; $item["saveMan"] = $data["saveMan"]; $item["client"] = $data["client"]; $item["address"] = $data["address"]; $item["inqty"] = 0; $item["outqty"] = $item["qty"]; $item["id"] = ''; $data = array(); $data["modify"] = array($item); $rtn = $stocksmanager->save($data); if (!$rtn) { $error = $stocksmanager->getError(); $this->setError($error); return false; } return $rtn; } else { $this->setError("表库里没有该表"); return false; } } catch (Executive $e) { system_out("UnconfirmstationAction.confirmOutStation error:{$e},\n\t\t\t\t\t\tcode:{$code},data:" . print_r($data, true)); throw new Exception($e); } }
/** * 通过位置码开挂表灯 * @param array $place 要开等的位置码数组 */ public function trunOnPutLightByStation($place) { try { $data = array(); for ($i = 0; $i < sizeof($place); $i++) { $add = substr($place[$i], 0, 4); $parm["No"] = $add; if (array_key_exists($add, $data)) { if (substr($place[$i], 4, 1) == "A") { array_push($data[$add]->A, $place[$i]); } else { array_push($data[$add]->B, $place[$i]); } } else { $item = new structstemp(); $item->parm = $parm; if (substr($place[$i], 4, 1) == "A") { array_push($item->A, $place[$i]); } else { array_push($item->B, $place[$i]); } $data[$add] = $item; } } //开灯 foreach ($data as $val) { $parm = $val->parm; $places["A"] = $val->A; $places["B"] = $val->B; //关闭挂表状态 $this->close($parm, 'put'); $this->trunOn($parm, $places, 'put'); } } catch (Executive $e) { system_out("StocksManager.trunOnPutLightOnStation Exception:{$e}"); throw new Exception($e); } return true; }
/** * 确认出库表 * * @param array $data //单据信息 * @param string $station //周转想 * @param string $code //表码 * @retur Boolean */ private function confirmOutStation($data, $station = '', $code = '') { try { $confirm = new ConfirmStationAction(); $currentstocks = new StocksManagerAction(); //单表出仓 if ($code != '') { $result = $currentstocks->queryCurrentStocks("code = '{$code}'"); if (!$result) { return "库存里没有该表计[{$code}]!"; } $rtn = $confirm->confirmOutstation($data, $code); if (!$rtn) { $rtn = $confirm->getError(); } return $rtn; } elseif ($station != '') { $result = $currentstocks->queryCurrentStocks("station = '{$station}'"); if (sizeof($result) == 0) { return "库存里该周转箱[{$station}]没有表计!"; } for ($i = 0; $i < sizeof($result); $i++) { $rtn = $confirm->confirmOutstation($data, $result[$i]["code"]); if (!$rtn) { $rtn = $confirm->getError(); return $rtn; } } return $rtn; } } catch (Exception $e) { system_out("confirmOutStationBK1.confirmOutStation Error:" . $e->getMessage()); throw new Exception($e); } return true; }
/** +---------------------------------------------------------- * 自定义错误处理 +---------------------------------------------------------- * @access public +---------------------------------------------------------- * @param int $errno 错误类型 * @param string $errstr 错误信息 * @param string $errfile 错误文件 * @param int $errline 错误行数 +---------------------------------------------------------- * @return void +---------------------------------------------------------- */ public function appError($errno, $errstr, $errfile, $errline) { switch ($errno) { case E_ERROR: case E_USER_ERROR: $errorStr = "错误:[{$errno}] {$errstr} " . basename($errfile) . " 第 {$errline} 行.\n"; if (C('WEB_LOG_RECORD')) { system_out($errorStr); } halt($errorStr); break; case E_STRICT: case E_USER_WARNING: case E_USER_NOTICE: default: $errorStr = "注意:[{$errno}] {$errstr} " . basename($errfile) . " 第 {$errline} 行.\n"; self::$debug[] = $errorStr; break; } }
public function delLocaleLog($data) { try { $action = new CheckoutLocaleLogAction(); $result = $action->del($data); return $result ? true : false; } catch (Exception $e) { system_out("del locale error:" . $e); throw new Exception($e); } }
/** * 查询库存明细 * * @param String $condition */ public function queryStocksDetail($sdate = '', $edate = '', $goodsName = '', $barcode = '*', $client = '') { try { $action = new StocksManagerAction(); $result = $action->query($sdate, $edate, $goodsName, $barcode, '', '', '', '', $client); if ($result) { //计算合计 $sumrecord['goodsName'] = '合计:'; $sumrecord["inqty"] = ExFunction::ex_array_sum($result, 'inqty'); $sumrecord["outqty"] = ExFunction::ex_array_sum($result, 'outqty'); array_push($result, $sumrecord); } $field = "billNo,billDate,goodsName,madeIn,code,factoryNo,spec,client,billType,inqty,outqty,voltage1,current1," . "direct,constant,grade,madeDate,memo,place,station"; $struct = $action->getStruct(); //如果字段不是全部的,则把必须的字段替换 if ($field != '*') { $field = explode(',', $field); $visible = array("_type_" => "INCLUDE", "data" => $field); $struct["visible"] = $visible; $struct["item"] = $field; } $rtn["struct"] = $struct; $rtn["data"] = $result; return $rtn; } catch (Exception $e) { system_out("Report.queryStocksDetail error" . $e); throw new ExcelDateUtil($e); } }