本文整理匯總了PHP中CommonModel::adjustPrintNum方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonModel::adjustPrintNum方法的具體用法?PHP CommonModel::adjustPrintNum怎麽用?PHP CommonModel::adjustPrintNum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonModel
的用法示例。
在下文中一共展示了CommonModel::adjustPrintNum方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: act_pdaAdjust
public function act_pdaAdjust()
{
$userCnName = $_SESSION['userCnName'];
$userId = $_SESSION['userId'];
$groupid = trim($_POST['groupid']);
$num = intval(trim($_POST['num']));
if ($num == 0) {
self::$errCode = "401";
self::$errMsg = "請輸入正數";
return false;
}
$list = packageCheckModel::getSKUByGroupId($groupid);
if ($list) {
OmAvailableModel::begin();
$entryStatus = 0;
$nums = -$num;
$id = $list[0]['id'];
$batchNum = $list[0]['batchNum'];
$sku = $list[0]['sku'];
$beforeNum = $list[0]['num'];
$ichibanNums = $list[0]['ichibanNums'];
$shelvesNums = $list[0]['shelvesNums'];
$now_num = $beforeNum - $num;
$u_num = -$num;
/** 判斷點貨調整後數量是否為負數**/
if ($now_num <= 0) {
self::$errCode = 203;
self::$errMsg = "調整後數量必須大於0!";
return false;
}
/** 已上架情況下不許調整**/
if ($shelvesNums) {
self::$errCode = 203;
self::$errMsg = "料號已有上架數,不能調整!";
return false;
}
/** 判斷有良品的情況下調整數量隻能小於原先點貨數量**/
if ($ichibanNums && $now_num > $beforeNum) {
self::$errCode = 203;
self::$errMsg = "良品存在時,點貨調整後數量必須小於原點貨數量!";
return false;
}
CommonModel::adjustPrintNum($batchNum, $nums);
//去除qc數量
if ($shelvesNums == 0) {
//釋放采購hold住數量
$delCheckOnWaySku = CommonModel::checkOnWaySkuNum($sku, $beforeNum, 2);
//驗證sku在途數量是否足夠
$checkOnWaySku = CommonModel::checkOnWaySkuNum($sku, $now_num, 1);
if ($checkOnWaySku == 0) {
$u_num = -$num;
} else {
$entryStatus = 1;
$u_num = -$beforeNum;
}
}
$updateinfo = packageCheckModel::updateRecord($id, $nums, $entryStatus);
if (!$updateinfo) {
self::$errCode = 203;
self::$errMsg = "更新點貨記錄失敗!";
OmAvailableModel::rollback();
return false;
}
$insertinfo = packageCheckModel::insertAdjustRecord($id, $nums, $beforeNum, $userId);
if (!$insertinfo) {
self::$errCode = 204;
self::$errMsg = "插入點貨調整記錄失敗!";
OmAvailableModel::rollback();
return false;
}
$updatestore = packageCheckModel::updateStore($sku, $u_num);
if (!updatestore) {
self::$errCode = 205;
self::$errMsg = "更新總庫存失敗!";
OmAvailableModel::rollback();
return false;
}
if ($ichibanNums != 0 && $ichibanNums != NULL) {
$updateIchibanNums = packageCheckModel::updateIchibanNums($nums, $id);
if ($shelvesNums != 0) {
$updateshelvesNums = packageCheckModel::updateShelvesNums($nums, $sku, $id);
if (!$updateshelvesNums) {
self::$errCode = 206;
self::$errMsg = "更新上架庫存失敗!";
OmAvailableModel::rollback();
return false;
}
$update_onhand = CommonModel::adjustOut($sku, $nums, $userCnName);
if ($update_onhand == 0) {
self::$errCode = 206;
self::$errMsg = "更新舊erp庫存失敗";
OmAvailableModel::rollback();
return false;
}
}
}
self::$errMsg = "調整成功";
OmAvailableModel::commit();
return true;
} else {
//.........這裏部分代碼省略.........