public function getPrintField($reportname = '') { if ($reportname == '') { return ''; } switch ($reportname) { case 'instocksbill': $field = "code,goodsName,spec,voltage1,current1,inqty"; $action = new StocksManagerAction(); $struct = $action->getStruct(); //如果字段不是全部的,则把必须的字段替换 if ($field != '*') { $field = explode(',', $field); $visible = array("_type_" => "INCLUDE", "data" => $field); $struct["visible"] = $visible; $struct["item"] = $field; $width = array("code" => 80, 'goodsName' => 170, 'spec' => 90, 'voltage1' => 50, 'current1' => 70); $struct["width"] = $width; } break; case 'outstocksbill': $field = "code,goodsName,spec,voltage1,current1,outqty"; $action = new StocksManagerAction(); $struct = $action->getStruct(); //如果字段不是全部的,则把必须的字段替换 if ($field != '*') { $field = explode(',', $field); $visible = array("_type_" => "INCLUDE", "data" => $field); $struct["visible"] = $visible; $struct["item"] = $field; $width = array("code" => 80, 'goodsName' => 170, 'spec' => 90, 'voltage1' => 50, 'current1' => 70); $struct["width"] = $width; } break; default: return ''; } return $struct; }
public function queryConfirm($struct) { $current = new StocksManagerAction(); $add = $struct["No"]; $A = array(); $B = array(); $sql = "station like '" . $add . "%'"; $result = $current->queryCurrentStocks($sql); for ($i = 0; $i < sizeof($result); $i++) { $station = $result[$i]["station"]; if (substr($station, 4, 1) == "A") { array_push($A, $station); } else { array_push($B, $station); } } $rtn["A"] = $A; $rtn["B"] = $B; return $rtn; }
/** * 确认出库表 * * @param array $data //单据信息 * @param String $validstation //确认已经取了表的表位 * @param string $station //周转想 * @param string $code //表码 * @retur Boolean */ public function confirmOutStation($data, $validstation = '', $station = '', $code = '') { try { $confirm = new ConfirmStationAction(); $currentstocks = new StocksManagerAction(); //单表出仓 if ($code != '') { $result = $currentstocks->queryCurrentStocks("code = '{$code}'"); if (sizeof($result) == 0) { return "库存里没有该表计!"; } $rtn = $confirm->confirmOutstation($data, $code); return $rtn; } elseif ($station != '') { $result = $currentstocks->queryCurrentStocks("station = '{$station}'"); if (sizeof($result) == 0) { return "库存里该周转箱没有表计!"; } for ($i = 0; $i < sizeof($result); $i++) { $rtn = $confirm->confirmOutstation($data, $result[$i]["code"]); if (!$rtn) { $rtn = $confirm->getError(); return $rtn; } } } else { if (is_array($validstation)) { for ($i = 0; $i < sizeof($validstation); $i++) { $result = $currentstocks->queryCurrentStocks("station = '{$validstation[$i]}'"); if (sizeof($result) > 0) { $rtn = $confirm->confirmOutstation($data, $result[0]["code"]); if (!$rtn) { $rtn = $confirm->getError(); return $rtn; } } } } //完成确认,删除待确认库里的记录 $this->delUnconfirmStation($validstation, 'D'); } } catch (Exception $e) { system_out("StocksManager.confirmOutStation Error:" . $e->getMessage()); throw new Exception($e); } 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 $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; }
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; }