2025-05-08 18:38:55 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HJGL.PreDesign
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class PackagingManageSelect : PageBase
|
|
|
|
|
|
{
|
|
|
|
|
|
#region 定义项
|
|
|
|
|
|
|
|
|
|
|
|
// public List<HJGL_Pipeline> Tree_hJGL_Pipelines;
|
|
|
|
|
|
public int pageSize = PipelineService.pageSize;
|
|
|
|
|
|
|
|
|
|
|
|
public string PackagingManageId
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["PackagingManageId"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["PackagingManageId"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-24 17:31:28 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 0是散件 1 是其他
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string TypeInt
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return (string)ViewState["TypeInt"];
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewState["TypeInt"] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-05-08 18:38:55 +08:00
|
|
|
|
|
|
|
|
|
|
#endregion 定义项
|
|
|
|
|
|
|
|
|
|
|
|
#region 加载页面
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载页面
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
PackagingManageId = Request.Params["PackagingManageId"];
|
|
|
|
|
|
TypeInt = Request.Params["TypeInt"];
|
2025-05-08 18:38:55 +08:00
|
|
|
|
this.InitTreeMenu();//加载树
|
|
|
|
|
|
InitDropList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion 加载页面
|
|
|
|
|
|
|
|
|
|
|
|
#region 加载树
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载树
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void InitTreeMenu()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.tvControlItem.Nodes.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
TreeNode rootNode1 = new TreeNode();
|
|
|
|
|
|
rootNode1.NodeID = "1";
|
|
|
|
|
|
rootNode1.Text = "建筑工程";
|
|
|
|
|
|
rootNode1.CommandName = "建筑工程";
|
|
|
|
|
|
rootNode1.Selectable = false;
|
|
|
|
|
|
|
|
|
|
|
|
this.tvControlItem.Nodes.Add(rootNode1);
|
|
|
|
|
|
|
|
|
|
|
|
TreeNode rootNode2 = new TreeNode();
|
|
|
|
|
|
rootNode2.NodeID = "2";
|
|
|
|
|
|
rootNode2.Text = "安装工程";
|
|
|
|
|
|
rootNode2.CommandName = "安装工程";
|
|
|
|
|
|
rootNode2.Expanded = true;
|
|
|
|
|
|
this.tvControlItem.Nodes.Add(rootNode2);
|
|
|
|
|
|
|
|
|
|
|
|
var pUnits = (from x in Funs.DB.Project_ProjectUnit where x.ProjectId == this.CurrUser.LoginProjectId select x).ToList();
|
|
|
|
|
|
// 获取当前用户所在单位
|
|
|
|
|
|
var currUnit = pUnits.FirstOrDefault(x => x.UnitId == this.CurrUser.UnitId);
|
2025-09-24 17:31:28 +08:00
|
|
|
|
//获取主项
|
2025-05-08 18:38:55 +08:00
|
|
|
|
var unitWorkList = (from x in Funs.DB.WBS_UnitWork
|
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
|
&& x.SuperUnitWork == null && x.UnitId != null && x.ProjectType != null
|
|
|
|
|
|
select x).ToList();
|
2025-09-24 17:31:28 +08:00
|
|
|
|
//获取当前项目出库单
|
|
|
|
|
|
Model.Tw_InOutMasterOutput querytable = new Model.Tw_InOutMasterOutput();
|
|
|
|
|
|
querytable.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
|
querytable.InOutType = (int?)TwConst.InOutType.出库;
|
|
|
|
|
|
querytable.TypeInt = TypeInt == ((int)HJGLPackagingmanageService.TypeInt.预制散件).ToString() ? (int)TwConst.TypeInt.散件出库 : (int)TwConst.TypeInt.其他出库;
|
|
|
|
|
|
var outMasterOutputs = BLL.TwOutputmasterService.GetListData(querytable);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
|
|
|
|
|
|
List<Model.WBS_UnitWork> unitWork1 = null;
|
|
|
|
|
|
List<Model.WBS_UnitWork> unitWork2 = null;
|
|
|
|
|
|
|
|
|
|
|
|
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
2025-05-08 18:38:55 +08:00
|
|
|
|
if (unitWork2.Count() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var q in unitWork2)
|
|
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
var unitworkOutMasterOutputs = outMasterOutputs.Where(x => x.UnitWorkId == q.UnitWorkId);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
|
|
|
|
|
TreeNode tn2 = new TreeNode();
|
|
|
|
|
|
tn2.NodeID = q.UnitWorkId;
|
2025-09-24 17:31:28 +08:00
|
|
|
|
tn2.Text = q.UnitWorkName;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
2025-09-24 17:31:28 +08:00
|
|
|
|
//tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
tn2.EnableExpandEvent = true;
|
|
|
|
|
|
tn2.EnableClickEvent = true;
|
|
|
|
|
|
|
|
|
|
|
|
rootNode2.Nodes.Add(tn2);
|
2025-09-24 17:31:28 +08:00
|
|
|
|
foreach (var item in unitworkOutMasterOutputs)
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
FineUIPro.TreeNode newNode = new FineUIPro.TreeNode();
|
|
|
|
|
|
newNode.Text = item.CusBillCode;
|
|
|
|
|
|
newNode.NodeID = item.Id;
|
|
|
|
|
|
newNode.CommandName = "出库单";
|
|
|
|
|
|
newNode.EnableClickEvent = true;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
tn2.Nodes.Add(newNode);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion 加载树
|
|
|
|
|
|
|
|
|
|
|
|
#region Methods
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnTreeFind_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.InitTreeMenu();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion Methods
|
|
|
|
|
|
|
|
|
|
|
|
#region 点击TreeView
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 点击TreeView
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void tvControlItem_NodeCommand(object sender, TreeCommandEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.CommandName == "加载")
|
|
|
|
|
|
{
|
|
|
|
|
|
string CommandName = e.Node.ParentNode.CommandName;
|
|
|
|
|
|
e.Node.ParentNode.CommandName = (int.Parse(CommandName.Split('|')[0]) + 1) + "|" + int.Parse(CommandName.Split('|')[1]);
|
|
|
|
|
|
TreeNode treeNode = e.Node.ParentNode;
|
|
|
|
|
|
treeNode.Nodes.Remove(e.Node);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
2025-10-10 14:33:21 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
2025-09-24 17:31:28 +08:00
|
|
|
|
this.BindGrid(this.tvControlItem.SelectedNodeID);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion 点击TreeView
|
|
|
|
|
|
|
|
|
|
|
|
#region 数据绑定
|
2025-09-24 17:31:28 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 行绑定事件(没有焊接方法无法选择)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataRowView row = e.DataItem as DataRowView;
|
|
|
|
|
|
string id = e.RowID;
|
2025-10-10 14:33:21 +08:00
|
|
|
|
if (Funs.DB.HJGL_PackagingManageDetail.Any(x => x.TwOutputDetailId == id))
|
2025-09-24 17:31:28 +08:00
|
|
|
|
{
|
2025-10-10 14:33:21 +08:00
|
|
|
|
e.RowSelectable = false;
|
2025-09-24 17:31:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
;
|
|
|
|
|
|
}
|
|
|
|
|
|
private void BindGrid(string outputMasterId)
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
////var Prelist = HJGL_PipelineComponentService.GetPipelinePrefabricatedComponent(unitworkid, pipelineId);
|
2025-10-10 14:33:21 +08:00
|
|
|
|
|
2025-09-24 17:31:28 +08:00
|
|
|
|
////var inoutplandetail = (from x in Funs.DB.HJGL_PackagingManageDetail
|
|
|
|
|
|
//// where x.PipelineId == pipelineId
|
|
|
|
|
|
//// && (x.PipelineComponentId == null || x.PipelineComponentId == "")
|
|
|
|
|
|
//// select x).ToList();
|
|
|
|
|
|
////var queryList = Prelist;
|
|
|
|
|
|
////// 优化 Linq 过滤条件,过滤已经进入包装的预制散件
|
|
|
|
|
|
////var result = (from x in queryList
|
|
|
|
|
|
//// join y in inoutplandetail on x.MaterialCode equals y.MaterialCode into yy
|
|
|
|
|
|
//// from y in yy.DefaultIfEmpty()
|
|
|
|
|
|
//// where y == null
|
|
|
|
|
|
//// select x).ToList();
|
|
|
|
|
|
////Grid1.DataSource = result;
|
|
|
|
|
|
////Grid1.DataBind();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Model.Tw_InOutDetailOutput table = new Model.Tw_InOutDetailOutput();
|
|
|
|
|
|
table.OutputMasterId = outputMasterId;
|
|
|
|
|
|
var tb = BLL.TwOutputdetailService.GetByModle(table).ToList();
|
|
|
|
|
|
Grid1.DataSource = tb;
|
2025-05-08 18:38:55 +08:00
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void InitDropList()
|
|
|
|
|
|
{
|
|
|
|
|
|
/* var pipeline = (from x in Funs.DB.HJGL_Pipeline
|
|
|
|
|
|
where x.ProjectId == this.CurrUser.LoginProjectId
|
|
|
|
|
|
&& x.UnitWorkId == this.UnitWorkId
|
|
|
|
|
|
select x.FlowingSection).Distinct().ToList();
|
|
|
|
|
|
this.drpFlowingSection.DataTextField = "Value";
|
|
|
|
|
|
this.drpFlowingSection.DataValueField = "Value";
|
|
|
|
|
|
this.drpFlowingSection.DataSource = pipeline;
|
|
|
|
|
|
this.drpFlowingSection.DataBind();
|
|
|
|
|
|
Funs.FineUIPleaseSelect(drpFlowingSection);*/
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion 数据绑定
|
|
|
|
|
|
|
|
|
|
|
|
#region 提交按钮
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 提交按钮
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnAccept_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
Save();
|
2025-09-24 17:31:28 +08:00
|
|
|
|
this.BindGrid(this.tvControlItem.SelectedNodeID);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void Save()
|
|
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
var SelectIDArry = Grid1.SelectedRowIDArray;
|
|
|
|
|
|
if (SelectIDArry != null)
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
foreach (var id in SelectIDArry)
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
2025-09-24 17:31:28 +08:00
|
|
|
|
var twoutputdetailModel = BLL.TwOutputdetailService.GetById(id);
|
|
|
|
|
|
if (twoutputdetailModel != null)
|
2025-05-08 18:38:55 +08:00
|
|
|
|
{
|
|
|
|
|
|
var model = new Model.HJGL_PackagingManageDetail()
|
|
|
|
|
|
{
|
|
|
|
|
|
Id = SQLHelper.GetNewID(),
|
|
|
|
|
|
PackagingManageId = this.PackagingManageId,
|
2025-09-24 17:31:28 +08:00
|
|
|
|
//PipelineId = hJGL_PipeLineMat.PipelineId,
|
|
|
|
|
|
MaterialCode = twoutputdetailModel.MaterialCode,
|
|
|
|
|
|
Number = twoutputdetailModel.ActNum,
|
|
|
|
|
|
TwOutputDetailId = twoutputdetailModel.Id,
|
2025-05-08 18:38:55 +08:00
|
|
|
|
CreateTime = DateTime.Now,
|
|
|
|
|
|
CreateUser = this.CurrUser.PersonId,
|
|
|
|
|
|
};
|
2025-05-12 19:05:13 +08:00
|
|
|
|
HJGLPackagingmanagedetailService.Add(model);
|
2025-05-08 18:38:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion 提交按钮
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|