protected void Page_Load(object sender, System.EventArgs e) { // Put user code to initialize the page here if (Session["Login"] == null) { Response.Redirect("../Exit.aspx"); return; } CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; string strBillReceiveID = Request.QueryString["ID"]; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; StoBusi = new BusiComm.StorageBusi(strcons); if (!IsPostBack) { this.txtStandardUnit.ReadOnly = true; this.txtStandardCount.ReadOnly = true; if (strBillReceiveID == "" || strBillReceiveID == null) { strBeginDate = DateTime.Now.ToShortDateString(); this.btnAdd.Enabled = true; this.FillDropDownList("NewDept", this.ddlReceiveDeptID); this.FillDropDownList("tbNameCodeToStorage", this.ddlGroup, "vcCommSign='GROUP'"); if (ls1.strDeptID != "CEN00" && ls1.strLimit != "CL001") { this.ddlReceiveDeptID.SelectedIndex = this.ddlReceiveDeptID.Items.IndexOf(this.ddlReceiveDeptID.Items.FindByValue(ls1.strNewDeptID)); this.ddlReceiveDeptID.Enabled = false; } this.ddlBillType.Items.Add(new ListItem("无制令原材料领用单", "0")); this.ddlBillType.Items.Add(new ListItem("无制令工具特殊领用单", "1")); this.ddlBillType.SelectedIndex = 0; if (this.ddlBillType.SelectedValue == "0") { this.FillDropDownList("PClass", this.ddlMaterialType, "vcCommSign in('Raw','Pack')"); } else { this.ddlMaterialType.Items.Add(new ListItem("生产使用工用具", "22001~22999")); this.ddlMaterialType.Items.Add(new ListItem("门店销售使用工用具", "23001~23999")); this.ddlMaterialType.Items.Add(new ListItem("机电工用具及零部件", "25001~25999")); this.ddlMaterialType.SelectedIndex = 0; } this.FillDropDownList("AllMaterial", this.ddlProduct, "cnvcProductClass='" + this.ddlMaterialType.SelectedValue + "'"); if (this.ddlProduct.Items.Count > 0) { DataTable dtmaterial = (DataTable)Application["AllMaterial"]; DataView dview = new DataView(dtmaterial); dview.RowFilter = "vcCommCode='" + this.ddlProduct.SelectedValue + "'"; this.lblUnit.Text = dview[0]["cnvcUnit"].ToString(); this.txtStandardUnit.Text = dview[0]["cnvcStandardUnit"].ToString(); this.txtStandardCount.Text = dview[0]["cnnStatdardCount"].ToString(); } DataTable dtout = new DataTable(); dtout.Columns.Add("cnvcProductCode"); dtout.Columns.Add("cnvcProductName"); dtout.Columns.Add("cnvcStandardUnit"); dtout.Columns.Add("cnnStandardCount"); dtout.Columns.Add("cnvcUnit"); dtout.Columns.Add("cnnClassStorage"); dtout.Columns.Add("cnvcReceiveOperID"); dtout.Columns.Add("cnnReceiveCount"); dtout.Columns.Add("cnnOutCount"); dtout.Columns.Add("cnnLoseCount"); dtout.Columns.Add("cnnCount"); Session["ReceiveDetail"] = dtout; this.DataGrid1.DataSource = dtout; this.DataGrid1.DataBind(); this.DataGrid1.Columns[8].Visible = false; this.DataGrid1.Columns[9].Visible = false; this.DataGrid1.Columns[10].Visible = false; this.DataGrid1.Columns[11].Visible = false; this.btnPrint.Enabled = false; } else { this.btnAdd.Enabled = false; this.FillDropDownList("NewDept", this.ddlReceiveDeptID); this.FillDropDownList("tbNameCodeToStorage", this.ddlGroup, "vcCommSign='GROUP'"); this.ddlBillType.Items.Add(new ListItem("原材料制令领用单", "0")); this.ddlBillType.Items.Add(new ListItem("无制令原材料领用单", "1")); this.ddlBillType.Items.Add(new ListItem("无制令工具特殊领用单", "2")); this.ddlBillType.SelectedIndex = 0; DataSet dsout = StoBusi.GetBillOfReceiveOneLog(strBillReceiveID); DataTable dtLog = dsout.Tables["ReceiveLog"]; DataTable dtDetail = dsout.Tables["ReceiveDetail"]; Session["ReceiveDetail"] = dtDetail; this.ddlBillType.SelectedIndex = this.ddlBillType.Items.IndexOf(this.ddlBillType.Items.FindByText(dtLog.Rows[0]["cnvcReceiveType"].ToString())); this.ddlReceiveDeptID.SelectedIndex = this.ddlReceiveDeptID.Items.IndexOf(this.ddlReceiveDeptID.Items.FindByValue(dtLog.Rows[0]["cnvcReceiveDeptID"].ToString())); this.ddlGroup.SelectedIndex = this.ddlGroup.Items.IndexOf(this.ddlGroup.Items.FindByValue(dtLog.Rows[0]["cnvcGroup"].ToString())); DataSet dsprint = new DataSet("无制令工具特殊领用单(" + dtLog.Rows[0]["cnvcClass"].ToString() + ")"); Session.Remove("BillPrint"); DataTable dtLogCopy = dtLog.Copy(); dtLogCopy.Rows[0]["cnvcReceiveDeptID"] = this.ddlReceiveDeptID.SelectedItem.Text; dtLogCopy.Rows[0]["cnvcGroup"] = this.ddlGroup.SelectedItem.Text; dsprint.Tables.Add(dtLogCopy); dsprint.Tables.Add(dtDetail.Copy()); Session["BillPrint"] = dsprint; this.txtReceiveID.Text = strBillReceiveID; strBeginDate = dtLog.Rows[0]["cndReceiveDate"].ToString().Substring(0, 10); this.txtClass.Text = dtLog.Rows[0]["cnvcClass"].ToString(); this.txtMaterialInchargeOperID.Text = dtLog.Rows[0]["cnvcMaterialInchargeOperID"].ToString(); this.txtStorageInchargeOperID.Text = dtLog.Rows[0]["cnvcStorageInchargeOperID"].ToString(); this.txtSendOperID.Text = dtLog.Rows[0]["cnvcSendOperID"].ToString(); this.txtBillState.Text = dtLog.Rows[0]["cnvcBillState"].ToString(); this.ddlBillType.Enabled = false; this.ddlReceiveDeptID.Enabled = false; this.ddlGroup.Enabled = false; this.txtClass.Enabled = false; this.txtMaterialInchargeOperID.Enabled = false; this.txtStorageInchargeOperID.Enabled = false; this.txtSendOperID.Enabled = false; this.ddlMaterialType.Enabled = false; this.ddlProduct.Enabled = false; this.txtStandardUnit.Enabled = false; this.txtStandardCount.Enabled = false; this.txtReceiveCount.Enabled = false; this.txtClassStorage.Enabled = false; this.txtReceiveOperID.Enabled = false; this.btnAdd.Enabled = false; if (this.ddlBillType.SelectedItem.Text == "无制令工具特殊领用单") { this.btnPrint.Enabled = true; } else { this.btnPrint.Enabled = false; } switch (this.txtBillState.Text.Trim()) { case "0": this.btnReceiveNew.Text = "发货量确认"; this.DataGrid1.Columns[9].Visible = false; this.DataGrid1.Columns[10].Visible = false; this.DataGrid1.Columns[12].Visible = false; // this.btnReceiveNew.Attributes.Add("onclick","return confirm('请确认你已经正确填写了\"发货量\",并已将本领料单发货。\\n\\n确认发货?');"); break; case "1": this.btnReceiveNew.Text = "收货确认"; ((BoundColumn)this.DataGrid1.Columns[8]).ReadOnly = true; this.DataGrid1.Columns[12].Visible = false; this.btnReceiveNew.Enabled = true; this.btnReceiveNew.Attributes.Add("onclick", "return confirm('请确认你已经正确填写了\"损耗量和实际领用量\",并要进行本领料单收货确认。\\n\\n确认收货?');"); break; case "2": this.btnReceiveNew.Text = "领料单"; this.btnReceiveNew.Enabled = false; this.DataGrid1.Columns[11].Visible = false; this.DataGrid1.Columns[12].Visible = false; break; } this.DataGrid1.DataSource = dtDetail; this.DataGrid1.DataBind(); } } else { strBeginDate = Request.Form["txtBegin"].ToString(); } }