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.
DS7/DSWeb/SeanInfo/OpLetterTruckList.aspx.cs

272 lines
9.2 KiB
C#

3 years ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DSWeb.EntityDA;
using System.Data;
using DSWeb.Models;
namespace DSWeb.SeanInfo
{
public partial class OpLetterTruckList : System.Web.UI.Page
{
public string strUserID = "";//登录用户GID
public string strCompanyID = "";//公司GID
public string strShowName = "";//用户显示名
public string strDeptName = "";//部门名称
DSWeb.EntityDA.Opsean opseaDA = new EntityDA.Opsean();
Models.OpseanEntity opseaEntity = new OpseanEntity();
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
//this.hdUserID.Value = strUserID;
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
}
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 (!this.IsPostBack)
{
//this.LoadRepeterInfo();
}
}
/// <summary>
/// repeater加载派车单通知信息表
/// </summary>
public void LoadRepeterInfo()
{
DataSet DS = opseaDA.GetNewCtnInfo();
PagedDataSource pds = new PagedDataSource();
pds.DataSource = DS.Tables[0].DefaultView;
AspNetPager1.RecordCount=DS.Tables[0].Rows.Count;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.PageSize = AspNetPager1.PageSize;
this.rep_letterTruck.DataSource = pds;
this.rep_letterTruck.DataBind();
}
/// <summary>
/// 绑定承运车信息
/// </summary>
//public void GetTeamTruck()
//{
// DataTable table = opseaDA.GetTeamInfo(strCompanyID);
// if (table != null)
// {
// this.drop_truck.DataSource = table.DefaultView;
// this.drop_truck.DataTextField = "NewColumns";
// this.drop_truck.DataValueField = "SHORTNAME";
// this.drop_truck.DataBind();
// }
// ListItem list = new ListItem("--承运车队--","");
// drop_truck.Items.Insert(0,list);
//}
/// <summary>
/// 箱型dropdownlist
/// </summary>
//protected void getCTN()
//{
// DataSet ctnds = opseaDA.GetAllCtn();
// if (ctnds != null)
// {
// drop_ctn.DataSource = ctnds.Tables[0].DefaultView;
// drop_ctn.DataTextField = "CTN";
// drop_ctn.DataValueField = "CTN";
// drop_ctn.DataBind();
// }
// ListItem list = new ListItem("--箱型--","");
// drop_ctn.Items.Insert(0,list);
//}
/// <summary>
/// 船名
/// </summary>
//protected void getVess()
//{
// DataSet vessds = opseaDA.GetTCodeVessel();
// if (vessds !=null)
// {
// drop_vessName.DataSource = vessds.Tables[0].DefaultView;
// drop_vessName.DataTextField = "NEWVESSL";
// drop_vessName.DataValueField = "CNAME";
// drop_vessName.DataBind();
// }
// ListItem vesslist = new ListItem("--船名--","");
// drop_vessName.Items.Insert(0,vesslist);
//}
/// <summary>
/// 航次
/// </summary>
//protected void getVoyonum()
//{
// DataSet voyods = opseaDA.GetOPSEAN(strCompanyID);
// if (voyods != null)
// {
// drop_voyoNum.DataSource = voyods.Tables[0].DefaultView;
// drop_voyoNum.DataTextField = "";
// drop_voyoNum.DataValueField = "";
// drop_voyoNum.DataBind();
// }
// ListItem voyolist = new ListItem("--航次--","");
// drop_voyoNum.Items.Insert(0,voyolist);
//}
/// <summary>
/// 根据条件查询信息
/// </summary>
public void searchTruckInfo()
{
string teamtypeload = "";
string teamtypesend = "";
string startime = txt_startime.Value.Trim();//开始时间
string endtime = txt_endtime.Value.Trim();//结束时间
string moresearch = txtmoresearch.Text.Trim();
if (this.check_load.Checked)
{
teamtypeload = "0";
}
if (this.check_send.Checked)
{
teamtypesend = "1";
}
DataTable table = opseaDA.SearchTrucBy(startime, endtime, teamtypeload, teamtypesend,moresearch);
PagedDataSource pds = new PagedDataSource();
pds.DataSource = table.DefaultView;
AspNetPager1.RecordCount = table.Rows.Count;
pds.AllowPaging = true;
pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pds.PageSize = AspNetPager1.PageSize;
this.rep_letterTruck.DataSource = pds;
this.rep_letterTruck.DataBind();
}
/// <summary>
/// 更改显示的派车类型
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public string changeTruckType(object str)
{
switch(Convert.ToInt32(str))
{
case 0:
return "<span style=\"color:#B22222; font-family:@新宋体;\">装货</span>";
case 1:
return "<span style=\"color:#7744FF ; font-family:@新宋体;\">送货</span>";
default:
return "未知";
}
}
/// <summary>
/// 更改显示是否完毕状态
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public string changeIsTeamStatus(object str)
{
switch (Convert.ToInt32(str))
{
case 0:
return "<span style=\"color:#B22222; font-family:@新宋体;\">生成单据</span>";
case 1:
return "<span style=\"color:#7744FF; font-family:@新宋体;\">完毕状态</span>";
default:
return "未操作";
}
}
/// <summary>
/// 公共消息提示
/// </summary>
/// <param name="strtext"></param>
public void CommonMessageBox(string strtext)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('" + strtext + "')</script>");
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
this.searchTruckInfo();
}
protected void img_btnsearch_Click(object sender, ImageClickEventArgs e)
{
this.searchTruckInfo();
}
protected void rep_letterTruck_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "isTeamStatus")
{
string leID = e.CommandArgument.ToString();
bool result = opseaDA.ChangeLetterStatus(leID);
if (result)
{
//this.LoadRepeterInfo();
this.searchTruckInfo();
this.CommonMessageBox("操作成功");
}
else
{
this.CommonMessageBox("操作失败,请重试");
}
}
}
//转换时间显示格式
protected string ShowDateTime(object obt)
{
if (Convert.ToString(obt) != "")
{
DateTime time = Convert.ToDateTime(obt);
if (time != null)
{
return time.ToString("yyyy-MM-dd").Trim();
}
else
{
return "--";
}
}
else
{
return "--";
}
}
/// <summary>
/// 删除多项数据
/// </summary>
protected void img_DeleteInfo_Click(object sender, ImageClickEventArgs e)
{
string[] items = this.hid_savedeleteinfo.Value.Split(',');
int iresult = opseaDA.DeleteLetterTruckbyID(items);
if (iresult == 1)
{
//this.LoadRepeterInfo();
this.searchTruckInfo();
this.CommonMessageBox("删除成功");
}
else
{
this.CommonMessageBox("删除失败,请重试");
}
}
}
}