/// <summary> /// 获取订单商检回执 /// </summary> /// <returns></returns> public override Result GetOrderRec() { Result result = new Result(); try { FtpUtil ftp = new FtpUtil(config.GZJCIcpInfoTrade.FtpUrl, config.GZJCIcpInfoTrade.FtpName, config.GZJCIcpInfoTrade.FtpPassword); string[] fileList = GetIcpOutResult(); if (fileList != null) { foreach (string fileTxt in fileList) { string msg = ""; Stream stream = ftp.FileStream(config.GZJCIcpInfoTrade.FtpUrl + fileTxt, ref msg); //设置当前流的位置为流的开始,防止读取位置错误造成无法读取完整流的内容 stream.Seek(0, SeekOrigin.Begin); using (StreamReader reader = new StreamReader(stream)) { string txt = reader.ReadToEnd(); //接收回执 if (fileTxt.Contains("KJDOCREC_")) { Hyt.Model.Icp.GZBaiYunJiChang.Goods.DOCREC.DocRec DocRec = Hyt.Util.Serialization.SerializationUtil.XmlDeserialize <Hyt.Model.Icp.GZBaiYunJiChang.Goods.DOCREC.DocRec>(txt); //更新平台回执信息 if (DocRec.Declaration.OrgMessageType == "KJ881111") { IcpBo.Instance.UpdatePlatDocRecByMessageID(DocRec.Declaration.OrgMessageID, txt, DocRec.Declaration.Status); } //更新商检回执信息 if (DocRec.Declaration.OrgMessageType == "881111") { IcpBo.Instance.UpdateCiqDocRecByMessageID(DocRec.Declaration.OrgMessageID, txt, DocRec.Declaration.Status); } } } } result.Status = true; result.Message = "获取成功"; } else { result.Status = true; result.Message = "暂未生成相应的回执"; } } catch (Exception ex) { result.Status = false; result.Message = ex.Message; } return(result); }
/// <summary> /// 获取商品商检回执 /// </summary> /// <returns></returns> public override Result GetGoodsRec() { Result result = new Result(); try { FtpUtil ftp = new FtpUtil(config.GZJCIcpInfoTrade.FtpUrl, config.GZJCIcpInfoTrade.FtpName, config.GZJCIcpInfoTrade.FtpPassword); string[] fileList = GetIcpOutResult(); if (fileList != null) { foreach (string fileTxt in fileList) { string msg = ""; Stream stream = ftp.FileStream(config.GZJCIcpInfoTrade.FtpUrl + fileTxt, ref msg); //设置当前流的位置为流的开始,防止读取位置错误造成无法读取完整流的内容 stream.Seek(0, SeekOrigin.Begin); using (StreamReader reader = new StreamReader(stream)) { string txt = reader.ReadToEnd(); //接收回执 if (fileTxt.Contains("KJDOCREC_")) { Hyt.Model.Icp.GZBaiYunJiChang.Goods.DOCREC.DocRec DocRec = Hyt.Util.Serialization.SerializationUtil.XmlDeserialize <Hyt.Model.Icp.GZBaiYunJiChang.Goods.DOCREC.DocRec>(txt); //更新平台回执信息 if (DocRec.Declaration.OrgMessageType == "KJ881101") { IcpBo.Instance.UpdatePlatDocRecByMessageID(DocRec.Declaration.OrgMessageID, txt, DocRec.Declaration.Status); if (DocRec.Declaration.Status != "S") { IcpBo.Instance.UpdateEntGoodsNoByMessageID(DocRec.Declaration.OrgMessageID, "None"); } } //更新商检回执信息 if (DocRec.Declaration.OrgMessageType == "881101") { IcpBo.Instance.UpdateCiqDocRecByMessageID(DocRec.Declaration.OrgMessageID, txt, DocRec.Declaration.Status); if (DocRec.Declaration.Status != "S") { IcpBo.Instance.UpdateEntGoodsNoByMessageID(DocRec.Declaration.OrgMessageID, "None"); } } } //国检审核回执 if (fileTxt.Contains("KJ881101CIQREC_")) { Hyt.Model.Icp.GZBaiYunJiChang.Goods.CIQREC.InternationalTrade InternationalTrade = Hyt.Util.Serialization.SerializationUtil.XmlDeserialize <Hyt.Model.Icp.GZBaiYunJiChang.Goods.CIQREC.InternationalTrade>(txt); List <Hyt.Model.Icp.GZBaiYunJiChang.Goods.CIQREC.GoodsRegRecList> GoodsRegRecList = InternationalTrade.Declaration.GoodsRegRecList; foreach (Hyt.Model.Icp.GZBaiYunJiChang.Goods.CIQREC.GoodsRegRecList item in GoodsRegRecList) { IcpBo.Instance.UpdateIcpGoodsItemCIQ((int)Model.CommonEnum.商检.广州白云机场, item.EntGoodsNo, item.CIQGRegStatus, item.CIQNotes); //审核通过,更新检验检疫商品备案编号 if (item.CIQGRegStatus == "C") { IcpBo.Instance.UpdateCIQGoodsNo(item.EntGoodsNo, item.CIQGoodsNo); } } } //海关审核回执 if (fileTxt.Contains("KJ881101CUSREC_")) { Hyt.Model.Icp.GZBaiYunJiChang.Goods.CUSREC.InternationalTrade InternationalTrade = Hyt.Util.Serialization.SerializationUtil.XmlDeserialize <Hyt.Model.Icp.GZBaiYunJiChang.Goods.CUSREC.InternationalTrade>(txt); List <Hyt.Model.Icp.GZBaiYunJiChang.Goods.CUSREC.GoodsRegRecList> GoodsRegRecList = InternationalTrade.Declaration.GoodsRegRecList; foreach (Hyt.Model.Icp.GZBaiYunJiChang.Goods.CUSREC.GoodsRegRecList item in GoodsRegRecList) { IcpBo.Instance.UpdateIcpGoodsItemCUS((int)Model.CommonEnum.商检.广州白云机场, item.EntGoodsNo, item.OpResult, item.CustomsNotes); //审核通过,更新海关正式备案编号 if (item.OpResult == "C") { IcpBo.Instance.UpdateCusGoodsNo(item.EntGoodsNo, item.CusGoodsNo); } } } } } result.Status = true; result.Message = "获取成功"; } else { result.Status = true; result.Message = "暂未生成相应的回执"; } } catch (Exception ex) { result.Status = false; result.Message = ex.Message; } return(result); }