This commit is contained in:
高飞 2025-09-23 14:52:29 +08:00
parent fd0399308b
commit e04f1e7ef8
3 changed files with 37 additions and 2 deletions

View File

@ -51,10 +51,12 @@
</f:TextBox>
</Items>
</f:FormRow>
<f:FormRow>
<f:FormRow ColumnWidths="40% 10% 50%">
<Items>
<f:NumberBox ID="txtWeight" runat="server" Label="重量(公斤)" LabelAlign="Right" NoNegative="true" AutoPostBack="true" OnTextChanged="txtWeight_TextChanged">
<f:NumberBox ID="txtWeight" runat="server" Label="重量(公斤)" LabelAlign="Right" NoNegative="true">
</f:NumberBox>
<f:Button runat="server" ID="btnAmount" Icon="Calculator" Text="计算" OnClick="btnAmount_Click" ToolTip="计算焊材数量">
</f:Button>
<f:NumberBox ID="txtAmount" runat="server" Label="数量(根)" LabelAlign="Right" NoNegative="true" AutoPostBack="true" OnTextChanged="txtAmount_TextChanged">
</f:NumberBox>
</Items>

View File

@ -369,6 +369,30 @@ namespace FineUIPro.Web.WeldMat.Stock
}
}
protected void btnAmount_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(this.txtWeight.Text.Trim()))
{
if (!string.IsNullOrEmpty(this.hdWeldId.Text.Trim()))
{
var weld = BLL.WeldInfoService.GetWeldInfoById(this.hdWeldId.Text.Trim());
if (weld != null)
{
if (weld.ConvertValue.HasValue)
{
decimal? amountCov = Funs.GetNewDecimal(this.txtWeight.Text.Trim()) / weld.ConvertValue;
int amount = Convert.ToInt32(Math.Floor(amountCov.Value));
this.txtAmount.Text = amount.ToString();
}
else
{
this.txtAmount.Text = this.txtWeight.Text.Trim();
}
}
}
}
}
protected void txtAmount_TextChanged(object sender, EventArgs e)
{
if (this.trRemainingAmount.Hidden == true)

View File

@ -120,6 +120,15 @@ namespace FineUIPro.Web.WeldMat.Stock {
/// </remarks>
protected global::FineUIPro.NumberBox txtWeight;
/// <summary>
/// btnAmount 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.Button btnAmount;
/// <summary>
/// txtAmount 控件。
/// </summary>