protected void btnConfirm_Click(object sender, EventArgs e) { AllocationBllAction allocationBllAction = new AllocationBllAction(); string text = (this.HdnAcode.Value == "") ? this.HdnAcodeList.Value : this.HdnAcode.Value; int num = allocationBllAction.OutDepositoryConfirm(text, this.Session["yhdm"].ToString()); if (num != 1) { this.RegisterStartupScript("alert", "<script>alert('\\n系统提示:\\n\\n库存不足 或者 没有权限!');</script>"); return; } DataTable allocationList = allocationBllAction.GetAllocationList("acode='" + text + "'"); string title = "调出提醒"; string content = text + "调拨单已被" + WebUtil.GetUserNames(base.UserCode) + "调出"; DataRow dataRow = allocationList.Rows[0]; string userCode = dataRow["InAllocationPerson"].ToString(); string dbTable = "Sm_Allocation"; string dbColumn = "acode"; string key = text; string uri = string.Concat(new string[] { "/StockManage/Allocation/AuditPage.aspx?ic=", dataRow["aid"].ToString(), "&acode=", text, "&allocationType=out" }); Warning.AddWarning(title, content, userCode, dbTable, dbColumn, key, uri); this.RegisterStartupScript("alert1", "<script>alert('\\n系统提示:\\n\\n 调拨成功!');</script>"); base.RegisterScript("location='ConfirmOutDepository.aspx'"); }
protected void ShowAllocationData() { AllocationBllAction allocationBllAction = new AllocationBllAction(); AllocationModel allocationModel = new AllocationModel(); allocationModel = allocationBllAction.ReturnAllocatonModel("aid='" + base.Request.QueryString["ic"] + "' "); this.lblAllocationNo.Text = allocationModel.Acode; this.FileLink1.FID = allocationModel.Acode; this.txtOutDepository.Text = allocationBllAction.GetTreasuryNameByCode(allocationModel.TCodea).Rows[0][0].ToString(); this.txtInDepository.Text = allocationBllAction.GetTreasuryNameByCode(allocationModel.TCodeb).Rows[0][0].ToString(); this.txtInDate.Text = allocationModel.InTime; this.txtOutAllocationPerson.Text = allocationBllAction.GetUserNameByCode(allocationModel.OutAllocationPerson); this.txtInAllocationPerson.Text = allocationBllAction.GetUserNameByCode(allocationModel.InAllocationPerson); this.txtRemark.Text = allocationModel.Explain; this.HdnTCodea.Value = allocationModel.TCodea; this.HdnAcode.Value = allocationModel.Acode; DataTable allocationStockList = allocationBllAction.GetAllocationStockList(allocationModel.TCodea, "acode='" + allocationModel.Acode + "'"); this.GVMaterialList.DataSource = allocationStockList; this.GVMaterialList.DataBind(); if (allocationStockList.Rows.Count > 0) { string total = Convert.ToDecimal(allocationStockList.Compute("SUM(Total)", string.Empty)).ToString("0.000"); GridViewUtility.AddTotalRow(this.GVMaterialList, total, 11); } this.lblBllProducer.Text = PageHelper.QueryUser(this, base.UserCode); this.lblPrintDate.Text = DateTime.Now.ToShortDateString(); }
protected void GVMaterialList_PageIndexChanging(object sender, GridViewPageEventArgs e) { AllocationBllAction allocationBllAction = new AllocationBllAction(); this.GVMaterialList.PageIndex = e.NewPageIndex; this.GVMaterialList.DataSource = allocationBllAction.GetAllocationStockList(this.HdnTCodea.Value, "acode='" + this.HdnAcode.Value + "'"); this.GVMaterialList.DataBind(); }
protected void btnDel_Click(object sender, EventArgs e) { using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString)) { sqlConnection.Open(); SqlTransaction sqlTransaction = sqlConnection.BeginTransaction(); List <string> list = new List <string>(); try { foreach (GridViewRow gridViewRow in this.gvPurchaseplan.Rows) { CheckBox checkBox = gridViewRow.FindControl("cbBox") as CheckBox; if (checkBox != null && checkBox.Checked) { sm_receiveNote modelByrnId = this.receiveNote.GetModelByrnId(checkBox.ToolTip); OutReserveModel modelByIc = this.outReserveBll.GetModelByIc(modelByrnId.soId); if (modelByIc != null) { this.outStockBll.DeleteByWhere(sqlTransaction, " where orcode ='" + modelByIc.orcode + "'"); this.outReserveBll.Delete(sqlTransaction, modelByIc.orcode); } StorageModel modelBySid = this.storage.GetModelBySid(modelByrnId.stId); if (modelBySid != null) { list.Add(modelBySid.scode); } if (!string.IsNullOrEmpty(modelByrnId.SAllocationId)) { AllocationBllAction allocationBllAction = new AllocationBllAction(); AllocationModel allocationModel = new AllocationModel(); allocationModel = allocationBllAction.ReturnAllocatonModel(" aid='" + modelByrnId.SAllocationId + "'"); if (allocationModel != null) { allocationBllAction.DelAllocationStockByAcode(sqlTransaction, allocationModel.Acode); allocationBllAction.Delete(sqlTransaction, allocationModel.Acode); } } this.receiveGoods.Delete(sqlTransaction, modelByrnId.rnId); this.receiveNote.Delete(sqlTransaction, modelByrnId.rnId); this.sendNote.UpdateStateNo(sqlTransaction, modelByrnId.snId); } } if (list.Count != 0) { this.storage.DelByTrans(sqlTransaction, list); } sqlTransaction.Commit(); this.BindGv(); } catch { sqlTransaction.Rollback(); base.RegisterScript("alert('系统提示:\\n\\n对不起撤销失败!');"); } } }
protected void BindTV() { AllocationBllAction allocationBllAction = new AllocationBllAction(); DataTable treasuryList = allocationBllAction.GetTreasuryList(-1); TreeNode treeNode = new TreeNode(); treeNode.Text = "仓库名称"; this.TVDepository.Nodes.Add(treeNode); treeNode.SelectAction = TreeNodeSelectAction.None; this.CreateTreeNodes(treasuryList, treeNode, ""); }
protected void Bind_GVAllocationList() { AllocationBllAction allocationBllAction = new AllocationBllAction(); DataTable allocationList = allocationBllAction.GetAllocationList(" 1 = 1 order by intime desc"); if (allocationList != null && allocationList.Rows.Count > NBasePage.pagesize) { this.HdnIsPage.Value = "1"; } Common2.BindGvTable(allocationList, this.GVAllocationList, false); }
protected void Bind_GVAllocationList() { AllocationBllAction allocationBllAction = new AllocationBllAction(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(" flowstate!=-3 and flowstate=1 "); stringBuilder.Append(" and isouta=1 and InAllocationPerson='" + base.UserCode + "' "); stringBuilder.Append(" order by intime desc "); DataTable allocationList = allocationBllAction.GetAllocationList(stringBuilder.ToString()); GridViewUtility.DataBind(this.GVAllocationList, allocationList); }
protected void gvwStorage_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex > -1) { try { AllocationBllAction allocationBllAction = new AllocationBllAction(); DataRowView dataRowView = (DataRowView)e.Row.DataItem; e.Row.Cells[15].Text = allocationBllAction.GetTreasuryNameByCode(dataRowView["tcodea"].ToString()).Rows[0][0].ToString(); e.Row.Cells[16].Text = allocationBllAction.GetTreasuryNameByCode(dataRowView["tcodeb"].ToString()).Rows[0][0].ToString(); } catch { } } }
protected void btnSertch_Click(object sender, EventArgs e) { string text = " acode like '%" + this.txtAllocationBill.Text.Trim() + "%'"; if (!string.IsNullOrEmpty(this.txtAllocationDateStarts.Text.Trim())) { text = text + " and intime >='" + this.txtAllocationDateStarts.Text.Trim() + "'"; } if (!string.IsNullOrEmpty(this.txtAllocationDateEnd.Text.Trim())) { text = text + " and intime < '" + Convert.ToDateTime(this.txtAllocationDateEnd.Text.Trim()).AddDays(1.0).ToString() + "'"; } this.GVAllocationList.AllowPaging = true; AllocationBllAction allocationBllAction = new AllocationBllAction(); this.GVAllocationList.DataSource = allocationBllAction.GetAllocationList(text); this.GVAllocationList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { base.Response.Clear(); base.Response.Cache.SetNoStore(); if (!this.Page.IsPostBack) { if (base.Request.QueryString["op"] == null && base.Request.QueryString["ac"] == null) { base.RegisterScript("top.ui.alert('页面错误,请联系技术人员')"); return; } if (base.Request.QueryString["op"] != "") { this.HdnOperater.Value = base.Request.QueryString["op"]; if (base.Request.QueryString["op"] == "Add") { this.lblAllocationNo.Text = DateTime.Now.ToString("yyyyMMddhhmmss"); this.hdGuid.Value = Guid.NewGuid().ToString(); this.HdnSelectOutPer.Value = base.UserCode; AllocationBllAction allocationBllAction = new AllocationBllAction(); this.txtOutAllocationPerson.Text = allocationBllAction.GetUserNameByCode(base.UserCode); } cn.justwin.stockBLL.Treasury treasury = new cn.justwin.stockBLL.Treasury(); if (treasury.GetManageMode() == SmEnum.SmSetValue.ParallelMode) { this.HdnStockModel.Value = "0"; } if (Convert.ToInt32(treasury.GetManageMode()) == 1) { this.HdnStockModel.Value = "1"; } } this.BindGVMaterialList(); this.btnSave.Attributes["onclick"] = "return checkData();"; this.txtOutDepository.Attributes["readonly"] = "readonly"; this.txtInDepository.Attributes["readonly"] = "readonly"; this.txtOutAllocationPerson.Attributes["readonly"] = "readonly"; this.txtInAllocationPerson.Attributes["readonly"] = "readonly"; this.lblAllocationNo.Attributes["readonly"] = "readonly"; this.FileLink1.MID = 89; this.FileLink1.FID = this.hdGuid.Value; this.FileLink1.Type = 1; } }
protected void Bind() { AllocationBllAction allocationBllAction = new AllocationBllAction(); DataTable materialOfDepositoryList = allocationBllAction.GetMaterialOfDepositoryList((base.Request.QueryString["did"] == "") ? "0" : base.Request.QueryString["did"], this.getStrWhere()); if (materialOfDepositoryList != null && materialOfDepositoryList.Rows.Count > NBasePage.pagesize) { this.HdnIsPage.Value = "1"; } Common2.BindGvTable(materialOfDepositoryList, this.GVMaterialList, false); List <string> list = new List <string>(); if (this.hdTsid.Value != "") { list = JsonHelper.GetListFromJson(this.hdTsid.Value); } foreach (GridViewRow gridViewRow in this.GVMaterialList.Rows) { CheckBox checkBox = gridViewRow.FindControl("chkSelectIt") as CheckBox; if (checkBox != null) { HiddenField hiddenField = gridViewRow.FindControl("hdScode") as HiddenField; HiddenField hiddenField2 = gridViewRow.FindControl("hdSprice") as HiddenField; HiddenField hiddenField3 = gridViewRow.FindControl("hdCorp") as HiddenField; string item = string.Concat(new string[] { hiddenField.Value, "|", hiddenField2.Value, "|", hiddenField3.Value, "|" }); if (list.Contains(item)) { checkBox.Checked = true; } } } }
protected void ShowAllocationData() { AllocationBllAction allocationBllAction = new AllocationBllAction(); AllocationModel allocationModel = new AllocationModel(); allocationModel = allocationBllAction.ReturnAllocatonModel("acode='" + ((base.Request.QueryString["ac"] == "") ? "0" : base.Request.QueryString["ac"]) + "' "); this.lblAllocationNo.Text = allocationModel.Acode; this.txtOutDepository.Text = allocationBllAction.GetTreasuryNameByCode(allocationModel.TCodea).Rows[0][0].ToString(); this.HdnSelectOutDepo.Value = allocationModel.TCodea; this.txtInDepository.Text = allocationBllAction.GetTreasuryNameByCode(allocationModel.TCodeb).Rows[0][0].ToString(); this.HdnIsTotal.Value = allocationBllAction.GetTreasuryNameByCode(allocationModel.TCodea).Rows[0][1].ToString(); this.HdnSecTotal.Value = allocationBllAction.GetTreasuryNameByCode(allocationModel.TCodea).Rows[0][1].ToString(); this.HdnSelectInDepo.Value = allocationModel.TCodeb; this.txtInDate.Text = allocationModel.InTime; this.txtOutAllocationPerson.Text = allocationBllAction.GetUserNameByCode(allocationModel.OutAllocationPerson); this.HdnSelectOutPer.Value = allocationModel.OutAllocationPerson; this.txtInAllocationPerson.Text = allocationBllAction.GetUserNameByCode(allocationModel.InAllocationPerson); this.HdnSelectInPer.Value = allocationModel.InAllocationPerson; this.txtRemark.Text = allocationModel.Explain; this.hdGuid.Value = allocationModel.Aid; DataTable allocationStockList = allocationBllAction.GetAllocationStockList(allocationModel.TCodea, "acode='" + allocationModel.Acode + "'"); if (allocationStockList != null && allocationStockList.Rows.Count > NBasePage.pagesize) { this.HdnIsPage.Value = "1"; } this.ViewState["DataTable"] = allocationStockList; if (allocationStockList.Rows.Count > 0) { Common2.BindGvTable(allocationStockList, this.GVMaterialList, false); string total = Convert.ToDecimal(allocationStockList.Compute("SUM(Total)", string.Empty)).ToString("0.000"); GridViewUtility.AddTotalRow(this.GVMaterialList, total, 12); return; } this.GVMaterialList.DataSource = allocationStockList; this.GVMaterialList.DataBind(); }
private void save(string type) { this.UpdateDataSource(); AllocationBllAction allocationBllAction = new AllocationBllAction(); if (this.HdnOperater.Value == "Add") { using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString)) { sqlConnection.Open(); SqlTransaction sqlTransaction = sqlConnection.BeginTransaction(); try { allocationBllAction.Insert(sqlTransaction, this.GetAllocationData()); DataTable dataTable = this.ViewState["DataTable"] as DataTable; if (dataTable != null) { foreach (DataRow row in dataTable.Rows) { allocationBllAction.Insert(sqlTransaction, this.GetStockModel(row)); } } sqlTransaction.Commit(); if (type == "pc") { base.RegisterScript("top.ui.tabSuccess({ parentName: '_transferringOrdre' });"); } else { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("alert('添加成功');"); stringBuilder.Append("parent.location.reload();"); base.RegisterScript(stringBuilder.ToString()); } } catch { sqlTransaction.Rollback(); if (type == "pc") { base.RegisterScript("top.ui.show('修改失败')"); } else { base.RegisterScript("alert('系统提示:\\n\\n修改失败!');"); } } return; } } if (this.HdnOperater.Value == "Edit") { using (SqlConnection sqlConnection2 = new SqlConnection(SqlHelper.ConnectionString)) { sqlConnection2.Open(); SqlTransaction sqlTransaction2 = sqlConnection2.BeginTransaction(); try { AllocationModel allocationData = this.GetAllocationData(); allocationBllAction.Update(sqlTransaction2, allocationData); allocationBllAction.DelAllocationStockByAcode(sqlTransaction2, allocationData.Acode); DataTable dataTable2 = this.ViewState["DataTable"] as DataTable; if (dataTable2 != null) { foreach (DataRow row2 in dataTable2.Rows) { allocationBllAction.Insert(sqlTransaction2, this.GetStockModel(row2)); } } sqlTransaction2.Commit(); if (type == "pc") { base.RegisterScript("top.ui.tabSuccess({ parentName: '_transferringOrdre' });"); } else { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append("alert('修改成功');"); stringBuilder.Append("parent.location.reload();"); base.RegisterScript(stringBuilder.ToString()); } } catch { sqlTransaction2.Rollback(); if (type == "pc") { base.RegisterScript("top.ui.show('修改失败')"); } else { base.RegisterScript("alert('系统提示:\\n\\n修改失败!');"); } } } } }
protected void GVAllocationList_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex > -1) { try { AllocationBllAction allocationBllAction = new AllocationBllAction(); DataRowView dataRowView = (DataRowView)e.Row.DataItem; e.Row.Cells[1].Text = (this.GVAllocationList.PageSize * this.GVAllocationList.PageIndex + e.Row.RowIndex + 1).ToString(); HyperLink hyperLink = (HyperLink)e.Row.Cells[2].FindControl("HyperLink1"); hyperLink.Text = string.Concat(new string[] { "<a class='al' href=javascript:viewopen('AuditPage.aspx?ic=", dataRowView["aid"].ToString(), "&BusiClass=001&BusiCode=075',820,500) >", dataRowView["acode"].ToString(), "</a>" }); if (e.Row.Cells[8].Text == "已审核") { e.Row.Cells[8].ForeColor = Color.Green; } else { e.Row.Cells[6].ForeColor = Color.Red; } e.Row.Cells[3].Text = allocationBllAction.GetTreasuryNameByCode(dataRowView["tcodea"].ToString()).Rows[0][0].ToString(); e.Row.Cells[4].Text = allocationBllAction.GetTreasuryNameByCode(dataRowView["tcodeb"].ToString()).Rows[0][0].ToString(); ((CheckBox)e.Row.Cells[0].FindControl("chkSelectIt")).Attributes["onclick"] = string.Concat(new object[] { "chkClick('", Convert.ToBoolean(dataRowView["isinb"]), "',this.checked,'", dataRowView["acode"].ToString(), "');" }); e.Row.Attributes["onclick"] = string.Concat(new object[] { "rowClick('", Convert.ToBoolean(dataRowView["isinb"]), "','", dataRowView["acode"].ToString(), "');" }); e.Row.Attributes["id"] = dataRowView["acode"].ToString(); if (Convert.ToBoolean(dataRowView["isouta"])) { e.Row.Cells[6].Text = "已调出"; e.Row.Cells[6].ForeColor = Color.Green; } else { e.Row.Cells[6].Text = "未调出"; e.Row.Cells[6].ForeColor = Color.Red; } if (Convert.ToBoolean(dataRowView["isinb"])) { e.Row.Cells[7].Text = "已接收"; e.Row.Cells[7].ForeColor = Color.Green; } else { e.Row.Cells[7].Text = "未接收"; e.Row.Cells[7].ForeColor = Color.Red; } } catch { } } }