代码拉取完成,页面将自动刷新
window.onload=initPage;
function initPage(){
ahrefs=document.getElementById("alldata").getElementsByTagName("a");
console.log(ahrefs.length);
for(var i=0;i<ahrefs.length;i++){
aaa = ahrefs[i];
aaa.onclick = function()
{
var id1 = this.id;
console.log(id1);
var strop =this.innerHTML;
if(strop=="OK"){
var tmp1=$("td#"+id1).text();
//console.log(tmp1);
//$("td#"+id1).text("abc");
if(tmp1==""){
alert("开始生成SO ID");
createSO(id1);
}else{
alert("已生成SO ID,不可再生成");
}
}else{
console.log("show");
showOrder(id1);
}
}
}
}
function showOrder(id1){
createshowOrder=createRequest();
if(createshowOrder==null){
alert("Unable to create request");
}else{
var url="orderf.php?idsh="+id1+"&show=true";
createshowOrder.onreadystatechange=showOrder1;
createshowOrder.open('GET',url,true);
createshowOrder.send(null);
}
}
function showOrder1(){
if(createshowOrder.readyState==4){
if(createshowOrder.status==200){
console.log("responseText->"+createshowOrder.responseText);
var respText=eval("("+ createshowOrder.responseText +")");
if(respText.result==0){
alert("网络连接错误");
}else if(respText.result==1){
var table1 = respText.table;
$("#showDetail").html(table1);
$(function() {
$( "#showDetail" ).dialog({
width: 530,
modal: true
});
});
}
}
}
}
function createSO(id1){
console.log("id1->"+id1);
createSORequest=createRequest();
if(createSORequest==null){
alert("Unable to create request");
}else{
var url="orderf.php?id="+id1;
createSORequest.onreadystatechange=showcreateSO;
createSORequest.open('GET',url,true);
createSORequest.send(null);
}
}
function showcreateSO(){
if(createSORequest.readyState==4){
if(createSORequest.status==200){
console.log("responseText->"+createSORequest.responseText);
var respText=eval("("+ createSORequest.responseText +")");
if(respText.result==0){
alert("错误,原因为:"+respText.respText);
}else if(respText.result==1){
console.log("respText.status->"+respText.status1);
alert("获取SO ID 成功:"+respText.respText);
var id1 = respText.id1;
var soid = respText.SOID;
$("td#"+id1).text(soid);
if(respText.status1==2){
//alert("货物库存不足,商品编码为:"+respText.invErrInfo);
$(function(){
$("#showDetail").html("货物库存不足,商品编码为:"+respText.invErrInfo+",<br>是否要生成ASN?");
$("#showDetail").dialog({
resizable: false,
width: 420,
modal: true,
buttons: {
Ok: function(){
sendCreateASN();
$(this).dialog("close");
},
Cancel: function(){
$(this).dialog("close");
}
}
});
});
}
}
console.log("showcreateSO");
}
}
}
function sendCreateASN(){
console.log("sendCreateASN");
$(function(){
$.get("orderf.php?CreateASN=true",function(data,status){
//alert("Data: " + data + "\nStatus: " + status);
var respTxt=jQuery.parseJSON(data);
if(respTxt.result==1){
alert("return msg is:"+respTxt.reasons);
}
});
});
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。