win 7and mac开发自动化申领单Day1——工具Dreamweaver8+Xampp+PHP+Python+MySQL
初步计划:
自动化申领单:
1、 大修只需要填入工卡号,系统自动查询需要手动输入
1.1所属飞机号(固定值)
1.2挂卡工作者即申领人(固定值)
1.3件号(可选,可勾选工卡里不需航材)需要手动操作
1.4锁定航材库存状态(库位,数量(固定值))
系统自动修改锁定器材库位,E5有库存修改锁定E5库存,退租检修改锁定ER库。非退租检飞机点击询问助理,自动发送邮件,助理点击邮件链接对其批准。
1.5所需单位、批准人(根据挂卡工作者区分,固定值)
1.6送货地点(根据所需单位区分,这里只有系统车间需要选择,1号机库or3号机库,默认选项3号机库)需要手动操作
1.7送货时间(自动判断例行工卡3day,非例行工卡1day,AOG 0.5day自动判断是否符合AOG(5项以内,若多余5项自动归纳为非例行工卡))可手动操作
2、确认信息后点击发送需手动点击
—————————————⬆大修操作部分——————————
3、发料组接到申请自动根据飞机号(无飞机号)分配工作任务(按照生产线指定)打印单据,发料完成后输入发料单号需要手动输入,配货完成后点击配货完成需手动点击
若有系统问题或库存差异做备注(后期自动发料完成会自动上报论坛,反馈解决进度)
4、车间接到器材签署接收(可否电子签署、存档)
5、数据统计:
每架飞机维修进度,共多少天,当前第几天(进度条格式),完成发料项数,今日完成项数,计算保障率。
/*附加:器材所需耗用比。PN:********,c1检/系统、机上…
*/
第一步:
1、安装环境,选择xampp,Dreamweaver8.
xampp(win7)下载地址:https://www.apachefriends.org/zh_cn/download_success.html
Dreamweaver(win7)下载地址:http://www.3d66.com/softhtml/showsoft_124.html
两个都是傻瓜软件选择安装位置,一直下一步就可以。
2、两个软件都安装完成后开始写个网页试试。
先设置下Dreamweaver字体,编辑——首选参数——字体——代码视图——14pt
编码,编辑——首选参数——新建文档——默认编码——utf-8
建立站点,站点——新建站点——基本——随便起个名字
高级——本地信息——本地根文件夹D:\xampp\htdocs\test\(你安装xampp里面的htdocs路径里面建立个test文件夹,作为测试用)——HTTP 地址——http://localhost/test/
测试服务器——服务器模型——选择PHP MySQl——访问——选择本地/网络——测试服务器文件夹与根目录文件夹一致D:\xampp\htdocs\test\——URl前缀——跟HTTP 地址一致http://localhost/test/。
完成。
开始测试下数据库
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>测试</title> </head> <body> Hello Word! <br/> <?php $mysqli=mysqli_connect("localhost","root","root","test"); if($mysqli){ echo "连接成功"; }else{ echo "连接失败"; } ?> </body> </html>
第二步
写一个登录的页面:
涉及到的知识点:
1、MYSQL数据库建立
IE打开:http://localhost/phpmyadmin/
新建test表单——新建表admin——名字分别为id、user、pwd——类型分别是int、varchar、varchar、把id设置主键
插入数据——id=1、user=aaa、pwd=111
2、简单的HTLM、CSS、JS
在Dreamweaver新建一个HTLM内容如下:保存文件名login
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>登录页面</title> <script> function KeyDown() { if (event.keyCode == 13) { event.returnValue=false; event.cancel = true; Form1.btnsubmit.click(); } } </script> </head> <body> <form action="login.php" method="post"> 账号:<input type="text" name="username" value="211203" onclick=javascript:this.value='' style="width:100px;"onkeydown=KeyDown()/> <br /> 密码:<input type="password" name="password" value="..." onclick=javascript:this.value='' style="width:100px;"onkeydown=KeyDown()/> <br /> <input type="submit" value="登录" id="login"/> </form> </body> </html>
3、PHP操作MYSQL数据库(mysqli登录)
连接数据库、字符转码:接收到的API什么格式,数据库就什么格式,然后PHP在转换成utf-8,你的浏览器显示就是utf-8的了。
coon.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>conn</title> </head> <body> <?php define('HOST','localhost'); define('USER','root'); define('PASS',''); define('DBNM','test'); //定义数据库连接常量 $conn=new mysqli(HOST,USER,PASS,DBNM); mysqli_query($conn,"SET NAMES 'utf8'"); ?> </body> </html>
login.htlm
功能:回车登录、默认值、点击编辑框内容清空
未解决问题:type=“text”和type=“password”大小不一致
知识点:<from></from>表单 提交方式,提交内容接收文件php
<input>自闭和标签属性{
type=""
name=""
value=""
待添加......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>登录页面</title> <script> function KeyDown() { if (event.keyCode == 13) { event.returnValue=false; event.cancel = true; Form1.btnsubmit.click(); } } </script> </head> <body> <form action="login.php" method="post"> 账号:<input type="text" name="username" value="211203" onclick=javascript:this.value='' style="width:100px;"onkeydown=KeyDown()/> <br /> 密码:<input type="password" name="password" value="..." onclick=javascript:this.value='' style="width:100px;"onkeydown=KeyDown()/> <br /> <input type="submit" value="登录" id="login"/> </form> </body> </html>
login.php
知识点:session_start();
include
$_post['表单里面的name值']
sql语句:待添加......
mysqli语句:待添加.....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>登陆中……</title> </head> <body> <?php session_start(); error_reporting(E_ALL &~ E_NOTICE); //屏蔽错误信息 include 'conn.php'; //调用数据库连接文件 $username=$_POST['username']; $password=$_POST['password']; //接收前台post值 if ($username == "" || $password == "") //判断用户名和密码是否为空 { echo "<script>alert('请输入用户名和密码');history.back();</script>"; } else { $selsql="SELECT * FROM admin WHERE user = '$username'"; $selres=$conn->query($selsql); $selrow=mysqli_fetch_object($selres); if ($selrow->user == $username) { //查询是否有此用户 if ($selrow->pwd == $password) //判断密码是否正确 { $_SESSION["user_name"]=$selrow->name; $_SESSION["code"]=mt_rand(0,100000); ?> <script> window.location.href="welcome.php"; </script> <?php } else { echo "<script>alert('密码错误');history.back();</script>"; } } else { echo "<script>alert('用户不存在');history.back();</script>"; } } ?> </body> </html>
welcome.php
功能:js动画时钟
调用session:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>欢迎登录</title> <script type="text/javascript"> function showTime(){ nowtime=new Date(); year=nowtime.getFullYear(); month=nowtime.getMonth()+1; date=nowtime.getDate(); document.getElementById("mytime").innerText=year+"年"+month+"月"+date+"日"+"\n"+nowtime.toLocaleTimeString(); } setInterval("showTime()",1000); </script> </head> <body> <?php session_start(); if(isset($_SESSION["code"])){ ?> 欢迎:<?php echo "${_SESSION["user_name"]}"; ?><br /> <span id="mytime"></span> <br/> <a href="login.html">退出登录</a> <?php } ?> </body> </html>
效果图:
点击登录
明天任务:
1、把没写的知识点写上
2、访问权限问题
3、研究下layui前段UI框架:http://www.layui.com/
参考:http://static7.calm7.com/index/index.html
牛逼:http://win10ui.yuri2.cn/src/demo.php
参考2:http://www.zjsoar.com/layuicms/
4、把登录流改成面向对象,放到UI框架里面。