$(function(){
|
//支持的文件类型正则表达式
|
var fileType = /\.(opt|OPT)$/;
|
var result = $("#result").attr("resultid");
|
if(result == "alsohave"){
|
alert("任务库已含有当前导入订单,请重新换批次");
|
window.location.href=contextPath + "/shelfmanager/taskimport";
|
}else if(result == "failue"){
|
alert("opt文件存在问题,请仔细查阅!");
|
window.location.href=contextPath + "/shelfmanager/taskimport";
|
}else if(result == "success"){
|
alert("当前任务导入成功");
|
window.location.href=contextPath + "/shelfmanager/taskimport";
|
}
|
$("#fileupload").fileupload({
|
url: contextPath + '/upload/optpattern',
|
dataType: 'json',
|
multipart: true,
|
add: function(e, data) { //校验文件格式
|
var goUpload = true;
|
var uploadFile = data.files;
|
for(var i=0;i<uploadFile.length; i++){
|
if (!fileType.test(uploadFile[i].name)) {
|
goUpload = false;
|
break ;
|
}
|
}
|
|
if (goUpload == true) {
|
data.submit();
|
}
|
},
|
done: function(e, data) {
|
$("#upload").hide();
|
$("#ctrl").hide();
|
$("#delSubmit").show();
|
$('#uploadError').html('');
|
//上传成功
|
$('#fileName').val(data.result.fileName);
|
$("#upload").before("<span style='position:relative;width: 140px; height: 122px;'>"
|
+"<img src='/gmms2/static/images/f5.png'>"
|
+"<span style='line-height:12px; position:absolute; top:50%; left:50%; margin-left:-24px; margin-top:-6px;font-weight: bolder;'>"
|
+data.result.fileName.substring(0,data.result.fileName.lastIndexOf("."))
|
+"</span></span>");
|
},
|
progressall: function(e, data) {
|
}
|
});
|
|
$("#delSubmit").click(function(){
|
$("#delSubmit").attr("disabled", true);
|
var send=true;
|
if(send){
|
send=false;
|
$("#uploadForm").submit();
|
}
|
});
|
|
$('#deleteOneModal').on('hide.bs.modal', function () {
|
window.location.href=contextPath + "/upload/cancelUpload";
|
});
|
|
|
});
|
|
function upload(){
|
$("#deleteOneModal").modal('show');
|
$("#delSubmit").hide();
|
}
|
|
|
function moshi(){
|
$("#moshi").modal('show');
|
$("#delSubmit").hide();
|
}
|
|
|
function push(){
|
var checkBoxes=$(":checkbox");
|
var rawpackagetxtIds="";
|
|
for(var i=0; i<checkBoxes.length; i++){
|
if(checkBoxes[i].name=='push'&&checkBoxes[i].checked){
|
rawpackagetxtIds+=(checkBoxes[i].id+";");
|
}
|
}
|
|
rawpackagetxtIds=rawpackagetxtIds.substring(0, rawpackagetxtIds.length-1);
|
|
if (rawpackagetxtIds == '') {
|
$.MsgBox.Alert("警告", "请至少选中左边的一个文件");
|
return;
|
}
|
//发送ajax请求
|
$.ajax({
|
url:contextPath + "/shelfmanager/batchDeleteRawpackagetxts?ajax=true&rawpackagetxtIds="+rawpackagetxtIds,
|
success: function(data){
|
if(data.trim()=="success"){
|
window.location.href=contextPath + "/shelfmanager/taskimport";
|
}
|
else{
|
$.MsgBox.Alert("警告", data.substring(4, data.length)+"文件开始不能Push,料架不够此文件吊装");
|
}
|
}
|
})
|
}
|
|
function reserse(){
|
var checkBoxe=$(":checkbox");
|
var rawpackagetxtId="";
|
for(var i=0; i<checkBoxe.length; i++){
|
if(checkBoxe[i].name=='reverse'&&checkBoxe[i].checked){
|
rawpackagetxtId+=(checkBoxe[i].id+";");
|
}
|
}
|
|
rawpackagetxtId=rawpackagetxtId.substring(0, rawpackagetxtId.length-1);
|
|
if (rawpackagetxtId == '') {
|
$.MsgBox.Alert("警告", "请至少选中右边的一个文件");
|
return;
|
}
|
|
//发送ajax请求
|
$.ajax({
|
url:contextPath + "/shelfmanager/batchDeleteRawpackagetxt?ajax=true&rawpackagetxtId="+rawpackagetxtId,
|
success: function(data){
|
if(data.trim()=="success"){
|
window.location.href=contextPath + "/shelfmanager/taskimport";
|
}else{
|
$.MsgBox.Alert("警告", data.substring(4, data.length)+"文件需要的原片已经在吊装,不能Reverse");
|
}
|
}
|
})
|
}
|
|
function cancel(){
|
var checkBoxe=$(":checkbox");
|
var rawpackagetxtId="";
|
for(var i=0; i<checkBoxe.length; i++){
|
if(checkBoxe[i].name=='reverse'&&checkBoxe[i].checked){
|
rawpackagetxtId+=(checkBoxe[i].id+";");
|
}
|
}
|
|
rawpackagetxtId=rawpackagetxtId.substring(0, rawpackagetxtId.length-1);
|
|
if (rawpackagetxtId != '') {
|
$.MsgBox.Alert("警告", "只能选中左边的文件");
|
return;
|
}
|
|
var checkBoxes=$(":checkbox");
|
var rawpackagetxtIds="";
|
|
for(var i=0; i<checkBoxes.length; i++){
|
if(checkBoxes[i].name=='push'&&checkBoxes[i].checked){
|
rawpackagetxtIds+=(checkBoxes[i].id+";");
|
}
|
}
|
|
rawpackagetxtIds=rawpackagetxtIds.substring(0, rawpackagetxtIds.length-1);
|
|
if (rawpackagetxtIds == '') {
|
$.MsgBox.Alert("警告", "请至少选中左边的一个文件");
|
return;
|
}
|
|
//发送ajax请求
|
$.ajax({
|
url:contextPath + "/shelfmanager/batchCancelRawpackagetxts?ajax=true&rawpackagetxtIds="+rawpackagetxtIds,
|
success: function(data){
|
if(data.trim()=="success"){
|
window.location.href=contextPath + "/shelfmanager/taskimport";
|
}
|
}
|
})
|
}
|