1 Star 1 Fork 1

gujiejing / WEBWMS

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
order.js 3.25 KB
一键复制 编辑 原始数据 按行查看 历史
wisdom 提交于 2017-11-03 23:31 . upupup new alll
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);
}
});
});
}
PHP
1
https://gitee.com/laotou99_admin/WEBWMS.git
git@gitee.com:laotou99_admin/WEBWMS.git
laotou99_admin
WEBWMS
WEBWMS
master

搜索帮助