到货分析总体匹配率算法修改

This commit is contained in:
李鹏飞 2024-11-27 17:05:01 +08:00
parent 73a869c851
commit ba37c43d06
4 changed files with 20 additions and 10 deletions

Binary file not shown.

View File

@ -17,12 +17,13 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
string PipeArea= WarehouseCode == "工厂预制"?"1":"2";
///所需材料数量列表
var NeedOutMateriaList = from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
where z.ProjectId == projectid && (string.IsNullOrEmpty(materialCode) || x.MaterialCode .Contains( materialCode))
group x by x.MaterialCode
where z.ProjectId == projectid && (string.IsNullOrEmpty(materialCode) || x.MaterialCode .Contains( materialCode)) && z.PipeArea== PipeArea
group x by x.MaterialCode
into g
select new
{
@ -31,18 +32,23 @@ namespace BLL
};
///实际材料入库数量列表
var RealInMateriaList = from x in db.Tw_InputDetail
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
join master in db.Tw_InputMaster on x.InputMasterId equals master.Id
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
where master.ProjectId== projectid && master.WarehouseCode== WarehouseCode
group x by x.MaterialCode
into g
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains( materialCode))
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains( materialCode))
select new
{
g.Key,
RealNum = g.Sum(x => x.ActNum) ?? 0,
};
//库存数量
var tw_MaterialStock=from x in db.Tw_MaterialStock
where x.WarehouseCode==WarehouseCode
select x;
where x.WarehouseCode==WarehouseCode && x.ProjectId== projectid
select x;
var StatisticsList =(from x in NeedOutMateriaList
join y in RealInMateriaList on x.Key equals y.Key into gg
from y in gg.DefaultIfEmpty()

View File

@ -22,7 +22,7 @@ namespace FineUIPro.Web.CLGL
drpWarehouse.DataBind();
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
// 绑定表格
this.BindGrid();
// this.BindGrid();
}
}
@ -36,7 +36,11 @@ namespace FineUIPro.Web.CLGL
if (tb.Count() > 0)
{
lbRate.Text = "总体匹配率:" + Math.Round(tb.Sum(x => x.MatchRate) * 100 / tb.Count(), 4) + "%";
decimal needNum = 0;
decimal realNum = 0;
needNum = tb.Sum(x => x.NeedNum);
realNum = tb.Sum(x => x.RealNum > x.NeedNum ? x.NeedNum : x.RealNum);
lbRate.Text = "总体匹配率:" + Math.Round(realNum * 100 / needNum, 4) + "%";
}
else
{

View File

@ -63,7 +63,7 @@
<Items>
<f:Grid ID="Grid_MinPrice" CssClass="blockpanel" ShowBorder="true" ShowHeader="false" Title="" EnableCollapse="false"
runat="server" DataKeyNames="ID" AllowCellEditing="true" ForceFit="true" SortField="SortIndex" AllowPaging="true" PageSize="300" EnableBigDataRowTip="false" EnableBigData="true" IsDatabasePaging="false"
EnableColumnLines="true" DataIDField="ID">
EnableColumnLines="true" DataIDField="ID" >
<Columns>
<f:RowNumberField />
@ -85,7 +85,7 @@
<Items>
<f:Grid ID="Grid_ConEvaluation" CssClass="blockpanel" ShowBorder="true" ShowHeader="false" Title="" EnableCollapse="false"
runat="server" DataKeyNames="ID" AllowCellEditing="true" ForceFit="true" SortField="SortIndex" AllowPaging="true" PageSize="300" EnableBigDataRowTip="false" EnableBigData="true" IsDatabasePaging="false"
EnableColumnLines="true" DataIDField="ID">
EnableColumnLines="true" DataIDField="ID" Height="400">
<Columns>
<f:RowNumberField />