本文整理汇总了PHP中Warehouse::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Warehouse::save方法的具体用法?PHP Warehouse::save怎么用?PHP Warehouse::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Warehouse
的用法示例。
在下文中一共展示了Warehouse::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Warehouse();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Warehouse'])) {
$model->attributes = $_POST['Warehouse'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('index', array('model' => $model));
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
$rules = array("warehouseId" => "required", "warehouseName" => "required", "firstAddress" => "required", "area" => "required", "region" => "required", "warehousePhone" => "required|numeric", "warehouseFax" => "required|numeric", "warehouseEmail" => "required|email", "warehousePIC" => "required");
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::to('/warehouse/create')->withErrors($validator);
}
//
$warehouse = new Warehouse();
$warehouse->warehouseID = Input::get('warehouseId');
$warehouse->warehouseName = Input::get('warehouseName');
$warehouse->warehouseAddress1 = Input::get('firstAddress');
$warehouse->warehouseAddress2 = Input::get('secondAddress');
$warehouse->areaID = Input::get("area");
$warehouse->regionID = Input::get("region");
$warehouse->warehousePhone = Input::get("warehousePhone");
$warehouse->warehouseFax = Input::get("warehouseFax");
$warehouse->warehouseEmail = Input::get("warehouseEmail");
$warehouse->warehousePIC = Input::get("warehousePIC");
$warehouse->save();
return Redirect::to('/warehouse');
}
示例3: postModal
/**
* postModal (入库确认)
*/
public function postModal()
{
//itemReceivedPackageDetail->id
$id = Input::get('id');
$position = Input::get('readyposition');
$itemReceivedPackageDetail = ItemReceivedPackageDetail::find($id);
$itemReceivedPackageDetail->status = 2;
$itemReceivedPackageDetail->readyposition = $position;
$itemReceivedPackageDetail->save();
//历史入库记录
$historyWareHouse = new HistoryWarehouse();
$historyWareHouse->identity = $itemReceivedPackageDetail->identity;
$historyWareHouse->item = $itemReceivedPackageDetail->item;
$historyWareHouse->batch = $itemReceivedPackageDetail->batch;
$historyWareHouse->quantity = $itemReceivedPackageDetail->quantity;
$historyWareHouse->position = $position;
$historyWareHouse->operator = 5;
$historyWareHouse->save();
//库存汇总
$wareHouse = Warehouse::where('item', $itemReceivedPackageDetail->item)->where('position', $position)->first();
if ($wareHouse) {
$wareHouse->quantity = $wareHouse->quantity + $itemReceivedPackageDetail->quantity;
$wareHouse->save();
} else {
$wareHouse = new Warehouse();
$wareHouse->item = $itemReceivedPackageDetail->item;
$wareHouse->position = $position;
$wareHouse->quantity = $itemReceivedPackageDetail->quantity;
$wareHouse->save();
}
//更新item总库存
$items = Item::where('code', $itemReceivedPackageDetail->item)->first();
$items->stock += $itemReceivedPackageDetail->quantity;
$items->readystock -= $itemReceivedPackageDetail->quantity;
$items->save();
return Redirect::back();
}
示例4: postWarehouseAdd
public function postWarehouseAdd()
{
$validator = Validator::make(Input::all(), Warehouse::$rules);
if ($validator->fails()) {
return Redirect::to('goods/warehouse-add')->withErrors($validator)->withInput();
}
$warehouse = new Warehouse();
$warehouse->name = Input::get('name');
$warehouse->user_id = Input::get('user_id');
$warehouse->save();
return Redirect::to('goods/warehouse-all')->with('success', '仓库添加成功!');
}
示例5: postPackageCheckedin
/**
* postPackageCheckedin (拆包检验入库)
*/
public function postPackageCheckedin()
{
$id = Input::get('id');
$position = Input::get('readyposition');
$itemReceivedPackageDetail = ItemReceivedPackageDetail::find($id);
$itemReceivedPackageDetail->status = 2;
$itemReceivedPackageDetail->readyposition = $position;
$itemReceivedPackageDetail->save();
//历史入库记录
$historyWareHouse = new HistoryWarehouse();
$historyWareHouse->identity = $itemReceivedPackageDetail->identity;
$historyWareHouse->item = $itemReceivedPackageDetail->item;
$historyWareHouse->batch = $itemReceivedPackageDetail->batch;
$historyWareHouse->quantity = $itemReceivedPackageDetail->quantity;
$historyWareHouse->position = $position;
$historyWareHouse->operator = 5;
$historyWareHouse->save();
//库存汇总
$wareHouse = Warehouse::where('item', $itemReceivedPackageDetail->item)->where('position', $position)->first();
if ($wareHouse) {
$wareHouse->quantity = $wareHouse->quantity + $itemReceivedPackageDetail->quantity;
$wareHouse->save();
} else {
$wareHouse = new Warehouse();
$wareHouse->item = $itemReceivedPackageDetail->item;
$wareHouse->position = $position;
$wareHouse->quantity = $itemReceivedPackageDetail->quantity;
$wareHouse->save();
}
//更新item总库存
$items = Item::where('code', $itemReceivedPackageDetail->item)->first();
$items->stock += $itemReceivedPackageDetail->quantity;
$items->readystock -= $itemReceivedPackageDetail->quantity;
$items->save();
//到包日期|包号
$itemReceivedPackage = ItemReceivedPackage::find($itemReceivedPackageDetail->package_id);
$package_checked_date = $itemReceivedPackage->package_checked_date;
$package_no = $itemReceivedPackage->package_no;
//供应商
$supplier = Supplier::find($itemReceivedPackageDetail->supplier_id);
//details
$itemReceivedPackageDetails = ItemReceivedPackageDetail::where('package_id', $itemReceivedPackageDetail->package_id)->orderBy('status')->get();
return View::make('admin.itemreceive.packagedetail')->with('itemReceivedPackageDetails', $itemReceivedPackageDetails)->with('supplier', $supplier)->with('package_checked_date', $package_checked_date)->with('package_no', $package_no);
}
示例6: import
//.........这里部分代码省略.........
*/
// is this the ccr dupe favoured row?
$StoreView['ccr_ind_dupe1'] = trim($data['CCR_Ind_Dupe1']) === 'Yes' ? 1 : 0;
// If CCR has detected a duplicate...
if ($data['CCR_Ind_Set'] > 0) {
$this->totalDupes++;
$StoreView->ccr_duplicate_id = $data['CCR_Ind_Set'];
//print "CCR_Ind_Set > 0\n";
//first of all, let see if the dupe has the same origin id as a previous in the database
$DupeMatches = Store::model()->with(array('store2contact'))->findAllByAttributes(array('ccr_duplicate_id' => $data['CCR_Ind_Set'], 'date_expired' => null), array('index' => 'origin_organisation_id'));
// print ('starting new loop with dupes');
if (sizeof($DupeMatches)) {
// print "size DupeMatches > 0\n";
$Store2Contact = null;
// print_r(array_keys($DupeMatches));
// print "\nDupeMatch orgs: " . $organisation_id . "\n";
if (array_key_exists((int) $organisation_id, $DupeMatches)) {
// we have a match from the same organisation
// print "org exists in dupes data\n";
//not do in the correct order, needs to be done with CCR_Ind_Set
//we need to expire the match and update the warehouse record
//we the new one
//echo 'DupeMatch';
if ($DupeMatches[$organisation_id]->ccr_ind_dupe1) {
// print "Alread have trusted row, expire row\n";
// already have a trusted row. Expire and insert this one.
$StoreView->date_expired = date('Y-m-d H:i:s');
$StoreView->ccr_ind_dupe1 = 0;
// just in case.
} else {
// print "Update store row\n";
// update store row
$DupeMatches[$organisation_id]->date_expired = date('Y-m-d H:i:s');
$DupeMatches[$organisation_id]->save();
// update any suppression list rows to not have warehouse or store_id. They're old and expired.
SuppressionList::model()->deleteAll('store2contact_id = ' . (int) $DupeMatches[$organisation_id]->store2contact->id);
// clone the contact_warehouse_id and ind set. Gets saved below.
$Store2Contact = $DupeMatches[$organisation_id]->store2contact;
// print 'Store2Contact=';
// print_r ($Store2Contact->attributes);
$Store2Contact->contact_warehouse_id = $DupeMatches[$organisation_id]->store2contact->contact_warehouse_id;
}
} else {
// print "org does not exist in dupes data\n";
//is it not a dupe match but someone else has the same dupe id?
//if so, lets find their Warehouse ID and then add as a new row
$LastDuplicate = end($DupeMatches);
$Store2Contact = new Store2Contact();
$Store2Contact->contact_warehouse_id = $LastDuplicate->store2contact->contact_warehouse_id;
}
// the save for dupes is here
if (!$StoreView->save()) {
print_r($StoreView->errors);
}
// if we have a store2contact save it here
if (!is_null($Store2Contact)) {
//update store_id to new one
$Store2Contact->store_id = $StoreView->id;
$Store2Contact->origin_unique_id = $data['CCR_Client_URN'];
$Store2Contact->origin_id = $organisation_id;
// print 'saving a (dupe style) store2contact ' . $Store2Contact->id . "\n";
if (!$Store2Contact->save()) {
print_r($Store2Contact->errors);
}
}
// currently required below.
示例7: actionStepOne
public function actionStepOne()
{
$this->inAccession = true;
// Have we arrived here with an accession hash, allowing us to track this contact through accession?
if (isset($_GET['accessionhash'])) {
$Accession = $this->getAccessionRecord();
$this->checkStep($Accession, 1);
} else {
$Accession = new Accession();
$Accession->step = 1;
}
$this->pageTitle = 'Welcome to ' . Yii::app()->name . ' | Step One | Accession';
if (isset($_POST['Accession'])) {
if ($_POST['Accession']['terms_agreed'] === '1') {
// Accession hash will be null if they've signed up from the public link
if (is_null($Accession->accession_hash)) {
$Accession->accession_hash = sha1(rand(1, 99999) . microtime(true));
}
// TERMS ARE AGREED! We're good to go. Set up all the models
$Accession->terms_agreed = date('Y-m-d H:i:s');
if (!$Accession->save()) {
print_r($Accession->errors);
exit;
}
// Now they've agreed terms, update the invite (if they had one)
if ($Accession->invite_id) {
$Invite = Invite::model()->findByPk($Accession->invite_id);
if (!is_null($Invite)) {
$Invite->status = Invite::STATUS_ACCEPTED;
$Invite->save(true, array('status'));
}
}
$new = false;
// If it's a new contact coming to the list, we just have a blank row
// If they've come via an invite then we copy their Store row
if (is_null($Accession->original_store2contact_id)) {
// This contact is new
$Store = new Store();
// Create a new warehouse row
$Warehouse = new Warehouse();
$Warehouse->save();
// Set the warehouse id to the accession model
$Accession->warehouse_id = $Warehouse->id;
$Accession->save(true, array('warehouse_id'));
$new = true;
} else {
// This contact came from an invite
// Grab their previous data
$Store2Contact = Store2Contact::model()->findByPk($Accession->original_store2contact_id);
// Get the contact's warehouse_id - this identifies them uniquely, even if they have multiple instances in Store
$Warehouse = Warehouse::model()->findByPk($Store2Contact->contact_warehouse_id);
$ExistingStore = Store::model()->findByPk($Store2Contact->store_id);
// Now make a new store to duplicate their info to
$Store = new Store();
$Store->attributes = $ExistingStore->attributes;
$Store->id = null;
}
// Set the org ID to THE LIST
$Store->origin_organisation_id = 10;
// Try to save the Store
if (!$Store->save()) {
print 'Store errors:<br>';
print_r($Store->errors);
exit;
}
// Also create a new Store2Contact row
$Store2Contact = new Store2Contact();
$Store2Contact->store_id = $Store->id;
$Store2Contact->contact_warehouse_id = $Warehouse->id;
$Store2Contact->origin_id = 10;
if (!$Store2Contact->save()) {
print 'Store2Contact errors:<br>';
print_r($Store2Contact->errors);
exit;
}
// Now also save the new Store2Contact ID to Accession
$Accession->store2contact_id = $Store2Contact->id;
if ($new) {
$Accession->original_store2contact_id = $Store2Contact->id;
}
}
if ($Accession->save(true, array('terms_agreed', 'store2contact_id', 'original_store2contact_id'))) {
$this->updateStep($Accession, 1);
$this->redirect(array('accession/stepTwo', 'accessionhash' => $Accession->accession_hash));
}
}
$this->render('step1', array('Accession' => $Accession, 'progress' => 1));
}