當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CommonModel::adjustInventory方法代碼示例

本文整理匯總了PHP中CommonModel::adjustInventory方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonModel::adjustInventory方法的具體用法?PHP CommonModel::adjustInventory怎麽用?PHP CommonModel::adjustInventory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CommonModel的用法示例。


在下文中一共展示了CommonModel::adjustInventory方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: act_allPass

 function act_allPass()
 {
     $userCnName = $_SESSION['userCnName'];
     $id_arr = $_POST['id'];
     $f_count = count($id_arr);
     $id = implode(',', $id_arr);
     $where = "where id in(" . $id . ") and auditStatus=0";
     $record_list = InvRecordModel::getInvRecordList("*", $where);
     $s_count = count($record_list);
     if ($f_count != $s_count) {
         self::$errCode = "401";
         self::$errMsg = "當前包含有不用審核的訂單,請確認!";
         return false;
     }
     OmAvailableModel::begin();
     foreach ($record_list as $record) {
         $data = array();
         $id = $record['id'];
         $data = array('auditStatus' => 1);
         $Inv_info = InvRecordModel::getInvRecordList("*", "where id='{$id}'");
         $position_info = OmAvailableModel::getTNameList("wh_position_distribution", "id", "where pName='{$Inv_info[0]['location']}'");
         $skuinfo = whShelfModel::selectSku(" where sku='{$Inv_info[0]['sku']}'");
         $updatedata = InvRecordModel::update($data, "and id='{$id}'");
         if (!$updatedata) {
             self::$errCode = "402";
             self::$errMsg = "更新通過狀態失敗!";
             return false;
         }
         $tName = 'wh_product_position_relation';
         $set = "SET nums='{$Inv_info[0]['invNums']}'";
         $where = "WHERE pId='{$skuinfo['id']}' AND positionId='{$position_info[0]['id']}' AND is_delete=0 AND storeId=1";
         $affectRow = OmAvailableModel::updateTNameRow($tName, $set, $where);
         //庫存變化
         if ($affectRow === false) {
             self::$errCode = "403";
             self::$errMsg = "更新具體倉位庫存失敗!";
             OmAvailableModel::rollback();
             return false;
         }
         $adjustNums = $Inv_info[0]['adjustNums'];
         if ($Inv_info[0]['invType'] == 2) {
             $adjustNums = "-" . $adjustNums;
         }
         $tName = 'wh_sku_location';
         $set = "SET actualStock=actualStock+'{$adjustNums}'";
         $where = "WHERE sku='{$Inv_info[0]['sku']}' AND storeId=1";
         $affectRow = WhIoRecordsModel::updateTNameRow($tName, $set, $where);
         //庫存變化
         if ($affectRow === false) {
             self::$errCode = "404";
             self::$errMsg = "更新總庫存失敗!";
             OmAvailableModel::rollback();
             return false;
         }
         /**** 插入出入庫記錄 *****/
         if ($Inv_info[0]['invType'] == 2) {
             $ioType = 1;
             $ioTypeId = 11;
             $reason = '盤點出庫';
         } else {
             $ioType = 2;
             $ioTypeId = 10;
             $reason = '盤點入庫';
         }
         if ($adjustNums != 0) {
             $update_onhand = CommonModel::adjustInventory($Inv_info[0]['sku'], $adjustNums, $userCnName);
             if ($update_onhand == 0) {
                 self::$errCode = 415;
                 self::$errMsg = "更新舊erp庫存失敗";
                 OmAvailableModel::rollback();
                 return false;
             }
             $skuinfo = whShelfModel::selectSku(" where sku = '{$Inv_info[0]['sku']}'");
             $paraArr = array('sku' => $Inv_info[0]['sku'], 'amount' => abs($adjustNums), 'positionId' => $position_info[0]['id'], 'purchaseId' => $skuinfo['purchaseId'], 'ioType' => $ioType, 'ioTypeId' => $ioTypeId, 'userId' => $_SESSION['userId'], 'reason' => $reason);
             $record = CommonModel::addIoRecores($paraArr);
             //出庫記錄
             if (!$record) {
                 OmAvailableModel::rollback();
                 return false;
             }
         }
         //更新申請盤點表
         $waitInf = WaitInventoryModel::updateInv($Inv_info[0]['sku'], $_SESSION['userId']);
         if (!$waitInf) {
             self::$errCode = 414;
             self::$errMsg = "跟新申請盤點表失敗!";
             TransactionBaseModel::rollback();
             return false;
         }
     }
     OmAvailableModel::commit();
     return true;
 }
開發者ID:ohjack,項目名稱:newErp,代碼行數:93,代碼來源:inventory.action.php


注:本文中的CommonModel::adjustInventory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。