From 12d251643d6cdf9ab1c27b14711aa70662f9363f Mon Sep 17 00:00:00 2001 From: hanxuntao <641739520@qq.com> Date: Fri, 10 Mar 2023 16:55:33 +0800 Subject: [PATCH] 1 --- .../Controllers/Chfee_AuditController.cs | 2 +- .../Viewsjs/Chfee_Audit/Chfee_AuditBL.js | 6 +- .../ChSettlementRecvDuiEdit.js | 38 +- .../Controllers/MsOpSeaeController.cs | 13 +- .../DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs | 1295 +++++++++++++++++ .../Viewsjs/MsChFee/FeeAmendDrCrGrid.js | 7 +- 6 files changed, 1335 insertions(+), 26 deletions(-) diff --git a/DSWeb/Areas/Account/Controllers/Chfee_AuditController.cs b/DSWeb/Areas/Account/Controllers/Chfee_AuditController.cs index 228114d5..2d8d6c49 100644 --- a/DSWeb/Areas/Account/Controllers/Chfee_AuditController.cs +++ b/DSWeb/Areas/Account/Controllers/Chfee_AuditController.cs @@ -1074,7 +1074,7 @@ namespace DSWeb.Areas.Account.Controllers { #region - var billlist = Chfee_AuditDAL.GetBillDataList("MASTERNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true); + var billlist = Chfee_AuditDAL.GetBillDataList("v_op_bill.BSNO='" + bsno + "'", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), null, true); foreach (var bill in billlist) { if (bill.BillFeeStatus == "2" || bill.BillFeeStatus == "1") diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_Audit/Chfee_AuditBL.js b/DSWeb/Areas/Account/Viewsjs/Chfee_Audit/Chfee_AuditBL.js index 13801520..60152068 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_Audit/Chfee_AuditBL.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_Audit/Chfee_AuditBL.js @@ -3499,7 +3499,11 @@ Ext.extend(Shipping.MsChfeeAudit, Ext.Panel, { var mblNo = form.findField('PS_MBLNO').getValue(); // sql = sql + getAndConSql(sql, mblNo, "(MblNo like '%" + mblNo + "%' or hblNo like '%" + mblNo + "%' OR CUSTNO like '%" + mblNo + "%' OR CUSTOMNO like '%" + mblNo + "%' OR ORDERNO like '%" + mblNo + "%')"); - sql = sql + getAndConSql(sql, mblNo, " (CUSTNO+' '+MBLNO+' '+HBLNO+' '+CUSTOMNO+' '+ORDERNO like '%" + mblNo + "%')"); + sql = sql + getAndConSql(sql, mblNo, " (MBLNO+' '+HBLNO like '%" + mblNo + "%')"); + + var PS_CUSTNO = form.findField('PS_CUSTNO').getValue(); + // sql = sql + getAndConSql(sql, mblNo, "(MblNo like '%" + mblNo + "%' or hblNo like '%" + mblNo + "%' OR CUSTNO like '%" + mblNo + "%' OR CUSTOMNO like '%" + mblNo + "%' OR ORDERNO like '%" + mblNo + "%')"); + sql = sql + getAndConSql(sql, PS_CUSTNO, " (CUSTNO like '%" + PS_CUSTNO + "%')"); var expDate_Min = form.findField('PS_EXPDATEBGN').getRawValue(); diff --git a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChSettlementRecvDuiEdit.js b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChSettlementRecvDuiEdit.js index da74a5e5..4dc02056 100644 --- a/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChSettlementRecvDuiEdit.js +++ b/DSWeb/Areas/Account/Viewsjs/Chfee_settlement/ChSettlementRecvDuiEdit.js @@ -3607,15 +3607,7 @@ Ext.extend(Shipping.ChSettlementRecvDuiEdit, Ext.Panel, { _this.formEdit.getForm().findField('SETTLEUSERREF').setDisabled(true); _this.GetEditStatus(); _this.LoadPeriod(this.opStatus); - this.StoreBANK.load({ - params: { condition: "" }, - callback: function (r, options, success) { - if (success) { - this.formEdit.getForm().findField('ACCOUNT').setValue(data.ACCOUNT); - } - }, - scope: this - }); + _this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: data.BILLNO } }); } else { @@ -3639,11 +3631,11 @@ Ext.extend(Shipping.ChSettlementRecvDuiEdit, 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); } } @@ -5579,16 +5571,24 @@ Ext.extend(Shipping.ChSettlementRecvDuiEdit, Ext.Panel, { }, GetBank: function () { if (this.StoreBANK.getCount() == 0) return; - var ACCOUNT = this.formEdit.getForm().findField('ACCOUNT').getValue(); - var CURR = this.formEdit.getForm().findField('CURR').getValue(); + var ACCOUNT = this.formEdit.getForm().findField('ACCOUNTRMB').getValue(); var SETTLETYPE = this.formEdit.getForm().findField('SETTLETYPE').getRawValue(); if (SETTLETYPE == '现金') return; - if (ACCOUNT != '') return; - if (CURR == '') return; - for (var j = 0; j < this.StoreBANK.getCount() ; j += 1) { - var memberbody = this.StoreBANK.getAt(j); - if (memberbody.data.CURRENCY == CURR && memberbody.data.ISDEF=='True') { - this.formEdit.getForm().findField('ACCOUNT').setValue(memberbody.data.GID); + if (ACCOUNT == '') { + for (var j = 0; j < this.StoreBANK.getCount(); j += 1) { + var memberbody = this.StoreBANK.getAt(j); + if (memberbody.data.CURRENCY == 'RMB' && memberbody.data.ISDEF == 'True') { + this.formEdit.getForm().findField('ACCOUNTRMB').setValue(memberbody.data.GID); + } + } + } + var ACCOUNTUSD = this.formEdit.getForm().findField('ACCOUNTUSD').getValue(); + if (ACCOUNTUSD == '') { + for (var j = 0; j < this.StoreBANKUSD.getCount(); j += 1) { + var memberbody = this.StoreBANKUSD.getAt(j); + if (memberbody.data.CURRENCY == 'USD' && memberbody.data.ISDEF == 'True') { + this.formEdit.getForm().findField('ACCOUNTUSD').setValue(memberbody.data.GID); + } } } diff --git a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs index aee22091..599df28c 100644 --- a/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs +++ b/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeController.cs @@ -6670,7 +6670,11 @@ namespace DSWeb.MvcShipping.Controllers var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='PIL'", Convert.ToString(Session["COMPANYID"])); var filename = ""; - filename = MsOpSeaeEdiPortDAL.CreateEdiPIL2(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filetype, ftpset, portload, agent, cagent, forward, contractno); + if (portload == "CNDLC") { + filename = MsOpSeaeEdiPortDAL.CreateEdiPILDL(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filetype, ftpset, portload, agent, cagent, forward, contractno); + } + else + filename = MsOpSeaeEdiPortDAL.CreateEdiPIL2(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filetype, ftpset, portload, agent, cagent, forward, contractno); if (ftpset.RECEIVEEMAIL != "" && ftpset.RECEIVESIEMAIL != null && ftpset.SENDEMAIL != "" && ftpset.SENDEMAIL != null && !string.IsNullOrEmpty(ftpset.SENDEMAILSERVER) && !string.IsNullOrEmpty(ftpset.SENDEMAILPASS) && !string.IsNullOrEmpty(ftpset.SENDEMAILPORT)) { @@ -6869,7 +6873,12 @@ namespace DSWeb.MvcShipping.Controllers { var filename = ""; if (carrier != "PILMELL") - filename = MsOpSeaeEdiPortDAL.CreateEdiPIL2(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filetype, ftpset, portload, agent, cagent, forward, contractno); + if (portload == "CNDLC") + { + filename = MsOpSeaeEdiPortDAL.CreateEdiPILDL(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filetype, ftpset, portload, agent, cagent, forward, contractno); + } + else + filename = MsOpSeaeEdiPortDAL.CreateEdiPIL2(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filetype, ftpset, portload, agent, cagent, forward, contractno); else filename = MsOpSeaeEdiPortDAL.CreateEdiPILMELL(headList, Convert.ToString(Session["USERCODE"]), path, mblno,"9", ftpset,0, filetype); filename = Path.GetFileName(filename); result.Data = "../../EDIFiles/SeaeEdi/" + filename; diff --git a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs index f02af95d..2e28773c 100644 --- a/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs +++ b/DSWeb/Areas/MvcShipping/DAL/MsOpSeae/MsOpSeaeEdiPortDAL.cs @@ -17533,6 +17533,1301 @@ namespace DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL return filename; } + + public static string CreateEdiPILDL(List headData, string usercode, string path, string mblno, string filetype, CodeFtpSet ftpset, string portload, string agent, string cagent, string forward, string contractno) + { + var estr = ""; + if (filetype == "E") + { + estr = "ESI"; + } + else + { + estr = "EDI"; + } + var SENDCODE = ""; + if (filetype == "E") + { + SENDCODE = ftpset.SENDSUBCOMPANYCODE; + } + else + { + SENDCODE = ftpset.SENDCODE; + } + + + // + string filename = path + "\\" + mblno + estr + ".pms"; + 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 OpAms = new MsOpSeaeAms(); + var tempstr = ""; + + #region 00 + //tempstr = "00DOC" + GetSpaceStr("", 22) + GetSpaceStr(SENDCODE, 8) + GetSpaceStr("", 6) + DateTime.Now.ToString("yyyyMMddHHmm") + GetSpaceStr("", 1) + // + portload + portload; + //if (filetype == "E") + // tempstr = tempstr + "4.01"; + //else + // tempstr = tempstr + "PBK"; + //r.WriteLine(GetSpaceStr(tempstr, 250)); + + tempstr = "00";//1//RECORD-ID//M//9(2)//1//2//00 + //if (filetype == "E") + //{ + tempstr += "DOC";//2//Data-type ID//M//X(3)//3//5//DOC=BL, BKG=Booking + //} + //else { + // tempstr += "BKG";//2//Data-type ID//M//X(3)//3//5//DOC=BL, BKG=Booking + + //} + tempstr += GetSpaceStr("", 20);//3//File Description//O//X(20)//6//25// + tempstr += GetSpaceStr("", 2);//4//Filler//M//X(2)//26//27//Spaces + tempstr += GetSpaceStr(SENDCODE, 8);//5//Sender-Code//M//X(8)//28//35//Sender/Receiver Code List + tempstr += GetSpaceStr("", 6);//6//Filler//M//X(6)//36//41// + tempstr += DateTime.Now.ToString("yyyyMMddHHmm");//7//File Send time//M//9(12)//42//53//YYYYMMDDHHMM + tempstr += GetSpaceStr("", 1);//8//Filler//M//X(1)//54//54//Spaces + tempstr += portload;//9//Sender Port Code//M//X(5)//55//59// + tempstr += portload;//10//Receiver Port Code//M//X(5)//60//64// + if (filetype == "E") + { + tempstr += "4.02";//11//EDI Version//M//X(4) //65//68//Default to "PBK" / esi:4.01 + } + else + { + tempstr += "PBK";//11//EDI Version//M//X(4) //65//68//Default to "PBK" / esi:4.01 + } + tempstr += GetSpaceStr("", 15);//12//Sender Ver Control ID//C//X(15)//69//83//Sender's ASFS/AFMS software version; blank if not applicable + tempstr += GetSpaceStr("", 167);//13//Filler//M//X(167)//84//250//Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + foreach (var bill in headData) + { + icount = icount + 1; + + forward = OpAms.FORWARD; + + #region 11 + var eta = ""; + if (bill.ETA == "" || bill.ETA == null) + { + eta = DateTime.Now.ToString("yyyyMMdd"); + } + else { eta = bill.ETA.Replace("-", ""); } + var etd = ""; + if (bill.ETD == "" || bill.ETD == null) + { + etd = GetSpaceStr("", 8); + } + else { etd = bill.ETD.Replace("-", ""); } + + //tempstr = "11" + GetSpaceStr("", 1) + GetSpaceStr(bill.VESSELID, 10) + GetSpaceStr(bill.VESSEL, 20) + GetSpaceStr(bill.VOYNO, 8) + eta + etd + // + GetSpaceStr(bill.VESSELID + bill.VOYNO, 12) + eta; + //r.WriteLine(GetSpaceStr(tempstr, 250)); + + tempstr = "11";//1//RECORD-ID//M//9(2)//1//2//11// + tempstr += GetSpaceStr("", 1);//2//Filler//M//X(1)//3//3//Spaces// + //if (bill.VESSELID.ToString().Trim().Length < 4) + //{ + // tempstr += GetSpaceStr(bill.VESSELID.ToString().Trim(), 10);//3//Vessel Code//M//X(10)//4//13//和vessel有关的,即field 4和 field 3 都必填 + //} + //else + //{ + tempstr += GetSpaceStr(bill.VOYNO.ToString().Trim().Substring(0, 4), 10);//3//Vessel Code//M//X(10)//4//13//和vessel有关的,即field 4和 field 3 都必填 + //} + tempstr += GetSpaceStr(bill.VESSEL, 20);//4//Vessel Name//M//X(20)//14//33//和vessel有关的,即field 4和 field 3 都必填 + tempstr += GetSpaceStr("", 8);//5//Voyage No.//M//X(8)//34//41//Alternate Voyage Reference (Commercial voyage)//但是和voyage有关的,即field 5和field 8不用填//不用填 + //tempstr += GetSpaceStr("", 8);//5//Voyage No.//M//X(8)//34//41//Alternate Voyage Reference (Commercial voyage)//不用填 + tempstr += eta;//6//Arrival Date//M//9(8)//42//49//YYYYMMDD (ATA or ETA if ATA not available)// + tempstr += etd;//7//Sailing Date//M//9(8)//50//57//YYYYMMDD (ATD or ETD if ATD not available)// + tempstr += GetSpaceStr("", 12);//8//webCSM Voyage No.//O//X(12)//58//69//webCSM System Voyage Reference//但是和voyage有关的,即field 5和field 8不用填//不要填 + tempstr += eta;//9//Berthing Date//O//9(8)//70//77//YYYYMMDD (ATB or ETB if ATB not available)// + if (bill.VOYNO.ToString().Trim().Length < 5) + { + tempstr += GetSpaceStr("", 12);//10//Export Local Voyage Reference//O//X(12)//78//89//Export Local Voyage in relation to Sender Port(customs/port reporting)//ENHANCEMENT,填写原field 8的内容,报关用 + } + else + { + tempstr += GetSpaceStr(bill.VOYNO.ToString().Trim().Substring(4), 12);//10//Export Local Voyage Reference//O//X(12)//78//89//Export Local Voyage in relation to Sender Port(customs/port reporting)//ENHANCEMENT,填写原field 8的内容,报关用 + //tempstr += GetSpaceStr(bill.VOYNO.ToString().Trim(), 12); + } + tempstr += GetSpaceStr("", 12);//11//Import Local Voyage Reference//O//X(12)//90//101//Import Local Voyage in relation to Sender Port(customs/port reporting)//内部航次 + tempstr += GetSpaceStr("", 149);//12//Filler//M//X(149)//102//250//Spaces// + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + OpAms = GetAmsData("BSNO='" + bill.BSNO + "'"); + + #region 12 + tempstr = "12";//1 //RECORD-ID//M//9(2)//1 //2 //12 + if (filetype == "E") + { + tempstr += GetSpaceStr(bill.MBLNO, 20);//2 //webCSM Booking Reference//M//X(20)//3 //22 //webCSM System Job Reference如果需要,填写原field 3的custom ref//bill.ORDERNO + } + else + { + tempstr += GetSpaceStr("+", 20);//2 //webCSM Booking Reference//M//X(20)//3 //22 //webCSM System Job Reference如果需要,填写原field 3的custom ref + } + tempstr += GetSpaceStr(bill.MBLNO, 20);//3 //webCSM BL Number//C//X(20)//23 //42 //Pre-assigned BKG Refmandtory (PIL's bkg ref nbr),预放提单号 + if (portload == "CNTAO") + { + tempstr += GetSpaceStr(bill.MBLNO, 20);//4 //Original Bill of Lading//C//X(20)//43 //62 //webCSM External B/L Reference, only if external BL is used + } + else + { + tempstr += GetSpaceStr("", 20);//4 //Original Bill of Lading//C//X(20)//43 //62 //webCSM External B/L Reference, only if external BL is used + } + + tempstr += GetSpaceStr("", 5);//5 //Filler//M//X(5)//63 //67 //Spaces + tempstr += GetSpaceStr(GetPortEDICode(bill.PORTDISCHARGEID, "PIL"), 5);//6 //Port of Discharge//M//X(5)//68 //72 //Next Discharge Port for the voyage generated + tempstr += GetSpaceStr(GetPortEDICode(bill.PORTLOADID, "PIL"), 5);//7 //Port of Loading//M//X(5)//73 //77 //Load Port for the voyage generated + tempstr += "FF";//8 //BL Movement Type//M//X(2)//78 //79 //F:FCL, L:LCL, M:MTY, T:TFCL, Y:TMTY, eg. FF=FCL/FCL + tempstr += "PP";//9 //Movement Terms//O//X(2)//80 //81 //D:Door, P:Port, R:Ramp, eg. DD=Door/Door + tempstr += GetSpaceStr(GetPILServiceStr(bill.SERVICE), 2);//10 //Freight Terms//M//X(2)//82 //83 //Y:CY, F:CFS, I:FI, O:FO, D:Door, K:Hook, L:Tackle eg. YY=CY/CY + tempstr += GetSpaceStr("", 3);//11 //Filler//M//X(3)//84 //86 //Spaces + if (bill.BLFRT.IndexOf("FREIGHT COLLECT") > -1) + { + tempstr += "C";//12 //BL Prepaid/Collect//C//X(1)//87 //87 //P-Prepaid, C-Collect for BOF charge, mandatory if Rec 61 exists//mandtory,到付预付必填,第三地填C + } + else if (bill.BLFRT.IndexOf("PREPAID") > -1)//预付 + { + tempstr += "P";//12 //BL Prepaid/Collect//C//X(1)//87 //87 //P-Prepaid, C-Collect for BOF charge, mandatory if Rec 61 exists//mandtory,到付预付必填,第三地填C + } + else + { + tempstr += "C";//12 //BL Prepaid/Collect//C//X(1)//87 //87 //P-Prepaid, C-Collect for BOF charge, mandatory if Rec 61 exists//mandtory,到付预付必填,第三地填C + } + tempstr += "N";//13 //BL Tranship Flag//M//X(1)//88 //88 //Y or N + tempstr += "N";//14 //BL All Empty CTN Flag//M//X(1)//89 //89 //Y or N + if (filetype != "E" || string.IsNullOrEmpty(bill.ETD)) + { + tempstr += GetSpaceStr("", 8);//15 //Loading Date//C//X(8)//90 //97 //YYYYMMDD, mandatory if record submitted is BL + } + else + { + //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") + { + tempstr += GetSpaceStr("", 20);//16 //Original_reference//C//X(20)//98 //117 //webCSM Alternate Booking Reference, only if alt booking ref is used + } + else + { + 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 + //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 == "") + { + tempstr += GetSpaceStr("", 8);//22 //Booking Date//M//X(8)//191 //198 //YYYYMMDD + } + else + { + tempstr += Convert.ToDateTime(bill.ETD).ToString("yyyyMMdd");//22 //Booking Date//M//X(8)//191 //198 //YYYYMMDD + } + //tempstr += eta;//23 //Slot Owner//M//X(3)//199 //201 // + tempstr += GetSpaceStr("PIL", 3);//24 //Cntr Operator//M//X(3)//202 //204 // + tempstr += GetSpaceStr("PIL", 3);//25 //Filler//M//X(46)//205 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + #region 13 + tempstr = "13";//1 //RECORD-ID//M//9(2)//1 //2 //13 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + 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.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 + tempstr += GetSpaceStr("", 5);//10 //Transhipment Port 1//C//X(5)//101 //105 //1st Transhipment Port, only if Transshipment involved + tempstr += GetSpaceStr("", 5);//11 //Transhipment Port 2//C//X(5)//106 //110 //2nd Transhipment Port, only if 2nd Transshipment involved + tempstr += GetSpaceStr("", 5);//12 //Transhipment Port 3//C//X(5)//111 //115 //3rd Transhipment Port, only if 3rd Transshipment involved + //eta = GetPortEDICode(bill.PORTDISCHARGEID, "PIL").Substring(2, 3); + //if (eta == "SSZ" || eta == "BUE" || eta == "MVD" || eta == "PNG" || eta == "NVT" || eta == "RIO") + //{ + // tempstr += "U";//13 //Master BOL Indicator//M//X(1)//116 //116 //1=Carrier filing HBL, 2=Self filing HBL, 3=Not Applicable/Straight bl//mandtory,1/船公司发HBL,2/自己发,3/无HBL。美国线必填,加拿大线填在record 73 + + //} + //else + //{ + // tempstr += "N";//13 //Master BOL Indicator//M//X(1)//116 //116 //1=Carrier filing HBL, 2=Self filing HBL, 3=Not Applicable/Straight bl//mandtory,1/船公司发HBL,2/自己发,3/无HBL。美国线必填,加拿大线填在record 73 + + //} + tempstr += OpAms.MasterBOLIndicator;//13 //Master BOL Indicator//M//X(1)//116 //116 //1=Carrier filing HBL, 2=Self filing HBL, 3=Not Applicable/Straight bl//mandtory,1/船公司发HBL,2/自己发,3/无HBL。美国线必填,加拿大线填在record 73 + + tempstr += GetSpaceStr("", 3);//14 //Job Status //O//X(3)//117 //119 //webCSM Job Status (out from webCSM only) + tempstr += GetSpaceStr("", 3);//15 //B/L Status//O//X(3)//120 //122 //webCSM B/L Status (out from webCSM only) + tempstr += GetSpaceStr("", 1);//16 //Export Haulage//O//X(1)//123 //123 //M:Merchant Haulage, C:Carrier Haulage + tempstr += GetSpaceStr("", 1);//17 //Import Haulage//O//X(1)//124 //124 //M:Merchant Haulage, C:Carrier Haulage + tempstr += GetSpaceStr("", 35);//18 //EDI301 Reference//C//X(35)//125 //159 //Shipping Portal's booking reference (eg. GT Nexus, INTTRA) + tempstr += GetSpaceStr("", 91);//19 //Filler//M//X(91)//160 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + if (filetype == "E") + { + #region 15 + tempstr = "15";//1//RECORD-ID//M//9(2)//1//2//15 + 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.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("", 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 + } + + #region 16 + tempstr = "16";//1//RECORD-ID//M//9(2)//1//2//16 + tempstr += GetSpaceStr("", 3);//2//Filler//M//X(3)//3//5//Spaces + //if (bill.BLFRT.IndexOf("FREIGHT COLLECT") > -1)//运费到付 + //{ + // tempstr += GetSpaceStr("", 10);//3//Shipper Code//O//X(10)//6//15//webcsm Partner Code//mandtory for CIF shpts,预付必填 + //} + //else + //{ + tempstr += GetSpaceStr(OpAms.ShipperEdiCode, 10);//3//Shipper Code//O//X(10)//6//15//webcsm Partner Code//mandtory for CIF shpts,预付必填 + //} + tempstr += GetSpaceStr("", 3);//4//Shipper Code//O//X(3)//16//18//webcsm Partner Subcode + tempstr += GetSpaceStr("", 4);//5//Filler//M//X(4)//19//22//Spaces + var Shipping = ""; + Shipping = bill.SHIPPER; + //List ShippingList = formatlengthStr(Shipping, 35); + //for (var i = 0; i < ShippingList.Count; i++) + //{ + // if (i <= 6) + // { + // tempstr += GetSpaceStr(ShippingList[i], 35);//6//Shipper-Item (1)//M//X(35)//23//57//Shipper Name, Address line 1 + // } + //} + + List ShippingDescription = new List(); + List tmpDescription = new List(); + List ShippingList = formatlengthStr(Shipping, 32, out tmpDescription, 6, "*"); + if (tmpDescription != null && tmpDescription.Count != 0) + { + foreach (var tmp in tmpDescription) + { + ShippingDescription.Add(tmp); + } + } + + for (var i = 0; i < ShippingList.Count; i++) + { + if (i <= 6) + { + tempstr += GetSpaceStr(ShippingList[i], 35);//7 //Deciding-Item (1)//M//X(35)//23 //57 //Deciding Party Name, Address line 1 + } + } + + //6//Shipper-Item (1)//M//X(35)//23//57//Shipper Name, Address line 1 + //7//Shipper-item (2)//M//X(35)//58//92//Shipper Name, Address line 2 + //8//Shipper-item (3)//M//X(35)//93//127//Shipper Name, Address line 3 + //9//Shipper-item (4)//M//X(35)//128//162//Shipper Name, Address line 4 + //10//Shipper-item (5)//M//X(35)//163//197//Shipper Name, Address line 5 + //11//Shipper-item (6)//M//X(35)//198//232//Shipper Name, Address line 6 + //12//SCAC Code//O//X(4)//233//236// + //13//Filler//M//X(14)//237//250//Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + if (portload == "CNDLC") + { + if (string.IsNullOrEmpty(forward)) + { + forward = "QINGDAO JET MARINE LOGISTICS CO.,LTD. DALIAN BRANCH"; + } + + } + else + { + if (string.IsNullOrEmpty(forward)) + { + forward = "QINGDAO JET MARINE LOGISTICS CO.,LTD."; + } + } + + #region 17 + tempstr = "17";//1 //RECORD-ID//M//9(2)//1 //2 //17 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + //if (bill.BLFRT == "FREIGHT PREPAID") + //{ + // tempstr += GetSpaceStr(agent, 10);//3 //Booking Party Code//O//X(10)//6 //15 //webcsm Partner Code + //} + //else + //{ + // tempstr += GetSpaceStr(cagent, 10);//3 //Booking Party Code//O//X(10)//6 //15 //webcsm Partner Code + //} + if (bill.BLFRT.IndexOf("FREIGHT PREPAID") > -1)//运费预付 + { + tempstr += GetSpaceStr(OpAms.ShipperEdiCode, 10);//3 //Booking Party Code//O//X(10)//6 //15 //webcsm Partner Code + } + else + { + tempstr += GetSpaceStr(OpAms.ConsigneeEdiCode, 10);//3//Shipper Code//O//X(10)//6//15//webcsm Partner Code//mandtory for CIF shpts,预付必填 + } + if (portload == "CNTAO" && filetype != "E") + { + tempstr += GetSpaceStr("", 3);//4 //Booking Party Code//O//X(3)//16 //18 //webcsm Partner Subcode//mandtory,订舱单位代码(customer code) + } + else + { + tempstr += GetSpaceStr("001", 3);//4 //Booking Party Code//O//X(3)//16 //18 //webcsm Partner Subcode//mandtory,订舱单位代码(customer code) + } + tempstr += GetSpaceStr("", 4);//5 //Filler//M//X(4)//19 //22 //Spaces + //int iLs = forward.Length / 35; + //int iLs2 = forward.Length % 35; + //int n = 0; + //for (int i = 0; i < iLs; i++) + //{ + // tempstr += GetSpaceStr(forward.Substring(i * 35, 35), 35);//6 //Booking Party-Item (1)//M//X(35)//23 //57 //Booking Party Name, Address line 1; + // n = i + 1; + //} + tempstr += GetSpaceStr(forward, 70);//6 //Booking Party-Item (1)//M//X(35)//23 //57 //Booking Party Name, Address line 6; + + + 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() + "'"); + if (dsUserOp != null) + { + if (dsUserOp.Tables[0].Rows.Count > 0) + { + tempstr += GetSpaceStr(dsUserOp.Tables[0].Rows[0]["OFFICEPHONE"].ToString().Trim(), 35);//12 //SCAC Code//O//X(4)//233 //236 // + } + else + { + tempstr += GetSpaceStr("", 35);//6 //Booking Party-Item (1)//M//X(35)//23 //57 //Booking Party Name, Address line 6; + + } + } + else + { + tempstr += GetSpaceStr("", 35);//6 //Booking Party-Item (1)//M//X(35)//23 //57 //Booking Party Name, Address line 6; + + } + tempstr += GetSpaceStr("", 35); + tempstr += GetSpaceStr("", 35); + tempstr += GetSpaceStr("", 35); + tempstr += GetSpaceStr("", 4);//12 //SCAC Code//O//X(4)//233 //236 // + tempstr += GetSpaceStr("", 14);//13 //Filler//M//X(14)//237 //250 //Spaces + tempstr = GetSpaceStr(tempstr, 236); + //if (!string.IsNullOrEmpty(bill.SERVICECONTRACTNO))//运费预付 + //{ + // tempstr += GetSpaceStr(bill.SERVICECONTRACTNO, 10);//3 //Booking Party Code//O//X(10)//6 //15 //webcsm Partner Code + //} + //else + //{ + // tempstr += GetSpaceStr("CN900160", 10);//3//Shipper Code//O//X(10)//6//15//webcsm Partner Code//mandtory for CIF shpts,预付必填 + //} + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + #region 18 + + if (string.IsNullOrEmpty(contractno)) contractno = bill.CONTRACTNO; + + tempstr = "18";//1 //RECORD-ID//M//9(2)//1 //2 //18 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + //if (bill.CONTRACTNO == "") + //{ + // if (bill.BLFRT == "FREIGHT PREPAID") + // { + // tempstr += GetSpaceStr(agent, 10);//3 //Deciding Party Code//O//X(10)//6 //15 //webcsm Partner Code//mandtory (DUM000001),填RFA;美国线的S/C或者TAA填写在record 74,美国线留空 + // } + // else + // { + // tempstr += GetSpaceStr(cagent, 10);//3 //Deciding Party Code//O//X(10)//6 //15 //webcsm Partner Code//mandtory (DUM000001),填RFA;美国线的S/C或者TAA填写在record 74,美国线留空 + // } + //} + //else + //{ + // tempstr += GetSpaceStr(bill.CONTRACTNO, 10);//3 //Deciding Party Code//O//X(10)//6 //15 //webcsm Partner Code + //} + if (OpAms.BYCOUNTRY == "USA") + { + tempstr += GetSpaceStr("", 11);//3 //Deciding Party Code//O//X(10)//6 //15 //webcsm Partner Code//mandtory (DUM000001),填RFA;美国线的S/C或者TAA填写在record 74,美国线留空 + } + else + { + if (contractno == "") + { + tempstr += GetSpaceStr("DUM000001", 11);//3 //Deciding Party Code//O//X(10)//6 //15 //webcsm Partner Code//mandtory (DUM000001),填RFA;美国线的S/C或者TAA填写在record 74,美国线留空 + } + else + { + tempstr += GetSpaceStr(contractno, 11);//3 //Deciding Party Code//O//X(10)//6 //15 //webcsm Partner Code + } + } + //if (portload == "CNTAO" && filetype != "E") + //{ + tempstr += GetSpaceStr("", 2);//4 //Deciding Party Code//O//X(3)//16 //18 //webcsm Partner Subcode + //} + //else + //{ + // tempstr += GetSpaceStr("01", 2);//4 //Deciding Party Code//O//X(3)//16 //18 //webcsm Partner Subcode + //} + tempstr += GetSpaceStr("", 1);//5 //Special Rate Indicator//C//X(1)//19 //19 //Denote special account with fixed exchange rates (out from webCSM only) + tempstr += GetSpaceStr("", 3);//6 //Filler//M//X(3)//20 //22 //Spaces + var sforard = forward; + if (dsUserOp != null) + { + if (dsUserOp.Tables[0].Rows.Count > 0) + { + sforard = sforard + " " + dsUserOp.Tables[0].Rows[0]["OFFICEPHONE"].ToString().Trim();//12 //SCAC Code//O//X(4)//233 //236 // + } + else + { + + } + } + else + { + + } + + tempstr += GetSpaceStr(sforard, 70);//6 //Booking Party-Item (1)//M//X(35)//23 //57 //Booking Party Name, Address line 6; + tempstr += GetSpaceStr("", 35); + tempstr += GetSpaceStr("", 35); + tempstr += GetSpaceStr("", 35); + tempstr += GetSpaceStr("", 35); + tempstr += GetSpaceStr("", 4);//12 //SCAC Code//O//X(4)//233 //236 // + tempstr += GetSpaceStr("", 14);//13 //Filler//M//X(14)//237 //250 //Spaces + + tempstr = GetSpaceStr(tempstr, 232); + tempstr += GetSpaceStr("", 4);//12 //SCAC Code//O//X(4)//233 //236 // + tempstr += GetSpaceStr(OpAms.SalesRepCode, 14);//13 //Filler//M//X(14)//237 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + #region 21 + tempstr = "21";//1 //RECORD-ID//M//9(2)//1 //2 //21 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + if (bill.BLFRT.IndexOf("FREIGHT COLLECT") > -1)//运费到付 + { + tempstr += GetSpaceStr(OpAms.ConsigneeEdiCode, 10);//3 //Consignee Code//O//X(10)//6 //15 //webcsm Partner Code//mandtory for FOB shpts,收货人代码,到付必填。跟客服要 + } + else + { + tempstr += GetSpaceStr("", 10);//3 //Consignee Code//O//X(10)//6 //15 //webcsm Partner Code//mandtory for FOB shpts,收货人代码,到付必填 + } + tempstr += GetSpaceStr("", 3);//4 //Consignee Code//O//X(3)//16 //18 //webcsm Partner Subcode + tempstr += GetSpaceStr("", 4);//5 //Filler//M//X(4)//19 //22 //Spaces + Shipping = ""; + Shipping = bill.CONSIGNEE; + //ShippingList = formatlengthStr(Shipping, 35); + ShippingList = formatlengthStr(Shipping, 32, out tmpDescription, 6, "**"); + if (tmpDescription != null && tmpDescription.Count != 0) + { + foreach (var tmp in tmpDescription) + { + ShippingDescription.Add(tmp); + } + } + + + for (var i = 0; i < ShippingList.Count; i++) + { + if (i <= 6) + { + tempstr += GetSpaceStr(ShippingList[i], 35);//6 //Consignee item - (1)//M//X(35)//23 //57 //Consignee Name, Address line 1 + } + } + //6 //Consignee item - (1)//M//X(35)//23 //57 //Consignee Name, Address line 1 + //7 //Consignee item - (2)//M//X(35)//58 //92 //Consignee Name, Address line 2 + //8 //Consignee item - (3)//M//X(35)//93 //127 //Consignee Name, Address line 3 + //9 //Consignee item - (4)//M//X(35)//128 //162 //Consignee Name, Address line 4 + //10 //Consignee item - (5)//M//X(35)//163 //197 //Consignee Name, Address line 5 + //11 //Consignee item - (6)//M//X(35)//198 //232 //Consignee Name, Address line 6 + //12 //SCAC Code//O//X(4)//233 //236 // + //13 //Filler//M//X(14)//237 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + #region 26 + tempstr = "26";//1 //RECORD-ID//M//9(2)//1 //2 //26 + tempstr += GetSpaceStr("", 2);//2 //Filler//M//X(2)//3 //4 //Spaces + tempstr += "1";//3 //Notify Party Count//M//9(1)//5 //5 //I = 1 to 3 notify party + tempstr += GetSpaceStr("", 10);//4 //Notify Code//O//X(10)//6 //15 //webcsm Partner Code + tempstr += GetSpaceStr("", 3);//5 //Notify Code//O//X(3)//16 //18 //webcsm Partner Subcode + tempstr += GetSpaceStr("", 4);//6 //Filler//M//X(4)//19 //22 //Spaces + Shipping = ""; + Shipping = bill.NOTIFYPARTY; + //ShippingList = formatlengthStr(Shipping, 35); + ShippingList = formatlengthStr(Shipping, 32, out tmpDescription, 6, "***"); + if (tmpDescription != null && tmpDescription.Count != 0) + { + foreach (var tmp in tmpDescription) + { + ShippingDescription.Add(tmp); + } + } + + + for (var i = 0; i < ShippingList.Count; i++) + { + if (i <= 6) + { + tempstr += GetSpaceStr(ShippingList[i], 35);//7 //Notify Field-(1)//M//X(35)//23 //57 //Notify Party Name, Address line 1 + } + } + //7 //Notify Field-(1)//M//X(35)//23 //57 //Notify Party Name, Address line 1 + //8 //Notify Field-(2)//M//X(35)//58 //92 //Notify Party Name, Address line 2 + //9 //Notify Field-(3)//M//X(35)//93 //127 //Notify Party Name, Address line 3 + //10 //Notify Field-(4)//M//X(35)//128 //162 //Notify Party Name, Address line 4 + //11 //Notify Field-(5)//M//X(35)//163 //197 //Notify Party Name, Address line 5 + //12 //Notify Field-(6)//M//X(35)//198 //232 //Notify Party Name, Address line 6 + //12 //SCAC Code//O//X(4)//233 //236 // + //13 //Filler//M//X(14)//237 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + var soc = "Y"; + if (bill.ISCONTAINERSOC) + { + soc = "S"; + } + var ctnlistsum = MsOpSeaeDAL.MsOpSeaeDAL.GetBodyListSum("BSNO='" + bill.BSNO + "'"); + var ctnline = 1; + foreach (var ctn in ctnlistsum) + { + if (ctn.CNTRSOURCE == "SOC") soc = "S"; + + if (filetype == "E") + { + #region ESI + #region 41 + tempstr = "41";//1 //RECORD-ID//M//9(2)//1 //2 //41 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence#//M//9(3)//6 //8 //001 to 999 (line-items) + if (bill.HSCODE.ToString().Length > 6) + { + tempstr += GetSpaceStr(bill.HSCODE.ToString().Substring(0, 6), 9);//4 //Commodity Code//M//X(9)//9 //17 //6 Digits HS CODE//mandtory,Hscode,必填,商品编码前6位 + } + else + { + tempstr += GetSpaceStr(bill.HSCODE.ToString(), 9);//4 //Commodity Code//M//X(9)//9 //17 //6 Digits HS CODE//mandtory,Hscode,必填,商品编码前6位 + } + tempstr += "Y";//5 //BL Override//M//X(1)//18 //18 //Y or N, Y=lumpsum weights used, (out from webCSM only) + tempstr += GetSpaceStr(ctn.CTNNUM.ToString(), 6, "0");//6 //No of packages/Containers//M//9(6)//19 //24 //Number of Containers for the cargo line + //tempstr += GetSpaceStr(ctn.TEU.ToString(), 4, "0");//7 //TEU Utilisation//C//9(4)//25 //28 //Actual TEU utilised, eg. OOG's slot kill or Flatrack bundled units + tempstr += GetSpaceStr("", 4);//7 //TEU Utilisation//C//9(4)//25 //28 //Actual TEU utilised, eg. OOG's slot kill or Flatrack bundled units + tempstr += GetSpaceStr((ctn.KGS * 1000).ToString(), 11, "0");//8 //Cargo Gross Weight//C//9(8)v999//29 //39 //Mandatory, except for Empties + tempstr += GetSpaceStr("0", 11, "0");//9 //Cargo Nett Weight//C//9(8)v999//40 //50 //Mandatory, except for Empties + tempstr += GetSpaceStr((ctn.CBM * 1000).ToString(), 10, "0");//10 //Cargo Gross Measurement//C//9(7)v999//51 //60 //Mandatory, except for Empties + tempstr += GetSpaceStr("", 10, "0");//11 //Cargo Nett Measurement//C//9(7)v999//61 //70 //Mandatory, except for Empties + tempstr += GetSpaceStr(bill.GOODSNAME, 48);//12 //Commodity Name//O//X(48)//71 //118 // + //tempstr += GetSpaceStr(GetGOODEDICode(bill.GOODSNAME), 4);//13 //webcsm Commodity Code//O//X(4)//119 //122 //webCSM Standard Commodity Code + tempstr += GetSpaceStr("", 4);//13 //webcsm Commodity Code//O//X(4)//119 //122 //webCSM Standard Commodity Code + tempstr += GetSpaceStr(GetCtnEDICode(ctn.CTNALL, "PIL"), 4);//14 //webcsm Package Code//M//X(4)//123 //126 //eg 20GP, 40GP etc. + tempstr += "KGM";//15 //UOM Weight//M//X(3)//127 //129 //Default to METRIC = KGM + tempstr += "MTQ";//16 //UOM Measurement//M//X(3)//130 //132 //Default to METRIC = MTQ + tempstr += soc;//17 //Equipment Flag //M//X(1)//133 //133 //Y:COC cntr required, N:cntr not required, S:SOC//mandtory,只要有SOC箱子就要填S + tempstr += GetSpaceStr("", 117);//18 //Filler//M//X(117)//134 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + #region 44 + if (ctnline == 1) + { + Shipping = bill.MARKS; + ShippingList = formatlengthStr(Shipping, 20); + for (var i = 0; i < Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(ShippingList.Count) / Convert.ToDecimal(12))); i++) + { + tempstr = "44";//1 //RECORD-ID//M//9(2)//1 //2 //44 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence No#//M//9(3)//6 //8 //001 to 999 (line-items) + for (var z = 0; z < 12; z++) + { + if ((i * 12 + z) < ShippingList.Count) + { + tempstr += GetSpaceStr(ShippingList[i * 12 + z], 20);//4 //Mark-no-(1)//O//X(20)//9 //28 + } + } + //4 //Mark-no-(1)//O//X(20)//9 //28 // + //5 //Mark-no-(2)//O//X(20)//29 //48 // + //6 //Mark-no-(3)//O//X(20)//49 //68 // + //7 //Mark-no-(4)//O//X(20)//69 //88 // + //8 //Mark-no-(5)//O//X(20)//89 //108 // + //9 //Mark-no-(6)//O//X(20)//109 //128 // + //10 //Mark-no-(7)//O//X(20)//129 //148 // + //11 //Mark-no-(8)//O//X(20)//149 //168 // + //12 //Mark-no-(9)//O//X(20)//169 //188 // + //13 //Mark-no-(10)//O//X(20)//189 //208 // + //14 //Mark-no-(11)//O//X(20)//209 //228 // + //15 //Mark-no-(12)//O//X(20)//229 //248 // + //16 //Filler//M//X(2)//249 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + } + } + #endregion + + #region 47 + if (ctnline == 1) + { + #region 47 + tempstr = "47";//1 //RECORD-ID//M//9(2)//1 //2 //47 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence No#//M//9(3)//6 //8 //001 to 999 (line-items) + tempstr += bill.PKGS.ToString() + bill.KINDPKGS;//4 //Cargo Description- (1)//O//X(30)//9 //38 // + //5 //Cargo Description- (2)//O//X(30)//39 //68 // + //6 //Cargo Description- (3)//O//X(30)//69 //98 // + //7 //Cargo Description- (4)//O//X(30)//99 //128 // + //8 //Cargo Description- (5)//O//X(30)//129 //158 // + //9 //Cargo Description- (6)//O//X(30)//159 //188 // + //10 //Cargo Description- (7)//O//X(30)//189 //218 // + //11 //Cargo Description- (8)//O//X(30)//219 //248 // + //12 //Filler//M//X(2)//249 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + Shipping = bill.DESCRIPTION; + ShippingList = formatlengthStr(Shipping, 30); + if (ShippingDescription != null && ShippingDescription.Count != 0) + { + foreach (var tmp in ShippingDescription) + { + ShippingList.Add(tmp); + } + } + + + + for (var i = 0; i < Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(ShippingList.Count) / Convert.ToDecimal(8))); i++) + { + tempstr = "47";//1 //RECORD-ID//M//9(2)//1 //2 //47 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence No#//M//9(3)//6 //8 //001 to 999 (line-items) + for (var z = 0; z < 8; z++) + { + if ((i * 8 + z) < ShippingList.Count) + { + tempstr += GetSpaceStr(ShippingList[i * 8 + z], 30);//4 //Cargo Description- (1)//O//X(30)//9 //38 // + } + } + //4 //Cargo Description- (1)//O//X(30)//9 //38 // + //5 //Cargo Description- (2)//O//X(30)//39 //68 // + //6 //Cargo Description- (3)//O//X(30)//69 //98 // + //7 //Cargo Description- (4)//O//X(30)//99 //128 // + //8 //Cargo Description- (5)//O//X(30)//129 //158 // + //9 //Cargo Description- (6)//O//X(30)//159 //188 // + //10 //Cargo Description- (7)//O//X(30)//189 //218 // + //11 //Cargo Description- (8)//O//X(30)//219 //248 // + //12 //Filler//M//X(2)//249 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + } + } + #endregion + + var ctndetaillist = MsOpSeaeDAL.MsOpSeaeDAL.GetBodyList("BSNO='" + bill.BSNO + "' and CTNALL='" + ctn.CTNALL + "'"); + var m = 1; + foreach (var ctndetail in ctndetaillist) + { + + + + if (ctndetail.CTNSTATUS == "") ctndetail.CTNSTATUS = "F"; + + if (ctndetail.CNTRNO != "") + { + #region 51 + tempstr = "51";//1//RECORD-ID//M//9(2)//1//2//51 + tempstr += GetSpaceStr("", 3);//2//Filler//M//X(3)//3//5//Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3//Cargo Sequence No#//M//9(3)//6//8//001 to 999 (line-items) + tempstr += GetSpaceStr(m.ToString(), 3, "0");//4//Equipment Sequence No//M//9(3)//9//11//001 to 999 + tempstr += GetSpaceStr(ctndetail.CNTRNO, 11);//5//Container No//M//X(11)//12//22//Container Number + if (ctndetail.CNTRSOURCE == "SOC") + { + tempstr += "Y";//6//Container SOC//M//X(1)//23//23//Y or N + } + else + { + tempstr += "N";//6//Container SOC//M//X(1)//23//23//Y or N + } + tempstr += GetCtnEDICode(ctn.CTNALL, "PIL");//7//Cntr Size/type code//M//X(4)//24//27//ISO Size/type eg 2200 + tempstr += ctndetail.CTNSTATUS;//8//Cntr Loading Status//M//X(1)//28//28//F-Full, P-Part, E-Empty + tempstr += GetSpaceStr("", 3);//9//Cntr Operator//O//X(3)//29//31// + tempstr += GetSpaceStr("KGM", 3);//10//UOM Weight//M//X(3)//32//34//Default to METRIC = KGM + tempstr += GetSpaceStr("MTQ", 3);//11//UOM Measurement//M//X(3)//35//37//Default to METRIC = MTQ + tempstr += GetSpaceStr("", 9);//12//Filler//M//X(9)//38//46//Spaces + tempstr += GetSpaceStr(ctndetail.PKGS.ToString(), 6, "0");//13//Cntr No of Packages//O//9(6)//47//52//Number of Packages in the Container + tempstr += GetSpaceStr(ctndetail.KINDPKGS, 8);//14//Cntr Kind of Packages//O//X(8)//53//60//Package Description (limited to 8 characters) + // tempstr += GetSpaceStr(GetPackageEDICode(ctndetail.KINDPKGS, "PIL"), 8);//14//Cntr Kind of Packages//O//X(8)//53//60//Package Description (limited to 8 characters) + tempstr += GetSpaceStr((ctndetail.KGS * 1000).ToString(), 9, "0");//15//Cntr Cargo Gross Weight//O//9(6)v999//61//69//Cargo Gross Weight per the container unit + tempstr += GetSpaceStr("", 9, "0");//16//Cntr Tare Weight//O//9(6)v999//70//78//Container Tare Weight + tempstr += GetSpaceStr((ctndetail.CBM * 1000).ToString(), 9, "0");//17//Cntr Cargo Measurement//O//9(6)v999//79//87//Measurement per the container unit + tempstr += GetSpaceStr("", 9, "0");//18//Cntr Cargo Net Weight//O//9(6)v999//88//96//Cargo Net Weight per the container unit + tempstr += GetSpaceStr(GetPackageEDICode(ctndetail.KINDPKGS, "PIL"), 5);//19//webCSM Package Code//O//X(5)//97//101//Package code within the container eg BX (boxes) + tempstr += GetSpaceStr("", 20);//20//Seal No (Shipper)//O//X(20)//102//121//Shipper's Seal Number + tempstr += GetSpaceStr(ctndetail.SEALNO, 20);//21//Seal No (Carrier)//O//X(20)//122//141//Carrier's Seal Number + tempstr += GetSpaceStr("", 20);//22//Seal No (Customs)//O//X(20)//142//161//Customs' Seal Number + tempstr += GetSpaceStr("", 20);//23//Seal No (Others)//O//X(20)//162//181//4th Seal Number + tempstr += GetSpaceStr("", 1);//24//Shortship Flag//C//X(1)//182//182//Y:Shortship, S:Shortland, O:Overland, else leave blank + tempstr += GetSpaceStr("", 20);//25//Part BL Cross-reference (Their Ref)//C//X(20)//183//202//Cross-ref to Main/Sub OBL of Part containers, only applicable to Part BLs + tempstr += GetSpaceStr("", 48);//26//Filler//M//X(48)//203//250//Spaces + + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + } + + if (bill.CARGOID == "R") + { + #region 54 冻柜 + var tmpset = ""; + if (bill.TEMPSET.IndexOf("-") >= 0) + { + tmpset = "-"; + } + else + { + tmpset = "0"; + } + bill.TEMPSET = bill.TEMPSET.Replace("+", "").Replace("-", ""); + + tempstr = "54";//1 //RECORD-ID//M//9(2)//1 //2 //54 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence No#//货物的序列号//M//9(3)//6 //8 //001 to 999 (line-items) + tempstr += GetSpaceStr(m.ToString(), 3, "0");//4 //Equipment Sequence No设备序列号//M//9(3)//9 //11 //001 to 999 + tempstr += "C";//5 //Reefer Temperature UOM冷藏温度计量单位//M//X(1)//12 //12 //C or F (C=Celsius, F=Fahrenheit) + tempstr += GetSpaceStr("", 5);//6 //Reefer Min Temperature//C//9(3)v99//13 //17 //If MAX exists, MIN should exists + tempstr += GetSpaceStr("", 5);//7 //Reefer Max Temperature//C//9(3)v99//18 //22 //If MIN exists, MAX should exists + tempstr += tmpset + GetSpaceStr((Convert.ToDecimal(bill.TEMPSET) * 100).ToString(), 4, "0");//8 //Reefer Preset Temperature冷藏温度设定//C//9(3)v99//23 //27 //Blank if no Preset required + tempstr += "N";//9 //Reefer Gensets Required冷藏机组的要求//M//X(1)//28 //28 //Y or N + if (bill.REEFERF != "") + { + tempstr += GetSpaceStr((Convert.ToDecimal(bill.REEFERF) * 100).ToString(), 5, "0");//10 //Reefer Vent Open Value冷藏等开放价值//C//9(3)v99//29 //33 //Blank if Vent Status = 'Closed', else value in relation to Vent UOM如果等待空白状态=“闭合”,其他的值等计量单位 + } + else + { + tempstr += GetSpaceStr("", 5);//10 //Reefer Vent Open Value冷藏等开放价值//C//9(3)v99//29 //33 //Blank if Vent Status = 'Closed', else value in relation to Vent UOM如果等待空白状态=“闭合”,其他的值等计量单位 + } + tempstr += "Y";//11 //Pretrip Flag//M//X(1)//34 //34 //Y or N + tempstr += tmpset + GetSpaceStr((Convert.ToDecimal(bill.TEMPSET) * 100).ToString(), 4, "0");//12 //Carriage Temperature运输温度//C//9(3)v99//35 //39 //For operating reefers, at least one temperature field must not be blank + if (bill.REEFERF != "") + { + tempstr += "H";//13 //Reefer Vent Status冷藏通风状况/UOM//C//X(1)//40 //40 //C:Closed, F:CFM, H:M3/H, P:Percentage, O:Open + } + else + { + tempstr += "C";//13 //Reefer Vent Status冷藏通风状况/UOM//C//X(1)//40 //40 //C:Closed, F:CFM, H:M3/H, P:Percentage, O:Open + } + tempstr += GetSpaceStr("", 210);//14 //Filler//M//X(210)//41 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + } + else if (bill.CARGOID == "D") + { + + var opctndetaillist = MsOpSeaeDAL.MsOpSeaeDAL.GetOpCtnDetailList("CTN_ID='" + ctndetail.CTN_ID + "'"); + var LINKMAN = ""; + var DUNNO = ""; + var DCLASS = ""; + var DPAGE = ""; + var DGOODNAME = ""; + var PKGTYPE = ""; + var DTEL = ""; + if (opctndetaillist != null && opctndetaillist.Count != 0) + { + LINKMAN = opctndetaillist[0].LINKMAN; + DUNNO = opctndetaillist[0].DUNNO; + DCLASS = opctndetaillist[0].DCLASS; + DPAGE = opctndetaillist[0].DPAGE; + PKGTYPE = opctndetaillist[0].PKGTYPE; + DTEL = opctndetaillist[0].DTEL; + } + if (string.IsNullOrEmpty(LINKMAN)) LINKMAN = bill.LINKMAN; + if (string.IsNullOrEmpty(DUNNO)) DUNNO = bill.DUNNO; + if (string.IsNullOrEmpty(DCLASS)) DCLASS = bill.DCLASS; + if (string.IsNullOrEmpty(DPAGE)) DPAGE = bill.DPAGE; + if (string.IsNullOrEmpty(DGOODNAME)) DGOODNAME = OpAms.RAILWAY_PORTLOAD; + if (string.IsNullOrEmpty(PKGTYPE)) PKGTYPE = bill.PKGTYPE; + if (string.IsNullOrEmpty(DTEL)) DTEL = bill.DTEL; + var ISMP = "N"; + if (bill.ISMP == "1") ISMP = "Y"; + + #region 55 危险品紧急联系信息 + tempstr = "55";//1//RECORD-ID//M//9(2)//1//2//55//record-id + tempstr += GetSpaceStr("", 1);//2//Filler//M//X(1)//3//3//Spaces//填料 + tempstr += "01";//3//DG Sequence No//M//9(2)//4//5//Default to "01", Rec 55 is needed only once for each equipment seq//DG的序列号 + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//4//Cargo Sequence No#//M//9(3)//6//8//001 to 999 (line-items)//货物没有#序列 + tempstr += GetSpaceStr(m.ToString(), 3, "0");//5//Equipment Sequence No//M//9(3)//9//11//001 to 999//设备序列号 + tempstr += GetSpaceStr(LINKMAN, 35);//6//Emergency Contact//O//X(35)//12//46////急救联系 + tempstr += GetSpaceStr(DTEL, 35);//7//Emergency Tel//O//X(35)//47//81////急救电话 + tempstr += GetSpaceStr("", 100);//8//Emergency Email//O//X(100)//82//181////急救的电子邮件 + tempstr += GetSpaceStr("", 20);//9//Emergency Reference//O//X(20)//182//201////急救参考 + tempstr += GetSpaceStr("", 49);//10//Filler//M//X(49)//202//250//Spaces//填料 + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + #region 56 危险品//56 01001001//2556//a//4.1 //2 //KGM//008220000//009516000//N + tempstr = "56";//1//RECORD-ID M 9(2) 1//2//56 + tempstr += GetSpaceStr("", 1);//2//Filler M X(1) 3//3//Spaces 填料 + tempstr += GetSpaceStr("01", 2);//3//DG Sequence No M 9(2) 4//5//01 to 99, to denote multiple DG items in each equipment seq (cntr) DG的序列号 + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//4//Cargo Sequence No# M 9(3) 6//8//001 to 999 (line-items)//货物没有#序列 + tempstr += GetSpaceStr(m.ToString(), 3, "0");//5//Equipment Sequence No M 9(3) 9//11//001 to 999 设备序列号 + tempstr += GetSpaceStr(DUNNO, 4);//6//UN Number M X(4) 12//15// 联合国编号 + tempstr += GetSpaceStr("", 1);//7//UN Variant M X(1) 16//16// 联合国的变体 + tempstr += GetSpaceStr(DCLASS, 4);//8//IMO Class M X(4) 17//20// 国际海事组织类 + tempstr += GetSpaceStr("", 3);//9//PSA Class O X(3) 21//23// PSA类 + tempstr += "KGM";//10//UOM M X(3) 24//26//Default to METRIC, eg. KGM 计量单位 + tempstr += GetSpaceStr((Convert.ToDecimal(ctn.CTNPRICE) * 1000 / ctn.CTNNUM).ToString(), 9, "0");//11//Net Weight C 9(6)v999 27//35//Weight of DG item 净重量 + tempstr += GetSpaceStr((ctn.KGS * 1000 / ctn.CTNNUM).ToString(), 9, "0");//12//Gross Weight C 9(6)v999 36//44//Weight of DG item 总重量 + tempstr += ISMP;//13//Marine Pollutant M X(1) 45//45//Y or N 海洋污染物 + tempstr += GetSpaceStr(DPAGE, 10);//14//IMDG Page O X(10) 46//55// 危规页码 + tempstr += GetSpaceStr("", 4);//15//DOT Packaging Group O X(4) 56//59// 点包装集团 + tempstr += GetSpaceStr("", 10);//16//Filler M X(10) 60//69//Spaces 填料 + tempstr += GetSpaceStr("", 25);//17//Flashpoint O X(25) 70//94// 闪点 + tempstr += GetSpaceStr(PKGTYPE, 3);//18//Packing Group O X(3) 95//97// 包装组 + tempstr += GetSpaceStr(GetPackageEDICode(bill.KINDPKGS, "PIL"), 5);//19//Outer Package Code O X(5) 98//102//webCSM Package Code 外包装编码 + tempstr += GetSpaceStr((ctndetail.PKGS / ctn.CTNNUM).ToString(), 9, "0");//20//Outer Quantity O 9(9) 103//111// 外量 + tempstr += GetSpaceStr("", 5);//21//Inner Package Code O X(5) 112//116//webCSM Package Code 内包装代码 + tempstr += GetSpaceStr("", 9);//22//Inner Quantity O 9(9) 117//125// 内部变量 + tempstr += GetSpaceStr("", 5);//23//Next Inner Package Code O X(5) 126//130//webCSM Package Code 下一个内部包代码 + tempstr += GetSpaceStr("", 9);//24//Next Inner Quantity O 9(9) 131//139// 下一个内部变量 + tempstr += GetSpaceStr(DGOODNAME, 50);//25//Chemical Name O X(50) 140//189// 化学名称 + tempstr += GetSpaceStr("", 20);//26//Our Reference O X(20) 190//209// 我们的参考 + tempstr += GetSpaceStr("", 21);//28//Filler M X(21) 230//250//Spaces 填料 + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + } + m = m + 1; + } + #endregion + } + else + { + if (ctn.CNTRSOURCE == "SOC") soc = "S"; + #region EDI + #region 41 + tempstr = "41";//1 //RECORD-ID//M//9(2)//1 //2 //41 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence#//M//9(3)//6 //8 //001 to 999 (line-items) + //tempstr += GetSpaceStr(GetGOODEDICode(bill.GOODSNAME), 9);//4 //Commodity Code//M//X(9)//9 //17 //6 Digits HS CODE + if (bill.HSCODE.ToString().Length > 6) + { + tempstr += GetSpaceStr(bill.HSCODE.ToString().Substring(0, 6), 9);//4 //Commodity Code//M//X(9)//9 //17 //6 Digits HS CODE + } + else + { + tempstr += GetSpaceStr(bill.HSCODE.ToString(), 9);//4 //Commodity Code//M//X(9)//9 //17 //6 Digits HS CODE + } + tempstr += "Y";//5 //BL Override//M//X(1)//18 //18 //Y or N, Y=lumpsum weights used, (out from webCSM only) + tempstr += GetSpaceStr(ctn.CTNNUM.ToString(), 6, "0");//6 //No of packages/Containers//M//9(6)//19 //24 //Number of Containers for the cargo line + tempstr += GetSpaceStr(ctn.TEU.ToString(), 4, "0");//7 //TEU Utilisation//C//9(4)//25 //28 //Actual TEU utilised, eg. OOG's slot kill or Flatrack bundled units + tempstr += GetSpaceStr((ctn.KGS * 1000).ToString(), 11, "0");//8 //Cargo Gross Weight//C//9(8)v999//29 //39 //Mandatory, except for Empties + tempstr += GetSpaceStr("0", 11, "0");//9 //Cargo Nett Weight//C//9(8)v999//40 //50 //Mandatory, except for Empties + tempstr += GetSpaceStr((ctn.CBM * 1000).ToString(), 10, "0");//10 //Cargo Gross Measurement//C//9(7)v999//51 //60 //Mandatory, except for Empties + tempstr += GetSpaceStr((ctn.CBM * 1000).ToString(), 10, "0");//11 //Cargo Nett Measurement//C//9(7)v999//61 //70 //Mandatory, except for Empties + tempstr += GetSpaceStr(bill.GOODSNAME, 48);//12 //Commodity Name//O//X(48)//71 //118 // + //tempstr += GetSpaceStr(GetGOODEDICode(bill.GOODSNAME), 4);//13 //webcsm Commodity Code//O//X(4)//119 //122 //webCSM Standard Commodity Code + tempstr += GetSpaceStr("", 4);//13 //webcsm Commodity Code//O//X(4)//119 //122 //webCSM Standard Commodity Code + tempstr += GetSpaceStr(GetCtnEDICode(ctn.CTNALL, "PIL"), 4);//14 //webcsm Package Code//M//X(4)//123 //126 //eg 20GP, 40GP etc. + tempstr += "KGM";//15 //UOM Weight//M//X(3)//127 //129 //Default to METRIC = KGM + tempstr += "MTQ";//16 //UOM Measurement//M//X(3)//130 //132 //Default to METRIC = MTQ + tempstr += GetSpaceStr(soc, 1); ;//17 //Equipment Flag //M//X(1)//133 //133 //Y:COC cntr required, N:cntr not required, S:SOC + tempstr += GetSpaceStr("", 117);//18 //Filler//M//X(117)//134 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + #region 44 + Shipping = bill.MARKS; + ShippingList = formatlengthStr(Shipping, 20); + for (var i = 0; i < Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(ShippingList.Count) / Convert.ToDecimal(12))); i++) + { + tempstr = "44";//1 //RECORD-ID//M//9(2)//1 //2 //44 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence No#//M//9(3)//6 //8 //001 to 999 (line-items) + for (var z = 0; z < 12; z++) + { + if ((i * 12 + z) < ShippingList.Count) + { + tempstr += GetSpaceStr(ShippingList[i * 12 + z], 20);//4 //Mark-no-(1)//O//X(20)//9 //28 + } + } + //4 //Mark-no-(1)//O//X(20)//9 //28 // + //5 //Mark-no-(2)//O//X(20)//29 //48 // + //6 //Mark-no-(3)//O//X(20)//49 //68 // + //7 //Mark-no-(4)//O//X(20)//69 //88 // + //8 //Mark-no-(5)//O//X(20)//89 //108 // + //9 //Mark-no-(6)//O//X(20)//109 //128 // + //10 //Mark-no-(7)//O//X(20)//129 //148 // + //11 //Mark-no-(8)//O//X(20)//149 //168 // + //12 //Mark-no-(9)//O//X(20)//169 //188 // + //13 //Mark-no-(10)//O//X(20)//189 //208 // + //14 //Mark-no-(11)//O//X(20)//209 //228 // + //15 //Mark-no-(12)//O//X(20)//229 //248 // + //16 //Filler//M//X(2)//249 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + } + #endregion + + if (ctnline == 1) + { + #region 47 + tempstr = "47";//1 //RECORD-ID//M//9(2)//1 //2 //47 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence No#//M//9(3)//6 //8 //001 to 999 (line-items) + tempstr += bill.PKGS.ToString() + bill.KINDPKGS;//4 //Cargo Description- (1)//O//X(30)//9 //38 // + //5 //Cargo Description- (2)//O//X(30)//39 //68 // + //6 //Cargo Description- (3)//O//X(30)//69 //98 // + //7 //Cargo Description- (4)//O//X(30)//99 //128 // + //8 //Cargo Description- (5)//O//X(30)//129 //158 // + //9 //Cargo Description- (6)//O//X(30)//159 //188 // + //10 //Cargo Description- (7)//O//X(30)//189 //218 // + //11 //Cargo Description- (8)//O//X(30)//219 //248 // + //12 //Filler//M//X(2)//249 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + } + + #region 47 description + Shipping = bill.DESCRIPTION; + ShippingList = formatlengthStr(Shipping, 30); + for (var i = 0; i < Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(ShippingList.Count) / Convert.ToDecimal(8))); i++) + { + tempstr = "47";//1 //RECORD-ID//M//9(2)//1 //2 //47 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence No#//M//9(3)//6 //8 //001 to 999 (line-items) + for (var z = 0; z < 8; z++) + { + if ((i * 8 + z) < ShippingList.Count) + { + tempstr += GetSpaceStr(ShippingList[i * 8 + z], 30);//4 //Cargo Description- (1)//O//X(30)//9 //38 // + } + } + //4 //Cargo Description- (1)//O//X(30)//9 //38 // + //5 //Cargo Description- (2)//O//X(30)//39 //68 // + //6 //Cargo Description- (3)//O//X(30)//69 //98 // + //7 //Cargo Description- (4)//O//X(30)//99 //128 // + //8 //Cargo Description- (5)//O//X(30)//129 //158 // + //9 //Cargo Description- (6)//O//X(30)//159 //188 // + //10 //Cargo Description- (7)//O//X(30)//189 //218 // + //11 //Cargo Description- (8)//O//X(30)//219 //248 // + //12 //Filler//M//X(2)//249 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + } + #endregion + + for (var m = 1; m <= ctn.CTNNUM; ++m) + { + if (bill.CARGOID == "R") + { + #region 54 冻柜 + var tmpset = ""; + if (bill.TEMPSET.IndexOf("-") >= 0) + tmpset = "-"; + else + tmpset = "0"; + bill.TEMPSET = bill.TEMPSET.Replace("+", "").Replace("-", ""); + + tempstr = "54";//1 //RECORD-ID//M//9(2)//1 //2 //54 + tempstr += GetSpaceStr("", 3);//2 //Filler//M//X(3)//3 //5 //Spaces + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//3 //Cargo Sequence No#//货物的序列号//M//9(3)//6 //8 //001 to 999 (line-items) + tempstr += GetSpaceStr(m.ToString(), 3, "0");//4 //Equipment Sequence No设备序列号//M//9(3)//9 //11 //001 to 999 + tempstr += "C";//5 //Reefer Temperature UOM冷藏温度计量单位//M//X(1)//12 //12 //C or F (C=Celsius, F=Fahrenheit) + tempstr += GetSpaceStr("", 5);//6 //Reefer Min Temperature//C//9(3)v99//13 //17 //If MAX exists, MIN should exists + tempstr += GetSpaceStr("", 5);//7 //Reefer Max Temperature//C//9(3)v99//18 //22 //If MIN exists, MAX should exists + tempstr += tmpset + GetSpaceStr((Convert.ToDecimal(bill.TEMPSET) * 100).ToString(), 4, "0");//8 //Reefer Preset Temperature冷藏温度设定//C//9(3)v99//23 //27 //Blank if no Preset required + tempstr += "N";//9 //Reefer Gensets Required冷藏机组的要求//M//X(1)//28 //28 //Y or N + if (bill.REEFERF != "") + { + tempstr += GetSpaceStr((Convert.ToDecimal(bill.REEFERF) * 100).ToString(), 5, "0");//10 //Reefer Vent Open Value冷藏等开放价值//C//9(3)v99//29 //33 //Blank if Vent Status = 'Closed', else value in relation to Vent UOM如果等待空白状态=“闭合”,其他的值等计量单位 + } + else + { + tempstr += GetSpaceStr("", 5);//10 //Reefer Vent Open Value冷藏等开放价值//C//9(3)v99//29 //33 //Blank if Vent Status = 'Closed', else value in relation to Vent UOM如果等待空白状态=“闭合”,其他的值等计量单位 + } + tempstr += "Y";//11 //Pretrip Flag//M//X(1)//34 //34 //Y or N + tempstr += tmpset + GetSpaceStr((Convert.ToDecimal(bill.TEMPSET) * 100).ToString(), 4, "0");//12 //Carriage Temperature运输温度//C//9(3)v99//35 //39 //For operating reefers, at least one temperature field must not be blank + if (bill.REEFERF != "") + { + tempstr += "H";//13 //Reefer Vent Status冷藏通风状况/UOM//C//X(1)//40 //40 //C:Closed, F:CFM, H:M3/H, P:Percentage, O:Open + } + else + { + tempstr += "C";//13 //Reefer Vent Status冷藏通风状况/UOM//C//X(1)//40 //40 //C:Closed, F:CFM, H:M3/H, P:Percentage, O:Open + } + tempstr += GetSpaceStr("", 210);//14 //Filler//M//X(210)//41 //250 //Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + } + else if (bill.CARGOID == "D") + { + + var opctndetaillist = MsOpSeaeDAL.MsOpSeaeDAL.GetOpCtnDetailList("CTN_ID='" + ctn.CTN_ID + "'"); + var LINKMAN = ""; + var DUNNO = ""; + var DCLASS = ""; + var DPAGE = ""; + var DGOODNAME = ""; + var PKGTYPE = ""; + var DTEL = ""; + if (opctndetaillist != null && opctndetaillist.Count != 0) + { + LINKMAN = opctndetaillist[0].LINKMAN; + DUNNO = opctndetaillist[0].DUNNO; + DCLASS = opctndetaillist[0].DCLASS; + DPAGE = opctndetaillist[0].DPAGE; + PKGTYPE = opctndetaillist[0].PKGTYPE; + DTEL = opctndetaillist[0].DTEL; + } + if (string.IsNullOrEmpty(LINKMAN)) LINKMAN = bill.LINKMAN; + if (string.IsNullOrEmpty(DUNNO)) DUNNO = bill.DUNNO; + if (string.IsNullOrEmpty(DCLASS)) DCLASS = bill.DCLASS; + if (string.IsNullOrEmpty(DPAGE)) DPAGE = bill.DPAGE; + if (string.IsNullOrEmpty(DGOODNAME)) DGOODNAME = OpAms.RAILWAY_PORTLOAD; + if (string.IsNullOrEmpty(PKGTYPE)) PKGTYPE = bill.PKGTYPE; + if (string.IsNullOrEmpty(DTEL)) DTEL = bill.DTEL; + var ISMP = "N"; + if (bill.ISMP == "1") ISMP = "Y"; + + #region 55 危险品紧急联系信息 + tempstr = "55";//1//RECORD-ID//M//9(2)//1//2//55//record-id + tempstr += GetSpaceStr("", 1);//2//Filler//M//X(1)//3//3//Spaces//填料 + tempstr += "01";//3//DG Sequence No//M//9(2)//4//5//Default to "01", Rec 55 is needed only once for each equipment seq//DG的序列号 + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//4//Cargo Sequence No#//M//9(3)//6//8//001 to 999 (line-items)//货物没有#序列 + tempstr += GetSpaceStr(m.ToString(), 3, "0");//5//Equipment Sequence No//M//9(3)//9//11//001 to 999//设备序列号 + tempstr += GetSpaceStr(LINKMAN, 35);//6//Emergency Contact//O//X(35)//12//46////急救联系 + tempstr += GetSpaceStr(DTEL, 35);//7//Emergency Tel//O//X(35)//47//81////急救电话 + tempstr += GetSpaceStr("", 100);//8//Emergency Email//O//X(100)//82//181////急救的电子邮件 + tempstr += GetSpaceStr("", 20);//9//Emergency Reference//O//X(20)//182//201////急救参考 + tempstr += GetSpaceStr("", 49);//10//Filler//M//X(49)//202//250//Spaces//填料 + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + #region 56 危险品//56 01001001//2556//a//4.1 //2 //KGM//008220000//009516000//N + tempstr = "56";//1//RECORD-ID M 9(2) 1//2//56 + tempstr += GetSpaceStr("", 1);//2//Filler M X(1) 3//3//Spaces 填料 + tempstr += GetSpaceStr("01", 2);//3//DG Sequence No M 9(2) 4//5//01 to 99, to denote multiple DG items in each equipment seq (cntr) DG的序列号 + tempstr += GetSpaceStr(ctnline.ToString(), 3, "0");//4//Cargo Sequence No# M 9(3) 6//8//001 to 999 (line-items)//货物没有#序列 + tempstr += GetSpaceStr(m.ToString(), 3, "0");//5//Equipment Sequence No M 9(3) 9//11//001 to 999 设备序列号 + tempstr += GetSpaceStr(DUNNO, 4);//6//UN Number M X(4) 12//15// 联合国编号 + tempstr += GetSpaceStr("", 1);//7//UN Variant M X(1) 16//16// 联合国的变体 + tempstr += GetSpaceStr(DCLASS, 4);//8//IMO Class M X(4) 17//20// 国际海事组织类 + tempstr += GetSpaceStr("", 3);//9//PSA Class O X(3) 21//23// PSA类 + tempstr += "KGM";//10//UOM M X(3) 24//26//Default to METRIC, eg. KGM 计量单位 + tempstr += GetSpaceStr((Convert.ToDecimal(ctn.CTNPRICE) * 1000 / ctn.CTNNUM).ToString(), 9, "0");//11//Net Weight C 9(6)v999 27//35//Weight of DG item 净重量 + tempstr += GetSpaceStr((ctn.KGS * 1000 / ctn.CTNNUM).ToString(), 9, "0");//12//Gross Weight C 9(6)v999 36//44//Weight of DG item 总重量 + tempstr += ISMP;//13//Marine Pollutant M X(1) 45//45//Y or N 海洋污染物 + tempstr += GetSpaceStr(DPAGE, 10);//14//IMDG Page O X(10) 46//55// 危规页码 + tempstr += GetSpaceStr("", 4);//15//DOT Packaging Group O X(4) 56//59// 点包装集团 + tempstr += GetSpaceStr("", 10);//16//Filler M X(10) 60//69//Spaces 填料 + tempstr += GetSpaceStr("", 25);//17//Flashpoint O X(25) 70//94// 闪点 + tempstr += GetSpaceStr(PKGTYPE, 3);//18//Packing Group O X(3) 95//97// 包装组 + tempstr += GetSpaceStr(GetPackageEDICode(bill.KINDPKGS, "PIL"), 5);//19//Outer Package Code O X(5) 98//102//webCSM Package Code 外包装编码 + tempstr += GetSpaceStr((ctn.PKGS / ctn.CTNNUM).ToString(), 9, "0");//20//Outer Quantity O 9(9) 103//111// 外量 + tempstr += GetSpaceStr("", 5);//21//Inner Package Code O X(5) 112//116//webCSM Package Code 内包装代码 + tempstr += GetSpaceStr("", 9);//22//Inner Quantity O 9(9) 117//125// 内部变量 + tempstr += GetSpaceStr("", 5);//23//Next Inner Package Code O X(5) 126//130//webCSM Package Code 下一个内部包代码 + tempstr += GetSpaceStr("", 9);//24//Next Inner Quantity O 9(9) 131//139// 下一个内部变量 + tempstr += GetSpaceStr(DGOODNAME, 50);//25//Chemical Name O X(50) 140//189// 化学名称 + tempstr += GetSpaceStr("", 20);//26//Our Reference O X(20) 190//209// 我们的参考 + tempstr += GetSpaceStr("", 21);//28//Filler M X(21) 230//250//Spaces 填料 + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + } + } + #endregion + } + ctnline = ctnline + 1; + } + + #region 73 + if (filetype != "E") + { + 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)"//分三行 + //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 (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 + 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.ACIHBL, 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.S0CC0C != "") + { + 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.S0CC0C, 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 (filetype == "E") + { + var ctndetaillist = MsOpSeaeDAL.MsOpSeaeDAL.GetBodyList("BSNO='" + bill.BSNO + "'"); + foreach (var ctndetail in ctndetaillist) + { + 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(ctndetail.CNTRNO, 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)); + } + + + //欧盟港口、伊朗港口、KHI + if (OpAms.cKHI != "") + { + Shipping = OpAms.cKHI; + List ShippingListLs = formatlengthStr(Shipping, 120); + for (var i = 0; i < ShippingListLs.Count; i++) + { + tempstr = "73";//1 //RECORD_ID//M//9(2)//1 //2 //73 + tempstr += "C";//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(ShippingListLs[i], 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.cNCM != "") + { + Shipping = OpAms.cNCM; + List ShippingListLs = formatlengthStr(Shipping, 120); + for (var i = 0; i < ShippingListLs.Count; i++) + { + tempstr = "73";//1 //RECORD_ID//M//9(2)//1 //2 //73 + tempstr += "C";//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(ShippingListLs[i], 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.wNCM != "") + { + Shipping = OpAms.wNCM; + List ShippingListLs = formatlengthStr(Shipping, 120); + for (var i = 0; i < ShippingListLs.Count; i++) + { + tempstr = "73";//1 //RECORD_ID//M//9(2)//1 //2 //73 + tempstr += "W";//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(ShippingListLs[i], 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)); + } + } + } + + #endregion + + #region 74 + tempstr = "74";//1//RECORD-ID//M//9(2)//1//2//74// + tempstr += GetSpaceStr("", 3);//2//Filler//O//X(3)//3//5//Spaces// + tempstr += GetSpaceStr(GetPortEDICode(bill.ISSUEPLACEID, "PIL"), 5);//3//Place of BL issue//M//X(5)//6//10//webCSM Port code (Port of BL Issuance)//提单签发地//webcsm港口代码(BL发行端口) + if (bill.ISSUEDATE.ToString().Trim() == "") + { + tempstr += GetSpaceStr("", 8);//4//Date of BL issue//M//X(8)//11//18//YYYYMMDD//提单签发日期//年月日 + } + else + { + tempstr += GetDateStr(bill.ISSUEDATE, "yyyyMMdd");//4//Date of BL issue//M//X(8)//11//18//YYYYMMDD//提单签发日期//年月日 + } + tempstr += GetSpaceStr("", 4);//5//Department Code//M//X(4)//19//22//webCSM Department Code (eg SG00) (out from webCSM only)//部门代码//webcsm部门代码(如sg00)(从webcsm只) + tempstr += GetSpaceStr("", 3);//6//Booking Agent Code//M//X(3)//23//25//webCSM Booking Agent Code (eg SIN)//订舱代理代码//webcsm订舱代理代码(如犯罪) + if (bill.ISSUETYPE.ToString().Trim().ToUpper() == "WAYBILL") + { + tempstr += GetSpaceStr("W", 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 + } + else + { + 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 + } + 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.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.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//按(港口代码)支付//第一收取缴费地点 + tempstr += GetSpaceStr(bill.PKGS.ToString().Trim(), 8, "0");//13//BL's total No of Packages//O//9(8)//51//58//提单总包数// + tempstr += GetSpaceStr(bill.KINDPKGS, 8);//14//BL's Packages_type in total//O//X(8)//59//66//Default as 'PACKAGE'//BL的packages_type总//默认为“包” + + + tempstr += GetSpaceStr("", 12);//15//Filler//M//X(12)//67//78//Spaces//填料//空间 + tempstr += GetSpaceStr("", 1);//16//Roundtrip Indicator//O//X(1)//79//79//Y:Round trip, else leave Blank//往返指示器//往返,否则留下空白 + tempstr += GetSpaceStr("", 1);//17//Received for Shipment//O//X(1)//80//80//Y:Received for Shipment, else leave Blank//收到的货物//收到装运,否则留空 + tempstr += GetSpaceStr("", 8);//18//Shipped on Board Date//O//X(8)//81//88//YYYYMMDD (SOB Date)//装船日期//YYYYMMDD(SOB日期) + tempstr += GetSpaceStr("", 8);//19//Date of Surrender//O//X(8)//89//96//YYYYMMDD (Surrender Date)//日投降//YYYYMMDD(投降日) + tempstr += GetSpaceStr("", 5);//20//Point of BL Surrender//O//X(5)//97//101//webCSM Port code (Point of BL Surrender)//提单退保点//webcsm港口代码(BL屈服点) + tempstr += GetSpaceStr("", 5);//21//Point of BL Switch//O//X(5)//102//106//webCSM Port code (Point of BL Switch)//BL开关点//webcsm港口代码(BL开关点) + tempstr += GetSpaceStr("", 8);//22//Date of Switch Issuance//O//X(8)//107//114//YYYYMMDD (Switch Issuance Date)//开关签发日期//YYYYMMDD(开关发行日期) + tempstr += GetSpaceStr("", 5);//23//Point of BL Switch Issuance//O//X(5)//115//119//webCSM Port code (Point of BL Switch Issuance)//提单开关点//webcsm港口代码(BL开关发行点) + tempstr += GetSpaceStr("", 5);//24//Final Delivered Point//O//X(5)//120//124//webCSM Port code (Final Released Point of cargo)//最后交付点//webcsm港口代码(最终发布点的货物) + tempstr += GetSpaceStr("", 126);//25//Filler//M//X(126)//125//250//Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + } + + #region 99 + tempstr = "99";//1 RECORD-ID M 9(2) 1 2 99 + tempstr += GetSpaceStr("", 3);//2 Filler M X(3) 3 5 Spaces + tempstr += GetSpaceStr(icount.ToString(), 6, "0");//3 Total No of B/Ls M 9(6) 6 11 Total number of b/ls generated in EDI file + //4 Filler M X(239) 12 250 Spaces + r.WriteLine(GetSpaceStr(tempstr, 250)); + #endregion + + r.Close(); + f.Close(); + + return filename; + } + + #endregion #region 太平玛利亚 diff --git a/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeAmendDrCrGrid.js b/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeAmendDrCrGrid.js index d07f3e9e..33820a2e 100644 --- a/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeAmendDrCrGrid.js +++ b/DSWeb/Areas/MvcShipping/Viewsjs/MsChFee/FeeAmendDrCrGrid.js @@ -5827,10 +5827,10 @@ Ext.extend(Shipping.FeeAmendEditGrid, Ext.Panel, { accdate = this.MsPeriod.PERIOD; } - + var store = this.storeAmendBill; var newbsno = NewGuid(); - + var n = store.getCount(); this.strAmendBSNO = newbsno; var record = null; @@ -5838,6 +5838,7 @@ Ext.extend(Shipping.FeeAmendEditGrid, Ext.Panel, { GID: NewGuid(), BSNO: newbsno, PARENTID: this.strBSNO, + SLNO:n, FEESTATUS: "false", FEESTATUSREF: '未锁定', ACCDATE: accdate, @@ -7557,7 +7558,7 @@ Ext.extend(Shipping.FeeAmendEditGrid, Ext.Panel, { _thisAmendfee.storeDrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 1, optype: _thisAmendfee.stroplb } }); _thisAmendfee.storeCrChFee.load({ params: { billno: _thisAmendfee.strAmendBSNO, type: 2, optype: _thisAmendfee.stroplb } }); - + _thisAmendfee.storeAmendBill.reload(); if (result.Data != '' && result.Data != null) { Ext.Msg.show({