Пример #1
0
 /**
  * 确认出库表
  *
  * @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;
 }