/// <summary> /// 库检确认 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_OK_Click(object sender, EventArgs e) { try { DataRow dr = this.gv_PDJG.GetDataRow(this.gv_PDJG.FocusedRowHandle); if (dr == null) { MessageBox.Show("请选择要确认的库检信息!", "提示"); return; } if (dr["C_CHECK_EMP_ID"].ToString() != "") { MessageBox.Show("请勿重复确认!", "提示"); return; } if (imgcbo_HGZT.Text.Trim() == "") { MessageBox.Show("请选择是否合格!", "提示"); return; } DialogResult dialogResult = MessageBox.Show("是否确认\n批号:'" + dr["C_BATCH_NO"].ToString() + "'", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (dialogResult == DialogResult.OK)//如果点击“确定”按钮 { Mod_TQC_ROOL_CHECK_AFFIRM mod = new Mod_TQC_ROOL_CHECK_AFFIRM(); mod.C_WE_CHECK_ROOL_ID = dr["C_ID"].ToString(); mod.C_SUGGESTION = txt_SHYJ.Text; mod.C_CHECK_EMP_ID = RV.UI.UserInfo.UserID; mod.D_CHECK_DT = RV.UI.ServerTime.timeNow(); if (bll_affirm.Add(mod)) { Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "确认线材库检信息");//添加操作日志 ClearContent.ClearFlowLayoutPanel(panelControl1.Controls); Mod_TQC_WAREHOUSE_CHECK_ROLL mod_roll = bll_roll.GetModel(dr["C_ID"].ToString()); mod_roll.C_CHECK_EMP_ID = RV.UI.UserInfo.UserID; mod_roll.D_CHECK_DT = RV.UI.ServerTime.timeNow(); if (bll_roll.Update(mod_roll)) { Mod_TRC_ROLL_PRODCUT mod_Product = bllProduct.GetModel(mod_roll.C_ROLL_ID); mod_Product.C_DEPOT_TYPE = imgcbo_HGZT.Text.Trim(); bllProduct.Update(mod_Product); btn_Query1_Click(null, null); } MessageBox.Show("已确认!", "提示"); } } else//如果点击“取消”按钮 { return; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TQC_WAREHOUSE_CHECK_ROLL GetModel(string C_ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_ROLL_ID,C_STOVE,C_BATCH_NO,C_TICK_NO,C_STL_GRD,N_WGT,C_STD_CODE,C_SPEC,C_MAT_CODE,C_MAT_NAME,D_WAREHOUSE_IN,C_SHIFT,C_GROUP,C_REASON_NAME,C_REASON_CODE,C_REASON_DEPMT_ID,C_REASON_DEPMT_DESC,C_SUGGESTION,N_STATUS,C_REMARK,C_EMP_ID,D_MOD_DT,C_CHECK_EMP_ID,D_CHECK_DT from TQC_WAREHOUSE_CHECK_ROLL "); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_ID; Mod_TQC_WAREHOUSE_CHECK_ROLL model = new Mod_TQC_WAREHOUSE_CHECK_ROLL(); 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 Add(Mod_TQC_WAREHOUSE_CHECK_ROLL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TQC_WAREHOUSE_CHECK_ROLL("); strSql.Append("C_ROLL_ID,C_STOVE,C_BATCH_NO,C_TICK_NO,C_STL_GRD,N_WGT,C_STD_CODE,C_SPEC,C_MAT_CODE,C_MAT_NAME,D_WAREHOUSE_IN,C_SHIFT,C_GROUP,C_REASON_NAME,C_REASON_CODE,C_REASON_DEPMT_ID,C_REASON_DEPMT_DESC,C_SUGGESTION,N_STATUS,C_REMARK,C_EMP_ID,C_CHECK_EMP_ID,D_CHECK_DT)"); strSql.Append(" values ("); strSql.Append(":C_ROLL_ID,:C_STOVE,:C_BATCH_NO,:C_TICK_NO,:C_STL_GRD,:N_WGT,:C_STD_CODE,:C_SPEC,:C_MAT_CODE,:C_MAT_NAME,:D_WAREHOUSE_IN,:C_SHIFT,:C_GROUP,:C_REASON_NAME,:C_REASON_CODE,:C_REASON_DEPMT_ID,:C_REASON_DEPMT_DESC,:C_SUGGESTION,:N_STATUS,:C_REMARK,:C_EMP_ID,:C_CHECK_EMP_ID,:D_CHECK_DT)"); OracleParameter[] parameters = { new OracleParameter(":C_ROLL_ID", OracleDbType.Varchar2, 100), 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_STL_GRD", OracleDbType.Varchar2, 100), new OracleParameter(":N_WGT", OracleDbType.Double, 15), new OracleParameter(":C_STD_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SPEC", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":D_WAREHOUSE_IN", OracleDbType.Date), new OracleParameter(":C_SHIFT", OracleDbType.Varchar2, 100), new OracleParameter(":C_GROUP", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_DEPMT_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_DEPMT_DESC", OracleDbType.Varchar2, 100), new OracleParameter(":C_SUGGESTION", 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(":C_CHECK_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_CHECK_DT", OracleDbType.Date) }; parameters[0].Value = model.C_ROLL_ID; parameters[1].Value = model.C_STOVE; parameters[2].Value = model.C_BATCH_NO; parameters[3].Value = model.C_TICK_NO; parameters[4].Value = model.C_STL_GRD; parameters[5].Value = model.N_WGT; parameters[6].Value = model.C_STD_CODE; parameters[7].Value = model.C_SPEC; parameters[8].Value = model.C_MAT_CODE; parameters[9].Value = model.C_MAT_NAME; parameters[10].Value = model.D_WAREHOUSE_IN; parameters[11].Value = model.C_SHIFT; parameters[12].Value = model.C_GROUP; parameters[13].Value = model.C_REASON_NAME; parameters[14].Value = model.C_REASON_CODE; parameters[15].Value = model.C_REASON_DEPMT_ID; parameters[16].Value = model.C_REASON_DEPMT_DESC; parameters[17].Value = model.C_SUGGESTION; parameters[18].Value = model.N_STATUS; parameters[19].Value = model.C_REMARK; parameters[20].Value = model.C_EMP_ID; parameters[21].Value = model.C_CHECK_EMP_ID; parameters[22].Value = model.D_CHECK_DT; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TQC_WAREHOUSE_CHECK_ROLL DataRowToModel(DataRow row) { Mod_TQC_WAREHOUSE_CHECK_ROLL model = new Mod_TQC_WAREHOUSE_CHECK_ROLL(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_ROLL_ID"] != null) { model.C_ROLL_ID = row["C_ROLL_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_STL_GRD"] != null) { model.C_STL_GRD = row["C_STL_GRD"].ToString(); } if (row["N_WGT"] != null && row["N_WGT"].ToString() != "") { model.N_WGT = decimal.Parse(row["N_WGT"].ToString()); } if (row["C_STD_CODE"] != null) { model.C_STD_CODE = row["C_STD_CODE"].ToString(); } if (row["C_SPEC"] != null) { model.C_SPEC = row["C_SPEC"].ToString(); } if (row["C_MAT_CODE"] != null) { model.C_MAT_CODE = row["C_MAT_CODE"].ToString(); } if (row["C_MAT_NAME"] != null) { model.C_MAT_NAME = row["C_MAT_NAME"].ToString(); } if (row["D_WAREHOUSE_IN"] != null && row["D_WAREHOUSE_IN"].ToString() != "") { model.D_WAREHOUSE_IN = DateTime.Parse(row["D_WAREHOUSE_IN"].ToString()); } if (row["C_SHIFT"] != null) { model.C_SHIFT = row["C_SHIFT"].ToString(); } if (row["C_GROUP"] != null) { model.C_GROUP = row["C_GROUP"].ToString(); } if (row["C_REASON_NAME"] != null) { model.C_REASON_NAME = row["C_REASON_NAME"].ToString(); } if (row["C_REASON_CODE"] != null) { model.C_REASON_CODE = row["C_REASON_CODE"].ToString(); } if (row["C_REASON_DEPMT_ID"] != null) { model.C_REASON_DEPMT_ID = row["C_REASON_DEPMT_ID"].ToString(); } if (row["C_REASON_DEPMT_DESC"] != null) { model.C_REASON_DEPMT_DESC = row["C_REASON_DEPMT_DESC"].ToString(); } if (row["C_SUGGESTION"] != null) { model.C_SUGGESTION = row["C_SUGGESTION"].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["C_CHECK_EMP_ID"] != null) { model.C_CHECK_EMP_ID = row["C_CHECK_EMP_ID"].ToString(); } if (row["D_CHECK_DT"] != null && row["D_CHECK_DT"].ToString() != "") { model.D_CHECK_DT = DateTime.Parse(row["D_CHECK_DT"].ToString()); } } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TQC_WAREHOUSE_CHECK_ROLL model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TQC_WAREHOUSE_CHECK_ROLL set "); strSql.Append("C_ROLL_ID=:C_ROLL_ID,"); 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_STL_GRD=:C_STL_GRD,"); strSql.Append("N_WGT=:N_WGT,"); strSql.Append("C_STD_CODE=:C_STD_CODE,"); strSql.Append("C_SPEC=:C_SPEC,"); strSql.Append("C_MAT_CODE=:C_MAT_CODE,"); strSql.Append("C_MAT_NAME=:C_MAT_NAME,"); strSql.Append("D_WAREHOUSE_IN=:D_WAREHOUSE_IN,"); strSql.Append("C_SHIFT=:C_SHIFT,"); strSql.Append("C_GROUP=:C_GROUP,"); strSql.Append("C_REASON_NAME=:C_REASON_NAME,"); strSql.Append("C_REASON_CODE=:C_REASON_CODE,"); strSql.Append("C_REASON_DEPMT_ID=:C_REASON_DEPMT_ID,"); strSql.Append("C_REASON_DEPMT_DESC=:C_REASON_DEPMT_DESC,"); strSql.Append("C_SUGGESTION=:C_SUGGESTION,"); 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("C_CHECK_EMP_ID=:C_CHECK_EMP_ID,"); strSql.Append("D_CHECK_DT=:D_CHECK_DT"); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_ROLL_ID", OracleDbType.Varchar2, 100), 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_STL_GRD", OracleDbType.Varchar2, 100), new OracleParameter(":N_WGT", OracleDbType.Double, 15), new OracleParameter(":C_STD_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_SPEC", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_MAT_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":D_WAREHOUSE_IN", OracleDbType.Date), new OracleParameter(":C_SHIFT", OracleDbType.Varchar2, 100), new OracleParameter(":C_GROUP", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_NAME", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_CODE", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_DEPMT_ID", OracleDbType.Varchar2, 100), new OracleParameter(":C_REASON_DEPMT_DESC", OracleDbType.Varchar2, 100), new OracleParameter(":C_SUGGESTION", 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(":C_CHECK_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_CHECK_DT", OracleDbType.Date), new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_ROLL_ID; parameters[1].Value = model.C_STOVE; parameters[2].Value = model.C_BATCH_NO; parameters[3].Value = model.C_TICK_NO; parameters[4].Value = model.C_STL_GRD; parameters[5].Value = model.N_WGT; parameters[6].Value = model.C_STD_CODE; parameters[7].Value = model.C_SPEC; parameters[8].Value = model.C_MAT_CODE; parameters[9].Value = model.C_MAT_NAME; parameters[10].Value = model.D_WAREHOUSE_IN; parameters[11].Value = model.C_SHIFT; parameters[12].Value = model.C_GROUP; parameters[13].Value = model.C_REASON_NAME; parameters[14].Value = model.C_REASON_CODE; parameters[15].Value = model.C_REASON_DEPMT_ID; parameters[16].Value = model.C_REASON_DEPMT_DESC; parameters[17].Value = model.C_SUGGESTION; parameters[18].Value = model.N_STATUS; parameters[19].Value = model.C_REMARK; parameters[20].Value = model.C_EMP_ID; parameters[21].Value = model.D_MOD_DT; parameters[22].Value = model.C_CHECK_EMP_ID; parameters[23].Value = model.D_CHECK_DT; parameters[24].Value = model.C_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TQC_WAREHOUSE_CHECK_ROLL model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TQC_WAREHOUSE_CHECK_ROLL model) { return(dal.Add(model)); }
/// <summary> /// 库检申请 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_KJSQ_Click(object sender, EventArgs e) { try { int[] rownumber = gv_SJXX.GetSelectedRows();//获取选中行号数组; if (rownumber.Length == 0) { MessageBox.Show("请选择需要保存的信息!"); return; } DataRow row = gv_SJXX.GetDataRow(rownumber[0]); if (imgcbo_YYMC.EditValue == null) { MessageBox.Show("库检原因不能为空!", "提示"); return; } if (imgcbo_ZRBM.EditValue == null) { MessageBox.Show("责任单位不能为空!", "提示"); return; } if (imgcbo_CZYJ.EditValue == null) { MessageBox.Show("处置意见不能为空!", "提示"); return; } if (DialogResult.OK != MessageBox.Show("是否确认保存已选中的数据?", "提示", MessageBoxButtons.OKCancel)) { return; } for (int i = 0; i < rownumber.Length; i++) { DataRow dr = gv_SJXX.GetDataRow(rownumber[i]); if (dr["C_BATCH_NO"].ToString() != row["C_BATCH_NO"].ToString()) { MessageBox.Show("请选择相同的批号!"); return; } Mod_TQC_WAREHOUSE_CHECK_ROLL mod = new Mod_TQC_WAREHOUSE_CHECK_ROLL(); mod.C_ROLL_ID = dr["C_ID"].ToString(); mod.C_STOVE = dr["C_STOVE"].ToString(); mod.C_BATCH_NO = dr["C_BATCH_NO"].ToString(); mod.C_TICK_NO = dr["C_TICK_NO"].ToString(); mod.C_STL_GRD = dr["C_STL_GRD"].ToString(); mod.N_WGT = Convert.ToDecimal(dr["N_WGT"]); mod.C_STD_CODE = dr["C_STD_CODE"].ToString(); mod.C_SPEC = dr["C_SPEC"].ToString(); mod.C_MAT_CODE = dr["C_MAT_CODE"].ToString(); mod.C_MAT_NAME = dr["C_MAT_DESC"].ToString(); mod.D_WAREHOUSE_IN = Convert.ToDateTime(dr["D_MOD_DT"]); mod.C_SHIFT = dr["C_SHIFT"].ToString(); mod.C_GROUP = dr["C_GROUP"].ToString(); mod.C_REASON_NAME = imgcbo_YYMC.Text; mod.C_REASON_CODE = imgcbo_YYMC.EditValue.ToString(); mod.C_REASON_DEPMT_ID = imgcbo_ZRBM.Text; mod.C_REASON_DEPMT_DESC = imgcbo_ZRBM.Text; mod.C_SUGGESTION = imgcbo_CZYJ.Text; mod.C_REMARK = txt_Remark.Text; mod.C_EMP_ID = RV.UI.UserInfo.UserID; mod.D_MOD_DT = RV.UI.ServerTime.timeNow(); if (bll_we_check_roll.Add(mod)) { Mod_TRC_ROLL_PRODCUT mod_roll = bll_TRC_Roll_Product.GetModel(dr["C_ID"].ToString()); mod_roll.C_IS_DEPOT = "Y"; bll_TRC_Roll_Product.Update(mod_roll); } } Mod_TQC_UPD_MATERIAL_MAIN mod_UpdMaterial = new Mod_TQC_UPD_MATERIAL_MAIN(); mod_UpdMaterial.C_BATCH_NO = row["C_BATCH_NO"].ToString(); mod_UpdMaterial.C_REMARK = txt_Remark.Text.Trim(); mod_UpdMaterial.C_EMP_ID = RV.UI.UserInfo.UserID; mod_UpdMaterial.D_MOD_DT = RV.UI.ServerTime.timeNow(); #region 检测是否重复添加 System.Collections.Hashtable ht = new System.Collections.Hashtable(); ht.Add("C_BATCH_NO", mod_UpdMaterial.C_BATCH_NO); ht.Add("N_STATUS", 1); if (Common.CheckRepeat.CheckTable("TQC_UPD_MATERIAL_MAIN", ht) > 0) { if (DialogResult.OK != MessageBox.Show(" 批号'" + mod_UpdMaterial.C_BATCH_NO + "'已申请修料,是否确认继续申请!", "提示", MessageBoxButtons.OKCancel)) { return; } else { DataTable dt = bll_Update.GetList_CXXL(row["C_BATCH_NO"].ToString()).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { Mod_TQC_UPDATE_MATERIAL mod_update = bll_Update.GetModel(dt.Rows[i]["C_ID"].ToString()); mod_update.N_STATUS = 0; mod_update.C_EMP_ID = RV.UI.UserInfo.UserID; mod_update.D_MOD_DT = RV.UI.ServerTime.timeNow(); bll_Update.Update(mod_update); } } } #endregion bllUpdMaterial.Add(mod_UpdMaterial); MessageBox.Show("申请成功!", "提示"); Common.UserLog.AddLog(strMenuName, this.Name, this.Text, "线材库检申请");//添加操作日志 btn_Query_Main_Click(null, null); btn_Query1_Click(null, null); } catch (Exception ex) { MessageBox.Show(ex.Message); } }