public void GetBom_Update(string pCode, string cCode, int pID) { //var ProcessBomList = TreeNodeManage.GetTreeNodeList<PRS_Process_BOM>( // TreeNodeManage.Instance() // .SetNode("PartCode") // .SetParentNode("ParentCode", parentCode) // .SetTableName("PRS_Process_BOM") // //.SetNodeLevel(model.IsLevel) // //.SetTreeSetting(model.TreeSetting) // .SetWhereSql("where IsEnable=1") // ); var MES_BN_MatchingTableDetailList = TreeNodeManage.GetTreeNodeList <MES_BN_MatchingTableDetail>( TreeNodeManage.Instance() .SetNode("PartCode") .SetParentNode("PPartCode", pCode) .SetTableName("MES_BN_MatchingTableDetail") //.SetNodeLevel(model.IsLevel) //.SetTreeSetting(model.TreeSetting) .SetWhereSql("where IsEnable=1") ); new MES_BN_MatchingTableDetailService().Cover_MES_BN_MatchingTableDetail2(MES_BN_MatchingTableDetailList, pCode, cCode, pID); }
public ActionResult GetTreeNodeList(TreeNodeModel model) { var list = TreeNodeManage.GetTreeNodeList <dynamic>( TreeNodeManage.Instance() .SetNode(model.NodeField) .SetParentNode(model.ParentNodeField, model.ParentNodeValue) .SetTableName(model.TableName) .SetNodeLevel(model.IsLevel) .SetTreeSetting(model.TreeSetting) .SetWhereSql(model.WhereSql)); return(Content(Newtonsoft.Json.JsonConvert.SerializeObject(list))); }
public dynamic GetProductTreeList([FromUri] TreeNodeModel model) { var PMS_BN_ProjectDetailList = new PMS_BN_ProjectDetailService().GetModelList(); var PRS_Process_BOMList = new PRS_Process_BOMService().GetModelList(); var APS_ProjectProduceDetialList = new APS_ProjectProduceDetialService().GetModelList(); var list = TreeNodeManage.GetTreeNodeList <dynamic>( TreeNodeManage.Instance() .SetNode(model.NodeField) .SetParentNode(model.ParentNodeField, model.ParentNodeValue) .SetTableName(model.TableName) .SetNodeLevel(model.IsLevel) .SetTreeSetting(model.TreeSetting) .SetWhereSql(model.WhereSql)); var new_list = new List <dynamic>(); list.ForEach(item => { dynamic item_old = item; string ContractCode = item_old.ContractCode; int ProductID = item_old.ProductID; string PartCode = item_old.PartCode; var Quantity = PMS_BN_ProjectDetailList.Where(a => a.ID == ProductID).FirstOrDefault().Quantity ?? 0; //合同台数 var PartQuantity = PRS_Process_BOMList.Where(a => a.PartCode == PartCode && a.ContractCode == ContractCode && a.ProductID == ProductID).FirstOrDefault().PartQuantity ?? 0; //单台数量 int ProductTotal = Quantity * PartQuantity; //生产总数=合同台数*单台数量 //已生产数量 //var ProcuctList = APS_ProjectProduceDetialList //.Where(a => a.ContractCode == ContractCode && a.ProjectDetailID == ProductID && a.PartCode == PartCode) //.GroupBy(a => new { a.ProcessModelType, a.MonthPlanCode }) //.Select(a => new { ProcessType = a.Key.ProcessModelType, a.Key.MonthPlanCode, Quantity = a.Max(b => b.Quantity) }); var ProcuctList = APS_ProjectProduceDetialList .Where(a => a.ContractCode == ContractCode && a.ProjectDetailID == ProductID && a.PartCode == PartCode) .GroupBy(a => new { a.ProcessModelType, a.ProcessCode }) .Select(a => new { ProcessType = a.Key.ProcessModelType, ProcessCode = a.Key.ProcessCode, Quantity = a.Sum(b => b.Quantity) }); int BlankingTotal = ProcuctList.Where(a => a.ProcessType == "1").FirstOrDefault() == null ? 0 : ProcuctList.Where(a => a.ProcessType == "1").FirstOrDefault().Quantity ?? 0; int WeldingTotal = ProcuctList.Where(a => a.ProcessType == "2").FirstOrDefault() == null ? 0 : ProcuctList.Where(a => a.ProcessType == "2").FirstOrDefault().Quantity ?? 0; int MachiningTotal = ProcuctList.Where(a => a.ProcessType == "3").FirstOrDefault() == null ? 0 : ProcuctList.Where(a => a.ProcessType == "3").FirstOrDefault().Quantity ?? 0; int AssemblingTotal = ProcuctList.Where(a => a.ProcessType == "4").FirstOrDefault() == null ? 0 : ProcuctList.Where(a => a.ProcessType == "4").FirstOrDefault().Quantity ?? 0; item_old.BlankingTotal = BlankingTotal.ToString() + "/" + ProductTotal.ToString(); item_old.WeldingTotal = WeldingTotal.ToString() + "/" + ProductTotal.ToString(); item_old.MachiningTotal = MachiningTotal.ToString() + "/" + ProductTotal.ToString(); item_old.AssemblingTotal = AssemblingTotal.ToString() + "/" + ProductTotal.ToString(); new_list.Add(item_old); }); return(new_list); }
public dynamic GetProductTreeList([FromUri] TreeNodeModel model) { //var PMS_BN_ProjectDetailList = new PMS_BN_ProjectDetailService().GetModelList(); //var PRS_Process_BOMList = new PRS_Process_BOMService().GetModelList(); //var APS_ProjectProduceDetialList = new APS_ProjectProduceDetialService().GetModelList(); var list = TreeNodeManage.GetTreeNodeList <dynamic>( TreeNodeManage.Instance() .SetNode(model.NodeField) .SetParentNode(model.ParentNodeField, model.ParentNodeValue) .SetTableName(model.TableName) .SetNodeLevel(model.IsLevel) .SetTreeSetting(model.TreeSetting) .SetWhereSql(model.WhereSql)); return(list); }
public List <dynamic> GetProductPlanList(List <dynamic> plan_list) { var ProcessTypeList = plan_list.Select(p => Convert.ToString(p.ProcessType)).ToArray(); string ContractCode = plan_list[0]["ContractCode"]; string PlanCode = plan_list[0]["PlanCode"]; int ProductID = plan_list[0]["ProductID"]; string PartCode = plan_list[0]["PartCode"]; int Quantity = plan_list[0]["Quantity"]; var BomList = TreeNodeManage.GetTreeNodeList <dynamic>( TreeNodeManage.Instance() .SetNode("PartCode") .SetParentNode("ParentCode", PartCode) .SetTableName("PRS_Process_BOM")) .Where(b => b.IsSelfMade == "1" && b.IsEnable == 1 && b.PartCode == PartCode).ToList(); var ProcessRouteList = new MES_BN_ProductProcessRouteService().GetModelList().Where(p => p.IsEnable == 1 && ProcessTypeList.Contains(p.ProcessModelType)).ToList(); return((from p in ProcessRouteList join b in BomList on p.PartCode equals b.PartCode orderby p.ProcessModelType, p.ProcessLineCode select new { ContractCode = ContractCode, ProductID = ProductID, p.ProcessModelType, p.PartCode, RootPartCode = PartCode, MonthPlanCode = PlanCode, p.ProcessCode, p.ProcessName, b.PartFigureCode, b.PartName, b.MaterialCode, Quantity = b.PartQuantity * Quantity, BomQty = b.PartQuantity, PlanType = 1, p.ManHour, p.WorkshopID, p.WorkshopName, p.EquipmentID, p.EquipmentName, p.WorkGroupID, p.WorkGroupName }).ToList <dynamic>()); }
public dynamic PostCreateWorkShopMatchingData(dynamic data) { string ParentCode = data.ParentCode; string ContractCode = data.ContractCode; int ProjectDetailID = data.ProjectDetailID; string OperationType = data.OperationType; var list = TreeNodeManage.GetTreeNodeList <PRS_Process_BOM>( TreeNodeManage.Instance() .SetNode("PartCode") .SetParentNode("ParentCode", ParentCode) .SetTableName("PRS_Process_BOM") .SetWhereSql($"where IsSelfMade=1 and ContractCode='{ContractCode}' order by ID")); var result = new MES_BN_WorkShopMatchingService().PostCreateWorkShopMatchingData(list, ParentCode, OperationType); return(result); }
public dynamic PostCreateBlankingProcessBomData(dynamic data) { string ParentCode = data.ParentCode; string ContractCode = data.ContractCode; int ProductID = data.ProductID; string OperationType = data.OperationType; //int IsExist = new PRS_Process_BOM_BlankingService().GetModelList( // ParamQuery.Instance() // .AndWhere("ParentCode", ParentCode) // .AndWhere("ContractCode", ContractCode) // .AndWhere("ProductID", ProductID)).Count; //if (IsExist > 0) //{ // return true; //} var PRS_Process_BOMList = TreeNodeManage.GetTreeNodeList <PRS_Process_BOM>( TreeNodeManage.Instance() .SetNode("PartCode") .SetParentNode("ParentCode", ParentCode) .SetTableName("PRS_Process_BOM") .SetWhereSql("where IsEnable=1")); var PRS_Process_BOM_BlankingList = TreeNodeManage.GetTreeNodeList <PRS_Process_BOM_Blanking>( TreeNodeManage.Instance() .SetNode("PartCode") .SetParentNode("ParentCode", ParentCode) .SetTableName("PRS_Process_BOM_Blanking") .SetWhereSql("where IsEnable=1")); var result = new MES_BN_WorkShopMatchingService().PostCreateBlankingBomData(PRS_Process_BOMList, PRS_Process_BOM_BlankingList, ParentCode, ContractCode, ProductID, OperationType); return(result); }