材料管理修改

This commit is contained in:
2024-10-10 10:06:11 +08:00
parent c3f49e7180
commit cbae78058c
14 changed files with 124 additions and 51 deletions
@@ -37,6 +37,9 @@
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
<f:DropDownList ID="drpWarehouse" runat="server" Label="仓库" AutoSelectFirstItem="true"
LabelWidth="70px" LabelAlign="Right" Width="170px">
</f:DropDownList>
<f:TextBox runat="server" ID="txtMaterialCode" Label="材料编码" EmptyText="输入查询条件" Width="230px" LabelWidth="100px"></f:TextBox>
<f:Label runat="server" ID="lbRate"></f:Label>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
@@ -68,19 +71,19 @@
<f:RenderField Width="150px" ColumnID="MaterialSpec" DataField="MaterialSpec" SortField="MaterialSpec"
FieldType="String" HeaderText="规格" TextAlign="Left" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="MaterialUnit" DataField="MaterialUnit" SortField="MaterialUnit"
<f:RenderField Width="80px" ColumnID="MaterialUnit" DataField="MaterialUnit" SortField="MaterialUnit"
FieldType="String" HeaderText="单位" TextAlign="Left" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="NeedNum" DataField="NeedNum" SortField="NeedNum"
<f:RenderField Width="90px" ColumnID="NeedNum" DataField="NeedNum" SortField="NeedNum"
FieldType="String" HeaderText="所需量" TextAlign="Left" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="RealNum" DataField="RealNum" SortField="RealNum"
<f:RenderField Width="90px" ColumnID="RealNum" DataField="RealNum" SortField="RealNum"
FieldType="String" HeaderText="到货量" TextAlign="Left" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="StockNum" DataField="StockNum" SortField="StockNum"
<f:RenderField Width="90px" ColumnID="StockNum" DataField="StockNum" SortField="StockNum"
FieldType="String" HeaderText="库存量" TextAlign="Left" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="MatchRateString" DataField="MatchRateString" SortField="MatchRateString"
<f:RenderField Width="90px" ColumnID="MatchRateString" DataField="MatchRateString" SortField="MatchRateString"
FieldType="String" HeaderText="匹配率" TextAlign="Left" HeaderTextAlign="Center">
</f:RenderField>
</Columns>
@@ -16,6 +16,10 @@ namespace FineUIPro.Web.CLGL
{
if (!IsPostBack)
{
drpWarehouse.DataTextField = "Text";
drpWarehouse.DataValueField = "Value";
drpWarehouse.DataSource = BLL.DropListService.HJGL_WarehouseCode();
drpWarehouse.DataBind();
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
// 绑定表格
this.BindGrid();
@@ -28,7 +32,7 @@ namespace FineUIPro.Web.CLGL
/// </summary>
private void BindGrid()
{
var tb = BLL.TwArrivalStatisticsService.GetStatistics(this.CurrUser.LoginProjectId, txtMaterialCode.Text.Trim());
var tb = BLL.TwArrivalStatisticsService.GetStatistics(this.CurrUser.LoginProjectId, txtMaterialCode.Text.Trim(), drpWarehouse.SelectedValue);
lbRate.Text="总体匹配率:"+ Math.Round( tb.Sum(x=>x.MatchRate)*100/tb.Count() ,4) + "%";
//tb = GetFilteredTable(Grid1.FilteredData, tb);
@@ -59,6 +59,15 @@ namespace FineUIPro.Web.CLGL
/// </remarks>
protected global::FineUIPro.Toolbar Toolbar2;
/// <summary>
/// drpWarehouse 控件。
/// </summary>
/// <remarks>
/// 自动生成的字段。
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
/// </remarks>
protected global::FineUIPro.DropDownList drpWarehouse;
/// <summary>
/// txtMaterialCode 控件。
/// </summary>
+30 -2
View File
@@ -192,8 +192,8 @@
<Items>
<f:Grid ID="Grid3" ShowBorder="False" ShowHeader="False" Title="管线材料明细" EnableCollapse="true" ForceFit="true"
runat="server" BoxFlex="1" DataKeyNames="Id"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="MaterialCode" EnableSummary="true" SummaryPosition="Bottom"
SortDirection="DESC" EnableRowGroup="true" DataRowGroupField="PipelineCode" AllowPaging="true" IsDatabasePaging="true" PageSize="10000">
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="MaterialCode" ExpandAllRowGroups="false"
SortDirection="DESC" EnableRowGroup="true" DataRowGroupField="PipelineCode" AllowPaging="true" IsDatabasePaging="true" PageSize="10000" RowGroupRendererFunction="onGrid3RowGroupRenderer">
<Columns>
<f:RenderField Width="100px" ColumnID="PipelineCode" DataField="PipelineCode" SortField="PipelineCode"
FieldType="String" HeaderText="管线号" HeaderTextAlign="Center"
@@ -227,6 +227,10 @@
FieldType="String" HeaderText="匹配量" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="MatchRate" DataField="MatchRate" SortField="MatchRate"
FieldType="String" HeaderText="匹配率" HeaderTextAlign="Center"
TextAlign="Left" Hidden="true">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="MatchRateString" DataField="MatchRateString" SortField="MatchRateString"
FieldType="String" HeaderText="匹配率" HeaderTextAlign="Center"
TextAlign="Left">
@@ -275,6 +279,30 @@
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
function onGrid3RowGroupRenderer(groupValue, rowData) {
var Total = 0,
Len = rowData.children.length;
for (var i = 0; i < Len; i++) {
var childData = rowData.children[i];
var genderValue = childData.values['MatchRate'];
console.log(genderValue);
// 确保值存在再进行累加
if (genderValue !== undefined) {
genderValue = parseFloat(genderValue); // 确保是数字
genderValue = genderValue > 0 ? genderValue : 0;
Total += genderValue;
}
}
// 检查 Len 是否大于零,以防止除以零
var TotalRate = Len > 0 ? ((Total * 100) / Len).toFixed(2) + "%" : "0%";
return F.formatString('{0},匹配率:{1}', groupValue, TotalRate);
}
</script>
</body>
</html>
+15 -15
View File
@@ -112,19 +112,18 @@ namespace FineUIPro.Web.CLGL
var tb = BLL.TwArrivalStatisticsService.GetMatMatchByOutPlanMasterId(inOutPlanMasterId);
Grid3.DataSource = tb;
Grid3.DataBind();
//if (tb!= null && tb.Count > 0)
//{
// string Rate = Math.Round((decimal)tb.Average(item => item.MatchRate) * 100, 2).ToString() + "%";
if (tb!= null && tb.Count > 0)
{
string Rate = Math.Round((decimal)tb.Average(item => item.MatchRate) * 100, 2).ToString() + "%";
// JObject summary = new JObject();
// //summary.Add("Major", "全部合计");
// summary.Add("MatchRateString", Rate);
JObject summary = new JObject();
//summary.Add("Major", "全部合计");
summary.Add("MatchRateString", Rate);
// Grid3.SummaryData = summary;
//}
Grid3.SummaryData = summary;
}
}
#endregion
@@ -480,16 +479,17 @@ namespace FineUIPro.Web.CLGL
}
string planId = Grid1.SelectedRowID;
var planMaster = BLL.TwInOutplanmasterService.GetById(planId);
if (planMaster.State != (int)TwConst.State. || planMaster.TypeInt != (int)TwConst.TypeInt.)
{
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
return;
}
else
if (planMaster.State == (int)TwConst.State. &&( planMaster.TypeInt == (int)TwConst.TypeInt. || planMaster.TypeInt == (int)TwConst.TypeInt.))
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("OutPlanMasterEdit.aspx?UnitWorkId={0}&Id={1} ", tvControlItem.SelectedNodeID, planId, "新增 - ")));
}
else
{
Alert.ShowInTop("请选择有效的计划!", MessageBoxIcon.Warning);
return;
}
}
protected void btnPassMaster_OnClick(object sender, EventArgs e)
+9 -11
View File
@@ -6,12 +6,10 @@
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<style type="text/css">
.f-readonly {
opacity: .5;
filter: alpha(opacity=50);
}
</style>
<style type="text/css">
</style>
</head>
<body>
<form id="form1" runat="server">
@@ -66,9 +64,9 @@
</Items>
</f:Panel>
<f:Grid ID="Grid1" ShowBorder="true" EnableAjax="false" ShowHeader="true" Title="出库明细"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" ForceFit="true"
DataIDField="Id" EnableColumnLines="true" Height="400" EnableBigData="true" OnRowCommand="Grid1_RowCommand"
EnableTextSelection="True">
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" ForceFit="true"
DataIDField="Id" OnRowCommand="Grid1_RowCommand" AllowPaging="true" IsDatabasePaging="true"
EnableTextSelection="True" PageSize="100">
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
@@ -104,8 +102,8 @@
</f:Grid>
<f:Grid ID="Grid2" ShowBorder="true" EnableAjax="false" ShowHeader="true" Title="出库明细"
runat="server" BoxFlex="1" DataKeyNames="Id" AllowCellEditing="true" ForceFit="true"
DataIDField="Id" EnableColumnLines="true" Height="400" EnableBigData="true" OnRowCommand="Grid2_RowCommand"
EnableTextSelection="True">
DataIDField="Id" EnableColumnLines="true" OnRowCommand="Grid2_RowCommand"
EnableTextSelection="True" PageSize="100">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Right">
<Items>
@@ -85,7 +85,7 @@ namespace FineUIPro.Web.CLGL
txtCreateMan.Text = this.CurrUser.PersonName;
txtCreateDate.Text = DateTime.Now.ToString("yyyy-MM-dd");
drpReqUnit.SelectedValue = this.CurrUser.UnitId;
txtCusBillCode.Text = TwInOutplanmasterService.GetDataInCusBillCode(this.CurrUser.LoginProjectId, this.CurrUser.UnitId);
txtCusBillCode.Text = TwInOutplanmasterService.GetDataInCusBillCode(this.CurrUser.LoginProjectId, UnitService.GetUnitByUnitId(this.CurrUser.UnitId)?.UnitCode);
}
drpTypeInt_SelectedIndexChanged(null, null);
@@ -38,7 +38,7 @@
<Toolbars>
<f:Toolbar ID="Toolbar2" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox runat="server" ID="txtMatCode" Label="材料编码" LabelWidth="70px" LabelAlign="Right" Width="170px"></f:TextBox>
<f:TextBox runat="server" ID="txtMatCode" Label="材料编码" LabelWidth="100px" LabelAlign="Right" Width="250px"></f:TextBox>
<f:ToolbarFill ID="ToolbarFill1" runat="server">
</f:ToolbarFill>
<f:Button ID="btnSearch" ToolTip="查询" Icon="SystemSearch" runat="server" Text="查询" OnClick="btnSearch_Click">