示例#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);
        }
        private BaseSubscribe GetBaseSubscribe(SqlDataReader dr)
        {
            BaseSubscribe result = null;

            try
            {
                result            = new BaseSubscribe();
                result.status     = "ALL";
                result.dxpMode    = "DXP";
                result.dxpAddress = "DXPENT0000001110";;
                result.note       = null;
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
        public void QueryDate601(string logisticsNo, ref InventoryHead inventoryHead, ref List <InventoryList> inventoryLists, ref BaseSubscribe baseSubscribe)
        {
            InventoryList inventoryList = null;
            SqlDataReader dr            = null;

            try
            {
                dr = a_sqlServer.ExePROC("MessageCenterQuery", ConvertToSqlParameters(601, "", logisticsNo));
                if (dr.HasRows)
                {
                    int i = 1;
                    while (dr.Read())
                    {
                        if (i == 1)
                        {
                            inventoryHead = GetInventoryHead(dr);
                        }
                        inventoryList = GetInventoryList(dr, i++);
                        InventoryList exist = inventoryLists.Find(o => o.gno.Equals(inventoryList.gno));
                        if (exist == null)
                        {
                            inventoryLists.Add(inventoryList);
                        }
                        else
                        {
                            exist.qty   += inventoryList.qty;
                            exist.total += inventoryList.total;
                            exist.qty1  += inventoryList.qty1;
                            exist.qty2  += inventoryList.qty2;
                        }
                        baseSubscribe = GetBaseSubscribe(dr);
                    }
                    foreach (var list in inventoryLists)
                    {
                        var f = inventoryHead.netWeight / inventoryLists.Count;
                        list.qty2 = ((float?)((int)(f * 100))) / 100;
                    }
                    //a_sqlServer.ExePROCNonQuery("MessageReceipt", ConvertToSqlParameters("601", inventoryHead.orderNo, logisticsNo, "0", "", inventoryHead.copNo, "", ""));
                }
            }
            catch (Exception ex)
            {
                Logs.Error("Query601DataByOrderNo Exception:" + ex.ToString());
            }
            finally
            {
                dr.Close();
            }
        }