Exemple #1
0
 private void SaveORUpdateClick(object sender, EventArgs e)
 {
     type = MaterialType();
     materialService.AddORUpdateType(type);
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
        //更新或添加数据
        public ActionResult Add(string material_Id)
        {
            ViewBag.types    = _typeBll.GetEntities(p => p.Material_Type_Parent_Id == "000000");
            ViewBag.companys = _companyBll.GetEntities(p => true).Select(p => p.Company_Name);
            if (string.IsNullOrEmpty(material_Id))
            {
                ViewBag.IsUpdate = false;
                return(View());
            }

            ViewBag.IsUpdate = true;
            Material_Info materialInfo = _baseInfoBll.GetEntity(m => m.Material_Id == material_Id);
            Material_Type currentType  =
                _typeBll.GetEntity(m => m.Material_Type_Name == materialInfo.Material_Type_Name);

            ViewBag.brotherTypes =
                _typeBll.GetEntities(m => m.Material_Type_Parent_Id == currentType.Material_Type_Parent_Id);
            Material_Type parenType =
                _typeBll.Find(currentType.Material_Type_Parent_Id);

            ViewBag.parentTypes =
                _typeBll.GetEntities(m => m.Material_Type_Parent_Id == parenType.Material_Type_Parent_Id);
            ViewBag.parentName = parenType.Material_Type_Name;
            ViewBag.grandName  = _typeBll.Find(parenType.Material_Type_Parent_Id)
                                 .Material_Type_Name;
            if (materialInfo != null)
            {
                return(View(materialInfo));
            }
            return(View());
        }
Exemple #3
0
 private void PartsMange_MaterialBankManage_MaterialBankManage_MaterialManage_TreeList_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Clicks > 1 && e.Button == MouseButtons.Left)
     {
         var treeList = (TreeList)sender;
         var hitInfo  = treeList.CalcHitInfo(e.Location);
         if (hitInfo == null)
         {
             return;
         }
         if (hitInfo.Node == null)
         {
             return;
         }
         var id      = hitInfo.Node.GetValue(Type_Id);
         var is_last = hitInfo.Node.GetValue(Is_Last);
         if (is_last.Equals("0"))
         {
             MessageBox.Show("请选择最小类型的物料类型!", "提示信息!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         else
         {
             materialType = materialTypeList.Find(t => t.Id == Convert.ToInt32(id));
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Exemple #4
0
        //右键菜单修改 物料分类
        private void MaterialType_Modify_BarButtonItem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            materialType = (Material_Type)PartsMange_MaterialPropertyBuild_AddMaterialProperty_MaterialClassify_GridView.GetFocusedRow();
            ChooseMaterialType CM = new ChooseMaterialType();

            CM.Tag = "Modify";
            CM.ShowDialog();
        }
Exemple #5
0
        private void GetAllTypes(Stack <string> materType, string typeName)
        {
            Material_Type materialType = _typeBll.GetEntity(m => m.Material_Type_Name == typeName);

            if (materialType.Material_Type_Parent_Id != "000000")
            {
                string name = _typeBll.Find(materialType.Material_Type_Parent_Id).Material_Type_Name;
                materType.Push(name);
                GetAllTypes(materType, name);
            }
        }
Exemple #6
0
        public IList <Material_Type> MT()
        {
            IList <Material_Type> Ma = new BindingList <Material_Type>();
            var materialType         = new Material_Type();

            materialType.Child_Mark_Length = "10";
            materialType.Code_Length       = "8";
            materialType.Code_Start        = "10";
            materialType.Create_Date       = new DateTime();
            materialType.Create_User_Id    = 1001;
            materialType.Id             = 001;
            materialType.Is_Delete      = "是";
            materialType.Is_Last        = "是";
            materialType.Modify_Date    = new DateTime();
            materialType.Modify_User_Id = 10001;
            materialType.Name           = "气囊";
            materialType.Parent_Id      = 1;
            materialType.Mark           = "保命用具";
            Ma.Add(materialType);

            materialType.Child_Mark_Length = "12";
            materialType.Code_Length       = "8";
            materialType.Code_Start        = "10";
            materialType.Create_Date       = new DateTime();
            materialType.Create_User_Id    = 1002;
            materialType.Id             = 002;
            materialType.Is_Delete      = "否";
            materialType.Is_Last        = "是";
            materialType.Modify_Date    = new DateTime();
            materialType.Modify_User_Id = 10002;
            materialType.Name           = "油箱";
            materialType.Parent_Id      = 2;
            materialType.Mark           = "汽车命脉";
            Ma.Add(materialType);

            materialType.Child_Mark_Length = "15";
            materialType.Code_Length       = "8";
            materialType.Code_Start        = "10";
            materialType.Create_Date       = new DateTime();
            materialType.Create_User_Id    = 1003;
            materialType.Id             = 003;
            materialType.Is_Delete      = "否";
            materialType.Is_Last        = "否";
            materialType.Modify_Date    = new DateTime();
            materialType.Modify_User_Id = 10003;
            materialType.Name           = "方向盘";
            materialType.Parent_Id      = 3;
            materialType.Mark           = "汽车眼睛";
            Ma.Add(materialType);
            return(Ma);
        }
Exemple #7
0
        private void PartsMange_MaterialPropertyBuild_ChooseMaterialType_ConfirmMaterialType_SimpleButton_Click(object sender, EventArgs e)
        {
            var materialType = new Material_Type();
            var focusNode    = PartsMange_MaterialPropertyBuild_ChooseMaterialType_MaterialClassify_TreeList.FocusedNode;

            materialType.Id   = Convert.ToInt32(focusNode.GetValue(MaterialType_Id));
            materialType.Mark = focusNode.GetValue(MaterialType_Mark).ToString();
            materialType.Name = focusNode.GetValue(MaterialType_Name).ToString();
            materialTypeList.Add(materialType);
            if (is_extend)
            {
                GetChildByParentId(materialType.Id, ref materialTypeList);
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemple #8
0
        private Material_Type MaterialType()
        {
            var index        = PartsMange_MaterialBankManage_AddType_MaterialBasicType_IsLast_RadioGroup.SelectedIndex;
            var materialType = new Material_Type
            {
                Id                = type.Id + 1,
                Name              = PartsMange_MaterialBankManage_AddType_MaterialBasicType_TextEdit.Text,
                Mark              = PartsMange_MaterialBankManage_AddType_MaterialBasicIdentification_TextEdit.Text,
                Is_Last           = PartsMange_MaterialBankManage_AddType_MaterialBasicType_IsLast_RadioGroup.Properties.Items[index].Description,
                Child_Mark_Length = PartsMange_MaterialBankManage_AddType_IdentificationLength_ComboBoxEdit.SelectedIndex.ToString(),
                Code_Start        = PartsMange_MaterialBankManage_AddType_MaterialBasicType_CodeStart_RadioGroup.SelectedIndex.ToString(),
                Code_Length       = PartsMange_MaterialBankManage_AddType_WaterCodeLength_ComboBoxEdit.SelectedIndex.ToString(),
                Parent_Id         = type.Parent_Id,
                Create_Date       = DateTime.Now,
                Create_User_Id    = 1
            };

            return(materialType);
        }
Exemple #9
0
        private void TreeAddParnetORChild(int parent_id)
        {
            var type = new Material_Type();

            if (materialTypeList.Count > 0)
            {
                type.Id = materialTypeList[materialTypeList.Count - 1].Id;
            }
            type.Parent_Id = Convert.ToInt32(parent_id);
            var addType = new AddType();

            addType.type = type;
            addType.ShowDialog();
            if (addType.DialogResult == DialogResult.OK)
            {
                materialTypeList.Add(addType.type);
                TreeDataBind(materialTypeList);
            }
        }
Exemple #10
0
    void ApplyMaterial(Material_Type materialType, Material_Type changeMaterialType, Renderer renderer)
    {
        if (materialType == Material_Type.SharedMaterial)
        {
            renderer.sharedMaterial = targetMaterial;
        }
        else if (materialType == Material_Type.Material)
        {
            renderer.material = targetMaterial;
        }

        if (changeMaterialType == Material_Type.SharedMaterial)
        {
            renderer.sharedMaterial.mainTextureOffset = new Vector2(0.25f, 0);
        }
        else if (changeMaterialType == Material_Type.Material)
        {
            renderer.material.mainTextureOffset = new Vector2(0, 0.25f);
        }
    }
Exemple #11
0
        public List <Material_Type> GetAllMaterailType()
        {
            var typeList = new List <Material_Type>();
            var type     = new Material_Type();

            type.Id        = 1;
            type.Name      = "测试类型1";
            type.Parent_Id = 0;
            type.Mark      = "备注1";
            type.Is_Delete = "0";
            typeList.Add(type);

            type           = new Material_Type();
            type.Id        = 2;
            type.Name      = "测试类型11";
            type.Parent_Id = 1;
            type.Mark      = "备注11";
            type.Is_Delete = "0";
            typeList.Add(type);

            return(typeList);
        }
Exemple #12
0
        private string GetParentTypeName(string typeName, List <Material_Type> materialTypes)
        {
            Material_Type materialType = materialTypes.FirstOrDefault(m => m.Material_Type_Name == typeName);
            int           count        = materialTypes.Count(m => m.Material_Type_Parent_Id == "000000");

            if (materialType?.Material_Type_Parent_Id == "000000")
            {
                return(materialType.Material_Type_Name);
            }
            else
            {
                if (materialType != null)
                {
                    string name = materialTypes.FirstOrDefault(m => m.Material_Type_Id == materialType.Material_Type_Parent_Id)
                                  ?.Material_Type_Name;
                    return(GetParentTypeName(name, materialTypes));
                }
                else
                {
                    return(null);
                }
            }
        }
Exemple #13
0
        public IList <Material_Type> MaterType()
        {
            IList <Material_Type> Mat = new BindingList <Material_Type>();
            Material_Type         M   = new Material_Type();

            M.Child_Mark_Length = "20";
            M.Code_Length       = "15";
            M.Code_Start        = "10";
            M.Create_Date       = new DateTime();
            M.Create_User_Id    = 1;
            M.Id             = 1;
            M.Is_Delete      = "是";
            M.Is_Last        = "是";
            M.Modify_Date    = new DateTime();
            M.Modify_User_Id = 1;
            M.Name           = "物料编号";
            M.Parent_Id      = 1;
            M.Mark           = "用于物料的";
            Mat.Add(M);

            M = new Material_Type();
            M.Child_Mark_Length = "10";
            M.Code_Length       = "25";
            M.Code_Start        = "100";
            M.Create_Date       = new DateTime();
            M.Create_User_Id    = 1;
            M.Id             = 1;
            M.Is_Delete      = "否";
            M.Is_Last        = "是";
            M.Modify_Date    = new DateTime();
            M.Modify_User_Id = 1;
            M.Name           = "文档编号";
            M.Parent_Id      = 1;
            M.Mark           = "";
            Mat.Add(M);
            return(Mat);
        }
Exemple #14
0
 private bool AddMaterialType(Material_Type type)
 {
     return(true);
 }
Exemple #15
0
 private bool UpdateMaterialType(Material_Type type)
 {
     return(false);
 }
Exemple #16
0
        public List <Material_Type> GetAllMaterialType()
        {
            var list         = new List <Material_Type>();
            var materialType = new Material_Type();

            materialType.Child_Mark_Length = "20";
            materialType.Code_Length       = "15";
            materialType.Code_Start        = "10";
            materialType.Create_Date       = new DateTime();
            materialType.Create_User_Id    = 1;
            materialType.Id             = 1;
            materialType.Is_Delete      = "1"; //0:否 1:是
            materialType.Is_Last        = "1"; //0:否 1:是
            materialType.Modify_Date    = new DateTime();
            materialType.Modify_User_Id = 1;
            materialType.Name           = "物料编号";
            materialType.Parent_Id      = 0;
            materialType.Mark           = "用于物料的";
            list.Add(materialType);

            materialType = new Material_Type();
            materialType.Child_Mark_Length = "10";
            materialType.Code_Length       = "25";
            materialType.Code_Start        = "100";
            materialType.Create_Date       = new DateTime();
            materialType.Create_User_Id    = 1;
            materialType.Id             = 2;
            materialType.Is_Delete      = "0"; //0:否 1:是
            materialType.Is_Last        = "0"; //0:否 1:是
            materialType.Modify_Date    = new DateTime();
            materialType.Modify_User_Id = 1;
            materialType.Name           = "文档编号";
            materialType.Parent_Id      = 0;
            materialType.Mark           = "";
            list.Add(materialType);

            materialType = new Material_Type();
            materialType.Child_Mark_Length = "10";
            materialType.Code_Length       = "25";
            materialType.Code_Start        = "100";
            materialType.Create_Date       = new DateTime();
            materialType.Create_User_Id    = 1;
            materialType.Id             = 3;
            materialType.Is_Delete      = "0"; //0:否 1:是
            materialType.Is_Last        = "0"; //0:否 1:是
            materialType.Modify_Date    = new DateTime();
            materialType.Modify_User_Id = 1;
            materialType.Name           = "文档编号1";
            materialType.Parent_Id      = 2;
            materialType.Mark           = "";
            list.Add(materialType);

            materialType = new Material_Type();
            materialType.Child_Mark_Length = "10";
            materialType.Code_Length       = "25";
            materialType.Code_Start        = "100";
            materialType.Create_Date       = new DateTime();
            materialType.Create_User_Id    = 1;
            materialType.Id             = 4;
            materialType.Is_Delete      = "0"; //0:否 1:是
            materialType.Is_Last        = "0"; //0:否 1:是
            materialType.Modify_Date    = new DateTime();
            materialType.Modify_User_Id = 1;
            materialType.Name           = "文档编号2";
            materialType.Parent_Id      = 2;
            materialType.Mark           = "";
            list.Add(materialType);
            return(list);
        }
Exemple #17
0
 public bool AddORUpdateType(Material_Type type)
 {
     return(type.Id != 0 ? UpdateMaterialType(type) : AddMaterialType(type));
 }