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


PHP CommonModel::getErpSkuInfo方法代碼示例

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


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

示例1: mysql_query

}
Core::getInstance();
global $dbConn;
mysql_query('SET NAMES UTF8');
$sql = 'select id, sku from pc_goods where is_delete = 0';
//$sql    =   'select id, sku from pc_goods where is_delete = 0 and sku="18558_P_140" order by id desc';
$sql = $dbConn->query($sql);
$res = $dbConn->fetch_array_all($sql);
//獲取新倉庫所有料號
$log_file = 'update_sku_stock/' . date('Y-m-d') . '.txt';
//print_r($res);exit;
foreach ($res as $val) {
    $sku = $val['sku'];
    $pId = $val['id'];
    $date = date('Y-m-d H:i:s');
    $erpSkuInfo = CommonModel::getErpSkuInfo($sku);
    //獲取ERP倉位庫存信息
    //print_r($erpSkuInfo);exit;
    if ($erpSkuInfo['errocode'] != 200) {
        //獲取信息失敗
        $log_info = sprintf("料號:%s, 時間:%s,信息:%s,返回值:%s \r\n", $sku, $date, '獲取舊ERP庫存失敗', is_array($erpSkuInfo) ? json_encode($erpSkuInfo) : $erpSkuInfo);
        write_log($log_file, $log_info);
        continue;
    }
    //print_r($erpSkuInfo);exit;
    $sku_location = $erpSkuInfo['data']['goods_location'];
    if (!$sku_location) {
        //ERP倉位不存在
        $log_info = sprintf("料號:%s, 時間:%s,信息:%s, 參數:%s, %s \r\n", $sku, $date, '沒有倉位', $sku, $sku_location);
        write_log($log_file, $log_info);
        continue;
開發者ID:ohjack,項目名稱:newErp,代碼行數:31,代碼來源:updateSkuStock.php

示例2: act_checkSkuNum

 function act_checkSkuNum()
 {
     $bool = false;
     //標誌是否有摒棄訂單
     $assignNUmber = $_POST['order_group'];
     $sku = trim($_POST['sku']);
     $sku = get_goodsSn($sku);
     $skuinfo = whShelfModel::selectSku(" where sku = '{$sku}'");
     //獲取sku信息
     //print_r($skuinfo);exit;
     //var_dump($skuinfo);exit;
     //$sku         = getGoodsSn2($sku);
     $sku_num = $_POST['sku_num'];
     $assignId = $_POST['now_group_id'];
     $now_pname = $_POST['now_pname'];
     $sku_info = WhGoodsAssignModel::getDetail($assignId, " and a.sku='{$sku}' and a.checkUid=0");
     //調撥單明細中的sku信息
     //$sku_onhand 	= GroupDistributionModel::getSkuPositionStock("and c.sku='$sku' and b.pName='$now_pname'");
     //$order_sku_info = $this->get_valid_order($sku_info[0]['shipOrderGroup'],$sku_info[0]['sku'],$sku_info[0]['pName']);
     $now_num = $sku_num + $sku_info['assignNum'];
     //已配貨數加上本次配貨數
     if (!is_numeric($sku_num) || $now_num < 0) {
         self::$errCode = "007";
         self::$errMsg = "出庫數量必須為正整數,請確認!";
         return false;
     }
     if ($sku_info['num'] < $now_num) {
         self::$errCode = "008";
         self::$errMsg = "配貨數量不能大於原始需求數量!";
         return false;
     }
     //print_r($sku_info);exit;
     $erp_onhand = CommonModel::getErpSkuInfo($sku);
     //獲取老ERP料號庫存信息
     if ($erp_onhand['errocode'] != 200) {
         self::$errCode = "014";
         self::$errMsg = "拉取老ERP庫存信息失敗,請稍後再試!";
         return false;
     }
     //根據轉出倉庫獲取庫存
     $goods_count = $sku_info['storeId'] == 1 ? $erp_onhand['data']['goods_count'] : $erp_onhand['data']['second_count'];
     if ($sku_num > $goods_count) {
         self::$errCode = "009";
         self::$errMsg = "配貨數量不能大於舊ERP係統庫存[{$goods_count}],請確認!";
         return false;
     }
     $uid = $_SESSION['userId'];
     $scanTime = time();
     $where = array('goodsAssignId' => $assignId, 'sku' => $sku);
     //拚接where條件
     $update = array('scanUid' => $uid, 'scanTime' => $scanTime, 'assignNum' => "assignNum+{$sku_num}");
     //拚接更新字段
     TransactionBaseModel::begin();
     $info = WhGoodsAssignModel::updateAssignDetail($where, $update);
     if ($info) {
         $where = array('sku' => $sku, 'storeId' => $sku_info['storeId']);
         $update = array('actualStock' => "actualStock - {$sku_num}", 'assignStock' => "assignStock + {$sku_num}");
         $info = WhGoodsAssignModel::updateSkuLocation($where, $update);
         //更新wh_sku_location的調撥庫存和總庫存
         if (!$info) {
             TransactionBaseModel::rollback();
             self::$errCode = "010";
             self::$errMsg = "更新總庫存失敗!";
             return false;
         }
         $where = array('pId' => $skuinfo['id'], 'positionId' => $sku_info['positionId']);
         $update = array('nums' => "nums - {$sku_num}");
         $info = WhGoodsAssignModel::updateProdcutPosition($where, $update);
         //更新wh_product_position_relation的倉位庫存
         if (!$info) {
             TransactionBaseModel::rollback();
             self::$errCode = "011";
             self::$errMsg = "更新倉位庫存失敗!";
             return false;
         }
         /**** 插入出庫記錄 *****/
         $paraArr = array('sku' => $sku, 'amount' => $sku_num, 'positionId' => $sku_info['positionId'], 'purchaseId' => $skuinfo['purchaseId'], 'ioType' => 1, 'ioTypeId' => 34, 'userId' => $_SESSION['userId'], 'reason' => '調撥出庫');
         $record = CommonModel::addIoRecores($paraArr);
         //出庫記錄
         /** 暫時取消同步老ERP庫存**/
         $info = CommonModel::updateIoRecord($sku, $sku_num, 2, '倉庫調撥', $_SESSION['userCnName'], $sku_info['pName']);
         //var_dump($info);exit;
         if ($info['errCode'] != 200) {
             TransactionBaseModel::rollback();
             self::$errCode = "012";
             self::$errMsg = "同步舊ERP庫存失敗!";
             return false;
         }
         TransactionBaseModel::commit();
         self::$errCode = "0";
         self::$errMsg = "配貨成功,請掃描下一個料號!";
         $arr['sku'] = $sku;
         $arr['num'] = $sku_info['num'];
         $arr['assignNum'] = $sku_info['assignNum'] + $sku_num;
         return $arr;
     } else {
         self::$errCode = "013";
         self::$errMsg = "更新料號狀態失敗!";
         return false;
     }
//.........這裏部分代碼省略.........
開發者ID:ohjack,項目名稱:newErp,代碼行數:101,代碼來源:pda_WhSkuOut.action.php


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