public static string InitOpt(string ocode) { string r = ""; Sys_Optimize so = new Sys_Optimize(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_Optimize csns = sob.Query(" and ocode='" + ocode + "'"); if (csns != null) { r = js.Serialize(csns); } else { so.oname = ""; so.ocode = sob.CreateCode().ToString().PadLeft(4, '0'); so.id = 0; r = js.Serialize(so); } } else { r = iv.badstr; } return(r); }
public static string SaveOpt(string mtype, string scol, string stype, string ycol, string ycode, string yid, string yname) { string r = ""; SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_Optimize s = new Sys_Optimize(); s.oname = yname; s.ocode = ycode; s.ocols = ycol; s.pcols = scol; s.mtype = mtype; s.stype = stype; s.cdate = DateTime.Now.ToString(); s.maker = iv.u.ename; if (iv.u.rcode != "xtgl") { s.dcode = iv.u.dcode.Substring(0, 8); } else { s.dcode = ""; } if (yid == "0") { if (sob.Add(s) > 0) { r = "S"; } else { r = "F"; } } else { if (sob.Update(s)) { r = "S"; } else { r = "F"; } } } else { r = iv.badstr; } return(r); }
public static ArrayList QueryTj(string bdate, string edate, string ptype, string ymethod) { ArrayList r = new ArrayList(); DataTable lsr = new DataTable(); StringBuilder where = new StringBuilder(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { r.Add(iv.badstr); if (bdate != null) { bdate = Convert.ToDateTime(bdate).ToString("yyyy-MM-dd"); } else { bdate = DateTime.Now.ToString("yyyy-MM-dd"); } if (edate != null) { edate = Convert.ToDateTime(edate).AddDays(1).ToString("yyyy-MM-dd"); } else { edate = DateTime.Now.ToString("yyyy-MM-dd"); } Sys_Optimize so = sob.Query(" and ocode='" + ptype + "'"); if (so != null) { where.Append(" and ddate>='" + bdate + "' and ddate<'" + edate + "' "); where.Append(" and pcode in (select pcode from LvErpBase.dbo.Sys_RInventoryOptimize where ocode='" + ptype + "' ) "); string sort = ""; if (ymethod == "m-s-p") { sort = " order by pmname, width, pname"; } if (ymethod == "m-p-s") { sort = " order by pmname, pname, width"; } if (ymethod == "s-p-m") { sort = " order by pname, width,pmname"; } DataTable dt = tsb.QueryList(" B_Tj_ProductionItems", so.pcols, where.ToString(), sort); if (dt != null) { int xh = 1; foreach (DataRow dr in dt.Rows) { ArrayList al = new ArrayList(); al.Add(xh); foreach (DataColumn column in dt.Columns) { al.Add(dr[column].ToString()); } r.Add(al); xh++; } } } } else { r.Add(iv.badstr); } return(r); }