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 $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; }
/** * 出仓发货确认 *@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); } }
private function getStation($code) { $dao = new StocksDao(); $table = StocksIndexAction::getTableNameByCode($code); if (!$table) { return false; } rsort($table); $result = $dao->findAll("code = '{$code}' ", $table[0])->toResultSet(); if (!$result) { return false; } $row = sizeof($result) - 1; $rtn['code'] = $code; $rtn['factoryNo'] = $result[$row]['factoryNo']; $rtn['goodsName'] = $result[$row]['goodsName']; $rtn['spec'] = $result[$row]['spec']; $rtn['madeIn'] = $result[$row]['madeIn']; //如果在库存,则写上当前库 $currentstocks = new StocksManagerAction(); $curren = $currentstocks->queryCurrentStocks("code = '{$code}'"); if ($curren) { $rtn["location"] = '在库[' . $curren[0]['place'] . ']'; } else { //写上用途/去向 switch ($result[$row]['billType']) { case '调拨出库': $rtn['location'] = "调拨到[" . $result[$row]['toplace'] . "]途中"; break; case '安装领表': $checkout = new CheckoutCardAction(); //print_r($result); $install = $checkout->query("clientNo = '" . $result[$row]['clientNo'] . "'"); if ($install) { $rtn["location"] = "安装到[" . $result[$row]['client'] . "]"; } else { $rtn['location'] = "安装到[" . $result[$row]['client'] . "]途中"; } break; default: $rtn['location'] = '内部移库途中'; } } return $rtn; }