/** * 通过条码从本系统中获取产品信息 * * @param string $code * @return array */ public function getInfoByCodeFormMySystem($code) { try { $tablename = StocksIndexAction::getTableNameByCode($code); if (!$tablename) { return false; } $dao = new StocksDao(); $result = ''; foreach ($tablename as $table) { $sql = "select * from {$table} where id=\n\t\t\t\t\t\t\t\t( select max(id) from {$table} where code = '{$code}') "; $result = $dao->query($sql)->toArray(); if (!$result) { continue; } else { break; } } if (!$result) { return false; } else { return $result[0]; } } catch (Exception $e) { throw new Exception($e); } }
public function queryLocationDetail($code = '') { $table = StocksIndexAction::getTableNameByCode($code); $volist = new VoList(); $dao = new StocksDao(); //开始查询 for ($i = 0; $i < sizeof($table); $i++) { $tablename = $table[$i]; $result = $dao->findAll("code='{$code}'", $tablename, '*', 'id'); $volist->addAll($result); } $field = "billType,billNo,billDate,goodsName,madeIn,code,factoryNo,spec,client,inqty,outqty,voltage1,current1," . "direct,constant,grade,madeDate,memo,place,station"; $action = new StocksManagerAction(); $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"] = $volist->toResultSet(); return $rtn; }