示例#1
0
 /**
  * 获取Datawindow结构
  *
  */
 public function getStruct($type = '')
 {
     try {
         $stocks = new StocksManagerAction();
         $result = $stocks->getStruct();
         if (!$result) {
             $result = $stocks->getError();
             return $result;
         }
         switch ($type) {
             case 'instocks':
                 $field = "station,code,factoryNo,goodsName,spec,inqty,voltage1,current1," . "direct,constant,grade,madeIn,madeDate,memo,place";
                 break;
             case 'outstocks':
                 $field = "station,code,factoryNo,goodsName,spec,outqty,voltage1,current1," . "direct,constant,grade,madeIn,madeDate,memo,place,station";
                 break;
             case 'reject':
                 $field = "station,code,factoryNo,goodsName,spec,outqty,voltage1,current1," . "direct,constant,grade,madeIn,madeDate,memo,place,station";
                 break;
             default:
                 $field = '*';
         }
         //如果字段不是全部的,则把必须的字段替换
         if ($field != '*') {
             $field = explode(',', $field);
             $visible = array("_type_" => "INCLUDE", "data" => $field);
             $result["visible"] = $visible;
             $result["item"] = $field;
         }
         return $result;
     } catch (Executive $e) {
         system_out("StocksManager.getStruct Exception:{$e}");
         throw new Exception($e);
     }
 }
 /**
  * 出仓发货确认
  *@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);
     }
 }