作者 朱兆平

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

@@ -179,92 +179,92 @@ namespace CustomsCargoSystem.ExchangeDataStorageService @@ -179,92 +179,92 @@ namespace CustomsCargoSystem.ExchangeDataStorageService
179 179
180 public void StartServiceThread_IMF(object obj) 180 public void StartServiceThread_IMF(object obj)
181 { 181 {
182 - try  
183 - {  
184 string connectionString = ConnectionString; 182 string connectionString = ConnectionString;
185 while (IsThreadNeedRun) 183 while (IsThreadNeedRun)
186 { 184 {
187 - string text = "";  
188 - string[] files = Directory.GetFiles(IMFMsgPath, "*.txt");  
189 - for (int i = 0; i < files.Length; i++) 185 + try
190 { 186 {
191 - if (!CheckFileCanRead(files[i])) 187 + string text = "";
  188 + string[] files = Directory.GetFiles(IMFMsgPath, "*.txt");
  189 + for (int i = 0; i < files.Length; i++)
192 { 190 {
193 - continue;  
194 - }  
195 - text = File.ReadAllText(files[i]);  
196 - if (string.IsNullOrWhiteSpace(text))  
197 - {  
198 - if (File.Exists(files[i])) 191 + if (!CheckFileCanRead(files[i]))
199 { 192 {
200 - File.Delete(files[i]); 193 + continue;
201 } 194 }
202 - continue;  
203 - }  
204 - Log.WriteMessage("999All", DateTime.Now.ToString("yyyyMMddHHmmss"), text);  
205 - if (!text.Contains("<META>"))  
206 - {  
207 - if (File.Exists(files[i])) 195 + text = File.ReadAllText(files[i]);
  196 + if (string.IsNullOrWhiteSpace(text))
208 { 197 {
209 - File.Delete(files[i]); 198 + if (File.Exists(files[i]))
  199 + {
  200 + File.Delete(files[i]);
  201 + }
  202 + continue;
210 } 203 }
211 - }  
212 - else  
213 - {  
214 - try 204 + Log.WriteMessage("999All", DateTime.Now.ToString("yyyyMMddHHmmss"), text);
  205 + if (!text.Contains("<META>"))
215 { 206 {
216 - XmlDocument xmlDocument = new XmlDocument();  
217 - xmlDocument.LoadXml(File.ReadAllText(files[i]));  
218 - if (text.Contains("<STYP>IFWB</STYP>") && text.Contains("FWB/")) 207 + if (File.Exists(files[i]))
219 { 208 {
220 - Log.WriteMessage("1fwboriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);  
221 - XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FWB");  
222 - if (xmlNode != null)  
223 - {  
224 - ProcessXmlDocumentFWB(xmlNode.InnerText);  
225 - } 209 + File.Delete(files[i]);
226 } 210 }
227 - else if (text.Contains("<STYP>FFM</STYP>") && text.Contains("FFM/") && text.Contains("CGO")) 211 + }
  212 + else
  213 + {
  214 + try
228 { 215 {
229 - Log.WriteMessage("2ffmoriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);  
230 - XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FFM");  
231 - if (xmlNode != null) 216 + XmlDocument xmlDocument = new XmlDocument();
  217 + xmlDocument.LoadXml(File.ReadAllText(files[i]));
  218 + if (text.Contains("<STYP>IFWB</STYP>") && text.Contains("FWB/"))
232 { 219 {
233 - BookingFFMINFO(xmlNode.InnerText); 220 + Log.WriteMessage("1fwboriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
  221 + XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FWB");
  222 + if (xmlNode != null)
  223 + {
  224 + ProcessXmlDocumentFWB(xmlNode.InnerText);
  225 + }
234 } 226 }
235 - }  
236 - else if (text.Contains("<STYP>IFHL</STYP>") && text.Contains("FHL/"))  
237 - {  
238 - Log.WriteMessage("3fhloriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);  
239 - XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FHL");  
240 - if (xmlNode != null) 227 + else if (text.Contains("<STYP>FFM</STYP>") && text.Contains("FFM/") && text.Contains("CGO"))
  228 + {
  229 + Log.WriteMessage("2ffmoriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
  230 + XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FFM");
  231 + if (xmlNode != null)
  232 + {
  233 + BookingFFMINFO(xmlNode.InnerText);
  234 + }
  235 + }
  236 + else if (text.Contains("<STYP>IFHL</STYP>") && text.Contains("FHL/"))
  237 + {
  238 + Log.WriteMessage("3fhloriginal", DateTime.Now.ToString("yyyyMMddHHmmssfff"), text);
  239 + XmlNode xmlNode = xmlDocument.SelectSingleNode("/MSG/FHL");
  240 + if (xmlNode != null)
  241 + {
  242 + ProcessXmlDocumentFHL(xmlNode.InnerText);
  243 + }
  244 + }
  245 + 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>")))
241 { 246 {
242 - ProcessXmlDocumentFHL(xmlNode.InnerText); 247 + ProcessXmlDocument_New(xmlDocument);
243 } 248 }
244 } 249 }
245 - 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>"))) 250 + catch (Exception ex)
246 { 251 {
247 - ProcessXmlDocument_New(xmlDocument); 252 + Log.WriteLog("9systemlog", ex.ToString());
248 } 253 }
249 - }  
250 - catch (Exception ex)  
251 - {  
252 - Log.WriteLog("9systemlog", ex.ToString());  
253 - }  
254 - finally  
255 - {  
256 - if (File.Exists(files[i])) 254 + finally
257 { 255 {
258 - File.Delete(files[i]); 256 + if (File.Exists(files[i]))
  257 + {
  258 + File.Delete(files[i]);
  259 + }
259 } 260 }
260 } 261 }
261 } 262 }
  263 + }catch(IOException e){
  264 + Log.WriteLog("9systemlog", e.ToString()+"IOerror");
262 } 265 }
263 Thread.Sleep(500); 266 Thread.Sleep(500);
264 } 267 }
265 - }catch(IOException e){  
266 - Log.WriteLog("9systemlog", e.ToString());  
267 - }  
268 } 268 }
269 269
270 protected override void OnStop() 270 protected override void OnStop()
@@ -1162,6 +1162,11 @@ namespace CustomsCargoSystem.ExchangeDataStorageService @@ -1162,6 +1162,11 @@ namespace CustomsCargoSystem.ExchangeDataStorageService
1162 { 1162 {
1163 text8 = text10; 1163 text8 = text10;
1164 } 1164 }
  1165 + //分单国际转运判定
  1166 + string org_domint = "", des_domint = "";
  1167 + CustomsCargoSystem.Data.OriginManifestMaster.get_t_flt_fsl_domint(connectionString, originatingstation_bill, destinationstation_bill, out org_domint, out des_domint);
  1168 + //国际转运
  1169 + if (org_domint == des_domint && des_domint == "1") { cUSTOMSSTATUS = "002"; }
1165 IEnumerable<CustomsCargoSystem.Model.OriginManifestMaster> originManifestMasterFromWayBillNoMaster = CustomsCargoSystem.Data.OriginManifestMaster.GetOriginManifestMasterFromWayBillNoMaster(connectionString, wayBillNoMaster); 1170 IEnumerable<CustomsCargoSystem.Model.OriginManifestMaster> originManifestMasterFromWayBillNoMaster = CustomsCargoSystem.Data.OriginManifestMaster.GetOriginManifestMasterFromWayBillNoMaster(connectionString, wayBillNoMaster);
1166 if (originManifestMasterFromWayBillNoMaster.Count() > 0) 1171 if (originManifestMasterFromWayBillNoMaster.Count() > 0)
1167 { 1172 {
@@ -1170,7 +1175,8 @@ namespace CustomsCargoSystem.ExchangeDataStorageService @@ -1170,7 +1175,8 @@ namespace CustomsCargoSystem.ExchangeDataStorageService
1170 { 1175 {
1171 IEnumerable<CustomsCargoSystem.Model.OriginManifestSecondary> originManifestSecondaryTureOrFalse = CustomsCargoSystem.Data.OriginManifestMaster.GetOriginManifestSecondaryTureOrFalse(connectionString, wayBillNoMaster, wayBillNoSecondary); 1176 IEnumerable<CustomsCargoSystem.Model.OriginManifestSecondary> originManifestSecondaryTureOrFalse = CustomsCargoSystem.Data.OriginManifestMaster.GetOriginManifestSecondaryTureOrFalse(connectionString, wayBillNoMaster, wayBillNoSecondary);
1172 string customsCode = originManifestMaster.CustomsCode; 1177 string customsCode = originManifestMaster.CustomsCode;
1173 - cUSTOMSSTATUS = originManifestMaster.CustomsStatus; 1178 + //取消分单海关状态跟着主单走
  1179 + //cUSTOMSSTATUS = originManifestMaster.CustomsStatus;
1174 CustomsCargoSystem.Model.OriginManifestSecondary originManifestSecondary = new CustomsCargoSystem.Model.OriginManifestSecondary(); 1180 CustomsCargoSystem.Model.OriginManifestSecondary originManifestSecondary = new CustomsCargoSystem.Model.OriginManifestSecondary();
1175 originManifestSecondary.AutoID = Guid.NewGuid().ToString(); 1181 originManifestSecondary.AutoID = Guid.NewGuid().ToString();
1176 originManifestSecondary.WayBillNoMaster = wayBillNoMaster; 1182 originManifestSecondary.WayBillNoMaster = wayBillNoMaster;