2022-11-25 焊接材料匹配任务清单树优化

This commit is contained in:
李鹏飞 2022-11-25 14:08:03 +08:00
parent 4255cacbe9
commit b6f8ef01f1
9 changed files with 113 additions and 31 deletions

Binary file not shown.

View File

@ -0,0 +1 @@
alter table [dbo].[HJGL_MaterialManage] alter column [SpecificationAndModel] nvarchar(1000)

View File

@ -1022,11 +1022,17 @@ namespace BLL
T entity = new T();
foreach (PropertyInfo p in pArray)
{
if (string.IsNullOrEmpty(row[p.Name].ToString()))
{
p.SetValue(entity, "", null);
continue;
}
if (row[p.Name] is Int64)
{
p.SetValue(entity, Convert.ToInt32(row[p.Name]), null);
continue;
}
p.SetValue(entity, row[p.Name], null);
}
list.Add(entity);

View File

@ -9,6 +9,22 @@ namespace BLL
{
public class HJGL_MaterialService
{
/// <summary>
/// 工程预制库存
/// </summary>
public static List<Model.MaterialStockItem> materialStockItems_SHOP
{
get;
set;
}
/// <summary>
/// 现场安装库存
/// </summary>
public static List<Model.MaterialStockItem> materialStockItems_FIELD
{
get;
set;
}
/// <summary>
/// 获取材料信息
/// </summary>
@ -96,7 +112,6 @@ namespace BLL
mat.MaterialCode,
lib.MaterialName,
lib.MaterialSpec,
lib.MaterialMade,
lib.MaterialUnit,
sum( mat.Num)+ISNULL( aa.Num,0) as MaterialNum
from HJGL_MaterialManage mat
@ -125,7 +140,6 @@ namespace BLL
mat.MaterialCode,
lib.MaterialName,
lib.MaterialSpec,
lib.MaterialMade,
lib.MaterialUnit,
sum( mat.Num)+ISNULL( aa.Num,0) as MaterialNum
from Material_Material mat
@ -240,12 +254,30 @@ namespace BLL
if (q != null && q.Count() > 0) //判断管线是否有关联材料
{
var pipemodel = BLL.PipelineService.GetPipelineByPipelineId(pipelineid);
List<Model.MaterialStockItem> list = GetMaterialStockItems(projectid, pipemodel.PipeArea);
if (list != null && list.Count > 0) //判断是否有库存信息
List<Model.MaterialStockItem> materialStockItems = new List<Model.MaterialStockItem>();
if (pipemodel.PipeArea==PipelineService.PipeArea_SHOP)
{
if (HJGL_MaterialService.materialStockItems_SHOP.Count == 0)
{
HJGL_MaterialService.materialStockItems_SHOP = GetMaterialStockItems(projectid, pipemodel.PipeArea);
}
materialStockItems = materialStockItems_SHOP;
}
else if (pipemodel.PipeArea == PipelineService.PipeArea_FIELD)
{
if(HJGL_MaterialService.materialStockItems_FIELD.Count == 0)
{
HJGL_MaterialService.materialStockItems_FIELD = GetMaterialStockItems(projectid, pipemodel.PipeArea);
}
materialStockItems = materialStockItems_FIELD;
}
//List<Model.MaterialStockItem> materialStockItems = GetMaterialStockItems(projectid, pipemodel.PipeArea);
if (materialStockItems != null && materialStockItems.Count > 0) //判断是否有库存信息
{
foreach (var item in q)
{
var StockMater = list.Where(x => x.MaterialCode == item.MaterialCode).FirstOrDefault();
var StockMater = materialStockItems.Where(x => x.MaterialCode == item.MaterialCode).FirstOrDefault();
if (StockMater != null) //判断该材料是否存在库存
{
var StockNum = StockMater.MaterialNum;

View File

@ -93,7 +93,7 @@ namespace BLL
{
model.PipelineId = PipelineId;
model.PipelineComponentCode = model_mat.PrefabricatedComponents;
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-'));
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", "");
model.State = state_0;
UpdatePipelineComponent(model);
}
@ -103,7 +103,7 @@ namespace BLL
model.PipelineComponentId = SQLHelper.GetNewID();
model.PipelineId = PipelineId;
model.PipelineComponentCode = model_mat.PrefabricatedComponents;
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-'));
model.DrawingName = model_mat.PrefabricatedComponents.Substring(0, model_mat.PrefabricatedComponents.LastIndexOf('-')).Replace("\"", "");
model.State = state_0;
AddPipelineComponent(model);
}

View File

@ -150,7 +150,8 @@ namespace FineUIPro.Web.HJGL.PreDesign
{
Model.ResponeData responeData = new Model.ResponeData();
string result = string.Empty;
//string result = string.Empty;
List<string> result = new List<string> () ;
int ic, ir;
ic = pds.Columns.Count;
ir = pds.Rows.Count;
@ -175,39 +176,41 @@ namespace FineUIPro.Web.HJGL.PreDesign
if (string.IsNullOrEmpty(pipelinecode))
{
result += "第" + (i + 2).ToString() + "行," + "管线号" + "," + "此项为必填项!" + "|";
//result += "第" + (i + 2).ToString() + "行," + "管线号" + "," + "此项为必填项!" + "|";
result.Add("第" + (i + 2).ToString() + "行," + "管线号" + "," + "此项为必填项!");
}
else
{
pipeline = getPipeline.FirstOrDefault(x => x.PipelineCode == pipelinecode);
if (pipeline == null)
{
result += "第" + (i + 2).ToString() + "行," + "不存在此管线号" + "|";
//result += "第" + (i + 2).ToString() + "行," + "不存在此管线号" + "|";
result.Add("不存在此管线号-"+ pipelinecode);
continue;
}
}
if (string.IsNullOrEmpty(PipelineComponentCode))
{
result += "第" + (i + 2).ToString() + "行," + "预制组件" + "," + "此项为必填项!" + "|";
//result += "第" + (i + 2).ToString() + "行," + "预制组件" + "," + "此项为必填项!" + "|";
result.Add("第" + (i + 2).ToString() + "行," + "预制组件" + "," + "此项为必填项!");
}
else
{
hJGL_Pipeline_Component = HJGL_PipelineComponentService.GetPipelineComponentByCodeandpipelineId(PipelineComponentCode, pipeline.PipelineId);
if (hJGL_Pipeline_Component == null)
{
result += "第" + (i + 2).ToString() + "行," + "不存在此预制组件 " + PipelineComponentCode + " |";
//result += "第" + (i + 2).ToString() + "行," + "不存在此预制组件 " + PipelineComponentCode + " |";
result.Add("不存在此预制组件-" + PipelineComponentCode);
continue;
}
}
}
if (!string.IsNullOrEmpty(result))
if (result.Count>0)
{
PipelineList.Clear();
result = result.Substring(0, result.LastIndexOf("|"));
errorInfos = result;
// result = result.Substring(0, result.LastIndexOf("|"));
errorInfos = string .Join("|", result.Distinct()) ;
//Alert alert = new Alert();
//alert.Message = result;
//alert.Target = Target.Self;

View File

@ -36,7 +36,7 @@
<Items>
<f:Tree ID="tvControlItem" ShowHeader="false" Height="560px" Title="管线列表"
OnNodeCommand="tvControlItem_NodeCommand" runat="server" ShowBorder="false" EnableCollapse="true"
EnableSingleClickExpand="true" AutoLeafIdentification="true"
EnableSingleClickExpand="true" AutoLeafIdentification="true" OnNodeExpand="tvControlItem_TreeNodeExpanded"
EnableTextSelection="true" >
</f:Tree>
</Items>

View File

@ -94,6 +94,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
if (!IsPostBack)
{
HJGL_MaterialService.materialStockItems_FIELD = new List<Model.MaterialStockItem>();
HJGL_MaterialService.materialStockItems_SHOP = new List<Model.MaterialStockItem>();
this.txtTaskDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now.AddDays(1));
this.txtTaskCode.Text = BLL.WeldTaskService.GetTaskCodeByDate(this.CurrUser.LoginProjectId, this.txtTaskDate.Text);
BLL.Base_WeldingLocationServie.InitWeldingLocationDropDownList(drpWeldingLocation, true);
@ -161,19 +164,35 @@ namespace FineUIPro.Web.HJGL.WeldingManage
rootNode1.Text = "工厂预制";
rootNode1.CommandName = "工厂预制";
rootNode1.EnableClickEvent = true;
rootNode1.Selectable = true;
rootNode1.EnableExpandEvent = true;
this.tvControlItem.Nodes.Add(rootNode1);
int a = (from x in PipelineService.hJGL_Pipelines where x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipelineService.PipeArea_SHOP select x).Count();
if (a > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
rootNode1.Nodes.Add(newNode);
}
TreeNode rootNode2 = new TreeNode();
rootNode2.NodeID = BLL.PipelineService.PipeArea_FIELD;
rootNode2.Text = "现场安装";
rootNode2.CommandName = "现场安装";
rootNode2.EnableClickEvent = true;
rootNode2.Expanded = true;
rootNode2.EnableExpandEvent = true;
this.tvControlItem.Nodes.Add(rootNode2);
AddTreeNode(BLL.PipelineService.PipeArea_SHOP, rootNode1);
AddTreeNode(BLL.PipelineService.PipeArea_FIELD, rootNode2);
int b = (from x in PipelineService.hJGL_Pipelines where x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipelineService.PipeArea_FIELD select x).Count();
if (b > 0)
{
// BindNodes(tn1);
TreeNode newNode = new TreeNode();
newNode.Text = "加载管线...";
newNode.NodeID = "加载管线...";
rootNode2.Nodes.Add(newNode);
}
//TreeNode rootNode = new TreeNode();
//rootNode.Text = "管线号";
//rootNode.NodeID = "0";
@ -185,12 +204,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
}
void AddTreeNode(string PipeArea , TreeNode node )
{
var iso = (from x in Funs.DB.HJGL_Pipeline where x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipeArea orderby x.PipelineCode select x).ToList();
var iso = (from x in PipelineService.hJGL_Pipelines where x.UnitWorkId == this.UnitWorkId && x.UnitId == this.UnitId && x.PipeArea == PipeArea orderby x.PipelineCode select x).ToList();
if (!string.IsNullOrEmpty(this.txtPipelineCode.Text))
{
iso = (from x in iso where x.PipelineCode.Contains(this.txtPipelineCode.Text.Trim()) orderby x.PipelineCode select x).ToList();
}
var joints = from x in Funs.DB.HJGL_WeldJoint where x.ProjectId == this.CurrUser.LoginProjectId select x;
var joints = from x in WeldJointService.hJGL_WeldJoints select x;
foreach (var item in iso)
{
TreeNode newNode = new TreeNode();
@ -208,14 +227,31 @@ namespace FineUIPro.Web.HJGL.WeldingManage
node.Nodes.Add(newNode);
}
}
protected void tvControlItem_TreeNodeExpanded(object sender, TreeNodeEventArgs e)
{
if (e.Node.Nodes[0].NodeID == "加载管线...")
{
e.Node.Nodes.Clear();
if (e.Node.CommandName == "工厂预制")
{
AddTreeNode(BLL.PipelineService.PipeArea_SHOP, e.Node);
#endregion
}
else if (e.Node.CommandName == "现场安装")
{
AddTreeNode(BLL.PipelineService.PipeArea_FIELD, e.Node);
#region
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid()
}
}
}
#endregion
#region
/// <summary>
/// 数据绑定
/// </summary>
private void BindGrid()
{
string pipelineId = this.tvControlItem.SelectedNodeID;

View File

@ -37,6 +37,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (!IsPostBack)
{
PipeArea = Request.Params["PipeArea"];
HJGL_MaterialService.materialStockItems_FIELD = new List<Model.MaterialStockItem>();
HJGL_MaterialService.materialStockItems_SHOP = new List<Model.MaterialStockItem>();
this.InitTreeMenu();//加载树
}
}
@ -159,6 +162,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
pipeline= pipeline.Where(x => x.PipelineCode.Contains(txtPipelineCode.Text.Trim())).ToList();
}
foreach (var item in pipeline)
{
//var jotCount = (from x in Funs.DB.HJGL_WeldJoint where x.PipelineId == item.PipelineId && x.IsTwoJoint == null select x).Count();