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 WmsInfo : 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; //strUserID = "1BEC90E1-9780-472F-90C2-0C6390C044A4"; //this.hdUserID.Value = strUserID; } 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"://新增 //ViewState["GID"] = getBSNO(); //this.hdGid.Value = ViewState["GID"].ToString().Trim(); this.hdGID.Value = ""; tbWMSNO.Text = ""; tbWMSDATE.Text = strdate; tbSTARTBILLINGDATE.Value = strdate; tbSTARTBILLINGDATEAP.Text = strdate; tbFREESTORAGEPERIOD.Text = "0"; tbFREESTORAGEPERIODAP.Text = "0"; this.hdISCHANGE.Value = "False"; tbAREANAME.Text = ""; tbBZTCHNO.Text = ""; 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(); tbMARKETVALUE.Text = TopSeaiEntity.IMPORTVALUE.ToString().Trim(); tbBANKVALUE.Text = TopSeaiEntity.IMPORTVALUE.ToString().Trim(); // ddlGOODSSTANDARD.Text = ""; //if (TopSeaiEntity.BALES.ToString().Trim() == "") //{ // ddlGOODSSTANDARD.Text = "散货"; //} //else //{ // ddlGOODSSTANDARD.Text = "托盘"; //} // 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.Value = strdate; tbSTARTBILLINGDATEAP.Text = strdate; tbFREESTORAGEPERIOD.Text = "0"; tbFREESTORAGEPERIODAP.Text = "0"; this.hdISCHANGE.Value = "False"; tbAREANAME.Text = ""; tbBZTCHNO.Text = ""; 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(); tbMARKETVALUE.Text = TopSeaiEntity.IMPORTVALUE.ToString().Trim(); tbBANKVALUE.Text = TopSeaiEntity.IMPORTVALUE.ToString().Trim(); // ddlGOODSSTANDARD.Text = ""; //if (TopSeaiEntity.BALES.ToString().Trim() == "") //{ // ddlGOODSSTANDARD.Text = "散货"; //} //else //{ // ddlGOODSSTANDARD.Text = "托盘"; //} // 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(); } } // //ViewState["GID"] = getBSNO(); //this.hdGid.Value = ViewState["GID"].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.Value = 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(); ddlGOODSSTANDARD.Text = WmsEntity.GOODSSTANDARD.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();//备案清单号 tbMARKETVALUE.Text = WmsEntity.MARKETVALUE.ToString().Trim(); tbBANKVALUE.Text = WmsEntity.BANKVALUE.ToString().Trim(); tbAREANAME.Text = WmsEntity.AREANAME.ToString().Trim(); tbBZTCHNO.Text = WmsEntity.BZTCHNO.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 { this.btSTARTBILLINGDATE.Disabled = true; if (this.hdISCHANGE.Value.Trim() == "True") { tbFREESTORAGEPERIODAP.Enabled = false; tbSTARTBILLINGDATEAP.Enabled = false; } } // if (this.hdHandle.Value.Trim() == "edit") { tbWMSNO.Enabled = false; this.divdel.Disabled = 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; this.divdel.Disabled = true; } // recvJSON = ""; recvJSON = this.recvContainer.Value.Trim(); recvJSON_2 = ""; recvJSON_2 = this.recvContainer_2.Value.Trim(); if (!recvJSON.Trim().Equals("")) { //应收账户保存 JsonWmsInGroupEntity2 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; this.btSTARTBILLINGDATE.Disabled = false; // tbWMSNO.Enabled=false; //ddlCUSTOMERNAME tbBLNO.Enabled=false; tbCONTRACTNO.Enabled=false; //ddlSTORAGENAME tbFREESTORAGEPERIOD.Enabled=false; tbFREESTORAGEPERIODAP.Enabled = false; //ddlGOODSNAME tbGOODSMODEL.Enabled=false; ddlGOODSSTANDARD.Enabled = false; tbCUSTNO.Enabled = false; tbCUSTOMNO.Enabled = false; ddlCHARGEUNIT.Enabled=false; tbWMSDATE.Enabled = false; //tbSTARTBILLINGDATE.Enabled = false; tbSTARTBILLINGDATE.Disabled = true; tbSTARTBILLINGDATEAP.Enabled = false; tbMARKETVALUE.Enabled = false; tbBANKVALUE.Enabled = false; tbAREANAME.Enabled = false; tbBZTCHNO.Enabled = false; //仓储费率 //divadd2.Disabled = true; //divsave2.Disabled = true; //divdel2.Disabled = true; //divrefresh2.Disabled = true; //mygrid_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; this.btSTARTBILLINGDATE.Disabled = true; // tbWMSNO.Enabled = false; //ddlCUSTOMERNAME tbBLNO.Enabled = false; tbCONTRACTNO.Enabled = false; //ddlSTORAGENAME tbFREESTORAGEPERIOD.Enabled = false; tbFREESTORAGEPERIODAP.Enabled = false; //ddlGOODSNAME tbGOODSMODEL.Enabled = false; ddlGOODSSTANDARD.Enabled = false; tbCUSTNO.Enabled = false; tbCUSTOMNO.Enabled = false; ddlCHARGEUNIT.Enabled = false; tbWMSDATE.Enabled = false; //tbSTARTBILLINGDATE.Enabled = false; tbSTARTBILLINGDATE.Disabled = true; tbSTARTBILLINGDATEAP.Enabled = false; tbMARKETVALUE.Enabled = false; tbBANKVALUE.Enabled = false; tbAREANAME.Enabled = false; tbBZTCHNO.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(JsonWmsInGroupEntity2 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.Value.Trim()); WmsEntity.STARTBILLINGDATEAP = DateTime.Parse(tbSTARTBILLINGDATEAP.Text.Trim()); WmsEntity.ISCHANGE = false; 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 = tbGOODSMODEL.Text.Trim(); WmsEntity.GOODSSTANDARD = ddlGOODSSTANDARD.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.CORPID = strCompanyID; WmsEntity.MARKETVALUE = tbMARKETVALUE.Text.Trim() == "" ? 0 : Decimal.Parse(tbMARKETVALUE.Text.Trim()); WmsEntity.BANKVALUE = tbBANKVALUE.Text.Trim() == "" ? 0 : Decimal.Parse(tbBANKVALUE.Text.Trim()); WmsEntity.AREANAME = tbAREANAME.Text.Trim(); WmsEntity.CUSTOMNO = this.tbCUSTOMNO.Text.Trim();//备案清单号 WmsEntity.BZTCHNO = tbBZTCHNO.Text.Trim(); 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.GOODSMODEL = tbGOODSMODEL.Text.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.UpdateWmsInInfo(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.Value.Trim()); WmsEntity.STARTBILLINGDATEAP = DateTime.Parse(tbSTARTBILLINGDATEAP.Text.Trim()); WmsEntity.ISCHANGE = false; 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.GOODSSTANDARD = ddlGOODSSTANDARD.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.MARKETVALUE = tbMARKETVALUE.Text.Trim()==""?0:Decimal.Parse(tbMARKETVALUE.Text.Trim()); WmsEntity.BANKVALUE = tbBANKVALUE.Text.Trim() == "" ? 0 : Decimal.Parse(tbBANKVALUE.Text.Trim()); WmsEntity.AREANAME = this.tbAREANAME.Text.Trim(); WmsEntity.BZTCHNO = tbBZTCHNO.Text.Trim(); WmsEntity.CLIENTBSNO = ""; int iR = WmsDA.Add(WmsEntity); } // List WmsEntities = 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,GOODSPACK,GOODSRKSL,GOODSPACKACTUAL,GOODSRKSLACTUAL,ARFEE,APFEE,MARKETVALUE,BANKVALUE,AREANAME,REMARK,ASSOCIATEDNO,MODIFIEDTIME,GOODSPACKSTOCK,LINENUM FROM wms_in WHERE 1<0"; } else { strInitSql = " SELECT GID,CTNALL,CNTRNO,SEALNO,GOODSPACK,GOODSRKSL,GOODSPACKACTUAL,GOODSRKSLACTUAL,ARFEE,APFEE,MARKETVALUE,BANKVALUE,AREANAME,REMARK,ASSOCIATEDNO,MODIFIEDTIME,GOODSPACKSTOCK,LINENUM 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 (JsonWmsInEntity2 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 strLINENUM = WmsIn.WmsIn2.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn2.ToString().Trim(); model.LINENUM = int.Parse(strLINENUM); if (!WmsInfoTable.Rows[i]["LINENUM"].ToString().Trim().Equals(strLINENUM)) { //strSql += String.Format(",blno = '{0}'", strLINENUM); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "行号", WmsInfoTable.Rows[i]["LINENUM"].ToString().Trim(), strLINENUM); } //箱型 string strCTNALL = WmsIn.WmsIn3.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn3.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.WmsIn4.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn4.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.WmsIn5.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn5.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 strGOODSPACK = WmsIn.WmsIn6.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn6.ToString().Trim(); model.GOODSPACK = Decimal.Parse(strGOODSPACK); model.GOODSPACKSTOCK = Decimal.Parse(strGOODSPACK); //剩余件数 if (!WmsInfoTable.Rows[i]["GOODSPACK"].ToString().Trim().Equals(strGOODSPACK)) { //strSql += String.Format(",accname = '{0}'", strGOODSPACK); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "件数", WmsInfoTable.Rows[i]["GOODSPACK"].ToString().Trim(), strGOODSPACK); } //计费数量 string strGOODSRKSL = WmsIn.WmsIn7.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn7.ToString().Trim(); model.GOODSRKSL = Decimal.Parse(strGOODSRKSL); model.GOODSSTOCK = Decimal.Parse(strGOODSRKSL); if (!WmsInfoTable.Rows[i]["GOODSRKSL"].ToString().Trim().Equals(strGOODSRKSL)) { //strSql += String.Format(",accname = '{0}'", strARFEE); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "计费数量", WmsInfoTable.Rows[i]["GOODSRKSL"].ToString().Trim(), strGOODSRKSL); } //实际件数 string strGOODSPACKACTUAL = WmsIn.WmsIn7.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn8.ToString().Trim(); model.GOODSPACKACTUAL = Decimal.Parse(strGOODSPACKACTUAL); if (!WmsInfoTable.Rows[i]["GOODSPACKACTUAL"].ToString().Trim().Equals(strGOODSPACKACTUAL)) { //strSql += String.Format(",accname = '{0}'", strGOODSPACKACTUAL); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "实际件数", WmsInfoTable.Rows[i]["GOODSPACKACTUAL"].ToString().Trim(), strGOODSPACKACTUAL); } //实际数量 string strGOODSRKSLACTUAL = WmsIn.WmsIn9.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn9.ToString().Trim(); model.GOODSRKSLACTUAL = Decimal.Parse(strGOODSRKSLACTUAL); if (!WmsInfoTable.Rows[i]["GOODSRKSLACTUAL"].ToString().Trim().Equals(strGOODSRKSLACTUAL)) { //strSql += String.Format(",accname = '{0}'", strARFEE); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "实际数量", WmsInfoTable.Rows[i]["GOODSRKSLACTUAL"].ToString().Trim(), strGOODSRKSLACTUAL); } //应收账款 string strARFEE = WmsIn.WmsIn10.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn10.ToString().Trim(); model.ARFEE = Decimal.Parse(strARFEE); if (!WmsInfoTable.Rows[i]["ARFEE"].ToString().Trim().Equals(strARFEE)) { //strSql += String.Format(",accname = '{0}'", strARFEE); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "应收账款", WmsInfoTable.Rows[i]["ARFEE"].ToString().Trim(), strARFEE); } //应付账款 string strAPFEE = WmsIn.WmsIn11.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn11.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 strMARKETVALUE = WmsIn.WmsIn12.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn12.ToString().Trim(); string strMARKETVALUE = tbMARKETVALUE.Text.Trim() == "" ? "0" : tbMARKETVALUE.Text.Trim(); model.MARKETVALUE = Decimal.Parse(strMARKETVALUE); if (!WmsInfoTable.Rows[i]["MARKETVALUE"].ToString().Trim().Equals(strMARKETVALUE)) { //strSql += String.Format(",accname = '{0}'", strMARKETVALUE); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "市场货值", WmsInfoTable.Rows[i]["MARKETVALUE"].ToString().Trim(), strMARKETVALUE); } //银行货值 //string strBANKVALUE = WmsIn.WmsIn13.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn13.ToString().Trim(); string strBANKVALUE = tbBANKVALUE.Text.Trim() == "" ? "0" : tbBANKVALUE.Text.Trim(); model.BANKVALUE = Decimal.Parse(strBANKVALUE); if (!WmsInfoTable.Rows[i]["BANKVALUE"].ToString().Trim().Equals(strBANKVALUE)) { //strSql += String.Format(",accname = '{0}'", strAPFEE); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "银行货值", WmsInfoTable.Rows[i]["BANKVALUE"].ToString().Trim(), strBANKVALUE); } //库位 //string strAREANAME = WmsIn.WmsIn14.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn14.ToString().Trim(); string strAREANAME = this.tbAREANAME.Text.Trim(); model.AREANAME = strAREANAME; if (!WmsInfoTable.Rows[i]["AREANAME"].ToString().Trim().Equals(strAREANAME)) { //strSql += String.Format(",blno = '{0}'", strAREANAME); LogContent += String.Format(log.GetLogContentTemplate(Logger.LogTypes.UPDATE), "库位", WmsInfoTable.Rows[i]["AREANAME"].ToString().Trim(), strAREANAME); } // //备注 string strREMARK = WmsIn.WmsIn15.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn15.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) { //if (strSql.Trim().StartsWith(",")) //{ // strSql = strSql.Trim().Substring(1); //} //string strUpdateSql = String.Format("UPDATE {0} SET {1} WHERE GID = '{2}'", "wms_in", strSql, WmsIn.WmsIn1.Trim()); //sqlList.Add(strUpdateSql); // 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 = ddlGOODSSTANDARD.Text.Trim();// 规格 model.GOODSKGS = 0;// 重量 model.KINDPKGS = "";// // model.ISLOCK = false;// 是否锁定 model.LOCKUSER = "";// 锁定操作人 model.ISDELETE = false;// 是否废除 model.DELETEUSER = "";// 废除操作人 // model.GOODSTHICKNESS = 0; model.GOODSWIDTH = 0; model.GOODSLENGTH = 0; model.GOODSSLICE = 0; model.GOODSGRADE = ""; model.STACKLOCATION = ""; model.DODATE = DateTime.Parse(tbWMSDATE.Text.Trim()); model.CORPID = strCompanyID; // WmsEntities.Add(model); logList.Add(String.Format("更新账户标识 {0} {1}", WmsIn.WmsIn1.Trim(), LogContent)); } WmsInEntities.Remove(WmsIn); break; } } } if (WmsEntities.Count > 0) { int iResult = WmsInDA.UpdateFromGrid(WmsEntities); //为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)" + ",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)" + ",GOODSSTOCK=(select isnull(sum(GOODSSTOCK),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",GOODSPACKACTUAL=(select isnull(sum(GOODSPACKACTUAL),0) from wms_in where ASSOCIATEDNO=wms.gid)" + ",GOODSRKSLACTUAL=(select isnull(sum(GOODSRKSLACTUAL),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 isnull(ISLOCK,0)=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 (JsonWmsInEntity2 WmsIn in WmsInEntities) { WmsInEntity model = new WmsInEntity(); model.GID = WmsIn.WmsIn1.Trim().Equals("null") ? "" : WmsIn.WmsIn1.Trim(); // #region 插入信息 //行号 model.LINENUM = WmsIn.WmsIn2.ToString().Trim().ToLower().Equals("null") ? 0 : int.Parse(WmsIn.WmsIn2.ToString().Trim()); //箱型 string strCTNALL = WmsIn.WmsIn3.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn3.Trim(); model.CTNALL = strCTNALL; //箱号 string strCNTRNO = WmsIn.WmsIn4.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn4.Trim(); model.CNTRNO = strCNTRNO; //封号 string strSEALNO = WmsIn.WmsIn5.Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn5.Trim(); model.SEALNO = strSEALNO; //件数 string strGOODSPACK = WmsIn.WmsIn6.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn6.ToString().Trim(); if (strGOODSPACK.Trim() == "" || strGOODSPACK.Trim() == "0" || strGOODSPACK.Trim() == "0.0000") { model.GOODSPACK = 0; model.GOODSPACKSTOCK = 0; //剩余件数 } else { model.GOODSPACK = Decimal.Parse(strGOODSPACK); model.GOODSPACKSTOCK = Decimal.Parse(strGOODSPACK); //剩余件数 } //计费数量 string strGOODSRKSL = WmsIn.WmsIn7.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn7.ToString().Trim(); if (strGOODSRKSL.Trim() == "" || strGOODSRKSL.Trim() == "0" || strGOODSRKSL.Trim() == "0.0000") { model.GOODSRKSL = 0; model.GOODSSTOCK = 0; //剩余件数 } else { model.GOODSRKSL = Decimal.Parse(strGOODSRKSL); model.GOODSSTOCK = Decimal.Parse(strGOODSRKSL); //计费数量 } //实际件数 string strGOODSPACKACTUAL = WmsIn.WmsIn8.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn8.ToString().Trim(); if (strGOODSPACKACTUAL.Trim() == "" || strGOODSPACKACTUAL.Trim() == "0" || strGOODSPACKACTUAL.Trim() == "0.0000") { model.GOODSPACKACTUAL = 0; } else { model.GOODSPACKACTUAL = Decimal.Parse(strGOODSPACKACTUAL); } //实际数量 string strGOODSRKSLACTUAL = WmsIn.WmsIn9.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn9.ToString().Trim(); if (strGOODSRKSLACTUAL.Trim() == "" || strGOODSRKSLACTUAL.Trim() == "0" || strGOODSRKSLACTUAL.Trim() == "0.0000") { model.GOODSRKSLACTUAL = 0; } else { model.GOODSRKSLACTUAL = Decimal.Parse(strGOODSRKSLACTUAL); } //应收账款 string strARFEE = WmsIn.WmsIn10.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn10.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.WmsIn11.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn11.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 strMARKETVALUE = WmsIn.WmsIn12.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn12.ToString().Trim(); //if (strMARKETVALUE.Trim() == "" || strMARKETVALUE.Trim() == "0" || strMARKETVALUE.Trim() == "0.00") //{ // model.MARKETVALUE = 0; //} //else //{ // model.MARKETVALUE = Decimal.Parse(Decimal.Parse(strMARKETVALUE.Trim()).ToString("F2")); //} model.MARKETVALUE = tbMARKETVALUE.Text.Trim() == "" ? 0 : Decimal.Parse(Decimal.Parse(tbMARKETVALUE.Text.Trim()).ToString("F2")); //银行货值 //string strBANKVALUE = WmsIn.WmsIn13.ToString().Trim().Equals("null") ? "" : WmsIn.WmsIn13.ToString().Trim(); //if (strBANKVALUE.Trim() == "" || strBANKVALUE.Trim() == "0" || strBANKVALUE.Trim() == "0.00") //{ // model.BANKVALUE = 0; //} //else //{ // model.BANKVALUE = Decimal.Parse(Decimal.Parse(strBANKVALUE.Trim()).ToString("F2")); //} model.BANKVALUE = tbBANKVALUE.Text.Trim() == "" ? 0 : Decimal.Parse(Decimal.Parse(tbBANKVALUE.Text.Trim()).ToString("F2")); //库位 //string strAREANAME = WmsIn.WmsIn14.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn14.ToString().Trim(); //model.AREANAME = WmsIn.WmsIn14.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn14.ToString().Trim(); model.AREANAME = this.tbAREANAME.Text.Trim(); //备注 //string strREMARK = WmsIn.WmsIn15.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn15.ToString().Trim(); model.REMARK = WmsIn.WmsIn15.ToString().Trim().ToLower().Equals("null") ? "" : WmsIn.WmsIn15.ToString().Trim(); // 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 = ddlGOODSSTANDARD.Text.Trim();// 规格 model.GOODSKGS = 0;// 重量 model.KINDPKGS = "";// // model.ISLOCK = false;// 是否锁定 model.LOCKUSER = "";// 锁定操作人 model.ISDELETE = false;// 是否废除 model.DELETEUSER = "";// 废除操作人 // model.GOODSTHICKNESS = 0; model.GOODSWIDTH = 0; model.GOODSLENGTH = 0; model.GOODSSLICE = 0; model.GOODSGRADE = ""; model.STACKLOCATION = ""; 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 JsonWmsInGroupEntity2 GetPostEntity(string tempValue) { JsonWmsInGroupEntity2 WmsInfoGroupEntity = (JsonWmsInGroupEntity2)JSON.Instance.ToObject(tempValue); return WmsInfoGroupEntity; } #endregion #region 提取编号 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() + "%' 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 ""; } #endregion /// /// 查询 /// /// /// protected void Button2_Click(object sender, EventArgs e) { if (this.hid_associatedno.Value.Trim() == "") { this.hdGID.Value = ""; tbWMSNO.Text = ""; tbWMSDATE.Text = strdate; tbSTARTBILLINGDATE.Value = 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 = ""; tbGOODSMODEL.Text = ""; ddlCHARGEUNIT.Text = "吨"; tbCUSTNO.Text = ""; tbCUSTOMNO.Text = ""; tbMARKETVALUE.Text = ""; tbBANKVALUE.Text = ""; tbAREANAME.Text = ""; tbBZTCHNO.Text = ""; ddlGOODSSTANDARD.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 * from(select CUSTOMERNAME,MBLNO,CONTRACTNO,"; sSQL = sSQL+"GOODSNAME,NUMBERPLATE,UNITOFWEIGHT, "; sSQL = sSQL+"CUSTNO,CUSTOMNO,PKGS,BALES,KGS,NETWEIGHT,CBM from op_seai union all "; sSQL = sSQL + "select m.buyer as CUSTOMERNAME,m.Billno as MBLNO,m.HTH as CONTRACTNO, "; sSQL = sSQL+"c.name as GOODSNAME,c.FactoryNo as NUMBERPLATE,'吨' as UNITOFWEIGHT, "; sSQL = sSQL+"m.Contractno as CUSTNO,m.DeclareNumber as CUSTOMNO,1 as PKGS,c.boxcount as bales, "; sSQL = sSQL + "c.m_weight as KGS,c.[weight]/1000 as netweight,0 as cbm "; sSQL = sSQL+"from import_main m left join import_cargo c on c.contractno=m.contractno)tt where 1=1 " + this.hdSelect.Value.Trim(); 20131227 邓羽 仓储费模块兼容新协航进口贸易 */ 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(); tbGOODSMODEL.Text = ds.Tables[0].Rows[0]["NUMBERPLATE"].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(); tbMARKETVALUE.Text = ds.Tables[0].Rows[0]["IMPORTVALUE"].ToString().Trim(); tbBANKVALUE.Text = ds.Tables[0].Rows[0]["IMPORTVALUE"].ToString().Trim(); // ddlGOODSSTANDARD.Text = ""; //if (ds.Tables[0].Rows[0]["BALES.ToString().Trim() == "") //{ // ddlGOODSSTANDARD.Text = "散货"; //} //else //{ // ddlGOODSSTANDARD.Text = "托盘"; //} // 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.Value = 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 = ""; tbGOODSMODEL.Text = ""; ddlCHARGEUNIT.Text = "吨"; tbCUSTNO.Text = ""; tbCUSTOMNO.Text = ""; tbMARKETVALUE.Text = ""; tbBANKVALUE.Text = ""; tbAREANAME.Text = ""; tbBZTCHNO.Text = ""; ddlGOODSSTANDARD.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 // } }