/** * CommonAct::actGetPurchaseList() * 获取公司采购列表 * @param int $all 是否全部获取 true全部获取 * @return array */ public static function actGetPurchaseList($all = false) { $cacheName = md5("purchase_list"); $memc_obj = new Cache(C('CACHEGROUP')); $purchaseInfo = $memc_obj->get_extral($cacheName); if (!empty($purchaseInfo)) { $purchaseInfo = unserialize($purchaseInfo); } else { $purchaseInfo = CommonModel::getPurchaseList(); $isok = $memc_obj->set_extral($cacheName, serialize($purchaseInfo)); if (!$isok) { self::$errCode = 0; self::$errMsg = 'memcache缓存出错!'; //return false; } } if ($all) { return $purchaseInfo; exit; } //获取当前用户可见采购帐号 $res = CommonAct::actGetPurchaseAccess(); if (empty($res['power_ids'])) { $uids = isset($_SESSION[C('USER_AUTH_SYS_ID')]) ? $_SESSION[C('USER_AUTH_SYS_ID')] : 0; } else { $uids = $res['power_ids']; } if (empty($uids)) { self::$errCode = 10001; self::$errMsg = '您还尚未登录!'; return false; } //获取可见采购的帐号信息 $uidArr = explode(",", $uids); $realArr = array(); foreach ($uidArr as $v) { foreach ($purchaseInfo as $key => $val) { if ($val['userId'] == $v) { array_push($realArr, array("userId" => $val['userId'], "userName" => $val['userName'])); break; } } } return $realArr; }
public function view_showPackage() { $navlist = array(array('url' => '', 'title' => '库存管理'), array('url' => '', 'title' => '点货清单')); $toplevel = 0; $secondlevel = 03; $checkUser = isset($_GET['checkUser']) ? $_GET['checkUser'] : ""; $purchase = isset($_GET['purchase']) ? $_GET['purchase'] : ""; $sku = isset($_GET['sku']) ? $_GET['sku'] : ""; $status = isset($_GET['status']) ? $_GET['status'] : 3; $start = isset($_GET['startdate']) ? $_GET['startdate'] : ""; $end = isset($_GET['enddate']) ? $_GET['enddate'] : ""; $this->smarty->assign('navlist', $navlist); $this->smarty->assign('toplevel', $toplevel); $this->smarty->assign('secondlevel', $secondlevel); if (empty($checkUser) && empty($purchase) && empty($sku) && empty($start) && empty($end) && $status == 200) { $where = "where is_delete=0"; } else { if (!empty($checkUser)) { $where[] = "tallyUserId='{$checkUser}'"; $this->smarty->assign("tallyUserId", $checkUser); } if (!empty($purchase)) { $where[] = "purchaseId='{$purchase}'"; $this->smarty->assign("purchase", $purchase); } if (!empty($sku)) { $where[] = "sku = '{$sku}'"; $this->smarty->assign("sku", $sku); } if ($status != 200) { $where[] = "entryStatus = '{$status}'"; $this->smarty->assign("status", $status); } if (!empty($start) && !empty($end)) { $starttime = strtotime($start); $endtime = strtotime($end); $where[] = "(entryTime between {$starttime} and {$endtime})"; $this->smarty->assign("start", $start); $this->smarty->assign("end", $end); } elseif (!empty($start) && empty($end)) { $starttime = strtotime($start); $where[] = "entryTime >{$starttime}"; $this->smarty->assign("start", $start); } elseif (empty($start) && !empty($end)) { $endtime = strtotime($end); $where[] = "entryTime < {$endtime}"; $this->smarty->assign("end", $end); } $where = implode(" AND ", $where); $where = " where is_delete=0 and " . $where; } $where = $where . ' order by id desc'; $nums = packageCheckModel::getTotalNums($where); $pagesize = 50; //$nums = count($lists); $pager = new Page($nums, $pagesize); $lists = packageCheckModel::selectList($where . " " . $pager->limit); if ($nums > $pagesize) { //分页 $pagestr = $pager->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)); } else { $pagestr = $pager->fpage(array(0, 2, 3)); } $userList = packageCheckModel::selectUser(); $usermodel = UserModel::getInstance(); foreach ($lists as $key => $list) { //到货库存 $sku_arrival = OmAvailableModel::getTNameList("wh_sku_location", "arrivalInventory", "where sku='{$list['sku']}'"); $lists[$key]['arrivalInventory'] = $sku_arrival[0]['arrivalInventory']; //获取原始点货数量 $before_num = OmAvailableModel::getTNameList("wh_tallying_adjustment", "beforeNum", "where tallyListId='{$list['id']}' order by id asc limit 1"); $lists[$key]['before_num'] = empty($before_num) ? $list['num'] : $before_num[0]['beforeNum']; } //点货员 $tallyUser = $usermodel->getGlobalUserLists('global_user_id,global_user_name', "where a.global_user_job=209", '', ''); $this->smarty->assign('tallyUser', $tallyUser); //采购员 $purchaseList = CommonModel::getPurchaseList(); $this->smarty->assign('purchaseList', $purchaseList); /** 添加贴标时间、QC检测时间、上架时间 add by GARY(yym)**/ $this->smarty->registerPlugin('function', 'getSkuTime', 'getSkuTime'); //$this->smarty->registerPlugin('function','getSkuInputTime','getSkuInputTime'); /** end**/ $toptitle = '点货清单列表'; //顶部链接 $this->smarty->assign('toptitle', $toptitle); $this->smarty->assign('pagestr', $pagestr); $this->smarty->assign("lists", $lists); $this->smarty->display('packageCheckList1.htm'); }