/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TPB_SCLX model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into TPB_SCLX("); strSql.Append("C_CC,C_ZL,C_LF,C_RH,C_EMP_ID)"); strSql.Append(" values ("); strSql.Append(":C_CC,:C_ZL,:C_LF,:C_RH,:C_EMP_ID)"); OracleParameter[] parameters = { new OracleParameter(":C_CC", OracleDbType.Varchar2, 100), new OracleParameter(":C_ZL", OracleDbType.Varchar2, 100), new OracleParameter(":C_LF", OracleDbType.Varchar2, 100), new OracleParameter(":C_RH", OracleDbType.Varchar2, 100), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_CC; parameters[1].Value = model.C_ZL; parameters[2].Value = model.C_LF; parameters[3].Value = model.C_RH; parameters[4].Value = model.C_EMP_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
//检测是否有新增连铸 public void CKCC() { string proid = bll_TB_PRO.GetIDByProCode("CC"); DataTable dt = bll_TPB_SCLX.CKGW(proid).Tables[0]; if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { Mod_TPB_SCLX mod_TPB_SCLX = new Mod_TPB_SCLX(); mod_TPB_SCLX.C_CC = item["C_ID"].ToString(); bll_TPB_SCLX.Add(mod_TPB_SCLX); } } MessageBox.Show("检测到有新增连铸!"); Query(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TPB_SCLX model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update TPB_SCLX set "); strSql.Append("C_CC=:C_CC,"); strSql.Append("C_ZL=:C_ZL,"); strSql.Append("C_LF=:C_LF,"); strSql.Append("C_RH=:C_RH,"); strSql.Append("C_EMP_ID=:C_EMP_ID,"); strSql.Append("D_MOD_DT=:D_MOD_DT"); strSql.Append(" where C_ID=:C_ID "); OracleParameter[] parameters = { new OracleParameter(":C_CC", OracleDbType.Varchar2, 100), new OracleParameter(":C_ZL", OracleDbType.Varchar2, 100), new OracleParameter(":C_LF", OracleDbType.Varchar2, 100), new OracleParameter(":C_RH", OracleDbType.Varchar2, 100), new OracleParameter(":C_EMP_ID", OracleDbType.Varchar2, 100), new OracleParameter(":D_MOD_DT", OracleDbType.Date), new OracleParameter(":C_ID", OracleDbType.Varchar2, 100) }; parameters[0].Value = model.C_CC; parameters[1].Value = model.C_ZL; parameters[2].Value = model.C_LF; parameters[3].Value = model.C_RH; parameters[4].Value = model.C_EMP_ID; parameters[5].Value = model.D_MOD_DT; parameters[6].Value = model.C_ID; int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TPB_SCLX DataRowToModel(DataRow row) { Mod_TPB_SCLX model = new Mod_TPB_SCLX(); if (row != null) { if (row["C_ID"] != null) { model.C_ID = row["C_ID"].ToString(); } if (row["C_CC"] != null) { model.C_CC = row["C_CC"].ToString(); } if (row["C_ZL"] != null) { model.C_ZL = row["C_ZL"].ToString(); } if (row["C_LF"] != null) { model.C_LF = row["C_LF"].ToString(); } if (row["C_RH"] != null) { model.C_RH = row["C_RH"].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()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Mod_TPB_SCLX GetModel(string C_CC) { StringBuilder strSql = new StringBuilder(); strSql.Append("select C_ID,C_CC,C_ZL,C_LF,C_RH,C_EMP_ID,D_MOD_DT from TPB_SCLX "); strSql.Append(" where C_CC=:C_CC "); OracleParameter[] parameters = { new OracleParameter(":C_CC", OracleDbType.Varchar2, 100) }; parameters[0].Value = C_CC; Mod_TPB_SCLX model = new Mod_TPB_SCLX(); DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
private void btn_Save_Click(object sender, EventArgs e) { for (int i = 0; i < gv_SCLX.RowCount; i++) { string cc = gv_SCLX.GetRowCellDisplayText(i, "C_CC").ToString(); //3# if (cc.Contains("3") == true) { string rh = gv_SCLX.GetRowCellDisplayText(i, "C_RH").ToString(); if (rh.Contains("1") == true) { MessageBox.Show("3#铸机不能选择1#RH!"); Query(); return; } string lf = gv_SCLX.GetRowCellDisplayText(i, "C_LF").ToString(); if (lf.Contains("3") == true) { MessageBox.Show("3#铸机不能选择3#LF!"); Query(); return; } string zl = gv_SCLX.GetRowCellDisplayText(i, "C_ZL").ToString(); if (zl.Contains("AOD") == true || zl.Contains("4") == true) { MessageBox.Show("3#铸机不能选择AOD炉或4#转炉!"); Query(); return; } } //4# if (cc.Contains("4") == true) { string rh = gv_SCLX.GetRowCellDisplayText(i, "C_RH").ToString(); if (rh.Contains("1") == true) { MessageBox.Show("4#铸机不能选择1#RH!"); Query(); return; } string lf = gv_SCLX.GetRowCellDisplayText(i, "C_LF").ToString(); if (lf.Contains("4") == true) { MessageBox.Show("4#铸机不能选择3#转炉!"); Query(); return; } string zl = gv_SCLX.GetRowCellDisplayText(i, "C_ZL").ToString(); if (zl.Contains("AOD") == true || zl.Contains("4") == true) { MessageBox.Show("4#铸机不能选择AOD炉或4#转炉!"); Query(); return; } } //5# if (cc.Contains("5") == true) { string zl = gv_SCLX.GetRowCellDisplayText(i, "C_ZL").ToString(); if (zl.Contains("AOD") == true) { MessageBox.Show("5#铸机不能选择AOD炉!"); Query(); return; } } //6# if (cc.Contains("6") == true) { string rh = gv_SCLX.GetRowCellDisplayText(i, "C_RH").ToString(); if (rh.Contains("1") == true) { MessageBox.Show("6#铸机不能选择1#RH!"); Query(); return; } string lf = gv_SCLX.GetRowCellDisplayText(i, "C_LF").ToString(); if (lf.Contains("3") == true) { MessageBox.Show("6#铸机不能选择3#精炼!"); Query(); return; } string zl = gv_SCLX.GetRowCellDisplayText(i, "C_ZL").ToString(); if (zl.Contains("4") == true) { MessageBox.Show("6#铸机不能选择4#转炉!"); Query(); return; } } //7# if (cc.Contains("7") == true) { string rh = gv_SCLX.GetRowCellDisplayText(i, "C_RH").ToString(); if (rh.Contains("1") == true) { MessageBox.Show("7#铸机不能选择1#RH!"); Query(); return; } string lf = gv_SCLX.GetRowCellDisplayText(i, "C_LF").ToString(); if (lf.Contains("3") == true) { MessageBox.Show("7#铸机不能选择3#精炼!"); Query(); return; } string zl = gv_SCLX.GetRowCellDisplayText(i, "C_ZL").ToString(); if (zl.Contains("AOD") == true) { MessageBox.Show("7#铸机不能选择AOD炉!"); Query(); return; } } } bll_TPB_SCLX.Delete(); for (int i = 0; i < gv_SCLX.RowCount; i++) { Mod_TPB_SCLX mod_TPB_SCLX = new Mod_TPB_SCLX(); mod_TPB_SCLX.C_CC = gv_SCLX.GetRowCellValue(i, "C_CC").ToString(); mod_TPB_SCLX.C_EMP_ID = RV.UI.UserInfo.userID; mod_TPB_SCLX.C_LF = gv_SCLX.GetRowCellValue(i, "C_LF").ToString(); mod_TPB_SCLX.C_RH = gv_SCLX.GetRowCellValue(i, "C_RH").ToString(); mod_TPB_SCLX.C_ZL = gv_SCLX.GetRowCellValue(i, "C_ZL").ToString(); bll_TPB_SCLX.Add(mod_TPB_SCLX); } MessageBox.Show("保存成功!"); Query(); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Mod_TPB_SCLX model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Mod_TPB_SCLX model) { return(dal.Add(model)); }
/// <summary> /// 调整浇次计划连铸信息 /// </summary> /// <param name="c_id">浇次计划主键</param> /// <param name="c_ccm_id">调整后连铸主键</param> /// <param name="c_remark">调整说明</param> public string ChangeCCM(string c_id, string c_ccm_id, string c_remark) { string c_ccm_desc = bll_sta.GetModel(c_ccm_id).C_STA_CODE; //连铸代码 Mod_TSP_CAST_PLAN mod = bll_cast_plan.GetModel(c_id); List <Mod_TSP_PLAN_SMS> lst_sms = new List <Mod_TSP_PLAN_SMS>(); //新浇次的炉次计划 if (mod.N_MLZL > 50 && mod.N_MLZL < 60) //不锈钢 { return("不锈钢计划只能在6#连铸生产!"); } if (mod.C_RH == "Y") { return("过真空的浇次计划不能调整!"); } decimal n_mlzl_e = 0;//调整后的炉次重量 if (c_ccm_id == "77B9FDA79B884D07AA2B3601D1DA11A2") { n_mlzl_e = 77; } else { n_mlzl_e = 47; } Mod_TPB_SCLX modlx = bll_lx.GetModel(c_ccm_id); #region 添加新的浇次计划 Mod_TSP_CAST_PLAN mod_cast = new Mod_TSP_CAST_PLAN(); mod_cast = mod; mod_cast.C_ID = System.Guid.NewGuid().ToString(); mod_cast.N_SORT = bll_cast_plan.Max_jc_sort(c_ccm_id) + 1; mod_cast.C_CCM_ID = c_ccm_id; mod_cast.C_CCM_CODE = c_ccm_desc; mod_cast.N_PRODUCE_TIME = 0; mod_cast.N_MLZL = n_mlzl_e; mod_cast.C_TZ_REMARK = c_remark; #endregion int lsxh = bll_plan_sms.GetMaxSort(c_ccm_id); int ypls = 0; var lcjh = bll_plan_sms.GetModelListByJcID(c_id); //当前浇次的炉次计划 //调整有计划的连铸计划 var lst_lc = bll_plan_sms.GetModelListByJcID(c_id).Where(ba => ba.C_STATE == "0" && ba.N_CREAT_PLAN == 1).GroupBy(ca => new { ca.C_STL_GRD, ca.C_STD_CODE }).Select(ca => new { n_wgt = ca.Sum(p => p.N_SLAB_WGT), ca.First().C_STL_GRD, ca.First().C_STD_CODE }).ToList(); if (lst_lc.Count > 0) { for (int i = 0; i < lst_lc.Count; i++) { Mod_TSP_PLAN_SMS mod_sms = new Mod_TSP_PLAN_SMS(); decimal n_wgt = (decimal)lst_lc[i].n_wgt; // ypls = (int)Math.Ceiling(n_wgt / n_mlzl_e); //应排炉数 mod_sms = lcjh[0]; mod_sms.N_SLAB_WGT = n_mlzl_e; //新的每炉重量 mod_sms.C_STATE = "0"; mod_sms.C_CCM_ID = c_ccm_id; mod_sms.C_CCM_DESC = c_ccm_desc; mod_sms.N_JC_SORT = mod_cast.N_SORT; mod_sms.C_FK = mod_cast.C_ID; mod_sms.C_LF_ID = modlx.C_LF; mod_sms.C_RH_ID = modlx.C_RH; mod_sms.C_ZL_ID = modlx.C_ZL; mod_sms.N_PRODUCE_TIME = 0; mod_sms.N_USE_WGT = n_mlzl_e; List <Mod_TPB_SLAB_CAPACITY> lstjscn = bll_jscn.GetListByCCM(mod_sms.C_STL_GRD, mod_sms.C_STD_CODE, mod_sms.C_CCM_ID); if (lstjscn.Count > 0) { mod_sms.N_JSCN = lstjscn[0].N_CAPACITY; } if (mod_sms.N_JSCN == 0) { mod_sms.N_JSCN = mod_sms.C_CCM_DESC == "5#CC" ? 114 : 88; } mod_cast.N_JSCN = mod_sms.N_JSCN; //?机时产量 mod_sms.N_PROD_TIME = n_mlzl_e / mod_sms.N_JSCN; //?生产时间 for (int j = 0; j < ypls; j++) { mod_sms.C_ID = System.Guid.NewGuid().ToString(); mod_sms.N_SORT = lsxh + 1; lsxh = lsxh + 1; bll_plan_sms.Add(mod_sms); } } } //调整非计划的连铸计划 var lst_lc_fjh = bll_plan_sms.GetModelListByJcID(c_id).Where(ba => ba.C_STATE == "1" && ba.N_CREAT_PLAN == 1).GroupBy(ca => new { ca.C_STL_GRD, ca.C_STD_CODE }).Select(ca => new { n_wgt = ca.Sum(p => p.N_SLAB_WGT), ca.First().C_STL_GRD, ca.First().C_STD_CODE }).ToList(); if (lst_lc_fjh.Count > 0) { for (int i = 0; i < lst_lc_fjh.Count; i++) { Mod_TSP_PLAN_SMS mod_sms = new Mod_TSP_PLAN_SMS(); decimal n_wgt = (decimal)lst_lc_fjh[i].n_wgt; // ypls = (int)Math.Ceiling(n_wgt / n_mlzl_e); //应排炉数 mod_sms = lcjh[0]; mod_sms.N_SLAB_WGT = n_mlzl_e; //新的每炉重量 mod_sms.C_STATE = "1"; mod_sms.C_CCM_ID = c_ccm_id; mod_sms.C_CCM_DESC = c_ccm_desc; mod_sms.N_JC_SORT = mod_cast.N_SORT; mod_sms.C_FK = mod_cast.C_ID; mod_sms.C_LF_ID = modlx.C_LF; mod_sms.C_RH_ID = modlx.C_RH; mod_sms.C_ZL_ID = modlx.C_ZL; mod_sms.N_PRODUCE_TIME = 0; mod_sms.N_USE_WGT = n_mlzl_e; List <Mod_TPB_SLAB_CAPACITY> lstjscn = bll_jscn.GetListByCCM(mod_sms.C_STL_GRD, mod_sms.C_STD_CODE, mod_sms.C_CCM_ID); if (lstjscn.Count > 0) { mod_sms.N_JSCN = lstjscn[0].N_CAPACITY; } if (mod_sms.N_JSCN == 0) { mod_sms.N_JSCN = mod_sms.C_CCM_DESC == "5#CC" ? 114 : 88; } mod_cast.N_JSCN = mod_sms.N_JSCN; //?机时产量 mod_sms.N_PROD_TIME = n_mlzl_e / mod_sms.N_JSCN; //?生产时间 for (int j = 0; j < ypls; j++) { mod_sms.C_ID = System.Guid.NewGuid().ToString(); mod_sms.N_SORT = lsxh + 1; lsxh = lsxh + 1; bll_plan_sms.Add(mod_sms); } } } bll_cast_plan.Add(mod_cast); int yls = lcjh.Where(a => a.N_CREAT_PLAN > 1).ToList().Count;//已排产炉数 bll_plan_sms.DeleteByjcid(c_id); if (yls == 0) { bll_cast_plan.Delete(c_id);//删除当前浇次计划 } else { bll_cast_plan.Update(c_id, yls);//修改当前浇次计划 } return("调整连铸成功!"); }
private void btn_Save_Click(object sender, EventArgs e) { if (cbo_ZL3.Text.Contains("AOD") == true || cbo_ZL4.Text.Contains("AOD") == true || cbo_ZL5.Text.Contains("AOD") == true || cbo_ZL7.Text.Contains("AOD") == true) { MessageBox.Show("AOD只能在6#铸机选择!"); return; } if (cbo_ZL3.Text.Contains("4") == true || cbo_ZL4.Text.Contains("4") == true || cbo_ZL6.Text.Contains("4") == true) { MessageBox.Show("4#ZL只能在5#铸机和7#铸机选择!"); return; } if (cbo_LF3.Text.Contains("3") == true || cbo_LF4.Text.Contains("3") == true || cbo_LF6.Text.Contains("3") == true || cbo_LF7.Text.Contains("3") == true) { MessageBox.Show("3#LF只能在5#铸机选择!"); return; } if (cbo_RH3.Text != "" || cbo_RH4.Text != "" || cbo_RH6.Text != "" || cbo_RH7.Text != "") { MessageBox.Show("1#RH只能在5#铸机选择!"); return; } string sta = ""; bll_TPB_SCLX.Delete(); Mod_TPB_SCLX mod_TPB_SCLX = new Mod_TPB_SCLX(); sta = bll_TB_STA.GetStaIdByCode("3#CC"); mod_TPB_SCLX.C_CC = sta; mod_TPB_SCLX.C_EMP_ID = RV.UI.UserInfo.userID; mod_TPB_SCLX.C_LF = cbo_LF3.EditValue.ToString(); mod_TPB_SCLX.C_RH = cbo_RH3.EditValue.ToString(); mod_TPB_SCLX.C_ZL = cbo_ZL3.EditValue.ToString(); bll_TPB_SCLX.Add(mod_TPB_SCLX); sta = bll_TB_STA.GetStaIdByCode("4#CC"); mod_TPB_SCLX.C_CC = sta; mod_TPB_SCLX.C_EMP_ID = RV.UI.UserInfo.userID; mod_TPB_SCLX.C_LF = cbo_LF4.EditValue.ToString(); mod_TPB_SCLX.C_RH = cbo_RH4.EditValue.ToString(); mod_TPB_SCLX.C_ZL = cbo_ZL4.EditValue.ToString(); bll_TPB_SCLX.Add(mod_TPB_SCLX); sta = bll_TB_STA.GetStaIdByCode("5#CC"); mod_TPB_SCLX.C_CC = sta; mod_TPB_SCLX.C_EMP_ID = RV.UI.UserInfo.userID; mod_TPB_SCLX.C_LF = cbo_LF5.EditValue.ToString(); mod_TPB_SCLX.C_RH = cbo_RH5.EditValue.ToString(); mod_TPB_SCLX.C_ZL = cbo_ZL5.EditValue.ToString(); bll_TPB_SCLX.Add(mod_TPB_SCLX); sta = bll_TB_STA.GetStaIdByCode("6#CC"); mod_TPB_SCLX.C_CC = sta; mod_TPB_SCLX.C_EMP_ID = RV.UI.UserInfo.userID; mod_TPB_SCLX.C_LF = cbo_LF6.EditValue.ToString(); mod_TPB_SCLX.C_RH = cbo_RH6.EditValue.ToString(); mod_TPB_SCLX.C_ZL = cbo_ZL6.EditValue.ToString(); bll_TPB_SCLX.Add(mod_TPB_SCLX); sta = bll_TB_STA.GetStaIdByCode("7#CC"); mod_TPB_SCLX.C_CC = sta; mod_TPB_SCLX.C_EMP_ID = RV.UI.UserInfo.userID; mod_TPB_SCLX.C_LF = cbo_LF7.EditValue.ToString(); mod_TPB_SCLX.C_RH = cbo_RH7.EditValue.ToString(); mod_TPB_SCLX.C_ZL = cbo_ZL7.EditValue.ToString(); bll_TPB_SCLX.Add(mod_TPB_SCLX); MessageBox.Show("保存成功!"); Query(); }