public function view_skuInfo() { $sku = isset($_GET['sku']) ? trim($_GET['sku']) : ""; //$spu = ExportsToXlsModel::getGoods($sku); $spu = GoodsModel::getSkuList($sku); $spu = $spu['spu']; $where = "where spu = '{$spu}'"; $skuinfo = OmAvailableModel::getTNameList("pc_goods", "*", $where); $skuStock = array(); foreach ($skuinfo as $key => $value) { $sku = $value['sku']; //获取库存 $skuStock = WarehouseAPIModel::getSkuStock($sku); //获取料号信息 //$skumsg = ExportsToXlsModel::getGoods($sku); $skumsg = GoodsModel::getSkuList($sku); //获取缓存表信息 $where = "where sku='{$sku}'"; $skuStatics = OmAvailableModel::getTNameList("om_sku_daily_status", "*", $where); $skuStockList = array(); $skuStockList['nums'] = $skuStock; $skuStockList['sku'] = $skumsg['sku']; $skuStockList['spu'] = $skumsg['spu']; $skuStockList['goodsName'] = $skumsg['goodsName']; $skuStockList['goodsCost'] = $skumsg['goodsCost']; $skuStockList['goodsWeight'] = $skumsg['goodsWeight']; $skuStockList['AverageDailyCount'] = $skuStatics['AverageDailyCount']; $skuStockList['waitingSendCount'] = $skuStatics['waitingSendCount']; $skuStockList['xuniCount'] = $skuStatics['waitingSendCount']; $skuStockList['goodsStatus'] = $skumsg['goodsStatus']; $path = $skumsg['goodsCategory']; $cateName = GoodsModel::getCategoryInfoByPath($path); $skuStockList['cateName'] = $cateName['name']; $skuStockList['isNew'] = $skumsg['isNew']; $skuStockList['pmId'] = $skumsg['pmId']; $pmName = GoodsModel::getMaterInfoById($skumsg['pmId']); $skuStockList['pmName'] = $pmName['pmName']; //print_r($pmName); $pName = $skumsg['purchaseId']; $skuStockList['pName'] = UserModel::getUsernameById($pName); $skuStockList['isPacking'] = $skumsg['isPacking']; $skuStockList['whName'] = "深圳A仓"; $skuStock_arr[] = $skuStockList; } $this->smarty->assign("skuStockList", $skuStock_arr); //print_r($skuStockList); $this->smarty->display("skuInfo.htm"); }
public static function getSkuinfo($sku) { self::initDB(); $sql = "SELECT * FROM `pc_goods` WHERE sku = '{$sku}' and is_delete = 0 "; $query = self::$dbConn->query($sql); $goodsInfo = self::$dbConn->fetch_array($query); if (!$goodsInfo) { return false; } $goodsInfo['purchaseName'] = UserModel::getUsernameById($goodsInfo['purchaseId']); //echo $sku; echo "<br>"; $autoStock = WarehouseAPIModel::getSkuStock($sku); if (!$autoStock) { $autoStock = 0; } $goodsInfo['enableCount'] = $autoStock; //var_dump($goodsInfo); return $goodsInfo; }
public static function get_sku_info($sku) { self::initDB(); //$sql = "SELECT cguser FROM ebay_goods WHERE goods_sn='{$sku}'"; /*$sql = "SELECT o.goods_count,g.cguser FROM ebay_goods AS g LEFT JOIN ebay_onhandle AS o ON o.goods_sn=g.goods_sn WHERE o.goods_sn='{$sku}'"; $sql = self::$dbConn->query($sql); $goodsinfo = self::$dbConn->fetch_array_all($sql); if (empty($goodsinfo)||empty($goodsinfo[0]['cguser'])){ return array(); }*/ $sql = "SELECT g.* FROM pc_goods AS g WHERE g.sku='{$sku}'"; $sql = self::$dbConn->query($sql); $goodsinfo = self::$dbConn->fetch_array_all($sql); //var_dump($sku,$goodsinfo); if (empty($goodsinfo) || empty($goodsinfo[0]['purchaseId'])) { echo "\n该料号{$sku}没有添加采购人员!\n"; return true; } //$goodsCountInfo = OldsystemModel::qccenterGetErpGoodscount($sku); $goodsCountInfo = WarehouseAPIModel::getSkuStock($sku); /*if (!$goodsCountInfo){ echo "\n该料号没有库存信息!\n"; return true; }*/ if (is_null($goodsCountInfo)) { echo "\n该料号{$sku}没有库存信息!\n"; return true; } /*$sql = "SELECT * FROM om_sku_daily_status WHERE sku='{$sku}'"; $sql = self::$dbConn->query($sql); $sku_info = self::$dbConn->fetch_array($sql);*/ $purchaseinfo = !empty($sku_info) ? $sku_info : array(); //$purchaseinfo['realnums'] = $goodsCountInfo['goods_count']; $purchaseinfo['realnums'] = $goodsCountInfo; return $purchaseinfo; }
public function resetSkuStock($sku, $storeid = 1) { $dbcon = $this->dbcon; $number1 = WarehouseAPIModel::getSkuStock($sku, 1); $number2 = WarehouseAPIModel::getSkuStock($sku, 2); $number = $number1 + $number2; $waitingsend = $this->getWaitingSendCount($sku); $availableStockCount = $number - $waitingsend; // 虚拟库存 //计算sku是否预警 $skuInfo = $this->getSkuDaysInfo($sku); $goodsdays = $skuInfo["goodsdays"]; // 预警天数 $averageDailyCount = $this->getAverageDailyCount($sku); if ($averageDailyCount != 0) { $canUseDay = floor($availableStockCount / $averageDailyCount); if ($canUseDay <= $goodsdays) { $is_warning = 1; } else { $is_warning = 0; } } else { $is_warning = 0; } $bigOrder = $this->getInterceptSendCount($sku); $shortagesendCount = $this->getShortageSendCount($sku); //自动拦截数量 $waitingauditCount = $this->getWaitingAuditCount($sku); //超大订单待审核数量 $lastDaySaleCount = $this->lastDaySaleCount($sku); $lastDaySendCount = $this->lastDaySendCount($sku); $lastWeekSaleCount = $this->lastWeekSaleCount($sku); $lastWeekSendCount = $this->lastWeekSendCount($sku); $lastMouthSaleCount = $this->lastMouthSaleCount($sku); $lastMounthSendCount = $this->lastMouthSendCount($sku); $sql = "select count(*) as number from om_sku_daily_status where sku='{$sku}'"; $sql = $dbcon->execute($sql); $dataInfo = $dbcon->fetch_one($sql); if ($dataInfo['number'] > 0) { $sql = "update om_sku_daily_status set \n\t\t\t\taverageDailyCount={$averageDailyCount},\n\t\t\t\tactualStockCount={$number},\n\t\t\t\twaitingSendCount={$waitingsend},\n\t\t\t\tavailableStockCount={$availableStockCount},\n\t\t\t\tlastDaySaleCount={$lastDaySaleCount},\n\t\t\t\tlastDaySendCount={$lastDaySendCount},\n\t\t\t\tlastWeekSaleCount={$lastWeekSendCount},\n\t\t\t\tlastWeekSendCount={$lastWeekSendCount},\n\t\t\t\tlastMouthSaleCount={$lastMouthSaleCount},\n\t\t\t\tlastMouthSendCount={$lastMounthSendCount},\n\t\t\t\tshortageSendCount={$shortagesendCount},\n\t\t\t\twaitingAuditCount={$waitingauditCount},\n\t\t\t\tinterceptSendCount={$bigOrder},\n\t\t\t\tis_warning={$is_warning}\n\t\t\t\tWHERE sku='{$sku}'"; } else { $sql = "insert into om_sku_daily_status set \n\t\t\t\taverageDailyCount={$averageDailyCount},\n\t\t\t\tactualStockCount={$number},\n\t\t\t\twaitingSendCount={$waitingsend},\n\t\t\t\tavailableStockCount={$availableStockCount},\n\t\t\t\tlastDaySaleCount={$lastDaySaleCount},\n\t\t\t\tlastDaySendCount={$lastDaySendCount},\n\t\t\t\tlastWeekSaleCount={$lastWeekSendCount},\n\t\t\t\tlastWeekSendCount={$lastWeekSendCount},\n\t\t\t\tlastMouthSaleCount={$lastMouthSaleCount},\n\t\t\t\tlastMouthSendCount={$lastMounthSendCount},\n\t\t\t\tis_warning={$is_warning},\n\t\t\t\tshortageSendCount={$shortagesendCount},\n\t\t\t\twaitingAuditCount={$waitingauditCount},\n\t\t\t\tinterceptSendCount={$bigOrder},\n\t\t\t\tsku='{$sku}'"; } if ($dbcon->execute($sql)) { $exchange = $this->exchange; // $this->rmqObj->queue_publish($exchange,$sql); //发布消息 echo "{$sql} 更新成功。。。\n"; } else { echo $sql; } }
public function resetSkuStock($sku, $storeid = 1) { $dbcon = $this->dbcon; $number = WarehouseAPIModel::getSkuStock($sku, $storeid); $waitingsend = $this->getWaitingSendCount($sku); $availableStockCount = $number - $waitingsend; // 虚拟库存 //计算sku是否预警 $skuInfo = $this->getSkuDaysInfo($sku); $goodsdays = $skuInfo["goodsdays"]; // 预警天数 $averageDailyCount = $this->getAverageDailyCount($sku); if ($averageDailyCount != 0) { $canUseDay = floor($availableStockCount / $averageDailyCount); if ($canUseDay <= $goodsdays) { $is_warning = 1; } else { $is_warning = 0; } } else { $is_warning = 0; } $bigOrder = $this->getInterceptSendCount($sku); $lastDaySaleCount = $this->lastDaySaleCount($sku); $lastDaySendCount = $this->lastDaySendCount($sku); $lastWeekSaleCount = $this->lastWeekSaleCount($sku); $lastWeekSendCount = $this->lastWeekSendCount($sku); $lastMouthSaleCount = $this->lastMouthSaleCount($sku); $lastMounthSendCount = $this->lastMouthSendCount($sku); $sql = "update om_sku_daily_status set \n\t\t\taverageDailyCount={$averageDailyCount},\n\t\t\tactualStockCount={$number},\n\t\t\twaitingSendCount={$waitingsend},\n\t\t\tavailableStockCount={$availableStockCount},\n\t\t\tlastDaySaleCount={$lastDaySaleCount},\n\t\t\tlastDaySendCount={$lastDaySendCount},\n\t\t\tlastWeekSaleCount={$lastWeekSendCount},\n\t\t\tlastWeekSendCount={$lastWeekSendCount},\n\t\t\tlastMouthSaleCount={$lastMouthSaleCount},\n\t\t\tlastMouthSendCount={$lastMounthSendCount},\n\t\t\tis_warning={$is_warning}\n\t\t \tWHERE sku='{$sku}'"; echo "{$sql}\n"; if ($dbcon->execute($sql)) { $exchange = $this->exchange; $this->rmqObj->queue_publish($exchange, $sql); //发布消息 echo "{$sku} 更新成功。。。\n"; } else { echo $sql; } }
if ($sf['isuse'] == '1') { $enable = 0; } if ($enable == 0) { continue; } if ($sf['goods_location'] == "停售") { continue; } /*if(in_array($key,$__liquid_items_postbyhkpost)||in_array($key,$__liquid_items_cptohkpost)||in_array($key,$__liquid_items_BuiltinBattery)||in_array($key,$__liquid_items_Paste)){ continue; }*/ /*$ss = "SELECT goods_count FROM ebay_onhandle WHERE goods_sn='$key'"; $ss = $dbConn->query($ss); $ss = $dbConn->fetch_array($ss);*/ $goods_count = WarehouseAPIModel::getSkuStock($key); $salensend = CommonModel::getpartsaleandnosendall($key); $useable_stock = $goods_count - $salensend; if ($useable_stock > 0) { $now_status = '1'; } else { $now_status = '0'; } $sql = "SELECT * FROM om_adjust_sku WHERE sku='{$key}' and type=1 order by createdtime desc"; $sql = $dbConn->query($sql); $sql = $dbConn->fetch_array($sql); if ($sql) { if ($now_status == $sql['adjustvalue']) { continue; } } else {