private void btAdd_Click(object sender, System.EventArgs e) { CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; if (ls1.strDeptID == "CEN00" || ls1.strNewDeptID == "") { this.Popup("没有操作权限,请使用部门帐号!"); this.btnQuery.Enabled = false; this.btAdd.Enabled = false; return; } if (this.txtMaterialCode.Text.Trim() == "") { this.SetErrorMsgPageBydirHistory("请选择要入库有原材料!"); return; } string strEnterCount = this.txtEnterCount.Text.Trim(); if (strEnterCount == "") { this.SetErrorMsgPageBydirHistory("请输入本次入库数量!"); return; } if (!this.JudgeIsNum(strEnterCount, "本次入库数量")) { return; } CMSMStruct.MaterialEnterStruct mes1 = new CommCenter.CMSMStruct.MaterialEnterStruct(); mes1.dEnterCount = Math.Round(double.Parse(strEnterCount), 2); mes1.strBatchNo = this.txtBatchNo.Text.Trim(); mes1.strMaterialCode = this.txtMaterialCode.Text.Trim(); mes1.strMaterialName = this.txtMaterialName.Text.Trim(); mes1.strStandardUnit = this.txtStandardUnit.Text.Trim(); mes1.strUnit = this.txtUnit.Text.Trim(); mes1.dPrice = Math.Round(double.Parse(this.txtPrice.Text.Trim()), 2); mes1.strProviderName = this.txtProviderName.Text.Trim(); mes1.strMaterialType = this.ddlMaterialType.SelectedValue; mes1.dLastCount = Math.Round(double.Parse(this.txtCurCount.Text.Trim()), 2); mes1.dCount = mes1.dLastCount + mes1.dEnterCount; mes1.strOperType = "0"; mes1.strEnterDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); // mes1.strDeptID=ls1.strNewDeptID; mes1.strDeptID = ls1.strDeptID; mes1.strOperDate = mes1.strEnterDate; mes1.strOperName = ls1.strOperName; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; msb1 = new MaterialSBusi(strcons); if (msb1.InsertMaterialEnter(mes1)) { this.SetSuccMsgPageBydir("录入原材料入库成功!", ""); return; } else { this.SetErrorMsgPageBydir("录入原材料入库失败,请重试!"); return; } }