焊接修改
This commit is contained in:
@@ -1,15 +1,8 @@
|
||||
using BLL;
|
||||
using FastReport.DevComponents.DotNetBar;
|
||||
using FineUIPro.Web.HJGL.WeldingManage;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.PreDesign
|
||||
@@ -32,6 +25,20 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
ViewState["PackagingManageId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 0是散件 1 是其他
|
||||
/// </summary>
|
||||
public string TypeInt
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["TypeInt"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["TypeInt"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion 定义项
|
||||
|
||||
@@ -46,7 +53,8 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
PackagingManageId = Request.QueryString["PackagingManageId"];
|
||||
PackagingManageId = Request.Params["PackagingManageId"];
|
||||
TypeInt = Request.Params["TypeInt"];
|
||||
this.InitTreeMenu();//加载树
|
||||
InitDropList();
|
||||
}
|
||||
@@ -55,12 +63,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
#endregion 加载页面
|
||||
|
||||
#region 加载树
|
||||
|
||||
private void BindNodes(TreeNode node)
|
||||
{
|
||||
BLL.PipelineService.BindTreeNodes(node, this.tvPipeCode.Text.Trim(), txtMaterialCode.Text.Trim(), this.CurrUser.LoginProjectId, pageSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载树
|
||||
/// </summary>
|
||||
@@ -86,141 +88,46 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
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);
|
||||
|
||||
//获取主项
|
||||
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();
|
||||
//获取当前项目出库单
|
||||
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);
|
||||
|
||||
List<Model.WBS_UnitWork> unitWork1 = null;
|
||||
List<Model.WBS_UnitWork> unitWork2 = null;
|
||||
|
||||
//// 当前为施工单位,只能操作本单位的数据
|
||||
//if (currUnit != null && currUnit.UnitType == Const.ProjectUnitType_2)
|
||||
//{
|
||||
// unitWork1 = (from x in unitWorkList
|
||||
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "1"
|
||||
// select x).ToList();
|
||||
// unitWork2 = (from x in unitWorkList
|
||||
// where x.UnitId == this.CurrUser.UnitId && x.ProjectType == "2"
|
||||
// select x).ToList();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
unitWork1 = (from x in unitWorkList where x.ProjectType == "1" select x).ToList();
|
||||
unitWork2 = (from x in unitWorkList where x.ProjectType == "2" select x).ToList();
|
||||
//}
|
||||
//var dbpipeLineMat = from x in Funs.DB.HJGL_PipeLineMat select x;
|
||||
//var DBpipeline = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId select x;
|
||||
if (unitWork1.Count() > 0)
|
||||
{
|
||||
foreach (var q in unitWork1)
|
||||
{
|
||||
string strSql = " SELECT DISTINCT [t0].[PipelineId] FROM [dbo].[HJGL_Pipeline] AS [t0]\r\nleft JOIN [dbo].[HJGL_PipeLineMat] AS [t1] ON [t0].[PipelineId] = [t1].[PipelineId]";
|
||||
strSql += "where [t0].[UnitWorkId] =@UnitWorkId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", q.UnitWorkId));
|
||||
|
||||
if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t1].[MaterialCode] like @MaterialCode";
|
||||
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(tvPipeCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t0].[PipelineCode] like @PipelineCode";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", "%" + tvPipeCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
var a = dt.Rows.Count;
|
||||
|
||||
//int a = (from x in DBpipeline
|
||||
// join y in dbpipeLineMat on x.PipelineId equals y.PipelineId
|
||||
// where x.PipelineCode.Contains(tvPipeCode.Text.Trim()) && x.UnitWorkId == q.UnitWorkId
|
||||
// && y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
|
||||
// select x.PipelineId).Distinct().Count();
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn1 = new TreeNode();
|
||||
tn1.NodeID = q.UnitWorkId;
|
||||
tn1.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
tn1.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn1.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn1.EnableExpandEvent = true;
|
||||
rootNode1.Nodes.Add(tn1);
|
||||
if (a > 0)
|
||||
{
|
||||
// BindNodes(tn1);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
tn1.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (unitWork2.Count() > 0)
|
||||
{
|
||||
|
||||
foreach (var q in unitWork2)
|
||||
{
|
||||
string strSql = " SELECT DISTINCT [t0].[PipelineId] FROM [dbo].[HJGL_Pipeline] AS [t0]\r\nleft JOIN [dbo].[HJGL_PipeLineMat] AS [t1] ON [t0].[PipelineId] = [t1].[PipelineId]";
|
||||
strSql += "where [t0].[UnitWorkId] =@UnitWorkId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
listStr.Add(new SqlParameter("@UnitWorkId", q.UnitWorkId));
|
||||
|
||||
if (!string.IsNullOrEmpty(txtMaterialCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t1].[MaterialCode] like @MaterialCode";
|
||||
listStr.Add(new SqlParameter("@MaterialCode", "%" + txtMaterialCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
if (!string.IsNullOrEmpty(tvPipeCode.Text.Trim()))
|
||||
{
|
||||
strSql += " and [t0].[PipelineCode] like @PipelineCode";
|
||||
listStr.Add(new SqlParameter("@PipelineCode", "%" + tvPipeCode.Text.Trim() + "%"));
|
||||
|
||||
}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
var a = dt.Rows.Count;
|
||||
|
||||
//var b = (from x in Funs.DB.HJGL_Pipeline
|
||||
// join y in Funs.DB.HJGL_PipeLineMat on x.PipelineId equals y.PipelineId
|
||||
// where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == q.UnitWorkId && y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
|
||||
// select x).Distinct();
|
||||
//var b = (from x in DBpipeline
|
||||
// join y in dbpipeLineMat on x.PipelineId equals y.PipelineId
|
||||
// where x.PipelineCode.Contains(tvPipeCode.Text.Trim()) && x.UnitWorkId == q.UnitWorkId
|
||||
// && y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
|
||||
// select x.PipelineId).Distinct();
|
||||
//int a = (from x in DBpipeline
|
||||
// join y in dbpipeLineMat on x.PipelineId equals y.PipelineId
|
||||
// where x.PipelineCode.Contains(tvPipeCode.Text.Trim()) && x.UnitWorkId == q.UnitWorkId
|
||||
// && y.MaterialCode.Contains(txtMaterialCode.Text.Trim())
|
||||
// select x.PipelineId).Distinct().Count();
|
||||
var unitworkOutMasterOutputs = outMasterOutputs.Where(x => x.UnitWorkId == q.UnitWorkId);
|
||||
var unitNamesUnitIds = BLL.UnitService.getUnitNamesUnitIds(q.UnitId);
|
||||
TreeNode tn2 = new TreeNode();
|
||||
tn2.NodeID = q.UnitWorkId;
|
||||
tn2.Text = q.UnitWorkName + "【" + a.ToString() + "】" + "管线";
|
||||
//if (q.UnitWorkId == this.hdUnitWorkId.Text)
|
||||
//{
|
||||
// tn2.Expanded = true;
|
||||
//}
|
||||
tn2.Text = q.UnitWorkName;
|
||||
tn2.ToolTip = "施工单位:" + unitNamesUnitIds;
|
||||
tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
//tn2.CommandName = 1 + "|" + Funs.GetEndPageNumber(a, pageSize);
|
||||
tn2.EnableExpandEvent = true;
|
||||
tn2.EnableClickEvent = true;
|
||||
|
||||
rootNode2.Nodes.Add(tn2);
|
||||
if (a > 0)
|
||||
foreach (var item in unitworkOutMasterOutputs)
|
||||
{
|
||||
// BindNodes(tn2);
|
||||
TreeNode newNode = new TreeNode();
|
||||
newNode.Text = "加载管线...";
|
||||
newNode.NodeID = "加载管线...";
|
||||
FineUIPro.TreeNode newNode = new FineUIPro.TreeNode();
|
||||
newNode.Text = item.CusBillCode;
|
||||
newNode.NodeID = item.Id;
|
||||
newNode.CommandName = "出库单";
|
||||
newNode.EnableClickEvent = true;
|
||||
tn2.Nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
@@ -234,20 +141,6 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
protected void btnTreeFind_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.InitTreeMenu();
|
||||
//this.BindGrid3(this.tvControlItem.SelectedNodeID);
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
|
||||
#region Methods
|
||||
|
||||
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
|
||||
{
|
||||
if (e.Node.Nodes[0].NodeID == "加载管线...")
|
||||
{
|
||||
e.Node.Nodes.Clear();
|
||||
BindNodes(e.Node);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Methods
|
||||
@@ -267,20 +160,14 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
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);
|
||||
BindNodes(e.Node.ParentNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(this.tvControlItem.SelectedNodeID))
|
||||
{
|
||||
Model.HJGL_Pipeline pipeline = BLL.PipelineService.GetPipelineByPipelineId(this.tvControlItem.SelectedNodeID);
|
||||
this.hdUnitWorkId.Text = string.Empty;
|
||||
if (pipeline != null)
|
||||
{
|
||||
this.hdUnitWorkId.Text = this.tvControlItem.SelectedNode.ParentNode.NodeID;
|
||||
{
|
||||
|
||||
this.BindGrid(this.tvControlItem.SelectedNodeID);
|
||||
|
||||
this.BindGrid(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,23 +175,44 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
#endregion 点击TreeView
|
||||
|
||||
#region 数据绑定
|
||||
|
||||
private void BindGrid(string pipelineId, string unitworkid)
|
||||
/// <summary>
|
||||
/// 行绑定事件(没有焊接方法无法选择)
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
||||
{
|
||||
var Prelist = HJGL_PipelineComponentService.GetPipelinePrefabricatedComponent(unitworkid, pipelineId);
|
||||
DataRowView row = e.DataItem as DataRowView;
|
||||
string id = e.RowID;
|
||||
if (Funs.DB.HJGL_PackagingManageDetail.Any(x=>x.TwOutputDetailId==id))
|
||||
{
|
||||
e.RowSelectable = false;
|
||||
}
|
||||
;
|
||||
}
|
||||
private void BindGrid(string outputMasterId)
|
||||
{
|
||||
////var Prelist = HJGL_PipelineComponentService.GetPipelinePrefabricatedComponent(unitworkid, pipelineId);
|
||||
|
||||
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;
|
||||
////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;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
@@ -338,26 +246,27 @@ namespace FineUIPro.Web.HJGL.PreDesign
|
||||
protected void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
this.BindGrid(this.tvControlItem.SelectedNodeID, this.hdUnitWorkId.Text);
|
||||
this.BindGrid(this.tvControlItem.SelectedNodeID);
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
var List_Id = Grid1.SelectedRowIDArray;
|
||||
if (List_Id != null)
|
||||
var SelectIDArry = Grid1.SelectedRowIDArray;
|
||||
if (SelectIDArry != null)
|
||||
{
|
||||
foreach (var id in List_Id)
|
||||
foreach (var id in SelectIDArry)
|
||||
{
|
||||
var hJGL_PipeLineMat = BLL.PipelineMatService.GetPipeLineMat(id);
|
||||
if (hJGL_PipeLineMat != null)
|
||||
var twoutputdetailModel = BLL.TwOutputdetailService.GetById(id);
|
||||
if (twoutputdetailModel != null)
|
||||
{
|
||||
var model = new Model.HJGL_PackagingManageDetail()
|
||||
{
|
||||
Id = SQLHelper.GetNewID(),
|
||||
PackagingManageId = this.PackagingManageId,
|
||||
PipelineId = hJGL_PipeLineMat.PipelineId,
|
||||
MaterialCode = hJGL_PipeLineMat.MaterialCode,
|
||||
Number = hJGL_PipeLineMat.Number,
|
||||
//PipelineId = hJGL_PipeLineMat.PipelineId,
|
||||
MaterialCode = twoutputdetailModel.MaterialCode,
|
||||
Number = twoutputdetailModel.ActNum,
|
||||
TwOutputDetailId = twoutputdetailModel.Id,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateUser = this.CurrUser.PersonId,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user