public static string createCycleNO(string location) { string res = String.Empty; string CycleNo = "INV"; string puser = (HttpContext.Current.Session[SysConst.S_LOGIN_USER] as UsersModel).USERNAME; string sql = "select next value for FGA_CycleInventory_seq as CycleID"; DataSet ds = new DataSet(); ds = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql); CycleNo = CycleNo + ds.Tables[0].Rows[0][0].ToString(); string insertSql = "insert into [FGA_CycleInventory_H]([CycleNO],[Location],[CycleStatus],[StartBy],[StartDate],[Dr]) " + "values('" + CycleNo + "','" + location + "','In Process','" + puser + "',getdate(),'0')"; if (FGA_DAL.Base.SQLServerHelper_WMS.ExecuteSql(insertSql) > 0) { List <CycleInventory_H> luw = new List <CycleInventory_H>(); CycleInventory_H ERM = new CycleInventory_H(); ERM.CycleNO = CycleNo; ERM.StartBy = puser; luw.Add(ERM); JavaScriptSerializer jssl = new JavaScriptSerializer(); res = jssl.Serialize(luw); } return(res); }
public static string SearchHead(string cycleno) { string res = String.Empty; string sql = "SELECT [CycleNO],[StartBy],[StartDate],[Location] FROM [WMS_BarCode_V10].[dbo].[FGA_CycleInventory_H] " + "where [CycleNO] ='" + cycleno + "'"; DataSet ds = new DataSet(); ds = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { List <CycleInventory_H> luw = new List <CycleInventory_H>(); foreach (DataRow row in ds.Tables[0].Rows) { CycleInventory_H ERM = new CycleInventory_H(row); luw.Add(ERM); } JavaScriptSerializer jssl = new JavaScriptSerializer(); res = jssl.Serialize(luw); res = res.Replace("\\/Date(", "").Replace(")\\/", ""); } return(res); }
public static string SearchData_H(string cycleno, string location, string status, string fdate, string tdate) { //按用户查看数据 UsersModel model = (UsersModel)HttpContext.Current.Session[SysConst.S_LOGIN_USER]; string sql = ""; string res = string.Empty; try { sql = "SELECT fch.[CycleNO],fch.[CycleStatus],fch.[StartBy],fch.[CompleteBy],fch.[StartDate],fch.[CompleteDate],fch.[Location] " + "FROM [WMS_BarCode_V10].[dbo].[FGA_CycleInventory_H] fch WHERE isnull(Dr,0) = 0 and exists (select 1 from [FGA_CycleInventory_Detail] fcd " + "where fch.[CycleNO] = fcd.[CycleNO] and isnull(fcd.Dr,0) = 0) "; //查询条件 if (!model.USERNAME.Equals("administrator") && !model.USERNAME.Equals("fy.aricciardi")) { sql = sql + " and [StartBy] = '" + model.USERNAME + "'"; } if (!String.IsNullOrEmpty(cycleno)) { sql = sql + " and fch.[CycleNO] like '%" + cycleno.Trim() + "%'"; } if (!String.IsNullOrEmpty(status)) { if (status != "All") { sql = sql + " and fch.[CycleStatus] = '" + status.Trim() + "'"; } } if (!String.IsNullOrEmpty(location)) { sql = sql + " and fch.[Location] like '%" + location.Trim() + "%'"; } if (!String.IsNullOrEmpty(fdate)) { sql = sql + " and fch.[StartDate] >= cast('" + fdate + "' as datetime)"; } if (!String.IsNullOrEmpty(tdate)) { sql = sql + " and fch.[StartDate] <= cast('" + tdate + "' as datetime)"; } sql = sql + " order by fch.[CycleNO] desc"; DataSet ds = new DataSet(); ds = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { List <CycleInventory_H> luw = new List <CycleInventory_H>(); foreach (DataRow row in ds.Tables[0].Rows) { CycleInventory_H ERM = new CycleInventory_H(row); luw.Add(ERM); } JavaScriptSerializer jssl = new JavaScriptSerializer(); res = jssl.Serialize(luw); res = res.Replace("\\/Date(", "").Replace(")\\/", ""); } } catch (Exception e) { } return(res); }