Beispiel #1
0
 public Candy(string name, double weight, double sugarWeight, double price, FilingType filingType) : base(name, weight,
                                                                                                          sugarWeight, price)
 {
     Name        = name;
     Weight      = weight;
     SugarWeight = sugarWeight;
     Price       = price;
     FilingType  = filingType;
 }
Beispiel #2
0
 public Brittle(string name, double weight, double sugarWeight, double price, FilingType filingType, NutType nutType) :
     base(name, weight, sugarWeight, price, filingType)
 {
     Name        = name;
     Weight      = weight;
     SugarWeight = sugarWeight;
     Price       = price;
     FilingType  = filingType;
     NutType     = nutType;
 }
Beispiel #3
0
        /// <summary>
        /// 获取库存 edit by lxm 20110113
        /// </summary>
        /// <param name="ftype"></param>
        /// <param name="wareHouseId"></param>
        /// <returns></returns>
        public IList <FilingReportInfo> GetFilingReportByFilingType(FilingType ftype, Guid wareHouseId)
        {
            IList <FilingReportInfo> frlist      = new List <FilingReportInfo>();
            string SQL_Select_ByftypeAndWhouseId = @"Select    
                                                    f.FilingId
                                                   ,f.GoodsId
                                                   ,f.GoodsName
                                                   ,f.GoodsCode
                                                   ,f.Specification
                                                   ,f.NonceFilialeGoodsStock
                                                   ,f.NonceRequest
                                                   ,f.Demand
                                                   ,f.FilialeId
                                                   ,f.WareHouseId       
                                                   ,f.Suppliers
                                                   ,f.FilingType
                                                   ,f.StartTime
                                                   ,f.endtime                                                   
                                                   ,isnull(g.RecentInPrice,0)
                                                   ,f.SuppliersId
                                                   From lmshop_FilingReport f left join lmShop_GoodsStockCurrent g on f.GoodsId = g.RealGoodsId and g.WareHouseId=@WareHouseId Where 1=1 ";

            if ((int)ftype != -1)
            {
                SQL_Select_ByftypeAndWhouseId += " and f.FilingType=@FilingType ";
            }
            else
            {
                SQL_Select_ByftypeAndWhouseId += " and f.FilingType!=2 ";
            }
            SQL_Select_ByftypeAndWhouseId += " Order by Suppliers ";
            var parms = new[]
            {
                new SqlParameter(PARM_FILING_TYPE, SqlDbType.Int),
                new SqlParameter(PARM_WARE_HOUSE_ID, SqlDbType.UniqueIdentifier)
            };

            parms[0].Value = (int)ftype;
            parms[1].Value = wareHouseId;
            using (var rdr = SqlHelper.ExecuteReader(GlobalConfig.ERP_DB_NAME, true, SQL_Select_ByftypeAndWhouseId, parms))
            {
                while (rdr.Read())
                {
                    var frInfo = new FilingReportInfo(rdr.GetGuid(0), rdr.GetGuid(1), rdr.GetString(2), rdr.GetString(3)
                                                      , rdr.GetString(4), rdr.GetInt32(5), rdr.GetInt32(6), rdr.GetInt32(7), rdr.GetGuid(8), rdr.GetGuid(9),
                                                      rdr.GetString(10), (FilingType)rdr.GetInt32(11), rdr.GetDateTime(12), rdr.GetDateTime(13), rdr[14] == DBNull.Value ? 0 : (decimal)rdr.GetDouble(14), rdr.GetGuid(15));
                    frlist.Add(frInfo);
                }
            }
            return(frlist);
        }
Beispiel #4
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="ftype">进货类别</param>
        /// <param name="wareHouseId">仓库ID</param>
        public void Delete(FilingType ftype, Guid wareHouseId)
        {
            var parms = new[] {
                new SqlParameter(PARM_FILING_TYPE, SqlDbType.Int),
                new SqlParameter(PARM_WARE_HOUSE_ID, SqlDbType.UniqueIdentifier)
            };

            parms[0].Value = (int)ftype;
            parms[1].Value = wareHouseId;
            try
            {
                SqlHelper.ExecuteNonQuery(GlobalConfig.ERP_DB_NAME, false, DELETE_BY_FILING_TYPE, parms);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="filingId">所在备货公司</param>
        /// <param name="goodsId">子商品id</param>
        /// <param name="goodsName">子商品名</param>
        /// <param name="goodsCode">商品编号</param>
        /// <param name="specification">缺货状态</param>
        /// <param name="nonceFilialeGoodsStock">现有库存</param>
        /// <param name="nonceRequest">需求量</param>
        /// <param name="demand">采购量</param>
        /// <param name="filialeId">所在备货公司</param>
        /// <param name="wareHouseId">所在公司仓库</param>
        /// <param name="suppliers">供应商</param>
        /// <param name="filingType">进货类别</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="purchasePrice">采购价</param>
        /// <param name="suppliersId">供应商ID</param>
        public FilingReportInfo(Guid filingId, Guid goodsId, string goodsName, string goodsCode, string specification, int nonceFilialeGoodsStock,
                                int nonceRequest, int demand, Guid filialeId, Guid wareHouseId, string suppliers, FilingType filingType, DateTime startTime, DateTime endTime
                                , decimal purchasePrice, Guid suppliersId)
        {
            FilingId               = filingId;
            GoodsId                = goodsId;
            GoodsName              = goodsName;
            GoodsCode              = goodsCode;
            Specification          = specification;
            NonceFilialeGoodsStock = nonceFilialeGoodsStock;
            NonceRequest           = nonceRequest;
            Demand      = demand;
            FilialeId   = filialeId;
            WareHouseId = wareHouseId;

            this.suppliers = suppliers;
            FilingType     = filingType;
            StartTime      = startTime;
            Endtime        = endTime;
            PurchasePrice  = purchasePrice;
            SuppliersId    = suppliersId;
        }
        private XmlDocument BuildProviderRequest(Warehouse warehouse, Address destination, Package package, bool needHolidayAdjustment)
        {
            //CREATE PROVIDER REQUEST DOCUMENT
            XmlDocument providerRequest = new XmlDocument();

            providerRequest.LoadXml("<?xml version=\"1.0\"?><eCommerce action=\"Request\" version=\"1.1\"></eCommerce>");

            XmlElement nodRequestor = XmlUtility.GetElement(providerRequest.DocumentElement, "Requestor", true);

            XmlUtility.SetElementValue(nodRequestor, "ID", this.UserID);
            XmlUtility.SetElementValue(nodRequestor, "Password", this.Password);

            //DETERMINE THE SHIP DATE
            DateTime shipDate = DateTime.Now.AddDays(this.DaysToShip);

            // ALSO ENSURE THATE SHIP DATE IS NOT A WEEKEND
            if (shipDate.DayOfWeek == DayOfWeek.Saturday)
            {
                shipDate = shipDate.AddDays(2);
            }
            else if (shipDate.DayOfWeek == DayOfWeek.Sunday)
            {
                shipDate = shipDate.AddDays(1);
            }
            //TAKE CARE OF THE ISSUE THAT DHL DOES NOT RETURN RATES FOR HOLIDAYS
            if (needHolidayAdjustment)
            {
                shipDate = shipDate.AddDays(1);
            }

            foreach (string serviceCode in _services.Keys)
            {
                //initialize shipment node
                XmlElement nodShipment = (XmlElement)providerRequest.DocumentElement.AppendChild(providerRequest.CreateElement("IntlShipment"));
                XmlUtility.SetAttributeValue(nodShipment, "action", "GenerateLabel");
                XmlUtility.SetAttributeValue(nodShipment, "version", "2.0");

                //set shipping credentials
                XmlElement nodTemp = XmlUtility.GetElement(nodShipment, "ShippingCredentials", true);
                XmlUtility.SetElementValue(nodTemp, "ShippingKey", this.ShippingKey);
                XmlUtility.SetElementValue(nodTemp, "AccountNbr", this.AccountNumber);

                //set shipment details
                XmlElement nodShipmentDetail = XmlUtility.GetElement(nodShipment, "ShipmentDetail", true);

                XmlUtility.SetElementValue(nodShipmentDetail, "ShipDate", shipDate.ToString("yyyy-MM-dd"));
                XmlUtility.SetElementValue(nodShipmentDetail, "Service/Code", serviceCode);
                XmlUtility.SetElementValue(nodShipmentDetail, "ShipmentType/Code", "P");

                //set package weight
                // MUST BE A WHOLE NUMBER FOR DHL
                XmlUtility.SetElementValue(nodShipmentDetail, "Weight", String.Format("{0:d}", package.Weight.ToInt32(null)));
                XmlUtility.SetElementValue(nodShipmentDetail, "ContentDesc", String.Format("Shipment From {0}", Token.Instance.Store.Name));

                // DIMENSIONS
                if (package.Length > 0 && package.Width > 0 && package.Height > 0)
                {
                    XmlUtility.SetElementValue(nodShipmentDetail, "Dimensions/Length", String.Format("{0:d}", package.Length.ToInt32(null)));
                    XmlUtility.SetElementValue(nodShipmentDetail, "Dimensions/Width", String.Format("{0:d}", package.Width.ToInt32(null)));
                    XmlUtility.SetElementValue(nodShipmentDetail, "Dimensions/Height", String.Format("{0:d}", package.Height.ToInt32(null)));
                }

                XmlUtility.SetElementValue(nodShipment, "ExportCompliance/DOSFlag", DOSFlag ? "Y" : "N");
                XmlUtility.SetElementValue(nodShipment, "Dutiable/DutiableFlag", DutiableFlag ? "Y" : "N");
                if (DutiableFlag)
                {
                    XmlUtility.SetElementValue(nodShipment, "Dutiable/CustomsValue", string.Format("{0:F2}", package.RetailValue * CustomsValueMultiplier));
                }
                else
                {
                    XmlUtility.SetElementValue(nodShipment, "Dutiable/CustomsValue", "0");
                }


                if (DutiableFlag)
                {
                    XmlUtility.SetElementValue(nodShipment, "Dutiable/CommerceLicensed", CommerceLicensed ? "Y" : "N");
                    XmlUtility.SetElementValue(nodShipment, "Dutiable/Filing/FilingType", FilingType.ToString());

                    switch (FilingType)
                    {
                    case FilingTypeFlags.FTR:
                        XmlUtility.SetElementValue(nodShipment, "Dutiable/Filing/FTSR", FTRExemptionCode);
                        break;

                    case FilingTypeFlags.ITN:
                        XmlUtility.SetElementValue(nodShipment, "Dutiable/Filing/ITN", ITNNumber);
                        break;

                    case FilingTypeFlags.AES4:
                        XmlUtility.SetElementValue(nodShipment, "Dutiable/Filing/AES4/EIN", EINCode);
                        break;

                    default:
                        break;
                    }
                }

                //set origin and destination
                XmlUtility.SetElementValue(nodShipment, "Billing/Party/Code", "S");
                XmlUtility.SetElementValue(nodShipment, "Billing/DutyPaymentType", "S");

                XmlElement nodReceiver = XmlUtility.GetElement(nodShipment, "Receiver", true);
                XmlUtility.SetElementValue(nodReceiver, "Address/Street", destination.Address1);
                XmlUtility.SetElementValue(nodReceiver, "Address/City", destination.City);
                XmlUtility.SetElementValue(nodReceiver, "Address/State", destination.Province);
                XmlUtility.SetElementValue(nodReceiver, "Address/Country", destination.CountryCode);
                XmlUtility.SetElementValue(nodReceiver, "Address/PostalCode", destination.PostalCode);

                //set the transaction trace to simplify the SAT/1030 recognition
                XmlUtility.SetElementValue(nodShipment, "TransactionTrace", serviceCode);
            }
            return(providerRequest);
        }