コード例 #1
0
ファイル: FormMaterielEdit.cs プロジェクト: Lierba2014/erp-2
        private bool addMaterielType()
        {
            MaterielTypeTable materielType = new MaterielTypeTable();

            materielType.name = this.textBoxMaterielGroupName.Text.ToString();
            materielType.num  = this.textBoxGroupNum.Text.ToString();
            materielType.desc = this.textBoxMaterielGroupDesc.Text.ToString();

            if (materielType.name.Length == 0)
            {
                MessageBoxExtend.messageWarning("物料分组保存失败, 组名称不能为空,请重新输入!");
                return(false);
            }

            if (materielType.num.Length == 0 || materielType.num.Length > 10)
            {
                MessageBoxExtend.messageWarning("物料分组保存失败, 组编号长度必须为1-10位,请重新输入!");
                return(false);
            }

            MaterielType.getInctance().insert(materielType);


            // 物料组织结构
            MaterielOrgStructTable materielOrgInfo = new MaterielOrgStructTable();

            materielOrgInfo.parentPkey = MaterielOrgStruct.getInctance().getPkeyFromValue(m_materielGroupPkey);
            materielOrgInfo.value      = MaterielType.getInctance().getMaxPkey();
            MaterielOrgStruct.getInctance().insert(materielOrgInfo);

            return(true);
        }
コード例 #2
0
        private void toolStripButtonRefresh_Click(object sender, EventArgs e)
        {
            MaterielProOccupiedOrder.getInctance().refreshRecord();
            MaterielProOccupiedOrderDetails.getInctance().refreshRecord();
            getMaterielProOccupiedList();

            MaterielType.getInctance().refreshRecord();
            MaterielOrgStruct.getInctance().refreshRecord();

            refreshTreeView();
            Materiel.getInctance().refreshRecord();
            updateDataGridView(Materiel.getInctance().getAllMaterielInfo());
        }
コード例 #3
0
 private void SuppierGroupDelete_Click(object sender, EventArgs e)
 {
     if (MessageBoxExtend.messageQuestion("确定删除[" + m_materielGroupName + "]分组信息吗?"))
     {
         if (m_materielRecordCount > 0)
         {
             MessageBoxExtend.messageWarning("[" + m_materielGroupName + "] 删除失败,请先删除物料记录然后重试.");
         }
         else
         {
             MaterielType.getInctance().delete(m_materielGroupPkey);
             MaterielOrgStruct.getInctance().delete(MaterielOrgStruct.getInctance().getPkeyFromValue(m_materielGroupPkey));
             refreshTreeView();
         }
     }
 }
コード例 #4
0
        private void processDutyOrgNode(int parentID, TreeNode node)
        {
            string    nodeName = "";
            TreeNode  currentNode;
            ArrayList nodeList = MaterielOrgStruct.getInctance().getNodesFormParentID(parentID);

            for (int i = 0; i < nodeList.Count; i++)
            {
                MaterielOrgStructTable record = (MaterielOrgStructTable)nodeList[i];

                nodeName = MaterielType.getInctance().getMaterielTypeNameFromPkey(record.value);

                currentNode = m_tree.addNode(node, nodeName, 0, 1, Convert.ToString(record.value));
                processDutyOrgNode(record.pkey, currentNode);
            }
        }
コード例 #5
0
        private void refreshTreeView()
        {
            if (m_tree != null && treeViewMaterielOrg.Nodes.Count > 0)
            {
                treeViewMaterielOrg.Nodes.Clear();
            }

            m_tree = new TreeViewExtend(this.treeViewMaterielOrg);

            if (m_type == 1)
            {
                int rootNodePkey = MaterielOrgStruct.getInctance().getRootNodePkey();

                int    rooNodeValue = MaterielOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey);
                string rootName     = MaterielType.getInctance().getMaterielTypeNameFromPkey(rooNodeValue);

                m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName);

                processDutyOrgNodeMateriel(rootNodePkey, m_rootNode);
            }
            else if (m_type == 2)
            {
                int rootNodePkey = CustomerOrgStruct.getInctance().getRootNodePkey();

                int    rooNodeValue = CustomerOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey);
                string rootName     = CustomerType.getInctance().getCustomerTypeNameFromPkey(rooNodeValue);

                m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName);

                processDutyOrgNodeCustomer(rootNodePkey, m_rootNode);
            }
            else if (m_type == 3)
            {
                int rootNodePkey = SupplierOrgStruct.getInctance().getRootNodePkey();

                int    rooNodeValue = SupplierOrgStruct.getInctance().getNoteValueFromPkey(rootNodePkey);
                string rootName     = SupplierType.getInctance().getSupplierTypeNameFromPkey(rooNodeValue);

                m_rootNode = this.treeViewMaterielOrg.Nodes.Add(Convert.ToString(rooNodeValue), rootName);

                processDutyOrgNodeSupplier(rootNodePkey, m_rootNode);
            }

            m_rootNode.Expand();
        }
コード例 #6
0
        /*
         * 各种测试代码如下
         *
         * */
        private bool addMaterielTypeTest(int materielGroupPkey)
        {
            MaterielTypeTable materielType = new MaterielTypeTable();

            materielType.name = "addMaterielTypeTest";
            materielType.num  = "0";
            materielType.desc = "addMaterielTypeTest desc";

            MaterielType.getInctance().insert(materielType, false);


            // 物料组织结构
            MaterielOrgStructTable materielOrgInfo = new MaterielOrgStructTable();

            materielOrgInfo.parentPkey = MaterielOrgStruct.getInctance().getPkeyFromValue(materielGroupPkey);
            materielOrgInfo.value      = MaterielType.getInctance().getMaxPkey();
            MaterielOrgStruct.getInctance().insert(materielOrgInfo, false);

            return(true);
        }
コード例 #7
0
        private SortedDictionary <int, MaterielTable> getCurrentNodeAllChildNodesMateriel()
        {
            SortedDictionary <int, MaterielTable> materielList    = new SortedDictionary <int, MaterielTable>();
            SortedDictionary <int, int>           childNodeValues = MaterielOrgStruct.getInctance().getAllChildNodeValue(m_materielGroupPkey);

            if (!childNodeValues.ContainsKey(m_materielGroupPkey))
            {
                childNodeValues.Add(m_materielGroupPkey, m_materielGroupPkey);
            }

            foreach (KeyValuePair <int, int> index in childNodeValues)
            {
                SortedDictionary <int, MaterielTable> temp = Materiel.getInctance().getMaterielInfoFromMaterielType(index.Value);

                foreach (KeyValuePair <int, MaterielTable> i in temp)
                {
                    MaterielTable materiel = new MaterielTable();
                    materielList.Add(materielList.Count, (MaterielTable)i.Value);
                }
            }

            return(materielList);
        }
コード例 #8
0
        private void addMaterielType()
        {
            MaterielTypeTable materielType = new MaterielTypeTable();

            materielType.name = this.textBoxMaterielGroupName.Text.ToString();
            materielType.desc = this.textBoxMaterielGroupDesc.Text.ToString();

            if (materielType.name.Length == 0)
            {
                MessageBoxExtend.messageWarning("组名称不能为空,请重新输入!");
                return;
            }

            MaterielType.getInctance().insert(materielType);


            // 物料组织结构
            MaterielOrgStructTable materielOrgInfo = new MaterielOrgStructTable();

            materielOrgInfo.parentPkey = MaterielOrgStruct.getInctance().getPkeyFromValue(m_materielGroupPkey);
            materielOrgInfo.value      = MaterielType.getInctance().getMaxPkey();
            MaterielOrgStruct.getInctance().insert(materielOrgInfo);
        }