protected void btnImport_Click(object sender, EventArgs e) { if (fileUp.HasFile == false)//HasFile用来检查FileUpload是否有指定文件 { JScript.Alert("请您选择Excel文件"); return; } string IsXls = System.IO.Path.GetExtension(fileUp.FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls") { JScript.Alert("只可以选择Excel文件"); return; } //获取Execle文件名 DateTime日期函数 string filename = fileUp.FileName; //Server.MapPath 获得虚拟服务器相对路径 string savePath = Server.MapPath(("upfiles\\") + filename); //SaveAs 将上传的文件内容保存在服务器上 fileUp.SaveAs(savePath); //连接Excel 读取Excel数据 并返回DataSet数据集合 DataSet ds = GridViewExportUtil.ExcelSqlConnection(savePath, filename, "sheet1"); //定义一个DataRow数组 DataRow[] dr = ds.Tables[0].Select(); int rowsnum = ds.Tables[0].Rows.Count; if (rowsnum == 0) { JScript.Alert("Excel表为空表,无数据!"); } else { List <UnitInfo> infoList = new List <UnitInfo>(); for (int i = 0; i < dr.Length - 1; i++) { //前面除了你需要在建立一个“upfiles”的文件夹外,其他的都不用管了,你只需要通过下面的方式获取Excel的值,然后再将这些值用你的方式去插入到数据库里面 //string unitName = dr[i]["机组编号"].ToString(); UnitInfo info = new UnitInfo(); info.T_CODE = dr[i]["机组编号"].ToString(); info.T_TIME = dr[i]["时间"].ToString().Substring(0, 4).ToString() + "-" + dr[i]["时间"].ToString().Substring(5, 2).ToString() + "-01"; //info.T_BEGINTIME= DateTime.Parse(dr[i]["机组编号"].ToString()); //info.T_ENDTIME= DateTime.Parse(dr[i]["机组编号"].ToString()); info.I_PH = Convert.ToDouble(dr[i]["统计期间小时PH"].ToString()); //info.T_FCATEGORYID = dr[i]["机组编号"].ToString(); //info.T_FPROPERTYID = dr[i]["机组编号"].ToString(); //info.T_FPROFEESIOID = dr[i]["机组编号"].ToString(); //info.T_FREASONID = dr[i]["机组编号"].ToString(); //info.T_EVENTDESC = dr[i]["机组编号"].ToString(); //info.T_REASONANALYSE = dr[i]["机组编号"].ToString(); //info.T_DEALCONDITION = dr[i]["机组编号"].ToString(); info.I_GAAG = Convert.ToDouble(dr[i]["发电量GAAG"].ToString()); info.I_PUMPPOWER = Convert.ToDouble(dr[i]["抽水电量"].ToString()); info.I_UTH = Convert.ToDouble(dr[i]["利用小时UTH"].ToString()); info.I_SH = Convert.ToDouble(dr[i]["运行小时SH"].ToString()); info.I_RH = Convert.ToDouble(dr[i]["备用小时RH"].ToString()); info.I_AH = Convert.ToDouble(dr[i]["可用小时AH"].ToString()); info.I_POH = Convert.ToDouble(dr[i]["计划停运小时POH"].ToString()); info.I_BPOH = Convert.ToDouble(dr[i]["大修停运小时POH1"].ToString()); info.I_SPOH = Convert.ToDouble(dr[i]["小修停运小时POH2"].ToString()); info.I_HPPOH = Convert.ToDouble(dr[i]["节日检修和公用系统计划检修停运小时POH3"].ToString()); info.I_IACTH = Convert.ToDouble(dr[i]["停机停运小时IACTH"].ToString()); info.I_FOH = Convert.ToDouble(dr[i]["强迫停运小时FOH"].ToString()); info.I_UOH = Convert.ToDouble(dr[i]["非计划停运小时UOH"].ToString()); info.I_ERFDH = Convert.ToDouble(dr[i]["备用降低出力等效小时ERFDH"].ToString()); info.I_EFDH = Convert.ToDouble(dr[i]["前三类降低出力等效停运小时EFDH"].ToString()); info.I_EUNDH = Convert.ToDouble(dr[i]["降低出力等效停运小时EUNDH"].ToString()); info.I_RT = Convert.ToDouble(dr[i]["备用次数RT"].ToString()); info.I_SST = Convert.ToDouble(dr[i]["启动成功次数SST"].ToString()); info.I_UST = Convert.ToDouble(dr[i]["启动失败次数UST"].ToString()); info.I_POT = Convert.ToDouble(dr[i]["计划停运次数POT"].ToString()); info.I_BPOT = Convert.ToDouble(dr[i]["计划大修停运次数POT1"].ToString()); info.I_SPOT = Convert.ToDouble(dr[i]["计划小修停运次数POT2"].ToString()); info.I_HPOT = Convert.ToDouble(dr[i]["节日检修停运次数POT3"].ToString()); info.I_IACTT = Convert.ToDouble(dr[i]["停机停运次数IACTT"].ToString()); info.I_FOT = Convert.ToDouble(dr[i]["强迫停运次数FOT"].ToString()); info.I_UOT = Convert.ToDouble(dr[i]["非计划停运次数UOT"].ToString()); info.I_FUOT = Convert.ToDouble(dr[i]["第5类非计划停运次数UOT5"].ToString()); info.I_LOSEPOWER = Convert.ToDouble(dr[i]["损失电量"].ToString()); info.D_SF = Convert.ToDouble(dr[i]["运行系数(%)SF"].ToString()); info.D_AF = Convert.ToDouble(dr[i]["可用系数(%)AF"].ToString()); info.D_UF = Convert.ToDouble(dr[i]["不可用系数(%)UF"].ToString()); info.D_EAF = Convert.ToDouble(dr[i]["等效可用系数(%)EAF"].ToString()); info.D_POF = Convert.ToDouble(dr[i]["计划停运系数(%)POF"].ToString()); info.D_UOF = Convert.ToDouble(dr[i]["非计划停运系数(%)UOF"].ToString()); info.D_FOF = Convert.ToDouble(dr[i]["强迫停运系数(%)FOF"].ToString()); info.D_UDF = Convert.ToDouble(dr[i]["降低出力系数(%)UDF"].ToString()); info.D_OF = Convert.ToDouble(dr[i]["出力系数(%)OF"].ToString()); info.D_GCF = Convert.ToDouble(dr[i]["毛容量系数(%)GCF"].ToString()); info.D_UTF = Convert.ToDouble(dr[i]["利用系数(%)UTF"].ToString()); info.D_FOR = Convert.ToDouble(dr[i]["强迫停运率(%)FOR"].ToString()); info.D_EFOR = Convert.ToDouble(dr[i]["等效强迫停运率(%)EFOR"].ToString()); info.D_UOR = Convert.ToDouble(dr[i]["非计划停运率(%)UOR"].ToString()); info.D_SR = Convert.ToDouble(dr[i]["启动可靠度(%)SR"].ToString()); info.D_EXR = Convert.ToDouble(dr[i]["运行暴露率(%)EXR"].ToString()); info.D_FOOR = Convert.ToDouble(dr[i]["强迫停运发生率(%)FOOR"].ToString()); info.S_MTBS = dr[i]["平均启动间隔MTBS"].ToString(); info.S_CAH = dr[i]["平均连续可用小时CAH"].ToString(); info.S_MTBF = dr[i]["平均无故障可用小时MTBF"].ToString(); info.S_MTTPO = dr[i]["平均计划停运间隔小时MTTPO"].ToString(); info.S_MTTUO = dr[i]["平均非计划停运间隔小时MTTUO"].ToString(); info.D_MPOD = Convert.ToDouble(dr[i]["平均计划停运小时MPOD"].ToString()); info.D_MUOD = Convert.ToDouble(dr[i]["平均非计划停运小时MUOD"].ToString()); info.S_BMTTPO = dr[i]["大修平均停运间隔小时MTTPO1"].ToString(); info.S_SMTTPO = dr[i]["小修平均停运间隔小时MTTPO2"].ToString(); info.D_BMPOD = Convert.ToDouble(dr[i]["大修平均延续小时MPOD1"].ToString()); info.D_SMPOD = Convert.ToDouble(dr[i]["小修平均延续小时MPOD2"].ToString()); info.D_KWZJ = Convert.ToDouble(dr[i]["千瓦装机发电量"].ToString()); info.I_GEH = Convert.ToDouble(dr[i]["发电小时GEH"].ToString()); info.I_PWH = Convert.ToDouble(dr[i]["抽水小时PWH"].ToString()); info.I_GMH = Convert.ToDouble(dr[i]["发电调相小时GMH"].ToString()); info.I_PMH = Convert.ToDouble(dr[i]["抽水调相小时PMH"].ToString()); info.I_GET = Convert.ToDouble(dr[i]["发电次数GET"].ToString()); info.I_PWT = Convert.ToDouble(dr[i]["抽水次数PWT"].ToString()); info.I_GMT = Convert.ToDouble(dr[i]["发电调相次数GMT"].ToString()); info.I_PMT = Convert.ToDouble(dr[i]["抽水调相次数PMT"].ToString()); info.I_MOE = Convert.ToDouble(dr[i]["调度停运备用小时"].ToString()); info.I_TOE = Convert.ToDouble(dr[i]["受累停运备用小时"].ToString()); info.I_FMOE = Convert.ToDouble(dr[i]["场内调度停运备用小时"].ToString()); info.I_CMOE = Convert.ToDouble(dr[i]["场外调度停运备用小时"].ToString()); info.I_MOET = Convert.ToDouble(dr[i]["调度停运备用次数"].ToString()); info.I_TOET = Convert.ToDouble(dr[i]["受累停运备用次数"].ToString()); info.I_FMOET = Convert.ToDouble(dr[i]["场内调度停运备用次数"].ToString()); info.I_CMOET = Convert.ToDouble(dr[i]["场外调度停运备用次数"].ToString()); infoList.Add(info); } try { if (bl.InsertUnit(infoList, out errMsg)) { JScript.Alert("Excle表导入成功"); } else { JScript.Alert("Excle表导入失败"); } } catch { JScript.Alert("Excle表导入失败"); } } }
protected void btnImport_Click(object sender, EventArgs e) { if (fileUp.HasFile == false)//HasFile用来检查FileUpload是否有指定文件 { JScript.Alert("请您选择Excel文件"); return; } string IsXls = System.IO.Path.GetExtension(fileUp.FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名 if ((IsXls != ".xls") && (IsXls != ".xlsx")) { JScript.Alert("只可以选择Excel文件"); return; } //获取Execle文件名 DateTime日期函数 string filename = fileUp.FileName; //Server.MapPath 获得虚拟服务器相对路径 string savePath = Server.MapPath(("upfiles\\") + filename); //SaveAs 将上传的文件内容保存在服务器上 fileUp.SaveAs(savePath); //连接Excel 读取Excel数据 并返回DataSet数据集合 DataSet ds = GridViewExportUtil.ExcelSqlConnection(savePath, filename, "五大集团"); //定义一个DataRow数组 DataRow[] dr = ds.Tables[0].Select(); int rowsnum = ds.Tables[0].Rows.Count; if (rowsnum == 0) { JScript.Alert("Excel表为空表,无数据!"); } else { List <DataInfo> infoList = new List <DataInfo>(); //时间 //string time = dr[1][1].ToString(); //for (int i = 2; i < dr.Length - 1; ) //{ // int j; // //合并五行 // for (j = 0; j < 5; j++) // { // DataInfo info = new DataInfo(); // if (String.IsNullOrEmpty(dr[i][0].ToString())) // { // break; // } // //防止超出excel行数 // if (i + j > dr.Length-1) // { // break; // } // info.T_COMPANY = dr[i][0].ToString(); // info.T_DATATYPE = dr[i + j][1].ToString(); // info.T_900_SL = dr[i + j][2].ToString(); // info.T_900_KL = dr[i + j][3].ToString(); // info.T_600_HJ = dr[i + j][4].ToString(); // info.T_600_CCL = dr[i + j][5].ToString(); // info.T_600_CLS = dr[i + j][6].ToString(); // info.T_600_CLK = dr[i + j][7].ToString(); // info.T_600_YLS = dr[i + j][8].ToString(); // info.T_600_YLK = dr[i + j][9].ToString(); // info.T_600_J = dr[i + j][10].ToString(); // info.T_350_HJ = dr[i + j][11].ToString(); // info.T_350_CNHJ = dr[i + j][12].ToString(); // info.T_350_CLJ = dr[i + j][13].ToString(); // info.T_350_YLJ = dr[i + j][14].ToString(); // info.T_350_GRHJ = dr[i + j][15].ToString(); // info.T_350_RCLJ = dr[i + j][16].ToString(); // info.T_350_RYLJ = dr[i + j][17].ToString(); // info.T_300_HJ = dr[i + j][18].ToString(); // info.T_300_CGSL = dr[i + j][19].ToString(); // info.T_300_CGKL = dr[i + j][20].ToString(); // info.T_300_LHC = dr[i + j][21].ToString(); // info.T_300_SL = dr[i + j][22].ToString(); // info.T_300_KL = dr[i + j][23].ToString(); // info.T_200_HJ = dr[i + j][24].ToString(); // info.T_200_SL = dr[i + j][25].ToString(); // info.T_200_KL = dr[i + j][26].ToString(); // info.T_200_LHC = dr[i + j][27].ToString(); // info.T_200_J = dr[i + j][28].ToString(); // info.T_120_HJ = dr[i + j][29].ToString(); // info.T_120_J = dr[i + j][30].ToString(); // info.T_120_LHC = dr[i + j][31].ToString(); // info.T_120_KL = dr[i + j][32].ToString(); // info.T_120_JC = dr[i + j][33].ToString(); // info.T_135_LHC = dr[i + j][34].ToString(); // info.T_100_HJ = dr[i + j][35].ToString(); // info.T_100_CG = dr[i + j][36].ToString(); // info.T_100_LHC = dr[i + j][37].ToString(); // info.T_100_J = dr[i + j][38].ToString(); // info.T_90_HJ = dr[i + j][39].ToString(); // info.T_90_NJ = dr[i + j][40].ToString(); // info.T_90_LHC = dr[i + j][41].ToString(); // info.T_90_RJ = dr[i + j][42].ToString(); // infoList.Add(info); // } // i = i + j; //} string time = DateTime.Now.Year.ToString(); int lee = dr[0][0].ToString().Length; string month = dr[0][0].ToString().TrimStart().Substring(3, 1); int resul = 0; if (int.TryParse(month, out resul)) { month = dr[0][0].ToString().Substring(2, 2); } else { month = "0" + dr[0][0].ToString().Substring(2, 1); } time += "-" + month; //dateTime = DateTime.Parse(time); for (int i = 3; i < dr.Length - 1;) { if (String.IsNullOrEmpty(dr[i][0].ToString())) { break; } int j; string company = dr[i][0].ToString(); //合并八行 for (j = 0; j < 8; j++) { DataInfo info = new DataInfo(); //防止超出excel行数 if (i + j > dr.Length - 1) { break; } if ((dr[i + j][1].ToString().Trim() != "供电煤耗") && (dr[i + j][1].ToString().Trim() != "供电煤耗最优值") && (dr[i + j][1].ToString().Trim() != "供电煤耗最优机组")) { continue; } switch (dr[i + j][1].ToString().Trim()) { case "供电煤耗": info.T_DATATYPE = "平均值"; break; case "供电煤耗最优值": info.T_DATATYPE = "最优值"; break; case "供电煤耗最优机组": info.T_DATATYPE = "最优机组"; break; } info.T_COMPANY = company; info.T_TIME = time; info.T_900_SL = dr[i + j][2].ToString(); info.T_900_KL = dr[i + j][3].ToString(); info.T_600_HJ = dr[i + j][4].ToString(); info.T_600_CCL = dr[i + j][5].ToString(); info.T_600_CLS = dr[i + j][6].ToString(); info.T_600_CLK = dr[i + j][7].ToString(); info.T_600_YLS = dr[i + j][8].ToString(); info.T_600_YLK = dr[i + j][9].ToString(); info.T_600_J = dr[i + j][10].ToString(); info.T_350_HJ = dr[i + j][11].ToString(); info.T_350_CNHJ = dr[i + j][12].ToString(); info.T_350_CLJ = dr[i + j][13].ToString(); info.T_350_YLJ = dr[i + j][14].ToString(); info.T_350_GRHJ = dr[i + j][15].ToString(); info.T_350_RCLJ = dr[i + j][16].ToString(); info.T_350_RYLJ = dr[i + j][17].ToString(); info.T_300_HJ = dr[i + j][18].ToString(); info.T_300_CGSL = dr[i + j][19].ToString(); info.T_300_CGKL = dr[i + j][20].ToString(); info.T_300_LHC = dr[i + j][21].ToString(); info.T_300_SL = dr[i + j][22].ToString(); info.T_300_KL = dr[i + j][23].ToString(); info.T_200_HJ = dr[i + j][24].ToString(); info.T_200_SL = dr[i + j][25].ToString(); info.T_200_KL = dr[i + j][26].ToString(); info.T_200_LHC = dr[i + j][27].ToString(); info.T_200_J = dr[i + j][28].ToString(); info.T_120_HJ = dr[i + j][29].ToString(); info.T_120_J = dr[i + j][30].ToString(); info.T_120_LHC = dr[i + j][31].ToString(); info.T_120_KL = dr[i + j][32].ToString(); info.T_120_JC = dr[i + j][33].ToString(); info.T_135_LHC = dr[i + j][34].ToString(); info.T_100_HJ = dr[i + j][35].ToString(); info.T_100_CG = dr[i + j][36].ToString(); info.T_100_LHC = dr[i + j][37].ToString(); info.T_100_J = dr[i + j][38].ToString(); info.T_90_HJ = dr[i + j][39].ToString(); info.T_90_NJ = dr[i + j][40].ToString(); info.T_90_LHC = dr[i + j][41].ToString(); info.T_90_RJ = dr[i + j][42].ToString(); infoList.Add(info); } i = i + 8; //再增加最差机组和最差值 DataInfo infos = new DataInfo(); infos.T_COMPANY = company; infos.T_TIME = time; infos.T_DATATYPE = "最差值"; infoList.Add(infos); DataInfo infoss = new DataInfo(); infoss.T_COMPANY = company; infoss.T_TIME = time; infoss.T_DATATYPE = "最差机组"; infoList.Add(infoss); } try { if (bc.InsertData(infoList, out errMsg)) { JScript.Alert("Excle表导入成功"); } else { JScript.Alert("Excle表导入失败"); } } catch { JScript.Alert("Excle表导入失败"); } } }
private bool CheckData(EntityLetterSend entity) { List <String> arrErr = new List <string>(); if (entity.DocumentTitle == "") { arrErr.Add("标题不能为空!"); } if (entity.DocumentTitle.Contains("#") || entity.DocumentTitle.Contains("'")) { arrErr.Add("含有特殊字符,请替换后再上传"); } if (entity.company == "") { arrErr.Add("主送单位不能为空!"); } if (entity.pages != "") { if (!Regex.IsMatch(entity.pages.Trim(), @"^[0-9]*[1-9][0-9]*$", RegexOptions.IgnoreCase)) { arrErr.Add("页数应为正整数!"); } } if (entity.content == "") { arrErr.Add("正文不能为空!"); } switch (base.StepName) { #region 发起函件 case ProcessConstString.StepName.LetterSend.发起函件: if (entity.sendDeptID1 == "") { arrErr.Add("发文部门不能为空!"); } //根据提交动作做不同的判断 if (entity.SubmitAction == "提交核稿") { if (string.IsNullOrEmpty(entity.wfHeGaoRenID)) { arrErr.Add("核稿人不能为空!"); } } if (entity.SubmitAction == "提交会签") { if (string.IsNullOrEmpty(wfHeGaoRenID.Text) == false) { arrErr.Add("请先清空核稿人后再提交会签!"); } if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs)) { arrErr.Add("会签人不能为空!"); } } if (entity.SubmitAction == "提交签发") { if (string.IsNullOrEmpty(wfHeGaoRenID.Text) == false) { arrErr.Add("请先清空核稿人后再提交签发!"); } if (string.IsNullOrEmpty(wfHuiQianRenIDs.Text) == false) { arrErr.Add("请先清空会签人后再提交签发!"); } if (string.IsNullOrEmpty(entity.wfQianFaRenID)) { arrErr.Add("签发人不能为空!"); } } if (string.IsNullOrEmpty(entity.wfFaQiRenID)) { arrErr.Add("发起人不能为空!"); } if (string.IsNullOrEmpty(entity.wfQianFaRenID)) { arrErr.Add("签发人不能为空!"); } break; #endregion #region 核稿 case ProcessConstString.StepName.LetterSend.核稿: if (entity.SubmitAction == "提交会签") { if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs)) { arrErr.Add("会签人不能为空!"); } if (string.IsNullOrEmpty(entity.wfQianFaRenID)) { arrErr.Add("签发人不能为空!"); } } if (entity.SubmitAction == "提交签发") { if (string.IsNullOrEmpty(entity.wfHuiQianRenIDs) == false) { arrErr.Add("请先清空会签人后再提交签发!"); } } break; #endregion #region 会签 case ProcessConstString.StepName.LetterSend.会签: if (entity.SubmitAction == "提交签发") { if (string.IsNullOrEmpty(entity.wfQianFaRenID)) { arrErr.Add("签发人不能为空!"); } } break; #endregion #region 签发 case ProcessConstString.StepName.LetterSend.签发: if (entity.HanJianAdminID == "") { arrErr.Add("角色:函件管理员没有成员!"); } break; #endregion #region 函件分发 case ProcessConstString.StepName.LetterSend.函件分发: if (entity.SubmitAction == "完成") { if (entity.pages == "") { arrErr.Add("页数不能为空!"); } if (txtOurRef.Text.Trim() == "") { arrErr.Add("我方发文号不能为空!"); } if (ucAttachment.UCDataList.Count == 0) { arrErr.Add("附件不能为空!"); } } if (entity.SubmitAction == "退回") { } break; #endregion case ProcessConstString.StepName.LetterSend.二次分发: entity.ourRef = txtOurRef.Text; entity.DocumentNo = txtOurRef.Text; break; default: break; } if (arrErr.Count > 0) { //JScript.ShowErrMsg(Page, arrErr); string strMessages = string.Empty; if (arrErr.Count > 0) { for (int i = 0; i < arrErr.Count; i++) { if (i == 0) { strMessages = arrErr[i]; } else { strMessages += "\\n" + arrErr[i]; } } } JScript.Alert(strMessages, false); return(false); } return(true); }
protected void btnSaveClose_Click(object sender, EventArgs e) { //插入basis表 , 更新母批剩余数量 ,子批flowidno为当点站 LotBasisDatalist dl = new LotBasisDatalist(); DataTable dt = (DataTable)ViewState["lotDt"]; dl.flowid = dt.Rows[0]["flowid"].ToString(); dl.workshopid = ddlWorkshop.SelectedValue; dl.lottype = "Film"; dl.status = "Active"; dl.createuser = System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(); dl.currentflowidno = (Convert.ToInt32(dt.Rows[0]["flowidno"].ToString()) + 1).ToString(); //流程编号加1 dl.factoryid = ""; dl.workorder = ViewState["WO"].ToString(); dl.reworkorder = ""; dl.lotid = txtLabelInfo.Text; dl.lotcount = dt.Rows[0]["lotcount"].ToString(); dl.ProcessComplete = "N"; //dl.UVCompleteLotid = txtLot.Text; dl.length = txtPreLength.Text; dl.restlength = txtPreLength.Text; dl.width = txtSplitWidth.Text; dl.restwidth = txtSplitWidth.Text; dl.Filmlevel = "A"; dl.eqpid = ddlEqp.SelectedValue; //=====================增加有效幅宽 add by lei.xue on 2017-5-24================================= dl.validwidth = txtSplitWidth.Text; string result = CreateMouldLot.InsertLot(dl); if (result != "success") { JScript.Alert(result, this); return; } //插入分批记录到分批表 dl.sublotid = txtLabelInfo.Text; dl.lotid = txtLot.Text; string resultsplit = PasteFilm.InsertSplitLot(dl); //更新母批剩余数量 Decimal rest = Convert.ToDecimal(txtRestWidth.Text) - Convert.ToDecimal(txtSplitWidth.Text); string strRest = PasteFilm.UpdateParentQty(ViewState["originalLot"].ToString(), rest.ToString(), "Width"); if (strRest != "success") { JScript.Alert("更新母批剩余数量失败!", this); return; } if (result != "success" || resultsplit != "success") { JScript.Alert("创建分批条码失败!", this); return; } //子批过站记录 add by lei.xue on 2017-4-26========================================= string strWipinfo = Subsection.FilmCheckOut(txtLabelInfo.Text, ddlEqp.SelectedValue, ddlWorkshop.SelectedValue, lblWorksiteID.Text, System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString()); if (strWipinfo == "fail") { JScript.Alert("子批过站记录失败!", this); return; } ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>PrintLabel('" + txtLabelInfo.Text + "','../Product/Subsection.aspx');</script>"); //JScript.Alert("创建贴膜条码成功!", this); }
/// <summary> /// /// </summary> /// <param name="p_blnIsSaveDraft"></param> /// <param name="p_strActionName"></param> /// <param name="p_htAttributes"></param> /// <param name="p_entEntityData"></param> protected void FormSubmit(Boolean p_blnIsSaveDraft, String p_strActionName, Hashtable p_htAttributes, EntityBase p_entEntityData) { String l_strMessage = String.Empty; User l_objUser = null; Boolean l_blnIsProcessCreated = true; try { ////M_20100406 ////huangqi ////修改说明:流程与附件模板名称是否匹配 ////Begin //if (p_entEntityData.FileList.Count > 0 && p_entEntityData.FileList[0].ProcessType != base.TemplateName) //{ // this.ShowMsgBox(this.Page, MsgType.VbInformation, "流程与附件模板名称不比配,请注销后重新处理该文件。", base.EntryAction); // return; //} ////End if (String.IsNullOrEmpty(base.WorkItemID)) { l_blnIsProcessCreated = false; } //保存实体数据 ReturnInfo l_objReturnInfo = FormSave.SaveEntity(p_entEntityData, this, p_blnIsSaveDraft, p_strActionName, base.TemplateName); if (!l_objReturnInfo.IsSucess) { //this.ShowMsgBox(this.Page, MsgType.VbExclamation, "表单保存出错,后续操作不能进行!" + l_objReturnInfo.ErrMessage); JScript.Alert("表单保存出错,后续操作不能进行!" + l_objReturnInfo.ErrMessage, TemplateName == ProcessConstString.TemplateName.PROGRAM_FILE); return; } if (p_blnIsSaveDraft) { if (l_blnIsProcessCreated) { //this.ShowMsgBox(this.Page, MsgType.VbInformation, "保存草稿成功!"); bool isUseUp = false; if (TemplateName == ProcessConstString.TemplateName.PROGRAM_FILE) { isUseUp = true; } else if (TemplateName == ProcessConstString.TemplateName.FinanceCCBX_APPLY) { isUseUp = true; } else { isUseUp = false; } JScript.Alert("保存草稿成功!", isUseUp); } else { this.ShowMsgBox(this.Page, MsgType.VbInformation, "保存草稿成功,可从草稿箱查看已保存文件!", "7"); } return; } //流程操作 DoWorkItem(p_htAttributes, l_blnIsProcessCreated); //获取下一个节点 getnext : DataTable l_dtbDataTable = B_FormsData.GetNextWorkItem(this.ProcessID, this.WorkItemID); if (l_dtbDataTable.Rows.Count == 0) { //有时候反应慢 数据还没产生 System.Threading.Thread.Sleep(500); l_dtbDataTable = B_FormsData.GetNextWorkItem(this.ProcessID, this.WorkItemID); } //防止协办与交办的冲突 if (base.TemplateName == ProcessConstString.TemplateName.LETTER_RECEIVE && base.SubAction != ProcessConstString.SubmitAction.LetterReceiveAction.ACTION_TJCB) { if (l_dtbDataTable != null && l_dtbDataTable.Rows.Count > 0) { int i = 0; foreach (DataRow l_dtrDataRow in l_dtbDataTable.Rows) { if (l_dtrDataRow["NAME"].ToString() != ProcessConstString.StepName.LetterReceiveStepName.STEP_HELP_DIRECTOR) { i = 1; break; } else if (base.SubAction == ProcessConstString.SubmitAction.ACTION_SUBMIT && base.StepName == ProcessConstString.StepName.LetterReceiveStepName.STEP_LETTER_ADMIN) { i = 1; break; } } if (i == 0) { goto getnext; } } } l_strMessage = p_strActionName + " "; String l_strStepName = String.Empty; foreach (DataRow l_dtrDataRow in l_dtbDataTable.Rows) { EntityBase l_entEntityData = EntityFactory.CreateEntity2(base.TemplateName); EntityBase l_entEntityBaseData = base.EntityData; l_entEntityBaseData.Clone(l_entEntityData); //流程实例ID l_entEntityData.ProcessID = this.ProcessID; l_entEntityBaseData.ProcessID = this.ProcessID; //步骤节点ID l_entEntityData.WorkItemID = l_dtrDataRow["WORK_ITEM_ID"].ToString(); l_entEntityBaseData.WorkItemID = l_dtrDataRow["WORK_ITEM_ID"].ToString(); //步骤名称 l_entEntityData.StepName = l_dtrDataRow["NAME"].ToString(); l_entEntityBaseData.StepName = l_dtrDataRow["NAME"].ToString(); //步骤状态 l_entEntityData.D_StepStatus = l_dtrDataRow["STATUS"].ToString(); l_entEntityBaseData.D_StepStatus = l_dtrDataRow["STATUS"].ToString(); //接收时间 l_entEntityData.ReceiveDateTime = Convert.ToDateTime(l_dtrDataRow["CREATED_DATE"]); l_entEntityBaseData.ReceiveDateTime = Convert.ToDateTime(l_dtrDataRow["CREATED_DATE"]); //接收人账号 l_entEntityData.ReceiveUserID = l_dtrDataRow["USER_ID"].ToString(); l_entEntityBaseData.ReceiveUserID = l_dtrDataRow["USER_ID"].ToString(); //接收人姓名 l_objUser = OAUser.GetUser(l_entEntityData.ReceiveUserID); if (l_objUser != null) { l_entEntityData.ReceiveUserName = l_objUser.Name; l_entEntityBaseData.ReceiveUserName = l_objUser.Name; } //公办ID l_entEntityData.CommonID = l_dtrDataRow["POOL_ID"].ToString(); l_entEntityBaseData.CommonID = l_dtrDataRow["POOL_ID"].ToString(); //提交动作 l_entEntityData.SubmitAction = null; l_entEntityBaseData.SubmitAction = null; //代理人信息 l_entEntityData.AgentUserID = String.Empty; l_entEntityData.AgentUserName = String.Empty; l_entEntityBaseData.AgentUserID = String.Empty; l_entEntityBaseData.AgentUserName = String.Empty; l_entEntityData.IsFormSave = false; l_entEntityBaseData.IsFormSave = false; if (base.TemplateName == ProcessConstString.TemplateName.PROGRAM_FILE || base.TemplateName == ProcessConstString.TemplateName.LETTER_RECEIVE) { l_entEntityData.CommentList.Clear(); l_entEntityBaseData.CommentList.Clear(); } l_entEntityData.FormsData = XmlUtility.SerializeXml(l_entEntityBaseData); if (l_strStepName != l_entEntityData.StepName) { l_strStepName = l_entEntityData.StepName; if (l_strMessage != p_strActionName + " ") { l_strMessage += "待处理!"; } l_strMessage += "\\n[" + l_strStepName + "]:"; } if (!String.IsNullOrEmpty(l_entEntityData.ReceiveUserName)) { l_strMessage += l_entEntityData.ReceiveUserName + " "; } else { l_strMessage += l_entEntityData.ReceiveUserID + " "; } if ((B_FormsData.AscertainSameRecord(base.ProcessID, l_entEntityData.WorkItemID, base.TemplateName))) { continue; } if (!l_entEntityData.Save()) { String l_strErrorMessage = SysString.GetErrorMsgs(l_entEntityData.ErrMsgs); ILogger log = LoggerFactory.GetLogger(LogType.TxtFile, @"Log", this.TemplateName); log.WriteLog("保存待办节点出错:" + l_strErrorMessage); } } if (l_strMessage == p_strActionName + " ") { l_strMessage = "完成!"; } else { l_strMessage += "待处理!"; } this.ShowMsgBox(this.Page, MsgType.VbInformation, l_strMessage, base.EntryAction); } catch (Exception ex) { this.WriteLog(ex.Message); l_strMessage = ex.Message; this.ShowMsgBox(this.Page, MsgType.VbInformation, l_strMessage, base.EntryAction); } }
protected void Article_Command(object sender, CommandEventArgs e) { string strConnection = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString; OleDbConnection objConnection = new OleDbConnection(strConnection); objConnection.Open(); using (objConnection) { int actionNeedAuthority = 1; switch (e.CommandName) { case "doEdit": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { string strSQL = "SELECT * FROM CPTable WHERE 编号=" + e.CommandArgument.ToString(); OleDbCommand command = new OleDbCommand(strSQL, objConnection); OleDbDataAdapter adapter = new OleDbDataAdapter(command); DataTable dt = new DataTable(); adapter.Fill(dt); if (dt.Rows.Count >= 1) { doUpdateButton.CommandArgument = e.CommandArgument.ToString(); doUpdateButton.Visible = true; doInsertButton.Visible = false; titleTextBox.Text = dt.Rows[0]["CPName"].ToString(); Txt_newsPicURL.Text = dt.Rows[0]["CPPicURL"].ToString(); infTextBox.Text = dt.Rows[0]["CPInf"].ToString(); contentTextBox.Text = dt.Rows[0]["CPDetails"].ToString(); try { parentIDDropDown.SelectedValue = dt.Rows[0]["CPLBID"].ToString(); } catch { parentIDDropDown.SelectedValue = "-1"; } //inMainPageCheckBox.Checked = Convert.ToBoolean(dt.Rows[0]["CPInMainPage"]); NewsListPanel.Visible = false; EditPanel.Visible = true; ViewPanel.Visible = false; } else { MyBasePage.writeLog(Session["userName"].ToString(), "选择指定新闻或通知时发生错误,操作对象ID:" + e.CommandArgument.ToString()); JScript.AlertAndRedirect("载入指定产品信息时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; case "doUpdate": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { if (titleTextBox.Text == "") { JScript.Alert("请输入产品名称", this); return; } string strSQL = "UPDATE CPTable SET CPName=@title, CPInf=@inf, CPDetails=@content, CPPicURL=@newsPic, CPLBID=@lbID, CPInMainPage=@inMain WHERE 编号=" + e.CommandArgument; OleDbCommand command = new OleDbCommand(strSQL, objConnection); command.Parameters.Add("@title", OleDbType.VarChar).Value = titleTextBox.Text; command.Parameters.Add("@inf", OleDbType.VarChar).Value = infTextBox.Text; command.Parameters.Add("@content", OleDbType.VarChar).Value = contentTextBox.Text; command.Parameters.Add("@newsPic", OleDbType.VarChar).Value = Txt_newsPicURL.Text; command.Parameters.Add("@lbID", OleDbType.Integer).Value = parentIDDropDown.SelectedValue; command.Parameters.Add("@inMain", OleDbType.Boolean).Value = false; //command.Parameters.Add("@inMain", OleDbType.Boolean).Value = inMainPageCheckBox.Checked; if (command.ExecuteNonQuery() > 0) { MyBasePage.writeLog(Session["userName"].ToString(), "修改新闻或通知,操作对象ID:" + e.CommandArgument); JScript.AlertAndRedirect("产品信息已修改", "", this); NewsListPanel.Visible = true; EditPanel.Visible = false; ViewPanel.Visible = false; } else { MyBasePage.writeLog(Session["userName"].ToString(), "修改新闻或通知时发生错误,返回受影响数据库条数为零。操作对象ID:" + e.CommandArgument); JScript.AlertAndRedirect("修改产品信息时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; case "doDelete": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { string strSQL = "UPDATE CPTable SET CPDel=true WHERE 编号=" + e.CommandArgument.ToString(); OleDbCommand command = new OleDbCommand(strSQL, objConnection); if (command.ExecuteNonQuery() > 0) { MyBasePage.writeLog(Session["userName"].ToString(), "删除新闻或通知,操作对象ID:" + e.CommandArgument.ToString()); JScript.AlertAndRedirect("该产品信息已删除", "", this); } else { MyBasePage.writeLog(Session["userName"].ToString(), "删除新闻或通知时发生错误,返回受影响数据库条数为零。欲操作对象ID: " + e.CommandArgument.ToString()); JScript.AlertAndRedirect("删除产品信息时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; case "doView": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { string strSQL = "SELECT * FROM CPTable WHERE 编号=" + e.CommandArgument.ToString(); OleDbCommand command = new OleDbCommand(strSQL, objConnection); OleDbDataAdapter adapter = new OleDbDataAdapter(command); DataTable dt = new DataTable(); adapter.Fill(dt); if (dt.Rows.Count >= 1) { ArticleViewTitle.Text = dt.Rows[0]["CPName"].ToString(); viewDoEditButton.CommandArgument = e.CommandArgument.ToString(); string articleInfo = string.Empty; //articleInfo += ("<div>类别:" + dt.Rows[0]["CPLBID"].ToString() + "</div>"); //articleInfo += ("<div>首页展示:" + ( Convert.ToBoolean(dt.Rows[0]["CPInMainPage"]) ? "√" : "×" ) + "</div>"); ArticleViewInfo.Text = articleInfo; ArticleView.Text = "<p>" + dt.Rows[0]["CPInf"].ToString() + "</p><p> </p><p> </p>" + dt.Rows[0]["CPDetails"].ToString(); if (dt.Rows[0]["CPPicURL"].ToString() != "") { ArticlePic.ImageUrl = dt.Rows[0]["CPPicURL"].ToString(); ArticlePic.Visible = true; } else { ArticlePic.Visible = false; } NewsListPanel.Visible = false; EditPanel.Visible = false; ViewPanel.Visible = true; } else { MyBasePage.writeLog(Session["userName"].ToString(), "选择指定新闻或通知时发生错误,操作对象ID:" + e.CommandArgument.ToString()); JScript.AlertAndRedirect("载入指定产品信息时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; } } }
protected void btnSaveClose_Click(object sender, EventArgs e) { //string result = UVComplete.FilmCheckOut(txtLot.Text, // txtLabelInfo.Text, // ddlEqp.SelectedValue, // ddlWorkshop.SelectedValue, // lblWorksiteID.Text, // System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), // txtPreLength.Text, // txtPreWidth.Text, // txtRestLength.Text, // txtSplitLength.Text, // txtMouldLot.Text, // txtDKWidth.Text, // txtMouldStructure.Text, // txtMouldPitch.Text, // ddlGlueType.SelectedValue // ); //if (result == "success") //{ // JScript.Alert("UV成型过站成功!", this); // //ClearInfo(); // //打印标签调用前台方法 // //ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>PrintLabel();</script>"); // ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>PrintLabel('" + txtLabelInfo.Text + "','../Product/UVComplete.aspx');</script>"); // return; //} //else //{ // JScript.Alert("UV成型过站失败!", this); // return; //} #region//分批条码改为手动输入,判断条码是否已经存在 add by lei.xue on 2017-4-18 string strExistSubLot = FilmCRUD.ExistSublot(txtLot.Text, txtLabelInfo.Text); if (strExistSubLot == "success") { JScript.Alert("该分批条码已经存在", this); return; } #endregion #region//插入basis表 , 更新母批剩余数量 ,子批flowidno为当点站=========================================== //==============不分批子批长度取母批的长度 modify by lei.xue on 2017-5-28================================== string SplitLength = ""; if (cbxSplit.Checked == true) { SplitLength = txtSplitLength.Text; } else { //母批直接分批的时候改为分批长度取剩余长度 modify by lei.xue on 2017-8-19 //SplitLength = txtPreLength.Text; SplitLength = txtRestLength.Text; } LotBasisDatalist dl = new LotBasisDatalist(); DataTable dt = (DataTable)ViewState["lotDt"]; dl.flowid = dt.Rows[0]["flowid"].ToString(); dl.workshopid = ddlWorkshop.SelectedValue; dl.lottype = "Film"; dl.status = "Active"; dl.createuser = System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(); dl.currentflowidno = (Convert.ToInt32(dt.Rows[0]["flowidno"].ToString()) + 1).ToString(); //流程编号加1 dl.factoryid = ""; dl.workorder = ViewState["WO"].ToString(); dl.reworkorder = ""; dl.lotid = txtLabelInfo.Text; dl.lotcount = dt.Rows[0]["lotcount"].ToString(); dl.ProcessComplete = "N"; //dl.UVCompleteLotid = txtLot.Text; dl.length = SplitLength; //txtSplitLength.Text; //================剩余长度和宽度为母批的有效长度和宽度modify by lei.xue on 2017-6-1============= dl.restlength = txtValidLength.Text; //SplitLength;//txtSplitLength.Text; dl.width = txtPreWidth.Text; dl.restwidth = txtValidWidth.Text; //txtPreWidth.Text; dl.Filmlevel = "A"; dl.eqpid = ddlEqp.SelectedValue; //增加有效幅宽 add by lei.xue on 2017-4-18================================================= dl.validwidth = txtValidWidth.Text; //================增加有效长度 add by lei.xue on 2017-5-28================================= dl.validlength = txtValidLength.Text; string result = CreateMouldLot.InsertLot(dl); if (result != "success") { JScript.Alert(result, this); return; } #endregion #region//插入分批记录到分批表=============================================================== dl.sublotid = txtLabelInfo.Text; dl.lotid = txtLot.Text; string resultsplit = PasteFilm.InsertSplitLot(dl); #endregion #region//更新母批剩余数量=================================================================== Decimal rest = Convert.ToDecimal(txtRestLength.Text) - Convert.ToDecimal(SplitLength); string strRest = PasteFilm.UpdateParentQty(txtLot.Text, rest.ToString(), "Length"); if (strRest != "success") { JScript.Alert("更新母批剩余数量失败!", this); return; } #endregion #region//记录绑定的模具信息和胶水规格 modify by lei.xue on 2017-3-27================================ string resultWipInfo = UVComplete.FilmCheckOut(txtLabelInfo.Text, "", ddlEqp.SelectedValue, ddlWorkshop.SelectedValue, lblWorksiteID.Text, System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), txtMouldLot.Text, txtDKWidth.Text, txtMouldStructure.Text, txtMouldPitch.Text, ddlGlueType.SelectedValue ); if (strRest != "success") { JScript.Alert("记录绑定的模具信息和胶水规格失败!", this); return; } #endregion if (result != "success" || resultsplit != "success") { JScript.Alert("创建UV成型条码失败!", this); return; } //ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>PrintLabel('" + txtLabelInfo.Text + "','../Product/UVComplete.aspx');</script>"); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>PrintLabel('" + txtLabelInfo.Text + "','../Product/UVComplete.aspx','" + txtProductType.Text + "');</script>"); }
protected void btnSend_Click(object sender, EventArgs e) { //提交前先保存 btnSave_Click(null, null); if (tdMessage.InnerText != "") { return; } string returnString = ""; object obj; //发送前判断汇集环节的所有分支是否都到达此节点 obj = DBOpt.dbHelper.ExecuteScalar("select f_nodetype from dmis_sys_flowlink where f_no=" + ViewState["CurLinkNo"].ToString()); if (obj != null && Convert.ToInt16(obj) == 2) { returnString = WebWorkFlow.InfluxTacheSendCondition(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"])); if (returnString.Length > 0) { JScript.Alert(returnString); tdMessage.InnerText = returnString; return; } } //发送前条件判断 returnString = WebWorkFlow.TacheSendCondition(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); if (returnString.Length > 0) { JScript.Alert(returnString); tdMessage.InnerText = returnString; return; } string sMainer = ""; obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { sMainer = obj.ToString(); } if (sMainer == Session["MemberName"].ToString()) { int iCat = -1; obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_FLOWCAT FROM DMIS_SYS_FLOWLINK WHERE F_NO=" + ViewState["CurLinkNo"]); if (obj != null) { iCat = Convert.ToInt16(obj); } if (iCat == 2) { int iFno = WebWorkFlow.EndFlow(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString()); if (iFno == -1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkFinishFailMessage").ToString());//此业务归档失败,请联系统管理员! return; } else { //JScript.Alert("此业务归档成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } } else { string paras; //发送岗位时,派工环节,弹出发送窗口 if (WebWorkFlow.IsAssignTache(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]))) { paras = "PackTypeNo=" + ViewState["PackTypeNo"] + "&CurLinkNo=" + ViewState["CurLinkNo"] + "&PackNo=" + ViewState["PackNo"] + "&CurWorkFlowNo=" + ViewState["CurWorkFlowNo"] + "&TableName=" + ViewState["TableName"].ToString() + "&RecNo=" + ViewState["RecNo"].ToString(); Session["sended"] = 0; JScript.OpenWindow("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=700,height=500,top=20,left=100"); //Response.Write(webfun.OpenWin("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=700,height=480,top=20,left=100")); } else //非派工环节,直接发送即可 { int curTaskID = Convert.ToInt16(ViewState["CurWorkFlowNo"]); if (WebWorkFlow.DirectCreateFlow(Convert.ToInt16(ViewState["PackNo"]), ref curTaskID, Session["MemberName"].ToString())) { //统计实际工作时间 //1、根据工作流的相关表DMIS_SYS_WORKFLOW DMIS_SYS_MEMBERSTATUS来统计实际工作时间 WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString());//"此任务发送失败,请联系统管理员!" return; } } } } else { //结束从办人员的办理状态 if (WebWorkFlow.EndMemberStatus(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString())) { //JScript.Alert("提交成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString()); //更新状态失败! } } }
protected void Article_Command(object sender, CommandEventArgs e) { string strConnection = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString; OleDbConnection objConnection = new OleDbConnection(strConnection); objConnection.Open(); using (objConnection) { int actionNeedAuthority = 1; switch (e.CommandName) { case "doEdit": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { string strSQL = "SELECT * FROM ZSTable WHERE ID=" + e.CommandArgument.ToString(); OleDbCommand command = new OleDbCommand(strSQL, objConnection); OleDbDataAdapter adapter = new OleDbDataAdapter(command); DataTable dt = new DataTable(); adapter.Fill(dt); if (dt.Rows.Count >= 1) { doUpdateButton.CommandArgument = e.CommandArgument.ToString(); doUpdateButton.Visible = true; doInsertButton.Visible = false; titleTextBox.Text = dt.Rows[0]["picName"].ToString(); Txt_PicURLSmall.Text = dt.Rows[0]["picSmall"].ToString(); Txt_PicURL.Text = dt.Rows[0]["picURL"].ToString(); Image_picSmall.ImageUrl = formatPicURL(dt.Rows[0]["picSmall"].ToString()); Image_pic.ImageUrl = formatPicURL(dt.Rows[0]["picURL"].ToString()); NewsListPanel.Visible = false; EditPanel.Visible = true; ViewPanel.Visible = false; } else { MyBasePage.writeLog(Session["userName"].ToString(), "选择指定新闻或通知时发生错误,操作对象ID:" + e.CommandArgument.ToString()); JScript.AlertAndRedirect("载入指定数据时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; case "doUpdate": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { if (Txt_PicURL.Text == "") { JScript.Alert("请输入大图片地址", this); return; } if (Txt_PicURLSmall.Text == "") { JScript.Alert("请输入小图片地址", this); return; } string strSQL = "UPDATE ZSTable SET picName=@name, picURL=@picurl, picSmall=@picsmallurl WHERE ID=" + e.CommandArgument; OleDbCommand command = new OleDbCommand(strSQL, objConnection); command.Parameters.Add("@name", OleDbType.VarChar).Value = titleTextBox.Text; command.Parameters.Add("@picurl", OleDbType.VarChar).Value = Txt_PicURL.Text; command.Parameters.Add("@picsmallurl", OleDbType.VarChar).Value = Txt_PicURLSmall.Text; if (command.ExecuteNonQuery() > 0) { MyBasePage.writeLog(Session["userName"].ToString(), "修改新闻或通知,操作对象ID:" + e.CommandArgument); JScript.AlertAndRedirect("记录已修改", "", this); NewsListPanel.Visible = true; EditPanel.Visible = false; ViewPanel.Visible = false; } else { MyBasePage.writeLog(Session["userName"].ToString(), "修改新闻或通知时发生错误,返回受影响数据库条数为零。操作对象ID:" + e.CommandArgument); JScript.AlertAndRedirect("修改数据库记录时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; case "doDelete": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { string strSQL = "DELETE FROM ZSTable WHERE ID=" + e.CommandArgument.ToString(); OleDbCommand command = new OleDbCommand(strSQL, objConnection); if (command.ExecuteNonQuery() > 0) { MyBasePage.writeLog(Session["userName"].ToString(), "删除新闻或通知,操作对象ID:" + e.CommandArgument.ToString()); JScript.AlertAndRedirect("记录已删除", "", this); } else { MyBasePage.writeLog(Session["userName"].ToString(), "删除新闻或通知时发生错误,返回受影响数据库条数为零。欲操作对象ID: " + e.CommandArgument.ToString()); JScript.AlertAndRedirect("删除数据库记录时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; case "doView": break; } } }
protected void btnEnter_Click(object sender, EventArgs e) { //模具编号 string MouldLot = ""; #region 判断条码是否有效================================================ if (txtLot.Text.Length == 10) { //外发或资产条码是否打印 条码第四位判断:W或Z if (txtLot.Text.Substring(3, 1).ToString() == "W") { if (CRUD.CheckMouldLabel("W", txtLot.Text) == "fail") { JScript.Alert("该条码未打印!", this); return; } } else if (txtLot.Text.Substring(3, 1).ToString() == "Z") { if (CRUD.CheckMouldLabel("Z", txtLot.Text) == "fail") { JScript.Alert("该条码未打印!", this); return; } } MouldLot = txtLot.Text.Substring(0, 3).ToString(); } else { MouldLot = txtLot.Text; } #endregion //查询是否可以过站 string result = CRUD.QueryStationOfLot(lblWorksiteID.Text, MouldLot); if (result != "success") { JScript.Alert(result, this); txtLot.Text = ""; return; } //是否已经checkin DataTable ResDt = CRUD.GetCheckInInfo(MouldLot, lblWorksiteID.Text); if (ResDt.Rows.Count > 0) { //返工后重复过站 if (ResDt.Rows[0]["rework"].ToString() == "Y") { DataTable dtCheckInIsOK = CRUD.CheckInIsOK(MouldLot, lblWorksiteID.Text); if (dtCheckInIsOK.Rows.Count > 0) { JScript.Alert("该批次已经进站", this); return; } } else { JScript.Alert("该批次已经进站", this); return; } } //批次已过站点 string WorksiteIDOfLot = CRUD.GetWorksite(MouldLot); //查询批次流程 CRUD.setLabelProcess(lblLotprocess, lblCurrnentWorksite, lblEndProcess, MouldLot, lblWorksiteID.Text); #region 显示精雕 喷砂或外发的模具参数add by lei.xue on 2017-3-16=============================================== string FlowID = ""; DataTable dt = CRUD.GetLotBasisInfo(MouldLot); if (dt.Rows.Count > 0) { FlowID = dt.Rows[0]["flowid"].ToString(); dt = null; if (FlowID == "flow001")//查询精雕M15 { dt = CRUD.getStationInfoOfMould(MouldLot, "M15"); } else if (FlowID == "flow002")//喷砂 { dt = CRUD.getStationInfoOfMould(MouldLot, "M20"); } else if (FlowID == "flow003")//外发 { dt = CRUD.getStationInfoOfMould(MouldLot, "M20"); } if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["paratype"].ToString() == "DKWidth") { txtDKWidth.Text = dt.Rows[i]["paraid"].ToString(); } if (dt.Rows[i]["paratype"].ToString() == "MouldStructure") { txtMouldStructure.Text = dt.Rows[i]["paraid"].ToString(); } if (dt.Rows[i]["paratype"].ToString() == "MouldPitch") { txtMouldPitch.Text = dt.Rows[i]["paraid"].ToString(); } if (dt.Rows[i]["paratype"].ToString() == "Haze") { txtHaze.Text = dt.Rows[i]["paraid"].ToString(); } } } } #endregion }
/// <summary> /// 提交按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitBtn_Click(object sender, EventArgs e) { try { //提交动作 string strActionName = ((Button)sender).Text.Trim(); base.SubAction = strActionName; string strErrorMessage = string.Empty; //保存 if (strActionName == ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT) { B_DJGTSend entity = ControlToEntity(true) as B_DJGTSend; entity.SubmitAction = strActionName; base.FormSubmit(true, strActionName, null, entity); } else { B_DJGTSend entity = ControlToEntity(false) as B_DJGTSend; entity.SubmitAction = strActionName; //撤销 if (strActionName == ProcessConstString.SubmitAction.ACTION_CANCEL) { base.FormCancel(entity); } else { //返回验证提示和流程提示 entity.GetSubmitMessage(base.StepName, strActionName, ref strErrorMessage); if (!string.IsNullOrEmpty(strErrorMessage)) { JScript.ShowMsgBox(this.Page, strErrorMessage, false); return; } else { switch (base.SubAction) { case ProcessConstString.SubmitAction.CompanySendAction.ACTION_TJJD: B_DocumentNo_SN sn = new B_DocumentNo_SN(); if (!sn.UpdateNo(ProcessConstString.TemplateName.DJGT_Send, entity.ProcessID, entity.DocumentYear, entity.DocumentNum, entity.DocumentNo)) { return; } break; case ProcessConstString.SubmitAction.CompanySendAction.ACTION_WCGD: if (!string.IsNullOrEmpty(entity.CirculateDeptIDs) || !string.IsNullOrEmpty(entity.CirculateLeaderIDs)) { base.Circulate(entity.CirculateDeptIDs, "1", string.Empty, entity.CirculateLeaderIDs, "1", false, string.Empty, false); } //党纪工团归档 try { string strMessage = string.Empty; this.Devolve(out strMessage); base.Devolved(base.ProcessID, base.TemplateName); JScript.Alert("归档成功!\\n流水号:" + strMessage, false); } catch (Exception ex) { base.WriteLog(ex.Message); JScript.Alert("归档失败!请查看配置是否正确!", false); return; } break; } //调用工作流 Hashtable nValues = entity.GetProcNameValue(base.StepName, strActionName); base.FormSubmit(false, strActionName, nValues, entity); } } } } catch (Exception ex) { JScript.ShowMsgBox(this.Page, ex.Message, false); } }
/// <summary> /// 提交按钮处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitBtn_Click(object sender, EventArgs e) { try { //提交动作 string strActionName = ((Button)sender).Text.Trim(); base.SubAction = strActionName; string strErrorMessage = string.Empty; //保存 if (strActionName == ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT) { B_Finance entity = ControlToEntity(true) as B_Finance; entity.SubmitAction = strActionName; base.FormSubmit(true, strActionName, null, entity); } else { B_Finance entity = ControlToEntity(false) as B_Finance; entity.SubmitAction = strActionName; //撤销 if (strActionName == ProcessConstString.SubmitAction.ACTION_CANCEL) { base.FormCancel(entity); } else { //返回验证信息 entity.GetSubmitMessage(base.StepName, strActionName, ref strErrorMessage); if (!string.IsNullOrEmpty(strErrorMessage)) { JScript.ShowMsgBox(this.Page, strErrorMessage, false); return; } else { switch (base.StepName) { case ProcessConstString.StepName.STEP_DRAFT: strActionName = base.SubAction; break; case ProcessConstString.StepName.FinanceStepName.STEP_DISTRIBUTION: if (strActionName == ProcessConstString.SubmitAction.FinanceAction.ACTION_WCGD) { if (!string.IsNullOrEmpty(entity.ChuanYueDeptID) || !string.IsNullOrEmpty(entity.ChuanYueRenYuanID)) { base.Circulate(entity.ChuanYueDeptID, "1", string.Empty, entity.ChuanYueRenYuanID, "1", false, string.Empty, false); } try { string strMessage = string.Empty; this.Devolve(out strMessage); base.Devolved(base.ProcessID, base.TemplateName); JScript.Alert("归档成功!\\n流水号:" + strMessage, false); } catch (Exception ex) { base.WriteLog(ex.Message); JScript.Alert("归档失败!请查看配置是否正确!", false); return; } } break; } } //调用工作流 Hashtable nValues = entity.GetProcNameValue(base.StepName, strActionName); base.FormSubmit(false, strActionName, nValues, entity); } } } catch (Exception ex) { base.ShowMsgBox(this.Page, MsgType.VbExclamation, ex.Message); } }
/// <summary> /// 确定留言按钮,同时发送邮件通知指定邮箱 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void OKButton_Click(object sender, EventArgs e) { ValicodeWrongLabel.Visible = false; if (IsValid)//判断页面控件是否都通过验证 { if (Session["ValidateCode"] == null || UserCodeTextbox.Text != Session["ValidateCode"].ToString()) { JScript.Alert("验证码输入错误!请重新输入!", this.Page); ValicodeWrongLabel.Visible = true; return; } string strConnection = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString; OleDbConnection objConnection = new OleDbConnection(strConnection); objConnection.Open(); using (objConnection) { string strLYTitle = TitleTextBox.Text.Trim(); string strLYName = NameTextBox.Text.Trim(); string strLYEmail = EmailTextBox.Text.Trim(); string strLYTel = TelTextBox.Text.Trim(); string strLYContents = ContentsTextBox.Text.Trim(); if (strLYTitle == "") { strLYTitle = strLYName + " 的留言"; } string strSQL = "INSERT INTO LYTable(LYTitle,LYName,LYEmail,LYTel,LYContents) VALUES(@lyTitle,@lyName,@lyEmail,@lyTel,@lyContent)"; OleDbCommand command = new OleDbCommand(strSQL, objConnection); command.Parameters.Add("@lyTitle", OleDbType.VarChar).Value = strLYTitle; command.Parameters.Add("@lyName", OleDbType.VarChar).Value = strLYName; command.Parameters.Add("@lyEmail", OleDbType.VarChar).Value = strLYEmail; command.Parameters.Add("@lyTel", OleDbType.VarChar).Value = strLYTel; command.Parameters.Add("@lyContent", OleDbType.VarChar).Value = strLYContents; if (command.ExecuteNonQuery() == 1) { string emailcontents = string.Format(@"一条新留言<br />标题: {0}<br />留言人: {1}<br />Email: {2}<br />电话: {3}<br /><br />内容为: <br />{4}", strLYTitle, strLYName, strLYEmail, strLYTel, strLYContents); if (SendEmail.strEmailForMessage == string.Empty) { SendEmail.strEmailForMessage = "*****@*****.**"; } if (SendEmail.StaticSendEmail(SendEmail.strEmailForMessage, strLYTitle, emailcontents)) { // Response.Write("<script language='javascript'>alert('留言发表成功!!'); window.location.href='Default.aspx'</script>"); JScript.AlertAndRedirect("你的留言发表成功!我们会尽快联系您,谢谢!", "Default.aspx", this.Page); } else { JScript.AlertAndRedirect("留言失败,请稍候再试!谢谢!", "Default.aspx", this.Page); } } else { JScript.AlertAndRedirect("留言失败,数据库错误!", "Default.aspx", this.Page); } } } }
protected void grvList_RowCommand(object sender, GridViewCommandEventArgs e) { int row; if (!int.TryParse(e.CommandArgument.ToString(), out row)) { return; } if (e.CommandName == "FlowTable") //流程 { Response.Redirect("FlowTable.aspx?InstanceID=" + grvList.DataKeys[row].Value.ToString() + @"&BackUrl=" + Page.Request.RawUrl); } else if (e.CommandName == "Deal") //查看 { object obj = null; int RecNo; //记录编号 int DocTypeNo; //文档类型号 int PackTypeNo; //业务类型编号 int CurLinkNo; //当前环节号 int PackNo; //当前业务号 int CurWorkFlowNo; //工作流编号 dmis_sys_workflow表中的f_no值 PackTypeNo = Convert.ToInt16(grvList.DataKeys[row].Values[1]); PackNo = Convert.ToInt16(grvList.DataKeys[row].Value); if (grvList.Rows[row].Cells[6].Text == GetGlobalResourceObject("WebGlobalResource", "WkStatusFinish").ToString()) //结案 { obj = DBOpt.dbHelper.ExecuteScalar("select f_no from dmis_sys_flowlink where f_packtypeno=" + PackTypeNo + " and f_flowcat=2"); //结案的找结束环节 } else if (grvList.Rows[row].Cells[6].Text == GetGlobalResourceObject("WebGlobalResource", "WkStatusWorking").ToString()) //正常 { obj = DBOpt.dbHelper.ExecuteScalar("select f_flowno from dmis_sys_workflow where f_packno=" + PackNo + " and f_status='1'"); } else if (grvList.Rows[row].Cells[6].Text == GetGlobalResourceObject("WebGlobalResource", "WkStatusAbolish").ToString()) //作废 { obj = DBOpt.dbHelper.ExecuteScalar("select f_no from dmis_sys_flowlink where f_packtypeno=" + PackTypeNo + " and f_flowcat=0"); //作废的找起始环节 } else if (grvList.Rows[row].Cells[6].Text == GetGlobalResourceObject("WebGlobalResource", "WkStatusSuspend").ToString()) //挂起 { obj = DBOpt.dbHelper.ExecuteScalar("select f_no from dmis_sys_flowlink where f_packtypeno=" + PackTypeNo + " and f_status='1'"); //作废的找起始环节 } if (obj == null) { //JScript.Alert("无法找到业务表的环节号!"); return; } CurLinkNo = Convert.ToInt16(obj); //最后一个环节的工作流号 CurWorkFlowNo = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar("select f_no from dmis_sys_workflow where f_packno=" + PackNo + " and f_flowno=" + CurLinkNo)); //最后一个环节对应的业务表中的记录号 _sql = "select f_recno from DMIS_SYS_DOC where F_PACKNO=" + PackNo + " and F_LINKNO=" + CurLinkNo; obj = DBOpt.dbHelper.ExecuteScalar(_sql); if (obj == null) { //JScript.Alert("无法找到业务表的记录编号!"); return; } RecNo = Convert.ToInt16(obj); DataTable docType = DBOpt.dbHelper.GetDataTable("select a.f_no,a.f_formfile,a.f_tablename,a.f_target from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and b.f_packtypeno=" + PackTypeNo + " and b.F_LINKNO=" + CurLinkNo); if (docType == null || docType.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); return; } Session["sended"] = "0"; Session["Oper"] = "0"; //不允许修改数据 Response.Redirect(docType.Rows[0][1].ToString() + "?RecNo=" + RecNo + @"&BackUrl=" + Page.Request.RawUrl + "&PackTypeNo=" + PackTypeNo + "&PackNo=" + PackNo + "&CurLinkNo=" + CurLinkNo + "&CurWorkFlowNo=" + CurWorkFlowNo); } }
protected void BtnSubmit_Click(object sender, EventArgs e) { //摸拟用户登录验证(帐号、密码于web.config中) //真实环境此处应通过数据库进行验证 string strAccount = this.UserName.Text; string strPassport = this.UserPwd.Text; string strWebSiteName = String.Empty; if (OAuthByLDAP) { OAuthLDAP = System.Configuration.ConfigurationManager.AppSettings["OAuthLDAP"]; isValidUser = ADHelper.TryAuthenticate(OAuthLDAP, strAccount, strPassport); //IdentityImpersonation Login = new IdentityImpersonation(strAccount, strPassport, LDAP); //Login.BeginImpersonate(); } else { isValidUser = this.UserName.Text == System.Configuration.ConfigurationManager.AppSettings["Acount"] && this.UserPwd.Text == System.Configuration.ConfigurationManager.AppSettings["PassWord"]; } if (isValidUser) { //产生令牌 string tokenValue = this.getGuidString(); HttpCookie tokenCookie = new HttpCookie("Token"); tokenCookie.Values.Add("Value", tokenValue); //获取验证站点域名 "www.passport.com"; tokenCookie.Domain = strCookieDomain ?? Net.Common.GetRequest.GetCurrentDomain(); Response.AppendCookie(tokenCookie); HttpCookie AccountCookie = new HttpCookie("AccountID"); AccountCookie.Values.Add("Value", strAccount); Response.AppendCookie(AccountCookie); //HttpCookie PassportCookie = new HttpCookie("Passport"); //PassportCookie.Values.Add("Value", strPassport); //Response.AppendCookie(PassportCookie); OAuthToken OAuth = new OAuthToken { ID = 0 , UserAgent = Request.UserAgent , isLocked = false , AccountID = strAccount , AccountName = strAccount , PassWords = strPassport , TokenVal = tokenValue , WebSiteName = strWebSiteName , RedirectURL = "" , ReturnURL = "" , LogInDtime = DateTime.Now.ToString() , LogOutDtime = DateTime.Now.AddMinutes(1).ToString() , LogInIP = GetRequest.GetClientIP() // "172.0.0.1" + Request.UserAgent }; //产生主站凭证 object info = true; TokenCache.Insert(tokenValue, OAuth.Serializer(), DateTime.Now.AddMinutes(double.Parse(System.Configuration.ConfigurationManager.AppSettings["Timeout"]))); TopLoginWindows.Visible = false; TopLoginAccount.Visible = true; LiUserAccount.Text = strAccount; //JScript.Alert(this, "BackURL"); //跳转回分站 if (Request.QueryString["BackURL"] != null) { //JScript.Alert(this, Request.QueryString["BackURL"]); Response.Redirect(Server.UrlDecode(Request.QueryString["BackURL"])); } else { //JScript.Alert(this, OAuthDefaultURL); if (OAuthDefaultURL.NotIsNullOrEmpty()) { Response.Redirect(OAuthDefaultURL); } } } else { JScript.Alert(this, "抱歉,帐号或密码有误!请正确输入域账号或密码"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["sended"] != null) { if (Session["sended"].ToString() == "1" && ViewState["BackUrl"] != null) { Response.Redirect(ViewState["BackUrl"].ToString()); } } if (!IsPostBack) { PageControlLocalizationText pl = new PageControlLocalizationText(this); pl.SetListPageControlLocalizationText(); lblFuncName.Text = GetLocalResourceObject("PageResource1.Title").ToString(); if (Request["BackUrl"] != null) { ViewState["BackUrl"] = Server.UrlDecode(Request["BackUrl"]); } else { ViewState["BackUrl"] = null; } object obj = null; if (Request["PackTypeNo"] != null && Request["CurLinkNo"] != null) //从工作流界面打开,肯定有PackTypeNo和CurLinkNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["CurLinkNo"] = Request["CurLinkNo"]; if (Request["PackNo"] != null) { ViewState["PackNo"] = Request["PackNo"]; _sql = "select f_recno from DMIS_SYS_DOC where f_packno=" + Request["PackNo"] + " and f_linkno=" + Request["CurLinkNo"]; ViewState["RecNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["RecNo"] == null) { //JScript.Alert("业务表的记录号,请联系管理员!"); return; } } else { ViewState["RecNo"] = -1; } if (Request["CurWorkFlowNo"] != null) { ViewState["CurWorkFlowNo"] = Request["CurWorkFlowNo"]; } } else //从业务表查询界面打开,有PackTypeNo、TableName、RecNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["TableName"] = Request["TableName"]; ViewState["RecNo"] = Request["RecNo"]; _sql = "select F_PACKNO from DMIS_SYS_DOC where f_tablename='" + Request["TableName"].ToString() + "' and f_recno=" + ViewState["RecNo"].ToString(); ViewState["PackNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["PackNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("select f_no from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='1'"); if (obj != null) //在办的业务 { ViewState["CurWorkFlowNo"] = obj; } else { _sql = "select max(f_no) from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='2'"; //归档的业务,最后的环节 ViewState["CurWorkFlowNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); } ViewState["CurLinkNo"] = DBOpt.dbHelper.ExecuteScalar("select f_flowno from DMIS_SYS_WORKFLOW where f_no=" + ViewState["CurWorkFlowNo"].ToString()); } else //查看历史数据,不能操作任何 { btnSave.Enabled = false; btnSaveClose.Enabled = false; btnSend.Enabled = false; btnWithdraw.Enabled = false; btnAccept.Enabled = false; CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_ZDH_DEVICE_FAULT", "TID=" + ViewState["RecNo"].ToString()); return; } } //找当前环节对应的文档 _sql = "select a.f_no,a.f_name,a.f_tablename,a.f_reportfile from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and a.f_packtypedef=1 and b.f_packtypeno=" + ViewState["PackTypeNo"].ToString() + " and b.F_LINKNO=" + ViewState["CurLinkNo"].ToString(); DataTable temp = DBOpt.dbHelper.GetDataTable(_sql); if (temp == null || temp.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); //"没有找到对应的文档!" return; } else { ViewState["DocTypeNo"] = temp.Rows[0][0]; //文档编号 ViewState["DocTypeName"] = temp.Rows[0][1]; //文档名称 ViewState["TableName"] = temp.Rows[0][2]; //文档对应的数据库表名称 ViewState["REPORT_ID"] = temp.Rows[0][3]; //报表编号 } int counts; btnSave.Enabled = false; btnSaveClose.Enabled = false; btnSend.Enabled = false; btnWithdraw.Enabled = false; btnAccept.Enabled = false; btnWithdraw.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmWithdraw").ToString() + "');"); //确定要退回到上一步? btnAccept.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmAccept").ToString() + "');"); //确定要接单? if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) //管理员开放本业务类型所涉及的所有业务表修改数据的权限,但不能发送、回退。不参与流转的处理 { btnSave.Enabled = true; btnSaveClose.Enabled = true; _sql = "select f_tablename from dmis_sys_doctype where f_packtypeno=" + ViewState["PackTypeNo"].ToString(); //本业务所涉及到的所有业务表 DataTable AllTables = DBOpt.dbHelper.GetDataTable(_sql); for (int i = 0; i < AllTables.Rows.Count; i++) { WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), AllTables.Rows[i][0].ToString()); } } else { if (Session["Oper"] != null) { if (Convert.ToInt16(Session["Oper"]) > 0) //有权限修改 { WebWorkFlow.SetWebControlRight(this.Page, Session["RoleIDs"].ToString(), Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), ViewState["TableName"].ToString()); btnSave.Enabled = true; btnSaveClose.Enabled = true; btnSend.Enabled = true; btnWithdraw.Enabled = true; //如果是最后一步,则弹出是否要归档的窗口 string sMainer = ""; if (ViewState["CurWorkFlowNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); } if (obj != null) { sMainer = obj.ToString(); } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');"); //确定要提交到下一步?(新建业务时。) } if (sMainer == Session["MemberName"].ToString()) { int iCat = -1; if (ViewState["CurLinkNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_FLOWCAT FROM DMIS_SYS_FLOWLINK WHERE F_NO=" + ViewState["CurLinkNo"]); if (obj != null) { iCat = Convert.ToInt16(obj); } } if (iCat == 2) { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmFinish").ToString() + "');");//该项目已办理完成,是否要归档? } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');");//确定要提交到下一步 } } } else //待办的状态下处理接单按钮 { int flag = -1; //判断是否接单 obj = DBOpt.dbHelper.ExecuteScalar("select f_working from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { flag = Convert.ToInt16(obj); } if (flag == 0) //待办状态 { string zbr = ""; obj = DBOpt.dbHelper.ExecuteScalar("select f_receiver from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { zbr = obj.ToString().Trim(); } if (zbr == "" || zbr == Session["MemberName"].ToString()) { btnAccept.Enabled = true; } } else if (flag == 1) //从办人员点击进入状态,只能提交 { if (WebWorkFlow.IsCongBanRen(ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), Session["MemberName"].ToString())) { btnSend.Enabled = true; } } else { btnAccept.Enabled = false; } } } } FillDropDownList.FillByTable(ref ddlDD_STATION, "DMIS_SYS_STATION", "NAME", "TID"); FillDropDownList.FillByTable(ref ddlXT_TYPE, "T_ZDH_DEVICE_XT_TYPE", "TYPE_NAME", "TID", "ORDER_ID ASC"); FillDropDownList.FillByTable(ref ddlYD_TYPE, "T_ZDH_DEVICE_XT_TYPE", "TYPE_NAME", "TID", "ORDER_ID ASC"); if (Convert.ToInt32(ViewState["RecNo"]) > -1) { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, "T_ZDH_DEVICE_FAULT", "TID=" + ViewState["RecNo"].ToString()); if (!SetRight.IsAdminitrator(Session["MemberID"].ToString())) //不是管理员才设置初始人员及日期,否则会把管理员的名称也赋值给相应的控件 { //设置初始人名,主办人,从办人在后面设置 string[] name = { "txtXT_JDR", "txtYD_JDR", "txtYS_YSR" }; TextBox txt; for (int i = 0; i < name.Length; i++) { txt = (TextBox)Page.FindControl(name[i]); if (txt == null) { continue; } if (!txt.ReadOnly && txt.Text == "") { txt.Text = Session["MemberName"].ToString(); } } //设置初始日期 string[] date = { "wdlXT_XDSJ", "wdlYD_JDSJ", "wdlYS_YSRQ" }; WebDate wdl; for (int i = 0; i < date.Length; i++) { wdl = (WebDate)Page.FindControl(date[i]); if (wdl == null) { continue; } if (wdl.Enabled && wdl.Text == "") { wdl.setTime(DateTime.Now); } } } //设置从办人员的姓名,这样不用两次输入办理人员的姓名 DataTable memberStatus = DBOpt.dbHelper.GetDataTable("select f_receiver from dmis_sys_memberstatus where f_packno=" + ViewState["PackNo"].ToString() + " and f_workflowno=" + ViewState["CurWorkFlowNo"].ToString()); for (int i = 0; i < memberStatus.Rows.Count; i++) { if (!txtXT_JDR.ReadOnly) { if (i == 0) { if (txtXT_JDR2.Text == "") { txtXT_JDR2.Text = memberStatus.Rows[i][0].ToString(); } } else if (i == 1) { if (txtXT_JDR3.Text == "") { txtXT_JDR3.Text = memberStatus.Rows[i][0].ToString(); } } else if (i == 2) { if (txtXT_JDR4.Text == "") { txtXT_JDR4.Text = memberStatus.Rows[i][0].ToString(); } } } else if (!txtYD_JDR.ReadOnly) { if (i == 0) { if (txtYD_JDR2.Text == "") { txtYD_JDR2.Text = memberStatus.Rows[i][0].ToString(); } } else if (i == 1) { if (txtYD_JDR3.Text == "") { txtYD_JDR3.Text = memberStatus.Rows[i][0].ToString(); } } else if (i == 2) { if (txtYD_JDR4.Text == "") { txtYD_JDR4.Text = memberStatus.Rows[i][0].ToString(); } } } } } else //新增时,确定缺陷编号 { _sql = "select count(*) from T_ZDH_DEVICE_FAULT where to_char(DD_DATEM,'YYYYMM')='" + DateTime.Now.ToString("yyyyMM") + "'"; counts = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar(_sql)) + 1; txtDD_PH.Text = DateTime.Now.ToString("yyyyMM") + counts.ToString("000"); txtDD_FINDER.Text = Session["MemberName"].ToString(); wdlDD_DATEM.setTime(DateTime.Now); } } }
protected void btnSaveClose_Click(object sender, EventArgs e) { if (txtWorkflowID.Text == "" || txtWorkshopID.Text == "" || txtWorkOrder.Text == "") { JScript.Alert("请输入工单按回车", this); return; } if (txtLotLength.Text == "" || txtLotWidth.Text == "") { JScript.Alert("请输入批次长度和批次宽度", this); return; } DataTable viewdt = (DataTable)ViewState["dt"]; if (viewdt.Rows.Count <= 0) { JScript.Alert("请先生成PET编号,在文本框输入数量按回车!", this); return; } //循环datatable插入lotbasis for (int i = 0; i <= grd.Rows.Count - 1; i++) { //CheckBox cbx = (CheckBox)grd.Rows[i].FindControl("cbx"); //if (cbx.Checked == true) //{ // //result = EqpManage.Delete(grd.Rows[i].Cells[1].Text); // //if (result != "success") // //{ // // JScript.Alert("删除设备!", this); // //} //} LotBasisDatalist dl = new LotBasisDatalist(); dl.flowid = txtWorkflowID.Text; dl.workshopid = txtWorkshopID.Text; dl.lottype = "Film"; dl.status = "Active"; dl.createuser = System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(); dl.currentflowidno = "0"; dl.factoryid = ""; dl.workorder = txtWorkOrder.Text;//ddlWorkorder.SelectedValue; dl.reworkorder = ""; dl.lotid = grd.Rows[i].Cells[0].Text; dl.lotcount = "1"; dl.Filmlevel = "A"; //创建批次增加宽度和长度记录 //批次长宽改为手动输入 modify by lei.xue on 2017-4-12================================================ //dl.length = txtMouldLength.Text; //dl.restlength = txtMouldLength.Text; //dl.width = txtMouldWidth.Text; //dl.restwidth = txtMouldWidth.Text; dl.length = txtLotLength.Text; dl.restlength = txtLotLength.Text; dl.width = txtLotWidth.Text; dl.restwidth = txtLotWidth.Text; //增加有效长度 dl.validlength = txtLotLength.Text; dl.validwidth = txtLotWidth.Text; string result = CreateMouldLot.InsertLot(dl); if (result != "success") { JScript.Alert(result, this); return; } string WOStatusResult = CreateLot.ChangWOStatus(txtWorkOrder.Text, "open"); if (WOStatusResult != "success") { JScript.Alert("开启工单失败!", this); return; } JScript.Alert("创建PET膜序列号成功!", this); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>PrintLabel();</script>"); //CreateTable(); //databind(); //txtLotCount.Text = ""; } }
protected void btnSave_Click(object sender, EventArgs e) { string re; //系统管理员只修改所有文档对就的业务表的数据,但不产生新的记录。 //2009-3-25 用户要求修改缺陷单的级别时,同时要修改业务流任务的描述。 if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) { DataTable doc = DBOpt.dbHelper.GetDataTable("select distinct f_tablename,f_recno from dmis_sys_doc where f_packno=" + ViewState["PackNo"].ToString()); for (int i = 0; i < doc.Rows.Count; i++) { re = ControlWebValidator.Validate(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, doc.Rows[i][0].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } else { //2009-3-25 修改业务流任务的描述 int packNO; if (ViewState["PackNo"] != null && int.TryParse(ViewState["PackNo"].ToString(), out packNO)) { string station = ""; string planStarttime = wdlDD_DATEM.getTime().ToString("dd-MM-yyyy HH:mm"); double planHours = 0; if (ddlDD_TYPE.SelectedItem.Text == "Commonly") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Commonly"]); } else if (ddlDD_TYPE.SelectedItem.Text == "Importance") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Importance"]); } else if (ddlDD_TYPE.SelectedItem.Text == "Urgency") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Urgency"]); } string desc = "(" + ddlDD_TYPE.SelectedItem.Text + txtDD_PH.Text + ")" + txtDD_FAULT.Text.Trim(); //任务描述 desc = desc.Replace('\'', '‘'); desc = desc.Replace('"', '“'); string planEndtime = wdlDD_DATEM.getTime().AddHours(planHours).ToString("dd-MM-yyyy HH:mm"); if (ddlDD_STATION.SelectedItem != null) { station = ddlDD_STATION.SelectedItem.Text; } _sql = "update DMIS_SYS_PACK set f_desc='" + desc + "',plan_endtime='" + planEndtime + "' where f_no=" + packNO; DBOpt.dbHelper.ExecuteSql(_sql); } tdMessage.InnerText = ""; } } return; } //其它人员处理业务时保存 bool isAdd = false; if (txtTID.Text == "") { isAdd = true; //判断是否是新增的,保存之后,txtTID会有值,故在此判断 } re = ControlWebValidator.Validate(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } re = CustomControlSave.CustomControlSaveByTableNameReturnS(this.Page, ViewState["TableName"].ToString()); if (re != "") { JScript.Alert(re); tdMessage.InnerText = re; return; } tdMessage.InnerText = ""; //第一次保存时,生成工作流数据 if (isAdd) { uint packNo = 0; string station = ""; string planStarttime = wdlDD_DATEM.getTime().ToString("dd-MM-yyyy HH:mm"); double planHours = 0; if (ddlDD_TYPE.SelectedItem.Text == "Commonly") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Commonly"]); } else if (ddlDD_TYPE.SelectedItem.Text == "Importance") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Importance"]); } else if (ddlDD_TYPE.SelectedItem.Text == "Urgency") { planHours = Convert.ToDouble(ConfigurationManager.AppSettings["Urgency"]); } string desc = "(" + ddlDD_TYPE.SelectedItem.Text + txtDD_PH.Text + ")" + txtDD_FAULT.Text.Trim(); //任务描述 string planEndtime = wdlDD_DATEM.getTime().AddHours(planHours).ToString("dd-MM-yyyy HH:mm"); if (ddlDD_STATION.SelectedItem != null) { station = ddlDD_STATION.SelectedItem.Text; } if (WebWorkFlow.CreatePack(Convert.ToInt32(ViewState["PackTypeNo"]), desc, Session["MemberName"].ToString(), ref packNo, station, planStarttime, planEndtime) < 0) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString()); //创建业务数据失败! tdMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertInstanceFailMessage").ToString(); return; } int iFirstFlowNo = -1; int iWorkFlowNo = -1; iFirstFlowNo = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar("select F_NO from DMIS_SYS_FLOWLINK where F_PACKTYPENO=" + ViewState["PackTypeNo"] + " and F_FLOWCAT=0")); bool bCreated = WebWorkFlow.CreateFlow(Convert.ToInt16(packNo), ref iWorkFlowNo, Session["MemberName"].ToString(), iFirstFlowNo, "", Session["MemberName"].ToString(), "", txtTID.Text); //第一次新建流程时,传接从办人的姓名列表 if (!bCreated) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString());//创建工作流数据失败! tdMessage.InnerText = GetGlobalResourceObject("WebGlobalResource", "WkInsertTaskFailMessage").ToString(); return; } ViewState["PackNo"] = packNo; ViewState["CurWorkFlowNo"] = iWorkFlowNo; ViewState["CurLinkNo"] = iFirstFlowNo; ViewState["RecNo"] = txtTID.Text; //增加PACK_NO值 _sql = "update " + ViewState["TableName"].ToString() + " set PACK_NO=" + packNo + " where TID=" + txtTID.Text; DBOpt.dbHelper.ExecuteSql(_sql); } //只有用户保存了,确认它接收此任务了。 //修改已经接收的状态,使此业务不能抽回 if (ViewState["CurWorkFlowNo"] != null && Convert.ToInt16(ViewState["CurWorkFlowNo"]) > 0) { object obj = DBOpt.dbHelper.ExecuteScalar("select f_working from dmis_sys_workflow where f_no=" + ViewState["CurWorkFlowNo"]); if (obj == null || Convert.ToInt16(obj) == 0) //已经接收的,允许再接收 { _sql = "update dmis_sys_workflow set f_working=1,f_receiver='" + Session["MemberName"].ToString() + "',f_receivedate='" + DateTime.Now.ToString("dd-MM-yyyy HH:mm") + "' where f_no=" + ViewState["CurWorkFlowNo"]; DBOpt.dbHelper.ExecuteSql(_sql); } } }
protected void btnImport_Click(object sender, EventArgs e) { if (fileUp.HasFile == false)//HasFile用来检查FileUpload是否有指定文件 { JScript.Alert("请您选择Excel文件"); return; } string IsXls = System.IO.Path.GetExtension(fileUp.FileName).ToString().ToLower();//System.IO.Path.GetExtension获得文件的扩展名 if (IsXls != ".xls") { JScript.Alert("只可以选择Excel文件"); return; } //获取Execle文件名 DateTime日期函数 string filename = fileUp.FileName; //Server.MapPath 获得虚拟服务器相对路径 string savePath = Server.MapPath(("upfiles\\") + filename); //SaveAs 将上传的文件内容保存在服务器上 fileUp.SaveAs(savePath); //连接Excel 读取Excel数据 并返回DataSet数据集合 DataSet ds = GridViewExportUtil.ExcelSqlConnection(savePath, filename, "com.sac.platform.action.report"); //com.sac.platform.action.report //定义一个DataRow数组 DataRow[] dr = ds.Tables[0].Select(); int rowsnum = ds.Tables[0].Rows.Count; if (rowsnum == 0) { JScript.Alert("Excel表为空表,无数据!"); } else { List <UnitConsumeInfo> infoList = new List <UnitConsumeInfo>(); DateTime dt = DateTime.Parse((dr[0][2].ToString().Replace("年", "-").Replace("月", "-") + "01")); for (int i = 2; i < dr.Length - 1; i++) { UnitConsumeInfo info = new UnitConsumeInfo(); if (String.IsNullOrEmpty(dr[i][0].ToString())) { continue; } info.T_TIME = dt; info.T_DWNAME = dr[i][1].ToString().Trim(); info.T_COUNT = dr[i][2].ToString(); info.T_CYDL = dr[i][14].ToString(); //对标煤耗暂时不计算。 info.T_DBMH = dr[i][2].ToString(); info.T_GDL = dr[i][20].ToString(); info.T_GDMH = dr[i][23].ToString(); //与集团平均,暂时不计算。 info.T_JTPJB = dr[i][1].ToString(); info.T_OF = dr[i][61].ToString(); info.T_RDB = dr[i][46].ToString(); info.T_UNITCODE = dr[i][0].ToString().Trim(); info.T_USEHOUR = dr[i][8].ToString(); infoList.Add(info); } try { if (bc.InsertChartDetailData(infoList, out errMsg)) { JScript.Alert("Excle表导入成功"); } else { JScript.Alert("Excle表导入失败"); } } catch { JScript.Alert("Excle表导入失败"); } } }
protected void btnSend_Click(object sender, EventArgs e) { //提交前先保存 btnSave_Click(null, null); if (tdMessage.InnerText != "") { return; } string returnString = ""; //发送前条件判断 returnString = WebWorkFlow.TacheSendCondition(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); if (returnString.Length > 0) { JScript.Alert(returnString); tdMessage.InnerText = returnString; return; } string sMainer = ""; object obj; obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { sMainer = obj.ToString(); } if (sMainer == Session["MemberName"].ToString()) //主办人发送 { int iCat = -1; obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_FLOWCAT FROM DMIS_SYS_FLOWLINK WHERE F_NO=" + ViewState["CurLinkNo"]); if (obj != null) { iCat = Convert.ToInt16(obj); } if (iCat == 2) { int iFno = WebWorkFlow.EndFlow(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString()); if (iFno == -1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkFinishFailMessage").ToString());//此业务归档失败,请联系统管理员! return; } else { //JScript.Alert("此业务归档成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } } else { string paras; //发送岗位时,派工环节,弹出发送窗口 if (WebWorkFlow.IsAssignTache(Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]))) { paras = "PackTypeNo=" + ViewState["PackTypeNo"] + "&CurLinkNo=" + ViewState["CurLinkNo"] + "&PackNo=" + ViewState["PackNo"] + "&CurWorkFlowNo=" + ViewState["CurWorkFlowNo"] + "&TableName=" + ViewState["TableName"].ToString() + "&RecNo=" + ViewState["RecNo"].ToString(); Session["sended"] = 0; JScript.OpenWindow("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=670,height=500,top=20,left=100"); //Response.Write(webfun.OpenWin("../SYS_WorkFlow/AssignTaskWindow.aspx?" + paras, "发送窗", "scrollbars=yes,width=700,height=480,top=20,left=100")); } else //非派工环节,直接发送即可 { int curTaskID = Convert.ToInt16(ViewState["CurWorkFlowNo"]); if (WebWorkFlow.DirectCreateFlow(Convert.ToInt16(ViewState["PackNo"]), ref curTaskID, Session["MemberName"].ToString())) { //两种统计时间的方法,看用户用何种 //1、根据工作流的相关表DMIS_SYS_WORKFLOW DMIS_SYS_MEMBERSTATUS来统计实际工作时间 //WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["CurLinkNo"].ToString(), // ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), ViewState["TableName"].ToString(), ViewState["RecNo"].ToString()); //2、根据业务表保存的人名来统计实际工作时间 string[] members = new string[4]; if (!txtXT_JDR.ReadOnly) //统计系统人员工作时间 { members[0] = txtXT_JDR.Text; members[1] = txtXT_JDR2.Text; members[2] = txtXT_JDR3.Text; members[3] = txtXT_JDR4.Text; WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["PackNo"].ToString(), "24", ViewState["TableName"].ToString(), ViewState["RecNo"].ToString(), "否", members); } else if (!txtYD_JDR.ReadOnly) //统计远动人员工作时间 { members[0] = txtYD_JDR.Text; members[1] = txtYD_JDR2.Text; members[2] = txtYD_JDR3.Text; members[3] = txtYD_JDR4.Text; WebWorkFlow.StatisicFactuslTimes(ViewState["PackTypeNo"].ToString(), ViewState["PackNo"].ToString(), "25", ViewState["TableName"].ToString(), ViewState["RecNo"].ToString(), "是", members); } Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString());//"此任务发送失败,请联系统管理员!" return; } } } } else { //从办人员提交,只是结束其办理状态 if (WebWorkFlow.EndMemberStatus(Convert.ToInt16(ViewState["PackNo"]), Convert.ToInt16(ViewState["CurWorkFlowNo"]), Session["MemberName"].ToString())) { //JScript.Alert("提交成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } else { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkSubmitFailMessage").ToString()); //更新状态失败! } } }
protected void btnEnter_Click(object sender, EventArgs e) { //查询是否可以过站 string result = CRUD.QueryStationOfLot(lblWorksiteID.Text, txtLot.Text); if (result != "success") { JScript.Alert(result, this); txtLot.Text = ""; return; } DataTable lotDt = CRUD.GetLotBasisInfo(txtLot.Text); ViewState["lotDt"] = lotDt; string workshop = lotDt.Rows[0]["workshopID"].ToString(); setddl(workshop); string WO = lotDt.Rows[0]["workorder"].ToString(); ViewState["WO"] = WO; #region 批次流程 //查询批次流程 CRUD.setLabelProcess(lblLotprocess, lblCurrnentWorksite, lblEndProcess, txtLot.Text, lblWorksiteID.Text); #endregion DataTable dt = CRUD.GetWorkflow(txtLot.Text); string firstWorksiteID = dt.Rows[0]["worksiteid"].ToString(); //第一个站点从工单获取; if (lblWorksiteID.Text == firstWorksiteID) { //查询工单中的长、宽 dt.Clear(); dt = CreateLot.QueryWorkorderIno(WO); txtPreLength.Text = dt.Rows[0]["mouldlength"].ToString(); txtPreWidth.Text = dt.Rows[0]["mouldwidth"].ToString(); } else { //批次已过站点 string WorksiteIDOfLot = CRUD.GetWorksite2(txtLot.Text); //查询前站的长宽 dt.Clear(); dt = CRUD.getStationInfo(txtLot.Text, WorksiteIDOfLot); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["paratype"].ToString() == "MouldLength") { txtPreLength.Text = dt.Rows[i]["paraid"].ToString(); } if (dt.Rows[i]["paratype"].ToString() == "MouldWidth") { txtPreWidth.Text = dt.Rows[i]["paraid"].ToString(); } } } //查询母批的长度宽度及其剩余量 //FilmCRUD.GetPreLengthAndWidth(txtPreLength, txtPreWidth, txtLot.Text, lblWorksiteID.Text, WO, ""); //txtRestLength.Text = lotDt.Rows[0]["restlength"].ToString(); //txtPreLength.Text = lotDt.Rows[0]["mouldlength"].ToString(); //txtPreWidth.Text = lotDt.Rows[0]["mouldwidth"].ToString(); //=======前站宽幅长度和剩余长度取有效值 modify by lei.xue on 2017-6-1================ txtRestLength.Text = lotDt.Rows[0]["restlength"].ToString(); txtPreLength.Text = lotDt.Rows[0]["validlength"].ToString(); txtPreWidth.Text = lotDt.Rows[0]["validwidth"].ToString(); //==========标签增加产品类型 add by lei.xue on 2017-5-20================ txtProductType.Text = lotDt.Rows[0]["producttype"].ToString(); //生成条码 LabelInfo(ddlEqp.SelectedValue.ToString().Substring(0, 3)); }
protected void btnEnter_Click(object sender, EventArgs e) { //查询是否可以过站 string result = CRUD.QueryStationOfLot(lblWorksiteID.Text, txtLot.Text); if (result != "success") { JScript.Alert(result, this); txtLot.Text = ""; return; } //是否进站 //result = CRUD.CheckInIsOK(txtLot.Text, lblWorksiteID.Text); //if (result != "success") //{ // JScript.Alert("批次尚未进站!", this); // txtLot.Text = ""; // return; //} string MouldLot = txtLot.Text; string workshop = ""; string eqp = ""; DataTable ResDt = CRUD.GetCheckInInfo(MouldLot, lblWorksiteID.Text); if (ResDt.Rows.Count > 0) { //返工后重复过站 if (ResDt.Rows[0]["rework"].ToString() == "Y") { DataTable dtCheckInIsOK = CRUD.CheckInIsOK(MouldLot, lblWorksiteID.Text); if (dtCheckInIsOK.Rows.Count > 0) { workshop = dtCheckInIsOK.Rows[0]["workshopid"].ToString(); eqp = dtCheckInIsOK.Rows[0]["eqpid"].ToString(); } else { JScript.Alert("该批次尚未进站!", this); return; } } else { eqp = ResDt.Rows[0]["eqpid"].ToString(); workshop = ResDt.Rows[0]["workshopid"].ToString(); } } else { JScript.Alert("批次尚未进站", this); return; } //绑定checkin时的信息 //ddlWorkshop.ClearSelection(); //ddlWorkshop.Items.FindByValue(workshop).Selected = true; //ddlEqp.ClearSelection(); //ddlEqp.Items.FindByValue(eqp).Selected = true; //txtWorkshop.Text = workshop; //txtEqp.Text = eqp; //锁定机台和车间选项 //ddlEqp setddl(workshop, eqp); //查询批次流程 CRUD.setLabelProcess(lblLotprocess, lblCurrnentWorksite, lblEndProcess, txtLot.Text, lblWorksiteID.Text); //生成模具编号:规则:模具编号+类型[Z]+年月日—001Z170118 DataTable dt = CRUD.GetWorkflow(txtLot.Text); string type = dt.Rows[0]["flowid"].ToString(); if (type == "flow001" || type == "flow002") { txtLabelInfo.Text = txtLot.Text + "Z" + System.DateTime.Now.ToString("yyMMdd"); } else if (type == "flow003") { txtLabelInfo.Text = txtLot.Text + "W" + System.DateTime.Now.ToString("yyMMdd"); } }
protected void btnEnter_Click(object sender, EventArgs e) { string originalLot = ""; //UV成型改为分批 注释检查是否打印代码 modify by lei.xue on 2017-3-27====================================== //判断是否是UV成型的条码 //string check = CRUD.CheckFilmLabel("UV成型", txtLot.Text); //if (check != "fail") //{ // originalLot = check; //} //else //{ // originalLot = txtLot.Text; //} ViewState["originalLot"] = txtLot.Text;//originalLot originalLot = txtLot.Text; //查询是否可以过站 string result = CRUD.QueryStationOfLot(lblWorksiteID.Text, originalLot); if (result != "success") { JScript.Alert(result, this); txtLot.Text = ""; return; } DataTable lotDt = CRUD.GetLotBasisInfo(originalLot); string workshop = lotDt.Rows[0]["workshopID"].ToString(); //保存批次号lotbasis信息 modify by lei.xue on 2017-2-20 ViewState["lotDt"] = lotDt; setddl(workshop); string WO = lotDt.Rows[0]["workorder"].ToString(); ViewState["WO"] = WO; #region 批次流程 //查询批次流程 CRUD.setLabelProcess(lblLotprocess, lblCurrnentWorksite, lblEndProcess, originalLot, lblWorksiteID.Text); #endregion ////查询工单中的长、宽 //dt.Clear(); //dt = CreateLot.QueryWorkorderIno(WO); //txtPreLength.Text = dt.Rows[0]["mouldlength"].ToString(); //txtPreWidth.Text = dt.Rows[0]["mouldwidth"].ToString(); //查询前站的长宽 //批次已过站点 //UV成型分批,注释获取母批为UV成型条码的逻辑 modify by lei.xue on 2017-3-28==================================================== //查询母批的长度宽度及其剩余量 //if (check != "fail")// 母批为UV成型的条码 //{ // FilmCRUD.GetPreLengthAndWidth(txtPreLength, txtPreWidth, originalLot, lblWorksiteID.Text, WO, ""); //} //else //{ // //母批为贴膜的条码 // txtPreLength.Text = lotDt.Rows[0]["mouldlength"].ToString(); // txtPreWidth.Text = lotDt.Rows[0]["mouldwidth"].ToString(); //} txtPreLength.Text = lotDt.Rows[0]["mouldlength"].ToString(); txtPreWidth.Text = lotDt.Rows[0]["mouldwidth"].ToString(); txtRestWidth.Text = lotDt.Rows[0]["restwidth"].ToString(); //生成条码 //LabelInfo(ddlEqp.SelectedValue.ToString().Substring(0, 3)); }
protected void btnSaveClose_Click(object sender, EventArgs e) { //string result = CRUD.FilmCheckOut(ViewState["originalLot"].ToString(), txtLot.Text, ddlEqp.SelectedValue, ddlWorkshop.SelectedValue, // lblWorksiteID.Text, // System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), // ddlFilmLevel.SelectedValue); //string resultLevel = ""; //if (cbxUpdateLevel.Checked == true) //{ // resultLevel = CRUD.updateFilmLevel(txtFilmLevel.Text, // ddlFilmLevel.SelectedValue, // ViewState["originalLot"].ToString(), // System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), // lblWorksiteID.Text // ); //} string strCheck = ""; //存放检验结果变量 string strFilmLevel = ""; //模具等级变量 string result = CRUD.FilmCheckOut(ViewState["originalLot"].ToString(), txtLot.Text, ddlEqp.SelectedValue, ddlWorkshop.SelectedValue, lblWorksiteID.Text, System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), ddlFilmLevel.SelectedValue); string resultLevel = ""; if (cbxUpdateLevel.Checked == true)//膜检验结果为NG { strCheck = "NG"; strFilmLevel = ddlFilmLevel.SelectedValue; resultLevel = CRUD.updateFilmLevel(txtFilmLevel.Text, ddlFilmLevel.SelectedValue, ViewState["originalLot"].ToString(), System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), lblWorksiteID.Text ); } else { strCheck = "OK"; strFilmLevel = txtFilmLevel.Text; } #region//检验项目===================================================================================== AGCoatingQCDatalist Datalist = new AGCoatingQCDatalist(); //外观 //1外观左 Datalist.appearanceleft = txtAppearanceLeft.Text; //2外观右 Datalist.appearanceright = txtAppearanceRight.Text; Datalist.appearanceresult = ddlAvailableWidthResult.SelectedValue; //可用宽幅 Datalist.availablewidth = txtAvailableWidth.Text; Datalist.availablewidthresult = ddlAvailableWidthResult.SelectedValue; //纹路 Datalist.lines = txtLines.Text; Datalist.linesresult = ddlLinesResult.Text; //正面保护膜张力 Datalist.FrontTension = txtFrontTension.Text; Datalist.FrontTensionResult = ddlFrontTensionResult.Text; //背面保护膜张力 Datalist.BackTension = txtBackTension.Text; Datalist.BackTensionResult = ddlBackTensionResult.Text; //点线 Datalist.dotline = txtDotLine.Text; Datalist.dotlineResult = ddlDotLineResult.Text; //string QCResult = AGCoatingCheck.CheckInfo(txtLot.Text, // ddlEqp.SelectedValue, // lblWorksiteID.Text, // strCheck, // System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), // strFilmLevel, // Datalist // ); string QCResult = PasteFilmCheck.CheckInfo(txtLot.Text, ddlEqp.SelectedValue, lblWorksiteID.Text, strCheck, System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), strFilmLevel, Datalist ); if (QCResult == "fail") { JScript.Alert("记录检验项目失败", this); return; } #endregion //跳分条流程 if (CbxChangeFlow.Checked == true) { string UpdataFlow = ""; UpdataFlow = FilmCRUD.QuerySubsectionFlowID(txtLot.Text); string resultFlow = CRUD.ChangLotWorkflow(UpdataFlow, txtLot.Text); if (resultFlow != "success") { JScript.Alert("变更产品流程出错!", this); return; } } if (result == "success" && resultLevel != "fail") { //JScript.Alert("UV成型检验过站成功!", this); JScript.AlertAndRedirect("贴膜检验过站成功!", "PasteFilmCheck.aspx", this); //ClearInfo(); return; } else { JScript.Alert("贴膜检验过站失败!", this); return; } }
protected void Article_Command(object sender, CommandEventArgs e) { string strConnection = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString; OleDbConnection objConnection = new OleDbConnection(strConnection); objConnection.Open(); using (objConnection) { int actionNeedAuthority = 1; switch (e.CommandName) { case "doEdit": break; case "doUpdate": break; case "doDelete": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { string strSQL = "UPDATE LYTable SET LYDelete=true WHERE 编号=" + e.CommandArgument.ToString(); OleDbCommand command = new OleDbCommand(strSQL, objConnection); if (command.ExecuteNonQuery() > 0) { MyBasePage.writeLog(Session["userName"].ToString(), "删除新闻或通知,操作对象ID:" + e.CommandArgument.ToString()); JScript.AlertAndRedirect("该新闻或通知已删除", "", this); } else { MyBasePage.writeLog(Session["userName"].ToString(), "删除新闻或通知时发生错误,返回受影响数据库条数为零。欲操作对象ID: " + e.CommandArgument.ToString()); JScript.AlertAndRedirect("删除新闻或通知时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; case "doView": actionNeedAuthority = 1; if (admin_MasterPage.userAuthority >= actionNeedAuthority) { string strSQL = "SELECT * FROM LYTable WHERE 编号=" + e.CommandArgument.ToString(); OleDbCommand command = new OleDbCommand(strSQL, objConnection); OleDbDataAdapter adapter = new OleDbDataAdapter(command); DataTable dt = new DataTable(); adapter.Fill(dt); if (dt.Rows.Count >= 1) { ArticleViewTitle.Text = dt.Rows[0]["LYTitle"].ToString(); viewDoEditButton.CommandArgument = e.CommandArgument.ToString(); string articleInfo = string.Empty; articleInfo += ("<div>姓名:" + dt.Rows[0]["LYName"].ToString() + "</div>"); articleInfo += ("<div>留言时间:" + dt.Rows[0]["LYTime"].ToString() + "</div>"); articleInfo += ("<div>Email:" + dt.Rows[0]["LYEmail"].ToString() + "</div>"); articleInfo += ("<div>电话:" + dt.Rows[0]["LYTel"].ToString() + "</div>"); ArticleViewInfo.Text = articleInfo; ArticleView.Text = dt.Rows[0]["LYContents"].ToString(); NewsListPanel.Visible = false; ViewPanel.Visible = true; strSQL = "UPDATE LYTable SET LYRead=true WHERE 编号=" + e.CommandArgument.ToString(); command = new OleDbCommand(strSQL, objConnection); command.ExecuteNonQuery(); } else { MyBasePage.writeLog(Session["userName"].ToString(), "选择指定新闻或通知时发生错误,操作对象ID:" + e.CommandArgument.ToString()); JScript.AlertAndRedirect("载入指定新闻或通知时发生错误", "", this); } } else { JScript.Alert("您无权进行此操作", this); } break; } } }
protected virtual void Page_Load(object sender, EventArgs e) { if (Session["sended"] != null) { if (Session["sended"].ToString() == "1" && ViewState["BackUrl"] != null) { Response.Redirect(ViewState["BackUrl"].ToString()); } } if (!IsPostBack) { PageControlLocalizationText pl = new PageControlLocalizationText(this); pl.SetListPageControlLocalizationText(); lblFuncName.Text = GetLocalResourceObject("PageResource1.Title").ToString(); if (Request["BackUrl"] != null) { ViewState["BackUrl"] = Request["BackUrl"]; } else { ViewState["BackUrl"] = null; } object obj = null; if (Request["PackTypeNo"] != null && Request["CurLinkNo"] != null) //从工作流界面打开,肯定有PackTypeNo和CurLinkNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["CurLinkNo"] = Request["CurLinkNo"]; if (Request["PackNo"] != null) { ViewState["PackNo"] = Request["PackNo"]; _sql = "select f_recno from DMIS_SYS_DOC where f_packno=" + Request["PackNo"] + " and f_linkno=" + Request["CurLinkNo"]; ViewState["RecNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["RecNo"] == null) { //JScript.Alert("业务表的记录号,请联系管理员!"); return; } } else { ViewState["RecNo"] = -1; } if (Request["CurWorkFlowNo"] != null) { ViewState["CurWorkFlowNo"] = Request["CurWorkFlowNo"]; } } else //从业务表查询界面打开,有PackTypeNo、TableName、RecNo { ViewState["PackTypeNo"] = Request["PackTypeNo"]; ViewState["TableName"] = Request["TableName"]; ViewState["RecNo"] = Request["RecNo"]; _sql = "select F_PACKNO from DMIS_SYS_DOC where f_tablename='" + Request["TableName"].ToString() + "' and f_recno=" + ViewState["RecNo"].ToString(); ViewState["PackNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); if (ViewState["PackNo"] == null) { //JScript.Alert("未找到业务号!"); return; } obj = DBOpt.dbHelper.ExecuteScalar("select f_no from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='在办'"); if (obj != null) //在办的业务 { ViewState["CurWorkFlowNo"] = obj; } else { _sql = "select max(f_no) from DMIS_SYS_WORKFLOW where f_packno=" + ViewState["PackNo"].ToString() + " and f_status='完成'"; //归档的业务,最后的环节 ViewState["CurWorkFlowNo"] = DBOpt.dbHelper.ExecuteScalar(_sql); } ViewState["CurLinkNo"] = DBOpt.dbHelper.ExecuteScalar("select f_flowno from DMIS_SYS_WORKFLOW where f_no=" + ViewState["CurWorkFlowNo"].ToString()); } //找当前环节对应的文档 _sql = "select a.f_no,a.f_name,a.f_tablename,a.f_reportfile from dmis_sys_doctype a,DMIS_SYS_WK_LINK_DOCTYPE b where a.f_no=b.F_DOCTYPENO and b.f_packtypeno=" + ViewState["PackTypeNo"].ToString() + " and b.F_LINKNO=" + ViewState["CurLinkNo"].ToString(); DataTable temp = DBOpt.dbHelper.GetDataTable(_sql); if (temp == null || temp.Rows.Count < 1) { JScript.Alert(GetGlobalResourceObject("WebGlobalResource", "WkNoDoc").ToString()); //"没有找到对应的文档!" return; } else { ViewState["DocTypeNo"] = temp.Rows[0][0]; //文档编号 ViewState["DocTypeName"] = temp.Rows[0][1]; //文档名称 ViewState["TableName"] = temp.Rows[0][2]; //文档对应的数据库表名称 ViewState["REPORT_ID"] = temp.Rows[0][3]; //报表编号 } int counts; btnSave.Enabled = false; btnSaveClose.Enabled = false; btnSend.Enabled = false; btnWithdraw.Enabled = false; btnAccept.Enabled = false; btnWithdraw.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmWithdraw").ToString() + "');"); //确定要退回到上一步? btnAccept.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmAccept").ToString() + "');"); //确定要接单? if (SetRight.IsAdminitrator(Session["MemberID"].ToString())) //管理员开放修改业务的数据的权限,但不能发送、回退。不参与流转的处理 { btnSave.Enabled = true; btnSaveClose.Enabled = true; WebWorkFlow.SetAllWebControlEnable(this.Page, Convert.ToInt16(ViewState["PackTypeNo"]), ViewState["TableName"].ToString()); } else { if (Session["Oper"] != null) { if (Convert.ToInt16(Session["Oper"]) > 0) //有权限修改 { WebWorkFlow.SetWebControlRight(this.Page, Session["RoleIDs"].ToString(), Convert.ToInt16(ViewState["PackTypeNo"]), Convert.ToInt16(ViewState["CurLinkNo"]), ViewState["TableName"].ToString()); btnSave.Enabled = true; btnSaveClose.Enabled = true; btnSend.Enabled = true; btnWithdraw.Enabled = true; //判断文件上传删除的权限,只要能修改委托书基本资料,则可以 if (hcbSTATION.Enabled) { btnAddFile.Enabled = true; btnDelFile.Enabled = true; } //如果是最后一步,则弹出是否要归档的窗口 string sMainer = ""; if (ViewState["CurWorkFlowNo"] != null) { obj = DBOpt.dbHelper.ExecuteScalar("select F_RECEIVER from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); } if (obj != null) { sMainer = obj.ToString(); } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');"); //确定要提交到下一步?(新建业务时。) } if (sMainer == Session["MemberName"].ToString()) { int iCat = -1; obj = DBOpt.dbHelper.ExecuteScalar("SELECT F_FLOWCAT FROM DMIS_SYS_FLOWLINK WHERE F_NO=" + ViewState["CurLinkNo"]); if (obj != null) { iCat = Convert.ToInt16(obj); } if (iCat == 2) { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmFinish").ToString() + "');");//该项目已办理完成,是否要归档? } else { btnSend.Attributes.Add("onClick", "return confirm('" + GetGlobalResourceObject("WebGlobalResource", "WkConfirmSubmit").ToString() + "');");//确定要提交到下一步 } } } else //待办的状态下处理接单按钮 { int flag = -1; //判断是否接单 obj = DBOpt.dbHelper.ExecuteScalar("select f_working from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { flag = Convert.ToInt16(obj); } if (flag == 0) //待办状态 { string zbr = ""; obj = DBOpt.dbHelper.ExecuteScalar("select f_receiver from DMIS_SYS_WORKFLOW where F_NO=" + ViewState["CurWorkFlowNo"]); if (obj != null) { zbr = obj.ToString().Trim(); } if (zbr == "" || zbr == Session["MemberName"].ToString()) { btnAccept.Enabled = true; } } else if (flag == 1) //从办人员点击进入状态,只能提交 { if (WebWorkFlow.IsCongBanRen(ViewState["PackNo"].ToString(), ViewState["CurWorkFlowNo"].ToString(), Session["MemberName"].ToString())) { btnSend.Enabled = true; } } else { btnAccept.Enabled = false; } } } } FillDropDownList.FillHtmlCombxByTable(ref hcbSTATION, "DMIS_SYS_STATION", "NAME", "TID"); initFile(); //显示上传的文件 string tid; if (ViewState["PackNo"] != null) { //任务单内容,只有一条,故用PACK查找 if (DBOpt.dbHelper.IsExist(ViewState["TableName"].ToString(), "PACK_NO=" + ViewState["PackNo"].ToString())) { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, ViewState["TableName"].ToString(), "PACK_NO=" + ViewState["PackNo"].ToString()); } //2009-3-6 每个业务表保存业务号,故用一个控件来保存就可以了. if (txtPACK_NO.Text.Trim() == "") { txtPACK_NO.Text = ViewState["PackNo"].ToString(); } } //确定当前步骤是否是第一步 obj = DBOpt.dbHelper.ExecuteScalar("select f_flowcat from dmis_sys_flowlink where f_no=" + ViewState["CurLinkNo"].ToString()); if (!obj.ToString().Equals("0")) //不是第一步 { //设置初始人名 if (!SetRight.IsAdminitrator(Session["MemberID"].ToString())) //不是管理员才设置初始人员及日期,否则会把管理员的名称也赋值给相应的控件 { string[] name = { "txtAPPLY_MAN", "txtLEADER", "txtAPPROVER", "txtDIRECTOR", "txtDISPATCHER" }; TextBox txt; for (int i = 0; i < name.Length; i++) { txt = (TextBox)Page.FindControl(name[i]); if (txt == null) { continue; } if (!txt.ReadOnly && txt.Text == "") { txt.Text = Session["MemberName"].ToString(); } } //设置初始日期 string[] date = { "wdlAPPLY_STARTTIME", "wdlAPPLY_ENDTIME", "wdlAPPROVE_STARTTIME", "wdlAPPROVE_ENDTIME", "wdlDIRECTOR_TIME", "wdlDISPATCH_FINISHEDTIME" }; WebDate wdl; for (int i = 0; i < date.Length; i++) { wdl = (WebDate)Page.FindControl(date[i]); if (wdl == null) { continue; } if (wdl.Enabled && wdl.Text == "") { wdl.setTime(DateTime.Now); } } } } else //开始步骤 { if (ViewState["RecNo"].ToString() == "-1") //新增任务书的情况 { _sql = "select count(*) from " + ViewState["TableName"].ToString() + " where to_char(APPLY_STARTTIME,'YYYYMM')='" + DateTime.Now.ToString("yyyyMM") + "'"; counts = Convert.ToInt16(DBOpt.dbHelper.ExecuteScalar(_sql)) + 1; txtNUM.Text = DateTime.Now.ToString("yyyyMM") + counts.ToString("000"); txtTID.Text = ""; } else //第二次,则还是第一步的步骤,则显示数据 { CustomControlFill.CustomControlFillByTableAndWhere(this.Page, ViewState["TableName"].ToString(), "TID=" + ViewState["RecNo"].ToString()); } } } }
protected void SubmitEvents(object sender, EventArgs e) { try { if (IsPreview == false) { string strActionName = ((Button)sender).Text.Trim(); base.SubAction = strActionName; if (strActionName == ProcessConstString.SubmitAction.ACTION_SAVE_DRAFT) //保存 { EntityLetterSend entity = ControlToEntity(true) as EntityLetterSend; entity.SubmitAction = strActionName; base.FormSubmit(true, strActionName, null, entity as EntityBase); } else { EntityLetterSend entity = ControlToEntity(false) as EntityLetterSend; entity.SubmitAction = strActionName; if (CheckData(entity) == false) { return; } if (strActionName == ProcessConstString.SubmitAction.ACTION_CANCEL) { base.FormCancel(entity as EntityBase); } else { if (base.StepName == ProcessConstString.StepName.LetterSend.函件分发) { if (base.SubAction == "完成") { //新增文号 LetterNum lnum = new LetterNum(); lnum.UpdateNo(txtOurRef.Text, txtCompanyID.Text, drpHanJian.SelectedValue); entity.ReceiveUserID = entity.ReceiveUserID; } } Hashtable ht = EntityLetterSend.GetProcNameValue(base.StepName, strActionName, entity);//ap属性 base.FormSubmit(false, strActionName, ht, entity as EntityBase); if (base.StepName == ProcessConstString.StepName.LetterSend.函件分发) { if (base.SubAction == "完成") { base.Circulate(entity.ccDeptIDs, "1", "", GetCYNames(entity), "2", false, "", true); } } } } } else { string strActionName = ((Button)sender).Text.Trim(); base.SubAction = strActionName; EntityLetterSend entity = ControlToEntity(false) as EntityLetterSend; if (strActionName == "追加分发") { base.Circulate(entity.ccDeptIDs, "1", "", GetCYNames(entity), "2", false, "", true); } else if (strActionName == "二次分发") { base.WorkItemID = Guid.NewGuid().ToString("N"); base.StepName = "二次分发"; base.SaveNewEntity(strActionName, entity); base.Circulate(entity.ccDeptIDs, "1", "", GetCYNames(entity), "4", true, "", true); } } } catch (Exception ex) { //JScript.ShowMsgBox(Page, MsgType.VbCritical, ex.Message); JScript.Alert(ex.Message, false); return; } }
/// <summary> /// 开始试验 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnStartEnd_Click(object sender, EventArgs e) { ThermalTestReport report = new ThermalTestReport(); if (ddlCompany.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择分公司...');", true); return; } if (ddlPlant.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择电厂...');", true); return; } if (ddlUnit.SelectedValue == "0") { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('请选择机组...');", true); return; } if (ddlSYName.SelectedValue == "0") { JScript.Alert("请选择试验名称!"); return; } if (txtSYR.Value == "") { JScript.Alert("请填写试验人!"); return; } if (btnStartEnd.Text == "开始试验") { if (report.IsDoingExpriment()) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('已有试验正在运行,请稍后运行试验...');", true); return; } this.btnView.Enabled = false; ThermalTestTemplate template = new ThermalTestTemplate(); if (template.GetTemplateID(this.ddlSYName.SelectedItem.Text.Trim(), this.ddlUnit.SelectedValue).ToString() == string.Empty) { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "msg1", "alert('该机组尚未配置...');", true); return; } report.TESTTemplateID = template.GetTemplateID(this.ddlSYName.SelectedItem.Text.Trim(), this.ddlUnit.SelectedValue); report.TESTCondition = GetCondition(); report.ReportName = this.txtReportName.Value; report.Tester = this.txtSYR.Value; report.UNITID = ddlUnit.SelectedValue.Trim(); report.TestBegin = Convert.ToDateTime(this.calSYStartTime.Text); report.TestCalBegin = Convert.ToDateTime(DateTime.Now.ToLongTimeString()); report.TestDuration = Convert.ToInt32(this.txtSYTime.Value); report.SampleInterval = Convert.ToInt32(this.txtSplitTime.Value); Bussiness.ThermalTestReport.UserState userState = ThermalTestReport.UserState.New; report.InsertTest(userState, report); this.Timer1.Interval = 1000; this.Timer1.Enabled = true; btnStartEnd.Text = "终止试验"; this.Label1.Text = this.txtReportName.Value + "试验正在进行已完成0%"; } else { this.Timer1.Enabled = false; int curReportId = report.GetMaxReportId(); report.EndTest(curReportId); btnStartEnd.Text = "开始试验"; report.EndTest(curReportId); this.Timer1.Enabled = true; btnStartEnd.Enabled = false; this.Label1.Text = "试验已中止"; } }
protected void btnEnter_Click(object sender, EventArgs e) { //查询是否可以过站 string result = CRUD.QueryStationOfLot(lblWorksiteID.Text, txtLot.Text); if (result != "success") { JScript.Alert(result, this); txtLot.Text = ""; return; } //是否已经checkin DataTable ResDt = CRUD.GetCheckInInfo(txtLot.Text, lblWorksiteID.Text); if (ResDt.Rows.Count > 0) { //批次查询出当前站点是否有Checkin信息,但是返工的批次不检查返工前的checkin信息 if (ResDt.Rows[0]["rework"].ToString() == "Y") { DataTable dtCheckInIsOK = CRUD.CheckInIsOK(txtLot.Text, lblWorksiteID.Text); if (dtCheckInIsOK.Rows.Count > 0) { JScript.Alert("该批次已经进站", this); return; } } else { JScript.Alert("该批次已经进站", this); return; } } //批次已过站点 string WorksiteIDOfLot = CRUD.GetWorksite(txtLot.Text); //查询批次流程 string CurrentSite = "N"; string EndSite = "N"; string BeginFlow = ""; string EndFlow = ""; string strFlow = ""; DataTable dt = CRUD.GetWorkflow(txtLot.Text); for (int i = 0; i < dt.Rows.Count; i++) { //if (WorksiteIDOfLot == dt.Rows[i]["worksiteID"].ToString()) //{ // strFlow = strFlow + "[" + dt.Rows[i]["worksitename"].ToString() + "]" + "->"; // lblCurrnentWorksite.Text = dt.Rows[i]["worksitename"].ToString(); //} //else //{ // strFlow = strFlow + dt.Rows[i]["worksitename"].ToString() + "->"; //} if (EndSite == "Y") { EndFlow = EndFlow + dt.Rows[i]["worksitename"].ToString() + "->"; } if (WorksiteIDOfLot == dt.Rows[i]["worksiteID"].ToString()) { strFlow = strFlow + "[" + dt.Rows[i]["worksitename"].ToString() + "]" + "->"; lblCurrnentWorksite.Text = "[" + dt.Rows[i]["worksitename"].ToString() + "]" + "->"; CurrentSite = "Y"; EndSite = "Y"; } if (CurrentSite == "N") { BeginFlow = BeginFlow + dt.Rows[i]["worksitename"].ToString() + "->"; } } if (EndFlow != "" && BeginFlow == "" && lblCurrnentWorksite.Text != "") { EndFlow = EndFlow.Remove((EndFlow).Length - 2, 2); } if (EndFlow == "" && BeginFlow != "" && lblCurrnentWorksite.Text != "") { lblCurrnentWorksite.Text = lblCurrnentWorksite.Text.Remove((lblCurrnentWorksite.Text).Length - 2, 2); } //string strFlow = ""; lblLotprocess.Text = BeginFlow; //当前站点显示颜色 modify by lei.xue on 2017-2-12 //lblCurrnentWorksite.ForeColor = System.Drawing.Color.FromName("#FFFFFF"); //lblCurrnentWorksite.BackColor = System.Drawing.Color.FromName("#0080FF"); lblEndProcess.Text = EndFlow; }
protected void btnSaveClose_Click(object sender, EventArgs e) { //JScript.Alert("test!", this); //入库单号是否存在 if (Warehouse.ExistWarehouseID(txtInventoryNo.Text.Trim().ToString()) == "success") { JScript.Alert("输入的入库单号已经存在", this); return; } //for (int i = 0; i < grd.Rows.Count; i++) //{ // DropDownList ddltype = (DropDownList)grd.Rows[i].FindControl("ddlType"); // string type = ddltype.SelectedValue; //} DropDownList ddlType; string result = ""; DataTable dt = (DataTable)ViewState["dt"]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //判断批次是否已入库 modify by lei.xue on 2017-8-22 using (DbDataReader reader = Warehouse.QueryLotInfo(dt.Rows[i]["lotid"].ToString())) { if (reader.Read()) { //是否入库 if (reader["warehouse"].ToString() == "Y") { JScript.Alert("批次已经入库", this); return; } } } //modify by lei.xue on 2017-9-20 型号取下拉选项 ddlType = (DropDownList)grd.Rows[i].FindControl("ddlType"); result = Warehouse.InsertWarehouseInfo(txtInventoryNo.Text, dt.Rows[i]["lotid"].ToString(), dt.Rows[i]["warehousecode"].ToString(), dt.Rows[i]["warehousetype"].ToString(), dt.Rows[i]["workorderid"].ToString(), dt.Rows[i]["workordertype"].ToString(), dt.Rows[i]["workshopid"].ToString(), System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), dt.Rows[i]["pinmin"].ToString(), dt.Rows[i]["thinkness"].ToString(), dt.Rows[i]["length"].ToString(), dt.Rows[i]["width"].ToString(), ddlType.SelectedItem.Text, //dt.Rows[i]["type"].ToString(), dt.Rows[i]["pettype"].ToString() ); if (result == "fail") { JScript.Alert("入库出错!", this); return; } } //erp接口 add by lei.xue on 2017-9-21 result = Warehouse.InsertDataToERP((DataTable)ViewState["dt"], grd, System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), txtInventoryNo.Text); if (result == "fail") { JScript.AlertAndRedirect("ERP入库接口出错!", "../Warehouse/Warehouse.aspx", this); } JScript.AlertAndRedirect("MES入库成功!", "../Warehouse/Warehouse.aspx", this); } else { JScript.Alert("请刷入条码!", this); } }