function act_checkWave() { $userId = $_SESSION['userId']; $wave = trim($_POST['wave']); $waveId = WhBaseModel::number_decode($wave); if (!$waveId) { self::$errCode = "001"; self::$errMsg = "请扫描配货单号!"; return FALSE; } $waveInfo = WhWaveInfoModel::get_wave_info('storey', $waveId); //获取配货单所有楼层 if (empty($waveInfo)) { self::$errCode = '002'; self::$errMsg = '配货单号' . $wave . '不存在!'; return FALSE; } $record = WhWaveFloorReceiveRecordModel::select('id', array('userId' => $userId, 'waveId' => $waveId, 'is_delete' => 0)); if (empty($record)) { $data['waveId'] = $waveId; $data['userId'] = $userId; $data['time'] = time(); $msg = WhWaveFloorReceiveRecordModel::insert($data); if (!$msg) { self::$errCode = '003'; self::$errMsg = '插入接收记录失败!'; return FALSE; } } $info = '该配货单需要配货楼层包括:<br />'; $storeys = explode(',', $waveInfo[0]['storey']); foreach ($storeys as $v) { $info .= $v . '楼<br />'; } return $info; }
private function buildWhereSql() { $sql_where_storeId = ''; $storeId = isset($_GET['storeId']) ? intval($_GET['storeId']) : 0; if ($storeId != 0) { $sql_where_storeId = " and po.storeId={$storeId}"; } $this->smarty->assign('storeId', $storeId); $keywords = isset($_GET['keywords']) ? trim($_GET['keywords']) : ''; //关键字 $sql_where_keywords = ''; $keytype = isset($_GET['keytype']) ? intval($_GET['keytype']) : ''; //关键字类型 //echo $keytype;exit; if (!empty($keywords) && $keytype != 0) { //有关键字搜索条件 $keywords = mysql_real_escape_string($keywords); if ($keytype == 1) { //按订单号搜索 $sql_where_keywords = " and por.originOrderId='{$keywords}'"; } elseif ($keytype == 2) { //按配货单号搜索 $sql_where_keywords = " and po.id='{$keywords}'"; } elseif ($keytype == 3) { //按sku搜索 $sql_where_keywords = " and pd.sku='{$keywords}'"; } elseif ($keytype == 4) { $sql_where_keywords = " and ot.tracknumber='{$keywords}'"; } else { if ($keytype == 5) { //按配货单号搜索 $wave = WhBaseModel::number_decode($keywords); //获取配货单ID $shipOrderIds = WhWaveShippingRelationModel::getShippingOrderIdsByWaveId($wave); //获取发货单ID $orderIds = array(); if (!empty($shipOrderIds)) { $orderIds = get_filed_array('shipOrderId', $shipOrderIds); } else { $orderIds = array(0); } $orderIds = implode(',', $orderIds); $sql_where_keywords = " and po.id in ({$orderIds})"; } } } $this->smarty->assign('keywords', $keywords); $this->smarty->assign('keytype', $keytype); $sql_where_status = ''; $status = intval($_GET['status']); //订单状态 if (!isset($_GET['status'])) { $status = PKS_WGETGOODS; } if ($status != 0) { //状态 $sql_where_status = " and po.orderStatus={$status}"; } $this->smarty->assign('status', $status); $sql_where_orderstarttime = ''; $ordertimestart = isset($_GET['startdate']) ? trim($_GET['startdate']) : ''; //下单日期 开始 if ($ordertimestart != 0) { //开始时间 $ordertimestart_int = strtotime($ordertimestart); $sql_where_orderstarttime = " and po.createdTime >= {$ordertimestart_int}"; } $this->smarty->assign('ordertimestart', $ordertimestart); $sql_where_orderendtime = ''; $ordertimeend = isset($_GET['enddate']) ? trim($_GET['enddate']) : ''; //下单日期 结束 if ($ordertimeend != 0) { //结束时间 $ordertimeend_int = strtotime($ordertimeend); //$ordertimeend_int += 86400; $sql_where_orderendtime = " and po.createdTime < {$ordertimeend_int}"; } $this->smarty->assign('ordertimeend', $ordertimeend); $sql_where_goodsoutstarttime = ''; $goodsouttimestart = isset($_GET['goodsouttimestart']) ? trim($_GET['goodsouttimestart']) : ''; //出库日期 开始 if ($goodsouttimestart != 0) { //出库开始时间 $goodsouttimestart_int = strtotime($goodsouttimestart); $sql_where_goodsoutstarttime = " and po.weighTime >= {$goodsouttimestart_int}"; } $this->smarty->assign('goodsouttimestart', $goodsouttimestart); $sql_where_goodsoutendtime = ''; $goodsouttimeend = isset($_GET['goodsouttimeend']) ? trim($_GET['goodsouttimeend']) : ''; //出库日期 结束 if ($goodsouttimeend != 0) { //出库结束时间 $goodsouttimeend_int = strtotime($goodsouttimeend); //$goodsouttimeend += 86400; $sql_where_goodsoutstarttime = " and po.weighTime < {$goodsouttimeend_int}"; } $this->smarty->assign('goodsouttimeend', $goodsouttimeend); $sql_where_isnote = ''; $isNote = intval($_GET['isNote']); if ($isNote) { //echo $isNote;exit; switch ($isNote) { case 1: //有留言 $sql_where_isnote = ' and po.isNote=1'; break; case 2: //没留言 $sql_where_isnote = ' and po.isNote=0'; break; } } $this->smarty->assign('isNote', $isNote); $sql_where_orderTypeId = ''; /* $orderTypeId = intval($_GET['orderTypeId']); if(!isset($_GET['orderTypeId'])){ $orderTypeId = 1; } switch ($orderTypeId){ case 1: //有留言 $sql_where_orderTypeId = ' and po.orderTypeId=1'; break; case 2: //没留言 $sql_where_orderTypeId = ' and po.orderTypeId=2'; break; } $this->smarty->assign('orderTypeId', $orderTypeId);*/ $sql_where_shiptype = ''; $shiptype = trim($_GET['shiptype']); //运输方式 if ($shiptype != 0) { //运输方式 if ($shiptype == 200) { $nshiptype = "1,2,3"; } else { if ($shiptype == 300) { $nshiptype = "6,10,52,53"; } else { $nshiptype = $shiptype; } } $sql_where_shiptype = " and po.transportId in({$nshiptype})"; } else { if (!empty($_SESSION['shippingList'])) { $nshiptype = implode(',', $_SESSION['shippingList']); $sql_where_shiptype = " and po.transportId in({$nshiptype})"; } } $this->smarty->assign('shiptype', $shiptype); $sql_where_clientname = ''; $client_name = trim($_GET['clientname']); if ($client_name != '') { //按客户id搜索 $sql_where_clientname = " and po.platformUsername='******'"; } $this->smarty->assign('clientname', $client_name); $sql_where_salesaccount = ''; $salesaccount = trim($_GET['salesaccount']); if ($salesaccount != '') { //按客户id搜索 $sql_where_salesaccount = " and po.accountId='{$salesaccount}'"; } else { if (!empty($_SESSION['accountList'])) { $accountInfo = implode(',', $_SESSION['accountList']); $sql_where_salesaccount = " and po.accountId in({$accountInfo})"; } } $this->smarty->assign('salesaccount', $salesaccount); $sql_where_hunhe = ''; $hunhe = intval($_GET['hunhe']); //echo $hunhe;exit; switch ($hunhe) { case 2: //单料号 $sql_where_hunhe = ' and po.orderAttributes=' . SOA_SINGLE; break; case 1: //多料号 $sql_where_hunhe = ' and po.orderAttributes=' . SOA_MULTIY; break; case 3: //组合订单 $sql_where_hunhe = ' and po.orderAttributes=' . SOA_COMBIN; break; } $this->smarty->assign('hunhe', $hunhe); $sql_where_platformName = ''; $platformName = trim($_GET['platformName']); if ($platformName != '') { //平台 $sql_where_platformName = " and po.platformId= {$platformName}"; } else { if (!empty($_SESSION['platformList'])) { $platformInfo = implode(',', $_SESSION['platformList']); $sql_where_platformName = " and po.platformId in({$platformInfo})"; } } $this->smarty->assign('platformName', $platformName); return $sql_where_storeId . $sql_where_keywords . $sql_where_status . $sql_where_orderstarttime . $sql_where_orderendtime . $sql_where_goodsoutstarttime . $sql_where_goodsoutendtime . $sql_where_isnote . $sql_where_orderTypeId . $sql_where_shiptype . $sql_where_clientname . $sql_where_salesaccount . $sql_where_hunhe . $sql_where_platformName; }
/** * WaveInfoManageView::get_search_where() * 处理配货单搜索条件 * @author Gary * @return void */ private function get_search_where() { $areaUser = trim($_GET['areaUser']) ? intval(trim($_GET['areaUser'])) : ''; //区域负责人 $shipOrderId = trim($_GET['shipOrderId']) ? intval(trim($_GET['shipOrderId'])) : ''; //发货单ID $waveType = trim($_GET['waveType']) ? intval(trim($_GET['waveType'])) : ''; //配货单类型 $waveZone = trim($_GET['waveZone']) ? intval(trim($_GET['waveZone'])) : ''; //配货单区域类型 $storey = isset($_REQUEST['storey']) ? intval(trim($_REQUEST['storey'])) : ''; //配货单打印楼层 $choose_area = trim($_GET['choose_area']); //选择的区域 $waveStatus = trim($_GET['waveStatus']); //配货单状态 $waveNumber = trim($_GET['waveNumber']); //配货单编号 $startdate = trim($_GET['startdate']); //开始日期 $enddate = trim($_GET['enddate']); //结束日日 foreach ($_GET as $key => $v) { //传递搜索条件到配货单管理页面 $this->smarty->assign($key, ${$key}); } //print_r($choose_area);exit; $searchArr = array(); $areas = array(); //区域集合 $wave_ids = array(); //配货单ID数组 if ($choose_area) { $areas[] = $choose_area; } if ($areaUser) { //区域负责人 $areaId = WhWaveAreaUserRelationModel::select(array('userId' => $areaUser, 'is_delete' => 0), 'areaId'); if (!empty($areaId)) { $areaName = WhWaveAreaInfoModel::get_area_info('areaName', $areaId[0]['areaId']); if (!empty($areaName)) { $areas[] = $areaName[0]['areaName']; } } } if ($waveNumber) { $wave_id = WhBaseModel::number_decode($waveNumber); //获取配货单ID $wave_ids[] = $wave_id; } if ($startdate) { $searchArr['a.createTime >='] = strtotime($startdate); } if ($enddate) { $searchArr['a.createTime <='] = strtotime($enddate); } if ($shipOrderId) { $ids = WhWaveShippingRelationModel::select(array('shipOrderId' => $shipOrderId, 'is_delete' => 0), 'waveId'); $tmp_ids = array(); if (!empty($ids)) { foreach ($ids as $val) { $tmp_ids[] = $val['waveId']; } } else { $tmp_ids[] = 0; } if (!empty($wave_ids)) { $wave_ids = array_intersect($wave_ids, $tmp_ids); $wave_ids = empty($wave_ids) ? array(0) : $wave_ids; } else { $wave_ids = $tmp_ids; } } if ($waveStatus) { $searchArr['a.waveStatus'] = $waveStatus; } if ($waveType) { $searchArr['a.waveType'] = $waveType; } if ($waveZone) { $searchArr['a.waveZone'] = $waveZone; } if (!empty($areas)) { $searchArr['c.area in'] = array_unique($areas); } if (!empty($wave_ids)) { $searchArr['a.id in'] = array_unique($wave_ids); } if ($storey) { $searchArr['a.printStorey'] = $storey; } $searchArr['a.waveStatus !='] = 0; $searchArr['a.createUserId !='] = 0; $searchArr['a.is_delete'] = 0; $searchArr['group by'] = 'a.id'; return $searchArr; }