|
|
|
@ -63,6 +63,7 @@ using DSWeb.Common.Model;
|
|
|
|
|
using sun.swing;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsSysThirdPartyAccount;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using ICSharpCode.SharpZipLib.Zip;
|
|
|
|
|
|
|
|
|
|
//using Discuz.Common;
|
|
|
|
|
|
|
|
|
@ -14204,6 +14205,138 @@ namespace DSWeb.MvcShipping.Controllers
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 引入MH8
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public ContentResult ImportMH8()
|
|
|
|
|
{
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
|
|
if (file == null)
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
|
|
{
|
|
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
}
|
|
|
|
|
string ext = Path.GetExtension(file.FileName).ToLower();
|
|
|
|
|
if (ext == ".asp" || ext == ".aspx")
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "不允许上传ASP或ASPX文件";
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/BulkDetail");
|
|
|
|
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
|
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
|
|
string filename = path + "\\" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
|
|
{
|
|
|
|
|
System.IO.File.Delete(filename);
|
|
|
|
|
}
|
|
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ext != ".zip")
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "上传的文件不是MH8文件";
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
var strMsg = "";
|
|
|
|
|
|
|
|
|
|
var pathstr = "../../UploadFiles/ViewTmp/" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff");
|
|
|
|
|
var filePath = Server.MapPath(pathstr);
|
|
|
|
|
if (!Directory.Exists(filePath))
|
|
|
|
|
{
|
|
|
|
|
Directory.CreateDirectory(filePath);
|
|
|
|
|
}
|
|
|
|
|
string[] files = Directory.GetFiles(filePath);
|
|
|
|
|
if (files.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (string afile in files)
|
|
|
|
|
{
|
|
|
|
|
System.IO.File.Delete(afile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FastZip fastZip = new FastZip();
|
|
|
|
|
fastZip.ExtractZip(filename, filePath, null);
|
|
|
|
|
bool isSucess = false;
|
|
|
|
|
DBResult result = new DBResult();
|
|
|
|
|
files = Directory.GetFiles(filePath);
|
|
|
|
|
if (files.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (string xmlfile in files)
|
|
|
|
|
{
|
|
|
|
|
FileInfo fileInfo2 = new FileInfo(xmlfile);
|
|
|
|
|
var allxmlfile= pathstr + "/" + fileInfo2.Name;
|
|
|
|
|
result = MsOpSeaeEdiPortDAL.ReadMh8(fileInfo2.FullName, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var message = string.Empty;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!isSucess)
|
|
|
|
|
{
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = message;
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = message });
|
|
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
}
|
|
|
|
|
catch (Exception)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性";
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 东胜VGM发送 直发VGM
|
|
|
|
|
public ContentResult CreateAndSendVGM(string mblno, string userid, string type,string bsno)
|
|
|
|
|
{
|
|
|
|
|