Exemplo n.º 1
0
 public function act_findPosition()
 {
     $now_position = isset($_POST['now_position']) ? $_POST['now_position'] : "";
     $where = " where pName='{$now_position}'";
     $now_position_info = whShelfModel::selectPosition($where);
     if (!$now_position_info || empty($now_position_info)) {
         self::$errCode = "003";
         self::$errMsg = "系统中不存在[{$now_position}]仓位信息";
         return false;
     }
     $where = " where is_enable=0 and type=1 and id!={$now_position_info[0]['id']}";
     $picking_position_list = whShelfModel::selectPosition($where);
     //未用仓位
     $where = " where is_enable=0 and type=2 and id!={$now_position_info[0]['id']}";
     $nopicking_position_list = whShelfModel::selectPosition($where);
     //未用备货位
     $picking_arr = array();
     $picking_pname_arr = array();
     $show_picking_arr = array();
     $nopicking_arr = array();
     $nopicking_pname_arr = array();
     $show_nopicking_arr = array();
     if ($now_position_info[0]['type'] == 1) {
         $show_picking_arr[] = array('id' => $now_position_info[0]['id'], 'pName' => $now_position_info[0]['pName']);
     } else {
         if ($now_position_info[0]['type'] == 2) {
             $show_nopicking_arr[] = array('id' => $now_position_info[0]['id'], 'pName' => $now_position_info[0]['pName']);
         }
     }
     if ($picking_position_list) {
         foreach ($picking_position_list as $picking_position) {
             $distance = getDistance($now_position_info[0]['x_alixs'], $now_position_info[0]['y_alixs'], $now_position_info[0]['floor'], $picking_position['x_alixs'], $picking_position['y_alixs'], $picking_position['floor']);
             $picking_arr[$picking_position['id']] = $distance;
             $picking_pname_arr[$picking_position['id']] = $picking_position['pName'];
         }
         asort($picking_arr);
         $i = 0;
         foreach ($picking_arr as $p_key => $picking_info) {
             if ($i >= 3) {
                 break;
             }
             $show_picking_arr[] = array('id' => $p_key, 'pName' => $picking_pname_arr[$p_key]);
             $i++;
         }
     }
     if ($nopicking_position_list) {
         foreach ($nopicking_position_list as $nopicking_position) {
             $distance = getDistance($now_position_info[0]['x_alixs'], $now_position_info[0]['y_alixs'], $now_position_info[0]['floor'], $nopicking_position['x_alixs'], $nopicking_position['y_alixs'], $nopicking_position['floor']);
             $nopicking_arr[$nopicking_position['id']] = $distance;
             $nopicking_pname_arr[$nopicking_position['id']] = $nopicking_position['pName'];
         }
         asort($nopicking_arr);
         $j = 0;
         foreach ($nopicking_arr as $p_key => $nopicking_info) {
             if ($j >= 3) {
                 break;
             }
             $show_nopicking_arr[] = array('id' => $p_key, 'pName' => $nopicking_pname_arr[$p_key]);
             $j++;
         }
     }
     $res['show_picking'] = $show_picking_arr;
     $res['show_nopicking'] = $show_nopicking_arr;
     self::$errMsg = "请选择上架位置";
     return $res;
 }
Exemplo n.º 2
0
 public function view_getWhIoRecordsList()
 {
     $type = isset($_GET['type']) ? $_GET['type'] : '';
     $status = isset($_GET['status']) ? $_GET['status'] : '';
     $ioType = isset($_GET['ioType']) ? $_GET['ioType'] : '';
     if (intval($ioType) != 1 && intval($ioType) != 2) {
         //1为出库,2为入库
         $this->smarty->assign('$toptitle', '出入库记录列表');
         $this->smarty->assign('status', '参数错误');
         $this->smarty->assign('whIoRecordsList', null);
         //循环列表
         $this->smarty->display("whIoRecords.htm");
     } else {
         $ioType = intval($ioType);
         $whIoRecordsAct = new WhIoRecordsAct();
         $where = "WHERE ioType='{$ioType}' ";
         if ($type == 'search') {
             $id = isset($_GET['id']) ? post_check($_GET['id']) : '';
             $ordersn = isset($_GET['ordersn']) ? post_check($_GET['ordersn']) : '';
             $ioTypeId = isset($_GET['ioTypeId']) ? post_check($_GET['ioTypeId']) : '';
             $sku = isset($_GET['sku']) ? post_check($_GET['sku']) : '';
             $purchaseId = isset($_GET['purchaseId']) ? post_check($_GET['purchaseId']) : '';
             $userId = isset($_GET['userId']) ? post_check($_GET['userId']) : '';
             $positionId = isset($_GET['position']) ? post_check($_GET['position']) : '';
             $cStartTime = isset($_GET['cStartTime']) ? post_check($_GET['cStartTime']) : '';
             $cEndTime = isset($_GET['cEndTime']) ? post_check($_GET['cEndTime']) : '';
             if (!empty($id)) {
                 $where .= "AND id='{$id}' ";
             }
             if (!empty($ordersn)) {
                 $where .= "AND ordersn='{$ordersn}' ";
             }
             if (!empty($ioTypeId)) {
                 $where .= "AND ioTypeId='{$ioTypeId}' ";
             }
             if (!empty($sku)) {
                 $where .= "AND sku='{$sku}' ";
             }
             if (!empty($purchaseId)) {
                 $purchaseId = getUserIdByName($purchaseId);
                 $where .= "AND purchaseId='{$purchaseId}' ";
             }
             if (!empty($userId)) {
                 $userId = getUserIdByName($userId);
                 $where .= "AND userId='{$userId}' ";
             }
             if ($positionId) {
                 $positionId = WhPositionDistributionModel::get_position_info('id', '', $positionId);
                 $positionId = empty($positionId) ? '-1' : $positionId[0]['id'];
                 $where .= "AND positionId = '{$positionId}' ";
             }
             if (!empty($cStartTime)) {
                 $startTime = strtotime($cStartTime . '00:00:00');
                 $where .= "AND createdTime >='{$startTime}' ";
             }
             if (!empty($cEndTime)) {
                 $endTime = strtotime($cEndTime . '23:59:59');
                 $where .= "AND createdTime <='{$endTime}' ";
             }
         }
         $total = $whIoRecordsAct->act_getTNameCount('wh_iorecords', $where);
         $num = 100;
         //每页显示的个数
         $page = new Page($total, $num, '', 'CN');
         $where .= "ORDER BY createdTime DESC " . $page->limit;
         $whIoRecordsList = $whIoRecordsAct->act_getTNameList('wh_iorecords', '*', $where);
         if (!empty($_GET['page'])) {
             if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
                 $n = 1;
             } else {
                 $n = (intval($_GET['page']) - 1) * $num + 1;
             }
         } else {
             $n = 1;
         }
         if ($total > $num) {
             //输出分页显示
             $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
         } else {
             $show_page = $page->fpage(array(0, 2, 3));
         }
         $toptitle = '出库记录列表';
         $ioSearchName = '出库类型';
         $navlist = array(array('url' => 'index.php?mod=skuStock&act=getSkuStockList', 'title' => '库存信息'), array('url' => '', 'title' => '出库记录列表'));
         $this->smarty->assign('toplevel', 0);
         $this->smarty->assign('secondlevel', '34');
         $ioTypeList = WhIoStoreModel::getIoTypeListByioType(0);
         if ($ioType == 2) {
             $toptitle = '入库记录列表';
             $ioSearchName = '入库类型';
             $this->smarty->assign('secondlevel', 35);
             $navlist = array(array('url' => 'index.php?mod=skuStock&act=getSkuStockList', 'title' => '库存信息'), array('url' => '', 'title' => '入库记录列表'));
             $ioTypeList = WhIoStoreModel::getIoTypeListByioType(1);
         }
         $this->smarty->assign('toptitle', $toptitle);
         $this->smarty->assign('ioSearchName', $ioSearchName);
         $this->smarty->assign('ioTypeList', $ioTypeList);
         $this->smarty->assign('navlist', $navlist);
         $this->smarty->assign('show_page', $show_page);
         $this->smarty->assign('status', $status);
         $usermodel = UserModel::getInstance();
         foreach ($whIoRecordsList as $key => $val) {
             $whIoRecordsList[$key]['ioTypeName'] = WhIoStoreModel::getIoTypeNameById($val['ioTypeId']);
             $whIoRecordsList[$key]['whName'] = WhIoStoreModel::getWhNameById($val['storeId']);
             $purchase_user_info = $usermodel->getGlobalUserLists('global_user_name', "where a.global_user_id='{$val['purchaseId']}'", '', 'limit 1');
             $whIoRecordsList[$key]['purchaseName'] = $purchase_user_info[0]['global_user_name'];
             //$user_info 		   					   = $usermodel->getGlobalUserLists('global_user_name',"where a.global_user_id='{$val['userId']}'",'','limit 1');
             //$whIoRecordsList[$key]['userName']	   = $user_info[0]['global_user_name'];
             $whIoRecordsList[$key]['userName'] = getUserNameById($val['userId']);
             $position_info = whShelfModel::selectPosition("where id={$val['positionId']}");
             $whIoRecordsList[$key]['pName'] = $position_info[0]['pName'];
         }
         $this->smarty->assign('whIoRecordsList', $whIoRecordsList ? $whIoRecordsList : null);
         //循环列表
         $this->smarty->display("whIoRecords.htm");
     }
 }
Exemplo n.º 3
0
 public function act_export()
 {
     $ioType = intval($_GET['ioType']);
     $id = isset($_GET['id']) ? post_check($_GET['id']) : '';
     $ordersn = isset($_GET['ordersn']) ? post_check($_GET['ordersn']) : '';
     $ioTypeId = isset($_GET['ioTypeId']) ? post_check($_GET['ioTypeId']) : '';
     $sku = isset($_GET['sku']) ? post_check($_GET['sku']) : '';
     $purchaseId = isset($_GET['purchaseId']) ? post_check($_GET['purchaseId']) : '';
     $userId = isset($_GET['userId']) ? post_check($_GET['userId']) : '';
     $cStartTime = isset($_GET['cStartTime']) ? post_check($_GET['cStartTime']) : '';
     $cEndTime = isset($_GET['cEndTime']) ? post_check($_GET['cEndTime']) : '';
     if (empty($id) && empty($ordersn) && empty($ioTypeId) && empty($sku) && empty($purchaseId) && empty($userId) && empty($cStartTime) && empty($cEndTime)) {
         echo "请选择导出条件";
         exit;
     }
     $where = "WHERE ioType='{$ioType}' ";
     if (!empty($id)) {
         $where .= "AND id='{$id}' ";
     }
     if (!empty($ordersn)) {
         $where .= "AND ordersn='{$ordersn}' ";
     }
     if (!empty($ioTypeId)) {
         $where .= "AND ioTypeId='{$ioTypeId}' ";
     }
     if (!empty($sku)) {
         $where .= "AND sku='{$sku}' ";
     }
     if (!empty($purchaseId)) {
         $purchaseId = getUserIdByName($purchaseId);
         $where .= "AND purchaseId='{$purchaseId}' ";
     }
     if (!empty($userId)) {
         $userId = getUserIdByName($userId);
         $where .= "AND userId='{$userId}' ";
     }
     if (!empty($cStartTime)) {
         $startTime = strtotime($cStartTime . '00:00:00');
         $where .= "AND createdTime >='{$startTime}' ";
     }
     if (!empty($cEndTime)) {
         $endTime = strtotime($cEndTime . '23:59:59');
         $where .= "AND createdTime <='{$endTime}' ";
     }
     $lists = WhIoRecordsModel::getTNameList('wh_iorecords', '*', $where);
     if ($ioType == 1) {
         $excel = new ExportDataExcel('browser', "out_warehouse." . date('Y-m-d') . ".xls");
     } else {
         $excel = new ExportDataExcel('browser', "in_warehouse." . date('Y-m-d') . ".xls");
     }
     $excel->initialize();
     $tharr = array("日期", "料号", "仓位", "数量", "类型", "申请人", "订单号", "备注");
     $excel->addRow($tharr);
     foreach ($lists as $list) {
         $time = date('Y/m/d', $list['createdTime']);
         $sku = $list['sku'];
         $position_info = whShelfModel::selectPosition("where id={$list['positionId']}");
         $pName = $position_info[0]['pName'];
         $num = $list['amount'];
         $ioTypeName = WhIoStoreModel::getIoTypeNameById($list['ioTypeId']);
         $user = getUserNameById($list['userId']);
         $ordersn = $list['ordersn'];
         $reason = $list['reason'];
         $tdarr = array($time, $sku, $pName, $num, $ioTypeName, $user, $ordersn, $reason);
         $excel->addRow($tdarr);
     }
     $excel->finalize();
     exit;
 }
Exemplo n.º 4
0
 //B仓仓位库存
 //$sku_num    =   intval($erpSkuInfo['data']['second_count'] + $erpSkuInfo['data']['goods_count']); //ERP仓位库存
 //print_r($sku_num);exit;
 /** 无料号对应仓位的关系时更新关系表***/
 $positionId = whShelfModel::selectPosition("where pName = '{$sku_location}'");
 //print_r($positionId);exit;
 if (empty($positionId)) {
     $log_info = sprintf("料号:%s, 时间:%s,信息:%s,仓位:%s \r\n", $sku, $date, '系统没有该仓位', $sku_location);
     write_log($log_file, $log_info);
     $tname = 'wh_position_distribution';
     $set = "set pName='{$sku_location}', storeId ={$storeId}";
     $info = OmAvailableModel::insertRow($tname, $set);
     if ($info) {
         $log_info = sprintf("料号:%s, 时间:%s,信息:%s,仓位:%s \r\n", $sku, $date, '插入仓位成功', $sku_location);
         write_log($log_file, $log_info);
         $positionId = whShelfModel::selectPosition("where pName = '{$sku_location}'");
     } else {
         $log_info = sprintf("料号:%s, 时间:%s,信息:%s,仓位:%s \r\n", $sku, $date, '插入仓位失败', $sku_location);
         write_log($log_file, $log_info);
         continue;
     }
 }
 /** 更新新系统料号仓位关系**/
 $info = updateNewPostion($sku, $sku_location);
 $msg = $info ? '更新仓位成功!' : '更新仓位失败!';
 $log_info = sprintf("料号:%s, 时间:%s,信息:%s,返回值:%s, 参数:%s, %s \r\n", $sku, $date, $msg, $info, $sku, $sku_location);
 write_log($log_file, $log_info);
 $positionId = $positionId[0]['id'];
 TransactionBaseModel::begin();
 $relation = whShelfModel::selectRelation(" where pId={$pId} and positionId={$positionId}");
 /** 更新仓位库存**/
 public function findPositionRelation($sku)
 {
     $result = array();
     $now_position = array();
     $now_storeposition = array();
     $where = "where sku='{$sku}'";
     $skuinfo = whShelfModel::selectSku($where);
     $skuId = $skuinfo['id'];
     $where = "where pId ={$skuId} and is_delete=0 and storeId =2";
     $positioninfo = whShelfModel::selectRelation($where);
     //print_r($positioninfo);die;
     foreach ($positioninfo as $key => $value) {
         if ($value['type'] == 1) {
             $where = " where id={$value['positionId']}";
             $info = whShelfModel::selectPosition($where);
             if ($info) {
                 if (!empty($info[0]['pName'])) {
                     $now_position[] = array('id' => $value['id'], 'pName' => $info[0]['pName'], 'nums' => $value['nums']);
                 }
             }
         }
         if ($value['type'] == 2) {
             $where = " where id={$value['positionId']}";
             $info = whShelfModel::selectPosition($where);
             if ($info) {
                 if (!empty($info[0]['pName'])) {
                     $now_storeposition[] = array('id' => $value['id'], 'pName' => $info[0]['pName'], 'nums' => $value['nums']);
                 }
             }
         }
     }
     $result['now_position'] = $now_position;
     $result['now_storeposition'] = $now_storeposition;
     return $result;
 }