/** * 仓位打印 */ public function act_getPrintList() { $info = array(); //仓库信息 $storeLists = WarehouseManagementModel::warehouseManagementModelList(); //楼层信息 $floorLists = FloorModel::getInvReasonList("*", ""); //仓库区域 $areaLists = M('WhArea')->getAreaList(); $info['storeLists'] = $storeLists; $info['floorLists'] = $floorLists; $info['areaLists'] = $areaLists; return $info; }
/** * whGoodsAssignView::view_editAssignList() * 调拨单修改界面 * @return void */ public function view_editAssignList() { self::bulidNav('修改调拨单', '修改调拨单', 51); $id = intval(trim($_GET['id'])) ? intval(trim($_GET['id'])) : 0; if ($id) { $where = 'where status = 1'; $storeLists = WarehouseManagementModel::warehouseManagementModelList($where); //获取可用仓库列表 $data = WhGoodsAssignModel::getAssignList(" and a.id={$id}", '', '', 'a.id'); if (!empty($data)) { $res = $data[0]; $detail = WhGoodsAssignModel::getsAssignListDetail($id); //调拨单明细 $this->smarty->assign('detail', $detail); $this->smarty->assign('res', $res); $createUser = getUserNameById($res['createUid']); $this->smarty->assign('createUser', $createUser); //$user = array('name'=>$userName, 'uid'=>$_SESSION['userId']); $this->smarty->assign('storeLists', $storeLists); $this->smarty->display('editAssignList.htm'); } //$userName = getUserNameById($_SESSION['userId']); //获取用户名 } }
$log_file = 'wh_getErpOnhandleChange/' . date('Y-m-d-H') . '.txt'; $date = date('Y-m-d H:i:s'); //$msg = '{"sku":"10878","amount":1,"reason":"\u9500\u552e\u8ba2\u5355\u51fa\u5e93","ioTypeId":"\u9500\u552e\u8ba2\u5355","ioType":1,"userId":"vipchen","ordersn":"2014-04-16-101430994"}'; $db_config = C("DB_CONFIG"); $dbConn = new mysql(); $dbConn->connect($db_config["master1"][0], $db_config["master1"][1], $db_config["master1"][2], ''); $dbConn->select_db($db_config["master1"][4]); $mctime = time(); //$msg_array = json_decode($msg->body,true); $msg_array = json_decode($msg->body, true); //echo ' [x] ', $msg->body, "\n"; //echo "\n\n"; write_log($log_file, json_encode($msg_array) . "\r\n"); if (!empty($msg_array)) { $sku = $msg_array['sku']; $ioTypeId = WarehouseManagementModel::whIoTypeModelList(" where typeName='{$msg_array['ioTypeId']}'"); $msg_array['ioTypeId'] = empty($ioTypeId) ? 0 : $ioTypeId[0]['id']; //获取出入库类型id $skuinfo = whShelfModel::selectSku("where sku='{$sku}'"); if (empty($skuinfo)) { $errCode = 409; $errMsg = "没有该料号"; $log_info = sprintf("料号:%s, 时间:%s,错误信息:%s,返回值:%s\r\n", $sku, $date, $errMsg, json_encode($skuinfo)); write_log($log_file, $log_info); OmAvailableModel::rollback(); continue; } $nums = ($msg_array['ioType'] == 1 ? '-' : '') . $msg_array['amount']; //1出库 2入库 //print_r($nums);exit; $positioninfo = whShelfModel::selectRelation("where pId={$skuinfo['id']}");
public static function whIoInvoicesTypeDel($where) { self::initDB(); $sql = "DELETE FROM " . self::$table3 . " {$where}"; $query = self::$dbConn->query($sql); if ($query) { return true; } else { self::$errCode = "4444"; self::$errMsg = "mysql:" . $sql . " error"; return false; } }
/** * WhGoodsAssignAct::export_data() * 导出调拨数据 * @return void */ public function export_data() { $ids = trim($_GET['ids']); if ($ids) { $assignList = WhGoodsAssignModel::getAssignList(" and a.id in ({$ids})", '', '', 'a.id'); $assign_status = C('assign_status'); //print_r($assign_status);exit; $name = 'assignList' . date('Y-m-d') . ".xls"; //$name = iconv('UTF-8', 'gb2312//ignore', $name); $excel = new ExportDataExcel('browser', $name); $excel->initialize(); $tharr = array("调拨单号", "SKU", "产品名称", "转出仓库", "转入仓库", "需求数量", "配货数量", '出库复核数量', '接收数量', '生成人员', '生成时间', '调拨单状态', '状态变更时间'); $excel->addRow($tharr); if (!empty($assignList)) { foreach ($assignList as $assign) { $outStore = WarehouseManagementModel::warehouseManagementModelList(" where id = {$assign['outStoreId']}"); $outStore = $outStore[0]['whName']; $inStore = WarehouseManagementModel::warehouseManagementModelList(" where id = {$assign['inStoreId']}"); $inStore = $inStore[0]['whName']; $maker = getUserNameById($assign['createUid']); $make_date = date('Y-m-d H:i:s', $assign['createTime']); $state_date = date('Y-m-d H:i:s', $assign['statusTime']); $status = $assign_status[$assign['status']]; $details = WhGoodsAssignModel::getsAssignListDetail($assign['id']); foreach ($details as $k => $val) { $tdarr = array($k == 0 ? $assign['assignNumber'] : '', $val['sku'], $val['goodsName'], $outStore, $inStore, $val['num'], $val['assignNum'], $val['outCheckNum'], $val['inCheckNum'], $k == 0 ? $maker : '', $k == 0 ? $make_date : '', $k == 0 ? $status : '', $k == 0 ? $state_date : ''); //print_r($tdarr);exit; $excel->addRow($tdarr); } } } $excel->finalize(); exit; } }
public function view_getWhRecManageList() { $paramArr = array(); $type = isset($_GET['type']) ? $_GET['type'] : ''; $status = isset($_GET['status']) ? $_GET['status'] : ''; $reStatus = isset($_GET['reStatus']) ? $_GET['reStatus'] : 0; $page = isset($_GET['page']) ? $_GET['page'] : 1; $paramArr['method'] = 'purchase.getPurchaseOrderList'; //API名称 $paramArr['page'] = $page; $paramArr['status'] = $reStatus; if ($type == 'search') { $keyWord = isset($_GET['keyWord']) ? post_check($_GET['keyWord']) : ''; $select = isset($_GET['select']) ? post_check($_GET['select']) : 0; $cStartTime = isset($_GET['cStartTime']) ? post_check($_GET['cStartTime']) : ''; $cEndTime = isset($_GET['cEndTime']) ? post_check($_GET['cEndTime']) : ''; $eStartTime = isset($_GET['eStartTime']) ? post_check($_GET['eStartTime']) : ''; $eEndTime = isset($_GET['eEndTime']) ? post_check($_GET['eEndTime']) : ''; if (!empty($select)) { $paramArr['key'] = $keyWord; $paramArr['type'] = $select; } if (!empty($cStartTime)) { $startTime = strtotime($cStartTime . '00:00:00'); $paramArr['addTime_start'] = $startTime; } if (!empty($cEndTime)) { $endTime = strtotime($cEndTime . '23:59:59'); $paramArr['addTime_end'] = $endTime; } if (!empty($eStartTime)) { $startTime = strtotime($eStartTime . '00:00:00'); $paramArr['auditTime_start'] = $startTime; } if (!empty($eEndTime)) { $endTime = strtotime($eEndTime . '23:59:59'); $paramArr['auditTime_end'] = $endTime; } } $purchase_order = UserCacheModel::callOpenSystem($paramArr); $total = $purchase_order[0]; $whRecManageList = $purchase_order[1]; if (!empty($whRecManageList)) { $usermodel = UserModel::getInstance(); $count = count($whRecManageList); for ($i = 0; $i < $count; $i++) { //仓库 $storeId = empty($whRecManageList[$i]['warehouse_id']) ? 1 : $whRecManageList[$i]['warehouse_id']; $whName_info = WarehouseManagementModel::warehouseManagementModelList("where companyId=1 and id={$storeId}"); $whRecManageList[$i]['whName'] = $whName_info[0]['whName']; $purchaseuser_info = $usermodel->getGlobalUserLists('global_user_name', "where a.global_user_id='{$whRecManageList[$i]['purchaseuser_id']}'", '', 'limit 1'); $inventory_info[$i]['purchaseuser'] = $purchaseuser_info[0]['global_user_name']; } } $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); 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)); } $navlist = array(array('url' => 'index.php?mod=skuStock&act=getSkuStockList', 'title' => '库存信息'), array('url' => '', 'title' => '收货管理表')); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('toptitle', '收货管理表'); $this->smarty->assign('toplevel', 0); $this->smarty->assign('secondlevel', '09'); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('status', $status); $this->smarty->assign('whRecManageList', $whRecManageList); //循环列表 $this->smarty->display("whRecManageList.htm"); }
function act_whIoInvoicesTypeDel($where) { $list = WarehouseManagementModel::whIoInvoicesTypeDel($where); if ($list) { return true; } else { self::$errCode = WarehouseManagementModel::$errCode; self::$errMsg = WarehouseManagementModel::$errMsg; return false; } }
/** * api获取出入库单类型 */ function act_getInvoiceType() { $info = WarehouseManagementModel::whIoInvoicesTypeModelList('where 1'); if (!$info) { self::$errCode = WarehouseManagementModel::$errCode; self::$errMsg = WarehouseManagementModel::$errMsg; return false; } else { return $info; } }
public function view_getskuStockList() { $type = isset($_GET['type']) ? $_GET['type'] : ''; $searchContent = isset($_GET['searchContent']) ? $_GET['searchContent'] : ''; $online = isset($_GET['online']) ? $_GET['online'] : ''; $warehouse = isset($_GET['warehouse']) ? $_GET['warehouse'] : ''; $isnew = isset($_GET['isnew']) ? $_GET['isnew'] : ''; $pid_one = isset($_GET['pid_one']) ? $_GET['pid_one'] : ''; $pid_two = isset($_GET['pid_two']) ? $_GET['pid_two'] : ''; $pid_three = isset($_GET['pid_three']) ? $_GET['pid_three'] : ''; $pid_four = isset($_GET['pid_four']) ? $_GET['pid_four'] : ''; $skuStockAct = new SkuStockAct(); $where = 'WHERE a.is_delete=0 '; if (!empty($online)) { $where .= "AND a.goodsStatus='{$online}' "; $this->smarty->assign('online', $online); } if (!empty($warehouse)) { $where .= "AND b.storeId='{$warehouse}' "; $this->smarty->assign('warehouse', $warehouse); } if (is_numeric($isnew)) { $where .= "AND a.isNew='{$isnew}' "; $this->smarty->assign('isnew', $isnew); } if (!empty($pid_four)) { $cate = $pid_one . "-" . $pid_two . "-" . $pid_three . "-" . $pid_four; $where .= "AND a.goodsCategory='{$cate}' "; $this->smarty->assign('pid_four', $pid_four); $this->smarty->assign('pid_three', $pid_three); $this->smarty->assign('pid_two', $pid_two); $this->smarty->assign('pid_one', $pid_one); $cate_four = $skuStockAct->act_getCategoryInfo($pid_three); $this->smarty->assign('cate_four', $cate_four); $cate_three = $skuStockAct->act_getCategoryInfo($pid_two); $this->smarty->assign('cate_three', $cate_three); $cate_two = $skuStockAct->act_getCategoryInfo($pid_one); $this->smarty->assign('cate_two', $cate_two); } else { if (!empty($pid_three)) { $cate = $pid_one . "-" . $pid_two . "-" . $pid_three; $where .= "AND a.goodsCategory='{$cate}' "; $this->smarty->assign('pid_three', $pid_three); $this->smarty->assign('pid_two', $pid_two); $this->smarty->assign('pid_one', $pid_one); $cate_three = $skuStockAct->act_getCategoryInfo($pid_two); $this->smarty->assign('cate_three', $cate_three); $cate_two = $skuStockAct->act_getCategoryInfo($pid_one); $this->smarty->assign('cate_two', $cate_two); } else { if (!empty($pid_two)) { $cate = $pid_one . "-" . $pid_two; $where .= "AND a.goodsCategory='{$cate}' "; $this->smarty->assign('pid_two', $pid_two); $this->smarty->assign('pid_one', $pid_one); $cate_two = $skuStockAct->act_getCategoryInfo($pid_one); $this->smarty->assign('cate_two', $cate_two); } else { if (!empty($pid_one)) { $where .= "AND a.goodsCategory='{$pid_one}' "; $this->smarty->assign('pid_one', $pid_one); } } } } switch ($type) { case '1': $spuinfo = OmAvailableModel::getTNameList("pc_goods", "sku", "where spu='{$searchContent}'"); if (empty($spuinfo)) { $skuinfo = get_realskuinfo($searchContent); foreach ($skuinfo as $sku => $num) { $sku_str .= "'" . $sku . "',"; } $sku_str = trim($sku_str, ','); $where .= "AND a.sku in (" . $sku_str . ") "; } else { foreach ($spuinfo as $info) { $sku_str .= "'" . $info['sku'] . "',"; } $sku_str = trim($sku_str, ','); $where .= "AND a.sku in (" . $sku_str . ") "; } break; case '2': $positionIds = SkuStockModel::getAllPositionIdByPName($searchContent); $pos = ''; if (!empty($positionIds)) { foreach ($positionIds as $positionId) { $pos .= $positionId['id'] . ","; } } else { $pos = 0; } $pos = trim($pos, ','); $where .= "AND b.positionId in({$pos}) "; break; case '3': $where .= "AND a.goodsName='{$searchContent}' "; break; case '4': $purchaseId = getUserIdByName($searchContent); if (empty($purchaseId)) { $purchaseId = 10000000; } $where .= "AND a.purchaseId='{$purchaseId}' "; break; case '5': $str = ''; $Supplier_id = CommonModel::getPartnerByName($searchContent); $paramArr['method'] = 'pc.getSkuByPartnerId'; //API名称 $paramArr['pid'] = $Supplier_id; $Supplier_info = UserCacheModel::callOpenSystem($paramArr); if (!empty($Supplier_info['data'])) { foreach ($Supplier_info['data'] as $info) { $str .= "'" . $info . "',"; } $str = trim($str, ","); $str = "(" . $str . ")"; } else { $str = "('no')"; } $where .= "AND a.sku in {$str} "; break; default: break; } $where .= "GROUP BY a.sku "; $total = $skuStockAct->act_getSkuStockCount($where); $num = 100; //每页显示的个数 $page = new Page($total, $num, '', 'CN'); $where .= "ORDER BY a.sku " . $page->limit; $skuStockList = $skuStockAct->act_getSkuStockList($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)); } $navlist = array(array('url' => 'index.php?mod=skuStock&act=searchSku', 'title' => '库存管理'), array('url' => 'index.php?mod=skuStock&act=searchSku', 'title' => '货品搜索')); $usermodel = UserModel::getInstance(); $count = count($skuStockList); for ($i = 0; $i < $count; $i++) { //$skuStockList[$i]['category'] = CommonModel::getCateInfoByPath($skuStockList[$i]['goodsCategory']); //类别 $user_info = $usermodel->getGlobalUserLists('global_user_name', "where a.global_user_id='{$skuStockList[$i]['purchaseId']}'", '', 'limit 1'); $skuStockList[$i]['pName'] = $user_info[0]['global_user_name']; //类别 $skuStockList[$i]['cateName'] = SkuStockModel::getCategoryInfoByPath($skuStockList[$i]['goodsCategory']); //获取供应商 $par['method'] = 'pc.getPartnerIdBySku'; //API名称 $par['sku'] = $skuStockList[$i]['sku']; $sku_pname = UserCacheModel::callOpenSystem($par); if (!empty($sku_pname['data'])) { $purchase = CommonModel::getPartnerByID($sku_pname['data']); $skuStockList[$i]['PartnerName'] = $purchase['username']; } //仓库 if (!empty($skuStockList[$i]['storeId'])) { $whName_info = WarehouseManagementModel::warehouseManagementModelList("where companyId=1 and id={$skuStockList[$i]['storeId']}"); $skuStockList[$i]['whName'] = $whName_info[0]['whName']; } //图片 //$picUrl = getPicFromOpenSys($skuStockList[$i]['sku']); //$skuStockList[$i]['picUrl'] = $picUrl; } //仓库 $whName = WarehouseManagementModel::warehouseManagementModelList("where companyId=1"); $this->smarty->assign('whName', $whName); //类别 $cate_f = SkuStockModel::getCategoryInfo(0); $this->smarty->assign('cate_f', $cate_f); $this->smarty->assign('type', $type); $this->smarty->assign('searchContent', $searchContent); $this->smarty->assign('navlist', $navlist); $this->smarty->assign('toptitle', '库存信息列表'); $this->smarty->assign('toplevel', 0); $this->smarty->assign('secondlevel', '01'); $this->smarty->assign('show_page', $show_page); $this->smarty->assign('status', $status); $this->smarty->assign('skuStockList', $skuStockList ? $skuStockList : null); //循环列表 $this->smarty->display("skuStock.htm"); }