wet 2 years ago
commit 7b674f57c6

@ -745,10 +745,13 @@ namespace Myshipping.Application.EDI.TSL
StreamWriter r = new StreamWriter(f, Encoding.Default);
var icount = 0;
var bsno = "";
//2023-05-04 多次现取当前日期改完生成一下,公用一个日期
DateTime nowDate = DateTime.Now;
foreach (var bill in InttrEdi.BSLIST)
{
bsno = bill.ORDERNO;
r.WriteLine("UNB+UNOC:2+" + InttrEdi.SENDCODE + "SO:ZZZ+" + InttrEdi.RECEIVECODE + ":UN+" + DateTime.Now.ToString("yyMMdd:HHmm") + "+" + bill.ORDERNO + "'");
r.WriteLine("UNB+UNOC:2+" + InttrEdi.SENDCODE + "SO:ZZZ+" + InttrEdi.RECEIVECODE + ":UN+" + nowDate.ToString("yyMMdd:HHmm") + "+" + bill.ORDERNO + "'");
/*
* 2023-03-02 UNH
r.WriteLine("UNH+" + bill.ORDERNO + "+IFTMBF:D:99B:UN'");
@ -764,7 +767,7 @@ namespace Myshipping.Application.EDI.TSL
r.WriteLine("BGM+335+" + bill.ORDERNO + "SO+5'");
r.WriteLine("DTM+137:" + DateTime.Now.ToString("yyyyMMddHHmm") + ":203'");
r.WriteLine("DTM+137:" + nowDate.ToString("yyyyMMddHHmm") + ":203'");
icount = icount + 2;
var Shipping = "";
@ -851,47 +854,47 @@ namespace Myshipping.Application.EDI.TSL
//if (bill.ISSUETYPE == "正本")
if (bill.ISSUETYPE == "ORIGINAL")
{
r.WriteLine("DOC+706+++" + GetBillNum(bill.NOBILL) + "'");
r.WriteLine("DOC+706+:26++" + GetBillNum(bill.NOBILL) + "'");
icount = icount + 1;
if (copynum != "")
if (!string.IsNullOrWhiteSpace(copynum))
{
r.WriteLine("DOC+707+++" + copynum + "'");
r.WriteLine("DOC+707+:26++" + copynum + "'");
icount = icount + 1;
}
}
else if (bill.ISSUETYPE == "海运单" || bill.ISSUETYPE.ToUpper() == "SEAWAY" || bill.ISSUETYPE.ToUpper() == "SEAWAY BILL" || bill.ISSUETYPE.ToUpper() == "WAYBILL" || bill.ISSUETYPE.ToUpper() == "SWB正本" || bill.ISSUETYPE.ToUpper() == "SWB无正本")
{
r.WriteLine("DOC+710+++" + GetBillNum(bill.NOBILL) + "'");
r.WriteLine("DOC+710+:26++" + GetBillNum(bill.NOBILL) + "'");
icount = icount + 1;
}
//else if (bill.ISSUETYPE.ToUpper() == "BILL COPY" || bill.ISSUETYPE == "电放")
else if (bill.ISSUETYPE.ToUpper() == "BILL COPY" || bill.ISSUETYPE == "TELEX")
{
r.WriteLine("DOC+706+++" + GetBillNum(bill.NOBILL) + "'");
r.WriteLine("DOC+706+:26++" + GetBillNum(bill.NOBILL) + "'");
icount = icount + 1;
if (copynum != "")
if (!string.IsNullOrWhiteSpace(copynum))
{
r.WriteLine("DOC+707+++" + copynum + "'");
r.WriteLine("DOC+707+:26++" + copynum + "'");
icount = icount + 1;
}
}
else if (bill.ISSUETYPE == "正副本")
{
r.WriteLine("DOC+706+++" + GetBillNum(bill.NOBILL) + "'");
r.WriteLine("DOC+706+:26++" + GetBillNum(bill.NOBILL) + "'");
icount = icount + 1;
if (copynum != "")
if (!string.IsNullOrWhiteSpace(copynum))
{
r.WriteLine("DOC+707+++" + copynum + "'");
r.WriteLine("DOC+707+:26++" + copynum + "'");
icount = icount + 1;
}
}
else if (bill.ISSUETYPE.ToUpper() == "HOUSE BILL")
{
r.WriteLine("DOC+714+++" + GetBillNum(bill.NOBILL) + "'");
r.WriteLine("DOC+714+:26++" + GetBillNum(bill.NOBILL) + "'");
icount = icount + 1;
}
@ -917,9 +920,9 @@ namespace Myshipping.Application.EDI.TSL
if (bill.BLFRT == "FREIGHT COLLECT")
{
if (bill.PAYABLEAT != "")
if (!string.IsNullOrWhiteSpace(bill.PAYABLEAT))
{
r.WriteLine("LOC+57+" + bill.PREPARDATID + "::6:" + bill.PAYABLEAT + "'");
r.WriteLine("LOC+57+" + bill.PAYABLEATID + "::6:" + bill.PAYABLEAT + "'");
icount = icount + 1;
}
}
@ -937,16 +940,16 @@ namespace Myshipping.Application.EDI.TSL
voyno = voyno.Substring(voyno.IndexOf(".") + 1, voyno.Length - voyno.IndexOf(".") - 1);
r.WriteLine("TDT+20+" + voyno + "+1++" + bill.CARRIEREDICODE + "+++:::" + bill.VESSEL + "'");
r.WriteLine("TDT+20+" + voyno + "+1++" + bill.CARRIEREDICODE + ":172+++:::" + bill.VESSEL + "'");
r.WriteLine("DTM+133:" + Convert.ToDateTime(bill.ETD).ToString("yyyyMMdd") + ":102'");//yyyyMMddHHmm
r.WriteLine("LOC+88+" + bill.PORTLOADID + ":139:6:" + bill.PORTLOAD + "'");
r.WriteLine("LOC+9+" + bill.PORTLOADID + ":139:6:" + bill.PORTLOAD + "'");
r.WriteLine("LOC+11+" + bill.PORTDISCHARGEID + ":139:6:" + bill.PORTDISCHARGE + "'");
r.WriteLine("LOC+88+" + bill.PORTLOADID + "::6:" + bill.PORTLOAD + "+'");
r.WriteLine("LOC+9+" + bill.PORTLOADID + "::6:" + bill.PORTLOAD + "+'");
r.WriteLine("LOC+11+" + bill.PORTDISCHARGEID + "::6:" + bill.PORTDISCHARGE + "+'");
icount = icount + 5;
if (!string.IsNullOrWhiteSpace(bill.DESTINATION))
{
r.WriteLine("LOC+7+" + bill.DESTINATIONID + ":139:6:" + bill.DESTINATION + "'");
r.WriteLine("LOC+7+" + bill.DESTINATIONID + "::6:" + bill.DESTINATION + "+'");
icount = icount + 1;
}
r.WriteLine("NAD+CA+" + bill.CARRIEREDICODE + ":160:86++" + GetCarrierName(bill.CARRIEREDICODE) + "'");
@ -1231,8 +1234,7 @@ namespace Myshipping.Application.EDI.TSL
icount = icount + 1;
}
else
if (bill.CARGOID == "O")
else if (bill.CARGOID == "O")
{
r.WriteLine("GDS+5'");
icount = icount + 1;
@ -1240,7 +1242,7 @@ namespace Myshipping.Application.EDI.TSL
}
if (bill.HSCODE != "")
if (!string.IsNullOrWhiteSpace(bill.HSCODE))
{
r.WriteLine("PIA+5+" + bill.HSCODE + ":HS'");
icount = icount + 1;
@ -1260,19 +1262,19 @@ namespace Myshipping.Application.EDI.TSL
}
}
if (DescriptionShipper != "")
if (!string.IsNullOrWhiteSpace(DescriptionShipper))
{
r.WriteLine("FTX+AAA+++" + DescriptionShipper + "'");
icount = icount + 1;
}
if (DescriptionConsignee != "")
if (!string.IsNullOrWhiteSpace(DescriptionConsignee))
{
r.WriteLine("FTX+AAA+++" + DescriptionConsignee + "'");
icount = icount + 1;
}
if (DescriptionNotifyparty != "")
if (!string.IsNullOrWhiteSpace(DescriptionNotifyparty))
{
r.WriteLine("FTX+AAA+++" + DescriptionNotifyparty + "'");
icount = icount + 1;
@ -1337,9 +1339,9 @@ namespace Myshipping.Application.EDI.TSL
if (bill.CARGOID == "R")
{
if (bill.REEFERF != "")
if (string.IsNullOrWhiteSpace(bill.REEFERF))
r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'");
if (bill.HUMIDITY != "")
if (string.IsNullOrWhiteSpace(bill.HUMIDITY))
r.WriteLine("MEA+AAE+AAO+HMD:" + bill.HUMIDITY + "'");
r.WriteLine("TMP+2+" + bill.TEMPSET + ":CEL'");
icount = icount + 2;

Loading…
Cancel
Save