public function view_index() { $productStockalarm = new ProductStockalarmAct(); //接收参数生成条件 $curpage = isset($_GET['page']) ? abs(intval($_GET['page'])) : 1; $pid = isset($_GET['pid']) ? intval($_GET['pid']) : 0; //供应商ID $type = isset($_GET['type']) ? trim($_GET['type']) : ''; //搜索条件 $key = isset($_GET['keyword']) ? post_check(trim($_GET['keyword'])) : ''; //关键词 $pcid = isset($_GET['pcid']) ? intval($_GET['pcid']) : 0; //采购员ID $is_warn = isset($_GET['is_warn']) ? intval($_GET['is_warn']) : ''; //是否预警 $status = isset($_GET['status']) ? intval($_GET['status']) : ''; //产品状态 $condition = "1"; if (!empty($status)) { $condition .= " AND a.goodsStatus = '{$status}'"; } if (!empty($is_warn)) { //$condition .= " AND c.is_warning = '{$is_warn}'"; $condition .= " AND c.is_alert = '{$is_warn}'"; } if ($pid != "") { $skuData = new SkuAanalyzeAct(); $skuArr = $skuData->getSkuFromPartner($pid); $skuStr = implode("','", $skuArr); $condition .= " AND a.sku in ('{$skuStr}')"; } if ($type && $key) { if ($type == 'goodsName') { $condition .= ' AND a.' . $type . " like '%" . $key . "%'"; } else { if ($type == "partner") { $skuArr = $this->getSkuByPartner($key); $skuStr = implode("','", $skuArr); $condition .= " and a.sku in ('{$skuStr}')"; } else { $condition .= " AND a.sku like '{$key}%'"; } } } else { if (isset($key)) { $condition .= " AND a.sku like '%{$key}%'"; } } $condition .= " AND a.is_delete=0"; //获取符合条件的数据并分页 $pagenum = 100; //每页显示的个数 $res = $productStockalarm->actList($condition, $curpage, $pagenum); $total = $productStockalarm->actListCount($condition); //页面总数量 $page = new Page($total, $pagenum, '', 'CN'); $pageStr = ""; $pageStr = $page->fpage(); $totalPageNum = ceil($total / $pagenum); //替换页面内容变量 $tableColor = array("active", "success", " ", "warning", " ", "danger"); $this->smarty->assign("tableColor", $tableColor); $this->smarty->assign('title', '采购下单预警'); $this->smarty->assign('key', $key); $this->smarty->assign('type', $type); $skuData = new SkuAanalyzeAct(); $platformInfo = $skuData->getSalePlatform(); $this->smarty->assign('platformInfo', $platformInfo); //销售平台数据 $this->smarty->assign('pid', $pid); $this->smarty->assign('is_warn', $is_warn); $this->smarty->assign('pcid', $pcid); $this->smarty->assign('status', $status); $this->smarty->assign('lists', $res); $purchaseList = getPurchaseUserList(); $this->smarty->assign('purchaseList', $purchaseList); //采购列表 $partnerList = getPartnerlist(); $this->smarty->assign('partnerList', $partnerList); //供应商列表 $this->smarty->assign('pageStr', $pageStr); //分页输出 $this->smarty->assign('totalPageNum', $totalPageNum); //$allPurchaser = $this->getPurchaseUserAll(); $allPurchaser = $purchaseList; $this->smarty->assign('allPurchaser', $allPurchaser); $this->smarty->display('products.htm'); }
public function view_outStock() { //error_reporting(-1); $productStockalarm = new ProductStockalarmAct(); //接收参数生成条件 $curpage = isset($_GET['page']) ? abs(intval($_GET['page'])) : 1; $pid = isset($_GET['pid']) ? intval($_GET['pid']) : 0; //供应商ID $type = isset($_GET['type']) ? trim($_GET['type']) : ''; //搜索条件 $key = isset($_GET['keyword']) ? post_check(trim($_GET['keyword'])) : ''; //关键词 $pcid = isset($_GET['pcid']) ? intval($_GET['pcid']) : 0; //采购员ID $is_warn = isset($_GET['is_warn']) ? intval($_GET['is_warn']) : ''; //是否预警 $status = isset($_GET['status']) ? intval($_GET['status']) : ''; //产品状态 $arrivalDays = isset($_GET['arrivalDays']) ? intval($_GET['arrivalDays']) : ''; //可能到货天数 $isSendMail = isset($_GET['isSendMail']) ? intval($_GET['isSendMail']) : ''; //是否已推送邮件 $skuData = new SkuAanalyzeAct(); //$condition = "1"; $condition = " a.goodsStatus != 2"; if (!empty($pcid)) { $condition .= " AND a.purchaseId = '{$pcid}'"; } else { $condition .= " AND a.purchaseId = '{$_SESSION['sysUserId']}'"; } if (!empty($is_warn)) { //$condition .= " AND c.is_warning = '{$is_warn}'"; $condition .= " AND c.is_alert = '{$is_warn}'"; } if ($pid != "") { $skuArr = $skuData->getSkuFromPartner($pid); $skuStr = implode("','", $skuArr); $condition .= " AND a.sku in ('{$skuStr}')"; } if ($type && $key) { if ($type == 'goodsName') { $condition .= ' AND a.' . $type . " like '%" . $key . "%'"; } else { if ($type == "partner") { $skuArr = $this->getSkuByPartner($key); $skuStr = implode("','", $skuArr); $condition .= " and a.sku in ('{$skuStr}')"; } else { $condition .= " AND a.sku like '{$key}%'"; } } } //跟据到货天数筛选 if (!empty($arrivalDays)) { if ($arrivalDays == '1') { $condition .= " AND (c.addReachtime=0 OR c.reach_days=0)"; } else { $condition .= " AND c.addReachtime<>0 AND c.reach_days<>0"; } } //跟据是否已推送邮件筛选 if (!empty($isSendMail)) { if ($isSendMail == '1') { $condition .= " AND (c.out_mark=1 OR c.out_mark=2)"; } else { $condition .= " AND c.out_mark=0"; } } $condition .= " AND c.out_alert=1 and c.everyday_sale!=0 and a.is_delete=0 and a.isNew=0"; //获取符合条件的数据并分页 $pagenum = 100; //每页显示的个数 $res = $productStockalarm->actList($condition, $curpage, $pagenum); $total = $productStockalarm->actListCount($condition); //页面总数量 $page = new Page($total, $pagenum, '', 'CN'); $pageStr = ""; $pageStr = $page->fpage(); $totalPageNum = ceil($total / $pagenum); //替换页面内容变量 $tableColor = array("active", "success", " ", "warning", " ", "danger"); $this->smarty->assign("tableColor", $tableColor); $this->smarty->assign('title', '超卖控制'); $this->smarty->assign('key', $key); $this->smarty->assign('type', $type); $platformInfo = $skuData->getSalePlatform(); $this->smarty->assign('platformInfo', $platformInfo); //销售平台数据 $this->smarty->assign('pid', $pid); $this->smarty->assign('is_warn', $is_warn); $this->smarty->assign('pcid', $pcid); $this->smarty->assign('status', $status); $this->smarty->assign('lists', $res); $purchaseList = getPurchaseUserList(); $this->smarty->assign('purchaseList', $purchaseList); //采购列表 $partnerList = getPartnerlist(); $this->smarty->assign('partnerList', $partnerList); //供应商列表 $this->smarty->assign('pageStr', $pageStr); //分页输出 $this->smarty->assign('totalPageNum', $totalPageNum); $allPurchaser = $this->getPurchaseUserAll(); $this->smarty->assign('allPurchaser', $allPurchaser); $this->smarty->display('outStock.htm'); }
/** * ProductStockalarmAct::act_updateWarnOld() * 更新选择料号的预警信息 * @param array skuArr 料号数组 * @return bool */ public function act_updateWarnOld() { $skuArr = isset($_POST['skuList']) ? $_POST['skuList'] : ""; $gid = isset($_SESSION[C('USER_AUTH_SYS_ID')]) ? $_SESSION[C('USER_AUTH_SYS_ID')] : 0; if (empty($skuArr) || !is_array($skuArr)) { self::$errCode = 10000; self::$errMsg = "料号参数非法!"; return false; } if (!count($skuArr)) { self::$errCode = 10001; self::$errMsg = "料号不能为空数组!"; return false; } if (empty($gid)) { self::$errCode = 10002; self::$errMsg = "您无权更新缓存!"; return false; } $res = ProductStockalarmModel::updateWarn($gid, $skuArr); self::$errCode = ProductStockalarmModel::$errCode; self::$errMsg = ProductStockalarmModel::$errMsg; return $res; }