You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
865 lines
39 KiB
C#
865 lines
39 KiB
C#
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;
|
|
|
|
namespace DSWeb.SeaiInfo
|
|
{
|
|
public partial class WmsListGridSource : 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 = "46";//Grid模块号
|
|
private string strOldHeader;
|
|
private string strNewHeader;
|
|
public string strgids = "";
|
|
public string strRange = String.Empty;//权限可视范围
|
|
RangeDA RangeDA = new RangeDA();
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (Session["USERID"] != null)
|
|
{
|
|
strUserID = Session["USERID"].ToString().Trim();
|
|
}
|
|
else
|
|
{
|
|
Server.Transfer("~/Error/FriendError.aspx");
|
|
return;
|
|
//strUserID = "";
|
|
}
|
|
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["gids"] != null && Request.QueryString["gids"].ToString().Trim() != "")
|
|
{
|
|
strgids = Request.QueryString["gids"].ToString().Trim();
|
|
}
|
|
|
|
#region 权限可视范围
|
|
strRange = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modWmsList");//仓储入库列表
|
|
if (strRange.Trim().Equals("0"))//全部
|
|
{
|
|
strRange = "";
|
|
}
|
|
else if (strRange.Trim().Equals("1"))//分公司
|
|
{
|
|
strRange = " and GID in(" + RangeDA.GetWmsListCompany(strCompanyID.Trim()) + ")";
|
|
}
|
|
else if (strRange.Trim().Equals("2"))//部门
|
|
{
|
|
strRange = " and GID in(" + RangeDA.GetWmsListDEPT(strDeptName, strCompanyID, strShowName) + ")";
|
|
}
|
|
else if (strRange.Trim().Equals("3"))//个人
|
|
{
|
|
strRange = " and GID in(" + RangeDA.GetWmsListPerson(strShowName, strCompanyID) + ")";
|
|
}
|
|
else if (strRange.Trim().Equals("4"))//无
|
|
{
|
|
strRange = " and 1<0";
|
|
}
|
|
else//空
|
|
{
|
|
strRange = " and 1<0";
|
|
}
|
|
#endregion
|
|
|
|
//
|
|
ViewState["hid_sel"] += strRange; ;
|
|
if (Request.QueryString["associatedno"] != null && Request.QueryString["associatedno"].ToString().Trim() != "")
|
|
{
|
|
string strassociatedno = Request.QueryString["associatedno"].ToString().Trim();
|
|
ViewState["hid_sel"] += " and associatedno like '%" + strassociatedno + "%'";
|
|
}
|
|
if (Request.QueryString["wmsno"] != null && Request.QueryString["wmsno"].ToString().Trim() != "")
|
|
{
|
|
string strWMSNO = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["wmsno"].ToString())));
|
|
ViewState["hid_sel"] += " and (WMSNO like '%" + strWMSNO + "%' or BLNO like '%" + strWMSNO + "%' or CONTRACTNO like '%" + strWMSNO + "%' or CUSTOMNO like '%" + strWMSNO + "%' or CUSTNO like '%" + strWMSNO + "%' or BZTCHNO like '%" + strWMSNO + "%')";
|
|
}
|
|
if (Request.QueryString["customername"] != null && Request.QueryString["customername"].ToString().Trim() != "")
|
|
{
|
|
string strcustomername = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["customername"].ToString())));
|
|
ViewState["hid_sel"] += " and CUSTOMERNAME='" + strcustomername + "'";
|
|
}
|
|
if (Request.QueryString["tbREMARK"] != null && Request.QueryString["tbREMARK"].ToString().Trim() != "")
|
|
{
|
|
string tbREMARK = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["tbREMARK"].ToString())));
|
|
ViewState["hid_sel"] += " and GID in (select ASSOCIATEDNO from wms_in where REMARK like '%" + tbREMARK + "%')";
|
|
}
|
|
if (Request.QueryString["cbISCHANGE"] != null && Request.QueryString["cbISCHANGE"].ToString().Trim() != "")
|
|
{
|
|
string sbl = Request.QueryString["cbISCHANGE"].ToString().Trim();
|
|
//if (sbl.Trim().ToLower() == "true")
|
|
//{
|
|
// ViewState["hid_sel"] += " AND ISCHANGE=0";
|
|
//}
|
|
ViewState["hid_sel"] += " AND ISCHANGE='"+sbl+"' ";
|
|
}
|
|
//2017年4月19日 add by 张义伟 需求编号SR2017041700009
|
|
//start
|
|
if (Request.QueryString["STORAGENAME"] != null && Request.QueryString["STORAGENAME"].ToString().Trim() != "")
|
|
{
|
|
string storename = Request.QueryString["STORAGENAME"].ToString().Trim();
|
|
ViewState["hid_sel"] += " AND STORAGENAME like '%"+storename+"%' ";
|
|
}
|
|
//end
|
|
|
|
//2017年4月27日 add by 张义伟 需求编号SR2017042600003-1
|
|
//start
|
|
if (Request.QueryString["INTIME"] != null && Request.QueryString["INTIME"].ToString().Trim() != "")
|
|
{
|
|
string INTIME = Request.QueryString["INTIME"].ToString().Trim();
|
|
DateTime dIntime = DateTime.Parse(INTIME);
|
|
|
|
ViewState["hid_sel"] += " AND WMSDATE = '" + dIntime.ToShortDateString() + "' ";
|
|
}
|
|
//end
|
|
//
|
|
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("isdel"))
|
|
{
|
|
Response.Write(getisdel());
|
|
return;
|
|
}
|
|
if (strHandle.Trim().ToLower().Equals("isedit"))
|
|
{
|
|
Response.Write(getisEdit());
|
|
return;
|
|
}
|
|
if (strHandle.Trim().ToLower().Equals("islock"))
|
|
{
|
|
Response.Write(setislock());
|
|
return;
|
|
}
|
|
if (strHandle == "notlock")
|
|
{ //取消入账信息
|
|
Response.Write(setnotlock());
|
|
}
|
|
if (strHandle == "getislock")
|
|
{ //判断是否入账信息
|
|
Response.Write(getislock());
|
|
}
|
|
//
|
|
if (strHandle == "getfpk")
|
|
{ //获取附件信息
|
|
Response.Write(getfpk());
|
|
}
|
|
//
|
|
if (strHandle == "getfpk2")
|
|
{ //获取附件信息
|
|
Response.Write(getfpk2(iShowPage, iCurrentPage));
|
|
}
|
|
if (strHandle == "setexcel")
|
|
{
|
|
string strSql = "";
|
|
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
|
//是否入账,货权转移,提单号,备案清单号,入库单号,客户名称,仓库名称,应收客户,应付客户,品名,牌号,入库件数,剩余件数,入库量,库存量,计费单位,应收账款,应付账款,操作人,入库时间,开始计费日期,市场货值,银行货值,批次号
|
|
strSql = "SELECT ISLOCK=(case ISLOCK when 'True' then '是' when 'False' then '' end)"
|
|
+ ",(case ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
+ ",blno,CUSTOMNO,WMSNO,CUSTOMERNAME,STORAGENAME,ARCLIENT,TRUCKNAME,GOODSNAME,GOODSMODEL,isnull(GOODSPACK,0),isnull(GOODSPACKSTOCK,0),isnull(GOODSRKSL,0),isnull(GOODSSTOCK,0),CHARGEUNIT,isnull(ARFEE,0),isnull(APFEE,0),WMSOP,convert(char(10),WMSDATE,20) AS WMSDATE,convert(char(10),STARTBILLINGDATE,20) AS STARTBILLINGDATE,MARKETVALUE,BANKVALUE,BZTCHNO FROM wms WHERE 1=1 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + " ORDER BY WMSDATE desc,WMSNO desc";
|
|
Response.Write(strSql.ToString().Trim());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strJSON = "-1";//GET 参数错误
|
|
}
|
|
}
|
|
|
|
#region 获取当前列表页合计信息
|
|
/// <summary>
|
|
/// 获取费率信息
|
|
/// </summary>
|
|
/// <returns>返回JSON数据</returns>
|
|
private string getfpk2(int tempShowPage, int tempCurPage)
|
|
{
|
|
LogDA logDA = new LogDA();
|
|
StringBuilder logBuilder = new StringBuilder();
|
|
|
|
string strSql = "";
|
|
string strTopInclude = "";
|
|
string strTopNotInclude = "";
|
|
if (tempShowPage > 0 && tempCurPage > 0)
|
|
{
|
|
if (tempCurPage == 1)
|
|
{
|
|
strSql = String.Format("select isnull(sum(ARFEE),0) as ARFEE,isnull(sum(APFEE),0) as APFEE,isnull(sum(GOODSPACK),0) as GOODSPACK,isnull(sum(GOODSRKSL),0) as GOODSRKSL from (SELECT {0} * FROM wms WHERE 1=1 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + " ORDER BY WMSDATE desc,WMSNO desc) as z ", "top " + tempShowPage);
|
|
|
|
}
|
|
else
|
|
{
|
|
strSql = String.Format("select isnull(sum(ARFEE),0) as ARFEE,isnull(sum(APFEE),0) as APFEE,isnull(sum(GOODSPACK),0) as GOODSPACK,isnull(sum(GOODSRKSL),0) as GOODSRKSL from (SELECT * FROM (SELECT {1} * FROM wms WHERE GID NOT IN (SELECT {0} GID FROM wms where 1=1 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + " ORDER BY WMSDATE desc,WMSNO desc) and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + " ORDER BY WMSDATE desc,WMSNO desc) AS A) as z ", strTopNotInclude, strTopInclude);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strSql = String.Format("select isnull(sum(ARFEE),0) as ARFEE,isnull(sum(APFEE),0) as APFEE,isnull(sum(GOODSPACK),0) as GOODSPACK,isnull(sum(GOODSRKSL),0) as GOODSRKSL from (SELECT {0} * FROM wms WHERE 1<0 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + " ORDER BY WMSDATE desc,WMSNO desc) as z ", "top " + tempShowPage);
|
|
}
|
|
DataTable sourceTable = GetSqlDataIndex(logDA.GetExcuteSql(strSql).Tables[0]);
|
|
string ls = sourceTable.Rows[0][0].ToString().Trim() + "," + sourceTable.Rows[0][1].ToString().Trim() + "," + sourceTable.Rows[0][2].ToString().Trim() + "," + sourceTable.Rows[0][3].ToString().Trim();
|
|
return ls;
|
|
}
|
|
#endregion
|
|
|
|
#region 获取所有列表合计信息
|
|
/// <summary>
|
|
/// 获取费率信息
|
|
/// </summary>
|
|
/// <returns>返回JSON数据</returns>
|
|
private string getfpk()
|
|
{
|
|
LogDA logDA = new LogDA();
|
|
string strSql = "select isnull(sum(ARFEE),0) as ARFEE,isnull(sum(APFEE),0) as APFEE,isnull(sum(GOODSPACK),0) as GOODSPACK,isnull(sum(GOODSRKSL),0) as GOODSRKSL from (SELECT * FROM wms WHERE 1=1 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + ") as z ";
|
|
DataTable sourceTable = GetSqlDataIndex(logDA.GetExcuteSql(strSql).Tables[0]);
|
|
string ls = sourceTable.Rows[0][0].ToString().Trim() + "," + sourceTable.Rows[0][1].ToString().Trim() + "," + sourceTable.Rows[0][2].ToString().Trim() + "," + sourceTable.Rows[0][3].ToString().Trim();
|
|
return ls;
|
|
}
|
|
#endregion
|
|
|
|
private string getislock()
|
|
{
|
|
string sGids = "'" + strgids.Replace(",", "','") + "'";
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
string ls = T_ALL_DA.GetStrSQL("nums", "select count(gid) nums from wms where ISLOCK=1 and gid in (" + sGids + ")");
|
|
return ls;
|
|
}
|
|
|
|
private string setnotlock()
|
|
{
|
|
string sGids = "'" + strgids.Replace(",", "','") + "'";
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
string ls = "select count(gid) nums from ch_fee where (bsno in (" + sGids + ") or WMSOUTBSNO in (" + sGids + ")) and (ISINVOICE=1 or AUDITSTATUS=1 or ORDERINVOICE<>0.00 or DEBITNO is not null or (FEESTATUS<>0 and FEESTATUS<>1))";
|
|
ls = T_ALL_DA.GetStrSQL("nums", ls);
|
|
if (ls.Trim() == "0")
|
|
{
|
|
ls = "select count(gid) nums from ch_fee_do where feeid in (select gid nums from ch_fee where (bsno in (" + sGids + ") or WMSOUTBSNO in (" + sGids + ")))";
|
|
ls = T_ALL_DA.GetStrSQL("nums", ls);
|
|
if (ls.Trim() == "0")
|
|
{
|
|
ls = "select count(gid) nums from wms_out_detail where INBSNO in (" + sGids + ") or INBSNO in (select gid from wms_in where ASSOCIATEDNO in(" + sGids + "))";
|
|
ls = T_ALL_DA.GetStrSQL("nums", ls);
|
|
if (ls.Trim() == "0")
|
|
{
|
|
WmsDA WmsDA = new WmsDA();
|
|
int iResult = WmsDA.setnotlock(strgids, strUserID);
|
|
if (iResult < 0)
|
|
{
|
|
return "操作有误,请重新操作!";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "有“已做出库”的入账数据,不允许取消入账!";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "有“已申请开票、已开发票或已对帐”的入账数据,不允许取消入账!";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return "有“已申请开票、已开发票或已对帐”的入账数据,不允许取消入账!";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
private string setislock()
|
|
{
|
|
//string sGids = strgids.Replace(",", "','");
|
|
//T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
//string sSQL = "select isnull(count(*),0) as lsnum from wms where CUSTOMERNAME is not null and CUSTOMERNAME<>'' and gid in ('"+sGids+"')";// and TRUCKNAME is not null and TRUCKNAME<>''
|
|
//string lsnum = T_ALL_DA.GetStrSQL("lsnum", sSQL);
|
|
//if (lsnum.Trim() == "0")
|
|
//{
|
|
// return "应收客户有为空数据,不允许操作!";//应付
|
|
//}
|
|
//
|
|
WmsDA WmsDA = new WmsDA();
|
|
int iResult = WmsDA.setislock(strgids, strUserID);//装卸费入账,并锁定入库信息
|
|
if (iResult < 0)
|
|
{
|
|
return "操作有误,请重新操作!";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
private string getisEdit()
|
|
{
|
|
string alt = "";
|
|
string sGids = strgids.Replace(",","','");
|
|
WmsDA WmsDA = new WmsDA();
|
|
string sSQL = "select *,hj=(select count(gid) as hj from wms_out_detail where INBSNO=wms_in.gid) from wms_in where gid in('" + sGids + "') and ISDELETE=0";
|
|
DataSet ds = WmsDA.GetRateListByCondition(sSQL);
|
|
if (ds != null)
|
|
{
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
{
|
|
if (ds.Tables[0].Rows[i]["hj"].ToString().Trim() == "0")
|
|
{
|
|
alt = "true";
|
|
}
|
|
else
|
|
{
|
|
alt = "false";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return alt.Trim();
|
|
}
|
|
|
|
private string getisdel()
|
|
{
|
|
string alt = "";
|
|
string strE = "";
|
|
string sGids = strgids.Replace(",","','");
|
|
WmsDA WmsDA = new WmsDA();
|
|
string sSQL = "select *,hj=(select count(gid) as hj from wms_out_detail where INBSNO=wms_in.gid) from wms_in where gid in('" + sGids + "')";
|
|
DataSet ds = WmsDA.GetRateListByCondition(sSQL);
|
|
if (ds != null)
|
|
{
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
sGids="";
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
{
|
|
if (ds.Tables[0].Rows[i]["hj"].ToString().Trim() == "0")
|
|
{
|
|
sGids += "','" + ds.Tables[0].Rows[i]["GID"].ToString().Trim();
|
|
}
|
|
else
|
|
{
|
|
alt += "," + ds.Tables[0].Rows[i]["BSNO"].ToString().Trim();
|
|
}
|
|
}
|
|
//
|
|
if (sGids.Length > 0)
|
|
{
|
|
sGids = sGids.Substring(3);
|
|
}
|
|
}
|
|
}
|
|
//
|
|
if (sGids.Length > 0)
|
|
{
|
|
strE = WmsDA.GetWmsDel(sGids, strUserID);
|
|
}
|
|
//
|
|
if (alt.Length > 0)
|
|
{
|
|
alt = alt.Substring(1);
|
|
alt = "入库单: " + alt + " ,已有出库信息,不允许删除!";
|
|
}
|
|
else
|
|
{
|
|
alt = strE.Trim();
|
|
}
|
|
return alt.Trim();
|
|
}
|
|
|
|
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()
|
|
{
|
|
LogDA logDA = new LogDA();
|
|
StringBuilder logBuilder = new StringBuilder();
|
|
string strSql = String.Format("SELECT COUNT(*) FROM wms WHERE 1=1 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim());
|
|
int iTotal = logDA.GetPageTotal(strSql);
|
|
return iTotal;
|
|
}
|
|
private string GetLogContent(int tempShowPage, int tempCurPage)
|
|
{
|
|
LogDA logDA = new LogDA();
|
|
StringBuilder logBuilder = new StringBuilder();
|
|
|
|
string strSql = "";
|
|
string strTopInclude = "";
|
|
string strTopNotInclude = "";
|
|
if (tempShowPage > 0 && tempCurPage > 0)
|
|
{
|
|
if (tempCurPage == 1)
|
|
{
|
|
strSql = String.Format("SELECT {0} GID,ISLOCK=(case ISLOCK when 'True' then '1' when 'False' then '0' end)"
|
|
+ ",(case ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
//+ ",(select top 1 (case when REMARK like '%货权转移%' then '货权转移' else '' end) as ISREMARK from wms_out where ingidnew=wms.gid) as ISREMARK"
|
|
+ ",blno,CUSTOMNO,WMSNO,CUSTOMERNAME,STORAGENAME,ARCLIENT,TRUCKNAME,GOODSNAME,GOODSMODEL,isnull(GOODSPACK,0),isnull(GOODSPACKSTOCK,0),isnull(GOODSRKSL,0),isnull(GOODSSTOCK,0),CHARGEUNIT,isnull(ARFEE,0),isnull(APFEE,0),WMSOP,convert(char(10),WMSDATE,20) AS WMSDATE,convert(char(10),STARTBILLINGDATE,20) AS STARTBILLINGDATE,MARKETVALUE,BANKVALUE,BZTCHNO FROM wms WHERE 1=1 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + " ORDER BY WMSDATE desc,WMSNO desc", "top " + tempShowPage);//,GOODSKGS
|
|
}
|
|
else
|
|
{
|
|
strTopNotInclude = "top " + (tempShowPage * (tempCurPage - 1));//RowCount*PageNum
|
|
strTopInclude = "top " + tempShowPage;//RowCount*PageNum
|
|
strSql = String.Format("SELECT GID,ISLOCK=(case ISLOCK when 'True' then '1' when 'False' then '0' end)"
|
|
+ ",(case ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
//+ ",(select top 1 (case when REMARK like '%货权转移%' then '货权转移' else '' end) as ISREMARK from wms_out where ingidnew=wms.gid) as ISREMARK"
|
|
+ ",blno,CUSTOMNO,WMSNO,CUSTOMERNAME,STORAGENAME,ARCLIENT,TRUCKNAME,GOODSNAME,GOODSMODEL,isnull(GOODSPACK,0),isnull(GOODSPACKSTOCK,0),isnull(GOODSRKSL,0),isnull(GOODSSTOCK,0),CHARGEUNIT,isnull(ARFEE,0),isnull(APFEE,0),WMSOP,convert(char(10),WMSDATE,20) AS WMSDATE,convert(char(10),STARTBILLINGDATE,20) AS STARTBILLINGDATE,MARKETVALUE,BANKVALUE,BZTCHNO FROM (SELECT {1} * FROM wms WHERE GID NOT IN (SELECT {0} GID FROM wms where 1=1 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + " ORDER BY WMSDATE desc,WMSNO desc) and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim() + " ORDER BY WMSDATE desc,WMSNO desc) AS A", strTopNotInclude, strTopInclude);//,GOODSKGS
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strSql = " SELECT GID,ISLOCK=(case ISLOCK when 'True' then '1' when 'False' then '0' end)"
|
|
+ ",(case ISCHANGE when 1 then '货权转移' else '' end) as ISCHANGE"
|
|
//+ ",(select top 1 (case when REMARK like '%货权转移%' then '货权转移' else '' end) as ISREMARK from wms_out where ingidnew=wms.gid) as ISREMARK"
|
|
+ ",blno,CUSTOMNO,WMSNO,CUSTOMERNAME,STORAGENAME,ARCLIENT,TRUCKNAME,GOODSNAME,GOODSMODEL,isnull(GOODSPACK,0),isnull(GOODSPACKSTOCK,0),isnull(GOODSRKSL,0),isnull(GOODSSTOCK,0),CHARGEUNIT,isnull(ARFEE,0),isnull(APFEE,0),WMSOP,convert(char(10),WMSDATE,20) AS WMSDATE,convert(char(10),STARTBILLINGDATE,20) AS STARTBILLINGDATE,MARKETVALUE,BANKVALUE,BZTCHNO FROM wms WHERE 1<0";
|
|
}
|
|
DataTable logTable = GetSqlDataIndex(logDA.GetExcuteSql(strSql).Tables[0]);
|
|
|
|
logBuilder.Append("{");
|
|
logBuilder.Append("rows:[");
|
|
for (int i = 0; i < logTable.Rows.Count; i++)
|
|
{
|
|
logBuilder.Append("{id:\"" + logTable.Rows[i][0].ToString() + "\",");
|
|
logBuilder.Append("data:[");
|
|
logBuilder.Append("\"0\",");
|
|
for (int j = 1; j < logTable.Columns.Count; j++)
|
|
{
|
|
string ls = logTable.Rows[i][j].ToString();
|
|
ls = ls.Replace("\r\n", " ");
|
|
ls = ls.Replace("\n", " ");
|
|
//
|
|
if (j == logTable.Columns.Count - 1)
|
|
{
|
|
logBuilder.Append("\"" + ls + "\"");
|
|
}
|
|
else
|
|
{
|
|
logBuilder.Append("\"" + ls + "\",");
|
|
}
|
|
}
|
|
if (i == logTable.Rows.Count - 1)
|
|
{
|
|
logBuilder.Append("]}");
|
|
}
|
|
else
|
|
{
|
|
logBuilder.Append("]},");
|
|
}
|
|
|
|
}
|
|
logBuilder.Append("]");
|
|
logBuilder.Append("}");
|
|
return logBuilder.ToString();
|
|
}
|
|
|
|
private string GetSeaExPKGSInfoBusinessListGridSource()
|
|
{
|
|
//GetLogGridSource
|
|
LogDA logDA = new LogDA();
|
|
StringBuilder logBuilder = new StringBuilder();
|
|
StringBuilder userdateBuilder = new StringBuilder();
|
|
StringBuilder dataBuilder = new StringBuilder();
|
|
|
|
string strSql = String.Format("SELECT COUNT(*) FROM wms WHERE 1=1 and ISDELETE=0 " + ViewState["hid_sel"].ToString().Trim());
|
|
DataTable logTable = logDA.GetExcuteSql(strSql).Tables[0];
|
|
|
|
|
|
logBuilder.Append("{");
|
|
logBuilder.Append("rows:[");
|
|
for (int i = 0; i < logTable.Rows.Count; i++)
|
|
{
|
|
logBuilder.Append("{id:\"" + logTable.Rows[i][0].ToString() + "\",");
|
|
|
|
userdateBuilder.Append("userdata:{");
|
|
dataBuilder.Append("data:[");
|
|
|
|
for (int j = 1; j < logTable.Columns.Count; j++)
|
|
{
|
|
if (j == logTable.Columns.Count - 1)
|
|
{
|
|
userdateBuilder.Append("\"" + logTable.Columns[j].ColumnName + "\":\"" + logTable.Rows[i][j].ToString() + "\"");
|
|
dataBuilder.Append("\"" + logTable.Rows[i][j].ToString() + "\"");
|
|
}
|
|
else
|
|
{
|
|
userdateBuilder.Append("\"" + logTable.Columns[j].ColumnName + "\":\"" + logTable.Rows[i][j].ToString() + "\",");
|
|
dataBuilder.Append("\"" + logTable.Rows[i][j].ToString() + "\",");
|
|
}
|
|
}
|
|
userdateBuilder.Append("}");
|
|
dataBuilder.Append("]");
|
|
logBuilder.Append(userdateBuilder.ToString() + ",");
|
|
logBuilder.Append(dataBuilder);
|
|
|
|
if (i == logTable.Rows.Count - 1)
|
|
{
|
|
logBuilder.Append("}");
|
|
}
|
|
else
|
|
{
|
|
logBuilder.Append("},");
|
|
}
|
|
|
|
}
|
|
logBuilder.Append("]");
|
|
logBuilder.Append("}");
|
|
|
|
|
|
return logBuilder.ToString();
|
|
//return logBuilder.ToString();
|
|
|
|
}
|
|
|
|
private DataTable GetSqlDataIndex(DataTable tempTable)
|
|
{
|
|
UserSettingDA userSettingDA = new UserSettingDA();
|
|
UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserIDType(strUserID, strType);
|
|
GridEntity gridEntity = null;
|
|
|
|
StringBuilder settingBuilder = new StringBuilder();
|
|
|
|
DataTable dataTable = new DataTable();
|
|
if (userSettingEntity != null)
|
|
{
|
|
if (userSettingEntity.GID != null)
|
|
{
|
|
gridEntity = GetSettingXml(userSettingEntity.Xml);
|
|
|
|
int i = 0;
|
|
StringBuilder columnGroupBuilder = new StringBuilder();
|
|
dataTable.Columns.Add(tempTable.Columns[0].ColumnName, tempTable.Columns[0].DataType);
|
|
|
|
for (int k = 0; k < tempTable.Rows.Count; k++)
|
|
{
|
|
DataRow newRow = dataTable.NewRow();
|
|
newRow[tempTable.Columns[0].ColumnName] = tempTable.Rows[k][tempTable.Columns[0].ColumnName].ToString();
|
|
|
|
dataTable.Rows.Add(newRow);
|
|
}
|
|
|
|
while (gridEntity.Columns.Count > i)
|
|
{
|
|
foreach (GridColumnEntity column in gridEntity.Columns)
|
|
{
|
|
if (column.Index == i)
|
|
{
|
|
for (int j = 1; j < tempTable.Columns.Count; j++)
|
|
{
|
|
if (tempTable.Columns[j].ColumnName.Equals(column.Name))
|
|
{
|
|
dataTable.Columns.Add(tempTable.Columns[j].ColumnName, tempTable.Columns[j].DataType);
|
|
|
|
for (int k = 0; k < tempTable.Rows.Count; k++)
|
|
{
|
|
dataTable.Rows[k][tempTable.Columns[j].ColumnName] = tempTable.Rows[k][tempTable.Columns[j].ColumnName].ToString();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return tempTable;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return tempTable;
|
|
}
|
|
|
|
|
|
return dataTable;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|