/// <summary> /// 根据主键id查询信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public static SendDetailMOD GetmodByid(string ProType) { SendDetailMOD mod = new SendDetailMOD(); string sqlcommandString = "select * from SendDetail where ProType='" + ProType + "'"; try { SqlDataReader reader = SqlHelper.ExecuteReader(sqlcommandString); if (reader.Read()) { mod.OrderNum = reader["OrderNum"].ToString(); mod.ProType = reader["ProType"].ToString(); mod.SendId = Convert.ToInt32(reader["SendId"].ToString()); mod.SendProNum = Convert.ToInt32(reader["SendProNum"].ToString()); mod.SendTime = Convert.ToDateTime(reader["SendTime"].ToString()); mod.UnitPrice = Convert.ToDecimal(reader["UnitPrice"].ToString()); mod.Remark = reader["Remark"].ToString(); mod.SendNum = reader["SendNum"].ToString(); mod.PackingCompanyName = reader["PackingCompanyName"].ToString(); mod.SuiGongDanNum = reader["SuiGongDanNum"].ToString(); mod.PrintCompanyName = reader["PrintCompanyName"].ToString(); } reader.Close(); return mod; } catch (Exception e) { throw e; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["id"] != "" && Request.QueryString["id"] != null) { string orderNum = Request.QueryString["id"]; mod = SendDetailBLL.GetModByOrderNum(orderNum); if (mod != null) { lblOrderNum.Text = mod.OrderNum; txtpackingCompanyName.Text = mod.PackingCompanyName; txtsendNum.Text = mod.SendNum; } } } }
/// <summary> /// 打印 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPrint_Click(object sender, ImageClickEventArgs e) { bool result = true; for (int i = 0; i < rptPro.Items.Count; i++) { TextBox txtProNum = this.rptPro.Items[i].FindControl("txtProNum") as TextBox; if (txtProNum.Text == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('请填写数量!');", true); return; } } //打印前先将信息保存 for (int i = 0; i < rptPro.Items.Count; i++) { Label lblProType = this.rptPro.Items[i].FindControl("lblProType") as Label; Label lblPrice = this.rptPro.Items[i].FindControl("lblPrice") as Label; TextBox txtProNum = this.rptPro.Items[i].FindControl("txtProNum") as TextBox; TextBox txtRemark = this.rptPro.Items[i].FindControl("txtRemark") as TextBox; SendDetailMOD mod = new SendDetailMOD(); mod.OrderNum = Request.QueryString["orderNum"].ToString(); mod.ProType = lblProType.Text; mod.Remark = txtRemark.Text; mod.SendProNum = Convert.ToInt32(txtProNum.Text.Trim()); mod.SendTime = DateTime.Now; mod.UnitPrice = Convert.ToDecimal(lblPrice.Text.Trim()); int num = SendDetailBLL.Insertmod(mod); if (num < 0) { result = false; SendDetailBLL.Delete(Request.QueryString["orderNum"].ToString()); break; } } if (result) { ProOrdersDetailBLL.UpdatePrintInfo(orderNum, proType, "printSHDTime", "printSHDCount"); ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "doPrint();", true); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('您输入的信息有误!');", true); } }
/// <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) { string orderNum = Request.QueryString["id"]; mod = SendDetailBLL.GetModByOrderNum(orderNum); mod.SendNum = txtsendNum.Text.Trim(); mod.PackingCompanyName=txtpackingCompanyName.Text.Trim(); num = SendDetailBLL.UpdateSendInfoByOrderNum(mod.OrderNum,mod.SendNum,mod.PackingCompanyName); } if (num > 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "DetailsPageControl.CloseBox();alert('提交成功');DetailsPageControl.ReflushList('orderManage/SendListOrAddSend.aspx');", true); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "ListArea", "alert('提交失败');", true); } }
/// <summary> /// 打印 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPrint_Click(object sender, ImageClickEventArgs e) { bool result = true; if (rptPro.Items.Count > 0) { //打印前先将信息保存 // DataSet ds = ProOrdersDetailBLL.GetAllOrderDetail(" and orderNum='"+orderNum+"'"); Session["songhuodan"] = "1"; List<PrevProductMOD> list = (List<PrevProductMOD>)Session["SendList"]; if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { //Label lblProType = this.Repeater1.Items[i].FindControl("lblProType") as Label; //Label lblPrice = this.Repeater1.Items[i].FindControl("lblPrice") as Label; //Label txtProNum = this.Repeater1.Items[i].FindControl("txtProNum") as Label; //// Label hiddProNum = (Label)Repeater1.Items[i].FindControl("hiddProNum"); //Label txtRemark = this.Repeater1.Items[i].FindControl("txtRemark") as Label; SendDetailMOD mod = new SendDetailMOD(); mod.OrderNum = Request.QueryString["orderNum"].ToString(); mod.ProType = list[i].ProType; mod.Remark = list[i].Beizhu; if (list[i].ProNum != "") { mod.SendProNum = Convert.ToInt32(list[i].ProNum); } else { mod.SendProNum = 0; } mod.SendTime = Convert.ToDateTime(lblPrintTime.Value); mod.UnitPrice = Convert.ToDecimal(list[i].Danjia); mod.SuiGongDanNum = Request.QueryString["withWorkNo"].ToString(); int num = SendDetailBLL.Insertmod(mod); if (num < 0) { result = false; SendDetailBLL.Delete(Request.QueryString["orderNum"].ToString()); break; } } if (result) { for (int i = 0; i < Repeater1.Items.Count; i++) { Label lblProType = this.Repeater1.Items[i].FindControl("lblProType") as Label; ProOrdersDetailBLL.UpdatePrintInfo(orderNum, lblProType.Text, "printSHDTime", "printSHDCount"); } ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "doPrint();", true); } else { //ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('打印失败!');", true); } } } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "BGYPSQLB", "alert('您没有要发货的型号!');", true); return; } }
/// <summary> /// 更新 /// </summary> /// <param name="dtomodList">数据对象</param> /// <returns></returns> public static int Updatemod(SendDetailMOD mod) { string sqlCommandString = "Update SendDetail Set SendProNum=@SendProNum Where OrderNum=@OrderNum"; SqlParameter[] arParams = new SqlParameter[2]; arParams[0] = new SqlParameter("@OrderNum", mod.OrderNum); arParams[1] = new SqlParameter("@SendProNum", mod.SendProNum); return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlCommandString, arParams); }
/// <summary> /// 添加 /// </summary> /// <param name="dtomodList">对象</param> /// <returns></returns> public static int Insertmod(SendDetailMOD mod) { string sqlCommandString = "Insert Into SendDetail(OrderNum,ProType,SendProNum,UnitPrice,SendTime,Remark,SuiGongDanNum,PrintCompanyName)Values(@OrderNum,@ProType,@SendProNum,@UnitPrice,@SendTime,@Remark,@SuiGongDanNum,@PrintCompanyName)"; SqlParameter[] arParams = new SqlParameter[8]; arParams[0] = new SqlParameter("@OrderNum", mod.OrderNum); arParams[1] = new SqlParameter("@ProType", mod.ProType); arParams[2] = new SqlParameter("@SendProNum", mod.SendProNum); arParams[3] = new SqlParameter("@UnitPrice", mod.UnitPrice); arParams[4] = new SqlParameter("@SendTime", mod.SendTime); arParams[5] = new SqlParameter("@Remark", mod.Remark); arParams[6] = new SqlParameter("@SuiGongDanNum", mod.SuiGongDanNum); arParams[7] = new SqlParameter("@PrintCompanyName", mod.PrintCompanyName); return SqlHelper.ExecuteNonQuery(CommandType.Text, sqlCommandString, arParams); }
/// <summary> /// 更新 /// </summary> /// <param name="dtomodList">数据对象</param> /// <returns></returns> public static int Updatemod(SendDetailMOD mod) { return SendDetailDAO.Updatemod(mod); }
/// <summary> /// 添加 /// </summary> /// <param name="dtomodList">对象</param> /// <returns></returns> public static int Insertmod(SendDetailMOD mod) { return SendDetailDAO.Insertmod(mod); }