예제 #1
0
 public function searchChild($parent)
 {
     $query = StockMove::find();
     $params['StockMoveSearch']['move_dest_id'] = $parent;
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'create_uid' => $this->create_uid, 'create_date' => $this->create_date, 'write_date' => $this->write_date, 'write_uid' => $this->write_uid, 'product_uos_qty' => $this->product_uos_qty, 'date_expected' => $this->date_expected, 'product_uom' => $this->product_uom, 'price_unit' => $this->price_unit, 'date' => $this->date, 'prodlot_id' => $this->prodlot_id, 'move_dest_id' => $this->move_dest_id, 'product_qty' => $this->product_qty, 'product_uos' => $this->product_uos, 'partner_id' => $this->partner_id, 'product_id' => $this->product_id, 'auto_validate' => $this->auto_validate, 'price_currency_id' => $this->price_currency_id, 'location_id' => $this->location_id, 'company_id' => $this->company_id, 'picking_id' => $this->picking_id, 'location_dest_id' => $this->location_dest_id, 'tracking_id' => $this->tracking_id, 'product_packaging' => $this->product_packaging, 'purchase_line_id' => $this->purchase_line_id, 'sale_line_id' => $this->sale_line_id, 'production_id' => $this->production_id, 'weight' => $this->weight, 'weight_net' => $this->weight_net, 'weight_uom_id' => $this->weight_uom_id, 'no_moved0' => $this->no_moved0, 'no' => $this->no]);
     $query->andFilterWhere(['like', 'origin', $this->origin])->andFilterWhere(['like', 'note', $this->note])->andFilterWhere(['like', 'priority', $this->priority])->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'no_moved1', $this->no_moved1])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'desc', $this->desc]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStockMoves()
 {
     return $this->hasMany(StockMove::className(), ['prodlot_id' => 'id']);
 }
예제 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStockMove()
 {
     return $this->hasOne(StockMove::className(), ['id' => 'stock_move_id']);
 }
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStockMoves()
 {
     return $this->hasMany(StockMove::className(), ['sale_line_id' => 'id']);
 }
예제 #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStockMoves()
 {
     return $this->hasMany(StockMove::className(), ['location_dest_id' => 'id']);
 }
예제 #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMoveDest()
 {
     return $this->hasOne(StockMove::className(), ['id' => 'move_dest_id']);
 }
예제 #7
0
 public function actionGenerateProductSet($id, $product_id)
 {
     $dataMove = StockMove::find()->where(['id' => $id])->one();
     $bom = MrpBom::find()->where(['product_id' => $product_id, 'type' => 'phantom'])->one();
     if (!$bom) {
         throw new NotFoundHttpException('This Product Not Setted Into Phantom BOM');
     }
     $searchModel = new MrpBomSearch();
     $dataProvider = $searchModel->searchBom($bom->id);
     foreach ($dataProvider->getModels() as $model) {
         $newMove = new StockMove();
         $newMove->create_uid = $dataMove->create_uid;
         $newMove->create_date = $dataMove->create_date;
         $newMove->date = $dataMove->create_date;
         $newMove->write_date = $dataMove->write_date;
         $newMove->write_uid = $dataMove->write_uid;
         $newMove->origin = $dataMove->origin;
         $newMove->product_uos_qty = $dataMove->product_uos_qty;
         $newMove->date_expected = $dataMove->date_expected;
         $newMove->product_uom = $model->product_uom;
         $newMove->move_dest_id = $dataMove->id;
         $newMove->product_qty = $dataMove->product_qty * $model->product_qty;
         $newMove->product_uos = $model->product_uom;
         $newMove->partner_id = $dataMove->partner_id;
         $newMove->product_id = $model->product_id;
         $newMove->location_id = $dataMove->location_id;
         $newMove->company_id = $dataMove->company_id;
         $newMove->picking_id = $dataMove->picking_id;
         $newMove->state = $dataMove->state;
         $newMove->location_dest_id = $dataMove->location_dest_id;
         $newMove->tracking_id = $dataMove->tracking_id;
         $newMove->product_packaging = $dataMove->product_packaging;
         $newMove->purchase_line_id = $dataMove->purchase_line_id;
         $newMove->sale_line_id = $dataMove->sale_line_id;
         $newMove->name = $model->name;
         $newMove->desc = $model->name;
         $newMove->no = $dataMove->no;
         $newMove->weight_uom_id = 3;
         $newMove->save();
     }
     $stockmove = StockMove::findOne($id);
     $stockmove->picking_id = '';
     $stockmove->location_dest_id = 12;
     $stockmove->update();
     return $this->redirect(['view-move-childs', 'id' => $id]);
 }
예제 #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStockMoves()
 {
     return $this->hasMany(StockMove::className(), ['picking_id' => 'id'])->orderBy('no, id ASC');
 }
예제 #9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getStockMoves()
 {
     return $this->hasMany(StockMove::className(), ['price_currency_id' => 'id']);
 }