From f6b1f889aa1bce88bd8d639aaabfac59f9319f78 Mon Sep 17 00:00:00 2001 From: hanxuntao <641739520@qq.com> Date: Fri, 10 Mar 2023 10:49:45 +0800 Subject: [PATCH] 1 --- .../Chfee_PayapplicationDAL.cs | 69 + .../ChInvoiceapplicationNewEdit.js | 12 +- .../ChSettlementRecvInvEdit.js | 4 +- .../Controllers/MsOpSeaeController.cs | 170 - .../DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs | 2732 +++-------------- .../MvcShipping/Views/MsOpAire/Edit.aspx | 2 +- .../MvcShipping/Views/MsOpAiri/Edit.aspx | 2 +- .../MvcShipping/Views/MsOpApply/Edit.aspx | 2 +- .../MvcShipping/Views/MsOpOther/Edit.aspx | 2 +- .../MvcShipping/Views/MsOpSeai/Edit.aspx | 2 +- .../MvcShipping/Viewsjs/Comm/PubFunction.js | 2 +- .../Viewsjs/MsOpSeae/MsOpSeaeEdit.js | 33 +- .../Viewsjs/MsOpSeae/MsOpSeaeIndex.js | 10 +- .../MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js | 3 +- .../MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js | 1 + 15 files changed, 559 insertions(+), 2487 deletions(-) diff --git a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs index df9e2352..2249a4c8 100644 --- a/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs +++ b/DSWeb/Areas/Account/DAL/Chfee_payapplication/Chfee_PayapplicationDAL.cs @@ -4713,6 +4713,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication { var head = GetData("cm.BILLNO='" + billno + "'", userid, username, companyid); //var bodylist = GetBodyAllBsList("c.BILLNO='" + billno + "'"); + //SavePayBill(billno,bodylist); var ISCONTRACT = "无"; T_ALL_DA T_ALL_DA = new T_ALL_DA(); @@ -4911,6 +4912,74 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Payapplication } + public static DBResult SavePayBill(string billno,List bodyList) + { + var result = new DBResult(); + + Database db = DatabaseFactory.CreateDatabase(); + using (var conn = db.CreateConnection()) + { + conn.Open(); + var tran = conn.BeginTransaction(); + + try + { + var cmdInsert = + db.GetSqlStringCommand( + @"insert into ch_fee_payapplication_bill (GID, BILLNO,BSNO,MBLNO,CUSTNO,ETD,CUSTOMERNAME, STLNAME,CNTRTOTAL,RMBCR,USDCR,TTLPROFIT,RMBPROFIT,USDPROFIT,BILLFEESTATUS) + values (@GID, @BILLNO,@BSNO,@MBLNO,@CUSTNO,@ETD,@CUSTOMERNAME, @STLNAME,@CNTRTOTAL,@RMBCR,@USDCR,@TTLPROFIT,@RMBPROFIT,@USDPROFIT,@BILLFEESTATUS) "); + var cmdDelete = + db.GetSqlStringCommand( + @"delete from ch_fee_payapplication_bill where BILLNO=@BILLNO "); + + if (bodyList != null) + { + cmdDelete.Parameters.Clear(); + db.AddInParameter(cmdDelete, "@BILLNO", DbType.String,billno); + db.ExecuteNonQuery(cmdDelete, tran); + + foreach (var enumValue in bodyList) + { + cmdInsert.Parameters.Clear(); + + db.AddInParameter(cmdInsert, "@GID", DbType.String, Guid.NewGuid().ToString()); + db.AddInParameter(cmdInsert, "@BILLNO", DbType.String,billno); + db.AddInParameter(cmdInsert, "@BSNO", DbType.String, enumValue.BSNO); + db.AddInParameter(cmdInsert, "@MBLNO", DbType.String, enumValue.MBLNO); + db.AddInParameter(cmdInsert, "@CUSTNO", DbType.String, enumValue.CUSTNO); + db.AddInParameter(cmdInsert, "@ETD", DbType.String, enumValue.ETD); + db.AddInParameter(cmdInsert, "@CUSTOMERNAME", DbType.String, enumValue.CUSTOMERNAME); + db.AddInParameter(cmdInsert, "@STLNAME", DbType.String, enumValue.STLNAME); + db.AddInParameter(cmdInsert, "@CNTRTOTAL", DbType.String, enumValue.CNTRTOTAL); + db.AddInParameter(cmdInsert, "@RMBCR", DbType.String, enumValue.RMBCR); + db.AddInParameter(cmdInsert, "@USDCR", DbType.String, enumValue.USDCR); + db.AddInParameter(cmdInsert, "@TTLPROFIT", DbType.String, enumValue.TTLPROFIT); + db.AddInParameter(cmdInsert, "@USDPROFIT", DbType.String, enumValue.USDPROFIT); + db.AddInParameter(cmdInsert, "@RMBPROFIT", DbType.String, enumValue.RMBPROFIT); + db.AddInParameter(cmdInsert, "@BILLFEESTATUS", DbType.String, enumValue.BILLFEESTATUS); + db.ExecuteNonQuery(cmdInsert, tran); + + } + } + + tran.Commit(); + } + catch (Exception) + { + tran.Rollback(); + + result.Success = false; + result.Message = "保存出现错误,请重试或联系系统管理员"; + + return result; + } + } + + result.Success = true; + result.Message = "保存成功"; + + return result; + } public static DBResult GetEmailHtml2(string billno, string userid, string username, string companyid,string deptname) { diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_invoiceapplication/ChInvoiceapplicationNewEdit.js b/DSWeb/Areas/Account/Viewsjs/Chfee_invoiceapplication/ChInvoiceapplicationNewEdit.js index 2347b668..fffd5151 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_invoiceapplication/ChInvoiceapplicationNewEdit.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_invoiceapplication/ChInvoiceapplicationNewEdit.js @@ -3970,12 +3970,12 @@ addDetail: function () { } - if ((CURR == '') || (CURR == null)) { - btnEAddDetail.enable(); - Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); - return; + //if ((CURR == '') || (CURR == null)) { + // btnEAddDetail.enable(); + // Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); + // return; - } + //} } } @@ -4234,7 +4234,7 @@ addDetailfn: function () { var sql = this.sqlcontext; this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} }); - + this.storeAppDetailList.load({ params: { condition: " LINKGID='" + GID + "'" } }); _this.storeBodyList.load({ params: { condition: " BILLNO='" + billno + "'" }, callback: function (r, options, success) { if (success) { diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChSettlementRecvInvEdit.js b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChSettlementRecvInvEdit.js index f44a2608..843155e6 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChSettlementRecvInvEdit.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChSettlementRecvInvEdit.js @@ -3736,11 +3736,11 @@ Ext.extend(Shipping.ChSettlementRecvInvEdit, Ext.Panel, { callback: function (r, options, success) { if (success) { if (_this.storeBodyList.getCount() > 0) { - _this.comboxCurr.setReadOnly(true); + _this.comboxBILLTYPE.setReadOnly(true); _this.comboxCustCode.setReadOnly(true); } else { - _this.comboxCurr.setReadOnly(false); + _this.comboxBILLTYPE.setReadOnly(false); _this.comboxCustCode.setReadOnly(false); } } diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs index b31f2613..88fb0459 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs @@ -4275,176 +4275,6 @@ namespace DSWeb.MvcShipping.Controllers } #endregion - #region 马士基MAERSK导出 - public ContentResult CreateMAERSKList(string bsnos, string mblno, string filetype, string filerole, int isbill, string carrier) - { - bsnos = bsnos.Replace(",", "','"); - var headList = MsOpSeaeDAL.GetDataList("BSNO IN ('" + bsnos + "')", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); - var path = Server.MapPath("../../EDIFiles/SeaeEdi"); - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - - var result = new DBResult(); - if (filetype == "V") - { - #region VGM - var error = MsOpSeaeEdiPortDAL.IsCreateVGM(headList, "MAERSKVGM", filetype, filerole, "", "", "", "", ""); - if (error == "") - { - var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='MAERSKVGM' and CARRIERID='" + carrier + "'", Convert.ToString(Session["COMPANYID"]));// AND CARRIERID='" + carrier + "' - var filename = ""; - filename = MsOpSeaeEdiPortDAL.CreateVGM(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, "MAERSKVGM", isbill, 0, carrier, "", "", filetype, "", "", "", "", ""); - if (ftpset.SERVERIP != "" && ftpset.SERVERIP != null) - { - result = MsOpSeaeEdiPortDAL.FtpFile(filename, ftpset); - var afilename = Path.GetFileName(filename); - MsOpSeaeEdiPortDAL.InsertEdiLog(bsnos, "MAERSKVGM", filetype, carrier, ftpset.SERVERIP, afilename, "../../EDIFiles/SeaeEdi/" + afilename, Convert.ToString(Session["SHOWNAME"])); - - } - else - { - result.Success = false; - result.Message = "FTP参数没有设置,请先设置FTP参数!"; - } - } - else - { - result.Success = false; - result.Message = error; - } - #endregion - } - else - { - #region 订舱、确认 - var error = MsOpSeaeEdiPortDAL.IsCreateMAERSK(headList, filetype, filerole, isbill, carrier); - if (error == "") - { - var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='MAERSK' and CARRIERID='" + carrier + "'", Convert.ToString(Session["COMPANYID"])); - var filename = ""; - if (filetype == "E") - filename = MsOpSeaeEdiPortDAL.CreateEdiMAERSKSI(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, isbill, carrier, filetype); - else - filename = MsOpSeaeEdiPortDAL.CreateEdiMAERSK(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, isbill, carrier, filetype); - - - if (ftpset.SERVERIP != "" && ftpset.SERVERIP != null) - { - result = MsOpSeaeEdiPortDAL.FtpFile(filename, ftpset); - var afilename = Path.GetFileName(filename); - - MsOpSeaeEdiPortDAL.InsertEdiLog(bsnos, "MAERSK", filetype, carrier, ftpset.SERVERIP, afilename, "../../EDIFiles/SeaeEdi/" + afilename, Convert.ToString(Session["SHOWNAME"])); - T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); - foreach (var bill in headList) - { - if (filetype == "B") - { - var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill.BSNO + "' AND COVERTITLE='发送SO') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill.BSNO + "','发送SO','','" + Session["SHOWNAME"] + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')"; - bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL); - } - else - { - var blUpSQL = " if (select CID from Op_SeaCover where bsno='" + bill.BSNO + "' AND COVERTITLE='发送SI') is null insert into Op_SeaCover(CID,BSNO,COVERTITLE,COVERCONTEXT,OPERATOR,OPTIME,ISSYS) values(NEWID(),'" + bill.BSNO + "','发送SI','','" + Session["SHOWNAME"] + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1')"; - bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL); - - } - } - - - } - else - { - result.Success = false; - result.Message = "FTP参数没有设置,请先设置FTP参数!"; - } - } - else - { - result.Success = false; - result.Message = error; - } - #endregion - } - var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; - return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; - } - - public ContentResult SaveMAERSKList(string bsnos, string mblno, string filetype, string filerole, int isbill, string carrier) - { - bsnos = bsnos.Replace(",", "','"); - var headList = MsOpSeaeDAL.GetDataList("BSNO IN ('" + bsnos + "')", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); - var path = Server.MapPath("../../EDIFiles/SeaeEdi"); - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - - var result = new DBResult(); - if (filetype == "V") - { - #region VGM - var error = MsOpSeaeEdiPortDAL.IsCreateVGM(headList, "MAERSKVGM", filetype, filerole, "", "", "", "", ""); - if (error == "") - { - var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='MAERSKVGM' and CARRIERID='" + carrier + "'", Convert.ToString(Session["COMPANYID"]));// AND CARRIERID='" + carrier + "' - if (ftpset.SENDCODE == "" || ftpset.RECEIVECODE == "") - { - result.Success = false; - result.Message = "EDI参数没有设置,请先设置EDI参数!"; - } - else - { - var filename = ""; - filename = MsOpSeaeEdiPortDAL.CreateVGM(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, "MAERSKVGM", isbill, 0, carrier, "", "", filetype, "", "", "", "", ""); - filename = Path.GetFileName(filename); - result.Data = "../../EDIFiles/SeaeEdi/" + filename; - result.Success = true; - result.Message = filename; - } - } - else - { - result.Success = false; - result.Message = error; - } - #endregion - } - else - { - #region 订舱、确认 - var error = MsOpSeaeEdiPortDAL.IsCreateMAERSK(headList, filetype, filerole, isbill, carrier); - if (error == "") - { - var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='MAERSK' and CARRIERID='" + carrier + "'", Convert.ToString(Session["COMPANYID"])); - var filename = ""; - if (filetype == "E") - filename = MsOpSeaeEdiPortDAL.CreateEdiMAERSKSI(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, isbill, carrier, filetype); - else - filename = MsOpSeaeEdiPortDAL.CreateEdiMAERSK(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, isbill, carrier, filetype); - filename = Path.GetFileName(filename); - result.Data = "../../EDIFiles/SeaeEdi/" + filename; - - result.Success = true; - - result.Message = filename; - - } - else - { - result.Success = false; - result.Message = error; - - } - #endregion - } - var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = result.Data }; - return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; - - - } - #endregion diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs index f203fd36..8f7c836d 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs @@ -1450,9 +1450,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (DestList.Count >= maxline) { if (formatstr) - overlist.Add(formatEdiStr("txt", StrList[i])); + overlist.Add(cutstr + formatEdiStr("txt", StrList[i])); else - overlist.Add(StrList[i]); + overlist.Add(cutstr+StrList[i]); } else { @@ -1466,7 +1466,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (tmpstr.Length > (length - cutstr.Length)) { DestList.Add(tmpstr.Substring(0, (length - cutstr.Length))); - overlist.Add(tmpstr.Substring((length - cutstr.Length))); + overlist.Add(cutstr+tmpstr.Substring((length - cutstr.Length))); } else DestList.Add(tmpstr); @@ -1506,9 +1506,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (DestList.Count >= maxline) { if (formatstr) - overlist.Add(formatEdiStr("txt", strnewline)); + overlist.Add(cutstr + formatEdiStr("txt", strnewline)); else - overlist.Add(strnewline); + overlist.Add(cutstr + strnewline); } else { @@ -1522,7 +1522,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (tmpstr.Length > (length - cutstr.Length)) { DestList.Add(tmpstr.Substring(0, (length - cutstr.Length)) ); - overlist.Add(tmpstr.Substring((length - cutstr.Length))); + overlist.Add(cutstr + tmpstr.Substring((length - cutstr.Length))); } else DestList.Add(tmpstr); @@ -1551,9 +1551,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (DestList.Count >= maxline) { if (formatstr) - overlist.Add(formatEdiStr("txt", strnewline)); + overlist.Add(cutstr + formatEdiStr("txt", strnewline)); else - overlist.Add(strnewline); + overlist.Add(cutstr + strnewline); } else { @@ -1567,7 +1567,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (tmpstr.Length > (length - cutstr.Length)) { DestList.Add(tmpstr.Substring(0, (length - cutstr.Length)) ); - overlist.Add(tmpstr.Substring((length - cutstr.Length))); + overlist.Add(cutstr + tmpstr.Substring((length - cutstr.Length))); } else DestList.Add(tmpstr); @@ -1588,7 +1588,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } if (overlist != null && overlist.Count != 0) { - overlist[0] = cutstr + overlist[0]; + //overlist[0] = cutstr + overlist[0]; + + DestList[DestList.Count - 1] = DestList[DestList.Count - 1] + cutstr; } @@ -4612,7 +4614,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } else Shipping = formatEdiStr("txt", OpBill.SHIPPER); List ShippingList = formatlengthStr(Shipping, 35); - var DescriptionShipper = ""; + //var DescriptionShipper = ""; + List DescriptionShipper = new List(); if (ShippingList.Count != 0 && Shipping.Length > 0) { for (var i = 0; i < ShippingList.Count; i++) @@ -4627,7 +4630,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 34) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 34); - DescriptionShipper = ShippingList[i].Substring(34); + DescriptionShipper.Add("*"+ShippingList[i].Substring(34)); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -4639,14 +4642,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "*"; - DescriptionShipper = "*" + DescriptionShipper; + //DescriptionShipper = "*" + DescriptionShipper; //} } else if (i > 4) { - - DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); + //DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; } } @@ -4669,7 +4672,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL else Shipping = formatEdiStr("txt", OpBill.CONSIGNEE); ShippingList = formatlengthStr(Shipping, 35); - var DescriptionConsignee = ""; + //var DescriptionConsignee = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -4686,7 +4689,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 33) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 33); - DescriptionConsignee = ShippingList[i].Substring(33); +// DescriptionConsignee = ShippingList[i].Substring(33); + DescriptionShipper.Add("**" + ShippingList[i].Substring(33)); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -4698,14 +4702,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "**"; - DescriptionConsignee = "**" + DescriptionConsignee; + //DescriptionConsignee = "**" + DescriptionConsignee; //} } else if (i > 4) { - - DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; + DescriptionShipper.Add("**" + ShippingList[i]); + //DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; } } @@ -4747,7 +4751,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL else Shipping = formatEdiStr("txt", OpBill.NOTIFYPARTY); ShippingList = formatlengthStr(Shipping, 35); - var DescriptionNotifyparty = ""; + //var DescriptionNotifyparty = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -4764,7 +4768,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 32) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 32); - DescriptionNotifyparty = ShippingList[i].Substring(32); + //DescriptionNotifyparty = ShippingList[i].Substring(32); + DescriptionShipper.Add("***" + ShippingList[i].Substring(32)); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -4776,14 +4781,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "***"; - DescriptionNotifyparty = "***" + DescriptionNotifyparty; + //DescriptionNotifyparty = "***" + DescriptionNotifyparty; //} } else if (i > 4) { - - DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; + DescriptionShipper.Add("***" + ShippingList[i]); + //DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; } } @@ -5025,24 +5030,29 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } } } - if (DescriptionShipper != "") + if (DescriptionShipper !=null&& DescriptionShipper.Count!=0) { - r.WriteLine("FTX+AAA+++" + DescriptionShipper + "'"); - icount = icount + 1; - + foreach (var shipper in DescriptionShipper) + { + if (!string.IsNullOrEmpty(shipper)) + { + r.WriteLine("FTX+AAA+++" + shipper + "'"); + icount = icount + 1; + } + } } - if (DescriptionConsignee != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionConsignee + "'"); - icount = icount + 1; + //if (DescriptionConsignee != "") + //{ + // r.WriteLine("FTX+AAA+++" + DescriptionConsignee + "'"); + // icount = icount + 1; - } - if (DescriptionNotifyparty != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty + "'"); - icount = icount + 1; + //} + //if (DescriptionNotifyparty != "") + //{ + // r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty + "'"); + // icount = icount + 1; - } + //} if (isbill != 1) { @@ -5078,20 +5088,26 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (bill.CARGOID == "D") { var tmp = bill.DFLASH; - var fuhao = ""; - if (tmp.IndexOf("-") == 0) - { - fuhao = "-"; - tmp = tmp.Replace("-", "").Trim(); - } - if (tmp.Length < 3) + if (tmp != "") { - for (int i = 0; i < 3 - tmp.Length + 1; i++) + var fuhao = ""; + if (tmp.IndexOf("-") == 0) + { + fuhao = "-"; + tmp = tmp.Replace("-", "").Trim(); + } + if (tmp.Length < 3) { - tmp = "0" + tmp; + for (int i = 0; i < 3 - tmp.Length + 1; i++) + { + tmp = "0" + tmp; + } } + tmp = fuhao + tmp; + } + else { + tmp = "000"; } - tmp = fuhao + tmp; if (!string.IsNullOrEmpty(bill.PKGTYPE)) r.WriteLine("DGS+IMD+" + bill.DCLASS + "+" + bill.DUNNO + "+" + tmp + ":CEL+" + bill.PKGTYPE + "'"); @@ -5137,19 +5153,28 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (bill.CARGOID == "R") { var tmp = bill.TEMPSET; - var fuhao = ""; - if (tmp.IndexOf("-") == 0) { - fuhao = "-"; - tmp = tmp.Replace("-",""); - } - if (tmp.Length < 3) + if (tmp != "") { - for (int i = 0; i < 3 - tmp.Length+1; i++) + var fuhao = ""; + if (tmp.IndexOf("-") == 0) { - tmp = "0" + tmp; + fuhao = "-"; + tmp = tmp.Replace("-", ""); + } + if (tmp.Length < 3) + { + for (int i = 0; i < 3 - tmp.Length + 1; i++) + { + tmp = "0" + tmp; + } } + tmp = fuhao + tmp; } - tmp = fuhao + tmp; + else + { + tmp = "000"; + } + if (bill.REEFERF != "") r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'"); @@ -5162,20 +5187,28 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL }else if (bill.CARGOID == "D"&&!string.IsNullOrEmpty(bill.TEMPSET)) { var tmp = bill.TEMPSET; - var fuhao = ""; - if (tmp.IndexOf("-") == 0) - { - fuhao = "-"; - tmp = tmp.Replace("-", ""); - } - if (tmp.Length < 3) + if (tmp != "") { - for (int i = 0; i < 3 - tmp.Length+1; i++) + var fuhao = ""; + if (tmp.IndexOf("-") == 0) { - tmp = "0" + tmp; + fuhao = "-"; + tmp = tmp.Replace("-", ""); + } + if (tmp.Length < 3) + { + for (int i = 0; i < 3 - tmp.Length + 1; i++) + { + tmp = "0" + tmp; + } } + tmp = fuhao + tmp; } - tmp = fuhao + tmp; + else + { + tmp = "000"; + } + if (bill.REEFERF != "") r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'"); @@ -5485,7 +5518,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL - var DescriptionShipper = ""; + List DescriptionShipper = new List(); if (isbill != 1) { if (billams.BYCOUNTRY != "" && carrier != "OOLU") @@ -5512,7 +5545,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 34) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 34); - DescriptionShipper = ShippingList[i].Substring(34); + DescriptionShipper.Add("*" + ShippingList[i].Substring(34)); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -5524,14 +5557,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "*"; - DescriptionShipper = "*" + DescriptionShipper; + //DescriptionShipper = "*" + DescriptionShipper; //} } else if (i > 4) { - - DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); + //DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; } } @@ -5556,7 +5589,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL else Shipping = formatEdiStr("txt", OpBill.CONSIGNEE); ShippingList = formatlengthStr(Shipping, 35); - var DescriptionConsignee = ""; + //var DescriptionConsignee = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -5573,7 +5606,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 33) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 33); - DescriptionConsignee = ShippingList[i].Substring(33); + DescriptionShipper.Add("**" + ShippingList[i].Substring(33)); + //DescriptionConsignee = ShippingList[i].Substring(33); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -5585,14 +5619,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "**"; - DescriptionConsignee = "**" + DescriptionConsignee; + //DescriptionConsignee = "**" + DescriptionConsignee; //} } else if (i > 4) { - - DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; + DescriptionShipper.Add("**" + ShippingList[i]); + //DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; } } @@ -5669,7 +5703,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL else Shipping = formatEdiStr("txt", OpBill.NOTIFYPARTY); ShippingList = formatlengthStr(Shipping, 35); - var DescriptionNotifyparty = ""; + //var DescriptionNotifyparty = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -5686,7 +5720,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 32) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 32); - DescriptionNotifyparty = ShippingList[i].Substring(32); + DescriptionShipper.Add("***" + ShippingList[i].Substring(32)); + //DescriptionNotifyparty = ShippingList[i].Substring(32); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -5698,14 +5733,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "***"; - DescriptionNotifyparty = "***" + DescriptionNotifyparty; + //DescriptionNotifyparty = "***" + DescriptionNotifyparty; //} } else if (i > 4) { - - DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; + DescriptionShipper.Add("***" + ShippingList[i]); + //DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; } } @@ -5904,24 +5939,36 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } } - if (DescriptionShipper != "") + if (DescriptionShipper != null && DescriptionShipper.Count != 0) { - r.WriteLine("FTX+AAA+++" + DescriptionShipper.TrimEnd() + "'"); - icount = icount + 1; - + foreach (var shipper in DescriptionShipper) + { + if (!string.IsNullOrEmpty(shipper)) + { + r.WriteLine("FTX+AAA+++" + shipper + "'"); + icount = icount + 1; + } + } } - if (DescriptionConsignee != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionConsignee.TrimEnd() + "'"); - icount = icount + 1; - } - if (DescriptionNotifyparty != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty.TrimEnd() + "'"); - icount = icount + 1; + //if (DescriptionShipper != "") + //{ + // r.WriteLine("FTX+AAA+++" + DescriptionShipper.TrimEnd() + "'"); + // icount = icount + 1; - } + //} + //if (DescriptionConsignee != "") + //{ + // r.WriteLine("FTX+AAA+++" + DescriptionConsignee.TrimEnd() + "'"); + // icount = icount + 1; + + //} + //if (DescriptionNotifyparty != "") + //{ + // r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty.TrimEnd() + "'"); + // icount = icount + 1; + + //} if (isbill != 1) { @@ -6163,20 +6210,28 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL { var tmp = bill.DFLASH; - var fuhao = ""; - if (tmp.IndexOf("-") == 0) - { - fuhao = "-"; - tmp = tmp.Replace("-", "").Trim(); - } - if (tmp.Length < 3) + if (tmp != "") { - for (int i = 0; i < 3 - tmp.Length+1; i++) + var fuhao = ""; + if (tmp.IndexOf("-") == 0) + { + fuhao = "-"; + tmp = tmp.Replace("-", "").Trim(); + } + if (tmp.Length < 3) { - tmp = "0" + tmp; + for (int i = 0; i < 3 - tmp.Length + 1; i++) + { + tmp = "0" + tmp; + } } + tmp = fuhao + tmp; + } + else + { + tmp = "000"; } - tmp = fuhao + tmp; + if (!string.IsNullOrEmpty(bill.PKGTYPE)) r.WriteLine("DGS+IMD+" + bill.DCLASS + "+" + bill.DUNNO + "+"+tmp+":CEL+"+bill.PKGTYPE+ "'"); @@ -6214,2057 +6269,10 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL foreach (var ctn in ctnsumlist) { if (ctn.CNTRSOURCE == "SOC") - r.WriteLine("EQD+CN+" + ctn.CNTRNO + "+" + GetCtnEDICode(ctn.CTNALL, "INTTR") + ":::"+ctn.CTNALL+"+1'"); - else - r.WriteLine("EQD+CN+" + ctn.CNTRNO + "+" + GetCtnEDICode(ctn.CTNALL, "INTTR") + ":::" + ctn.CTNALL + "+2'"); - r.WriteLine("MEA+AAE+WT+KGM:" + Math.Round(ctn.KGS, 3) + "'"); - r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(ctn.CBM, 3) + "'"); - icount = icount + 3; - - if (bill.CARGOID == "R") - { - if (bill.REEFERF != "") - { - r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'"); - icount = icount + 1; - } - - r.WriteLine("SEL+" + ctn.SEALNO + "+CA'"); - icount = icount + 1; - - - var tmp = bill.TEMPSET; - var fuhao = ""; - if (tmp.IndexOf("-") == 0) - { - fuhao = "-"; - tmp = tmp.Replace("-", ""); - } - if (tmp.Length < 3) - { - for (int i = 0; i < 3 - tmp.Length+1; i++) - { - tmp = "0" + tmp; - } - } - tmp = fuhao + tmp; - - r.WriteLine("TMP+2+" + tmp + ":CEL'"); - icount = icount + 1; - } else if (bill.CARGOID == "D"&&!string.IsNullOrEmpty(bill.TEMPSET)) - { - if (bill.REEFERF != "") - { - r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'"); - icount = icount + 1; - } - - r.WriteLine("SEL+" + ctn.SEALNO + "+CA'"); - icount = icount + 1; - - - var tmp = bill.TEMPSET; - var fuhao = ""; - if (tmp.IndexOf("-") == 0) - { - fuhao = "-"; - tmp = tmp.Replace("-", ""); - } - if (tmp.Length < 3) - { - for (int i = 0; i < 3 - tmp.Length+1; i++) - { - tmp = "0" + tmp; - } - } - tmp = fuhao + tmp; - - r.WriteLine("TMP+2+" + tmp + ":CEL'"); - icount = icount + 1; - } else - { - - - r.WriteLine("SEL+" + ctn.SEALNO + "+CA'"); - icount = icount + 1; - - - } - - - } - #endregion - } - r.WriteLine("UNT+" + icount.ToString() + "+" + bsno + "'"); - r.WriteLine("UNZ+" + headData.Count.ToString() + "+" + bsno + "'"); - r.Close(); - f.Close(); - - return filename; - } - #endregion - #endregion - - #region 马士基MAERSK EDI - #region 检查 - public static string IsCreateMAERSK(List headData, string filetype, string filerole, int isbill, string carrier) - { - T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); - var error = ""; - foreach (var bill in headData) - { - var OpBill = MsOpSeaeDAL.MsOpSeaeDAL.GetBillData("BSNO='" + bill.BSNO + "'"); - var billams = GetAmsData("BSNO='" + bill.BSNO + "'"); - - #region EDI信息 - if (bill.OP == null || bill.OP == "") - { error = error + "
操作不能为空"; } - else - { - DataSet dsUserOp = T_ALL_DA.GetAllSQL("select top 1 * from [user] as u INNER JOIN user_baseinfo as b on u.GID=b.USERID where [SHOWNAME]='" + bill.OP.ToString() + "'"); - if (dsUserOp != null) - { - if (dsUserOp.Tables[0].Rows.Count > 0) - { - if (dsUserOp.Tables[0].Rows[0]["USERNAME"].ToString().Trim() == "") - { error = error + "
操作的英文名不能为空"; } - - if (dsUserOp.Tables[0].Rows[0]["OFFICEPHONE"].ToString().Trim() == "") - { error = error + "
操作的电话不能为空"; } - - //if (dsUserOp.Tables[0].Rows[0]["EMAIL1"].ToString().Trim() == "") - //{ error = error + "
操作的邮箱不能为空"; } - } - } - else { - - { error = error + "
操作不能为空"; } - - } - } - - if (bill.CARGOID == "D" || bill.SERVICE == "DOOR-DOOR" || bill.SERVICE == "DOOR-CY" || bill.SERVICE == "CY-DOOR") - { - if (billams.ATTN == null || billams.ATTN == "") - { error = error + "
EDI信息联系人不能为空"; } - - if (billams.ATTNTEL == null || billams.ATTNTEL == "") - { error = error + "
EDI信息联系人电话不能为空"; } - - if (billams.ATTNEMAIL == null || billams.ATTNEMAIL == "") - { error = error + "
EDI信息联系人邮箱不能为空"; } - } - #endregion - - #region 提单、付费方式、船名航次、Edi备注、船公司 - if (bill.MBLNO == null || bill.MBLNO == "") - { error = error + "
主提单号不能为空"; } - if (isbill == 1) - if (OpBill.MBLNO == null || OpBill.MBLNO == "") - { error = error + "
分票提单主提单号不能为空"; } - - if ((bill.BLFRT == null || bill.BLFRT == "")) - { error = error + "
提单号:" + bill.MBLNO + " 付费方式不能为空"; } - - if (filetype == "E") - { - //if ((bill.HSCODE == null || bill.HSCODE == "")) - //{ error = error + "
提单号:" + bill.MBLNO + " HSCODE不能为空"; } - if (bill.VESSEL == null || bill.VESSEL == "") - { error = error + "
提单号:" + bill.MBLNO + " 船名不能为空"; } - - if (bill.VOYNO == null || bill.VOYNO == "") - { error = error + "
提单号:" + bill.MBLNO + " 航次不能为空"; } - } - - if (filetype == "E") - { - if (billams.SIREMARK.IndexOf("PLEASE BOOK OCEAN CARRIER") > -1 || billams.SIREMARK.ToString().Trim() == "") - { - if (carrier == "COSU") - { - error = error + "
提单号:" + bill.MBLNO + " 请在SI备注中输入:COSCO 销售的营销代码(此代码船公司会直接提供)"; - } - else - { - //error = error + "
提单号:" + bill.MBLNO + " EDI备注中不能为空"; - } - } - else - { - // error = error + "
提单号:" + bill.MBLNO + " SI备注必须含有 PLEASE BOOK OCEAN CARRIER"; - if (StringIsChinese(billams.SIREMARK)) - { - error = error + "
提单号:" + bill.MBLNO + " EDI备注中含有中文或双字节字符"; - } - } - } - else - { - if (bill.EDIREMARK.IndexOf("PLEASE BOOK OCEAN CARRIER") > -1 || bill.EDIREMARK.ToString().Trim() == "") - { - if (carrier == "COSU") - { - error = error + "
提单号:" + bill.MBLNO + " 请在EDI备注中输入:COSCO 销售的营销代码(此代码船公司会直接提供)"; - } - else - { - //error = error + "
提单号:" + bill.MBLNO + " EDI备注中不能为空"; - } - } - else - { - // error = error + "
提单号:" + bill.MBLNO + " EDI备注必须含有 PLEASE BOOK OCEAN CARRIER"; - if (StringIsChinese(bill.EDIREMARK)) - { - error = error + "
提单号:" + bill.MBLNO + " EDI备注中含有中文或双字节字符"; - } - } - } - - if (bill.CARRIER == null || bill.CARRIER == "") - { error = error + "
提单号:" + bill.MBLNO + " 船公司不能为空"; } - else - { - if (GetCustEdi(bill.CARRIER) == "") - { error = error + "
提单号:" + bill.MBLNO + " 船公司EDI代码不能为空"; } - } - #endregion - - #region 发货人SHIPPER - if (billams.BYCOUNTRY != "") - { - if (billams.AMSSHIPPER == "") - { - error = error + "
提单号:" + bill.MBLNO + " AMS发货人不能为空"; - } - else - { - if (StringIsChinese(billams.AMSSHIPPER)) - { - error = error + "
提单号:" + bill.MBLNO + " AMS发货人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", billams.AMSSHIPPER, 35, bill.MBLNO, "AMS发货人", 5, "-", false); - } - else - { - error += formatlengthError("txt", billams.AMSSHIPPER, 35, bill.MBLNO, "AMS发货人", 5, "*", false); - } - } - } - } - else - { - - if (bill.SHIPPER == "") - { - error = error + "
提单号:" + bill.MBLNO + " 发货人不能为空"; - } - else - { - if (StringIsChinese(bill.SHIPPER)) - { - error = error + "
提单号:" + bill.MBLNO + " 发货人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", bill.SHIPPER, 35, bill.MBLNO, "发货人", 5, "-", false); - } - else - { - error += formatlengthError("txt", bill.SHIPPER, 35, bill.MBLNO, "发货人", 5, "*", false); - } - } - } - } - - if (isbill == 1) - { - if (OpBill.SHIPPER == "") - { - error = error + "
提单号:" + bill.MBLNO + " 分单发货人不能为空"; - } - else - { - if (StringIsChinese(OpBill.SHIPPER)) - { - error = error + "
提单号:" + bill.MBLNO + " 分单发货人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", OpBill.SHIPPER, 35, bill.MBLNO, "分单发货人", 5, "-", false); - } - else - { - error += formatlengthError("txt", OpBill.SHIPPER, 35, bill.MBLNO, "分单发货人", 5, "*", false); - } - } - } - } - #endregion - - #region 收货人CONSIGNEE - if (billams.BYCOUNTRY != "") - { - if (billams.AMSCONSIGNEE == "") - { - error = error + "
提单号:" + bill.MBLNO + " AMS收货人不能为空"; - } - else - { - if (StringIsChinese(billams.AMSCONSIGNEE)) - { - error = error + "
提单号:" + bill.MBLNO + " AMS收货人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", billams.AMSCONSIGNEE, 35, bill.MBLNO, "AMS收货人", 5, "--", false); - } - else - { - error += formatlengthError("txt", billams.AMSCONSIGNEE, 35, bill.MBLNO, "AMS收货人", 5, "**", false); - } - } - } - } - else - { - - if (bill.CONSIGNEE == "") - { - error = error + "
提单号:" + bill.MBLNO + " 收货人不能为空"; - } - else - { - if (StringIsChinese(bill.CONSIGNEE)) - { - error = error + "
提单号:" + bill.MBLNO + " 收货人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", bill.CONSIGNEE, 35, bill.MBLNO, "收货人", 5, "--", false); - } - else - { - error += formatlengthError("txt", bill.CONSIGNEE, 35, bill.MBLNO, "收货人", 5, "**", false); - } - } - } - } - - if (isbill == 1) - { - if (OpBill.CONSIGNEE == "") - { - error = error + "
提单号:" + bill.MBLNO + " 分单收货人不能为空"; - } - else - { - if (StringIsChinese(OpBill.CONSIGNEE)) - { - error = error + "
提单号:" + bill.MBLNO + " 分单收货人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", OpBill.CONSIGNEE, 35, bill.MBLNO, "分单收货人", 5, "--", false); - } - else - { - error += formatlengthError("txt", OpBill.CONSIGNEE, 35, bill.MBLNO, "分单收货人", 5, "**", false); - } - } - } - } - #endregion - - #region 通知人NOTIFYPARTY - if (billams.BYCOUNTRY != "") - { - if (billams.AMSNOTIFYPARTY == "") - { - error = error + "
提单号:" + bill.MBLNO + " AMS通知人不能为空"; - } - else - { - if (StringIsChinese(billams.AMSNOTIFYPARTY)) - { - error = error + "
提单号:" + bill.MBLNO + " AMS通知人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", billams.AMSNOTIFYPARTY, 35, bill.MBLNO, "AMS通知人", 5, "---", false); - } - else - { - error += formatlengthError("txt", billams.AMSNOTIFYPARTY, 35, bill.MBLNO, "AMS通知人", 5, "***", false); - } - } - } - } - else - { - - if (bill.NOTIFYPARTY == "") - { - error = error + "
提单号:" + bill.MBLNO + " 通知人不能为空"; - } - else - { - if (StringIsChinese(bill.NOTIFYPARTY)) - { - error = error + "
提单号:" + bill.MBLNO + " 通知人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", bill.NOTIFYPARTY, 35, bill.MBLNO, "通知人", 5, "---", false); - } - else - { - error += formatlengthError("txt", bill.NOTIFYPARTY, 35, bill.MBLNO, "通知人", 5, "***", false); - } - } - } - } - - if (isbill == 1) - { - if (OpBill.NOTIFYPARTY == "") - { - error = error + "
提单号:" + bill.MBLNO + " 分单通知人不能为空"; - } - else - { - if (StringIsChinese(OpBill.NOTIFYPARTY)) - { - error = error + "
提单号:" + bill.MBLNO + " 分单通知人含有中文或双字节字符"; - } - else - { - if (carrier == "HLCU") - { - error += formatlengthError("txt", OpBill.NOTIFYPARTY, 35, bill.MBLNO, "分单通知人", 5, "---", false); - } - else - { - error += formatlengthError("txt", OpBill.NOTIFYPARTY, 35, bill.MBLNO, "分单通知人", 5, "***", false); - } - } - } - } - #endregion - - #region 代理AGENT - //if (filetype == "E") - //{ - // if (bill.AGENT == "") - // { - // error = error + "
提单号:" + bill.MBLNO + " 代理不能为空"; - // } - // else - // { - // if (StringIsChinese(bill.AGENT)) - // { - // error = error + "
提单号:" + bill.MBLNO + " 代理含有中文或双字节字符"; - // } - // else - // { - // if (carrier == "HLCU") - // { - // error += formatlengthError("txt", bill.AGENT, 35, bill.MBLNO, "代理", 5, "----"); - // } - // else - // { - // error += formatlengthError("txt", bill.AGENT, 35, bill.MBLNO, "代理", 5, "****"); - // } - // } - // } - //} - #endregion - - #region 运输条款 - if (bill.SERVICE == "CY-DOOR") - { - if (billams.DOORADDR == "") - { - error = error + "
提单号:" + bill.MBLNO + " 运输条款为:CY-DOOR,EDI信息中的DOOR地址不能为空"; - } - else - if (StringIsChinese(billams.DOORADDR)) - { - error = error + "
提单号:" + bill.MBLNO + " DOOR地址含有中文或双字节字符"; - } - - } - if (bill.SERVICE == "DOOR-CY") - { - if (billams.ATTNADDR == "") - { - error = error + "
提单号:" + bill.MBLNO + " 运输条款为:DOOR-CY,EDI信息中的联系人地址不能为空"; - } - else - if (StringIsChinese(billams.ATTNADDR)) - { - error = error + "
提单号:" + bill.MBLNO + " 联系人地址含有中文或双字节字符"; - } - } - #endregion - - #region 唛头 - if (isbill == 1) - { - if (OpBill.MARKS == "") - { - error = error + "
提单号:" + OpBill.MBLNO + "分票唛头不能为空"; - } - else - { - if (StringIsChinese(OpBill.MARKS)) - { - error = error + "
提单号:" + OpBill.MBLNO + "分票唛头含有中文或双字节字符"; - } - else - { - error += formatlengthError("txt", OpBill.MARKS, 35, bill.MBLNO, "分票唛头", 0, "", false); - } - } - } - else - { - if (bill.MARKS == "") - { - error = error + "
提单号:" + bill.MBLNO + " 唛头不能为空"; - } - else - { - if (StringIsChinese(bill.MARKS)) - { - error = error + "
提单号:" + bill.MBLNO + " 唛头含有中文或双字节字符"; - } - else - { - error += formatlengthError("txt", bill.MARKS, 35, bill.MBLNO, "唛头", 0, "", false); - } - } - } - #endregion - - #region 货物描述 - if (isbill == 1) - { - if (OpBill.DESCRIPTION == "") - { - error = error + "
提单号:" + bill.MBLNO + " 分票货物描述不能为空"; - } - else - { - if (StringIsChinese(OpBill.DESCRIPTION)) - { - error = error + "
提单号:" + bill.MBLNO + " 分票货物描述含有中文或双字节字符"; - } - else - { - error += formatlengthError("txt", OpBill.DESCRIPTION, 35, bill.MBLNO, "分票货物描述", 0, "", false); - } - } - } - else - { - if (bill.DESCRIPTION == "") - { - error = error + "
提单号:" + bill.MBLNO + " 货物描述不能为空"; - } - else - { - if (StringIsChinese(bill.DESCRIPTION)) - { - error = error + "
提单号:" + bill.MBLNO + " 货物描述含有中文或双字节字符"; - } - else - { - error += formatlengthError("txt", bill.DESCRIPTION, 35, bill.MBLNO, "货物描述", 0, "", true); - } - } - } - #endregion - - #region 港口 - if (GetPortEDICode(bill.PORTLOADID, "MAERSK") == "") - { error = error + "
提单号:" + bill.MBLNO + " 装货港代码不能为空"; } - - if (bill.PORTLOAD == null || bill.PORTLOAD == "") - { error = error + "
提单号:" + bill.MBLNO + " 装货港不能为空"; } - - if (bill.ETD == null || bill.ETD == "") - { - error = error + "
提单号:" + bill.MBLNO + " 开船日期不能为空"; - return error; - } - if (GetPortEDICode(bill.PORTDISCHARGEID, "MAERSK") == "") - { error = error + "
提单号:" + bill.MBLNO + " 卸货港代码不能为空"; } - - if (bill.PORTDISCHARGE == null || bill.PORTDISCHARGE == "") - { error = error + "
提单号:" + bill.MBLNO + " 卸货港不能为空"; } - #endregion - - #region 包装、件重尺 - if (isbill != 1) - { - //if (GetPackageEDICode(bill.KINDPKGS) == "") { error = error + "
提单号:" + bill.MBLNO + " 包装EDI代码不能为空"; } - if (GetPackageEDICode(bill.KINDPKGS, "MAERSK").Trim() == "") { error = error + "
提单号:" + bill.MBLNO + " 包装EDI代码不能为空"; } - } - else - { - //if (GetPackageEDICode(OpBill.KINDPKGS) == "") { error = error + "
提单号:" + OpBill.MBLNO + "分票包装EDI代码不能为空"; } - if (GetPackageEDICode(OpBill.KINDPKGS, "MAERSK").Trim() == "") { error = error + "
提单号:" + OpBill.MBLNO + "分票包装EDI代码不能为空"; } - } - - if (isbill != 1) - { - if (bill.PKGS == "0") - { error = error + "
提单号:" + bill.MBLNO + " 货物件数不能为空"; } - if (bill.KGS == "0") - { error = error + "
提单号:" + bill.MBLNO + " 货物重量不能为空"; } - if (bill.CBM == "0") - { error = error + "
提单号:" + bill.MBLNO + " 货物尺码不能为空"; } - } - else - { - if (OpBill.PKGS == 0) - { error = error + "
提单号:" + bill.MBLNO + " 分票货物件数不能为空"; } - if (OpBill.KGS == 0) - { error = error + "
提单号:" + bill.MBLNO + " 分票货物重量不能为空"; } - if (OpBill.CBM == 0) - { error = error + "
提单号:" + bill.MBLNO + " 分票货物尺码不能为空"; } - } - #endregion - - #region 货物标示、危险品 - if (bill.CARGOID == null || bill.CARGOID == "") - { error = error + "
提单号:" + bill.MBLNO + " 货物标示不能为空"; } - - if (bill.CARGOID == "D") - { - if (bill.DCLASS == null || bill.DCLASS == "") - { error = error + "
提单号:" + bill.MBLNO + " 危险品分类不能为空"; } - - if (bill.DUNNO == null || bill.DUNNO == "") - { error = error + "
提单号:" + bill.MBLNO + " 危险品编号不能为空"; } - } - if (bill.CARGOID == "R") - { - if (bill.TEMPSET == null || bill.TEMPSET == "") - { error = error + "
提单号:" + bill.MBLNO + " 设置温度不能为空"; } - } - #endregion - - #region 付款方式、地点、运输条款、运费协议号 - if (bill.BLFRT.IndexOf("PREPAID") >= 0) - { - if (bill.PREPARDATID == "") - { error = error + "
提单号:" + bill.MBLNO + " 预付地点或预付地点EDI代码不能为空"; } - } - - if (bill.BLFRT.IndexOf("COLLECT") >= 0) - { - if (bill.PREPARDATID == "") - { error = error + "
提单号:" + bill.MBLNO + " 到付地点或到付地点EDI代码不能为空"; } - } - - if (filetype == "E") - { - if (GetPortEDICode(bill.ISSUEPLACE, "MAERSK") == "") - { error = error + "
提单号:" + bill.MBLNO + " 签单地点或到签单地点EDI代码不能为空"; } - } - - if ((bill.SERVICE == null || bill.SERVICE == "")) - { error = error + "
提单号:" + bill.MBLNO + " 运输条款不能为空"; } - - - if ((bill.CONTRACTNO == null || bill.CONTRACTNO == "")) - { error = error + "
提单号:" + bill.MBLNO + " 运费协议号不能为空"; } - #endregion - - if (filetype == "E") - { - #region 集装箱判断检查 - var bsno = ""; - if (isbill != 1) - bsno = bill.BSNO; - else - bsno = OpBill.AS_ID; - // - string sCtnCntrno = ""; - int iCTN = 0; - int iCTNDetail = 0; - var ctnlist = MsOpSeaeDAL.MsOpSeaeDAL.GetBodyList("BSNO='" + bsno + "'"); - if (ctnlist.Count == 0) { error = error + "
提单号:" + bill.MBLNO + " 集装箱信息不能为空"; } - else - { - Decimal dlPKGS = 0; - Decimal dlKGS = 0; - Decimal dlCBM = 0; - foreach (var ctn in ctnlist) - { - if ((ctn.CTNALL.IndexOf("RH") > 0 || ctn.CTNALL.IndexOf("RF") > 0) && (bill.CARGOID != "R")) - { - { error = error + "
提单号:" + bill.MBLNO + " 集装箱箱型为冻柜,货类代码请选择冻柜"; } - } - - if (GetCtnEDICode(ctn.CTNALL, "HANJIN") == "") - { error = error + "
提单号:" + bill.MBLNO + " 集装箱箱型EDI代码不能为空"; } - - if (ctn.CNTRNO == null || ctn.CNTRNO == "") - { error = error + "
提单号:" + bill.MBLNO + " 箱号不能为空"; } - - if (ctn.KINDPKGS != bill.KINDPKGS) - { error = error + "
提单号:" + bill.MBLNO + " 中的包装类型与集装箱的包装类型不同"; } - - //是否有分箱 - var OpCtnDetailList = MsOpSeaeDAL.MsOpSeaeDAL.GetOpCtnDetailList("[CTN_ID]='" + ctn.CTN_ID.ToString() + "'"); - if (OpCtnDetailList.Count > 0) - { - iCTNDetail++; - } - else - { - sCtnCntrno += "、" + ctn.CNTRNO; - } - iCTN++; - // - dlPKGS += ctn.PKGS; - dlKGS += ctn.KGS; - dlCBM += ctn.CBM; - } - - if (dlPKGS != Convert.ToInt32(bill.PKGS)) - { error = error + "
提单号:" + bill.MBLNO + " 集装箱件数合计数必须等于委托单总件数"; } - if (dlKGS != Convert.ToDecimal(bill.KGS)) - { error = error + "
提单号:" + bill.MBLNO + " 集装箱重量合计数必须等于委托单总重量数"; } - if (dlCBM != Convert.ToDecimal(bill.CBM)) - { error = error + "
提单号:" + bill.MBLNO + " 集装箱尺码合计数必须等于委托单总尺码数"; } - } - - //有分箱 - if (iCTNDetail > 0) - { - if (iCTNDetail != iCTN) - { - error = error + "
提单号:" + bill.MBLNO + "的“" + sCtnCntrno.Substring(1) + "”等箱号未添加分箱明细!"; - } - var OpCtnDetailList = MsOpSeaeDAL.MsOpSeaeDAL.GetOpCtnDetailList("[CTN_ID] in (select [CTN_ID] from op_ctn where BSNO='" + bsno + "')"); - foreach (var ctnDetail in OpCtnDetailList) - { - if (ctnDetail.HSCODE == null || ctnDetail.HSCODE == "") - { - if (error.IndexOf(ctnDetail.CNTRNO + "”箱号的分箱HS编码不能为空!") < 0) - { - error = error + "
提单号:" + bill.MBLNO + "的“" + ctnDetail.CNTRNO + "”箱号的分箱HS编码不能为空!"; - } - } - - if (ctnDetail.DESCRIPTION == null || ctnDetail.DESCRIPTION == "") - { - error += "
提单号:" + bill.MBLNO + "的“" + ctnDetail.CNTRNO + "”箱号的分箱货描不能为空!"; - } - else - { - error += formatlengthError("txt", ctnDetail.DESCRIPTION, 70, bill.MBLNO, "的“" + ctnDetail.CNTRNO + "”箱号的分箱货物描述", 0, "", false); - } - - if (ctnDetail.KINDPKGS != bill.KINDPKGS) - { error = error + "
提单号:" + bill.MBLNO + " 中的包装类型与集装箱分箱的包装类型不同"; } - } - // - string slSQL = "SELECT * from (SELECT c.CTN_ID,c.CNTRNO,c.PKGS,c.KGS,c.CBM,isnull(sum(d.PKGS),0) as PKGS_d,isnull(sum(d.KGS),0) as KGS_d,isnull(sum(d.CBM),0) as CBM_d from op_ctn as c INNER JOIN op_ctn_detail as d on c.CTN_ID=d.CTN_ID where c.BSNO='" + bill.BSNO + "' GROUP BY c.CTN_ID,c.CNTRNO,c.PKGS,c.KGS,c.CBM) as a where PKGS<>PKGS_d or KGS<>KGS_d or CBM<>CBM_d"; - DataSet dsOpCtnDetail = T_ALL_DA.GetAllSQL(slSQL); - if (dsOpCtnDetail != null) - { - if (dsOpCtnDetail.Tables[0].Rows.Count > 0) - { - for (int i = 0; i < dsOpCtnDetail.Tables[0].Rows.Count; i++) - { - error = error + "
提单号:" + bill.MBLNO + "的“" + dsOpCtnDetail.Tables[0].Rows[i]["CNTRNO"].ToString() + "”箱号的件(" + dsOpCtnDetail.Tables[0].Rows[i]["PKGS"].ToString() + ")、重(" + dsOpCtnDetail.Tables[0].Rows[i]["KGS"].ToString() + ")、尺(" + dsOpCtnDetail.Tables[0].Rows[i]["CBM"].ToString() + ")不等于其分箱件(" + dsOpCtnDetail.Tables[0].Rows[i]["PKGS_d"].ToString() + ")、重(" + dsOpCtnDetail.Tables[0].Rows[i]["KGS_d"].ToString() + ")、尺(" + dsOpCtnDetail.Tables[0].Rows[i]["CBM_d"].ToString() + ")的合计数!"; - } - } - } - } - #endregion - - #region 其他信息 - if (billams.BYCOUNTRY == "USA") - { - if (billams.CONSIGNEEPOSTCODE == null || billams.CONSIGNEEPOSTCODE == "") - { error = error + "
提单号:" + bill.MBLNO + " 收货人邮编不能为空"; } - if (billams.NOTIFYPARTYPOSTCODE == null || billams.NOTIFYPARTYPOSTCODE == "") - { error = error + "
提单号:" + bill.MBLNO + " 通知人邮编不能为空"; } - } - else if (billams.BYCOUNTRY == "CANADA") - { - if (billams.CONSIGNEEPOSTCODE == null || billams.CONSIGNEEPOSTCODE == "") - { error = error + "
提单号:" + bill.MBLNO + " 收货人邮编不能为空"; } - } - else if (billams.BYCOUNTRY == "BRAZIL") - { - if (billams.CONSIGNEECOUNTRY == null || billams.CONSIGNEECOUNTRY == "") - { error = error + "
提单号:" + bill.MBLNO + " 收货人国家代码不能为空"; } - if (billams.CONSIGNEETAXNO == null || billams.CONSIGNEETAXNO == "") - { error = error + "
提单号:" + bill.MBLNO + " 收货人税号不能为空"; } - if (billams.NOTIFYPARTYCOUNTRY == null || billams.NOTIFYPARTYCOUNTRY == "") - { error = error + "
提单号:" + bill.MBLNO + " 通知人国家代码不能为空"; } - if (billams.NOTIFYPARTYTAXNO == null || billams.NOTIFYPARTYTAXNO == "") - { error = error + "
提单号:" + bill.MBLNO + " 通知人税号不能为空"; } - if (billams.GOODSNCM == null || billams.GOODSNCM == "") - { error = error + "
提单号:" + bill.MBLNO + " 货物NCM编码不能为空"; } - - } - #endregion - } - } - return error; - } - #endregion - - #region 订舱 - public static string CreateEdiMAERSK(List headData, string usercode, string path, string mblno, string filerole, CodeFtpSet ftpset, int isbill, string carrier, string filetype) - { - string filename = path + "\\" + mblno + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt"; - if (System.IO.File.Exists(filename)) - { - System.IO.File.Delete(filename); - } - FileStream f = new FileStream(filename, FileMode.Create); - StreamWriter r = new StreamWriter(f, Encoding.Default); - - var icount = 0; - var bsno = ""; - var OpBill = new MsOpSeaeBill(); - r.WriteLine("UNB+UNOA:1+" + ftpset.SENDCODE + ":ZZZ+" + ftpset.RECEIVECODE + ":ZZZ+" + DateTime.Now.ToString("yyMMdd:HHmm") + "+" + headData[0].CUSTNO + "'"); - icount++; - foreach (var bill in headData) - { - T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); - DataSet dsUserOp = T_ALL_DA.GetAllSQL("select top 1 * from [user] as u INNER JOIN user_baseinfo as b on u.GID=b.USERID where [SHOWNAME]='" + bill.OP.ToString() + "'"); - // - bsno = bill.CUSTNO; - if (isbill == 1) - { - OpBill = MsOpSeaeDAL.MsOpSeaeDAL.GetBillData("BSNO='" + bill.BSNO + "'"); - } - - #region 基本 - - - r.WriteLine("UNH+" + bill.CUSTNO + "+IFTMBF:D:99B:UN'"); - icount++; - - if (isbill != 1) - { - r.WriteLine("BGM+335+" + bill.MBLNO + "+" + filerole + "'"); - } - else - { - r.WriteLine("BGM+335+" + OpBill.MBLNO + "+" + filerole + "'"); - } - icount++; - if (ftpset.SENDATTN != "") - { - r.WriteLine("CTA+IC+:" + ftpset.SENDATTN + "'"); - icount++; - } - if (ftpset.SENDTEL != "") - { - r.WriteLine("COM+" + ftpset.SENDTEL + ":TE'"); - icount++; - } - if (ftpset.SENDEMAIL != "") - { - r.WriteLine("COM+" + ftpset.SENDEMAIL + ":EM'"); - icount++; - } - - r.WriteLine("DTM+137:" + DateTime.Now.ToString("yyyyMMddHHmm") + ":203'"); - icount++; - #endregion - - #region 运输条款 - if (bill.SERVICE.ToUpper() == "DOOR-DOOR") - { - r.WriteLine("TSR+27+2'"); - } - else if (bill.SERVICE.ToUpper() == "DOOR-CY") - { - r.WriteLine("TSR+28+2'"); - } - else if (bill.SERVICE.ToUpper() == "CY-DOOR") - { - r.WriteLine("TSR+29+2'"); - } - else if (bill.SERVICE.ToUpper() == "CY-CY") - { - r.WriteLine("TSR+30+2'"); - } - else - { - r.WriteLine("TSR+30+2'"); - } - icount++; - #endregion - - #region 付款方式、地址 - var str_pay = ""; - if (bill.BLFRT.IndexOf("PREPAID") >= 0) - str_pay = bill.PREPARDAT; - if (bill.BLFRT.IndexOf("COLLECT") >= 0) - str_pay = bill.PAYABLEAT; - - if (isbill != 1) - { - r.WriteLine("FTX+AAI+++" + bill.BLFRT + " Payable at " + str_pay + " " + bill.SERVICE + " " + bill.PKGS + bill.KINDPKGS + " " + formatEdiStr("txt", bill.EDIREMARK.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ")) + "'"); - } - else - { - r.WriteLine("FTX+AAI+++" + bill.BLFRT + " Payable at " + str_pay + " " + OpBill.SERVICE + " " + OpBill.PKGS + OpBill.KINDPKGS + " " + formatEdiStr("txt", bill.EDIREMARK.Replace("\r\n", " ").Replace("\n", " ").Replace("\r", " ")) + "'"); - } - icount++; - #endregion - - #region 各种单号、付款方式代码 - - r.WriteLine("RFF+BN:" + bill.MBLNO + "'"); - - //icount++; - - - - r.WriteLine("RFF+CT:" + formatEdiStr("txt", bill.CONTRACTNO) + "'"); - icount++; - - - #endregion - - #region 船信息、港口地址 - var voyno = ""; - if (bill.VOYNO.IndexOf(".") >= 0) - voyno = bill.VOYNO.Substring(bill.VOYNO.IndexOf(".") + 1, bill.VOYNO.Length - bill.VOYNO.IndexOf(".")-1); - else - voyno = bill.VOYNO; - - r.WriteLine("TDT+20+" + voyno + "+1++" + carrier + "+++:::" + bill.VESSEL + "'"); - r.WriteLine("LOC+9+" + GetPortEDICode(bill.PORTLOADID, "MAERSK") + ":139:6:" + bill.PORTLOAD + "'"); - r.WriteLine("LOC+88+" + GetPortEDICode(bill.PORTLOADID, "MAERSK") + ":139:6:" + bill.PORTLOAD + "'"); - r.WriteLine("DTM+133:" + GetDateStr(bill.ETD, "yyyyMMdd") + ":102'");//yyyyMMddHHmm - r.WriteLine("LOC+11+" + GetPortEDICode(bill.PORTDISCHARGEID, "MAERSK") + ":139:6:" + bill.PORTDISCHARGE + "'"); - icount = icount + 5; - - if (bill.DESTINATION != "") - { - r.WriteLine("LOC+7+" + GetPortEDICode(bill.DESTINATIONID, "MAERSK") + ":139:6:" + bill.DESTINATION + "'"); - icount++; - } - #endregion - - - if (ftpset.SENDNAME.Length > 35) - r.WriteLine("NAD+BA+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME.Substring(0, 35) + "+" + ftpset.SENDNAME.Substring(35) + "'"); - else - r.WriteLine("NAD+BA+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME + "'"); - icount++; - - //r.WriteLine("CTA+IC+:" + billams.ATTN + "'"); - //r.WriteLine("COM+" + billams.ATTNTEL + ":TE'"); - //r.WriteLine("COM+" + billams.ATTNEMAIL + ":EM'"); - if (dsUserOp != null) - { - if (dsUserOp.Tables[0].Rows.Count > 0) - { - - r.WriteLine("CTA+IC+:" + dsUserOp.Tables[0].Rows[0]["USERNAME"].ToString().Trim() + "'"); - r.WriteLine("COM+" + dsUserOp.Tables[0].Rows[0]["OFFICEPHONE"].ToString().Trim() + ":TE'"); - r.WriteLine("COM+" + ftpset.SENDEMAIL+ ":EM'"); - icount = icount + 3; - } - } - - - #region 发货人 - var billams = GetAmsData("BSNO='" + bill.BSNO + "'"); - var Shipping = ""; - var DescriptionShipper = ""; - if (isbill != 1) - { - if (billams.BYCOUNTRY != "") - Shipping = formatEdiStr("txt", billams.AMSSHIPPER); - else - Shipping = formatEdiStr("txt", bill.SHIPPER); - } - else Shipping = formatEdiStr("txt", OpBill.SHIPPER); - List ShippingList = formatlengthStr(Shipping, 35); - if (ShippingList.Count != 0 && Shipping.Length > 0) - { - for (var i = 0; i < ShippingList.Count; i++) - { - if (i == 0) Shipping = "NAD+CZ+++" + ShippingList[0] + "+"; - if (i == 1) Shipping = Shipping + ShippingList[i]; - if (i == 2 || i == 3) Shipping = Shipping + ":" + ShippingList[i]; - if (i >= 4 && ShippingList.Count > 5) - { - if (i == 4) - { - if (ShippingList[i].Length > 34) - { - Shipping = Shipping + ":" + ShippingList[i].Substring(0, 34); - DescriptionShipper = ShippingList[i].Substring(34); - } - else - Shipping = Shipping + ":" + ShippingList[i]; - Shipping = Shipping + "*"; - DescriptionShipper = "*" + DescriptionShipper; - } - else if (i > 4) - { - DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; - } - } - else - if (i == 4) Shipping = Shipping + ":" + ShippingList[i]; - } - } - r.WriteLine(Shipping + "'"); - icount++; - #endregion - - #region 收货人 - if (isbill != 1) - { - if (billams.BYCOUNTRY != "") - Shipping = formatEdiStr("txt", billams.AMSCONSIGNEE); - else - Shipping = formatEdiStr("txt", bill.CONSIGNEE); - } - else Shipping = formatEdiStr("txt", OpBill.CONSIGNEE); - ShippingList = formatlengthStr(Shipping, 35); - var DescriptionConsignee = ""; - if (ShippingList.Count != 0 && Shipping.Length > 0) - { - for (var i = 0; i < ShippingList.Count; i++) - { - if (i == 0) Shipping = "NAD+CN+++" + ShippingList[0] + "+"; - if (i == 1) Shipping = Shipping + ShippingList[i]; - if (i == 2 || i == 3) Shipping = Shipping + ":" + ShippingList[i]; - if (i >= 4 && ShippingList.Count > 5) - { - if (i == 4) - { - if (ShippingList[i].Length > 33) - { - Shipping = Shipping + ":" + ShippingList[i].Substring(0, 33); - DescriptionConsignee = ShippingList[i].Substring(33); - } - else - Shipping = Shipping + ":" + ShippingList[i]; - Shipping = Shipping + "**"; - DescriptionConsignee = "**" + DescriptionConsignee; - } - else if (i > 4) - { - DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; - } - } - else - if (i == 4) Shipping = Shipping + ":" + ShippingList[i]; - } - } - if (billams.BYCOUNTRY == "USA") - { - Shipping = Shipping + "+++" + billams.CONSIGNEEPOSTCODE; - r.WriteLine(Shipping + "'"); - } - else if (billams.BYCOUNTRY == "CANADA") - { - Shipping = Shipping + "+++" + billams.CONSIGNEEPOSTCODE + "+CA"; - r.WriteLine(Shipping + "'"); - } - else if (billams.BYCOUNTRY == "BRAZIL") - { - Shipping = Shipping + "++++" + billams.CONSIGNEECOUNTRY; - r.WriteLine(Shipping + "'"); - r.WriteLine("RFF+GN:" + billams.CONSIGNEETAXNO + "'"); - icount = icount + 1; - } - else { r.WriteLine(Shipping + "'"); } - icount++; - #endregion - - #region 通知人 - if (isbill != 1) - { - if (billams.BYCOUNTRY != "") - Shipping = formatEdiStr("txt", billams.AMSNOTIFYPARTY); - else - Shipping = formatEdiStr("txt", bill.NOTIFYPARTY); - } - else Shipping = formatEdiStr("txt", OpBill.NOTIFYPARTY); - ShippingList = formatlengthStr(Shipping, 35); - var DescriptionNotifyparty = ""; - if (ShippingList.Count != 0 && Shipping.Length > 0) - { - for (var i = 0; i < ShippingList.Count; i++) - { - if (i == 0) Shipping = "NAD+NI+++" + ShippingList[0] + "+"; - if (i == 1) Shipping = Shipping + ShippingList[i]; - if (i == 2 || i == 3) Shipping = Shipping + ":" + ShippingList[i]; - if (i >= 4 && ShippingList.Count > 5) - { - if (i == 4) - { - if (ShippingList[i].Length > 32) - { - Shipping = Shipping + ":" + ShippingList[i].Substring(0, 32); - DescriptionNotifyparty = ShippingList[i].Substring(32); - } - else - { - Shipping = Shipping + ":" + ShippingList[i]; - } - Shipping = Shipping + "***"; - DescriptionNotifyparty = "***" + DescriptionNotifyparty; - } - else if (i > 4) - { - DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; - } - } - else - if (i == 4) Shipping = Shipping + ":" + ShippingList[i]; - } - } - - if (billams.BYCOUNTRY == "USA") - { - Shipping = Shipping + "+++" + billams.NOTIFYPARTYPOSTCODE; - r.WriteLine(Shipping + "'"); - } - else if (billams.BYCOUNTRY == "BRAZIL") - { - if (billams.NOTIFYPARTYCOUNTRY != "") - Shipping = Shipping + "++++" + billams.NOTIFYPARTYCOUNTRY; - r.WriteLine(Shipping + "'"); - if (billams.NOTIFYPARTYTAXNO != "") - { - r.WriteLine("RFF+GN:" + billams.NOTIFYPARTYTAXNO + "'"); - icount = icount + 1; - } - } - else - { - r.WriteLine(Shipping + "'"); - } - icount++; - #endregion - - #region 运输条款、发送方 - if (bill.SERVICE == "DOOR-DOOR" || bill.SERVICE == "DOOR-CY" || bill.SERVICE == "CY-DOOR") - { - r.WriteLine("CTA+IC+:" + billams.ATTN + "'"); - r.WriteLine("COM+" + billams.ATTNTEL + ":TE'"); - r.WriteLine("COM+" + billams.ATTNEMAIL + ":EM'"); - icount = icount + 3; - } - - if (ftpset.SENDNAME.Length > 35) - r.WriteLine("NAD+FW+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME.Substring(0, 35) + "+" + ftpset.SENDNAME.Substring(35) + "'"); - else - r.WriteLine("NAD+FW+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME + "'"); - icount++; - - if (ftpset.SENDNAME.Length > 35) - r.WriteLine("NAD+FC+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME.Substring(0, 35) + "+" + ftpset.SENDNAME.Substring(35) + "'"); - else - r.WriteLine("NAD+FC+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME + "'"); - icount++; - - #endregion - - if (bill.BLFRT.IndexOf("PREPAID") >= 0) - r.WriteLine("CPI+4++P'"); - else - r.WriteLine("CPI+4++C'"); - icount++; - - - #region 总件数//订舱不需要分箱明细 - if (isbill != 1) - { - r.WriteLine("GID+1+" + bill.PKGS.ToString() + ":" + GetPackageEDICode(bill.KINDPKGS, "MAERSK").Trim() + "::6:" + bill.KINDPKGS + "'"); - } - else - { - r.WriteLine("GID+1+" + OpBill.PKGS.ToString() + ":" + GetPackageEDICode(OpBill.KINDPKGS, "MAERSK").Trim() + "::6:" + OpBill.KINDPKGS + "'"); - } - icount++; - #endregion - - #region 货物描述 - if (isbill != 1) - { - Shipping = formatEdiStr("txt", bill.DESCRIPTION); - } - else Shipping = formatEdiStr("txt", OpBill.DESCRIPTION); - Shipping = Shipping.Replace("\n", "\\"); - Shipping = Shipping.Replace("\r", " "); - string[] DescriptionList = Shipping.Split('\\'); - if (DescriptionList.Length != 0) - { - for (var i = 0; i < DescriptionList.Length; i++) - { - if (DescriptionList[i] != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionList[i] + "'"); - icount++; - } - } - } - if (DescriptionShipper != "") - { - if (DescriptionShipper != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionShipper + "'"); - icount++; - } - } - if (DescriptionConsignee != "") - { - if (DescriptionConsignee != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionConsignee + "'"); - icount++; - } - } - if (DescriptionNotifyparty != "") - { - if (DescriptionNotifyparty != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty + "'"); - icount++; - } - } - //if (bill.CARGOID == "R") - //{ - // r.WriteLine("PCD+52:"+bill.TEMPSET+"'"); - // icount++; - //} - #endregion - - #region 重量、尺码 - if (isbill != 1) - { - r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(Convert.ToDecimal(bill.KGS), 3) + "'"); - r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(Convert.ToDecimal(bill.CBM), 3) + "'"); - } - else - { - r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(OpBill.KGS, 3) + "'"); - r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(OpBill.CBM, 3) + "'"); - } - icount = icount + 2; - #endregion - - #region 唛头 - - //if (isbill != 1) - //{ - // Shipping = formatEdiStr("txt", bill.MARKS); - //} - //else Shipping = formatEdiStr("txt", OpBill.MARKS); - //Shipping = Shipping.Replace("\n", "\\"); - //Shipping = Shipping.Replace("\r", " "); - //string[] MarksList = Shipping.Split('\\'); - //if (MarksList.Length != 0) - //{ - // for (var i = 0; i < MarksList.Length; i++) - // { - // r.WriteLine("PCI++" + MarksList[i] + "'"); - // icount++; - // } - //} - #endregion - - #region 危险品 - if (bill.CARGOID == "D") - { - r.WriteLine("DGS+IMD+" + bill.DCLASS + "+" + bill.DUNNO + "'"); - r.WriteLine("CTA+HG+:" + billams.ATTN + "'"); - r.WriteLine("COM+" + billams.ATTNTEL + ":TE'"); - icount = icount + 3; - } - #endregion - - #region 集装箱 - if (isbill != 1) - { - Shipping = bill.BSNO; - } - else Shipping = OpBill.AS_ID; - var ctnsumlist = GetCtnSum("BSNO='" + Shipping + "'"); - foreach (var ctn in ctnsumlist) - { - if (ctn.CNTRSOURCE == "SOC") - r.WriteLine("EQD+CN++" + GetCtnEDICode(ctn.CTNALL, "MAERSK") + "+1'"); - else - r.WriteLine("EQD+CN++" + GetCtnEDICode(ctn.CTNALL, "MAERSK") + "+2'"); - r.WriteLine("EQN+" + ctn.CTNNUM.ToString() + "'"); - icount = icount + 2; - - if (bill.CARGOID == "R") - { - if (bill.REEFERF != "") - { - r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'"); - icount++; - } - r.WriteLine("TMP+2+" + bill.TEMPSET + ":CEL'"); - icount++; - } - } - #endregion - } - r.WriteLine("UNT+" + icount.ToString() + "+" + bsno + "'"); - r.WriteLine("UNZ+" + headData.Count.ToString() + "+" + bsno + "'"); - r.Close(); - f.Close(); - return filename; - } - #endregion - - #region 确认 - public static string CreateEdiMAERSKSI(List headData, string usercode, string path, string mblno, string filerole, CodeFtpSet ftpset, int isbill, string carrier, string filetype) - { - string filename = path + "\\" + mblno + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt"; - if (System.IO.File.Exists(filename)) - { - System.IO.File.Delete(filename); - } - FileStream f = new FileStream(filename, FileMode.Create); - StreamWriter r = new StreamWriter(f, Encoding.Default); - - var icount = 0; - var OpBill = new MsOpSeaeBill(); - var bsno = ""; - foreach (var bill in headData) - { - T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); - DataSet dsUserOp = T_ALL_DA.GetAllSQL("select top 1 * from [user] as u INNER JOIN user_baseinfo as b on u.GID=b.USERID where [SHOWNAME]='" + bill.OP.ToString() + "'"); - // - bsno = bill.CUSTNO; - var billams = GetAmsData("BSNO='" + bill.BSNO + "'"); - if (isbill == 1) - OpBill = MsOpSeaeDAL.MsOpSeaeDAL.GetBillData("BSNO='" + bill.BSNO + "'"); - - #region 报文头 - r.WriteLine("UNB+UNOA:1+" + ftpset.SENDCODE + ":ZZZ+" + ftpset.RECEIVECODE + ":ZZZ+" + DateTime.Now.ToString("yyMMdd:HHmm") + "+" + bill.CUSTNO + "'"); - r.WriteLine("UNH+" + bill.CUSTNO + "+IFTMIN:D:99B:UN'"); - icount++; - - if (isbill != 1) - { - r.WriteLine("BGM+340+" + bill.MBLNO + "+" + filerole + "'"); - } - else - { - r.WriteLine("BGM+340+" + OpBill.MBLNO + "+" + filerole + "'"); - } - icount++; - - if (ftpset.SENDATTN != "") - { - r.WriteLine("CTA+IC+:" + ftpset.SENDATTN + "'"); - icount++; - } - if (ftpset.SENDTEL != "") - { - r.WriteLine("COM+" + ftpset.SENDTEL + ":TE'"); - icount++; - } - if (ftpset.SENDEMAIL != "") - { - r.WriteLine("COM+" + ftpset.SENDEMAIL + ":EM'"); - icount++; - } - - r.WriteLine("DTM+137:" + DateTime.Now.ToString("yyyyMMddHHmm") + ":203'"); - icount++; - - #endregion - - #region 运输条款 - if (bill.SERVICE.ToUpper() == "DOOR-DOOR") - { - r.WriteLine("TSR+27+2'"); - } - else if (bill.SERVICE.ToUpper() == "DOOR-CY") - { - r.WriteLine("TSR+28+2'"); - } - else if (bill.SERVICE.ToUpper() == "CY-DOOR") - { - r.WriteLine("TSR+29+2'"); - } - else - { - r.WriteLine("TSR+30+2'"); - } - #endregion - - #region edi备注 - var str_pay = ""; - if (bill.BLFRT.IndexOf("PREPAID") >= 0) - str_pay = bill.PREPARDAT; - if (bill.BLFRT.IndexOf("COLLECT") >= 0) - str_pay = bill.PAYABLEAT; - - if (isbill != 1) - { - r.WriteLine("FTX+AAI+++" + bill.BLFRT + " Payable at " + str_pay + " " + bill.SERVICE + " " + bill.PKGS + bill.KINDPKGS + "'"); - } - else - { - r.WriteLine("FTX+AAI+++" + bill.BLFRT + " Payable at " + str_pay + " " + OpBill.SERVICE + " " + OpBill.PKGS + OpBill.KINDPKGS + "'"); - } - icount++; - - var Shipping = ""; - Shipping = formatEdiStr("txt", billams.SIREMARK); - Shipping = Shipping.Replace("\n", "\\"); - Shipping = Shipping.Replace("\r", " "); - string[] EdiRemarkList = Shipping.Split('\\'); - if (EdiRemarkList.Length != 0) - { - for (var i = 0; i < EdiRemarkList.Length; i++) - { - if (EdiRemarkList[i] != "") - { - r.WriteLine("FTX+AAI+++" + EdiRemarkList[i] + "'"); - icount++; - } - } - } - - //if (billams.BYCOUNTRY == "USA") - //{ - // if (billams.SCACCODE != "") - // r.WriteLine("FTX+CCI++MFS+1:US:" + billams.SCACCODE + "'"); - // else - // r.WriteLine("FTX+CCI++MFS+5:US'"); - // icount++; - - //} - //else if (billams.BYCOUNTRY == "CANADA") - //{ - // if (billams.SCACCODE != "") - // r.WriteLine("FTX+CCI++MFS+1:CA:" + billams.SCACCODE + "'"); - // else - // r.WriteLine("FTX+CCI++MFS+5:CA'"); - // icount++; - //} - #endregion - - #region 总 件重尺 - if (isbill != 1) - { - r.WriteLine("CNT+7:" + Math.Round(Convert.ToDecimal(bill.KGS), 3) + ":KGM'"); - r.WriteLine("CNT+11:" + bill.PKGS + "'"); - r.WriteLine("CNT+15:" + Math.Round(Convert.ToDecimal(bill.CBM), 3) + ":MTQ'"); - } - else - { - r.WriteLine("CNT+7:" + Math.Round(OpBill.KGS, 3) + ":KGM'"); - r.WriteLine("CNT+11:" + OpBill.PKGS + "'"); - r.WriteLine("CNT+15:" + Math.Round(OpBill.CBM, 3) + ":MTQ'"); - } - icount = icount + 3; - - //var ctnttllist = GetCtnTTLSum("BSNO='" + bill.BSNO + "'"); - //var ctnttl = ctnttllist[0]; - //r.WriteLine("CNT+16:" + ctnttl.CTNNUM + "'"); - //icount++; - #endregion - - #region 地址地点 - if (bill.BLFRT == "FREIGHT COLLECT") - r.WriteLine("LOC+57+" + bill.PREPARDATID + "::6:" + bill.PAYABLEAT + "'"); - else - r.WriteLine("LOC+57+" + bill.PREPARDATID + "::6:" + bill.PREPARDAT + "'"); - icount++; - - r.WriteLine("LOC+73+" + GetPortEDICode(bill.ISSUEPLACEID, "MAERSK") + "::6:" + bill.ISSUEPLACE + "'"); - icount++; - #endregion - - #region 提单号 - if (isbill != 1) - { - Shipping = formatEdiStr("txt", billams.BSNOLIST); - Shipping = Shipping.Replace("\n", "\\"); - Shipping = Shipping.Replace("\r", " "); - EdiRemarkList = Shipping.Split('\\'); - if (EdiRemarkList.Length != 0 && billams.BSNOLIST != "") - { - for (var i = 0; i < EdiRemarkList.Length; i++) - { - r.WriteLine("RFF+BN:" + EdiRemarkList[i] + "'"); - icount++; - } - } - else - { - if (billams.ORDERNO != "") - r.WriteLine("RFF+BN:" + billams.ORDERNO + "'"); - else - r.WriteLine("RFF+BN:" + bill.MBLNO + "'"); - icount++; - } - } - else - { - r.WriteLine("RFF+BN:" + bill.MBLNO + "'"); - } - - if (isbill != 1) - r.WriteLine("RFF+BM:" + bill.MBLNO + "'"); - else - r.WriteLine("RFF+BM:" + OpBill.MBLNO + "'"); - icount++; - - //r.WriteLine("RFF+CT:" + bill.CONTRACTNO + "'"); - //icount++; - - if (carrier == "UASC") - { - r.WriteLine("RFF+SI:" + bill.CUSTNO + "'"); - icount = icount + 1; - } - if (billams.BYCOUNTRY == "USA") - { - r.WriteLine("REF+TN:" + billams.ITNCODE + "'"); - icount = icount + 1; - } - #endregion - - #region 付费方式 - if (bill.BLFRT.IndexOf("PREPAID") >= 0) - r.WriteLine("CPI+4++P'"); - else if (bill.BLFRT.IndexOf("COLLECT") >= 0) - r.WriteLine("CPI+4++C'"); - else - r.WriteLine("CPI+4++B'"); - icount++; - #endregion - - #region 港口 - var voyno = ""; - if (bill.VOYNO.IndexOf(".") >= 0) - { - voyno = bill.VOYNO.Substring(bill.VOYNO.IndexOf(".") + 1, bill.VOYNO.Length - bill.VOYNO.IndexOf(".")-1); - } - else - { - voyno = bill.VOYNO; - } - r.WriteLine("TDT+20+" + voyno + "+1+++++:::" + bill.VESSEL + "'"); - r.WriteLine("LOC+9+" + GetPortEDICode(bill.PORTLOADID, "MAERSK") + ":139:6:" + bill.PORTLOAD + "'"); - - r.WriteLine("LOC+88+" + GetPortEDICode(bill.PORTLOADID, "MAERSK") + ":139:6:" + bill.PORTLOAD + "'"); - r.WriteLine("LOC+11+" + GetPortEDICode(bill.PORTDISCHARGEID, "MAERSK") + ":139:6:" + bill.PORTDISCHARGE + "'"); - icount = icount + 4; - - if (bill.DESTINATION != "") - { - r.WriteLine("LOC+7+" + GetPortEDICode(bill.DESTINATIONID, "MAERSK") + ":139:6:" + bill.DESTINATION + "'"); - icount++; - } - #endregion - - #region 发货人 - var DescriptionShipper = ""; - if (isbill != 1) - { - if (billams.BYCOUNTRY != "") - Shipping = formatEdiStr("txt", billams.AMSSHIPPER); - else - Shipping = formatEdiStr("txt", bill.SHIPPER); - } - else Shipping = formatEdiStr("txt", OpBill.SHIPPER); - List ShippingList = formatlengthStr(Shipping, 35); - - if (ShippingList.Count != 0 && Shipping.Length > 0) - { - for (var i = 0; i < ShippingList.Count; i++) - { - if (i == 0) Shipping = "NAD+CZ+++" + ShippingList[0] + "+"; - if (i == 1) Shipping = Shipping + ShippingList[i]; - if (i == 2 || i == 3) Shipping = Shipping + ":" + ShippingList[i]; - if (i >= 4 && ShippingList.Count > 5) - { - if (i == 4) - { - if (ShippingList[i].Length > 34) - { - Shipping = Shipping + ":" + ShippingList[i].Substring(0, 34); - DescriptionShipper = ShippingList[i].Substring(34); - } - else - Shipping = Shipping + ":" + ShippingList[i]; - Shipping = Shipping + "*"; - DescriptionShipper = "*" + DescriptionShipper; - } - else if (i > 4) - { - DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; - } - } - else - if (i == 4) Shipping = Shipping + ":" + ShippingList[i]; - } - } - r.WriteLine(Shipping + "'"); - icount = icount + 1; - #endregion - - #region 收货人 - if (isbill != 1) - { - if (billams.BYCOUNTRY != "") - Shipping = formatEdiStr("txt", billams.AMSCONSIGNEE); - else - Shipping = formatEdiStr("txt", bill.CONSIGNEE); - } - else Shipping = formatEdiStr("txt", OpBill.CONSIGNEE); - ShippingList = formatlengthStr(Shipping, 35); - var DescriptionConsignee = ""; - if (ShippingList.Count != 0 && Shipping.Length > 0) - { - for (var i = 0; i < ShippingList.Count; i++) - { - if (i == 0) Shipping = "NAD+CN+++" + ShippingList[0] + "+"; - if (i == 1) Shipping = Shipping + ShippingList[i]; - if (i == 2 || i == 3) Shipping = Shipping + ":" + ShippingList[i]; - if (i >= 4 && ShippingList.Count > 5) - { - if (i == 4) - { - if (ShippingList[i].Length > 33) - { - Shipping = Shipping + ":" + ShippingList[i].Substring(0, 33); - DescriptionConsignee = ShippingList[i].Substring(33); - } - else - Shipping = Shipping + ":" + ShippingList[i]; - Shipping = Shipping + "**"; - DescriptionConsignee = "**" + DescriptionConsignee; - } - else if (i > 4) - { - DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; - } - - } - else - if (i == 4) Shipping = Shipping + ":" + ShippingList[i]; - } - } - - if (billams.BYCOUNTRY == "USA") - { - Shipping = Shipping + "+++" + billams.CONSIGNEEPOSTCODE; - r.WriteLine(Shipping + "'"); - } - else if (billams.BYCOUNTRY == "CANADA") - { - Shipping = Shipping + "+++" + billams.CONSIGNEEPOSTCODE + "+CA"; - r.WriteLine(Shipping + "'"); - } - else if (billams.BYCOUNTRY == "BRAZIL") - { - Shipping = Shipping + "++++" + billams.CONSIGNEECOUNTRY; - r.WriteLine(Shipping + "'"); - r.WriteLine("RFF+GN:" + billams.CONSIGNEETAXNO + "'"); - icount = icount + 1; - - } - else r.WriteLine(Shipping + "'"); - icount++; - #endregion - - //#region 代理 - //Shipping = formatEdiStr("txt", bill.AGENT); - //List AgentList = formatlengthStr(Shipping, 35); - //if (AgentList.Count != 0) - //{ - // for (var i = 0; i < AgentList.Count; i++) - // { - // if (i == 0) Shipping = "NAD+FW+++" + AgentList[0] ; - // if (i == 1) Shipping = Shipping + "+" + AgentList[i]; - // if (i >= 2 && i <= 4) Shipping = Shipping + ":" + AgentList[i]; - // } - //} - //r.WriteLine(Shipping + "'"); - //icount++; - //#endregion - - - if (ftpset.SENDNAME.Length > 35) - r.WriteLine("NAD+FW+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME.Substring(0, 35) + "+" + ftpset.SENDNAME.Substring(35) + "'"); - else - r.WriteLine("NAD+FW+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME + "'"); - icount++; - - - #region 通知人 - if (isbill != 1) - { - if (billams.BYCOUNTRY != "") - Shipping = formatEdiStr("txt", billams.AMSNOTIFYPARTY); - else - Shipping = formatEdiStr("txt", bill.NOTIFYPARTY); - } - else Shipping = formatEdiStr("txt", OpBill.NOTIFYPARTY); - ShippingList = formatlengthStr(Shipping, 35); - var DescriptionNotifyparty = ""; - if (ShippingList.Count != 0 && Shipping.Length > 0) - { - for (var i = 0; i < ShippingList.Count; i++) - { - if (i == 0) Shipping = "NAD+NI+++" + ShippingList[0] + "+"; - if (i == 1) Shipping = Shipping + ShippingList[i]; - if (i == 2 || i == 3) Shipping = Shipping + ":" + ShippingList[i]; - if (i >= 4 && ShippingList.Count > 5) - { - if (i == 4) - { - if (ShippingList[i].Length > 32) - { - Shipping = Shipping + ":" + ShippingList[i].Substring(0, 32); - DescriptionNotifyparty = ShippingList[i].Substring(32); - } - else - Shipping = Shipping + ":" + ShippingList[i]; - Shipping = Shipping + "***"; - DescriptionNotifyparty = "***" + DescriptionNotifyparty; - } - else if (i > 4) - { - DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; - } - } - else - if (i == 4) Shipping = Shipping + ":" + ShippingList[i]; - } - } - - if (billams.BYCOUNTRY == "USA") - { - Shipping = Shipping + "+++" + billams.NOTIFYPARTYPOSTCODE; - r.WriteLine(Shipping + "'"); - } - else if (billams.BYCOUNTRY == "BRAZIL") - { - if (billams.NOTIFYPARTYCOUNTRY != "") - Shipping = Shipping + "++++" + billams.NOTIFYPARTYCOUNTRY; - r.WriteLine(Shipping + "'"); - if (billams.NOTIFYPARTYTAXNO != "") - { - r.WriteLine("RFF+GN:" + billams.NOTIFYPARTYTAXNO + "'"); - icount++; - } - } - else r.WriteLine(Shipping + "'"); - icount++; - #endregion - - #region 承运公司/人 - // r.WriteLine("NAD+CA+" + carrier + ":160:86++" + bill.CARRIER + "'"); - if (ftpset.SENDNAME.Length > 35) - r.WriteLine("NAD+BA+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME.Substring(0, 35) + "+" + ftpset.SENDNAME.Substring(35) + "'"); - else - r.WriteLine("NAD+BA+" + ftpset.SENDCOMPANYCODE + ":160:86++" + ftpset.SENDNAME + "'"); - - //r.WriteLine("CTA+IC+:" + billams.ATTN + "'"); - //r.WriteLine("COM+" + billams.ATTNTEL + ":TE'"); - //r.WriteLine("COM+" + billams.ATTNEMAIL + ":EM'"); - if (dsUserOp != null) - { - if (dsUserOp.Tables[0].Rows.Count > 0) - { - r.WriteLine("CTA+IC+:" + dsUserOp.Tables[0].Rows[0]["USERNAME"].ToString().Trim() + "'"); - r.WriteLine("COM+" + dsUserOp.Tables[0].Rows[0]["OFFICEPHONE"].ToString().Trim() + ":TE'"); - r.WriteLine("COM+" + ftpset.SENDEMAIL + ":EM'"); - - icount = icount + 5; - } - } - #endregion - - #region 签单方式 - if (bill.ISSUETYPE == "正本") - { - r.WriteLine("DOC+706+++" + GetBillNum(bill.NOBILL) + "'"); - icount++; - } - else if (bill.ISSUETYPE == "海运单" || bill.ISSUETYPE == "WAYBILL" || bill.ISSUETYPE == "Seaway" || bill.ISSUETYPE == "SWB正本" || bill.ISSUETYPE == "SWB无正本") - { - r.WriteLine("DOC+710+++" + GetBillNum(bill.NOBILL) + "'"); - icount++; - } - else if (bill.ISSUETYPE == "BILL COPY" || bill.ISSUETYPE == "电放" || bill.ISSUETYPE == "正副本") - { - r.WriteLine("DOC+706+++" + GetBillNum(bill.NOBILL) + "'"); - icount++; - } - else if (bill.ISSUETYPE == "HOUSE BILL") - { - r.WriteLine("DOC+714+++" + GetBillNum(bill.NOBILL) + "'"); - icount++; - } - #endregion - - //判断集装箱是否包含分箱明细 - string slSQL = "select count(*) as inum from op_ctn_detail where CTN_ID in (select CTN_ID from op_ctn where bsno='" + bill.BSNO.ToString() + "')"; - int inum = int.Parse(T_ALL_DA.GetStrSQL("inum", slSQL)); - if (inum < 1) - { - #region 取委托单货描、唛头信息 - if (isbill != 1) - { - r.WriteLine("GID+1+" + bill.PKGS.ToString() + ":" + GetPackageEDICode(bill.KINDPKGS, "MAERSK").Trim() + "::6:" + bill.KINDPKGS + "'"); - } - else - { - r.WriteLine("GID+1+" + OpBill.PKGS.ToString() + ":" + GetPackageEDICode(OpBill.KINDPKGS, "MAERSK").Trim() + "::6:" + OpBill.KINDPKGS + "'"); - } - icount = icount + 1; - - if (bill.HSCODE != "") - { - r.WriteLine("PIA+5+" + bill.HSCODE + ":HS'"); - icount = icount + 1; - } - - if (isbill != 1) - { - Shipping = formatEdiStr("txt", bill.DESCRIPTION); - } - else Shipping = formatEdiStr("txt", OpBill.DESCRIPTION); - Shipping = Shipping.Replace("\n", "\\"); - Shipping = Shipping.Replace("\r", " "); - string[] DescriptionList = Shipping.Split('\\'); - if (DescriptionList.Length != 0) - { - for (var i = 0; i < DescriptionList.Length; i++) - { - if (DescriptionList[i] != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionList[i] + "'"); - icount = icount + 1; - } - } - } - if (DescriptionShipper != "") - { - - r.WriteLine("FTX+AAA+++" + DescriptionShipper + "'"); - icount = icount + 1; - - - } - if (DescriptionConsignee != "") - { - - r.WriteLine("FTX+AAA+++" + DescriptionConsignee + "'"); - icount = icount + 1; - - - } - if (DescriptionNotifyparty != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty + "'"); - icount = icount + 1; - - } - - if (isbill != 1) - { - r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(Convert.ToDecimal(bill.KGS), 3) + "'"); - r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(Convert.ToDecimal(bill.CBM), 3) + "'"); - } - else - { - r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(OpBill.KGS, 3) + "'"); - r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(OpBill.CBM, 3) + "'"); - } - icount = icount + 2; - - - if (billams.GOODSNCM != "") - { - r.WriteLine("RFF+ABT:" + billams.GOODSNCM + "'"); - icount = icount + 1; - - } - - - if (isbill != 1) - { - Shipping = formatEdiStr("txt", bill.MARKS); - } - else Shipping = formatEdiStr("txt", OpBill.MARKS); - Shipping = Shipping.Replace("\n", "\\"); - Shipping = Shipping.Replace("\r", " "); - string[] MarksList = Shipping.Split('\\'); - if (MarksList.Length != 0) - { - - for (var i = 0; i < MarksList.Length; i++) - { - r.WriteLine("PCI++" + MarksList[i] + "'"); - icount = icount + 1; - - } - } - - if (isbill != 1) - { - Shipping = bill.BSNO; - } - else Shipping = OpBill.AS_ID; - var ctnsumlist2 = MsOpSeaeDAL.MsOpSeaeDAL.GetBodyList("BSNO='" + Shipping + "'"); - foreach (var ctn in ctnsumlist2) - { - r.WriteLine("SGP+" + ctn.CNTRNO + "+" + ctn.PKGS.ToString() + "'"); - r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(ctn.KGS, 3) + "'"); - r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(ctn.CBM, 3) + "'"); - icount = icount + 3; - } - #endregion - } - else - { - #region 取集装箱分箱_货描、唛头信息 - string lsSQL = "SELECT HSCODE,KINDPKGS,DESCRIPTION,isnull(sum(PKGS),0) as PKGS,isnull(sum(KGS),0) as KGS,isnull(sum(CBM),0) as CBM from op_ctn_detail where CTN_ID in (select CTN_ID from op_ctn where bsno='" + bill.BSNO.ToString() + "') GROUP BY HSCODE,KINDPKGS,DESCRIPTION"; - DataSet dsHSCODE = T_ALL_DA.GetAllSQL(lsSQL); - if (dsHSCODE != null) - { - if (dsHSCODE.Tables[0].Rows.Count > 0) - { - for (int i = 0; i < dsHSCODE.Tables[0].Rows.Count; i++) - { - //GID+1+400:CT::6:CARTONS' - r.WriteLine("GID+" + (i + 1) + "+" + dsHSCODE.Tables[0].Rows[i]["PKGS"].ToString() + ":" + GetPackageEDICode(dsHSCODE.Tables[0].Rows[i]["KINDPKGS"].ToString(), "MAERSK") + "::6:" + dsHSCODE.Tables[0].Rows[i]["KINDPKGS"].ToString() + "'"); - icount++; - //PIA+5+HS_CODE1:HS' - r.WriteLine("PIA+5+" + dsHSCODE.Tables[0].Rows[i]["HSCODE"].ToString() + ":HS'"); - icount++; - //FTX+AAA+++MATERIAL 1' - //FTX+AAA+++HS-NO 39023012' - Shipping = formatEdiStr("txt", dsHSCODE.Tables[0].Rows[i]["DESCRIPTION"].ToString()); - Shipping = Shipping.Replace("\n", "\\"); - Shipping = Shipping.Replace("\r", " "); - string[] DescriptionList = Shipping.Split('\\'); - if (DescriptionList.Length != 0) - { - for (var j = 0; j < DescriptionList.Length; j++) - { - r.WriteLine("FTX+AAA+++" + DescriptionList[j] + "'"); - icount++; - } - } - //MEA+AAE+WT+KGM:3000' - //MEA+AAE+AAW+MTQ:110.11' - r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(Decimal.Parse(dsHSCODE.Tables[0].Rows[i]["KGS"].ToString()), 3) + "'"); - icount++; - r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(Decimal.Parse(dsHSCODE.Tables[0].Rows[i]["CBM"].ToString()), 3) + "'"); - icount++; - //PCI++MARKS AND NUMBERS:FOR MATERIAL 1: OUR PONUMBER: PO_123456' - if (isbill != 1) - { - Shipping = formatEdiStr("txt", bill.MARKS); - } - else - { - Shipping = formatEdiStr("txt", OpBill.MARKS); - } - Shipping = Shipping.Replace("\n", "\\"); - Shipping = Shipping.Replace("\r", " "); - string[] MarksList = Shipping.Split('\\'); - if (MarksList.Length != 0) - { - for (var j = 0; j < MarksList.Length; j++) - { - r.WriteLine("PCI++" + MarksList[j] + "'"); - icount++; - } - } - if (billams.GOODSNCM != "") - { - r.WriteLine("RFF+ABT:" + billams.GOODSNCM + "'"); - icount++; - } - // - lsSQL = "SELECT c.CTNALL,c.CNTRNO,c.SEALNO,d.PKGS,d.KINDPKGS,d.KGS,d.CBM,d.HSCODE,d.[DESCRIPTION] from op_ctn as c INNER JOIN op_ctn_detail as d on c.CTN_ID=d.CTN_ID where d.HSCODE='" + dsHSCODE.Tables[0].Rows[i]["HSCODE"].ToString() + "' and d.KINDPKGS='" + dsHSCODE.Tables[0].Rows[i]["KINDPKGS"].ToString() + "' and d.DESCRIPTION='" + dsHSCODE.Tables[0].Rows[i]["DESCRIPTION"].ToString() + "' order by c.CTNCODE,d.[ID]"; - DataSet dsCNTRNO = T_ALL_DA.GetAllSQL(lsSQL); - if (dsCNTRNO != null) - { - if (dsCNTRNO.Tables[0].Rows.Count > 0) - { - for (int n = 0; n < dsCNTRNO.Tables[0].Rows.Count; n++) - { - //SGP+MSCU1234567+100' - r.WriteLine("SGP+" + dsCNTRNO.Tables[0].Rows[n]["CNTRNO"].ToString() + "+" + dsCNTRNO.Tables[0].Rows[n]["PKGS"].ToString() + "'"); - //MEA+AAE+WT+KGM:1000' - r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(Decimal.Parse(dsCNTRNO.Tables[0].Rows[n]["KGS"].ToString()), 3) + "'"); - //MEA+AAE+AAW+MTQ:50.11' - r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(Decimal.Parse(dsCNTRNO.Tables[0].Rows[n]["CBM"].ToString()), 3) + "'"); - icount = icount + 3; - } - } - } - } - } - } - #endregion - } - - #region 集装箱 主箱循环 - if (isbill != 1) - { - Shipping = bill.BSNO; - } - else Shipping = OpBill.AS_ID; - var ctnsumlist = MsOpSeaeDAL.MsOpSeaeDAL.GetBodyList("BSNO='" + Shipping + "'"); - foreach (var ctn in ctnsumlist) - { - if (ctn.CNTRSOURCE == "SOC") - r.WriteLine("EQD+CN+" + ctn.CNTRNO + "+" + GetCtnEDICode(ctn.CTNALL, "MAERSK") + "+1'"); + r.WriteLine("EQD+CN+" + ctn.CNTRNO + "+" + GetCtnEDICode(ctn.CTNALL, "INTTR") + ":::"+ctn.CTNALL+"+1'"); else - r.WriteLine("EQD+CN+" + ctn.CNTRNO + "+" + GetCtnEDICode(ctn.CTNALL, "MAERSK") + "+2'"); - r.WriteLine("MEA+AAE+G+KGM:" + Math.Round(ctn.KGS, 3) + "'"); + r.WriteLine("EQD+CN+" + ctn.CNTRNO + "+" + GetCtnEDICode(ctn.CTNALL, "INTTR") + ":::" + ctn.CTNALL + "+2'"); + r.WriteLine("MEA+AAE+WT+KGM:" + Math.Round(ctn.KGS, 3) + "'"); r.WriteLine("MEA+AAE+AAW+MTQ:" + Math.Round(ctn.CBM, 3) + "'"); icount = icount + 3; @@ -8275,25 +6283,89 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'"); icount = icount + 1; } - } - r.WriteLine("SEL+" + ctn.SEALNO + "+CA'"); - icount = icount + 1; + + r.WriteLine("SEL+" + ctn.SEALNO + "+CA'"); + icount = icount + 1; - if (bill.CARGOID == "R") - { - r.WriteLine("TMP+2+" + bill.TEMPSET + ":CEL'"); + + var tmp = bill.TEMPSET; + if (tmp != "") + { + var fuhao = ""; + if (tmp.IndexOf("-") == 0) + { + fuhao = "-"; + tmp = tmp.Replace("-", ""); + } + if (tmp.Length < 3) + { + for (int i = 0; i < 3 - tmp.Length + 1; i++) + { + tmp = "0" + tmp; + } + } + tmp = fuhao + tmp; + } + else + { + tmp = "000"; + } + + + r.WriteLine("TMP+2+" + tmp + ":CEL'"); icount = icount + 1; - } - if (bill.CARGOID == "D") + } else if (bill.CARGOID == "D"&&!string.IsNullOrEmpty(bill.TEMPSET)) { - r.WriteLine("DGS+IMD+" + bill.DCLASS + "+" + bill.DUNNO + "'"); - r.WriteLine("CTA+HG+:" + billams.ATTN + "'"); - r.WriteLine("COM+" + billams.ATTNTEL + ":TE'"); - icount = icount + 3; - } + if (bill.REEFERF != "") + { + r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'"); + icount = icount + 1; + } + + r.WriteLine("SEL+" + ctn.SEALNO + "+CA'"); + icount = icount + 1; + + + var tmp = bill.TEMPSET; + if (tmp != "") + { + var fuhao = ""; + if (tmp.IndexOf("-") == 0) + { + fuhao = "-"; + tmp = tmp.Replace("-", ""); + } + if (tmp.Length < 3) + { + for (int i = 0; i < 3 - tmp.Length + 1; i++) + { + tmp = "0" + tmp; + } + } + tmp = fuhao + tmp; + } + else + { + tmp = "000"; + } + + + r.WriteLine("TMP+2+" + tmp + ":CEL'"); + icount = icount + 1; + } else + { + + + r.WriteLine("SEL+" + ctn.SEALNO + "+CA'"); + icount = icount + 1; + + } - #endregion + + } + #endregion + } r.WriteLine("UNT+" + icount.ToString() + "+" + bsno + "'"); r.WriteLine("UNZ+" + headData.Count.ToString() + "+" + bsno + "'"); r.Close(); @@ -8304,6 +6376,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL #endregion #endregion + + + #region 韩进EDI 导出 #region 检查 public static string IsCreateHANJIN(List headData, string filetype, string filerole, int isbill) @@ -9085,7 +7160,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL Shipping = formatEdiStr("txt", OpBill.SHIPPER); sSHIPPERID = OpBill.SHIPPERID; } - var DescriptionShipper = ""; + List DescriptionShipper = new List(); var shipperstr = ""; List ShippingList = formatlengthStr(Shipping, 35); @@ -9103,7 +7178,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 34) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 34); - DescriptionShipper = ShippingList[i].Substring(34); + //DescriptionShipper = ShippingList[i].Substring(34); + DescriptionShipper.Add("*" + ShippingList[i].Substring(34)); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -9115,14 +7191,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "*"; - DescriptionShipper = "*" + DescriptionShipper; + //DescriptionShipper = "*" + DescriptionShipper; //} } else if (i > 4) { - - DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); + //DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; } } @@ -9151,7 +7227,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL Shipping = formatEdiStr("txt", OpBill.CONSIGNEE); sCONSIGNEEID = OpBill.CONSIGNEEID; } - var DescriptionConsignee = ""; + //var DescriptionConsignee = ""; var Consigneestr = ""; ShippingList = formatlengthStr(Shipping, 35); @@ -9170,7 +7246,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 33) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 33); - DescriptionConsignee = ShippingList[i].Substring(33); + DescriptionShipper.Add("**" + ShippingList[i].Substring(33)); + //DescriptionConsignee = ShippingList[i].Substring(33); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -9182,14 +7259,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "**"; - DescriptionConsignee = "**" + DescriptionConsignee; + //DescriptionConsignee = "**" + DescriptionConsignee; //} } else if (i > 4) { - - DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; + DescriptionShipper.Add("**" + ShippingList[i]); + //DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; } } @@ -9217,7 +7294,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL Shipping = formatEdiStr("txt", OpBill.NOTIFYPARTY); sNOTIFYPARTYID = OpBill.NOTIFYPARTYID; } - var DescriptionNotifyparty = ""; + //var DescriptionNotifyparty = ""; var Notifypartystr = ""; ShippingList = formatlengthStr(Shipping, 35); @@ -9236,7 +7313,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 32) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 32); - DescriptionNotifyparty = ShippingList[i].Substring(32); + DescriptionShipper.Add("***" + ShippingList[i].Substring(32)); + //DescriptionNotifyparty = ShippingList[i].Substring(32); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -9248,14 +7326,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "***"; - DescriptionNotifyparty = "***" + DescriptionNotifyparty; + //DescriptionNotifyparty = "***" + DescriptionNotifyparty; //} } else if (i > 4) { - - DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; + DescriptionShipper.Add("***" + ShippingList[i]); + //DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; } } @@ -9296,24 +7374,36 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL strR += "FTX+AAA+++" + sls + "'"; icount++; } - if (DescriptionShipper != "") - { - strR += "FTX+AAA+++" + DescriptionShipper + "'"; - icount = icount + 1; - } - if (DescriptionConsignee != "") + if (DescriptionShipper != null && DescriptionShipper.Count != 0) { - strR += "FTX+AAA+++" + DescriptionConsignee + "'"; - icount = icount + 1; - + foreach (var shipper in DescriptionShipper) + { + if (!string.IsNullOrEmpty(shipper)) + { + r.WriteLine("FTX+AAA+++" + shipper + "'"); + icount = icount + 1; + } + } } - if (DescriptionNotifyparty != "") - { - strR += "FTX+AAA+++" + DescriptionNotifyparty + "'"; - icount = icount + 1; + //if (DescriptionShipper != "") + //{ + // strR += "FTX+AAA+++" + DescriptionShipper + "'"; + // icount = icount + 1; - } + //} + //if (DescriptionConsignee != "") + //{ + // strR += "FTX+AAA+++" + DescriptionConsignee + "'"; + // icount = icount + 1; + + //} + //if (DescriptionNotifyparty != "") + //{ + // strR += "FTX+AAA+++" + DescriptionNotifyparty + "'"; + // icount = icount + 1; + + //} #endregion @@ -9811,7 +7901,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL #region NAD_CZ 发货人 string sSHIPPERID = ""; - var DescriptionShipper = ""; + List DescriptionShipper = new List(); if (isbill != 1) { if (billams.BYCOUNTRY != "") @@ -9845,7 +7935,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 34) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 34); - DescriptionShipper = ShippingList[i].Substring(34); + DescriptionShipper.Add("*" + ShippingList[i].Substring(34)); + //DescriptionShipper = ShippingList[i].Substring(34); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -9857,14 +7948,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "*"; - DescriptionShipper = "*" + DescriptionShipper; + //DescriptionShipper = "*" + DescriptionShipper; //} } else if (i > 4) { - - DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); + //DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; } } @@ -9903,7 +7994,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } ShippingList = formatlengthStr(Shipping, 35); - var DescriptionConsignee = ""; + //var DescriptionConsignee = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -9920,7 +8011,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 33) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 33); - DescriptionConsignee = ShippingList[i].Substring(33); + DescriptionShipper.Add("**" + ShippingList[i].Substring(33)); + //DescriptionConsignee = ShippingList[i].Substring(33); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -9932,14 +8024,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "**"; - DescriptionConsignee = "**" + DescriptionConsignee; + //} } else if (i > 4) { - - DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); + //DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; } } @@ -10010,7 +8102,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL sNOTIFYPARTYID = OpBill.NOTIFYPARTYID; } ShippingList = formatlengthStr(Shipping, 35); - var DescriptionNotifyparty = ""; + //var DescriptionNotifyparty = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -10027,7 +8119,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 32) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 32); - DescriptionNotifyparty = ShippingList[i].Substring(32); + DescriptionShipper.Add("***" + ShippingList[i].Substring(32)); + //DescriptionNotifyparty = ShippingList[i].Substring(32); } else Shipping = Shipping + ":" + ShippingList[i]; @@ -10039,14 +8132,14 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //else //{ Shipping = Shipping + "***"; - DescriptionNotifyparty = "***" + DescriptionNotifyparty; + //DescriptionNotifyparty = "***" + DescriptionNotifyparty; //} } else if (i > 4) { - - DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); + //DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; } } @@ -10117,24 +8210,35 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL icount++; } } - if (DescriptionShipper != "") + if (DescriptionShipper != null && DescriptionShipper.Count != 0) { - r.WriteLine("FTX+AAA+++" + DescriptionShipper.TrimEnd() + "'"); - icount = icount + 1; - + foreach (var shipper in DescriptionShipper) + { + if (!string.IsNullOrEmpty(shipper)) + { + r.WriteLine("FTX+AAA+++" + shipper + "'"); + icount = icount + 1; + } + } } - if (DescriptionConsignee != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionConsignee.TrimEnd() + "'"); - icount = icount + 1; + //if (DescriptionShipper != "") + //{ + // r.WriteLine("FTX+AAA+++" + DescriptionShipper.TrimEnd() + "'"); + // icount = icount + 1; - } - if (DescriptionNotifyparty != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty.TrimEnd() + "'"); - icount = icount + 1; + //} + //if (DescriptionConsignee != "") + //{ + // r.WriteLine("FTX+AAA+++" + DescriptionConsignee.TrimEnd() + "'"); + // icount = icount + 1; - } + //} + //if (DescriptionNotifyparty != "") + //{ + // r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty.TrimEnd() + "'"); + // icount = icount + 1; + + //} #endregion #region MEA 货物尺寸 @@ -13449,7 +11553,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL - var DescriptionShipper = ""; + List DescriptionShipper = new List(); if (isbill != 1) { if (billams.BYCOUNTRY != "") @@ -13476,19 +11580,20 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 34) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 34); - DescriptionShipper = ShippingList[i].Substring(34); + DescriptionShipper.Add("*" + ShippingList[i].Substring(34)); + //DescriptionShipper = ShippingList[i].Substring(34); } else Shipping = Shipping + ":" + ShippingList[i]; Shipping = Shipping + "*"; - DescriptionShipper = "*" + DescriptionShipper; + //DescriptionShipper = "*" + DescriptionShipper; } else if (i > 4) { - - DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); + //DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; } } @@ -13512,7 +11617,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL else Shipping = formatEdiStr("txt", OpBill.CONSIGNEE); ShippingList = formatlengthStr(Shipping, 35); - var DescriptionConsignee = ""; + //var DescriptionConsignee = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -13529,20 +11634,21 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 33) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 33); - DescriptionConsignee = ShippingList[i].Substring(33); + DescriptionShipper.Add("**" + ShippingList[i].Substring(33)); + //DescriptionConsignee = ShippingList[i].Substring(33); } else Shipping = Shipping + ":" + ShippingList[i]; Shipping = Shipping + "**"; - DescriptionConsignee = "**" + DescriptionConsignee; + //DescriptionConsignee = "**" + DescriptionConsignee; } else if (i > 4) { - - DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); + //DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; } } @@ -13598,7 +11704,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL else Shipping = formatEdiStr("txt", OpBill.NOTIFYPARTY); ShippingList = formatlengthStr(Shipping, 35); - var DescriptionNotifyparty = ""; + //var DescriptionNotifyparty = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -13615,20 +11721,21 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 32) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 32); - DescriptionNotifyparty = ShippingList[i].Substring(32); + //DescriptionNotifyparty = ShippingList[i].Substring(32); + DescriptionShipper.Add("***" + ShippingList[i].Substring(32)); } else Shipping = Shipping + ":" + ShippingList[i]; Shipping = Shipping + "***"; - DescriptionNotifyparty = "***" + DescriptionNotifyparty; + //DescriptionNotifyparty = "***" + DescriptionNotifyparty; } else if (i > 4) { - - DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; + DescriptionShipper.Add("***" + ShippingList[i]); + //DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; } } @@ -13748,23 +11855,16 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } } - if (DescriptionShipper != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionShipper + "'"); - icount = icount + 1; - - } - if (DescriptionConsignee != "") - { - r.WriteLine("FTX+AAA+++" + DescriptionConsignee + "'"); - icount = icount + 1; - - } - if (DescriptionNotifyparty != "") + if (DescriptionShipper != null && DescriptionShipper.Count != 0) { - r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty + "'"); - icount = icount + 1; - + foreach (var shipper in DescriptionShipper) + { + if (!string.IsNullOrEmpty(shipper)) + { + r.WriteLine("FTX+AAA+++" + shipper + "'"); + icount = icount + 1; + } + } } if (isbill != 1) @@ -13853,6 +11953,17 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL icount++; } } + if (DescriptionShipper != null && DescriptionShipper.Count != 0) + { + foreach (var shipper in DescriptionShipper) + { + if (!string.IsNullOrEmpty(shipper)) + { + r.WriteLine("FTX+AAA+++" + shipper + "'"); + icount = icount + 1; + } + } + } //MEA+AAE+WT+KGM:3000' //MEA+AAE+AAW+MTQ:110.11' r.WriteLine("MEA+AAE+WT+KGM:" + Math.Round(Decimal.Parse(dsHSCODE.Tables[0].Rows[i]["KGS"].ToString()), 3) + "'"); @@ -21566,11 +19677,15 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL { error = error + "
提单号:" + bill.MBLNO + "卸货港代码不能为空"; } - if (GetPortEDICode(bill.PLACEDELIVERYID) == "") - { error = error + "
提单号:" + bill.MBLNO + "交货代码不能为空"; } + //if (GetPortEDICode(bill.PLACEDELIVERYID) == "") + //{ error = error + "
提单号:" + bill.MBLNO + "交货代码不能为空"; } + + //if (bill.PLACEDELIVERY == null || bill.PLACEDELIVERY == "") + //{ error = error + "
提单号:" + bill.MBLNO + "交货地不能为空"; } + + if (GetPortEDICode(bill.DESTINATIONID, "PIL") == "") + { error = error + "
提单号:" + bill.MBLNO + "目的地代码不能为空"; } - if (bill.PLACEDELIVERY == null || bill.PLACEDELIVERY == "") - { error = error + "
提单号:" + bill.MBLNO + "交货地不能为空"; } if (bill.DESTINATION == null || bill.DESTINATION == "") { error = error + "
提单号:" + bill.MBLNO + "目的地不能为空"; } @@ -21987,7 +20102,8 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } else { - tempstr += Convert.ToDateTime(bill.ETD).ToString("yyyyMMdd");//15 //Loading Date//C//X(8)//90 //97 //YYYYMMDD, mandatory if record submitted is BL + //tempstr += Convert.ToDateTime(bill.ETD).ToString("yyyyMMdd");//15 //Loading Date//C//X(8)//90 //97 //YYYYMMDD, mandatory if record submitted is BL + tempstr += GetSpaceStr("", 8);//15 //Loading Date//C//X(8)//90 //97 //YYYYMMDD, mandatory if record submitted is BL } if (portload == "CNSHA" && filetype != "E") { @@ -21995,11 +20111,15 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } else { - tempstr += GetSpaceStr(bill.ORDERNO, 20);//16 //Original_reference//C//X(20)//98 //117 //webCSM Alternate Booking Reference, only if alt booking ref is used + tempstr += GetSpaceStr(bill.MBLNO, 20);//16 //Original_reference//C//X(20)//98 //117 //webCSM Alternate Booking Reference, only if alt booking ref is used } tempstr += GetSpaceStr("", 20);//17 //Bkg Pty Reference//O//X(20)//118 //137 //webCSM Bkg Party Reference tempstr += "F";//18 //Booking_Party_indicator//M//X(1)//138 //138 //D-Deciding Pty, N-Notify Pty, C-Consignee, S-Shipper, F-Forwarder - tempstr += GetSpaceStr("", 20);//19 //Part MBL//C//X(20)//139 //158 //Not for part BL purpose + //if (filetype == "E") { + // tempstr += GetSpaceStr(bill.MBLNO, 20); + //} + //else + tempstr += GetSpaceStr("", 20);//19 //Part MBL//C//X(20)//139 //158 //Not for part BL purpose tempstr += GetSpaceStr("", 20);//20 //BL Paid By//C//X(20)//159 //178 //Freight Absorbed by BL Reference, only if BL's frt is paid by other BL tempstr += GetSpaceStr("", 12);//21 //Customs Bill of Lading//C//X(12)//179 //190 //Customs BL Reference (12 char) - only for US/CA Customs requirement if (bill.ETD == "") @@ -22022,7 +20142,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL tempstr += GetSpaceStr(GetPortEDICode(bill.PORTLOADID, "PIL"), 5);//3 //Port of Origin//M//X(5)//6 //10 //refer Port Code (Place of receipt) tempstr += GetSpaceStr(GetPortEDICode(bill.PORTDISCHARGEID, "PIL"), 5);//4 //Port of Discharge//M//X(5)//11 //15 //refer Port code (Port of Discharge - final) tempstr += GetSpaceStr("", 5);//5 //Port of Trans//C//X(5)//16 //20 //refer Port code (1st T/S port), only if Transshipment involved - tempstr += GetSpaceStr(GetPortEDICode(bill.PLACEDELIVERYID, "PIL"), 5);//6 //Final Destination//M//X(5)//21 //25 //refer Port Code (Place of delivery) + tempstr += GetSpaceStr(GetPortEDICode(bill.DESTINATIONID, "PIL"), 5);//6 //Final Destination//M//X(5)//21 //25 //refer Port Code (Place of delivery) tempstr += GetSpaceStr(bill.DESTINATION, 20);//7 //Final Destination (Name)//M//X(20)//26 //45 // tempstr += GetSpaceStr("", 10);//8 //Route Code//O//X(10)//46 //55 //webCSM Route Code (out from webCSM only) tempstr += GetSpaceStr("", 45);//9 //Filler//M//X(45)//56 //100 //Spaces @@ -22058,9 +20178,9 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL tempstr += GetSpaceStr(bill.PLACERECEIPT, 50);//2//Origin Freeform//O//X(50)//3//52//BL location text for Port of Origin//收货地 tempstr += GetSpaceStr(bill.PORTLOAD, 50);//3//Load Port Freeform//O//X(50)//53//102//BL location text for Port of Load//装货港 tempstr += GetSpaceStr(bill.PORTDISCHARGE, 50);//4//Discharge Port Freeform//O//X(50)//103//152//BL location text for Port of Discharge//卸货港 - tempstr += GetSpaceStr(bill.PLACEDELIVERY, 50);//5//Destination Freeform//O//X(50)//153//202//BL location text for Port of Delivery//交货地点 + tempstr += GetSpaceStr(bill.DESTINATION, 50);//5//Destination Freeform//O//X(50)//153//202//BL location text for Port of Delivery//交货地点 tempstr += GetSpaceStr(bill.VOYNO, 30);//6//Freeform Voyage//O//X(30)//203//232//BL voyage freeform/ - tempstr += GetSpaceStr(bill.VOYNO, 30);//6//Freeform Voyage//O//X(30)//203//232//BL voyage freeform//航次 + tempstr += GetSpaceStr("", 30);//6//Freeform Voyage//O//X(30)//203//232//BL voyage freeform//航次 tempstr += GetSpaceStr("", 18);//7//Filler//M//X(18)//233//250//Spaces r.WriteLine(GetSpaceStr(tempstr, 250)); #endregion @@ -22915,6 +21035,18 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL //4 //Filler//M//X(127)//124 //250 //Spaces r.WriteLine(GetSpaceStr(tempstr, 250)); + if (portload == "CNDLC") { + if (!string.IsNullOrEmpty(OpAms.INLANE)) { + tempstr = "73";//1 //RECORD_ID//M//9(2)//1 //2 //73 + tempstr += "B";//2 //Remarks_indicator//M//X(1)//3 //3 //O-Onhold, B-Booking, C-Customs, M-Manifest, X-Special, A-Additional, G-General, T-Transhipment, E-EDI //"73B,必填内容:1)SALES REP CODE;2)ACI HBL (1,2,3);加拿大线的HBL3) 货物混装描述 (S0C+C0C)"//分三行 + tempstr += GetSpaceStr(OpAms.INLANE, 120);//3 //Remarks Text//O//X(120)//4 //123 //RemarksGetCustEdi(bill.YARD,120) + //4 //Filler//M//X(127)//124 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + + } + + } + if (OpAms.ACIHBL != "") { tempstr = "73";//1 //RECORD_ID//M//9(2)//1 //2 //73 @@ -23016,17 +21148,23 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL { tempstr += GetSpaceStr("N", 1);//7//BOL Type//M//X(1)//26//26//N-Nominal, G-Negotiable, S-Switch, W-Waybill, M-Memo//公司类型//n-nominal,g-negotiable,S-开关,w-waybill,m-memo } - //tempstr += GetSpaceStr(GetBillNum(bill.NOBILL.ToString().Trim()), 2, "0");//8//No. of Original BLs//O//9(2)//27//28//号原BLS// - //tempstr += GetSpaceStr(GetBillNum(bill.COPYNOBILL.ToString().Trim()), 2, "0");//9//No. of Copy BLs//O//9(2)//29//30//不复制BLS// - tempstr += GetSpaceStr("", 2);//8//No. of Original BLs//O//9(2)//27//28//号原BLS//太平要求去掉 - tempstr += GetSpaceStr("", 2);//9//No. of Copy BLs//O//9(2)//29//30//不复制BLS//太平要求去掉 + if (filetype == "E") + { + tempstr += GetSpaceStr(GetBillNum(bill.NOBILL.ToString().Trim()), 2, "0");//8//No. of Original BLs//O//9(2)//27//28//号原BLS// + tempstr += GetSpaceStr(GetBillNum(bill.COPYNOBILL.ToString().Trim()), 2, "0");//9//No. of Copy BLs//O//9(2)//29//30//不复制BLS// + } + else + { + tempstr += GetSpaceStr("", 2);//8//No. of Original BLs//O//9(2)//27//28//号原BLS//太平要求去掉 + tempstr += GetSpaceStr("", 2);//9//No. of Copy BLs//O//9(2)//29//30//不复制BLS//太平要求去掉 + } if (OpAms.BYCOUNTRY == "USA") { - tempstr += GetSpaceStr(bill.SERVICECONTRACTNO, 10);//10//Service Contract #//C//X(10)//31//40//Applicable to US shipments only//"mandtory for US shpts---Service Contract Nbr/TAA Nbr"//美国线的S/C,TAA//服务合同#//只适用于美国装运 + tempstr += GetSpaceStr(bill.CONTRACTNO, 10);//10//Service Contract #//C//X(10)//31//40//Applicable to US shipments only//"mandtory for US shpts---Service Contract Nbr/TAA Nbr"//美国线的S/C,TAA//服务合同#//只适用于美国装运 } else { - tempstr += GetSpaceStr(bill.SERVICECONTRACTNO, 10);//10//Service Contract #//C//X(10)//31//40//Applicable to US shipments only//"mandtory for US shpts---Service Contract Nbr/TAA Nbr"//美国线的S/C,TAA//服务合同#//只适用于美国装运 + tempstr += GetSpaceStr(bill.CONTRACTNO, 10);//10//Service Contract #//C//X(10)//31//40//Applicable to US shipments only//"mandtory for US shpts---Service Contract Nbr/TAA Nbr"//美国线的S/C,TAA//服务合同#//只适用于美国装运 } tempstr += GetSpaceStr("", 5);//11//Prepaid at (Port code)//M//X(5)//41//45//Ocean Freight Payment Location//预付(港码)//海运付款地点 tempstr += GetSpaceStr("", 5);//12//Payable at (Port Code)//M//X(5)//46//50//1st Collect Charge Payment Location//按(港口代码)支付//第一收取缴费地点 @@ -24115,7 +22253,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL var billams = GetAmsData("BSNO='" + bill.BSNO + "'"); var Shipping = ""; - var DescriptionShipper = ""; + List DescriptionShipper = new List(); if (isbill != 1) { if (billams.BYCOUNTRY != "") @@ -24141,19 +22279,19 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 34) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 34); - DescriptionShipper = ShippingList[i].Substring(34); + DescriptionShipper.Add("*" + ShippingList[i].Substring(34)); } else Shipping = Shipping + ":" + ShippingList[i]; Shipping = Shipping + "*"; - DescriptionShipper = "*" + DescriptionShipper; + } else if (i > 4) { - DescriptionShipper = DescriptionShipper + " " + ShippingList[i]; + DescriptionShipper.Add("*" + ShippingList[i]); } } @@ -24176,7 +22314,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL else Shipping = formatEdiStr("txt", OpBill.CONSIGNEE); ShippingList = formatlengthStr(Shipping, 35); - var DescriptionConsignee = ""; + //var DescriptionConsignee = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -24193,19 +22331,20 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 33) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 33); - DescriptionConsignee = ShippingList[i].Substring(33); + DescriptionShipper.Add("**" + ShippingList[i].Substring(33)); + //DescriptionConsignee = ShippingList[i].Substring(33); } else Shipping = Shipping + ":" + ShippingList[i]; Shipping = Shipping + "**"; - DescriptionConsignee = "**" + DescriptionConsignee; + //DescriptionConsignee = "**" + DescriptionConsignee; } else if (i > 4) { - - DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; + DescriptionShipper.Add("**" + ShippingList[i]); + //DescriptionConsignee = DescriptionConsignee + " " + ShippingList[i]; } } @@ -24227,7 +22366,7 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL else Shipping = formatEdiStr("txt", OpBill.NOTIFYPARTY); ShippingList = formatlengthStr(Shipping, 35); - var DescriptionNotifyparty = ""; + //var DescriptionNotifyparty = ""; if (ShippingList.Count != 0 && Shipping.Length > 0) { @@ -24244,19 +22383,20 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL if (ShippingList[i].Length > 32) { Shipping = Shipping + ":" + ShippingList[i].Substring(0, 32); - DescriptionNotifyparty = ShippingList[i].Substring(32); + //DescriptionNotifyparty = ShippingList[i].Substring(32); + DescriptionShipper.Add("***" + ShippingList[i].Substring(32)); } else Shipping = Shipping + ":" + ShippingList[i]; Shipping = Shipping + "***"; - DescriptionNotifyparty = "***" + DescriptionNotifyparty; + //DescriptionNotifyparty = "***" + DescriptionNotifyparty; } else if (i > 4) { - - DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; + DescriptionShipper.Add("***" + ShippingList[i]); + //DescriptionNotifyparty = DescriptionNotifyparty + " " + ShippingList[i]; } } @@ -24338,6 +22478,18 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL } } + if (DescriptionShipper != null && DescriptionShipper.Count != 0) + { + foreach (var shipper in DescriptionShipper) + { + if (!string.IsNullOrEmpty(shipper)) + { + r.WriteLine("FTX+AAA+++" + shipper + "'"); + icount = icount + 1; + } + } + } + //if (DescriptionShipper != "") //{ // r.WriteLine("FTX+AAA+++" + DescriptionShipper + "'"); diff --git a/DSWeb/Areas/MvcShipping/Views/MsOpAire/Edit.aspx b/DSWeb/Areas/MvcShipping/Views/MsOpAire/Edit.aspx index effbba97..8a7dced2 100644 --- a/DSWeb/Areas/MvcShipping/Views/MsOpAire/Edit.aspx +++ b/DSWeb/Areas/MvcShipping/Views/MsOpAire/Edit.aspx @@ -51,7 +51,7 @@ - + diff --git a/DSWeb/Areas/MvcShipping/Views/MsOpAiri/Edit.aspx b/DSWeb/Areas/MvcShipping/Views/MsOpAiri/Edit.aspx index 2c9dcdaa..d43679d5 100644 --- a/DSWeb/Areas/MvcShipping/Views/MsOpAiri/Edit.aspx +++ b/DSWeb/Areas/MvcShipping/Views/MsOpAiri/Edit.aspx @@ -51,7 +51,7 @@ - + diff --git a/DSWeb/Areas/MvcShipping/Views/MsOpApply/Edit.aspx b/DSWeb/Areas/MvcShipping/Views/MsOpApply/Edit.aspx index 9b1bc4b5..cc65a030 100644 --- a/DSWeb/Areas/MvcShipping/Views/MsOpApply/Edit.aspx +++ b/DSWeb/Areas/MvcShipping/Views/MsOpApply/Edit.aspx @@ -43,7 +43,7 @@ - + diff --git a/DSWeb/Areas/MvcShipping/Views/MsOpOther/Edit.aspx b/DSWeb/Areas/MvcShipping/Views/MsOpOther/Edit.aspx index db338678..f731752e 100644 --- a/DSWeb/Areas/MvcShipping/Views/MsOpOther/Edit.aspx +++ b/DSWeb/Areas/MvcShipping/Views/MsOpOther/Edit.aspx @@ -39,7 +39,7 @@ - + diff --git a/DSWeb/Areas/MvcShipping/Views/MsOpSeai/Edit.aspx b/DSWeb/Areas/MvcShipping/Views/MsOpSeai/Edit.aspx index 4628ddb9..a383182d 100644 --- a/DSWeb/Areas/MvcShipping/Views/MsOpSeai/Edit.aspx +++ b/DSWeb/Areas/MvcShipping/Views/MsOpSeai/Edit.aspx @@ -64,7 +64,7 @@ - + diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/Comm/PubFunction.js b/DSWeb/Areas/MvcShipping/Viewsjs/Comm/PubFunction.js index 9b2a645d..23efeba0 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/Comm/PubFunction.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/Comm/PubFunction.js @@ -473,7 +473,7 @@ function Billstrnum(str,len) { for (var i = 0; i < slist.length; i += 1) { var member = slist[i]; - if (member.length > len) { + if (member.trim().length > len) { if (result=='') result = result + (i + 1) + '行'; else diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeEdit.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeEdit.js index 4db93ba8..a6f1c9be 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeEdit.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeEdit.js @@ -3244,8 +3244,9 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formEdit.getForm().findField('DESTINATION').setValue(records[0].data.PORT); - this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(records[0].data.EDICODE); - this.formEdit.getForm().findField('PLACEDELIVERY').setValue(records[0].data.PORT); + //this.storeCodeDisport3.load({ params: { PORT: records[0].data.EDICODE} }); + //this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(records[0].data.EDICODE); + //this.formEdit.getForm().findField('PLACEDELIVERY').setValue(records[0].data.PORT); var BLFRT = this.formHead.getForm().findField('BLFRT').getValue(); if (BLFRT == "FREIGHT COLLECT") { this.formEdit.getForm().findField('PREPARDAT').setValue(''); @@ -3269,8 +3270,8 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { _rec = this.storeCodeDisport2.getAt(0); this.formEdit.getForm().findField('DESTINATION').setValue(_rec.data.PORT); - this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(_rec.data.EDICODE); - this.formEdit.getForm().findField('PLACEDELIVERY').setValue(_rec.data.PORT); + //this.formEdit.getForm().findField('PLACEDELIVERYID').setValue(_rec.data.EDICODE); + //this.formEdit.getForm().findField('PLACEDELIVERY').setValue(_rec.data.PORT); var BLFRT = this.formHead.getForm().findField('BLFRT').getValue(); if (BLFRT == "FREIGHT COLLECT") { this.formEdit.getForm().findField('PREPARDAT').setValue(''); @@ -5987,9 +5988,6 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { }, { name: 'ENTERPRISECODETYPE2', hidden: true }, - { - name: 'INLANE', hidden: true, value: false//企业代码类型 - }, { name: 'USERAILWAY', hidden: true, value: false//企业代码类型 }, @@ -6381,8 +6379,13 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', - items: [{ - fieldLabel: Zi.LAN.ACIHBL, //'ACI HBL', + items: [{ + fieldLabel: Zi.LAN.INLANE, //'通知人Edi代码', + flex: 1, + name: 'INLANE' + },{ + fieldLabel: Zi.LAN.ACIHBL, //'ACI HBL', + flex: 3, name: 'ACIHBL' }] }, { @@ -9744,6 +9747,11 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { inputValue: 'CNTAO', checked: true }, { + boxLabel: 'CNDLC', //'CNSHA', + name: 'PORTLOAD2', + inputValue: 'CNDLC', + checked: false + }, { boxLabel: Zi.LAN.CNSHA, //'CNSHA', name: 'PORTLOAD2', inputValue: 'CNSHA', @@ -16972,7 +16980,7 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '船公司不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } - + var PORTLOADID = this.formEdit.getForm().findField('PORTLOADID').getValue(); var carriercode = ""; var selectrecords = DsStoreQueryBy(this.storeListCarrierEdiType, 'CTN', carrier); if (selectrecords.getCount() > 0) { @@ -17014,6 +17022,9 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { cgFILETYPE.setValue({ FILETYPE2: type }); var cgCARRIER = Ext.getCmp('pilCARRIER'); cgCARRIER.setValue({ CARRIER: carriercode }); + var pilPORTLOAD = Ext.getCmp('pilPORTLOAD2'); + pilPORTLOAD.setValue({ PORTLOAD2: PORTLOADID.substring(0,5) }); + this.winPILShow2.show(); } else if (this.editype == 'MAERSK') { var cgFILETYPE = Ext.getCmp('mFILETYPE'); @@ -21598,7 +21609,7 @@ Ext.extend(Shipping.MsOpSeaeEdit, Ext.Panel, { if (textArr == null) return; for (var j = 0; j < textArr.length; j++) { - var subArr = textArr[j].match(/[\w]+[ ]*[\n]*|[\d]+[ ]*[\n]*|[^\w\d]+[ ]*[\n]*/g); + var subArr = textArr[j].trim().match(/[\w]+[ ]*[\n]*|[\d]+[ ]*[\n]*|[^\w\d]+[ ]*[\n]*/g); var count = 0; for (var i = 0; i < subArr.length; i++) { count += subArr[i].replace(/\n/g, "").length; diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js index c14c2b04..827582b1 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/MsOpSeaeIndex.js @@ -5285,6 +5285,11 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { inputValue: 'CNTAO', checked: true }, { + boxLabel: 'CNDLC', //'CNSHA', + name: 'PORTLOAD2', + inputValue: 'CNDLC', + checked: false + }, { boxLabel: Zi.LAN.CNSHA, //'CNSHA', name: 'PORTLOAD2', inputValue: 'CNSHA', @@ -8899,7 +8904,8 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { return; } - var carrier =selections[0].data.CARRIER; + var carrier = selections[0].data.CARRIER; + var PORTLOADID = selections[0].data.PORTLOADID; if (carrier == '') { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '船公司不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; @@ -8945,6 +8951,8 @@ Ext.extend(Shipping.MsOpSeaeIndex, Ext.Panel, { cgFILETYPE.setValue({ FILETYPE2: type }); var cgCARRIER = Ext.getCmp('pilCARRIER'); cgCARRIER.setValue({ CARRIER: carriercode }); + var pilPORTLOAD = Ext.getCmp('pilPORTLOAD2'); + pilPORTLOAD.setValue({ PORTLOAD2: PORTLOADID.substring(0,5) }); this.winPILShow2.show(); } else if (this.editype == 'MAERSK') { diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js index 96ece74f..a64a04f3 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_en-us.js @@ -684,4 +684,5 @@ Zi.LAN.rRECEIVERDEPT = "接受方部门"; Zi.LAN.EDIRUSSIA = "俄罗斯(交通部)"; Zi.LAN.CNTRSOURCE = "箱源"; Zi.LAN.SALECORPID = "所属团队"; -Zi.LAN.PiLiangHistryAddFee = "批量历史费用引入"; \ No newline at end of file +Zi.LAN.PiLiangHistryAddFee = "批量历史费用引入"; +Zi.LAN.INLANE = "CNAS No."; \ No newline at end of file diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js index 449aa1c1..56e6e915 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsOpSeae/Zi_zh-cn.js @@ -713,6 +713,7 @@ Zi.LAN.EDIRUSSIA = "俄罗斯(交通部)"; Zi.LAN.CNTRSOURCE = "箱源"; Zi.LAN.SALECORPID = "所属团队"; Zi.LAN.PiLiangHistryAddFee = "批量历史费用引入"; +Zi.LAN.INLANE = "CNAS No."; //Zi.LAN. = "";