123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- function getXmlHttpObject() {
- var a = null;
- try {
- a = new XMLHttpRequest()
- } catch (e) {
- try {
- a = new ActiveXObject("Msxml2.XMLHTTP")
- } catch (e) {
- a = new ActiveXObject("Microsoft.XMLHTTP")
- }
- }
- return a
- }
- function createUrl(a, b) {
- var c = 'application/main.php?';
- var d = a.split('_');
- c += 'c=' + d[0] + '&m=' + d[1];
- if (b.length > 0 || b > 0) {
- if (d[0] == 'barcode' && d[1] == 'showProduct') {
- var p = b.split('_');
- c += '&now=' + p[0] + '&type=' + p[1]
- } else if (d[0] == 'barcode' && d[1] == 'pagination') {
- var p = b.split('_');
- c += '&type=' + p[0] + '&wh=' + p[1]
- } else if (d[0] == 'barcode' && d[1] == 'updatePrintStatus') {
- var p = b.split('_');
- c += '&bid=' + p[0] + '&type=' + p[1]
- } else if (d[0] == 'ocr' && d[1] == 'getWaybill') {
- var p = b.split('_');
- c += '&now=' + p[0] + '&shop=' + p[1] + '&startDate=' + p[2] + '&endDate=' + p[3]
- } else if (d[0] == 'ocr' && d[1] == 'pagination') {
- var p = b.split('_');
- c += '&shop=' + p[0] + '&startDate=' + p[1] + '&endDate=' + p[2] + '&wh=' + p[3]
- } else if (d[0] == 'scanner' && d[1] == 'getOrders') {
- var p = b.split('_');
- c += '&now=' + p[0] + '&shop=' + p[1] + '&status=' + p[2] + '&startDate=' + p[3] + '&endDate=' + p[4] + '&key=' + p[5] + '&pnsn=' + p[6]
- } else if (d[0] == 'scanner' && d[1] == 'pagination') {
- var p = b.split('_');
- c += '&shop=' + p[0] + '&status=' + p[1] + '&startDate=' + p[2] + '&endDate=' + p[3] + '&wh=' + p[4] + '&pnsn=' + p[5]
- } else if (d[0] == 'scanner' && d[1] == 'updateOrder') {
- var p = b.split('_');
- c += '&order_sn=' + p[0] + '&status=' + p[1]
- } else if (d[0] == 'scanner' && d[1] == 'getStatistics') {
- var p = b.split('_');
- c += '&startDate=' + p[0] + '&endDate=' + p[1]
- } else if (d[0] == 'wigsOut' && d[1] == 'getOrders') {
- var p = b.split('_');
- c += '&now=' + p[0] + '&shop=' + p[1] + '&status=' + p[2] + '&startDate=' + p[3] + '&endDate=' + p[4] + '&key=' + p[5] + '&pnsn=' + p[6];
- c += '&type=' + p[7];
- c += '&time_type='+p[8]
- } else if (d[0] == 'wigsOut' && d[1] == 'pagination') {
- var p = b.split('_');
- c += '&shop=' + p[0] + '&status=' + p[1] + '&startDate=' + p[2] + '&endDate=' + p[3] + '&wh=' + p[4] + '&pnsn=' + p[5];
- c += '&type=' + p[6];
- c += '&time_type='+p[7]
- } else if (d[0] == 'wigsOut' && d[1] == 'updateOrder') {
- var p = b.split('_');
- c += '&code=' + p[0] + '&status=' + p[1]
- } else if (d[0] == 'wigsOut' && d[1] == 'getStatistics') {
- var p = b.split('_');
- c += '&startDate=' + p[0] + '&endDate=' + p[1];
- c += '&time_type='+p[2]
- }
- }
- c = encodeURI(c + '&mr=' + Math.random());
- return c
- }
- function stateChanged(a, b, c) {
- var d = b.split('_');
- if (a.readyState == 4 && a.status == 200) {
- if (d[0] == 'barcode' && d[1] == 'showProduct') {
- $("#list").html(a.responseText);
- $("#pagination").data("now", c)
- } else if (d[0] == 'barcode' && d[1] == 'pagination') {
- $("#pagination").html(a.responseText)
- } else if (d[0] == 'barcode' && d[1] == 'uploadExcel') {
- $(".btn").attr("disabled", false);
- $(".upload_icon").hide();
- if (a.response !== '1') {
- alert("导入失败")
- } else {
- alert("导入成功");
- window.location.reload()
- }
- } else if (d[0] == 'ocr' && d[1] == 'uploadImage') {
- $(".btn").attr("disabled", false);
- $(".upload_icon").hide();
- if (a.response != '1') {
- var e = a.response;
- switch (e) {
- case '-6':
- alert("请勿重复上传");
- break;
- default:
- alert("上传失败")
- }
- } else {
- alert("上传成功");
- window.location.reload()
- }
- } else if (d[0] == 'ocr' && d[1] == 'getWaybill') {
- $("#list").html(a.responseText);
- $("#pagination").data("now", c)
- } else if (d[0] == 'ocr' && d[1] == 'pagination') {
- $("#pagination").html(a.responseText)
- } else if (d[0] == 'scanner' && d[1] == 'getOrders') {
- $("#list").html(a.responseText);
- $("#pagination").data("now", c)
- } else if (d[0] == 'scanner' && d[1] == 'pagination') {
- $("#pagination").html(a.responseText)
- } else if (d[0] == 'scanner' && d[1] == 'uploadExcel') {
- $(".btn").attr("disabled", false);
- $(".upload_icon").hide();
- if (a.response !== '1') {
- alert("导入失败,数据格式错误或内容重复!")
- } else {
- alert("导入成功");
- window.location.reload()
- }
- } else if (d[0] == 'scanner' && d[1] == 'updateOrder') {
- var f = document.getElementById('success_tip');
- var g = document.getElementById('warning_tip');
- var h = JSON.parse(a.response);
- switch (h.no) {
- case '1':
- f.play();
- alert("出库成功");
- break;
- case '2':
- f.play();
- alert("取消成功");
- window.location.reload();
- break;
- case '-1':
- g.play();
- alert("出库失败,请联系开发人员!");
- break;
- case '-2':
- g.play();
- alert("取消失败,请联系开发人员!");
- break;
- case '-3':
- g.play();
- alert("出库失败,此运单已出库!\n出库时间:" + h.out_time);
- break;
- case '-4':
- g.play();
- alert("取消失败,此运单已出库!\n出库时间:" + h.out_time);
- break;
- case '-5':
- g.play();
- alert("出库失败,此运单已取消!\n取消时间:" + h.out_time);
- break;
- case '-6':
- g.play();
- alert("取消失败,此运单已取消!\n取消时间:" + h.out_time);
- break;
- case '-10':
- g.play();
- alert("操作失败,查无此运单号!");
- break;
- default:
- g.play();
- alert("操作失败,请联系开发人员!")
- }
- $(".barcode_input").val('');
- $(".barcode_input").focus()
- } else if (d[0] == 'scanner' && d[1] == 'getStatistics') {
- var h = JSON.parse(a.responseText);
- $(".top_yesterday").html(h.yesterday);
- $(".top_total").html(h.total);
- $(".top_in").html(h. in );
- $(".top_out").html(h.out);
- $(".top_cancel").html(h.cancel)
- } else if (d[0] == 'wigsOut' && d[1] == 'getOrders') {
- $("#list").html(a.responseText);
- $("#pagination").data("now", c)
- } else if (d[0] == 'wigsOut' && d[1] == 'pagination') {
- $("#pagination").html(a.responseText)
- } else if (d[0] == 'wigsOut' && d[1] == 'uploadExcel') {
- $(".btn").attr("disabled", false);
- $(".upload_icon").hide();
- if (a.response !== '1') {
- alert("导入失败,数据格式错误或内容重复!")
- } else {
- alert("导入成功");
- window.location.reload()
- }
- } else if (d[0] == 'wigsOut' && d[1] == 'updateOrder') {
- var f = document.getElementById('success_tip');
- var g = document.getElementById('warning_tip');
- var h = JSON.parse(a.response);
- switch (h.no) {
- case '1':
- f.play();
- alert("入库成功");
- window.location.reload();
- break;
- case '2':
- f.play();
- alert("出库成功");
- window.location.reload();
- break;
- case '3':
- f.play();
- alert("取消成功");
- window.location.reload();
- break;
- case '4':
- f.play();
- alert("待分配执行成功");
- window.location.reload();
- break;
- case '-1':
- g.play();
- alert("入库失败,请联系开发人员!");
- break;
- case '-2':
- g.play();
- alert("出库失败,请联系开发人员!");
- break;
- case '-3':
- g.play();
- alert("取消失败,请联系开发人员!");
- break;
- case '-4':
- g.play();
- alert("出库失败,此订单未入库!");
- break;
- case '-5':
- g.play();
- alert("入库失败,此运单已入库!\n入库时间:" + h.time);
- break;
- case '-6':
- g.play();
- alert("入库失败,此运单已出库!\n出库时间:" + h.time);
- break;
- case '-7':
- g.play();
- alert("出库失败,此运单已出库!\n出库时间:" + h.time);
- break;
- case '-8':
- g.play();
- alert("入库失败,此运单已取消!\n取消时间:" + h.time);
- break;
- case '-9':
- g.play();
- alert("出库失败,此运单已取消!\n取消时间:" + h.time);
- break;
- case '-10':
- g.play();
- alert("操作失败,查无此单号!");
- break;
- case '-12':
- g.play();
- alert("未分配失败,请联系开发人员!");
- break;
- default:
- g.play();
- alert("操作失败,请联系开发人员!")
- }
- $(".code_input_in").val('');
- $(".code_input_out").val('');
- $(".code_input_in").focus()
- } else if (d[0] == 'wigsOut' && d[1] == 'getStatistics') {
- var h = JSON.parse(a.responseText);
- $(".top_yesterday").html(h.yesterday);
- $(".top_total").html(h.total);
- $(".top_in").html(h. in );
- $(".top_out").html(h.out);
- $(".top_cancel").html(h.cancel);
- $(".top_not_in").html(h.not_in)
- }
- } else if (a.readyState == 4 && a.status == 404) {
- alert("系统错误,请联系开发人员!")
- }
- }
- function myAjax(a, b) {
- var c = getXmlHttpObject();
- if (c == null) {
- alert("Please update your browser!");
- return false
- }
- var d = createUrl(a, b);
- c.onreadystatechange = function() {
- stateChanged(c, a, b)
- };
- c.open("GET", d, true);
- c.send(null)
- }
|