This commit is contained in:
commit
650fc31cfd
|
|
@ -86,7 +86,35 @@ namespace BLL
|
|||
WarehouseCode = warehouseCode,
|
||||
ProjectId = projectId
|
||||
};
|
||||
var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStockOutput).ToList();//获取库存列表
|
||||
var stockList = TwMaterialstockService.GetTw_MaterialStockByModle(twMaterialStockOutput).ToList();//获取库存列表
|
||||
|
||||
// 预扣除出库申请单中状态为待审核/已审核的材料数量
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var outboundMaterials = from detail in db.Tw_InOutPlanDetail
|
||||
join master in db.Tw_InOutPlanMaster on detail.InOutPlanMasterId equals master.Id
|
||||
where master.InOutType == (int)TwConst.InOutType.出库
|
||||
&& (master.State == (int)TwConst.State.待审核 || master.State == (int)TwConst.State.已审核)
|
||||
&& master.WarehouseCode == warehouseCode
|
||||
&& master.ProjectId == projectId
|
||||
group detail by detail.MaterialCode into g
|
||||
select new
|
||||
{
|
||||
MaterialCode = g.Key,
|
||||
TotalPlanNum = g.Sum(d => d.PlanNum) ?? 0
|
||||
};
|
||||
|
||||
var outboundList = outboundMaterials.ToList();
|
||||
foreach (var outbound in outboundList)
|
||||
{
|
||||
var stock = stockList.FirstOrDefault(x => x.PipeLineMatCode == outbound.MaterialCode);
|
||||
if (stock != null)
|
||||
{
|
||||
stock.StockNum -= outbound.TotalPlanNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var material in requiredMaterials)
|
||||
{
|
||||
material.Id = Guid.NewGuid().ToString();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Report ScriptLanguage="CSharp" ReportInfo.Created="12/29/2021 10:56:08" ReportInfo.Modified="03/11/2026 16:07:53" ReportInfo.CreatorVersion="2017.1.16.0">
|
||||
<Report ScriptLanguage="CSharp" ReportInfo.Created="12/29/2021 10:56:08" ReportInfo.Modified="04/14/2026 16:15:36" ReportInfo.CreatorVersion="2017.1.16.0">
|
||||
<ScriptText>using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -99,7 +99,7 @@ namespace FastReport
|
|||
}
|
||||
</ScriptText>
|
||||
<Dictionary>
|
||||
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaUHihKXxbhpqie4wmZgM2ymDKry7UxzO5md9ybQlkfKpN2rHYbp9GtH1LDQPa7z2vVu/kEnNnTKeHt9obmaC7TQDh0IvsUBSuzhGZdfAIK7YyBqykCgeZm5rvA6K5b7zHGdA+7pUpJ/9ZLpp1NuxWRE/YXimGeniUNA/761p7jLt"/>
|
||||
<MsSqlDataConnection Name="Connection" ConnectionString="rijcmlqvJIqZbrmqGn7L0P56UFhaUHihKXxbhpqie4wmZgM2ymDKry7UxzO5md9ybQlkfKpN2rHYbp9GtH1LDQPa7z2vVu/kEnNnTKeHt9obmaC7TQDh0IvsUBSuzhGZdfAIK7YyBqykCgeZm5rvA6K5b7zHGdA+7pUpJ/9ZLpp1NuxWRFvoS/O78nkZZeky9BsAtP/"/>
|
||||
<TableDataSource Name="Table1" ReferenceName="Table1" DataType="System.Int32" Enabled="true">
|
||||
<Column Name="PipelineComponentId" DataType="System.String"/>
|
||||
<Column Name="PipelineComponentCode" DataType="System.String"/>
|
||||
|
|
|
|||
|
|
@ -17033,10 +17033,7 @@
|
|||
</COMReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v18.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@
|
|||
</f:RenderField>
|
||||
<f:RenderField Width="150px" ColumnID="StackingPosition" DataField="StackingPosition"
|
||||
FieldType="String" HeaderText="预制工作包" HeaderTextAlign="Center"
|
||||
TextAlign="Left">
|
||||
TextAlign="Left" Hidden="true">
|
||||
</f:RenderField>
|
||||
</Columns>
|
||||
<PageItems>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
public partial class InstallList : PageBase
|
||||
{
|
||||
public int pageSize = 20;
|
||||
public static IQueryable<View_HJGL_InstallData> GridDataTable = null;
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
|
@ -232,35 +231,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
{
|
||||
try
|
||||
{
|
||||
var baseQuery = from x in Funs.DB.View_HJGL_InstallData select x;
|
||||
|
||||
// 应用与数据绑定相同的筛选条件
|
||||
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
|
||||
}
|
||||
else if (tvControlItem.SelectedNode.CommandName == "流水段")
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.ParentNode.NodeID && x.FlowingSection == tvControlItem.SelectedNode.Text);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(txtPipelineCode2.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode2.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.Code.Contains(txtPipelineComponentCode.Text.Trim()));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(drpTypeStr.SelectedValue))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.TypeStr.Contains(drpTypeStr.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtPipelineCode.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
||||
}
|
||||
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
// 计算汇总数据
|
||||
var componentCount = baseQuery.Count(x => x.TypeStr == "预制组件");
|
||||
var partCount = baseQuery.Count(x => x.TypeStr == "预制散件");
|
||||
|
|
@ -283,9 +254,28 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
/// <returns></returns>
|
||||
private List<View_HJGL_InstallData> BindData(int pageIndex, int pageSize, out int totalCount)
|
||||
{
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
totalCount = baseQuery.Count();
|
||||
// 分页保护
|
||||
if (pageIndex <= 0) pageIndex = 1;
|
||||
if (pageSize <= 0) pageSize = 10;
|
||||
var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||
// 预制组件数量显示为1,预制散件保持原始数量
|
||||
foreach (var item in query)
|
||||
{
|
||||
if (item.TypeStr == "预制组件")
|
||||
{
|
||||
item.Number = 1;
|
||||
}
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
var baseQuery=from x in Funs.DB.View_HJGL_InstallData
|
||||
select x;
|
||||
|
||||
private IQueryable<View_HJGL_InstallData> GetIQueryableInstallDatas()
|
||||
{
|
||||
var baseQuery = from x in Funs.DB.View_HJGL_InstallData
|
||||
select x;
|
||||
if (tvControlItem.SelectedNode.CommandName.Split('|').Length == 2)
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.NodeID);
|
||||
|
|
@ -293,17 +283,17 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
else if (tvControlItem.SelectedNode.CommandName == "流水段")
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.UnitWorkId == tvControlItem.SelectedNode.ParentNode.NodeID && x.FlowingSection == tvControlItem.SelectedNode.Text);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(txtPipelineCode2.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode2.Text.Trim()));
|
||||
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtPipelineComponentCode.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.Code.Contains(txtPipelineComponentCode.Text.Trim()));
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(drpTypeStr.SelectedValue))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.TypeStr.Contains(drpTypeStr.SelectedValue));
|
||||
|
|
@ -315,19 +305,15 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
//}
|
||||
if (!string.IsNullOrEmpty(txtPipelineCode.Text))
|
||||
{
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
||||
baseQuery = baseQuery.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim()));
|
||||
|
||||
}
|
||||
}
|
||||
// 过滤组件编号/材料编码值为"裕-量"的记录
|
||||
baseQuery = baseQuery.Where(x => x.Code != "裕-量");
|
||||
baseQuery = baseQuery.OrderBy(x => x.PipelineCode).ThenBy(x => x.Code);
|
||||
totalCount = baseQuery.Count();
|
||||
GridDataTable = baseQuery;
|
||||
// 分页保护
|
||||
if (pageIndex <= 0) pageIndex = 1;
|
||||
if (pageSize <= 0) pageSize = 10;
|
||||
var query = baseQuery.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
|
||||
return query;
|
||||
}
|
||||
|
||||
return baseQuery;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 分页排序
|
||||
|
|
@ -418,16 +404,18 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GridDataTable != null)
|
||||
{
|
||||
var q = (from x in GridDataTable
|
||||
|
||||
var baseQuery = GetIQueryableInstallDatas();
|
||||
|
||||
var q = (from x in baseQuery
|
||||
where x.Code != "裕-量"
|
||||
select new
|
||||
{
|
||||
管线号 = x.PipelineCode,
|
||||
类型 = x.TypeStr,
|
||||
编号 = x.Code,
|
||||
预制散件材料描述 = (x.Matdef=="" || x.Matdef==null)?"-":x.Matdef,
|
||||
数量 = x.Number??1,
|
||||
数量 = x.TypeStr == "预制组件" ? 1 : (x.Number ?? 1),
|
||||
所在包装编号 = x.PackagingCode,
|
||||
车次 = x.TrainNumber,
|
||||
流水段 = x.FlowingSection
|
||||
|
|
@ -435,7 +423,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
string path = Funs.RootPath + @"File\Excel\Temp\PrePipelineInstallList.xlsx";
|
||||
path = path.Replace(".xlsx", string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx");
|
||||
|
||||
MiniExcel.SaveAs(path, q);
|
||||
MiniExcel.SaveAs(path, q, overwriteFile: true);
|
||||
|
||||
string fileName = $"安装清单-" + this.tvControlItem.SelectedNode.Text + "-" + string.Format("{0:yyyy-MM-dd}", DateTime.Now) + ".xlsx";
|
||||
FileInfo info = new FileInfo(path);
|
||||
|
|
@ -448,7 +436,7 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
System.Web.HttpContext.Current.Response.Flush();
|
||||
System.Web.HttpContext.Current.Response.Close();
|
||||
File.Delete(path);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -292,11 +292,14 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
|||
listStr.Add(new SqlParameter("@ProductionState", drpProductionState.SelectedValue.ToString()));
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
|
||||
if (!string.IsNullOrEmpty(drpFlowingSection.SelectedValue) && drpFlowingSection.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND pipe.FlowingSection =@FlowingSection";
|
||||
listStr.Add(new SqlParameter("@FlowingSection", drpFlowingSection.SelectedValue.ToString()));
|
||||
}
|
||||
// 过滤组件编号值为"裕-量"的行
|
||||
strSql += " AND com.PipelineComponentCode != @ExcludeYuliang";
|
||||
listStr.Add(new SqlParameter("@ExcludeYuliang", "裕-量"));
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
GridDataTable = tb;
|
||||
|
|
|
|||
Loading…
Reference in New Issue