示例#1
0
    /// <summary>
    /// 绑定订单明细
    /// </summary>
    public void BindOrderDetail()
    {
        List <Hi.Model.DIS_OrderDetail> l = OrderDetailBll.GetList("", " OrderId=" + Id, "");

        if (l != null)
        {
            if (l.Count > 0)
            {
                this.rpDtl.DataSource = l;
                this.rpDtl.DataBind();
            }
            else
            {
                this.rpDtl.DataSource = "";
                this.rpDtl.DataBind();
            }
        }
        else
        {
            this.rpDtl.DataSource = "";
            this.rpDtl.DataBind();
        }

        //SelectGoods.OrderDetail(Id);
        //DataTable dt = Session["OrderDetail"] as DataTable;
        //this.rpDtl.DataSource = dt;
        //this.rpDtl.DataBind();
        //SelectGoods.Clear();
    }
示例#2
0
    /// <summary>
    /// 订单商品明细
    /// </summary>
    /// <param name="Id">订单Id</param>
    public static void OrderDetail(int Id, int DisId, int CompId)
    {
        HttpContext.Current.Session["GoodsInfo"] = null;

        List <Hi.Model.DIS_OrderDetail> l = OrderDetailBll.GetList("", " isnull(dr,0)=0 and OrderId=" + Id, "Id desc");

        string Digits = OrderInfoType.rdoOrderAudit("订单下单数量是否取整", CompId);

        if (l != null && l.Count > 0)
        {
            DataTable dt = null;

            foreach (Hi.Model.DIS_OrderDetail item in l)
            {
                //获取商品信息
                Hi.Model.BD_GoodsInfo goodsinfoModel = new Hi.BLL.BD_GoodsInfo().GetModel(item.GoodsinfoID);

                if (goodsinfoModel != null)
                {
                    //获取商品价格
                    //List<Hi.Model.BD_GoodsPrice> pl = new Hi.BLL.BD_GoodsPrice().GetList("top 1 *", "DisID=" + DisId + " and CompID=" + CompId + " and GoodsInfoID=" + item.GoodsinfoID + " and IsEnabled=1 and ISNULL(dr,0)=0", "");
                    //if (pl != null)
                    //{
                    //    if (pl.Count > 0)
                    //    {  //}
                    //}
                    if (HttpContext.Current.Session["GoodsInfo"] == null)
                    {
                        dt = new DataTable();
                        dt.Columns.Add("Id", typeof(string));           //订单明细Id
                        dt.Columns.Add("DisId", typeof(string));        //代理商Id
                        dt.Columns.Add("CompId", typeof(string));       //企业Id
                        dt.Columns.Add("GoodsID", typeof(Int64));       //商品基本档案ID
                        dt.Columns.Add("GoodsinfoID", typeof(Int64));   //商品ID
                        dt.Columns.Add("BarCode", typeof(string));      //商品编码
                        dt.Columns.Add("GoodsName", typeof(string));    //商品名称
                        dt.Columns.Add("GoodsInfos", typeof(string));   //商品属性信息
                        dt.Columns.Add("Price", typeof(decimal));       //商品价格
                        dt.Columns.Add("Inventory", typeof(decimal));   //商品库存
                        dt.Columns.Add("AuditAmount", typeof(decimal)); //审核后价格
                        dt.Columns.Add("Unit", typeof(string));         //商品计量单位
                        dt.Columns.Add("Pic", typeof(string));          //商品图片
                        //dt.Columns.Add("StockNum", typeof(int)); //数据类型为 文本
                        dt.Columns.Add("GoodsNum", typeof(decimal));    //商品数量
                        dt.Columns.Add("Remark", typeof(string));       //备注
                        dt.Columns.Add("vdef1", typeof(string));        //是否促销商品
                        dt.Columns.Add("vdef2", typeof(string));        //促销商品数量
                        dt.Columns.Add("vdef3", typeof(string));        //促销Protype
                        dt.Columns.Add("Total", typeof(decimal));       //小计

                        DataRow dr1 = dt.NewRow();

                        dr1["Id"]          = item.ID;
                        dr1["DisId"]       = DisId;
                        dr1["CompId"]      = CompId;
                        dr1["GoodsID"]     = goodsinfoModel.GoodsID;
                        dr1["GoodsinfoID"] = goodsinfoModel.ID;
                        dr1["BarCode"]     = goodsinfoModel.BarCode;
                        dr1["GoodsName"]   = GoodsName(goodsinfoModel.GoodsID, "GoodsName");
                        dr1["GoodsInfos"]  = item.GoodsInfos == "" ? Util.GetSubString(Common.GetGoodsMemo(goodsinfoModel.GoodsID), 30) : item.GoodsInfos;
                        dr1["Price"]       = item.Price;
                        dr1["Inventory"]   = goodsinfoModel.Inventory + item.GoodsNum;
                        dr1["Pic"]         = GoodsName(goodsinfoModel.GoodsID, "Pic");
                        dr1["AuditAmount"] = item.AuditAmount;
                        dr1["Unit"]        = GoodsName(goodsinfoModel.GoodsID, "Unit");
                        dr1["GoodsNum"]    = decimal.Parse(string.Format("{0:N4}", item.GoodsNum.ToString("#,####" + Digits)));
                        dr1["Remark"]      = item.Remark;
                        if (item.vdef1 != null)
                        {
                            dr1["vdef1"] = item.vdef1.ToString() == "" ? "0" : item.vdef1.ToString();
                        }
                        else
                        {
                            dr1["vdef1"] = "0";
                        }
                        if (item.vdef5 != "")
                        {
                            dr1["vdef2"] = decimal.Parse(string.Format("{0:N4}", Convert.ToDecimal(item.vdef5).ToString("#,####" + Digits)));
                        }
                        else
                        {
                            dr1["vdef2"] = "0";
                        }
                        //dr1["vdef3"] = item.vdef6;

                        dr1["Total"] = item.sumAmount;

                        dt.Rows.Add(dr1);
                    }
                    else
                    {
                        dt = HttpContext.Current.Session["GoodsInfo"] as DataTable;
                        DataRow dr2 = dt.NewRow();

                        dr2["Id"]          = item.ID;
                        dr2["DisId"]       = DisId;
                        dr2["CompId"]      = CompId;
                        dr2["GoodsID"]     = goodsinfoModel.GoodsID;
                        dr2["GoodsinfoID"] = goodsinfoModel.ID;
                        dr2["BarCode"]     = goodsinfoModel.BarCode;
                        dr2["GoodsName"]   = GoodsName(goodsinfoModel.GoodsID, "GoodsName");
                        dr2["GoodsInfos"]  = item.GoodsInfos == "" ? Util.GetSubString(Common.GetGoodsMemo(goodsinfoModel.GoodsID), 30) : item.GoodsInfos;
                        dr2["Price"]       = item.Price;
                        dr2["Inventory"]   = goodsinfoModel.Inventory + item.GoodsNum;
                        dr2["Pic"]         = GoodsName(goodsinfoModel.GoodsID, "Pic");
                        dr2["AuditAmount"] = item.AuditAmount;
                        dr2["Unit"]        = GoodsName(goodsinfoModel.GoodsID, "Unit");
                        dr2["GoodsNum"]    = decimal.Parse(string.Format("{0:N4}", item.GoodsNum.ToString("#,####" + Digits)));
                        dr2["Remark"]      = item.Remark;
                        if (item.vdef1 != null)
                        {
                            dr2["vdef1"] = item.vdef1.ToString() == "" ? "0" : item.vdef1.ToString();
                        }
                        else
                        {
                            dr2["vdef1"] = "0";
                        }
                        if (item.vdef5 != "")
                        {
                            dr2["vdef2"] = decimal.Parse(string.Format("{0:N4}", Convert.ToDecimal(item.vdef5).ToString("#,####" + Digits)));
                        }
                        else
                        {
                            dr2["vdef2"] = "0";
                        }
                        //dr2["vdef3"] = item.vdef6;
                        dr2["Total"] = item.sumAmount;
                        dt.Rows.Add(dr2);
                    }
                    dt.DefaultView.Sort = "id desc";
                    HttpContext.Current.Session["GoodsInfo"] = dt;
                }
            }
        }
    }
示例#3
0
    /// <summary>
    /// 提交订单
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnPrn_Click(object sender, EventArgs e)
    {
        Hi.Model.DIS_Order OrderInfoModel = OrderBll.GetModel(KeyID);

        string GoodsName = string.Empty;
        string GoodMome  = string.Empty;

        if (OrderInfoModel != null)
        {
            //判断订单明细是否有商品数据为0的
            List <Hi.Model.DIS_OrderDetail> ld = OrderDetailBll.GetList("", " OrderID=" + KeyID, "");
            if (ld != null)
            {
                if (ld.Count > 0)
                {
                    foreach (Hi.Model.DIS_OrderDetail item in ld)
                    {
                        if (item.GoodsNum <= 0)
                        {
                            //订单存在有商品数量小于等于0的商品
                            JScript.AlertMsgOne(this, "订单明细数据不正确,无法提交!", JScript.IconOption.错误);
                            return;
                        }
                        //判断商品是否可购买
                        if (OrderInfoType.IsGoodsShip(this.DisID, item.GoodsinfoID, item.vdef1.ToInt(0), CompID.ToString(), out GoodsName, out GoodMome) == 1)
                        {
                            JScript.AlertMsgOne(this, "订单商品:" + GoodsName + "," + GoodMome + ",不能提交!", JScript.IconOption.错误);
                            return;
                        }
                    }
                }
                else
                {
                    //没有商品明细
                    JScript.AlertMsgOne(this, "订单明细数据不正确,无法提交!", JScript.IconOption.错误);
                    return;
                }
            }

            if (OrderInfoModel.OState == (int)Enums.OrderState.未提交 || OrderInfoModel.OState == (int)Enums.OrderState.退回)
            {
                int OState = (int)Enums.OrderState.待审核;

                string sql = string.Empty;

                if (OrderInfoModel.IsAudit == 1)
                {
                    //无需审核
                    OState = (int)Enums.OrderState.已审;
                    sql    = " update [DIS_Order] set [OState]=" + OState + ",[AuditDate]='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where ID=" + KeyID;
                }
                else
                {
                    sql = " update [DIS_Order] set [OState]=" + OState + " where ID=" + KeyID;
                }

                if (OrderBll.UpdateOrderState(sql))
                {
                    Utils.AddSysBusinessLog(this.CompID, "Order", KeyID.ToString(), "订单提交", "");
                    new Common().GetWxService("1", KeyID.ToString(), "1");

                    if (OrderInfoModel.IsAudit == 1)
                    {
                        //无需审核
                        if (OrderInfoModel.Otype == (int)Enums.OType.赊销订单)
                        {
                            ClientScript.RegisterStartupScript(GetType(), "", "<script>location.href=location.href;</script>");
                            return;
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(GetType(), "", "<script>location.href='pay/Pay.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey) + "';</script>");
                            //Response.Redirect("pay/Pay.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey));
                            return;
                        }
                    }
                    else
                    {
                        //需审核
                        //Bind();
                        JScript.AlertMethod(this, "您已成功提交,请等待审核!", JScript.IconOption.正确, "function (){ location.replace('" + ("neworder/orderdetail.aspx?KeyID=" + Common.DesEncrypt(KeyID.ToString(), Common.EncryptKey)) + "'); }");

                        //Response.Redirect("OrderInfo.aspx?KeyID=" + KeyID);
                    }
                }
            }
            else
            {
                JScript.AlertMsgOne(this, "订单状态不正确,不能进行提交!", JScript.IconOption.错误);
            }
        }
        else
        {
            JScript.AlertMsgOne(this, "数据不存在!", JScript.IconOption.错误);
        }
    }