DS7_JinGang
hanxuntao 2 years ago
parent 0b976f73f1
commit 1ed33e906e

@ -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)
{

@ -47641,7 +47641,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
#region
public DBResult ReadMh8(string filename,string userid,string username,string companyid)
public static DBResult ReadMh8(string filename,string userid,string username,string companyid)
{
var result = new DBResult();
@ -47662,11 +47662,29 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL
}
return result;
}
public static DBResult ImportXmlBs(NewDataSet SHIPMENT, string userid, string showname, string companyid, string dbname = "")
public static DBResult ImportXmlBs(NewDataSet SHIPMENTLIST, string userid, string showname, string companyid, string dbname = "")
{
var result = new DBResult();
var opseaelist = new List<MsOpSeae>();
var opseae = new MsOpSeae();
for (int i=0;i<SHIPMENTLIST.Items.Length;i++) {
var SHIPMENT = SHIPMENTLIST.Items[i];
if (SHIPMENT.GetType().FullName == "NewDataSetBooking") {
var tmpBILL = new NewDataSetBooking();
tmpBILL = SHIPMENT as NewDataSetBooking;
opseae.GROUPBS = tmpBILL.BookingId.ToString();
}
}
//foreach (var item in SHIPMENTLIST) {
//}
//opseaelist.Add(opseae);
return result;
}

File diff suppressed because it is too large Load Diff

@ -2640,7 +2640,13 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, {
this.ImortBsListExcel(button, event);
},
scope: this
}, {
}, {
text: Zi.LAN.ImportBsListMH8, //"EXCEL导入",
handler: function (button, event) {
this.ImortBsListMH8(button, event);
},
scope: this
}, {
text: Zi.LAN.ExpExcel, //"EXCEL模板导出",
iconCls: "btnexportexcel",
handler: function (button, event) {
@ -14676,7 +14682,89 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, {
},
ImortBsListMH8: function () {
var BSNO = "";
me = this;
var url = '/MvcShipping/MsOpSeae/ImportMH8';
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 20,
frame: true,
autoScroll: false,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadExcel',
name: 'LoadExcel',
emptyText: '请选择MH8文件', //'请选择EXCEL文件',
fieldLabel: 'MH8文件', //'EXCEL',
buttonText: '选择文件', //'选择文件',
allowBlank: false,
width: 200,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: Zi.LAN.submit, //'上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadExcel').getValue();
if (!CheckFileExt(UserFilePath, /.zip/i)) {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: '请选择您要上传的zip文件', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //'请确认你上传的文件为EXCEL文件!'
return;
}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: url,
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
method: 'POST',
params: {
bsno: BSNO
},
success: function (form, action) {
win.close(this);
_this.onDsQuery();
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert(Zi.LAN.JingGao, action.result.errors.msg);
}
});
}
}, {
text: Zi.LAN.GuanBi, //'关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title:'上传MH8文件', //"上传EXCEL",
width: 380,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
return;
},
LoadModuleEnable: function () {
this.storeModuleEnable.load({
params: { condition: " (sys_module.[NAME] like 'EDI-%' OR sys_module.[NAME] like 'SEAE-%') " },

@ -700,4 +700,5 @@ Zi.LAN.YARDREMARK = "场站备注";
Zi.LAN.SyncBooking = "同步订舱数据";
Zi.LAN.EDICSSA = "CSSA EDI";
Zi.LAN.FINANCIALSTAFFCODE = "场站自结";
Zi.LAN.GETYARDDB = "场站数据对比";
Zi.LAN.GETYARDDB = "场站数据对比";
Zi.LAN.ImportBsListMH8 = "MH8导入";

@ -728,6 +728,7 @@ Zi.LAN.SyncBooking = "同步订舱数据";
Zi.LAN.EDICSSA = "CSSA EDI";
Zi.LAN.FINANCIALSTAFFCODE = "场站自结";
Zi.LAN.GETYARDDB = "场站数据对比";
Zi.LAN.ImportBsListMH8 = "MH8导入";
//Zi.LAN. = "";

Loading…
Cancel
Save