public function getAllocationDone($AllocationId) { $allocation = Allocation::find($AllocationId); $form_product = Product::find($allocation->from_product_id); $form_product->store = $form_product->store - $allocation->num; $form_product->save(); $to_product = new Product(); $to_product->good_id = $allocation->good_id; $to_product->purchase = 0; $to_product->sell = 0; $to_product->store = $allocation->num; $to_product->cost = $form_product->cost; $to_product->price = $form_product->price; $to_product->damage = 0; $to_product->replacement = 0; $to_product->warehouse_id = $allocation->to_warehouse_id; $to_product->production_date = $form_product->production_date; $to_product->life = $form_product->life; $to_product->cost_date = $form_product->cost_date; $to_product->life_date = $form_product->life_date; $to_product->save(); $allocation->to_product_id = $to_product->id; $allocation->allocation_status = '1'; $allocation->save(); $this->__goodLog($allocation->good_id, $form_product->id, 'allocation'); return Redirect::to('goods/allocation-list')->with('success', '确认调拨!'); }