예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string suigongdan = Request.QueryString["suigongdan"];//随工单号
                string PrintCount = Request.QueryString["PrintCount"];//随工单打印数量
                string orderNum = Request.QueryString["orderNum"];//订单编号
                string proType = Request.QueryString["proType"];//产品型号
                if (!string.IsNullOrEmpty(orderNum)&&!string.IsNullOrEmpty(proType))
                {
                    string strWhere = string.Format(" and orderNum='{0}' and proType='{1}' ",orderNum,proType);
                    orderDetail = ProOrdersDetailBLL.GetModelByWhere(strWhere);

                    if (orderDetail != null)
                    {
                        lblpiHao.Text = orderDetail.PiHao;
                        try
                        {
                            if (orderDetail.PlanSendTime != null && Convert.ToDateTime(orderDetail.PlanSendTime).ToString("yyyy-MM-dd") != "0001-01-01")
                            {
                                lblplanSendTime.Text = Convert.ToDateTime(orderDetail.PlanSendTime).ToString("yyyy-MM-dd");
                            }
                        }
                        catch (Exception) { }
                        lblproductAddress.Text = orderDetail.ProductAddress;
                        lblproNum.Text = orderDetail.proNum.ToString();
                        lblproType.Text = orderDetail.proType;

                        //随工单号
                        lblSuiGongDan.Text = suigongdan;
                        //随工单打印数量
                        lblPrintCount.Text = PrintCount;
                        //加载订单基本信息
                        orderMod = ProOrdersBLL.GetModel(orderDetail.orderNum);
                        if (orderMod != null)
                        {
                            txtcustomManager.Text = orderMod.customManager;
                            txtcustomNum.Text = orderMod.customNum;
                            txtcustomOrderNum.Text = orderMod.customOrderNum;
                            txtcustomWLBH.Text = orderMod.customWLBH;
                            txtheTongNum.Text = orderMod.heTongNum;
                            txtorderNum.Text = orderMod.orderNum;
                            txtremark.Text = orderMod.remark;

                            var db = new Web.Model.OrderPrintEntities();
                            var intorderDetailId = orderDetail.orderDetailId;
                            var gt_order = db.proOrders.FirstOrDefault(r => r.orderId == orderMod.orderId);
                            if (!string.IsNullOrEmpty(gt_order.发货状态))
                            {
                                lbl发货状态.Text = gt_order.发货状态;
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, EventArgs e)
    {
        int num = 0;
        //修改订单详情
        if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
        {
            string detailId = Request.QueryString["id"].ToString();
            //加载订单基本信息
            orderDetail = ProOrdersDetailBLL.GetModel(Convert.ToInt32(detailId));
            orderDetail.PiHao = txtpiHao.Text.Trim();
            orderDetail.PlanSendTime = Convert.ToDateTime(txtplanSendTime.Text.Trim());
            orderDetail.ProductAddress = txtproductAddress.Text.Trim();
            orderDetail.withWorkNo = txtwithWorkNo.Text.Trim();
            orderDetail.proNum = Convert.ToInt32(lblproNum.Text.Trim());

            num = ProOrdersDetailBLL.Update(orderDetail);
        }

        if (num > 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "DetailsPageControl.CloseBox();alert('提交成功!');DetailsPageControl.ReflushList('orderManage/OrderProManage.aspx');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('提交失败!')", true);
        }
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
            {
                orderDetailId = Request.QueryString["id"].ToString();
                orderDetail = ProOrdersDetailBLL.GetModel(Convert.ToInt32(orderDetailId));
                if (orderDetail != null)
                {
                    txtpiHao.Text = orderDetail.PiHao;
                    if (Convert.ToDateTime(orderDetail.PlanSendTime).ToString("yyyy-MM-dd") != "0001-01-01")
                    {
                        txtplanSendTime.Text = Convert.ToDateTime(orderDetail.PlanSendTime).ToString("yyyy-MM-dd");
                    }
                    txtproductAddress.Text = orderDetail.ProductAddress;
                    lblproNum.Text = orderDetail.proNum.ToString();
                    txtproType.Text = orderDetail.proType;
                    //if (orderDetail.withWorkNo != "")
                    //{
                    //    txtwithWorkNo.Text = orderDetail.withWorkNo;
                    //}
                    //else
                    //{
                    //    txtwithWorkNo.Text = DateTime.Now.ToString("yyyyMMddhhmmss");
                    //}
                    //随工单号
                    string date = DateTime.Now.ToString("yyyyMM");
                    string str = "";
                    if (SGDRecordBLL.GetSuigondanMax(date) != null)
                    {
                        str = SGDRecordBLL.GetSuigondanMax(date).ToString();
                    }
                    if (str == "")
                    {
                        txtwithWorkNo.Text = DateTime.Now.ToString("yyyyMMdd") + "-1";
                    }
                    else
                    {
                        txtwithWorkNo.Text = DateTime.Now.ToString("yyyyMMdd") + "-" + (Convert.ToInt32(str.Split('-')[1]) + 1);
                    }
                    //加载订单基本信息
                    orderMod = ProOrdersBLL.GetModel(orderDetail.orderNum);
                    if (orderMod != null)
                    {
                        txtcustomManager.Text = orderMod.customManager;
                        txtcustomNum.Text = orderMod.customNum;
                        txtcustomOrderNum.Text = orderMod.customOrderNum;
                        txtcustomWLBH.Text = orderMod.customWLBH;
                        txtheTongNum.Text = orderMod.heTongNum;
                        txtorderNum.Text = orderMod.orderNum;
                        txtremark.Text = orderMod.remark;

                    }

                }
            }
        }
    }
예제 #4
0
    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, EventArgs e)
    {
        bool real = true;
        //修改订单基本信息
        if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
        {
            string orderNum = Request.QueryString["id"].ToString();
            //加载订单基本信息
            orderMod = ProOrdersBLL.GetModel(orderNum);
            orderMod.customManager = txtcustomManager.Text.Trim();
            orderMod.customOrderNum = txtcustomOrderNum.Text.Trim();
            orderMod.customWLBH = txtcustomWLBH.Text.Trim();
            orderMod.heTongNum = txtheTongNum.Text.Trim();
            orderMod.remark = txtremark.Text.Trim();
            orderMod.UpdateTime = DateTime.Now;
            if (txtYijiekuanMoney.Text.Trim() != "")
            {
                orderMod.YijiekuanMoney = Convert.ToDecimal(txtYijiekuanMoney.Text.Trim());
            }
            else
            {
                orderMod.YijiekuanMoney = 0;
            }
            if (txtYikaipiaoMoney.Text.Trim() != "")
            {
                orderMod.YikaipiaoMoney = Convert.ToDecimal(txtYikaipiaoMoney.Text.Trim());
            }
            else
            {
                orderMod.YikaipiaoMoney = 0;
            }
            ProOrdersBLL.Update(orderMod);
        }
        //修改订单详情

        string[] xinghao = Request.Params.GetValues("proType");
        string[] shuliang = Request.Params.GetValues("proNum");
        string[] danjia = Request.Params.GetValues("ProPrice");

        string xianyouyongpin = "";

        //原有产品的增加和修改
        for (int i = 0; i < rptYongpin.Items.Count; i++)
        {
            Label lblProType = this.rptYongpin.Items[i].FindControl("lblProType") as Label;
            TextBox txtProNum = this.rptYongpin.Items[i].FindControl("txtProNum") as TextBox;
            Label lblProPrice = this.rptYongpin.Items[i].FindControl("lblProPrice") as Label;
            HiddenField hdborderDetailId = this.rptYongpin.Items[i].FindControl("hdborderDetailId") as HiddenField;
            xianyouyongpin += lblProType.Text.Trim() + ",";

            if (txtProNum != null && txtProNum.Text.Trim() != "" && int.Parse(txtProNum.Text.Trim()) != 0)
            {
                //修改产品数量
                int Updcount = ProOrdersDetailBLL.Update(Convert.ToInt32(hdborderDetailId.Value), Convert.ToInt32(txtProNum.Text));
                if (!(Updcount > 0))
                {
                    real = false;
                }
            }
            else
            {
                //删除产品型号
                ProOrdersDetailBLL.Delete(Convert.ToInt32(hdborderDetailId.Value));
            }
        }
        //新增产品
        if (xinghao != null && xinghao.Length > 0)
        {
            for (int i = 0; i < xinghao.Length; i++)
            {
                if (shuliang[i].ToString().Trim() != "" && int.Parse(shuliang[i].ToString().Trim()) != 0)
                {
                    string xinYongpin = xinghao[i].ToString().Trim();
                    int num = 0;
                    int osid = 0;
                    if (xianyouyongpin.Contains(xinYongpin))   //如果新增产品已经存在于原有的产品中,则数量合并
                    {
                        DataSet ds = ProOrdersDetailBLL.GetList(" and proType='" + xinghao[i].Trim() + "' and orderNum='" + txtorderNum.Text.Trim() + "'");
                        if (ds != null && ds.Tables[0].Rows.Count > 0)
                        {
                            num = Convert.ToInt32(ds.Tables[0].Rows[0]["proNum"].ToString());
                            osid = Convert.ToInt32(ds.Tables[0].Rows[0]["orderDetailId"].ToString());
                            int newNUM = num + Convert.ToInt32(shuliang[i].Trim());
                            //修改产品数量
                            int Updcount = ProOrdersDetailBLL.Update(osid, newNUM);
                            if (!(Updcount > 0))
                            {
                                real = false;
                            }
                        }
                        else
                        {
                            orderDetail = new ProOrdersDetailMOD();
                            orderDetail.orderNum = txtorderNum.Text.Trim();
                            orderDetail.proNum = Convert.ToInt32(shuliang[i].Trim());
                            orderDetail.ProPrice = Convert.ToDecimal(danjia[i].Trim());
                            orderDetail.proType = xinghao[i].Trim();
                            int Addcounts = ProOrdersDetailBLL.Add(orderDetail);
                            if (!(Addcounts > 0))
                            {
                                real = false;
                            }
                        }
                    }
                    else   //直接添加
                    {
                        orderDetail = new ProOrdersDetailMOD();
                        orderDetail.orderNum = txtorderNum.Text.Trim();
                        orderDetail.proNum = Convert.ToInt32(shuliang[i].Trim());
                        orderDetail.ProPrice = Convert.ToDecimal(danjia[i].Trim());
                        orderDetail.proType = xinghao[i].Trim();
                        int Addcounts = ProOrdersDetailBLL.Add(orderDetail);
                        if (!(Addcounts > 0))
                        {
                            real = false;
                        }
                    }
                }
            }
        }
        if (real)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "DetailsPageControl.CloseBox();alert('提交成功!');DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('提交失败!')", true);
        }
    }
예제 #5
0
    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, ImageClickEventArgs e)
    {
        int num = 0;

        if (Int32.Parse(SqlHelper.GetSingle(string.Format("select count(1) from proOrders where orderNum='{0}'", txtcustomOrderNum.Text)).ToString()) > 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('" + "订单号已存在!');DetailsPageControl.CloseBox();DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);
            return;
        }

        if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);

            // num = ProductParamBLL.Updatemod(mod);
        }
        else
        {
            orderMod = new ProOrdersMOD();
            orderDetailMOD = new ProOrdersDetailMOD();
            try
            {
                //订单基本信息
                orderMod.customManager = txtcustomManager.Text.Trim();
                orderMod.customNum = txtcustomNum.Text.Trim();
                orderMod.customOrderNum = txtcustomOrderNum.Text.Trim();
                orderMod.customWLBH = "";// txtcustomWLBH.Text.Trim();
                orderMod.editTime = DateTime.Now;
                orderMod.heTongNum = txtheTongNum.Text.Trim();
                orderMod.orderNum = txtorderNum.Text.Trim();
                orderMod.remark = txtremark.Text.Trim();
                orderMod.ShuChuXianchang = "";// txtshuChuXianchang.Text.Trim();
                orderMod.ShuRuXianchang = "";// txtshuRuXianchang.Text.Trim();

                //添加订单详细

                string[] xinghao = Request.Params.GetValues("proType");
                string[] shuliang = Request.Params.GetValues("proNum");
                string[] danjia = Request.Params.GetValues("ProPrice");
                string[] wuliaobian = Request.Params.GetValues("wuliaobian");
                string errmsg = "";
                int errorCount = 0;
                //判断是否有填写产品信息
                if (xinghao.Length < 0)
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "DDGL", "alert('您还没有填写产品信息!')", true);
                }
                else
                {
                    int flag = ProOrdersBLL.Add(orderMod);
                    if (flag > 0)
                    {
                        bool flag2 = true;

                        for (int i = 0; i < xinghao.Length; i++)
                        {
                            orderDetailMOD.orderNum = txtorderNum.Text.Trim();
                            if (Convert.ToInt32(shuliang[i]) > 0)
                            {
                                ProductParamMOD paramMod = ProductParamBLL.GetmodByid(txtcustomNum.Text.Trim(), xinghao[i].Trim());
                                if (paramMod != null)
                                {
                                    orderDetailMOD.proNum = Convert.ToInt32(shuliang[i].Trim());
                                    orderDetailMOD.ProPrice = Convert.ToDecimal(danjia[i].Trim());
                                    orderDetailMOD.proType = xinghao[i].Trim();
                                    //orderDetailMOD.Wuliaobian = wuliaobian[i].Trim();
                                    if (!(ProOrdersDetailBLL.Add(orderDetailMOD) > 0))
                                    {
                                        flag2 = false;
                                        break;
                                    }
                                }
                                else
                                {
                                    errmsg += xinghao[i].Trim() + ",";
                                    errorCount++;
                                }
                            }
                            else
                            {

                            }
                        }
                        if (flag2)
                        {
                            string isShow = "";
                            if (xinghao.Length - errorCount > 0)
                            {
                                DataSet ds = CustomerManageBLL.GetcustomerAll(" and customerNo='" + txtcustomNum.Text.Trim() + "'");
                                if (ds != null && ds.Tables[0].Rows.Count > 0)
                                {
                                    isShow = ds.Tables[0].Rows[0]["isFanben"].ToString();
                                }
                                if (isShow != "0")
                                {
                                    //ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交成功');DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');print();", true);
                                    if (errmsg == "")
                                    {
                                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);
                                        Response.Redirect("Contract.aspx?customerNo=" + txtcustomNum.Text.Trim() + "&orderNum=" + txtorderNum.Text.Trim());
                                    }
                                    else
                                    {
                                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('" + errmsg + "没有维护产品参数提交失败,其余添加成功!');DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');print();", true);
                                        //  Response.Redirect("Contract.aspx?customerNo=" + txtcustomNum.Text.Trim() + "&orderNum=" + txtorderNum.Text.Trim());
                                    }
                                }
                                else
                                {
                                    if (errmsg == "")
                                    {
                                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交成功');DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);
                                    }
                                    else
                                    {
                                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('" + errmsg + "没有维护产品参数提交失败,其余添加成功!');DetailsPageControl.CloseBox();DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);
                                    }
                                }
                            }
                            else
                            {
                                ProOrdersDetailBLL.Delete(txtorderNum.Text.Trim());
                                ProOrdersBLL.Delete(txtorderNum.Text.Trim());
                                ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('您没有要添加的型号,添加失败!')", true);
                            }
                        }
                        else
                        {
                            ProOrdersDetailBLL.Delete(txtorderNum.Text.Trim());
                            ProOrdersBLL.Delete(txtorderNum.Text.Trim());
                            ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('添加失败!')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "BGYPSQLB", "alert('添加失败!')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('添加失败!')", true);
            }
        }
    }
예제 #6
0
    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, ImageClickEventArgs e)
    {
        int num = 0;

        if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);

            // num = ProductParamBLL.Updatemod(mod);
        }
        else
        {
            orderMod = new ProOrdersMOD();
            orderDetailMOD = new ProOrdersDetailMOD();
            try
            {
                //订单基本信息
                orderMod.customManager = txtcustomManager.Text.Trim();
                orderMod.customNum = txtcustomNum.Text.Trim();
                orderMod.customOrderNum = txtcustomOrderNum.Text.Trim();
                orderMod.customWLBH = txtcustomWLBH.Text.Trim();
                orderMod.editTime = DateTime.Now;
                orderMod.heTongNum = txtheTongNum.Text.Trim();
                orderMod.orderNum = txtorderNum.Text.Trim();
                orderMod.remark = txtremark.Text.Trim();

                //添加订单详细

                string[] xinghao = Request.Params.GetValues("proType");
                string[] shuliang = Request.Params.GetValues("proNum");
                string[] danjia = Request.Params.GetValues("ProPrice");

                //判断是否有填写产品信息
                if (xinghao.Length < 0)
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "DDGL", "alert('您还没有填写产品信息!')", true);
                }
                else
                {
                    int flag = ProOrdersBLL.Add(orderMod);
                    if (flag > 0)
                    {
                        bool flag2 = true;

                        for (int i = 0; i < xinghao.Length; i++)
                        {
                            orderDetailMOD.orderNum = txtorderNum.Text.Trim();
                            if (Convert.ToInt32(shuliang[i]) > 0)
                            {
                                orderDetailMOD.proNum = Convert.ToInt32(shuliang[i].Trim());
                                orderDetailMOD.ProPrice = Convert.ToDecimal(danjia[i].Trim());
                                orderDetailMOD.proType = xinghao[i].Trim();
                                if (!(ProOrdersDetailBLL.Add(orderDetailMOD) > 0))
                                {
                                    flag2 = false;
                                    break;
                                }
                            }
                        }
                        if (flag2)
                        {
                            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交成功');DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);
                        }
                        else
                        {
                            ProOrdersDetailBLL.Delete(txtorderNum.Text.Trim());
                            ProOrdersBLL.Delete(txtorderNum.Text.Trim());
                            ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('添加失败!')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), "BGYPSQLB", "alert('添加失败!')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('添加失败!')", true);
            }
        }
    }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
            {
                orderDetailId = Request.QueryString["id"].ToString();
                orderDetail = ProOrdersDetailBLL.GetModel(Convert.ToInt32(orderDetailId));
                if (orderDetail != null)
                {
                    txtpiHao.Text = orderDetail.PiHao;
                    if (Convert.ToDateTime(orderDetail.PlanSendTime).ToString("yyyy-MM-dd") != "0001-01-01")
                    {
                        txtplanSendTime.Text = Convert.ToDateTime(orderDetail.PlanSendTime).ToString("yyyy-MM-dd");
                    }
                    txtproductAddress.Text = orderDetail.ProductAddress;
                    txtproNum.Text = orderDetail.proNum.ToString();
                    txtproType.Text = orderDetail.proType;
                    if (orderDetail.withWorkNo != "")
                    {
                        txtwithWorkNo.Text = orderDetail.withWorkNo;
                    }
                    else
                    {
                        txtwithWorkNo.Text = DateTime.Now.ToString("yyyyMMddhhmmss");
                    }
                    //加载订单基本信息
                    orderMod = ProOrdersBLL.GetModel(orderDetail.orderNum);
                    if (orderMod != null)
                    {
                        txtcustomManager.Text = orderMod.customManager;
                        txtcustomNum.Text = orderMod.customNum;
                        txtcustomOrderNum.Text = orderMod.customOrderNum;
                        txtcustomWLBH.Text = orderMod.customWLBH;
                        txtheTongNum.Text = orderMod.heTongNum;
                        txtorderNum.Text = orderMod.orderNum;
                        txtremark.Text = orderMod.remark;
                    }
                }
            }
        }
    }
예제 #8
0
    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, EventArgs e)
    {
        try
        {

            bool real = true;
            //修改订单基本信息
            if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
            {
                string orderNum = Request.QueryString["id"].ToString();
                //加载订单基本信息
                orderMod = ProOrdersBLL.GetModel(orderNum);
                orderMod.customManager = txtcustomManager.Text.Trim();
                orderMod.customOrderNum = txtcustomOrderNum.Text.Trim();
                orderMod.customWLBH = "";// txtcustomWLBH.Text.Trim();
                orderMod.heTongNum = txtheTongNum.Text.Trim();
                orderMod.remark = txtremark.Text.Trim();
                orderMod.UpdateTime = DateTime.Now;
                orderMod.FaPiaoDanhao = "";
                orderMod.ChengShuiHao = "";
                orderMod.Remark1 = "";
                orderMod.EditUser = UserInfo.UserId;
                orderMod.IsTiXing = 0;
                orderMod.ShuRuXianchang = "";// txtshuRuXianchang.Text.Trim();
                orderMod.ShuChuXianchang = "";// txtshuChuXianchang.Text.Trim();
                //if (txtYijiekuanMoney.Text.Trim() != "")
                //{
                //    orderMod.YijiekuanMoney = Convert.ToDecimal(txtYijiekuanMoney.Text.Trim());
                //}
                //else
                //{
                //    orderMod.YijiekuanMoney = 0;
                //}
                //if (txtYikaipiaoMoney.Text.Trim() != "")
                //{
                //    orderMod.YikaipiaoMoney = Convert.ToDecimal(txtYikaipiaoMoney.Text.Trim());
                //}
                //else
                //{
                //    orderMod.YikaipiaoMoney = 0;
                //}
                ProOrdersBLL.Update(orderMod);
            }
            //修改订单详情

            string[] xinghao = Request.Params.GetValues("proType");
            string[] shuliang = Request.Params.GetValues("proNum");
            string[] danjia = Request.Params.GetValues("ProPrice");
            string[] wuliaobian = Request.Params.GetValues("wuliaobian");

            string xianyouyongpin = "";
            string errmsg = "";
            //原有产品的增加和修改
            for (int i = 0; i < rptYongpin.Items.Count; i++)
            {
                Label lblProType = this.rptYongpin.Items[i].FindControl("lblProType") as Label;
                TextBox txtProNum = this.rptYongpin.Items[i].FindControl("txtProNum") as TextBox;
                Label lblProPrice = this.rptYongpin.Items[i].FindControl("lblProPrice") as Label;
                Label lblWuliaobian = this.rptYongpin.Items[i].FindControl("lblWuliaobian") as Label;
                HiddenField hdborderDetailId = this.rptYongpin.Items[i].FindControl("hdborderDetailId") as HiddenField;
                xianyouyongpin += lblProType.Text.Trim() + ",";

                if (txtProNum != null && txtProNum.Text.Trim() != "" && int.Parse(txtProNum.Text.Trim()) != 0)
                {
                    //修改产品数量
                    int Updcount = ProOrdersDetailBLL.Update(Convert.ToInt32(hdborderDetailId.Value), Convert.ToInt32(txtProNum.Text));
                    if (!(Updcount > 0))
                    {
                        real = false;
                    }
                }
                else
                {
                    //删除产品型号
                    ProOrdersDetailBLL.Delete(Convert.ToInt32(hdborderDetailId.Value));
                }
            }
            //新增产品

            if (xinghao != null && xinghao.Length > 0)
            {
                for (int i = 0; i < xinghao.Length; i++)
                {
                    if (shuliang[i].ToString().Trim() != "" && int.Parse(shuliang[i].ToString().Trim()) != 0)
                    {
                        ProductParamMOD paramMod = ProductParamBLL.GetmodByid(txtcustomNum.Text.Trim(), xinghao[i].Trim());
                        if (paramMod != null)
                        {
                            string xinYongpin = xinghao[i].ToString().Trim();
                            int num = 0;
                            int osid = 0;
                            if (xianyouyongpin.Contains(xinYongpin))   //如果新增产品已经存在于原有的产品中,则数量合并
                            {
                                DataSet ds = ProOrdersDetailBLL.GetList(" and proType='" + xinghao[i].Trim() + "' and orderNum='" + txtorderNum.Text.Trim() + "'");
                                if (ds != null && ds.Tables[0].Rows.Count > 0)
                                {
                                    num = Convert.ToInt32(ds.Tables[0].Rows[0]["proNum"].ToString());
                                    osid = Convert.ToInt32(ds.Tables[0].Rows[0]["orderDetailId"].ToString());
                                    int newNUM = num + Convert.ToInt32(shuliang[i].Trim());
                                    //修改产品数量
                                    int Updcount = ProOrdersDetailBLL.Update(osid, newNUM);
                                    if (!(Updcount > 0))
                                    {
                                        real = false;
                                    }
                                }
                                else
                                {
                                    orderDetail = new ProOrdersDetailMOD();
                                    orderDetail.orderNum = txtorderNum.Text.Trim();
                                    orderDetail.proNum = Convert.ToInt32(shuliang[i].Trim());
                                    orderDetail.ProPrice = Convert.ToDecimal(danjia[i].Trim());
                                    orderDetail.proType = xinghao[i].Trim();
                                    int Addcounts = ProOrdersDetailBLL.Add(orderDetail);
                                    if (!(Addcounts > 0))
                                    {
                                        real = false;
                                    }
                                }
                            }
                            else   //直接添加
                            {
                                orderDetail = new ProOrdersDetailMOD();
                                orderDetail.orderNum = txtorderNum.Text.Trim();
                                orderDetail.proNum = Convert.ToInt32(shuliang[i].Trim());
                                orderDetail.ProPrice = Convert.ToDecimal(danjia[i].Trim());
                                orderDetail.proType = xinghao[i].Trim();
                                //orderDetail.Wuliaobian = wuliaobian[i].Trim();
                                int Addcounts = ProOrdersDetailBLL.Add(orderDetail);
                                if (!(Addcounts > 0))
                                {
                                    real = false;
                                }
                            }
                        }
                        else
                        {
                            errmsg += xinghao[i] + ",";
                        }
                    }

                }
            }
            if (real)
            {
                if (errmsg == "")
                {
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);

                    //   ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');print();DetailsPageControl.CloseBox();", true);
                    Response.Redirect("Contract.aspx?customerNo=" + txtcustomNum.Text.Trim() + "&orderNum=" + txtorderNum.Text.Trim());
                }
                else
                {
                    //  ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert(" + errmsg + "'没有维护单价提交失败,其余提交成功');", true);
                    ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('" + errmsg + "没有维护产品参数提交失败,其余提交成功');DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);
                    Response.Redirect("Contract.aspx?customerNo=" + txtcustomNum.Text.Trim() + "&orderNum=" + txtorderNum.Text.Trim());
                }
                //  ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "DetailsPageControl.CloseBox();alert('提交成功!');DetailsPageControl.ReflushList('orderManage/OrderManage.aspx');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('提交失败!')", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('提交失败,您输入的信息有误!')", true);
        }
    }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
            //这里是判断是否已经登陆 (先加一个测试一下)
            var authCookie = Request.Cookies[ FormsAuthentication.FormsCookieName];
            if (authCookie == null)
            {  //Cookie中不存在,表示没有登陆,需要跳转到登陆页面
                Response.Redirect("/Login.aspx");
                return;
            }

            if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
            {
                orderDetailId = Request.QueryString["id"].ToString();
                orderDetail = ProOrdersDetailBLL.GetModel(Convert.ToInt32(orderDetailId));

                if (Request.QueryString["opr"] == "print")
                {
                    //
                    // 点击了“打印”
                    //
                    //
                    txtproNum.Text = Request.QueryString["txtproNum"];
                    orderDetail.PiHao = Request.QueryString["txtpiHao"];
                    try
                    {
                        orderDetail.PlanSendTime = Convert.ToDateTime(Request.QueryString["txtplanSendTime"].Trim());
                    }
                    catch (Exception) { }
                    orderDetail.ProductAddress = Request.QueryString["txtproductAddress"];
                }

                if (orderDetail != null)
                {
                    txtpiHao.Text = orderDetail.PiHao;
                    try
                    {
                        if (orderDetail.PlanSendTime != null && Convert.ToDateTime(orderDetail.PlanSendTime).ToString("yyyy-MM-dd") != "0001-01-01")
                        {
                            txtplanSendTime.Text = Convert.ToDateTime(orderDetail.PlanSendTime).ToString("yyyy-MM-dd");
                        }
                    }
                    catch (Exception) { }
                    txtproductAddress.Text = orderDetail.ProductAddress;
                    lblproNum.Text = orderDetail.proNum.ToString();
                    txtproType.Text = orderDetail.proType;

                    #region 生成随工单号

                    //随工单号
                    string date = DateTime.Now.ToString("yyyyMM");
                    string str = "";
                    if (SGDRecordBLL.GetSuigondanMax(date) != null)
                    {
                        str = SGDRecordBLL.GetSuigondanMax(date).ToString();
                    }
                    if (str == "")
                    {
                        txtwithWorkNo.Text = DateTime.Now.ToString("yyyyMMdd") + "-1-" + DateTime.Now.ToString("ffff");
                    }
                    else
                    {
                        try
                        {
                            txtwithWorkNo.Text = DateTime.Now.ToString("yyyyMMdd") + "-" + (Convert.ToInt32(str.Split('-')[1]) + 1) + "-" + DateTime.Now.ToString("ffff");
                        }
                        catch (Exception ex)
                        {
                            throw new Exception("错误的字串:" + str);
                        }
                    }
                    #endregion

                    //加载订单内容信息
                    orderMod = ProOrdersBLL.GetModel(orderDetail.orderNum);
                    if (orderMod != null)
                    {
                        txtcustomManager.Text = orderMod.customManager;
                        txtcustomNum.Text = orderMod.customNum;
                        txtcustomOrderNum.Text = orderMod.customOrderNum;
                        txtcustomWLBH.Text = orderMod.customWLBH;
                        txtheTongNum.Text = orderMod.heTongNum;
                        txtorderNum.Text = orderMod.orderNum;
                        txtremark.Text = orderMod.remark;

                        var db = new Web.Model.OrderPrintEntities();
                        var intorderDetailId = Int32.Parse(orderDetailId);
                        var gt_order = db.proOrders.FirstOrDefault(r => r.orderId == orderMod.orderId);
                        if (!string.IsNullOrEmpty(gt_order.发货状态))//发货状态显示判断
                        {
                            lbl发货状态.Text = gt_order.发货状态;
                        }
                    }

                }
            }
            }
        }