|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.Linq;
|
|
|
using System.Web;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
|
using DSWeb.TruckMng.Helper;
|
|
|
using HcUtility.Comm;
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using DSWeb.EntityDA;
|
|
|
using System.Text;
|
|
|
using DSWeb.SoftMng.Filter;
|
|
|
|
|
|
namespace DSWeb.Areas.RptMng.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsRptWlTyreQryController : Controller
|
|
|
{
|
|
|
//
|
|
|
// GET: /RptMng/MsRptWlTyreQry
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
//
|
|
|
// GET:/RptMng/MsRptWlTyreQry/QryData
|
|
|
|
|
|
public ContentResult QryData(int start, int limit, string condition,string sort)
|
|
|
{
|
|
|
|
|
|
var strDa = GetRangDAStr("index", Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), CookieConfig.GetCookie_OrgCode(Request));
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strDa))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
condition = condition + " and " + strDa;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
condition = strDa;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT A.ORGCODE, A.TRUCKNO, '' AS DRIVER, A.PLUCODE, A.PCNO, A.PLANMIL, A.SCRAPMIL, A.YKMIL, A.REMARK");
|
|
|
strSql.Append(" FROM TMSWLTYREACC A");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
{
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
}
|
|
|
|
|
|
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
|
|
var paramps_sSQL = new CustomDbParamter();
|
|
|
paramps_sSQL.ParameterName = "@sSQL";
|
|
|
paramps_sSQL.DbType = DbType.String;
|
|
|
paramps_sSQL.Direction = ParameterDirection.Input;
|
|
|
paramps_sSQL.Value = strSql.ToString();
|
|
|
dbparams.Add(paramps_sSQL);
|
|
|
|
|
|
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
|
|
|
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", true);
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
|
/*
|
|
|
var dbparams = new List<CustomDbParamter>();
|
|
|
|
|
|
var paramps_OrgCode = new CustomDbParamter();
|
|
|
paramps_OrgCode.ParameterName = "@PS_ORGCODE";
|
|
|
paramps_OrgCode.DbType = DbType.String;
|
|
|
paramps_OrgCode.Direction = ParameterDirection.Input;
|
|
|
paramps_OrgCode.Value = RptHelper.JsonGetValue(condition, "PS_ORGCODE").ToString();
|
|
|
dbparams.Add(paramps_OrgCode);
|
|
|
var paramps_TruckNo = new CustomDbParamter();
|
|
|
paramps_TruckNo.ParameterName = "@PS_TRUCKNO";
|
|
|
paramps_TruckNo.DbType = DbType.String;
|
|
|
paramps_TruckNo.Direction = ParameterDirection.Input;
|
|
|
paramps_TruckNo.Value = RptHelper.JsonGetValue(condition, "PS_TRUCKNO").ToString();
|
|
|
dbparams.Add(paramps_TruckNo);
|
|
|
var paramps_PcNo = new CustomDbParamter();
|
|
|
paramps_PcNo.ParameterName = "@PS_PCNO";
|
|
|
paramps_PcNo.DbType = DbType.String;
|
|
|
paramps_PcNo.Direction = ParameterDirection.Input;
|
|
|
paramps_PcNo.Value = RptHelper.JsonGetValue(condition, "PS_PCNO").ToString();
|
|
|
dbparams.Add(paramps_PcNo);
|
|
|
var paramps_ScrapDateBgn = new CustomDbParamter();
|
|
|
paramps_ScrapDateBgn.ParameterName = "@PS_SCRAPDATEBGN";
|
|
|
paramps_ScrapDateBgn.DbType = DbType.String;
|
|
|
paramps_ScrapDateBgn.Direction = ParameterDirection.Input;
|
|
|
paramps_ScrapDateBgn.Value = RptHelper.JsonGetValue(condition, "PS_SCRAPDATEBGN").ToString();
|
|
|
dbparams.Add(paramps_ScrapDateBgn);
|
|
|
var paramps_ScrapDateEnd = new CustomDbParamter();
|
|
|
paramps_ScrapDateEnd.ParameterName = "@PS_SCRAPDATEEND";
|
|
|
paramps_ScrapDateEnd.DbType = DbType.String;
|
|
|
paramps_ScrapDateEnd.Direction = ParameterDirection.Input;
|
|
|
paramps_ScrapDateEnd.Value = RptHelper.JsonGetValue(condition, "PS_SCRAPDATEEND").ToString();
|
|
|
dbparams.Add(paramps_ScrapDateEnd);
|
|
|
|
|
|
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsRptWlTyreQry", dbparams, "Result_Set");
|
|
|
var json = RptHelper.GetRptJsonResult(start, limit, dbRptResult, "Result_Set", false);
|
|
|
return new ContentResult() { Content = json };
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
|
|
|
public static string GetRangDAStr(string tb, string userid, string usercode, string orgcode)
|
|
|
{
|
|
|
string str = "";
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT ");
|
|
|
strSql.Append(" VISIBLERANGE,OPERATERANGE ");
|
|
|
strSql.Append(" from VW_User_Authority ");
|
|
|
strSql.Append(" where [NAME]='modTruckPj' and USERID='" + userid + "' and ISDELETE=0");
|
|
|
|
|
|
string visiblerange = "4";
|
|
|
string operaterange = "4";
|
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
|
|
|
{
|
|
|
while (reader.Read())
|
|
|
{
|
|
|
visiblerange = Convert.ToString(reader["VISIBLERANGE"]);
|
|
|
operaterange = Convert.ToString(reader["OPERATERANGE"]);
|
|
|
break;
|
|
|
}
|
|
|
reader.Close();
|
|
|
}
|
|
|
if (visiblerange == "4")
|
|
|
{
|
|
|
str = "1=2";
|
|
|
}
|
|
|
else if (visiblerange == "3")
|
|
|
{
|
|
|
|
|
|
str = " UPPER(A.ORGCODE)='" + orgcode + "'";
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "2")
|
|
|
{
|
|
|
str = " UPPER(A.ORGCODE)='" + orgcode + "'";
|
|
|
|
|
|
}
|
|
|
else if (visiblerange == "1")
|
|
|
{
|
|
|
str = " UPPER(A.ORGCODE)='" + orgcode + "'";
|
|
|
}
|
|
|
|
|
|
return str;
|
|
|
}
|
|
|
|
|
|
#region 参照部分
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|