html和javascript代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<style>
body {
font-family: Verdana;
margin: 0px;
padding: 0px;
text-align: center;
font-weight: bold;
font-size: 14px;
}
.frametittle {
background: url('/public/images/left_bg2.jpg') repeat-x;
text-align: center;
padding-bottom: 18px;
font-size: 25px;
color: #000000;
font-weight: bold;
}
#msg38{
font-size: 30px;
color: red;
font-weight: bold;
font-family: Microsoft Yahei;
}
.Tracking {
width: 100%;
}
.tr {
height: 30px;
}
.td1{
width: 15%;
text-align: right;
padding-right: 10px;
}
.td2{
text-align: left;
}
.td3{
text-align: left;
width: 30%;
}
.textinput{
height:30px;
width: 60%;
font-size: 12px;
font-weight: bold;
padding-left: 5px;
/*
border-top: none;
border-left: none;
border-right: none;
border-bottom: 2px;
*/
}
.textinput2{
height:30px;
width: 60%;
font-size: 12px;
font-weight: bold;
padding-left: 5px;
/*
border-top: none;
border-left: none;
border-right: none;
border-bottom: 2px;
*/
}
.xlbtn {
margin: 20px 40px;
border-style: none;
border-color: inherit;
border-width: 0px;
border-radius: 4px;
font-size: 18px;
Color:White;
Width:100px;
*background: url(../images/btn_bg1.jpg) repeat-x;
_background: url(../images/btn_bg1.jpg) repeat-x;
background: url(../images/btn_bg1.jpg) repeat-x;
background: linear-gradient(#f77777, #ce0000);
cursor:pointer;
height:30px;
line-height:30px;
}
.bt{
*background: url(../images/btn_bg1.jpg) repeat-x;
_background: url(../images/btn_bg1.jpg) repeat-x;
background: url(../images/btn_bg1.jpg) repeat-x;
background: linear-gradient(#f77777, #ce0000);
cursor:pointer;
Color:White;
border-color: inherit;
border-style: none;
border-radius: 2px;
}
.divmsg {
margin:0px auto;
font-size: 26px;
color:red;
font-family :Verdana;
}
.divider{
height: 20px;
}
.history {
font-size: 18px;
color: black;
position: absolute;
right: 5%;
padding: 5px;
}
.HisLink {
font-size: 18px;
color: black;
position: absolute;
right: 5%;
padding: 5px;
}
.HisLinkLeft{
font-size: 18px;
color: black;
position: absolute;
left: 5%;
padding: 5px;
}
li{
list-style-type:none;
}
</style>
<title>Tracking</title>
</head>
<body>
<form action="<{$app}>/Tracking/secondfile" method="post" enctype="multipart/form-data" />
<table id="Tracking" class="Tracking" border="0">
<tr><td colspan="4" class="frametittle" ><a class="HisLinkLeft" href="<{$app}>/Tracking/history">History</a>8D<a href="<{$app}>/Tracking/Action" class="HisLink" id="action">Action</a></td></tr>
<tr class="tr">
<td class="td1">CAR#</td>
<td class="td2" colspan="">
<input type="text" class="textinput" style="width:60%" id="CAR" name="CAR1">
</td>
<td align="left" style="padding-left: 0px;" colspan="2">
<input type=radio name="CAR" value='Complain'>Complain
<input type=radio name="CAR" value='Feeback'>Feeback
<input type=radio name="CAR" value='Internal'>Internal</td>
</tr>
<tr class="tr">
<td class="td1">Title</td>
<td class="td2" colspan="3">
<input type=text class="textinput" id="Title" style="width:84%">
</td>
</tr>
<tr class="tr">
<td class="td1">Customer</td>
<td class="td2">
<input type=text class="textinput" id="Customer">
</td>
<td class="td1">End Customer</td>
<td class="td2">
<input type=text class="textinput" id="EndCustomer">
</td>
</tr>
<tr class="tr">
<td class="td1">Received Date</td>
<td class="td2">
<input type=date class="textinput" id="ReceivedDate">
</td>
<td class="td1">Device</td>
<td class="td3">
<input type=text class="textinput" id="Device">
</td>
</tr>
<tr class="tr">
<td class="td1">Lot#</td>
<td class="td3">
<input type=text class="textinput" id="Lot">
</td>
<td class="td1">Package</td>
<td class="td2">
<input type=text class="textinput" id="Package">
</td>
</tr>
<tr class="tr">
<td class="td1">Plant</td>
<td class="td3">
<input type=text class="textinput" id="Plant">
</td>
<td class="td1">Serial#</td>
<td class="td2">
<input type=text class="textinput" id="Serial">
</td>
</tr>
<tr class="tr">
<td class="td1">Area</td>
<td class="td3">
<input type=text class="textinput" id="Area">
</td>
<td class="td1">Department</td>
<td class="td2">
<input type=text class="textinput" id="Department">
</td>
</tr>
<tr class="tr">
<td class="td1">Failure rate</td>
<td class="td3">
<input type=text class="textinput" id="Failurerate">
</td>
<td class="td1">Date Code</td>
<td class="td2">
<input type=text class="textinput" id="DateCode">
</td>
</tr>
<tr class="tr">
<td class="td1">Affected Qty</td>
<td class="td2">
<input type=text class="textinput" id="AffectedQty">
</td>
<td class="td1">Sample Required</td>
<td class="td3">
<input type=radio name="SampleRequired" value='Yes'>Yes
<input type=radio name="SampleRequired" value='No'>No
</td>
</tr>
<tr class="divider"></tr>
<tr class="tr">
<td class="td1">Sample receive date</td>
<td class="td2">
<input type=date class="textinput2" id="Samplereceivedate">
</td>
<td class="td1">Failure mode</td>
<td class="td3">
<input type=text class="textinput2" id="FailureMode">
</td>
</tr>
<tr class="tr">
<td class="td1">Problem verification</td>
<td class="td2">
<input type=radio name="Problemverification" value='Valid'>Valid
<input type=radio name="Problemverification" value='InValid'>InValid
</td>
<td class="td1">Root cause-4M</td>
<td class="td3">
<input type=radio name="Rootcause" value='Man'>Man
<input type=radio name="Rootcause" value='Machine'>Machine
<input type=radio name="Rootcause" value='Material'>Material
<input type=radio name="Rootcause" value='Method'>Method
</td>
</tr>
<tr class="tr">
<td class="td1">3D Report Date</td>
<td class="td3">
<input type=date class="textinput2" id="threeDReportDate">
</td>
<td class="td1">8D report Date</td>
<td class="td2">
<input type=date class="textinput2" id="eightDReportDate">
</td>
</tr>
<tr class="tr">
<td class="td1">3D Report File</td>
<td class="td3">
<input id="3d" class="bt" type="submit" name="submit" value="上传">
<label class="bt" style="margin-left:40px;" for="file3d">上传文件</label>
<input style="margin-left:40px;position:absolute;clip:rect(0 0 0 0);" type="file" id="file3d" name="file3d">
<a id="add3">未选择文件</a>
</td>
<td class="td1">8D report File</td>
<td class="td2">
<input id="8d" class="bt" type="submit" name="submit" value="上传">
<label class="bt" style="margin-left:40px;" for="file8d">上传文件</label>
<input style="margin-left:40px;position:absolute;clip:rect(0 0 0 0);" type="file" id="file8d" name="file8d">
<a id="add8">未选择文件</a>
</td>
</tr>
<tr class="file" >
<td class="td1">3D Report File</td>
<td class="td3">
<ul id="file3" style="font-size:12px;" ></ul>
<a id="msg38"></a>
</td>
<td class="td1">8D report File</td>
<td class="td2">
<ul id="file8" style="font-size:12px;"></ul>
</td>
</tr><br>
<tr class="tr">
<td class="td1">3D Close Date</td>
<td class="td3">
<input type=date class="textinput2" id="threeDCloseDate">
</td>
<td class="td1">8D Close Date</td>
<td class="td2">
<input type=date class="textinput2" id="eightDCloseDate">
</td>
</tr>
<tr class="tr">
<td class="td1">3D Cycle time</td>
<td class="td3">
<input type="text" class="textinput2" id="threeDCycletime">
</td>
<td class="td1">8D cycle time</td>
<td class="td2">
<input type="text" class="textinput2" id="eightDCycletime">
</td>
</tr>
<tr class="divider">
<td colspan="2"><div id="divmsg" class="divmsg"></div></td>
</tr>
<tr >
<td colspan="4">
<input type="button" id='save' value="Save" class="xlbtn" >
<input type="button" id='btnAction' value="Action" class="xlbtn" style="display: none;">
</td>
</tr>
</table>
</form>
</body>
<script type="text/javascript" src="<{$public}>/js/jquery.js"></script>
<script>
$(function(){
var url = window.location.href; //获取当前浏览器的url
index1 = url.indexOf("flag");
if (index1 != -1) {
var start = url.indexOf("A");
var getCAR = url.substring(start + "A".length + 1);
$("#action").attr("href","<{$app}>/Tracking/action"+"?flag=true&A="+getCAR);
$("#btnAction").show().click(function(){
location.href = "<{$app}>/Tracking/action"+"?flag=true&A="+getCAR;
})
//文件名显示代码
$.ajax({
url:"<{$app}>/Tracking/files3",
type:"POST",
data:{
CAR:getCAR,
},
success:function(json){
var file=eval(json);
var name="";
for(var i=0;i<file.length;i++){
if(file[i]!='.'&&file[i]!='..'){
name+="<li style='margin-left:-40px;'>"+"<input style='border:none;' type='text' id=file3"+i+" value="+file[i]+" name=3><input type='button' style='*background: url(../images/btn_bg1.jpg) repeat-x;_background: url(../images/btn_bg1.jpg) repeat-x;background: url(../images/btn_bg1.jpg) repeat-x;background: linear-gradient(#f77777, #ce0000);cursor:pointer;Color:White;border-color: inherit;border-style: none;border-radius: 2px;' value='dload' οnclick='click2(this)' class=file3"+i+"><input type='button' οnclick='click1(this)' style='*background: url(../images/btn_bg1.jpg) repeat-x;_background: url(../images/btn_bg1.jpg) repeat-x;background: url(../images/btn_bg1.jpg) repeat-x;background: linear-gradient(#f77777, #ce0000);cursor:pointer;Color:White;border-color: inherit;border-style: none;border-radius: 2px;' value='del' class=file3"+i+"></li> <br/>";
}
}
$("#file3").html(name);
}
})
//文件名显示代码
$.ajax({
url:"<{$app}>/Tracking/files8",
type:"POST",
data:{
CAR:getCAR,
},
success:function(json){
var file=eval(json);
console.log(file);
console.log(file.length);
var name="";
for(var i=0;i<file.length;i++){
if(file[i]!='.'&&file[i]!='..'){
name+="<li style='margin-left:-40px;'>"+"<input style='border:none; type='text' id=file8"+i+" value="+file[i]+" name=8><input type='button' style='*background: url(../images/btn_bg1.jpg) repeat-x;_background: url(../images/btn_bg1.jpg) repeat-x;background: url(../images/btn_bg1.jpg) repeat-x;background: linear-gradient(#f77777, #ce0000);cursor:pointer;Color:White;border-color: inherit;border-style: none;border-radius: 2px;' value='dload' οnclick='click2(this)' class=file8"+i+"><input type='button' οnclick='click1(this)' value='del' style='*background: url(../images/btn_bg1.jpg) repeat-x;_background: url(../images/btn_bg1.jpg) repeat-x;background: url(../images/btn_bg1.jpg) repeat-x;background: linear-gradient(#f77777, #ce0000);cursor:pointer;Color:White;border-color: inherit;border-style: none;border-radius: 2px;' class=file8"+i+"></li> <br/>";
}
}
$("#file8").html(name);
}
})
$.ajax({
url:"<{$app}>/Tracking/secondready",
type:"POST",
dataType:"json",
data:{
CAR:getCAR,
},
success:function(json){
if(json!=null){
$("#CAR").val(getCAR);
$("#Title").val(json[0]['Title']);
$("#Customer").val(json[0]['Customer']);
$("#Device").val(json[0]['Device']);
$("#EndCustomer").val(json[0]['EndCustomer']);
$("#ReceivedDate").val(json[0]['ReceivedDate']);
$("#Lot").val(json[0]['LotNo']);
$("#Package").val(json[0]['Package']);
$("#Plant").val(json[0]['Plant']);
$("#Serial").val(json[0]['SerialNo']);
$("#Failurerate").val(json[0]['FailureRate']);
$("#DateCode").val(json[0]['DateCode']);
$("#Department").val(json[0]['Department']);
$("#Area").val(json[0]['Area']);
$("#AffectedQty").val(json[0]['AffectedQty']);
$("#Samplereceivedate").val(json[0]['SampleReceiveDate']);
$("#FailureMode").val(json[0]['FailureMode']);
$("#threeDReportDate").val(json[0]['ReportDate3D']);
$("#eightDReportDate").val(json[0]['ReportDate8D']);
$("#threeDCycletime").val(json[0]['CycleTime3D']);
$("#eightDCycletime").val(json[0]['CycleTime8D']);
$("#threeDCloseDate").val(json[0]['CloseDate3D']);
$("#eightDCloseDate").val(json[0]['CloseDate8D']);
if(json[0]['Type']=="Complain"){
$("input:radio[value='Complain']").attr("checked",true);
}
if(json[0]['Type']=="Feeback"){
$("input:radio[value='Feeback']").attr("checked",true);
}
if(json[0]['Type']=="Internal"){
$("input:radio[value='Internal']").attr("checked",true);
}
if(json[0]['SampleRequired']=="Yes"){
$("input:radio[value='Yes']").attr("checked",true);
}
if(json[0]['SampleRequired']=="No"){
$("input:radio[value='No']").attr("checked",true);
}
if(json[0]['ProgramVerification']=="Valid"){
$("input:radio[value='Valid']").attr("checked",true);
}
if(json[0]['ProgramVerification']=="InValid"){
$("input:radio[value='InValid']").attr("checked",true);
}
if(json[0]['RootCause']=="Man"){
$("input:radio[value='Man']").attr("checked",true);
}
if(json[0]['RootCause']=="Machine"){
$("input:radio[value='Machine']").attr("checked",true);
}
if(json[0]['RootCause']=="Material"){
$("input:radio[value='Material']").attr("checked",true);
}
if(json[0]['RootCause']=="Method"){
$("input:radio[value='Method']").attr("checked",true);
}
// $(".textinput").attr("disabled",true);
//$("#CAR").attr("disabled",true);
//
}
}
})
}
})
//文件删除代码
function click1(obj){
var Id=obj.className;
$.ajax({
url:"<{$app}>/Tracking/files3d",
type:"POST",
data:{
files:$("#"+Id+"").val(),
filesId:Id,
CAR:$("#CAR").val(),
},
success:function(json){
var re=eval(json);
if(re==true){
$("#"+Id+"").parent().remove();
}
else if(re==false){
$("#msg38").html("你没有权限删除文件");
}
},
});
}
//文件下载查看代码
function click2(obj){
var Id=obj.className;
$.ajax({
url:"<{$app}>/Tracking/files8d",
type:"POST",
data:{
files:$("#"+Id+"").val(),
filesId:Id,
CAR:$("#CAR").val(),
},
success:function(json){
var re=eval(json);
window.open("http://localhost:8888/"+re);
},
});
}
$("#file8d").change(function(){
var filePath=$(this).val();
var arr=filePath.split('\\');
var fileName=arr[arr.length-1];
if(fileName!=""){
$("#add8").html(fileName);
}
else{
$("#add8").html("未选择文件");
return false
}
})
$("#file3d").change(function(){
var filePath=$(this).val();
var arr=filePath.split('\\');
var fileName=arr[arr.length-1];
if(fileName!=""){
$("#add3").html(fileName);
}
else{
$("#add3").html("未选择文件");
return false
}
})
$("#save").click(function(){
$("#msg").remove();
var CAR=$("#CAR").val(),
Problemverification=$("input:radio[name='Problemverification']:checked").val(),
Rootcause=$("input:radio[name='Rootcause']:checked").val(),
Samplereceivedate=$("#Samplereceivedate").val(),
Failuremode=$("#FailureMode").val(),
threeDReportDate=$("#threeDReportDate").val(),
threeDCloseDate=$("#threeDCloseDate").val(),
threeDCycletime=$("#threeDCycletime").val(),
eightDCycletime=$("#eightDCycletime").val(),
eightDCloseDate=$("#eightDCloseDate").val(),
Type=$("input:radio[name='CAR']:checked").val(),
eightDReportDate=$("#eightDReportDate").val(),
Title=$("#Title").val(),
Customer=$("#Customer").val(),
Device=$("#Device").val(),
EndCustomer=$("#EndCustomer").val(),
ReceivedDate=$("#ReceivedDate").val(),
Lot=$("#Lot").val(),
Package=$("#Package").val(),
Plant=$("#Plant").val(),
Serial=$("#Serial").val(),
Failurerate=$("#Failurerate").val(),
DateCode=$("#DateCode").val(),
Department=$("#Department").val(),
Area=$("#Area").val(),
AffectedQty=$("#AffectedQty").val(),
SampleRequired=$("input:radio[name='SampleRequired']:checked").val();
//
// if(Samplereceivedate==""){
// $('<div id="msg" />').html("Samplereceivedate不能为空!").appendTo('#divmsg');
// $("#Samplereceivedate").focus();
// return;
// }else if(Failuremode==""){
// $('<div id="msg" />').html("Failuremode不能为空!").appendTo('#divmsg');
// $("#Failuremode").focus();
// return;
// }else if(threeDReport==""){
// $('<div id="msg" />').html("threeDReport不能为空!").appendTo('#divmsg');
// $("#threeDReport").focus();
// return;
// }else if(threeDCloseDate==""){
// $('<div id="msg" />').html("threeDCloseDate不能为空!").appendTo('#divmsg');
// $("#threeDCloseDate").focus();
// return;
// }else if(threeDCycletime==""){
// $('<div id="msg" />').html("threeDCycletime不能为空!").appendTo('#divmsg');
// $("#threeDCycletime").focus();
// return;
// }else if(eightDCycletime==""){
// $('<div id="msg" />').html("eightDCycletime不能为空!").appendTo('#divmsg');
// $("#eightDCycletime").focus();
// return;
// }else if(eightDCloseDate==""){
// $('<div id="msg" />').html("eightDCloseDate不能为空!").appendTo('#divmsg');
// $("#eightDCloseDate").focus();
// return;
// }else if(eightDReport=="undefined"){
// $('<div id="msg" />').html("eightDReport不能为空!").appendTo('#divmsg');
// $("#eightDReport").focus();
// return;
// }else if(typeof Rootcause=="undefined"){
// $('<div id="msg" />').html("Rootcause不能为空!").appendTo('#divmsg');
// $("#Rootcause").focus();
// return;
// }else if(typeof eightDReport==""){
// $('<div id="msg" />').html("eightDReport不能为空!").appendTo('#divmsg');
// $("#eightDReport").focus();
// return;
// }
// else{
$.ajax({
url:"<{$app}>/Tracking/secondsave",
type:"POST",
data:{
CAR:CAR,
Type:Type,
Problemverification:Problemverification,
Rootcause:Rootcause,
Samplereceivedate:Samplereceivedate,
Failuremode:Failuremode,
threeDReportDate:threeDReportDate,
threeDCloseDate:threeDCloseDate,
threeDCycletime:threeDCycletime,
eightDCycletime:eightDCycletime,
eightDCloseDate:eightDCloseDate,
eightDReportDate:eightDReportDate,
Title:Title,
Customer:Customer,
Device:Device,
EndCustomer:EndCustomer,
ReceivedDate:ReceivedDate,
Lot:Lot,
Package:Package,
Plant:Plant,
Serial:Serial,
Failurerate:Failurerate,
DateCode:DateCode,
Department:Department,
Area:Area,
AffectedQty:AffectedQty,
SampleRequired:SampleRequired,
},
success:function(result){
if(result!=-1){
$('<div id="msg" />').html("Save成功!").appendTo('#divmsg');
$("input:text").val("");
$("input:radio").attr("checked",false);
}else {
$('<div id="msg" />').html("Save失败!").appendTo('#divmsg');
}
}
})
// }
})
</script>
</html>
php后台代码:
<?php
header("content-type:text/html;charset=utf-8");
class Tracking
{
function index(){
$this->display();
}
function second(){
$this->display();
}
/* 文件显示后台代码 */
function files3(){
header("content-type:text/html;charset=utf-8");
$dir=$_SERVER['DOCUMENT_ROOT'];
$car=$_POST['CAR'];
$dir="$dir/public/eightd/$car/3d/";
$file=scandir($dir);
//$files=iconv( "gbk","UTF-8",$dir);
//$file=iconv("UTF-8", "gbk",scandir($dir));
for($i=0;$i<(sizeof($file));$i++) {
$arr[$i]=iconv('gbk' , 'utf-8' , $file[$i] );
}
echo json_encode($arr);
}
/* 文件显示后台代码 */
function files8(){
header("content-type:text/html;charset=utf-8");
$dir=$_SERVER['DOCUMENT_ROOT'];
$car=$_POST['CAR'];
$dir="$dir/public/eightd/$car/8d/";
$file=scandir($dir);
for($i=0;$i<(sizeof($file));$i++) {
$arr[$i]=iconv('gbk' , 'utf-8' , $file[$i] );
}
echo json_encode($arr);
}
/* 文件删除代码 */
function files3d(){
$dir=$_SERVER['DOCUMENT_ROOT'];
$file=iconv('UTF-8','gbk',$_POST['files']);
$Id=$_POST['filesId'];
$car=$_POST['CAR'];
$result3=file_exists("$dir/public/eightd/$car/3d/$file");
$result8=file_exists("$dir/public/eightd/$car/8d/$file");
$result=(($result3&&$_SESSION['Post']=='SUP')||($result8&&$_SESSION['Post']=='SUP'));
if($_SESSION['Post']=='SUP'){
if($result3==true&&strpos($Id,'3')){
unlink("$dir/public/eightd/$car/3d/$file");
}
else if($result8==true&&strpos($Id,'8')){
unlink("$dir/public/eightd/$car/8d/"."$file");
}
echo json_encode($result);
}else{
echo json_encode($result);
}
}
/* 文件下载和查看代码 */
function files8d(){
$dir=$_SERVER['DOCUMENT_ROOT'];
$car=$_POST['CAR'];
$file=iconv('UTF-8','gbk',$_POST['files']);
$Id=$_POST['filesId'];
$result3=file_exists("$dir/public/eightd/$car/3d/$file");
$result8=file_exists("$dir/public/eightd/$car/8d/$file");
if($result3==true&&strpos($Id,'3')){
$result="/public/eightd/$car/3d/$file";
echo json_encode($result);
}
else if($result8==true&&strpos($Id,'8')){
$result="/public/eightd/$car/8d/$file";
echo json_encode($result);
}
}
/* 文件上传代码 */
function secondfile(){
header("content-type:text/html;charset=utf-8");
$car=$_POST["CAR1"];
header("Location: http://localhost:8888/eightd.php/Tracking/second?flag=true&A=$car");
$dir=$_SERVER['DOCUMENT_ROOT'];
//$name3d=$_FILES["file3d"]["name"];
$name3d=iconv("UTF-8", "gbk",$_FILES["file3d"]["name"]);
if ($_FILES["file3d"]["error"] > 0)
{
echo "错误:" . $_FILES["file3d"]["error"] . "<br>";
}
else
{
$car=$_POST['CAR1'];
if(file_exists("$dir/public/eightd/$car/3d")){
move_uploaded_file($_FILES["file3d"]["tmp_name"],"$dir/public/eightd/$car/3d/$name3d");
}
else{
mkdir("$dir/public/eightd/$car/3d",0777,true);
move_uploaded_file($_FILES["file3d"]["tmp_name"],"$dir/public/eightd/$car/3d/$name3d");
}
// echo $dir."<br>";
// echo "上传文件名: " . $_FILES["file3d"]["name"] . "<br>";
// echo "文件类型: " . $_FILES["file3d"]["type"] . "<br>";
// echo "文件大小: " . ($_FILES["file3d"]["size"] / 1024) . " kB<br>";
// echo "文件临时存储的位置: " . $_FILES["file3d"]["tmp_name"];
// echo "chenggon";
}
//$name8d=$_FILES["file8d"]["name"];
$name8d=iconv("UTF-8", "gbk",$_FILES["file8d"]["name"]);
if ($_FILES["file8d"]["error"] > 0)
{
echo "错误:" . $_FILES["file8d"]["error"] . "<br>";
}
else
{
$car=$_POST['CAR1'];
echo $car;
if(file_exists("$dir/public/eightd/$car/8d")){
move_uploaded_file($_FILES["file8d"]["tmp_name"],"$dir/public/eightd/$car/8d/$name8d");
}
else{
mkdir("$dir/public/eightd/$car/8d",0777,true);
move_uploaded_file($_FILES["file8d"]["tmp_name"],"$dir/public/eightd/$car/8d/$name8d");
}
print_r ($_FILES);
// echo "上传文件名: " . $_FILES["file8d"]["name"] . "<br>";
// echo "文件类型: " . $_FILES["file8d"]["type"] . "<br>";
// echo "文件大小: " . ($_FILES["file8d"]["size"] / 1024) . " kB<br>";
// echo "文件临时存储的位置: " . $_FILES["file8d"]["tmp_name"];
// echo "chenggon";
}
}
function history(){
$this->display();
}
function trackinghistory(){
$this->display();
}
function action(){
$this->display();
}
function firstsave(){
$sqlpdo=new SqlHelper();
$CAR=$_POST[CAR];
$Title=$_POST[Title];
$Customer=$_POST[Customer];
$Device=$_POST[Device];
$Type=$_POST[Type];
$EndCustomer=$_POST[EndCustomer];
$ReceivedDate=$_POST[ReceivedDate];
$Lot=$_POST[Lot];
$Package=$_POST[Package];
$Plant=$_POST[Plant];
$Serial=$_POST[Serial];
$Failurerate=$_POST[Failurerate];
$DateCode=$_POST[DateCode];
$Department=$_POST[Department];
$Area=$_POST[Area];
$AffectedQty=$_POST[AffectedQty];
$SampleRequired=$_POST[SampleRequired];
$date=date("Y-m-d H:i:s");
$sql="insert into eightd.trackinginfo(CARNo,Type,Title,Customer,EndCustomer,ReceivedDate,Device,LotNo,Package,Plant,SerialNo,Area,Department,FailureRate,DateCode,AffectedQty,SampleRequired,FirstDateTime) values('$CAR','$Type','$Title','$Customer','$EndCustomer','$ReceivedDate','$Device','$Lot','$Package','$Plant','$Serial','$Area','$Department','$Failurerate','$DateCode','$AffectedQty','$SampleRequired','$date')";
$result=$sqlpdo->UpDateMySqlInfo($sql);
echo $result;
}
function secondready(){
$sqlpdo=new SqlHelper();
$sql="select * from eightd.trackinginfo where CARNo='$_POST[CAR]'";
$result=$sqlpdo->GetMySqlDataTable($sql);
echo json_encode($result);
}
function secondsave(){
$sqlpdo=new SqlHelper();
$CAR=$_POST[CAR];
$Type=$_POST[Type];
$Problemverification=$_POST[Problemverification];
$Rootcause=$_POST[Rootcause];
$Samplereceivedate=$_POST[Samplereceivedate];
$Failuremode=$_POST[Failuremode];
$threeDReportDate=$_POST[threeDReportDate];
$threeDCloseDate=$_POST[threeDCloseDate];
$threeDCycletime=$_POST[threeDCycletime];
$eightDCycletime=$_POST[eightDCycletime];
$eightDCloseDate=$_POST[eightDCloseDate];
$eightDReportDate=$_POST[eightDReportDate];
$Title=$_POST[Title];
$Customer=$_POST[Customer];
$Device=$_POST[Device];
$EndCustomer=$_POST[EndCustomer];
$ReceivedDate=$_POST[ReceivedDate];
$Lot=$_POST[Lot];
$Package=$_POST[Package];
$Plant=$_POST[Plant];
$Serial=$_POST[Serial];
$Failurerate=$_POST[Failurerate];
$DateCode=$_POST[DateCode];
$Department=$_POST[Department];
$Area=$_POST[Area];
$AffectedQty=$_POST[AffectedQty];
$SampleRequired=$_POST[SampleRequired];
$date=date("Y-m-d H:i:s");
$sql="update eightd.trackinginfo set Title='$Title',Customer='$Customer',EndCustomer='$EndCustomer',ReceivedDate='$ReceivedDate',Device='$Device',LotNo='$Lot',Package='$Package',Plant='$Plant',SerialNo='$Serial',Area='$Area',Department='$Department',FailureRate='$Failurerate',DateCode='$DateCode',AffectedQty='$AffectedQty',SampleRequired='$SampleRequired',Type='$Type',SampleReceiveDate='$Samplereceivedate',FailureMode='$Failuremode',ProgramVerification='$Problemverification',RootCause='$Rootcause',ReportDate3D='$threeDReportDate',CloseDate3D='$threeDCloseDate',CycleTime3D='$threeDCycletime',ReportDate8D='$eightDReportDate',CloseDate8D='$eightDCloseDate',CycleTime8D='$eightDCycletime',SecondDateTime='$date' where CARNo='$CAR'";
$result=$sqlpdo->UpDateMySqlInfo($sql);
echo $result;
}
function historyready(){
$sqlpdo=new SqlHelper();
$sql="select * from trackinginfo order by ReceivedDate";
$result=$sqlpdo->GetMySqlDataTable($sql);
$j=0;
for($i=0;$result[$i];$i++){
// if($result[$i][ReportDate8D]==""){
$arr[$j][CAR]=$result[$i][CARNo];
$arr[$j][ReceivedDate]=$result[$i][ReceivedDate];
$arr[$j][Area]=$result[$i][Area];
$arr[$j][ProblemVerification]=$result[$i][ProgramVerification];
$arr[$j][RootCause]=$result[$i][RootCause];
$arr[$j][CloseDate8D]=$result[$i][CloseDate8D];
$arr[$j][Type]=$result[$i][Type];
$arr[$j][CycleTime8D]=$result[$i][CycleTime8D];
$arr[$j]['FirstDateTime'] = $result[$i]['FirstDateTime'];
$j++;
// }
}
echo json_encode($arr);
}
function actionready(){
$sqlpdo = new SqlHelper();
$sql="select * from eightd.action where CARNo='$_POST[CARNo]' order by id DESC";
$result=$sqlpdo->GetMySqlDataTable($sql);
echo json_encode($result);
}
function actionsave(){
$sqlpdo = new SqlHelper();
$CAR=$_POST[CAR];
$No=explode('|',$_POST[No]);
$Action=explode('|',$_POST[Action]);
$Resp=explode('|',$_POST[Resp]);
$DueDate=explode('|',$_POST[DueDate]);
$CloseDate=explode('|',$_POST[CloseDate]);
$sql = "select * from eightd.action where CARNo='$CAR'";
$result=$sqlpdo->GetMySqlDataTable($sql);
if(count($result)>0){
$sql = "delete from eightd.action where CARNo='$CAR'";
$result=$sqlpdo->UpDateMySqlInfo($sql);
for($i=0;$No[$i];$i++){
$Action[$i]=addslashes($Action[$i]);
$sql = "insert into eightd.action(CARNo,No,Action,Resp,DueDate,CloseDate) value('$CAR','$No[$i]','$Action[$i]','$Resp[$i]','$DueDate[$i]','$CloseDate[$i]')";
$arr[]=$sqlpdo->GetMySqlDataTable($sql);
}
}else{
for($i=0;$No[$i];$i++){
$sql = "insert into eightd.action(CARNo,No,Action,Resp,DueDate,CloseDate) value('$CAR','$No[$i]','$Action[$i]','$Resp[$i]','$DueDate[$i]','$CloseDate[$i]')";
$arr[]=$sqlpdo->GetMySqlDataTable($sql);
}
echo json_encode($arr);
}
}
}