/** * MakeRouteIndexAct::act_makeAreaIndex() * 生成区域索引 * @author Gary * @return */ public function act_makeAreaIndex() { $areaInfo = WhWaveAreaInfoModel::get_area_by_floorId(); if (empty($areaInfo)) { self::$errCode = 201; self::$errMsg = '没有关联区域信息!'; return FALSE; } //print_r($areaInfo);exit; $new_arr = array(); foreach ($areaInfo as $area) { //按照楼层和纵坐标生成新区域数组 $y = $area['start_y_alixs']; $new_arr[$area['floorId']][$y][] = $area; } unset($areaInfo); $i = 1; $insert_data = array(); //print_r($new_arr);exit; foreach ($new_arr as $val1) { //遍历排序 foreach ($val1 as $val2) { foreach ($val2 as $area) { $insert_data[] = array('routeId' => $area['id'], 'name' => $area['areaName'], 'route' => $i, 'routeType' => 3); $i++; } } } WhBaseModel::begin(); $where = 'routeType = 3'; $info = WhWaveRouteRelationModel::delete_relation($where); if (!$info) { WhBaseModel::rollback(); self::$errCode = 202; self::$errMsg = '删除旧区域索引失败!'; return FALSE; } $info = WhWaveRouteRelationModel::insert_data($insert_data); if (!$info) { WhBaseModel::rollback(); self::$errCode = 203; self::$errMsg = '插入新区域索引失败!'; return FALSE; } WhBaseModel::commit(); self::$errCode = 200; self::$errMsg = '更新区域索引成功!'; return TRUE; }
/** * WaveBuildAct::process_scan_details() * 处理订单详情生成对应的配货记录 * @param array $order_detail * @return void */ public function process_scan_details($order_detail) { $return = array(); if (is_array($order_detail)) { foreach ($order_detail as $key => $val) { $position_info = WhPositionDistributionModel::get_position_info(array('storey', 'areaId'), $val['positionId']); $areaName = WhWaveAreaInfoModel::get_area_info('areaName', $position_info[0]['areaId']); $return[$key] = array('sku' => $val['sku'], 'skuAmount' => $val['amount'], 'pName' => $val['pName'], 'storey' => $position_info[0]['storey'], 'area' => $areaName[0]['areaName']); } } return $return; }
/** * 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; }