示例#1
0
        public static void InsertOrderDtl(OrderDtlModel order)
        {
            string sql = $"INSERT INTO OrderDtl (OrderId,CommodityId,CommodityName,CommodityGeneral,CommodityPrice,CommodityUnitName,CommoditySpec,CommodityBrandId," +
                         "CommodityBrandName,CommodityFamilyId,CommodityIndex,CommodityCode,CommodityRH,CommodityRM,CommodityFL,OriginalTotalPrice,DiscountPrice,Discount,CommNumber,UserId,CommodityImg)" +
                         " VALUES (?orderId,?commodityId,?commodityName,?commodityGeneral,?commodityPrice,?commodityUnitName,?commoditySpec,?commodityBrandId,?commodityBrandName,?commodityFamilyId,?commodityIndex," +
                         "?commodityCode,?commodityRH,?commodityRM,?commodityFL,?originalTotalPrice,?discountPrice,?discount,?commNumber,?userId,?commodityImg)";
            Dictionary <string, object> p = new Dictionary <string, object>();

            p["orderId"]            = order.OrderId;
            p["commodityId"]        = order.CommodityId;
            p["commodityName"]      = order.CommodityName;
            p["commodityGeneral"]   = order.CommodityGeneral;
            p["commodityPrice"]     = order.CommodityPrice;
            p["commodityUnitName"]  = order.CommodityUnitName;
            p["commoditySpec"]      = order.CommoditySpec;
            p["commodityBrandId"]   = order.CommodityBrandId;
            p["commodityBrandName"] = order.CommodityBrandName;
            p["commodityFamilyId"]  = order.CommodityFamilyId;
            p["commodityIndex"]     = order.CommodityIndex;
            p["commodityCode"]      = order.CommodityCode;
            p["commodityRH"]        = order.CommodityRH;
            p["commodityRM"]        = order.CommodityRM;
            p["commodityFL"]        = order.CommodityFL;
            p["originalTotalPrice"] = order.OriginalTotalPrice;
            p["discountPrice"]      = order.DiscountPrice;
            p["discount"]           = order.Discount;
            p["commNumber"]         = order.CommNumber;
            p["userId"]             = order.UserId;
            p["commodityImg"]       = order.CommodityImg;
            DbUtil.Master.ExecuteNonQuery(sql, p);
        }
示例#2
0
        public void r105Implementation(OrderDtlModel instance)
        {
            // This is the placeholder for method implementation.
            if (instance.OrderQty <= 0 && instance.Focqty <= 0)
            {
                PreventDefault();
                Result.Focus("OrderQty", "OrderQty Or FOCQty must be greater than 0");
            }

            if (Arguments.CommandName.ToLower() == "insert")
            {
            }
            else if (Arguments.CommandName.ToLower() == "update")
            {
                if (!(bool)instance.OrderHedBulkOrder)
                {
                    if (instance[OrderDtlDataField.OrderQty].Modified)
                    {
                        int i = SqlText.ExecuteNonQuery("UPDATE OrderRel Set OrderRelQty=@OrderQty WHERE OrderDtlID=@OrderDtlID and Seq=1"
                                                        , instance.OrderQty, instance.OrderDtlID);
                    }

                    if (instance[OrderDtlDataField.Focqty].Modified)
                    {
                        int i = SqlText.ExecuteNonQuery("UPDATE OrderRel Set  FOCRelQty=@Focqty WHERE OrderDtlID=@OrderDtlID and Seq=1"
                                                        , instance.Focqty, instance.OrderDtlID);
                    }
                }
            }
            else
            {
                throw new Exception("Command Argument is Wrong!");
            }

            //string exDtl = string.Empty;

            //if (instance.ProposedBasePrice < instance.BasePrice)
            //{
            //     exDtl += string.Format(" #Proposed BasePrice Changed for \"{0}\" ", instance.PartNum);

            //}

            //if(instance.ProposedSellingPrice < instance.SellingPrice)
            //{
            //     exDtl += string.Format(" #Propsed SellingPrice Changed for \"{0}\" ", instance.PartNum);

            //}

            //if(!string.IsNullOrEmpty(exDtl))
            //{
            //    int i = SqlText.ExecuteNonQuery("UPDATE OrderHed SET Exception = 1 " +
            //        ",ExceptionDtl = @exDtl " +
            //        " Where OrderHedID=@OrderHedID "
            //        , new { @OrderHedID = instance.OrderHedID, @exDtl = exDtl });
            //}
        }
示例#3
0
 public void r108Implementation(OrderDtlModel instance)
 {
     // This is the placeholder for method implementation.
     //if (UserIsInRole("SalesPerson"))
     //{
     //    instance.OTFOC = "FOC";
     //}
     //else if (UserIsInRole("SalesClerk"))
     //{
     //    instance.OTFOC = "99";
     //}
 }
        public void r100Implementation(OrderDtlModel instance)
        {
            // This is the placeholder for method implementation.
            //var ordhedid = instance.OrderHedID;

            //int i = (int)SqlText.ExecuteScalar("Select Count(OrderHedID) from OrderHed where OrderHedID=@OrderHedID and BulkOrder=1 "
            //                , new { @OrderHedID = ordhedid });
            //if (i >= 1)
            //{
            //    NodeSet().SelectViews("editForm1", "createForm1")
            //        .SelectDataFields("OrderQty")
            //        .SetTextMode("Static");
            //}
        }
示例#5
0
        public void r111Implementation(OrderDtlModel instance)
        {
            if (instance.OrderQty == null)
            {
                instance.OrderQty = 0;
            }

            if (instance.Focqty == null)
            {
                instance.Focqty = 0;
            }


            // This is the placeholder for method implementation.
            if (instance.OrderQty <= 0 && instance.Focqty <= 0)
            {
                PreventDefault();
                Result.Focus("OrderQty", "FocQty or OrderQty must be greater than 0");
            }
        }
示例#6
0
        public void r110Implementation(OrderDtlModel instance)
        {
            // This is the placeholder for method implementation.
            if (instance.SellingPrice != null && instance.CtnConv != null)
            {
                if (Convert.ToDecimal(instance.CtnConv) > 0 && Convert.ToDecimal(instance.SellingPrice) > 0)
                {
                    instance.SellingPricePerBottle = instance.SellingPrice / instance.CtnConv;
                }
            }
            if (instance.BasePrice != null && instance.CtnConv != null)
            {
                if (Convert.ToDecimal(instance.CtnConv) > 0 && Convert.ToDecimal(instance.BasePrice) > 0)
                {
                    instance.BasePricePerBottle = instance.BasePrice / instance.CtnConv;
                }
            }
            if (instance.ProposedSellingPrice != null && instance.CtnConv != null &&
                instance.ProposedSellingPrice > 0 && instance.CtnConv > 0)
            {
                instance.ProposedSellingPricePerBottle = instance.ProposedSellingPrice / instance.CtnConv;
            }
            else
            {
                instance.ProposedSellingPricePerBottle = null;
            }

            if (instance.ProposedBasePrice != null && instance.CtnConv != null &&
                instance.ProposedBasePrice > 0 && instance.CtnConv > 0)
            {
                instance.ProposedBasePricePerBottle = instance.ProposedBasePrice / instance.CtnConv;
            }
            else
            {
                instance.ProposedBasePricePerBottle = null;
            }
        }
 public void r104Implementation(OrderDtlModel instance)
 {
     // This is the placeholder for method implementation.
     int i = SqlText.ExecuteNonQuery("INSERT INTO OrderRel (OrderHedID,OrderDtlID,OrderRelQty,FOCRelQty,ShipByDate,ShipToSysRowID,ShipToName,Seq) VALUES (@OrderHedID,@OrderDtlID,@OrderQty,@Focqty,@OHShipByDate,@OHShipToSysRowID,@OHShipToName,1)	"
                                     , instance.OrderHedID, instance.OrderDtlID, instance.OrderQty, instance.Focqty, instance.OHShipByDate, instance.OHShipToSysRowID, instance.OHShipToName);
 }
示例#8
0
        public void r106Implementation(OrderDtlModel instance)
        {
            // This is the placeholder for method implementation.
            if (Arguments.CommandArgument == "PartSysRowID")
            {
                //instance.PartNum = null;
                //instance.PartDescription = null;
                instance.ChangeBasePrice               = false;
                instance.ChangeSellingPrice            = false;
                instance.ProposedBasePrice             = null;
                instance.ProposedSellingPrice          = null;
                instance.ProposedSellingPricePerBottle = null;
                instance.ProposedBasePricePerBottle    = null;

                string priceLstQry = string.Format("SELECT isnull(BasePrice,0) , isnull(Price,0), isnull(SellingPricePerBottle,0), isnull(BasePricePerBottle,0) FROM vwPriceList WHERE Company='{0}' and CustNum={1} and PartNum='{2}' ",
                                                   instance.OHCompany, instance.OHCustNum, instance.PartNum);

                var priceLst = SqlText.Execute(priceLstQry);
                if (priceLst != null)
                {
                    instance.BasePrice             = (decimal)priceLst[0];
                    instance.SellingPrice          = (decimal)priceLst[1];
                    instance.SellingPricePerBottle = (decimal)priceLst[2];
                    instance.BasePricePerBottle    = (decimal)priceLst[3];

                    instance.Amount         = instance.SellingPrice * instance.OrderQty;
                    instance.ProposedAmount = instance.SellingPrice * instance.OrderQty;
                }
            }
            if (Arguments.CommandArgument == "ChangeSellingPrice")
            {
                if (instance.ChangeSellingPrice == null)
                {
                    instance.ProposedSellingPrice          = null;
                    instance.ProposedSellingPricePerBottle = null;
                    instance.ProposedAmount = instance.SellingPrice * instance.OrderQty;
                }

                if (instance.ChangeSellingPrice != null && !(bool)instance.ChangeSellingPrice)
                {
                    instance.ProposedSellingPrice          = null;
                    instance.ProposedSellingPricePerBottle = null;
                    instance.ProposedAmount = instance.SellingPrice * instance.OrderQty;
                }
            }
            if (Arguments.CommandArgument == "ChangeBasePrice")
            {
                if (instance.ChangeBasePrice != null && !(bool)instance.ChangeBasePrice)
                {
                    instance.ProposedBasePrice          = null;
                    instance.ProposedBasePricePerBottle = null;
                }
            }
            if (Arguments.CommandArgument == "OrderQty")
            {
                instance.Amount = instance.SellingPrice * instance.OrderQty;
                //instance.ProposedAmount = instance.SellingPrice * instance.OrderQty;
                if (instance.ProposedSellingPrice != null && instance.CtnConv != null &&
                    instance.ProposedSellingPrice > 0 && instance.CtnConv > 0)
                {
                    instance.ProposedSellingPricePerBottle = instance.ProposedSellingPrice / instance.CtnConv;
                    instance.ProposedAmount = instance.ProposedSellingPrice * instance.OrderQty;
                }
                else
                {
                    instance.ProposedSellingPricePerBottle = null;
                    instance.ProposedAmount = instance.SellingPrice * instance.OrderQty;
                }
            }
            if (Arguments.CommandArgument == "ProposedSellingPrice")
            {
                if (instance.ProposedSellingPrice != null && instance.CtnConv != null &&
                    instance.ProposedSellingPrice > 0 && instance.CtnConv > 0)
                {
                    instance.ProposedSellingPricePerBottle = instance.ProposedSellingPrice / instance.CtnConv;
                    instance.ProposedAmount = instance.ProposedSellingPrice * instance.OrderQty;
                }
                else
                {
                    instance.ProposedSellingPricePerBottle = null;
                    instance.ProposedAmount = instance.SellingPrice * instance.OrderQty;
                }
            }
            if (Arguments.CommandArgument == "ProposedBasePrice")
            {
                if (instance.ProposedBasePrice != null && instance.CtnConv != null &&
                    instance.ProposedBasePrice > 0 && instance.CtnConv > 0)
                {
                    instance.ProposedBasePricePerBottle = instance.ProposedBasePrice / instance.CtnConv;
                }
                else
                {
                    instance.ProposedBasePricePerBottle = null;
                }
            }
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="spId"></param>
        /// <param name="spCount"></param>
        /// <param name="token"></param>
        /// <param name="isSC">是否来自于购物车</param>
        /// <returns></returns>
        public string WapPay(string spId, string spCount, string token, int isSC, int cityId, int exId, string exName,
                             string addres, string consignee, string phone, int isInvoice, int payid, string payName, string ramrk,
                             string invoicePayable, string businessName, string taxpayerNumber, string billContactPhone, string billContactEmail, string billContent, int IsSample)
        {
            var user = UserService.CkToken(token);

            if (user != null)
            {
                OrderListModel        orderList = new OrderListModel();
                long                  orderId   = 0;
                var                   idList    = spId.Split(',').Select(x => int.Parse(x)).ToList();
                var                   spcList   = spCount.Split(',').Select(x => int.Parse(x)).ToList();
                List <CommodityModel> comDtl    = new List <CommodityModel>();
                #region 获取基础数据
                if (isSC == 1)
                {
                    //获取购物车信息
                    var comStr = CommodityService.Instance.GetShoppingInId(token, spId);
                    comDtl = JsonUtil.Deserialize <List <CommodityModel> >(comStr);
                }
                else
                {
                    var data = CommodityService.Instance.GetCommodityInfo(Convert.ToInt32(spId));
                    comDtl.Add(JsonUtil.Deserialize <CommodityModel>(data));
                }
                #endregion
                //生成订单
                List <OrderDtlModel> oderDtl = new List <OrderDtlModel>();
                double orderAmount           = 0;
                #region 订单明细
                int weight = 0; //订单重量
                foreach (var cm in comDtl)
                {
                    int           cIndex = idList.FindIndex(o => o == cm.CommodityId);
                    OrderDtlModel dtl    = new OrderDtlModel();
                    dtl.CommodityId        = cm.CommodityId;
                    dtl.CommodityName      = cm.CommodityName;
                    dtl.CommodityGeneral   = cm.CommodityGeneral;
                    dtl.CommodityPrice     = cm.CommodityPrice;
                    dtl.CommodityUnitName  = cm.UnitIdName;
                    dtl.CommoditySpec      = cm.CommoditySpec;
                    dtl.CommodityBrandId   = cm.CommodityBrandId;
                    dtl.CommodityBrandName = cm.BrandName;
                    dtl.CommodityFamilyId  = cm.CommodityFamilyId;
                    dtl.CommodityImg       = cm.CommodityImg;
                    dtl.CommodityIndex     = cm.CommodityIndex;
                    dtl.CommodityCode      = cm.CommodityCode;
                    dtl.CommodityRH        = cm.CommodityRH;
                    dtl.CommodityRM        = cm.CommodityRM;
                    dtl.CommodityFL        = cm.CommodityFL;
                    dtl.UserId             = user.Uid;
                    dtl.CommNumber         = spcList[cIndex];
                    dtl.OriginalTotalPrice = spcList[cIndex] * (cm.CommodityPrice * cm.CommoditySpec);
                    orderAmount            = orderAmount + spcList[cIndex] * (cm.CommodityPrice * cm.CommoditySpec);
                    weight = weight + cm.CommoditySpec * dtl.CommNumber;
                    oderDtl.Add(dtl);
                }
                #endregion
                orderList.OrdrList   = oderDtl;
                orderList.OrderPrice = orderAmount;
                orderList.IsSample   = IsSample;
                //计算运费
                string cityStr  = CityExLogisticsAmountService.Instance.GetCityExLogisticsAmount(cityId, exId);
                var    cityData = JsonUtil.Deserialize <CityExLogisticsAmountModel>(cityStr);
                if (IsSample == 1)
                {
                    orderList.OrderAmount = 0;
                    orderList.NameExpress = string.Empty;
                }
                else
                {
                    orderList.Weight        = weight;
                    orderList.ExpressAmount = cityData.Amount * weight;
                    orderList.OrderAmount   = orderList.OrderPrice + orderList.ExpressAmount;
                    orderList.NameExpress   = exName;
                }
                orderList.ReceivingAddress  = addres;
                orderList.Consignee         = consignee;
                orderList.Telephone         = phone;
                orderList.IsInvoice         = isInvoice;
                orderList.PaymentMethod     = payid;
                orderList.PaymentMethodName = payName;
                orderList.Remarks           = ramrk;
                //保存发票抬头信息
                #region 发票
                OrderInvoiceModel invoice = new OrderInvoiceModel();
                invoice.InvoicePayable   = invoicePayable;
                invoice.BusinessName     = businessName;
                invoice.TaxpayerNumber   = taxpayerNumber;
                invoice.BillContactPhone = billContactPhone;
                invoice.BillContactEmail = billContactEmail;
                invoice.BillContent      = billContent;
                invoice.UserId           = user.Uid;
                invoice.InvoiceAmount    = orderList.OrderAmount;
                #endregion
                InsertOrderList(orderList, user.Uid, invoice, ref orderId);
                if (isSC == 1)
                {
                    //删除购物车
                    CommodityService.Instance.DeleteShopping(spId, token);
                }
                string key     = CryptoUtil.GetRandomAesKey();
                string wapSpId = CryptoUtil.AesEncryptHex(orderId.ToString(), key);
                CacheHelp.Set(wapSpId, DateTimeOffset.Now.AddDays(1), orderId.ToString());
                return(wapPay(orderList, orderId, IsSample, wapSpId));
            }
            else
            {
                return(UserService.ckTokenState());
            }
        }
示例#10
0
 public void r103Implementation(OrderDtlModel instance)
 {
     // This is the placeholder for method implementation.
 }