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.
1357 lines
64 KiB
C#
1357 lines
64 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;
|
|
using DSWeb.Authority;
|
|
using DSWeb.DataAccess;
|
|
|
|
namespace DSWeb.Shipping
|
|
{
|
|
public partial class SeaExportGridSource : System.Web.UI.Page
|
|
{
|
|
private string strSearch;//委托信息查询条件
|
|
private int iCurrentPage;//当前页数
|
|
private int iShowPage;//显示最大页数
|
|
private string strHandle;//值为"page"获取分页状态值数组 值为"list"获取日志显示JSON数据 值为"columns"获取日志显示记录 值为"rename"更新列标题
|
|
public string strUserID;//用户GID
|
|
private string strBSNO;//委托业务GID
|
|
private string strids;//委托业务GIDS
|
|
private string stroplb;//委托业务类型
|
|
public string isbsstatus;//
|
|
private string strCompanyID;//公司GID
|
|
private string strShowName;//用户显示名
|
|
private string strDeptName;//部门名称
|
|
public string strCntr;//部门名称
|
|
private string strSortName;//排序名称
|
|
private string strSortIndex;//排序方向 asc desc
|
|
private string strSearchCacheName;//综合查询条件缓存
|
|
//private string strOldHeader;
|
|
//private string strNewHeader;
|
|
|
|
//UnicodeEncoding unicode = new UnicodeEncoding();
|
|
//public string strRange = String.Empty;//权限可视范围
|
|
//public string strSel = String.Empty;//查询条件
|
|
//RangeDA RangeDA = new RangeDA();
|
|
|
|
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["bsno"] != null)
|
|
{
|
|
strBSNO = Request.QueryString["bsno"].ToString();
|
|
}
|
|
if (Request.QueryString["gids"] != null)
|
|
{
|
|
strids = Request.QueryString["gids"].ToString();
|
|
}
|
|
if (Request.QueryString["oplb"] != null)
|
|
{
|
|
stroplb = Request.QueryString["oplb"].ToString();
|
|
}
|
|
if (Request.QueryString["isbsstatus"] != null)
|
|
{
|
|
isbsstatus = Request.QueryString["isbsstatus"].ToString().Trim();
|
|
}
|
|
if (Request.QueryString["cntr"] != null)
|
|
{
|
|
strCntr = Request.QueryString["cntr"].ToString();
|
|
}
|
|
if (Request.QueryString["search"] != null)
|
|
{
|
|
UnicodeEncoding unicode = new UnicodeEncoding();
|
|
strSearch = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["search"].ToString())));
|
|
}
|
|
if (Request.QueryString["cur_page"] != null)
|
|
{
|
|
iCurrentPage = int.Parse(Request.QueryString["cur_page"].ToString().Trim());
|
|
}
|
|
else
|
|
{
|
|
iCurrentPage = 0;
|
|
}
|
|
if (Request.QueryString["show_page"] != null)
|
|
{
|
|
iShowPage = int.Parse(Request.QueryString["show_page"].ToString().Trim());
|
|
}
|
|
else
|
|
{
|
|
iShowPage = 0;
|
|
}
|
|
|
|
if (Request.QueryString["sort"] != null)
|
|
{
|
|
strSortName = Request.QueryString["sort"].ToString().Trim().ToUpper();
|
|
}
|
|
|
|
if (Request.QueryString["sortindex"] != null)
|
|
{
|
|
strSortIndex = Request.QueryString["sortindex"].ToString().Trim().ToUpper();
|
|
|
|
if (strSortIndex.Equals("DES"))
|
|
{
|
|
strSortIndex = "DESC";
|
|
}
|
|
}
|
|
|
|
if (Request.QueryString["searchcachename"] != null)
|
|
{
|
|
strSearchCacheName = Request.QueryString["searchcachename"].ToString();
|
|
}
|
|
//权限可视范围
|
|
//strRange = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modOrderManagement");//委托管理列表
|
|
//if (strRange.Trim().Equals("0"))//全部
|
|
//{
|
|
// strRange = "";
|
|
//}
|
|
//else if (strRange.Trim().Equals("1"))//分公司
|
|
//{
|
|
// strRange = " and BSNO in(" + RangeDA.GetOrderManagementCompany(strUserID.Trim()) + ")";
|
|
//}
|
|
//else if (strRange.Trim().Equals("2"))//部门
|
|
//{
|
|
// strRange = " and BSNO in(" + RangeDA.GetOrderManagementDEPT(strUserID.Trim()) + ")";
|
|
//}
|
|
//else if (strRange.Trim().Equals("3"))//个人
|
|
//{
|
|
// strRange = " and BSNO in(" + RangeDA.GetOrderManagementPerson(strUserID.Trim()) + ")";
|
|
//}
|
|
//else if (strRange.Trim().Equals("4"))//无
|
|
//{
|
|
// strRange = " and 1<0";
|
|
//}
|
|
//else//空
|
|
//{
|
|
// strRange = " and 1<0";
|
|
//}
|
|
|
|
////
|
|
//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());
|
|
//}
|
|
//
|
|
//ViewState["hid_sel"] = "";
|
|
//strSel = "";
|
|
//if (Request.QueryString["tbNO"] != null && Request.QueryString["tbNO"].ToString().Trim()!="")
|
|
//{
|
|
// string tbNO = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["tbNO"].ToString().Trim())));
|
|
// strSel += " and (CUSTNO like '%" + tbNO + "%' or MBLNO like '%" + tbNO + "%' or HBLNO like '%" + tbNO + "%' or ORDERNO like '%" + tbNO + "%')";
|
|
//}
|
|
////
|
|
//if (Request.QueryString["VESSEL"] != null && Request.QueryString["VESSEL"].ToString().Trim()!="")
|
|
//{
|
|
// string strVESSEL = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["VESSEL"].ToString().Trim())));
|
|
// strSel += " and VESSEL='" + strVESSEL + "'";
|
|
//}
|
|
////
|
|
//if (Request.QueryString["VOYNO"] != null && Request.QueryString["VOYNO"].ToString().Trim()!="")
|
|
//{
|
|
// string strVOYNO = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["VOYNO"].ToString().Trim())));
|
|
// strSel += " and VOYNO='" + strVOYNO + "'";
|
|
//}
|
|
////
|
|
//if (Request.QueryString["tbETD"] != null && Request.QueryString["tbETD"].ToString().Trim()!="")
|
|
//{
|
|
// string s = Request.QueryString["tbETD"].ToString().Trim();
|
|
// strSel += " and convert(char(10),ETD,20)>='" + Request.QueryString["tbETD"].ToString().Trim() + "'";
|
|
//}
|
|
////
|
|
//if (Request.QueryString["tbETD2"] != null && Request.QueryString["tbETD2"].ToString().Trim()!="")
|
|
//{
|
|
// string s = Request.QueryString["tbETD2"].ToString().Trim();
|
|
// strSel += " and convert(char(10),ETD,20)<='" + Request.QueryString["tbETD2"].ToString().Trim() + "'";
|
|
//}
|
|
////
|
|
//if (Request.QueryString["CUSTOMERNAME"] != null && Request.QueryString["CUSTOMERNAME"].ToString().Trim()!="")
|
|
//{
|
|
// string strCUSTOMERNAME = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["CUSTOMERNAME"].ToString().Trim())));
|
|
// strSel += " and CUSTOMERNAME='" + strCUSTOMERNAME + "'";
|
|
//}
|
|
////
|
|
//if (Request.QueryString["ddlOP"] != null && Request.QueryString["ddlOP"].ToString().Trim() != "")
|
|
//{
|
|
// string strOP = unicode.GetString(unicode.GetBytes(Regex.Unescape(Request.QueryString["ddlOP"].ToString().Trim())));
|
|
// strSel += " and OP='" + strOP + "'";
|
|
//}
|
|
|
|
//
|
|
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(GetGridSource(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 == "list")
|
|
{
|
|
Response.Write(GetOpSeaeList());
|
|
}
|
|
if (strHandle == "listpage")
|
|
{
|
|
Response.Write(GetOpSeaeListPage());
|
|
}
|
|
if (strHandle.Trim().ToLower().Equals("delete"))
|
|
{
|
|
Response.Write(DeleteSeaExportOrder(strBSNO).ToString());
|
|
}
|
|
if (strHandle == "bsstatus")
|
|
{
|
|
Response.Write(editSeaeBsstatus());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strJSON = "-1";//GET 参数错误
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 业务锁定/解锁
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private string editSeaeBsstatus()
|
|
{
|
|
|
|
string alt = "";
|
|
string mblnos = "";
|
|
strids = strids.Replace(",","','");
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
string sSQL = "update " + stroplb + " set BSSTATUS=" + isbsstatus + " where bsno in('" + strids + "') ";
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(sSQL);
|
|
string strSQL="select mblno from "+stroplb.ToString()+" where bsno in ('"+strids.ToString()+"')";
|
|
DataSet dsMblno = T_ALL_DA.GetAllSQL(strSQL);
|
|
for (int i = 0; i < dsMblno.Tables[0].Rows.Count; i++)
|
|
{
|
|
mblnos +=dsMblno.Tables[0].Rows[i]["mblno"].ToString() + ",";
|
|
}
|
|
mblnos = mblnos.Remove(mblnos.Length-1,1);
|
|
if (bl)
|
|
{
|
|
alt = "";
|
|
SeaeOpertorSyslog(stroplb, isbsstatus, mblnos);
|
|
}
|
|
else
|
|
{
|
|
alt = "操作失败!";
|
|
}
|
|
return alt;
|
|
}
|
|
/// <summary>
|
|
/// 解锁和锁定的系统操作日志
|
|
/// </summary>
|
|
public void SeaeOpertorSyslog(string oplb,string status,string gids)
|
|
{
|
|
string strSQL = "";
|
|
if (oplb == "op_seae")
|
|
{
|
|
if (status == "1")
|
|
{
|
|
strSQL = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('海运出口委托信息列表','锁定','"+strShowName.ToString()+" 锁定了主提单号为:"+gids.ToString()+" 的海运出口委托信息','" + strUserID + "')";
|
|
}
|
|
else
|
|
{
|
|
strSQL = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('海运出口委托信息列表','解锁','" + strShowName.ToString() + " 解锁了主提单号为:" + gids.ToString() + " 的海运出口委托信息','" + strUserID + "')";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (status == "1")
|
|
{
|
|
strSQL = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('海运进口委托信息列表','锁定','" + strShowName.ToString() + " 锁定了主提单号为:" + gids.ToString() + " 的海运进口委托信息','" + strUserID + "')";
|
|
}
|
|
else
|
|
{
|
|
strSQL = "insert into sys_log(NAME,LOGTYPE,LOGCONTENT,CREATEUSER) values('海运进口委托信息列表','解锁','" + strShowName.ToString() + " 解锁了主提单号为:" + gids.ToString() + " 的海运进口委托信息','" + strUserID + "')";
|
|
}
|
|
}
|
|
SqlHelper.ExecuteSqlCommand(SqlHelper.ConnectionStringLocalTransaction, strSQL);
|
|
}
|
|
#region 获取海运出口委托总页数
|
|
/// <summary>
|
|
/// 获取海运出口委托总页数
|
|
/// </summary>
|
|
/// <returns>返回总页数</returns>
|
|
private int GetOpSeaeListPage()
|
|
{
|
|
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
|
|
string strSql = "SELECT COUNT(*) FROM op_seae WHERE 1 > 0 ";
|
|
|
|
string strCondition = "";
|
|
|
|
string strAuthorityCondition = "";
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modOrderManagement");
|
|
int itempoplb = 0;
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
{
|
|
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAELIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
strSql += strAuthorityCondition;
|
|
}
|
|
|
|
string tempCacheSearch = "";
|
|
if (strSearchCacheName != null)
|
|
{
|
|
tempCacheSearch = Session[strSearchCacheName].ToString();
|
|
|
|
string tempSearch = tempCacheSearch;
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
ArrayList optionList = new ArrayList();
|
|
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 "search1"://search1
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal1"://equal1
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type1"://type1
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value1"://value1
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option2":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search2"://search2
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal2"://equal2
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type2"://type2
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value2"://value3
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option3":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search3"://search3
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal3"://equal3
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type3"://type3
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value3"://value4
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option4":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search4"://search4
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal4"://equal4
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type4"://type4
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value4"://value4
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option5":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search5"://search5
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal5"://equal5
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type5"://type5
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value5"://value5
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option6":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search6"://search6
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal6"://equal6
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type6"://type6
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value6"://value6
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
//}
|
|
}
|
|
strCondition = " AND " + strCondition + " ";
|
|
strSql += strCondition;
|
|
}
|
|
else 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 ETD >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "etime"://ETD EndDate
|
|
strCondition += String.Format(" AND ETD <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "cus"://CUSTOMER
|
|
strCondition += String.Format(" AND CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "no"://NO
|
|
strCondition += String.Format(" AND (CUSTNO LIKE '%{0}%' OR MBLNO LIKE '%{0}%' OR HBLNO LIKE '%{0}%' OR ORDERNO like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "op"://OP
|
|
strCondition += String.Format(" AND OP LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "vessel"://VESSEL
|
|
strCondition += String.Format(" AND VESSEL LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "voyno"://VOYNO
|
|
strCondition += String.Format(" AND VOYNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "bty"://业务类别
|
|
itempoplb = int.Parse(strArg[1].Replace("\"", ""));
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
strSql += strCondition;
|
|
}
|
|
}
|
|
|
|
int iTotal = int.Parse(seaExportInfoDA.GetExcuteSql(strSql).Tables[0].Rows[0][0].ToString());
|
|
|
|
return iTotal;
|
|
}
|
|
#endregion
|
|
private string GetOpSeaeList()
|
|
{
|
|
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
|
|
DataTable sourceTable;
|
|
|
|
string strCondition = "";
|
|
string strTopInclude = "";
|
|
string strTopNotInclude = "";
|
|
|
|
string tempCacheSearch = "";
|
|
if (strSearchCacheName != null)
|
|
{
|
|
tempCacheSearch = Session[strSearchCacheName].ToString();
|
|
|
|
string tempSearch = tempCacheSearch;
|
|
tempSearch = tempSearch.Replace("{", "");
|
|
tempSearch = tempSearch.Replace("}", "");
|
|
tempSearch = tempSearch.Replace("[", "");
|
|
tempSearch = tempSearch.Replace("]", "");
|
|
|
|
string[] searchArg = tempSearch.Split(new char[] { ',' });
|
|
|
|
ArrayList optionList = new ArrayList();
|
|
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 "search1"://search1
|
|
strCondition += "( "+String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal1"://equal1
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type1"://type1
|
|
strCondition = String.Format(strCondition,GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value1"://value1
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option2":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search2"://search2
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal2"://equal2
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type2"://type2
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value2"://value3
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option3":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search3"://search3
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal3"://equal3
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type3"://type3
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value3"://value4
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option4":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search4"://search4
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal4"://equal4
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type4"://type4
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value4"://value4
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option5":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search5"://search5
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal5"://equal5
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type5"://type5
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value5"://value5
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
case "option6":
|
|
strCondition = GetOption(strArg[1].Replace("\"", "").Trim(), optionList, strCondition);
|
|
optionList.Add(strArg[1].Replace("\"", "").Trim());
|
|
break;
|
|
case "search6"://search6
|
|
strCondition += "( " + String.Format(" {0} ", strArg[1].Replace("\"", "").Trim().ToUpper());
|
|
break;
|
|
case "equal6"://equal6
|
|
strCondition += GetEqual(strArg[1].Replace("\"", "").Trim().ToLower());
|
|
break;
|
|
case "type6"://type6
|
|
strCondition = String.Format(strCondition, GetEqualValueType(strArg[1].Replace("\"", "").Trim().ToLower()));
|
|
break;
|
|
case "value6"://value6
|
|
strCondition = String.Format(strCondition, strArg[1].Replace("\"", "").Trim()) + " )";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
//}
|
|
}
|
|
strCondition = " AND " + strCondition + " ";
|
|
}
|
|
else 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 ETD >= '{0}' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "etime"://ETD EndDate
|
|
strCondition += String.Format(" AND ETD <= '{0}' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "cus"://CUSTOMER
|
|
strCondition += String.Format(" AND CUSTOMERNAME LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "no"://NO
|
|
strCondition += String.Format(" AND (CUSTNO LIKE '%{0}%' OR MBLNO LIKE '%{0}%' OR HBLNO LIKE '%{0}%' OR ORDERNO like '%{0}%')", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "op"://OP
|
|
strCondition += String.Format(" AND OP LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "vessel"://VESSEL
|
|
strCondition += String.Format(" AND VESSEL LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
case "voyno"://VOYNO
|
|
strCondition += String.Format(" AND VOYNO LIKE '%{0}%' ", strArg[1].Replace("\"", ""));
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
string strAuthorityCondition = "";
|
|
UserAuthorityManage userAuthorityManage = new UserAuthorityManage(strUserID, "modOrderManagement");
|
|
|
|
if (userAuthorityManage.OperateType != AuthorityType.NULL)
|
|
{
|
|
strAuthorityCondition = userAuthorityManage.GetVisibleRangeSql(userAuthorityManage.VisibleType, ModuleType.OPSEAELIST, strShowName, strCompanyID, strDeptName, strUserID);
|
|
}
|
|
|
|
string strSortCondition = "";
|
|
|
|
if (strSortName != null && strSortIndex != null)
|
|
{
|
|
strSortCondition = String.Format(" ORDER BY {0} {1},CREATETIME DESC", strSortName, strSortIndex);
|
|
}
|
|
else
|
|
{
|
|
strSortCondition = String.Format(" ORDER BY {0} {1},CREATETIME DESC", "ETD", "DESC");
|
|
}
|
|
string strSql = "";
|
|
if (iCurrentPage > 0 && iShowPage > 0)
|
|
{
|
|
if (iCurrentPage == 1)
|
|
{//业务封账 接受委托
|
|
strSql = String.Format("SELECT {0} BSNO,CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS,CASE WHEN FEESTATUS = 1 THEN '锁定' ELSE '未锁定' END as FEESTATUS"
|
|
+ ",OPSTATUS=(select top 1 STATUS from op_status where bsno=[op_seae].bsno order by INPUTTIME desc)"
|
|
+ ",ORDERTYPE,INPUTBY,convert(char(10),BSDATE,20) AS BSDATE,VESSEL,VOYNO,MBLNO,convert(char(10),ETD,20) AS ETD,SHIPPERID,CUSTOMERNAME,CNTRTOTAL,FORWARDER,SALE,OP,DOC,CUSTSERVICE,LANE,PORTLOAD,PORTDISCHARGE,PLACEDELIVERY,DESTINATION"
|
|
+ ",ACCDATE,HBLNO,CUSTNO,TRANSNO,BLTYPE,YARD,CLOSINGDATE,ETA"
|
|
+ ",SERVICE,GOODSNAME,KGS,CBM,PKGS,KINDPKGS,TEU,CARRIER,CUSTOMSER,TRUCKER"
|
|
+ ",INVNO,BSSOURCE,BSSOURCEDETAIL,ORDTYPE,ORDERNO,PACKINGTYPE,WAREHOUSE,convert(char(10),CLOSEDOCDATE,20) AS CLOSEDOCDATE,INTOPORTDATE,OTCNTR"
|
|
+ strCntr
|
|
+ " FROM op_seae where 1>0 " + strAuthorityCondition + strCondition + strSortCondition, "top " + iShowPage.ToString());
|
|
}
|
|
else
|
|
{//业务封账 接受委托
|
|
strTopNotInclude = "top " + (iShowPage * (iCurrentPage - 1)).ToString();//RowCount*PageNum
|
|
strTopInclude = "top " + iShowPage.ToString();
|
|
|
|
strSql = String.Format("SELECT {0} BSNO,CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS,CASE WHEN FEESTATUS = 1 THEN '锁定' ELSE '未锁定' END as FEESTATUS"
|
|
+ ",OPSTATUS=(select top 1 STATUS from op_status where bsno=[op_seae].bsno order by INPUTTIME desc)"
|
|
+ ",ORDERTYPE,INPUTBY,convert(char(10),BSDATE,20) AS BSDATE,VESSEL,VOYNO,MBLNO,convert(char(10),ETD,20) AS ETD,SHIPPERID,CUSTOMERNAME,CNTRTOTAL,FORWARDER,SALE,OP,DOC,CUSTSERVICE,LANE,PORTLOAD,PORTDISCHARGE,PLACEDELIVERY,DESTINATION"
|
|
+ ",ACCDATE,HBLNO,CUSTNO,TRANSNO,BLTYPE,YARD,CLOSINGDATE,ETA"
|
|
+ ",SERVICE,GOODSNAME,KGS,CBM,PKGS,KINDPKGS,TEU,CARRIER,CUSTOMSER,TRUCKER"
|
|
+ ",INVNO,BSSOURCE,BSSOURCEDETAIL,ORDTYPE,ORDERNO,PACKINGTYPE,WAREHOUSE,convert(char(10),CLOSEDOCDATE,20) AS CLOSEDOCDATE,INTOPORTDATE,OTCNTR "
|
|
+ strCntr
|
|
+ " FROM op_seae WHERE BSNO NOT IN "
|
|
+ " (SELECT {1} BSNO FROM op_seae WHERE 1>0 " + strAuthorityCondition + strCondition + strSortCondition+") " + strAuthorityCondition + strCondition
|
|
+ strSortCondition, strTopInclude, strTopNotInclude);
|
|
}
|
|
}
|
|
else
|
|
{//业务封账 接受委托
|
|
strSql = String.Format("SELECT BSNO,CASE WHEN BSSTATUS = 1 THEN '锁定' ELSE '未锁定' END as BSSTATUS,CASE WHEN FEESTATUS = 1 THEN '锁定' ELSE '未锁定' END as FEESTATUS"
|
|
+ ",OPSTATUS=(select top 1 STATUS from op_status where bsno=[op_seae].bsno order by INPUTTIME desc)"
|
|
+ ",ORDERTYPE,INPUTBY,convert(char(10),BSDATE,20) AS BSDATE,VESSEL,VOYNO,MBLNO,convert(char(10),ETD,20) AS ETD,SHIPPERID,CUSTOMERNAME,CNTRTOTAL,FORWARDER,SALE,OP,DOC,CUSTSERVICE,LANE,PORTLOAD,PORTDISCHARGE,PLACEDELIVERY,DESTINATION"
|
|
+ ",ACCDATE,HBLNO,CUSTNO,TRANSNO,BLTYPE,YARD,CLOSINGDATE,ETA"
|
|
+ ",SERVICE,GOODSNAME,KGS,CBM,PKGS,KINDPKGS,TEU,CARRIER,CUSTOMSER,TRUCKER"
|
|
+ ",INVNO,BSSOURCE,BSSOURCEDETAIL,ORDTYPE,ORDERNO,PACKINGTYPE,WAREHOUSE,convert(char(10),CLOSEDOCDATE,20) AS CLOSEDOCDATE,INTOPORTDATE,OTCNTR "
|
|
+ strCntr
|
|
+ " FROM op_seae where 1>0 " + strAuthorityCondition + strCondition + strSortCondition);
|
|
}
|
|
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++)
|
|
{
|
|
if (j == sourceTable.Columns.Count - 1)
|
|
{
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\"");
|
|
}
|
|
else
|
|
{
|
|
sourceBuilder.Append("\"" + sourceTable.Rows[i][j].ToString() + "\",");
|
|
}
|
|
}
|
|
if (i == sourceTable.Rows.Count - 1)
|
|
{
|
|
sourceBuilder.Append("]}");
|
|
}
|
|
else
|
|
{
|
|
sourceBuilder.Append("]},");
|
|
}
|
|
|
|
}
|
|
sourceBuilder.Append("]");
|
|
sourceBuilder.Append("}");
|
|
|
|
return sourceBuilder.ToString();
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
private string GetEqualValueType(string typeName)
|
|
{
|
|
string tempResult = "";
|
|
|
|
switch (typeName)
|
|
{
|
|
case "str":
|
|
tempResult = "'{0}'";
|
|
break;
|
|
case "sdate":
|
|
tempResult = "'{0}'";
|
|
break;
|
|
case "bool":
|
|
tempResult = "{0}";
|
|
break;
|
|
case "int":
|
|
tempResult = "{0}";
|
|
break;
|
|
}
|
|
|
|
return tempResult;
|
|
}
|
|
|
|
private int DeleteSeaExportOrder(string tempBSNO)
|
|
{
|
|
int iResult = 0;
|
|
SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
|
|
TopSeaeEntity TopSeaeEntity = new TopSeaeEntity();
|
|
TopSeaeEntity = seaExportInfoDA.GetID(tempBSNO);
|
|
|
|
if (TopSeaeEntity.BSSTATUS)
|
|
{
|
|
iResult = -3;//当前业务为锁定状态,不允许删除此业务!//业务封帐
|
|
}
|
|
else
|
|
{
|
|
//
|
|
//if (strShowName.Trim() != TopSeaeEntity.OP.ToString().Trim())
|
|
//{
|
|
// iResult = -4;//您不是当前业务的操作,无删除此业务的权限!
|
|
//}
|
|
//else
|
|
//{
|
|
FeeDA feeDA = new FeeDA();
|
|
IList<FeeEntity> feeEntities = feeDA.GetFeeByBSNO(tempBSNO);
|
|
if (feeEntities.Count > 0)
|
|
{
|
|
iResult = -5;//有与海运出口委托相关联的费用信息
|
|
}
|
|
else
|
|
{
|
|
iResult = seaExportInfoDA.DeleteOrder(tempBSNO);
|
|
}
|
|
//}
|
|
}
|
|
return iResult;
|
|
}
|
|
private int UpdateColumnHeader(string tempOldHeader, string tempNewHeader)
|
|
{
|
|
int iResult = 0;
|
|
UserSettingDA userSettingDA = new UserSettingDA();
|
|
UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserID(strUserID);
|
|
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.GetUserSettingByUserID(strUserID);
|
|
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 = String.Format("SELECT COUNT(*) FROM op_seae where 1=1 " + strSel.Trim() + strRange);
|
|
|
|
// int iTotal = seaExportInfoDA.GetPageTotal(strSql);
|
|
|
|
// return iTotal;
|
|
//}
|
|
//private string GetGridSource(int tempShowPage, int tempCurPage)
|
|
//{
|
|
// SeaExportInfoDA seaExportInfoDA = new SeaExportInfoDA();
|
|
// StringBuilder logBuilder = new StringBuilder();
|
|
|
|
// //SELECT {0} A.GID, A.NAME, A.LOGTYPE, A.LOGTIME, A.LOGCONTENT,B.USERNAME FROM sys_log as A INNER JOIN [user] as B ON A.CREATEUSER = B.GID AND
|
|
// string strSql = "";
|
|
// string strTopInclude = "";
|
|
// string strTopNotInclude = "";
|
|
// if (tempShowPage > 0 && tempCurPage > 0)
|
|
// {
|
|
// if (tempCurPage == 1)
|
|
// {
|
|
// // var headerArgs = new Array("业务状态", "费用状态", "委托方式", "录入人", "录入日期",
|
|
// //"船名", "航次", "主提单号", "开船日期", "发货人", "委托单位", "集装箱", "订舱代理", "揽货人", "操作", "单证", "客服", "航线", "装货港", "卸货港", "交货地", "目的地",
|
|
// //"会计期间", "分提单号", "委托编号", "运单号", "装运方式", "场站", "截港日期", "预抵日期",
|
|
// //"运输条款", "品名", "货物毛重", "货物尺码", "件数", "包装", "箱TEU", "船公司", "报关行", "承运车队",
|
|
// //"发票号", "业务来源", "来源明细", "订舱类型", "订舱编号", "装箱类型", "仓库", "截单日期", "集港日期");
|
|
|
|
// strSql = String.Format("SELECT {0} BSNO,CASE WHEN BSSTATUS = 1 THEN '业务封账' ELSE '接受委托' END as BSSTATUS,CASE WHEN FEESTATUS = 1 THEN '锁定' ELSE '未锁定' END as FEESTATUS,ORDERTYPE,INPUTBY,BSDATE"
|
|
// + ",VESSEL,VOYNO,MBLNO,ETD,SHIPPERID,CUSTOMERNAME,CNTRTOTAL,FORWARDER,SALE,OP,DOC,CUSTSERVICE,LANE,PORTLOAD,PORTDISCHARGE,PLACEDELIVERY,DESTINATION"
|
|
// + ",ACCDATE,HBLNO,CUSTNO,TRANSNO,BLTYPE,YARD,CLOSINGDATE,ETA"
|
|
// + ",SERVICE,GOODSNAME,KGS,CBM,PKGS,KINDPKGS,TEU,CARRIER,CUSTOMSER,TRUCKER"
|
|
// + ",INVNO,BSSOURCE,BSSOURCEDETAIL,ORDTYPE,ORDERNO,PACKINGTYPE,WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE "
|
|
// + " FROM op_seae where 1=1 " + strSel.Trim() + strRange + " ORDER BY VESSEL,VOYNO,ETD DESC", "top " + tempShowPage);
|
|
// }
|
|
// else
|
|
// {
|
|
// strTopNotInclude = "top " + (tempShowPage * (tempCurPage - 1));//RowCount*PageNum
|
|
// strTopInclude = "top " + tempShowPage;//RowCount*PageNum
|
|
|
|
// strSql = String.Format("SELECT {1} BSNO,CASE WHEN BSSTATUS = 1 THEN '业务封账' ELSE '接受委托' END as BSSTATUS,CASE WHEN FEESTATUS = 1 THEN '锁定' ELSE '未锁定' END as FEESTATUS,ORDERTYPE,INPUTBY,BSDATE"
|
|
// + ",VESSEL,VOYNO,MBLNO,ETD,SHIPPERID,CUSTOMERNAME,CNTRTOTAL,FORWARDER,SALE,OP,DOC,CUSTSERVICE,LANE,PORTLOAD,PORTDISCHARGE,PLACEDELIVERY,DESTINATION"
|
|
// + ",ACCDATE,HBLNO,CUSTNO,TRANSNO,BLTYPE,YARD,CLOSINGDATE,ETA"
|
|
// + ",SERVICE,GOODSNAME,KGS,CBM,PKGS,KINDPKGS,TEU,CARRIER,CUSTOMSER,TRUCKER"
|
|
// + ",INVNO,BSSOURCE,BSSOURCEDETAIL,ORDTYPE,ORDERNO,PACKINGTYPE,WAREHOUSE,CLOSEDOCDATE,INTOPORTDATE "
|
|
// + " FROM op_seae WHERE BSNO NOT IN ("
|
|
// + "SELECT {0} BSNO FROM op_seae"
|
|
// + " where 1=1 " + strSel.Trim() + strRange
|
|
// + " ORDER BY VESSEL,VOYNO DESC )"
|
|
// + strSel.Trim() + strRange
|
|
// + " ORDER BY VESSEL,VOYNO,ETD DESC ", strTopNotInclude, strTopInclude);
|
|
// }
|
|
// }
|
|
// else
|
|
// {
|
|
// return "";//如果页数为空或者页数为0不返回数据
|
|
// }
|
|
|
|
|
|
// DataTable logTable = GetSqlDataIndex(seaExportInfoDA.GetSeaExportListByCondition(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:[");
|
|
// for (int j = 1; j < logTable.Columns.Count; j++)
|
|
// {
|
|
// if (j == logTable.Columns.Count - 1)
|
|
// {
|
|
// logBuilder.Append("\"" + logTable.Rows[i][j].ToString() + "\"");
|
|
// }
|
|
// else
|
|
// {
|
|
// logBuilder.Append("\"" + logTable.Rows[i][j].ToString() + "\",");
|
|
// }
|
|
// }
|
|
// if (i == logTable.Rows.Count - 1)
|
|
// {
|
|
// logBuilder.Append("]}");
|
|
// }
|
|
// else
|
|
// {
|
|
// logBuilder.Append("]},");
|
|
// }
|
|
|
|
// }
|
|
// logBuilder.Append("]");
|
|
// logBuilder.Append("}");
|
|
|
|
// return logBuilder.ToString();
|
|
|
|
//}
|
|
|
|
private DataTable GetSqlDataIndex(DataTable tempTable)
|
|
{
|
|
//UserSettingDA userSettingDA = new UserSettingDA();
|
|
//UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserID(strUserID);
|
|
//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;
|
|
//}
|
|
|
|
//for (int i = 0; i < tempTable.Rows.Count; i++)
|
|
//{
|
|
// tempTable.Rows[i]["GROSSWEIGHT"] = ToDBC(tempTable.Rows[i]["GROSSWEIGHT"].ToString());
|
|
|
|
//}
|
|
return tempTable;
|
|
}
|
|
|
|
public static string ToDBC(string input)
|
|
{
|
|
char[] c = input.ToCharArray();
|
|
for (int i = 0; i < c.Length; i++)
|
|
{
|
|
if (c[i] == 12288)
|
|
{
|
|
c[i] = (char)32;
|
|
continue;
|
|
}
|
|
if (c[i] > 65280 && c[i] < 65375)
|
|
c[i] = (char)(c[i] - 65248);
|
|
}
|
|
return new string(c);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|