📄 instructionmod2.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Botheighten.Yanghui.BusinessFacade;
using Botheighten.Yanghui.Framework;
using Botheighten.Yanghui.BusinessRules;
using Botheighten.Yanghui.Web.Controls;
namespace Botheighten.Yanghui.Web
{
/// <summary>
/// InstructionMod2 的摘要说明。
/// </summary>
public class InstructionMod2 : BasePage
{
protected System.Web.UI.WebControls.Label lblTitle;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.TextBox txtOrderId;
protected System.Web.UI.WebControls.TextBox txtOrderHeadId;
protected System.Web.UI.WebControls.ValidationSummary ErrorSummary;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.Label Label8;
protected System.Web.UI.WebControls.TextBox txtQuantity;
protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
protected System.Web.UI.WebControls.RangeValidator RangeValidator1;
protected System.Web.UI.WebControls.Label Label13;
protected System.Web.UI.WebControls.DataGrid gridOrderLine;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button btnGoBack;
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.HtmlControls.HtmlTable tableBOM;
protected System.Web.UI.WebControls.TextBox txtOrderCode;
protected Instruction_C Instruction_C1;
private void Page_Load(object sender, System.EventArgs e)
{
Principal p=this.CurrentUser();
this.CheckPermissionPage(p.Id,"","202");
this.lblMessage.Visible=false;
//this.GoBackFunction(this.btnGoBack);
if(!Page.IsPostBack)
{
string iid="";
string ilid="";
if(Request.QueryString["IID"]!=null)
iid=Request.QueryString["IID"].ToString();
if(Request.QueryString["ILID"]!=null)
ilid=Request.QueryString["ILID"].ToString();
this.ViewState["IID"]=iid;
this.ViewState["ILID"]=ilid;
this.InitPage();
}
}
private void InitPage()
{
Instruction_C1.OrderHeadId=this.ViewState["IID"].ToString();
Instruction_C1.Bind();
// string[] flags=new String[]{"Y","D","O"};
// DataTable dtOrder=OrderTicketSystem.AllOrderByFlag(flags);
//
// DropDownList lc=this.ddlOrder;
// lc.Items.Clear();
// lc.Items.Add(new ListItem("请选择...",""));
// foreach(DataRow myRow in dtOrder.Rows)
// {
//
// lc.Items.Add(new ListItem("[" + OrderTicketSystem.GetOrderCode(myRow[Order.ORDERHEADID].ToString()) +"]"+ myRow[Order.BOMCODE].ToString(),myRow[Order.ID].ToString()));
// }
// lc.DataBind();
this.InitIL();
}
private void InitIL()
{
string ilid=this.ViewState["ILID"].ToString();
InstructionLine il=new InstructionLine();
il.Id=ilid;
il.Retrieve();
if(il.IsPersistent)
{
this.txtOrderId.Text=il.Id;
this.txtOrderCode.Text = il.BOMCode;
this.txtQuantity.Text = il.Quantity.ToString();
}
this.BindBOMLine();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.gridOrderLine.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.gridOrderLine_ItemDataBound);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.btnGoBack.Click += new System.EventHandler(this.Button3_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void BindBOMLine()
{
string ilid=this.txtOrderId.Text.Trim();
DataTable dtIL=InstructionSystem.AllInstructionDetByIL(ilid);
Common.ReSet(this.gridOrderLine,dtIL.DefaultView);
this.gridOrderLine.DataSource=dtIL;
this.gridOrderLine.DataBind();
}
private void Button2_Click(object sender, System.EventArgs e)
{
string iid=this.ViewState["IID"].ToString();
if(iid!="")
{
for(int i=0;i<this.gridOrderLine.Items.Count;i++)
{
if(this.gridOrderLine.Items[i].Cells[4].Text.Trim()!="0")
{
this.lblMessage.Text="失败:此指令已经领料生产,无法修改指令数量";
this.lblMessage.Visible=true;
return;
}
}
InstructionLine il=new InstructionLine();
il.Id=this.ViewState["ILID"].ToString();
il.Retrieve();
int oq=il.Quantity ;
Order o=new Order();
o.Id=il.OrderId;
o.Retrieve();
il.Quantity=int.Parse(this.txtQuantity.Text.Trim());
il.JGCost=(il.Quantity * o.UnitJGCost);
il.JGPrice=(il.Quantity * o.UnitJGPrice);
o.CompleteQuantity= o.CompleteQuantity + (il.Quantity - oq) ;
try
{
InstructionSystem.UpdateILQuantity(il,o);
}
catch
{
this.lblMessage.Text="失败:修改指令遇到错误";
this.lblMessage.Visible=true;
}
this.lblMessage.Text="成功:修改指令成功";
this.lblMessage.Visible=true;
this.Button2.Visible=false;
}
}
private void gridOrderLine_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
{
string mid=e.Item.Cells[0].Text.Trim();
// double IQ=InventorySystem.GetInventorys(mid);
// e.Item.Cells[4].Text=IQ.ToString();
e.Item.Cells[0].Text = MaterielSystem.GetMaterielCode(mid);
// double CQ=q * double.Parse(e.Item.Cells[1].Text.Trim());
// e.Item.Cells[3].Text =CQ.ToString();
// if(CQ>IQ)
// {
// e.Item.ForeColor=Color.Red;
// this.ViewState["Over"]="Y";
// }
e.Item.Cells[2].Text = UnitSystem.GetUnitCode(e.Item.Cells[2].Text.Trim());
//e.Item.Cells[3].Text =e.Item.Cells[3].Text.Trim() +"%";
}
}
private void Button3_Click(object sender, System.EventArgs e)
{
Response.Redirect("InstructionWeb.aspx");
Response.End();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -