|
|
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HW_SKUImport3.aspx.cs" Inherits="TradeManage.HuoWu.HW_SKUImport3" %>
|
|
|
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
<head id="Head1">
|
|
|
<title>sku导入</title>
|
|
|
<link rel="stylesheet" type="text/css" href="../css2/icon.css">
|
|
|
<link rel="stylesheet" type="text/css" href="../css2/DataGrid.css" />
|
|
|
<link href="../css2/gray/easyui.css" rel="stylesheet" type="text/css" />
|
|
|
<link rel="stylesheet" href="../font-awesome/css/font-awesome.min.css" />
|
|
|
<link href="../css2/New.css?a=1" rel="stylesheet" type="text/css" />
|
|
|
<link rel="stylesheet" type="text/css" href="../themes/uploadify.css" />
|
|
|
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/Global.js" type="text/javascript"></script>
|
|
|
<script type="text/javascript" src="../Scripts/uploadify/jquery.uploadify.js"></script>
|
|
|
<script src="../Scripts/ajaxfileupload.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/jquery.url.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="../Scripts/Global.js" type="text/javascript"></script>
|
|
|
<script type="text/javascript">
|
|
|
var WindowLoadModel = new WindowLoad();
|
|
|
$(document).ready(function () {
|
|
|
WindowLoadModel.ApplicationPath = "../";
|
|
|
WindowLoadModel.ControlID = "WindowLoad";
|
|
|
WindowLoadModel.Isbgiframe = true;
|
|
|
WindowLoadModel.Load();
|
|
|
ajaxInit(WindowLoadModel);
|
|
|
GetCompanyList();
|
|
|
//导入
|
|
|
$("#cmdReport").click(function () {
|
|
|
ajaxFileUpload();
|
|
|
});
|
|
|
|
|
|
$("#cmdReport2").click(function () {
|
|
|
ajaxFileUpload2();
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
function GetCompanyList() {
|
|
|
|
|
|
// $("#select_company").append("<option value='0'>选择</option>")
|
|
|
|
|
|
$.ajax({
|
|
|
url: "../SysManageServiceNew.asmx/GetListCompany3",
|
|
|
// data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
dataType: "json",
|
|
|
async: false,
|
|
|
success: function (data) {
|
|
|
if (data.d != null) {
|
|
|
$(data.d).each(function () {
|
|
|
$("#select_company").append("<option value='" + this.ID + "'>" + this.Name + "</option>")
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//#region 上传
|
|
|
function ajaxFileUpload(a) {
|
|
|
|
|
|
var filename = $("#fileToUpload").val();
|
|
|
if (IsExcel(filename) == false) { alert("请选择Excel文件"); return; }
|
|
|
$.ajaxFileUpload({
|
|
|
url: '../GlobalAshx/AjaxFileUpdate.ashx?DirectoryName=ServerCookies',
|
|
|
secureuri: false,
|
|
|
fileElementId: 'fileToUpload',
|
|
|
dataType: 'json',
|
|
|
success: function (data, status) {
|
|
|
ImportGoods("ServerCookies/" + data.FileName);
|
|
|
},
|
|
|
error: function (data, status, e) {
|
|
|
alert(e);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
//#region
|
|
|
function ImportGoods(FileName) {
|
|
|
|
|
|
|
|
|
var param = new Object();
|
|
|
param.CompanyId = $("#select_company").val();
|
|
|
param.FileName = FileName;
|
|
|
param.SortName = "其他";
|
|
|
// param.SortId = 679;
|
|
|
// param.GoodsEg = "KZQ";
|
|
|
WindowLoadModel.Show();
|
|
|
$.ajax({
|
|
|
url: "../HuoWuServiceNew.asmx/ExcelSaveGoodsHWC",
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
success: function (data) {
|
|
|
WindowLoadModel.Hide();
|
|
|
if (data.d != "") { $("#div1").html(data.d); return; }
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
error: function (xhr, status) {
|
|
|
if (status != "success") alert(xhr.responseText);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
//#endregion
|
|
|
//#region 检测文件是否是图片类型
|
|
|
function IsRAR(filename) {
|
|
|
var extStart = filename.lastIndexOf(".");
|
|
|
var ext = filename.substring(extStart, filename.length).toUpperCase();
|
|
|
if (ext != ".RAR") {
|
|
|
return false;
|
|
|
} else {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
//#region 上传
|
|
|
function ajaxFileUpload2(a) {
|
|
|
|
|
|
if ($("#fileToUpload2").val() == "") { alert("请选择要导入的文件"); return; }
|
|
|
var filename = $("#fileToUpload2").val();
|
|
|
if (IsRAR(filename) == false) { alert("上传文件格式要压缩成RAR格式"); return; }
|
|
|
|
|
|
fileToUploadid = 'fileToUpload2';
|
|
|
WindowLoadModel.Show();
|
|
|
$.ajaxFileUpload({
|
|
|
url: '../GlobalAshx/AjaxFileUpdate.ashx',
|
|
|
secureuri: false,
|
|
|
fileElementId: fileToUploadid,
|
|
|
dataType: 'json',
|
|
|
success: function (data, status) {
|
|
|
// alert('文件路径:' + data.FileName + '长度:' + data.FileSize);
|
|
|
|
|
|
ExcelPhoto(data.FileName);
|
|
|
|
|
|
},
|
|
|
error: function (data, status, e) {
|
|
|
alert(e);
|
|
|
}
|
|
|
})
|
|
|
return false;
|
|
|
}
|
|
|
//#region 导入
|
|
|
function ExcelPhoto(FileName) {
|
|
|
|
|
|
var param = new Object();
|
|
|
param.FileName = FileName;
|
|
|
|
|
|
param.CompanyId = $("#select_company").val();
|
|
|
$.ajax({
|
|
|
url: "../HuoWuServiceNew.asmx/ExcelPhoto",
|
|
|
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
|
|
|
success: function (data) {
|
|
|
WindowLoadModel.Hide();
|
|
|
if (data.d != "") { $("#div1").html(data.d); return; }
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
error: function (xhr, status) {
|
|
|
if (status != "success") alert(xhr.responseText);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
//#endregion
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
</head>
|
|
|
<body>
|
|
|
<form id="form1" runat="server">
|
|
|
|
|
|
|
|
|
<div class="title_ico">
|
|
|
货物导入</div>
|
|
|
<table width="100%">
|
|
|
<tr>
|
|
|
<td align="center">
|
|
|
<table border="1" cellpadding="0" cellspacing="0" style="width: 95%"class="tableAll">
|
|
|
|
|
|
<tr>
|
|
|
<td>
|
|
|
客户单位</td>
|
|
|
<td>
|
|
|
<select id="select_company" class="selectClass" style="width: 200px" name="D1">
|
|
|
|
|
|
</select></td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td>
|
|
|
货物SKU导入:</td>
|
|
|
<td>
|
|
|
<input id="fileToUpload" accept="excel/xls" name="fileToUpload" type="file" style="width:30%" /> <input
|
|
|
id="cmdReport" type="button" class="btnClass btnClassEdit" value="SKU导入" />
|
|
|
<a href="../Scripts/货物导入模板3.xls"
|
|
|
style="cursor: pointer; color: Blue; "> 货物SKU导入模板下载</a></td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td>
|
|
|
</td>
|
|
|
<td>
|
|
|
如果sku导入列有图片的需要在下面导入图片文件</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td>
|
|
|
货物图片导入:</td>
|
|
|
<td>
|
|
|
<input id="fileToUpload2" accept="excel/xls" name="fileToUpload2" type="file"
|
|
|
style="width:30%" /> <input id="cmdReport2" type="button" class="btnClass btnClassEdit" value="图片导入" />
|
|
|
把图片放到一个文件夹压缩后再导入,图片名称跟sku导入那边的图片列名称要一致</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td>
|
|
|
导入结果提示:</td>
|
|
|
<td>
|
|
|
<div id="div1" style="height:270px;width:600px;color:red"></div></td>
|
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
</form>
|
|
|
</body>
|
|
|
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|