/// <summary> /// 添加送样 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_TJSY_Click(object sender, EventArgs e) { try { int[] rownumber = gv_SJXX.GetSelectedRows();//获取选中行号数组; if (rownumber.Length > 0) { for (int i = 0; i < rownumber.Length; i++) { int selectedHandle = rownumber[i]; string strID = gv_SJXX.GetRowCellValue(selectedHandle, "C_ID").ToString(); Mod_TRC_ROLL_SPOT_CHECK modProduct = bll_spot_check.GetModel(strID); modProduct.N_ENTRUST_TYPE = 0; modProduct.C_EMP_ID = RV.UI.UserInfo.userID; bll_spot_check.Update(modProduct); } Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "生成抽查送样信息");//添加操作日志 MessageBox.Show("添加成功!"); btn_Query_Main_Click(null, null); btn_Query_Sam_Click(null, null); } else { MessageBox.Show("请选择送样的实绩!"); return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TRC_ROLL_SPOT_CHECK model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TRC_ROLL_SPOT_CHECK("); strSql.Append(" C_STOVE,C_BATCH_NO,C_TICK_NO,C_STD_CODE,C_STL_GRD,C_SPEC,N_STATUS,C_REMARK,C_EMP_ID,D_MOD_DT,N_ENTRUST_TYPE,C_EMP_ID_ZY,D_MOD_DT_ZY,C_EMP_ID_JS,D_MOD_DT_JS)"); strSql.Append(" values ("); strSql.Append(" :C_STOVE,:C_BATCH_NO,:C_TICK_NO,:C_STD_CODE,:C_STL_GRD,:C_SPEC,:N_STATUS,:C_REMARK,:C_EMP_ID,:D_MOD_DT,:N_ENTRUST_TYPE,:C_EMP_ID_ZY,:D_MOD_DT_ZY,:C_EMP_ID_JS,:D_MOD_DT_JS)"); OracleParameter[] parameters = { new OracleParameter(":C_STOVE", OracleDbType.Varchar2, 100), new OracleParameter(":C_BATCH_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_TICK_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_STD_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_STL_GRD", OracleDbType.Varchar2, 100), new OracleParameter(":C_SPEC", OracleDbType.Varchar2, 100), new OracleParameter(":N_STATUS", OracleDbType.Decimal, 1), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":N_ENTRUST_TYPE", OracleDbType.Decimal, 1), new OracleParameter(":C_EMP_ID_ZY", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT_ZY", OracleDbType.Date), new OracleParameter(":C_EMP_ID_JS", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT_JS", OracleDbType.Date) }; parameters[0].Value = model.C_STOVE; parameters[1].Value = model.C_BATCH_NO; parameters[2].Value = model.C_TICK_NO; parameters[3].Value = model.C_STD_CODE; parameters[4].Value = model.C_STL_GRD; parameters[5].Value = model.C_SPEC; parameters[6].Value = model.N_STATUS; parameters[7].Value = model.C_REMARK; parameters[8].Value = model.C_EMP_ID; parameters[9].Value = model.D_MOD_DT; parameters[10].Value = model.N_ENTRUST_TYPE; parameters[11].Value = model.C_EMP_ID_ZY; parameters[12].Value = model.D_MOD_DT_ZY; parameters[13].Value = model.C_EMP_ID_JS; parameters[14].Value = model.D_MOD_DT_JS; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 线材抽查信息添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Save_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_Std.Text.Trim())) { MessageBox.Show("执行标准不能为空!"); return; } if (string.IsNullOrEmpty(txt_Grd.Text.Trim())) { MessageBox.Show("钢种不能为空!"); return; } try { Mod_TRC_ROLL_SPOT_CHECK mod = new Mod_TRC_ROLL_SPOT_CHECK(); mod.C_STOVE = txt_LH.Text.Trim(); mod.C_BATCH_NO = txt_PH.Text.Trim(); mod.C_TICK_NO = txt_GH.Text.Trim(); mod.C_STD_CODE = txt_Std.Text.Trim(); mod.C_STL_GRD = txt_Grd.Text.Trim(); mod.C_SPEC = txt_Spec.Text.Trim(); mod.C_EMP_ID = RV.UI.UserInfo.UserID; #region 检测是否重复添加 System.Collections.Hashtable ht = new System.Collections.Hashtable(); ht.Add("C_STOVE", mod.C_STOVE); ht.Add("C_BATCH_NO", mod.C_BATCH_NO); ht.Add("C_TICK_NO", mod.C_TICK_NO); ht.Add("C_STD_CODE", mod.C_STD_CODE); ht.Add("C_STL_GRD", mod.C_STL_GRD); ht.Add("C_SPEC", mod.C_SPEC); ht.Add("N_STATUS", "1"); if (Common.CheckRepeat.CheckTable("TRC_ROLL_SPOT_CHECK", ht) > 0) { MessageBox.Show("已存在,不能重复添加!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } #endregion if (bll_spot_check.Add(mod)) { Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "添加抽查送样信息");//添加操作日志 btn_Rest_Click(null, null); btn_Query_Main_Click(null, null); MessageBox.Show("添加成功!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TRC_ROLL_SPOT_CHECK GetModel(string C_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_STOVE,C_BATCH_NO,C_TICK_NO,C_STD_CODE,C_STL_GRD,C_SPEC,N_STATUS,C_REMARK,C_EMP_ID,D_MOD_DT,N_ENTRUST_TYPE,C_EMP_ID_ZY,D_MOD_DT_ZY,C_EMP_ID_JS,D_MOD_DT_JS from TRC_ROLL_SPOT_CHECK "); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_ID; Mod_TRC_ROLL_SPOT_CHECK model = new Mod_TRC_ROLL_SPOT_CHECK(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TRC_ROLL_SPOT_CHECK model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TRC_ROLL_SPOT_CHECK set "); strSql.Append("C_STOVE=:C_STOVE,"); strSql.Append("C_BATCH_NO=:C_BATCH_NO,"); strSql.Append("C_TICK_NO=:C_TICK_NO,"); strSql.Append("C_STD_CODE=:C_STD_CODE,"); strSql.Append("C_STL_GRD=:C_STL_GRD,"); strSql.Append("C_SPEC=:C_SPEC,"); strSql.Append("N_STATUS=:N_STATUS,"); strSql.Append("C_REMARK=:C_REMARK,"); strSql.Append("C_EMP_ID=:C_EMP_ID,"); strSql.Append("D_MOD_DT=:D_MOD_DT,"); strSql.Append("N_ENTRUST_TYPE=:N_ENTRUST_TYPE,"); strSql.Append("C_EMP_ID_ZY=:C_EMP_ID_ZY,"); strSql.Append("D_MOD_DT_ZY=:D_MOD_DT_ZY,"); strSql.Append("C_EMP_ID_JS=:C_EMP_ID_JS,"); strSql.Append("D_MOD_DT_JS=:D_MOD_DT_JS"); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_STOVE", OracleDbType.Varchar2, 100), new OracleParameter(":C_BATCH_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_TICK_NO", OracleDbType.Varchar2, 100), new OracleParameter(":C_STD_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_STL_GRD", OracleDbType.Varchar2, 100), new OracleParameter(":C_SPEC", OracleDbType.Varchar2, 100), new OracleParameter(":N_STATUS", OracleDbType.Decimal, 1), new OracleParameter(":C_REMARK", OracleDbType.Varchar2, 500), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":N_ENTRUST_TYPE", OracleDbType.Decimal, 1), new OracleParameter(":C_EMP_ID_ZY", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT_ZY", OracleDbType.Date), new OracleParameter(":C_EMP_ID_JS", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT_JS", OracleDbType.Date), new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_STOVE; parameters[1].Value = model.C_BATCH_NO; parameters[2].Value = model.C_TICK_NO; parameters[3].Value = model.C_STD_CODE; parameters[4].Value = model.C_STL_GRD; parameters[5].Value = model.C_SPEC; parameters[6].Value = model.N_STATUS; parameters[7].Value = model.C_REMARK; parameters[8].Value = model.C_EMP_ID; parameters[9].Value = model.D_MOD_DT; parameters[10].Value = model.N_ENTRUST_TYPE; parameters[11].Value = model.C_EMP_ID_ZY; parameters[12].Value = model.D_MOD_DT_ZY; parameters[13].Value = model.C_EMP_ID_JS; parameters[14].Value = model.D_MOD_DT_JS; parameters[15].Value = model.C_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TRC_ROLL_SPOT_CHECK DataRowToModel(DataRow row) { Mod_TRC_ROLL_SPOT_CHECK model = new Mod_TRC_ROLL_SPOT_CHECK(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_STOVE"] != null) { model.C_STOVE = row["C_STOVE"].ToString(); } if (row["C_BATCH_NO"] != null) { model.C_BATCH_NO = row["C_BATCH_NO"].ToString(); } if (row["C_TICK_NO"] != null) { model.C_TICK_NO = row["C_TICK_NO"].ToString(); } if (row["C_STD_CODE"] != null) { model.C_STD_CODE = row["C_STD_CODE"].ToString(); } if (row["C_STL_GRD"] != null) { model.C_STL_GRD = row["C_STL_GRD"].ToString(); } if (row["C_SPEC"] != null) { model.C_SPEC = row["C_SPEC"].ToString(); } if (row["N_STATUS"] != null && row["N_STATUS"].ToString() != "") { model.N_STATUS = decimal.Parse(row["N_STATUS"].ToString()); } if (row["C_REMARK"] != null) { model.C_REMARK = row["C_REMARK"].ToString(); } if (row["C_EMP_ID"] != null) { model.C_EMP_ID = row["C_EMP_ID"].ToString(); } if (row["D_MOD_DT"] != null && row["D_MOD_DT"].ToString() != "") { model.D_MOD_DT = DateTime.Parse(row["D_MOD_DT"].ToString()); } if (row["N_ENTRUST_TYPE"] != null && row["N_ENTRUST_TYPE"].ToString() != "") { model.N_ENTRUST_TYPE = decimal.Parse(row["N_ENTRUST_TYPE"].ToString()); } if (row["C_EMP_ID_ZY"] != null) { model.C_EMP_ID_ZY = row["C_EMP_ID_ZY"].ToString(); } if (row["D_MOD_DT_ZY"] != null && row["D_MOD_DT_ZY"].ToString() != "") { model.D_MOD_DT_ZY = DateTime.Parse(row["D_MOD_DT_ZY"].ToString()); } if (row["C_EMP_ID_JS"] != null) { model.C_EMP_ID_JS = row["C_EMP_ID_JS"].ToString(); } if (row["D_MOD_DT_JS"] != null && row["D_MOD_DT_JS"].ToString() != "") { model.D_MOD_DT_JS = DateTime.Parse(row["D_MOD_DT_JS"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TRC_ROLL_SPOT_CHECK model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TRC_ROLL_SPOT_CHECK model) { return(dal.Add(model)); }