using System; using System.Collections; 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 DSWeb.Models; using System.Collections.Generic; using JsonHelper; using DSWeb.EntityDA; using DSWeb.Log; using System.Text; using DSWeb.DataAccess; using System.Data.SqlClient; using System.Web.Script.Serialization; using System.Text.RegularExpressions; using System.ComponentModel; using System.Drawing; using System.Web.SessionState; using System.Web.Mail; using System.IO; using System.Data.OleDb; using DSWeb.Attributes; namespace DSWeb.SeaiInfo { public partial class WmsInfoCBM : System.Web.UI.Page { private string recvJSON; private string recvJSON_2; RangeDA RangeDA = new RangeDA(); T_ALL_DA T_ALL_DA = new T_ALL_DA(); public string strdate;// public string strUserID;//登录用户GID public string strCompanyID;//公司GID public string strShowName;//用户显示名 public string strDeptName;//部门名称 protected void Page_Load(object sender, EventArgs e) { if (Session["USERID"] != null) { strUserID = Session["USERID"].ToString().Trim(); 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(); this.hdCompanyID.Value = strCompanyID; } if (Session["DEPTNAME"] != null) { strDeptName = Session["DEPTNAME"].ToString(); } if (Request.QueryString["isenabled"] != null) { this.hdEnabled.Value = Request.QueryString["isenabled"].ToString(); } // T_ALL_DA T_ALL_DA = new T_ALL_DA(); strdate = T_ALL_DA.GetStrSQL("rq", "select convert(char(10),getdate(),20) as rq"); // if (Request.QueryString["handle"] != null) { this.hdHandle.Value = Request.QueryString["handle"].ToString(); } // if (Request.QueryString["id"] != null) { this.hdGID.Value = Request.QueryString["id"].ToString(); } // if (Request.QueryString["associatedno"] != null) { this.hid_associatedno.Value = Request.QueryString["associatedno"].ToString(); } // if (!IsPostBack) { if (Request.QueryString["handle"] != null) { WmsDA WmsDA = new WmsDA(); WmsEntity WmsEntity = new WmsEntity(); SeaImportInfoDA SeaImportInfoDA = new SeaImportInfoDA(); TopSeaiEntity TopSeaiEntity = new TopSeaiEntity(); switch (this.hdHandle.Value.Trim()) { case "add"://新增 this.hdGID.Value = ""; tbWMSNO.Text = ""; tbWMSDATE.Text = strdate; tbSTARTBILLINGDATE.Text = strdate; tbSTARTBILLINGDATEAP.Text = strdate; tbFREESTORAGEPERIOD.Text = "0"; tbFREESTORAGEPERIODAP.Text = "0"; this.hdISCHANGE.Value = "False"; if (this.hid_associatedno.Value.Trim() != "") { TopSeaiEntity = SeaImportInfoDA.GetID(this.hid_associatedno.Value.Trim()); if (TopSeaiEntity.BSNO != null) { this.hd_comboCUSTOMERNAME.Value = TopSeaiEntity.CUSTOMERNAME.ToString().Trim(); tbBLNO.Text = TopSeaiEntity.MBLNO.ToString().Trim(); tbCONTRACTNO.Text = TopSeaiEntity.CONTRACTNO.ToString().Trim(); this.hd_comboGOODSNAME.Value = TopSeaiEntity.GOODSNAME.ToString().Trim(); //tbGOODSMODEL.Text = TopSeaiEntity.NUMBERPLATE.ToString().Trim(); ddlCHARGEUNIT.Text = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); tbCUSTNO.Text = TopSeaiEntity.CUSTNO.ToString().Trim(); tbCUSTOMNO.Text = TopSeaiEntity.CUSTOMNO.ToString().Trim(); // lbPKGS.Text = TopSeaiEntity.PKGS.ToString().Trim(); lbBALES.Text = TopSeaiEntity.BALES.ToString().Trim(); lbKGS.Text = TopSeaiEntity.KGS.ToString().Trim(); lbNETWEIGHT.Text = TopSeaiEntity.NETWEIGHT.ToString().Trim(); lbCBM.Text = TopSeaiEntity.CBM.ToString().Trim(); } } break; case "addfull"://新增 this.hdGID.Value = ""; tbWMSNO.Text = ""; tbWMSDATE.Text = strdate; tbSTARTBILLINGDATE.Text = strdate; tbSTARTBILLINGDATEAP.Text = strdate; tbFREESTORAGEPERIOD.Text = "0"; tbFREESTORAGEPERIODAP.Text = "0"; this.hdISCHANGE.Value = "False"; if (this.hid_associatedno.Value.Trim() != "") { TopSeaiEntity = SeaImportInfoDA.GetID(this.hid_associatedno.Value.Trim()); if (TopSeaiEntity.BSNO != null) { this.hd_comboCUSTOMERNAME.Value = TopSeaiEntity.CUSTOMERNAME.ToString().Trim(); tbBLNO.Text = TopSeaiEntity.MBLNO.ToString().Trim(); tbCONTRACTNO.Text = TopSeaiEntity.CONTRACTNO.ToString().Trim(); this.hd_comboGOODSNAME.Value = TopSeaiEntity.GOODSNAME.ToString().Trim(); //tbGOODSMODEL.Text = TopSeaiEntity.NUMBERPLATE.ToString().Trim(); ddlCHARGEUNIT.Text = TopSeaiEntity.UNITOFWEIGHT.ToString().Trim(); tbCUSTNO.Text = TopSeaiEntity.CUSTNO.ToString().Trim(); tbCUSTOMNO.Text = TopSeaiEntity.CUSTOMNO.ToString().Trim(); // lbPKGS.Text = TopSeaiEntity.PKGS.ToString().Trim(); lbBALES.Text = TopSeaiEntity.BALES.ToString().Trim(); lbKGS.Text = TopSeaiEntity.KGS.ToString().Trim(); lbNETWEIGHT.Text = TopSeaiEntity.NETWEIGHT.ToString().Trim(); lbCBM.Text = TopSeaiEntity.CBM.ToString().Trim(); } } // break; case "edit"://录入 if (this.hdGID.Value.Trim() != "") { WmsEntity = WmsDA.GetModel(this.hdGID.Value.Trim()); if (WmsEntity.GID != null) { tbWMSNO.Text = WmsEntity.WMSNO.ToString().Trim(); this.hd_comboCUSTOMERNAME.Value = WmsEntity.CUSTOMERNAME.ToString().Trim(); tbFREESTORAGEPERIOD.Text = WmsEntity.FREESTORAGEPERIOD.ToString().Trim() == "" ? "0" : WmsEntity.FREESTORAGEPERIOD.ToString().Trim(); tbFREESTORAGEPERIODAP.Text = WmsEntity.FREESTORAGEPERIODAP.ToString().Trim() == "" ? "0" : WmsEntity.FREESTORAGEPERIODAP.ToString().Trim(); tbBLNO.Text = WmsEntity.BLNO.ToString().Trim(); tbCONTRACTNO.Text = WmsEntity.CONTRACTNO.ToString().Trim(); tbWMSDATE.Text = WmsEntity.WMSDATE.ToString("yyyy-MM-dd").Trim(); tbSTARTBILLINGDATE.Text = WmsEntity.STARTBILLINGDATE.ToString("yyyy-MM-dd").Trim().IndexOf("0001") > -1 ? "" : WmsEntity.STARTBILLINGDATE.ToString("yyyy-MM-dd").Trim(); tbSTARTBILLINGDATEAP.Text = WmsEntity.STARTBILLINGDATEAP.ToString("yyyy-MM-dd").Trim().IndexOf("0001") > -1 ? "" : WmsEntity.STARTBILLINGDATEAP.ToString("yyyy-MM-dd").Trim(); this.hdISCHANGE.Value = WmsEntity.ISCHANGE.ToString().Trim(); this.hd_comboGOODSNAME.Value = WmsEntity.GOODSNAME.ToString().Trim(); //tbGOODSMODEL.Text = WmsEntity.GOODSMODEL.ToString().Trim(); tbCUSTNO.Text = WmsEntity.CUSTNO.ToString().Trim(); ddlCHARGEUNIT.Text = WmsEntity.CHARGEUNIT.ToString().Trim(); this.hd_comboSTORAGENAME.Value = WmsEntity.STORAGENAME.ToString().Trim(); this.hd_comboARCLIENT.Value = WmsEntity.ARCLIENT.ToString().Trim(); this.hd_comboTRUCKNAME.Value = WmsEntity.TRUCKNAME.ToString().Trim(); this.tbCUSTOMNO.Text = WmsEntity.CUSTOMNO.ToString().Trim();//备案清单号 DataSet ds = T_ALL_DA.GetAllSQL("select top 1 GOODSPACK=(select sum(GOODSPACK) from wms_in where ASSOCIATEDNO=wms.gid),GOODSRKSL=(select sum(GOODSRKSL) from wms_in where ASSOCIATEDNO=wms.gid),ARFEE=(select sum(ARFEE) from wms_in where ASSOCIATEDNO=wms.gid),APFEE=(select sum(APFEE) from wms_in where ASSOCIATEDNO=wms.gid) from wms where gid='" + this.hdGID.Value.Trim() + "'"); if (ds != null) { //件数 this.dvGOODSPACKVal.InnerText = ds.Tables[0].Rows[0]["GOODSPACK"].ToString().Trim(); //计费数量 this.dvProfitTotalVal.InnerText = ds.Tables[0].Rows[0]["GOODSRKSL"].ToString().Trim(); //出库应收 this.dvRecvTotalVal.InnerText = ds.Tables[0].Rows[0]["ARFEE"].ToString().Trim(); //出库应付 this.dvPaySumVal.InnerText = ds.Tables[0].Rows[0]["APFEE"].ToString().Trim(); } } // if (WmsEntity.ASSOCIATEDNO.ToString().Trim() != "") { TopSeaiEntity = SeaImportInfoDA.GetID(WmsEntity.ASSOCIATEDNO.ToString().Trim()); if (TopSeaiEntity.BSNO != null) { lbPKGS.Text = TopSeaiEntity.PKGS.ToString().Trim(); lbBALES.Text = TopSeaiEntity.BALES.ToString().Trim(); lbKGS.Text = TopSeaiEntity.KGS.ToString().Trim(); lbNETWEIGHT.Text = TopSeaiEntity.NETWEIGHT.ToString().Trim(); lbCBM.Text = TopSeaiEntity.CBM.ToString().Trim(); } } } break; } } } // if (this.hdEnabled.Value.Trim() == "false") { getEnabled(); } else { if (this.hdISCHANGE.Value.Trim() == "True") { tbFREESTORAGEPERIODAP.Enabled = false; tbSTARTBILLINGDATEAP.Enabled = false; } } // if (this.hdHandle.Value.Trim() == "edit") { tbWMSNO.Enabled = false; // #region 权限可视范围 this.hdRangeV.Value = RangeDA.GetVISIBLERANGE(strUserID.Trim(), "modWmsList"); this.hdRangeO.Value = RangeDA.GetOPERATERANGE(strUserID.Trim(), "modWmsList"); 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.GetWmsListCompany(strCompanyID, this.hdGID.Value.Trim()); if (alt == "") { getEnabled_2(); } } else if (this.hdRangeO.Value.Trim().Equals("2"))//部门 { alt = RangeDA.GetWmsListDEPT(strDeptName, this.hdGID.Value.Trim(), strCompanyID, strShowName); if (alt == "") { getEnabled_2(); } } else if (this.hdRangeO.Value.Trim().Equals("3"))//个人 { alt = RangeDA.GetWmsListPerson(strShowName, this.hdGID.Value.Trim(), strCompanyID); if (alt == "") { getEnabled_2(); } } else if (this.hdRangeO.Value.Trim().Equals("4"))//无 { getEnabled_2(); } } #endregion } else { tbWMSNO.Enabled = true; } // recvJSON = ""; recvJSON = this.recvContainer.Value.Trim(); recvJSON_2 = ""; recvJSON_2 = this.recvContainer_2.Value.Trim(); // if (!recvJSON.Trim().Equals("")) { //应收账户保存 JsonWmsInGroupEntity4 WmsInfoGroupRecvEntity = GetPostEntity(recvJSON); List WmsInfoRecvEntities = new List(); WmsInfoRecvEntities = WmsInfoGroupRecvEntity.JsonWmsInEntities; SaveRecvWmsInfo(WmsInfoGroupRecvEntity); //更新完初始化 recvJSON = ""; } //仓储费率 if (!recvJSON_2.Trim().Equals("")) { SaveRateAction(); recvJSON_2 = ""; this.recvContainer_2.Value = ""; } //加载下拉框 Page.ClientScript.RegisterStartupScript(this.GetType(), "key0", ""); } /// /// 不包含仓储费率的屏蔽 /// protected void getEnabled() { divadd.Disabled = true; divsave.Disabled = true; divdel.Disabled = true; divrollback.Disabled = true; divrefresh.Disabled = true; //ibPrint.Disabled = true; mygrid_recv.Disabled = true; // tbWMSNO.Enabled=false; //ddlCUSTOMERNAME tbBLNO.Enabled=false; tbCONTRACTNO.Enabled=false; //ddlSTORAGENAME tbFREESTORAGEPERIOD.Enabled=false; tbFREESTORAGEPERIODAP.Enabled = false; //ddlGOODSNAME //tbGOODSMODEL.Enabled=false; tbCUSTNO.Enabled = false; tbCUSTOMNO.Enabled = false; ddlCHARGEUNIT.Enabled=false; tbWMSDATE.Enabled = false; tbSTARTBILLINGDATE.Enabled = false; tbSTARTBILLINGDATEAP.Enabled = false; //仓储费率 //divadd_2.Disabled = true; //divsave_2.Disabled = true; //divdel_2.Disabled = true; //divrollback_2.Disabled = true; //divrefresh_2.Disabled = true; //mygrid_container_recv_2.Disabled = true; } /// /// 包含仓储费率的屏蔽 /// protected void getEnabled_2() { this.hdEnabled.Value = "false"; // this.divadd.Disabled = true; this.divsave.Disabled = true; this.divdel.Disabled = true; this.divrollback.Disabled = true; this.divrefresh.Disabled = true; //ibPrint.Disabled = true; this.mygrid_recv.Disabled = true; this.btislock.Disabled = true; this.btnotislock.Disabled = true; // tbWMSNO.Enabled = false; //ddlCUSTOMERNAME tbBLNO.Enabled = false; tbCONTRACTNO.Enabled = false; //ddlSTORAGENAME tbFREESTORAGEPERIOD.Enabled = false; tbFREESTORAGEPERIODAP.Enabled = false; //ddlGOODSNAME //tbGOODSMODEL.Enabled=false; tbCUSTNO.Enabled = false; tbCUSTOMNO.Enabled = false; ddlCHARGEUNIT.Enabled = false; tbWMSDATE.Enabled = false; tbSTARTBILLINGDATE.Enabled = false; tbSTARTBILLINGDATEAP.Enabled = false; //仓储费率 this.divadd2.Disabled = true; this.divsave2.Disabled = true; this.divdel2.Disabled = true; this.divrefresh2.Disabled = true; this.mygrid_recv_2.Disabled = true; } #region 将页面post获取的仓储费率信息保存或更新“仓储费率信息表”wms_rate,并返回操作结果 /// /// 将页面post获取的仓储费率信息保存或更新“仓储费率信息表”wms_rate,并返回操作结果 /// private void SaveRateAction() { IList rateEntities = new List(); if (!recvJSON_2.Trim().Equals("")) { rateEntities = ResolverecvJSON_2(recvJSON_2.Trim(), rateEntities); this.recvContainer_2.Value = ""; } WmsRateDA rateDA = new WmsRateDA(); foreach (WmsRateEntity rateentity in rateEntities) { string strwhere = String.Format(" GID='{0}' ", rateentity.GID); int strExists = rateDA.GetRecordCount(strwhere); if (strExists == 1) { bool iRecvState = rateDA.Update(rateentity); } else if (strExists == 0) { bool iRecvState = rateDA.Add(rateentity); } } } #endregion #region 将页面post获取的仓储费率信息读入到仓储费率实体类wms_rate中 /// /// 将页面post获取的仓储费率信息读入到仓储费率实体类wms_rate中 /// /// /// /// 将页面post获取的仓储费率信息读入到仓储费率实体类wms_rate中 private IList ResolverecvJSON_2(string tempJSON, IList tempRateEntities) { string strFilter = ""; if (tempJSON.IndexOf("[") >= 0 && tempJSON.IndexOf("]") > 0) { strFilter = tempJSON.Substring(tempJSON.IndexOf("[") + 1, tempJSON.IndexOf("]") - tempJSON.IndexOf("[") - 1); string[] strFees = strFilter.Split(new string[] { "},{" }, System.StringSplitOptions.RemoveEmptyEntries); if (strFees.Length > 0) { for (int i = 0; i < strFees.Length; i++) { strFees[i] = strFees[i].ToString().Replace("{", ""); strFees[i] = strFees[i].ToString().Replace("}", ""); string[] strCell = strFees[i].Split(new char[] { ',' }); if (strCell.Length > 0) { WmsRateEntity RateEntity = new WmsRateEntity(); for (int j = 0; j < strCell.Length; j++) { string[] strArg = strCell[j].Split(new char[] { ':' }); switch (strArg[0].Replace("\"", "")) { case "id": RateEntity.GID = strArg[1].ToString().Replace("\"", ""); break; case "cus": RateEntity.CUSTOMERNAME = UnicodeToGB(strArg[1].ToString().Replace("\"", "")); break; case "feetype": RateEntity.FEETYPE = int.Parse(strArg[1].ToString().Replace("\"", "")); break; case "fgrade": RateEntity.FEEGRADE = int.Parse(strArg[1].ToString().Replace("\"", "")); break; case "fscale": RateEntity.FEESCALE = int.Parse(strArg[1].ToString().Replace("\"", "")); break; case "funit": RateEntity.FEEUNIT = UnicodeToGB(strArg[1].ToString().Replace("\"", "")); break; case "fprice": RateEntity.FEEPRICE = decimal.Parse(strArg[1].ToString().Replace("\"", "")); break; case "addprice": RateEntity.ADDPRICE = decimal.Parse(strArg[1].ToString().Replace("\"", "")); break; case "capprice"://增值价 RateEntity.CAPPRICE = decimal.Parse(strArg[1].ToString().Replace("\"", "")); break; case "endbillingdate": RateEntity.ENDBILLINGDATE = DateTime.Parse(strArg[1].ToString().Replace("\"", "") == "" ? "0001-01-01" : strArg[1].ToString().Replace("\"", "")); break; case "remark": RateEntity.REMARK = UnicodeToGB(strArg[1].ToString().Replace("\"", "")); break; default: break; } } RateEntity.BSNO = this.hdGID.Value.Trim(); RateEntity.CREATEUSER = this.strShowName; RateEntity.MODIFIEDUSER = this.strShowName; tempRateEntities.Add(RateEntity); } } } } return tempRateEntities; } #endregion #region 保存应收账户列表更改结果 /// /// 保存应收账户列表更改结果 /// /// private void SaveRecvWmsInfo(JsonWmsInGroupEntity4 tempGroupEntity) { if (tempGroupEntity != null) { if (this.hdGID.Value.Trim() != "" & this.hdHandle.Value.Trim()=="edit") { WmsDA WmsDA = new WmsDA(); WmsEntity WmsEntity = new WmsEntity(); //this.hdGID.Value = getWMSNO(); WmsEntity.GID = this.hdGID.Value.Trim(); if (tbWMSNO.Text.Trim() == "") { WmsEntity.WMSNO = getCodeRule("入库单号", "WMSNO", "WMS");//调用编码规则 } else { WmsEntity.WMSNO = tbWMSNO.Text.Trim(); } // string strWMSNO = T_ALL_DA.GetStrSQL("WMSNO", "select WMSNO from wms where wmsno='" + WmsEntity.WMSNO.ToString().Trim() + "' and gid<>'" + this.hdGID.Value.Trim() + "'"); if (strWMSNO.Trim() != "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", ""); return; } // WmsEntity.WMSDATE = DateTime.Parse(tbWMSDATE.Text.Trim()); WmsEntity.STARTBILLINGDATE = DateTime.Parse(tbSTARTBILLINGDATE.Text.Trim()); WmsEntity.STARTBILLINGDATEAP = DateTime.Parse(tbSTARTBILLINGDATEAP.Text.Trim()); WmsEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.Trim(); WmsEntity.FREESTORAGEPERIOD = tbFREESTORAGEPERIOD.Text.Trim() == "" ? 0 : int.Parse(tbFREESTORAGEPERIOD.Text.Trim()); WmsEntity.FREESTORAGEPERIODAP = tbFREESTORAGEPERIODAP.Text.Trim() == "" ? 0 : int.Parse(tbFREESTORAGEPERIODAP.Text.Trim()); WmsEntity.BLNO = tbBLNO.Text.Trim(); WmsEntity.CONTRACTNO = tbCONTRACTNO.Text.Trim(); WmsEntity.WMSOP = strShowName.Trim(); WmsEntity.STOREMAN = strShowName.Trim(); WmsEntity.MODIFIEDUSER = strUserID; // WmsEntity.GOODSPACK = 0; WmsEntity.GOODSPACKSTOCK = 0; WmsEntity.GOODSRKSL = 0; WmsEntity.GOODSSTOCK = 0; WmsEntity.ARFEE = 0; WmsEntity.APFEE = 0; WmsEntity.GOODSPACKACTUAL = 0; WmsEntity.GOODSRKSLACTUAL = 0; // if (this.hid_associatedno.Value.Trim() == "" && tbBLNO.Text.Trim() != "") { this.hid_associatedno.Value = T_ALL_DA.GetStrSQL("bsno", "select top 1 bsno from op_seai where MBLNO='" + tbBLNO.Text.Trim() + "'"); } WmsEntity.ASSOCIATEDNO = this.hid_associatedno.Value.Trim(); // WmsEntity.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim(); WmsEntity.GOODSMODEL = ""; WmsEntity.CUSTNO = tbCUSTNO.Text.Trim(); WmsEntity.CHARGEUNIT = ddlCHARGEUNIT.Text.Trim(); //原客户编码 string strCLIENTCODE = T_ALL_DA.GetStrSQL("CODENAME", "select top 1 CODENAME from info_client where SHORTNAME='" + this.hd_comboCUSTOMERNAME.Value.Trim() + "'"); WmsEntity.CLIENTCODEOLD = strCLIENTCODE;// 原客户编码 WmsEntity.CLIENTNAMEOLD = this.hd_comboCUSTOMERNAME.Value.Trim();// 原客户名称 WmsEntity.STORAGENAME = this.hd_comboSTORAGENAME.Value.Trim(); WmsEntity.ARCLIENT = this.hd_comboARCLIENT.Value.Trim(); WmsEntity.TRUCKNAME = this.hd_comboTRUCKNAME.Value.Trim(); WmsEntity.CUSTOMNO = this.tbCUSTOMNO.Text.Trim();//备案清单号 WmsEntity.CORPID = strCompanyID; WmsEntity.BZTCHNO = ""; WmsEntity.CLIENTBSNO = ""; int iR = WmsDA.Update(WmsEntity); // WmsInDA WmsInDA1 = new WmsInDA(); WmsInEntity WmsInEntity = new WmsInEntity(); WmsInEntity.ASSOCIATEDNO = this.hdGID.Value.Trim();// 关联号 WmsInEntity.CLIENTCODE = T_ALL_DA.GetStrSQL("CODENAME", "select top 1 CODENAME from info_client where SHORTNAME='" + this.hd_comboCUSTOMERNAME.Value.Trim() + "'");//客户编码 WmsInEntity.CLIENTNAME = this.hd_comboCUSTOMERNAME.Value.Trim(); WmsInEntity.AREANAME = WmsEntity.AREANAME.ToString().Trim(); WmsInEntity.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim();//货物名称 WmsInEntity.CHARGEUNIT = ddlCHARGEUNIT.Text.Trim();//计费单位 WmsInEntity.STORAGENAME = this.hd_comboSTORAGENAME.Value.Trim(); WmsInEntity.BLNO = tbBLNO.Text.Trim();//提单号 WmsInEntity.CONTRACTNO = tbCONTRACTNO.Text.Trim();//合同号 WmsInEntity.BSNO = tbWMSNO.Text.Trim();//仓单明细号 WmsInEntity.FREESTORAGEPERIOD = tbFREESTORAGEPERIOD.Text.Trim() == "" ? 0 : int.Parse(tbFREESTORAGEPERIOD.Text.Trim());// int iR2 = WmsInDA1.UpdateWmsInCBMInfo(WmsInEntity); } else { WmsDA WmsDA = new WmsDA(); WmsEntity WmsEntity = new WmsEntity(); this.hdGID.Value=getWMSNO(); WmsEntity.GID = this.hdGID.Value.Trim(); if (tbWMSNO.Text.Trim() == "") { WmsEntity.WMSNO = getCodeRule("入库单号", "WMSNO", "WMS");//调用编码规则 } else { WmsEntity.WMSNO = tbWMSNO.Text.Trim(); } // string strWMSNO = T_ALL_DA.GetStrSQL("WMSNO", "select WMSNO from wms where wmsno='" + WmsEntity.WMSNO.ToString().Trim() + "'"); if (strWMSNO.Trim() != "") { Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", ""); return; } // WmsEntity.WMSDATE = DateTime.Parse(tbWMSDATE.Text.Trim()); WmsEntity.STARTBILLINGDATE = DateTime.Parse(tbSTARTBILLINGDATE.Text.Trim()); WmsEntity.STARTBILLINGDATEAP = DateTime.Parse(tbSTARTBILLINGDATEAP.Text.Trim()); WmsEntity.CUSTOMERNAME = this.hd_comboCUSTOMERNAME.Value.Trim(); WmsEntity.FREESTORAGEPERIOD = tbFREESTORAGEPERIOD.Text.Trim() == "" ? 0 : int.Parse(tbFREESTORAGEPERIOD.Text.Trim()); WmsEntity.FREESTORAGEPERIODAP = tbFREESTORAGEPERIODAP.Text.Trim() == "" ? 0 : int.Parse(tbFREESTORAGEPERIODAP.Text.Trim()); WmsEntity.BLNO = tbBLNO.Text.Trim().Trim(); WmsEntity.CONTRACTNO = tbCONTRACTNO.Text.Trim(); WmsEntity.WMSOP = strShowName.Trim(); WmsEntity.STOREMAN = strShowName.Trim(); WmsEntity.CREATEUSER = strUserID; WmsEntity.MODIFIEDUSER = strUserID; // WmsEntity.GOODSPACK = 0; WmsEntity.GOODSPACKSTOCK = 0; WmsEntity.GOODSRKSL = 0; WmsEntity.GOODSSTOCK = 0; WmsEntity.ARFEE = 0; WmsEntity.APFEE = 0; WmsEntity.GOODSPACKACTUAL = 0; WmsEntity.GOODSRKSLACTUAL = 0; // if (this.hid_associatedno.Value.Trim() == "" && tbBLNO.Text.Trim() != "") { this.hid_associatedno.Value = T_ALL_DA.GetStrSQL("bsno", "select top 1 bsno from op_seai where MBLNO='" + tbBLNO.Text.Trim() + "'"); } WmsEntity.ASSOCIATEDNO = this.hid_associatedno.Value.Trim(); // WmsEntity.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim(); WmsEntity.GOODSMODEL = "";// tbGOODSMODEL.Text.Trim(); WmsEntity.CUSTNO = tbCUSTNO.Text.Trim(); WmsEntity.CHARGEUNIT = ddlCHARGEUNIT.Text.Trim(); //原客户编码 string strCLIENTCODE = T_ALL_DA.GetStrSQL("CODENAME", "select top 1 CODENAME from info_client where SHORTNAME='" + this.hd_comboCUSTOMERNAME.Value.Trim() + "'"); WmsEntity.CLIENTCODEOLD = strCLIENTCODE;// 原客户编码 WmsEntity.CLIENTNAMEOLD = this.hd_comboCUSTOMERNAME.Value.Trim();// 原客户名称 WmsEntity.STORAGENAME = this.hd_comboSTORAGENAME.Value.Trim(); WmsEntity.ARCLIENT = this.hd_comboARCLIENT.Value.Trim(); WmsEntity.TRUCKNAME = this.hd_comboTRUCKNAME.Value.Trim(); WmsEntity.CUSTOMNO = this.tbCUSTOMNO.Text.Trim();//备案清单号 WmsEntity.ISCHANGE = bool.Parse(this.hdISCHANGE.Value.Trim());// WmsEntity.CORPID = strCompanyID; WmsEntity.BZTCHNO = ""; WmsEntity.CLIENTBSNO = ""; int iR = WmsDA.Add(WmsEntity); } // List WMSZXEntities = new List(); List WmsInEntities = new List(); WmsInEntities = tempGroupEntity.JsonWmsInEntities; DataTable WmsInfoTable = new DataTable(); // ArrayList sqlInsertList = new ArrayList(); WmsInDA WmsInDA = new WmsInDA(); WmsInEntity WmsInEntityGID = new WmsInEntity(); string strInitSql = ""; if (tempGroupEntity.JsonWmsInEntities.Count > 0) { if (this.hdGID.Value.Trim() == "") { strInitSql = " SELECT GID,CTNALL,CNTRNO,SEALNO,GOODSGRADE,GOODSMODEL,GOODSSTANDARD,GOODSTHICKNESS,GOODSWIDTH,GOODSLENGTH,GOODSSLICE,GOODSPACK,GOODSRKSL,ARFEE,APFEE,STACKLOCATION,REMARK,ASSOCIATEDNO,MODIFIEDTIME,GOODSPACKSTOCK FROM wms_in WHERE 1<0"; } else { strInitSql = " SELECT GID,CTNALL,CNTRNO,SEALNO,GOODSGRADE,GOODSMODEL,GOODSSTANDARD,GOODSTHICKNESS,GOODSWIDTH,GOODSLENGTH,GOODSSLICE,GOODSPACK,GOODSRKSL,ARFEE,APFEE,STACKLOCATION,REMARK,ASSOCIATEDNO,MODIFIEDTIME,GOODSPACKSTOCK FROM wms_in WHERE 1=1 and ASSOCIATEDNO='" + this.hdGID.Value.Trim() + "' ORDER BY MODIFIEDTIME desc"; } } else { return; } WmsInfoTable = WmsInDA.GetExcuteSql(strInitSql).Tables[0]; //更新操作SQL语句 ArrayList sqlList = new ArrayList(); //日志操作SQL语句 ArrayList logList = new ArrayList(); //日志记录 Logger log = Logger.Instance; for (int i = 0; i < WmsInfoTable.Rows.Count; i++) { foreach (JsonWmsInEntity4 WmsIn in WmsInEntities) { if (WmsInfoTable.Rows[i]["GID"].ToString().Trim().Equals(WmsIn.WmsIn1.Trim()))//惟一编号 { WmsInEntity model = new WmsInEntity(); string strSql = ""; string LogContent = ""; LogEntity logEntity = new LogEntity(); //GID string strGID = WmsIn.WmsIn1.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn1.ToString().Trim(); model.GID = strGID; // #region 更改前后信息对比 //箱型 string strCTNALL = WmsIn.WmsIn2.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn2.Trim(); model.CTNALL = strCTNALL; if (!WmsInfoTable.Rows[i]["CTNALL"].ToString().Trim().Equals(strCTNALL)) { //strSql += String.Format(",explan = '{0}'", strAREANAME); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱型", WmsInfoTable.Rows[i]["CTNALL"].ToString().Trim(), strCTNALL); } //箱号 string strCNTRNO = WmsIn.WmsIn3.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn3.Trim(); model.CNTRNO = strCNTRNO; if (!WmsInfoTable.Rows[i]["CNTRNO"].ToString().Trim().Equals(strCNTRNO)) { //strSql += String.Format(",explan = '{0}'", strAREANAME); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "箱型", WmsInfoTable.Rows[i]["CNTRNO"].ToString().Trim(), strCNTRNO); } //封号 string strSEALNO = WmsIn.WmsIn4.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn4.Trim(); model.SEALNO = strSEALNO; if (!WmsInfoTable.Rows[i]["SEALNO"].ToString().Trim().Equals(strSEALNO)) { //strSql += String.Format(",explan = '{0}'", strAREANAME); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "封号", WmsInfoTable.Rows[i]["SEALNO"].ToString().Trim(), strSEALNO); } //等级 string strGOODSGRADE = WmsIn.WmsIn5.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn5.Trim(); model.GOODSGRADE = strGOODSGRADE; if (!WmsInfoTable.Rows[i]["GOODSGRADE"].ToString().Trim().Equals(strGOODSGRADE)) { //strSql += String.Format(",explan = '{0}'", strAREANAME); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "等级", WmsInfoTable.Rows[i]["GOODSGRADE"].ToString().Trim(), strGOODSGRADE); } //品牌 string strGOODSMODEL = WmsIn.WmsIn6.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn6.Trim(); model.GOODSMODEL = strGOODSMODEL; if (!WmsInfoTable.Rows[i]["GOODSMODEL"].ToString().Trim().Equals(strGOODSMODEL)) { //strSql += String.Format(",explan = '{0}'", strAREANAME); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "品牌", WmsInfoTable.Rows[i]["GOODSMODEL"].ToString().Trim(), strGOODSMODEL); } //规格 string strGOODSSTANDARD = WmsIn.WmsIn7.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn7.Trim(); model.GOODSSTANDARD = strGOODSSTANDARD; if (!WmsInfoTable.Rows[i]["GOODSSTANDARD"].ToString().Trim().Equals(strGOODSSTANDARD)) { //strSql += String.Format(",explan = '{0}'", strAREANAME); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "规格", WmsInfoTable.Rows[i]["GOODSSTANDARD"].ToString().Trim(), strGOODSSTANDARD); } //厚度 string strGOODSTHICKNESS = WmsIn.WmsIn8.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn8.ToString().Trim(); model.GOODSTHICKNESS = Decimal.Parse(strGOODSTHICKNESS); model.GOODSSTOCK = Decimal.Parse(strGOODSTHICKNESS); if (!WmsInfoTable.Rows[i]["GOODSTHICKNESS"].ToString().Trim().Equals(strGOODSTHICKNESS)) { LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "厚度", WmsInfoTable.Rows[i]["GOODSTHICKNESS"].ToString().Trim(), strGOODSTHICKNESS); } //宽度 string strGOODSWIDTH = WmsIn.WmsIn9.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn9.ToString().Trim(); model.GOODSWIDTH = Decimal.Parse(strGOODSWIDTH); model.GOODSSTOCK = Decimal.Parse(strGOODSWIDTH); if (!WmsInfoTable.Rows[i]["GOODSWIDTH"].ToString().Trim().Equals(strGOODSWIDTH)) { LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "宽度", WmsInfoTable.Rows[i]["GOODSWIDTH"].ToString().Trim(), strGOODSWIDTH); } //长度 string strGOODSLENGTH = WmsIn.WmsIn10.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn10.ToString().Trim(); model.GOODSLENGTH = Decimal.Parse(strGOODSLENGTH); model.GOODSSTOCK = Decimal.Parse(strGOODSLENGTH); if (!WmsInfoTable.Rows[i]["GOODSLENGTH"].ToString().Trim().Equals(strGOODSLENGTH)) { LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "长度", WmsInfoTable.Rows[i]["GOODSLENGTH"].ToString().Trim(), strGOODSLENGTH); } //片数/件 string strGOODSSLICE = WmsIn.WmsIn11.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn11.ToString().Trim(); model.GOODSSLICE = Decimal.Parse(strGOODSSLICE); if (!WmsInfoTable.Rows[i]["GOODSSLICE"].ToString().Trim().Equals(strGOODSSLICE)) { LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "【片数/件】", WmsInfoTable.Rows[i]["GOODSSLICE"].ToString().Trim(), strGOODSSLICE); } //件数 string strGOODSPACK = WmsIn.WmsIn12.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn12.ToString().Trim(); model.GOODSPACK = Decimal.Parse(strGOODSPACK); model.GOODSPACKACTUAL = Decimal.Parse(strGOODSPACK); //实际件数 model.GOODSPACKSTOCK = Decimal.Parse(strGOODSPACK); //剩余件数 if (!WmsInfoTable.Rows[i]["GOODSPACK"].ToString().Trim().Equals(strGOODSPACK)) { LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "件数", WmsInfoTable.Rows[i]["GOODSPACK"].ToString().Trim(), strGOODSPACK); } //计费数量 string strGOODSRKSL = WmsIn.WmsIn13.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn13.ToString().Trim(); model.GOODSRKSL = Decimal.Parse(strGOODSRKSL); model.GOODSRKSLACTUAL = Decimal.Parse(strGOODSRKSL); model.GOODSSTOCK = Decimal.Parse(strGOODSRKSL); if (!WmsInfoTable.Rows[i]["GOODSRKSL"].ToString().Trim().Equals(strGOODSRKSL)) { LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "计费数量", WmsInfoTable.Rows[i]["GOODSRKSL"].ToString().Trim(), strGOODSRKSL); } //应收账款 string strARFEE = WmsIn.WmsIn14.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn14.ToString().Trim(); model.ARFEE = Decimal.Parse(strARFEE); if (!WmsInfoTable.Rows[i]["ARFEE"].ToString().Trim().Equals(strARFEE)) { LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "应收账款", WmsInfoTable.Rows[i]["ARFEE"].ToString().Trim(), strARFEE); } //应付账款 string strAPFEE = WmsIn.WmsIn15.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn15.ToString().Trim(); model.APFEE = Decimal.Parse(strAPFEE); if (!WmsInfoTable.Rows[i]["APFEE"].ToString().Trim().Equals(strAPFEE)) { //strSql += String.Format(",accname = '{0}'", strAPFEE); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "应付账款", WmsInfoTable.Rows[i]["APFEE"].ToString().Trim(), strAPFEE); } //码放位置 string strSTACKLOCATION = WmsIn.WmsIn16.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn16.ToString().Trim(); model.STACKLOCATION = strSTACKLOCATION; if (!WmsInfoTable.Rows[i]["STACKLOCATION"].ToString().Trim().Equals(strSTACKLOCATION)) { //strSql += String.Format(",blno = '{0}'", strSTACKLOCATION); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "码放位置", WmsInfoTable.Rows[i]["STACKLOCATION"].ToString().Trim(), strSTACKLOCATION); } //备注 string strREMARK = WmsIn.WmsIn17.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn17.ToString().Trim(); model.REMARK = strREMARK; if (!WmsInfoTable.Rows[i]["REMARK"].ToString().Trim().Equals(strREMARK)) { //strSql += String.Format(",blno = '{0}'", strREMARK); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "备注", WmsInfoTable.Rows[i]["REMARK"].ToString().Trim(), strREMARK); } // model.MODIFIEDUSER = strUserID; if (strSql.Trim() != "") { //最后一次更改操作人 //strSql += String.Format(",MODIFIEDUSER = '{0}'", strUserID); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "最后一次更改操作人", WmsInfoTable.Rows[i]["MODIFIEDUSER"].ToString().Trim(), strUserID); //最后一次更改操作时间 //strSql += ",MODIFIEDTIME = getdate()"; LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "最后一次更改操作时间", WmsInfoTable.Rows[i]["MODIFIEDTIME"].ToString().Trim(), DateTime.Now.ToString().Trim()); } #endregion //如果有字段内容更新则执行更新操作 if (LogContent.Trim().Length > 1) { model.ASSOCIATEDNO = this.hdGID.Value.Trim();// 关联号 // 客户编码 string strCLIENTCODE = T_ALL_DA.GetStrSQL("CODENAME", "select top 1 CODENAME from info_client where SHORTNAME='" + this.hd_comboCUSTOMERNAME.Value.Trim() + "'"); model.CLIENTCODE = strCLIENTCODE; model.CLIENTNAME = this.hd_comboCUSTOMERNAME.Value.Trim(); model.CLIENTCODEOLD = strCLIENTCODE;// 原客户编码 model.CLIENTNAMEOLD = this.hd_comboCUSTOMERNAME.Value.Trim();// 原客户名称 model.STORAGECODE = "";// 仓库编码 model.AREACODE = "";// 库位编码 model.AREANAME = ""; model.GOODSCODE = "";// 货物编号 model.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim();//货物名称 //model.GOODSMODEL = "";// tbGOODSMODEL.Text.Trim();//型号 model.CHARGEUNIT = ddlCHARGEUNIT.Text.Trim();//计费单位 model.STORAGENAME = this.hd_comboSTORAGENAME.Value.Trim(); // model.BLNO = tbBLNO.Text.Trim();// 提单号 model.CONTRACTNO = tbCONTRACTNO.Text.Trim();// 合同号 model.BSNO = tbWMSNO.Text.Trim();// 仓单明细号 model.FREESTORAGEPERIOD = tbFREESTORAGEPERIOD.Text.Trim() == "" ? 0 : int.Parse(tbFREESTORAGEPERIOD.Text.Trim());// model.GOODSTYPE = "";// 货物类型 //model.GOODSSTANDARD = "";// 规格 model.GOODSKGS = 0;// 重量 model.KINDPKGS = "";// // model.ISLOCK = false;// 是否锁定 model.LOCKUSER = "";// 锁定操作人 model.ISDELETE = false;// 是否废除 model.DELETEUSER = "";// 废除操作人 model.DODATE = DateTime.Parse(tbWMSDATE.Text.Trim()); model.CORPID = strCompanyID; // WMSZXEntities.Add(model); logList.Add(String.Format("更新账户标识 {0} {1}", WmsIn.WmsIn1.Trim(), LogContent)); } WmsInEntities.Remove(WmsIn); break; } } } if (WMSZXEntities.Count > 0) { int iResult = WmsInDA.UpdateFromGrid(WMSZXEntities); //为1表示更新成功 //为-1有异常,更新失败 //为-2更新异常,事务已回滚成功 //更新完成后,记录日志 if (iResult == 1) { #region 费用合计入ch_fee表 //FeeDA feeDA = new FeeDA(); //IList feeEntities = new List(); //FeeEntity feeEntityBSNO = new FeeEntity(); //// ////应收 //string feehj = T_ALL_DA.GetStrSQL("hj", "SELECT isnull(sum(ARFEE),0) as hj FROM wms_in WHERE ASSOCIATEDNO = '" + this.hdGID.Value.Trim() + "'"); //string feebsno = T_ALL_DA.GetStrSQL("GID", "SELECT top 1 GID FROM ch_fee WHERE BSNO = '" + this.hdGID.Value.Trim() + "' and FEETYPE=1"); //FeeEntity feeEntity = new FeeEntity(); //if (feebsno.Trim() == "") //{ // feeEntity.GID = Guid.NewGuid().ToString(); //} //else //{ // feeEntity.GID = feebsno; //} //feeEntity.FeeType = 1; //feeEntity.BSNO = this.hdGID.Value.Trim();// 关联号 //feeEntity.FeeName = "装卸费"; //feeEntity.CustomerName = this.hd_comboCUSTOMERNAME.Value.Trim(); //feeEntity.Unit = "重量"; //feeEntity.UnitPrice = decimal.Parse(feehj); //feeEntity.Quantity = 1; //feeEntity.CommissionRate = 1; //feeEntity.Amount = decimal.Parse(feehj); ; //feeEntity.Currency = "RMB"; //feeEntity.ExchangeRate = 1; //feeEntity.FeeFrt = ""; //feeEntity.Remark = ""; //feeEntity.IsAdvancePay = false; //feeEntity.EnterOperator = strUserID; //feeEntity.FeeStatus = 1; //feeEntity.WMSOUTBSNO = ""; //feeEntities.Add(feeEntity); ////应付 //feehj = T_ALL_DA.GetStrSQL("hj", "SELECT isnull(sum(APFEE),0) as hj FROM wms_in WHERE ASSOCIATEDNO = '" + this.hdGID.Value.Trim() + "'"); //feebsno = T_ALL_DA.GetStrSQL("GID", "SELECT top 1 GID FROM ch_fee WHERE BSNO = '" + this.hdGID.Value.Trim() + "' and FEETYPE=2"); //FeeEntity feeEntity1 = new FeeEntity(); //if (feebsno.Trim() == "") //{ // feeEntity1.GID = Guid.NewGuid().ToString(); //} //else //{ // feeEntity1.GID = feebsno; //} //feeEntity1.FeeType = 2; //feeEntity1.BSNO = this.hdGID.Value.Trim();// 关联号 //feeEntity1.FeeName = "装卸费"; //feeEntity1.CustomerName = this.hd_comboCUSTOMERNAME.Value.Trim(); //feeEntity1.Unit = "重量"; //feeEntity1.UnitPrice = decimal.Parse(feehj); //feeEntity1.Quantity = 1; //feeEntity1.CommissionRate = 1; //feeEntity1.Amount = decimal.Parse(feehj); ; //feeEntity1.Currency = "RMB"; //feeEntity1.ExchangeRate = 1; //feeEntity1.FeeFrt = ""; //feeEntity1.Remark = ""; //feeEntity1.IsAdvancePay = false; //feeEntity1.EnterOperator = strUserID; //feeEntity1.FeeStatus = 1; //feeEntity1.WMSOUTBSNO = ""; //feeEntities.Add(feeEntity1); //int iState = feeDA.DoFee(feeEntities, this.hdGID.Value.Trim(), strUserID); #endregion #region 日志记录操作 // INSERT-"INSERT INTO {0} ({1}) VALUES ({2})" @{0}-所要插入记录的表;{1}记录字段值;{2}-记录新值@ //if (logList.Count > 0) //{ // for (int i = 0; i < logList.Count; i++) // { // LogEntity logEntity = new LogEntity(); // logEntity.GID = Guid.NewGuid().ToString(); // logEntity.Name = "更新账户信息列表"; // logEntity.LogType = "UPDATE 更新操作"; // logEntity.CreateUserID = strUserID.Trim();//测试使用数据,正式发布请删除 // logEntity.LogContent = logList[i].ToString(); // log.WriteLog(logEntity); // } //} #endregion } } //如果遍历完所有币别表数据,没有相对应的币别信息,则将剩余的币别信息插入到币别表中 if (WmsInEntities.Count > 0) { //插入新的应收币别信息 InsertWmsInfo(WmsInEntities); } // updateWMS();//更新wms的库存、费用数据 // recvJSON = ""; this.recvContainer.Value = ""; } else { recvJSON = ""; this.recvContainer.Value = ""; return; } } #endregion #region 更新wms的库存、费用数据 /// /// 更新wms的库存、费用数据 /// public void updateWMS() { T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); string lsSQL = "update wms set " + "GOODSPACK=(select isnull(sum(GOODSPACK),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",GOODSPACKACTUAL=(select isnull(sum(GOODSPACKACTUAL),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",GOODSPACKSTOCK=(select isnull(sum(GOODSPACKSTOCK),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",GOODSRKSL=(select isnull(sum(GOODSRKSL),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",GOODSRKSLACTUAL=(select isnull(sum(GOODSRKSLACTUAL),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",GOODSSTOCK=(select isnull(sum(GOODSSTOCK),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",ARFEE=(select isnull(sum(ARFEE),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",APFEE=(select isnull(sum(APFEE),0) from wms_in where ASSOCIATEDNO=wms.gid)" + " where ISLOCK=0 and GID='" + this.hdGID.Value.Trim() + "'"; bool bl = T_ALL_DA.GetExecuteSqlCommand(lsSQL); } #endregion #region 插入账户信息记录 /// /// 插入账户信息记录 /// /// 需要插入账户表的账户实体类 public void InsertWmsInfo(List WmsInEntities) { ArrayList sqlInsertList = new ArrayList(); WmsInDA WmsInDA = new WmsInDA(); WmsInEntity WmsInEntityGID = new WmsInEntity(); string alt = ""; foreach (JsonWmsInEntity4 WmsIn in WmsInEntities) { WmsInEntity model = new WmsInEntity(); model.GID = WmsIn.WmsIn1.Trim().Equals("null") ? "" : WmsIn.WmsIn1.Trim(); // #region 插入信息 //箱型 string strCTNALL = WmsIn.WmsIn2.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn2.Trim(); model.CTNALL = strCTNALL; //箱号 string strCNTRNO = WmsIn.WmsIn3.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn3.Trim(); model.CNTRNO = strCNTRNO; //封号 string strSEALNO = WmsIn.WmsIn4.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn4.Trim(); model.SEALNO = strSEALNO; //等级 string strGOODSGRADE = WmsIn.WmsIn5.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn5.Trim(); model.GOODSGRADE = strGOODSGRADE; //品牌 string strGOODSMODEL = WmsIn.WmsIn6.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn6.Trim(); model.GOODSMODEL = strGOODSMODEL; //规格 string strGOODSSTANDARD = WmsIn.WmsIn7.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn7.Trim(); model.GOODSSTANDARD = strGOODSSTANDARD; //厚度 string strGOODSTHICKNESS = WmsIn.WmsIn8.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn8.ToString().Trim(); if (strGOODSTHICKNESS.Trim() == "" || strGOODSTHICKNESS.Trim() == "0" || strGOODSTHICKNESS.Trim() == "0.0000") { model.GOODSTHICKNESS = 0; } else { model.GOODSTHICKNESS = Decimal.Parse(strGOODSTHICKNESS); } //宽度 string strGOODSWIDTH = WmsIn.WmsIn9.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn9.ToString().Trim(); if (strGOODSWIDTH.Trim() == "" || strGOODSWIDTH.Trim() == "0" || strGOODSWIDTH.Trim() == "0.0000") { model.GOODSWIDTH = 0; } else { model.GOODSWIDTH = Decimal.Parse(strGOODSWIDTH); } //长度 string strGOODSLENGTH = WmsIn.WmsIn10.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn10.ToString().Trim(); if (strGOODSLENGTH.Trim() == "" || strGOODSLENGTH.Trim() == "0" || strGOODSLENGTH.Trim() == "0.0000") { model.GOODSLENGTH = 0; } else { model.GOODSLENGTH = Decimal.Parse(strGOODSLENGTH); } //片数/件 string strGOODSSLICE = WmsIn.WmsIn11.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn11.ToString().Trim(); if (strGOODSSLICE.Trim() == "" || strGOODSSLICE.Trim() == "0" || strGOODSSLICE.Trim() == "0.0000") { model.GOODSSLICE = 0; } else { model.GOODSSLICE = Decimal.Parse(strGOODSSLICE); } //件数 string strGOODSPACK = WmsIn.WmsIn12.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn12.ToString().Trim(); if (strGOODSPACK.Trim() == "" || strGOODSPACK.Trim() == "0" || strGOODSPACK.Trim() == "0.0000") { model.GOODSPACK = 0; model.GOODSPACKACTUAL = 0; //实际件数 model.GOODSPACKSTOCK = 0; //剩余件数 } else { model.GOODSPACK = Decimal.Parse(strGOODSPACK); model.GOODSPACKACTUAL = Decimal.Parse(strGOODSPACK); //实际件数 model.GOODSPACKSTOCK = Decimal.Parse(strGOODSPACK); //剩余件数 } //计费数量/立方米 string strGOODSRKSL = WmsIn.WmsIn13.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn13.ToString().Trim(); if (strGOODSRKSL.Trim() == "" || strGOODSRKSL.Trim() == "0" || strGOODSRKSL.Trim() == "0.0000") { model.GOODSRKSL = 0; model.GOODSRKSLACTUAL = 0; model.GOODSSTOCK = 0; //剩余件数 } else { model.GOODSRKSL = Decimal.Parse(strGOODSRKSL); model.GOODSRKSLACTUAL = Decimal.Parse(strGOODSRKSL); model.GOODSSTOCK = Decimal.Parse(strGOODSRKSL); //计费数量 } //应收账款 string strARFEE = WmsIn.WmsIn14.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn14.ToString().Trim(); if (strARFEE.Trim() == "" || strARFEE.Trim() == "0" || strARFEE.Trim() == "0.00") { model.ARFEE = 0; } else { model.ARFEE = Decimal.Parse(Decimal.Parse(strARFEE.Trim()).ToString("F2")); } //应付账款 string strAPFEE = WmsIn.WmsIn15.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn15.ToString().Trim(); if (strAPFEE.Trim() == "" || strAPFEE.Trim() == "0" || strAPFEE.Trim() == "0.00") { model.APFEE = 0; } else { model.APFEE = Decimal.Parse(Decimal.Parse(strAPFEE.Trim()).ToString("F2")); } //码放位置 string strSTACKLOCATION = WmsIn.WmsIn16.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn16.ToString().Trim(); model.STACKLOCATION = strSTACKLOCATION; //备注 string strREMARK = WmsIn.WmsIn17.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn17.ToString().Trim(); model.REMARK = strREMARK; // model.CREATEUSER = strUserID; model.MODIFIEDUSER = strUserID; // model.ASSOCIATEDNO = this.hdGID.Value.Trim();// 关联号 // 客户编码 string strCLIENTCODE = T_ALL_DA.GetStrSQL("CODENAME", "select top 1 CODENAME from info_client where SHORTNAME='" + this.hd_comboCUSTOMERNAME.Value.Trim() + "'"); model.CLIENTCODE = strCLIENTCODE; model.CLIENTNAME = this.hd_comboCUSTOMERNAME.Value.Trim(); model.CLIENTCODEOLD = strCLIENTCODE;// 原客户编码 model.CLIENTNAMEOLD = this.hd_comboCUSTOMERNAME.Value.Trim();// 原客户名称 model.STORAGECODE = ""; model.AREACODE = "";// 库位编码 model.AREANAME = ""; model.GOODSCODE = "";// 货物编号 model.GOODSNAME = this.hd_comboGOODSNAME.Value.Trim();//货物名称 //model.GOODSMODEL = "";// tbGOODSMODEL.Text.Trim();//型号 model.CHARGEUNIT = ddlCHARGEUNIT.Text.Trim();//计费单位 model.STORAGENAME = this.hd_comboSTORAGENAME.Value.Trim(); // model.BLNO = tbBLNO.Text.Trim();// 提单号 model.CONTRACTNO = tbCONTRACTNO.Text.Trim();// 合同号 model.BSNO = getCodeRule("入库明细单号", "WMSNO", "wms_in");//调用编码规则 model.FREESTORAGEPERIOD = tbFREESTORAGEPERIOD.Text.Trim() == "" ? 0 : int.Parse(tbFREESTORAGEPERIOD.Text.Trim());// model.GOODSTYPE = "";// 货物类型 //model.GOODSSTANDARD = "";// 规格 model.GOODSKGS = 0;// 重量 model.KINDPKGS = "";// // model.ISLOCK = false;// 是否锁定 model.LOCKUSER = "";// 锁定操作人 model.ISDELETE = false;// 是否废除 model.DELETEUSER = "";// 废除操作人 model.ISCHANGE = bool.Parse(this.hdISCHANGE.Value.Trim());// model.DODATE = DateTime.Parse(tbWMSDATE.Text.Trim()); model.CORPID = strCompanyID; #endregion // WmsInEntityGID = WmsInDA.GetID(model.GID); if (WmsInEntityGID.GID == null) { int iResult = WmsInDA.InserInfo(model); //为1表示更新成功 //为-1有异常,更新失败 //为-2更新异常,事务已回滚成功 //更新完成后,记录日志 if (iResult == 1) { #region 费用合计入ch_fee表 //FeeDA feeDA = new FeeDA(); //IList feeEntities = new List(); //FeeEntity feeEntityBSNO = new FeeEntity(); //// ////应收 //string feehj = T_ALL_DA.GetStrSQL("hj", "SELECT isnull(sum(ARFEE),0) as hj FROM wms_in WHERE ASSOCIATEDNO = '" + this.hdGID.Value.Trim() + "'"); //string feebsno = T_ALL_DA.GetStrSQL("GID", "SELECT top 1 GID FROM ch_fee WHERE BSNO = '" + this.hdGID.Value.Trim() + "' and FEETYPE=1"); //FeeEntity feeEntity = new FeeEntity(); //if (feebsno.Trim() == "") //{ // feeEntity.GID = Guid.NewGuid().ToString(); //} //else //{ // feeEntity.GID = feebsno; //} //feeEntity.FeeType = 1; //feeEntity.BSNO = this.hdGID.Value.Trim();// 关联号 //feeEntity.FeeName = "装卸费"; //feeEntity.CustomerName = this.hd_comboCUSTOMERNAME.Value.Trim(); //feeEntity.Unit = "重量"; //feeEntity.UnitPrice = decimal.Parse(feehj); //feeEntity.Quantity = 1; //feeEntity.CommissionRate = 1; //feeEntity.Amount = decimal.Parse(feehj); ; //feeEntity.Currency = "RMB"; //feeEntity.ExchangeRate = 1; //feeEntity.FeeFrt = ""; //feeEntity.Remark = ""; //feeEntity.IsAdvancePay = false; //feeEntity.EnterOperator = strUserID; //feeEntity.FeeStatus = 1; //feeEntity.WMSOUTBSNO = ""; //feeEntities.Add(feeEntity); ////应付 //feehj = T_ALL_DA.GetStrSQL("hj", "SELECT isnull(sum(APFEE),0) as hj FROM wms_in WHERE ASSOCIATEDNO = '" + this.hdGID.Value.Trim() + "'"); //feebsno = T_ALL_DA.GetStrSQL("GID", "SELECT top 1 GID FROM ch_fee WHERE BSNO = '" + this.hdGID.Value.Trim() + "' and FEETYPE=2"); //FeeEntity feeEntity1 = new FeeEntity(); //if (feebsno.Trim() == "") //{ // feeEntity1.GID = Guid.NewGuid().ToString(); //} //else //{ // feeEntity1.GID = feebsno; //} //feeEntity1.FeeType = 2; //feeEntity1.BSNO = this.hdGID.Value.Trim();// 关联号 //feeEntity1.FeeName = "装卸费"; //feeEntity1.CustomerName = this.hd_comboCUSTOMERNAME.Value.Trim(); //feeEntity1.Unit = "重量"; //feeEntity1.UnitPrice = decimal.Parse(feehj); //feeEntity1.Quantity = 1; //feeEntity1.CommissionRate = 1; //feeEntity1.Amount = decimal.Parse(feehj); ; //feeEntity1.Currency = "RMB"; //feeEntity1.ExchangeRate = 1; //feeEntity1.FeeFrt = ""; //feeEntity1.Remark = ""; //feeEntity1.IsAdvancePay = false; //feeEntity1.EnterOperator = strUserID; //feeEntity1.FeeStatus = 1; //feeEntity1.WMSOUTBSNO = ""; //feeEntities.Add(feeEntity1); //int iState = feeDA.DoFee(feeEntities, this.hdGID.Value.Trim(), strUserID); //if (iState != 1) //{ //} #endregion } } else { alt += model.GID + ","; } } Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", ""); // //if (alt != "") //{ // alt=alt.Trim().Substring(0,alt.Trim().Length-1); // Page.ClientScript.RegisterStartupScript(this.GetType(), "key3", ""); //} } #endregion #region 获取账户客户保存的账户信息 /// /// 获取账户客户保存的账户信息 /// /// /// public JsonWmsInGroupEntity4 GetPostEntity(string tempValue) { JsonWmsInGroupEntity4 WmsInfoGroupEntity = (JsonWmsInGroupEntity4)JSON.Instance.ToObject(tempValue); return WmsInfoGroupEntity; } #endregion protected String getWMSNO() { string strWMSNO = Guid.NewGuid().ToString(); strWMSNO = strWMSNO.Replace("-", ""); strWMSNO = "Wms" + strWMSNO; return strWMSNO; } /// /// 提取规则编号 /// /// 规则项目名称 /// 需要加规则的字段 /// protected void getCodeRuleEnabled(string strRULENAME, string strfield) { //是否生成之后允许编辑 DataSet ds = T_ALL_DA.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=3"); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ISSTARTUSING"].ToString().Trim().Equals("True")) { if (strfield == "WMSNO") { if (ds.Tables[0].Rows[0]["ISALLOWEDITS"].ToString().Trim().Equals("True")) { tbWMSNO.Enabled = true; } else { tbWMSNO.Enabled = false; } } } } } } /// /// 提取规则编号 /// /// 规则项目名称 /// 需要加规则的字段 /// protected String getCodeRule(string strRULENAME, string strfield,string tablename) { //调用编码规则 string strRULEYEAR = ""; string strRULECONTENT = ""; string strCODENAME = ""; string strDEPTNO = ""; string strRULENOLENGTH = ""; int iRULENOLENGTH = 0; int inum = 0; string strCONTENT = ""; DataSet ds = T_ALL_DA.GetAllSQL("select * from code_rule where RULENAME='" + strRULENAME.Trim() + "' and RULETYPE=3"); 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 (tbWMSDATE.Text.Trim() == "") { return ""; } DateTime dETD = System.Convert.ToDateTime(tbWMSDATE.Text.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("自然月份")) { DateTime fwqdate = System.Convert.ToDateTime(T_ALL_DA.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 = T_ALL_DA.GetStrSQL("CODENAME", "select CODENAME from [company] where GID=(select top 1 COMPANYID from user_company where USERID='" + this.hdUserID.Value.Trim() + "')"); } if (ds.Tables[0].Rows[0]["ISDEPT"].ToString().Trim().Equals("True")) { strDEPTNO = T_ALL_DA.GetStrSQL("DEPTNO", "select DEPTNO from [sys_dept] where LINKID=(select top 1 COMPANYID from user_company where USERID='" + this.hdUserID.Value.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 = T_ALL_DA.GetStrSQL("BANKSHEAD", "SELECT TOP 1 BANKSHEAD FROM company WHERE GID='" + strCompanyID.Trim() + "'"); strCONTENT = tempBANKSHEAD + strCONTENT; // strRULENOLENGTH = T_ALL_DA.GetStrSQL(strfield, "select top 1 " + strfield + " from [" + tablename + "] where " + strfield + " like '" + strCONTENT.Trim() + "%' and ISDELETE=0 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 ""; } /// /// 查询 /// /// /// protected void Button2_Click(object sender, EventArgs e) { if (this.hid_associatedno.Value.Trim() == "") { this.hdGID.Value = ""; tbWMSNO.Text = ""; tbWMSDATE.Text = strdate; tbSTARTBILLINGDATE.Text = strdate; tbSTARTBILLINGDATEAP.Text = strdate; tbFREESTORAGEPERIOD.Text = "0"; tbFREESTORAGEPERIODAP.Text = "0"; this.hdISCHANGE.Value = "False"; this.hd_comboCUSTOMERNAME.Value = ""; tbBLNO.Text = ""; tbCONTRACTNO.Text = ""; this.hd_comboGOODSNAME.Value = ""; ddlCHARGEUNIT.Text = "CBM"; tbCUSTNO.Text = ""; tbCUSTOMNO.Text = ""; lbPKGS.Text = ""; lbBALES.Text = ""; lbKGS.Text = ""; lbNETWEIGHT.Text = ""; lbCBM.Text = ""; // this.hdSelect.Value = ""; if (this.txt_blno2.Value.Trim() != "") { this.hdSelect.Value += " and mblno = '" + this.txt_blno2.Value.Trim() + "'"; } if (this.txt_customno2.Value.Trim() != "") { this.hdSelect.Value += " and CUSTOMNO = '" + this.txt_customno2.Value.Trim() + "'"; } if (this.hdSelect.Value.Trim() == "") { this.hdSelect.Value = " and 1<0"; } // string sSQL = "select top 1 * from op_seai where 1=1 " + this.hdSelect.Value.Trim(); DataSet ds = T_ALL_DA.GetAllSQL(sSQL); if (ds != null) { this.hd_comboCUSTOMERNAME.Value = ds.Tables[0].Rows[0]["CUSTOMERNAME"].ToString().Trim(); tbBLNO.Text = ds.Tables[0].Rows[0]["MBLNO"].ToString().Trim(); tbCONTRACTNO.Text = ds.Tables[0].Rows[0]["CONTRACTNO"].ToString().Trim(); this.hd_comboGOODSNAME.Value = ds.Tables[0].Rows[0]["GOODSNAME"].ToString().Trim(); ddlCHARGEUNIT.Text = ds.Tables[0].Rows[0]["UNITOFWEIGHT"].ToString().Trim(); tbCUSTNO.Text = ds.Tables[0].Rows[0]["CUSTNO"].ToString().Trim(); tbCUSTOMNO.Text = ds.Tables[0].Rows[0]["CUSTOMNO"].ToString().Trim(); // lbPKGS.Text = ds.Tables[0].Rows[0]["PKGS"].ToString().Trim(); lbBALES.Text = ds.Tables[0].Rows[0]["BALES"].ToString().Trim(); lbKGS.Text = ds.Tables[0].Rows[0]["KGS"].ToString().Trim(); lbNETWEIGHT.Text = ds.Tables[0].Rows[0]["NETWEIGHT"].ToString().Trim(); lbCBM.Text = ds.Tables[0].Rows[0]["CBM"].ToString().Trim(); } } } protected void Button1_Click(object sender, EventArgs e) { if (this.hid_associatedno.Value.Trim() == "") { this.hdGID.Value = ""; tbWMSNO.Text = ""; tbWMSDATE.Text = strdate; tbSTARTBILLINGDATE.Text = strdate; tbSTARTBILLINGDATEAP.Text = strdate; tbFREESTORAGEPERIOD.Text = "0"; tbFREESTORAGEPERIODAP.Text = "0"; this.hdISCHANGE.Value = "False"; this.hd_comboCUSTOMERNAME.Value = ""; tbBLNO.Text = ""; tbCONTRACTNO.Text = ""; this.hd_comboGOODSNAME.Value = ""; ddlCHARGEUNIT.Text = "CBM"; tbCUSTNO.Text = ""; tbCUSTOMNO.Text = ""; lbPKGS.Text = ""; lbBALES.Text = ""; lbKGS.Text = ""; lbNETWEIGHT.Text = ""; lbCBM.Text = ""; // this.txt_blno2.Value = ""; this.txt_customno2.Value = ""; this.hdSelect.Value = ""; } } #region Unicode-GB Code转换 /// /// Unicode-GB Code转换 /// /// 将Unicode编码字符转换成GB编码字符 /// GB Code字符串 public string UnicodeToGB(string text) { UnicodeEncoding unicode = new UnicodeEncoding(); text = unicode.GetString(unicode.GetBytes(Regex.Unescape(text.Trim()))); return text; } /// /// Unicode-GB Code转换 /// /// 将Unicode编码字符转换成GB编码字符 /// GB Code字符串 public string UnicodeToGB_Old(string text) { MatchCollection mc = Regex.Matches(text, "([\\w]+)|(\\\\u([\\w]{4}))"); if (mc != null && mc.Count > 0) { StringBuilder sb = new StringBuilder(); foreach (Match m2 in mc) { string v = m2.Value; if (v.IndexOf("\\") >= 0) { string word = v.Substring(2); byte[] codes = new byte[2]; int code = Convert.ToInt32(word.Substring(0, 2), 16); int code2 = Convert.ToInt32(word.Substring(2), 16); codes[0] = (byte)code2; codes[1] = (byte)code; sb.Append(Encoding.Unicode.GetString(codes)); } else { sb.Append(v); } } return sb.ToString(); } else { return text; } } #endregion // } }