protected void btnDone_Click(object sender, EventArgs e)// { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); if (opt.GetSegValue("select flow_status from ht_eq_mclbr_plan where pz_code = '" + txtCode.Text + "'", "flow_status") != "2") { ScriptManager.RegisterStartupScript(UpdatePanel2, this.Page.GetType(), "", "$('#dspcthor').hide();alert('请在正确状态下确认完成');", true); return; } List <string> commandlist = new List <string>(); for (int i = 0; i <= GridView2.Rows.Count - 1; i++) { if (((CheckBox)GridView2.Rows[i].FindControl("chk")).Checked) { string ID = GridView2.DataKeys[i].Value.ToString(); commandlist.Add("update HT_EQ_MCLBR_PLAN_detail set STATUS = '5' where ID = '" + ID + "' and status = '4'"); } } if (commandlist.Count > 0) { string log_message = opt.TransactionCommand(commandlist) == "Success" ? "确认校准反馈成功" : "确认校准反馈失败"; InsertTlog(log_message); string alter = opt.GetSegValue("select case when total = done then 1 else 0 end as status from (select count(distinct t.id) as total,count( distinct t1.id) as done from ht_eq_mclbr_plan_detail t left join ht_eq_mclbr_plan_detail t1 on t1.id = t.id and t1.status = '5' and t1.is_del = '0' where t.main_id = '" + txtCode.Text + "' and t.is_del = '0')", "status"); if (alter == "1") { opt.UpDateOra("update HT_EQ_MCLBR_PLAN set TASK_STATUS = '5' where PZ_CODE = '" + txtCode.Text + "' and TASK_STATUS = '4'"); bindGrid1(); } bindGrid2(txtCode.Text); } }
protected void btnDone_Click(object sender, EventArgs e)// { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); if (opt.GetSegValue("select flow_status from ht_eq_lb_plan where pz_code = '" + txtCode.Text + "'", "flow_status") != "2") { return; } for (int i = 0; i <= GridView2.Rows.Count - 1; i++) { if (((CheckBox)GridView2.Rows[i].FindControl("chk")).Checked) { string ID = GridView2.DataKeys[i].Value.ToString(); string query = "update ht_eq_lb_plan_detail set STATUS = '5' where ID = '" + ID + "' and status = '4'"; string log_message = opt.UpDateOra(query) == "Success" ? "下发润滑反馈成功" : "下发润滑反馈失败"; log_message += "--标识:" + ID; InsertTlog(log_message); } } string alter = opt.GetSegValue("select case when total = done then 1 else 0 end as status from (select count(distinct t.id) as total,count( distinct t1.id) as done from ht_eq_lb_plan_detail t left join ht_eq_lb_plan_detail t1 on t1.id = t.id and t1.status = '5' and t1.is_del = '0' where t.main_id = '" + txtCode.Text + "' and t.is_del = '0')", "status"); if (alter == "1") { opt.UpDateOra("update ht_eq_lb_plan set TASK_STATUS = '5' where PZ_CODE = '" + txtCode.Text + "' and TASK_STATUS = '4'"); bindGrid1(); } bindGrid2(txtCode.Text); }
protected void btnGrid2Modify_Click(object sender, EventArgs e) { try { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); foreach (GridViewRow row in GridView2.Rows) { int Rowindex = row.RowIndex;//获得行号 string mtr_code = ((TextBox)row.FindControl("txtPlanNo")).Text; string prod_code = ((DropDownList)row.FindControl("listProd")).SelectedValue; if (!Regex.IsMatch(hidePlanID.Value, @"^[+-]?/d*$")) { hidePlanID.Value = hidePlanID.Value.Substring(hidePlanID.Value.LastIndexOf(',') + 1); } string path_code = opt.GetSegValue("select path_code from ht_pub_prod_design where prod_code = '" + prod_code + "'", "path_code"); if (mtr_code == "" || mtr_code.Substring(8, 7) != prod_code) { if (mtr_code.Length >= 17 && mtr_code.Substring(8, 7) != prod_code) { opt.UpDateOra("delete from ht_prod_month_plan_detail where plan_no = '" + mtr_code + "'"); } string planno = opt.GetSegValue("select nvl(Max(substr(PLAN_NO,16,2)),0)+1 as CODE from ht_prod_month_plan_detail where month_plan_ID = '" + hidePlanID.Value + "'", "CODE"); mtr_code = "PD" + txtYear.Text + listMonth.SelectedValue + prod_code + planno.PadLeft(2, '0'); } List <string> commandlist = new List <string>(); string[] seg = { "plan_no", "MONTH_PLAN_ID", "plan_Sort", "prod_code", "plan_output", "path_code", "is_del" }; string[] value = { mtr_code, hidePlanID.Value, ((TextBox)row.FindControl("txtOrder")).Text, prod_code, ((TextBox)row.FindControl("txtOutput")).Text, path_code, "0" }; commandlist.Add(opt.getMergeStr(seg, value, 1, "HT_PROD_MONTH_PLAN_DETAIL")); if (hideAdjust.Value == "1") { commandlist.Add("update HT_PROD_MONTH_PLAN set ADJUST_STATUS = '1',MODIFY_ID = '" + ((MSYS.Data.SysUser)Session["User"]).id + "' where ID = '" + hidePlanID.Value + "'"); } string log_message = opt.TransactionCommand(commandlist) == "Success" ? "保存生产计划详情成功" : "生产计划详情失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); if (path_code != " ") { insertSectionPath(path_code, mtr_code); } } bindGrid2(hidePlanID.Value); bindGrid1(); } catch (Exception ee) { Response.Write(ee.Message); } }
}//绑定GridView2数据源 protected void btnGrid2Save_Click(object sender, EventArgs e)// { try { Button btn = (Button)sender; GridViewRow row = (GridViewRow)btn.NamingContainer; int rowIndex = row.RowIndex; string id = GridView2.DataKeys[rowIndex].Value.ToString(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string[] seg = { "ID", "OLDVALUE", "POINTVALUE", "SAMPLE_TIME", "remark", "STATUS" }; string[] value = { id, ((TextBox)row.FindControl("txtGridOldvalue")).Text, ((TextBox)row.FindControl("txtGridNewvalue")).Text, ((TextBox)row.FindControl("txtGridClbrtime")).Text, ((TextBox)row.FindControl("txtGridremark")).Text, "2" }; string log_message = opt.MergeInto(seg, value, 1, "HT_EQ_MCLBR_PLAN_detail") == "Success" ? "自动校准成功" : "自动校准失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); string alter = opt.GetSegValue("select case when total = done then 1 else 0 end as status from (select count(distinct t.id) as total,count( distinct t1.id) as done from HT_EQ_MCLBR_PLAN_detail t left join HT_EQ_MCLBR_PLAN_detail t1 on t1.id = t.id and t1.status >= '2' and t1.is_del = '0' where t.main_id = '" + txtCode.Value + "' and t.is_del = '0')", "status"); if (alter == "1") { opt.UpDateOra("update HT_EQ_MCLBR_PLAN set TASK_STATUS = '2' where PZ_CODE = '" + txtCode.Value + "' and TASK_STATUS = '1'"); bindGrid1(); } } catch (Exception ee) { Response.Write(ee.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { try { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string ftID = ""; string query = "select * from HT_EQ_FAULT_DB where Error_name = '" + txtName.Text + "' and eqp_TYpe = '" + listEqType.SelectedValue + "' and SPECIFIC_LOCATION = '" + txtLocation.Text + "' and SECTION_CODE = '" + listSection.SelectedValue + "' and FAULT_TYPE1 = '" + listStyle1.SelectedValue + "' and FAULT_TYPE2 = '" + listStyle2.SelectedValue + "' and FAULT_TYPE3 = '" + listStyle3.SelectedValue + "' and FAULT_TYPE4 = '" + listStyle4.SelectedValue + "' and FAULT_TYPE5 = '" + listStyle5.SelectedValue + "' and FAULT_TYPE6 = '" + listStyle6.SelectedValue + "' and SCEAN = '" + txtScean.Text + "' and ERROR_DESCRIPTION = '" + txtDescpt.Text + "' and FAILURE_CAUSE = '" + txtReason.Text + "' and SOLUTION = '" + txtSolution.Text + "' and EQUIP_CODE = '" + listEq.SelectedValue + "'"; query = query.Replace("= ''", "is null"); DataSet data = opt.CreateDataSetOra(query); if (data != null && data.Tables[0].Rows.Count > 0) { ftID = data.Tables[0].Rows[0]["ID"].ToString(); } else { ftID = opt.GetSegValue("select fault_id_seq.nextval from dual", "nextval"); string[] seg = { "ID", "ERROR_NAME", "EQP_TYPE", "SPECIFIC_LOCATION", "SECTION_CODE", "FAULT_TYPE1", "FAULT_TYPE2", "FAULT_TYPE3", "FAULT_TYPE4", "FAULT_TYPE5", "FAULT_TYPE6", "SCEAN", "ERROR_DESCRIPTION", "FAILURE_CAUSE", "SOLUTION", "CREATE_TIME", "EQUIP_CODE", "EDITOR" }; string[] value = { ftID, txtName.Text, listEqType.SelectedValue, txtLocation.Text, listSection.SelectedValue, listStyle1.SelectedValue, listStyle2.SelectedValue, listStyle3.SelectedValue, listStyle4.SelectedValue, listStyle5.SelectedValue, listStyle6.SelectedValue, txtScean.Text, txtDescpt.Text, txtReason.Text, txtSolution.Text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), listEq.SelectedValue, ((MSYS.Data.SysUser)Session["User"]).text }; string log_message = opt.InsertData(seg, value, "HT_EQ_FAULT_DB") == "Success" ? "故障信息入库成功" : "故障信息入库失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); bindGrid(); } } catch (Exception ee) { Response.Write(ee.Message); } }
protected void bindStatistic() { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string query; query = "select r.产品, t.output as 产量,t.output/s.output as 产量占比,r.* from hv_qlt_month_prod_report r left join (select t.PROD_CODE,substr(t.STARTTIME,1,7) as month, sum(decode(t.para_code,'7030500029',t.SEG_VALUE)) * sum(decode(t.para_code,'7030500030',t.SECTION_CODE)) as output from hv_prod_report t where t.SECTION_CODE = '70305' and t.starttime like '" + txtStartTime.Text + "%' group by substr(t.starttime,1,7),t.prod_code) t on t.PROD_CODE = r.prod_code and t.month = r.month left join (select substr(t.STARTTIME,1,7) as month, sum(decode(t.para_code,'7030500029',t.SEG_VALUE)) * sum(decode(t.para_code,'7030500030',t.SEG_VALUE)) as output from hv_prod_report t where t.SECTION_CODE = '70305' and t.starttime like '" + txtStartTime.Text + "%' group by substr(t.starttime,1,7)) s on s.month = r.month where r.month = '" + txtStartTime.Text + "'"; DataSet data = opt.CreateDataSetOra(query); GridAll.DataSource = data; GridAll.DataBind(); if (data != null && data.Tables[0].Rows.Count > 0) { labout.Text = opt.GetSegValue("select substr(t.STARTTIME,1,7) as month, sum(decode(t.para_code,'7030500029',t.SEG_VALUE)) * sum(decode(t.para_code,'7030500030',t.SEG_VALUE)) as output from hv_prod_report t where t.SECTION_CODE = '70305' and t.starttime like '" + txtStartTime.Text + "%' group by substr(t.starttime,1,7)", "output"); labout.Text = (labout.Text == "NoRecord" || labout.Text == "") ? "0" : labout.Text; if (labout.Text != "0") { double total = Convert.ToDouble(labout.Text); double score = 0; foreach (DataRow row in data.Tables[0].Rows) { score += Convert.ToDouble(row["产量"].ToString()) / total * Convert.ToDouble(row["产品得分"].ToString()); } labScore.Text = score.ToString(); } } }
protected string initNav() { StringBuilder str = new StringBuilder(); string[] urls = new string[] { "Approval/APRVMonthPlan.aspx", "Craft/Recipe.aspx", "Product/Plan.aspx", "Product/StorageMater.aspx", "Quality/CraftEvent.aspx", "Quality/EventDeal.aspx", "Device/MtncExe.aspx", "Device/RepairExe.aspx", "Device/LbrctExe.aspx" }; string[] menus = new string[] { "业务审批", "配方编辑", "生产计划排产", "出入库确认", "工艺事件确认", "工艺事件处理", "设备维保", "设备维修", "设备润滑" }; MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); str.Append("<ul class='newlist'>"); for (int i = 0; i < urls.Length; i++) { string mappingId = opt.GetSegValue("select * from ht_inner_map t where t.url = '" + urls[i] + "'", "MAPID"); SysRightCollection rightCol = ((SysUser)Session["User"]).UserRights; var query = from SysRight right in rightCol where right.mapID == mappingId && right.eType == SysRight.RightType.Button select right; foreach (SysRight s in query) { str.Append("<li><a href='"); str.Append(urls[i]); str.Append("' target='rightFrame'>"); str.Append(menus[i]); str.Append("</a></li>"); } } str.Append("</ul>"); return(str.ToString()); }
}//绑定GridView2数据源 protected void btnGrid2Save_Click(object sender, EventArgs e)// { List <string> commandlist = new List <string>(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); foreach (GridViewRow row in GridView2.Rows) { int rowIndex = row.RowIndex; string id = GridView2.DataKeys[rowIndex].Value.ToString(); string status = ((DropDownList)row.FindControl("listGrid2Status")).SelectedValue; if ((status == "1" || status == "2") && ((TextBox)row.FindControl("txtGridNewvalue")).Text != "") { string[] seg = { "ID", "OLDVALUE", "POINTVALUE", "SAMPLE_TIME", "remark", "STATUS" }; string[] value = { id, ((TextBox)row.FindControl("txtGridOldvalue")).Text, ((TextBox)row.FindControl("txtGridNewvalue")).Text, ((TextBox)row.FindControl("txtGridClbrtime")).Text, ((TextBox)row.FindControl("txtGridremark")).Text, "2" }; commandlist.Add(opt.getMergeStr(seg, value, 1, "HT_EQ_MCLBR_PLAN_detail")); } } if (commandlist.Count > 0) { string log_message = opt.TransactionCommand(commandlist) == "Success" ? "人工校准录入成功" : "人工校准录入失败"; InsertTlog(log_message); bindGrid2(txtCode.Value); string alter = opt.GetSegValue("select case when total = done then 1 else 0 end as status from (select count(distinct t.id) as total,count( distinct t1.id) as done from HT_EQ_MCLBR_PLAN_detail t left join HT_EQ_MCLBR_PLAN_detail t1 on t1.id = t.id and t1.status >= '2' and t1.is_del = '0' where t.main_id = '" + txtCode.Value + "' and t.is_del = '0')", "status"); if (alter == "1") { opt.UpDateOra("update HT_EQ_MCLBR_PLAN set TASK_STATUS = '2' where PZ_CODE = '" + txtCode.Value + "' and TASK_STATUS = '1'"); bindGrid1(); } } }
protected void btnGridview_Click(object sender, EventArgs e)//查看领退明细 { Button btn = (Button)sender; int rowIndex = ((GridViewRow)btn.NamingContainer).RowIndex; txtCode.Text = GridView1.DataKeys[rowIndex].Values[0].ToString(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); DataSet data = opt.CreateDataSetOra("select * from HT_STRG_FLAVOR where ORDER_SN = '" + txtCode.Text + "'"); if (data != null && data.Tables[0].Rows.Count > 0) { txtPrdctdate.Text = data.Tables[0].Rows[0]["OUT_DATE"].ToString(); listStatus.SelectedValue = data.Tables[0].Rows[0]["AUDIT_MARK"].ToString(); listStorage.SelectedValue = data.Tables[0].Rows[0]["WARE_HOUSE_ID"].ToString(); listApt.SelectedValue = data.Tables[0].Rows[0]["DEPT_ID"].ToString(); if (listPrdctPlan.Items.FindByValue(data.Tables[0].Rows[0]["MONTHPLANNO"].ToString()) != null) { listPrdctPlan.SelectedValue = data.Tables[0].Rows[0]["MONTHPLANNO"].ToString(); txtPrdctPlan.Text = listPrdctPlan.SelectedValue; txtPrdctPlan.Visible = false; listPrdctPlan.Visible = true; } else { listPrdctPlan.SelectedValue = ""; txtPrdctPlan.Text = data.Tables[0].Rows[0]["MONTHPLANNO"].ToString(); txtPrdctPlan.Visible = true; listPrdctPlan.Visible = false; } string temp = opt.GetSegValue("select Prod_code from ht_prod_month_plan_detail where plan_no = '" + txtPrdctPlan.Text + "'", "PROD_CODE"); if (listPrdct.Items.FindByValue(temp) != null) { listPrdct.SelectedValue = temp; } else { listPrdct.SelectedValue = ""; } txtBatchNum.Text = data.Tables[0].Rows[0]["BATCHNUM"].ToString(); DropDownListShift.SelectedValue = data.Tables[0].Rows[0]["shift_code"].ToString(); DropDownListTeam.SelectedValue = data.Tables[0].Rows[0]["team_code"].ToString(); txtValiddate.Text = data.Tables[0].Rows[0]["EXPIRED_DATE"].ToString(); txtStemSum.Text = data.Tables[0].Rows[0]["CABOSUM"].ToString(); listCreator.SelectedValue = data.Tables[0].Rows[0]["CREATOR_ID"].ToString(); } if (listStatus.SelectedItem.Text == "未提交") { SetEnable(true); } else { SetEnable(false); } bindGrid2(); }
protected void btnGrid2Save_Click(object sender, EventArgs e) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); if (txtCode.Text == "") { txtCode.Text = "SC" + System.DateTime.Now.ToString("yyyyMMdd") + (Convert.ToInt16(opt.GetSegValue("select count(ORDER_SN) as ordernum from HT_STRG_COAT where substr(ORDER_SN,1,10) ='SC" + System.DateTime.Now.ToString("yyyyMMdd") + "'", "ordernum")) + 1).ToString().PadLeft(3, '0'); } Button btn = (Button)sender; GridViewRow row = (GridViewRow)btn.NamingContainer; string ID = GridView2.DataKeys[row.RowIndex].Value.ToString(); if (ID == "0") { ID = opt.GetSegValue("select STRGCOAT_ID_SEQ.nextval as id from dual", "ID"); } string[] seg = { "ID", "STORAGE", "unit_code", "mater_code", "ORIGINAL_DEMAND", "MAIN_CODE" }; string[] value = { ID, ((DropDownList)row.FindControl("listGridstrg")).SelectedValue, ((TextBox)row.FindControl("txtGridUnit")).Text, ((TextBox)row.FindControl("txtGridcode")).Text, ((TextBox)row.FindControl("txtGridAmount")).Text, txtCode.Text }; string log_message = opt.MergeInto(seg, value, 1, "HT_STRG_COAT_SUB") == "Success" ? "保存原料领用明细成功" : "保存原料领用明细失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); update_MainAmount(txtCode.Text); bindGrid2(); }
protected void btnAdd_Click(object sender, EventArgs e) { if (listtype.SelectedValue != "" && listSection.SelectedValue != "") { listType2.SelectedValue = listtype.SelectedValue; MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); if (listType2.SelectedValue == "0") { opt.bindDropDownList(listSection2, "select Section_code,Section_name from ht_pub_tech_section where is_valid = '1' and is_del = '0' order by section_code", "Section_name", "Section_code"); } else { opt.bindDropDownList(listSection2, "select ID,Name from ht_inner_inspect_group t", "Name", "ID"); } listSection2.SelectedValue = listSection.SelectedValue; string temp = opt.GetSegValue("select nvl(max(substr(inspect_code,10,3)),0) + 1 as code from Ht_Qlt_Inspect_Proj where inspect_type = '" + listtype.SelectedValue + "' and inspect_group = '" + listSection.SelectedValue + "'", "code"); txtCode.Text = "703" + listtype.SelectedValue + listSection.SelectedValue.PadLeft(5, '0') + temp.PadLeft(3, '0'); listCreator.SelectedValue = ((MSYS.Data.SysUser)Session["User"]).id; txtName.Text = ""; ScriptManager.RegisterStartupScript(UpdatePanel2, this.Page.GetType(), "", " $('.shade').fadeIn(200);", true); } else { ScriptManager.RegisterStartupScript(UpdatePanel2, this.Page.GetType(), "noselect", "alert('请选择检查项目类型及所属分组');", true); } }
protected void btnTrack_Click(object sender, EventArgs e)// { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); //if (opt.GetSegValue("select flow_status from HT_EQ_RP_PLAN where pz_code = '" + txtCode.Text + "'", "flow_status") != "2") //{ // ScriptManager.RegisterStartupScript(UpdatePanel2, this.Page.GetType(), "", "$('#dspcthor').hide();", true); // return; //} for (int i = 0; i <= GridView2.Rows.Count - 1; i++) { if (((CheckBox)GridView2.Rows[i].FindControl("chk")).Checked) { string ID = GridView2.DataKeys[i].Value.ToString(); string query = "update HT_EQ_RP_PLAN_detail set STATUS = '3' where ID = '" + ID + "' and status = '2'"; string log_message = opt.UpDateOra(query) == "Success" ? "下发跟踪维修计划明细成功" : "下发跟踪维修计划明细失败"; log_message += "--标识:" + ID; InsertTlog(log_message); } } string alter = opt.GetSegValue("select case when total = done then 1 else 0 end as status from (select count(distinct t.id) as total,count( distinct t1.id) as done from HT_EQ_RP_PLAN_detail t left join HT_EQ_RP_PLAN_detail t1 on t1.id = t.id and t1.status >= '3' and t1.is_del = '0' where t.main_id = '" + txtCode.Text + "' and t.is_del = '0')", "status"); if (alter == "1") { opt.UpDateOra("update HT_EQ_RP_PLAN set TASK_STATUS = '3' where PZ_CODE = '" + txtCode.Text + "' and TASK_STATUS = '2'"); bindGrid1(); } bindGrid2(txtCode.Text); }
protected void btnGrid2Save_Click(object sender, EventArgs e)// { List <string> commandlist = new List <string>(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); foreach (GridViewRow row in GridView2.Rows) { int rowIndex = row.RowIndex; string id = GridView2.DataKeys[rowIndex].Value.ToString(); string status = ((DropDownList)row.FindControl("listGrid2Status")).SelectedValue; if ((status == "1" || status == "2") && ((TextBox)row.FindControl("txtGridpos")).Text != "") { string[] seg = { "section", "equipment_id", "position", "pointnum", "luboil", "periodic", "style", "amount", "CREATE_TIME", "MAIN_ID", "STATUS" }; string[] value = { ((DropDownList)row.FindControl("listGridsct")).SelectedValue, ((DropDownList)row.FindControl("listGridEq")).SelectedValue, ((TextBox)row.FindControl("txtGridpos")).Text, ((TextBox)row.FindControl("txtGridnum")).Text, ((TextBox)row.FindControl("txtGridoil")).Text, ((TextBox)row.FindControl("txtGriPric")).Text, ((TextBox)row.FindControl("txtGridStyle")).Text, ((TextBox)row.FindControl("txtGridamount")).Text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), hdcode.Value, "2" }; commandlist.Add(opt.UpdateStr(seg, value, "ht_eq_lb_plan_detail", " where ID = '" + id + "'")); } } if (commandlist.Count > 0) { string log_message = opt.TransactionCommand(commandlist) == "Success" ? "润滑记录录入成功" : "润滑记录录入失败"; InsertTlog(log_message); bindGrid2(txtCode.Value); string alter = opt.GetSegValue("select case when total = done then 1 else 0 end as status from (select count(distinct t.id) as total,count( distinct t1.id) as done from ht_eq_lb_plan_detail t left join ht_eq_lb_plan_detail t1 on t1.id = t.id and t1.status >= '2' and t1.is_del = '0' where t.main_id = '" + hdcode.Value + "' and t.is_del = '0')", "status"); if (alter == "1") { opt.UpDateOra("update ht_eq_lb_plan set TASK_STATUS = '2' where PZ_CODE = '" + hdcode.Value + "' and TASK_STATUS = '1'"); bindGrid1(); } } }
protected void btnGrid2Save_Click(object sender, EventArgs e)// { Button btn = (Button)sender; GridViewRow row = (GridViewRow)btn.NamingContainer; if (((DropDownList)row.FindControl("listGridarea")).SelectedValue == "" || ((DropDownList)row.FindControl("listGridEq")).SelectedValue == "" || ((TextBox)row.FindControl("txtGridExptime")).Text == "") { ScriptManager.RegisterStartupScript(UpdatePanel2, this.Page.GetType(), "", "alert('请将信息填写完全后再保存');", true); return; } int rowIndex = ((GridViewRow)btn.NamingContainer).RowIndex; string id = GridView2.DataKeys[rowIndex].Value.ToString(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); if (id == "0") { id = opt.GetSegValue("select rpdetail_id_seq.nextval as id from dual", "id"); } string[] seg = { "ID", "mech_area", "equipment_id", "reason", "content", "exp_finish_time", "remark", "CREATE_TIME", "MAIN_ID", "STATUS" }; string[] value = { id, ((DropDownList)row.FindControl("listGridarea")).SelectedValue, ((DropDownList)row.FindControl("listGridEq")).SelectedValue, ((TextBox)row.FindControl("txtGridReason")).Text, ((TextBox)row.FindControl("txtGridcntnt")).Text, ((TextBox)row.FindControl("txtGridExptime")).Text, ((TextBox)row.FindControl("txtGridremark")).Text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), txtCode.Text, "0" }; string log_message = opt.MergeInto(seg, value, 1, "HT_EQ_RP_PLAN_detail") == "Success" ? "新增维修明细成功" : "新增维修明细失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); bindGrid2(txtCode.Text); }
protected void btnGrid2View_Click(object sender, EventArgs e) { Button btn = (Button)sender; GridViewRow Row = (GridViewRow)btn.NamingContainer; int rowIndex = Row.RowIndex; string ID = GridView2.DataKeys[rowIndex].Value.ToString(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); DataSet data = opt.CreateDataSetOra("select * from HT_EQ_RP_PLAN_DETAIL where id = '" + ID + "'"); if (data != null && data.Tables[0].Rows.Count > 0) { DataRow row = data.Tables[0].Rows[0]; txtCodeS.Text = ID; listEq.SelectedValue = row["EQUIPMENT_ID"].ToString(); txtOpttime.Text = row["EXE_TIME"].ToString(); listOptor.SelectedValue = row["RESPONER"].ToString(); listArea.SelectedValue = row["MECH_AREA"].ToString(); txtRecord.Text = row["REASON"].ToString() + ";" + row["CONTENT"].ToString() + ";" + row["REMARK"].ToString(); string ftid = row["FAULT_ID"].ToString(); txtFalut.Text = opt.GetSegValue("select '故障名:'||t.error_name||';故障描述:'|| t.error_description||';故障场景:'||t.scean||';故障原因:'||t.failure_cause||';解决方案'||t.solution as faultinfo from ht_eq_fault_db t where t.ID = '" + ftid + "'", "faultinfo"); txtFeedback.Text = row["FEEDBACK"].ToString() + ";" + row["REMARKPLUS"].ToString(); } ScriptManager.RegisterStartupScript(UpdatePanel3, this.Page.GetType(), "", "$('.shade').fadeIn(200);", true); }
protected void btnGrid2Save_Click(object sender, EventArgs e) { try { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); if (txtPzcode.Text == "") { txtPzcode.Text = "PK" + System.DateTime.Now.ToString("yyyyMMdd") + (Convert.ToInt16(opt.GetSegValue("select nvl(max(substr(PZ_CODE,3,11)),0) as ordernum from HT_EQ_STG_PICKUP where substr(PZ_CODE,1,10) ='PK" + System.DateTime.Now.ToString("yyyyMMdd") + "'", "ordernum")) + 1).ToString().PadLeft(3, '0'); } Button btn = (Button)sender; int Rowindex = ((GridViewRow)btn.NamingContainer).RowIndex;//获得行号 string ID = GridView2.DataKeys[Rowindex].Value.ToString(); if (ID == "0") { ID = opt.GetSegValue("select sub_pickup_id_seq.nextval as id from dual", "ID"); } string[] seg = { "ID", "MAIN_CODE", "STORAGE", "Sp_Code", "sp_name", "sp_standard", "sp_model", "sp_unit", "pickup_num", "own_section", "remark" }; string[] value = { ID, txtPzcode.Text, ((DropDownList)GridView2.Rows[Rowindex].FindControl("listGridstrg")).SelectedValue, ((TextBox)GridView2.Rows[Rowindex].FindControl("txtGridCode")).Text, ((DropDownList)GridView2.Rows[Rowindex].FindControl("listGridName")).SelectedItem.Text, ((TextBox)GridView2.Rows[Rowindex].FindControl("txtGridSpec")).Text, ((TextBox)GridView2.Rows[Rowindex].FindControl("txtGridModel")).Text, ((TextBox)GridView2.Rows[Rowindex].FindControl("txtGridUnit")).Text, ((TextBox)GridView2.Rows[Rowindex].FindControl("txtGridAmount")).Text, ((DropDownList)GridView2.Rows[Rowindex].FindControl("listGridSection")).SelectedValue, ((TextBox)GridView2.Rows[Rowindex].FindControl("txtGridDscprt")).Text }; string log_message = opt.MergeInto(seg, value, 1, "HT_EQ_STG_PICKUP_DETAIL") == "Success" ? "保存备品备件领退明细成功" : "保存备品备件领退明细失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); bindGrid2(); } catch (Exception ee) { Response.Write(ee.Message); } }
//业务明细 protected void btnDetail_Click(object sender, EventArgs e) { Button btn = (Button)sender; GridViewRow row = (GridViewRow)btn.NamingContainer; if (((Label)row.FindControl("labStatus2")).Text != "未审批") { btnSure.Visible = false; } else { btnSure.Visible = true; } int rowIndex = row.RowIndex; string ID = GridView1.DataKeys[rowIndex].Values[2].ToString(); //审批业务ID string gong_ID = GridView1.DataKeys[rowIndex].Values[1].ToString(); //主审批流程ID hideAprvid.Value = GridView1.DataKeys[rowIndex].Values[0].ToString(); //子审批流程ID MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string strsql = opt.GetSegValue("select s.plsql from ht_pub_aprv_flowinfo r left join ht_pub_aprv_type s on s.pz_type = r.modulename where r.id = '" + gong_ID + "'", "PLSQL"); strsql = strsql.Replace("@BUZ_ID", ID); GridView2.DataSource = opt.CreateDataSetOra(strsql); GridView2.DataBind(); }
protected void btnAdd_Click(object sender, EventArgs e) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string Btime = opt.GetSegValue("select begin_time from ht_sys_shift t where shift_name = '早班'", "begin_time"); DateTime startdate = Convert.ToDateTime(txtStartDate.Text + " " + Btime); DateTime enddate = Convert.ToDateTime(txtEndDate.Text + " " + Btime).AddDays(1); if (listPrdline.SelectedValue == "" || txtStartDate.Text == "" || txtEndDate.Text == "" || startdate - enddate > new TimeSpan(0) || enddate - System.DateTime.Now < new TimeSpan(0)) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "alert", "alert('请选择正确的排班车间与时间段!!')", true); return; } DateTime tempdate = GetMondayDate(startdate).AddDays(7); if (GridView1.Rows.Count > 0) { List <string> commandlist = new List <string>(); List <TeamSchedula> schedules = getTeamSchedule(); int h = 0; if (startdate - System.DateTime.Now < new TimeSpan(0)) { startdate = System.DateTime.Now; } while (startdate < enddate) { if (h == 3) { h = 0; } TeamSchedula schedule = schedules.ToArray()[h]; while (startdate < tempdate && startdate <= enddate) { for (int i = 0; i < GridView1.Rows.Count; i++) { string endtime = startdate.ToString("yyyy-MM-dd") + " " + ((TextBox)GridView1.Rows[i].FindControl("txtEndtime")).Text; if (((CheckBox)GridView1.Rows[i].FindControl("ckInter")).Checked) { endtime = startdate.AddDays(1).ToString("yyyy-MM-dd") + " " + ((TextBox)GridView1.Rows[i].FindControl("txtEndtime")).Text; } string[] seg = { "WORK_DATE", "WORK_SHOP_CODE", "SHIFT_CODE", "TEAM_CODE", "WORK_STAUS", "CREATE_TIME", "MODIFY_TIME", "DATE_BEGIN", "DATE_END", "is_del" }; string[] value = { startdate.ToString("yyyy-MM-dd"), listPrdline.SelectedValue, GridView1.DataKeys[i].Value.ToString(), schedule.team.ToArray()[i], "1", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), startdate.ToString("yyyy-MM-dd") + " " + ((TextBox)GridView1.Rows[i].FindControl("txtStarttime")).Text, endtime, "0" }; if (((CheckBox)GridView1.Rows[i].FindControl("ckInter")).Checked) { startdate = startdate.AddDays(1); } commandlist.Add(opt.getMergeStr(seg, value, 3, "HT_PROD_SCHEDULE")); } } h++; tempdate = tempdate.AddDays(7); } string log_message = opt.TransactionCommand(commandlist) == "Success" ? "排班成功" : "排班失败"; log_message += ",排班时间:" + txtStartDate.Text + "~" + txtEndDate.Text; InsertTlog(log_message); ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "alert", "alert('" + log_message + "')", true); } bindGrid2(); }
protected void btnExport_Click(object sender, EventArgs e) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string filename = opt.GetSegValue("select F_NAME from ht_sys_excel_book where f_id = '" + hidebookid.Value + "'", "F_NAME"); ExportExcel(filename, listProd.SelectedValue, txtStartTime.Text, txtEndTime.Text, listTeam.SelectedValue, ".xls", txtMonth.Text, DateTime.Now, hideMerge.Value != "0"); //ExportExcel("再造梗丝车间交接班记录", "", "2018-08-21", "", "02", ".xlsx"); }
protected void btnAddPlan_Click(object sender, EventArgs e)//新增计划 { listEditor2.SelectedValue = ((MSYS.Data.SysUser)Session["User"]).id; txtRecordTime.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); hideID.Value = opt.GetSegValue("select sensor_record_id_seq.nextval as id from dual", "ID"); }
protected void btnAdd_Click(object sender, EventArgs e) { setBlank(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); txtIDKey.Text = listSectionM.SelectedValue + opt.GetSegValue("select nvl(max(substr(idkey,6,3)),0)+1 as code from ht_eq_eqp_tbl where SECTION_CODE = '" + listSectionM.SelectedValue + "'", "CODE").PadLeft(3, '0'); listSection.SelectedValue = listSectionM.SelectedValue; ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "showinfo", " $('.shade').fadeIn(200);", true); }
protected void btnCalbrt_Click(object sender, EventArgs e) { if (drpBatch.SelectedValue == "" || txtcalBtime.Text == "") { ScriptManager.RegisterStartupScript(UpdatePanel2, this.Page.GetType(), "message", "alert('请选择自动校准采样批次及采样时间!!')", true); return; } if (GridView2.Rows.Count > 0) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); List <string> commandlist = new List <string>(); string prod_code = drpBatch.SelectedValue.Substring(8, 7); foreach (GridViewRow row in GridView2.Rows) { int rowIndex = row.RowIndex; string id = GridView2.DataKeys[rowIndex].Value.ToString(); string status = ((DropDownList)row.FindControl("listGrid2Status")).SelectedValue; if (status == "1" || status == "2") { string para_code = ((DropDownList)row.FindControl("listGridPoint")).SelectedValue; string setval = opt.GetSegValue("select value from ht_tech_stdd_code_detail r left join ht_pub_prod_design q on q.tech_stdd_code = r.tech_code where r.para_code = '" + para_code + "' and q.prod_code = '" + prod_code + "'", "value"); setval = (setval == "NoRecord" ? "0" : setval); string resval = getResVal(txtcalBtime.Text, txtcalEtime.Text, para_code); string[] seg = { "ID", "OLDVALUE", "POINTVALUE", "SAMPLE_TIME", "remark", "STATUS" }; string[] value = { id, setval, resval, txtcalBtime.Text.Substring(0, 10), ((TextBox)row.FindControl("txtGridremark")).Text, "2" }; commandlist.Add(opt.getMergeStr(seg, value, 1, "HT_EQ_MCLBR_PLAN_detail")); } } if (commandlist.Count > 0) { string log_message = opt.TransactionCommand(commandlist) == "Success" ? "自动校准录入成功" : "自动校准录入失败"; InsertTlog(log_message); bindGrid2(txtCode.Value); string alter = opt.GetSegValue("select case when total = done then 1 else 0 end as status from (select count(distinct t.id) as total,count( distinct t1.id) as done from HT_EQ_MCLBR_PLAN_detail t left join HT_EQ_MCLBR_PLAN_detail t1 on t1.id = t.id and t1.status >= '2' and t1.is_del = '0' where t.main_id = '" + txtCode.Value + "' and t.is_del = '0')", "status"); if (alter == "1") { opt.UpDateOra("update HT_EQ_MCLBR_PLAN set TASK_STATUS = '2' where PZ_CODE = '" + txtCode.Value + "' and TASK_STATUS = '1'"); bindGrid1(); } } } }
protected void bindgrid2() { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string query = "select distinct t.id,r.prod_name,s.team_name,t.inspect_type,t.inspect_code,t.insgroup,t.inspect_name,t.value,t.range,t.unit,t.status,t.minus_score,t.record_time from hv_craft_offline t left join ht_pub_prod_design r on r.prod_code = t.prod_code left join ht_sys_team s on s.team_code = t.team_id where t.RECORD_TIME between '" + txtBtime.Text + "' and '" + txtEtime.Text + "' "; if (listStatus.SelectedValue != "") { query += " and t.status = '" + listStatus.SelectedValue + "'"; } query += " order by t.record_time,t.id"; DataSet data = opt.CreateDataSetOra(query); GridView2.DataSource = data; GridView2.DataBind(); if (data != null && data.Tables[0].Rows.Count > 0) { string status = ""; for (int i = GridView2.PageSize * GridView2.PageIndex; i < GridView2.PageSize * (GridView2.PageIndex + 1) && i < data.Tables[0].Rows.Count; i++) { int j = i - GridView2.PageSize * GridView2.PageIndex; DataRowView mydrv = data.Tables[0].DefaultView[i]; GridViewRow row = GridView2.Rows[j]; status = mydrv["status"].ToString(); ((Label)row.FindControl("labStatus")).Text = opt.GetSegValue("select * from ht_inner_inspect_status where id = '" + status + "'", "NAME"); switch (status) { case "0": //未处理 ((Button)row.FindControl("btngrid2Ignore")).CssClass = "btn1"; ((Button)row.FindControl("btngrid2Sure")).CssClass = "btn1"; ((Button)row.FindControl("btngrid2fdback")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2done")).CssClass = "btnhide"; break; case "3": //己处理 ((Button)row.FindControl("btngrid2Ignore")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2Sure")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2fdback")).CssClass = "btn1"; ((Button)row.FindControl("btngrid2done")).CssClass = "btnhide"; break; case "5": //己反馈 ((Button)row.FindControl("btngrid2Ignore")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2Sure")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2fdback")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2done")).CssClass = "btn1"; break; default: // case "1"://己忽略 case "2"://处理中 case "4"://跟踪中case 6 己完成 ((Button)row.FindControl("btngrid2Ignore")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2Sure")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2fdback")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid2done")).CssClass = "btnhide"; break; } } } }
protected void btnAdd_Click(object sender, EventArgs e) { SetBlank(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string id = opt.GetSegValue("select nvl(max(substr(id,3,5)),0)+1 as id from ht_svr_user where substr(id,1,2) = '07'", "ID").PadLeft(5, '0'); txtID.Text = "07" + id; ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", " $('.shade').fadeIn(200);", true); }
protected void btnAdd_Click(object sender, EventArgs e) { listpara.SelectedValue = hidecode.Value; MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string paraname = opt.GetSegValue("select * from ht_pub_tech_para where para_code = '" + hidecode.Value + "'", "para_name"); ListItem item = new ListItem(paraname + "_" + txtBtime.Text + "~" + txtEtime.Text, hidecode.Value); cklistPara.Items.Add(item); }
protected void listGridName_SelectedIndexChanged(object sender, EventArgs e) { DropDownList list = (DropDownList)sender; GridViewRow row = (GridViewRow)list.NamingContainer; ((TextBox)row.FindControl("txtGridcode")).Text = list.SelectedValue; MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); ((DropDownList)row.FindControl("listGridstrg")).SelectedValue = opt.GetSegValue("select data_origin_flag from ht_pub_materiel where material_code = '" + list.SelectedValue + "'", "data_origin_flag"); }
protected void btnUpdate_Click(object sender, EventArgs e) { MSYS.Web.PlanService.WsPlanForGSInterfaceService service = new MSYS.Web.PlanService.WsPlanForGSInterfaceService(); MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); System.Diagnostics.Debug.WriteLine(System.DateTime.Now.Month.ToString()); string month = System.DateTime.Now.Month.ToString().Length < 2? "0" + System.DateTime.Now.Month.ToString():System.DateTime.Now.Month.ToString(); prodAssignPlan[] pb = service.getProdAssignForGS(System.DateTime.Now.Year.ToString(), month); prodAssignVO[] pvo = service.getProdAssignListForGS(System.DateTime.Now.Year.ToString(), month); string[] seg = { "id", "PLAN_NAME", "B_FLOW_STATUS", "ISSUED_STATUS", "PLAN_TIME", "IS_DEL", "REMARK", "CREATE_ID" }; string[] seg2 = { "month_plan_id", "plan_no", "prod_code ", "plan_year", "prod_month", "plan_type", "plan_output", "plan_sort", "exe_status", "is_del", "is_valid", "create_id", "path_code" }; if (pb == null || pvo == null) { System.Diagnostics.Debug.WriteLine("无数据"); return; } string monthid = ""; string cid = ""; foreach (prodAssignPlan p in pb) { if (p.planNo.ToString().Substring(0, 2) != "GS") { continue; } monthid = p.id; string sqllog = "select id from ht_svr_user where loginname = '" + pvo[0].planNo + "'"; if (pvo[0].createId != null) { cid = opt.CreateDataSetOra(sqllog).Tables[0].Rows[0][0].ToString(); } string[] value = { p.id, p.planName, "2", p.issuedStatus, p.planNo.Substring(2, 4) + "-" + p.planNo.Substring(6, 2), "0", p.remark, cid }; // string[] value2 = { p.id }; opt.MergeInto(seg, value, 2, "HT_PROD_MONTH_PLAN"); // opt.getMergeStr(seg2, value2, 1, "HT_PROD_MONTH_PLAN_DETAIL"); // dt.Rows.Add(paras); } foreach (prodAssignVO p in pvo) { //if (p.planNo.ToString().Substring(0, 2) != "GS") //continue; // string sql = "select xy_prod_code from ht_pub_prod_design where prod_code = " + p.prodCode; // DataSet ds = opt.CreateDataSetOra(sql); //string xy_prod_code = ds.Tables[0].Rows[0][0].ToString(); if (p.prodCode.Substring(0, 3) != "703") { continue; } string path_code = opt.GetSegValue("select path_code from ht_pub_prod_design where prod_code = '" + p.prodCode + "'", "path_code"); string[] value = { monthid, p.planNo, p.prodCode, p.jobYear, p.jobMonth, p.planType, p.jobOutput, p.jobSort, Convert.ToInt32(p.status).ToString(), "0", "1", cid, path_code }; opt.MergeInto(seg2, value, 2, "HT_PROD_MONTH_PLAN_DETAIL"); insertSectionPath(path_code, p.planNo); } bindGrid1(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "alert('同步完成');", true); return; }
protected void bindgrid1() { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string query = "select distinct t.para_name,s.prod_name,a.name as typename,r.value,r.range,r.b_time,r.e_time,h.team_name,nvl(j.status,0) as status,nvl(r.minus_score,0) as minus_score,r.id,r.type,r.prod_code,r.para_code from hv_qlt_data_event r left join ht_pub_prod_design s on s.prod_code = r.prod_code left join ht_pub_tech_para t on t.para_code = r.para_code left join ht_sys_team h on h.team_code = r.team left join ht_qlt_auto_event j on j.record_id = r.id and j.sort = r.type left join ht_inner_qlt_type a on a.id = r.type where r.b_time>'" + txtBtime.Text + "' and r.e_time <'" + txtEtime.Text + "'"; if (listStatus.SelectedValue != "") { query += " and nvl(j.status,0) = '" + listStatus.SelectedValue + "'"; } query += " order by r.b_time,r.id"; DataSet data = opt.CreateDataSetOra(query); GridView1.DataSource = data; GridView1.DataBind(); if (data != null && data.Tables[0].Rows.Count > 0) { string status = ""; for (int i = GridView1.PageSize * GridView1.PageIndex; i < GridView1.PageSize * (GridView1.PageIndex + 1) && i < data.Tables[0].Rows.Count; i++) { int j = i - GridView1.PageSize * GridView1.PageIndex; DataRowView mydrv = data.Tables[0].DefaultView[i]; GridViewRow row = GridView1.Rows[j]; status = mydrv["status"].ToString(); ((Label)row.FindControl("labStatus")).Text = opt.GetSegValue("select * from ht_inner_inspect_status where id = '" + status + "'", "NAME"); switch (status) { case "0": //未处理 ((Button)row.FindControl("btngrid1Ignore")).CssClass = "btn1"; ((Button)row.FindControl("btngrid1Sure")).CssClass = "btn1"; ((Button)row.FindControl("btngrid1fdback")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1done")).CssClass = "btnhide"; break; case "3": //己处理 ((Button)row.FindControl("btngrid1Ignore")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1Sure")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1fdback")).CssClass = "btn1"; ((Button)row.FindControl("btngrid1done")).CssClass = "btnhide"; break; case "5": //己反馈 ((Button)row.FindControl("btngrid1Ignore")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1Sure")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1fdback")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1done")).CssClass = "btn1"; break; default: // case "1"://己忽略 case "2"://处理中 case "4"://跟踪中case 6 己完成 ((Button)row.FindControl("btngrid1Ignore")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1Sure")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1fdback")).CssClass = "btnhide"; ((Button)row.FindControl("btngrid1done")).CssClass = "btnhide"; break; } } } }
protected void btnSave_Click(object sender, EventArgs e) { Button btn = (Button)sender; int rowIndex = ((GridViewRow)btn.NamingContainer).RowIndex; string id = GridView1.DataKeys[rowIndex].Value.ToString(); GridViewRow row = GridView1.Rows[rowIndex]; string mapID, RightID; MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); ///在映射表中插入URL映射 if ("NoRecord" == (mapID = opt.GetSegValue("select * from ht_inner_map where URL = '" + ((TextBox)row.FindControl("txtURL")).Text + "'", "MAPID"))) { mapID = id; opt.MergeInto(new string[] { "MAPID", "URL" }, new string[] { mapID, ((TextBox)row.FindControl("txtURL")).Text }, 1, "HT_INNER_MAP"); } //在权限表中插入菜单权限 if ("NoRecord" == (RightID = opt.GetSegValue("select * from ht_svr_sys_menu where F_MENU = '" + ((TextBox)row.FindControl("txtMenu")).Text + "'", "F_ID"))) { RightID = (Convert.ToInt16(opt.GetSegValue("select Max(F_ID) as ID from ht_svr_sys_menu ", "ID")) + 1).ToString().PadLeft(5, '0'); } string[] seg = { "F_ID", "F_MENU", "F_MAPID", "F_PID", "F_DESCRIPT", "F_TYPE" }; string[] value = { RightID, ((TextBox)row.FindControl("txtMenu")).Text, mapID, ((DropDownList)row.FindControl("listPrt")).SelectedValue, ((TextBox)row.FindControl("txtDscrp")).Text, "0" }; //插入操作权限 if ("Success" == opt.MergeInto(seg, value, 1, "ht_svr_sys_menu")) { value[0] = (Convert.ToInt16(RightID) + 1).ToString().PadLeft(5, '0'); } value[5] = "1"; if (value[1] == "") { value[1] = "子框架" + ((DropDownList)row.FindControl("listPrt")).SelectedItem.Text; } string log_message = opt.InsertData(seg, value, "ht_svr_sys_menu") == "Success" ? "插入操作权限成功" : "插入操作权限失败"; log_message += "--详情:" + string.Join(",", value); InsertTlog(log_message); bindData(); }
protected void btnSave_Click(object sender, EventArgs e) { MSYS.DAL.DbOperator opt = new MSYS.DAL.DbOperator(); string ftID = ""; List <String> commandlist = new List <string>(); string log_message; if (ckFault.Checked) { string query = "select * from HT_EQ_FAULT_DB where Error_name = '" + txtName.Text + "' and eqp_TYpe = '" + listEqType.SelectedValue + "' and SPECIFIC_LOCATION = '" + txtLocation.Text + "' and SECTION_CODE = '" + listSection.SelectedValue + "' and FAULT_TYPE1 = '" + listStyle1.SelectedValue + "' and FAULT_TYPE2 = '" + listStyle2.SelectedValue + "' and FAULT_TYPE3 = '" + listStyle3.SelectedValue + "' and FAULT_TYPE4 = '" + listStyle4.SelectedValue + "' and FAULT_TYPE5 = '" + listStyle5.SelectedValue + "' and FAULT_TYPE6 = '" + listStyle6.SelectedValue + "' and SCEAN = '" + txtScean.Text + "' and ERROR_DESCRIPTION = '" + txtDescpt.Text + "' and FAILURE_CAUSE = '" + txtReason.Text + "' and SOLUTION = '" + txtSolution.Text + "' and EQUIP_CODE = '" + listEq.SelectedValue + "'"; query = query.Replace("= ''", "is null"); DataSet data = opt.CreateDataSetOra(query); if (data != null && data.Tables[0].Rows.Count > 0) { ftID = data.Tables[0].Rows[0]["ID"].ToString(); } else { ftID = opt.GetSegValue("select fault_id_seq.nextval from dual", "nextval"); string[] seg1 = { "ID", "ERROR_NAME", "EQP_TYPE", "SPECIFIC_LOCATION", "SECTION_CODE", "FAULT_TYPE1", "FAULT_TYPE2", "FAULT_TYPE3", "FAULT_TYPE4", "FAULT_TYPE5", "FAULT_TYPE6", "SCEAN", "ERROR_DESCRIPTION", "FAILURE_CAUSE", "SOLUTION", "CREATE_TIME", "EQUIP_CODE", "EDITOR" }; string[] value1 = { ftID, txtName.Text, listEqType.SelectedValue, txtLocation.Text, listSection.SelectedValue, listStyle1.SelectedValue, listStyle2.SelectedValue, listStyle3.SelectedValue, listStyle4.SelectedValue, listStyle5.SelectedValue, listStyle6.SelectedValue, txtScean.Text, txtDescpt.Text, txtReason.Text, txtSolution.Text, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), listEq.SelectedValue, ((MSYS.Data.SysUser)Session["User"]).text }; log_message = opt.InsertData(seg1, value1, "HT_EQ_FAULT_DB") == "Success" ? "故障信息入库成功" : "故障信息入库失败"; log_message += ",故障信息ID:" + ftID; InsertTlog(log_message); } } string[] seg = { "EQUIPMENT_ID", "EXE_TIME", "RESPONER", "MECH_AREA", "IS_FAULT", "RECORD", "RESULTS", "CONDITION", "FAULT_ID", "EXE_SEGTIME", "STATUS" }; string[] value = { listEq.SelectedValue, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), listOptor.SelectedValue, listArea.SelectedValue, Convert.ToInt16(ckFault.Checked).ToString(), txtRecord.Text, txtResults.Text, txtCondition.Text, ftID, txtSegcount.Text, "2" }; log_message = opt.UpDateData(seg, value, "HT_EQ_MT_PLAN_DETAIL", "where id = '" + txtCode.Text + "'") == "Success" ? "维修执行成功" : "维修执行失败"; log_message += ",维修明细ID:" + txtCode.Text; InsertTlog(log_message); bindGrid(); string alter = opt.GetSegValue("select case when total = done then 1 else 0 end as status from (select count(distinct t.id) as total,count( distinct t1.id) as done from HT_EQ_MT_PLAN_DETAIL t left join HT_EQ_MT_PLAN_DETAIL t1 on t1.id = t.id and t1.status >= '2' and t1.is_del = '0' where t.main_id = '" + hideMainid.Value + "' and t.is_del = '0')", "status"); if (alter == "1") { opt.UpDateOra("update HT_EQ_MT_PLAN set TASK_STATUS = '2' where PZ_CODE = '" + hideMainid.Value + "' and TASK_STATUS = '1'"); } ScriptManager.RegisterStartupScript(UpdatePanel2, this.Page.GetType(), "", "GridClick();", true); }