예제 #1
0
        /// <summary>
        /// 粘贴同级或下级
        /// </summary>
        /// <param name="_parentId"></param>
        private void BOMStructPasteByMaterial(int _parentId)
        {
            var structId = Convert.ToInt32(focus_node.GetValue("Id"));
            var referStructId = Convert.ToInt32(referNode.GetValue("Id"));
            var bomId = Convert.ToInt32(referNode.GetValue("BOM_Id"));

            if (bmReferMaterial.Items["btnCopyMaterial"].Tag == "ReferMaterialCopy")
            {
                var m = new BOM_Struct { Id = structId + 1, Parent_Id = _parentId, Material_Id = referMaterialId, BOM_Id = bom_id, Is_Refer = "1", ReferBOM_Id = 0 };
                structList.Add(m);
            }
            else
            {
                var m = structList.Find(s => s.Id == structId && s.BOM_Id == bom_id);
                if (m == null) return;
                var referStructList = productStructService.GetBOMStructListByParentId(referStructId, bomId);

                m = new BOM_Struct { Id = m.Id + 1, Parent_Id = _parentId, BOM_Id = bom_id, Material_Id = referStructList[0].Material_Id };
                structList.Add(m);
                for (int i = 0; i < referStructList.Count; i++)
                {
                    var _list = new List<BOM_Struct>();
                    productStructService.GetChildBOMStruct(referStructList[i].Id, ref _list);
                    var parent_id = m.Id;
                    for (int j = 0; j < _list.Count; j++)
                    {
                        m = new BOM_Struct { Id = m.Id + 1, Parent_Id = parent_id, BOM_Id = bom_id, Material_Id = _list[j].Material_Id };
                        structList.Add(m);
                    }
                }
            }
            TreeDataBind(structList, treeList1);
        }
예제 #2
0
 /// <summary>
 /// 添加同级或下级
 /// </summary>
 private void BOMStructAddByMaterial(int _parentId)
 {
     var materialForm = new SelectExistingFile();
     materialForm.ShowDialog();
     if (materialForm.DialogResult == DialogResult.OK)
     {
         var id = Convert.ToInt32(focus_node.GetValue("Id"));
         var parts = materialForm.parts;
         var m = new BOM_Struct { Id = id + 1, Parent_Id = _parentId, Material_Id = Convert.ToInt32(parts[0]) };
         structList.Add(m);
         TreeDataBind(structList, treeList1);
     }
 }
예제 #3
0
        public List<BOM_Struct> GetAllStruct()
        {
            var structList = new List<BOM_Struct>();
            var structs = new BOM_Struct
            {
                Id = 1,
                BOM_Id = 1,
                Is_Delete = "0",
                Material_Id = 1,
                Parent_Id = 0,
                Create_Date = DateTime.Now
            };
            structList.Add(structs);

            structs = new BOM_Struct
            {
                Id = 2,
                BOM_Id = 1,
                Is_Delete = "0",
                Material_Id = 2,
                Parent_Id = 1,
                Create_Date = DateTime.Now
            };
            structList.Add(structs);

            structs = new BOM_Struct
            {
                Id = 3,
                BOM_Id = 1,
                Is_Delete = "0",
                Material_Id = 3,
                Parent_Id = 2,
                Create_Date = DateTime.Now
            };
            structList.Add(structs);

            structs = new BOM_Struct
            {
                Id = 4,
                BOM_Id = 2,
                Is_Delete = "0",
                Material_Id = 1,
                Parent_Id = 0,
                Create_Date = DateTime.Now
            };
            structList.Add(structs);

            structs = new BOM_Struct
            {
                Id = 5,
                BOM_Id = 1,
                Is_Delete = "0",
                Material_Id = 2,
                Parent_Id = 1,
                Create_Date = DateTime.Now
            };
            structList.Add(structs);

            return structList;
        }
예제 #4
0
        public List<BOM_Struct> GetAllStructByBOMId(int? bom_id)
        {
            List<BOM_Struct> structList = new List<BOM_Struct>();
            BOM_Struct structs = new BOM_Struct
            {
                Id = 1,
                BOM_Id = 1,
                Is_Delete = "0",
                Material_Id = 1,
                Parent_Id = 0,
                Create_Date = DateTime.Now
            };
            structList.Add(structs);

            structs = new BOM_Struct
            {
                Id = 2,
                BOM_Id = 1,
                Is_Delete = "0",
                Material_Id = 2,
                Parent_Id = 1,
                Create_Date = DateTime.Now
            };
            structList.Add(structs);

            return structList;
        }
예제 #5
0
 public bool UpdateBOMStruct(BOM_Struct bomStruct)
 {
     var sql = "Update bom_struct set bom_id=" + bomStruct.BOM_Id + ",material_id=" + bomStruct.Material_Id + ",parent_id=" + bomStruct.Parent_Id + " where id=" + bomStruct.Id + "";
     return false;
 }
예제 #6
0
 /// <summary>
 /// 添加BOM结构数据
 /// </summary>
 /// <param name="bomStruct"></param>
 /// <returns></returns>
 public bool AddBOMStruct(BOM_Struct bomStruct)
 {
     var sql = "insert into bom_struct(bom_id,material_id,parent_id) values(" + bomStruct.BOM_Id + "," + bomStruct.Material_Id + "," + bomStruct.Parent_Id + ")";
     return false;
 }