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/Opsean.aspx.cs

1327 lines
57 KiB
C#

2 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.Models;
using DSWeb.EntityDA;
using System.Data;
using System.Text;
namespace DSWeb.SeanInfo
{
public partial class Opsean : System.Web.UI.Page
{
public string strdate;//用户GID
public string strUserID ;//登录用户GID
public string strCompanyID ;//公司GID
public string strShowName;//用户显示名
public string strDeptName;//部门名称
public string strBsno ;
public string strIsAble;//业务状态是否已经已经锁定如果锁定页面是只读
DSWeb.EntityDA.Opsean opp = new EntityDA.Opsean();
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString();
}
else
{
Server.Transfer("~/Error/FriendError.aspx");
return;
}
if (Session["SHOWNAME"] != null)
{
strShowName = Session["SHOWNAME"].ToString();
this.txt_inputBy.Text = strShowName;
}
if (Session["COMPANYID"] != null)
{
strCompanyID = Session["COMPANYID"].ToString();
}
if (Session["DEPTNAME"] != null)
{
strDeptName = Session["DEPTNAME"].ToString();
}
if (Request.QueryString["id"] !=null)
{
strBsno = Request.QueryString["id"];
hid_BSNO.Value=Request.QueryString["id"];
}
if (Request.QueryString["hdenabled"] != null)
{
strIsAble = Request.QueryString["hdenabled"].ToString();
}
if (!IsPostBack)
{
this.GetPostParamValue();
}
}
/// <summary>
/// 获得传递过来的参数并加载相应的程序
/// </summary>
public void GetPostParamValue()
{
ViewState["status"] = "";
//表示编辑信息
if (Request.QueryString["handle"] == "edit"&&Request.QueryString["id"]!="")
{
if (strIsAble == "true"||strIsAble=="")//表示业务状态已经锁定
{
this.readOnlyFace();
}
else
{
ViewState["status"] = "edit";
this.loaddropdown();
this.ShowInfo(strBsno);
LoadGridView(strBsno);
this.HideContol();
}
}
//表示添加新项
else if (Request.QueryString["handle"] == "add")
{
this.ClickAddNew();
this.LoadGridView("");
}
//表示复制添加新项
else if (Request.QueryString["handle"] == "addfull")
{
ViewState["status"] = "addfull";
this.loaddropdown();
this.AddCopyInfo(strBsno);
this.lab_ordtype.Visible = false;
}
else
{
this.ClickAddNew();
this.LoadGridView("");
}
}
/// <summary>
/// 只读页面
/// </summary>
public void readOnlyFace()
{
this.ibAdd.Enabled = false;
this.img_addnewcont.Enabled = false;
this.img_btnSaveNew.Enabled=false;
this.ibDel.Enabled = false;
this.Img_deleContain.Enabled = false;
}
/// <summary>
/// 复制添加新项的加载数据****注释的是更改的
/// </summary>
public void AddCopyInfo(string bsno)
{
this.img_btnSave.Visible = false;
this.img_btnSaveNew.Visible = true;
string newbsno = CheckCUSTNO(getCodeRule("委托编号", "CUSTNO"));
//hid_BSNO.Value = newbsno.ToString();
OpseanEntity oppean = opp.GetInfoByBusnoID(bsno);
this.lab_bustatus.Text = "未锁定";
this.lab_costatus.Text = "未锁定";
this.txt_accTime.Text = DateTime.Now.Year.ToString()+"-"+DateTime.Now.Month.ToString();//会计期间
this.txt_mblNu.Value = "";//设置为空运单号为空?
this.txt_CUSTNO.Value = newbsno; //新的委托编号
this.dro_CUSTOMERNAME.SelectedValue = oppean.CUSTOMERNAME;
this.txt_shipper.Value = oppean.SHIPPER;
this.txt_consig.Value = oppean.CONSIGNEE;
this.dro_vessName.SelectedValue = oppean.VESSEL;
this.txt_voyNu.Value = oppean.VOYNO;
if (oppean.ETD.ToString().IndexOf("0001") > -1)
{
this.txt_etdTime.Value = "";
}
else
{
this.txt_etdTime.Value = oppean.ETD.ToString("yyyy-MM-dd").Trim();
}
if (oppean.ETA.ToString().IndexOf("0001") > -1)
{
this.txt_etaTime.Value = "";
}
else
{
this.txt_etaTime.Value = oppean.ETA.ToString("yyyy-MM-dd").Trim();
}
this.dro_portLoad.SelectedValue = oppean.PORTLOAD;
this.dro_portDisc.SelectedValue = oppean.PORTDISCHARGE;
this.dro_goodName.SelectedValue = oppean.GOODSNAME;
this.txt_grossWeight.Value = oppean.GROSSWEIGHT.ToString();
this.txt_measurement.Value = oppean.MEASUREMENT.ToString();
this.dro_op.SelectedValue = oppean.OP;
this.txt_inputBy.Text = strShowName;//登录人的名字
this.dro_sale.SelectedValue = oppean.SALE;
this.dro_carrComName.SelectedValue = oppean.CARRIER;
this.dro_grossWeight.SelectedValue = oppean.Grossweightunit;
this.dro_measruement.SelectedValue = oppean.Measurementunit;
}
/// <summary>
/// 页面加载时隐藏的控件
/// </summary>
public void HideContol()
{
this.img_btnSaveNew.Visible = false;//保存新添加
this.img_btnSave.Visible = true;
this.radbtn_direct.Visible = false;//直接引入
this.radbtn_plan.Visible = false;//计划引入
this.txt_accTime.ReadOnly =true;;//会计期间
//this.txt_CUSTNO.Disabled = true;//委托编号
getCodeRuleEnabled("委托编码","CUSTNO");
this.txt_inputBy.ReadOnly = true;//录入人
}
/// <summary>
/// 点击添加时需要保留和显示的控件及清空的控件
/// </summary>
public void ClickAddNew()
{
this.img_btnSave.Visible = false;//保存修改按钮
this.img_btnSaveNew.Visible = true;
this.radbtn_direct.Visible = true;//直接引入
this.radbtn_plan.Visible = true;//计划引入
this.lab_ordtype.Visible = false;//委托提示
this.txt_accTime.ReadOnly = false;//会计期间
this.txt_inputBy.ReadOnly = false;//录入人
this.lab_bustatus.Text = "未锁定";
this.lab_costatus.Text = "未锁定";
this.txt_accTime.Text = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString();
this.txt_CUSTNO.Value = CheckCUSTNO(getCodeRule("委托编号", "CUSTNO"));//加载新的委托编号
this.GetCustomName(); //委托单位绑定
this.txt_mblNu.Value = "";//运单号
this.txt_etdTime.Value = "";//开船日期
this.GetVesslInfo();//加载船名
this.GetCarrierInfo();
this.txt_voyNu.Value = "";
this.GetPortLoad();//绑定装货港信息
this.GetDisPortLoad();//绑定卸货港信息
this.txt_etaTime.Value = "";
this.GetSaleman();//绑定揽货人信息
this.GetOpInfo();//绑定操作员信息
this.GetGoodName();//绑定物品名称信息
this.txt_grossWeight.Value = "0.00";//毛重
this.txt_shipper.Value = "";//发货人
this.txt_measurement.Value = "0.00";//尺码
this.txt_consig.Value = "";//收货人
this.txt_inputBy.Text = strShowName;
this.loadAddress.Value = "";//装货地址
this.deliverAddress.Value = "";//送货地址
this.dropitem();
}
/// <summary>
/// 为各个dropdownlist添加空白项目
/// </summary>
public void dropitem()
{
ListItem list1=new ListItem("---请选择委托单位---","");
this.dro_CUSTOMERNAME.Items.Insert(0,list1);
ListItem list2 = new ListItem("---请选择船名---","");
this.dro_vessName.Items.Insert(0,list2);
ListItem list3 = new ListItem("---请选择船公司名称---","");
this.dro_carrComName.Items.Insert(0, list3);
ListItem list4 = new ListItem("---请选择装货码头---","");
this.dro_portLoad.Items.Insert(0,list4);
ListItem list5 = new ListItem("---请选择卸货码头---","");
this.dro_portDisc.Items.Insert(0,list5);
ListItem list6 = new ListItem("---请选择揽货人---","");
this.dro_sale.Items.Insert(0, list6);
ListItem list7 = new ListItem("---请选择操作员---","");
this.dro_op.Items.Insert(0, list7);
ListItem list8 = new ListItem("---请选择物品名称---","");
this.dro_goodName.Items.Insert(0,list8);
}
/// <summary>
/// 页面加载时需要绑定的drodownlist
/// </summary>
public void loaddropdown()
{
this.GetCustomName(); //委托单位绑定
this.GetVesslInfo();//加载船名信息
this.GetCarrierInfo();
this.GetPortLoad();//绑定装货港信息
this.GetDisPortLoad();//绑定卸货港信息
this.GetSaleman();//绑定揽货人信息
this.GetOpInfo();//绑定操作员信息
this.GetGoodName();//绑定物品名称信息
}
/// <summary>
/// 验证信的委托编号是否存在
/// </summary>
/// <param name="custno"></param>
/// <returns></returns>
public string CheckCUSTNO(string custno)
{
string alt = "";
string newcustno = "";
alt = opp.GetStrSQL("CUSTNO", "select CUSTNO from [op_sean] where CUSTNO='" +custno+ "'");
if (alt.Trim() != "")
{
newcustno = getCodeRule("委托编号", "CUSTNO");
}
else
{
newcustno = custno;
}
return custno;
}
/// <summary>
/// 委托单位信息加载
/// </summary>
public void GetCustomName()
{
DataSet ds = opp.GetCustomName(strCompanyID);
if (ds != null)
{
dro_CUSTOMERNAME.DataSource = ds.Tables[0].DefaultView;
dro_CUSTOMERNAME.DataTextField = "NEWNAME";
dro_CUSTOMERNAME.DataValueField = "SHORTNAME";
dro_CUSTOMERNAME.DataBind();
}
}
/// <summary>
/// 加载船名
/// </summary>
public void GetVesslInfo()
{
DataSet ds = opp.GetTCodeVessel();
if (ds != null)
{
this.dro_vessName.DataSource = ds.Tables[0].DefaultView;
this.dro_vessName.DataTextField = "NEWVESSL";
this.dro_vessName.DataValueField = "CNAME";
this.dro_vessName.DataBind();
}
}
/// <summary>
/// 船公司名称
/// </summary>
public void GetCarrierInfo()
{
DataSet ds = opp.GetCarrierName(strCompanyID);
if (ds != null)
{
this.dro_carrComName.DataSource = ds.Tables[0].DefaultView;
this.dro_carrComName.DataTextField = "NEWNAME";
this.dro_carrComName.DataValueField = "SHORTNAME";
this.dro_carrComName.DataBind();
}
}
/// <summary>
/// 加载装货港
/// </summary>
public void GetPortLoad()
{
DataSet ds = opp.GetTCodeLoadport();
if (ds != null)
{
this.dro_portLoad.DataSource = ds.Tables[0].DefaultView;
this.dro_portLoad.DataTextField = "NEWPORT";
this.dro_portLoad.DataValueField = "CNAME";
this.dro_portLoad.DataBind();
}
}
/// <summary>
/// 加载卸货港
/// </summary>
public void GetDisPortLoad()
{
DataSet ds = opp.GetTCodeDisport();
if (ds != null)
{
this.dro_portDisc.DataSource = ds.Tables[0].DefaultView;
this.dro_portDisc.DataTextField = "NEWPORT";
this.dro_portDisc.DataValueField = "CNAME";
this.dro_portDisc.DataBind();
}
}
/// <summary>
/// 加载揽货人信息
/// </summary>
public void GetSaleman()
{
DataSet ds = opp.GetSaleManInfo(strUserID, "isSaleMan");
if (ds != null)
{
this.dro_sale.DataSource = ds.Tables[0].DefaultView;
this.dro_sale.DataTextField = "SHOWNAME";
this.dro_sale.DataValueField = "SHOWNAME";
this.dro_sale.DataBind();
}
}
/// <summary>
/// 操作员信息加载
/// </summary>
public void GetOpInfo()
{
DataSet ds = opp.GetSaleManInfo(strUserID, "isOperator");
if (ds != null)
{
this.dro_op.DataSource = ds.Tables[0].DefaultView;
this.dro_op.DataTextField = "SHOWNAME";
this.dro_op.DataValueField = "SHOWNAME";
this.dro_op.DataBind();
}
}
/// <summary>
/// 物品名称加载
/// </summary>
public void GetGoodName()
{
DataSet ds = opp.GetGoodsInfo();
if (ds != null)
{
this.dro_goodName.DataSource = ds.Tables[0].DefaultView;
this.dro_goodName.DataTextField = "CODEANDNAME";
this.dro_goodName.DataValueField = "GOODNAME";
this.dro_goodName.DataBind();
}
}
/// <summary>
/// 根据委托编号加载集装箱信息
/// </summary>
/// <param name="BSNO"></param>
//public void LoadContainerInfo(string BSNO)
//{
// DataSet ds = opp.GetBoxInfo(BSNO);
// this.Rep_Container.DataSource = ds.Tables[0].DefaultView;
// this.Rep_Container.DataBind();
//}
/// <summary>
/// 页面加载信息
/// </summary>
/// <param name="busonID"></param>
public void ShowInfo(string busonID)
{
OpseanEntity oppean = opp.GetInfoByBusnoID(busonID);
if (oppean.BSSTATUS == false)
{
this.lab_bustatus.Text = "未锁定";
}
else
{
this.lab_bustatus.Text = "已锁定";
}
if (oppean.FEESTATUS == false)
{
this.lab_costatus.Text = "未锁定";
}
else
{
this.lab_costatus.Text = "已锁定";
}
this.txt_accTime.Text = oppean.ACCDATE;
this.txt_mblNu.Value = oppean.MBLNO;
this.txt_CUSTNO.Value = oppean.CUSTNO;
this.dro_CUSTOMERNAME.SelectedValue = oppean.CUSTOMERNAME;
this.txt_shipper.Value = oppean.SHIPPER;
this.txt_consig.Value = oppean.CONSIGNEE;
this.dro_vessName.SelectedValue = oppean.VESSEL;
this.txt_voyNu.Value = oppean.VOYNO;
if (oppean.ETD.ToString().Trim().IndexOf("0001") > -1)
{
this.txt_etdTime.Value = "";
}
else
{
this.txt_etdTime.Value = oppean.ETD.ToString("yyyy-MM-dd").Trim();
}
if (oppean.ETA.ToString().Trim().IndexOf("0001") > -1)
{
this.txt_etaTime.Value = "";
}
else
{
this.txt_etaTime.Value = oppean.ETA.ToString("yyyy-MM-dd").Trim();
}
this.dro_portLoad.SelectedValue = oppean.PORTLOAD;
this.dro_portDisc.SelectedValue = oppean.PORTDISCHARGE;
this.dro_goodName.SelectedValue = oppean.GOODSNAME;
this.txt_grossWeight.Value = oppean.GROSSWEIGHT.ToString();
this.txt_measurement.Value = oppean.MEASUREMENT.ToString();
this.dro_op.SelectedValue = oppean.OP;
this.txt_inputBy.Text = oppean.INPUTBY;
this.dro_sale.SelectedValue = oppean.SALE;
this.dro_carrComName.SelectedValue = oppean.CARRIER;
this.dro_grossWeight.SelectedValue = oppean.Grossweightunit;
this.dro_measruement.SelectedValue = oppean.Measurementunit;
this.loadAddress.Value = oppean.LOADADDRESS;
this.deliverAddress.Value = oppean.DELIVERADDRESS;
}
/// <summary>
/// 添加信息操作
/// </summary>
public void addMessageCont()
{
//获得属性集
OpseanEntity seaEntity = new OpseanEntity();
string newbsno = getBSNO();
seaEntity.BSNO = newbsno; //主键,规则生成
seaEntity.ORDERTYPE =selectOrdertype();
seaEntity.BSSTATUS = false;
seaEntity.FEESTATUS = false;
seaEntity.ACCDATE = this.txt_accTime.Text.Trim();
seaEntity.MBLNO = this.txt_mblNu.Value.Trim();
int result = opp.ConfirMblnoIfExist(txt_mblNu.Value.Trim());
if (result != 0)
{
this.CommonMessageBox("该运单号已经存在,请重新填写!");
return;
}
seaEntity.CUSTNO = this.txt_CUSTNO.Value.Trim();
seaEntity.CUSTOMERNAME = this.dro_CUSTOMERNAME.SelectedValue.ToString().Trim();
seaEntity.SHIPPER = this.txt_shipper.Value.Trim();
seaEntity.CONSIGNEE = this.txt_consig.Value.Trim();
seaEntity.VESSEL = this.dro_vessName.SelectedValue.ToString().Trim();
seaEntity.VOYNO = this.txt_voyNu.Value.Trim();
if (txt_etdTime.Value.Trim() != "")
{
seaEntity.ETD = DateTime.Parse(txt_etdTime.Value.Trim());
}
if (txt_etaTime.Value.Trim() != "")
{
seaEntity.ETA = DateTime.Parse(txt_etaTime.Value.Trim());
}
seaEntity.PORTLOAD = this.dro_portLoad.SelectedValue.ToString().Trim();
seaEntity.PORTDISCHARGE = this.dro_portDisc.SelectedValue.ToString().Trim();
seaEntity.GOODSNAME = this.dro_goodName.SelectedValue.ToString().Trim();
seaEntity.GROSSWEIGHT =Convert.ToDecimal(this.txt_grossWeight.Value);
seaEntity.MEASUREMENT = Convert.ToDecimal(this.txt_measurement.Value);
seaEntity.INPUTBY =strShowName;
seaEntity.INPUTTIME = DateTime.Now;
seaEntity.CORPID = strCompanyID;
seaEntity.OP = this.dro_op.SelectedValue.ToString().Trim();
seaEntity.SALE = this.dro_sale.SelectedValue.ToString().Trim();
seaEntity.CARRIER = this.dro_carrComName.SelectedValue.ToString().Trim();
seaEntity.Grossweightunit = this.dro_grossWeight.SelectedValue.ToString().Trim();
seaEntity.Measurementunit = this.dro_measruement.SelectedValue.ToString().Trim();
seaEntity.LOADADDRESS = this.loadAddress.Value.Trim();
seaEntity.DELIVERADDRESS = this.deliverAddress.Value.Trim();
int inresutl = opp.AddInfo(seaEntity);
if (inresutl == 1)
{
this.hidnewBsno.Value = newbsno;
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>reloadParent('" + newbsno.ToString().Trim() + "','saveInfo');</script>");
//this.ShowInfo(hidnewBsno.Value.Trim());
//this.img_btnSaveNew.Visible = false;
//this.img_btnSave.Visible = true;
//ViewState["sign"] = "btnsave";
}
else
{
this.CommonMessageBox("添加失败,请重试");
}
}
/// <summary>
/// 修改页面信息
/// </summary>
public void Updateinfo(string bsno)
{
OpseanEntity seaEntity = new OpseanEntity();
seaEntity.BSNO = bsno;
seaEntity.CUSTOMERNAME = dro_CUSTOMERNAME.SelectedValue.ToString();
seaEntity.SHIPPER = txt_shipper.Value.Trim();
seaEntity.CONSIGNEE = txt_consig.Value.Trim();
seaEntity.VESSEL = dro_vessName.SelectedValue.ToString();
seaEntity.VOYNO = txt_voyNu.Value.Trim();
if (txt_etdTime.Value.Trim() != "")
{
seaEntity.ETD = Convert.ToDateTime(txt_etdTime.Value.Trim());
}
if (txt_etaTime.Value.Trim() != "")
{
seaEntity.ETA = Convert.ToDateTime(txt_etaTime.Value.Trim());
}
seaEntity.PORTLOAD = dro_portLoad.SelectedValue.ToString();
seaEntity.PORTDISCHARGE = dro_portDisc.SelectedValue.ToString();
seaEntity.GOODSNAME = dro_goodName.SelectedValue.ToString();
seaEntity.GROSSWEIGHT = Convert.ToDecimal(txt_grossWeight.Value.Trim());
seaEntity.MEASUREMENT = Convert.ToDecimal(txt_measurement.Value.Trim());
seaEntity.OP = dro_op.SelectedValue.ToString();
seaEntity.SALE = dro_sale.SelectedValue.ToString();
seaEntity.CARRIER = dro_carrComName.SelectedValue.ToString();
seaEntity.Updatepper = strShowName;
seaEntity.Updatetime = DateTime.Now;
seaEntity.Grossweightunit = dro_grossWeight.SelectedValue.ToString();
seaEntity.Measurementunit = dro_measruement.SelectedValue.ToString();
seaEntity.LOADADDRESS = loadAddress.Value.Trim();
seaEntity.DELIVERADDRESS = deliverAddress.Value.Trim();
int inresutl = opp.UpteInfo(seaEntity);
if (inresutl == 1)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>reloadParent('" + hid_BSNO.ToString().Trim() + "','updateInfo');</script>");
}
else
{
this.CommonMessageBox("修改失败,请重试");
}
}
/// <summary>
/// 确定引入计划
/// </summary>
/// <returns></returns>
public string selectOrdertype()
{
string resut = "";
if (this.radbtn_direct.Checked == true)
{
return resut="直接引入";
}
if (this.radbtn_plan.Checked == true)
{
return resut="计划引入";
}
return resut;
}
protected void img_btnSave_Click(object sender, ImageClickEventArgs e)
{
Updateinfo(strBsno);
}
protected void ibAdd_Click(object sender, ImageClickEventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>reloadParent('" + hid_BSNO.ToString().Trim() + "','edit');</script>");
}
/// <summary>
/// 提取规则编号
/// </summary>
/// <param name="strRULENAME">规则项目名称</param>
/// <param name="strfield">需要加规则的字段</param>
/// <returns></returns>
protected void getCodeRuleEnabled(string strRULENAME, string strfield)
{
//是否生成之后允许编辑
DataSet ds = opp.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=2");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["ISSTARTUSING"].ToString().Trim().Equals("True"))
{
if (strfield == "CUSTNO")
{
if (ds.Tables[0].Rows[0]["ISALLOWEDITS"].ToString().Trim().Equals("True"))
{
this.txt_CUSTNO.Disabled = true;
}
else
{
this.txt_CUSTNO.Disabled = false;
}
}
}
}
}
}
/// <summary>
/// 提取规则编号
/// </summary>
/// <param name="strRULENAME">规则项目名称</param>
/// <param name="strfield">需要加规则的字段</param>
/// <returns></returns>
protected String getCodeRule(string strRULENAME, string strfield)
{
//调用编码规则
string strRULEYEAR = "";
string strRULECONTENT = "";
string strCODENAME = "";
string strDEPTNO = "";
string strRULENOLENGTH = "";
int iRULENOLENGTH = 0;
int inum = 0;
string strCONTENT = "";
DataSet ds = opp.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=2");
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["ISSTARTUSING"].ToString().Trim().Equals("True"))
{
getCodeRuleEnabled(strRULENAME, strfield);
//
if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("业务日期"))
{
if ( this.txt_etaTime.Value.Trim() == "")
{
return "";
}
DateTime dETD = System.Convert.ToDateTime(txt_etaTime.Value.Trim());
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dETD.ToString("yyyy") + dETD.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dETD.ToString("yy") + dETD.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dETD.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dETD.ToString("yy");
}
}
}
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("会计期间"))
{
if ( this.txt_accTime.Text.Trim() == "")
{
return "";
}
DateTime dACCDATE = System.Convert.ToDateTime(txt_accTime.Text.Trim() + "-01");
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dACCDATE.ToString("yyyy") + dACCDATE.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dACCDATE.ToString("yy") + dACCDATE.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = dACCDATE.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = dACCDATE.ToString("yy");
}
}
}
else if (ds.Tables[0].Rows[0]["RULEDATE"].ToString().Trim().Equals("自然月份"))
{
DateTime fwqdate = System.Convert.ToDateTime(opp.GetStrSQL("fwqdate", "select fwqdate=getdate()"));
if (ds.Tables[0].Rows[0]["ISCLEAREDINEARLY"].ToString().Trim().Equals("True"))
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = fwqdate.ToString("yyyy") + fwqdate.ToString("MM");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = fwqdate.ToString("yy") + fwqdate.ToString("MM");
}
}
else
{
if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "4")
{
strRULEYEAR = fwqdate.ToString("yyyy");
}
else if (ds.Tables[0].Rows[0]["RULEYEAR"].ToString().Trim() == "2")
{
strRULEYEAR = fwqdate.ToString("yy");
}
}
}
//
if (ds.Tables[0].Rows[0]["ISCOMPANY"].ToString().Trim().Equals("True"))
{
strCODENAME = opp.GetStrSQL("CODENAME", "select CODENAME from [company] where GID=(select top 1 COMPANYID from user_company where USERID='" + this.strUserID.Trim() + "')");
}
if (ds.Tables[0].Rows[0]["ISDEPT"].ToString().Trim().Equals("True"))
{
strDEPTNO = opp.GetStrSQL("DEPTNO", "select DEPTNO from [sys_dept] where LINKID=(select top 1 COMPANYID from user_company where USERID='" + this.strUserID.Trim() + "')");
}
strRULECONTENT = ds.Tables[0].Rows[0]["RULECONTENT"].ToString().Trim();
strRULECONTENT = strRULECONTENT.Replace("《COMPANY》", strCODENAME);
strRULECONTENT = strRULECONTENT.Replace("《DEPT》", strDEPTNO);
//
if (ds.Tables[0].Rows[0]["RULENOLENGTH"].ToString().Trim() == "")
{
iRULENOLENGTH = 0;
}
else
{
iRULENOLENGTH = int.Parse(ds.Tables[0].Rows[0]["RULENOLENGTH"].ToString().Trim());
}
strCONTENT = strRULECONTENT + strRULEYEAR;
//获取分公司的票号头字符
string tempBANKSHEAD = opp.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'");
strCONTENT = tempBANKSHEAD + strCONTENT;
//
strRULENOLENGTH = opp.GetStrSQL(strfield, "select top 1 " + strfield + " from [op_sean] where " + strfield + " like '" + strCONTENT.Trim() + "%' order by " + strfield + " DESC");
if (strRULENOLENGTH == "")
{
strRULENOLENGTH = "1";
}
else
{
strRULENOLENGTH = strRULENOLENGTH.Replace(strCONTENT.Trim(), "");
inum = int.Parse(strRULENOLENGTH.Trim());
inum = inum + 1;
strRULENOLENGTH = inum.ToString();
}
int j = iRULENOLENGTH - strRULENOLENGTH.Length;
for (int i = 1; i <= j; i++)
{
strRULENOLENGTH = "0" + strRULENOLENGTH;
}
//
strCONTENT = strCONTENT + strRULENOLENGTH;
return strCONTENT;
}
}
}
return "";
}
/// <summary>
/// 公共消息提示
/// </summary>
/// <param name="strtext"></param>
public void CommonMessageBox(string strtext)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('"+strtext+"')</script>");
//ScriptManager.RegisterStartupScript(Page, typeof(Page), "", "alert('" + strtext + "')",true);
}
/// <summary>
/// 自动生成的newid主键
/// </summary>
/// <returns></returns>
protected String getBSNO()
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = "topsean" + strBSNO;
return strBSNO;
}
/// <summary>
/// 新添加集装箱中的信息(更新)
/// </summary>
#region
//public void UpdateContainerInfo(string ctnid)
//{
// OpctnEntity opctn = new OpctnEntity();
// opctn.CTN_ID = ctnid;
// foreach (RepeaterItem item in Rep_Container.Items)
// {
// DropDownList dropctn=(DropDownList)item.FindControl("drop_ctn");
// opctn.CTN=dropctn.SelectedValue.ToString();
// TextBox ctnnum=(TextBox)item.FindControl("txt_ctnnum");
// opctn.CTNNUM=Convert.ToInt32(ctnnum.Text.Trim());
// TextBox cntrno = (TextBox)item.FindControl("txt_cntrno");
// opctn.CNTRNO= cntrno.Text.Trim();
// TextBox sealno = (TextBox)item.FindControl("txt_sealno");
// opctn.SEALNO = sealno.Text.Trim();
// TextBox pkgs = (TextBox)item.FindControl("txt_pkgs");
// opctn.PKGS=Convert.ToInt32(pkgs.Text.Trim());
// DropDownList kindpkgs = (DropDownList)item.FindControl("drop_kindpkgs");
// opctn.KINDPKGS = kindpkgs.SelectedValue.ToString();
// TextBox kgs = (TextBox)item.FindControl("txt_pkgs");
// opctn.KGS =Convert.ToDecimal(kgs.Text.Trim());
// TextBox tareweight = (TextBox)item.FindControl("txt_tareweight");
// opctn.TAREWEIGHT =Convert.ToDecimal(tareweight.Text.Trim());
// TextBox cbm = (TextBox)item.FindControl("txt_cbm");
// opctn.CBM =Convert.ToDecimal(cbm.Text.Trim());
// TextBox remark = (TextBox)item.FindControl("txt_remark");
// opctn.REMARK = remark.Text.Trim();
// }
// int intresult= opp.UpdateOpCtn(opctn);
// if (intresult == 1)
// {
// this.CommonMessageBox("操作成功");
// //Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script>alert('集装箱修改成功!')</script>");
// }
// else
// {
// this.CommonMessageBox("操作失败");
// //Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script>alert('集装箱信息修改失败!')</script>");
// }
//}
#endregion
protected void Rep_Container_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DropDownList dropctn = (DropDownList)e.Item.FindControl("drop_ctn");//箱型
DataSet ds = opp.GetAllCtn();
dropctn.DataSource = ds;
dropctn.DataTextField ="CTN";
dropctn.DataValueField = "CTN";
dropctn.DataBind();
//dropctn.Items.FindByValue(DataBinder.Eval(e.Item.DataItem, "CTN").ToString()).Selected = true;//表示绑定的数据显示==repeater显示的一致
DropDownList dropkindpkgs = (DropDownList)e.Item.FindControl("drop_kindpkgs");//包装类型
DataSet dss = opp.GetALLPkgs();
dropkindpkgs.DataSource = dss.Tables[0].DefaultView;
dropkindpkgs.DataTextField = "PKGS";
dropkindpkgs.DataValueField ="PKGS";
dropkindpkgs.DataBind();
// dropkindpkgs.Items.FindByValue(DataBinder.Eval(e.Item.DataItem, "KINDPKGS").ToString()).Selected = true;//同上
}
}
protected void img_btnSaveNew_Click(object sender, ImageClickEventArgs e)
{
addMessageCont();
// ClickAddNew();
}
/// <summary>
/// 新加载新添加的集装箱信息
/// </summary>
public void GetNewCreateContainer(string bsno)
{
DataSet ds = opp.GetNewContainer(bsno);
PagedDataSource pas = new PagedDataSource();
AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
pas.DataSource = ds.Tables[0].DefaultView;
pas.AllowCustomPaging = true;
pas.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pas.PageSize = AspNetPager1.PageSize;
this.gridviewContainer.DataSource = pas;
this.gridviewContainer.DataBind();
}
/// <summary>
/// 添加(创建新的)集装箱信息
/// </summary>
protected void img_addnewcont_Click(object sender, ImageClickEventArgs e)
{
string status = ViewState["status"].ToString();
if (hid_BSNO.Value!=""&&ViewState["status"].ToString()!="addfull")
{
opp.CreatNewContainer(this.hid_newctnid.Value.Trim(), hid_BSNO.Value);
this.GetNewCreateContainer(hid_BSNO.Value);
}
else
{
this.CommonMessageBox("请确认已添加新委托项");
}
}
//删除集装箱信息
protected void Img_deleContain_Click(object sender, ImageClickEventArgs e)
{
string sqlstr = "delete from [op_ctn] where ";
string str = "";
for (int i = 0; i < gridviewContainer.Rows.Count; i++)
{
CheckBox checkitem = (CheckBox)gridviewContainer.Rows[i].FindControl("checkitems");
if (checkitem.Checked == true)
{
str+= " CTN_ID='"+gridviewContainer.DataKeys[i].Value.ToString()+"' or";
}
}
if (str != "")
{
sqlstr += str.Substring(0, str.Length - 3);
int ii = opp.DelteCtnID(sqlstr);
if (ii == 1)
{
this.CommonMessageBox("操作成功");
}
else
{
this.CommonMessageBox("操作失败");
}
}
else
{
this.CommonMessageBox("您没有选择要删除项");
}
this.LoadGridView(hid_BSNO.Value);
}
protected void ibDel_Click1(object sender, ImageClickEventArgs e)
{
if (hid_BSNO.Value.Trim() != "" && ViewState["status"].ToString() != "addfull")
{
int ii = opp.DeleteOpseanInfo(hid_BSNO.Value.Trim());
if (ii == 1)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>reloadParent('" + hid_BSNO.ToString().Trim() + "','dele');</script>");
}
else
{
this.CommonMessageBox("删除失败,请重试");
}
}
else
{
this.CommonMessageBox("请确认已添加新委托项");
}
}
protected void img_saveupdatecont_Click(object sender, ImageClickEventArgs e)
{
}
/////////////////////////////////////********************gridview应用*******************************************/////////////////
/// <summary>
/// 加载gridview信息
/// </summary>
/// <param name="bsno"></param>
public void LoadGridView(string bsno)
{
DataSet ds = opp.GetBoxInfo(bsno);
PagedDataSource pas = new PagedDataSource();
AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
pas.DataSource = ds.Tables[0].DefaultView;
pas.AllowCustomPaging = true;
pas.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
pas.PageSize = AspNetPager1.PageSize;
this.gridviewContainer.DataSource = pas;
this.gridviewContainer.DataKeyNames = new string[] { "CTN_ID"};
this.gridviewContainer.DataBind();
}
//checkbox全选
protected void checkall_CheckedChanged(object sender, EventArgs e)
{
CheckBox checkall=(CheckBox)gridviewContainer.HeaderRow.Cells[0].FindControl("checkall");
foreach (GridViewRow gr in gridviewContainer.Rows)
{
CheckBox checkitem = (CheckBox)gr.Cells[0].FindControl("checkitems");
if (!checkitem.Checked&&checkitem.Enabled==true)
{
checkitem.Checked = true;
}
else
{
checkitem.Checked = false;
}
}
}
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
this.LoadGridView(hid_BSNO.Value);
}
protected void gridviewContainer_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DropDownList dropctn = (DropDownList)e.Row.FindControl("dropctn");
Label lablctn = (Label)e.Row.Cells[1].FindControl("lableCtn");
DataSet dss = opp.GetAllCtn();
dropctn.DataSource = dss;
dropctn.DataTextField = "CTN";
dropctn.DataValueField = "CTN";
dropctn.DataBind();
if (lablctn.Text != "")
{
dropctn.SelectedValue = lablctn.Text.Trim();
}
else
{
ListItem list = new ListItem("--请选择箱型--", "");
dropctn.Items.Insert(0, list);
}
DropDownList dropkingdpkgs = (DropDownList)e.Row.FindControl("dropkindpkgs");
Label lablekind = (Label)e.Row.FindControl("lableKindPKGS");
DataSet das = opp.GetALLPkgs();
if (das != null)
{
dropkingdpkgs.DataSource = das.Tables[0].DefaultView;
dropkingdpkgs.DataTextField = "PKGS";
dropkingdpkgs.DataValueField = "PKGS";
dropkingdpkgs.DataBind();
}
if (lablekind.Text != "")
{
dropkingdpkgs.SelectedValue = lablekind.Text;
}
else
{
ListItem listkind = new ListItem("--选择包装类型--", "");
dropkingdpkgs.Items.Insert(0, listkind);
}
DropDownList dropgoodname = (DropDownList)e.Row.FindControl("drop_goodnames");
Label labelgoodname = (Label)e.Row.FindControl("labelGoodsName");
DataSet dsgood = opp.GetGoodsInfo();
if (dsgood != null)
{
dropgoodname.DataSource = dsgood.Tables[0].DefaultView;
dropgoodname.DataTextField = "CODEANDNAME";
dropgoodname.DataValueField = "GOODNAME";
dropgoodname.DataBind();
}
if (labelgoodname.Text != "")
{
dropgoodname.SelectedValue = labelgoodname.Text;
}
else
{
ListItem listgoodname = new ListItem("--请选择品名--", "");
dropgoodname.Items.Insert(0, listgoodname);
}
}
}
//删除信息
protected void gridviewContainer_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string ctnid = gridviewContainer.DataKeys[e.RowIndex].Value.ToString();
OpctnEntity opctn = new OpctnEntity();
opctn.CTN_ID = ctnid;
DropDownList dropctn = (DropDownList)gridviewContainer.Rows[e.RowIndex].FindControl("dropctn");
opctn.CTN = dropctn.SelectedValue.ToString();
TextBox ctnnum = (TextBox)gridviewContainer.Rows[e.RowIndex].FindControl("txt_ctnnum");
opctn.CTNNUM = Convert.ToInt32(ctnnum.Text.Trim());
TextBox cntrno = (TextBox)gridviewContainer.Rows[e.RowIndex].FindControl("txt_cntrno");
opctn.CNTRNO = cntrno.Text.Trim();
TextBox sealno = (TextBox)gridviewContainer.Rows[e.RowIndex].FindControl("txt_sealno");
opctn.SEALNO = sealno.Text.Trim();
TextBox pkgs = (TextBox)gridviewContainer.Rows[e.RowIndex].FindControl("txt_pkgs");
opctn.PKGS = Convert.ToInt32(pkgs.Text.Trim());
DropDownList kindpkgs = (DropDownList)gridviewContainer.Rows[e.RowIndex].FindControl("dropkindpkgs");
opctn.KINDPKGS = kindpkgs.SelectedValue.ToString();
TextBox kgs = (TextBox)gridviewContainer.Rows[e.RowIndex].FindControl("txt_pkgs");
opctn.KGS = Convert.ToDecimal(kgs.Text.Trim());
TextBox tareweight = (TextBox)gridviewContainer.Rows[e.RowIndex].FindControl("txt_tareweight");
opctn.TAREWEIGHT = Convert.ToDecimal(tareweight.Text.Trim());
TextBox cbm = (TextBox)gridviewContainer.Rows[e.RowIndex].FindControl("txt_cbm");
opctn.CBM = Convert.ToDecimal(cbm.Text.Trim());
TextBox remark = (TextBox)gridviewContainer.Rows[e.RowIndex].FindControl("txt_remark");
opctn.REMARK = remark.Text.Trim();
int intresult = opp.UpdateOpCtn(opctn);
if (intresult == 1)
{
this.CommonMessageBox("操作成功");
}
else
{
this.CommonMessageBox("操作失败");
}
gridviewContainer.EditIndex = -1;
if (hidnewBsno.Value != "")
{
LoadGridView(hidnewBsno.Value);
}
else
{
LoadGridView(hid_BSNO.Value);
}
}
protected void gridviewContainer_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}
protected void gridviewContainer_RowEditing(object sender, GridViewEditEventArgs e)
{
//gridviewContainer.EditIndex = e.NewEditIndex;
//LoadGridView(hid_BSNO.Value);
string ctnid = gridviewContainer.DataKeys[e.NewEditIndex].Value.ToString();
OpctnEntity opctn = new OpctnEntity();
opctn.CTN_ID = ctnid;
DropDownList dropctn = (DropDownList)gridviewContainer.Rows[e.NewEditIndex].FindControl("dropctn");
opctn.CTN = dropctn.SelectedValue.ToString();
TextBox ctnnum = (TextBox)gridviewContainer.Rows[e.NewEditIndex].FindControl("txt_ctnnum");
opctn.CTNNUM = Convert.ToInt32(ctnnum.Text.Trim());
TextBox cntrno = (TextBox)gridviewContainer.Rows[e.NewEditIndex].FindControl("txt_cntrno");
opctn.CNTRNO = cntrno.Text.Trim();
TextBox sealno = (TextBox)gridviewContainer.Rows[e.NewEditIndex].FindControl("txt_sealno");
opctn.SEALNO = sealno.Text.Trim();
TextBox pkgs = (TextBox)gridviewContainer.Rows[e.NewEditIndex].FindControl("txt_pkgs");
opctn.PKGS = Convert.ToInt32(pkgs.Text.Trim());
DropDownList kindpkgs = (DropDownList)gridviewContainer.Rows[e.NewEditIndex].FindControl("dropkindpkgs");
opctn.KINDPKGS = kindpkgs.SelectedValue.ToString();
TextBox kgs = (TextBox)gridviewContainer.Rows[e.NewEditIndex].FindControl("txt_pkgs");
opctn.KGS = Convert.ToDecimal(kgs.Text.Trim());
TextBox tareweight = (TextBox)gridviewContainer.Rows[e.NewEditIndex].FindControl("txt_tareweight");
opctn.TAREWEIGHT = Convert.ToDecimal(tareweight.Text.Trim());
TextBox cbm = (TextBox)gridviewContainer.Rows[e.NewEditIndex].FindControl("txt_cbm");
opctn.CBM = Convert.ToDecimal(cbm.Text.Trim());
TextBox remark = (TextBox)gridviewContainer.Rows[e.NewEditIndex].FindControl("txt_remark");
opctn.REMARK = remark.Text.Trim();
int intresult = opp.UpdateOpCtn(opctn);
if (intresult == 1)
{
this.CommonMessageBox("操作成功");
}
else
{
this.CommonMessageBox("操作失败");
}
gridviewContainer.EditIndex = -1;
if (hidnewBsno.Value != "")
{
LoadGridView(hidnewBsno.Value);
}
else
{
LoadGridView(hid_BSNO.Value);
}
}
/// <summary>
/// 转换显示装货或者未送货状态
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
protected string ShowChangeStatus(object str1,object str2)
{
if (Convert.ToString(str1) == ""||Convert.ToString(str2)=="")
{
return "<img alt=\"加载失败\" id=\"img_LoadUnright\" title=\"未装货\" width=\"20\" height=\"15\" src=\"../images/Unright.png\" />";
}
else
{
string strLS = Convert.ToString(str1);
string LSstr = strLS.Split(',')[0];
string LStr2 = strLS.Split(',')[1];
string strIsStau = Convert.ToString(str2);
string LSistr = strIsStau.Split(',')[0];
string LSistr2 = strIsStau.Split(',')[1];
string result = "";
if (LSstr == "0" && LSistr == "1")
{
result = "<img alt=\"加载失败\" id=\"img_LoadRight\" title=\"装货完成\" width=\"20\" height=\"15\" src=\"../images/right.gif\" />";
}
else if (LStr2 == "0" && LSistr2 == "1")
{
result = "<img alt=\"加载失败\" id=\"img_LoadRight\" title=\"装货完成\" width=\"20\" height=\"15\" src=\"../images/right.gif\" />";
}
else
{
result = "<img alt=\"加载失败\" id=\"img_LoadUnright\" title=\"未装货\" width=\"20\" height=\"15\" src=\"../images/Unright.png\" />";
}
return result;
}
}
/// <summary>
/// 转换显示装货或者未送货状态
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
protected string ChangeShow(object str1, object str2)
{
if (Convert.ToString(str1) == "" || Convert.ToString(str2) == "")
{
return "<img alt=\"加载失败\" id=\"img_LoadUnright\" title=\"未送货\" width=\"20\" height=\"15\" src=\"../images/Unright.png\" />";
}
else
{
string strLS = Convert.ToString(str1);
string LSstr = strLS.Split(',')[0];
string LStr2 = strLS.Split(',')[1];
string strIsStau = Convert.ToString(str2);
string LSistr = strIsStau.Split(',')[0];
string LSistr2 = strIsStau.Split(',')[1];
string result = "";
if (LStr2 == "1"&&LSistr2=="1")
{
result = "<img alt=\"加载失败\" id=\"img_SendRight\" title=\"送货完成\" width=\"20\" height=\"15\" src=\"../images/right.gif\" />";
}
else if (LSistr == "1" && LSistr == "1")
{
result = "<img alt=\"加载失败\" id=\"img_SendRight\" title=\"送货完成\" width=\"20\" height=\"15\" src=\"../images/right.gif\" />";
}
else
{
result = "<img alt=\"加载失败\" id=\"img_SendUnright\" title=\"未送货\" width=\"20\" height=\"15\" src=\"../images/Unright.png\" />";
}
return result;
}
}
protected void gridviewContainer_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "deleteCon")
{
string ctnID = e.CommandArgument.ToString();
int ii = opp.DelteCTNBYID(ctnID);
if (ii == 1)
{
this.CommonMessageBox("删除成功");
}
else
{
this.CommonMessageBox("删除失败");
}
LoadGridView(hid_BSNO.Value);
}
if (e.CommandName == "saveCon")
{
OpctnEntity opctn = new OpctnEntity();
opctn.CTN_ID = e.CommandArgument.ToString();
GridViewRow row = ((Control)e.CommandSource).BindingContainer as GridViewRow;
DropDownList dropctn = (DropDownList)row.FindControl("dropctn");
opctn.CTN = dropctn.SelectedValue.ToString();
TextBox ctnnum = (TextBox)row.FindControl("txt_ctnnum");
if (System.Text.RegularExpressions.Regex.IsMatch(ctnnum.Text.Trim(), @"^\+?[1-9][0-9]*$"))
{
opctn.CTNNUM = Convert.ToInt32(ctnnum.Text.Trim());
}
else
{
this.CommonMessageBox("箱量含有不符合的字符!");
return;
}
TextBox cntrno = (TextBox)row.FindControl("txt_cntrno");
opctn.CNTRNO = cntrno.Text.Trim();
TextBox sealno = (TextBox)row.FindControl("txt_sealno");
opctn.SEALNO = sealno.Text.Trim();
TextBox pkgs = (TextBox)row.FindControl("txt_pkgs");
opctn.PKGS = 0;//隐藏的件数
DropDownList kindpkgs = (DropDownList)row.FindControl("dropkindpkgs");
opctn.KINDPKGS = "";//隐藏的包装类型
TextBox kgs = (TextBox)row.FindControl("txt_kgs");
if (System.Text.RegularExpressions.Regex.IsMatch(kgs.Text.Trim(), "^[0-9]+[.]?[0-9]+$"))
{
opctn.KGS = Convert.ToDecimal(kgs.Text.Trim());
}
else
{
this.CommonMessageBox("箱内货重含有不符合的字符!");
return;
}
TextBox tareweight = (TextBox)row.FindControl("txt_tareweight");
opctn.TAREWEIGHT = 0;//隐藏的箱皮重
TextBox cbm = (TextBox)row.FindControl("txt_cbm");
opctn.CBM = 0;//隐藏的尺码
TextBox remark = (TextBox)row.FindControl("txt_remark");
opctn.REMARK = remark.Text.Trim();
DropDownList goodName = (DropDownList)row.FindControl("drop_goodnames");
opctn.Goodsname = goodName.SelectedValue.ToString();
int intresult = opp.UpdateOpCtn(opctn);
if (intresult == 1)
{
this.CommonMessageBox("操作成功");
}
else
{
this.CommonMessageBox("操作失败");
}
//gridviewContainer.EditIndex = -1;
LoadGridView(hid_BSNO.Value);
}
}
}
}