using System; using System.Collections; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Linq; 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.Xml.Linq; using DSWeb.EntityDA; using DSWeb.Models; using JsonHelper; using System.Xml; namespace DSWeb.Shipping { public partial class SeaExportInfoBlissueSurAudit : System.Web.UI.Page { TopSeaeBillmanageDA TopSeaeBillmanageDA = new TopSeaeBillmanageDA(); T_ALL_DA T_ALL_DA = new T_ALL_DA(); RangeDA RangeDA = new RangeDA(); //grid private string strColumnVal; public string strUserID = "";//"04eaeac5-f271-45d1-b17b-ad4ccbab63d0"; private string strType = "24";//Grid模块号 //gridEnd 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 = ""; } // //grid if (!IsPostBack) { } if (hid_setting.Value.Trim() != "") { strColumnVal = hid_setting.Value.Trim(); SaveColumnSetting(strColumnVal); hid_setting.Value = ""; } if (hid_header.Value.Trim() != "") { strColumnVal = hid_header.Value.Trim(); SaveColumnSetting(strColumnVal); hid_header.Value = ""; } //gridEnd // /* //权限可视范围 this.hdRangeV.Value = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modOrderManagement"); this.hdRangeO.Value = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modOrderManagement"); //页面是否只读 if (Request.QueryString["hdenabled"] != null) { if (Request.QueryString["hdenabled"].ToString() == "false") { this.hdRangeO.Value = "4"; } } string alt = ""; if (this.hdRangeV.Value.Trim() != this.hdRangeO.Value.Trim()) { if (this.hdRangeO.Value.Trim().Equals("0"))//全部 { } else if (this.hdRangeO.Value.Trim().Equals("1"))//分公司 { alt = RangeDA.GetOrderManagementCompany(strUserID.Trim(), this.hid_BSNO.Value.Trim()); if (alt == "") { this.imgApply.Disabled = true; this.hdqx.Value = "0"; } } else if (this.hdRangeO.Value.Trim().Equals("2"))//部门 { alt = RangeDA.GetOrderManagementDEPT(strUserID.Trim(), this.hid_BSNO.Value.Trim()); if (alt == "") { this.imgApply.Disabled = true; this.hdqx.Value = "0"; } } else if (this.hdRangeO.Value.Trim().Equals("3"))//个人 { alt = RangeDA.GetOrderManagementPerson(strUserID.Trim(), this.hid_BSNO.Value.Trim()); if (alt == "") { this.imgApply.Disabled = true; this.hdqx.Value = "0"; } } else if (this.hdRangeO.Value.Trim().Equals("4"))//无 { this.imgApply.Disabled = true; this.hdqx.Value = "0"; } } // */ } protected void btSQDF_Click(object sender, EventArgs e) { string alt = ""; string alt2 = ""; //批准电放 if (this.hdSur.Value.Trim() != "") { int iResult = 0; T_ALL_DA T_ALL_DA = new T_ALL_DA(); string strOPNAME = T_ALL_DA.GetSHOWNAME(strUserID); OpBlissueDA OpBlissueDA = new OpBlissueDA(); OpBlissueEntity OpBlissueEntity = new OpBlissueEntity(); OpBlissueEntity OpBlissueEntity1 = new OpBlissueEntity(); // string[] txtval = this.hdSur.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < txtval.Length; i++) { OpBlissueEntity1 = OpBlissueDA.GetOpBlissueID(txtval[i].ToString().Trim()); //本业务已有批准操作,不允许重复操作! string pd = ""; pd = T_ALL_DA.GetStrSQL("BLSTATUS", "select BLSTATUS from op_blissue where bsno='" + OpBlissueEntity1.BSNO.ToString().Trim() + "' and BLSTATUS='批准电放'"); if (pd != "") { //本业务已有批准操作,不允许重复操作! continue; } else { // OpBlissueEntity.BSNO = OpBlissueEntity1.BSNO; OpBlissueEntity.BLNO = OpBlissueEntity1.BLNO;//单证编号 OpBlissueEntity.BLNAME = "提单";//单证名称 OpBlissueEntity.BLSTATUS = "批准电放";//处理状态 OpBlissueEntity.BLORDERNO = "";//单证流水号 OpBlissueEntity.ISSUETYPE = OpBlissueEntity1.ISSUETYPE;//签单方式 OpBlissueEntity.OPNAME = strOPNAME;//处理人 //OpBlissueEntity.OPTIME;//处理时间 OpBlissueEntity.BSINKNO = "";//关联编号 OpBlissueEntity.REMARK = "";//备注 OpBlissueEntity.DElFLAG = false;//撤销标志 OpBlissueEntity.EXPRESSCORP = "";//快递公司 OpBlissueEntity.EXPRESSNO = "";//快递号 OpBlissueEntity.ISADD = OpBlissueEntity1.ISADD;// OpBlissueEntity.PUTSINGLETIME = OpBlissueEntity1.PUTSINGLETIME;// OpBlissueEntity.PUTSINGLE = OpBlissueEntity1.PUTSINGLE;// OpBlissueEntity.PAYTIME = OpBlissueEntity1.PAYTIME;// OpBlissueEntity.PAYRMB = OpBlissueEntity1.PAYRMB;// OpBlissueEntity.PAYUSD = OpBlissueEntity1.PAYUSD;// // iResult = OpBlissueDA.InserInfo(OpBlissueEntity); if (iResult > 0) { //64784D94-420F-46D2-BDC1-471437278965 提单电放审核 IList messageEntities = new List(); MessageDA messageDA = new MessageDA(); MessageEntity messageEntity = new MessageEntity(); // string opnameid = T_ALL_DA.GetStrSQL("GID", "select GID from [user] where SHOWNAME='" + OpBlissueEntity1.OPNAME.ToString() + "' and ISDELETED=0"); // messageEntity.GID = Guid.NewGuid().ToString(); messageEntity.Name = "BLISSUESURRETURN";//英文名称自定义 messageEntity.Description = "申请电放审核通过"; messageEntity.IsRead = false; messageEntity.ReadCount = 0; messageEntity.MessageContent = strOPNAME + " 审核通过了您申请的提单电放,提单号为:" + OpBlissueEntity.BLNO.ToString() + "!";//消息内容 messageEntity.TaskID = OpBlissueEntity.BSNO.ToString();//bsno messageEntity.Receiver = opnameid;//收件人id messageEntity.TaskUrl = messageEntity.TaskUrl = "Shipping/SeaExportInfoBlissueSur.aspx?id=" + OpBlissueEntity.BSNO.ToString();//审核页面的地址 messageEntity.Type = messageDA.GetMessageType(MessageType.BLISSUESUR); messageEntity.RecvType = 3;//审核完成类型 messageEntities.Add(messageEntity); if (messageEntities.Count > 0) { messageDA.CreateMessage(MessageType.BLISSUESUR, messageEntities); } } else { alt += "," + OpBlissueEntity1.BLNO.ToString().Trim(); } } } } //批准放单 if (this.hdPut.Value.Trim() != "") { int iResult = 0; T_ALL_DA T_ALL_DA = new T_ALL_DA(); string strOPNAME = T_ALL_DA.GetSHOWNAME(strUserID); OpBlissueDA OpBlissueDA = new OpBlissueDA(); OpBlissueEntity OpBlissueEntity = new OpBlissueEntity(); OpBlissueEntity OpBlissueEntity1 = new OpBlissueEntity(); // string[] txtval = this.hdPut.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < txtval.Length; i++) { OpBlissueEntity1 = OpBlissueDA.GetOpBlissueID(txtval[i].ToString().Trim()); //本业务已有批准操作,不允许重复操作! string pd = ""; pd = T_ALL_DA.GetStrSQL("BLSTATUS", "select BLSTATUS from op_blissue where bsno='" + OpBlissueEntity1.BSNO.ToString().Trim() + "' and BLSTATUS='批准放单'"); if (pd != "") { //本业务已有批准操作,不允许重复操作! continue; } else { OpBlissueEntity.BSNO = OpBlissueEntity1.BSNO; OpBlissueEntity.BLNO = OpBlissueEntity1.BLNO;//单证编号 OpBlissueEntity.BLNAME = "提单";//单证名称 OpBlissueEntity.BLSTATUS = "批准放单";//处理状态 OpBlissueEntity.BLORDERNO = "";//单证流水号 OpBlissueEntity.ISSUETYPE = OpBlissueEntity1.ISSUETYPE;//签单方式 OpBlissueEntity.OPNAME = strOPNAME;//处理人 //OpBlissueEntity.OPTIME;//处理时间 OpBlissueEntity.BSINKNO = "";//关联编号 OpBlissueEntity.REMARK = "";//备注 OpBlissueEntity.DElFLAG = false;//撤销标志 OpBlissueEntity.EXPRESSCORP = "";//快递公司 OpBlissueEntity.EXPRESSNO = "";//快递号 OpBlissueEntity.ISADD = OpBlissueEntity1.ISADD;// OpBlissueEntity.PUTSINGLETIME = OpBlissueEntity1.PUTSINGLETIME;// OpBlissueEntity.PUTSINGLE = OpBlissueEntity1.PUTSINGLE;// OpBlissueEntity.PAYTIME = OpBlissueEntity1.PAYTIME;// OpBlissueEntity.PAYRMB = OpBlissueEntity1.PAYRMB;// OpBlissueEntity.PAYUSD = OpBlissueEntity1.PAYUSD;// // iResult = OpBlissueDA.InserInfo(OpBlissueEntity); if (iResult > 0) { //64784D94-420F-46D2-BDC1-471437278965 提单放单审核 IList messageEntities = new List(); MessageDA messageDA = new MessageDA(); MessageEntity messageEntity = new MessageEntity(); // string opnameid = T_ALL_DA.GetStrSQL("GID", "select GID from [user] where SHOWNAME='" + OpBlissueEntity1.OPNAME.ToString() + "' and ISDELETED=0"); // messageEntity.GID = Guid.NewGuid().ToString(); messageEntity.Name = "BLISSUEPUTRETURN";//英文名称自定义 messageEntity.Description = "放单申请审核通过"; messageEntity.IsRead = false; messageEntity.ReadCount = 0; messageEntity.MessageContent = strOPNAME + " 审核通过了您申请的放单申请,提单号为:" + OpBlissueEntity.BLNO.ToString() + "!";//消息内容 messageEntity.TaskID = OpBlissueEntity.BSNO.ToString();//bsno messageEntity.Receiver = opnameid;//收件人id messageEntity.TaskUrl = messageEntity.TaskUrl = "Shipping/SeaExportInfoBlissueSur.aspx?id=" + OpBlissueEntity.BSNO.ToString();//审核页面的地址 messageEntity.Type = messageDA.GetMessageType(MessageType.BLISSUEPUT); messageEntity.RecvType = 3;//审核完成类型 messageEntities.Add(messageEntity); if (messageEntities.Count > 0) { messageDA.CreateMessage(MessageType.BLISSUEPUT, messageEntities); } } else { alt2 += "," + OpBlissueEntity1.BLNO.ToString().Trim(); } } } } // if (alt != "") { alt = alt.Trim().Substring(1); } // if (alt2 != "") { alt2 = alt2.Trim().Substring(1); } // if (alt == "" && alt2=="") { //Page.ClientScript.RegisterStartupScript(this.GetType(), "key", ""); return; } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "key", ""); return; } } #region Grid参数 private void SaveColumnSetting(string tempColumnVal) { JsonColumnGroupEntity jsonColumnGroupEntity = GetPostEntity(tempColumnVal); List jsonColumnEntities = new List(); UserSettingDA userSettingDA = new UserSettingDA(); UserSettingEntity userSettingEntity = userSettingDA.GetUserSettingByUserIDType(strUserID, strType); if (userSettingEntity.GID != null) { userSettingEntity.ModifiedUser = strUserID; GridEntity gridEntity = null; List gridColumnEntities = new List(); gridEntity = GetSettingXml(userSettingEntity.Xml); gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount; foreach (JsonColumnEntity jColumn in jsonColumnGroupEntity.JsonColumnEntities) { foreach (GridColumnEntity gColumn in gridEntity.Columns) { if (gColumn.Description.Equals(jColumn.col3)) { gColumn.Description = jColumn.col3; gColumn.Width = jColumn.col5; gColumn.Index = jColumn.col4; if (jColumn.col6 != -1) { gColumn.VisibleState = jColumn.col6; } //gridColumnEntities.Add(gColumn); break; } } } //Columns //gridEntity.Columns = gridColumnEntities; userSettingEntity.Xml = SaveUserSetting(gridEntity).OuterXml; int iResult = userSettingDA.UpdateUserSetting(userSettingEntity); } else { if (jsonColumnGroupEntity != null) { userSettingEntity = new UserSettingEntity(); userSettingEntity.GID = Guid.NewGuid().ToString(); userSettingEntity.Name = "SeaExportInfoBlissueSurAuditGridSetting"; userSettingEntity.Description = "提单电放审核Grid设置"; userSettingEntity.UserID = strUserID; userSettingEntity.Type = 1;//type值为1表示Grid string strRequestUrl = Request.Url.ToString(); string strUrl = strRequestUrl.Substring(0, strRequestUrl.LastIndexOf("/")); string strPage = strRequestUrl.Substring(strRequestUrl.LastIndexOf("/") + 1, strRequestUrl.Length - strRequestUrl.LastIndexOf("/") - 1); userSettingEntity.Url = strUrl; userSettingEntity.Page = strPage; userSettingEntity.CreateUser = strUserID; GridEntity gridEntity = new GridEntity(); gridEntity.GID = userSettingEntity.GID; gridEntity.UserID = strUserID; gridEntity.GroupBy = ""; gridEntity.DefaultPrePageCount = 15; gridEntity.PagePreCount = jsonColumnGroupEntity.ShowCount; List gridColumnEntities = new List(); foreach (JsonColumnEntity column in jsonColumnGroupEntity.JsonColumnEntities) { GridColumnEntity gridColumnEntity = new GridColumnEntity(); if (column.col6 != -1) { gridColumnEntity.Name = column.col2; gridColumnEntity.VisibleState = column.col6; } else { switch (column.col3.Trim()) { case "处理状态": gridColumnEntity.Name = "BLSTATUS"; break; case "主提单号": gridColumnEntity.Name = "MBLNO"; break; case "委托单位": gridColumnEntity.Name = "CUSTOMERNAME"; break; case "处理人": gridColumnEntity.Name = "OPNAME"; break; case "处理时间": gridColumnEntity.Name = "OPTIME"; break; case "备注": gridColumnEntity.Name = "REMARK"; break; } gridColumnEntity.VisibleState = 0; } gridColumnEntity.Description = column.col3; gridColumnEntity.Index = column.col4; gridColumnEntity.Width = column.col5; gridColumnEntities.Add(gridColumnEntity); } //Columns gridEntity.Columns = gridColumnEntities; userSettingEntity.Xml = SaveUserSetting(gridEntity).OuterXml; int iResult = userSettingDA.InsertUserSetting(userSettingEntity); dvSaveState.InnerHtml = iResult.ToString(); } } } #region 获取列信息 /// /// 获取列信息 /// /// /// private JsonColumnGroupEntity GetPostEntity(string tempValue) { JsonColumnGroupEntity tempColumnGroupEntity = new JsonColumnGroupEntity(); try { tempColumnGroupEntity = (JsonColumnGroupEntity)JSON.Instance.ToObject(tempValue); } catch (Exception error) { throw error; } return tempColumnGroupEntity; } #endregion private XmlDocument SaveUserSetting(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 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 columnsEntities = new List(); 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; } public enum SqlName { NAME = 0, LOGTYPE = 1, LOGTIME = 2, LOGCONTENT = 3, USERNAME = 4 } #endregion } }