public string GetBjformDetail() { string responsetxt = string.Empty; DataTable dt; HttpContextBase context = this.HttpContext; string CodeStr = context.Request.Params["code"]; string TypeStr = context.Request.Params["type"]; string sqlStr = string.Empty; SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", CodeStr) }; if (TypeStr == "材料") { sqlStr = "select a.pcode, b.Description as pdesc, b.size, b.unit, a.purchaseamount,a.checkrate, a.checkamount,a.passamount,a.passrate,a.finalpassamount, convert(varchar(20), a.checkdate, 120) as checkdate from bjform_d a, stockinfo b where a.pcode = b.code and a.code =@code"; } else { sqlStr = "select Description as pdesc, size, unit,purchaseamount,checkrate,checkamount, passamount,passrate, finalpassamount,convert(varchar(20), checkdate, 120) as checkdate from bjform_d_others where code = @code"; } dt = KDATA.GetDataTable(sqlStr, spara); string returnjson = JsonConvert.SerializeObject(dt); return(returnjson); }
public string BjFormChgStatus() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; string CodeStr = context.Request.Params["code"]; string StatusStr = context.Request.Params["chgstatus"]; SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", CodeStr), new SqlParameter("@chgstatus", StatusStr) }; try { int resultcode = KDATA.ExecuteNonQuery("update bjform_m set status=@chgstatus where code=@code", spara); if (resultcode > 0) { responsetxt = "success"; } else { responsetxt = "error"; } }catch (Exception ex) { throw ex; } return(responsetxt); }
public string DelBjForm() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; string codeStr = context.Request.Params["code"]; SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", codeStr) }; try { int resultcode = KDATA.ExecuteNonQuery("delete bjform_m where status=0 and code=@code", spara); if (resultcode > 0) { responsetxt = "已删除报检单"; } else { responsetxt = "删除有误"; } }catch (Exception ex) { throw ex; } return(responsetxt); }
public void UpdateBjfrom(NameValueCollection forms, out string responsetxt) { string code = forms.Get("code").ToString().Trim(); string buyer = forms.Get("buyer").ToString(); string supplier = forms.Get("supplier").ToString(); SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", code), new SqlParameter("@buyer", buyer), new SqlParameter("@supplier", supplier) }; try { int resultcode = KDATA.ExecuteNonQuery("update bjform_m set buyer=@buyer,supplier=@supplier where code=@code", spara); if (resultcode > 0) { responsetxt = "已保存"; } else { responsetxt = "保存有误,联系管理员"; } } catch (Exception ex) { throw ex; } }
public string GetDataFromStockinfo() { //HttpContextBase context = this.HttpContext; // NameValueCollection forms = context.Request.Form; DataTable dt = KDATA.GetDataTable("select code,codetype,productmodel from barcodeelement "); string returnjson = JsonConvert.SerializeObject(dt); return(returnjson); }
public string GetQcProcessFormInfo() { HttpContextBase context = this.HttpContext; string StatusStr = context.Request.Params["status"]; string sqlStr = string.Empty; string userSQLStr = string.Empty; DataTable dt; if (Session["role"].ToString() == "1") { userSQLStr = " where a.status in ('2','3','4') and a.qcstaff='" + Session["user"].ToString() + "'"; } else { userSQLStr = " where a.status in ('1','2','3','4')"; } if (StatusStr == null) { sqlStr = @"select a.urgent,f.bjtext as type,a.code,e.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as maker,a.buyer,a.supplier,c.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcmanager, d.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcstaff, b.bjtext as status,convert(varchar(20), a.makedate, 120) as makedate from bjform_m a left join bjformstcode b on a.status = b.bjstatus left join QC_staff c on a.qcmanager = c.username left join QC_staff d on a.qcstaff = d.username left join QC_staff e on a.maker=e.username left join bjformstcode f on a.type=f.bjstatus" + userSQLStr + "order by a.makedate desc"; try { dt = KDATA.GetDataTable(sqlStr); }catch (Exception ex) { throw ex; } } else { SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@status", StatusStr) }; sqlStr = @"select a.code,a.maker,a.buyer,a.supplier,c.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcmanager, d.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcstaff, bjtext as status,convert(varchar(20), a.makedate, 120) as makedate from bjform_m a left join bjformstcode b on a.status = b.bjstatus left join QC_staff c on a.qcmanager = c.username left join QC_staff d on a.qcstaff = d.username where status=@status order by a.makedate desc"; try { dt = KDATA.GetDataTable(sqlStr, spara); }catch (Exception ex) { throw ex; } } return(JsonConvert.SerializeObject(dt)); }
public string GetBjFrominfo() { string sqlStr = @"select a.urgent,f.bjtext as type,a.code,e.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as maker,a.buyer,a.supplier,c.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcmanager, d.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcstaff, b.bjtext as status,convert(varchar(20), a.makedate, 120) as makedate from bjform_m a left join bjformstcode b on a.status = b.bjstatus left join QC_staff c on a.qcmanager = c.username left join QC_staff d on a.qcstaff = d.username left join QC_staff e on a.maker=e.username left join bjformstcode f on a.type=f.bjstatus order by a.makedate desc"; DataTable dt = KDATA.GetDataTable(sqlStr); string returnjson = JsonConvert.SerializeObject(dt); return(returnjson); }
public string AddBjFormDetail() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; string CodeStr = context.Request.Params["code"]; string TypeStr = context.Request.Params["ptype"]; string PcodeStr = context.Request.Params["pcode"]; string PdescStr = context.Request.Params["pdesc"]; string PsizeStr = context.Request.Params["psize"]; string PunitStr = context.Request.Params["punit"]; float Checkamount = Convert.ToSingle(context.Request.Params["puramount"]); string sqlStr = string.Empty; SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", CodeStr), new SqlParameter("@pcode", PcodeStr), new SqlParameter("@desc", PdescStr), new SqlParameter("@size", PsizeStr), new SqlParameter("@unit", PunitStr), new SqlParameter("@purchaseamount", Checkamount) }; if (TypeStr == "80") { sqlStr = "insert into bjform_d (code, pcode, purchaseamount) values(@code, @pcode, @purchaseamount)"; } else { sqlStr = "insert into bjform_d_others (code,description,size,unit,purchaseamount) values (@code,@desc,@size,@unit,@purchaseamount)"; } try { int resultcode = KDATA.ExecuteNonQuery(sqlStr, spara); if (resultcode > 0) { responsetxt = "已保存"; } else { responsetxt = "保存有误,联系管理员"; } } catch (Exception ex) { throw ex; } return(responsetxt); }
public string GetStatusForQc() { string responsetxt = "<select>"; DataTable dt = KDATA.GetDataTable("select bjtext from bjformstcode where bjstatus in ('1','2','4')"); for (int i = 0; i < dt.Rows.Count; i++) { responsetxt += "<option value='" + dt.Rows[i]["bjtext"] + "'>" + dt.Rows[i]["bjtext"] + "</option>"; } responsetxt += "</select>"; return(responsetxt); }
public string SearchStockinfo() { string returnjson = string.Empty; HttpContextBase context = this.HttpContext; string SearchStr = context.Request.Params["q"]; if (SearchStr != null) { string sqlstr = "select code as id, description+' '+size as text from stockinfo where description like '%" + SearchStr.Trim() + "%' or size like '%" + SearchStr.Trim() + "%'"; DataTable dt = KDATA.GetDataTable(sqlstr); returnjson = JsonConvert.SerializeObject(dt); } return(returnjson); }
public string GetStockinfoDetail() { string returnjson = string.Empty; HttpContextBase context = this.HttpContext; string SearchStr = context.Request.Params["q"]; if (SearchStr != null) { string sqlstr = "select code as pcode,description as [desc],size,unit from stockinfo where code='" + SearchStr + "'"; DataTable dt = KDATA.GetDataTable(sqlstr); returnjson = JsonConvert.SerializeObject(dt); } return(returnjson); }
public string GetUsername() { HttpContextBase context = this.HttpContext; string roleid = "9"; string responsetxt = "<select>"; DataTable dt = KDATA.GetDataTable("select username,profile.value('(/root/Chinesename)[1]','nvarchar(max)') as chinesename from QC_staff where role=" + roleid + " order by username asc"); for (int i = 0; i < dt.Rows.Count; i++) { responsetxt += "<option value = '" + dt.Rows[i]["chinesename"] + "'>" + dt.Rows[i]["chinesename"] + "</option >"; } responsetxt += "</select>"; return(responsetxt); }
public string DelBjFormDetail() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; string codestr = context.Request.Params["code"]; string typestr = context.Request.Params["type"]; string pcodestr = context.Request.Params["pcode"]; string[] pcodearray = pcodestr.Split('|'); string pcodesql = string.Empty; string tablesql = string.Empty; foreach (string pcode in pcodearray) { pcodesql = pcodesql + ",'" + pcode + "'"; } pcodesql = pcodesql.Substring(1); if (typestr == "材料") { tablesql = "delete bjform_d where code='" + codestr.Trim() + "' and pcode in (" + pcodesql + ")"; } else { tablesql = "delete bjform_d_others where code='" + codestr.Trim() + "' and description in (" + pcodesql + ")"; } try { int resultcode = KDATA.ExecuteNonQuery(tablesql); if (resultcode > 0) { responsetxt = "已保存"; } else { responsetxt = "保存有误,联系管理员"; } } catch (Exception ex) { throw ex; } return(responsetxt); }
public void AddBjForm(NameValueCollection forms, out string responsetxt) { string bjformcode = forms.Get("code").ToString(); string urgent = forms.Get("urgent").ToString(); string type = forms.Get("type").ToString(); string maker = forms.Get("maker").ToString(); string buyer = forms.Get("buyer").ToString(); string supplier = forms.Get("supplier").ToString(); string status = "0"; string makedate = forms.Get("makedate").ToString(); SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", bjformcode), new SqlParameter("@urgent", urgent), new SqlParameter("@type", type), new SqlParameter("@maker", maker), new SqlParameter("@buyer", buyer), new SqlParameter("@supplier", supplier), new SqlParameter("@status", status), new SqlParameter("@makedate", makedate) }; try { int resultcode = KDATA.ExecuteNonQuery(@"insert into bjform_m (urgent,type,code,maker,buyer,supplier,status,makedate) values (@urgent,@type,@code, (select top 1 username from qc_staff where profile.value('(/root/Chinesename)[1]','nvarchar(max)')=@maker) , @buyer,@supplier,@status,@makedate)", spara); if (resultcode > 0) { responsetxt = "已保存"; } else { responsetxt = "保存有误,联系管理员"; } } catch (Exception ex) { throw ex; } }
public string GetqcitemDetail() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; string CodeStr = context.Request.Params["bjformcode"].Trim(); string TypeStr = context.Request.Params["bjformtype"].Trim(); string ItemStr = context.Request.Params["bjformitem"].Trim(); string sqlStr = string.Empty; DataTable dt; SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", CodeStr), new SqlParameter("@pcode", ItemStr) }; if (TypeStr == "材料") { sqlStr = @"select a.code,a.pcode,a.checkamount,b.Description,b.Size,b.Unit,a.purchaseamount,a.checkamount,a.checkrate,a.passamount,a.finalpassamount,a.passrate,a.note.value('(/root/staffnote)[1]','varchar(max)') as staffnote,a.note.value('(/root/directornote)[1]','varchar(max)') as directornote from bjform_d a, stockinfo b where a.pcode = b.code and a.code = @code and a.pcode = @pcode"; } else { sqlStr = @"select code,Description,Size,Unit,purchaseamount,checkamount,checkrate,passamount,finalpassamount,passrate,note.value('(/root/staffnote)[1]','varchar(max)') as staffnote,note.value('(/root/directornote)[1]','varchar(max)') as directornote from bjform_d_others where code=@code and description=@pcode"; } try { dt = KDATA.GetDataTable(sqlStr, spara); }catch (Exception ex) { throw ex; } responsetxt = JsonConvert.SerializeObject(dt); return(responsetxt); }
public void UpdateBjfromByQc(NameValueCollection forms, out string responsetxt) { string codeStr = forms.Get("code").Trim(); string qcmanagerStr = forms.Get("qcmanager"); string qcstaffStr = forms.Get("qcstaff"); string statusStr = forms.Get("status"); SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", codeStr), new SqlParameter("@manager", qcmanagerStr), new SqlParameter("@staff", qcstaffStr), new SqlParameter("@status", statusStr) }; try { string sqlstr = "update bjform_m "; sqlstr += "set qcstaff=(select top 1 username from qc_staff where profile.value('(/root/Chinesename)[1]','nvarchar(max)')='" + qcstaffStr + "'),"; sqlstr += "qcmanager=(select top 1 username from qc_staff where profile.value('(/root/Chinesename)[1]','nvarchar(max)')='" + qcmanagerStr + "'),"; sqlstr += "status=(select top 1 bjstatus from bjformstcode where bjtext='" + statusStr + "') "; sqlstr += "where code='" + codeStr + "'"; int resultcode = KDATA.ExecuteNonQuery(sqlstr); if (resultcode > 0) { responsetxt = "success"; } else { responsetxt = "error"; } }catch (Exception ex) { throw ex; } }
public string UserCheck() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; /*string SubmitStr = context.Request.Params["submit"]; * * JObject jo = (JObject)JsonConvert.DeserializeObject(SubmitStr); * * string userStr = jo["username"].ToString(); * string passStr =Hash_MD5_32( jo["password"].ToString()); */ string userStr = context.Request.Params["userdata"]; string passStr = Hash_MD5_32(context.Request.Params["passdata"]); DataTable dt; Dictionary <string, string> responsejsontxt = new Dictionary <string, string>(); SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@user", userStr), new SqlParameter("@pass", passStr) }; try { dt = KDATA.GetDataTable(@"select top 1 username,profile.value('(/root/Chinesename)[1]','varchar(max)') as chinesename,role from QC_staff where username=@user and password=@pass", spara); }catch (Exception ex) { throw ex; } if (dt.Rows.Count > 0) { Session["user"] = dt.Rows[0]["username"].ToString(); Session["chinesename"] = dt.Rows[0]["chinesename"].ToString(); Session["role"] = dt.Rows[0]["role"].ToString().Trim(); responsejsontxt.Add("restxt", "loginsuccess"); string urlheader = Request.ApplicationPath.Length == 1 ? string.Empty : Request.ApplicationPath; switch (dt.Rows[0]["role"].ToString().Trim()) { case "0": responsejsontxt.Add("url", urlheader + "/Qcprocess"); break; case "1": responsejsontxt.Add("url", urlheader + "/Qcprocess"); break; case "9": responsejsontxt.Add("url", urlheader + "/Qcform"); break; case "99": responsejsontxt.Add("url", urlheader + "/Qcprocess"); break; default: responsejsontxt.Add("url", urlheader + "/"); break; } } else { responsejsontxt.Add("restxt", "loginerror"); responsejsontxt.Add("url", Request.ApplicationPath + "/Login"); } responsetxt = JsonConvert.SerializeObject(responsejsontxt); return(responsetxt); }
public string Updateqcitem() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; string SubmitStr = context.Request.Params["submit"]; JObject jo = (JObject)JsonConvert.DeserializeObject(SubmitStr); string codestr = jo["code"].ToString(); string pcodestr = string.Empty; if (jo["pcode"] != null) { pcodestr = jo["pcode"].ToString(); } else { pcodestr = jo["desc"].ToString(); } decimal checkamount = Convert.ToDecimal(jo["checkamount"]); decimal passamount = Convert.ToDecimal(jo["passamount"]); decimal finalpassamount = Convert.ToDecimal(jo["finalpassamount"]); decimal checkrate = Convert.ToDecimal(jo["checkrate"].ToString().TrimEnd('%')) / 100; decimal passrate = Convert.ToDecimal(jo["passrate"].ToString().TrimEnd('%')) / 100; string qcnotestr = jo["qcnote"].ToString(); string directornotestr = jo["directornote"].ToString(); string checkdatestr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); XmlDocument xdoc; XmlElement xelement; xdoc = new XmlDocument(); xelement = xdoc.CreateElement("", "root", ""); xdoc.AppendChild(xelement); XmlElement staffnote = xdoc.CreateElement("staffnote"); staffnote.InnerText = qcnotestr; XmlElement directornote = xdoc.CreateElement("directornote"); directornote.InnerText = directornotestr; xelement.AppendChild(staffnote); xelement.AppendChild(directornote); string notestr = xdoc.OuterXml; SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", codestr), new SqlParameter("@pcode", pcodestr), new SqlParameter("@checkamount", checkamount), new SqlParameter("@passamount", passamount), new SqlParameter("@finalpassamount", finalpassamount), new SqlParameter("@checkrate", checkrate), new SqlParameter("@passrate", passrate), new SqlParameter("@note", notestr), new SqlParameter("@checkdate", checkdatestr) }; string sqlStr = string.Empty; if (jo["pcode"] == null) { sqlStr = @"update bjform_d_others set checkamount=@checkamount,passamount=@passamount,finalpassamount=@finalpassamount,checkrate=@checkrate,passrate=@passrate,note=@note,checkdate=@checkdate where code=@code and description=@pcode"; } else { sqlStr = @"update bjform_d set checkamount=@checkamount,passamount=@passamount,finalpassamount=@finalpassamount,checkrate=@checkrate,passrate=@passrate,note=@note,checkdate=@checkdate where code=@code and pcode=@pcode"; } try { int resultcode = KDATA.ExecuteNonQuery(sqlStr, spara); if (resultcode > 0) { responsetxt = "updateqcitemsuccess"; } else { responsetxt = "error"; } } catch (Exception ex) { throw ex; } return(responsetxt); }