Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
            {
                imgWaiXingTZ.Visible = true;
                imgbiaoShiPicture.Visible = true;
                int id = Convert.ToInt32(Request.QueryString["id"]);
                mod = ProductsBLL.GetModel(id);
                if (mod != null)
                {
                    txtbaoHeDian.Text = mod.baoHeDian;
                    txtbianbi.Text = mod.bian;
                    txtbiaoShiAddress.Text = mod.biaoShiAddress;
                    txtbiaoShiNo.Text = mod.biaoShiNo;
                    imgbiaoShiPicture.ImageUrl = mod.biaoShiPicture;
                    imgWaiXingTZ.ImageUrl = mod.waiXingTZ;

                    txtcaiLiao.Text = mod.caiLiao;

                    txtchajianCount.Text = mod.chajianCount.ToString();

                    txtchajianNo.Text = mod.chajianNo;
                    txtchujRaoXianZD.Text = mod.chujRaoXianZD;
                    txtchujTongMD.Text = mod.chujTongMD;
                    txtchujXianJing.Text = mod.chujXianJing;
                    txtchujXianTouCD.Text = mod.chujXianTouCD;
                    txtchujXiantouCL.Text = mod.chujXiantouCL;
                    txtchujZaShu.Text = mod.chujZaShu;
                    txtchuLiMethod.Text = mod.chuLiMethod;
                    txtcijRaoXianZD.Text = mod.cijRaoXianZD;
                    txtcijTongMD.Text = mod.cijTongMD;
                    txtcijXianJing.Text = mod.cijXianJing;
                    txtcijXianTouCD.Text = mod.cijXianTouCD;
                    txtcijXianTouCL.Text = mod.cijXianTouCL;
                    txtcijZaShu.Text = mod.cijZaShu;
                    txtcpjccsEquip.Text = mod.cpjccsEquip;
                    txtcpjccsFuZai.Text = mod.cpjccsFuZai;
                    txtCpjccsJiaoChaBH.Text = mod.CpjccsJiaoChaBH;
                    txtcpjccsNaiYa.Text = mod.cpjccsNaiYa;
                    txtcpjccsShuChuState.Text = mod.cpjccsShuChuState;
                    txtcpjccsShuRuState.Text = mod.cpjccsShuRuState;
                    txtcpjccsTongMD.Text = mod.cpjccsTongMD;
                    txteDingJC.Text = mod.eDingJC;
                    txtguanJiaoZhenLX.Text = mod.guanJiaoZhenLX;
                    txtguanJIaoZhenLXCount.Text = mod.guanJIaoZhenLXCount.ToString();
                    txtguanJiaoZhenLXTOW.Text = mod.guanJiaoZhenLXTOW;
                    txtguanJiaoZhenLXTOWCount.Text = mod.guanJiaoZhenLXTOWCount.ToString();
                    txtguiGe.Text = mod.guiGe;
                    txtjingDu.Text = mod.jingDu;
                    txtNeiBZ.Text = mod.NeiBZ;
                    txtpeiXianSC.Text = mod.peiXianSC;
                    txtpeiXianSCCount.Text = mod.peiXianSCCount.ToString();
                    txtpeiXianSR.Text = mod.peiXianSR;
                    txtpeiXianSRCount.Text = mod.peiXianSRCount.ToString();
                    txtproductName.Text = mod.productName;
                    txtproductNum.Text = mod.productNum;
                    txtremark.Text = mod.remark;
                    txtshuChu.Text = mod.shuChu;
                    txtshuChuXC.Text = mod.shuChuXC;
                    txtshuRu.Text = mod.shuRu;
                    txtshuRuXC.Text = mod.shuRuXC;
                    txttieXiCount.Text = mod.tieXiCount.ToString();
                    txtwaiBZ.Text = mod.waiBZ.ToString();

                    txtwaiKeCount.Text = mod.waiKeCount.ToString();
                    txtwaiKeNo.Text = mod.waiKeNo;
                    txtxianQuanCount.Text = mod.xianQuanCount.ToString();

                    txtxianXingdu.Text = mod.xianXingdu;
                    txtxingNeng.Text = mod.xingNeng;
                    txtxqjcyqEquip.Text = mod.xqjcyqEquip;
                    txtxqjcyqFuZai.Text = mod.xqjcyqFuZai;
                    txtxqjcyqJiaoCha.Text = mod.xqjcyqJiaoCha;
                    txtxqjcyqShuChuState.Text = mod.xqjcyqShuChuState;
                    txtxqjcyqShuRuState.Text = mod.xqjcyqShuRuState;
                    txtyongJiaoCS.Text = mod.yongJiaoCS;
                }
                //产品编号不允许修改
                txtproductNum.Enabled = false;
            }
            else
            {
                imgWaiXingTZ.Visible = true;
                imgbiaoShiPicture.Visible = true;
            }
        }
    }
Example #2
0
    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, ImageClickEventArgs e)
    {
        int num = 0;
        bool isModifyPrintSGDCount = false;
        if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);
            mod = ProductsBLL.GetModel(id);
            if (mod.biaoShiNo != txtbiaoShiNo.Text.Trim())
            {
                mod.isModifyTZ = 1;
                isModifyPrintSGDCount = true;
            }
            if (mod.waiKeNo != txtwaiKeNo.Text.Trim())
            {
                mod.IsModifyWaikeNo = 1;
                isModifyPrintSGDCount = true;
            }
            mod.baoHeDian = txtbaoHeDian.Text.Trim();
            mod.bian = txtbianbi.Text.Trim();
            mod.biaoShiAddress = txtbiaoShiAddress.Text.Trim();
            mod.biaoShiNo = txtbiaoShiNo.Text.Trim();

            Boolean fileOK = false;
            //上传外形图纸
            if (fuwaiXingTZ.HasFile)
            {
                // 得到文件的后缀
                String fileExtension =
                    System.IO.Path.GetExtension(fuwaiXingTZ.FileName).ToLower();
                // 允许的文件后缀
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                // 看包含的文件是否是被允许的文件后缀
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        // 如果是,标志位置为真
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string url = "~/fileUpload/" + fuwaiXingTZ.FileName;

                    if (fuwaiXingTZ.HasFile)
                    {
                        string fileType = fuwaiXingTZ.PostedFile.ContentType;

                        string name = fuwaiXingTZ.PostedFile.FileName;  //文件路径
                        FileInfo fileInfo = new FileInfo(name);
                        try
                        {
                            fuwaiXingTZ.SaveAs(Server.MapPath(url));
                            mod.waiXingTZ = url;
                            fileOK = false;

                        }
                        catch (Exception ex)
                        {
                            Response.Write("<script>alert('上传有误,请重新上传!');</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('只能上传gif,png,jpeg,jpg格式的文件!');</script>");
                    return;
                }
            }

            //上传标示图片

            if (fubiaoShiPicture.HasFile)
            {
                // 得到文件的后缀
                String fileExtension =
                    System.IO.Path.GetExtension(fubiaoShiPicture.FileName).ToLower();
                // 允许的文件后缀
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                // 看包含的文件是否是被允许的文件后缀
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        // 如果是,标志位置为真
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string url = "~/fileUpload/" + fubiaoShiPicture.FileName;

                    if (fubiaoShiPicture.HasFile)
                    {
                        string fileType = fubiaoShiPicture.PostedFile.ContentType;

                        string name = fubiaoShiPicture.PostedFile.FileName;  //文件路径
                        FileInfo fileInfo = new FileInfo(name);
                        try
                        {
                            fubiaoShiPicture.SaveAs(Server.MapPath(url));
                            mod.biaoShiPicture = url;
                            fileOK = false;
                            mod.isModifyTZ = 1;
                            isModifyPrintSGDCount = true;
                        }
                        catch (Exception ex)
                        {
                            Response.Write("<script>alert('上传有误,请重新上传!');</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('只能上传gif,png,jpeg,jpg格式的文件!');</script>");
                    return;
                }
            }
            mod.caiLiao = txtcaiLiao.Text.Trim();
            if (txtchajianCount.Text.Trim() != "")
            {
                mod.chajianCount = Convert.ToInt32(txtchajianCount.Text.Trim());
            }
            else
            {
                mod.chajianCount = 0;
            }
            mod.chajianNo = txtchajianNo.Text.Trim();
            mod.chujRaoXianZD = txtchujRaoXianZD.Text.Trim();
            mod.chujTongMD = txtchujTongMD.Text.Trim();
            mod.chujXianJing = txtchujXianJing.Text.Trim();
            mod.chujXianTouCD = txtchujXianTouCD.Text.Trim();
            mod.chujXiantouCL = txtchujXiantouCL.Text.Trim();
            mod.chujZaShu = txtchujZaShu.Text.Trim();
            mod.chuLiMethod = txtchuLiMethod.Text.Trim();
            mod.cijRaoXianZD = txtcijRaoXianZD.Text.Trim();
            mod.cijTongMD = txtcijTongMD.Text.Trim();
            mod.cijXianJing = txtcijXianJing.Text.Trim();
            mod.cijXianTouCD = txtcijXianTouCD.Text.Trim();
            mod.cijXianTouCL = txtcijXianTouCL.Text.Trim();
            mod.cijZaShu = txtcijZaShu.Text.Trim();
            mod.cpjccsEquip = txtcpjccsEquip.Text.Trim();
            mod.cpjccsFuZai = txtcpjccsFuZai.Text.Trim();
            mod.CpjccsJiaoChaBH = txtCpjccsJiaoChaBH.Text.Trim();
            mod.cpjccsNaiYa = txtcpjccsNaiYa.Text.Trim();
            mod.cpjccsShuChuState = txtcpjccsShuChuState.Text.Trim();
            mod.cpjccsShuRuState = txtcpjccsShuRuState.Text.Trim();
            mod.cpjccsTongMD = txtcpjccsTongMD.Text.Trim();
            mod.eDingJC = txteDingJC.Text.Trim();
            mod.guanJiaoZhenLX = txtguanJiaoZhenLX.Text.Trim();
            if (txtguanJIaoZhenLXCount.Text.Trim() != "")
            {
                mod.guanJIaoZhenLXCount = Convert.ToInt32(txtguanJIaoZhenLXCount.Text.Trim());
            }
            else
            {
                mod.guanJIaoZhenLXCount = 0;
            }
            mod.guanJiaoZhenLXTOW = txtguanJiaoZhenLXTOW.Text.Trim();
            if (txtguanJiaoZhenLXTOWCount.Text.Trim() != "")
            {
                mod.guanJiaoZhenLXTOWCount = Convert.ToInt32(txtguanJiaoZhenLXTOWCount.Text.Trim());
            }
            else
            {
                mod.guanJiaoZhenLXTOWCount = 0;
            }
            mod.guiGe = txtguiGe.Text.Trim();

            mod.jingDu = txtjingDu.Text.Trim();
            mod.NeiBZ = txtNeiBZ.Text.Trim();
            mod.NeiBZDW = "psc";
            mod.peiXianSC = txtpeiXianSC.Text.Trim();
            if (txtpeiXianSCCount.Text.Trim() != "")
            {
                mod.peiXianSCCount = Convert.ToDecimal(txtpeiXianSCCount.Text.Trim());
            }
            else
            {
                mod.peiXianSCCount = 0;
            }
            mod.peiXianSR = txtpeiXianSR.Text.Trim();
            if (txtpeiXianSRCount.Text.Trim() != "")
            {
                mod.peiXianSRCount = Convert.ToDecimal(txtpeiXianSRCount.Text.Trim());
            }
            else
            {
                mod.peiXianSRCount = 0;
            }
            mod.productName = txtproductName.Text.Trim();
            mod.productNum = txtproductNum.Text.Trim();
            mod.remark = txtremark.Text.Trim();
            mod.shuChu = txtshuChu.Text.Trim();
            mod.shuChuXC = txtshuChuXC.Text.Trim();
            mod.shuRu = txtshuRu.Text.Trim();
            mod.shuRuXC = txtshuRuXC.Text.Trim();
            if (txttieXiCount.Text.Trim() != "")
            {
                mod.tieXiCount = Convert.ToInt32(txttieXiCount.Text.Trim());
            }
            else
            {
                mod.tieXiCount = 0;
            }
            if (txtwaiBZ.Text.Trim() != "")
            {
                mod.waiBZ = Convert.ToInt32(txtwaiBZ.Text.Trim());
            }
            else
            {
                mod.waiBZ = 0;
            }
            if (txtwaiKeCount.Text.Trim() != "")
            {
                mod.waiKeCount = Convert.ToInt32(txtwaiKeCount.Text.Trim());
            }
            else
            {
                mod.waiKeCount = 0;
            }
            mod.waiKeNo = txtwaiKeNo.Text.Trim();

            if (txtxianQuanCount.Text.Trim() != "")
            {
                mod.xianQuanCount = Convert.ToInt32(txtxianQuanCount.Text.Trim());
            }
            else
            {
                mod.xianQuanCount = 0;
            }
            mod.xianXingdu = txtxianXingdu.Text.Trim();
            mod.xingNeng = txtxingNeng.Text.Trim();
            mod.xqjcyqEquip = txtxqjcyqEquip.Text.Trim();
            mod.xqjcyqFuZai = txtxqjcyqFuZai.Text.Trim();
            mod.xqjcyqJiaoCha = txtxqjcyqJiaoCha.Text.Trim();
            mod.xqjcyqShuChuState = txtxqjcyqShuChuState.Text.Trim();
            mod.xqjcyqShuRuState = txtxqjcyqShuRuState.Text.Trim();
            mod.yongJiaoCS = txtyongJiaoCS.Text.Trim();
            num = ProductsBLL.Update(mod);
            if (isModifyPrintSGDCount)
            {
                //随工单打印次数改为0
                ProOrdersDetailBLL.UpdatePrintInfo(txtproductNum.Text.Trim());
            }
        }
        else
        {
            mod = new ProductsMOD();
            mod.baoHeDian = txtbaoHeDian.Text.Trim();
            mod.bian = txtbianbi.Text.Trim();
            mod.biaoShiAddress = txtbiaoShiAddress.Text.Trim();
            mod.biaoShiNo = txtbiaoShiNo.Text.Trim();

            Boolean fileOK = false;
            //上传外形图纸
            if (fuwaiXingTZ.HasFile)
            {
                // 得到文件的后缀
                String fileExtension =
                    System.IO.Path.GetExtension(fuwaiXingTZ.FileName).ToLower();
                // 允许的文件后缀
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                // 看包含的文件是否是被允许的文件后缀
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        // 如果是,标志位置为真
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string url = "~/fileUpload/" + fuwaiXingTZ.FileName;

                    if (fuwaiXingTZ.HasFile)
                    {
                        string fileType = fuwaiXingTZ.PostedFile.ContentType;

                        string name = fuwaiXingTZ.PostedFile.FileName;  //文件路径
                        FileInfo fileInfo = new FileInfo(name);
                        try
                        {
                            fuwaiXingTZ.SaveAs(Server.MapPath(url));
                            mod.waiXingTZ = url;
                            fileOK = false;

                        }
                        catch (Exception ex)
                        {
                            Response.Write("<script>alert('上传有误,请重新上传!');</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('只能上传gif,png,jpeg,jpg格式的文件!');</script>");
                    return;
                }

            }
            else
            {
                mod.waiXingTZ = "";
            }

            //上传标示图片

            if (fubiaoShiPicture.HasFile)
            {
                // 得到文件的后缀
                String fileExtension =
                    System.IO.Path.GetExtension(fubiaoShiPicture.FileName).ToLower();
                // 允许的文件后缀
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                // 看包含的文件是否是被允许的文件后缀
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        // 如果是,标志位置为真
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string url = "~/fileUpload/" + fubiaoShiPicture.FileName;

                    if (fubiaoShiPicture.HasFile)
                    {
                        string fileType = fubiaoShiPicture.PostedFile.ContentType;

                        string name = fubiaoShiPicture.PostedFile.FileName;  //文件路径
                        FileInfo fileInfo = new FileInfo(name);
                        try
                        {
                            fubiaoShiPicture.SaveAs(Server.MapPath(url));
                            mod.biaoShiPicture = url;
                            fileOK = false;

                        }
                        catch (Exception ex)
                        {
                            Response.Write("<script>alert('上传有误,请重新上传!');</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('只能上传gif,png,jpeg,jpg格式的文件!');</script>");
                    return;
                }
            }
            else
            {
                mod.biaoShiPicture = "";
            }
            mod.caiLiao = txtcaiLiao.Text.Trim();
            if (txtchajianCount.Text.Trim() != "")
            {
                mod.chajianCount = Convert.ToInt32(txtchajianCount.Text.Trim());
            }
            else
            {
                mod.chajianCount = 0;
            }
            mod.chajianNo = txtchajianNo.Text.Trim();
            mod.chujRaoXianZD = txtchujRaoXianZD.Text.Trim();
            mod.chujTongMD = txtchujTongMD.Text.Trim();
            mod.chujXianJing = txtchujXianJing.Text.Trim();
            mod.chujXianTouCD = txtchujXianTouCD.Text.Trim();
            mod.chujXiantouCL = txtchujXiantouCL.Text.Trim();
            mod.chujZaShu = txtchujZaShu.Text.Trim();
            mod.chuLiMethod = txtchuLiMethod.Text.Trim();
            mod.cijRaoXianZD = txtcijRaoXianZD.Text.Trim();
            mod.cijTongMD = txtcijTongMD.Text.Trim();
            mod.cijXianJing = txtcijXianJing.Text.Trim();
            mod.cijXianTouCD = txtcijXianTouCD.Text.Trim();
            mod.cijXianTouCL = txtcijXianTouCL.Text.Trim();
            mod.cijZaShu = txtcijZaShu.Text.Trim();
            mod.cpjccsEquip = txtcpjccsEquip.Text.Trim();
            mod.cpjccsFuZai = txtcpjccsFuZai.Text.Trim();
            mod.CpjccsJiaoChaBH = txtCpjccsJiaoChaBH.Text.Trim();
            mod.cpjccsNaiYa = txtcpjccsNaiYa.Text.Trim();
            mod.cpjccsShuChuState = txtcpjccsShuChuState.Text.Trim();
            mod.cpjccsShuRuState = txtcpjccsShuRuState.Text.Trim();
            mod.cpjccsTongMD = txtcpjccsTongMD.Text.Trim();
            mod.eDingJC = txteDingJC.Text.Trim();
            mod.guanJiaoZhenLX = txtguanJiaoZhenLX.Text.Trim();
            if (txtguanJIaoZhenLXCount.Text.Trim() != "")
            {
                mod.guanJIaoZhenLXCount = Convert.ToInt32(txtguanJIaoZhenLXCount.Text.Trim());
            }
            else
            {
                mod.guanJIaoZhenLXCount = 0;
            }
            mod.guanJiaoZhenLXTOW = txtguanJiaoZhenLXTOW.Text.Trim();
            if (txtguanJiaoZhenLXTOWCount.Text.Trim() != "")
            {
                mod.guanJiaoZhenLXTOWCount = Convert.ToInt32(txtguanJiaoZhenLXTOWCount.Text.Trim());
            }
            else
            {
                mod.guanJiaoZhenLXTOWCount = 0;
            }
            mod.guiGe = txtguiGe.Text.Trim();
            mod.isModifyTZ = 0;
            mod.IsModifyWaikeNo = 0;
            mod.jingDu = txtjingDu.Text.Trim();
            mod.NeiBZ = txtNeiBZ.Text.Trim();
            mod.NeiBZDW = "psc";
            mod.peiXianSC = txtpeiXianSC.Text.Trim();
            if (txtpeiXianSCCount.Text.Trim() != "")
            {
                mod.peiXianSCCount = Convert.ToDecimal(txtpeiXianSCCount.Text.Trim());
            }
            else
            {
                mod.peiXianSCCount = 0;
            }
            mod.peiXianSR = txtpeiXianSR.Text.Trim();
            if (txtpeiXianSRCount.Text.Trim() != "")
            {
                mod.peiXianSRCount = Convert.ToDecimal(txtpeiXianSRCount.Text.Trim());
            }
            else
            {
                mod.peiXianSRCount = 0;
            }
            mod.productName = txtproductName.Text.Trim();
            mod.productNum = txtproductNum.Text.Trim();
            mod.remark = txtremark.Text.Trim();
            mod.shuChu = txtshuChu.Text.Trim();
            mod.shuChuXC = txtshuChuXC.Text.Trim();
            mod.shuRu = txtshuRu.Text.Trim();
            mod.shuRuXC = txtshuRuXC.Text.Trim();
            if (txttieXiCount.Text.Trim() != "")
            {
                mod.tieXiCount = Convert.ToInt32(txttieXiCount.Text.Trim());
            }
            else
            {
                mod.tieXiCount = 0;
            }
            if (txtwaiBZ.Text.Trim() != "")
            {
                mod.waiBZ = Convert.ToInt32(txtwaiBZ.Text.Trim());
            }
            else
            {
                mod.waiBZ = 0;
            }
            if (txtwaiKeCount.Text.Trim() != "")
            {
                mod.waiKeCount = Convert.ToInt32(txtwaiKeCount.Text.Trim());
            }
            else
            {
                mod.waiKeCount = 0;
            }
            mod.waiKeNo = txtwaiKeNo.Text.Trim();

            if (txtxianQuanCount.Text.Trim() != "")
            {
                mod.xianQuanCount = Convert.ToInt32(txtxianQuanCount.Text.Trim());
            }
            else
            {
                mod.xianQuanCount = 0;
            }
            mod.xianXingdu = txtxianXingdu.Text.Trim();
            mod.xingNeng = txtxingNeng.Text.Trim();
            mod.xqjcyqEquip = txtxqjcyqEquip.Text.Trim();
            mod.xqjcyqFuZai = txtxqjcyqFuZai.Text.Trim();
            mod.xqjcyqJiaoCha = txtxqjcyqJiaoCha.Text.Trim();
            mod.xqjcyqShuChuState = txtxqjcyqShuChuState.Text.Trim();
            mod.xqjcyqShuRuState = txtxqjcyqShuRuState.Text.Trim();
            mod.yongJiaoCS = txtyongJiaoCS.Text.Trim();

            num = ProductsBLL.Add(mod);
        }
        if (num > 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交成功');DetailsPageControl.ReflushList('ProductManage/ProductManage.aspx');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('提交失败');", true);
        }
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (true || Session["songhuodan"] == null)
            {

                string isFahuo = "1";// Session["songhuodan"].ToString();
                if (isFahuo == "1")
                {

                    Session["songhuodan"] = "1";
                    if (Request.QueryString["orderNum"] != null && Request.QueryString["orderNum"].ToString() != "")
                    {
                        orderNum = Request.QueryString["orderNum"].ToString();
                    }
                    if (Request.QueryString["proNum"] != null && Request.QueryString["proNum"].ToString() != "")
                    {
                        proNum = Request.QueryString["proNum"].ToString();
                    }
                    if (Request.QueryString["proType"] != null && Request.QueryString["proType"].ToString() != "")
                    {
                        proType = Request.QueryString["proType"].ToString();
                    }
                    if (Request.QueryString["customNum"] != null && Request.QueryString["customNum"].ToString() != "")
                    {
                        customNum = Request.QueryString["customNum"].ToString();
                        customerMod = new CustomerManageMod();
                        customerMod = CustomerManageBLL.GetcustomerByid(customNum);
                    }
                    string strOrderDetail = " and orderNum='" + orderNum + "'";
                    ProOrdersMOD proOrderMOD = ProOrdersBLL.GetModel(orderNum);
                    DataSet ds = ProOrdersDetailBLL.GetList(strOrderDetail);
                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {

                        var countN = 0;
                        var countW = 0;
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            string proType = ds.Tables[0].Rows[i]["proType"].ToString();
                            ProductParamMOD paramMod = ProductParamBLL.GetmodByid(customNum, proType);
                            //    string proNum = ds.Tables[0].Rows[i]["proNum"].ToString();
                            object obj = SendDetailBLL.GetSendCountByProType(proType, orderNum);
                            if (obj != null)
                            {
                                proNum = obj.ToString();
                            }
                            if (proNum != "")
                            {
                                //根据产品型号和数量计算出外包装盒和内包装盒标签个数
                                int neiCount = 0;
                                int waiCount = 0;
                                productMod = ProductsBLL.GetModel(proType);
                                string nei = "";
                                string wai = "";

                                if (productMod != null)
                                {
                                    nei = productMod.NeiBZ;   //内包装盒的产品数
                                    wai = productMod.waiBZ.ToString();  //外包装盒里面内包装盒个数

                                    if (productMod.NeiBZ == "0")
                                    {
                                        //htmlStr += productMod.productName+ "内包装盒的产品数为0,系统无法计算内包装盒数量,请重新设置该产品内包装盒的产品数!";
                                        continue;
                                    }
                                    if (productMod.waiBZ == 0)
                                    {
                                        //htmlStr += productMod.productName+"外包装盒里面内包装盒个数为0,系统无法计算外包装盒数量,请重新设置外包装盒里面内包装盒个数!";
                                        continue;
                                    }

                                    if (Convert.ToInt32(proNum) % Convert.ToInt32(nei) == 0)
                                    {
                                        neiCount = Convert.ToInt32(proNum) / Convert.ToInt32(nei);
                                    }
                                    else
                                    {
                                        neiCount = (Convert.ToInt32(proNum) / Convert.ToInt32(nei)) + 1;
                                    }

                                    if (neiCount % Convert.ToInt32(wai) == 0)
                                    {
                                        waiCount = neiCount / Convert.ToInt32(wai);
                                    }
                                    else
                                    {
                                        waiCount = (neiCount / Convert.ToInt32(wai)) + 1;
                                    }
                                }
                                //内包装标签
                                htmlStr += "<table cellpadding='0' cellspacing='0' align='center'><tr><td>";
                                //  htmlStr += "<table cellpadding='0' cellspacing='0' style='width: 300px; margin-top: 10px;' align='center'><tr><td colspan='2'>内包装盒标签</tr></td></table>";

                                var htmlStrN = "";
                                var htmlStrW = "";

                                for (int j = 0; j < neiCount; j++)
                                {
                                    int num = 0;
                                    if (j == neiCount - 1)
                                    {
                                        num = Convert.ToInt32(proNum) - (Convert.ToInt32(nei) * (neiCount - 1));
                                    }
                                    else
                                    {
                                        num = Convert.ToInt32(nei);
                                    }
                                    if (j % 2 == 0)
                                    {
                                        htmlStrN += "<td/><tr/><tr><td>";
                                    }
                                    else
                                    {
                                        htmlStrN += "<td/><td>";
                                    }
                                    htmlStrN += "<table cellpadding='0' cellspacing='0' style='width: 300px; margin-top: 10px;padding-left:10px;padding-right:10px; border: 1px solid #000;margin-right:10px;' align='center'>";
                                    htmlStrN += "<tr><td colspan='2' align='center'>内包装盒标签</td></tr>";
                                    if (customerMod != null)
                                    {
                                        htmlStrN += "<tr><td style='width:120px;'>客户名称:<br />Customer name</td><td style='font-size:12px;'>" + customerMod.CompanyName + "</td></tr>";
                                    }
                                    else
                                    {
                                        htmlStrN += "<tr><td style='width:120px;'>客户名称:<br />Customer name</td><td></td></tr>";
                                    }
                                    htmlStrN += " <tr><td>型号:<br />Model number </td><td>" + proType + "</td></tr>";
                                    htmlStrN += "<tr><td>规格参数:<br />Parameters </td><td>" + productMod.bian + "</td></tr>";
                                    htmlStrN += " <tr><td>数    量:<br /> Quantity</td><td>" + num + "</td></tr>";
                                    htmlStrN += "<tr><td>封 装 日 期:<br />Packaging date</td><td>" + DateTime.Now.ToShortDateString() + "</td></tr>";
                                    htmlStrN += "</table>";

                                    countN++;
                                    if (countN % 8 == 0)
                                    {
                                        htmlStrN += "<div style='page-break-after:always;'>分页</div>";
                                    }
                                }
                                //  htmlStr += "<table cellpadding='0' cellspacing='0' style='width: 300px; margin-top: 10px;' align='center'><tr><td colspan='2'>外包装盒标签</tr></td></table>";
                                //外包装标签
                                // htmlStr += "<div style='clear:both;'><div/>";

                                for (int k = 0; k < waiCount; k++)
                                {
                                    string waiNUM = "";
                                    if (k == waiCount - 1)
                                    {
                                        // waiNUM = neiCount - (Convert.ToInt32(wai) * (waiCount - 1));   //剩余内包装盒

                                        waiNUM = neiCount - (Convert.ToInt32(wai) * (waiCount - 1)) + "盒(" + (Convert.ToInt32(proNum) - (Convert.ToInt32(wai) * (waiCount - 1) * Convert.ToInt32(nei))) + "PCS)";
                                    }
                                    else
                                    {
                                        waiNUM = Convert.ToInt32(wai) + "盒(" + (Convert.ToInt32(wai) * Convert.ToInt32(nei)) + "PCS)";  //如果是整除 数量为内包装盒个数
                                    }
                                    if (k % 2 == 0)
                                    {
                                        htmlStrW += "<td/><tr/><tr><td>";
                                    }
                                    else
                                    {
                                        htmlStrW += "<td/><td>";
                                    }
                                    htmlStrW += "<table cellpadding='0' cellspacing='0' style='width: 300px;padding-left:10px;padding-right:10px; margin-top: 10px; border: 1px solid #000; margin-right:10px;' align='center'>";
                                    htmlStrW += "<tr><td colspan='2' align='center'>外包装盒标签</td></tr>";
                                    if (customerMod != null)
                                    {
                                        htmlStrW += "<tr><td style='width:140px;'>客户名称:<br />Customer name</td><td style='font-size:12px;'>" + customerMod.CompanyName + "</td></tr>";
                                    }
                                    else
                                    {
                                        htmlStrW += "<tr><td style='width:140px;'>客户名称:<br />Customer name</td><td></td></tr>";
                                    }
                                    htmlStrW += " <tr><td>型号:<br />Model number </td><td>" + proType + "</td></tr>";
                                    htmlStrW += "<tr><td>规格参数:<br />Parameters </td><td>" + productMod.bian + "</td></tr>";
                                    htmlStrW += " <tr><td>数    量:<br /> Quantity</td><td>" + waiNUM + "</td></tr>";
                                    htmlStrW += "<tr><td>合同编号:<br /> Contract No.</td><td>" + proOrderMOD.heTongNum + "</td></tr>";
                                    if (paramMod != null)
                                    {
                                        htmlStrW += "<tr> <td>物料编号:<br />Material Code</td><td><input style='border:none;' value='" + paramMod.Wuliaobian + "'></input></td></tr>";
                                    }
                                    else
                                    {
                                        htmlStrW += "<tr> <td>物料编号:<br />Material Code</td><td><input style='border:none;'></input></td></tr>";
                                    }
                                    htmlStrW += "<tr><td>客户单号:<br />Purchase order No.</td><td>" + proOrderMOD.customOrderNum + "</td></tr>";
                                    htmlStrW += "<tr><td>供应商名称:<br />Vendor Company</td><td>北京霍远科技</td></tr>";
                                    htmlStrW += "<tr><td>件      数:<br />Number of packages</td><td>" + waiCount + "-" + (k + 1) + "</td></tr>";
                                    htmlStrW += "</table>";
                                    countW++;
                                    if (countW % 4 == 0)
                                    {
                                        htmlStrW += "<div style='page-break-after:always;'>分页</div>";
                                    }
                                }
                                htmlStr += htmlStrN;
                                htmlStr += "<div style='page-break-after:always;'>分页</div>";
                                htmlStr += htmlStrW;

                                htmlStr += "</table>";
                            }
                        }
                    }
                }
            }
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
                {
                    imgWaiXingTZ.Visible = true;
                    imgbiaoShiPicture.Visible = true;
                    int id = Convert.ToInt32(Request.QueryString["id"]);
                    mod = ProductsBLL.GetModel(id);
                    if (mod != null)
                    {
                        txtbaoHeDian.Text = mod.baoHeDian;
                        txtbianbi.Text = mod.bian;
                        txtbiaoShiAddress.Text = mod.biaoShiAddress;
                        txtbiaoShiNo.Text = mod.biaoShiNo;
                        if (mod.biaoShiPicture != "")
                        {
                            imgbiaoShiPicture.ImageUrl = mod.biaoShiPicture;
                        }
                        else
                        {
                            imgbiaoShiPicture.ImageUrl = "/images/nophoto.jpg";
                        }
                        if (mod.waiXingTZ != "")
                        {
                            imgWaiXingTZ.ImageUrl = mod.waiXingTZ;
                        }
                        else
                        {
                            imgWaiXingTZ.ImageUrl = "/images/nophoto.jpg";
                        }

                        txtcaiLiao.Text = mod.caiLiao;

                        txtchajianCount.Text = mod.chajianCount.ToString();

                        txtchajianNo.Text = mod.chajianNo;
                        txtchujRaoXianZD.Text = mod.chujRaoXianZD;
                        txtchujTongMD.Text = mod.chujTongMD;
                        txtchujXianJing.Text = mod.chujXianJing;
                        txtchujXianTouCD.Text = mod.chujXianTouCD;
                        txtchujXiantouCL.Text = mod.chujXiantouCL;
                        txtchujZaShu.Text = mod.chujZaShu;
                        txtchuLiMethod.Text = mod.chuLiMethod;
                        txtcijRaoXianZD.Text = mod.cijRaoXianZD;
                        txtcijTongMD.Text = mod.cijTongMD;
                        txtcijXianJing.Text = mod.cijXianJing;
                        txtcijXianTouCD.Text = mod.cijXianTouCD;
                        txtcijXianTouCL.Text = mod.cijXianTouCL;
                        txtcijZaShu.Text = mod.cijZaShu;
                        txtcpjccsEquip.Text = mod.cpjccsEquip;
                        txtcpjccsFuZai.Text = mod.cpjccsFuZai;
                        txtCpjccsJiaoChaBH.Text = mod.CpjccsJiaoChaBH;
                        txtcpjccsNaiYa.Text = mod.cpjccsNaiYa;
                        txtcpjccsShuChuState.Text = mod.cpjccsShuChuState;
                        txtcpjccsShuRuState.Text = mod.cpjccsShuRuState;
                        txtcpjccsTongMD.Text = mod.cpjccsTongMD;
                        txteDingJC.Text = mod.eDingJC;
                        txtguanJiaoZhenLX.Text = mod.guanJiaoZhenLX;
                        txtguanJIaoZhenLXCount.Text = mod.guanJIaoZhenLXCount.ToString();
                        txtguanJiaoZhenLXTOW.Text = mod.guanJiaoZhenLXTOW;
                        txtguanJiaoZhenLXTOWCount.Text = mod.guanJiaoZhenLXTOWCount.ToString();
                        txtguiGe.Text = mod.guiGe;
                        txtjingDu.Text = mod.jingDu;
                        txtNeiBZ.Text = mod.NeiBZ;
                        txtpeiXianSC.Text = mod.peiXianSC;
                        txtpeiXianSCCount.Text = mod.peiXianSCCount.ToString();
                        txtpeiXianSR.Text = mod.peiXianSR;
                        txtpeiXianSRCount.Text = mod.peiXianSRCount.ToString();
                        txtproductName.Text = mod.productName;
                        txtproductNum.Text = mod.productNum;
                        txtremark.InnerHtml = mod.remark;
                        txtshuChu.Text = mod.shuChu;
                        txtshuChuXC.Text = mod.shuChuXC;
                        txtshuRu.Text = mod.shuRu;
                        txtshuRuXC.Text = mod.shuRuXC;
                        txttieXiCount.Text = mod.tieXiCount.ToString();
                        txtwaiBZ.Text = mod.waiBZ.ToString();

                        txtwaiKeCount.Text = mod.waiKeCount.ToString();
                        txtwaiKeNo.Text = mod.waiKeNo;
                        txtxianQuanCount.Text = mod.xianQuanCount.ToString();

                        txtxianXingdu.Text = mod.xianXingdu;
                        txtxingNeng.Text = mod.xingNeng;
                        txtxqjcyqEquip.Text = mod.xqjcyqEquip;
                        txtxqjcyqFuZai.Text = mod.xqjcyqFuZai;
                        txtxqjcyqJiaoCha.Text = mod.xqjcyqJiaoCha;
                        txtxqjcyqShuChuState.Text = mod.xqjcyqShuChuState;
                        txtxqjcyqShuRuState.Text = mod.xqjcyqShuRuState;
                        txtyongJiaoCS.Text = mod.yongJiaoCS;
                        txtGongyi.InnerHtml = mod.GongyiZYSX;

                        txtbaoZhuangHeGG.Text = mod.BaoZhuangHeGG;
                        txtbaoZhuangXiangGG.Text = mod.BaoZhuangXiangGG;
                        txtbaoHeDianTestTJ.Text = mod.BaoHeDianTestTJ;
                        //取料单
                        txtguJia.Text = mod.GuJia;
                        txttongPai.Text = mod.TongPai;
                        txtciHuan.Text = mod.CiHuan;
                        txtduanZi.Text = mod.DuanZi;
                        txtxianLuBan.Text = mod.XianLuBan;
                        txtjiaoPian.Text = mod.JiaoPian;
                        txtpingBi.Text = mod.PingBi;
                        txtwenYaGuan.Text = mod.WenYaGuan;
                        txtdianZu.Text = mod.DianZu;
                        txtluoSi.Text = mod.LuoSi;
                        txtreSuoTaoGuan.Text = mod.ReSuoTaoGuan;
                        txtanZhuangPJ.Text = mod.AnZhuangPJ;
                        txtyuanQiJian1.Text = mod.YuanQiJian1;
                        txtyuanQiJian2.Text = mod.YuanQiJian2;
                        txtyuanQiJian3.Text = mod.YuanQiJian3;
                        txtyuanQiJian4.Text = mod.YuanQiJian4;

                        txtgujiaCanshu.Text = mod.GujiaCanshu;
                        txtgujiaCount.Text = mod.GujiaCount.ToString() == "0" ? "" : mod.GujiaCount.ToString();
                        txttongpaiCanshu.Text = mod.TongpaiCanshu;
                        txttongpaiCount.Text = mod.TongpaoCount.ToString() == "0" ? "" : mod.TongpaoCount.ToString();
                        txtcihuanCanshu.Text = mod.CihuanCanshu;
                        txtcihuanCount.Text = mod.CihuanCount.ToString() == "0" ? "" : mod.CihuanCount.ToString();
                        txtduanziCanshu.Text = mod.DuanziCanshu;
                        txtduanziCount.Text = mod.DuanziCount.ToString() == "0" ? "" : mod.DuanziCount.ToString();
                        txtxianlubanCanshu.Text = mod.XianlubanCanshu;
                        txtxianlubanCount.Text = mod.XianlubanCount.ToString() == "0" ? "" : mod.XianlubanCount.ToString();
                        txtjiaopianCanshu.Text = mod.JiaopianCanshu;
                        txtjiaopianCount.Text = mod.JiaopianCount.ToString() == "0" ? "" : mod.JiaopianCount.ToString();
                        txtpingbiCanshu.Text = mod.PingbiCanshu;
                        txtpingbiCount.Text = mod.PingbiCount.ToString() == "0" ? "" : mod.PingbiCount.ToString();
                        txtwenyaguanCanshu.Text = mod.WenyaguanCanshu;
                        txtwenyaguanCount.Text = mod.WenyaguanCount.ToString() == "0" ? "" : mod.WenyaguanCount.ToString();
                        txtdianzuCanshu.Text = mod.DianzuCanshu;
                        txtdianzuCount.Text = mod.DianzuCount.ToString() == "0" ? "" : mod.DianzuCount.ToString();
                        txtluosiCanshu.Text = mod.LuosiCanshu;
                        txtluosiCount.Text = mod.LuosiCount.ToString() == "0" ? "" : mod.LuosiCount.ToString();
                        txtresuotaoguanCanshu.Text = mod.ResuotaoguanCanshu;
                        txtresuotaoguanCount.Text = mod.ResuotaoguanCount.ToString() == "0" ? "" : mod.ResuotaoguanCount.ToString();
                        txtanzhuangPJCanshu.Text = mod.AnzhuangPJCanshu;
                        txtanzhuangPJCount.Text = mod.AnzhuangPJCount.ToString() == "0" ? "" : mod.AnzhuangPJCount.ToString();
                        txtyuanQiJian1Canshu.Text = mod.Yuanqijian1Canshu;
                        txtyuanQiJian1Count.Text = mod.Yuanqijian1Count1.ToString() == "0" ? "" : mod.Yuanqijian1Count1.ToString();
                        txtyuanQiJian2Canshu.Text = mod.Yuanqijian2Canshu1;
                        txtyuanQiJian2Count.Text = mod.Yuanqijian2Count1.ToString() == "0" ? "" : mod.Yuanqijian2Count1.ToString();
                        txtyuanQiJian3Canshu.Text = mod.Yuanqijian3Canshu1;
                        txtyuanQiJian3Count.Text = mod.Yuanqijian3Count1.ToString() == "0" ? "" : mod.Yuanqijian3Count1.ToString();
                        txtyuanQiJian4Canshu.Text = mod.Yuanqijian4Canshu1;
                        txtyuanQiJian4Count.Text = mod.Yuanqijian4Count1.ToString() == "0" ? "" : mod.Yuanqijian4Count1.ToString();
                    }
                    //产品编号不允许修改
                    txtproductNum.Enabled = false;
                }
                else
                {
                    imgWaiXingTZ.Visible = false;
                    imgbiaoShiPicture.Visible = false;
                }
            }
        }
Example #5
0
    /// <summary>
    /// 添加
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Save_Click(object sender, ImageClickEventArgs e)
    {
        int num = 0;
        bool isModifyPrintSGDCount = false;
        if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null)
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);
            mod = ProductsBLL.GetModel(id);
            if (mod.biaoShiNo != txtbiaoShiNo.Text.Trim())
            {
                mod.isModifyTZ = 1;
                isModifyPrintSGDCount = true;
            }
            else
            {
                mod.isModifyTZ = 0;
            }
            if (mod.waiKeNo != txtwaiKeNo.Text.Trim())
            {
                mod.IsModifyWaikeNo = 1;
                isModifyPrintSGDCount = true;
            }
            else
            {
                mod.IsModifyWaikeNo = 0;
            }
            mod.baoHeDian = txtbaoHeDian.Text.Trim();
            mod.bian = txtbianbi.Text.Trim();
            mod.biaoShiAddress = txtbiaoShiAddress.Text.Trim();
            mod.biaoShiNo = txtbiaoShiNo.Text.Trim();

            Boolean fileOK = false;
            //上传外形图纸
            if (fuwaiXingTZ.HasFile)
            {
                // 得到文件的后缀
                String fileExtension =
                    System.IO.Path.GetExtension(fuwaiXingTZ.FileName).ToLower();
                // 允许的文件后缀
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                // 看包含的文件是否是被允许的文件后缀
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        // 如果是,标志位置为真
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string url = "~/fileUpload/" + fuwaiXingTZ.FileName.Split('.')[0] + DateTime.Now.ToString("yyyyMMddhhmmss") + fileExtension;

                    if (fuwaiXingTZ.HasFile)
                    {
                        string fileType = fuwaiXingTZ.PostedFile.ContentType;

                        string name = fuwaiXingTZ.PostedFile.FileName;  //文件路径
                        FileInfo fileInfo = new FileInfo(name);
                        try
                        {
                            fuwaiXingTZ.SaveAs(Server.MapPath(url));
                            mod.waiXingTZ = url;
                            fileOK = false;

                        }
                        catch (Exception ex)
                        {
                            Response.Write("<script>alert('上传有误,请重新上传!');</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('只能上传gif,png,jpeg,jpg格式的文件!');</script>");
                    return;
                }
            }

            //上传标示图片

            if (fubiaoShiPicture.HasFile)
            {
                // 得到文件的后缀
                String fileExtension =
                    System.IO.Path.GetExtension(fubiaoShiPicture.FileName).ToLower();
                // 允许的文件后缀
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                // 看包含的文件是否是被允许的文件后缀
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        // 如果是,标志位置为真
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string url = "~/fileUpload/" + fubiaoShiPicture.FileName ;

                    if (fubiaoShiPicture.HasFile)
                    {
                        string fileType = fubiaoShiPicture.PostedFile.ContentType;

                        string name = fubiaoShiPicture.PostedFile.FileName;  //文件路径
                        FileInfo fileInfo = new FileInfo(name);
                        try
                        {
                            fubiaoShiPicture.SaveAs(Server.MapPath(url));
                            mod.biaoShiPicture = url;
                            fileOK = false;
                            mod.isModifyTZ = 1;
                            isModifyPrintSGDCount = true;
                        }
                        catch (Exception ex)
                        {
                            Response.Write("<script>alert('上传有误,请重新上传!');</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('只能上传gif,png,jpeg,jpg格式的文件!');</script>");
                    return;
                }
            }
            mod.caiLiao = txtcaiLiao.Text.Trim();
            if (txtchajianCount.Text.Trim() != "")
            {
                mod.chajianCount = Convert.ToInt32(txtchajianCount.Text.Trim());
            }
            else
            {
                mod.chajianCount = 0;
            }
            mod.chajianNo = txtchajianNo.Text.Trim();
            mod.chujRaoXianZD = txtchujRaoXianZD.Text.Trim();
            mod.chujTongMD = txtchujTongMD.Text.Trim();
            mod.chujXianJing = txtchujXianJing.Text.Trim();
            mod.chujXianTouCD = txtchujXianTouCD.Text.Trim();
            mod.chujXiantouCL = txtchujXiantouCL.Text.Trim();
            mod.chujZaShu = txtchujZaShu.Text.Trim();
            mod.chuLiMethod = txtchuLiMethod.Text.Trim();
            mod.cijRaoXianZD = txtcijRaoXianZD.Text.Trim();
            mod.cijTongMD = txtcijTongMD.Text.Trim();
            mod.cijXianJing = txtcijXianJing.Text.Trim();
            mod.cijXianTouCD = txtcijXianTouCD.Text.Trim();
            mod.cijXianTouCL = txtcijXianTouCL.Text.Trim();
            mod.cijZaShu = txtcijZaShu.Text.Trim();
            mod.cpjccsEquip = txtcpjccsEquip.Text.Trim();
            mod.cpjccsFuZai = txtcpjccsFuZai.Text.Trim();
            mod.CpjccsJiaoChaBH = txtCpjccsJiaoChaBH.Text.Trim();
            mod.cpjccsNaiYa = txtcpjccsNaiYa.Text.Trim();
            mod.cpjccsShuChuState = txtcpjccsShuChuState.Text.Trim();
            mod.cpjccsShuRuState = txtcpjccsShuRuState.Text.Trim();
            mod.cpjccsTongMD = txtcpjccsTongMD.Text.Trim();
            mod.eDingJC = txteDingJC.Text.Trim();
            mod.guanJiaoZhenLX = txtguanJiaoZhenLX.Text.Trim();
            if (txtguanJIaoZhenLXCount.Text.Trim() != "")
            {
                mod.guanJIaoZhenLXCount = Convert.ToInt32(txtguanJIaoZhenLXCount.Text.Trim());
            }
            else
            {
                mod.guanJIaoZhenLXCount = 0;
            }
            mod.guanJiaoZhenLXTOW = txtguanJiaoZhenLXTOW.Text.Trim();
            if (txtguanJiaoZhenLXTOWCount.Text.Trim() != "")
            {
                mod.guanJiaoZhenLXTOWCount = Convert.ToInt32(txtguanJiaoZhenLXTOWCount.Text.Trim());
            }
            else
            {
                mod.guanJiaoZhenLXTOWCount = 0;
            }
            mod.guiGe = txtguiGe.Text.Trim();

            mod.jingDu = txtjingDu.Text.Trim();
            mod.NeiBZ = txtNeiBZ.Text.Trim();
            mod.NeiBZDW = "psc";
            mod.peiXianSC = txtpeiXianSC.Text.Trim();
            if (txtpeiXianSCCount.Text.Trim() != "")
            {
                mod.peiXianSCCount = Convert.ToDecimal(txtpeiXianSCCount.Text.Trim());
            }
            else
            {
                mod.peiXianSCCount = 0;
            }
            mod.peiXianSR = txtpeiXianSR.Text.Trim();
            if (txtpeiXianSRCount.Text.Trim() != "")
            {
                mod.peiXianSRCount = Convert.ToDecimal(txtpeiXianSRCount.Text.Trim());
            }
            else
            {
                mod.peiXianSRCount = 0;
            }
            mod.productName = txtproductName.Text.Trim();
            mod.productNum = txtproductNum.Text.Trim();
            if (UserInfo.UserType == 2)
            {
                mod.remark = divRemark.InnerHtml;
            }
            else
            {
                mod.remark = txtremark.Value.Trim();

            }

            mod.shuChu = txtshuChu.Text.Trim();
            mod.shuChuXC = txtshuChuXC.Text.Trim();
            mod.shuRu = txtshuRu.Text.Trim();
            mod.shuRuXC = txtshuRuXC.Text.Trim();
            if (txttieXiCount.Text.Trim() != "")
            {
                mod.tieXiCount = Convert.ToInt32(txttieXiCount.Text.Trim());
            }
            else
            {
                mod.tieXiCount = 0;
            }
            if (txtwaiBZ.Text.Trim() != "")
            {
                mod.waiBZ = Convert.ToInt32(txtwaiBZ.Text.Trim());
            }
            else
            {
                mod.waiBZ = 0;
            }
            if (txtwaiKeCount.Text.Trim() != "")
            {
                mod.waiKeCount = Convert.ToInt32(txtwaiKeCount.Text.Trim());
            }
            else
            {
                mod.waiKeCount = 0;
            }
            mod.waiKeNo = txtwaiKeNo.Text.Trim();

            if (txtxianQuanCount.Text.Trim() != "")
            {
                mod.xianQuanCount = Convert.ToInt32(txtxianQuanCount.Text.Trim());
            }
            else
            {
                mod.xianQuanCount = 0;
            }
            mod.xianXingdu = txtxianXingdu.Text.Trim();
            mod.xingNeng = txtxingNeng.Text.Trim();
            mod.xqjcyqEquip = txtxqjcyqEquip.Text.Trim();
            mod.xqjcyqFuZai = txtxqjcyqFuZai.Text.Trim();
            mod.xqjcyqJiaoCha = txtxqjcyqJiaoCha.Text.Trim();
            mod.xqjcyqShuChuState = txtxqjcyqShuChuState.Text.Trim();
            mod.xqjcyqShuRuState = txtxqjcyqShuRuState.Text.Trim();
            mod.yongJiaoCS = txtyongJiaoCS.Text.Trim();
            mod.GongyiZYSX = txtGongyi.Value;

            mod.BaoZhuangHeGG = txtbaoZhuangHeGG.Text.Trim();
            mod.BaoZhuangXiangGG = txtbaoZhuangXiangGG.Text.Trim();
            mod.BaoHeDianTestTJ = txtbaoHeDianTestTJ.Text.Trim();
            mod.GuJia = txtguJia.Text.Trim();
            mod.TongPai = txttongPai.Text.Trim();
            mod.CiHuan = txtciHuan.Text.Trim();
            mod.DuanZi = txtduanZi.Text.Trim();
            mod.XianLuBan = txtxianLuBan.Text.Trim();
            mod.JiaoPian = txtjiaoPian.Text.Trim();
            mod.PingBi = txtpingBi.Text.Trim();
            mod.WenYaGuan = txtwenYaGuan.Text.Trim();
            mod.DianZu = txtdianZu.Text.Trim();
            mod.LuoSi = txtluoSi.Text.Trim();
            mod.ReSuoTaoGuan = txtreSuoTaoGuan.Text.Trim();
            mod.AnZhuangPJ = txtanZhuangPJ.Text.Trim();
            mod.YuanQiJian1 = txtyuanQiJian1.Text.Trim();
            mod.YuanQiJian2 = txtyuanQiJian2.Text.Trim();
            mod.YuanQiJian3 = txtyuanQiJian3.Text.Trim();
            mod.YuanQiJian4 = txtyuanQiJian4.Text.Trim();

            mod.GujiaCanshu = txtgujiaCanshu.Text.Trim();
            if (txtgujiaCount.Text.Trim() != "")
            {
                mod.GujiaCount = Convert.ToInt32(txtgujiaCount.Text.Trim());
            }
            else
            {
                mod.GujiaCount = 0;
            }
            mod.TongpaiCanshu = txttongpaiCanshu.Text.Trim();
            if (txttongpaiCount.Text.Trim() != "")
            {
                mod.TongpaoCount = Convert.ToInt32(txttongpaiCount.Text.Trim());
            }
            else
            {
                mod.TongpaoCount = 0;
            }
            mod.CihuanCanshu = txtcihuanCanshu.Text.Trim();
            if (txtcihuanCount.Text.Trim() != "")
            {
                mod.CihuanCount = Convert.ToInt32(txtcihuanCount.Text.Trim());
            }
            else { mod.CihuanCount = 0; }
            mod.DuanziCanshu = txtduanziCanshu.Text.Trim();
            if (txtduanziCount.Text.Trim() != "")
            { mod.DuanziCount = Convert.ToInt32(txtduanziCount.Text.Trim()); }
            else { mod.DuanziCount = 0; }
            mod.XianlubanCanshu = txtxianlubanCanshu.Text.Trim();
            if (txtxianlubanCount.Text.Trim() != "") { mod.XianlubanCount = Convert.ToInt32(txtxianlubanCount.Text.Trim()); } else { mod.XianlubanCount = 0; }
            mod.JiaopianCanshu = txtjiaopianCanshu.Text.Trim();
            if (txtjiaopianCount.Text.Trim() != "") { mod.JiaopianCount = Convert.ToInt32(txtjiaopianCount.Text.Trim()); } else { mod.JiaopianCount = 0; }
            mod.PingbiCanshu = txtpingbiCanshu.Text.Trim();
            if (txtpingbiCount.Text.Trim() != "") { mod.PingbiCount = Convert.ToInt32(txtpingbiCount.Text.Trim()); } else { mod.PingbiCount = 0; }
            mod.WenyaguanCanshu = txtwenyaguanCanshu.Text.Trim();
            if (txtwenyaguanCount.Text.Trim() != "") { mod.WenyaguanCount = Convert.ToInt32(txtwenyaguanCount.Text.Trim()); } else { mod.WenyaguanCount = 0; }
            mod.DianzuCanshu = txtdianzuCanshu.Text.Trim();
            if (txtdianzuCount.Text.Trim() != "")
            {
                mod.DianzuCount = Convert.ToInt32(txtdianzuCount.Text.Trim());
            }
            else
            {
                mod.DianzuCount = 0;
            }
            mod.LuosiCanshu = txtluosiCanshu.Text.Trim();
            if (txtluosiCount.Text.Trim() != "")
            {
                mod.LuosiCount = Convert.ToInt32(txtluosiCount.Text.Trim());
            }
            else { mod.LuosiCount = 0; }
            mod.ResuotaoguanCanshu = txtresuotaoguanCanshu.Text.Trim();
            if (txtresuotaoguanCount.Text.Trim() != "")
            {
                mod.ResuotaoguanCount = Convert.ToInt32(txtresuotaoguanCount.Text.Trim());
            }
            else { mod.ResuotaoguanCount = 0; }
            mod.AnzhuangPJCanshu = txtanzhuangPJCanshu.Text.Trim();
            if (txtanzhuangPJCount.Text.Trim() != "")
            {
                mod.AnzhuangPJCount = Convert.ToInt32(txtanzhuangPJCount.Text.Trim());
            }
            else
            {
                mod.AnzhuangPJCount = 0;
            }
            mod.Yuanqijian1Canshu = txtyuanQiJian1Canshu.Text.Trim();
            if (txtyuanQiJian1Count.Text.Trim() != "")
            {
                mod.Yuanqijian1Count1 = Convert.ToInt32(txtyuanQiJian1Count.Text.Trim());
            }
            else
            {
                mod.Yuanqijian1Count1 = 0;
            }
            mod.Yuanqijian2Canshu1 = txtyuanQiJian2Canshu.Text.Trim();
            if (txtyuanQiJian2Count.Text.Trim() != "")
            {
                mod.Yuanqijian2Count1 = Convert.ToInt32(txtyuanQiJian2Count.Text.Trim());
            }
            else
            {
                mod.Yuanqijian2Count1 = 0;
            }
            mod.Yuanqijian3Canshu1 = txtyuanQiJian3Canshu.Text.Trim();
            if (txtyuanQiJian3Count.Text.Trim() != "")
            {
                mod.Yuanqijian3Count1 = Convert.ToInt32(txtyuanQiJian3Count.Text.Trim());
            }
            else
            {
                mod.Yuanqijian3Count1 = 0;
            }
            mod.Yuanqijian4Canshu1 = txtyuanQiJian4Canshu.Text.Trim();
            if (txtyuanQiJian4Count.Text.Trim() != "")
            {
                mod.Yuanqijian4Count1 = Convert.ToInt32(txtyuanQiJian4Count.Text.Trim());
            }
            else
            {
                mod.Yuanqijian4Count1 = 0;
            }

            num = ProductsBLL.Update(mod);
            if (isModifyPrintSGDCount)
            {
                //随工单打印次数改为0
                ProOrdersDetailBLL.UpdatePrintInfo(txtproductNum.Text.Trim());
            }
        }
        else
        {
            mod = new ProductsMOD();
            mod.baoHeDian = txtbaoHeDian.Text.Trim();
            mod.bian = txtbianbi.Text.Trim();
            mod.biaoShiAddress = txtbiaoShiAddress.Text.Trim();
            mod.biaoShiNo = txtbiaoShiNo.Text.Trim();

            Boolean fileOK = false;
            //上传外形图纸
            if (fuwaiXingTZ.HasFile)
            {
                // 得到文件的后缀
                String fileExtension =
                    System.IO.Path.GetExtension(fuwaiXingTZ.FileName).ToLower();
                // 允许的文件后缀
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                // 看包含的文件是否是被允许的文件后缀
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        // 如果是,标志位置为真
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string url = "~/fileUpload/" + fuwaiXingTZ.FileName.Split('.')[0] + DateTime.Now.ToString("yyyyMMddhhmmss")+fileExtension;

                    if (fuwaiXingTZ.HasFile)
                    {
                        string fileType = fuwaiXingTZ.PostedFile.ContentType;

                        string name = fuwaiXingTZ.PostedFile.FileName;  //文件路径
                        FileInfo fileInfo = new FileInfo(name);
                        try
                        {
                            fuwaiXingTZ.SaveAs(Server.MapPath(url));
                            mod.waiXingTZ = url;
                            fileOK = false;

                        }
                        catch (Exception ex)
                        {
                            Response.Write("<script>alert('上传有误,请重新上传!');</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('只能上传gif,png,jpeg,jpg格式的文件!');</script>");
                    return;
                }

            }
            else
            {
                mod.waiXingTZ = "";
                Response.Write("<script>alert('请上传外形图纸!');</script>");
                return;
            }

            //上传标示图片

            if (fubiaoShiPicture.HasFile)
            {
                // 得到文件的后缀
                String fileExtension =
                    System.IO.Path.GetExtension(fubiaoShiPicture.FileName).ToLower();
                // 允许的文件后缀
                String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
                // 看包含的文件是否是被允许的文件后缀
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        // 如果是,标志位置为真
                        fileOK = true;
                    }
                }

                if (fileOK)
                {
                    string url = "~/fileUpload/" + fubiaoShiPicture.FileName;

                    if (fubiaoShiPicture.HasFile)
                    {
                        string fileType = fubiaoShiPicture.PostedFile.ContentType;

                        string name = fubiaoShiPicture.PostedFile.FileName;  //文件路径
                        FileInfo fileInfo = new FileInfo(name);
                        try
                        {
                            fubiaoShiPicture.SaveAs(Server.MapPath(url));
                            mod.biaoShiPicture = url;
                            fileOK = false;

                        }
                        catch (Exception ex)
                        {
                            Response.Write("<script>alert('上传有误,请重新上传!');</script>");
                        }
                    }
                }
                else
                {
                    Response.Write("<script>alert('只能上传gif,png,jpeg,jpg格式的文件!');</script>");
                    return;
                }
            }
            else
            {
                mod.biaoShiPicture = "";
            }
            mod.caiLiao = txtcaiLiao.Text.Trim();
            if (txtchajianCount.Text.Trim() != "")
            {
                mod.chajianCount = Convert.ToInt32(txtchajianCount.Text.Trim());
            }
            else
            {
                mod.chajianCount = 0;
            }
            mod.chajianNo = txtchajianNo.Text.Trim();
            mod.chujRaoXianZD = txtchujRaoXianZD.Text.Trim();
            mod.chujTongMD = txtchujTongMD.Text.Trim();
            mod.chujXianJing = txtchujXianJing.Text.Trim();
            mod.chujXianTouCD = txtchujXianTouCD.Text.Trim();
            mod.chujXiantouCL = txtchujXiantouCL.Text.Trim();
            mod.chujZaShu = txtchujZaShu.Text.Trim();
            mod.chuLiMethod = txtchuLiMethod.Text.Trim();
            mod.cijRaoXianZD = txtcijRaoXianZD.Text.Trim();
            mod.cijTongMD = txtcijTongMD.Text.Trim();
            mod.cijXianJing = txtcijXianJing.Text.Trim();
            mod.cijXianTouCD = txtcijXianTouCD.Text.Trim();
            mod.cijXianTouCL = txtcijXianTouCL.Text.Trim();
            mod.cijZaShu = txtcijZaShu.Text.Trim();
            mod.cpjccsEquip = txtcpjccsEquip.Text.Trim();
            mod.cpjccsFuZai = txtcpjccsFuZai.Text.Trim();
            mod.CpjccsJiaoChaBH = txtCpjccsJiaoChaBH.Text.Trim();
            mod.cpjccsNaiYa = txtcpjccsNaiYa.Text.Trim();
            mod.cpjccsShuChuState = txtcpjccsShuChuState.Text.Trim();
            mod.cpjccsShuRuState = txtcpjccsShuRuState.Text.Trim();
            mod.cpjccsTongMD = txtcpjccsTongMD.Text.Trim();
            mod.eDingJC = txteDingJC.Text.Trim();
            mod.guanJiaoZhenLX = txtguanJiaoZhenLX.Text.Trim();
            if (txtguanJIaoZhenLXCount.Text.Trim() != "")
            {
                mod.guanJIaoZhenLXCount = Convert.ToInt32(txtguanJIaoZhenLXCount.Text.Trim());
            }
            else
            {
                mod.guanJIaoZhenLXCount = 0;
            }
            mod.guanJiaoZhenLXTOW = txtguanJiaoZhenLXTOW.Text.Trim();
            if (txtguanJiaoZhenLXTOWCount.Text.Trim() != "")
            {
                mod.guanJiaoZhenLXTOWCount = Convert.ToInt32(txtguanJiaoZhenLXTOWCount.Text.Trim());
            }
            else
            {
                mod.guanJiaoZhenLXTOWCount = 0;
            }
            mod.guiGe = txtguiGe.Text.Trim();
            mod.isModifyTZ = 0;
            mod.IsModifyWaikeNo = 0;
            mod.jingDu = txtjingDu.Text.Trim();
            mod.NeiBZ = txtNeiBZ.Text.Trim();
            mod.NeiBZDW = "psc";
            mod.peiXianSC = txtpeiXianSC.Text.Trim();
            if (txtpeiXianSCCount.Text.Trim() != "")
            {
                mod.peiXianSCCount = Convert.ToDecimal(txtpeiXianSCCount.Text.Trim());
            }
            else
            {
                mod.peiXianSCCount = 0;
            }
            mod.peiXianSR = txtpeiXianSR.Text.Trim();
            if (txtpeiXianSRCount.Text.Trim() != "")
            {
                mod.peiXianSRCount = Convert.ToDecimal(txtpeiXianSRCount.Text.Trim());
            }
            else
            {
                mod.peiXianSRCount = 0;
            }
            mod.productName = txtproductName.Text.Trim();
            mod.productNum = txtproductNum.Text.Trim();
            mod.remark = txtremark.Value.Trim();
            mod.shuChu = txtshuChu.Text.Trim();
            mod.shuChuXC = txtshuChuXC.Text.Trim();
            mod.shuRu = txtshuRu.Text.Trim();
            mod.shuRuXC = txtshuRuXC.Text.Trim();
            if (txttieXiCount.Text.Trim() != "")
            {
                mod.tieXiCount = Convert.ToInt32(txttieXiCount.Text.Trim());
            }
            else
            {
                mod.tieXiCount = 0;
            }
            if (txtwaiBZ.Text.Trim() != "")
            {
                mod.waiBZ = Convert.ToInt32(txtwaiBZ.Text.Trim());
            }
            else
            {
                mod.waiBZ = 0;
            }
            if (txtwaiKeCount.Text.Trim() != "")
            {
                mod.waiKeCount = Convert.ToInt32(txtwaiKeCount.Text.Trim());
            }
            else
            {
                mod.waiKeCount = 0;
            }
            mod.waiKeNo = txtwaiKeNo.Text.Trim();

            if (txtxianQuanCount.Text.Trim() != "")
            {
                mod.xianQuanCount = Convert.ToInt32(txtxianQuanCount.Text.Trim());
            }
            else
            {
                mod.xianQuanCount = 0;
            }
            mod.xianXingdu = txtxianXingdu.Text.Trim();
            mod.xingNeng = txtxingNeng.Text.Trim();
            mod.xqjcyqEquip = txtxqjcyqEquip.Text.Trim();
            mod.xqjcyqFuZai = txtxqjcyqFuZai.Text.Trim();
            mod.xqjcyqJiaoCha = txtxqjcyqJiaoCha.Text.Trim();
            mod.xqjcyqShuChuState = txtxqjcyqShuChuState.Text.Trim();
            mod.xqjcyqShuRuState = txtxqjcyqShuRuState.Text.Trim();
            mod.yongJiaoCS = txtyongJiaoCS.Text.Trim();
            mod.GongyiZYSX = txtGongyi.Value;

            mod.BaoZhuangHeGG = txtbaoZhuangHeGG.Text.Trim();
            mod.BaoZhuangXiangGG = txtbaoZhuangXiangGG.Text.Trim();
            mod.BaoHeDianTestTJ = txtbaoHeDianTestTJ.Text.Trim();
            //取料单
            mod.GuJia = txtguJia.Text.Trim();
            mod.TongPai = txttongPai.Text.Trim();
            mod.CiHuan = txtciHuan.Text.Trim();
            mod.DuanZi = txtduanZi.Text.Trim();
            mod.XianLuBan = txtxianLuBan.Text.Trim();
            mod.JiaoPian = txtjiaoPian.Text.Trim();
            mod.PingBi = txtpingBi.Text.Trim();
            mod.WenYaGuan = txtwenYaGuan.Text.Trim();
            mod.DianZu = txtdianZu.Text.Trim();
            mod.LuoSi = txtluoSi.Text.Trim();
            mod.ReSuoTaoGuan = txtreSuoTaoGuan.Text.Trim();
            mod.AnZhuangPJ = txtanZhuangPJ.Text.Trim();
            mod.YuanQiJian1 = txtyuanQiJian1.Text.Trim();
            mod.YuanQiJian2 = txtyuanQiJian2.Text.Trim();
            mod.YuanQiJian3 = txtyuanQiJian3.Text.Trim();
            mod.YuanQiJian4 = txtyuanQiJian4.Text.Trim();

            mod.GujiaCanshu = txtgujiaCanshu.Text.Trim();
            if (txtgujiaCount.Text.Trim() != "")
            {
                mod.GujiaCount = Convert.ToInt32(txtgujiaCount.Text.Trim());
            }
            else
            {
                mod.GujiaCount = 0;
            }
            mod.TongpaiCanshu = txttongpaiCanshu.Text.Trim();
            if (txttongpaiCount.Text.Trim() != "")
            {
                mod.TongpaoCount = Convert.ToInt32(txttongpaiCount.Text.Trim());
            }
            else
            {
                mod.TongpaoCount = 0;
            }
            mod.CihuanCanshu = txtcihuanCanshu.Text.Trim();
            if (txtcihuanCount.Text.Trim() != "")
            {
                mod.CihuanCount = Convert.ToInt32(txtcihuanCount.Text.Trim());
            }
            else { mod.CihuanCount = 0; }
            mod.DuanziCanshu = txtduanziCanshu.Text.Trim();
            if (txtduanziCount.Text.Trim() != "")
            { mod.DuanziCount = Convert.ToInt32(txtduanziCount.Text.Trim()); }
            else { mod.DuanziCount = 0; }
            mod.XianlubanCanshu = txtxianlubanCanshu.Text.Trim();
            if (txtxianlubanCount.Text.Trim() != "") { mod.XianlubanCount = Convert.ToInt32(txtxianlubanCount.Text.Trim()); } else { mod.XianlubanCount = 0; }
            mod.JiaopianCanshu = txtjiaopianCanshu.Text.Trim();
            if (txtjiaopianCount.Text.Trim() != "") { mod.JiaopianCount = Convert.ToInt32(txtjiaopianCount.Text.Trim()); } else { mod.JiaopianCount = 0; }
            mod.PingbiCanshu = txtpingbiCanshu.Text.Trim();
            if (txtpingbiCount.Text.Trim() != "") { mod.PingbiCount = Convert.ToInt32(txtpingbiCount.Text.Trim()); } else { mod.PingbiCount = 0; }
            mod.WenyaguanCanshu = txtwenyaguanCanshu.Text.Trim();
            if (txtwenyaguanCount.Text.Trim() != "") { mod.WenyaguanCount = Convert.ToInt32(txtwenyaguanCount.Text.Trim()); } else { mod.WenyaguanCount = 0; }
            mod.DianzuCanshu = txtdianzuCanshu.Text.Trim();
            if (txtdianzuCount.Text.Trim() != "")
            {
                mod.DianzuCount = Convert.ToInt32(txtdianzuCount.Text.Trim());
            }
            else
            {
                mod.DianzuCount = 0;
            }
            mod.LuosiCanshu = txtluosiCanshu.Text.Trim();
            if (txtluosiCount.Text.Trim() != "")
            {
                mod.LuosiCount = Convert.ToInt32(txtluosiCount.Text.Trim());
            }
            else { mod.LuosiCount = 0; }
            mod.ResuotaoguanCanshu = txtresuotaoguanCanshu.Text.Trim();
            if (txtresuotaoguanCount.Text.Trim() != "")
            {
                mod.ResuotaoguanCount = Convert.ToInt32(txtresuotaoguanCount.Text.Trim());
            }
            else { mod.ResuotaoguanCount = 0; }
            mod.AnzhuangPJCanshu = txtanzhuangPJCanshu.Text.Trim();
            if (txtanzhuangPJCount.Text.Trim() != "")
            {
                mod.AnzhuangPJCount = Convert.ToInt32(txtanzhuangPJCount.Text.Trim());
            }
            else
            {
                mod.AnzhuangPJCount = 0;
            }
            mod.Yuanqijian1Canshu = txtyuanQiJian1Canshu.Text.Trim();
            if (txtyuanQiJian1Count.Text.Trim() != "")
            {
                mod.Yuanqijian1Count1 = Convert.ToInt32(txtyuanQiJian1Count.Text.Trim());
            }
            else
            {
                mod.Yuanqijian1Count1 = 0;
            }
            mod.Yuanqijian2Canshu1 = txtyuanQiJian2Canshu.Text.Trim();
            if (txtyuanQiJian2Count.Text.Trim() != "")
            {
                mod.Yuanqijian2Count1 = Convert.ToInt32(txtyuanQiJian2Count.Text.Trim());
            }
            else
            {
                mod.Yuanqijian2Count1 = 0;
            }
            mod.Yuanqijian3Canshu1 = txtyuanQiJian3Canshu.Text.Trim();
            if (txtyuanQiJian3Count.Text.Trim() != "")
            {
                mod.Yuanqijian3Count1 = Convert.ToInt32(txtyuanQiJian3Count.Text.Trim());
            }
            else
            {
                mod.Yuanqijian3Count1 = 0;
            }
            mod.Yuanqijian4Canshu1 = txtyuanQiJian4Canshu.Text.Trim();
            if (txtyuanQiJian4Count.Text.Trim() != "")
            {
                mod.Yuanqijian4Count1 = Convert.ToInt32(txtyuanQiJian4Count.Text.Trim());
            }
            else
            {
                mod.Yuanqijian4Count1 = 0;
            }
            num = ProductsBLL.Add(mod);
        }
        if (num > 0)
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交成功');DetailsPageControl.ReflushList('ProductManage/ProductManage.aspx');", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('提交失败');", true);
        }
    }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["orderNum"] != null && Request.QueryString["orderNum"].ToString() != "")
            {
                orderNum = Request.QueryString["orderNum"].ToString();
            }
            if (Request.QueryString["customNum"] != null && Request.QueryString["customNum"].ToString() != "")
            {
                customNum = Request.QueryString["customNum"].ToString();
                customerMod = new CustomerManageMod();
                customerMod = CustomerManageBLL.GetcustomerByid(customNum);
            }
            string strOrderDetail = " and orderNum='" + orderNum + "'";
            ProOrdersMOD proOrderMOD = ProOrdersBLL.GetModel(orderNum);
            DataSet ds = ProOrdersDetailBLL.GetList(strOrderDetail);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string proType = ds.Tables[0].Rows[i]["proType"].ToString();
                    string proNum = ds.Tables[0].Rows[i]["proNum"].ToString();

                    //根据产品型号和数量计算出外包装盒和内包装盒标签个数
                    int neiCount = 0;
                    int waiCount = 0;
                    productMod = ProductsBLL.GetModel(proType);
                    string nei = "";
                    string wai = "";
                    if (productMod != null)
                    {
                        nei = productMod.NeiBZ;
                        wai = productMod.waiBZ.ToString();
                        if (Convert.ToInt32(proNum) % Convert.ToInt32(nei) == 0)
                        {
                            neiCount = Convert.ToInt32(proNum) / Convert.ToInt32(nei);
                        }
                        else
                        {
                            neiCount = (Convert.ToInt32(proNum) / Convert.ToInt32(nei)) + 1;
                        }

                        if (neiCount % Convert.ToInt32(wai) == 0)
                        {
                            waiCount = neiCount / Convert.ToInt32(wai);
                        }
                        else
                        {
                            waiCount = (neiCount / Convert.ToInt32(wai)) + 1;
                        }
                    }
                    //内包装标签

                    //  htmlStr += "<table cellpadding='0' cellspacing='0' style='width: 300px; margin-top: 10px;' align='center'><tr><td colspan='2'>内包装盒标签</tr></td></table>";
                    for (int j = 0; j < neiCount; j++)
                    {
                        int num = 0;
                        if (Convert.ToInt32(proNum) % Convert.ToInt32(nei) == 0)
                        {
                            num = Convert.ToInt32(nei);
                        }
                        else
                        {
                            num = (Convert.ToInt32(proNum) % Convert.ToInt32(nei));
                        }

                        htmlStr += "<table cellpadding='0' cellspacing='0' style='width: 300px; margin-top: 10px; border: 1px solid #808080' align='center'>";
                        htmlStr += "<tr><td colspan='2' align='center'>内包装盒标签</td></tr>";
                        htmlStr += "<tr><td>客户名称:<br />Customer name</td><td>" + customerMod.CompanyName + "</td></tr>";
                        htmlStr += " <tr><td>型号:<br />Model number </td><td>" + proType + "</td></tr>";
                        htmlStr += "<tr><td>规格参数:<br />Parameters </td><td>" + productMod.bian + "</td></tr>";
                        htmlStr += " <tr><td>数    量:<br /> Quantity</td><td>" + num + "</td></tr>";
                        htmlStr += "<tr><td>封 装 日 期:<br />Packaging date</td><td>" + DateTime.Now.ToShortDateString() + "</td></tr>";
                        htmlStr += "</table>";
                    }
                    htmlStr += "<table cellpadding='0' cellspacing='0' style='width: 300px; margin-top: 10px;' align='center'><tr><td colspan='2'>外包装盒标签</tr></td></table>";
                    //外包装标签
                    for (int k = 0; k < waiCount; k++)
                    {
                        int num = 0;
                        if (neiCount % Convert.ToInt32(wai) == 0)
                        {
                            num = Convert.ToInt32(wai) * Convert.ToInt32(nei);  //如果是整除 产品数量为内包装个数*每个内包装里的产品数

                        }
                        else
                        {
                            num = (neiCount % Convert.ToInt32(wai)) * Convert.ToInt32(nei);  //如果不整除 产品数量为外包装盒和内包装盒取余*每个内包装盒里的产品数
                        }
                        htmlStr += "<table cellpadding='0' cellspacing='0' style='width: 300px; margin-top: 10px; border: 1px solid #808080' align='center'>";
                        htmlStr += "<tr><td colspan='2' align='center'>外包装盒标签</td></tr>";
                        htmlStr += "<tr><td>客户名称:<br />Customer name</td><td>" + customerMod.CompanyName + "</td></tr>";
                        htmlStr += " <tr><td>型号:<br />Model number </td><td>" + proType + "</td></tr>";
                        htmlStr += "<tr><td>规格参数:<br />Parameters </td><td>" + productMod.bian + "</td></tr>";
                        htmlStr += " <tr><td>数    量:<br /> Quantity</td><td>" + num + "</td></tr>";
                        htmlStr += "<tr><td>合同编号:<br /> Contract No.</td><td>" + proOrderMOD.heTongNum + "</td></tr>";
                        htmlStr += "<tr> <td>物料编号:<br />Material Code</td><td>" + proOrderMOD.customWLBH + "</td></tr>";
                        htmlStr += "<tr><td>客户单号:<br />Purchase order No.</td><td>" + proOrderMOD.customOrderNum + "</td></tr>";
                        htmlStr += "<tr><td>供应商名称:<br />Vendor Company</td><td>北京霍远科技</td></tr>";
                        htmlStr += "<tr><td>件      数:<br />Number of packages</td><td>" + waiCount + "</td></tr>";
                        htmlStr += "</table>";
                    }
                }
            }
        }
    }