焊接任务单生成出库申请单逻辑修改

This commit is contained in:
2026-04-02 11:55:50 +08:00
parent 48785fbdae
commit 7715352579
5 changed files with 15 additions and 13 deletions
+2 -2
View File
@@ -750,7 +750,7 @@ namespace BLL
ProjectId = weldTask.ProjectId, ProjectId = weldTask.ProjectId,
// CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01", // CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01",
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.), CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.),
WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), WarehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).WarehouseId).WarehouseName,
Source = 1, Source = 1,
InOutType = (int)TwConst.InOutType., InOutType = (int)TwConst.InOutType.,
TypeInt = (int)TwConst.TypeInt., TypeInt = (int)TwConst.TypeInt.,
@@ -789,7 +789,7 @@ namespace BLL
Id = Guid.NewGuid().ToString(), Id = Guid.NewGuid().ToString(),
ProjectId = weldTask.ProjectId, ProjectId = weldTask.ProjectId,
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.), CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.),
WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(), WarehouseCode = BLL.Base_WarehouseService.GetWarehouseByWarehouseId(PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).WarehouseId).WarehouseName,
Source = 1, Source = 1,
InOutType = (int)TwConst.InOutType., InOutType = (int)TwConst.InOutType.,
TypeInt = (int)TwConst.TypeInt., TypeInt = (int)TwConst.TypeInt.,
+1 -1
View File
@@ -17017,7 +17017,7 @@
</COMReference> </COMReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <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> <ProjectExtensions>
<VisualStudio> <VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
@@ -1316,8 +1316,6 @@ namespace FineUIPro.Web.HJGL.WeldingManage
} }
} }
protected void btnPrintJoint_Click(object sender, EventArgs e) protected void btnPrintJoint_Click(object sender, EventArgs e)
{ {
var rows = Grid1.SelectedRowIndexArray; var rows = Grid1.SelectedRowIndexArray;
@@ -69,6 +69,7 @@
</f:ToolbarFill> </f:ToolbarFill>
<f:HiddenField runat="server" ID="hdRemark"> <f:HiddenField runat="server" ID="hdRemark">
</f:HiddenField> </f:HiddenField>
<%--<f:Button ID="btnPull" runat="server" OnClick="btnPull_Click" ToolTip="获取" Text="获取" > <%--<f:Button ID="btnPull" runat="server" OnClick="btnPull_Click" ToolTip="获取" Text="获取" >
</f:Button>--%> </f:Button>--%>
<f:Button ID="btnNew" Icon="Add" runat="server" OnClick="btnNew_Click" ToolTip="编制" Hidden="true"> <f:Button ID="btnNew" Icon="Add" runat="server" OnClick="btnNew_Click" ToolTip="编制" Hidden="true">
@@ -51,11 +51,11 @@ namespace FineUIPro.Web.common
this.tvControlItem.Nodes.Add(rootNode2); this.tvControlItem.Nodes.Add(rootNode2);
// 优化:一次性获取所有管线统计数据,避免 N+1 查询 // 优化:一次性获取所有管线统计数据,避免 N+1 查询
var pipelineCountByUnitWork = (from x in Funs.DB.HJGL_Pipeline var pipelineCountByUnitWork = (from x in Funs.DB.View_HJGL_Pipeline
where x.ProjectId == this.CurrUser.LoginProjectId where x.ProjectId == this.CurrUser.LoginProjectId
group x by x.UnitWorkId into g group x by x.UnitWorkId into g
select new { UnitWorkId = g.Key, Count = g.Count() }) select new { UnitWorkId = g.Key, Count = g.Count(), TotalDin = g.Sum(x => x.TotalDin) })
.ToDictionary(x => x.UnitWorkId, x => x.Count); .ToDictionary(x => x.UnitWorkId, x => new { x.Count, x.TotalDin });
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList(); var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
// 获取当前用户所在单位 // 获取当前用户所在单位
@@ -74,14 +74,15 @@ namespace FineUIPro.Web.common
if (unitWork1.Count() > 0) if (unitWork1.Count() > 0)
{ {
foreach (var q in unitWork1) foreach (var q in unitWork1)
{ {
// 优化:从内存字典中获取管线数量,避免数据库查询 // 优化:从内存字典中获取管线数量,避免数据库查询
int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId] : 0; int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].Count : 0;
decimal totalDia = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].TotalDin ?? 0 : 0;
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn1 = new TreeNode(); TreeNode tn1 = new TreeNode();
tn1.NodeID = q.UnitWorkId; tn1.NodeID = q.UnitWorkId;
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线"; tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线" + "(总达因:" + totalDia.ToString() + "";
tn1.ToolTip = "施工单位:" + unitNamesUnitIds; tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
tn1.EnableClickEvent = true; tn1.EnableClickEvent = true;
rootNode1.Nodes.Add(tn1); rootNode1.Nodes.Add(tn1);
@@ -92,11 +93,13 @@ namespace FineUIPro.Web.common
foreach (var q in unitWork2) foreach (var q in unitWork2)
{ {
// 优化:从内存字典中获取管线数量,避免数据库查询 // 优化:从内存字典中获取管线数量,避免数据库查询
int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId] : 0; int a = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].Count : 0;
decimal totalDia = pipelineCountByUnitWork.ContainsKey(q.UnitWorkId) ? pipelineCountByUnitWork[q.UnitWorkId].TotalDin??0 : 0;
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId); var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
TreeNode tn2 = new TreeNode(); TreeNode tn2 = new TreeNode();
tn2.NodeID = q.UnitWorkId; tn2.NodeID = q.UnitWorkId;
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线"; tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线" + "(总达因:" + totalDia.ToString() + "";
tn2.ToolTip = "施工单位:" + unitNamesUnitIds; tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
tn2.EnableClickEvent = true; tn2.EnableClickEvent = true;
rootNode2.Nodes.Add(tn2); rootNode2.Nodes.Add(tn2);