作者 朱兆平

分单FHL国际转运状态识别并入库,取消分单海关状态跟随主单

... ... @@ -179,92 +179,92 @@ namespace CustomsCargoSystem.ExchangeDataStorageService
public void StartServiceThread_IMF(object obj)
{
try
{
string connectionString = ConnectionString;
while (IsThreadNeedRun)
{
string text = "";
string[] files = Directory.GetFiles(IMFMsgPath, "*.txt");
for (int i = 0; i < files.Length; i++)
try
{
if (!CheckFileCanRead(files[i]))
string text = "";
string[] files = Directory.GetFiles(IMFMsgPath, "*.txt");
for (int i = 0; i < files.Length; i++)
{
continue;
}
text = File.ReadAllText(files[i]);
if (string.IsNullOrWhiteSpace(text))
{
if (File.Exists(files[i]))
if (!CheckFileCanRead(files[i]))
{
File.Delete(files[i]);
continue;
}
continue;
}
Log.WriteMessage("999All", DateTime.Now.ToString("yyyyMMddHHmmss"), text);
if (!text.Contains("<META>"))
{
if (File.Exists(files[i]))
text = File.ReadAllText(files[i]);
if (string.IsNullOrWhiteSpace(text))
{
File.Delete(files[i]);
if (File.Exists(files[i]))
{
File.Delete(files[i]);
}
continue;
}
}
else
{
try
Log.WriteMessage("999All", DateTime.Now.ToString("yyyyMMddHHmmss"), text);
if (!text.Contains("<META>"))
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(File.ReadAllText(files[i]));
if (text.Contains("<STYP>IFWB</STYP>") && text.Contains("FWB/"))
if (File.Exists(files[i]))
{
Log.WriteMessage("1fwboriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FWB");
if (xmlNode != null)
{
ProcessXmlDocumentFWB(xmlNode.InnerText);
}
File.Delete(files[i]);
}
else if (text.Contains("<STYP>FFM</STYP>") && text.Contains("FFM/") && text.Contains("CGO"))
}
else
{
try
{
Log.WriteMessage("2ffmoriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FFM");
if (xmlNode != null)
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(File.ReadAllText(files[i]));
if (text.Contains("<STYP>IFWB</STYP>") && text.Contains("FWB/"))
{
BookingFFMINFO(xmlNode.InnerText);
Log.WriteMessage("1fwboriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FWB");
if (xmlNode != null)
{
ProcessXmlDocumentFWB(xmlNode.InnerText);
}
}
}
else if (text.Contains("<STYP>IFHL</STYP>") && text.Contains("FHL/"))
{
Log.WriteMessage("3fhloriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FHL");
if (xmlNode != null)
else if (text.Contains("<STYP>FFM</STYP>") && text.Contains("FFM/") && text.Contains("CGO"))
{
Log.WriteMessage("2ffmoriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FFM");
if (xmlNode != null)
{
BookingFFMINFO(xmlNode.InnerText);
}
}
else if (text.Contains("<STYP>IFHL</STYP>") && text.Contains("FHL/"))
{
Log.WriteMessage("3fhloriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FHL");
if (xmlNode != null)
{
ProcessXmlDocumentFHL(xmlNode.InnerText);
}
}
else if (text.Contains("<TYPE>DFME</TYPE>") && (text.Contains("<STYP>UFOH</STYP>") || text.Contains("<STYP>EFOH</STYP>") || text.Contains("<STYP>UDEP</STYP>") || text.Contains("<STYP>EDEP</STYP>") || text.Contains("<STYP>URCF</STYP>") || text.Contains("<STYP>ERCF</STYP>") || text.Contains("<STYP>PFFM</STYP>")))
{
ProcessXmlDocumentFHL(xmlNode.InnerText);
ProcessXmlDocument_New(xmlDocument);
}
}
else if (text.Contains("<TYPE>DFME</TYPE>") && (text.Contains("<STYP>UFOH</STYP>") || text.Contains("<STYP>EFOH</STYP>") || text.Contains("<STYP>UDEP</STYP>") || text.Contains("<STYP>EDEP</STYP>") || text.Contains("<STYP>URCF</STYP>") || text.Contains("<STYP>ERCF</STYP>") || text.Contains("<STYP>PFFM</STYP>")))
catch (Exception ex)
{
ProcessXmlDocument_New(xmlDocument);
Log.WriteLog("9systemlog", ex.ToString());
}
}
catch (Exception ex)
{
Log.WriteLog("9systemlog", ex.ToString());
}
finally
{
if (File.Exists(files[i]))
finally
{
File.Delete(files[i]);
if (File.Exists(files[i]))
{
File.Delete(files[i]);
}
}
}
}
}catch(IOException e){
Log.WriteLog("9systemlog", e.ToString()+"IOerror");
}
Thread.Sleep(500);
}
}catch(IOException e){
Log.WriteLog("9systemlog", e.ToString());
}
}
protected override void OnStop()
... ... @@ -1162,6 +1162,11 @@ namespace CustomsCargoSystem.ExchangeDataStorageService
{
text8 = text10;
}
//分单国际转运判定
string org_domint = "", des_domint = "";
CustomsCargoSystem.Data.OriginManifestMaster.get_t_flt_fsl_domint(connectionString, originatingstation_bill, destinationstation_bill, out org_domint, out des_domint);
//国际转运
if (org_domint == des_domint && des_domint == "1") { cUSTOMSSTATUS = "002"; }
IEnumerable<CustomsCargoSystem.Model.OriginManifestMaster> originManifestMasterFromWayBillNoMaster = CustomsCargoSystem.Data.OriginManifestMaster.GetOriginManifestMasterFromWayBillNoMaster(connectionString, wayBillNoMaster);
if (originManifestMasterFromWayBillNoMaster.Count() > 0)
{
... ... @@ -1170,7 +1175,8 @@ namespace CustomsCargoSystem.ExchangeDataStorageService
{
IEnumerable<CustomsCargoSystem.Model.OriginManifestSecondary> originManifestSecondaryTureOrFalse = CustomsCargoSystem.Data.OriginManifestMaster.GetOriginManifestSecondaryTureOrFalse(connectionString, wayBillNoMaster, wayBillNoSecondary);
string customsCode = originManifestMaster.CustomsCode;
cUSTOMSSTATUS = originManifestMaster.CustomsStatus;
//取消分单海关状态跟着主单走
//cUSTOMSSTATUS = originManifestMaster.CustomsStatus;
CustomsCargoSystem.Model.OriginManifestSecondary originManifestSecondary = new CustomsCargoSystem.Model.OriginManifestSecondary();
originManifestSecondary.AutoID = Guid.NewGuid().ToString();
originManifestSecondary.WayBillNoMaster = wayBillNoMaster;
... ...