public static function getInstance() { if (!self::$_instance instanceof self) { self::$_instance = new self(); } return self::$_instance; }
function act_operateAbOrder($orderId, $calcWeight) { $res = WarehouseAPIModel::operateAbOrder($orderId, $calcWeight); //self::$errCode = WarehouseAPIModel::$errCode; //self::$errMsg = WarehouseAPIModel::$errMsg; return $res; }
public function act_cancelDeal() { $orderid = isset($_GET['orderid']) ? intval($_GET['orderid']) : 0; $type = isset($_GET['type']) ? intval($_GET['type']) : 2; if ($orderid < 1) { // 传入订单号不正确 self::$errCode = 300; self::$errMsg = '订单号类型不正确!'; return FALSE; } //var_dump($orderid); exit; //$oi_obj = new OrderInfoModel (); $orderinfo = OrderInfoModel::getOrderInfo($orderid); //var_dump($orderinfo); if (!$orderinfo) { // 未找到订单 self::$errCode = OrderInfoModel::$errCode; self::$errMsg = OrderInfoModel::$errMsg; return FALSE; } if (C('STATESHIPPED') == $orderinfo['orderStatus'] && C('STATEHASSHIPPED_CONV') == $orderinfo['orderType']) { //订单已发货不能取消交易 self::$errCode = 304; self::$errMsg = '订单已完成不能取消交易!'; return FALSE; } else { if (C('STATESHIPPED') == $orderinfo['orderStatus'] && C('STATESHIPPED_APPLYPRINT') != $orderinfo['orderType']) { /*$ro_obj = new RequestOpenApiModel(); $parameter = array( 'method' => 'wh.discardShippingOrder', //API名称 'format' => 'json', //返回格式 'v' => '1.0', //API版本号 'username' => 'valsun.cn', 'originOrderId'=>$orderid, 'storeId'=>1 ); $sendresult = $ro_obj->sendRequest($parameter); $sendresult = json_decode($sendresult, TRUE);*/ //$orderids = array(0=>$orderid); $sendresult = WarehouseAPIModel::discardShippingOrder($orderid); //var_dump($sendresult); if (!$sendresult) { //推送消息到仓库系统失败 self::$errCode = 305; self::$errMsg = "发货单仓库废弃失败"; return FALSE; } } } $rtn = OrderInfoModel::cancelDeal($orderid, $type); self::$errCode = OrderInfoModel::$errCode; self::$errMsg = OrderInfoModel::$errMsg; return $rtn; }
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 function act_ebayOversea() { $user = $_SESSION['userName']; $objPHPExcel = new PHPExcel(); $sendreplacement = array('1' => '补寄全部', '2' => '补寄主体', '3' => '补寄配件'); $ebay_splitorder_logs = array('0' => '拆分 订单', '1' => '复制 订单', '2' => '异常 订单', '3' => '合并 包裹', '4' => '邮局退回补寄', '5' => '自动部分包货拆分', '7' => '同步异常订单'); $MAILWAYCONFIG = array(0 => 'EUB', 1 => '深圳', 2 => '福州', 3 => '三泰', 4 => '泉州', 5 => '义乌', 6 => '福建', 7 => '中外联', 8 => 'GM', 9 => '香港', 10 => '快递'); $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")->setLastModifiedBy("Maarten Balliauw")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file"); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', '日期'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('B1', 'ebay store'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('C1', '交易号'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('D1', '客户ID'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('E1', '仓位号'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('F1', '料号'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('G1', '数量'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('H1', '国家'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('I1', '产品价格'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('J1', 'ebay运费'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('K1', '包裹总价值'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('L1', '币种'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('M1', '包装员'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('N1', '挂号条码'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('O1', '是/否'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('P1', '重量'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('Q1', '邮费'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('R1', '运输方式'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('S1', '订单编号'); /* 王民伟 2012-04-18*/ $objPHPExcel->setActiveSheetIndex(0)->setCellValue('T1', '产品货本'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('U1', '交易ID'); /*---end Tt Uu Vv Ww Xx*/ $objPHPExcel->setActiveSheetIndex(0)->setCellValue('V1', 'ItemID'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('W1', '是否复制订单'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('X1', '是否补寄'); //add by Herman.Xi 2012-09-13 $objPHPExcel->setActiveSheetIndex(0)->setCellValue('Y1', '是否拆分订单'); //add by Herman.Xi 2012-09-14 $objPHPExcel->setActiveSheetIndex(0)->setCellValue('Z1', '包材'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('AA1', '包材费用'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('AB1', '是否组合料号'); //add by Herman.Xi 2012-12-17 $objPHPExcel->setActiveSheetIndex(0)->setCellValue('AC1', '发货分区'); $objPHPExcel->setActiveSheetIndex(0)->setCellValue('AD1', '是否邮局退回后补寄'); //add by Herman.Xi 2013-03-09 $objPHPExcel->setActiveSheetIndex(0)->setCellValue('AE1', 'PayPal邮箱'); //add by Herman.Xi 2013-03-09 $objPHPExcel->setActiveSheetIndex(0)->setCellValue('AF1', '采购'); //add by chenwei 2013-09-07 $start = strtotime($_REQUEST['start']); $end = strtotime($_REQUEST['end']); //echo $start."||".$end;exit; $account = $_REQUEST['account']; $tjstr = ''; if ($account != '') { $account = explode("#", $account); for ($i = 0; $i < count($account); $i++) { $a0 = $account[$i]; if ($a0 != '') { $tjstr .= " a.accountId = '" . $a0 . "' or "; } } } $packinglists = GoodsModel::getMaterInfo(); //需要调产品中心的接口才可以使用。 $packings = array(); foreach ($packinglists as $packinglist) { //$packings[$packinglist['id']] = $packinglist['pmCost']; $packings[$packinglist['pmAlias']] = $packinglist['pmCost']; } unset($packinglists); $tjstr = substr($tjstr, 0, strlen($tjstr) - 3); //$ret = OrderInfoModel::getShipOrderList($start,$end,$tjstr); $ret = WarehouseAPIModel::getAbOrderList(); $a = 2; for ($i = 0; $i < count($shipData); $i++) { $ordersn = $ret[$i]['ebay_ordersn']; $paidtime = @date('Y-m-d', $ret[$i]['ebay_paidtime']); $ebay_usermail = $ret[$i]['ebay_usermail']; $ebay_userid = $ret[$i]['ebay_userid']; $name = @html_entity_decode($ret[$i]['ebay_username'], ENT_QUOTES, 'UTF-8'); $street1 = @$ret[$i]['ebay_street']; $street2 = @$ret[$i]['ebay_street1']; $city = $ret[$i]['ebay_city']; $state = $ret[$i]['ebay_state']; $countryname = $ret[$i]['ebay_countryname']; //客服部小霞提出 导出列 国家 显示英文 方便退款处理 //$cnname = $country[$countryname]; $cnname = $countryname; $zip = $ret[$i]['ebay_postcode']; $tel = $ret[$i]['ebay_phone']; $ebay_shipfee = $ret[$i]['ebay_shipfee']; $ebay_note = $ret[$i]['ebay_note']; $ebay_total = @round($ret[$i]['ebay_total'], 2); $ebay_tracknumber = @$ret[$i]['ebay_tracknumber']; $ebay_account = @$ret[$i]['ebay_account']; $recordnumber0 = @$ret[$i]['recordnumber']; $ebay_carrier = @$ret[$i]['ebay_carrier']; $ebay_phone = $ret[$i]['ebay_phone']; $ebay_currency = $ret[$i]['ebay_currency']; $packinguser = $ret[$i]['packagingstaff']; $ordershipfee = $ret[$i]['ordershipfee']; $ebay_id = $ret[$i]['ebay_id']; $ebay_ptid = $ret[$i]['ebay_ptid']; $ebay_pp = $ret[$i]['PayPalEmailAddress']; $ebay_noteb = $ret[$i]['ebay_noteb']; //=='复制 订单' ? $ret[$i]['ebay_noteb'] : '' $is_sendreplacement = $ret[$i]['is_sendreplacement']; $is_main_order = $ret[$i]['is_main_order']; $mailway = $ret[$i]['mailway']; $address = $street1 . "\n" . $street2 . "\n" . $city . "\n" . $state . "\n" . $zip . "\n" . $countryname; $scantime = date('Y-m-d', $sql[$i]['scantime']); //$calculate_weight = $sql[$i]['orderweight']; //计算重量 $orderweight2 = number_format($sql[$i]['orderweight2'] / 1000, 3); //实际重量 $totalweight = $orderweight2; $ordershipfee = round(calctrueshippingfee($ebay_carrier, $totalweight, $countryname, $ebay_id), 2); $ebay_noteb = $is_main_order == 2 ? '复制 订单' : ($is_main_order == 1 ? '被复制 订单' : ''); $ebay_splitorder = judge_is_splitorder($ebay_id) == 1 ? '拆分 订单' : ''; $ebay_combineorder = judge_contain_combinesku($ordersn) ? '组合 料号' : ''; $splitorder_log = func_readlog_splitorder($ebay_id); $ebay_splitorder_log = ''; if ($splitorder_log != false) { $ebay_splitorder_log = $ebay_splitorder_logs[$splitorder_log]; } $is_sendreplacement = isset($sendreplacement[$is_sendreplacement]) ? $sendreplacement[$is_sendreplacement] : ''; $sl = "select * from ebay_orderdetail where ebay_ordersn='{$ordersn}'"; $sl = $dbcon->execute($sl); $sl = $dbcon->getResultArray($sl); if ($mailway === null) { $mailsql = "SELECT mailway FROM ebay_scan_mailway WHERE ebay_id={$sql[$i]['combine_package']}"; $mailsql = $dbcon->execute($mailsql); $mailllist = $dbcon->getResultArray($mailsql); $mailway_c = !empty($mailllist[0]['mailway']) ? $MAILWAYCONFIG[$mailllist[0]['mailway']] . '合并包裹' : ''; } else { $mailway_c = $MAILWAYCONFIG[$mailway]; } } }
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 {