示例#1
0
        public bool Create503Message(LogisticsStatus logisticsStatus)
        {
            bool          isSuccess     = true;
            BaseSubscribe baseSubscribe = null;
            XElement      xele          = null;
            XNamespace    ns            = null;

            try
            {
                Logs.Debug("Create503Message Start! OrderNo_" + logisticsStatus.logisticsNo);
                baseSubscribe = GetBaseSubscribe();
                ns            = "http://www.chinaport.gov.cn/ceb";
                xele          = new XElement(ns + "CEB503Message");
                xele.SetAttributeValue(XNamespace.Xmlns + "ceb", ns);
                xele = logisticsStatus.ToXElememt(xele, ns);
                xele = baseSubscribe.ToXElememt(xele, ns);
                FileUtilities.CreateFolder(ConfigurationInfo.PathSend);
                xele.Save(ConfigurationInfo.PathSend + "\\" + logisticsStatus.logisticsNo + "_" + logisticsStatus.logisticsStatus + "_503.xml");
                Logs.Debug("Create503Message End! OrderNo_" + logisticsStatus.logisticsNo);
            }
            catch (Exception ex)
            {
                Logs.Error("Create503Message Exception: " + ex.ToString());
                isSuccess = false;
            }
            return(isSuccess);
        }
示例#2
0
        public bool CreateMessage601(string logisticsNo)
        {
            bool                 success        = true;
            InventoryHead        inventoryHead  = null;
            List <InventoryList> inventoryLists = null;
            BaseSubscribe        baseSubscribe  = null;
            XElement             xele           = null;
            XNamespace           ns             = null;
            MessageSql           mssql          = null;
            MessageService       msService      = null;

            try
            {
                inventoryHead  = new InventoryHead();
                inventoryLists = new List <InventoryList>();
                baseSubscribe  = new BaseSubscribe();
                mssql          = new MessageSql();
                mssql.QueryDate601(logisticsNo, ref inventoryHead, ref inventoryLists, ref baseSubscribe);
                if (inventoryHead.guid != new Guid())
                {
                    ns   = "http://www.chinaport.gov.cn/ceb";
                    xele = new XElement(ns + "CEB601Message");
                    xele.SetAttributeValue(XNamespace.Xmlns + "ceb", ns);
                    xele = inventoryHead.ToXElememt(xele, ns);
                    foreach (var a in inventoryLists)
                    {
                        xele = a.ToXElememt(xele, ns);
                    }
                    xele = baseSubscribe.ToXElememt(xele, ns);
                    FileUtilities.CreateFolder(ConfigurationInfo.PathSend);
                    xele.Save(ConfigurationInfo.PathSend + "\\" + FileUtilities.GetNewFileName(inventoryHead.orderNo) + "_601.xml");

                    string destPath = FileUtilities.GetNewFolderName(true, ConfigurationInfo.PathBackUp, "601") + "\\" + FileUtilities.GetNewFileName(inventoryHead.orderNo, "Create") + ".xml";

                    msService = new MessageService();
                    msService.DealMessage601(false, true, inventoryHead.guid.ToString(), inventoryHead.copNo, destPath);

                    xele.Save(destPath);
                }
                else
                {
                    Logs.Info("Does not exist in database:" + logisticsNo);
                    success = false;
                }
            }
            catch (Exception ex)
            {
                Logs.Error("Create301Message Exception:" + ex.ToString());
                success = false;
            }
            return(success);
        }