|
|
using System;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Configuration;
|
|
|
using System.Data;
|
|
|
using System.Web;
|
|
|
using System.Web.Security;
|
|
|
using System.Web.UI;
|
|
|
using System.Web.UI.HtmlControls;
|
|
|
using System.Web.UI.WebControls;
|
|
|
using System.Web.UI.WebControls.WebParts;
|
|
|
using System.Text;
|
|
|
using DSWeb.EntityDA;
|
|
|
using DSWeb.Models;
|
|
|
using System.Xml;
|
|
|
using System.Text.RegularExpressions;
|
|
|
using DSWeb.Authority;
|
|
|
|
|
|
namespace DSWeb.WMS
|
|
|
{
|
|
|
public partial class VwWmsDetailListGridSource : System.Web.UI.Page
|
|
|
{
|
|
|
private int iCurrentPage;
|
|
|
private int iShowPage;
|
|
|
private string strHandle;//值为"page"获取分页状态值数组 值为"list"获取日志显示JSON数据 值为"columns"获取日志显示记录 值为"rename"更新列标题
|
|
|
public string strUserID = "";//"04eaeac5-f271-45d1-b17b-ad4ccbab63d0";//用户GID
|
|
|
private string strCompanyID;//公司GID
|
|
|
private string strShowName;//用户显示名
|
|
|
private string strDeptName;//部门名称
|
|
|
private string strType = "51";//Grid模块号
|
|
|
private string strOldHeader;
|
|
|
private string strNewHeader;
|
|
|
public string strgids = "";
|
|
|
public string strSearch;//综合查询条件缓存
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
if (Session["USERID"] != null)
|
|
|
{
|
|
|
strUserID = Session["USERID"].ToString().Trim();
|
|
|
}
|
|
|
if (Session["SHOWNAME"] != null)
|
|
|
{
|
|
|
strShowName = Session["SHOWNAME"].ToString();
|
|
|
}
|
|
|
if (Session["COMPANYID"] != null)
|
|
|
{
|
|
|
strCompanyID = Session["COMPANYID"].ToString();
|
|
|
}
|
|
|
if (Session["DEPTNAME"] != null)
|
|
|
{
|
|
|
strDeptName = Session["DEPTNAME"].ToString();
|
|
|
}
|
|
|
//
|
|
|
if (Request.QueryString["handle"] != null)
|
|
|
{
|
|
|
strHandle = Request.QueryString["handle"].ToString().Trim().ToLower();
|
|
|
}
|
|
|
if (Request.QueryString["cur_page"] != null)
|
|
|
{
|
|
|
iCurrentPage = int.Parse(Request.QueryString["cur_page"].ToString().Trim());
|
|
|
}
|
|
|
if (Request.QueryString["show_page"] != null)
|
|
|
{
|
|
|
iShowPage = int.Parse(Request.QueryString["show_page"].ToString().Trim());
|
|
|
}
|
|
|
//
|
|
|
if (Request.QueryString["hid_sel"] != null)
|
|
|
{
|
|
|
strSearch = Request.QueryString["hid_sel"].ToString();
|
|
|
}
|
|
|
//
|
|
|
string strJSON = "";
|
|
|
if (strHandle != null)
|
|
|
{
|
|
|
if (strHandle.Equals("list"))
|
|
|
{
|
|
|
if (iCurrentPage <= 0 && iShowPage < 0)
|
|
|
{
|
|
|
strJSON = "-2";//提交页数参数错误
|
|
|
}
|
|
|
}
|
|
|
if (strHandle.Trim().ToLower().Equals("setting"))
|
|
|
{
|
|
|
Response.Write(GetUserSettingJson());
|
|
|
}
|
|
|
|
|
|
if (strHandle.Trim().ToLower().Equals("page"))
|
|
|
{
|
|
|
Response.Write(GetPageInfo().ToString());
|
|
|
}
|
|
|
if (strHandle.Trim().ToLower().Equals("list"))
|
|
|
{
|
|
|
Response.Write(GetLogContent(iShowPage, iCurrentPage));
|
|
|
}
|
|
|
if (strHandle.Trim().ToLower().Equals("rename"))
|
|
|
{
|
|
|
if (Request.QueryString["old_header"] != null && Request.QueryString["new_header"] != null)
|
|
|
{
|
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
strOldHeader = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["old_header"].ToString())));
|
|
|
strNewHeader = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["new_header"].ToString())));
|
|
|
|
|
|
Response.Write(UpdateColumnHeader(strOldHeader, strNewHeader));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
Response.Write("-1");//GET 参数错误
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (strHandle.Trim().ToLower().Equals("excel"))
|
|
|
{
|
|
|
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
|
|
|
string strCondition = "";
|
|
|
//
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "btime"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND WMSDATE >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "etime"://ETD EndDate
|
|
|
strCondition += String.Format(" AND WMSDATE <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "btime2"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND DODATE_OUT >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "etime2"://ETD EndDate
|
|
|
strCondition += String.Format(" AND DODATE_OUT <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND (CUSTOMERNAME LIKE '%{0}%' or CUSTOMERNAME_OUT LIKE '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsname"://GOODSNAME
|
|
|
strCondition += String.Format(" AND GOODSNAME='{0}'", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "storagename"://STORAGENAME
|
|
|
strCondition += String.Format(" AND STORAGENAME='{0}'", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "no"://NO
|
|
|
strCondition += String.Format(" AND (BLNO LIKE '%{0}%' OR BSNO_OUT LIKE '%{0}%' OR CONTRACTNO LIKE '%{0}%' OR GOODSMODEL LIKE '%{0}%' OR TRUCKNO_OUT LIKE '%{0}%' OR WMSNO LIKE '%{0}%' OR OUTBSNO_OUT LIKE '%{0}%' OR CUSTOMNO LIKE '%{0}%' OR CUSTNO LIKE '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = " and 1<0";
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
strCondition += " and CORPID='" + strCompanyID + "'";
|
|
|
//
|
|
|
string strSortCondition = strSortCondition = String.Format(" ORDER BY {0}{1}{2}{3}{4}{5}{6}{7}", "CUSTOMERNAME", ",STORAGENAME", ",GOODSNAME", ",GOODSMODEL", ",BLNO", ",DODATE_OUT", ",OUTBSNO_OUT", ",BSNO_OUT");
|
|
|
//
|
|
|
string strSql = "SELECT BLNO,CUSTOMNO,CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSSTANDARD,GOODSMODEL,WMSNO,OUTBSNO_OUT,BSNO_OUT,WMSDATE,DODATE_OUT,GOODSRKSL,GOODSRKSLACTUAL,GOODSPFSL_OUT,GOODSSTOCK,GOODSOUTFEE_OUT, GOODSOUTFEEAP_OUT,CHARGEUNIT,ARFEE, APFEE,ARFEE_OUT,APFEE_OUT,FREESTORAGEPERIOD,CONTRACTNO,GOODSPACK,TRUCKNO_OUT,REMARK_OUT,MODIFIEDUSER,MODIFIEDTIME,CREATEUSER_OUT,CREATETIME_OUT FROM VW_WMS_DETAIL where 1>0 " + strCondition
|
|
|
+ " union "
|
|
|
+ "SELECT '','','总计','','','','','','','','','',sum(GOODSRKSL) as GOODSRKSL,sum(GOODSRKSLACTUAL) as GOODSRKSLACTUAL,sum(GOODSPFSL_OUT) as GOODSPFSL_OUT,sum(GOODSSTOCK) as GOODSSTOCK,sum(GOODSOUTFEE_OUT) as GOODSOUTFEE_OUT, sum(GOODSOUTFEEAP_OUT) as GOODSOUTFEEAP_OUT,'',sum(ARFEE) as ARFEE, sum(APFEE) as APFEE,sum(ARFEE_OUT) as ARFEE_OUT,sum(APFEE_OUT) as APFEE_OUT,0,'',sum(GOODSPACK) as GOODSPACK,'','','',null,'',null FROM VW_WMS_DETAIL where 1>0 " + strCondition + strSortCondition;
|
|
|
Response.Write(strSql);//GET 参数错误
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strJSON = "-1";//GET 参数错误
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private int UpdateColumnHeader(string tempOldHeader, string tempNewHeader)
|
|
|
{
|
|
|
int iResult = 0;
|
|
|
UserSettingDA userSettingDA = new UserSettingDA();
|
|
|
UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserIDType(strUserID, strType);
|
|
|
GridEntity gridEntity = null;
|
|
|
|
|
|
if (userSettingEntity != null)
|
|
|
{
|
|
|
if (userSettingEntity.GID != null)
|
|
|
{
|
|
|
gridEntity = GetSettingXml(userSettingEntity.Xml);
|
|
|
|
|
|
foreach (GridColumnEntity column in gridEntity.Columns)
|
|
|
{
|
|
|
if (column.Description.Equals(tempOldHeader))
|
|
|
{
|
|
|
column.Description = tempNewHeader;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
userSettingEntity.Xml = GetUserSettingXml(gridEntity).OuterXml;
|
|
|
iResult = userSettingDA.UpdateUserSetting(userSettingEntity);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iResult = -3;//没有相关用户Grid设置记录
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
iResult = -3;//没有相关用户Grid设置记录
|
|
|
}
|
|
|
return iResult;
|
|
|
}
|
|
|
|
|
|
private string GetUserSettingJson()
|
|
|
{
|
|
|
UserSettingDA userSettingDA = new UserSettingDA();
|
|
|
UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserIDType(strUserID, strType);
|
|
|
GridEntity gridEntity = null;
|
|
|
|
|
|
StringBuilder settingBuilder = new StringBuilder();
|
|
|
if (userSettingEntity != null)
|
|
|
{
|
|
|
if (userSettingEntity.GID != null)
|
|
|
{
|
|
|
gridEntity = GetSettingXml(userSettingEntity.Xml);
|
|
|
|
|
|
settingBuilder.Append("{");
|
|
|
|
|
|
settingBuilder.Append("\"show\":" + gridEntity.PagePreCount + ",");
|
|
|
settingBuilder.Append("\"columns\":");
|
|
|
int i = 0;
|
|
|
StringBuilder columnGroupBuilder = new StringBuilder();
|
|
|
while (gridEntity.Columns.Count > i)
|
|
|
{
|
|
|
foreach (GridColumnEntity column in gridEntity.Columns)
|
|
|
{
|
|
|
if (column.Index == i)
|
|
|
{
|
|
|
StringBuilder columnBuilder = new StringBuilder();
|
|
|
columnBuilder.Append("{\"name\":\"" + column.Name + "\",");
|
|
|
columnBuilder.Append("\"description\":\"" + column.Description + "\",");
|
|
|
columnBuilder.Append("\"index\":" + column.Index.ToString() + ",");
|
|
|
columnBuilder.Append("\"width\":" + column.Width.ToString() + ",");
|
|
|
columnBuilder.Append("\"visible\":" + column.VisibleState.ToString());
|
|
|
|
|
|
columnGroupBuilder.Append(columnBuilder.ToString() + "},");
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
i++;
|
|
|
}
|
|
|
string strGroup = columnGroupBuilder.ToString().Trim();
|
|
|
if (strGroup.EndsWith(","))
|
|
|
{
|
|
|
strGroup = strGroup.Substring(0, strGroup.Length - 1);
|
|
|
}
|
|
|
strGroup = "[" + strGroup + "]";
|
|
|
settingBuilder.Append(strGroup);
|
|
|
settingBuilder.Append("}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
settingBuilder.Append("-3");//没有相关用户Grid设置记录
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
settingBuilder.Append("-3");//没有相关用户Grid设置记录
|
|
|
}
|
|
|
|
|
|
return settingBuilder.ToString();
|
|
|
}
|
|
|
|
|
|
private GridEntity GetSettingXml(string strXml)
|
|
|
{
|
|
|
XmlDocument xmlSettingDoc = new XmlDocument();
|
|
|
GridEntity gridEntity = new GridEntity();
|
|
|
try
|
|
|
{
|
|
|
xmlSettingDoc.LoadXml(strXml);
|
|
|
|
|
|
gridEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[0].InnerText.Trim();
|
|
|
gridEntity.UserID = xmlSettingDoc.ChildNodes[0].ChildNodes[1].InnerText.Trim();
|
|
|
gridEntity.CreateTime = DateTime.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[2].InnerText.Trim());
|
|
|
|
|
|
IList<GridColumnEntity> columnsEntities = new List<GridColumnEntity>();
|
|
|
|
|
|
int iColCount = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes.Count;
|
|
|
|
|
|
for (int i = 0; i < iColCount; i++)
|
|
|
{
|
|
|
GridColumnEntity columnEntity = new GridColumnEntity();
|
|
|
//columnEntity.GID = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[0].ToString();
|
|
|
columnEntity.Name = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[0].InnerText.Trim();
|
|
|
columnEntity.Description = xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[1].InnerText.Trim();
|
|
|
columnEntity.Index = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[2].InnerText.Trim());
|
|
|
columnEntity.Width = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[3].ChildNodes[i].ChildNodes[3].InnerText.Trim());
|
|
|
|
|
|
columnsEntities.Add(columnEntity);
|
|
|
}
|
|
|
|
|
|
gridEntity.Columns = columnsEntities;
|
|
|
gridEntity.GroupBy = xmlSettingDoc.ChildNodes[0].ChildNodes[4].InnerText.Trim();
|
|
|
gridEntity.DefaultPrePageCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[0].InnerText.Trim());
|
|
|
gridEntity.PagePreCount = int.Parse(xmlSettingDoc.ChildNodes[0].ChildNodes[5].ChildNodes[1].InnerText.Trim());
|
|
|
}
|
|
|
catch (Exception error)
|
|
|
{
|
|
|
throw (error);
|
|
|
}
|
|
|
|
|
|
return gridEntity;
|
|
|
}
|
|
|
|
|
|
private int GetPageInfo()
|
|
|
{
|
|
|
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
|
|
|
string strSql = "SELECT COUNT(*) FROM VW_WMS_DETAIL WHERE 1 > 0 and CORPID='" + strCompanyID + "'";
|
|
|
string strCondition = "";
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "btime"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND WMSDATE >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "etime"://ETD EndDate
|
|
|
strCondition += String.Format(" AND WMSDATE <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "btime2"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND DODATE_OUT >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "etime2"://ETD EndDate
|
|
|
strCondition += String.Format(" AND DODATE_OUT <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND (CUSTOMERNAME LIKE '%{0}%' or CUSTOMERNAME_OUT LIKE '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsname"://GOODSNAME
|
|
|
strCondition += String.Format(" AND GOODSNAME='{0}'", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "storagename"://STORAGENAME
|
|
|
strCondition += String.Format(" AND STORAGENAME='{0}'", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "no"://NO
|
|
|
strCondition += String.Format(" AND (BLNO LIKE '%{0}%' OR BSNO_OUT LIKE '%{0}%' OR CONTRACTNO LIKE '%{0}%' OR GOODSMODEL LIKE '%{0}%' OR TRUCKNO_OUT LIKE '%{0}%' OR WMSNO LIKE '%{0}%' OR OUTBSNO_OUT LIKE '%{0}%' OR CUSTOMNO LIKE '%{0}%' OR CUSTNO LIKE '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = " and 1<0";
|
|
|
}
|
|
|
}
|
|
|
strSql += strCondition;
|
|
|
int iTotal = int.Parse(seaExportInfoDA.GetExcuteSql(strSql).Tables[0].Rows[0][0].ToString());
|
|
|
return iTotal;
|
|
|
}
|
|
|
|
|
|
private string GetLogContent(int tempShowPage, int tempCurPage)
|
|
|
{
|
|
|
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
|
|
|
DataTable sourceTable;
|
|
|
string strCondition = "";
|
|
|
string strTopInclude = "";
|
|
|
string strTopNotInclude = "";
|
|
|
//
|
|
|
if (strSearch != null)
|
|
|
{
|
|
|
if (!strSearch.Trim().Equals(""))
|
|
|
{
|
|
|
string tempSearch = strSearch;
|
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
|
|
for (int i = 0; i < searchArg.Length; i++)
|
|
|
{
|
|
|
string[] strArg = searchArg[i].Split(new char[] { ':' });
|
|
|
|
|
|
if (!strArg[1].Replace("\"", "").Trim().Equals(""))
|
|
|
{
|
|
|
switch (strArg[0].Replace("\"", ""))
|
|
|
{
|
|
|
case "btime"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND WMSDATE >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "etime"://ETD EndDate
|
|
|
strCondition += String.Format(" AND WMSDATE <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "btime2"://ETD BeginDate
|
|
|
strCondition += String.Format(" AND DODATE_OUT >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "etime2"://ETD EndDate
|
|
|
strCondition += String.Format(" AND DODATE_OUT <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "cus"://CUSTOMER
|
|
|
strCondition += String.Format(" AND (CUSTOMERNAME LIKE '{0}' or CUSTOMERNAME_OUT LIKE '{0}')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "goodsname"://GOODSNAME
|
|
|
strCondition += String.Format(" AND GOODSNAME='{0}'", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "storagename"://STORAGENAME
|
|
|
strCondition += String.Format(" AND STORAGENAME='{0}'", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
case "no"://NO
|
|
|
strCondition += String.Format(" AND (BLNO LIKE '%{0}%' OR BSNO_OUT LIKE '%{0}%' OR CONTRACTNO LIKE '%{0}%' OR GOODSMODEL LIKE '%{0}%' OR TRUCKNO_OUT LIKE '%{0}%' OR WMSNO LIKE '%{0}%' OR OUTBSNO_OUT LIKE '%{0}%' OR CUSTOMNO LIKE '%{0}%' OR CUSTNO LIKE '%{0}%')", strArg[1].Replace("\"", ""));
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strCondition = " and 1<0";
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
strCondition += " and CORPID='" + strCompanyID + "'";
|
|
|
//
|
|
|
string strSortCondition = strSortCondition = String.Format(" ORDER BY {0}{1}{2}{3}{4}{5}{6}{7}", "CUSTOMERNAME", ",STORAGENAME", ",GOODSNAME", ",GOODSMODEL", ",BLNO", ",DODATE_OUT DESC", ",OUTBSNO_OUT", ",BSNO_OUT");
|
|
|
//
|
|
|
string strSql = "";
|
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
|
{
|
|
|
if (iCurrentPage == 1)
|
|
|
{
|
|
|
strSql = String.Format("SELECT {0} NID,BLNO,CUSTOMNO,CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSSTANDARD,GOODSMODEL,WMSNO,OUTBSNO_OUT,BSNO_OUT,WMSDATE,DODATE_OUT,GOODSRKSL,GOODSRKSLACTUAL,GOODSPFSL_OUT,GOODSSTOCK,CHARGEUNIT,GOODSOUTFEE_OUT, GOODSOUTFEEAP_OUT,ARFEE, APFEE,ARFEE_OUT,APFEE_OUT,FREESTORAGEPERIOD,CONTRACTNO,GOODSPACK,TRUCKNO_OUT,REMARK_OUT,MODIFIEDUSER,MODIFIEDTIME,CREATEUSER_OUT,CREATETIME_OUT FROM VW_WMS_DETAIL where 1>0 " + strCondition + strSortCondition, "top " + iShowPage.ToString());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();
|
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
|
|
|
strSql = String.Format("SELECT {0} NID,BLNO,CUSTOMNO,CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSSTANDARD,GOODSMODEL,WMSNO,OUTBSNO_OUT,BSNO_OUT,WMSDATE,DODATE_OUT,GOODSRKSL,GOODSRKSLACTUAL,GOODSPFSL_OUT,GOODSSTOCK,CHARGEUNIT,GOODSOUTFEE_OUT, GOODSOUTFEEAP_OUT,ARFEE, APFEE,ARFEE_OUT,APFEE_OUT,FREESTORAGEPERIOD,CONTRACTNO,GOODSPACK,TRUCKNO_OUT,REMARK_OUT,MODIFIEDUSER,MODIFIEDTIME,CREATEUSER_OUT,CREATETIME_OUT FROM VW_WMS_DETAIL WHERE NID NOT IN (SELECT {1} NID FROM VW_WMS_DETAIL WHERE 1>0 " + strCondition + strSortCondition + ") " + strCondition + strSortCondition, strTopInclude, strTopNotInclude);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strSql = "SELECT NID,BLNO,CUSTOMNO,CUSTOMERNAME,STORAGENAME,GOODSNAME,GOODSSTANDARD,GOODSMODEL,WMSNO,OUTBSNO_OUT,BSNO_OUT,WMSDATE,DODATE_OUT,GOODSRKSL,GOODSRKSLACTUAL,GOODSPFSL_OUT,GOODSSTOCK,CHARGEUNIT,GOODSOUTFEE_OUT, GOODSOUTFEEAP_OUT,ARFEE, APFEE,ARFEE_OUT,APFEE_OUT,FREESTORAGEPERIOD,CONTRACTNO,GOODSPACK,TRUCKNO_OUT,REMARK_OUT,MODIFIEDUSER,MODIFIEDTIME,CREATEUSER_OUT,CREATETIME_OUT FROM VW_WMS_DETAIL where 1<0 ";
|
|
|
}
|
|
|
sourceTable = seaExportInfoDA.GetExcuteSql(strSql).Tables[0];
|
|
|
StringBuilder sourceBuilder = new StringBuilder();
|
|
|
sourceBuilder.Append("{");
|
|
|
sourceBuilder.Append("rows:[");
|
|
|
for (int i = 0; i < sourceTable.Rows.Count; i++)
|
|
|
{
|
|
|
sourceBuilder.Append("{id:\"" + sourceTable.Rows[i][0].ToString() + "\",");
|
|
|
sourceBuilder.Append("data:[");
|
|
|
sourceBuilder.Append("\"0\",");
|
|
|
for (int j = 1; j < sourceTable.Columns.Count; j++)
|
|
|
{
|
|
|
string ls = sourceTable.Rows[i][j].ToString();
|
|
|
ls = ls.Replace(" ", ",");
|
|
|
ls = ls.Replace("\r\n", "。");
|
|
|
//
|
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\"");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("\"" + ls + "\",");
|
|
|
}
|
|
|
}
|
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
|
{
|
|
|
sourceBuilder.Append("]}");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sourceBuilder.Append("]},");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
sourceBuilder.Append("]");
|
|
|
sourceBuilder.Append("}");
|
|
|
return sourceBuilder.ToString();
|
|
|
}
|
|
|
|
|
|
private XmlDocument GetUserSettingXml(GridEntity gridEntity)
|
|
|
{
|
|
|
XmlDocument xmlDoc = new XmlDocument();
|
|
|
XmlElement root = xmlDoc.CreateElement("user-settings");
|
|
|
|
|
|
//xmlDoc.AppendChild(root);
|
|
|
|
|
|
XmlElement xGID = xmlDoc.CreateElement("GID");
|
|
|
xGID.InnerText = gridEntity.GID;
|
|
|
root.AppendChild(xGID);
|
|
|
|
|
|
XmlElement xUserID = xmlDoc.CreateElement("userid");
|
|
|
xUserID.InnerText = gridEntity.UserID;
|
|
|
root.AppendChild(xUserID);
|
|
|
|
|
|
XmlElement xCreateTime = xmlDoc.CreateElement("create-time");
|
|
|
xCreateTime.InnerText = gridEntity.CreateTime.ToString();
|
|
|
root.AppendChild(xCreateTime);
|
|
|
|
|
|
XmlElement xColumns = xmlDoc.CreateElement("columns");
|
|
|
|
|
|
foreach (GridColumnEntity column in gridEntity.Columns)
|
|
|
{
|
|
|
XmlElement xColumn = xmlDoc.CreateElement("column");
|
|
|
XmlElement nName = xmlDoc.CreateElement("name");
|
|
|
nName.InnerText = column.Name;
|
|
|
|
|
|
xColumn.AppendChild(nName);
|
|
|
|
|
|
XmlElement nDescription = xmlDoc.CreateElement("description");
|
|
|
nDescription.InnerText = column.Description;
|
|
|
|
|
|
xColumn.AppendChild(nDescription);
|
|
|
|
|
|
XmlElement nIndex = xmlDoc.CreateElement("index");
|
|
|
nIndex.InnerText = column.Index.ToString();
|
|
|
|
|
|
xColumn.AppendChild(nIndex);
|
|
|
|
|
|
XmlElement nWidth = xmlDoc.CreateElement("width");
|
|
|
nWidth.InnerText = column.Width.ToString();
|
|
|
|
|
|
xColumn.AppendChild(nWidth);
|
|
|
|
|
|
XmlElement nVisible = xmlDoc.CreateElement("visible");
|
|
|
nVisible.InnerText = column.VisibleState.ToString();
|
|
|
|
|
|
xColumn.AppendChild(nVisible);
|
|
|
|
|
|
xColumns.AppendChild(xColumn);
|
|
|
}
|
|
|
|
|
|
root.AppendChild(xColumns);
|
|
|
|
|
|
XmlElement xGroupBy = xmlDoc.CreateElement("group-by");
|
|
|
xGroupBy.InnerText = gridEntity.GroupBy;
|
|
|
|
|
|
root.AppendChild(xGroupBy);
|
|
|
|
|
|
XmlElement xPage = xmlDoc.CreateElement("page");
|
|
|
|
|
|
XmlElement nPageDefault = xmlDoc.CreateElement("page-default");
|
|
|
nPageDefault.InnerText = gridEntity.DefaultPrePageCount.ToString();
|
|
|
xPage.AppendChild(nPageDefault);
|
|
|
|
|
|
XmlElement nPagePre = xmlDoc.CreateElement("page-pre");
|
|
|
nPagePre.InnerText = gridEntity.PagePreCount.ToString();
|
|
|
xPage.AppendChild(nPagePre);
|
|
|
|
|
|
root.AppendChild(xPage);
|
|
|
|
|
|
xmlDoc.AppendChild(root);
|
|
|
return xmlDoc;
|
|
|
}
|
|
|
|
|
|
private string GetOption(string tempOption, ArrayList tempList, string tempCondition)
|
|
|
{
|
|
|
string tempResult = "";
|
|
|
|
|
|
switch (tempOption)
|
|
|
{
|
|
|
case "1":
|
|
|
if (tempList.Count > 0)
|
|
|
{
|
|
|
if (tempList[(tempList.Count - 1)].ToString().Trim() != "1")
|
|
|
{
|
|
|
tempResult = " (" + tempCondition + ") AND ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
tempResult = tempCondition + " AND ";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
tempResult = tempCondition + " AND ";
|
|
|
}
|
|
|
break;
|
|
|
case "2":
|
|
|
if (tempList.Count > 0)
|
|
|
{
|
|
|
if (tempList[(tempList.Count - 1)].ToString().Trim() != "2")
|
|
|
{
|
|
|
tempResult = " (" + tempCondition + ") OR ";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
tempResult = tempCondition + " OR ";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
tempResult = tempCondition + " OR ";
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
return tempResult;
|
|
|
}
|
|
|
|
|
|
private string GetEqual(string tempEqual)
|
|
|
{
|
|
|
string tempResult = "";
|
|
|
|
|
|
switch (tempEqual)
|
|
|
{
|
|
|
case "=":
|
|
|
tempResult = " = {0} ";
|
|
|
break;
|
|
|
case "<":
|
|
|
tempResult = " < {0} ";
|
|
|
break;
|
|
|
case ">":
|
|
|
tempResult = " > {0} ";
|
|
|
break;
|
|
|
case "in":
|
|
|
tempResult = " LIKE {0} ";
|
|
|
break;
|
|
|
case "notin":
|
|
|
tempResult = " NOT LIKE {0} ";
|
|
|
break;
|
|
|
case "null":
|
|
|
tempResult = " IS NULL ";
|
|
|
break;
|
|
|
case "notnull":
|
|
|
tempResult = " IS NOT NULL ";
|
|
|
break;
|
|
|
case ">=":
|
|
|
tempResult = " >= {0} ";
|
|
|
break;
|
|
|
case "<=":
|
|
|
tempResult = " <= {0} ";
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
return tempResult;
|
|
|
}
|
|
|
}
|
|
|
}
|